Fix dark mode disabled static text color in Column Editor and Style configurator
Fix #11407, close #11409
This commit is contained in:
parent
d9c5688635
commit
6086e819fd
|
@ -36,7 +36,7 @@ void ColumnEditorDlg::display(bool toShow) const
|
||||||
::SetFocus(::GetDlgItem(_hSelf, ID_GOLINE_EDIT));
|
::SetFocus(::GetDlgItem(_hSelf, ID_GOLINE_EDIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
|
intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
|
@ -63,11 +63,30 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
||||||
case WM_CTLCOLORDLG:
|
case WM_CTLCOLORDLG:
|
||||||
case WM_CTLCOLORSTATIC:
|
case WM_CTLCOLORSTATIC:
|
||||||
{
|
{
|
||||||
|
LRESULT result = FALSE;
|
||||||
if (NppDarkMode::isEnabled())
|
if (NppDarkMode::isEnabled())
|
||||||
{
|
{
|
||||||
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
|
result = NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
if (
|
||||||
|
(HWND)lParam == ::GetDlgItem(_hSelf, IDC_COL_INITNUM_STATIC) ||
|
||||||
|
(HWND)lParam == ::GetDlgItem(_hSelf, IDC_COL_INCRNUM_STATIC) ||
|
||||||
|
(HWND)lParam == ::GetDlgItem(_hSelf, IDC_COL_REPEATNUM_STATIC)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_COL_NUM_RADIO, BM_GETCHECK, 0, 0))
|
||||||
|
{
|
||||||
|
if (NppDarkMode::isEnabled())
|
||||||
|
SetTextColor((HDC)wParam, NppDarkMode::getTextColor());
|
||||||
|
else
|
||||||
|
SetTextColor((HDC)wParam, RGB(0, 0, 0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SetTextColor((HDC)wParam, NppDarkMode::getDisabledTextColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_PRINTCLIENT:
|
case WM_PRINTCLIENT:
|
||||||
|
@ -333,11 +352,8 @@ void ColumnEditorDlg::switchTo(bool toText)
|
||||||
|
|
||||||
HWND hNum = ::GetDlgItem(_hSelf, IDC_COL_INITNUM_EDIT);
|
HWND hNum = ::GetDlgItem(_hSelf, IDC_COL_INITNUM_EDIT);
|
||||||
::SendDlgItemMessage(_hSelf, IDC_COL_NUM_RADIO, BM_SETCHECK, !toText, 0);
|
::SendDlgItemMessage(_hSelf, IDC_COL_NUM_RADIO, BM_SETCHECK, !toText, 0);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_INITNUM_STATIC), !toText);
|
|
||||||
::EnableWindow(hNum, !toText);
|
::EnableWindow(hNum, !toText);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_INCRNUM_STATIC), !toText);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_INCREASENUM_EDIT), !toText);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_INCREASENUM_EDIT), !toText);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_REPEATNUM_STATIC), !toText);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_REPEATNUM_EDIT), !toText);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_REPEATNUM_EDIT), !toText);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_DEC_RADIO), !toText);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_DEC_RADIO), !toText);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_HEX_RADIO), !toText);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_HEX_RADIO), !toText);
|
||||||
|
@ -346,6 +362,8 @@ void ColumnEditorDlg::switchTo(bool toText)
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_LEADZERO_CHECK), !toText);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_LEADZERO_CHECK), !toText);
|
||||||
|
|
||||||
::SetFocus(toText?hText:hNum);
|
::SetFocus(toText?hText:hNum);
|
||||||
|
|
||||||
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
UCHAR ColumnEditorDlg::getFormat()
|
UCHAR ColumnEditorDlg::getFormat()
|
||||||
|
|
|
@ -192,19 +192,73 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||||
|
|
||||||
case WM_CTLCOLORSTATIC:
|
case WM_CTLCOLORSTATIC:
|
||||||
{
|
{
|
||||||
|
LRESULT result = FALSE;
|
||||||
if (NppDarkMode::isEnabled())
|
if (NppDarkMode::isEnabled())
|
||||||
{
|
{
|
||||||
HWND hwnd = reinterpret_cast<HWND>(lParam);
|
HWND hwnd = reinterpret_cast<HWND>(lParam);
|
||||||
if (hwnd == ::GetDlgItem(_hSelf, IDC_DEF_EXT_EDIT) || hwnd == ::GetDlgItem(_hSelf, IDC_DEF_KEYWORDS_EDIT))
|
if (hwnd == ::GetDlgItem(_hSelf, IDC_DEF_EXT_EDIT) || hwnd == ::GetDlgItem(_hSelf, IDC_DEF_KEYWORDS_EDIT))
|
||||||
{
|
{
|
||||||
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
|
result = NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
|
result = NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
|
if (
|
||||||
|
(HWND)lParam == ::GetDlgItem(_hSelf, IDC_FG_STATIC) ||
|
||||||
|
(HWND)lParam == ::GetDlgItem(_hSelf, IDC_BG_STATIC) ||
|
||||||
|
(HWND)lParam == ::GetDlgItem(_hSelf, IDC_FONTNAME_STATIC) ||
|
||||||
|
(HWND)lParam == ::GetDlgItem(_hSelf, IDC_FONTSIZE_STATIC)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Style& style = getCurrentStyler();
|
||||||
|
bool isEnable = false;
|
||||||
|
|
||||||
|
if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_FG_STATIC))
|
||||||
|
{
|
||||||
|
if (HIBYTE(HIWORD(style._fgColor)) != 0xFF)
|
||||||
|
isEnable = true;
|
||||||
|
|
||||||
|
// Selected text colour style
|
||||||
|
if (style._styleDesc == TEXT("Selected text colour"))
|
||||||
|
{
|
||||||
|
isEnable = false; // disable by default for "Selected text colour" style
|
||||||
|
|
||||||
|
if (NppParameters::getInstance().isSelectFgColorEnabled())
|
||||||
|
isEnable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_BG_STATIC))
|
||||||
|
{
|
||||||
|
if (HIBYTE(HIWORD(style._bgColor)) != 0xFF)
|
||||||
|
isEnable = true;
|
||||||
|
}
|
||||||
|
else if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_FONTNAME_STATIC))
|
||||||
|
{
|
||||||
|
if (!style._fontName.empty())
|
||||||
|
isEnable = true;
|
||||||
|
}
|
||||||
|
else if ((HWND)lParam == ::GetDlgItem(_hSelf, IDC_FONTSIZE_STATIC))
|
||||||
|
{
|
||||||
|
if (style._fontSize != STYLE_NOT_USED && style._fontSize < 100) // style._fontSize has only 2 digits
|
||||||
|
isEnable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEnable)
|
||||||
|
{
|
||||||
|
if (NppDarkMode::isEnabled())
|
||||||
|
SetTextColor((HDC)wParam, NppDarkMode::getTextColor());
|
||||||
|
else
|
||||||
|
SetTextColor((HDC)wParam, RGB(0, 0, 0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SetTextColor((HDC)wParam, NppDarkMode::getDisabledTextColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_PRINTCLIENT:
|
case WM_PRINTCLIENT:
|
||||||
|
@ -883,7 +937,8 @@ void WordStyleDlg::setVisualFromStyleList()
|
||||||
if (NppParameters::getInstance().isSelectFgColorEnabled())
|
if (NppParameters::getInstance().isSelectFgColorEnabled())
|
||||||
isEnable = true;
|
isEnable = true;
|
||||||
}
|
}
|
||||||
enableFg(isEnable);
|
::EnableWindow(_pFgColour->getHSelf(), isEnable);
|
||||||
|
InvalidateRect(_hFgColourStaticText, NULL, FALSE);
|
||||||
|
|
||||||
isEnable = false;
|
isEnable = false;
|
||||||
if (HIBYTE(HIWORD(style._bgColor)) != 0xFF)
|
if (HIBYTE(HIWORD(style._bgColor)) != 0xFF)
|
||||||
|
@ -892,7 +947,8 @@ void WordStyleDlg::setVisualFromStyleList()
|
||||||
_pBgColour->setEnabled((style._colorStyle & COLORSTYLE_BACKGROUND) != 0);
|
_pBgColour->setEnabled((style._colorStyle & COLORSTYLE_BACKGROUND) != 0);
|
||||||
isEnable = true;
|
isEnable = true;
|
||||||
}
|
}
|
||||||
enableBg(isEnable);
|
::EnableWindow(_pBgColour->getHSelf(), isEnable);
|
||||||
|
InvalidateRect(_hBgColourStaticText, NULL, FALSE);
|
||||||
|
|
||||||
//-- font name
|
//-- font name
|
||||||
isEnable = false;
|
isEnable = false;
|
||||||
|
@ -909,7 +965,8 @@ void WordStyleDlg::setVisualFromStyleList()
|
||||||
iFontName = 0;
|
iFontName = 0;
|
||||||
}
|
}
|
||||||
::SendMessage(_hFontNameCombo, CB_SETCURSEL, iFontName, 0);
|
::SendMessage(_hFontNameCombo, CB_SETCURSEL, iFontName, 0);
|
||||||
enableFontName(isEnable);
|
::EnableWindow(_hFontNameCombo, isEnable);
|
||||||
|
InvalidateRect(_hFontNameStaticText, NULL, FALSE);
|
||||||
|
|
||||||
//-- font size
|
//-- font size
|
||||||
isEnable = false;
|
isEnable = false;
|
||||||
|
@ -923,7 +980,8 @@ void WordStyleDlg::setVisualFromStyleList()
|
||||||
isEnable = true;
|
isEnable = true;
|
||||||
}
|
}
|
||||||
::SendMessage(_hFontSizeCombo, CB_SETCURSEL, iFontSize, 0);
|
::SendMessage(_hFontSizeCombo, CB_SETCURSEL, iFontSize, 0);
|
||||||
enableFontSize(isEnable);
|
::EnableWindow(_hFontSizeCombo, isEnable);
|
||||||
|
InvalidateRect(_hFontSizeStaticText, NULL, FALSE);
|
||||||
|
|
||||||
//-- font style : bold & italic
|
//-- font style : bold & italic
|
||||||
isEnable = false;
|
isEnable = false;
|
||||||
|
|
|
@ -177,26 +177,6 @@ private :
|
||||||
|
|
||||||
void loadLangListFromNppParam();
|
void loadLangListFromNppParam();
|
||||||
|
|
||||||
void enableFg(bool isEnable) {
|
|
||||||
::EnableWindow(_pFgColour->getHSelf(), isEnable);
|
|
||||||
::EnableWindow(_hFgColourStaticText, isEnable);
|
|
||||||
};
|
|
||||||
|
|
||||||
void enableBg(bool isEnable) {
|
|
||||||
::EnableWindow(_pBgColour->getHSelf(), isEnable);
|
|
||||||
::EnableWindow(_hBgColourStaticText, isEnable);
|
|
||||||
};
|
|
||||||
|
|
||||||
void enableFontName(bool isEnable) {
|
|
||||||
::EnableWindow(_hFontNameCombo, isEnable);
|
|
||||||
::EnableWindow(_hFontNameStaticText, isEnable);
|
|
||||||
};
|
|
||||||
|
|
||||||
void enableFontSize(bool isEnable) {
|
|
||||||
::EnableWindow(_hFontSizeCombo, isEnable);
|
|
||||||
::EnableWindow(_hFontSizeStaticText, isEnable);
|
|
||||||
};
|
|
||||||
|
|
||||||
void enableFontStyle(bool isEnable) {
|
void enableFontStyle(bool isEnable) {
|
||||||
::EnableWindow(_hCheckBold, isEnable);
|
::EnableWindow(_hCheckBold, isEnable);
|
||||||
::EnableWindow(_hCheckItalic, isEnable);
|
::EnableWindow(_hCheckItalic, isEnable);
|
||||||
|
|
Loading…
Reference in New Issue