From 363cf5d94bf40e513148976d09d70e7cc4e76dd4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Feb 2024 17:21:38 +0300 Subject: fixes #4232 (tabSRMM: added container option to specify side bar's width) --- plugins/TabSRMM/res/resource.rc | 5 ++++- plugins/TabSRMM/src/containeroptions.cpp | 26 +++++++++++++++----------- plugins/TabSRMM/src/msgs.h | 1 + plugins/TabSRMM/src/resource.h | 5 +++-- plugins/TabSRMM/src/sidebar.cpp | 5 ++++- plugins/TabSRMM/src/utils.cpp | 2 ++ 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/plugins/TabSRMM/res/resource.rc b/plugins/TabSRMM/res/resource.rc index 7f65fda2b5..1d1ad8dc44 100644 --- a/plugins/TabSRMM/res/resource.rc +++ b/plugins/TabSRMM/res/resource.rc @@ -175,13 +175,16 @@ BEGIN EDITTEXT IDC_DESC,99,186,323,25,ES_MULTILINE | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | NOT WS_TABSTOP LTEXT "Tab location",IDC_O_TABMODE,121,41,260,12 COMBOBOX IDC_TABMODE,120,50,260,14,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "When using the switch bar, use the following layout",IDC_O_SBARLAYOUT,121,66,270,12 + LTEXT "When using the switch bar, use the following layout",IDC_O_SBARLAYOUT,120,66,270,12 COMBOBOX IDC_SBARLAYOUT,120,76,260,14,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP CONTROL "Flash event icon on tab",IDC_FLASHICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,94,290,10 CONTROL "Flash text label on tabs",IDC_FLASHLABEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,105,290,10 CONTROL "Single row tab control (*)",IDC_SINGLEROWTAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,116,290,10 CONTROL "Close button on tabs",IDC_CLOSEBUTTONONTABS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,127,290,10 CONTROL "Use button tabs (*)",IDC_BUTTONTABS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,138,290,10 + LTEXT "Side bar width",IDC_O_SBARWIDTH,120,151,200,12 + EDITTEXT IDC_SBARWIDTH,320,150,41,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_SBARWIDTH_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,362,150,11,11 LTEXT "You have chosen to disable all event notifications for open message windows.",IDC_O_EXPLAINGLOBALNOTIFY,103,105,240,30 LTEXT "Show contact avatars",IDC_O_STATIC_AVATAR,105,41,233,12 COMBOBOX IDC_AVATARMODE,105,50,220,14,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index ef59157aad..249160e9f7 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -67,20 +67,20 @@ void TContainerData::ApplySetting(bool fForceResize) struct { const wchar_t *szTitle, *szDesc; - UINT uIds[10]; + UINT uIds[12]; } static o_pages[] = { - { LPGENW("General options"), nullptr, IDC_O_NOTABS, IDC_O_STICKY, IDC_VERTICALMAX, IDC_AUTOSPLITTER, IDC_O_AUTOHIDE, IDC_AUTOCLOSETABTIME, IDC_AUTOCLOSETABSPIN, IDC_O_AUTOHIDESECONDS, 0, 0 }, - { LPGENW("Window layout"), nullptr, IDC_CNTNOSTATUSBAR, IDC_HIDEMENUBAR, IDC_UIDSTATUSBAR, IDC_HIDETOOLBAR, IDC_INFOPANEL, IDC_BOTTOMTOOLBAR, 0, 0, 0, 0 }, - { LPGENW("Tabs and switch bar"), LPGENW("Choose your options for the tabbed user interface. Not all options can be applied to open windows. You may need to close and re-open them."), IDC_TABMODE, IDC_O_TABMODE, IDC_O_SBARLAYOUT, IDC_SBARLAYOUT, IDC_FLASHICON, IDC_FLASHLABEL, IDC_SINGLEROWTAB, IDC_BUTTONTABS, IDC_CLOSEBUTTONONTABS, 0 }, - { LPGENW("Notifications"), LPGENW("Select, when you want to see event notifications (popups) for this window. The settings apply to all tabs within this window."), IDC_O_DONTREPORT, IDC_DONTREPORTUNFOCUSED2, IDC_DONTREPORTFOCUSED2, IDC_ALWAYSPOPUPSINACTIVE, IDC_O_EXPLAINGLOBALNOTIFY, 0, 0, 0, 0, 0 }, - { LPGENW("Flashing"), nullptr, IDC_O_FLASHDEFAULT, IDC_O_FLASHALWAYS, IDC_O_FLASHNEVER, 0, 0, 0, 0, 0, 0, 0 }, - { LPGENW("Title bar"), nullptr, IDC_O_HIDETITLE, IDC_TITLEFORMAT, IDC_O_TITLEBARFORMAT, IDC_O_HELP_TITLEFORMAT, 0, 0, 0, 0, 0, 0 }, - { LPGENW("Window size and theme"), LPGENW("You can select a private theme (.tabsrmm file) for this container which will then override the default message log theme. You will have to close and re-open all message windows after changing this option."), IDC_THEME, IDC_SELECTTHEME, IDC_USEGLOBALSIZE, IDC_SAVESIZEASGLOBAL, IDC_LABEL_PRIVATETHEME, IDC_TSLABEL_EXPLAINTHEME, 0, 0, 0, 0 }, - { LPGENW("Transparency"), LPGENW("This feature may be unavailable when using a container skin."), IDC_TRANSPARENCY, IDC_TRANSPARENCY_ACTIVE, IDC_TRANSPARENCY_INACTIVE, IDC_TSLABEL_ACTIVE, IDC_TSLABEL_INACTIVE, 0, 0, 0, 0, 0 }, - { LPGENW("Contact avatars"), nullptr, IDC_O_STATIC_AVATAR, IDC_O_STATIC_OWNAVATAR, IDC_AVATARMODE, IDC_OWNAVATARMODE, IDC_AVATARSONTASKBAR, 0, 0, 0, 0, 0 }, - { LPGENW("Sound notifications"), nullptr, IDC_O_ENABLESOUNDS, IDC_O_SOUNDSMINIMIZED, IDC_O_SOUNDSUNFOCUSED, IDC_O_SOUNDSINACTIVE, IDC_O_SOUNDSFOCUSED, 0, 0, 0, 0, 0 }, + { LPGENW("General options"), nullptr, IDC_O_NOTABS, IDC_O_STICKY, IDC_VERTICALMAX, IDC_AUTOSPLITTER, IDC_O_AUTOHIDE, IDC_AUTOCLOSETABTIME, IDC_AUTOCLOSETABSPIN, IDC_O_AUTOHIDESECONDS }, + { LPGENW("Window layout"), nullptr, IDC_CNTNOSTATUSBAR, IDC_HIDEMENUBAR, IDC_UIDSTATUSBAR, IDC_HIDETOOLBAR, IDC_INFOPANEL, IDC_BOTTOMTOOLBAR }, + { LPGENW("Tabs and switch bar"), LPGENW("Choose your options for the tabbed user interface. Not all options can be applied to open windows. You may need to close and re-open them."), IDC_TABMODE, IDC_O_TABMODE, IDC_O_SBARLAYOUT, IDC_SBARLAYOUT, IDC_FLASHICON, IDC_FLASHLABEL, IDC_SINGLEROWTAB, IDC_BUTTONTABS, IDC_CLOSEBUTTONONTABS, IDC_O_SBARWIDTH, IDC_SBARWIDTH, IDC_SBARWIDTH_SPIN }, + { LPGENW("Notifications"), LPGENW("Select, when you want to see event notifications (popups) for this window. The settings apply to all tabs within this window."), IDC_O_DONTREPORT, IDC_DONTREPORTUNFOCUSED2, IDC_DONTREPORTFOCUSED2, IDC_ALWAYSPOPUPSINACTIVE, IDC_O_EXPLAINGLOBALNOTIFY }, + { LPGENW("Flashing"), nullptr, IDC_O_FLASHDEFAULT, IDC_O_FLASHALWAYS, IDC_O_FLASHNEVER }, + { LPGENW("Title bar"), nullptr, IDC_O_HIDETITLE, IDC_TITLEFORMAT, IDC_O_TITLEBARFORMAT, IDC_O_HELP_TITLEFORMAT }, + { LPGENW("Window size and theme"), LPGENW("You can select a private theme (.tabsrmm file) for this container which will then override the default message log theme. You will have to close and re-open all message windows after changing this option."), IDC_THEME, IDC_SELECTTHEME, IDC_USEGLOBALSIZE, IDC_SAVESIZEASGLOBAL, IDC_LABEL_PRIVATETHEME, IDC_TSLABEL_EXPLAINTHEME }, + { LPGENW("Transparency"), LPGENW("This feature may be unavailable when using a container skin."), IDC_TRANSPARENCY, IDC_TRANSPARENCY_ACTIVE, IDC_TRANSPARENCY_INACTIVE, IDC_TSLABEL_ACTIVE, IDC_TSLABEL_INACTIVE }, + { LPGENW("Contact avatars"), nullptr, IDC_O_STATIC_AVATAR, IDC_O_STATIC_OWNAVATAR, IDC_AVATARMODE, IDC_OWNAVATARMODE, IDC_AVATARSONTASKBAR }, + { LPGENW("Sound notifications"), nullptr, IDC_O_ENABLESOUNDS, IDC_O_SOUNDSMINIMIZED, IDC_O_SOUNDSUNFOCUSED, IDC_O_SOUNDSINACTIVE, IDC_O_SOUNDSFOCUSED }, }; static void ShowPage(HWND hwndDlg, int iPage, BOOL fShow) @@ -416,6 +416,9 @@ do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); Utils::showDlgControl(hwndDlg, IDC_O_EXPLAINGLOBALNOTIFY, NEN::bWindowCheck ? SW_SHOW : SW_HIDE); + SendDlgItemMessage(hwndDlg, IDC_SBARWIDTH_SPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0)); + SendDlgItemMessage(hwndDlg, IDC_SBARWIDTH_SPIN, UDM_SETPOS, 0, cs->sideBarWidth); + SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0)); SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETPOS, 0, (LPARAM)cs->autoCloseSeconds); } @@ -495,6 +498,7 @@ do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); cs->flags = newFlags; cs->flagsEx = newFlagsEx; cs->autoCloseSeconds = (uint16_t)SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_GETPOS, 0, 0); + cs->sideBarWidth = (uint16_t)SendDlgItemMessage(hwndDlg, IDC_SBARWIDTH_SPIN, UDM_GETPOS, 0, 0); } break; diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index cdeed7ec54..c39d333514 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -269,6 +269,7 @@ struct TContainerSettings uint16_t avatarMode; uint16_t ownAvatarMode; uint16_t autoCloseSeconds; + uint16_t sideBarWidth; bool fPrivate; }; diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h index f19e263635..714bcb4533 100644 --- a/plugins/TabSRMM/src/resource.h +++ b/plugins/TabSRMM/src/resource.h @@ -133,11 +133,9 @@ #define IDC_SCROLLFIX 1060 #define IDC_CLIENTINSTATBAR 1061 #define IDC_TYPINGSOUNDS 1062 -#define IDC_RADIO2 1062 #define IDC_OFFLINEMULTI 1063 #define IDC_CLIENTINSTATBAR2 1063 #define IDC_ICONWARNINGS 1063 -#define IDC_RADIO3 1063 #define IDC_AUTOCLOSEV2 1064 #define IDC_TEXT 1064 #define IDC_RESTART 1065 @@ -152,9 +150,12 @@ #define IDC_TEXTO3 1071 #define IDC_CHKSHOWTIME 1072 #define IDC_TEXTO4 1072 +#define IDC_SBARWIDTH 1073 #define IDC_LOADCOUNTN 1074 #define IDC_TEXTO5 1074 +#define IDC_O_SBARWIDTH 1075 #define IDC_LOADCOUNTSPIN 1076 +#define IDC_SBARWIDTH_SPIN 1077 #define IDC_SHOWINFOLINE 1078 #define IDC_STATIC_ULIST 1078 #define IDC_STATIC_OTHER 1079 diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index 8bab2a4e54..a7798bd225 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -391,7 +391,10 @@ void CSideBar::Init() m_isActive = m_isVisible = true; createScroller(); m_elementHeight = m_currentLayout->height; - m_elementWidth = m_currentLayout->width; + if (m_dwFlags & (SIDEBARORIENTATION_RIGHT | SIDEBARORIENTATION_LEFT)) + m_elementWidth = max(m_pContainer->cfg.sideBarWidth, m_currentLayout->width); + else + m_elementWidth = m_currentLayout->width; m_width = m_elementWidth + 4; populateAll(); if (m_activeItem) diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index a52836c1e8..0c177f2bb0 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -215,6 +215,7 @@ int Utils::ReadContainerSettingsFromDB(const MCONTACT hContact, TContainerSettin cs->iSplitterY = db_get_dw(hContact, SRMSGMOD_T, szSetting + "_SplitterY", 0); cs->avatarMode = db_get_w(hContact, SRMSGMOD_T, szSetting + "_AvatarMode", 0); cs->ownAvatarMode = db_get_w(hContact, SRMSGMOD_T, szSetting + "_OwnAvatarMode", 0); + cs->sideBarWidth = db_get_w(hContact, SRMSGMOD_T, szSetting + "_SideBarWidth", 100); cs->autoCloseSeconds = db_get_w(hContact, SRMSGMOD_T, szSetting + "_AutoCloseSecs", 0); cs->fPrivate = db_get_b(hContact, SRMSGMOD_T, szSetting + "_Private", 0) != 0; db_get_wstatic(hContact, SRMSGMOD_T, szSetting + "_Format", cs->szTitleFormat, _countof(cs->szTitleFormat)); @@ -234,6 +235,7 @@ int Utils::WriteContainerSettingsToDB(const MCONTACT hContact, TContainerSetting db_set_w(hContact, SRMSGMOD_T, szSetting + "_AvatarMode", cs->avatarMode); db_set_w(hContact, SRMSGMOD_T, szSetting + "_OwnAvatarMode", cs->ownAvatarMode); db_set_w(hContact, SRMSGMOD_T, szSetting + "_AutoCloseSecs", cs->autoCloseSeconds); + db_set_w(hContact, SRMSGMOD_T, szSetting + "_SideBarWidth", cs->sideBarWidth); db_set_b(hContact, SRMSGMOD_T, szSetting + "_Private", cs->fPrivate); return 0; } -- cgit v1.2.3