Fix Styler Configurator performance issue considerably
Improve Styler Configurator modification application performance considerably. While one of dockable Panels (Folder as Workspace, for example) is loaded heavily, any action (checkboxes & comboboxes) on Styler Configurator reacts very slowly - for example, check "Bold" in "Font Style". This commit makes difference among the operations, and optimizes each action in Styler Configurator. Fix #12436, close #15560pull/15565/head
parent
c1954e5c44
commit
d84f9b2048
|
@ -8563,7 +8563,7 @@ void Notepad_plus::refreshDarkMode(bool resetStyle)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nppParams.reloadStylers(themePath.c_str());
|
nppParams.reloadStylers(themePath.c_str());
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), WM_UPDATESCINTILLAS, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_UPDATESCINTILLAS, TRUE, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const wchar_t *cmdL
|
||||||
{
|
{
|
||||||
nppGUI._themeName.assign(themePath);
|
nppGUI._themeName.assign(themePath);
|
||||||
nppParams.reloadStylers(themePath.c_str());
|
nppParams.reloadStylers(themePath.c_str());
|
||||||
::SendMessage(_hSelf, WM_UPDATESCINTILLAS, 0, 0);
|
::SendMessage(_hSelf, WM_UPDATESCINTILLAS, TRUE, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2286,6 +2286,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
case WM_UPDATESCINTILLAS:
|
case WM_UPDATESCINTILLAS:
|
||||||
{
|
{
|
||||||
|
bool doChangePanel = (wParam == TRUE);
|
||||||
|
|
||||||
//reset styler for change in Stylers.xml
|
//reset styler for change in Stylers.xml
|
||||||
_mainEditView.defineDocType(_mainEditView.getCurrentBuffer()->getLangType());
|
_mainEditView.defineDocType(_mainEditView.getCurrentBuffer()->getLangType());
|
||||||
_mainEditView.performGlobalStyles();
|
_mainEditView.performGlobalStyles();
|
||||||
|
@ -2313,6 +2315,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
AutoCompletion::drawAutocomplete(_pEditView);
|
AutoCompletion::drawAutocomplete(_pEditView);
|
||||||
AutoCompletion::drawAutocomplete(_pNonEditView);
|
AutoCompletion::drawAutocomplete(_pNonEditView);
|
||||||
|
|
||||||
|
if (doChangePanel) // Theme change
|
||||||
|
{
|
||||||
NppDarkMode::calculateTreeViewStyle();
|
NppDarkMode::calculateTreeViewStyle();
|
||||||
auto refreshOnlyTreeView = static_cast<LPARAM>(TRUE);
|
auto refreshOnlyTreeView = static_cast<LPARAM>(TRUE);
|
||||||
|
|
||||||
|
@ -2370,6 +2374,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
_pFileBrowser->setForegroundColor(pStyle->_fgColor);
|
_pFileBrowser->setForegroundColor(pStyle->_fgColor);
|
||||||
::SendMessage(_pFileBrowser->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, refreshOnlyTreeView);
|
::SendMessage(_pFileBrowser->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, refreshOnlyTreeView);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_pDocMap)
|
if (_pDocMap)
|
||||||
_pDocMap->setSyntaxHiliting();
|
_pDocMap->setSyntaxHiliting();
|
||||||
|
|
|
@ -290,14 +290,14 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
{
|
{
|
||||||
updateUserKeywords();
|
updateUserKeywords();
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply();
|
apply(GENERAL_CHANGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (editID == IDC_USER_EXT_EDIT)
|
else if (editID == IDC_USER_EXT_EDIT)
|
||||||
{
|
{
|
||||||
updateExtension();
|
updateExtension();
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply(false);
|
apply(NO_VISUAL_CHANGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -309,19 +309,19 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
case IDC_BOLD_CHECK :
|
case IDC_BOLD_CHECK :
|
||||||
updateFontStyleStatus(BOLD_STATUS);
|
updateFontStyleStatus(BOLD_STATUS);
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply();
|
apply(GENERAL_CHANGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case IDC_ITALIC_CHECK :
|
case IDC_ITALIC_CHECK :
|
||||||
updateFontStyleStatus(ITALIC_STATUS);
|
updateFontStyleStatus(ITALIC_STATUS);
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply();
|
apply(GENERAL_CHANGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case IDC_UNDERLINE_CHECK :
|
case IDC_UNDERLINE_CHECK :
|
||||||
updateFontStyleStatus(UNDERLINE_STATUS);
|
updateFontStyleStatus(UNDERLINE_STATUS);
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply();
|
apply(GENERAL_CHANGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case IDC_GLOBAL_GOTOSETTINGS_LINK :
|
case IDC_GLOBAL_GOTOSETTINGS_LINK :
|
||||||
|
@ -366,13 +366,13 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
_isThemeDirty = false;
|
_isThemeDirty = false;
|
||||||
setVisualFromStyleList();
|
setVisualFromStyleList();
|
||||||
|
|
||||||
|
|
||||||
//(nppParamInst.getNppGUI())._themeName
|
|
||||||
::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0);
|
::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0);
|
||||||
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
|
::SendMessage(_hParent, WM_UPDATESCINTILLAS, _isThemeChanged, 0);
|
||||||
::SendMessage(_hParent, WM_UPDATEMAINMENUBITMAPS, 0, 0);
|
::SendMessage(_hParent, WM_UPDATEMAINMENUBITMAPS, 0, 0);
|
||||||
|
|
||||||
|
_isThemeChanged = false;
|
||||||
}
|
}
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE/*!_isSync*/);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE);
|
||||||
display(false);
|
display(false);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
@ -391,6 +391,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
_currentThemeIndex = static_cast<int32_t>(::SendMessage(_hSwitch2ThemeCombo, CB_GETCURSEL, 0, 0));
|
_currentThemeIndex = static_cast<int32_t>(::SendMessage(_hSwitch2ThemeCombo, CB_GETCURSEL, 0, 0));
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE);
|
::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE);
|
||||||
_isDirty = false;
|
_isDirty = false;
|
||||||
|
_isThemeChanged = false;
|
||||||
}
|
}
|
||||||
_isThemeDirty = false;
|
_isThemeDirty = false;
|
||||||
auto newSavedFilePath = (NppParameters::getInstance()).writeStyles(_lsArray, _globalStyles);
|
auto newSavedFilePath = (NppParameters::getInstance()).writeStyles(_lsArray, _globalStyles);
|
||||||
|
@ -398,10 +399,11 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
updateThemeName(newSavedFilePath);
|
updateThemeName(newSavedFilePath);
|
||||||
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE);
|
||||||
//_isSync = true;
|
|
||||||
display(false);
|
display(false);
|
||||||
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
|
|
||||||
::SendMessage(_hParent, WM_UPDATEMAINMENUBITMAPS, 0, 0);
|
// With the application of each modification, the following 2 actions (applications) are not necessary
|
||||||
|
//::SendMessage(_hParent, WM_UPDATESCINTILLAS, TRUE, 0);
|
||||||
|
//::SendMessage(_hParent, WM_UPDATEMAINMENUBITMAPS, 0, 0);
|
||||||
|
|
||||||
const wchar_t* fn = ::PathFindFileName(_themeName.c_str());
|
const wchar_t* fn = ::PathFindFileName(_themeName.c_str());
|
||||||
NppDarkMode::setThemeName((!NppDarkMode::isEnabled() && lstrcmp(fn, L"stylers.xml") == 0) ? L"" : fn);
|
NppDarkMode::setThemeName((!NppDarkMode::isEnabled() && lstrcmp(fn, L"stylers.xml") == 0) ? L"" : fn);
|
||||||
|
@ -429,7 +431,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
||||||
glo.enableFg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
glo.enableFg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply();
|
apply(GENERAL_CHANGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +440,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
||||||
glo.enableBg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
glo.enableBg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply();
|
apply(GENERAL_CHANGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,7 +449,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
||||||
glo.enableFont = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
glo.enableFont = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply();
|
apply(GENERAL_CHANGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
case IDC_GLOBAL_FONTSIZE_CHECK :
|
case IDC_GLOBAL_FONTSIZE_CHECK :
|
||||||
|
@ -455,7 +457,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
||||||
glo.enableFontSize = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
glo.enableFontSize = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply();
|
apply(GENERAL_CHANGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
case IDC_GLOBAL_BOLD_CHECK :
|
case IDC_GLOBAL_BOLD_CHECK :
|
||||||
|
@ -463,7 +465,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
||||||
glo.enableBold = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
glo.enableBold = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply();
|
apply(GENERAL_CHANGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,7 +474,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
||||||
glo.enableItalic = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
glo.enableItalic = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply();
|
apply(GENERAL_CHANGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
case IDC_GLOBAL_UNDERLINE_CHECK :
|
case IDC_GLOBAL_UNDERLINE_CHECK :
|
||||||
|
@ -480,7 +482,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
GlobalOverride & glo = (NppParameters::getInstance()).getGlobalOverrideStyle();
|
||||||
glo.enableUnderLine = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
glo.enableUnderLine = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0));
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply();
|
apply(GENERAL_CHANGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,12 +496,12 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
case IDC_FONT_COMBO :
|
case IDC_FONT_COMBO :
|
||||||
updateFontName();
|
updateFontName();
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply();
|
apply(GENERAL_CHANGE);
|
||||||
break;
|
break;
|
||||||
case IDC_FONTSIZE_COMBO :
|
case IDC_FONTSIZE_COMBO :
|
||||||
updateFontSize();
|
updateFontSize();
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
apply();
|
apply(GENERAL_CHANGE);
|
||||||
break;
|
break;
|
||||||
case IDC_LANGUAGES_LIST :
|
case IDC_LANGUAGES_LIST :
|
||||||
{
|
{
|
||||||
|
@ -525,12 +527,15 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
|
|
||||||
case CPN_COLOURPICKED:
|
case CPN_COLOURPICKED:
|
||||||
{
|
{
|
||||||
|
int applicationInfo = getApplicationInfo();
|
||||||
|
int tabColourIndex = whichTabColourIndex();
|
||||||
|
|
||||||
if (reinterpret_cast<HWND>(lParam) == _pFgColour->getHSelf())
|
if (reinterpret_cast<HWND>(lParam) == _pFgColour->getHSelf())
|
||||||
{
|
{
|
||||||
updateColour(C_FOREGROUND);
|
updateColour(C_FOREGROUND);
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
int tabColourIndex;
|
|
||||||
if ((tabColourIndex = whichTabColourIndex()) != -1)
|
if (tabColourIndex != -1)
|
||||||
{
|
{
|
||||||
TabBarPlus::setColour(_pFgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex, nullptr);
|
TabBarPlus::setColour(_pFgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex, nullptr);
|
||||||
}
|
}
|
||||||
|
@ -538,15 +543,16 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
{
|
{
|
||||||
ViewZoneDlg::setColour(_pFgColour->getColour(), ViewZoneDlg::ViewZoneColorIndex::focus);
|
ViewZoneDlg::setColour(_pFgColour->getColour(), ViewZoneDlg::ViewZoneColorIndex::focus);
|
||||||
}
|
}
|
||||||
apply();
|
apply(applicationInfo);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (reinterpret_cast<HWND>(lParam) == _pBgColour->getHSelf())
|
else if (reinterpret_cast<HWND>(lParam) == _pBgColour->getHSelf())
|
||||||
{
|
{
|
||||||
updateColour(C_BACKGROUND);
|
updateColour(C_BACKGROUND);
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
int tabColourIndex;
|
|
||||||
if ((tabColourIndex = whichTabColourIndex()) != -1)
|
|
||||||
|
if (tabColourIndex != -1)
|
||||||
{
|
{
|
||||||
tabColourIndex = (tabColourIndex == TabBarPlus::inactiveText ? TabBarPlus::inactiveBg : tabColourIndex);
|
tabColourIndex = (tabColourIndex == TabBarPlus::inactiveText ? TabBarPlus::inactiveBg : tabColourIndex);
|
||||||
TabBarPlus::setColour(_pBgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex, nullptr);
|
TabBarPlus::setColour(_pBgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex, nullptr);
|
||||||
|
@ -569,7 +575,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply();
|
apply(applicationInfo);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -633,7 +639,7 @@ void WordStyleDlg::updateThemeName(const wstring& themeName)
|
||||||
nppGUI._themeName.assign( themeName );
|
nppGUI._themeName.assign( themeName );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WordStyleDlg::getStyleName(wchar_t *styleName, const size_t styleNameLen)
|
bool WordStyleDlg::getStyleName(wchar_t *styleName, const size_t styleNameLen) const
|
||||||
{
|
{
|
||||||
auto i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0);
|
auto i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0);
|
||||||
if (i == LB_ERR)
|
if (i == LB_ERR)
|
||||||
|
@ -648,7 +654,40 @@ bool WordStyleDlg::getStyleName(wchar_t *styleName, const size_t styleNameLen)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WordStyleDlg::whichTabColourIndex()
|
int WordStyleDlg::getApplicationInfo() const
|
||||||
|
{
|
||||||
|
constexpr size_t styleNameLen = 128;
|
||||||
|
wchar_t styleName[styleNameLen + 1] = { '\0' };
|
||||||
|
|
||||||
|
if (!WordStyleDlg::getStyleName(styleName, styleNameLen))
|
||||||
|
{
|
||||||
|
return NO_VISUAL_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lstrcmp(styleName, L"Default Style") == 0)
|
||||||
|
return (GENERAL_CHANGE | THEME_CHANGE);
|
||||||
|
|
||||||
|
if ((lstrcmp(styleName, L"Mark Style 1") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Mark Style 2") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Mark Style 3") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Mark Style 4") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Mark Style 5") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Tab color 1") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Tab color 2") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Tab color 3") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Tab color 4") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Tab color 5") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Tab color dark mode 1") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Tab color dark mode 2") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Tab color dark mode 3") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Tab color dark mode 4") == 0) ||
|
||||||
|
(lstrcmp(styleName, L"Tab color dark mode 5") == 0))
|
||||||
|
return (GENERAL_CHANGE | COLOR_CHANGE_4_MENU);
|
||||||
|
|
||||||
|
return GENERAL_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int WordStyleDlg::whichTabColourIndex() const
|
||||||
{
|
{
|
||||||
constexpr size_t styleNameLen = 128;
|
constexpr size_t styleNameLen = 128;
|
||||||
wchar_t styleName[styleNameLen + 1] = { '\0' };
|
wchar_t styleName[styleNameLen + 1] = { '\0' };
|
||||||
|
@ -880,7 +919,7 @@ void WordStyleDlg::applyCurrentSelectedThemeAndUpdateUI()
|
||||||
setVisualFromStyleList();
|
setVisualFromStyleList();
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
_isThemeDirty = false;
|
_isThemeDirty = false;
|
||||||
apply();
|
apply(GENERAL_CHANGE | THEME_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WordStyleDlg::selectThemeByName(const wchar_t* themeName)
|
bool WordStyleDlg::selectThemeByName(const wchar_t* themeName)
|
||||||
|
@ -1319,8 +1358,7 @@ void WordStyleDlg::restoreGlobalOverrideValues()
|
||||||
gOverride = _gOverride2restored;
|
gOverride = _gOverride2restored;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WordStyleDlg::apply(int applicationInfo)
|
||||||
void WordStyleDlg::apply(bool needVisualApply)
|
|
||||||
{
|
{
|
||||||
LexerStylerArray & lsa = (NppParameters::getInstance()).getLStylerArray();
|
LexerStylerArray & lsa = (NppParameters::getInstance()).getLStylerArray();
|
||||||
lsa = _lsArray;
|
lsa = _lsArray;
|
||||||
|
@ -1328,11 +1366,13 @@ void WordStyleDlg::apply(bool needVisualApply)
|
||||||
StyleArray & globalStyles = (NppParameters::getInstance()).getGlobalStylers();
|
StyleArray & globalStyles = (NppParameters::getInstance()).getGlobalStylers();
|
||||||
globalStyles = _globalStyles;
|
globalStyles = _globalStyles;
|
||||||
|
|
||||||
if (needVisualApply)
|
if ((applicationInfo & THEME_CHANGE) != 0)
|
||||||
{
|
_isThemeChanged = true;
|
||||||
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
|
|
||||||
|
if (applicationInfo & GENERAL_CHANGE || applicationInfo & THEME_CHANGE)
|
||||||
|
::SendMessage(_hParent, WM_UPDATESCINTILLAS, (applicationInfo & THEME_CHANGE) != 0, 0);
|
||||||
|
if (applicationInfo & COLOR_CHANGE_4_MENU)
|
||||||
::SendMessage(_hParent, WM_UPDATEMAINMENUBITMAPS, 0, 0);
|
::SendMessage(_hParent, WM_UPDATEMAINMENUBITMAPS, 0, 0);
|
||||||
}
|
|
||||||
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE);
|
::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,14 @@
|
||||||
#include "Parameters.h"
|
#include "Parameters.h"
|
||||||
|
|
||||||
|
|
||||||
#define WM_UPDATESCINTILLAS (WORDSTYLE_USER + 1) //GlobalStyleDlg's msg 2 send 2 its parent
|
#define WM_UPDATESCINTILLAS (WORDSTYLE_USER + 1) // WM_UPDATESCINTILLAS (BOOL doChangePanel, 0)
|
||||||
#define WM_UPDATEMAINMENUBITMAPS (WORDSTYLE_USER + 2)
|
#define WM_UPDATEMAINMENUBITMAPS (WORDSTYLE_USER + 2)
|
||||||
|
|
||||||
|
#define NO_VISUAL_CHANGE 0x00
|
||||||
|
#define GENERAL_CHANGE 0x01
|
||||||
|
#define THEME_CHANGE 0x02
|
||||||
|
#define COLOR_CHANGE_4_MENU 0x04
|
||||||
|
|
||||||
enum fontStyleType {BOLD_STATUS, ITALIC_STATUS, UNDERLINE_STATUS};
|
enum fontStyleType {BOLD_STATUS, ITALIC_STATUS, UNDERLINE_STATUS};
|
||||||
|
|
||||||
const bool C_FOREGROUND = false;
|
const bool C_FOREGROUND = false;
|
||||||
|
@ -67,7 +72,6 @@ public :
|
||||||
void prepare2Cancel();
|
void prepare2Cancel();
|
||||||
void redraw(bool forceUpdate = false) const override;
|
void redraw(bool forceUpdate = false) const override;
|
||||||
void restoreGlobalOverrideValues();
|
void restoreGlobalOverrideValues();
|
||||||
void apply(bool needVisualApply = true);
|
|
||||||
void addLastThemeEntry();
|
void addLastThemeEntry();
|
||||||
bool selectThemeByName(const wchar_t* themeName);
|
bool selectThemeByName(const wchar_t* themeName);
|
||||||
bool goToSection(const wchar_t* sectionNames); // sectionNames is formed as following: "Language name:Style name"
|
bool goToSection(const wchar_t* sectionNames); // sectionNames is formed as following: "Language name:Style name"
|
||||||
|
@ -109,6 +113,7 @@ private :
|
||||||
bool _isDirty = false;
|
bool _isDirty = false;
|
||||||
bool _isThemeDirty = false;
|
bool _isThemeDirty = false;
|
||||||
bool _isShownGOCtrls = false;
|
bool _isShownGOCtrls = false;
|
||||||
|
bool _isThemeChanged = false;
|
||||||
|
|
||||||
std::pair<intptr_t, intptr_t> goToPreferencesSettings();
|
std::pair<intptr_t, intptr_t> goToPreferencesSettings();
|
||||||
|
|
||||||
|
@ -116,10 +121,12 @@ private :
|
||||||
|
|
||||||
Style& getCurrentStyler();
|
Style& getCurrentStyler();
|
||||||
|
|
||||||
bool getStyleName(wchar_t *styleName, const size_t styleNameLen);
|
bool getStyleName(wchar_t *styleName, const size_t styleNameLen) const;
|
||||||
|
|
||||||
int whichTabColourIndex();
|
int whichTabColourIndex() const;
|
||||||
int whichIndividualTabColourId();
|
int whichIndividualTabColourId();
|
||||||
|
void apply(int applicationInfo);
|
||||||
|
int getApplicationInfo() const;
|
||||||
bool isDocumentMapStyle();
|
bool isDocumentMapStyle();
|
||||||
void move2CtrlRight(int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight);
|
void move2CtrlRight(int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight);
|
||||||
void updateColour(bool which);
|
void updateColour(bool which);
|
||||||
|
|
Loading…
Reference in New Issue