Browse Source

Make naming correct for indent settings of Preferences dialog

Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/15180#issuecomment-2129892136

Close #15203
pull/15218/head
Don Ho 6 months ago
parent
commit
0019e20f82
  1. 1
      PowerEditor/src/Notepad_plus.cpp
  2. 39
      PowerEditor/src/WinControls/Preference/preference.rc
  3. 33
      PowerEditor/src/WinControls/Preference/preferenceDlg.cpp
  4. 8
      PowerEditor/src/WinControls/Preference/preference_rc.h

1
PowerEditor/src/Notepad_plus.cpp

@ -7902,6 +7902,7 @@ static const QuoteParams quotes[] =
{TEXT("Anonymous #204"), QuoteParams::slow , false, SC_CP_UTF8, L_TEXT, TEXT("The greatest security vulnerability in any computer system is located between the keyboard and the chair.\n\n") },
{TEXT("Anonymous #205"), QuoteParams::slow , false, SC_CP_UTF8, L_TEXT, TEXT("Courage is knowing it might hurt, and doing it anyway.\nStupidity is the same.\nAnd that's why life is hard.\n\n") },
{TEXT("Anonymous #206"), QuoteParams::rapid , false, SC_CP_UTF8, L_TEXT, TEXT("RegEx can save 30 minutes of your dev time with only 10 characters.\nBut you have to spend more than 40 minutes to figure out what these 10 characters need to be.\n\n") },
{TEXT("Anonymous #207"), QuoteParams::rapid , false, SC_CP_UTF8, L_TEXT, TEXT("To whoever stole my copy of Microsoft Office, I will find you.\n\nYou have my Word.\n") },
{TEXT("xkcd"), QuoteParams::rapid, false, SC_CP_UTF8, L_TEXT, TEXT("Never have I felt so close to another soul\nAnd yet so helplessly alone\nAs when I Google an error\nAnd there's one result\nA thread by someone with the same problem\nAnd no answer\nLast posted to in 2003\n\n\"Who were you, DenverCoder9?\"\n\"What did you see?!\"\n\n(ref: https://xkcd.com/979/)") },
{TEXT("A developer"), QuoteParams::slow, false, SC_CP_UTF8, L_TEXT, TEXT("No hugs & kisses.\nOnly bugs & fixes.") },
{TEXT("Elon Musk"), QuoteParams::rapid, false, SC_CP_UTF8, L_TEXT, TEXT("Don't set your password as your child's name.\nName your child after your password.") },

39
PowerEditor/src/WinControls/Preference/preference.rc

@ -272,25 +272,26 @@ IDD_PREFERENCE_SUB_LANGUAGE DIALOGEX 115, 10, 460, 205
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Language Menu",IDC_CHECK_LANGMENU_GR_STATIC,34,0,220,172,BS_CENTER
CONTROL "Make language menu compact",IDC_CHECK_LANGMENUCOMPACT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,48,14,174,10
CTEXT "Available items",IDC_ENABLEDITEMS_STATIC,52,31,72,8
LISTBOX IDC_LIST_ENABLEDLANG,47,44,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "->",IDC_BUTTON_REMOVE,132,76,25,14
PUSHBUTTON "<-",IDC_BUTTON_RESTORE,132,107,25,14
CTEXT "Disabled items",IDC_DISABLEDITEMS_STATIC,167,31,72,8
LISTBOX IDC_LIST_DISABLEDLANG,164,44,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Tab Settings",IDC_TABSETTING_GB_STATIC,275,0,130,172,BS_CENTER
LISTBOX IDC_LIST_TABSETTNG,297,18,84,100,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
GROUPBOX "",IDC_GR_TABVALUE_STATIC,287,125,110,42,BS_CENTER
CONTROL "Use default value",IDC_CHECK_DEFAULTTABVALUE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,283,125,85,10
RTEXT "Tab size: ",IDC_TABSIZE_STATIC,288,138,58,8
EDITTEXT IDC_EDIT_TABSIZEVAL,348,136,14,12,ES_CENTER | ES_NUMBER | WS_TABSTOP
CONTROL "Replace by space",IDC_CHECK_REPLACEBYSPACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,295,149,100,10
CONTROL "Treat backslash as escape character for SQL",IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,175,217,10
GROUPBOX "Language Menu",IDC_CHECK_LANGMENU_GR_STATIC,11,0,220,181,BS_CENTER
CONTROL "Make language menu compact",IDC_CHECK_LANGMENUCOMPACT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,14,174,10
CTEXT "Available items",IDC_ENABLEDITEMS_STATIC,29,31,72,8
LISTBOX IDC_LIST_ENABLEDLANG,24,44,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "->",IDC_BUTTON_REMOVE,109,76,25,14
PUSHBUTTON "<-",IDC_BUTTON_RESTORE,109,107,25,14
CTEXT "Disabled items",IDC_DISABLEDITEMS_STATIC,144,31,72,8
LISTBOX IDC_LIST_DISABLEDLANG,141,44,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
CONTROL "Treat backslash as escape character for SQL",IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,184,217,10
GROUPBOX "Indent Settings",IDC_TABSETTING_GB_STATIC,242,0,211,195,BS_CENTER
LISTBOX IDC_LIST_TABSETTNG,307,15,84,70,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
GROUPBOX "",IDC_GR_TABVALUE_STATIC,254,92,188,92,BS_CENTER
CONTROL "Use default value",IDC_CHECK_DEFAULTTABVALUE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,250,91,85,10
RTEXT "Indent size: ",IDC_TABSIZE_STATIC,295,105,65,8
EDITTEXT IDC_EDIT_TABSIZEVAL,362,103,14,12,ES_CENTER | ES_NUMBER
LTEXT "Indent using: ",IDC_INDENTUSING_STATIC,259,118,58,8
CONTROL "Tab character",IDC_RADIO_USINGTAB,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,264,130,100,10
CONTROL "Space character(s)",IDC_RADIO_REPLACEBYSPACE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,264,143,100,10
//CONTROL "Backspace key unindents instead of removing single space",IDC_CHECK_BACKSPACEUNINDENT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,258,158,180,21
END

33
PowerEditor/src/WinControls/Preference/preferenceDlg.cpp

@ -3161,7 +3161,8 @@ intptr_t CALLBACK LanguageSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
// Tab settings
//
::SetDlgItemInt(_hSelf, IDC_EDIT_TABSIZEVAL, nppGUI._tabSize, FALSE);
::SendDlgItemMessage(_hSelf, IDC_CHECK_REPLACEBYSPACE, BM_SETCHECK, nppGUI._tabReplacedBySpace, 0);
::SendDlgItemMessage(_hSelf, IDC_RADIO_REPLACEBYSPACE, BM_SETCHECK, nppGUI._tabReplacedBySpace, 0);
::SendDlgItemMessage(_hSelf, IDC_RADIO_USINGTAB, BM_SETCHECK, !nppGUI._tabReplacedBySpace, 0);
::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("[Default]")));
const int nbLang = nppParam.getNbLang();
@ -3200,7 +3201,7 @@ intptr_t CALLBACK LanguageSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
const auto& hdcStatic = reinterpret_cast<HDC>(wParam);
// handle blurry text with disabled states for the affected static controls
const size_t index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0);
if ((index > 0) && (dlgCtrlID == IDC_TABSIZE_STATIC))
if ((index > 0) && (dlgCtrlID == IDC_TABSIZE_STATIC || dlgCtrlID == IDC_INDENTUSING_STATIC))
{
const Lang* lang = nppParam.getLangFromIndex(index - 1);
if (lang == nullptr)
@ -3275,25 +3276,31 @@ intptr_t CALLBACK LanguageSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
int size = useDefaultTab ? nppGUI._tabSize : lang->_tabSize;
::SetDlgItemInt(_hSelf, IDC_EDIT_TABSIZEVAL, size, FALSE);
::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, useDefaultTab ? nppGUI._tabReplacedBySpace : lang->_isTabReplacedBySpace, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), !useDefaultTab);
::SendMessage(::GetDlgItem(_hSelf, IDC_RADIO_REPLACEBYSPACE), BM_SETCHECK, useDefaultTab ? nppGUI._tabReplacedBySpace : lang->_isTabReplacedBySpace, 0);
::SendMessage(::GetDlgItem(_hSelf, IDC_RADIO_USINGTAB), BM_SETCHECK, useDefaultTab ? !nppGUI._tabReplacedBySpace : !lang->_isTabReplacedBySpace, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_REPLACEBYSPACE), !useDefaultTab);
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_USINGTAB), !useDefaultTab);
::EnableWindow(::GetDlgItem(_hSelf, IDC_EDIT_TABSIZEVAL), !useDefaultTab);
if (!useDefaultTab)
{
::SetDlgItemInt(_hSelf, IDC_EDIT_TABSIZEVAL, lang->_tabSize, FALSE);
::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, lang->_isTabReplacedBySpace, 0);
::SendMessage(::GetDlgItem(_hSelf, IDC_RADIO_REPLACEBYSPACE), BM_SETCHECK, lang->_isTabReplacedBySpace, 0);
::SendMessage(::GetDlgItem(_hSelf, IDC_RADIO_USINGTAB), BM_SETCHECK, !lang->_isTabReplacedBySpace, 0);
}
}
else
{
::SetDlgItemInt(_hSelf, IDC_EDIT_TABSIZEVAL, nppGUI._tabSize, FALSE);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), TRUE);
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_REPLACEBYSPACE), TRUE);
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_USINGTAB), TRUE);
::EnableWindow(::GetDlgItem(_hSelf, IDC_EDIT_TABSIZEVAL), TRUE);
::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, nppGUI._tabReplacedBySpace, 0);
::SendMessage(::GetDlgItem(_hSelf, IDC_RADIO_REPLACEBYSPACE), BM_SETCHECK, nppGUI._tabReplacedBySpace, 0);
::SendMessage(::GetDlgItem(_hSelf, IDC_RADIO_USINGTAB), BM_SETCHECK, !nppGUI._tabReplacedBySpace, 0);
}
redrawDlgItem(IDC_TABSIZE_STATIC);
redrawDlgItem(IDC_INDENTUSING_STATIC);
return TRUE;
}
@ -3572,9 +3579,10 @@ intptr_t CALLBACK LanguageSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
return TRUE;
}
case IDC_CHECK_REPLACEBYSPACE:
case IDC_RADIO_REPLACEBYSPACE:
case IDC_RADIO_USINGTAB:
{
bool isTabReplacedBySpace = BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_GETCHECK, 0, 0);
bool isTabReplacedBySpace = BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_RADIO_REPLACEBYSPACE), BM_GETCHECK, 0, 0);
auto index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0);
if (index == LB_ERR) return FALSE;
if (index != 0)
@ -3625,8 +3633,10 @@ intptr_t CALLBACK LanguageSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
//- set visual effect
::SetDlgItemInt(_hSelf, IDC_EDIT_TABSIZEVAL, useDefaultTab ? nppGUI._tabSize : lang->_tabSize, FALSE);
setChecked(IDC_CHECK_REPLACEBYSPACE, useDefaultTab ? nppGUI._tabReplacedBySpace : lang->_isTabReplacedBySpace);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), !useDefaultTab);
setChecked(IDC_RADIO_REPLACEBYSPACE, useDefaultTab ? nppGUI._tabReplacedBySpace : lang->_isTabReplacedBySpace);
setChecked(IDC_RADIO_USINGTAB, useDefaultTab ? !nppGUI._tabReplacedBySpace : !lang->_isTabReplacedBySpace);
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_REPLACEBYSPACE), !useDefaultTab);
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_USINGTAB), !useDefaultTab);
::EnableWindow(::GetDlgItem(_hSelf, IDC_EDIT_TABSIZEVAL), !useDefaultTab);
// write in langs.xml
@ -3634,6 +3644,7 @@ intptr_t CALLBACK LanguageSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
nppParam.insertTabInfo(lang->getLangName(), -1);
redrawDlgItem(IDC_TABSIZE_STATIC);
redrawDlgItem(IDC_INDENTUSING_STATIC);
return TRUE;
}

8
PowerEditor/src/WinControls/Preference/preference_rc.h

@ -211,15 +211,15 @@
#define IDD_PREFERENCE_SUB_MISC 6300 //(IDD_PREFERENCE_BOX + 300)
#define IDC_TABSETTING_GB_STATIC (IDD_PREFERENCE_SUB_MISC + 1)
#define IDC_CHECK_REPLACEBYSPACE (IDD_PREFERENCE_SUB_MISC + 2)
#define IDC_RADIO_REPLACEBYSPACE (IDD_PREFERENCE_SUB_MISC + 2)
#define IDC_TABSIZE_STATIC (IDD_PREFERENCE_SUB_MISC + 3)
#define IDC_HISTORY_GB_STATIC (IDD_PREFERENCE_SUB_MISC + 4)
#define IDC_CHECK_DONTCHECKHISTORY (IDD_PREFERENCE_SUB_MISC + 5)
#define IDC_MAXNBFILE_STATIC (IDD_PREFERENCE_SUB_MISC + 6)
#define IDC_CHECK_MIN2SYSTRAY (IDD_PREFERENCE_SUB_MISC + 8)
#define IDC_CHECK_REMEMBERSESSION (IDD_PREFERENCE_SUB_MISC + 9)
//#define IDC_TABSIZEVAL_STATIC (IDD_PREFERENCE_SUB_MISC + 10)
//#define IDC_MAXNBFILEVAL_STATIC (IDD_PREFERENCE_SUB_MISC + 11)
#define IDC_INDENTUSING_STATIC (IDD_PREFERENCE_SUB_MISC + 10)
#define IDC_RADIO_USINGTAB (IDD_PREFERENCE_SUB_MISC + 11)
#define IDC_FILEAUTODETECTION_STATIC (IDD_PREFERENCE_SUB_MISC + 12)
#define IDC_CHECK_UPDATESILENTLY (IDD_PREFERENCE_SUB_MISC + 13)
#define IDC_RADIO_BKNONE (IDD_PREFERENCE_SUB_MISC + 15)
@ -319,7 +319,7 @@
#define IDC_LIST_TABSETTNG (IDD_PREFERENCE_SUB_LANGUAGE + 9)
#define IDC_CHECK_DEFAULTTABVALUE (IDD_PREFERENCE_SUB_LANGUAGE + 10)
#define IDC_GR_TABVALUE_STATIC (IDD_PREFERENCE_SUB_LANGUAGE + 11)
//#define IDC_TABSIZEVAL_DISABLE_STATIC (IDD_PREFERENCE_SUB_LANGUAGE + 12)
#define IDC_CHECK_BACKSPACEUNINDENT (IDD_PREFERENCE_SUB_LANGUAGE + 12)
#define IDC_EDIT_TABSIZEVAL (IDD_PREFERENCE_SUB_LANGUAGE + 13)
#define IDD_PREFERENCE_SUB_EDITING2 6520 //(IDD_PREFERENCE_BOX + 520)

Loading…
Cancel
Save