From 24a76259e2c527e107f1c1b969b501d63a8e29f5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 13 May 2018 18:38:54 +0300 Subject: related to #1354 (unhides the hidden database setting that sets the title format for Scriver) --- plugins/Scriver/res/resource.rc | 49 ++++++++++++++++++++------------ plugins/Scriver/src/globals.cpp | 9 ++++-- plugins/Scriver/src/globals.h | 58 +++++++++++++++++++------------------- plugins/Scriver/src/msgdialog.cpp | 7 ++--- plugins/Scriver/src/msgoptions.cpp | 11 ++++++++ plugins/Scriver/src/resource.h | 17 +++++++++-- 6 files changed, 95 insertions(+), 56 deletions(-) (limited to 'plugins/Scriver') diff --git a/plugins/Scriver/res/resource.rc b/plugins/Scriver/res/resource.rc index b5254672e9..df6214f896 100644 --- a/plugins/Scriver/res/resource.rc +++ b/plugins/Scriver/res/resource.rc @@ -80,29 +80,31 @@ BEGIN CONTROL "",IDC_LIMITCHATSTABSNUMSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,232,99,11,14 END -IDD_OPT_LAYOUT DIALOGEX 2, 0, 304, 230 +IDD_OPT_LAYOUT DIALOGEX 2, 0, 304, 175 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "Layout",IDC_STATIC,0,0,304,138 + GROUPBOX "Layout",IDC_STATIC,0,0,304,172 CONTROL "Show title bar",IDC_SHOWTITLEBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,12,180,10 - CONTROL "Show status bar",IDC_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,23,180,10 - CONTROL "Show toolbar",IDC_SHOWTOOLBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,34,180,10 - CONTROL "Show info bar",IDC_SHOWINFOBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,45,180,10 - CONTROL "Show avatars",IDC_AVATARSUPPORT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,56,180,10 - CONTROL "Show progress indicator",IDC_SHOWPROGRESS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,67,180,10 - CONTROL "Enable transparency",IDC_TRANSPARENCY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,95,140,10 - LTEXT "active",IDC_TRANSPARENCYTEXT1,152,91,36,8 - CONTROL "Slider1",IDC_ATRANSPARENCYVALUE,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,194,91,70,12 - LTEXT "100%",IDC_ATRANSPARENCYPERC,264,91,30,8 - LTEXT "inactive",IDC_TRANSPARENCYTEXT2,152,102,36,8 - CONTROL "Slider1",IDC_ITRANSPARENCYVALUE,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,194,102,70,12 - LTEXT "100%",IDC_ITRANSPARENCYPERC,264,102,30,8 - LTEXT "Min input area size",IDC_STATIC,8,119,139,8 - EDITTEXT IDC_INPUTLINES,154,117,30,12,ES_RIGHT | ES_NUMBER - CONTROL "Spin1",IDC_INPUTLINESSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,180,116,10,14 - LTEXT "lines",IDC_STATIC,188,119,43,8 + CONTROL "Show status bar",IDC_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,67,180,10 + CONTROL "Show toolbar",IDC_SHOWTOOLBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,79,180,10 + CONTROL "Show info bar",IDC_SHOWINFOBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,90,180,10 + CONTROL "Show avatars",IDC_AVATARSUPPORT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,101,180,10 + CONTROL "Show progress indicator",IDC_SHOWPROGRESS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,112,180,10 + CONTROL "Enable transparency",IDC_TRANSPARENCY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,126,140,10 + LTEXT "active",IDC_TRANSPARENCYTEXT1,152,134,36,8 + CONTROL "Slider1",IDC_ATRANSPARENCYVALUE,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,194,122,70,12 + LTEXT "100%",IDC_ATRANSPARENCYPERC,264,123,30,8 + LTEXT "inactive",IDC_TRANSPARENCYTEXT2,152,123,36,8 + CONTROL "Slider1",IDC_ITRANSPARENCYVALUE,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,194,133,70,12 + LTEXT "100%",IDC_ITRANSPARENCYPERC,264,134,30,8 + LTEXT "Min input area size",IDC_STATIC,8,153,139,8 + EDITTEXT IDC_INPUTLINES,154,151,30,12,ES_RIGHT | ES_NUMBER + CONTROL "Spin1",IDC_INPUTLINESSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,180,150,10,14 + LTEXT "lines",IDC_STATIC,188,153,43,8 + EDITTEXT IDC_TITLEFORMAT,17,25,279,12,ES_AUTOHSCROLL + LTEXT "You can use embedded variables here: %name% for contact's name, %status% for its status, %statusmsg% for its status message and %account% for its account's name",IDC_STATIC,17,38,279,25 END IDD_OPT_MSGLOG DIALOGEX 2, 0, 304, 232 @@ -557,6 +559,17 @@ BEGIN END END + +///////////////////////////////////////////////////////////////////////////// +// +// AFX_DIALOG_LAYOUT +// + +IDD_OPT_LAYOUT AFX_DIALOG_LAYOUT +BEGIN + 0 +END + #endif // Neutral resources ///////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 0886f048cc..d63e8f29ec 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -423,10 +423,13 @@ void ReloadGlobals() if (db_get_b(0, SRMM_MODULE, SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW)) g_dat.flags |= SMF_USEIEVIEW; - g_dat.buttonVisibility = db_get_dw(0, SRMM_MODULE, SRMSGSET_BUTTONVISIBILITY, SRMSGDEFSET_BUTTONVISIBILITY); - g_dat.chatBbuttonVisibility = db_get_dw(0, SRMM_MODULE, SRMSGSET_CHATBUTTONVISIBILITY, SRMSGDEFSET_CHATBUTTONVISIBILITY); - g_dat.limitNamesLength = db_get_dw(0, SRMM_MODULE, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN); g_dat.limitTabsNum = db_get_dw(0, SRMM_MODULE, SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM); g_dat.limitChatsTabsNum = db_get_dw(0, SRMM_MODULE, SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM); + + ptrW wszTitleFormat(db_get_wsa(0, SRMM_MODULE, SRMSGSET_WINDOWTITLE)); + if (wszTitleFormat == nullptr) + g_dat.wszTitleFormat[0] = 0; + else + wcsncpy_s(g_dat.wszTitleFormat, wszTitleFormat, _TRUNCATE); } diff --git a/plugins/Scriver/src/globals.h b/plugins/Scriver/src/globals.h index 652a077f86..eb84086dc3 100644 --- a/plugins/Scriver/src/globals.h +++ b/plugins/Scriver/src/globals.h @@ -79,40 +79,40 @@ typedef struct ImageListUsageEntry_tag struct GlobalMessageData { - unsigned int flags; - unsigned int flags2; - DWORD openFlags; - MWindowList hParentWindowList; - ParentWindowData *lastParent; - ParentWindowData *lastChatParent; - DWORD limitNamesLength; - int activeAlpha; - int inactiveAlpha; - int tabIconListUsageSize; - ImageListUsageEntry *tabIconListUsage; - int smileyAddInstalled; - int popupInstalled; - int ieviewInstalled; - int buttonVisibility; - int chatBbuttonVisibility; - int limitTabsNum; - int limitChatsTabsNum; - int indentSize; + unsigned flags; + unsigned flags2; + DWORD openFlags; + DWORD limitNamesLength; + int activeAlpha; + int inactiveAlpha; + int tabIconListUsageSize; + int smileyAddInstalled; + int popupInstalled; + int ieviewInstalled; + int limitTabsNum; + int limitChatsTabsNum; + int indentSize; HIMAGELIST hTabIconList; HIMAGELIST hButtonIconList; HIMAGELIST hChatButtonIconList; HIMAGELIST hHelperIconList; HIMAGELIST hSearchEngineIconList; - HBRUSH hInfobarBrush; - int toolbarPosition; - HWND hFocusWnd; - DWORD logLineColour; - int logPixelSX; - int logPixelSY; - HICON hMsgIcon; - HICON hMsgIconBig; - HICON hIconChatBig; - int minInputAreaHeight; + HBRUSH hInfobarBrush; + int toolbarPosition; + HWND hFocusWnd; + DWORD logLineColour; + int logPixelSX; + int logPixelSY; + HICON hMsgIcon; + HICON hMsgIconBig; + HICON hIconChatBig; + int minInputAreaHeight; + wchar_t wszTitleFormat[200]; + + MWindowList hParentWindowList; + ParentWindowData *lastParent; + ParentWindowData *lastChatParent; + ImageListUsageEntry *tabIconListUsage; }; int IconsChanged(WPARAM wParam, LPARAM lParam); diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index a9110a2e03..8bc0ff50cc 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -781,9 +781,8 @@ static const wchar_t *titleTokenNames[] = { L"%name%", L"%status%", L"%statusmsg void CSrmmWindow::UpdateTitle() { CMStringW wszTitle; - ptrW tmplt(db_get_wsa(0, SRMM_MODULE, SRMSGSET_WINDOWTITLE)); - if (tmplt != nullptr) - wszTitle = tmplt; + if (g_dat.wszTitleFormat[0]) + wszTitle = g_dat.wszTitleFormat; else wszTitle = L"%name% - "; @@ -803,7 +802,7 @@ void CSrmmWindow::UpdateTitle() } } - if (tmplt == nullptr) + if (g_dat.wszTitleFormat[0] == 0) wszTitle.Append(TranslateT("Message session")); TitleBarData tbd = {}; diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 0ddefba75d..e8876170e3 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -376,6 +376,7 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar TranslateDialogDefault(hwndDlg); CheckDlgButton(hwndDlg, IDC_SHOWSTATUSBAR, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWSTATUSBAR, SRMSGDEFSET_SHOWSTATUSBAR) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWTITLEBAR, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWTITLEBAR, SRMSGDEFSET_SHOWTITLEBAR) ? BST_CHECKED : BST_UNCHECKED); + SetWindowText(GetDlgItem(hwndDlg, IDC_TITLEFORMAT), g_dat.wszTitleFormat); CheckDlgButton(hwndDlg, IDC_SHOWTOOLBAR, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWINFOBAR, db_get_b(0, SRMM_MODULE, SRMSGSET_SHOWINFOBAR, SRMSGDEFSET_SHOWINFOBAR) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, db_get_b(0, SRMM_MODULE, SRMSGSET_USETRANSPARENCY, SRMSGDEFSET_USETRANSPARENCY) ? BST_CHECKED : BST_UNCHECKED); @@ -390,6 +391,9 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar SendDlgItemMessage(hwndDlg, IDC_INPUTLINESSPIN, UDM_SETRANGE, 0, MAKELONG(100, 1)); SendDlgItemMessage(hwndDlg, IDC_INPUTLINESSPIN, UDM_SETPOS, 0, db_get_w(0, SRMM_MODULE, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES)); + bChecked = IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR); + EnableWindow(GetDlgItem(hwndDlg, IDC_TITLEFORMAT), bChecked); + bChecked = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY); EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYVALUE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYPERC), bChecked); @@ -414,6 +418,10 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT2), bChecked); break; + case IDC_SHOWTITLEBAR: + bChecked = IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR); + EnableWindow(GetDlgItem(hwndDlg, IDC_TITLEFORMAT), bChecked); + case IDC_INPUTLINES: if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; @@ -439,6 +447,9 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar break; case PSN_APPLY: + GetWindowText(GetDlgItem(hwndDlg, IDC_TITLEFORMAT), g_dat.wszTitleFormat, _countof(g_dat.wszTitleFormat)); + db_set_ws(0, SRMM_MODULE, SRMSGSET_WINDOWTITLE, g_dat.wszTitleFormat); + db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWSTATUSBAR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSBAR)); db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWTITLEBAR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR)); db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWBUTTONLINE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTOOLBAR)); diff --git a/plugins/Scriver/src/resource.h b/plugins/Scriver/src/resource.h index 7b429acd80..37bb17e72b 100644 --- a/plugins/Scriver/src/resource.h +++ b/plugins/Scriver/src/resource.h @@ -73,6 +73,7 @@ #define IDC_HYPERLINKHAND 600 #define IDC_DRAGCURSOR 601 #define IDC_TABS 1000 +#define IDC_TITLEFORMAT 1002 #define IDC_AUTOPOPUP 1003 #define IDC_AUTOMIN 1005 #define IDC_STAYMINIMIZED 1006 @@ -165,6 +166,18 @@ #define IDC_XSTATUSICON 1646 #define IDC_INPUTLINES 1647 #define IDC_INPUTLINESSPIN 1648 +#define IDC_SRMM_COLOR 3001 +#define IDC_SRMM_BKGCOLOR 3002 +#define IDC_SRMM_BOLD 3003 +#define IDC_SRMM_ITALICS 3004 +#define IDC_SRMM_UNDERLINE 3005 +#define IDC_SRMM_FILTER 3006 +#define IDC_SRMM_CHANMGR 3007 +#define IDC_SRMM_SHOWNICKLIST 3008 +#define IDC_SRMM_HISTORY 3009 +#define IDC_SRMM_NICKLIST 3010 +#define IDC_SRMM_LOG 3011 +#define IDC_SRMM_MESSAGE 3012 #define IDC_SPLITTERX 5006 #define IDC_SPLITTERY 5008 #define IDC_CHAT_CHECKBOXES 5021 @@ -234,9 +247,9 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_RESOURCE_VALUE 102 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1002 +#define _APS_NEXT_CONTROL_VALUE 1003 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3