Enhance combobox & edit field in dark mode
1. Allow function list search to use dark mode error background. 2. Make combobox more dark and allow to use custom colors (borders, arrow head and background). 3. Use dark listbox in combobox. Fix #10178, close #10179pull/10199/head
parent
aa69711d4c
commit
81b21aae2a
|
@ -1,4 +1,4 @@
|
|||
#include "nppDarkMode.h"
|
||||
#include "nppDarkMode.h"
|
||||
|
||||
#include "DarkMode/DarkMode.h"
|
||||
#include "DarkMode/UAHMenuBar.h"
|
||||
|
@ -117,7 +117,6 @@ namespace NppDarkMode
|
|||
HEXRGB(0x809080) // edgeColor
|
||||
};
|
||||
|
||||
|
||||
// blue tone
|
||||
static const Colors darkBlueColors{
|
||||
HEXRGB(0x202040), // background
|
||||
|
@ -1223,6 +1222,109 @@ namespace NppDarkMode
|
|||
SetWindowSubclass(hwnd, TabSubclass, g_tabSubclassID, 0);
|
||||
}
|
||||
|
||||
constexpr UINT_PTR g_comboBoxSubclassID = 42;
|
||||
|
||||
LRESULT CALLBACK ComboBoxSubclass(
|
||||
HWND hWnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
UINT_PTR uIdSubclass,
|
||||
DWORD_PTR /*dwRefData*/
|
||||
)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
{
|
||||
if (!NppDarkMode::isEnabled())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
RECT rc = { 0 };
|
||||
::GetClientRect(hWnd, &rc);
|
||||
|
||||
PAINTSTRUCT ps;
|
||||
auto hdc = ::BeginPaint(hWnd, &ps);
|
||||
|
||||
auto holdPen = static_cast<HPEN>(::SelectObject(hdc, NppDarkMode::getEdgePen()));
|
||||
::SelectObject(hdc, reinterpret_cast<HFONT>(::SendMessage(hWnd, WM_GETFONT, 0, 0)));
|
||||
::SetBkColor(hdc, NppDarkMode::getBackgroundColor());
|
||||
|
||||
::SelectObject(hdc, ::GetStockObject(NULL_BRUSH)); // to avoid text flicker, use only border
|
||||
::Rectangle(hdc, 0, 0, rc.right, rc.bottom);
|
||||
|
||||
auto holdBrush = ::SelectObject(hdc, NppDarkMode::getBackgroundBrush());
|
||||
|
||||
// CBS_DROPDOWN text is handled by parent by WM_CTLCOLOREDIT
|
||||
auto style = ::GetWindowLongPtr(hWnd, GWL_STYLE);
|
||||
if ((style & CBS_DROPDOWNLIST) == CBS_DROPDOWNLIST)
|
||||
{
|
||||
auto index = static_cast<int>(::SendMessage(hWnd, CB_GETCURSEL, 0, 0));
|
||||
if (index != CB_ERR)
|
||||
{
|
||||
::SetTextColor(hdc, NppDarkMode::getTextColor());
|
||||
auto bufferLen = static_cast<size_t>(::SendMessage(hWnd, CB_GETLBTEXTLEN, index, 0));
|
||||
TCHAR* buffer = new TCHAR[(bufferLen + 1)];
|
||||
::SendMessage(hWnd, CB_GETLBTEXT, index, reinterpret_cast<LPARAM>(buffer));
|
||||
RECT textRc = rc;
|
||||
textRc.left += NppParameters::getInstance()._dpiManager.scaleX(4);
|
||||
textRc.right -= NppParameters::getInstance()._dpiManager.scaleX(23);
|
||||
::DrawText(hdc, buffer, -1, &textRc, DT_EDITCONTROL | DT_NOPREFIX | DT_LEFT | DT_VCENTER | DT_SINGLELINE);
|
||||
delete[]buffer;
|
||||
}
|
||||
}
|
||||
|
||||
RECT arrowRc = {
|
||||
rc.right - NppParameters::getInstance()._dpiManager.scaleX(17), rc.top + 1,
|
||||
rc.right - 1, rc.bottom - 1
|
||||
};
|
||||
|
||||
POINT ptCursor = { 0 };
|
||||
::GetCursorPos(&ptCursor);
|
||||
ScreenToClient(hWnd, &ptCursor);
|
||||
|
||||
bool isHot = PtInRect(&rc, ptCursor);
|
||||
|
||||
::SetTextColor(hdc, isHot ? NppDarkMode::getTextColor() : NppDarkMode::getDarkerTextColor());
|
||||
::SetBkColor(hdc, isHot ? NppDarkMode::getHotBackgroundColor() : NppDarkMode::getBackgroundColor());
|
||||
::ExtTextOut(hdc,
|
||||
rc.right - NppParameters::getInstance()._dpiManager.scaleX(13),
|
||||
rc.top + 4,
|
||||
ETO_OPAQUE | ETO_CLIPPED,
|
||||
&arrowRc, L"˅",
|
||||
1,
|
||||
nullptr);
|
||||
::SetBkColor(hdc, NppDarkMode::getBackgroundColor());
|
||||
|
||||
POINT edge[] = {
|
||||
{rc.right - NppParameters::getInstance()._dpiManager.scaleX(18), rc.top + 1},
|
||||
{rc.right - NppParameters::getInstance()._dpiManager.scaleX(18), rc.bottom - 1}
|
||||
};
|
||||
::Polyline(hdc, edge, _countof(edge));
|
||||
|
||||
::SelectObject(hdc, holdPen);
|
||||
::SelectObject(hdc, holdBrush);
|
||||
|
||||
::EndPaint(hWnd, &ps);
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_NCDESTROY:
|
||||
{
|
||||
::RemoveWindowSubclass(hWnd, ComboBoxSubclass, uIdSubclass);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
void subclassComboBoxControl(HWND hwnd)
|
||||
{
|
||||
SetWindowSubclass(hwnd, ComboBoxSubclass, g_comboBoxSubclassID, 0);
|
||||
}
|
||||
|
||||
void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass, bool theme)
|
||||
{
|
||||
struct Params
|
||||
|
@ -1233,44 +1335,57 @@ namespace NppDarkMode
|
|||
};
|
||||
|
||||
Params p{
|
||||
NppDarkMode::isEnabled() ? L"DarkMode_Explorer" : L"Button"
|
||||
NppDarkMode::isEnabled() ? L"DarkMode_Explorer" : nullptr
|
||||
, subclass
|
||||
, theme
|
||||
};
|
||||
|
||||
EnumChildWindows(hwndParent, [](HWND hwnd, LPARAM lParam) {
|
||||
auto& p = *reinterpret_cast<Params*>(lParam);
|
||||
wchar_t className[16] = { 0 };
|
||||
GetClassName(hwnd, className, 9);
|
||||
if (wcscmp(className, L"Button"))
|
||||
const size_t classNameLen = 16;
|
||||
TCHAR className[classNameLen] = { 0 };
|
||||
GetClassName(hwnd, className, classNameLen);
|
||||
|
||||
if (wcscmp(className, WC_COMBOBOX) == 0)
|
||||
{
|
||||
auto style = ::GetWindowLongPtr(hwnd, GWL_STYLE);
|
||||
|
||||
if ((style & CBS_DROPDOWNLIST) == CBS_DROPDOWNLIST || (style & CBS_DROPDOWN) == CBS_DROPDOWN)
|
||||
{
|
||||
NppDarkMode::subclassComboBoxControl(hwnd);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
DWORD nButtonStyle = (DWORD)GetWindowLong(hwnd, GWL_STYLE) & 0xF;
|
||||
switch (nButtonStyle)
|
||||
|
||||
if (wcscmp(className, WC_BUTTON) == 0)
|
||||
{
|
||||
case BS_CHECKBOX:
|
||||
case BS_AUTOCHECKBOX:
|
||||
case BS_RADIOBUTTON:
|
||||
case BS_AUTORADIOBUTTON:
|
||||
if (p.subclass)
|
||||
auto nButtonStyle = ::GetWindowLongPtr(hwnd, GWL_STYLE) & 0xF;
|
||||
switch (nButtonStyle)
|
||||
{
|
||||
NppDarkMode::subclassButtonControl(hwnd);
|
||||
case BS_CHECKBOX:
|
||||
case BS_AUTOCHECKBOX:
|
||||
case BS_RADIOBUTTON:
|
||||
case BS_AUTORADIOBUTTON:
|
||||
if (p.subclass)
|
||||
{
|
||||
NppDarkMode::subclassButtonControl(hwnd);
|
||||
}
|
||||
break;
|
||||
case BS_GROUPBOX:
|
||||
if (p.subclass)
|
||||
{
|
||||
NppDarkMode::subclassGroupboxControl(hwnd);
|
||||
}
|
||||
break;
|
||||
case BS_DEFPUSHBUTTON:
|
||||
case BS_PUSHBUTTON:
|
||||
if (p.theme)
|
||||
{
|
||||
SetWindowTheme(hwnd, p.themeClassName, nullptr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case BS_GROUPBOX:
|
||||
if (p.subclass)
|
||||
{
|
||||
NppDarkMode::subclassGroupboxControl(hwnd);
|
||||
}
|
||||
break;
|
||||
case BS_DEFPUSHBUTTON:
|
||||
case BS_PUSHBUTTON:
|
||||
if (p.theme)
|
||||
{
|
||||
SetWindowTheme(hwnd, p.themeClassName, nullptr);
|
||||
}
|
||||
break;
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
}, reinterpret_cast<LPARAM>(&p));
|
||||
|
@ -1381,4 +1496,25 @@ namespace NppDarkMode
|
|||
{
|
||||
SetWindowTheme(hwnd, nullptr, nullptr);
|
||||
}
|
||||
|
||||
LRESULT onCtlColor(HDC hdc)
|
||||
{
|
||||
::SetTextColor(hdc, NppDarkMode::getTextColor());
|
||||
::SetBkColor(hdc, NppDarkMode::getBackgroundColor());
|
||||
return reinterpret_cast<LRESULT>(NppDarkMode::getBackgroundBrush());
|
||||
}
|
||||
|
||||
LRESULT onCtlColorSofter(HDC hdc)
|
||||
{
|
||||
::SetTextColor(hdc, NppDarkMode::getTextColor());
|
||||
::SetBkColor(hdc, NppDarkMode::getSofterBackgroundColor());
|
||||
return reinterpret_cast<LRESULT>(NppDarkMode::getSofterBackgroundBrush());
|
||||
}
|
||||
|
||||
LRESULT onCtlColorError(HDC hdc)
|
||||
{
|
||||
::SetTextColor(hdc, NppDarkMode::getTextColor());
|
||||
::SetBkColor(hdc, NppDarkMode::getErrorBackgroundColor());
|
||||
return reinterpret_cast<LRESULT>(NppDarkMode::getErrorBackgroundBrush());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,6 +118,7 @@ namespace NppDarkMode
|
|||
void subclassGroupboxControl(HWND hwnd);
|
||||
void subclassToolbarControl(HWND hwnd);
|
||||
void subclassTabControl(HWND hwnd);
|
||||
void subclassComboBoxControl(HWND hwnd);
|
||||
|
||||
void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass = true, bool theme = true);
|
||||
void autoThemeChildControls(HWND hwndParent);
|
||||
|
@ -131,4 +132,8 @@ namespace NppDarkMode
|
|||
|
||||
void disableVisualStyle(HWND hwnd, bool doDisable);
|
||||
void setTreeViewStyle(HWND hwnd);
|
||||
|
||||
LRESULT onCtlColor(HDC hdc);
|
||||
LRESULT onCtlColorSofter(HDC hdc);
|
||||
LRESULT onCtlColorError(HDC hdc);
|
||||
}
|
||||
|
|
|
@ -325,7 +325,7 @@ void FindReplaceDlg::fillFindHistory()
|
|||
fillComboHistory(IDFINDWHAT, findHistory._findHistoryFinds);
|
||||
fillComboHistory(IDREPLACEWITH, findHistory._findHistoryReplaces);
|
||||
fillComboHistory(IDD_FINDINFILES_FILTERS_COMBO, findHistory._findHistoryFilters);
|
||||
fillComboHistory(IDD_FINDINFILES_DIR_COMBO, findHistory._findHistoryPaths);
|
||||
fillComboHistory(IDD_FINDINFILES_DIR_COMBO, findHistory._findHistoryPaths);
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDWRAP, BM_SETCHECK, findHistory._isWrap, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDWHOLEWORD, BM_SETCHECK, findHistory._isMatchWord, 0);
|
||||
|
@ -334,7 +334,7 @@ void FindReplaceDlg::fillFindHistory()
|
|||
|
||||
::SendDlgItemMessage(_hSelf, IDD_FINDINFILES_INHIDDENDIR_CHECK, BM_SETCHECK, findHistory._isFifInHiddenFolder, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDD_FINDINFILES_RECURSIVE_CHECK, BM_SETCHECK, findHistory._isFifRecuisive, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK, BM_SETCHECK, findHistory._isFolderFollowDoc, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK, BM_SETCHECK, findHistory._isFolderFollowDoc, 0);
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDD_FINDINFILES_PROJECT1_CHECK, BM_SETCHECK, findHistory._isFifProjectPanel_1, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDD_FINDINFILES_PROJECT2_CHECK, BM_SETCHECK, findHistory._isFifProjectPanel_2, 0);
|
||||
|
@ -850,30 +850,44 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
}
|
||||
|
||||
case WM_CTLCOLOREDIT:
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_CTLCOLORDLG:
|
||||
case WM_CTLCOLORSTATIC:
|
||||
case WM_CTLCOLORLISTBOX:
|
||||
{
|
||||
if (!NppDarkMode::isEnabled())
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
break;
|
||||
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
|
||||
SetTextColor((HDC)wParam, NppDarkMode::getTextColor());
|
||||
SetBkColor((HDC)wParam, NppDarkMode::getBackgroundColor());
|
||||
return (LRESULT)NppDarkMode::getBackgroundBrush();
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PRINTCLIENT:
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
{
|
||||
if (!NppDarkMode::isEnabled())
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
break;
|
||||
RECT rc = { 0 };
|
||||
getClientRect(rc);
|
||||
FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getBackgroundBrush());
|
||||
return TRUE;
|
||||
}
|
||||
RECT rc = { 0 };
|
||||
getClientRect(rc);
|
||||
FillRect((HDC)wParam, &rc, NppDarkMode::getBackgroundBrush());
|
||||
SetWindowLongPtr(_hSelf, DWLP_MSGRESULT, TRUE);
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||
|
@ -1248,8 +1262,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
if (_currentStatus == FIND_DLG)
|
||||
{
|
||||
setStatusbarMessage(TEXT(""), FSNoMessage);
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
combo2ExtendedMode(IDFINDWHAT);
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
combo2ExtendedMode(IDFINDWHAT);
|
||||
_options._str2Search = getTextFromCombo(hFindCombo);
|
||||
updateCombo(IDFINDWHAT);
|
||||
|
||||
|
@ -1265,7 +1279,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
{
|
||||
setStatusbarMessage(TEXT(""), FSNoMessage);
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
combo2ExtendedMode(IDFINDWHAT);
|
||||
combo2ExtendedMode(IDFINDWHAT);
|
||||
_options._str2Search = getTextFromCombo(hFindCombo);
|
||||
updateCombo(IDFINDWHAT);
|
||||
|
||||
|
@ -1744,17 +1758,17 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
}
|
||||
return TRUE;
|
||||
|
||||
case IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK :
|
||||
case IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK :
|
||||
{
|
||||
if (_currentStatus == FINDINFILES_DLG)
|
||||
findHistory._isFolderFollowDoc = isCheckedOrNot(IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK);
|
||||
findHistory._isFolderFollowDoc = isCheckedOrNot(IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK);
|
||||
|
||||
if (findHistory._isFolderFollowDoc)
|
||||
{
|
||||
NppParameters& nppParam = NppParameters::getInstance();
|
||||
const TCHAR * dir = nppParam.getWorkingDir();
|
||||
::SetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, dir);
|
||||
}
|
||||
if (findHistory._isFolderFollowDoc)
|
||||
{
|
||||
NppParameters& nppParam = NppParameters::getInstance();
|
||||
const TCHAR * dir = nppParam.getWorkingDir();
|
||||
::SetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, dir);
|
||||
}
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -2473,10 +2487,10 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
|
|||
}
|
||||
if (processed) ++nbProcessed;
|
||||
|
||||
// After the processing of the last string occurrence the search loop should be stopped
|
||||
// This helps to avoid the endless replacement during the EOL ("$") searching
|
||||
// After the processing of the last string occurrence the search loop should be stopped
|
||||
// This helps to avoid the endless replacement during the EOL ("$") searching
|
||||
if (targetStart + foundTextLen == findReplaceInfo._endRange)
|
||||
break;
|
||||
break;
|
||||
|
||||
findReplaceInfo._startRange = targetStart + foundTextLen + replaceDelta; //search from result onwards
|
||||
findReplaceInfo._endRange += replaceDelta; //adjust end of range in case of replace
|
||||
|
@ -3498,7 +3512,7 @@ void FindReplaceDlg::doDialog(DIALOG_TYPE whichType, bool isRTL, bool toShow)
|
|||
enableReplaceFunc(whichType == REPLACE_DLG);
|
||||
|
||||
::SetFocus(::GetDlgItem(_hSelf, IDFINDWHAT));
|
||||
display(toShow, true);
|
||||
display(toShow, true);
|
||||
}
|
||||
|
||||
LRESULT FAR PASCAL FindReplaceDlg::finderProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
@ -3623,40 +3637,40 @@ void FindReplaceDlg::combo2ExtendedMode(int comboID)
|
|||
|
||||
generic_string str2transform = getTextFromCombo(hFindCombo);
|
||||
|
||||
// Count the number of character '\n' and '\r'
|
||||
size_t nbEOL = 0;
|
||||
size_t str2transformLen = lstrlen(str2transform.c_str());
|
||||
for (size_t i = 0 ; i < str2transformLen ; ++i)
|
||||
{
|
||||
if (str2transform[i] == '\r' || str2transform[i] == '\n')
|
||||
++nbEOL;
|
||||
}
|
||||
// Count the number of character '\n' and '\r'
|
||||
size_t nbEOL = 0;
|
||||
size_t str2transformLen = lstrlen(str2transform.c_str());
|
||||
for (size_t i = 0 ; i < str2transformLen ; ++i)
|
||||
{
|
||||
if (str2transform[i] == '\r' || str2transform[i] == '\n')
|
||||
++nbEOL;
|
||||
}
|
||||
|
||||
if (nbEOL)
|
||||
{
|
||||
if (nbEOL)
|
||||
{
|
||||
TCHAR * newBuffer = new TCHAR[str2transformLen + nbEOL*2 + 1];
|
||||
int j = 0;
|
||||
for (size_t i = 0 ; i < str2transformLen ; ++i)
|
||||
{
|
||||
if (str2transform[i] == '\r')
|
||||
{
|
||||
newBuffer[j++] = '\\';
|
||||
newBuffer[j++] = 'r';
|
||||
}
|
||||
else if (str2transform[i] == '\n')
|
||||
{
|
||||
newBuffer[j++] = '\\';
|
||||
newBuffer[j++] = 'n';
|
||||
}
|
||||
else
|
||||
{
|
||||
newBuffer[j++] = str2transform[i];
|
||||
}
|
||||
}
|
||||
newBuffer[j++] = '\0';
|
||||
int j = 0;
|
||||
for (size_t i = 0 ; i < str2transformLen ; ++i)
|
||||
{
|
||||
if (str2transform[i] == '\r')
|
||||
{
|
||||
newBuffer[j++] = '\\';
|
||||
newBuffer[j++] = 'r';
|
||||
}
|
||||
else if (str2transform[i] == '\n')
|
||||
{
|
||||
newBuffer[j++] = '\\';
|
||||
newBuffer[j++] = 'n';
|
||||
}
|
||||
else
|
||||
{
|
||||
newBuffer[j++] = str2transform[i];
|
||||
}
|
||||
}
|
||||
newBuffer[j++] = '\0';
|
||||
setSearchText(newBuffer);
|
||||
|
||||
_options._searchType = FindExtended;
|
||||
_options._searchType = FindExtended;
|
||||
::SendDlgItemMessage(_hSelf, IDNORMAL, BM_SETCHECK, FALSE, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDEXTENDED, BM_SETCHECK, TRUE, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDREGEXP, BM_SETCHECK, FALSE, 0);
|
||||
|
@ -4190,11 +4204,11 @@ void Finder::setFinderStyle()
|
|||
|
||||
// Override foreground & background colour by default foreground & background coulour
|
||||
StyleArray & stylers = NppParameters::getInstance().getMiscStylerArray();
|
||||
int iStyleDefault = stylers.getStylerIndexByID(STYLE_DEFAULT);
|
||||
if (iStyleDefault != -1)
|
||||
{
|
||||
Style & styleDefault = stylers.getStyler(iStyleDefault);
|
||||
_scintView.setStyle(styleDefault);
|
||||
int iStyleDefault = stylers.getStylerIndexByID(STYLE_DEFAULT);
|
||||
if (iStyleDefault != -1)
|
||||
{
|
||||
Style & styleDefault = stylers.getStyler(iStyleDefault);
|
||||
_scintView.setStyle(styleDefault);
|
||||
|
||||
GlobalOverride & go = NppParameters::getInstance().getGlobalOverrideStyle();
|
||||
if (go.isEnable())
|
||||
|
@ -4216,7 +4230,7 @@ void Finder::setFinderStyle()
|
|||
|
||||
_scintView.execute(SCI_STYLESETFORE, SCE_SEARCHRESULT_DEFAULT, styleDefault._fgColor);
|
||||
_scintView.execute(SCI_STYLESETBACK, SCE_SEARCHRESULT_DEFAULT, styleDefault._bgColor);
|
||||
}
|
||||
}
|
||||
|
||||
_scintView.execute(SCI_COLOURISE, 0, -1);
|
||||
|
||||
|
@ -4442,19 +4456,17 @@ INT_PTR CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||
// Make edit field red if not found
|
||||
case WM_CTLCOLOREDIT :
|
||||
{
|
||||
auto hdc = reinterpret_cast<HDC>(wParam);
|
||||
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
if (FSNotFound != getFindStatus())
|
||||
{
|
||||
SetTextColor((HDC)wParam, NppDarkMode::getTextColor());
|
||||
SetBkColor((HDC)wParam, NppDarkMode::getBackgroundColor());
|
||||
return (LRESULT)NppDarkMode::getBackgroundBrush();
|
||||
return NppDarkMode::onCtlColorSofter(hdc);
|
||||
}
|
||||
else // text not found
|
||||
{
|
||||
SetTextColor((HDC)wParam, NppDarkMode::getTextColor());
|
||||
SetBkColor((HDC)wParam, NppDarkMode::getErrorBackgroundColor());
|
||||
return (LRESULT)NppDarkMode::getErrorBackgroundBrush();
|
||||
return NppDarkMode::onCtlColorError(hdc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4465,9 +4477,9 @@ INT_PTR CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||
return FALSE; // text found, use the default color
|
||||
|
||||
// text not found
|
||||
SetTextColor((HDC)wParam, TXT_COLOR);
|
||||
SetBkColor((HDC)wParam, BCKGRD_COLOR);
|
||||
return (LRESULT)hBrushBackground;
|
||||
SetTextColor(hdc, TXT_COLOR);
|
||||
SetBkColor(hdc, BCKGRD_COLOR);
|
||||
return reinterpret_cast<LRESULT>(hBrushBackground);
|
||||
}
|
||||
|
||||
case WM_CTLCOLORDLG:
|
||||
|
@ -4478,9 +4490,7 @@ INT_PTR CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||
return DefWindowProc(getHSelf(), message, wParam, lParam);
|
||||
}
|
||||
|
||||
SetTextColor((HDC)wParam, NppDarkMode::getTextColor());
|
||||
SetBkColor((HDC)wParam, NppDarkMode::getBackgroundColor());
|
||||
return (LRESULT)NppDarkMode::getBackgroundBrush();
|
||||
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
|
||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||
|
@ -4642,9 +4652,9 @@ void FindIncrementDlg::setFindStatus(FindStatus iStatus, int nbCounted)
|
|||
{
|
||||
static TCHAR findCount[128] = TEXT("");
|
||||
static const TCHAR * const findStatus[] = { findCount, // FSFound
|
||||
TEXT("Phrase not found"), //FSNotFound
|
||||
TEXT("Reached top of page, continued from bottom"), // FSTopReached
|
||||
TEXT("Reached end of page, continued from top")}; // FSEndReached
|
||||
TEXT("Phrase not found"), //FSNotFound
|
||||
TEXT("Reached top of page, continued from bottom"), // FSTopReached
|
||||
TEXT("Reached end of page, continued from top")}; // FSEndReached
|
||||
if (nbCounted <= 0)
|
||||
findCount[0] = '\0';
|
||||
else if (nbCounted == 1)
|
||||
|
|
|
@ -769,24 +769,31 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA
|
|||
}
|
||||
}
|
||||
|
||||
auto hdc = reinterpret_cast<HDC>(wParam);
|
||||
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
if (textFound)
|
||||
{
|
||||
return NppDarkMode::onCtlColorSofter(hdc);
|
||||
}
|
||||
else // text not found
|
||||
{
|
||||
return NppDarkMode::onCtlColorError(hdc);
|
||||
}
|
||||
}
|
||||
|
||||
if (textFound)
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
SetTextColor((HDC)wParam, NppDarkMode::getTextColor());
|
||||
SetBkColor((HDC)wParam, NppDarkMode::getBackgroundColor());
|
||||
return (LRESULT)NppDarkMode::getBackgroundBrush();
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// text not found
|
||||
// if the text not found modify the background color of the editor
|
||||
static HBRUSH hBrushBackground = CreateSolidBrush(BCKGRD_COLOR);
|
||||
SetTextColor((HDC)wParam, TXT_COLOR);
|
||||
SetBkColor((HDC)wParam, BCKGRD_COLOR);
|
||||
return (LRESULT)hBrushBackground;
|
||||
SetTextColor(hdc, TXT_COLOR);
|
||||
SetBkColor(hdc, BCKGRD_COLOR);
|
||||
return reinterpret_cast<LRESULT>(hBrushBackground);
|
||||
}
|
||||
|
||||
case WM_INITDIALOG :
|
||||
|
@ -798,7 +805,7 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA
|
|||
// Create toolbar menu
|
||||
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | BTNS_AUTOSIZE | BTNS_SEP | TBSTYLE_TOOLTIPS;
|
||||
_hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style,
|
||||
0,0,0,0,_hSelf,nullptr, _hInst, NULL);
|
||||
0,0,0,0,_hSelf,nullptr, _hInst, NULL);
|
||||
|
||||
NppDarkMode::setDarkTooltips(_hToolbarMenu, NppDarkMode::ToolTipsType::toolbar);
|
||||
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
||||
|
@ -845,9 +852,9 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA
|
|||
_reloadTipStr = pNativeSpeaker->getAttrNameStr(_reloadTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_RELOADLOCALNODENAME);
|
||||
|
||||
_hSearchEdit = CreateWindowEx(0, L"Edit", NULL,
|
||||
WS_CHILD | WS_BORDER | WS_VISIBLE | ES_AUTOVSCROLL,
|
||||
2, 2, editWidth, editHeight,
|
||||
_hToolbarMenu, reinterpret_cast<HMENU>(IDC_SEARCHFIELD_FUNCLIST), _hInst, 0 );
|
||||
WS_CHILD | WS_BORDER | WS_VISIBLE | ES_AUTOVSCROLL,
|
||||
2, 2, editWidth, editHeight,
|
||||
_hToolbarMenu, reinterpret_cast<HMENU>(IDC_SEARCHFIELD_FUNCLIST), _hInst, 0 );
|
||||
|
||||
oldFunclstSearchEditProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSearchEdit, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(funclstSearchEditProc)));
|
||||
|
||||
|
|
Loading…
Reference in New Issue