From 11ad9f699a29c13b5de22c741dd8200b3543591b Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sat, 25 Jul 2015 17:25:10 +0200 Subject: [PATCH] [BUG_FIXED] Fix a regression of Preferences dialog (closes #570) In v6.8, some options in Preferences dialog are not applied dynamically. This fix makes them work again. --- PowerEditor/src/Notepad_plus.cpp | 90 -------------------------------- PowerEditor/src/Notepad_plus.h | 1 - PowerEditor/src/NppBigSwitch.cpp | 7 +-- PowerEditor/src/NppCommands.cpp | 83 +++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 97 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 1a9236f1..46fe2b36 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2502,96 +2502,6 @@ void Notepad_plus::maintainIndentation(TCHAR ch) } } -void Notepad_plus::specialCmd(int id) -{ - NppParameters *pNppParam = NppParameters::getInstance(); - - switch (id) - { - case IDM_VIEW_LINENUMBER: - case IDM_VIEW_SYMBOLMARGIN: - case IDM_VIEW_DOCCHANGEMARGIN: - { - int margin; - if (id == IDM_VIEW_LINENUMBER) - margin = ScintillaEditView::_SC_MARGE_LINENUMBER; - else //if (id == IDM_VIEW_SYMBOLMARGIN) - margin = ScintillaEditView::_SC_MARGE_SYBOLE; - - if (_mainEditView.hasMarginShowed(margin)) - { - _mainEditView.showMargin(margin, false); - _subEditView.showMargin(margin, false); - } - else - { - _mainEditView.showMargin(margin); - _subEditView.showMargin(margin); - } - break; - } - - case IDM_VIEW_FOLDERMAGIN_SIMPLE: - case IDM_VIEW_FOLDERMAGIN_ARROW: - case IDM_VIEW_FOLDERMAGIN_CIRCLE: - case IDM_VIEW_FOLDERMAGIN_BOX: - case IDM_VIEW_FOLDERMAGIN: - { - folderStyle fStyle = (id == IDM_VIEW_FOLDERMAGIN_SIMPLE)?FOLDER_STYLE_SIMPLE:\ - (id == IDM_VIEW_FOLDERMAGIN_ARROW)?FOLDER_STYLE_ARROW:\ - (id == IDM_VIEW_FOLDERMAGIN_CIRCLE)?FOLDER_STYLE_CIRCLE:\ - (id == IDM_VIEW_FOLDERMAGIN)?FOLDER_STYLE_NONE:FOLDER_STYLE_BOX; - - _mainEditView.setMakerStyle(fStyle); - _subEditView.setMakerStyle(fStyle); - break; - } - - case IDM_VIEW_CURLINE_HILITING: - { - COLORREF colour = pNppParam->getCurLineHilitingColour(); - _mainEditView.setCurrentLineHiLiting(!_pEditView->isCurrentLineHiLiting(), colour); - _subEditView.setCurrentLineHiLiting(!_pEditView->isCurrentLineHiLiting(), colour); - break; - } - - case IDM_VIEW_EDGEBACKGROUND: - case IDM_VIEW_EDGELINE: - case IDM_VIEW_EDGENONE: - { - int mode; - switch (id) - { - case IDM_VIEW_EDGELINE: - { - mode = EDGE_LINE; - break; - } - case IDM_VIEW_EDGEBACKGROUND: - { - mode = EDGE_BACKGROUND; - break; - } - default : - mode = EDGE_NONE; - } - _mainEditView.execute(SCI_SETEDGEMODE, mode); - _subEditView.execute(SCI_SETEDGEMODE, mode); - break; - } - - case IDM_VIEW_LWDEF: - case IDM_VIEW_LWALIGN: - case IDM_VIEW_LWINDENT: - { - int mode = (id == IDM_VIEW_LWALIGN)?SC_WRAPINDENT_SAME:\ - (id == IDM_VIEW_LWINDENT)?SC_WRAPINDENT_INDENT:SC_WRAPINDENT_FIXED; - _mainEditView.execute(SCI_SETWRAPINDENTMODE, mode); - _subEditView.execute(SCI_SETWRAPINDENTMODE, mode); - break; - } - } -} BOOL Notepad_plus::processIncrFindAccel(MSG *msg) const { diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index e53f0d16..dedba92d 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -441,7 +441,6 @@ private: FunctionListPanel *_pFuncList; BOOL notify(SCNotification *notification); - void specialCmd(int id); void command(int id); //Document management diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 9298787d..001d1102 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -529,12 +529,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa } else { - if ((lParam == 1) || (lParam == 2)) - { - specialCmd(LOWORD(wParam)); - } - else - command(LOWORD(wParam)); + command(LOWORD(wParam)); } } return TRUE; diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 26296412..cc1d328d 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -2581,6 +2581,89 @@ void Notepad_plus::command(int id) } break; + case IDM_VIEW_LINENUMBER: + case IDM_VIEW_SYMBOLMARGIN: + case IDM_VIEW_DOCCHANGEMARGIN: + { + int margin; + if (id == IDM_VIEW_LINENUMBER) + margin = ScintillaEditView::_SC_MARGE_LINENUMBER; + else //if (id == IDM_VIEW_SYMBOLMARGIN) + margin = ScintillaEditView::_SC_MARGE_SYBOLE; + + if (_mainEditView.hasMarginShowed(margin)) + { + _mainEditView.showMargin(margin, false); + _subEditView.showMargin(margin, false); + } + else + { + _mainEditView.showMargin(margin); + _subEditView.showMargin(margin); + } + } + break; + + case IDM_VIEW_FOLDERMAGIN_SIMPLE: + case IDM_VIEW_FOLDERMAGIN_ARROW: + case IDM_VIEW_FOLDERMAGIN_CIRCLE: + case IDM_VIEW_FOLDERMAGIN_BOX: + case IDM_VIEW_FOLDERMAGIN: + { + folderStyle fStyle = (id == IDM_VIEW_FOLDERMAGIN_SIMPLE) ? FOLDER_STYLE_SIMPLE : \ + (id == IDM_VIEW_FOLDERMAGIN_ARROW) ? FOLDER_STYLE_ARROW : \ + (id == IDM_VIEW_FOLDERMAGIN_CIRCLE) ? FOLDER_STYLE_CIRCLE : \ + (id == IDM_VIEW_FOLDERMAGIN) ? FOLDER_STYLE_NONE : FOLDER_STYLE_BOX; + + _mainEditView.setMakerStyle(fStyle); + _subEditView.setMakerStyle(fStyle); + } + break; + + case IDM_VIEW_CURLINE_HILITING: + { + COLORREF colour = (NppParameters::getInstance())->getCurLineHilitingColour(); + _mainEditView.setCurrentLineHiLiting(!_pEditView->isCurrentLineHiLiting(), colour); + _subEditView.setCurrentLineHiLiting(!_pEditView->isCurrentLineHiLiting(), colour); + } + break; + + case IDM_VIEW_EDGEBACKGROUND: + case IDM_VIEW_EDGELINE: + case IDM_VIEW_EDGENONE: + { + int mode; + switch (id) + { + case IDM_VIEW_EDGELINE: + { + mode = EDGE_LINE; + break; + } + case IDM_VIEW_EDGEBACKGROUND: + { + mode = EDGE_BACKGROUND; + break; + } + default: + mode = EDGE_NONE; + } + _mainEditView.execute(SCI_SETEDGEMODE, mode); + _subEditView.execute(SCI_SETEDGEMODE, mode); + } + break; + + case IDM_VIEW_LWDEF: + case IDM_VIEW_LWALIGN: + case IDM_VIEW_LWINDENT: + { + int mode = (id == IDM_VIEW_LWALIGN) ? SC_WRAPINDENT_SAME : \ + (id == IDM_VIEW_LWINDENT) ? SC_WRAPINDENT_INDENT : SC_WRAPINDENT_FIXED; + _mainEditView.execute(SCI_SETWRAPINDENTMODE, mode); + _subEditView.execute(SCI_SETWRAPINDENTMODE, mode); + } + break; + default : if (id > IDM_FILEMENU_LASTONE && id < (IDM_FILEMENU_LASTONE + _lastRecentFileList.getMaxNbLRF() + 1)) {