Fix x64 build error in 3f1a582a36db175a4f86b35dcd47f3aa5bf331fa

Fix x64 build error, remove unnecessary codes and add enhancement for the previous commit 3f1a582a36db175a4f86b35dcd47f3aa5bf331fa
This commit is contained in:
Don Ho 2022-04-13 04:38:39 +02:00
parent 3f1a582a36
commit 0ee65fd826
9 changed files with 6 additions and 120 deletions

View File

@ -1444,9 +1444,5 @@ License: GPL2
<WidgetStyle name="Inactive tabs" styleID="0" fgColor="808080" bgColor="C0C0C0" />
<WidgetStyle name="URL hovered" styleID="0" fgColor="A3DCA3" />
<WidgetStyle name="Document map" styleID="0" fgColor="000000" bgColor="FFFFFF" />
<WidgetStyle name="Autocomplete list" styleID="0" fgColor="C0C0C0" bgColor="202020" fontStyle="0" />
<WidgetStyle name="Autocomplete selected item" styleID="0" fgColor="E0E0E0" bgColor="404040" fontStyle="0" />
<WidgetStyle name="Calltip" styleID="0" fgColor="808080" bgColor="202020" fontStyle="0" />
<WidgetStyle name="Calltip highlighted text" styleID="0" fgColor="E0E0E0" fontStyle="0" />
</GlobalStyles>
</NotepadPlus>

View File

@ -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<long>(stAcList->_fgColor) != -1)
{
AutoCompletion::setColour(stAcList->_fgColor, AutoCompletion::AutocompleteColorIndex::autocompleteText);
}
if (static_cast<long>(stAcList->_bgColor) != -1)
{
AutoCompletion::setColour(stAcList->_bgColor, AutoCompletion::AutocompleteColorIndex::autocompleteBg);
}
}
Style* stAcSelected = getStyleFromName(AUTOCOMPLETE_SELECT);
if (stAcSelected)
{
if (static_cast<long>(stAcSelected->_fgColor) != -1)
{
AutoCompletion::setColour(stAcSelected->_fgColor, AutoCompletion::AutocompleteColorIndex::selectedText);
}
if (static_cast<long>(stAcSelected->_bgColor) != -1)
{
AutoCompletion::setColour(stAcSelected->_bgColor, AutoCompletion::AutocompleteColorIndex::selectedBg);
}
}
Style* stCalltip = getStyleFromName(AUTOCOMPLETE_CALLTIP);
if (stCalltip)
{
if (static_cast<long>(stCalltip->_fgColor) != -1)
{
AutoCompletion::setColour(stCalltip->_fgColor, AutoCompletion::AutocompleteColorIndex::calltipText);
}
if (static_cast<long>(stCalltip->_bgColor) != -1)
{
AutoCompletion::setColour(stCalltip->_bgColor, AutoCompletion::AutocompleteColorIndex::calltipBg);
}
}
Style* stCalltipHl = getStyleFromName(AUTOCOMPLETE_CALLTIP_HIGHLIGHT);
if (stCalltipHl && static_cast<long>(stCalltipHl->_fgColor) != -1)
{
AutoCompletion::setColour(stCalltipHl->_fgColor, AutoCompletion::AutocompleteColorIndex::calltipHighlight);
}
}
void Notepad_plus::drawDocumentMapColoursFromStylerArray()
{

View File

@ -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<generic_string> loadCommandlineParams(const TCHAR * commandLine, const CmdLineParams * pCmdParams) {

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -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<AutoCompletion::AutocompleteColorIndex>(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<AutoCompletion::AutocompleteColorIndex>(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<int>(AutoCompletion::AutocompleteColorIndex::autocompleteText);
}
return static_cast<int>(AutoCompletion::AutocompleteColorIndex::autocompleteBg);
}
if (lstrcmp(styleName, AUTOCOMPLETE_SELECT) == 0)
{
if (isText)
{
return static_cast<int>(AutoCompletion::AutocompleteColorIndex::selectedText);
}
return static_cast<int>(AutoCompletion::AutocompleteColorIndex::selectedBg);
}
if (lstrcmp(styleName, AUTOCOMPLETE_CALLTIP) == 0)
{
if (isText)
{
return static_cast<int>(AutoCompletion::AutocompleteColorIndex::calltipText);
}
return static_cast<int>(AutoCompletion::AutocompleteColorIndex::calltipBg);
}
if ((lstrcmp(styleName, AUTOCOMPLETE_CALLTIP_HIGHLIGHT) == 0) && isText)
return static_cast<int>(AutoCompletion::AutocompleteColorIndex::calltipHighlight);
return -1;
}
bool WordStyleDlg::isDocumentMapStyle()
{
constexpr size_t styleNameLen = 128;

View File

@ -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);

View File

@ -1433,9 +1433,5 @@
<WidgetStyle name="Inactive tabs" styleID="0" fgColor="808080" bgColor="C0C0C0" />
<WidgetStyle name="URL hovered" styleID="0" fgColor="0000FF" />
<WidgetStyle name="Document map" styleID="0" fgColor="FF8000" bgColor="FFFFFF" />
<WidgetStyle name="Autocomplete list" styleID="0" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
<WidgetStyle name="Autocomplete selected item" styleID="0" fgColor="FFFFFF" bgColor="0078D7" fontStyle="0" />
<WidgetStyle name="Calltip" styleID="0" fgColor="808080" bgColor="FFFFFF" fontStyle="0" />
<WidgetStyle name="Calltip highlighted text" styleID="0" fgColor="000080" fontStyle="0" />
</GlobalStyles>
</NotepadPlus>