From 0ee65fd82687d741220739cec04b89c2247dd4eb Mon Sep 17 00:00:00 2001 From: Don Ho Date: Wed, 13 Apr 2022 04:38:39 +0200 Subject: [PATCH] Fix x64 build error in 3f1a582a36db175a4f86b35dcd47f3aa5bf331fa Fix x64 build error, remove unnecessary codes and add enhancement for the previous commit 3f1a582a36db175a4f86b35dcd47f3aa5bf331fa --- .../installer/themes/DarkModeDefault.xml | 4 -- PowerEditor/src/Notepad_plus.cpp | 52 ++---------------- PowerEditor/src/Notepad_plus.h | 1 - PowerEditor/src/NppBigSwitch.cpp | 1 - PowerEditor/src/NppDarkMode.cpp | 4 +- .../src/ScintillaComponent/AutoCompletion.h | 5 -- .../WinControls/ColourPicker/WordStyleDlg.cpp | 54 ------------------- .../WinControls/ColourPicker/WordStyleDlg.h | 1 - PowerEditor/src/stylers.model.xml | 4 -- 9 files changed, 6 insertions(+), 120 deletions(-) diff --git a/PowerEditor/installer/themes/DarkModeDefault.xml b/PowerEditor/installer/themes/DarkModeDefault.xml index 71ff64c2c..9d5064ef0 100644 --- a/PowerEditor/installer/themes/DarkModeDefault.xml +++ b/PowerEditor/installer/themes/DarkModeDefault.xml @@ -1444,9 +1444,5 @@ License: GPL2 - - - - diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index b75ff0128..1da2c9dc9 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -370,7 +370,6 @@ LRESULT Notepad_plus::init(HWND hwnd) // Autocomplete list and calltip drawAutocompleteColoursFromTheme(); - drawAutocompleteColoursFromStylerArray(); AutoCompletion::drawAutocomplete(_pEditView); AutoCompletion::drawAutocomplete(_pNonEditView); @@ -5851,6 +5850,10 @@ void Notepad_plus::drawAutocompleteColoursFromTheme() int bfv = GetBValue(pStyle->_fgColor); COLORREF bgDarker = RGB(rbv - 20 <= 0 ? 0 : rbv - 20, gbv - 20 <= 0 ? 0 : gbv - 20, bbv - 20 <= 0 ? 0 : bbv - 20); + + if (pStyle->_bgColor == RGB(0, 0, 0)) // if the bg is pure black + bgDarker = RGB(20, 20, 20); // make bgDarker lighter for distinguishing between both + COLORREF fgDarker = RGB(rfv - 20 <= 0 ? 0 : rfv - 20, gfv - 20 <= 0 ? 0 : gfv - 20, bfv - 20 <= 0 ? 0 : bfv - 20); COLORREF fgLigher = RGB(rfv + 20 >= 255 ? 255 : rfv + 20, gfv + 20 >= 255 ? 255 : gfv + 20, bfv + 20 >= 255 ? 255 : bfv + 20); @@ -5864,53 +5867,6 @@ void Notepad_plus::drawAutocompleteColoursFromTheme() AutoCompletion::setColour(fgLigher, AutoCompletion::AutocompleteColorIndex::calltipHighlight); } } -void Notepad_plus::drawAutocompleteColoursFromStylerArray() -{ - Style* stAcList = getStyleFromName(AUTOCOMPLETE_LIST); - if (stAcList) - { - if (static_cast(stAcList->_fgColor) != -1) - { - AutoCompletion::setColour(stAcList->_fgColor, AutoCompletion::AutocompleteColorIndex::autocompleteText); - } - if (static_cast(stAcList->_bgColor) != -1) - { - AutoCompletion::setColour(stAcList->_bgColor, AutoCompletion::AutocompleteColorIndex::autocompleteBg); - } - } - - Style* stAcSelected = getStyleFromName(AUTOCOMPLETE_SELECT); - if (stAcSelected) - { - if (static_cast(stAcSelected->_fgColor) != -1) - { - AutoCompletion::setColour(stAcSelected->_fgColor, AutoCompletion::AutocompleteColorIndex::selectedText); - } - if (static_cast(stAcSelected->_bgColor) != -1) - { - AutoCompletion::setColour(stAcSelected->_bgColor, AutoCompletion::AutocompleteColorIndex::selectedBg); - } - } - - Style* stCalltip = getStyleFromName(AUTOCOMPLETE_CALLTIP); - if (stCalltip) - { - if (static_cast(stCalltip->_fgColor) != -1) - { - AutoCompletion::setColour(stCalltip->_fgColor, AutoCompletion::AutocompleteColorIndex::calltipText); - } - if (static_cast(stCalltip->_bgColor) != -1) - { - AutoCompletion::setColour(stCalltip->_bgColor, AutoCompletion::AutocompleteColorIndex::calltipBg); - } - } - - Style* stCalltipHl = getStyleFromName(AUTOCOMPLETE_CALLTIP_HIGHLIGHT); - if (stCalltipHl && static_cast(stCalltipHl->_fgColor) != -1) - { - AutoCompletion::setColour(stCalltipHl->_fgColor, AutoCompletion::AutocompleteColorIndex::calltipHighlight); - } -} void Notepad_plus::drawDocumentMapColoursFromStylerArray() { diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 2cc6234de..3c1557c1c 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -586,7 +586,6 @@ private: bool dumpFiles(const TCHAR * outdir, const TCHAR * fileprefix = TEXT("")); //helper func void drawTabbarColoursFromStylerArray(); void drawAutocompleteColoursFromTheme(); - void drawAutocompleteColoursFromStylerArray(); void drawDocumentMapColoursFromStylerArray(); std::vector loadCommandlineParams(const TCHAR * commandLine, const CmdLineParams * pCmdParams) { diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index f3d06b4b3..75e430dd6 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -1870,7 +1870,6 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa drawDocumentMapColoursFromStylerArray(); drawAutocompleteColoursFromTheme(); - drawAutocompleteColoursFromStylerArray(); AutoCompletion::drawAutocomplete(_pEditView); AutoCompletion::drawAutocomplete(_pNonEditView); diff --git a/PowerEditor/src/NppDarkMode.cpp b/PowerEditor/src/NppDarkMode.cpp index 01f57e52c..b93ccb1b1 100644 --- a/PowerEditor/src/NppDarkMode.cpp +++ b/PowerEditor/src/NppDarkMode.cpp @@ -1707,7 +1707,7 @@ namespace NppDarkMode (wcscmp(className, WC_LISTBOX) == 0)) { NppDarkMode::setDarkScrollBar(hwnd); - ::EnumChildWindows(hwnd, getAutocompleHandleProc, 0); + ::EnumChildWindows(hwnd, (WNDENUMPROC)getAutocompleHandleProc, 0); } return TRUE; @@ -1716,7 +1716,7 @@ namespace NppDarkMode // set dark scrollbar for autocomplete list void setDarkAutoCompletion() { - ::EnumThreadWindows(::GetCurrentThreadId(), getAutocompleHandleProc, 0); + ::EnumThreadWindows(::GetCurrentThreadId(), (WNDENUMPROC)getAutocompleHandleProc, 0); } LRESULT onCtlColor(HDC hdc) diff --git a/PowerEditor/src/ScintillaComponent/AutoCompletion.h b/PowerEditor/src/ScintillaComponent/AutoCompletion.h index ca62cc3fb..864a9298e 100644 --- a/PowerEditor/src/ScintillaComponent/AutoCompletion.h +++ b/PowerEditor/src/ScintillaComponent/AutoCompletion.h @@ -24,11 +24,6 @@ const size_t tagMaxLen = 256; class ScintillaEditView; -constexpr TCHAR AUTOCOMPLETE_LIST[64] = TEXT("Autocomplete list"); -constexpr TCHAR AUTOCOMPLETE_SELECT[64] = TEXT("Autocomplete selected item"); -constexpr TCHAR AUTOCOMPLETE_CALLTIP[64] = TEXT("Calltip"); -constexpr TCHAR AUTOCOMPLETE_CALLTIP_HIGHLIGHT[64] = TEXT("Calltip highlighted text"); - struct MatchedCharInserted { MatchedCharInserted() = delete; char _c; diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index 8c3486202..466801d1e 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -511,7 +511,6 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM updateColour(C_FOREGROUND); notifyDataModified(); int tabColourIndex; - int autocompleteColourIndex = -1; if ((tabColourIndex = whichTabColourIndex()) != -1) { TabBarPlus::setColour(_pFgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex); @@ -520,10 +519,6 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM { ViewZoneDlg::setColour(_pFgColour->getColour(), ViewZoneDlg::ViewZoneColorIndex::focus); } - else if ((autocompleteColourIndex = whichAutocompleteColourIndex(true)) != -1) - { - AutoCompletion::setColour(_pFgColour->getColour(), static_cast(autocompleteColourIndex)); - } apply(); return TRUE; } @@ -532,7 +527,6 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM updateColour(C_BACKGROUND); notifyDataModified(); int tabColourIndex; - int autocompleteColourIndex = -1; if ((tabColourIndex = whichTabColourIndex()) != -1) { tabColourIndex = (tabColourIndex == TabBarPlus::inactiveText ? TabBarPlus::inactiveBg : tabColourIndex); @@ -542,10 +536,6 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM { ViewZoneDlg::setColour(_pBgColour->getColour(), ViewZoneDlg::ViewZoneColorIndex::frost); } - else if ((autocompleteColourIndex = whichAutocompleteColourIndex(false)) != -1) - { - AutoCompletion::setColour(_pBgColour->getColour(), static_cast(autocompleteColourIndex)); - } apply(); return TRUE; } @@ -650,50 +640,6 @@ int WordStyleDlg::whichTabColourIndex() return -1; } -int WordStyleDlg::whichAutocompleteColourIndex(bool isText) -{ - constexpr size_t styleNameLen = 128; - TCHAR styleName[styleNameLen + 1] = { '\0' }; - - if (!WordStyleDlg::getStyleName(styleName, styleNameLen)) - { - return -1; - } - - if (lstrcmp(styleName, AUTOCOMPLETE_LIST) == 0) - { - if (isText) - { - return static_cast(AutoCompletion::AutocompleteColorIndex::autocompleteText); - } - return static_cast(AutoCompletion::AutocompleteColorIndex::autocompleteBg); - } - - if (lstrcmp(styleName, AUTOCOMPLETE_SELECT) == 0) - { - if (isText) - { - return static_cast(AutoCompletion::AutocompleteColorIndex::selectedText); - } - return static_cast(AutoCompletion::AutocompleteColorIndex::selectedBg); - } - - if (lstrcmp(styleName, AUTOCOMPLETE_CALLTIP) == 0) - { - if (isText) - { - return static_cast(AutoCompletion::AutocompleteColorIndex::calltipText); - } - return static_cast(AutoCompletion::AutocompleteColorIndex::calltipBg); - } - - - if ((lstrcmp(styleName, AUTOCOMPLETE_CALLTIP_HIGHLIGHT) == 0) && isText) - return static_cast(AutoCompletion::AutocompleteColorIndex::calltipHighlight); - - return -1; -} - bool WordStyleDlg::isDocumentMapStyle() { constexpr size_t styleNameLen = 128; diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h index 4415e196c..aaa0ead32 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h @@ -166,7 +166,6 @@ private : bool getStyleName(TCHAR *styleName, const size_t styleNameLen); int whichTabColourIndex(); - int whichAutocompleteColourIndex(bool isText); bool isDocumentMapStyle(); void move2CtrlRight(int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight); void updateColour(bool which); diff --git a/PowerEditor/src/stylers.model.xml b/PowerEditor/src/stylers.model.xml index 10911c6c1..5ff2e84c5 100644 --- a/PowerEditor/src/stylers.model.xml +++ b/PowerEditor/src/stylers.model.xml @@ -1433,9 +1433,5 @@ - - - -