Fix toolbar icons switching in dark mode makes incoherence in Preferences dialog
ref: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9742#issuecomment-836757562
This commit is contained in:
parent
2d4640ce42
commit
c230ccf1bd
|
@ -214,6 +214,20 @@ INT_PTR CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
case PREF_MSG_ISCHECKED_GENERALPAGE:
|
||||
{
|
||||
if (!lParam)
|
||||
return FALSE;
|
||||
|
||||
bool isChecked = _generalSubDlg.isCheckedOrNot(wParam);
|
||||
*((bool*)lParam) = isChecked;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case PREF_MSG_SETTOOLICONSFROMSTDTOSMALL:
|
||||
_generalSubDlg.setToolIconsFromStdToSmall();
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND :
|
||||
{
|
||||
if (LOWORD(wParam) == IDC_LIST_DLGTITLE)
|
||||
|
@ -359,6 +373,13 @@ void PreferenceDlg::destroy()
|
|||
_delimiterSubDlg.destroy();
|
||||
}
|
||||
|
||||
void GeneralSubDlg::setToolIconsFromStdToSmall()
|
||||
{
|
||||
::SendDlgItemMessage(_hSelf, IDC_RADIO_STANDARD, BM_SETCHECK, BST_UNCHECKED, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_RADIO_SMALLICON, BM_SETCHECK, BST_CHECKED, 0);
|
||||
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_TOOLBAR_REDUCE, 0);
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
|
||||
{
|
||||
NppParameters& nppParam = NppParameters::getInstance();
|
||||
|
@ -806,6 +827,15 @@ INT_PTR CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
{
|
||||
case IDC_CHECK_DARKMODE_ENABLE:
|
||||
nppGUI._darkmode.enable = isCheckedOrNot(static_cast<int>(wParam));
|
||||
|
||||
// if dark mode enabled & TB_STANDARD is selected, switch to TB_SMALL
|
||||
if (nppGUI._darkmode.enable)
|
||||
{
|
||||
bool isStandardChecked = false;
|
||||
::SendMessage(_hParent, PREF_MSG_ISCHECKED_GENERALPAGE, IDC_RADIO_STANDARD, LPARAM(&isStandardChecked));
|
||||
if (isStandardChecked)
|
||||
::SendMessage(_hParent, PREF_MSG_SETTOOLICONSFROMSTDTOSMALL, 0, 0);
|
||||
}
|
||||
changed = true;
|
||||
break;
|
||||
case IDC_CHECK_DARKMODE_ENABLE_EXPERIMENTAL:
|
||||
|
|
|
@ -37,6 +37,8 @@ class GeneralSubDlg : public StaticDialog
|
|||
{
|
||||
public :
|
||||
GeneralSubDlg() = default;
|
||||
void setToolIconsFromStdToSmall();
|
||||
|
||||
private :
|
||||
INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
};
|
||||
|
|
|
@ -17,10 +17,12 @@
|
|||
#ifndef PREFERENCE_RC_H
|
||||
#define PREFERENCE_RC_H
|
||||
|
||||
#define PREF_MSG_ISCHECKED_GENERALPAGE (WM_USER + 1) // wParam:checkbox/radiobutton ID in General page. lParam is type of "bool *" to get result
|
||||
#define PREF_MSG_SETTOOLICONSFROMSTDTOSMALL (WM_USER + 2)
|
||||
|
||||
#define IDD_PREFERENCE_BOX 6000
|
||||
#define IDC_BUTTON_CLOSE (IDD_PREFERENCE_BOX + 1)
|
||||
#define IDC_LIST_DLGTITLE (IDD_PREFERENCE_BOX + 2)
|
||||
|
||||
|
||||
#define IDD_PREFERENCE_SUB_GENRAL 6100 //(IDD_PREFERENCE_BOX + 100)
|
||||
#define IDC_TOOLBAR_GB_STATIC (IDD_PREFERENCE_SUB_GENRAL + 1)
|
||||
|
|
Loading…
Reference in New Issue