From dee59a4ce79e9f08f07f5a0f9ac5ded500efa76a Mon Sep 17 00:00:00 2001 From: donho Date: Thu, 30 Aug 2007 00:06:19 +0000 Subject: [PATCH] [UPDATE] Remove apply button in Stylers configurator. Now the visual effect is update immediately. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@19 f5eea248-9336-0410-98b8-ebc06183d4e3 --- .../WinControls/ColourPicker/WordStyleDlg.cpp | 28 +++++++++++++++++++ .../WinControls/ColourPicker/WordStyleDlg.h | 2 ++ .../WinControls/ColourPicker/WordStyleDlg.rc | 4 +-- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index 955648ca..d1c56679 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -159,6 +159,7 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar { updateUserKeywords(); notifyDataModified(); + apply(); } else if (editID == IDC_USER_EXT_EDIT) { @@ -173,16 +174,19 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar case IDC_BOLD_CHECK : updateFontStyleStatus(BOLD_STATUS); notifyDataModified(); + apply(); break; case IDC_ITALIC_CHECK : updateFontStyleStatus(ITALIC_STATUS); notifyDataModified(); + apply(); break; case IDC_UNDERLINE_CHECK : updateFontStyleStatus(UNDERLINE_STATUS); notifyDataModified(); + apply(); break; case IDCANCEL : @@ -254,6 +258,7 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableFg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); + apply(); return TRUE; } @@ -262,6 +267,7 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableBg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); + apply(); return TRUE; } @@ -270,6 +276,7 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableFont = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); + apply(); return TRUE; } case IDC_GLOBAL_FONTSIZE_CHECK : @@ -277,6 +284,7 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableFontSize = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); + apply(); return TRUE; } case IDC_GLOBAL_BOLD_CHECK : @@ -284,6 +292,7 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableBold = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); + apply(); return TRUE; } @@ -292,6 +301,7 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableItalic = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); + apply(); return TRUE; } case IDC_GLOBAL_UNDERLINE_CHECK : @@ -299,6 +309,7 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle(); glo.enableUnderLine = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0)); notifyDataModified(); + apply(); return TRUE; } @@ -312,10 +323,12 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar case IDC_FONT_COMBO : updateFontName(); notifyDataModified(); + apply(); break; case IDC_FONTSIZE_COMBO : updateFontSize(); notifyDataModified(); + apply(); break; case IDC_LANGUAGES_LIST : { @@ -337,12 +350,14 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar { updateColour(C_FOREGROUND); notifyDataModified(); + apply(); return TRUE; } else if ((HWND)lParam == _pBgColour->getHSelf()) { updateColour(C_BACKGROUND); notifyDataModified(); + apply(); return TRUE; } else @@ -666,3 +681,16 @@ void WordStyleDlg::create(int dialogID, bool isRTL) } } +void WordStyleDlg::apply() +{ + LexerStylerArray & lsa = (NppParameters::getInstance())->getLStylerArray(); + StyleArray & globalStyles = (NppParameters::getInstance())->getGlobalStylers(); + + lsa = _lsArray; + globalStyles = _globalStyles; + + ::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE); + _isDirty = false; + _isSync = false; + ::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0); +} \ No newline at end of file diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h index c7eb6350..8b56e411 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h @@ -86,6 +86,8 @@ public : ::UpdateWindow(_hStyleInfoStaticText); }; + void apply(); + private : diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.rc b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.rc index 52703de0..a3a7fcae 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.rc +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.rc @@ -54,8 +54,8 @@ BEGIN LTEXT "User Define keywords",IDC_USER_KEYWORDS_STATIC,349,116,126,8 LTEXT "+",IDC_PLUSSYMBOL_STATIC,335,142,8,8 PUSHBUTTON "Cancel",IDCANCEL,332,198,57,14 - PUSHBUTTON "Apply",IDOK,264,198,60,14 - PUSHBUTTON "Save && Close",IDC_SAVECLOSE_BUTTON,188,198,69,14 + //PUSHBUTTON "Apply",IDOK,264,198,60,14 + PUSHBUTTON "Save && Close",IDC_SAVECLOSE_BUTTON,255,198,69,14 CONTROL "",IDC_SC_PERCENTAGE_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | NOT WS_VISIBLE | WS_TABSTOP,441,208,53,10 CONTROL "Transparency",IDC_SC_TRANSPARENT_CHECK,"Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,431,197,63, 10 LISTBOX IDC_LANGUAGES_LIST,17,22,59,146,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP