summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-22 20:38:56 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-22 20:38:56 +0000
commit88790eed4ffd9ca555c8f9b73cb014a93b57a34f (patch)
treeb3e5bfe096005a9cac4bc14fdfbe5f6f5acad98a /plugins/Clist_modern/src
parent9ecc2aa50e2183e2c4a11861ca6dede7d2151139 (diff)
Menu_ModifyItem unbound from CLISTMENUITEM structure
git-svn-id: http://svn.miranda-ng.org/main/trunk@14334 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src')
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp129
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp26
-rw-r--r--plugins/Clist_modern/src/modern_clistmenus.cpp35
3 files changed, 69 insertions, 121 deletions
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
index 2d1b9bf74a..df9afbc0ab 100644
--- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
@@ -885,14 +885,6 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp
return 0;
}
-static int ModifyMItem(WPARAM wParam, LPARAM lParam)
-{
- if ((int)wParam == -1) return 0; // FIXME
-
- return CallService(MS_CLIST_MODIFYMENUITEM, wParam, lParam);
-};
-
-
static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM)
{
/* HOOK */
@@ -900,45 +892,26 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM)
if (_fCluiFramesModuleNotStarted) return -1;
int pos = id2pos(wParam);
if (pos >= 0 && pos < g_nFramesCount) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR;
- if (g_pfwFrames[pos].visible) mi.flags |= CMIF_CHECKED;
- mi.ptszName = g_pfwFrames[pos].TitleBar.tbname ? g_pfwFrames[pos].TitleBar.tbname : g_pfwFrames[pos].name;
- ModifyMItem((WPARAM)_hmiVisible, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].Locked) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiLock, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiTBVisible, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].floating) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiFloating, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_CluiData.fLayered) mi.flags |= CMIF_GRAYED;
- else if ((g_pfwFrames[pos].UseBorder)) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiBorder, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].align&alTop) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiAlignTop, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].align&alClient) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiAlignClient, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].align&alBottom) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiAlignBottom, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].collapsed) mi.flags |= CMIF_CHECKED;
- if ((!g_pfwFrames[pos].visible) || (g_pfwFrames[pos].Locked) || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED;
- ModifyMItem((WPARAM)_hmiColl, (LPARAM)&mi);
+ FRAMEWND &p = g_pfwFrames[pos];
+
+ Menu_ModifyItem(_hmiVisible, p.TitleBar.tbname ? p.TitleBar.tbname : p.name, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.visible) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(_hmiLock, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.Locked) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(_hmiTBVisible, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.TitleBar.ShowTitleBar) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(_hmiFloating, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.floating) ? CMIF_CHECKED : 0);
+
+ int flags = CMIF_CHILDPOPUP;
+ if (g_CluiData.fLayered) flags += CMIF_GRAYED;
+ else if ((p.UseBorder)) flags += CMIF_CHECKED;
+ Menu_ModifyItem(_hmiBorder, NULL, INVALID_HANDLE_VALUE, flags);
+
+ Menu_ModifyItem(_hmiAlignTop, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.align&alTop) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(_hmiAlignClient, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.align&alClient) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(_hmiAlignBottom, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.align&alBottom) ? CMIF_CHECKED : 0);
+
+ flags = CMIF_CHILDPOPUP;
+ if (p.collapsed) flags += CMIF_CHECKED;
+ if ((!p.visible) || (p.Locked) || (pos == CLUIFramesGetalClientFrame())) flags += CMIF_GRAYED;
+ Menu_ModifyItem(_hmiColl, NULL, INVALID_HANDLE_VALUE, flags);
}
return 0;
}
@@ -946,51 +919,29 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM)
static int CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM)
{
//hiword(wParam) = frameid,loword(wParam) = flag
- if (_fCluiFramesModuleNotStarted) return -1;
+ if (_fCluiFramesModuleNotStarted)
+ return -1;
int pos = id2pos(wParam);
-
if (pos >= 0 && pos < g_nFramesCount) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR;
- if (g_pfwFrames[pos].visible) mi.flags |= CMIF_CHECKED;
- mi.ptszName = g_pfwFrames[pos].TitleBar.tbname ? g_pfwFrames[pos].TitleBar.tbname : g_pfwFrames[pos].name;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIVisible, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].Locked) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MILock, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MITBVisible, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].floating) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIFloating, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
-
- if (g_CluiData.fLayered) mi.flags |= CMIF_GRAYED;
- else if ((g_pfwFrames[pos].UseBorder)) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIBorder, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | ((g_pfwFrames[pos].align&alClient) ? CMIF_GRAYED : 0);
- if (g_pfwFrames[pos].align&alTop) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIAlignTop, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].align&alClient) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIAlignClient, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | ((g_pfwFrames[pos].align&alClient) ? CMIF_GRAYED : 0);
- if (g_pfwFrames[pos].align&alBottom) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIAlignBottom, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].collapsed) mi.flags |= CMIF_CHECKED;
- if ((!g_pfwFrames[pos].visible) || g_pfwFrames[pos].Locked || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIColl, &mi);
+ FRAMEWND &p = g_pfwFrames[pos];
+
+ Menu_ModifyItem(p.MenuHandles.MIVisible, p.TitleBar.tbname ? p.TitleBar.tbname : p.name, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.visible) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(p.MenuHandles.MILock, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.Locked) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(p.MenuHandles.MITBVisible, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.TitleBar.ShowTitleBar) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(p.MenuHandles.MIFloating, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.floating) ? CMIF_CHECKED : 0);
+
+ int flags = CMIF_CHILDPOPUP;
+ if (g_CluiData.fLayered) flags += CMIF_GRAYED;
+ else if (p.UseBorder) flags += CMIF_CHECKED;
+ Menu_ModifyItem(p.MenuHandles.MIBorder, NULL, INVALID_HANDLE_VALUE, flags);
+
+ Menu_ModifyItem(p.MenuHandles.MIAlignTop, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + ((p.align & alClient) ? CMIF_GRAYED : 0) + (p.align & alTop) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(p.MenuHandles.MIAlignClient, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.align & alClient) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(p.MenuHandles.MIAlignBottom, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + ((p.align & alClient) ? CMIF_GRAYED : 0) + (p.align & alBottom) ? CMIF_CHECKED : 0);
+
+ flags = CMIF_CHILDPOPUP + (p.collapsed) ? CMIF_CHECKED : 0 + ((!p.visible) || p.Locked || (pos == CLUIFramesGetalClientFrame())) ? CMIF_GRAYED : 0;
+ Menu_ModifyItem(p.MenuHandles.MIColl, NULL, INVALID_HANDLE_VALUE, flags);
}
return 0;
diff --git a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp
index 276448b477..fd4d0f60db 100644
--- a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp
+++ b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp
@@ -192,18 +192,17 @@ static int OnBuildGroupMenu(WPARAM, LPARAM)
{
if (MirandaExiting()) return 0;
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideOfflineUsersMenuItem, &mi);
+ int flags = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CMIF_CHECKED : 0;
+ Menu_ModifyItem(hHideOfflineUsersMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
- mi.flags = CMIM_FLAGS | (SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideOfflineUsersOutHereMenuItem, &mi);
+ flags = SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) ? CMIF_CHECKED : 0;
+ Menu_ModifyItem(hHideOfflineUsersOutHereMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
- mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE)&CLS_HIDEEMPTYGROUPS ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideEmptyGroupsMenuItem, &mi);
+ flags = GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS ? CMIF_CHECKED : 0;
+ Menu_ModifyItem(hHideEmptyGroupsMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
- mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE)&CLS_USEGROUPS ? 0 : CMIF_CHECKED);
- Menu_ModifyItem(hDisableGroupsMenuItem, &mi);
+ flags = GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS ? 0 : CMIF_CHECKED;
+ Menu_ModifyItem(hDisableGroupsMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
return 0;
}
@@ -348,12 +347,11 @@ static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM)
if (gray1 && gray2) gray1 = FALSE; //should not be cause CLCItems_IsShowOfflineGroup return false if group->hideOffline
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | ((group->hideOffline && !gray1) ? CMIF_CHECKED : 0) | (gray1 ? CMIF_GRAYED : 0);
- Menu_ModifyItem(hHideOfflineUsersHereMenuItem, &mi);
+ int flags = ((group->hideOffline && !gray1) ? CMIF_CHECKED : 0) | (gray1 ? CMIF_GRAYED : 0);
+ Menu_ModifyItem(hHideOfflineUsersHereMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
- mi.flags = CMIM_FLAGS | ((showOfflineinGroup && !gray2) ? CMIF_CHECKED : 0) | (gray2 ? CMIF_GRAYED : 0);
- Menu_ModifyItem(hShowOfflineUsersHereMenuItem, &mi);
+ flags = ((showOfflineinGroup && !gray2) ? CMIF_CHECKED : 0) | (gray2 ? CMIF_GRAYED : 0);
+ Menu_ModifyItem(hShowOfflineUsersHereMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
return 0;
}
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp
index f9d532d532..809bb75508 100644
--- a/plugins/Clist_modern/src/modern_clistmenus.cpp
+++ b/plugins/Clist_modern/src/modern_clistmenus.cpp
@@ -117,8 +117,7 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM)
if (!hFavoriteContactMenu)
hFavoriteContactMenu = Menu_AddContactMenuItem(&mi);
else {
- mi.flags |= CMIM_FLAGS | CMIM_NAME;
- Menu_ModifyItem(hFavoriteContactMenu, &mi);
+ Menu_ModifyItem(hFavoriteContactMenu, mi.ptszName);
bModifyMenu = TRUE;
}
@@ -136,29 +135,29 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM)
int i;
for (i = 0; i < _countof(rates); i++) {
- mi.icolibItem = iconList[i].hIcolib;
- mi.ptszName = rates[i];
mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR | ((bContactRate == i) ? CMIF_CHECKED : 0);
- mi.pszService = CLUI_FAVSETRATE;
- mi.popupPosition = i;
- if (bModifyMenu && hFavoriteContactMenuItems[i]) {
- mi.flags |= CMIM_FLAGS | CMIM_ICON;
- Menu_ModifyItem(hFavoriteContactMenuItems[i], &mi);
+ if (bModifyMenu && hFavoriteContactMenuItems[i])
+ Menu_ModifyItem(hFavoriteContactMenuItems[i], NULL, iconList[i].hIcolib, mi.flags);
+ else {
+ mi.icolibItem = iconList[i].hIcolib;
+ mi.ptszName = rates[i];
+ mi.pszService = CLUI_FAVSETRATE;
+ mi.popupPosition = i;
+ hFavoriteContactMenuItems[i] = Menu_AddContactMenuItem(&mi);
}
- else hFavoriteContactMenuItems[i] = Menu_AddContactMenuItem(&mi);
}
mi.hIcon = NULL;
- mi.ptszName = LPGENT("Show even if offline");
mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR | (db_get_b(hContact, "CList", "noOffline", 0) ? CMIF_CHECKED : 0);
- mi.pszService = CLUI_FAVTOGGLESHOWOFFLINE;
- mi.popupPosition = i + 100000000;
- mi.position = -100000000;
- if (bModifyMenu && hShowIfOflineItem) {
- mi.flags |= CMIM_FLAGS | CMIM_ICON;
- Menu_ModifyItem(hShowIfOflineItem, &mi);
+ if (bModifyMenu && hShowIfOflineItem)
+ Menu_ModifyItem(hShowIfOflineItem, NULL, INVALID_HANDLE_VALUE, mi.flags);
+ else {
+ mi.pszService = CLUI_FAVTOGGLESHOWOFFLINE;
+ mi.popupPosition = i + 100000000;
+ mi.position = -100000000;
+ mi.ptszName = LPGENT("Show even if offline");
+ hShowIfOflineItem = Menu_AddContactMenuItem(&mi);
}
- else hShowIfOflineItem = Menu_AddContactMenuItem(&mi);
return 0;
}