[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.
This commit is contained in:
Don Ho 2015-07-25 17:25:10 +02:00
parent 809500f1cd
commit 11ad9f699a
4 changed files with 84 additions and 97 deletions

View File

@ -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 BOOL Notepad_plus::processIncrFindAccel(MSG *msg) const
{ {

View File

@ -441,7 +441,6 @@ private:
FunctionListPanel *_pFuncList; FunctionListPanel *_pFuncList;
BOOL notify(SCNotification *notification); BOOL notify(SCNotification *notification);
void specialCmd(int id);
void command(int id); void command(int id);
//Document management //Document management

View File

@ -529,12 +529,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
} }
else else
{ {
if ((lParam == 1) || (lParam == 2)) command(LOWORD(wParam));
{
specialCmd(LOWORD(wParam));
}
else
command(LOWORD(wParam));
} }
} }
return TRUE; return TRUE;

View File

@ -2581,6 +2581,89 @@ void Notepad_plus::command(int id)
} }
break; 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 : default :
if (id > IDM_FILEMENU_LASTONE && id < (IDM_FILEMENU_LASTONE + _lastRecentFileList.getMaxNbLRF() + 1)) if (id > IDM_FILEMENU_LASTONE && id < (IDM_FILEMENU_LASTONE + _lastRecentFileList.getMaxNbLRF() + 1))
{ {