From d23e8c74c53ec3eac6c8691c85c584528f0b1607 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 21 Feb 2010 02:05:46 +0000 Subject: [PATCH] [BUG_FIXED] Fix the bug while changing the language list in Style Configurator, the "Save and close" button is enabled. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@616 f5eea248-9336-0410-98b8-ebc06183d4e3 --- .../src/WinControls/ColourPicker/WordStyleDlg.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index 372164fb7..99dde9bcb 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -657,7 +657,17 @@ void WordStyleDlg::setStyleListFromLexer(int index) const TCHAR *ext = NppParameters::getInstance()->getLangExtFromName(langName); const TCHAR *userExt = (_lsArray.getLexerStylerByName(langName))->getLexerUserExt(); ::SendDlgItemMessage(_hSelf, IDC_DEF_EXT_EDIT, WM_SETTEXT, 0, (LPARAM)(ext)); + + // WM_SETTEXT cause sending WM_COMMAND message with EN_CHANGE. + // That makes status dirty, even it shouldn't in this case. + // The walk around solution is get the current status before sending WM_SETTEXT, + // then restore the status after sending this message. + bool isDirty = _isDirty; + bool isThemeDirty = _isThemeDirty; ::SendDlgItemMessage(_hSelf, IDC_USER_EXT_EDIT, WM_SETTEXT, 0, (LPARAM)(userExt)); + _isDirty = isDirty; + _isThemeDirty = isThemeDirty; + ::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), isDirty || isThemeDirty); } ::ShowWindow(::GetDlgItem(_hSelf, IDC_DEF_EXT_EDIT), index?SW_SHOW:SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_DEF_EXT_STATIC), index?SW_SHOW:SW_HIDE);