GUI Enhancement: Preference Print sub-dialog

- add initializers
- reorder controls for tab focus
- add accelerators
- make comboboxes larger
- replace variable static text with edit control
- fix override warnings

Fix #13601, fix #12812, close #13602
pull/13616/head
ozone10 2023-04-30 18:55:15 +02:00 committed by Don Ho
parent 23a0cfb3aa
commit 6b194453b8
6 changed files with 166 additions and 148 deletions

View File

@ -1071,30 +1071,30 @@ You can define several column markers by using white space to separate the diffe
</Highlighting> </Highlighting>
<Print title="Print"> <Print title="Print">
<Item id="6601" name="Print line number"/> <Item id="6601" name="Print line n&amp;umber"/>
<Item id="6602" name="Color Options"/> <Item id="6602" name="Color Options"/>
<Item id="6603" name="WYSIWYG"/> <Item id="6603" name="W&amp;YSIWYG"/>
<Item id="6604" name="Invert"/> <Item id="6604" name="I&amp;nvert"/>
<Item id="6605" name="Black on white"/> <Item id="6605" name="Black on &amp;white"/>
<Item id="6606" name="No background color"/> <Item id="6606" name="No bac&amp;kground color"/>
<Item id="6607" name="Margin Settings (Unit:mm)"/> <Item id="6607" name="Margin Settings (Unit:mm)"/>
<Item id="6612" name="Left"/> <Item id="6612" name="&amp;Left"/>
<Item id="6613" name="Top"/> <Item id="6613" name="&amp;Top"/>
<Item id="6614" name="Right"/> <Item id="6614" name="&amp;Right"/>
<Item id="6615" name="Bottom"/> <Item id="6615" name="Botto&amp;m"/>
<Item id="6706" name="Bold"/> <Item id="6706" name="&amp;Bold"/>
<Item id="6707" name="Italic"/> <Item id="6707" name="&amp;Italic"/>
<Item id="6708" name="Header"/> <Item id="6708" name="Header"/>
<Item id="6709" name="Left part"/> <Item id="6709" name="L&amp;eft part"/>
<Item id="6710" name="Middle part"/> <Item id="6710" name="&amp;Middle part"/>
<Item id="6711" name="Right part"/> <Item id="6711" name="Ri&amp;ght part"/>
<Item id="6717" name="Bold"/> <Item id="6717" name="Bol&amp;d"/>
<Item id="6718" name="Italic"/> <Item id="6718" name="Itali&amp;c"/>
<Item id="6719" name="Footer"/> <Item id="6719" name="Footer"/>
<Item id="6720" name="Left part"/> <Item id="6720" name="Le&amp;ft part"/>
<Item id="6721" name="Middle part"/> <Item id="6721" name="Middle &amp;part"/>
<Item id="6722" name="Right part"/> <Item id="6722" name="Rig&amp;ht part"/>
<Item id="6723" name="Add"/> <Item id="6723" name="&amp;Add"/>
<ComboBox id="6724"> <ComboBox id="6724">
<Element name="Full file name path"/> <Element name="Full file name path"/>
<Element name="File name"/> <Element name="File name"/>
@ -1104,7 +1104,7 @@ You can define several column markers by using white space to separate the diffe
<Element name="Long date format"/> <Element name="Long date format"/>
<Element name="Time"/> <Element name="Time"/>
</ComboBox> </ComboBox>
<Item id="6725" name="Variable:"/> <Item id="6725" name="&amp;Variable:"/>
<Item id="6727" name="Here display your variable settings"/> <Item id="6727" name="Here display your variable settings"/>
<Item id="6728" name="Header and Footer"/> <Item id="6728" name="Header and Footer"/>
</Print> </Print>

View File

@ -1066,30 +1066,30 @@ You can define several column markers by using white space to separate the diffe
</Highlighting> </Highlighting>
<Print title="Print"> <Print title="Print">
<Item id="6601" name="Print line number"/> <Item id="6601" name="Print line n&amp;umber"/>
<Item id="6602" name="Color Options"/> <Item id="6602" name="Color Options"/>
<Item id="6603" name="WYSIWYG"/> <Item id="6603" name="W&amp;YSIWYG"/>
<Item id="6604" name="Invert"/> <Item id="6604" name="I&amp;nvert"/>
<Item id="6605" name="Black on white"/> <Item id="6605" name="Black on &amp;white"/>
<Item id="6606" name="No background color"/> <Item id="6606" name="No bac&amp;kground color"/>
<Item id="6607" name="Margin Settings (Unit:mm)"/> <Item id="6607" name="Margin Settings (Unit:mm)"/>
<Item id="6612" name="Left"/> <Item id="6612" name="&amp;Left"/>
<Item id="6613" name="Top"/> <Item id="6613" name="&amp;Top"/>
<Item id="6614" name="Right"/> <Item id="6614" name="&amp;Right"/>
<Item id="6615" name="Bottom"/> <Item id="6615" name="Botto&amp;m"/>
<Item id="6706" name="Bold"/> <Item id="6706" name="&amp;Bold"/>
<Item id="6707" name="Italic"/> <Item id="6707" name="&amp;Italic"/>
<Item id="6708" name="Header"/> <Item id="6708" name="Header"/>
<Item id="6709" name="Left part"/> <Item id="6709" name="L&amp;eft part"/>
<Item id="6710" name="Middle part"/> <Item id="6710" name="&amp;Middle part"/>
<Item id="6711" name="Right part"/> <Item id="6711" name="Ri&amp;ght part"/>
<Item id="6717" name="Bold"/> <Item id="6717" name="Bol&amp;d"/>
<Item id="6718" name="Italic"/> <Item id="6718" name="Itali&amp;c"/>
<Item id="6719" name="Footer"/> <Item id="6719" name="Footer"/>
<Item id="6720" name="Left part"/> <Item id="6720" name="Le&amp;ft part"/>
<Item id="6721" name="Middle part"/> <Item id="6721" name="Middle &amp;part"/>
<Item id="6722" name="Right part"/> <Item id="6722" name="Rig&amp;ht part"/>
<Item id="6723" name="Add"/> <Item id="6723" name="&amp;Add"/>
<ComboBox id="6724"> <ComboBox id="6724">
<Element name="Full file name path"/> <Element name="Full file name path"/>
<Element name="File name"/> <Element name="File name"/>
@ -1099,7 +1099,7 @@ You can define several column markers by using white space to separate the diffe
<Element name="Long date format"/> <Element name="Long date format"/>
<Element name="Time"/> <Element name="Time"/>
</ComboBox> </ComboBox>
<Item id="6725" name="Variable:"/> <Item id="6725" name="&amp;Variable:"/>
<Item id="6727" name="Here display your variable settings"/> <Item id="6727" name="Here display your variable settings"/>
<Item id="6728" name="Header and Footer"/> <Item id="6728" name="Header and Footer"/>
</Print> </Print>

View File

@ -292,49 +292,55 @@ IDD_PREFERENCE_SUB_PRINT DIALOGEX 115, 10, 460, 205
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
CONTROL "WYSIWYG",IDC_RADIO_WYSIWYG,"Button",BS_AUTORADIOBUTTON,12,30,123,10 CONTROL "Print line n&umber",IDC_CHECK_PRINTLINENUM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,3,133,10
CONTROL "Invert",IDC_RADIO_INVERT,"Button",BS_AUTORADIOBUTTON,12,45,90,10
CONTROL "Black on white",IDC_RADIO_BW,"Button",BS_AUTORADIOBUTTON,12,60,90,10 GROUPBOX "Color Options",IDC_COLOUROPT_STATIC,6,18,133,74,BS_CENTER
CONTROL "No background colour",IDC_RADIO_NOBG,"Button",BS_AUTORADIOBUTTON,12,76,123,10 CONTROL "W&YSIWYG",IDC_RADIO_WYSIWYG,"Button",BS_AUTORADIOBUTTON,12,31,121,10
GROUPBOX "Colour Options",IDC_COLOUROPT_STATIC,6,20,133,73,BS_CENTER CONTROL "I&nvert",IDC_RADIO_INVERT,"Button",BS_AUTORADIOBUTTON,12,46,121,10
CONTROL "Print line number",IDC_CHECK_PRINTLINENUM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,6,133,10 CONTROL "Black on &white",IDC_RADIO_BW,"Button",BS_AUTORADIOBUTTON,12,61,121,10
EDITTEXT IDC_EDIT_ML,42,136,17,14,ES_NUMBER CONTROL "No bac&kground color",IDC_RADIO_NOBG,"Button",BS_AUTORADIOBUTTON,12,76,121,10
EDITTEXT IDC_EDIT_MT,59,120,17,14,ES_NUMBER
EDITTEXT IDC_EDIT_MR,77,136,17,14,ES_NUMBER GROUPBOX "Margin Setting (Unit:mm)",IDC_MARGESETTINGS_STATIC,6,98,133,83,BS_CENTER
EDITTEXT IDC_EDIT_MB,59,152,17,14,ES_NUMBER CTEXT "&Top",IDC_MT_STATIC,43,110,54,8
RTEXT "Left",IDC_ML_STATIC,9,139,30,8 EDITTEXT IDC_EDIT_MT,61,120,17,12,ES_CENTER | ES_NUMBER
CTEXT "Top",IDC_MT_STATIC,41,110,54,8 RTEXT "&Left",IDC_ML_STATIC,9,139,30,8
LTEXT "Right",IDC_MR_STATIC,99,139,29,8 EDITTEXT IDC_EDIT_ML,43,136,17,12,ES_CENTER | ES_NUMBER
CTEXT "Bottom",IDC_MB_STATIC,41,167,54,8 LTEXT "&Right",IDC_MR_STATIC,101,139,30,8
GROUPBOX "Margin Setting (Unit:mm)",IDC_MARGESETTINGS_STATIC,6,98,133,82,BS_CENTER EDITTEXT IDC_EDIT_MR,79,136,17,12,ES_CENTER | ES_NUMBER
EDITTEXT IDC_EDIT_HLEFT,166,58,83,14,ES_AUTOHSCROLL CTEXT "Botto&m",IDC_MB_STATIC,43,167,54,8
EDITTEXT IDC_EDIT_HMIDDLE,256,58,83,14,ES_CENTER | ES_AUTOHSCROLL EDITTEXT IDC_EDIT_MB,61,152,17,12,ES_CENTER | ES_NUMBER
EDITTEXT IDC_EDIT_HRIGHT,346,58,83,14,ES_RIGHT | ES_AUTOHSCROLL
COMBOBOX IDC_COMBO_HFONTNAME,166,76,84,104,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP GROUPBOX "Header and Footer",IDC_HEADERFPPTER_GR_STATIC,148,3,300,178,BS_CENTER
COMBOBOX IDC_COMBO_HFONTSIZE,256,76,31,72,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP RTEXT "&Variable:",IDC_VAR_STATIC,181,16,60,8
CONTROL "Bold",IDC_CHECK_HBOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,296,76,46,10 COMBOBOX IDC_COMBO_VARLIST,244,14,122,58,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Italic",IDC_CHECK_HITALIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,356,76,43,10 PUSHBUTTON "&Add",IDC_BUTTON_ADDVAR,369,14,50,13
GROUPBOX "Header",IDC_HGB_STATIC,158,39,279,56,BS_CENTER
CTEXT "Left part",IDC_HL_STATIC,168,49,79,8 GROUPBOX "Header",IDC_HGB_STATIC,156,30,284,57,BS_CENTER
CTEXT "Middle part",IDC_HM_STATIC,260,49,75,8 CTEXT "L&eft part",IDC_HL_STATIC,166,40,81,8
CTEXT "Right part",IDC_HR_STATIC,348,49,78,8 EDITTEXT IDC_EDIT_HLEFT,164,49,85,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_FLEFT,166,116,83,14,ES_AUTOHSCROLL CTEXT "&Middle part",IDC_HM_STATIC,257,40,82,8
EDITTEXT IDC_EDIT_FMIDDLE,257,116,83,14,ES_CENTER | ES_AUTOHSCROLL EDITTEXT IDC_EDIT_HMIDDLE,255,49,86,12,ES_CENTER | ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_FRIGHT,346,116,83,14,ES_RIGHT | ES_AUTOHSCROLL CTEXT "Ri&ght part",IDC_HR_STATIC,349,40,81,8
COMBOBOX IDC_COMBO_FFONTNAME,166,134,84,119,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP EDITTEXT IDC_EDIT_HRIGHT,347,49,85,12,ES_RIGHT | ES_AUTOHSCROLL
COMBOBOX IDC_COMBO_FFONTSIZE,258,134,31,71,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_HFONTNAME,164,67,134,119,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Bold",IDC_CHECK_FBOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,297,136,46,10 COMBOBOX IDC_COMBO_HFONTSIZE,302,67,31,72,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Italic",IDC_CHECK_FITALIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,356,136,47,10 CONTROL "&Bold",IDC_CHECK_HBOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,338,69,47,10
GROUPBOX "Footer",IDC_FGB_STATIC,158,97,279,58,BS_CENTER CONTROL "&Italic",IDC_CHECK_HITALIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,388,69,50,10
CTEXT "Left part",IDC_FL_STATIC,168,107,78,8
CTEXT "Middle part",IDC_FM_STATIC,257,107,82,8 GROUPBOX "Footer",IDC_FGB_STATIC,156,90,284,57,BS_CENTER
CTEXT "Right part",IDC_FR_STATIC,348,107,79,8 CTEXT "Le&ft part",IDC_FL_STATIC,168,100,81,8
COMBOBOX IDC_COMBO_VARLIST,259,24,70,58,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP EDITTEXT IDC_EDIT_FLEFT,164,109,85,12,ES_AUTOHSCROLL
PUSHBUTTON "Add",IDC_BUTTON_ADDVAR,337,24,44,12 CTEXT "Middle &part",IDC_FM_STATIC,257,100,82,8
RTEXT "Variable :",IDC_VAR_STATIC,198,26,59,8 EDITTEXT IDC_EDIT_FMIDDLE,255,109,86,12,ES_CENTER | ES_AUTOHSCROLL
RTEXT "Here display your variable settings",IDC_WHICHPART_STATIC,155,161,120,8 CTEXT "Rig&ht part",IDC_FR_STATIC,349,100,81,8
LTEXT "",IDC_VIEWPANEL_STATIC,277,161,180,8 EDITTEXT IDC_EDIT_FRIGHT,347,109,85,12,ES_RIGHT | ES_AUTOHSCROLL
GROUPBOX "Header and Footer",IDC_HEADERFPPTER_GR_STATIC,150,7,296,172,BS_CENTER COMBOBOX IDC_COMBO_FFONTNAME,164,127,134,119,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_FFONTSIZE,302,127,31,72,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Bol&d",IDC_CHECK_FBOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,338,129,47,10
CONTROL "Itali&c",IDC_CHECK_FITALIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,388,129,50,10
CTEXT "Here display your variable settings",IDC_WHICHPART_STATIC,158,152,280,8,NOT WS_TABSTOP
EDITTEXT IDC_EDIT_VIEWPANEL,158,161,280,12,ES_AUTOHSCROLL | ES_READONLY
END END

View File

@ -1581,7 +1581,7 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
{ {
case CPN_COLOURPICKED: case CPN_COLOURPICKED:
{ {
COLORREF c; COLORREF c = 0;
if (reinterpret_cast<HWND>(lParam) == _pBackgroundColorPicker->getHSelf()) if (reinterpret_cast<HWND>(lParam) == _pBackgroundColorPicker->getHSelf())
{ {
c = _pBackgroundColorPicker->getColour(); c = _pBackgroundColorPicker->getColour();
@ -3522,7 +3522,7 @@ intptr_t CALLBACK HighlightingSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
return FALSE; return FALSE;
} }
intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
NppParameters& nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
NppGUI & nppGUI = (NppGUI & )nppParam.getNppGUI(); NppGUI & nppGUI = (NppGUI & )nppParam.getNppGUI();
@ -3563,7 +3563,7 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SetDlgItemText(_hSelf, IDC_EDIT_FMIDDLE, nppGUI._printSettings._footerMiddle.c_str()); ::SetDlgItemText(_hSelf, IDC_EDIT_FMIDDLE, nppGUI._printSettings._footerMiddle.c_str());
::SetDlgItemText(_hSelf, IDC_EDIT_FRIGHT, nppGUI._printSettings._footerRight.c_str()); ::SetDlgItemText(_hSelf, IDC_EDIT_FRIGHT, nppGUI._printSettings._footerRight.c_str());
TCHAR intStr[5]; TCHAR intStr[5]{};
for (int i = 6 ; i < 15 ; ++i) for (int i = 6 ; i < 15 ; ++i)
{ {
wsprintf(intStr, TEXT("%d"), i); wsprintf(intStr, TEXT("%d"), i);
@ -3631,11 +3631,21 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
} }
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
{ {
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam)); return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
} }
case WM_CTLCOLORSTATIC:
{
const auto hdcStatic = reinterpret_cast<HDC>(wParam);
const auto dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast<HWND>(lParam));
if (dlgCtrlID == IDC_EDIT_VIEWPANEL)
{
return NppDarkMode::onCtlColor(hdcStatic);
}
return NppDarkMode::onCtlColorDarker(hdcStatic);
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
if (NppDarkMode::isEnabled()) if (NppDarkMode::isEnabled())
@ -3645,9 +3655,9 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
break; break;
} }
case WM_COMMAND : case WM_COMMAND:
{ {
if (HIWORD(wParam) == EN_CHANGE) if (HIWORD(wParam) == EN_CHANGE && LOWORD(wParam) != IDC_EDIT_VIEWPANEL)
{ {
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
@ -3667,13 +3677,13 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
nppGUI._printSettings._marge.bottom = ::GetDlgItemInt(_hSelf, IDC_EDIT_MB, NULL, FALSE); nppGUI._printSettings._marge.bottom = ::GetDlgItemInt(_hSelf, IDC_EDIT_MB, NULL, FALSE);
return TRUE; return TRUE;
default : default:
{ {
const int stringSize = 256; constexpr int stringSize = 256;
TCHAR str[stringSize]; TCHAR str[stringSize]{};
_focusedEditCtrl = LOWORD(wParam); _focusedEditCtrl = LOWORD(wParam);
::GetDlgItemText(_hSelf, _focusedEditCtrl, str, stringSize); ::GetDlgItemText(_hSelf, _focusedEditCtrl, str, stringSize);
::SendDlgItemMessage(_hSelf, IDC_VIEWPANEL_STATIC, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(str)); ::SendDlgItemMessage(_hSelf, IDC_EDIT_VIEWPANEL, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(str));
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDC_EDIT_HLEFT: case IDC_EDIT_HLEFT:
@ -3712,10 +3722,10 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
} }
} }
} }
else if (HIWORD(wParam) == EN_SETFOCUS) else if (HIWORD(wParam) == EN_SETFOCUS && LOWORD(wParam) != IDC_EDIT_VIEWPANEL)
{ {
const int stringSize = 256; constexpr int stringSize = 256;
TCHAR str[stringSize]; TCHAR str[stringSize]{};
_focusedEditCtrl = LOWORD(wParam); _focusedEditCtrl = LOWORD(wParam);
int focusedEditStatic = 0; int focusedEditStatic = 0;
@ -3731,15 +3741,15 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
default : return TRUE; default : return TRUE;
} }
::GetDlgItemText(_hSelf, _focusedEditCtrl, str, stringSize); ::GetDlgItemText(_hSelf, _focusedEditCtrl, str, stringSize);
::SendDlgItemMessage(_hSelf, IDC_VIEWPANEL_STATIC, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(str)); ::SendDlgItemMessage(_hSelf, IDC_EDIT_VIEWPANEL, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(str));
::GetDlgItemText(_hSelf, groupStatic, str, stringSize); ::GetDlgItemText(_hSelf, groupStatic, str, stringSize);
generic_string title = str; generic_string title = str;
title += TEXT(" "); title += TEXT(" ");
::GetDlgItemText(_hSelf, focusedEditStatic, str, stringSize); ::GetDlgItemText(_hSelf, focusedEditStatic, str, stringSize);
title += str; title += str;
title += TEXT(" : "); title = purgeMenuItemString(title.c_str()); // use purgeMenuItemString to clean '&'
::SendDlgItemMessage(_hSelf, IDC_WHICHPART_STATIC, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(title.c_str())); ::SendDlgItemMessage(_hSelf, IDC_WHICHPART_STATIC, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(title.c_str()));
redrawDlgItem(IDC_WHICHPART_STATIC);
return TRUE; return TRUE;
} }
else if (HIWORD(wParam) == CBN_SELCHANGE) else if (HIWORD(wParam) == CBN_SELCHANGE)
@ -3763,8 +3773,8 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
case IDC_COMBO_HFONTSIZE : case IDC_COMBO_HFONTSIZE :
case IDC_COMBO_FFONTSIZE : case IDC_COMBO_FFONTSIZE :
{ {
const size_t intStrLen = 3; constexpr size_t intStrLen = 3;
TCHAR intStr[intStrLen]; TCHAR intStr[intStrLen]{};
auto lbTextLen = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETLBTEXTLEN, iSel, 0); auto lbTextLen = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETLBTEXTLEN, iSel, 0);
if (static_cast<size_t>(lbTextLen) >= intStrLen) if (static_cast<size_t>(lbTextLen) >= intStrLen)
@ -3781,10 +3791,15 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
} }
break; break;
case IDC_COMBO_VARLIST : case IDC_COMBO_VARLIST:
{ {
break;
}
default:
{
break;
} }
break;
} }
return TRUE; return TRUE;
@ -3842,8 +3857,8 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
size_t selEnd = 0; size_t selEnd = 0;
::SendDlgItemMessage(_hSelf, _focusedEditCtrl, EM_GETSEL, reinterpret_cast<WPARAM>(&selStart), reinterpret_cast<LPARAM>(&selEnd)); ::SendDlgItemMessage(_hSelf, _focusedEditCtrl, EM_GETSEL, reinterpret_cast<WPARAM>(&selStart), reinterpret_cast<LPARAM>(&selEnd));
const int stringSize = 256; constexpr int stringSize = 256;
TCHAR str[stringSize]; TCHAR str[stringSize]{};
::SendDlgItemMessage(_hSelf, _focusedEditCtrl, WM_GETTEXT, stringSize, reinterpret_cast<LPARAM>(str)); ::SendDlgItemMessage(_hSelf, _focusedEditCtrl, WM_GETTEXT, stringSize, reinterpret_cast<LPARAM>(str));
generic_string str2Set(str); generic_string str2Set(str);
@ -3977,8 +3992,8 @@ intptr_t CALLBACK BackupSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case IDC_BACKUPDIR_RESTORESESSION_EDIT: case IDC_BACKUPDIR_RESTORESESSION_EDIT:
{ {
const int stringSize = 16; constexpr int stringSize = 16;
TCHAR str[stringSize]; TCHAR str[stringSize]{};
::GetDlgItemText(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, str, stringSize); ::GetDlgItemText(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, str, stringSize);
@ -4002,8 +4017,8 @@ intptr_t CALLBACK BackupSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
case IDC_BACKUPDIR_RESTORESESSION_EDIT: case IDC_BACKUPDIR_RESTORESESSION_EDIT:
{ {
//printStr(TEXT("")); //printStr(TEXT(""));
const int stringSize = 16; constexpr int stringSize = 16;
TCHAR str[stringSize]; TCHAR str[stringSize]{};
::GetDlgItemText(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, str, stringSize); ::GetDlgItemText(_hSelf, IDC_BACKUPDIR_RESTORESESSION_EDIT, str, stringSize);
@ -4453,7 +4468,7 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
case IDD_AUTOC_QUOTESCHECK : case IDD_AUTOC_QUOTESCHECK :
{ {
bool isChecked = isCheckedOrNot(static_cast<int32_t>(wParam)); bool isChecked = isCheckedOrNot(static_cast<int32_t>(wParam));
const TCHAR *label; const TCHAR *label = nullptr;
if (wParam == IDD_AUTOCPARENTHESES_CHECK) if (wParam == IDD_AUTOCPARENTHESES_CHECK)
{ {
nppGUI._matchedPairConf._doParentheses = isChecked; nppGUI._matchedPairConf._doParentheses = isChecked;
@ -4558,8 +4573,8 @@ intptr_t CALLBACK MultiInstanceSubDlg::run_dlgProc(UINT message, WPARAM wParam,
{ {
if (HIWORD(wParam) == EN_CHANGE && LOWORD(wParam) == IDC_DATETIMEFORMAT_EDIT) if (HIWORD(wParam) == EN_CHANGE && LOWORD(wParam) == IDC_DATETIMEFORMAT_EDIT)
{ {
const size_t inputLen = 256; constexpr size_t inputLen = 256;
TCHAR input[inputLen]; TCHAR input[inputLen]{};
::GetDlgItemText(_hSelf, IDC_DATETIMEFORMAT_EDIT, input, inputLen); ::GetDlgItemText(_hSelf, IDC_DATETIMEFORMAT_EDIT, input, inputLen);
nppGUI._dateTimeFormat = input; nppGUI._dateTimeFormat = input;
@ -4775,10 +4790,10 @@ intptr_t CALLBACK DelimiterSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
// //
// Delimiter // Delimiter
// //
TCHAR opener[2]; TCHAR opener[2]{};
opener[0] = nppGUI._leftmostDelimiter; opener[0] = nppGUI._leftmostDelimiter;
opener[1] = '\0'; opener[1] = '\0';
TCHAR closer[2]; TCHAR closer[2]{};
closer[0] = nppGUI._rightmostDelimiter; closer[0] = nppGUI._rightmostDelimiter;
closer[1] = '\0'; closer[1] = '\0';
bool onSeveralLines = nppGUI._delimiterSelectionOnEntireDocument; bool onSeveralLines = nppGUI._delimiterSelectionOnEntireDocument;
@ -5185,8 +5200,8 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L
{ {
case IDC_EDIT_PERFORMANCE_FILESIZE: case IDC_EDIT_PERFORMANCE_FILESIZE:
{ {
const int stringSize = 16; constexpr int stringSize = 16;
TCHAR str[stringSize]; TCHAR str[stringSize]{};
::GetDlgItemText(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, str, stringSize); ::GetDlgItemText(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, str, stringSize);
@ -5212,8 +5227,8 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L
{ {
case IDC_EDIT_PERFORMANCE_FILESIZE: case IDC_EDIT_PERFORMANCE_FILESIZE:
{ {
const int stringSize = 16; constexpr int stringSize = 16;
TCHAR str[stringSize]; TCHAR str[stringSize]{};
::GetDlgItemText(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, str, stringSize); ::GetDlgItemText(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, str, stringSize);
if (lstrcmp(str, TEXT("")) == 0) if (lstrcmp(str, TEXT("")) == 0)

View File

@ -29,7 +29,7 @@ public :
MiscSubDlg() = default; MiscSubDlg() = default;
private : private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
}; };
class GeneralSubDlg : public StaticDialog class GeneralSubDlg : public StaticDialog
@ -39,7 +39,7 @@ public :
void setTabbarAlternateIcons(bool enable = false); void setTabbarAlternateIcons(bool enable = false);
private : private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
}; };
class EditingSubDlg : public StaticDialog class EditingSubDlg : public StaticDialog
@ -98,7 +98,7 @@ private:
ColourPicker* _pHotEdgeColorPicker = nullptr; ColourPicker* _pHotEdgeColorPicker = nullptr;
ColourPicker* _pDisabledEdgeColorPicker = nullptr; ColourPicker* _pDisabledEdgeColorPicker = nullptr;
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
void enableCustomizedColorCtrls(bool doEnable); void enableCustomizedColorCtrls(bool doEnable);
void move2CtrlLeft(int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight); void move2CtrlLeft(int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight);
}; };
@ -131,7 +131,7 @@ private :
::SendDlgItemMessage(_hSelf, IDC_CHECK_OPENANSIASUTF8, BM_SETCHECK, BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_OPENANSIASUTF8, BM_SETCHECK, BST_UNCHECKED, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_OPENANSIASUTF8), doIt); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_OPENANSIASUTF8), doIt);
}; };
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
}; };
class DefaultDirectorySubDlg : public StaticDialog class DefaultDirectorySubDlg : public StaticDialog
@ -140,7 +140,7 @@ public :
DefaultDirectorySubDlg() = default; DefaultDirectorySubDlg() = default;
private : private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
}; };
class RecentFilesHistorySubDlg : public StaticDialog class RecentFilesHistorySubDlg : public StaticDialog
@ -159,7 +159,7 @@ public :
private : private :
LexerStylerArray _lsArray; LexerStylerArray _lsArray;
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
std::vector<LangMenuItem> _langList; std::vector<LangMenuItem> _langList;
}; };
@ -170,7 +170,7 @@ public :
private : private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
}; };
@ -180,7 +180,7 @@ public:
SearchingSubDlg() = default; SearchingSubDlg() = default;
private: private:
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
}; };
class PrintSubDlg : public StaticDialog class PrintSubDlg : public StaticDialog
@ -189,7 +189,7 @@ public :
PrintSubDlg() = default; PrintSubDlg() = default;
private : private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
std::vector<generic_string> varList; std::vector<generic_string> varList;
int _focusedEditCtrl = 0; int _focusedEditCtrl = 0;
}; };
@ -202,7 +202,7 @@ public :
private : private :
void updateBackupSessionGUI(); void updateBackupSessionGUI();
void updateBackupOnSaveGUI(); void updateBackupOnSaveGUI();
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
}; };
@ -211,7 +211,7 @@ class AutoCompletionSubDlg : public StaticDialog
public : public :
AutoCompletionSubDlg() = default; AutoCompletionSubDlg() = default;
private : private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
}; };
class MultiInstanceSubDlg : public StaticDialog class MultiInstanceSubDlg : public StaticDialog
@ -221,7 +221,7 @@ public :
private : private :
const SYSTEMTIME _BTTF_time = {1985, 10, 6, 26, 16, 24, 42, 0}; const SYSTEMTIME _BTTF_time = {1985, 10, 6, 26, 16, 24, 42, 0};
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
}; };
class DelimiterSubDlg : public StaticDialog class DelimiterSubDlg : public StaticDialog
@ -241,7 +241,7 @@ private :
RECT _closerLabelRect = {}; RECT _closerLabelRect = {};
HWND _tip = nullptr; HWND _tip = nullptr;
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
void detectSpace(const char *text2Check, int & nbSp, int & nbTab) const; void detectSpace(const char *text2Check, int & nbSp, int & nbTab) const;
generic_string getWarningText(size_t nbSp, size_t nbTab) const; generic_string getWarningText(size_t nbSp, size_t nbTab) const;
void setWarningIfNeed() const; void setWarningIfNeed() const;
@ -253,7 +253,7 @@ public :
CloudAndLinkSubDlg() = default; CloudAndLinkSubDlg() = default;
private : private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
}; };
class SearchEngineSubDlg : public StaticDialog class SearchEngineSubDlg : public StaticDialog
@ -262,7 +262,7 @@ public :
SearchEngineSubDlg() = default; SearchEngineSubDlg() = default;
private : private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
}; };
class PerformanceSubDlg : public StaticDialog class PerformanceSubDlg : public StaticDialog
@ -276,7 +276,7 @@ public :
}; };
private : private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
HWND _largeFileRestrictionTip = nullptr; HWND _largeFileRestrictionTip = nullptr;
}; };
@ -288,18 +288,15 @@ friend class Notepad_plus;
public : public :
PreferenceDlg() = default; PreferenceDlg() = default;
void init(HINSTANCE hInst, HWND parent) { void doDialog(bool isRTL = false) {
Window::init(hInst, parent); if (!isCreated())
};
void doDialog(bool isRTL = false) {
if (!isCreated())
{ {
create(IDD_PREFERENCE_BOX, isRTL); create(IDD_PREFERENCE_BOX, isRTL);
goToCenter(); goToCenter(SWP_SHOWWINDOW | SWP_NOSIZE);
} }
display(); display();
}; };
bool renameDialogTitle(const TCHAR *internalName, const TCHAR *newName); bool renameDialogTitle(const TCHAR *internalName, const TCHAR *newName);
int getListSelectedIndex() const { int getListSelectedIndex() const {
@ -311,10 +308,10 @@ public :
bool goToSection(size_t iPage, intptr_t ctrlID = -1); bool goToSection(size_t iPage, intptr_t ctrlID = -1);
virtual void destroy(); void destroy() override;
private : private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
void makeCategoryList(); void makeCategoryList();
int32_t getIndexFromName(const TCHAR *name) const; int32_t getIndexFromName(const TCHAR *name) const;
void showDialogByIndex(size_t index) const; void showDialogByIndex(size_t index) const;

View File

@ -368,7 +368,7 @@
#define IDC_BUTTON_ADDVAR (IDD_PREFERENCE_PRINT2_BOX + 23) #define IDC_BUTTON_ADDVAR (IDD_PREFERENCE_PRINT2_BOX + 23)
#define IDC_COMBO_VARLIST (IDD_PREFERENCE_PRINT2_BOX + 24) #define IDC_COMBO_VARLIST (IDD_PREFERENCE_PRINT2_BOX + 24)
#define IDC_VAR_STATIC (IDD_PREFERENCE_PRINT2_BOX + 25) #define IDC_VAR_STATIC (IDD_PREFERENCE_PRINT2_BOX + 25)
#define IDC_VIEWPANEL_STATIC (IDD_PREFERENCE_PRINT2_BOX + 26) #define IDC_EDIT_VIEWPANEL (IDD_PREFERENCE_PRINT2_BOX + 26)
#define IDC_WHICHPART_STATIC (IDD_PREFERENCE_PRINT2_BOX + 27) #define IDC_WHICHPART_STATIC (IDD_PREFERENCE_PRINT2_BOX + 27)
#define IDC_HEADERFPPTER_GR_STATIC (IDD_PREFERENCE_PRINT2_BOX + 28) #define IDC_HEADERFPPTER_GR_STATIC (IDD_PREFERENCE_PRINT2_BOX + 28)