diff options
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r-- | plugins/Clist_modern/res/resource.rc | 24 | ||||
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_clc.h | 4 | ||||
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_commonheaders.h | 6 | ||||
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_commonprototypes.h | 5 | ||||
-rw-r--r-- | plugins/Clist_modern/src/init.cpp | 6 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcopts.cpp | 172 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clisttray.cpp | 366 | ||||
-rw-r--r-- | plugins/Clist_modern/src/resource.h | 15 |
8 files changed, 336 insertions, 262 deletions
diff --git a/plugins/Clist_modern/res/resource.rc b/plugins/Clist_modern/res/resource.rc index 16b2c886a0..9db00c43ac 100644 --- a/plugins/Clist_modern/res/resource.rc +++ b/plugins/Clist_modern/res/resource.rc @@ -478,7 +478,7 @@ BEGIN CONTROL "Tree1",IDC_GREYOUTOPTS,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,165,168,130,46
END
-IDD_OPT_TRAY DIALOGEX 0, 0, 296, 152
+IDD_OPT_TRAY DIALOGEX 0, 0, 296, 190
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
@@ -489,21 +489,23 @@ BEGIN EDITTEXT IDC_BLINKTIME,12,59,35,12,ES_NUMBER
CONTROL "",IDC_BLINKSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,48,58,11,12
LTEXT "ms, delay between icon blinking",IDC_STATIC,62,61,104,8
- CONTROL "Show",IDC_DONTCYCLE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,10,94,97,10
- COMBOBOX IDC_PRIMARYSTATUS,107,94,78,101,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- CONTROL "Cycle icons every",IDC_CYCLE,"Button",BS_AUTORADIOBUTTON,10,110,97,10
- EDITTEXT IDC_CYCLETIME,107,110,29,12,ES_RIGHT | ES_NUMBER
- CONTROL "",IDC_CYCLETIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,136,109,11,14
- LTEXT "seconds, when statuses differ",IDC_STATIC,151,111,132,8,NOT WS_GROUP
- CONTROL "Show multiple icons",IDC_MULTITRAY,"Button",BS_AUTORADIOBUTTON,10,126,97,10
- CONTROL "only when statuses differ",IDC_ALWAYSMULTI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,126,181,10
GROUPBOX "System tray icon",IDC_STATIC,2,6,292,73
- GROUPBOX "System tray icon mode",IDC_STATIC,2,80,292,61
CONTROL "Use xStatus icon",IDC_SHOWXSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,171,19,117,10
CONTROL "Show normal status as overlay",IDC_SHOWNORMAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,171,32,117,10
CONTROL "Status overlay opacity is 75%",IDC_TRANSPARENTOVERLAY,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,171,45,117,10
- CONTROL "only when statuses differ",IDC_ALWAYSPRIMARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,94,98,10
+
+ GROUPBOX "Icon mode", IDC_STATIC, 2, 80, 292, 80
+ CONTROL "Global status", IDC_ICON_GLOBAL, "Button", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 10, 94, 97, 10
+ CONTROL "Single account", IDC_ICON_ACC, "Button", BS_AUTORADIOBUTTON, 10, 110, 97, 10
+ CONTROL "Cycle icons every", IDC_ICON_CYCLE, "Button", BS_AUTORADIOBUTTON, 10, 126, 97, 10
+ CONTROL "All accounts", IDC_ICON_ALL, "Button", BS_AUTORADIOBUTTON, 10, 142, 97, 10
+ COMBOBOX IDC_PRIMARYSTATUS, 107, 110, 78, 101, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | WS_DISABLED
+ EDITTEXT IDC_CYCLETIME, 107, 126, 29, 12, ES_RIGHT | ES_NUMBER | WS_DISABLED
+ CONTROL "", IDC_CYCLETIMESPIN, "msctls_updown32",
+ UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK | WS_DISABLED, 136, 109, 11, 14
+ LTEXT "seconds", IDC_STATIC, 142, 128, 132, 8
+
END
IDD_OPT_META_CLC DIALOGEX 0, 0, 225, 186
diff --git a/plugins/Clist_modern/src/hdr/modern_clc.h b/plugins/Clist_modern/src/hdr/modern_clc.h index e84b1f1779..68b6aa4518 100644 --- a/plugins/Clist_modern/src/hdr/modern_clc.h +++ b/plugins/Clist_modern/src/hdr/modern_clc.h @@ -32,10 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "modern_defsettings.h"
#include "modern_clist.h"
-#define SETTING_TRAYICON_SINGLE 0
-#define SETTING_TRAYICON_CYCLE 1
-#define SETTING_TRAYICON_MULTI 2
-
#define NIIF_INTERN_UNICODE 0x00000100
#define SETTING_STATE_HIDDEN 0
diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index 07d0d510a7..003200d1c0 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -83,6 +83,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_langpack.h>
#include <m_options.h>
#include <m_protosvc.h>
+#include <m_protoint.h>
#include <m_clistint.h>
#include <m_skin.h>
#include <m_contacts.h>
@@ -368,4 +369,9 @@ public: };
};
+#define TRAY_ICON_MODE_GLOBAL 1
+#define TRAY_ICON_MODE_ACC 2
+#define TRAY_ICON_MODE_CYCLE 4
+#define TRAY_ICON_MODE_ALL 8
+
#endif // commonheaders_h__
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index 7c0cea9fab..f20919dc43 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -297,8 +297,6 @@ int cliShowHide(WPARAM wParam, LPARAM lParam); BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase );
int cliCompareContacts(const ClcContact *contact1,const ClcContact *contact2);
int cliFindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible);
-int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount);
-int cliTrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam);
void cliCluiProtocolStatusChanged(int status,const char * proto);
HMENU cliBuildGroupPopupMenu(ClcGroup *group);
void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact);
@@ -307,6 +305,9 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat); void CLUI_cli_LoadCluiGlobalOpts(void);
INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam);
BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase );
+int cliTrayIconInit(HWND hwnd);
+int cliTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int status);
+void cliTrayIconUpdateBase(const char *szChangedProto);
ClcContact* cliCreateClcContact( void );
ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact);
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 7736c45cf6..aedeb0b01f 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -144,8 +144,10 @@ static HRESULT SubclassClistInterface() pcli->pfnFreeCacheItem = cliFreeCacheItem;
pcli->pfnInvalidateDisplayNameCacheEntry = cliInvalidateDisplayNameCacheEntry;
- pcli->pfnTrayIconPauseAutoHide = cliTrayIconPauseAutoHide;
- pcli->pfnTrayCalcChanged = cliTrayCalcChanged;
+ pcli->pfnTrayIconInit = cliTrayIconInit;
+ pcli->pfnTrayIconAdd = cliTrayIconAdd;
+ pcli->pfnTrayIconUpdateBase = cliTrayIconUpdateBase;
+
pcli->pfnCluiProtocolStatusChanged = cliCluiProtocolStatusChanged;
pcli->pfnBeginRenameSelection = cliBeginRenameSelection;
diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index db189050d3..c65e6bb9e1 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -729,86 +729,71 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
+
+ CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, db_get_b(NULL, "CList", "NoOfflineBottom", SETTING_NOOFFLINEBOTTOM_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_OFFLINETOROOT, db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONECLK, db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
{
- CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, db_get_b(NULL, "CList", "NoOfflineBottom", SETTING_NOOFFLINEBOTTOM_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_OFFLINETOROOT, db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONECLK, db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- {
- BYTE trayOption = db_get_b(NULL, "CLUI", "XStatusTray", SETTING_TRAYOPTION_DEFAULT);
- CheckDlgButton(hwndDlg, IDC_SHOWXSTATUS, (trayOption & 3) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWNORMAL, (trayOption & 2) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TRANSPARENTOVERLAY, (trayOption & 4) ? BST_CHECKED : BST_UNCHECKED);
+ BYTE trayOption = db_get_b(NULL, "CLUI", "XStatusTray", SETTING_TRAYOPTION_DEFAULT);
+ CheckDlgButton(hwndDlg, IDC_SHOWXSTATUS, (trayOption & 3) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWNORMAL, (trayOption & 2) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TRANSPARENTOVERLAY, (trayOption & 4) ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWNORMAL), IsDlgButtonChecked(hwndDlg, IDC_SHOWXSTATUS));
- EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENTOVERLAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg, IDC_SHOWNORMAL));
- }
- CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_ALWAYSPRIMARY, !db_get_b(NULL, "CList", "AlwaysPrimary", SETTING_ALWAYSPRIMARY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DONTCYCLE, db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CYCLE, db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MULTITRAY, db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, db_get_b(NULL, "CList", "DisableTrayFlash", SETTING_DISABLETRAYFLASH_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOW_AVATARS, db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL, "CList", "AvatarsAnimated", ServiceExists(MS_AV_GETAVATARBITMAP)) == 1 ? BST_CHECKED : BST_UNCHECKED);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSMULTI), FALSE);
- }
- if (IsDlgButtonChecked(hwndDlg, IDC_CYCLE)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSMULTI), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSPRIMARY), FALSE);
- }
- if (IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSPRIMARY), FALSE);
- }
- SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1));
- SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWNORMAL), IsDlgButtonChecked(hwndDlg, IDC_SHOWXSTATUS));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENTOVERLAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg, IDC_SHOWNORMAL));
+ }
+ CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+
+ CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, db_get_b(NULL, "CList", "DisableTrayFlash", SETTING_DISABLETRAYFLASH_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_BLINKTIME), 0); // set buddy
+ SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250));
+ SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "IconFlashTime", SETTING_ICONFLASHTIME_DEFAULT), 0));
+
+ // == Tray icon mode ==
+ // Готовим список аккаунтов.
+ {
+ int AccNum, i, si, item;
+ PROTOACCOUNT **acc;
+
+ ProtoEnumAccounts(&AccNum, &acc);
+
+ for (si = -1, i = 0; i < AccNum; i++)
{
- int i, count, item;
- PROTOACCOUNT **accs;
- DBVARIANT dbv = { DBVT_DELETED };
- db_get(NULL, "CList", "PrimaryStatus", &dbv);
- ProtoEnumAccounts(&count, &accs);
- item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Global"));
- SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, 0);
- for (i = 0; i < count; i++) {
- if (!IsAccountEnabled(accs[i]) || CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
- continue;
+ if (!acc[i]->bIsVirtual && acc[i]->bIsVisible && acc[i]->ppro)
+ {
+ item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)acc[i]->tszAccountName);
+ SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)acc[i]);
- item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)accs[i]->tszAccountName);
- SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)accs[i]);
- if ((dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) && !strcmp(dbv.pszVal, accs[i]->szModuleName))
- SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 0);
+ if (!strcmp(acc[i]->szModuleName, db_get_sa(NULL, "CList", "PrimaryStatus")))
+ si = item;
}
- db_free(&dbv);
}
- if (-1 == (int)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0))
- SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_BLINKTIME), 0); // set buddy
- SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETRANGE, 0, MAKELONG(0x3FFF, 250));
- SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "IconFlashTime", SETTING_ICONFLASHTIME_DEFAULT), 0));
-
- int i = _GetNetVisibleProtoCount();
- if (i < 2) {
+ if (si < 0) si = 0; // Пустой элемент в качестве выбранного оставлять нельзя.
+ SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, si, 0);
+ }
+ // Какой период смены иконок?
+ SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETRANGE, 0, MAKELONG(120, 1));
+ SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT), 0));
+ // Какой режим иконок?
+ switch (db_get_b(NULL, "CList", "TrayIcon", TRAY_ICON_MODE_GLOBAL))
+ {
+ case TRAY_ICON_MODE_GLOBAL:
+ CheckDlgButton(hwndDlg, IDC_ICON_GLOBAL, 1);
+ break;
+ case TRAY_ICON_MODE_ACC:
+ CheckDlgButton(hwndDlg, IDC_ICON_ACC, 1);
EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSPRIMARY), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSPRIMARY), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLE), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_MULTITRAY), FALSE);
- CheckDlgButton(hwndDlg, IDC_DONTCYCLE, TRUE);
- }
+ break;
+ case TRAY_ICON_MODE_CYCLE:
+ CheckDlgButton(hwndDlg, IDC_ICON_CYCLE, 1);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), TRUE);
+ break;
+ case TRAY_ICON_MODE_ALL:
+ CheckDlgButton(hwndDlg, IDC_ICON_ALL, 1);
+ break;
}
+
return TRUE;
case WM_COMMAND:
@@ -816,13 +801,17 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWNORMAL), IsDlgButtonChecked(hwndDlg, IDC_SHOWXSTATUS));
EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENTOVERLAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg, IDC_SHOWNORMAL));
}
- if (LOWORD(wParam) == IDC_DONTCYCLE || LOWORD(wParam) == IDC_CYCLE || LOWORD(wParam) == IDC_MULTITRAY) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), IsDlgButtonChecked(hwndDlg, IDC_CYCLE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_CYCLE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSMULTI), IsDlgButtonChecked(hwndDlg, IDC_MULTITRAY));
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSPRIMARY), IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE));
+
+ if ( LOWORD(wParam) == IDC_ICON_GLOBAL
+ || LOWORD(wParam) == IDC_ICON_ACC
+ || LOWORD(wParam) == IDC_ICON_CYCLE
+ || LOWORD(wParam) == IDC_ICON_ALL)
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PRIMARYSTATUS), IsDlgButtonChecked(hwndDlg, IDC_ICON_ACC));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIME), IsDlgButtonChecked(hwndDlg, IDC_ICON_CYCLE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_ICON_CYCLE));
}
+
if (LOWORD(wParam) == IDC_PRIMARYSTATUS && HIWORD(wParam) != CBN_SELCHANGE)
return 0;
if ((LOWORD(wParam) == IDC_BLINKTIME || LOWORD(wParam) == IDC_CYCLETIME) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
@@ -838,28 +827,31 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L db_set_b(NULL, "CList", "Tray1Click", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ONECLK));
db_set_b(NULL, "CList", "AlwaysStatus", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSTATUS));
- db_set_b(NULL, "CList", "AlwaysMulti", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI));
- db_set_b(NULL, "CList", "AlwaysPrimary", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_ALWAYSPRIMARY));
-
- db_set_w(NULL, "CList", "CycleTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0));
db_set_w(NULL, "CList", "IconFlashTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_BLINKSPIN, UDM_GETPOS, 0, 0));
db_set_b(NULL, "CList", "DisableTrayFlash", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
- if (_GetNetVisibleProtoCount() > 1)
- db_set_b(NULL, "CList", "TrayIcon", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE : (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE : SETTING_TRAYICON_MULTI)));
-
BYTE xOptions = 0;
xOptions = IsDlgButtonChecked(hwndDlg, IDC_SHOWXSTATUS) ? 1 : 0;
xOptions |= (xOptions && IsDlgButtonChecked(hwndDlg, IDC_SHOWNORMAL)) ? 2 : 0;
xOptions |= (xOptions && IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENTOVERLAY)) ? 4 : 0;
db_set_b(NULL, "CLUI", "XStatusTray", xOptions);
- int cursel = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0);
- PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA, cursel, 0);
- if (!pa)
- db_unset(NULL, "CList", "PrimaryStatus");
- else
+ // == Tray icon mode ==
+ // Имя выбранного аккаунта.
+ {
+ PROTOACCOUNT *pa;
+ pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETITEMDATA,
+ SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_GETCURSEL, 0, 0), 0);
db_set_s(NULL, "CList", "PrimaryStatus", pa->szModuleName);
+ }
+ // Период смены иконок.
+ db_set_w(NULL, "CList", "CycleTime", (WORD)SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0));
+ // Режим иконок.
+ db_set_b(NULL, "CList", "TrayIcon",
+ IsDlgButtonChecked(hwndDlg, IDC_ICON_GLOBAL) << 0
+ | IsDlgButtonChecked(hwndDlg, IDC_ICON_ACC) << 1
+ | IsDlgButtonChecked(hwndDlg, IDC_ICON_CYCLE) << 2
+ | IsDlgButtonChecked(hwndDlg, IDC_ICON_ALL) << 3);
pcli->pfnTrayIconIconsChanged();
pcli->pfnLoadContactTree(); /* this won't do job properly since it only really works when changes happen */
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index e74f604772..db4dc3840a 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -96,30 +96,21 @@ int GetStatusOrder(int currentStatus, int newStatus) INT_PTR CListTray_GetGlobalStatus(WPARAM wparam,LPARAM lparam)
{
- int curstatus = 0;
- int i;
- int connectingCount = 0;
- for (i=0; i < pcli->hClcProtoCount; i++)
+ PROTOACCOUNT **acc;
+ int AccNum, i;
+
+ ProtoEnumAccounts(&AccNum, &acc);
+
+ for (i = AccNum; i--;)
{
- if (!pcli->pfnGetProtocolVisibility(pcli->clcProto[i].szProto)) continue;
- if (pcli->clcProto[i].dwStatus >= ID_STATUS_CONNECTING &&
- pcli->clcProto[i].dwStatus < ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)
+ if (!acc[i]->bIsVirtual && acc[i]->bIsVisible && acc[i]->ppro)
{
- connectingCount++;
- if (connectingCount == 1) g_szConnectingProto = pcli->clcProto[i].szProto;
+ if (acc[i]->ppro->m_iStatus >= ID_STATUS_ONLINE)
+ return ID_STATUS_ONLINE;
}
- curstatus = GetStatusOrder(curstatus,pcli->clcProto[i].dwStatus);
}
- if (connectingCount == 0)
- {
- //g_szConnectingProto = NULL;
- g_bMultiConnectionMode = FALSE;
- }
- else if (connectingCount>1)
- g_bMultiConnectionMode = TRUE;
- else
- g_bMultiConnectionMode = FALSE;
- return curstatus?curstatus:ID_STATUS_OFFLINE;
+
+ return ID_STATUS_OFFLINE;
}
////////////////////////////////////////////////////////////
@@ -143,134 +134,6 @@ static VOID CALLBACK RefreshTimerProc(HWND hwnd,UINT message,UINT idEvent,DWORD }
//////// End by FYR /////////
-int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount)
-{
- HWND hwnd = pcli->hwndContactList;
- HICON hIcon;
- int status;
-
- if (netProtoCount > 1) {
- if (averageMode >= ID_STATUS_OFFLINE) {
- if ( db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) {
- if ( db_get_b(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT))
- return pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL,szChangedProto,averageMode),szChangedProto);
-
- if (pcli->trayIcon == NULL || pcli->trayIcon[0].szProto == NULL)
- return pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL,NULL,averageMode),NULL);
-
- pcli->pfnTrayIconDestroy(hwnd);
- pcli->pfnTrayIconInit(hwnd);
- }
- else {
- if ( db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE &&
- db_get_b(NULL, "CList", "AlwaysPrimary", SETTING_ALWAYSPRIMARY_DEFAULT))
- {
- ptrA szProto( db_get_sa(NULL,"CList","PrimaryStatus"));
- return pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL,szProto,averageMode),NULL);
- }
- return pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL,NULL,averageMode),NULL);
- }
- }
- else {
- switch (db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT)) {
- case SETTING_TRAYICON_SINGLE:
- status = CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0);
-
- if (g_StatusBarData.bConnectingIcon && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) {
- // 1 check if multi connecting icon
- CListTray_GetGlobalStatus(0, 0);
- if (g_bMultiConnectionMode) {
- if (_strcmpi(szChangedProto, g_szConnectingProto))
- return -1;
-
- hIcon = (HICON)CLUI_GetConnectingIconService(NULL, 1);
- }
- else hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szChangedProto, 0);
- }
- else {
- ptrA szProto(db_get_sa(NULL, "CList", "PrimaryStatus"));
- hIcon = cliGetIconFromStatusMode(NULL, szProto, (szProto) ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0));
- }
- if (hIcon)
- return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL);
- break;
-
- case SETTING_TRAYICON_CYCLE:
- status = szChangedProto ? CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0) : averageMode;
- if (g_StatusBarData.bConnectingIcon && CListTray_GetGlobalStatus(0, 0) &&
- ((status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) || g_bMultiConnectionMode))
- {
- //stop cycling
- if (pcli->cycleTimerId)
- KillTimer(NULL, pcli->cycleTimerId);
- pcli->cycleTimerId = 0;
-
- // 1 check if multi connecting icon
- if (g_bMultiConnectionMode) {
- if (_strcmpi(szChangedProto, g_szConnectingProto))
- return -1;
- hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)"", 1);
- }
- else hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szChangedProto, 0);
- if (hIcon)
- return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL);
- }
- else {
- pcli->cycleTimerId = CLUI_SafeSetTimer(NULL, 0, db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, pcli->pfnTrayCycleTimerProc);
- return pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL, szChangedProto, status), NULL);
- }
- break;
-
- case SETTING_TRAYICON_MULTI:
- if (!pcli->trayIcon)
- pcli->pfnTrayIconRemove(NULL, NULL);
- else if (db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)) {
- if (!pcli->pfnGetProtocolVisibility(szChangedProto))
- return -1;
-
- status = CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0);
- if (g_StatusBarData.bConnectingIcon && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)
- hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szChangedProto, 0);
- else
- hIcon = cliGetIconFromStatusMode(NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0));
- if (hIcon)
- return pcli->pfnTrayIconSetBaseInfo(hIcon, szChangedProto);
- }
- else if (pcli->pfnGetProtocolVisibility(szChangedProto)) {
- int avg = pcli->pfnGetAverageMode(NULL);
- int i = pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)), szChangedProto);
- if (i < 0) {
- pcli->pfnTrayIconDestroy(hwnd);
- pcli->pfnTrayIconInit(hwnd);
- return -1;
- }
-
- status = CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0);
- if (g_StatusBarData.bConnectingIcon && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) {
- if (hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szChangedProto, 0))
- return pcli->pfnTrayIconSetBaseInfo(hIcon, szChangedProto);
- }
- return i;
- }
- break;
- }
- }
- }
- else if (pcli->pfnGetProtocolVisibility(szChangedProto)) {
- status = CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0);
-
- if (g_StatusBarData.bConnectingIcon && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) {
- if (hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szChangedProto, 0))
- return pcli->pfnTrayIconSetBaseInfo(hIcon, NULL);
- }
- else if (status >= ID_STATUS_OFFLINE && status <= ID_STATUS_IDLE) {
- ptrA szProto(db_get_sa(NULL, "CList", "PrimaryStatus"));
- return pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL, szProto, status), NULL);
- }
- }
-
- return -1;
-}
static UINT_PTR autoHideTimerId;
@@ -339,6 +202,10 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) }
return FALSE; //to avoid autohideTimer in core
+ case TIM_CREATE:
+ pcli->pfnTrayIconInit(msg->hwnd);
+ return TRUE;
+
case TIM_CALLBACK:
if ((GetAsyncKeyState(VK_CONTROL) & 0x8000) && msg->lParam == WM_LBUTTONDOWN && !db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT)) {
POINT pt;
@@ -568,3 +435,206 @@ void UninitTrayMenu() CallService(MO_REMOVEMENUOBJECT, (WPARAM)hTrayMenuObject, 0);
hTrayMenuObject = NULL;
}
+
+
+VOID CALLBACK cliTrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD)
+{
+ PROTOACCOUNT **acc;
+ int AccNum;
+
+ if (!pcli->trayIconCount)
+ return;
+
+ ProtoEnumAccounts(&AccNum, &acc);
+
+ // Нужно найти подходящий аккаунт, чтобы показать его значок.
+ do
+ pcli->cycleStep = (pcli->cycleStep + 1) % AccNum;
+ while (acc[pcli->cycleStep]->bIsVirtual || !acc[pcli->cycleStep]->bIsVisible);
+
+ cliTrayIconUpdateBase(acc[pcli->cycleStep]->szModuleName);
+}
+
+int cliTrayIconInit(HWND hwnd)
+{
+ PROTOACCOUNT **acc;
+ int AccNum, i;
+ BYTE Mode;
+
+ // Нулевое количество иконок означает, что инициализация не была проведена.
+ if (pcli->trayIconCount != 0)
+ return 0;
+
+ if (pcli->cycleTimerId)
+ {
+ KillTimer(NULL, pcli->cycleTimerId);
+ pcli->cycleTimerId = 0;
+ }
+
+ // Какой режим?
+ Mode = db_get_b(NULL, "CList", "TrayIcon", TRAY_ICON_MODE_GLOBAL);
+
+ ProtoEnumAccounts(&AccNum, &acc);
+
+ // Узнаём количество иконок.
+ switch (Mode)
+ {
+ case TRAY_ICON_MODE_GLOBAL:
+ case TRAY_ICON_MODE_ACC:
+ case TRAY_ICON_MODE_CYCLE:
+ pcli->trayIconCount = 1;
+ break;
+ case TRAY_ICON_MODE_ALL:
+ // Считаем количество будущих иконок в трее.
+ // Виртуальные и скрытые аккаунты не нужно показывать.
+ for (i = AccNum, pcli->trayIconCount = 0; i--; )
+ {
+ if (!acc[i]->bIsVirtual && acc[i]->bIsVisible && acc[i]->ppro)
+ pcli->trayIconCount++;
+ }
+ break;
+ }
+
+ pcli->trayIcon = (trayIconInfo_t*)mir_calloc(sizeof(trayIconInfo_t) * pcli->trayIconCount);
+
+ // Добавляем иконки.
+ switch (Mode)
+ {
+ case TRAY_ICON_MODE_GLOBAL:
+ pcli->pfnTrayIconAdd(hwnd, NULL, NULL, CListTray_GetGlobalStatus(0, 0));
+ break;
+ case TRAY_ICON_MODE_ACC:
+ {
+ PROTOACCOUNT *pa = ProtoGetAccount(db_get_sa(NULL, "CList", "PrimaryStatus"));
+ // Если злоумышленник удалил ключ, то устанавливаем глобальную иконку.
+ if (!pa || !pa->ppro)
+ {
+ pcli->pfnTrayIconAdd(hwnd, NULL, NULL, CListTray_GetGlobalStatus(0, 0));
+ return 0;
+ }
+ pcli->pfnTrayIconAdd(hwnd, pa->szModuleName, NULL, pa->ppro->m_iStatus);
+ }
+ break;
+ case TRAY_ICON_MODE_CYCLE:
+ pcli->pfnTrayIconAdd(hwnd, NULL, NULL, CListTray_GetGlobalStatus(0, 0));
+ pcli->cycleStep = 0;
+ cliTrayCycleTimerProc(0, 0, 0, 0); // Это затем, чтобы сразу обновить иконку.
+ pcli->cycleTimerId = SetTimer(NULL, 0, db_get_w(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cliTrayCycleTimerProc);
+ break;
+ case TRAY_ICON_MODE_ALL:
+ for (i = AccNum; i--; )
+ {
+ if (!acc[i]->bIsVirtual && acc[i]->bIsVisible && acc[i]->ppro)
+ pcli->pfnTrayIconAdd(hwnd, acc[i]->szModuleName, NULL, acc[i]->ppro->m_iStatus);
+ }
+ break;
+ }
+
+ return 0;
+}
+
+int cliTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int status)
+{
+ int i;
+ NOTIFYICONDATA nid = { sizeof(NOTIFYICONDATA) };
+
+ // Поиск первой пустой записи во внутреннем списке.
+ for (i = 0; i < pcli->trayIconCount; i++)
+ if (pcli->trayIcon[i].id == 0)
+ break;
+
+ pcli->trayIcon[i].id = TRAYICON_ID_BASE + i;
+ pcli->trayIcon[i].szProto = (char*)szProto;
+ pcli->trayIcon[i].hBaseIcon = pcli->pfnGetIconFromStatusMode(NULL, szIconProto ? szIconProto : pcli->trayIcon[i].szProto, status);
+
+ pcli->pfnTrayIconMakeTooltip(NULL, pcli->trayIcon[i].szProto);
+ pcli->trayIcon[i].ptszToolTip = mir_tstrdup(pcli->szTip);
+ lstrcpyn(nid.szTip, pcli->szTip, SIZEOF(nid.szTip));
+
+ nid.hWnd = hwnd;
+ nid.uID = pcli->trayIcon[i].id;
+ nid.uCallbackMessage = TIM_CALLBACK;
+ nid.hIcon = pcli->trayIcon[i].hBaseIcon;
+
+ nid.uFlags = NIF_ICON
+ | NIF_MESSAGE
+ | (!ServiceExists("mToolTip/ShowTip") || !db_get_b(NULL, "Tipper", "TrayTip", 0) ? NIF_TIP : 0)
+ | (pcli->shellVersion >= 5 ? NIF_INFO : 0);
+ // INFO Если Tipper отсутствует или не хочет заниматься треевыми тултипами,
+ // то тогда тултипы показывает система.
+
+ Shell_NotifyIcon(NIM_ADD, &nid);
+
+ return 0;
+}
+
+void cliTrayIconUpdateBase(const char *szChangedProto)
+{
+ int i;
+ PROTOACCOUNT *pa;
+ NOTIFYICONDATA nid = { sizeof(NOTIFYICONDATA) };
+ HICON hIcon;
+
+ if (!szChangedProto)
+ return;
+
+ if (!pcli->trayIconCount)
+ return;
+
+ pa = ProtoGetAccount(szChangedProto);
+ if (!pa->bIsVisible || pa->bIsVirtual)
+ return;
+
+ i = 0;
+ switch (db_get_b(NULL, "CList", "TrayIcon", TRAY_ICON_MODE_GLOBAL))
+ {
+ case TRAY_ICON_MODE_GLOBAL:
+ hIcon = pcli->pfnGetIconFromStatusMode(NULL, NULL, CListTray_GetGlobalStatus(0, 0));
+ pcli->pfnTrayIconMakeTooltip(NULL, NULL);
+ break;
+ case TRAY_ICON_MODE_ACC:
+ // Если изменяется не тот аккаунт, что выбран в настройках, то ничего не делаем.
+ if (strcmp(pcli->trayIcon[i].szProto, szChangedProto))
+ return;
+ if (g_StatusBarData.bConnectingIcon && pa->ppro->m_iStatus >= ID_STATUS_CONNECTING && pa->ppro->m_iStatus <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)
+ hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szChangedProto, 0);
+ else
+ hIcon = pcli->pfnGetIconFromStatusMode(NULL, szChangedProto, pa->ppro->m_iStatus);
+ pcli->pfnTrayIconMakeTooltip(NULL, pcli->trayIcon[i].szProto);
+ break;
+ case TRAY_ICON_MODE_CYCLE:
+ return;
+ hIcon = pcli->pfnGetIconFromStatusMode(NULL, szChangedProto, pa->ppro->m_iStatus);
+ pcli->pfnTrayIconMakeTooltip(NULL, NULL);
+ break;
+ case TRAY_ICON_MODE_ALL:
+ // Какой индекс у аккаунта, который будем апдейтить?
+ for ( ; i < pcli->trayIconCount; i++)
+ if (!strcmp(pcli->trayIcon[i].szProto, szChangedProto))
+ break;
+
+ if (g_StatusBarData.bConnectingIcon && pa->ppro->m_iStatus >= ID_STATUS_CONNECTING && pa->ppro->m_iStatus <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)
+ hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szChangedProto, 0);
+ else
+ hIcon = pcli->pfnGetIconFromStatusMode(NULL, szChangedProto, pa->ppro->m_iStatus);
+ pcli->pfnTrayIconMakeTooltip(NULL, pcli->trayIcon[i].szProto);
+ break;
+ }
+
+ DestroyIcon(pcli->trayIcon[i].hBaseIcon);
+ pcli->trayIcon[i].hBaseIcon = hIcon;
+
+ pcli->trayIcon[i].ptszToolTip = mir_tstrdup(pcli->szTip);
+ lstrcpyn(nid.szTip, pcli->szTip, SIZEOF(nid.szTip));
+
+ nid.hWnd = pcli->hwndContactList;
+ nid.uID = pcli->trayIcon[i].id;
+ nid.hIcon = pcli->trayIcon[i].hBaseIcon;
+ nid.uFlags = NIF_ICON
+ | (!ServiceExists("mToolTip/ShowTip") || !db_get_b(NULL, "Tipper", "TrayTip", 0) ? NIF_TIP : 0);
+ // Если Tipper отсутствует или не хочет заниматься треевыми тултипами,
+ // то тогда тултипы показывает система.
+
+ Shell_NotifyIcon(NIM_MODIFY, &nid);
+}
+
diff --git a/plugins/Clist_modern/src/resource.h b/plugins/Clist_modern/src/resource.h index 61e5f7b5cb..1185f63f76 100644 --- a/plugins/Clist_modern/src/resource.h +++ b/plugins/Clist_modern/src/resource.h @@ -187,19 +187,19 @@ #define IDC_GAMMACORRECT 1302
#define IDC_TILEVROWH 1302
#define IDC_HIDEOFFLINEOPTS 1308
-#define IDC_DONTCYCLE 1315
+//#define IDC_DONTCYCLE 1315
#define IDC_PRIMARYSTATUS 1316
-#define IDC_CYCLE 1317
+//#define IDC_CYCLE 1317
#define IDC_CYCLETIME 1318
#define IDC_CYCLETIMESPIN 1319
#define IDC_HIDETIMESPIN 1320
-#define IDC_MULTITRAY 1321
+//#define IDC_MULTITRAY 1321
#define IDC_FRAMESSPIN 1321
-#define IDC_ALWAYSMULTI 1322
+//#define IDC_ALWAYSMULTI 1322
#define IDC_CAPTIONSSPIN 1322
#define IDC_SHOWICON 1323
#define IDC_HIDETIMESPIN2 1323
-#define IDC_ALWAYSPRIMARY 1323
+//#define IDC_ALWAYSPRIMARY 1323
#define IDC_SHOWPROTO 1324
#define IDC_HIDETIMESPIN3 1324
#define IDC_SHOWSTATUS 1325
@@ -517,6 +517,11 @@ #define IDC_FRAME_META 40054
#define IDC_FRAME_META2 40055
+#define IDC_ICON_GLOBAL 40056
+#define IDC_ICON_ACC 40057
+#define IDC_ICON_CYCLE 40058
+#define IDC_ICON_ALL 40059
+
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
|