Style Configurator: reorganize Language and Styles

Change Language to a COMBO and stack them so they can be wide rather than narrow
This commit is contained in:
PeterCJ 2025-02-20 13:30:27 -08:00
parent fd2157729a
commit 3f6bbc8316
3 changed files with 16 additions and 16 deletions

View File

@ -516,9 +516,9 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
notifyDataModified();
apply(GENERAL_CHANGE);
break;
case IDC_LANGUAGES_LIST :
case IDC_LANGUAGES_COMBO :
{
int i = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, LOWORD(wParam), LB_GETCURSEL, 0, 0));
int i = static_cast<int32_t>(::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETCURSEL, 0, 0));
if (i != LB_ERR)
{
bool prevThemeState = _isThemeDirty;
@ -641,17 +641,17 @@ void WordStyleDlg::loadLangListFromNppParam()
_globalStyles = nppParamInst.getGlobalStylers();
// Clean up Language List
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_RESETCONTENT, 0, 0);
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_COMBO, CB_RESETCONTENT, 0, 0);
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Global Styles"));
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Global Styles"));
// All the lexers
for (size_t i = 0, nb = _lsArray.getNbLexer() ; i < nb ; ++i)
{
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(_lsArray.getLexerDescFromIndex(i)));
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(_lsArray.getLexerDescFromIndex(i)));
}
const int index2Begin = 0;
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_SETCURSEL, index2Begin, 0);
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_COMBO, CB_SETCURSEL, index2Begin, 0);
setStyleListFromLexer(index2Begin);
}
@ -993,10 +993,10 @@ bool WordStyleDlg::goToSection(const wchar_t* sectionNames)
if (sections.size() == 0 || sections.size() >= 3)
return false;
auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_FINDSTRING, (WPARAM)-1, (LPARAM)sections[0].c_str());
auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_COMBO, CB_FINDSTRING, (WPARAM)-1, (LPARAM)sections[0].c_str());
if (i == LB_ERR)
return false;
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_SETCURSEL, i, 0);
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_COMBO, CB_SETCURSEL, i, 0);
setStyleListFromLexer(static_cast<int>(i));
if (sections.size() == 1)
@ -1204,14 +1204,14 @@ void WordStyleDlg::setVisualFromStyleList()
str[0] = '\0';
auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETCURSEL, 0, 0);
auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_COMBO, CB_GETCURSEL, 0, 0);
if (i == LB_ERR)
return;
auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETTEXTLEN, i, 0);
auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_COMBO, CB_GETLBTEXTLEN, i, 0);
if (static_cast<size_t>(lbTextLen) > strLen)
return;
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETTEXT, i, reinterpret_cast<LPARAM>(str));
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_COMBO, CB_GETLBTEXT, i, reinterpret_cast<LPARAM>(str));
i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0);
if (i == LB_ERR)

View File

@ -32,10 +32,10 @@ BEGIN
COMBOBOX IDC_SWITCH2THEME_COMBO,95,7,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
GROUPBOX "",IDC_STATIC,7,24,166,212
LTEXT "Language:",IDC_LANGDESC_STATIC,20,35,61,8
LISTBOX IDC_LANGUAGES_LIST,17,46,59,146,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
LTEXT "Style:",IDC_STYLEDESC_STATIC,89,35,68,8
LISTBOX IDC_STYLES_LIST,86,46,77,146,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
LTEXT "Language:",IDC_LANGDESC_STATIC,20,35,137,8
COMBOBOX IDC_LANGUAGES_COMBO,17,46,146,36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
LTEXT "Style:",IDC_STYLEDESC_STATIC,20,63,137,8
LISTBOX IDC_STYLES_LIST,17,74,146,118,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
LTEXT "Default ext.:",IDC_DEF_EXT_STATIC,20,203,61,8
EDITTEXT IDC_DEF_EXT_EDIT,17,214,59,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "+",IDC_PLUSSYMBOL2_STATIC,82,216,8,8

View File

@ -62,7 +62,7 @@
#define IDC_SAVECLOSE_BUTTON (IDD_GLOBAL_STYLER_DLG + 1)
#define IDC_SC_PERCENTAGE_SLIDER (IDD_GLOBAL_STYLER_DLG + 2)
#define IDC_SC_TRANSPARENT_CHECK (IDD_GLOBAL_STYLER_DLG + 3)
#define IDC_LANGUAGES_LIST (IDD_GLOBAL_STYLER_DLG + 4)
#define IDC_LANGUAGES_COMBO (IDD_GLOBAL_STYLER_DLG + 4)
#define IDC_STYLES_LIST (IDD_GLOBAL_STYLER_DLG + 5)
#define IDC_SWITCH2THEME_STATIC (IDD_GLOBAL_STYLER_DLG + 6)
#define IDC_SWITCH2THEME_COMBO (IDD_GLOBAL_STYLER_DLG + 7)