From 31582b9e959b65cb9e29c4197a42e1a7e9ca804e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 3 Aug 2013 18:51:25 +0000 Subject: tray icons code standardization git-svn-id: http://svn.miranda-ng.org/main/trunk@5569 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/src/clistmod.cpp | 1 - plugins/Clist_nicer/src/clisttray.cpp | 26 ++++---------------------- plugins/Clist_nicer/src/init.cpp | 6 +++--- 3 files changed, 7 insertions(+), 26 deletions(-) (limited to 'plugins/Clist_nicer/src') diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index ae022a4a7f..bfb01329b5 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -40,7 +40,6 @@ extern int RemoveEvent(WPARAM wParam, LPARAM lParam); int InitCustomMenus(void); void UninitCustomMenus(void); INT_PTR GetContactStatusMessage(WPARAM wParam, LPARAM lParam); -void TrayIconUpdateBase(const char *szChangedProto); int EventsProcessContactDoubleClick(HANDLE hContact); int SetHideOffline(WPARAM wParam, LPARAM lParam); diff --git a/plugins/Clist_nicer/src/clisttray.cpp b/plugins/Clist_nicer/src/clisttray.cpp index 9430ed1f56..bad9535193 100644 --- a/plugins/Clist_nicer/src/clisttray.cpp +++ b/plugins/Clist_nicer/src/clisttray.cpp @@ -35,29 +35,11 @@ extern HIMAGELIST hCListImages; #define NIF_STATE 0x00000008 #define NIF_INFO 0x00000010 -void TrayIconUpdateBase(const char *szChangedProto) +int TrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount) { - int i,count,netProtoCount,changed = -1; - PROTOACCOUNT **accs; - int averageMode = 0; + int changed = -1; HWND hwnd = pcli->hwndContactList; - if (pcli->cycleTimerId) - KillTimer(NULL, pcli->cycleTimerId); pcli->cycleTimerId = 0; - - ProtoEnumAccounts( &count, &accs ); - for (i = 0,netProtoCount = 0; i < count; i++) { - if ( !pcli->pfnGetProtocolVisibility( accs[i]->szModuleName )) - continue; - netProtoCount++; - if ( !lstrcmpA(szChangedProto, accs[i]->szModuleName )) - pcli->cycleStep = i; - if (averageMode == 0) - averageMode = CallProtoService( accs[i]->szModuleName, PS_GETSTATUS, 0, 0); - else if (averageMode != CallProtoService( accs[i]->szModuleName, PS_GETSTATUS, 0, 0)) { - averageMode = -1; break; - } - } if (netProtoCount > 1) { if (averageMode > 0) { if (cfg::getByte("CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) { @@ -150,8 +132,8 @@ void TrayIconUpdateBase(const char *szChangedProto) else changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), NULL); } - if (changed != -1 && pcli->trayIcon[changed].isBase) - pcli->pfnTrayIconUpdate( pcli->trayIcon[changed].hBaseIcon, NULL, pcli->trayIcon[changed].szProto, 1); + + return changed; } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index 7b8b31de25..f7ac4a02ba 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -51,9 +51,9 @@ TIME_API tmi; HMENU BuildGroupPopupMenu( ClcGroup* group ); ClcContact* CreateClcContact( void ); -struct CListEvent* fnCreateEvent( void ); +CListEvent* fnCreateEvent( void ); void ReloadThemedOptions(); -void TrayIconUpdateBase(const char *szChangedProto); +int TrayCalcChanged(const char *szChangedProto, int averageMode, int iProtoCount); void RegisterCLUIFrameClasses(); void LoadButtonModule(); @@ -299,7 +299,7 @@ extern "C" int __declspec(dllexport) CListInitialise() pcli->pfnRebuildEntireList = RebuildEntireList; pcli->pfnRowHitTest = RowHeight::hitTest; pcli->pfnScrollTo = ScrollTo; - pcli->pfnTrayIconUpdateBase = TrayIconUpdateBase; + pcli->pfnTrayCalcChanged = TrayCalcChanged; pcli->pfnSetHideOffline = SetHideOffline; pcli->pfnShowHide = ShowHide; -- cgit v1.2.3