diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-03 18:51:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-03 18:51:25 +0000 |
commit | 31582b9e959b65cb9e29c4197a42e1a7e9ca804e (patch) | |
tree | 23ed81355fc68a8b9812be0c30f20467b4c52cf4 /plugins/Clist_mw | |
parent | c8a4c6574f3e0894d97c67cdd45e311a42eda59f (diff) |
tray icons code standardization
git-svn-id: http://svn.miranda-ng.org/main/trunk@5569 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_mw')
-rw-r--r-- | plugins/Clist_mw/src/clisttray.cpp | 125 | ||||
-rw-r--r-- | plugins/Clist_mw/src/contact.cpp | 8 |
2 files changed, 69 insertions, 64 deletions
diff --git a/plugins/Clist_mw/src/clisttray.cpp b/plugins/Clist_mw/src/clisttray.cpp index af0f210e14..2aeb9e70d4 100644 --- a/plugins/Clist_mw/src/clisttray.cpp +++ b/plugins/Clist_mw/src/clisttray.cpp @@ -36,12 +36,13 @@ INT_PTR TrayIconProcessMessage(WPARAM wParam,LPARAM lParam) case WM_DRAWITEM:
return CallService(MS_CLIST_MENUDRAWITEM,msg->wParam,msg->lParam);
break;
+
case WM_MEASUREITEM:
return CallService(MS_CLIST_MENUMEASUREITEM,msg->wParam,msg->lParam);
break;
+
case TIM_CALLBACK:
- if (msg->lParam == WM_RBUTTONUP)
- {
+ if (msg->lParam == WM_RBUTTONUP) {
POINT pt;
HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDTRAY,0,0);
@@ -49,7 +50,7 @@ INT_PTR TrayIconProcessMessage(WPARAM wParam,LPARAM lParam) SetFocus(msg->hwnd);
GetCursorPos(&pt);
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN, pt.x, pt.y, 0, msg->hwnd, NULL);
- DestroyTrayMenu(hMenu);
+ DestroyTrayMenu(hMenu);
}
else break;
@@ -69,10 +70,12 @@ HANDLE hTrayStatusMenuItemProxy; HANDLE hPreBuildTrayMenuEvent;
//traymenu exec param(ownerdata)
-typedef struct{
-char *szServiceName;
-INT_PTR Param1;
-}TrayMenuExecParam,*lpTrayMenuExecParam;
+typedef struct
+{
+ char *szServiceName;
+ INT_PTR Param1;
+}
+ TrayMenuExecParam,*lpTrayMenuExecParam;
/*
wparam = handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM
@@ -159,7 +162,8 @@ INT_PTR TrayMenuonAddService(WPARAM wParam,LPARAM lParam) //called with:
//wparam - ownerdata
//lparam - lparam from winproc
-INT_PTR TrayMenuExecService(WPARAM wParam,LPARAM lParam) {
+INT_PTR TrayMenuExecService(WPARAM wParam,LPARAM lParam)
+{
if (wParam != 0)
{
lpTrayMenuExecParam mmep = (lpTrayMenuExecParam)wParam;
@@ -223,56 +227,55 @@ void InitTrayMenus(void) op.Value = (INT_PTR)"CLISTMENUSTRAY/TrayMenuonAddService";
CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
- {
- //add exit command to menu
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.position = 900000;
- mi.pszService = "CloseAction";
- mi.pszName = LPGEN("E&xit");
- AddTrayMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 100000;
- mi.pszService = MS_CLIST_SHOWHIDE;
- mi.pszName = LPGEN("&Hide/Show");
- hHideShowMainMenuItem = (HANDLE)AddTrayMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 200000;
- mi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FINDUSER));
- mi.pszService = "FindAdd/FindAddCommand";
- mi.pszName = LPGEN("&Find/Add Contacts...");
- AddTrayMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 300000;
- mi.pszService = "";
- mi.pszName = LPGEN("&Main Menu");
- hTrayMainMenuItemProxy = (HANDLE)AddTrayMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 300100;
- mi.pszService = "";
- mi.pszName = LPGEN("&Status");
- hTrayStatusMenuItemProxy = (HANDLE)AddTrayMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 400000;
- mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_OPTIONS));
- mi.pszService = "Options/OptionsCommand";
- mi.pszName = LPGEN("&Options...");
- AddTrayMenuItem(0,(LPARAM)&mi);
-
- memset(&mi,0,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.position = 500000;
- mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_CLIENTMIRANDA));
- mi.pszService = "Help/AboutCommand";
- mi.pszName = LPGEN("&About");
- AddTrayMenuItem(0,(LPARAM)&mi);
-} }
+ //add exit command to menu
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.position = 900000;
+ mi.pszService = "CloseAction";
+ mi.pszName = LPGEN("E&xit");
+ AddTrayMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 100000;
+ mi.pszService = MS_CLIST_SHOWHIDE;
+ mi.pszName = LPGEN("&Hide/Show");
+ hHideShowMainMenuItem = (HANDLE)AddTrayMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 200000;
+ mi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FINDUSER));
+ mi.pszService = "FindAdd/FindAddCommand";
+ mi.pszName = LPGEN("&Find/Add Contacts...");
+ AddTrayMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 300000;
+ mi.pszService = "";
+ mi.pszName = LPGEN("&Main Menu");
+ hTrayMainMenuItemProxy = (HANDLE)AddTrayMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 300100;
+ mi.pszService = "";
+ mi.pszName = LPGEN("&Status");
+ hTrayStatusMenuItemProxy = (HANDLE)AddTrayMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 400000;
+ mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_OPTIONS));
+ mi.pszService = "Options/OptionsCommand";
+ mi.pszName = LPGEN("&Options...");
+ AddTrayMenuItem(0,(LPARAM)&mi);
+
+ memset(&mi,0,sizeof(mi));
+ mi.cbSize = sizeof(mi);
+ mi.position = 500000;
+ mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_CLIENTMIRANDA));
+ mi.pszService = "Help/AboutCommand";
+ mi.pszName = LPGEN("&About");
+ AddTrayMenuItem(0,(LPARAM)&mi);
+}
diff --git a/plugins/Clist_mw/src/contact.cpp b/plugins/Clist_mw/src/contact.cpp index 12a82ba2d5..9a818226e1 100644 --- a/plugins/Clist_mw/src/contact.cpp +++ b/plugins/Clist_mw/src/contact.cpp @@ -77,9 +77,11 @@ void LoadContactTree(void) {
int tick = GetTickCount();
CallService(MS_CLUI_LISTBEGINREBUILD,0,0);
- for (int i=1;; i++)
- if ((char*)CallService(MS_CLIST_GROUPGETNAME2, i, 0) != NULL)
- CallService(MS_CLUI_GROUPADDED, i, 0);
+ for (int i=1;; i++) {
+ if ((char*)CallService(MS_CLIST_GROUPGETNAME2, i, 0) == NULL)
+ break;
+ CallService(MS_CLUI_GROUPADDED, i, 0);
+ }
int hideOffline = db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT);
|