From 048ef61d78aba395988abe8621ba29437d281472 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 8 Apr 2018 13:20:52 +0300 Subject: Clist_nicer: unused code removed --- plugins/Clist_nicer/src/clc.cpp | 2 +- plugins/Clist_nicer/src/clist.h | 2 +- plugins/Clist_nicer/src/clistmod.cpp | 15 +------ plugins/Clist_nicer/src/clisttray.cpp | 73 -------------------------------- plugins/Clist_nicer/src/cluiservices.cpp | 38 ++++++----------- plugins/Clist_nicer/src/init.cpp | 9 +--- plugins/Clist_nicer/src/version.h | 4 +- 7 files changed, 20 insertions(+), 123 deletions(-) diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 650ad15bd2..8ff5b06bff 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -125,7 +125,7 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) szProto_s = nullptr; else szProto_s = cws->value.pszVal; - Clist_ChangeContactIcon(hContact, IconFromStatusMode(szProto_s, szProto_s == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto_s, "Status", ID_STATUS_OFFLINE), hContact, nullptr)); + Clist_ChangeContactIcon(hContact, IconFromStatusMode(szProto_s, szProto_s == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto_s, "Status", ID_STATUS_OFFLINE), hContact)); } // something is being written to a protocol module if (!__strcmp(szProto, cws->szModule)) { diff --git a/plugins/Clist_nicer/src/clist.h b/plugins/Clist_nicer/src/clist.h index 8e6d0e3212..32409f3a6c 100644 --- a/plugins/Clist_nicer/src/clist.h +++ b/plugins/Clist_nicer/src/clist.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma once -int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON *phIcon); +int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact); #define CLUIINTM_REDRAW (WM_USER+100) #define CLUIINTM_STATUSBARUPDATE (WM_USER+101) diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index 0b7bbc04b5..03933ec48c 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -38,18 +38,15 @@ static INT_PTR GetStatusMode(WPARAM, LPARAM) return(g_maxStatus == ID_STATUS_OFFLINE ? pcli->currentDesiredStatusMode : g_maxStatus); } -int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON *phIcon) +int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact) { - if (phIcon != nullptr) - *phIcon = nullptr; - char *szFinalProto; int finalStatus; if (szProto != nullptr && !mir_strcmp(szProto, META_PROTO) && hContact != 0 && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { MCONTACT hSubContact = db_mc_getMostOnline(hContact); szFinalProto = GetContactProto(hSubContact); - finalStatus = (status == 0) ? (WORD)db_get_w(hSubContact, szFinalProto, "Status", ID_STATUS_OFFLINE) : status; + finalStatus = (status == 0) ? db_get_w(hSubContact, szFinalProto, "Status", ID_STATUS_OFFLINE) : status; hContact = hSubContact; } else { @@ -57,14 +54,6 @@ int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON finalStatus = status; } - if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE && phIcon != nullptr) { - if (szProto) { - char szBuf[128]; - mir_snprintf(szBuf, "%s_conn", szProto); - *phIcon = IcoLib_GetIcon(szBuf); - } - } - return coreCli.pfnIconFromStatusMode(szFinalProto, finalStatus, hContact); } diff --git a/plugins/Clist_nicer/src/clisttray.cpp b/plugins/Clist_nicer/src/clisttray.cpp index 0b16733917..59cae18f71 100644 --- a/plugins/Clist_nicer/src/clisttray.cpp +++ b/plugins/Clist_nicer/src/clisttray.cpp @@ -24,79 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -#define TRAYICON_ID_BASE 100 - -// don't move to win2k.h, need new and old versions to work on 9x/2000/XP -#define NIF_STATE 0x00000008 -#define NIF_INFO 0x00000010 - -int TrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount) -{ - HICON hIcon; - int iIcon; - HWND hwnd = pcli->hwndContactList; - - if (netProtoCount > 1) { - if (averageMode > 0) { - if (db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) { - if (db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)) { - iIcon = IconFromStatusMode(szChangedProto, averageMode, 0, &hIcon); - hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); - return Clist_TrayIconSetBaseInfo(hIcon, szChangedProto); - } - if (pcli->trayIcon == nullptr || pcli->trayIcon[0].szProto == nullptr) { - iIcon = IconFromStatusMode(nullptr, averageMode, 0, &hIcon); - hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); - return Clist_TrayIconSetBaseInfo(hIcon, nullptr); - } - Clist_TrayIconDestroy(hwnd); - pcli->pfnTrayIconInit(hwnd); - } - else { - iIcon = IconFromStatusMode(nullptr, averageMode, 0, &hIcon); - hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); - return Clist_TrayIconSetBaseInfo(hIcon, nullptr); - } - } - else { - switch (db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT)) { - case SETTING_TRAYICON_CYCLE: - Clist_TraySetTimer(); - iIcon = IconFromStatusMode(szChangedProto, Proto_GetStatus(szChangedProto), 0, &hIcon); - hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); - return Clist_TrayIconSetBaseInfo(hIcon, nullptr); - - case SETTING_TRAYICON_MULTI: - if (!pcli->trayIcon) - Clist_TrayIconRemove(nullptr, nullptr); - else if (db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)) { - iIcon = IconFromStatusMode(szChangedProto, Proto_GetStatus(szChangedProto), 0, &hIcon); - hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); - return Clist_TrayIconSetBaseInfo(hIcon, szChangedProto); - } - Clist_TrayIconDestroy(hwnd); - pcli->pfnTrayIconInit(hwnd); - break; - - case SETTING_TRAYICON_SINGLE: - ptrA szProto(db_get_sa(NULL, "CList", "PrimaryStatus")); - iIcon = IconFromStatusMode(szProto, szProto ? Proto_GetStatus(szProto) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0), 0, &hIcon); - hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); - return Clist_TrayIconSetBaseInfo(hIcon, nullptr); - } - } - } - else { - iIcon = IconFromStatusMode(nullptr, averageMode, 0, &hIcon); - hIcon = (hIcon) ? CopyIcon(hIcon) : ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL); - return Clist_TrayIconSetBaseInfo(hIcon, nullptr); - } - - return -1; -} - -///////////////////////////////////////////////////////////////////////////////////////// - INT_PTR TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) { MSG *msg = (MSG*)wParam; diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index 7da688f714..9f83842bac 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -45,12 +45,6 @@ int g_maxStatus = ID_STATUS_OFFLINE; void CluiProtocolStatusChanged(int, const char*) { - DBVARIANT dbv = { 0 }; - int iIcon = 0; - HICON hIcon = nullptr; - int rdelta = cfg::dat.bCLeft + cfg::dat.bCRight; - BYTE windowStyle; - if (pcli->hwndStatus == nullptr || cfg::shutDown) return; @@ -66,6 +60,7 @@ void CluiProtocolStatusChanged(int, const char*) int *partWidths = (int*)_alloca((accs.getCount() + 1)*sizeof(int)); + int rdelta = cfg::dat.bCLeft + cfg::dat.bCRight; int partCount; if (cfg::dat.bEqualSections) { RECT rc; @@ -92,7 +87,6 @@ void CluiProtocolStatusChanged(int, const char*) partCount = toshow; } else { - SIZE textSize; BYTE showOpts = db_get_b(NULL, "CLUI", "SBarShow", 1); wchar_t szName[32]; @@ -110,6 +104,7 @@ void CluiProtocolStatusChanged(int, const char*) if (!pa->IsVisible()) continue; + SIZE textSize; int x = 2; if (showOpts & 1) x += 16; @@ -139,7 +134,7 @@ void CluiProtocolStatusChanged(int, const char*) SendMessage(pcli->hwndStatus, SB_SIMPLE, FALSE, 0); partWidths[partCount - 1] = -1; - windowStyle = db_get_b(NULL, "CLUI", "WindowStyle", 0); + BYTE windowStyle = db_get_b(NULL, "CLUI", "WindowStyle", 0); SendMessage(pcli->hwndStatus, SB_SETMINHEIGHT, 18 + cfg::dat.bClipBorder + ((windowStyle == SETTING_WINDOWSTYLE_THINBORDER || windowStyle == SETTING_WINDOWSTYLE_NOBORDER) ? 3 : 0), 0); SendMessage(pcli->hwndStatus, SB_SETPARTS, partCount, (LPARAM)partWidths); @@ -167,18 +162,17 @@ void CluiProtocolStatusChanged(int, const char*) } // update the clui button + int iIcon = 0; int wStatus = 0; - if (!db_get(NULL, "CList", "PrimaryStatus", &dbv)) { - if (dbv.type == DBVT_ASCIIZ && mir_strlen(dbv.pszVal) > 1) { - wStatus = Proto_GetStatus(dbv.pszVal); - iIcon = IconFromStatusMode(dbv.pszVal, (int)wStatus, 0, &hIcon); - } - mir_free(dbv.pszVal); + ptrA szPrimaryStatus(db_get_sa(NULL, "CList", "PrimaryStatus")); + if (szPrimaryStatus != nullptr) { + wStatus = Proto_GetStatus(szPrimaryStatus); + iIcon = IconFromStatusMode(szPrimaryStatus, (int)wStatus, 0); } else { char *szMaxProto = nullptr; wStatus = Clist_GetGeneralizedStatus(&szMaxProto); - iIcon = IconFromStatusMode(szMaxProto, wStatus, 0, &hIcon); + iIcon = IconFromStatusMode(szMaxProto, wStatus, 0); g_maxStatus = (int)wStatus; } @@ -198,21 +192,15 @@ void CluiProtocolStatusChanged(int, const char*) HWND hwndClistBtn = GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS); if (IsWindow(hwndClistBtn)) { SetWindowText(hwndClistBtn, szStatus); - if (!hIcon) - SendMessage(hwndClistBtn, BUTTONSETIMLICON, (WPARAM)hCListImages, (LPARAM)iIcon); - else - SendMessage(hwndClistBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); + SendMessage(hwndClistBtn, BUTTONSETIMLICON, (WPARAM)hCListImages, (LPARAM)iIcon); InvalidateRect(hwndClistBtn, nullptr, TRUE); } HWND hwndTtbStatus = ClcGetButtonWindow(IDC_TBTOPSTATUS); if (IsWindow(hwndTtbStatus)) { - if (g_ButtonItems == nullptr) { - if (!hIcon) - SendMessage(hwndTtbStatus, BUTTONSETIMLICON, (WPARAM)hCListImages, (LPARAM)iIcon); - else - SendMessage(hwndTtbStatus, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); - } + if (g_ButtonItems == nullptr) + SendMessage(hwndTtbStatus, BUTTONSETIMLICON, (WPARAM)hCListImages, (LPARAM)iIcon); + InvalidateRect(hwndTtbStatus, nullptr, TRUE); } } diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index cedc28e0ec..14aa73b678 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -41,7 +41,6 @@ int SetHideOffline(int iValue); ClcContact *CreateClcContact(void); void ReloadThemedOptions(); -int TrayCalcChanged(const char *szChangedProto, int averageMode, int iProtoCount); void LoadButtonModule(); void GetDefaultFontSetting(int i, LOGFONT *lf, COLORREF *colour); @@ -112,11 +111,6 @@ static int systemModulesLoaded(WPARAM, LPARAM) return 0; } -static int fnIconFromStatusMode(const char *szProto, int status, MCONTACT hContact) -{ - return IconFromStatusMode(szProto, status, hContact, nullptr); -} - extern "C" int __declspec(dllexport) CListInitialise() { mir_getLP(&pluginInfo); @@ -202,7 +196,6 @@ extern "C" int __declspec(dllexport) CListInitialise() pcli->pfnRebuildEntireList = RebuildEntireList; pcli->pfnRowHitTest = RowHeight::hitTest; pcli->pfnScrollTo = ScrollTo; - pcli->pfnTrayCalcChanged = TrayCalcChanged; pcli->pfnSetHideOffline = SetHideOffline; pcli->pfnShowHide = ShowHide; @@ -215,7 +208,7 @@ extern "C" int __declspec(dllexport) CListInitialise() pcli->pfnAddInfoItemToGroup = AddInfoItemToGroup; pcli->pfnContactListControlWndProc = ContactListControlWndProc; pcli->pfnContactListWndProc = ContactListWndProc; - pcli->pfnIconFromStatusMode = fnIconFromStatusMode; + pcli->pfnIconFromStatusMode = IconFromStatusMode; pcli->pfnLoadClcOptions = LoadClcOptions; pcli->pfnProcessExternalMessages = ProcessExternalMessages; pcli->pfnRecalcScrollBar = RecalcScrollBar; diff --git a/plugins/Clist_nicer/src/version.h b/plugins/Clist_nicer/src/version.h index 982fee189e..ede11e58e7 100644 --- a/plugins/Clist_nicer/src/version.h +++ b/plugins/Clist_nicer/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 9 -#define __RELEASE_NUM 2 -#define __BUILD_NUM 4 +#define __RELEASE_NUM 3 +#define __BUILD_NUM 1 #include -- cgit v1.2.3