From 52fe3f7be13509bd336c5efa28b8310a23211034 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 11 Apr 2013 16:47:12 +0000 Subject: - Srmm_ModifyIcon helper applied instead of CallService(MS_MSG_MODIFYICON) - various fixes related to SRMM icons; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@4426 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../HistorySweeperLight/src/historysweeperlight.h | 4 +-- plugins/HistorySweeperLight/src/main.cpp | 14 +++++----- plugins/HistorySweeperLight/src/options.cpp | 31 +++++++++++----------- 3 files changed, 24 insertions(+), 25 deletions(-) (limited to 'plugins/HistorySweeperLight/src') diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.h b/plugins/HistorySweeperLight/src/historysweeperlight.h index 407f3973d2..9f820ec439 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.h +++ b/plugins/HistorySweeperLight/src/historysweeperlight.h @@ -49,8 +49,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern HINSTANCE hInst; // options.c -extern const char* time_stamp_strings[]; -extern const char* keep_strings[]; +extern char* time_stamp_strings[]; +extern char* keep_strings[]; int HSOptInitialise(WPARAM wParam, LPARAM lParam); void InitIcons(void); void ReleaseIconEx(const char* name); diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp index b3653d8a9a..75f8d65143 100644 --- a/plugins/HistorySweeperLight/src/main.cpp +++ b/plugins/HistorySweeperLight/src/main.cpp @@ -59,14 +59,14 @@ int OnIconPressed(WPARAM wParam, LPARAM lParam) sid.szModule = ModuleName; sid.dwId = nh; sid.flags = MBF_HIDDEN; - CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid); + Srmm_ModifyIcon(hContact, &sid); nh = (nh + 1) % 4; db_set_b((HANDLE)wParam, ModuleName, "SweepHistory", (BYTE)nh); sid.dwId = nh; sid.flags = 0; - CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid); + Srmm_ModifyIcon(hContact, &sid); } return 0; } @@ -84,9 +84,9 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) if (sweep == 0) sid.szTooltip = LPGEN("Keep all events"); else if (sweep == 1) - sid.szTooltip = (char*)time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]; + sid.szTooltip = time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]; else if (sweep == 2) - sid.szTooltip = (char*)keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]; + sid.szTooltip = keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]; else if (sweep == 3) sid.szTooltip = LPGEN("Delete all events"); @@ -95,13 +95,13 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) sid.dwId = 1; sid.hIcon = LoadIconEx("act1"); - sid.szTooltip = (char*)time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]; + sid.szTooltip = time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]; sid.flags = MBF_HIDDEN; Srmm_AddIcon(&sid); sid.dwId = 2; sid.hIcon = LoadIconEx("act2"); - sid.szTooltip = (char*)keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]; + sid.szTooltip = keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]; sid.flags = MBF_HIDDEN; Srmm_AddIcon(&sid); @@ -123,7 +123,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) for(i = 0; i < 4; i++) { sid.dwId = i; sid.flags = (sweep == i) ? 0 : MBF_HIDDEN; - CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid); + Srmm_ModifyIcon(hContact, &sid); } } diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index 06686fe2d6..436fecd86f 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "historysweeperlight.h" // Time Stamps strings -const char* time_stamp_strings[] = +char* time_stamp_strings[] = { LPGEN("Delete older than 1 day"), LPGEN("Delete older than 3 days"), @@ -34,7 +34,7 @@ const char* time_stamp_strings[] = LPGEN("Delete older than 1 year (365 days)") }; -const char* keep_strings[] = +char* keep_strings[] = { LPGEN("Keep 1 last event"), LPGEN("Keep 2 last events"), @@ -179,14 +179,13 @@ void SaveSettings(HWND hwndDlg) st = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, 0); if ( st != 0 ) db_set_b(hContact, ModuleName, "SweepHistory", (BYTE)st); - else db_unset(hContact, ModuleName, "SweepHistory"); + else db_unset(hContact, ModuleName, "SweepHistory"); // set per-contact icons in status bar - for(i = 0; i < 4; i++) - { + for(i = 0; i < 4; i++) { sid.dwId = i; sid.flags = (st == i) ? 0 : MBF_HIDDEN; - CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid); + Srmm_ModifyIcon(hContact, &sid); } } @@ -194,20 +193,20 @@ void SaveSettings(HWND hwndDlg) st = db_get_b(NULL, ModuleName, "SweepHistory", 0); sid.dwId = 0; - if (st == 0) sid.szTooltip = Translate("Keep all events"); - else if (st == 1) sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]); - else if (st == 2) sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]); - else if (st == 3) sid.szTooltip = Translate("Delete all events"); - CallService(MS_MSG_MODIFYICON, 0, (LPARAM)&sid); + if (st == 0) sid.szTooltip = LPGEN("Keep all events"); + else if (st == 1) sid.szTooltip = LPGEN(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]); + else if (st == 2) sid.szTooltip = LPGEN(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]); + else if (st == 3) sid.szTooltip = LPGEN("Delete all events"); + Srmm_ModifyIcon(NULL, &sid); sid.dwId = 1; - sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]); - CallService(MS_MSG_MODIFYICON, 0, (LPARAM)&sid); + sid.szTooltip = time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]; + Srmm_ModifyIcon(NULL, &sid); sid.dwId = 2; - sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]); - CallService(MS_MSG_MODIFYICON, 0, (LPARAM)&sid); -}//SaveSettings + sid.szTooltip = keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]; + Srmm_ModifyIcon(NULL, &sid); +} INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { -- cgit v1.2.3