From 4656e75294f503f4689ad057dbf03ba559364703 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 4 Apr 2021 20:21:24 +0300 Subject: fixes #2833 (SimpleStatusMsg: remove "Show Status message ..." item in status menu) --- plugins/SimpleStatusMsg/res/resource.rc | 31 ++++++++++++++++++++++++------- plugins/SimpleStatusMsg/src/main.cpp | 2 -- plugins/SimpleStatusMsg/src/options.cpp | 28 ++++++++++------------------ plugins/SimpleStatusMsg/src/resource.h | 3 +-- plugins/SimpleStatusMsg/src/version.h | 2 +- 5 files changed, 36 insertions(+), 30 deletions(-) (limited to 'plugins/SimpleStatusMsg') diff --git a/plugins/SimpleStatusMsg/res/resource.rc b/plugins/SimpleStatusMsg/res/resource.rc index 34c00cab2e..d83ddc2565 100644 --- a/plugins/SimpleStatusMsg/res/resource.rc +++ b/plugins/SimpleStatusMsg/res/resource.rc @@ -27,12 +27,12 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "..\\src\\resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" "#include ""windows.h""\r\n" @@ -40,7 +40,7 @@ BEGIN "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "\r\n" "\0" @@ -155,7 +155,7 @@ BEGIN LTEXT "Buttons:",IDC_STATIC,154,16,58,8 COMBOBOX IDC_CBOPTBUTTONS,154,28,144,100,CBS_DROPDOWNLIST | WS_TABSTOP CONTROL "Show icons in message list",IDC_CICONS2,"Button",BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | WS_TABSTOP,154,44,140,10 - GROUPBOX "Other",IDC_STATIC,4,62,300,84,WS_GROUP + GROUPBOX "Other",IDC_STATIC,4,62,300,69,WS_GROUP CONTROL "Store up to",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP,12,76,45,8 EDITTEXT IDC_EMAXHIST,58,74,28,12,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Spin2",IDC_SMAXHIST,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,76,73,11,14 @@ -169,11 +169,9 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,104,222,8 CONTROL "Remove Carriage Return (CR = '\\r' = #0D) chars from status messages",IDC_CREMOVECR, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,118,287,8 - CONTROL "Show 'Status message...' item in status menu",IDC_CSHOWSMSG, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,132,287,8 CONTROL "Clear History",IDC_BOPTHIST,"MButtonClass",WS_TABSTOP,236,73,61,14,WS_EX_NOACTIVATE | 0x10000000L CONTROL "Clear Predefined",IDC_BOPTDEF,"MButtonClass",WS_TABSTOP,236,90,61,14,WS_EX_NOACTIVATE | 0x10000000L - LTEXT "* This feature is available only when using StatusManager plugin.",IDC_NOTE1,11,149,287,8,NOT WS_VISIBLE + LTEXT "* This feature is available only when using StatusManager plugin.",IDC_NOTE1,11,135,287,8,NOT WS_VISIBLE END IDD_OPT_STATUS DIALOGEX 0, 0, 241, 162 @@ -272,14 +270,22 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_CROSS ICON "cross.ico" + IDI_HISTORY ICON "history.ico" + IDI_MESSAGE ICON "msg.ico" + IDI_PLUS ICON "plus.ico" + IDI_CHIST ICON "cbook.ico" + IDI_COPY ICON "copy.ico" + IDI_CSMSG ICON "csmsg.ico" + IDI_GOTOURL ICON "gotourl.ico" + ///////////////////////////////////////////////////////////////////////////// // // Menu @@ -336,6 +342,17 @@ BEGIN END END + +///////////////////////////////////////////////////////////////////////////// +// +// AFX_DIALOG_LAYOUT +// + +IDD_OPT_ADVANCED AFX_DIALOG_LAYOUT +BEGIN + 0 +END + #endif // Neutral resources ///////////////////////////////////////////////////////////////////////////// diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 96ea1e0525..dae491137a 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -1268,8 +1268,6 @@ static int ChangeStatusMsgPrebuild(WPARAM, LPARAM) CMenuItem mi(&g_plugin); mi.flags = CMIF_UNICODE; - if (!g_plugin.getByte("ShowStatusMenuItem", 1)) - mi.flags |= CMIF_HIDDEN; mi.hIcolibItem = g_plugin.getIconHandle(IDI_CSMSG); mi.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT; mi.name.w = LPGENW("Status message..."); diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index d733c4a376..37bb197a73 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -120,15 +120,12 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwndDlg, IDC_SMAXLENGTH, UDM_SETRANGE32, 1, 1024); SendDlgItemMessage(hwndDlg, IDC_EMAXLENGTH, EM_LIMITTEXT, 4, 0); - data->status_msg = (struct SingleStatusMsg *)mir_alloc(sizeof(struct SingleStatusMsg)*(accounts->count + 1)); + data->status_msg = (struct SingleStatusMsg *)mir_alloc(sizeof(struct SingleStatusMsg) * (accounts->count + 1)); for (i = ID_STATUS_ONLINE; i <= ID_STATUS_MAX; i++) { if (accounts->statusMsgFlags & Proto_Status2Flag(i)) { index = SendDlgItemMessage(hwndDlg, IDC_CBOPTSTATUS, CB_INSERTSTRING, -1, (LPARAM)Clist_GetStatusModeDescription(i, 0)); if (index != CB_ERR && index != CB_ERRSPACE) { - int j; - char setting[80]; - SendDlgItemMessage(hwndDlg, IDC_CBOPTSTATUS, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i - ID_STATUS_ONLINE); val = g_plugin.getByte((char *)StatusModeToDbSetting(i, "Flags"), STATUS_DEFAULT); @@ -136,11 +133,12 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l ptrW text(db_get_wsa(0, "SRAway", StatusModeToDbSetting(i, "Default"), GetDefaultMessage(i))); mir_wstrncpy(data->status_msg[0].msg[i - ID_STATUS_ONLINE], text, 1024); - for (j = 0; j < accounts->count; j++) { + for (int j = 0; j < accounts->count; j++) { auto *pa = accounts->pa[j]; if (!pa->IsEnabled() || !CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) || !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) continue; + char setting[80]; mir_snprintf(setting, "%sFlags", pa->szModuleName); val = g_plugin.getByte((char *)StatusModeToDbSetting(i, setting), STATUS_DEFAULT); data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE] = val; @@ -153,7 +151,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l } SendDlgItemMessage(hwndDlg, IDC_CBOPTSTATUS, CB_SETCURSEL, 0, 0); - data->proto_msg = (struct SingleProtoMsg *)mir_alloc(sizeof(struct SingleProtoMsg)*(accounts->count + 1)); + data->proto_msg = (struct SingleProtoMsg *)mir_alloc(sizeof(struct SingleProtoMsg) * (accounts->count + 1)); if (!data->proto_msg) { // TODO not really needed? EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), FALSE); @@ -256,16 +254,14 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case EN_KILLFOCUS: { BOOL translated; - int val, i; - - val = GetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, &translated, FALSE); + int val = GetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, &translated, FALSE); if (translated && val > 1024) SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1024, FALSE); if (translated && val < 1) SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1, FALSE); val = GetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, &translated, FALSE); - i = SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_GETCURSEL, 0, 0), 0); + int i = SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_GETCURSEL, 0, 0), 0); data->proto_msg[i].max_length = val; break; } @@ -280,7 +276,6 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l int l, k, status_modes = 0, newindex = 0; int i = SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0); - if (i == 0) { EnableWindow(GetDlgItem(hwndDlg, IDC_MAXLENGTH), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_EMAXLENGTH), FALSE); @@ -381,8 +376,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SendDlgItemMessage(hwndDlg, IDC_CBOPTSTATUS, CB_SETCURSEL, 0, 0); j = SendDlgItemMessage(hwndDlg, IDC_CBOPTSTATUS, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_CBOPTSTATUS, CB_GETCURSEL, 0, 0), 0); } - else - SendDlgItemMessage(hwndDlg, IDC_CBOPTSTATUS, CB_SETCURSEL, (WPARAM)newindex, 0); + else SendDlgItemMessage(hwndDlg, IDC_CBOPTSTATUS, CB_SETCURSEL, (WPARAM)newindex, 0); if (data->status_msg[i].flags[j] & STATUS_SHOW_DLG) CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_CHECKED); @@ -1128,7 +1122,6 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w CheckDlgButton(hwndDlg, IDC_CCLOSEWND, g_plugin.getByte("AutoClose", 1) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CRPOSWND, !g_plugin.getByte("WinCentered", 1) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CREMOVECR, g_plugin.getByte("RemoveCR", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CSHOWSMSG, g_plugin.getByte("ShowStatusMenuItem", 1) ? BST_CHECKED : BST_UNCHECKED); SendMessage(hwndDlg, WM_USER + 2, 0, 0); return TRUE; @@ -1264,9 +1257,8 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w g_plugin.setByte("DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, nullptr, FALSE)); g_plugin.setByte("WinCentered", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CRPOSWND) != BST_CHECKED)); g_plugin.setByte("RemoveCR", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CREMOVECR) == BST_CHECKED)); - g_plugin.setByte("ShowStatusMenuItem", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWSMSG) == BST_CHECKED)); - RebuildStatusMenu(); + RebuildStatusMenu(); return TRUE; } break; @@ -1296,7 +1288,7 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa data->setdelay = (int *)mir_alloc(sizeof(int) * accounts->count); for (int i = 0; i < accounts->count; ++i) { auto *pa = accounts->pa[i]; - if (!pa->IsEnabled() || !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) &~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0))) + if (!pa->IsEnabled() || !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0))) continue; int index = SendDlgItemMessage(hwndDlg, IDC_LISTPROTO, LB_ADDSTRING, 0, (LPARAM)pa->tszAccountName); @@ -1462,7 +1454,7 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) { for (int i = 0; i < accounts->count; i++) { auto *pa = accounts->pa[i]; - if (!pa->IsEnabled() || !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0))) + if (!pa->IsEnabled() || !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0))) continue; char szSetting[80]; diff --git a/plugins/SimpleStatusMsg/src/resource.h b/plugins/SimpleStatusMsg/src/resource.h index a7a25c8396..1270b4544f 100644 --- a/plugins/SimpleStatusMsg/src/resource.h +++ b/plugins/SimpleStatusMsg/src/resource.h @@ -55,7 +55,6 @@ #define IDC_COPTMSG2 1036 #define IDC_VARSHELP 1037 #define IDC_CBOPTBUTTONS 1038 -#define IDC_CSHOWSMSG 1039 #define IDC_CRPOSWND 1040 #define IDC_ESECUPDTMSG 1041 #define IDC_CUPDATEMSG 1042 @@ -117,7 +116,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 117 +#define _APS_NEXT_RESOURCE_VALUE 118 #define _APS_NEXT_COMMAND_VALUE 40037 #define _APS_NEXT_CONTROL_VALUE 1061 #define _APS_NEXT_SYMED_VALUE 100 diff --git a/plugins/SimpleStatusMsg/src/version.h b/plugins/SimpleStatusMsg/src/version.h index 0e2449ad2e..afa8258d8e 100644 --- a/plugins/SimpleStatusMsg/src/version.h +++ b/plugins/SimpleStatusMsg/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 1 #define __MINOR_VERSION 9 #define __RELEASE_NUM 0 -#define __BUILD_NUM 8 +#define __BUILD_NUM 9 #include -- cgit v1.2.3