GUI visual enhancement: optimize dlg items redraw

Fix #13230, close #13231
This commit is contained in:
ozone10 2023-02-24 18:51:39 +01:00 committed by Don Ho
parent 269e78bc1e
commit b8291d4911
3 changed files with 146 additions and 247 deletions

View File

@ -73,22 +73,14 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
} }
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{ {
@ -104,13 +96,8 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
bool isTextEnabled = isCheckedOrNot(IDC_COL_NUM_RADIO); bool isTextEnabled = isCheckedOrNot(IDC_COL_NUM_RADIO);
return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled); return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled);
} }
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorDarker(hdcStatic); return NppDarkMode::onCtlColorDarker(hdcStatic);
} }
return FALSE;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -125,7 +112,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
{ {
if (NppDarkMode::isEnabled()) if (NppDarkMode::isEnabled())
{ {
RECT rc = {}; RECT rc{};
getClientRect(rc); getClientRect(rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush()); ::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
return TRUE; return TRUE;
@ -135,6 +122,11 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
case NPPM_INTERNAL_REFRESHDARKMODE: case NPPM_INTERNAL_REFRESHDARKMODE:
{ {
if (NppDarkMode::isEnabled())
{
const ColumnEditorParam& colEditParam = NppParameters::getInstance()._columnEditParam;
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_FORMAT_GRP_STATIC), !colEditParam._mainChoice);
}
NppDarkMode::autoThemeChildControls(_hSelf); NppDarkMode::autoThemeChildControls(_hSelf);
return TRUE; return TRUE;
} }
@ -467,7 +459,15 @@ void ColumnEditorDlg::switchTo(bool toText)
::SetFocus(toText?hText:hNum); ::SetFocus(toText?hText:hNum);
redraw(); redrawDlgItem(IDC_COL_INITNUM_STATIC);
redrawDlgItem(IDC_COL_INCRNUM_STATIC);
redrawDlgItem(IDC_COL_REPEATNUM_STATIC);
if (NppDarkMode::isEnabled())
{
::EnableWindow(::GetDlgItem(_hSelf, IDC_COL_FORMAT_GRP_STATIC), !toText);
redrawDlgItem(IDC_COL_FORMAT_GRP_STATIC);
}
} }
UCHAR ColumnEditorDlg::getFormat() UCHAR ColumnEditorDlg::getFormat()

View File

@ -210,23 +210,15 @@ intptr_t CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
} }
case WM_CTLCOLORLISTBOX: case WM_CTLCOLORLISTBOX:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorListbox(wParam, lParam); return NppDarkMode::onCtlColorListbox(wParam, lParam);
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -256,6 +248,19 @@ intptr_t CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (_performanceSubDlg._largeFileRestrictionTip != nullptr) if (_performanceSubDlg._largeFileRestrictionTip != nullptr)
NppDarkMode::setDarkTooltips(_performanceSubDlg._largeFileRestrictionTip, NppDarkMode::ToolTipsType::tooltip); NppDarkMode::setDarkTooltips(_performanceSubDlg._largeFileRestrictionTip, NppDarkMode::ToolTipsType::tooltip);
// groupbox label in dark mode support disabled text color
if (NppDarkMode::isEnabled())
{
const NppGUI& nppGUI = NppParameters::getInstance().getNppGUI();
::EnableWindow(::GetDlgItem(_highlightingSubDlg.getHSelf(), IDC_SMARTHILITEMATCHING_STATIC), nppGUI._enableSmartHilite);
const bool noBackup = _backupSubDlg.isCheckedOrNot(IDC_RADIO_BKNONE);
::EnableWindow(::GetDlgItem(_backupSubDlg.getHSelf(), IDC_BACKUPDIR_USERCUSTOMDIR_GRPSTATIC), !noBackup);
const bool isEnableAutoC = _autoCompletionSubDlg.isCheckedOrNot(IDD_AUTOC_ENABLECHECK);
::EnableWindow(::GetDlgItem(_autoCompletionSubDlg.getHSelf(), IDD_AUTOC_USEKEY_GRP_STATIC), isEnableAutoC);
}
return TRUE; return TRUE;
} }
@ -589,23 +594,15 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
} }
case WM_CTLCOLORLISTBOX: case WM_CTLCOLORLISTBOX:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -831,7 +828,8 @@ void EditingSubDlg::initScintParam()
void EditingSubDlg::changeLineHiliteMode(bool enableSlider) void EditingSubDlg::changeLineHiliteMode(bool enableSlider)
{ {
::EnableWindow(::GetDlgItem(_hSelf, IDC_CARETLINEFRAME_WIDTH_SLIDER), enableSlider); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CARETLINEFRAME_WIDTH_SLIDER), enableSlider);
redraw(); redrawDlgItem(IDC_CARETLINEFRAME_WIDTH_STATIC);
redrawDlgItem(IDC_CARETLINEFRAME_WIDTH_DISPLAY);
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_CURLINE_HILITING, 0); ::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_CURLINE_HILITING, 0);
} }
@ -984,31 +982,19 @@ intptr_t CALLBACK EditingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
} }
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORLISTBOX: case WM_CTLCOLORLISTBOX:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{ {
@ -1019,13 +1005,8 @@ intptr_t CALLBACK EditingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
return NppDarkMode::onCtlColorDarkerBGStaticText(reinterpret_cast<HDC>(wParam), (svp._currentLineHiliteMode == LINEHILITE_FRAME)); return NppDarkMode::onCtlColorDarkerBGStaticText(reinterpret_cast<HDC>(wParam), (svp._currentLineHiliteMode == LINEHILITE_FRAME));
} }
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -1255,8 +1236,6 @@ void DarkModeSubDlg::enableCustomizedColorCtrls(bool doEnable)
_pLinkColorPicker->setColour(NppDarkMode::getLinkTextColor()); _pLinkColorPicker->setColour(NppDarkMode::getLinkTextColor());
_pHotEdgeColorPicker->setColour(NppDarkMode::getHotEdgeColor()); _pHotEdgeColorPicker->setColour(NppDarkMode::getHotEdgeColor());
_pDisabledEdgeColorPicker->setColour(NppDarkMode::getDisabledEdgeColor()); _pDisabledEdgeColorPicker->setColour(NppDarkMode::getDisabledEdgeColor());
redraw();
} }
} }
@ -1700,8 +1679,6 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
_pLinkColorPicker->setColour(disabledColor); _pLinkColorPicker->setColour(disabledColor);
_pHotEdgeColorPicker->setColour(disabledColor); _pHotEdgeColorPicker->setColour(disabledColor);
_pDisabledEdgeColorPicker->setColour(disabledColor); _pDisabledEdgeColorPicker->setColour(disabledColor);
redraw();
} }
NppDarkMode::refreshDarkMode(_hSelf, forceRefresh); NppDarkMode::refreshDarkMode(_hSelf, forceRefresh);
@ -1818,23 +1795,15 @@ intptr_t CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPar
} }
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -2056,32 +2025,20 @@ intptr_t CALLBACK MiscSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
} }
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORLISTBOX: case WM_CTLCOLORLISTBOX:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -2381,23 +2338,15 @@ intptr_t CALLBACK NewDocumentSubDlg::run_dlgProc(UINT message, WPARAM wParam, LP
} }
case WM_CTLCOLORLISTBOX: case WM_CTLCOLORLISTBOX:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -2537,23 +2486,15 @@ intptr_t CALLBACK DefaultDirectorySubDlg::run_dlgProc(UINT message, WPARAM wPara
} }
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -3416,18 +3357,19 @@ intptr_t CALLBACK HighlightingSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEUSEFINDSETTINGS), nppGUI._enableSmartHilite); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEUSEFINDSETTINGS), nppGUI._enableSmartHilite);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEANOTHERRVIEW), nppGUI._enableSmartHilite); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEANOTHERRVIEW), nppGUI._enableSmartHilite);
if (NppDarkMode::isEnabled())
{
::EnableWindow(::GetDlgItem(_hSelf, IDC_SMARTHILITEMATCHING_STATIC), nppGUI._enableSmartHilite);
}
return TRUE; return TRUE;
} }
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -3470,6 +3412,13 @@ intptr_t CALLBACK HighlightingSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEWHOLEWORDONLY), nppGUI._enableSmartHilite); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEWHOLEWORDONLY), nppGUI._enableSmartHilite);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEUSEFINDSETTINGS), nppGUI._enableSmartHilite); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEUSEFINDSETTINGS), nppGUI._enableSmartHilite);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEANOTHERRVIEW), nppGUI._enableSmartHilite); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEANOTHERRVIEW), nppGUI._enableSmartHilite);
if (NppDarkMode::isEnabled())
{
::EnableWindow(::GetDlgItem(_hSelf, IDC_SMARTHILITEMATCHING_STATIC), nppGUI._enableSmartHilite);
redrawDlgItem(IDC_SMARTHILITEMATCHING_STATIC);
}
HWND grandParent = ::GetParent(_hParent); HWND grandParent = ::GetParent(_hParent);
::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0); ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0);
return TRUE; return TRUE;
@ -3655,36 +3604,24 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_SETCURSEL, 0, 0); ::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_SETCURSEL, 0, 0);
break; return TRUE;
} }
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORLISTBOX: case WM_CTLCOLORLISTBOX:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -3957,27 +3894,21 @@ intptr_t CALLBACK BackupSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>((nppGUI._backupDir.c_str()))); ::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>((nppGUI._backupDir.c_str())));
updateBackupGUI(); updateBackupSessionGUI();
updateBackupOnSaveGUI();
return TRUE; return TRUE;
} }
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{ {
@ -4000,16 +3931,12 @@ intptr_t CALLBACK BackupSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled); return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled);
} }
if (NppDarkMode::isEnabled())
{
if (dlgCtrlID == IDD_BACKUPDIR_RESTORESESSION_PATH_EDIT) if (dlgCtrlID == IDD_BACKUPDIR_RESTORESESSION_PATH_EDIT)
{ {
return NppDarkMode::onCtlColor(hdcStatic); return NppDarkMode::onCtlColor(hdcStatic);
} }
return NppDarkMode::onCtlColorDarker(hdcStatic); return NppDarkMode::onCtlColorDarker(hdcStatic);
} }
return FALSE;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -4085,13 +4012,13 @@ intptr_t CALLBACK BackupSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_RESTORESESSION_CHECK, BM_SETCHECK, BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_RESTORESESSION_CHECK, BM_SETCHECK, BST_UNCHECKED, 0);
::SendMessage(_hSelf, WM_COMMAND, IDC_BACKUPDIR_RESTORESESSION_CHECK, 0); ::SendMessage(_hSelf, WM_COMMAND, IDC_BACKUPDIR_RESTORESESSION_CHECK, 0);
} }
updateBackupGUI(); updateBackupSessionGUI();
return TRUE; return TRUE;
} }
case IDC_BACKUPDIR_RESTORESESSION_CHECK: case IDC_BACKUPDIR_RESTORESESSION_CHECK:
{ {
nppGUI._isSnapshotMode = BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_RESTORESESSION_CHECK, BM_GETCHECK, 0, 0); nppGUI._isSnapshotMode = BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_RESTORESESSION_CHECK, BM_GETCHECK, 0, 0);
updateBackupGUI(); updateBackupSessionGUI();
if (nppGUI._isSnapshotMode) if (nppGUI._isSnapshotMode)
{ {
@ -4104,28 +4031,28 @@ intptr_t CALLBACK BackupSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case IDC_RADIO_BKSIMPLE: case IDC_RADIO_BKSIMPLE:
{ {
nppGUI._backup = bak_simple; nppGUI._backup = bak_simple;
updateBackupGUI(); updateBackupOnSaveGUI();
return TRUE; return TRUE;
} }
case IDC_RADIO_BKVERBOSE: case IDC_RADIO_BKVERBOSE:
{ {
nppGUI._backup = bak_verbose; nppGUI._backup = bak_verbose;
updateBackupGUI(); updateBackupOnSaveGUI();
return TRUE; return TRUE;
} }
case IDC_RADIO_BKNONE: case IDC_RADIO_BKNONE:
{ {
nppGUI._backup = bak_none; nppGUI._backup = bak_none;
updateBackupGUI(); updateBackupOnSaveGUI();
return TRUE; return TRUE;
} }
case IDC_BACKUPDIR_CHECK: case IDC_BACKUPDIR_CHECK:
{ {
nppGUI._useDir = !nppGUI._useDir; nppGUI._useDir = !nppGUI._useDir;
updateBackupGUI(); updateBackupOnSaveGUI();
return TRUE; return TRUE;
} }
case IDD_BACKUPDIR_BROWSE_BUTTON : case IDD_BACKUPDIR_BROWSE_BUTTON :
@ -4146,7 +4073,7 @@ intptr_t CALLBACK BackupSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
return FALSE; return FALSE;
} }
void BackupSubDlg::updateBackupGUI() void BackupSubDlg::updateBackupSessionGUI()
{ {
bool rememberSession = isCheckedOrNot(IDC_CHECK_REMEMBERSESSION); bool rememberSession = isCheckedOrNot(IDC_CHECK_REMEMBERSESSION);
bool isSnapshot = isCheckedOrNot(IDC_BACKUPDIR_RESTORESESSION_CHECK); bool isSnapshot = isCheckedOrNot(IDC_BACKUPDIR_RESTORESESSION_CHECK);
@ -4154,6 +4081,13 @@ void BackupSubDlg::updateBackupGUI()
::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT), isSnapshot); ::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT), isSnapshot);
::EnableWindow(::GetDlgItem(_hSelf, IDD_BACKUPDIR_RESTORESESSION_PATH_EDIT), isSnapshot); ::EnableWindow(::GetDlgItem(_hSelf, IDD_BACKUPDIR_RESTORESESSION_PATH_EDIT), isSnapshot);
redrawDlgItem(IDD_BACKUPDIR_RESTORESESSION_STATIC1);
redrawDlgItem(IDD_BACKUPDIR_RESTORESESSION_STATIC2);
redrawDlgItem(IDD_BACKUPDIR_RESTORESESSION_PATHLABEL_STATIC);
}
void BackupSubDlg::updateBackupOnSaveGUI()
{
bool noBackup = BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_RADIO_BKNONE, BM_GETCHECK, 0, 0); bool noBackup = BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_RADIO_BKNONE, BM_GETCHECK, 0, 0);
bool isEnableGlobableCheck = false; bool isEnableGlobableCheck = false;
bool isEnableLocalCheck = false; bool isEnableLocalCheck = false;
@ -4168,7 +4102,13 @@ void BackupSubDlg::updateBackupGUI()
::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKUPDIR_EDIT), isEnableLocalCheck); ::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKUPDIR_EDIT), isEnableLocalCheck);
::EnableWindow(::GetDlgItem(_hSelf, IDD_BACKUPDIR_BROWSE_BUTTON), isEnableLocalCheck); ::EnableWindow(::GetDlgItem(_hSelf, IDD_BACKUPDIR_BROWSE_BUTTON), isEnableLocalCheck);
redraw(); // redrawDlgItem(IDD_BACKUPDIR_STATIC); // not needed, IDD_BACKUPDIR_STATIC rect is inside IDC_BACKUPDIR_USERCUSTOMDIR_GRPSTATIC rect
if (NppDarkMode::isEnabled())
{
::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKUPDIR_USERCUSTOMDIR_GRPSTATIC), !noBackup);
redrawDlgItem(IDC_BACKUPDIR_USERCUSTOMDIR_GRPSTATIC);
}
} }
@ -4219,6 +4159,11 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_USETAB), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_USETAB), FALSE);
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_IGNORENUMBERS), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_IGNORENUMBERS), FALSE);
::EnableWindow(::GetDlgItem(_hSelf, IDC_AUTOC_CHAR_SLIDER), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDC_AUTOC_CHAR_SLIDER), FALSE);
if (NppDarkMode::isEnabled())
{
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_USEKEY_GRP_STATIC), FALSE);
}
} }
::SendDlgItemMessage(_hSelf, IDC_CHECK_MAINTAININDENT, BM_SETCHECK, nppGUI._maitainIndent, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_MAINTAININDENT, BM_SETCHECK, nppGUI._maitainIndent, 0);
@ -4287,22 +4232,14 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
} }
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{ {
@ -4321,12 +4258,8 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled); return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled);
} }
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorDarker(hdcStatic); return NppDarkMode::onCtlColorDarker(hdcStatic);
} }
return FALSE;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -4429,7 +4362,18 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_IGNORENUMBERS), isEnableAutoC); ::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_IGNORENUMBERS), isEnableAutoC);
::EnableWindow(::GetDlgItem(_hSelf, IDC_AUTOC_CHAR_SLIDER), isEnableAutoC); ::EnableWindow(::GetDlgItem(_hSelf, IDC_AUTOC_CHAR_SLIDER), isEnableAutoC);
redraw(); redrawDlgItem(IDD_AUTOC_STATIC_FROM);
redrawDlgItem(IDD_AUTOC_STATIC_N);
redrawDlgItem(IDD_AUTOC_STATIC_CHAR);
redrawDlgItem(IDD_AUTOC_SLIDER_MIN_STATIC);
redrawDlgItem(IDD_AUTOC_SLIDER_MAX_STATIC);
if (NppDarkMode::isEnabled())
{
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_USEKEY_GRP_STATIC), isEnableAutoC);
redrawDlgItem(IDD_AUTOC_USEKEY_GRP_STATIC);
}
return TRUE; return TRUE;
} }
@ -4573,27 +4517,20 @@ intptr_t CALLBACK MultiInstanceSubDlg::run_dlgProc(UINT message, WPARAM wParam,
::SetDlgItemText(_hSelf, IDC_DATETIMEFORMAT_EDIT, nppGUI._dateTimeFormat.c_str()); ::SetDlgItemText(_hSelf, IDC_DATETIMEFORMAT_EDIT, nppGUI._dateTimeFormat.c_str());
generic_string datetimeStr = getDateTimeStrFrom(nppGUI._dateTimeFormat, _BTTF_time); generic_string datetimeStr = getDateTimeStrFrom(nppGUI._dateTimeFormat, _BTTF_time);
::SetDlgItemText(_hSelf, IDD_DATETIMEFORMAT_RESULT_STATIC, datetimeStr.c_str()); ::SetDlgItemText(_hSelf, IDD_DATETIMEFORMAT_RESULT_STATIC, datetimeStr.c_str());
return TRUE;
} }
break;
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -4886,22 +4823,14 @@ intptr_t CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
} }
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{ {
@ -5110,26 +5039,19 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_CLICKABLELINK_NOUNDERLINE), linkEnable); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_CLICKABLELINK_NOUNDERLINE), linkEnable);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_CLICKABLELINK_FULLBOXMODE), linkEnable); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_CLICKABLELINK_FULLBOXMODE), linkEnable);
::EnableWindow(::GetDlgItem(_hSelf, IDC_URISCHEMES_EDIT), linkEnable); ::EnableWindow(::GetDlgItem(_hSelf, IDC_URISCHEMES_EDIT), linkEnable);
return TRUE;
} }
break;
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{ {
@ -5144,12 +5066,8 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled); return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled);
} }
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorDarker(hdcStatic); return NppDarkMode::onCtlColorDarker(hdcStatic);
} }
return FALSE;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -5213,7 +5131,7 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_CLICKABLELINK_FULLBOXMODE), isChecked); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_CLICKABLELINK_FULLBOXMODE), isChecked);
::EnableWindow(::GetDlgItem(_hSelf, IDC_URISCHEMES_EDIT), isChecked); ::EnableWindow(::GetDlgItem(_hSelf, IDC_URISCHEMES_EDIT), isChecked);
redraw(); redrawDlgItem(IDC_CLICKABLELINK_STATIC);
nppGUI._styleURL = isChecked ? urlUnderLineFg : urlDisable; nppGUI._styleURL = isChecked ? urlUnderLineFg : urlDisable;
HWND grandParent = ::GetParent(_hParent); HWND grandParent = ::GetParent(_hParent);
@ -5328,26 +5246,19 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string enablePerfTip = pNativeSpeaker->getLocalizedStrFromID("largeFileRestriction-tip", TEXT("Some features may slow performance in large files. These features can be auto-disabled on opening a large file. You can customize them here.\n\nNOTE:\n1. Modifying options here requires re-open currently opened large files to get proper behavior.\n\n2. If \"Deactivate Word Wrap globally\" is checked and you open a large file, \"Word Wrap\" will be disabled for all files. You can re-enable it via menu \"View->Word Wrap\"")); generic_string enablePerfTip = pNativeSpeaker->getLocalizedStrFromID("largeFileRestriction-tip", TEXT("Some features may slow performance in large files. These features can be auto-disabled on opening a large file. You can customize them here.\n\nNOTE:\n1. Modifying options here requires re-open currently opened large files to get proper behavior.\n\n2. If \"Deactivate Word Wrap globally\" is checked and you open a large file, \"Word Wrap\" will be disabled for all files. You can re-enable it via menu \"View->Word Wrap\""));
_largeFileRestrictionTip = CreateToolTip(IDD_PERFORMANCE_TIP_QUESTION_BUTTON, _hSelf, _hInst, const_cast<PTSTR>(enablePerfTip.c_str()), false); _largeFileRestrictionTip = CreateToolTip(IDD_PERFORMANCE_TIP_QUESTION_BUTTON, _hSelf, _hInst, const_cast<PTSTR>(enablePerfTip.c_str()), false);
return TRUE;
} }
break;
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{ {
@ -5362,16 +5273,12 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L
return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled); return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled);
} }
if (NppDarkMode::isEnabled())
{
if (dlgCtrlID == IDC_EDIT_PERFORMANCE_FILESIZE) if (dlgCtrlID == IDC_EDIT_PERFORMANCE_FILESIZE)
{ {
return NppDarkMode::onCtlColor(hdcStatic); return NppDarkMode::onCtlColor(hdcStatic);
} }
return NppDarkMode::onCtlColorDarker(hdcStatic); return NppDarkMode::onCtlColorDarker(hdcStatic);
} }
return FALSE;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -5398,7 +5305,8 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWCLICKABLELINK), largeFileRestrictionEnabled); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWCLICKABLELINK), largeFileRestrictionEnabled);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_DEACTIVATEWORDWRAP), largeFileRestrictionEnabled); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_DEACTIVATEWORDWRAP), largeFileRestrictionEnabled);
redraw(); redrawDlgItem(IDC_STATIC_PERFORMANCE_FILESIZE);
redrawDlgItem(IDC_STATIC_PERFORMANCE_MB);
if (largeFileRestrictionEnabled) if (largeFileRestrictionEnabled)
{ {
@ -5502,27 +5410,20 @@ intptr_t CALLBACK SearchEngineSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
::SendDlgItemMessage(_hSelf, IDC_SEARCHENGINE_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(nppGUI._searchEngineCustom.c_str())); ::SendDlgItemMessage(_hSelf, IDC_SEARCHENGINE_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(nppGUI._searchEngineCustom.c_str()));
::EnableWindow(::GetDlgItem(_hSelf, IDC_SEARCHENGINE_EDIT), nppGUI._searchEngineChoice == nppGUI.se_custom); ::EnableWindow(::GetDlgItem(_hSelf, IDC_SEARCHENGINE_EDIT), nppGUI._searchEngineChoice == nppGUI.se_custom);
return TRUE;
} }
break;
case WM_CTLCOLOREDIT: case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
@ -5598,18 +5499,15 @@ intptr_t CALLBACK SearchingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
::SendDlgItemMessage(_hSelf, IDC_CHECK_CONFIRMREPLOPENDOCS, BM_SETCHECK, nppGUI._confirmReplaceInAllOpenDocs, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_CONFIRMREPLOPENDOCS, BM_SETCHECK, nppGUI._confirmReplaceInAllOpenDocs, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_REPLACEANDSTOP, BM_SETCHECK, nppGUI._replaceStopsWithoutFindingNext, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_REPLACEANDSTOP, BM_SETCHECK, nppGUI._replaceStopsWithoutFindingNext, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_SHOWONCEPERFOUNDLINE, BM_SETCHECK, nppGUI._finderShowOnlyOneEntryPerFoundLine, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_SHOWONCEPERFOUNDLINE, BM_SETCHECK, nppGUI._finderShowOnlyOneEntryPerFoundLine, 0);
return TRUE;
} }
break;
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC: case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
break;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {

View File

@ -199,7 +199,8 @@ public :
BackupSubDlg() = default; BackupSubDlg() = default;
private : private :
void updateBackupGUI(); void updateBackupSessionGUI();
void updateBackupOnSaveGUI();
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
}; };