From fd00c3f12ac75e78941d4417985d0052f31eba8f Mon Sep 17 00:00:00 2001 From: slotwin Date: Tue, 1 Jul 2014 22:56:51 +0000 Subject: Simple Status Message: remove options to hide 'Copy message' and 'Go to URL in status message' from contact menu (can be done with genmenu) git-svn-id: http://svn.miranda-ng.org/main/trunk@9641 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SimpleStatusMsg/src/awaymsg.cpp | 23 ++++++--------- plugins/SimpleStatusMsg/src/options.cpp | 52 ++++++++++++++++----------------- plugins/SimpleStatusMsg/src/resource.h | 6 ++-- 3 files changed, 36 insertions(+), 45 deletions(-) (limited to 'plugins/SimpleStatusMsg/src') diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index 28521dd14c..f918e447db 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -364,8 +364,8 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM lParam) if (!iHidden) { iHidden = 1; iStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); - if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1,0) & PF1_MODEMSGRECV) { - if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3,0) & Proto_Status2Flag(iStatus == ID_STATUS_OFFLINE ? ID_STATUS_INVISIBLE : iStatus)) { + if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) { + if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus == ID_STATUS_OFFLINE ? ID_STATUS_INVISIBLE : iStatus)) { iHidden = 0; clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON | CMIF_TCHAR; clmi.hIcon = LoadSkinnedProtoIcon(szProto, iStatus); @@ -381,22 +381,17 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM lParam) clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR; if (!iHidden && szMsg != NULL) { - if (db_get_b(NULL, "SimpleStatusMsg", "ShowCopy", 1)) { - clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_TCHAR; - mir_sntprintf(str, SIZEOF(str), TranslateT("Copy %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0)); - clmi.ptszName = str; - } + clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_TCHAR; + mir_sntprintf(str, SIZEOF(str), TranslateT("Copy %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0)); + clmi.ptszName = str; } Menu_ModifyItem(hCopyMsgMenuItem, &clmi); clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR; - if (!iHidden && szMsg != NULL) { - if (db_get_b(NULL, "SimpleStatusMsg", "ShowGoToURL", 1) && StrFindURL(szMsg) != NULL) { - clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_TCHAR; - mir_sntprintf(str, SIZEOF(str), TranslateT("&Go to URL in %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0)); - clmi.ptszName = str; - } - + if (!iHidden && szMsg != NULL && StrFindURL(szMsg) != NULL) { + clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_TCHAR; + mir_sntprintf(str, SIZEOF(str), TranslateT("&Go to URL in %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0)); + clmi.ptszName = str; } Menu_ModifyItem(hGoToURLMenuItem, &clmi); diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index 5f8044216d..251f005a99 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -1237,8 +1237,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w CheckDlgButton(hwndDlg, IDC_CICONS1, settingValue & DLG_SHOW_STATUS_ICONS ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CICONS2, settingValue & DLG_SHOW_LIST_ICONS ? BST_CHECKED : BST_UNCHECKED); - if (!(settingValue & DLG_SHOW_STATUS)) - { + if (!(settingValue & DLG_SHOW_STATUS)) { EnableWindow(GetDlgItem(hwndDlg, IDC_CPROFILES), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CICONS1), FALSE); } @@ -1252,8 +1251,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w else SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTBUTTONS), CB_SETCURSEL, (WPARAM)i_btnhide, 0); - if (!ServiceExists(MS_SS_GETPROFILECOUNT)) - { + if (!ServiceExists(MS_SS_GETPROFILECOUNT)) { TCHAR szText[100]; mir_sntprintf(szText, SIZEOF(szText), _T("%s *"), TranslateT("Show status profiles in status list")); SetDlgItemText(hwndDlg, IDC_CPROFILES, szText); @@ -1283,8 +1281,6 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w CheckDlgButton(hwndDlg, IDC_CCLOSEWND, db_get_b(NULL, "SimpleStatusMsg", "AutoClose", 1) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CRPOSWND, !db_get_b(NULL, "SimpleStatusMsg", "WinCentered", 1) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CREMOVECR, db_get_b(NULL, "SimpleStatusMsg", "RemoveCR", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CSHOWCOPY, db_get_b(NULL, "SimpleStatusMsg", "ShowCopy", 1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_CSHOWGURL, db_get_b(NULL, "SimpleStatusMsg", "ShowGoToURL", 1) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CSHOWSMSG, db_get_b(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", 1) ? BST_CHECKED : BST_UNCHECKED); SendMessage(hwndDlg, WM_USER + 2, 0, 0); @@ -1300,8 +1296,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w } case WM_COMMAND: - switch (LOWORD(wParam)) - { + switch (LOWORD(wParam)) { case IDC_CSTATUSLIST: { BOOL bChecked = IsDlgButtonChecked(hwndDlg, IDC_CSTATUSLIST) == BST_CHECKED; @@ -1311,12 +1306,14 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w } case IDC_CBOPTBUTTONS: - if ((HWND)lParam != GetFocus() || HIWORD(wParam) != CBN_SELCHANGE) return 0; + if ((HWND)lParam != GetFocus() || HIWORD(wParam) != CBN_SELCHANGE) + return 0; break; case IDC_EMAXHIST: { - if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0; + if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) + return 0; int val = GetDlgItemInt(hwndDlg, IDC_EMAXHIST, NULL, FALSE); if (val > 25) SendDlgItemMessage(hwndDlg, IDC_SMAXHIST, UDM_SETPOS, 0, MAKELONG((short)25, 0)); @@ -1330,7 +1327,8 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w case IDC_ETIMEOUT: { - if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0; + if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) + return 0; int val = GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE); if (val == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ETIMEOUT))) SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)1, 0)); @@ -1345,17 +1343,16 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w int i, max_hist_msgs; char text[8], setting[80]; - if (hwndSAMsgDialog) DestroyWindow(hwndSAMsgDialog); + if (hwndSAMsgDialog) + DestroyWindow(hwndSAMsgDialog); max_hist_msgs = db_get_b(NULL, "SimpleStatusMsg", "MaxHist", 10); - for (i = 1; i <= max_hist_msgs; i++) - { + for (i = 1; i <= max_hist_msgs; i++) { mir_snprintf(text, SIZEOF(text), "SMsg%d", i); db_set_ts(NULL, "SimpleStatusMsg", text, _T("")); } db_set_s(NULL, "SimpleStatusMsg", "LastMsg", ""); - for (i = 0; i < accounts->count; i++) - { + for (i = 0; i < accounts->count; i++) { if (!IsAccountEnabled(accounts->pa[i])) continue; @@ -1379,11 +1376,11 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w char szSetting[16]; int nDefMSgCount; - if (hwndSAMsgDialog) DestroyWindow(hwndSAMsgDialog); + if (hwndSAMsgDialog) + DestroyWindow(hwndSAMsgDialog); nDefMSgCount = db_get_w(NULL, "SimpleStatusMsg", "DefMsgCount", 0); - for (int i = 1; i <= nDefMSgCount; i++) - { + for (int i = 1; i <= nDefMSgCount; i++) { mir_snprintf(szSetting, SIZEOF(szSetting), "DefMsg%d", i); db_unset(NULL, "SimpleStatusMsg", szSetting); } @@ -1396,15 +1393,18 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w break; case WM_NOTIFY: - if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) - { + if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) { // Layout int flags = 0, curSel; - if (IsDlgButtonChecked(hwndDlg, IDC_CSTATUSLIST) == BST_CHECKED) flags |= DLG_SHOW_STATUS; - if (IsDlgButtonChecked(hwndDlg, IDC_CICONS1) == BST_CHECKED) flags |= DLG_SHOW_STATUS_ICONS; - if (IsDlgButtonChecked(hwndDlg, IDC_CICONS2) == BST_CHECKED) flags |= DLG_SHOW_LIST_ICONS; - if (IsDlgButtonChecked(hwndDlg, IDC_CPROFILES) == BST_CHECKED) flags |= DLG_SHOW_STATUS_PROFILES; + if (IsDlgButtonChecked(hwndDlg, IDC_CSTATUSLIST) == BST_CHECKED) + flags |= DLG_SHOW_STATUS; + if (IsDlgButtonChecked(hwndDlg, IDC_CICONS1) == BST_CHECKED) + flags |= DLG_SHOW_STATUS_ICONS; + if (IsDlgButtonChecked(hwndDlg, IDC_CICONS2) == BST_CHECKED) + flags |= DLG_SHOW_LIST_ICONS; + if (IsDlgButtonChecked(hwndDlg, IDC_CPROFILES) == BST_CHECKED) + flags |= DLG_SHOW_STATUS_PROFILES; curSel = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTBUTTONS), CB_GETCURSEL, 0, 0); if (curSel != CB_ERR) @@ -1418,8 +1418,6 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w db_set_b(NULL, "SimpleStatusMsg", "DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE)); db_set_b(NULL, "SimpleStatusMsg", "WinCentered", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CRPOSWND) != BST_CHECKED)); db_set_b(NULL, "SimpleStatusMsg", "RemoveCR", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CREMOVECR) == BST_CHECKED)); - db_set_b(NULL, "SimpleStatusMsg", "ShowCopy", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWCOPY) == BST_CHECKED)); - db_set_b(NULL, "SimpleStatusMsg", "ShowGoToURL", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWGURL) == BST_CHECKED)); db_set_b(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWSMSG) == BST_CHECKED)); RebuildStatusMenu(); diff --git a/plugins/SimpleStatusMsg/src/resource.h b/plugins/SimpleStatusMsg/src/resource.h index 137327acac..6646093446 100644 --- a/plugins/SimpleStatusMsg/src/resource.h +++ b/plugins/SimpleStatusMsg/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by resource.rc +// Microsoft Visual C++ generated include file. +// Used by ..\res\resource.rc // #define IDD_COPY 101 #define IDD_AWAYMSGBOX 102 @@ -39,7 +39,6 @@ #define IDC_CPROFILES 1018 #define IDC_EMAXHIST 1019 #define IDC_ETIMEOUT 1020 -#define IDC_CSHOWGURL 1021 #define IDC_SMAXHIST 1022 #define IDC_CCLOSEWND 1023 #define IDC_STIMEOUT 1024 @@ -51,7 +50,6 @@ #define IDC_ROPTPROTO2 1030 #define IDC_ROPTPROTO3 1031 #define IDC_CREMOVECR 1032 -#define IDC_CSHOWCOPY 1033 #define IDC_EMAXLENGTH 1034 #define IDC_SMAXLENGTH 1035 #define IDC_COPTMSG2 1036 -- cgit v1.2.3