From e402928e45f071975017de4c65698506389a809c Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 2 Jun 2014 19:54:10 +0000 Subject: [PATCH] [NEW] Add warning text if settings on cloud option has been changed. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1243 f5eea248-9336-0410-98b8-ebc06183d4e3 --- .../src/WinControls/Preference/preference.rc | 1 + .../WinControls/Preference/preferenceDlg.cpp | 23 +++++++------------ .../WinControls/Preference/preferenceDlg.h | 4 +++- .../WinControls/Preference/preference_rc.h | 5 ++-- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index 144bd5d59..f063692f7 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -377,5 +377,6 @@ BEGIN GROUPBOX "Settings on cloud",IDC_SETTINGSONCLOUD_GB_STATIC,89,44,268,89,BS_CENTER CONTROL "Dropbox",IDD_SETTINGSONCLOUD_DROPBOX_CHECK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,60,160,10 + LTEXT "",IDC_SETTINGSONCLOUD_WARNING_STATIC,132,75,135,8 END diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 01fcd817c..b6438013e 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -2795,6 +2795,12 @@ BOOL CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARA case WM_INITDIALOG : { CloudChoice cloudChoice = nppGUI._cloudChoice; + initialCloudChoice = nppGUI._cloudChoice; +/* + COLORREF bgColor = getCtrlBgColor(_hSelf); + SetTextColor(hdcStatic, RGB(255, 0, 0)); + SetBkColor(hdcStatic, RGB(GetRValue(bgColor) - 30, GetGValue(bgColor) - 30, GetBValue(bgColor) - 30)); +*/ ::SendDlgItemMessage(_hSelf, IDD_SETTINGSONCLOUD_DROPBOX_CHECK, BM_SETCHECK, cloudChoice == dropbox?BST_CHECKED:BST_UNCHECKED, 0); ::EnableWindow(::GetDlgItem(_hSelf, IDD_SETTINGSONCLOUD_DROPBOX_CHECK), (nppGUI._availableClouds & DROPBOX_AVAILABLE) != 0); } @@ -2810,26 +2816,13 @@ BOOL CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARA if (nppGUI._cloudChoice == dropbox) { setCloudChoice("dropbox"); - /* - // files on cloud can never be erased or modified while setting cloud - if (!hasSettingsFilesInDropBox()) - { - // it's the first time to set Notepad++ settings on cloud - changeSettingsFilesPath(); - - } - else - { - // Notepad++ settings are already on cloud - askForRestarting(); - } - */ } else { removeCloudChoice(); - //changeSettingsFilesPath(); } + generic_string message = initialCloudChoice != nppGUI._cloudChoice?TEXT("Please restart Notepad++ to take effect."):TEXT(""); + ::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str()); } break; diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.h b/PowerEditor/src/WinControls/Preference/preferenceDlg.h index 7b71022c0..0c451842f 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.h +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.h @@ -216,9 +216,11 @@ private : class SettingsOnCloudDlg : public StaticDialog { public : - SettingsOnCloudDlg() {}; + SettingsOnCloudDlg(): initialCloudChoice(noCloud) {}; private : + CloudChoice initialCloudChoice; + BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); void setCloudChoice(const char *choice); void removeCloudChoice(); diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h index 7a8cd4401..90a6e4f15 100644 --- a/PowerEditor/src/WinControls/Preference/preference_rc.h +++ b/PowerEditor/src/WinControls/Preference/preference_rc.h @@ -124,8 +124,9 @@ #define IDD_STATIC_BLABLA2NDLINE (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 8) #define IDD_PREFERENCE_SETTINGSONCLOUD_BOX 6260 //(IDD_PREFERENCE_BOX + 250) - #define IDC_SETTINGSONCLOUD_GB_STATIC (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 1) - #define IDD_SETTINGSONCLOUD_DROPBOX_CHECK (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 2) + #define IDC_SETTINGSONCLOUD_WARNING_STATIC (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 1) + #define IDC_SETTINGSONCLOUD_GB_STATIC (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 2) + #define IDD_SETTINGSONCLOUD_DROPBOX_CHECK (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 3) #define IDD_PREFERENCE_SETTING_BOX 6300 //(IDD_PREFERENCE_BOX + 300) #define IDC_TABSETTING_GB_STATIC (IDD_PREFERENCE_SETTING_BOX + 1)