summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin10/lib/mir_app.libbin60474 -> 60914 bytes
-rw-r--r--bin10/lib/mir_app64.libbin58850 -> 59250 bytes
-rw-r--r--bin12/lib/mir_app.libbin60474 -> 60914 bytes
-rw-r--r--bin12/lib/mir_app64.libbin58850 -> 59250 bytes
-rw-r--r--include/m_clist.h10
-rw-r--r--plugins/Alarms/src/frame.cpp2
-rw-r--r--plugins/AvatarHistory/src/AvatarDlg.cpp4
-rw-r--r--plugins/AvatarHistory/src/stdafx.h4
-rw-r--r--plugins/AvatarHistory/src/utils.cpp10
-rw-r--r--plugins/Boltun/src/boltun.cpp4
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp233
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/cluiframes.h20
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp8
-rw-r--r--plugins/Clist_modern/src/hdr/modern_commonprototypes.h2
-rw-r--r--plugins/Clist_modern/src/modern_skinengine.cpp12
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp200
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.h20
-rw-r--r--plugins/HistoryStats/src/main.cpp10
-rw-r--r--plugins/ListeningTo/src/listeningto.cpp8
-rw-r--r--plugins/LotusNotify/src/LotusNotify.cpp34
-rw-r--r--plugins/Quotes/src/QuoteInfoDlg.cpp24
-rw-r--r--protocols/FacebookRM/src/proto.h2
-rw-r--r--protocols/FacebookRM/src/theme.cpp9
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp6
-rw-r--r--protocols/IRCG/src/options.cpp2
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp25
-rw-r--r--protocols/Tlen/src/tlen_thread.cpp4
-rw-r--r--protocols/WhatsApp/src/proto.h2
-rw-r--r--protocols/WhatsApp/src/theme.cpp7
-rw-r--r--src/mir_app/src/clistmenus.cpp14
-rw-r--r--src/mir_app/src/genmenu.cpp34
-rw-r--r--src/mir_app/src/mir_app.def2
-rw-r--r--src/mir_app/src/mir_app64.def2
33 files changed, 326 insertions, 388 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib
index 5423cf29ea..69e2c28ccd 100644
--- a/bin10/lib/mir_app.lib
+++ b/bin10/lib/mir_app.lib
Binary files differ
diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib
index c7fee9b18e..cd9a03738f 100644
--- a/bin10/lib/mir_app64.lib
+++ b/bin10/lib/mir_app64.lib
Binary files differ
diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib
index 5423cf29ea..69e2c28ccd 100644
--- a/bin12/lib/mir_app.lib
+++ b/bin12/lib/mir_app.lib
Binary files differ
diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib
index c7fee9b18e..cd9a03738f 100644
--- a/bin12/lib/mir_app64.lib
+++ b/bin12/lib/mir_app64.lib
Binary files differ
diff --git a/include/m_clist.h b/include/m_clist.h
index f2d104a6bd..9362080589 100644
--- a/include/m_clist.h
+++ b/include/m_clist.h
@@ -179,6 +179,16 @@ EXTERN_C MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszN
EXTERN_C MIR_APP_DLL(void) Menu_ShowItem(HGENMENU hMenuItem, bool bShow);
+/////////////////////////////////////////////////////////////////////////////////////////
+// enables or disables a menu item
+
+EXTERN_C MIR_APP_DLL(void) Menu_EnableItem(HGENMENU hMenuItem, bool bEnable);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// turns a menu item's check on & off
+
+EXTERN_C MIR_APP_DLL(void) Menu_SetChecked(HGENMENU hMenuItem, bool bSet);
+
//the context menu for a contact is about to be built v0.1.0.1+
//wParam = (MCONTACT)hContact
//lParam = 0
diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp
index f29af0713d..0f62257afa 100644
--- a/plugins/Alarms/src/frame.cpp
+++ b/plugins/Alarms/src/frame.cpp
@@ -450,7 +450,7 @@ void FixMainMenu()
{
if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
if (options.hide_with_clist || options.auto_showhide)
- Menu_ModifyItem(hMenuShowReminders, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
+ Menu_EnableItem(hMenuShowReminders, false);
else
Menu_ModifyItem(hMenuShowReminders,
ReminderFrameVisible() ? LPGENT("Hide reminders") : LPGENT("Show reminders"), INVALID_HANDLE_VALUE, 0);
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp
index cadd9fcc14..da41894e42 100644
--- a/plugins/AvatarHistory/src/AvatarDlg.cpp
+++ b/plugins/AvatarHistory/src/AvatarDlg.cpp
@@ -25,7 +25,7 @@ void __cdecl AvatarDialogThread(void *param);
static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
int ShowSaveDialog(HWND hwnd, TCHAR* fn,MCONTACT hContact = NULL);
-BOOL ProtocolEnabled(const char *proto);
+bool ProtocolEnabled(const char *proto);
int FillAvatarListFromDB(HWND list, MCONTACT hContact);
int FillAvatarListFromFolder(HWND list, MCONTACT hContact);
int FillAvatarListFromFiles(HWND list, MCONTACT hContact);
@@ -506,7 +506,7 @@ int CleanupAvatarPic(HWND hwnd)
int PreBuildContactMenu(WPARAM wParam, LPARAM)
{
char *proto = GetContactProto(wParam);
- Menu_ShowItem(hMenu, ProtocolEnabled(proto));
+ Menu_ShowItem(hMenu, 0 != ProtocolEnabled(proto));
return 0;
}
diff --git a/plugins/AvatarHistory/src/stdafx.h b/plugins/AvatarHistory/src/stdafx.h
index 27a584f5a1..4564dd5d73 100644
--- a/plugins/AvatarHistory/src/stdafx.h
+++ b/plugins/AvatarHistory/src/stdafx.h
@@ -70,8 +70,8 @@ int OpenAvatarDialog(MCONTACT hContact, char* fn);
// utils
TCHAR* GetCachedAvatar(char *proto, TCHAR *hash);
-BOOL ProtocolEnabled(const char *proto);
-BOOL ContactEnabled(MCONTACT hContact, char *setting, int def);
+bool ProtocolEnabled(const char *proto);
+bool ContactEnabled(MCONTACT hContact, char *setting, int def);
BOOL CopyImageFile(TCHAR *old_file, TCHAR *new_file);
void ConvertToFilename(TCHAR *str, size_t size);
diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp
index 88b00b3dfb..9344544a1e 100644
--- a/plugins/AvatarHistory/src/utils.cpp
+++ b/plugins/AvatarHistory/src/utils.cpp
@@ -24,24 +24,24 @@ Avatar History Plugin
#include "stdafx.h"
-BOOL ProtocolEnabled(const char *proto)
+bool ProtocolEnabled(const char *proto)
{
if (proto == NULL)
return FALSE;
char setting[256];
mir_snprintf(setting, "%sEnabled", proto);
- return (BOOL) db_get_b(NULL, MODULE_NAME, setting, TRUE);
+ return 0 != db_get_b(NULL, MODULE_NAME, setting, true);
}
-BOOL ContactEnabled(MCONTACT hContact, char *setting, int def)
+bool ContactEnabled(MCONTACT hContact, char *setting, int def)
{
if (hContact == NULL)
- return FALSE;
+ return false;
char *proto = GetContactProto(hContact);
if (!ProtocolEnabled(proto))
- return FALSE;
+ return false;
BYTE globpref = db_get_b(NULL, MODULE_NAME, setting, def);
BYTE userpref = db_get_b(hContact, MODULE_NAME, setting, BST_INDETERMINATE);
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp
index bf3ea229f1..3c77218d31 100644
--- a/plugins/Boltun/src/boltun.cpp
+++ b/plugins/Boltun/src/boltun.cpp
@@ -546,8 +546,8 @@ static INT_PTR ContactClickStartChatting(WPARAM hContact, LPARAM)
static int MessagePrebuild(WPARAM hContact, LPARAM)
{
if (!blInit || (db_get_b(hContact, "CList", "NotOnList", 0) == 1)) {
- Menu_ModifyItem(hMenuItemAutoChat, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
- Menu_ModifyItem(hMenuItemNotToChat, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
+ Menu_EnableItem(hMenuItemAutoChat, false);
+ Menu_EnableItem(hMenuItemNotToChat, false);
}
else {
if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE))
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
index 94543dbc94..06cb843063 100644
--- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
@@ -59,20 +59,16 @@ static BOOL CLUIFramesFitInSize();
static int RemoveItemFromList(int pos, FRAMEWND **lpFrames, int *FrameItemCount);
static int _us_DoSetFramePaintProc(WPARAM wParam, LPARAM lParam);
-
-
-static mir_cs _cluiFramesModuleCS;
-static BOOL _cluiFramesModuleCSInitialized = FALSE;
-static BOOL _fCluiFramesModuleNotStarted = TRUE;
-static XPTHANDLE _hFrameTitleTheme = NULL;
-static int _nClientFrameId = eUnknownId; //for fast access to frame with alclient properties
-static int _iNextFrameId = 100;
-static HFONT _hTitleBarFont = NULL;
+static mir_cs _cluiFramesModuleCS;
+static BOOL _cluiFramesModuleCSInitialized = FALSE;
+static BOOL _fCluiFramesModuleNotStarted = TRUE;
+static XPTHANDLE _hFrameTitleTheme = NULL;
+static int _nClientFrameId = eUnknownId; //for fast access to frame with alclient properties
+static int _iNextFrameId = 100;
+static HFONT _hTitleBarFont = NULL;
// menus
-static HGENMENU _hmiVisible, _hmiTBVisible, _hmiLock, _hmiColl;
-static HGENMENU _hmiFloating, _hmiAlignRoot, _hmiAlignTop, _hmiAlignClient, _hmiAlignBottom;
-static HGENMENU _hmiPosRoot, _hmiPosUp, _hmiPosDown, _hmiBorder, _hmiRoot;
+static FrameMenuHandles cont = { HGENMENU_ROOT };
// others
static int _nContactListHeight = 0;
@@ -268,7 +264,7 @@ static FRAMEWND* FindFrameByWnd(HWND hwnd)
}
-int QueueAllFramesUpdating(BYTE queue)
+int QueueAllFramesUpdating(bool queue)
{
for (int i = 0; i < g_nFramesCount; i++) {
if (!g_CluiData.fLayered) {
@@ -611,11 +607,11 @@ static int DBLoadFrameSettingsAtPos(int pos, int Frameid)
//db_set_s(0, CLUIFrameModule,mir_strcat("Name",sadd),Frames[Frameid].name);
//bool
- g_pfwFrames[Frameid].collapsed = db_get_b(0, CLUIFrameModule, AS(buf, "Collapse", sadd), g_pfwFrames[Frameid].collapsed);
+ g_pfwFrames[Frameid].collapsed = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "Collapse", sadd), g_pfwFrames[Frameid].collapsed);
- g_pfwFrames[Frameid].Locked = db_get_b(0, CLUIFrameModule, AS(buf, "Locked", sadd), g_pfwFrames[Frameid].Locked);
- g_pfwFrames[Frameid].visible = db_get_b(0, CLUIFrameModule, AS(buf, "Visible", sadd), g_pfwFrames[Frameid].visible);
- g_pfwFrames[Frameid].TitleBar.ShowTitleBar = db_get_b(0, CLUIFrameModule, AS(buf, "TBVisile", sadd), g_pfwFrames[Frameid].TitleBar.ShowTitleBar);
+ g_pfwFrames[Frameid].Locked = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "Locked", sadd), g_pfwFrames[Frameid].Locked);
+ g_pfwFrames[Frameid].visible = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "Visible", sadd), g_pfwFrames[Frameid].visible);
+ g_pfwFrames[Frameid].TitleBar.ShowTitleBar = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "TBVisile", sadd), g_pfwFrames[Frameid].TitleBar.ShowTitleBar);
g_pfwFrames[Frameid].height = db_get_w(0, CLUIFrameModule, AS(buf, "Height", sadd), g_pfwFrames[Frameid].height);
g_pfwFrames[Frameid].HeightWhenCollapsed = db_get_w(0, CLUIFrameModule, AS(buf, "HeightCollapsed", sadd), 0);
@@ -626,10 +622,10 @@ static int DBLoadFrameSettingsAtPos(int pos, int Frameid)
g_pfwFrames[Frameid].FloatingSize.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatW", sadd), 100, 0, 2048);
g_pfwFrames[Frameid].FloatingSize.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatH", sadd), 100, 0, 2048);
- g_pfwFrames[Frameid].floating = db_get_b(0, CLUIFrameModule, AS(buf, "Floating", sadd), 0);
+ g_pfwFrames[Frameid].floating = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "Floating", sadd), 0);
g_pfwFrames[Frameid].order = db_get_w(0, CLUIFrameModule, AS(buf, "Order", sadd), 0);
- g_pfwFrames[Frameid].UseBorder = db_get_b(0, CLUIFrameModule, AS(buf, "UseBorder", sadd), g_pfwFrames[Frameid].UseBorder);
+ g_pfwFrames[Frameid].UseBorder = 0 != db_get_b(0, CLUIFrameModule, AS(buf, "UseBorder", sadd), g_pfwFrames[Frameid].UseBorder);
return 0;
}
@@ -754,13 +750,12 @@ static int CLUIFramesGetalClientFrame(void)
static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGENMENU(*pfnAdd)(CLISTMENUITEM*))
{
- //TMO_MenuItem tmi;
- HGENMENU menuid;
- int framepos = id2pos(frameid);
-
if (_fCluiFramesModuleNotStarted)
return NULL;
+ int framepos = id2pos(frameid);
+ FrameMenuHandles &fmh = (frameid == -1) ? cont : g_pfwFrames[framepos].MenuHandles;
+
CLISTMENUITEM mi = { 0 };
mi.hParentMenu = root;
mi.popupPosition = frameid;
@@ -768,49 +763,37 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp
mi.pszName = LPGEN("&Visible");
mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SHFRAME;
- menuid = pfnAdd(&mi);
- if (frameid == -1) _hmiVisible = menuid;
- else g_pfwFrames[framepos].MenuHandles.MIVisible = menuid;
+ fmh.MIVisible = pfnAdd(&mi);
popuppos += 100000;
mi.position = popuppos++;
mi.pszName = LPGEN("&Show title");
mi.pszService = MS_CLIST_FRAMES_SHFRAMETITLEBAR;
- menuid = pfnAdd(&mi);
- if (frameid == -1) _hmiTBVisible = menuid;
- else g_pfwFrames[framepos].MenuHandles.MITBVisible = menuid;
+ fmh.MITBVisible = pfnAdd(&mi);
mi.position = popuppos++;
mi.pszName = LPGEN("&Locked");
mi.pszService = MS_CLIST_FRAMES_ULFRAME;
- menuid = pfnAdd(&mi);
- if (frameid == -1) _hmiLock = menuid;
- else g_pfwFrames[framepos].MenuHandles.MILock = menuid;
+ fmh.MILock = pfnAdd(&mi);
mi.position = popuppos++;
mi.pszName = LPGEN("&Expanded");
mi.pszService = MS_CLIST_FRAMES_UCOLLFRAME;
- menuid = pfnAdd(&mi);
- if (frameid == -1) _hmiColl = menuid;
- else g_pfwFrames[framepos].MenuHandles.MIColl = menuid;
+ fmh.MIColl = pfnAdd(&mi);
// floating
mi.position = popuppos++;
mi.pszName = LPGEN("&Floating mode");
mi.flags = CMIF_ROOTHANDLE;
mi.pszService = "Set_Floating";
- menuid = pfnAdd(&mi);
- if (frameid == -1) _hmiFloating = menuid;
- else g_pfwFrames[framepos].MenuHandles.MIFloating = menuid;
+ fmh.MIFloating = pfnAdd(&mi);
mi.position = popuppos++;
mi.pszName = LPGEN("&Border");
mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SETUNBORDER;
- menuid = pfnAdd(&mi);
- if (frameid == -1) _hmiBorder = menuid;
- else g_pfwFrames[framepos].MenuHandles.MIBorder = menuid;
+ fmh.MIBorder = pfnAdd(&mi);
popuppos += 100000;
@@ -819,40 +802,31 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp
mi.pszName = LPGEN("&Align");
mi.flags = CMIF_ROOTHANDLE;
mi.pszService = "";
- menuid = pfnAdd(&mi);
- if (frameid == -1) _hmiAlignRoot = menuid;
- else g_pfwFrames[framepos].MenuHandles.MIAlignRoot = menuid;
+ fmh.MIAlignRoot = pfnAdd(&mi);
mi.flags = CMIF_ROOTHANDLE;
// align top
- mi.hParentMenu = menuid;
+ mi.hParentMenu = fmh.MIAlignRoot;
mi.position = popuppos++;
mi.pszName = LPGEN("&Top");
mi.pszService = CLUIFRAMESSETALIGNALTOP;
mi.pszContactOwner = (char*)alTop;
- menuid = pfnAdd(&mi);
- if (frameid == -1) _hmiAlignTop = menuid;
- else g_pfwFrames[framepos].MenuHandles.MIAlignTop = menuid;
-
+ fmh.MIAlignTop = pfnAdd(&mi);
// align client
mi.position = popuppos++;
mi.pszName = LPGEN("&Client");
mi.pszService = CLUIFRAMESSETALIGNALCLIENT;
mi.pszContactOwner = (char*)alClient;
- menuid = pfnAdd(&mi);
- if (frameid == -1) _hmiAlignClient = menuid;
- else g_pfwFrames[framepos].MenuHandles.MIAlignClient = menuid;
+ fmh.MIAlignClient = pfnAdd(&mi);
// align bottom
mi.position = popuppos++;
mi.pszName = LPGEN("&Bottom");
mi.pszService = CLUIFRAMESSETALIGNALBOTTOM;
mi.pszContactOwner = (char*)alBottom;
- menuid = pfnAdd(&mi);
- if (frameid == -1) _hmiAlignBottom = menuid;
- else g_pfwFrames[framepos].MenuHandles.MIAlignBottom = menuid;
+ fmh.MIAlignBottom = pfnAdd(&mi);
// position root
mi.hParentMenu = root;
@@ -861,27 +835,21 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp
mi.flags = CMIF_ROOTHANDLE;
mi.pszService = "";
mi.pszContactOwner = (char*)0;
- menuid = pfnAdd(&mi);
- if (frameid == -1) _hmiPosRoot = menuid;
- else g_pfwFrames[framepos].MenuHandles.MIPosRoot = menuid;
+ fmh.MIPosRoot = pfnAdd(&mi);
- mi.hParentMenu = menuid;
+ mi.hParentMenu = fmh.MIPosRoot;
mi.position = popuppos++;
mi.pszName = LPGEN("&Up");
mi.flags = CMIF_ROOTHANDLE;
mi.pszService = CLUIFRAMESMOVEUP;
mi.pszContactOwner = (char*)1;
- menuid = pfnAdd(&mi);
- if (frameid == -1) _hmiPosUp = menuid;
- else g_pfwFrames[framepos].MenuHandles.MIPosUp = menuid;
+ fmh.MIPosUp = pfnAdd(&mi);
mi.position = popuppos++;
mi.pszName = LPGEN("&Down");
mi.pszService = CLUIFRAMESMOVEDOWN;
mi.pszContactOwner = (char*)-1;
- menuid = pfnAdd(&mi);
- if (frameid == -1) _hmiPosDown = menuid;
- else g_pfwFrames[framepos].MenuHandles.MIPosDown = menuid;
+ fmh.MIPosDown = pfnAdd(&mi);
return 0;
}
@@ -894,24 +862,23 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM)
if (pos >= 0 && pos < g_nFramesCount) {
FRAMEWND &p = g_pfwFrames[pos];
- Menu_ModifyItem(_hmiVisible, p.TitleBar.tbname ? p.TitleBar.tbname : p.name, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.visible) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(_hmiLock, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.Locked) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(_hmiTBVisible, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.TitleBar.ShowTitleBar) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(_hmiFloating, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.floating) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(cont.MIVisible, p.TitleBar.tbname ? p.TitleBar.tbname : p.name);
+ Menu_SetChecked(cont.MIVisible, p.visible);
+ Menu_SetChecked(cont.MILock, p.Locked);
+ Menu_SetChecked(cont.MITBVisible, p.TitleBar.ShowTitleBar);
+ Menu_SetChecked(cont.MIFloating, p.floating);
- int flags = CMIF_ROOTHANDLE;
- if (g_CluiData.fLayered) flags += CMIF_GRAYED;
- else if ((p.UseBorder)) flags += CMIF_CHECKED;
- Menu_ModifyItem(_hmiBorder, NULL, INVALID_HANDLE_VALUE, flags);
+ if (g_CluiData.fLayered)
+ Menu_EnableItem(cont.MIBorder, false);
+ else
+ Menu_SetChecked(cont.MIBorder, p.UseBorder);
- Menu_ModifyItem(_hmiAlignTop, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.align&alTop) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(_hmiAlignClient, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.align&alClient) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(_hmiAlignBottom, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.align&alBottom) ? CMIF_CHECKED : 0);
+ Menu_SetChecked(cont.MIAlignTop, (p.align & alTop) != 0);
+ Menu_SetChecked(cont.MIAlignClient, (p.align & alClient) != 0);
+ Menu_SetChecked(cont.MIAlignBottom, (p.align & alBottom) != 0);
- flags = CMIF_ROOTHANDLE;
- if (p.collapsed) flags += CMIF_CHECKED;
- if ((!p.visible) || (p.Locked) || (pos == CLUIFramesGetalClientFrame())) flags += CMIF_GRAYED;
- Menu_ModifyItem(_hmiColl, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_SetChecked(cont.MIColl, p.collapsed);
+ Menu_EnableItem(cont.MIColl, p.visible && !p.Locked && pos != CLUIFramesGetalClientFrame());
}
return 0;
}
@@ -926,22 +893,25 @@ static int CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM)
if (pos >= 0 && pos < g_nFramesCount) {
FRAMEWND &p = g_pfwFrames[pos];
- Menu_ModifyItem(p.MenuHandles.MIVisible, p.TitleBar.tbname ? p.TitleBar.tbname : p.name, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.visible) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(p.MenuHandles.MILock, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.Locked) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(p.MenuHandles.MITBVisible, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.TitleBar.ShowTitleBar) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(p.MenuHandles.MIFloating, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.floating) ? CMIF_CHECKED : 0);
-
- int flags = CMIF_ROOTHANDLE;
- 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_ROOTHANDLE + ((p.align & alClient) ? CMIF_GRAYED : 0) + (p.align & alTop) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(p.MenuHandles.MIAlignClient, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.align & alClient) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(p.MenuHandles.MIAlignBottom, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + ((p.align & alClient) ? CMIF_GRAYED : 0) + (p.align & alBottom) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(p.MenuHandles.MIVisible, p.TitleBar.tbname ? p.TitleBar.tbname : p.name);
+ Menu_SetChecked(p.MenuHandles.MIVisible, p.visible);
+ Menu_SetChecked(p.MenuHandles.MILock, p.Locked);
+ Menu_SetChecked(p.MenuHandles.MITBVisible, p.TitleBar.ShowTitleBar);
+ Menu_SetChecked(p.MenuHandles.MIFloating, p.floating);
+
+ if (g_CluiData.fLayered)
+ Menu_EnableItem(p.MenuHandles.MIBorder, false);
+ else
+ Menu_SetChecked(p.MenuHandles.MIBorder, p.UseBorder);
+
+ Menu_EnableItem(p.MenuHandles.MIAlignTop, (p.align & alClient) == 0);
+ Menu_SetChecked(p.MenuHandles.MIAlignTop, (p.align & alTop) != 0);
+ Menu_EnableItem(p.MenuHandles.MIAlignBottom, (p.align & alClient) == 0);
+ Menu_SetChecked(p.MenuHandles.MIAlignBottom, (p.align & alBottom) != 0);
+ Menu_SetChecked(p.MenuHandles.MIAlignClient, (p.align & alClient) != 0);
- flags = CMIF_ROOTHANDLE + (p.collapsed) ? CMIF_CHECKED : 0 + ((!p.visible) || p.Locked || (pos == CLUIFramesGetalClientFrame())) ? CMIF_GRAYED : 0;
- Menu_ModifyItem(p.MenuHandles.MIColl, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_SetChecked(p.MenuHandles.MIColl, p.collapsed);
+ Menu_EnableItem(p.MenuHandles.MIColl, p.visible && !p.Locked && pos != CLUIFramesGetalClientFrame());
}
return 0;
@@ -1543,9 +1513,9 @@ static int CLUIFramesLoadMainMenu()
if (_fCluiFramesModuleNotStarted)
return -1;
- if (_hmiRoot != HGENMENU_ROOT) {
- Menu_RemoveItem(_hmiRoot);
- _hmiRoot = HGENMENU_ROOT;
+ if (cont.MainMenuItem != HGENMENU_ROOT) {
+ Menu_RemoveItem(cont.MainMenuItem);
+ cont.MainMenuItem = HGENMENU_ROOT;
}
// create root menu
@@ -1554,7 +1524,7 @@ static int CLUIFramesLoadMainMenu()
mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_FRAME);
mi.position = 3000090000;
mi.pszName = LPGEN("Frames");
- _hmiRoot = Menu_AddMainMenuItem(&mi);
+ cont.MainMenuItem = Menu_AddMainMenuItem(&mi);
// create frames menu
int separator = 3000200000;
@@ -1562,7 +1532,7 @@ static int CLUIFramesLoadMainMenu()
mi.hIcon = g_pfwFrames[i].TitleBar.hicon;
mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
mi.position = separator;
- mi.hParentMenu = _hmiRoot;
+ mi.hParentMenu = cont.MainMenuItem;
mi.ptszName = g_pfwFrames[i].TitleBar.tbname ? g_pfwFrames[i].TitleBar.tbname : g_pfwFrames[i].name;
mi.pszService = 0;
g_pfwFrames[i].MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi);
@@ -1578,7 +1548,7 @@ static int CLUIFramesLoadMainMenu()
mi.hIcon = NULL;
mi.flags = CMIF_ROOTHANDLE;
mi.position = separator++;
- mi.hParentMenu = _hmiRoot;
+ mi.hParentMenu = cont.MainMenuItem;
mi.pszName = LPGEN("Show all frames");
mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES;
Menu_AddMainMenuItem(&mi);
@@ -3402,11 +3372,10 @@ static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam)
RECT recttb, rectw, border;
LONG_PTR temp;
int neww, newh;
- BOOLEAN locked;
g_pfwFrames[pos].oldstyles = GetWindowLongPtr(g_pfwFrames[pos].hWnd, GWL_STYLE);
g_pfwFrames[pos].TitleBar.oldstyles = GetWindowLongPtr(g_pfwFrames[pos].TitleBar.hwnd, GWL_STYLE);
- locked = g_pfwFrames[pos].Locked;
+ bool locked = g_pfwFrames[pos].Locked;
g_pfwFrames[pos].Locked = FALSE;
g_pfwFrames[pos].minmaxenabled = FALSE;
@@ -3490,33 +3459,33 @@ int CLUIFrameOnModulesUnload(WPARAM, LPARAM)
{
g_CluiData.bSTATE = STATE_PREPEARETOEXIT;
- if (!_hmiVisible)
+ if (!cont.MIVisible)
return 0;
- Menu_RemoveItem(_hmiVisible);
- Menu_RemoveItem(_hmiTBVisible);
- Menu_RemoveItem(_hmiLock);
- Menu_RemoveItem(_hmiColl);
- Menu_RemoveItem(_hmiFloating);
- Menu_RemoveItem(_hmiAlignTop);
- Menu_RemoveItem(_hmiAlignClient);
- Menu_RemoveItem(_hmiAlignBottom);
- Menu_RemoveItem(_hmiBorder);
- Menu_RemoveItem(_hmiAlignRoot);
-
- Menu_RemoveItem(_hmiPosUp);
- Menu_RemoveItem(_hmiPosDown);
- Menu_RemoveItem(_hmiPosRoot);
-
- Menu_RemoveItem(_hmiVisible);
- Menu_RemoveItem(_hmiTBVisible);
- Menu_RemoveItem(_hmiLock);
- Menu_RemoveItem(_hmiColl);
- Menu_RemoveItem(_hmiFloating);
- Menu_RemoveItem(_hmiBorder);
- Menu_RemoveItem(_hmiAlignRoot);
- Menu_RemoveItem(_hmiPosRoot);
- _hmiVisible = 0;
+ Menu_RemoveItem(cont.MIVisible);
+ Menu_RemoveItem(cont.MITBVisible);
+ Menu_RemoveItem(cont.MILock);
+ Menu_RemoveItem(cont.MIColl);
+ Menu_RemoveItem(cont.MIFloating);
+ Menu_RemoveItem(cont.MIAlignTop);
+ Menu_RemoveItem(cont.MIAlignClient);
+ Menu_RemoveItem(cont.MIAlignBottom);
+ Menu_RemoveItem(cont.MIBorder);
+ Menu_RemoveItem(cont.MIAlignRoot);
+
+ Menu_RemoveItem(cont.MIPosUp);
+ Menu_RemoveItem(cont.MIPosDown);
+ Menu_RemoveItem(cont.MIPosRoot);
+
+ Menu_RemoveItem(cont.MIVisible);
+ Menu_RemoveItem(cont.MITBVisible);
+ Menu_RemoveItem(cont.MILock);
+ Menu_RemoveItem(cont.MIColl);
+ Menu_RemoveItem(cont.MIFloating);
+ Menu_RemoveItem(cont.MIBorder);
+ Menu_RemoveItem(cont.MIAlignRoot);
+ Menu_RemoveItem(cont.MIPosRoot);
+ cont.MIVisible = 0;
_AniAva_OnModulesUnload();
return 0;
@@ -3575,12 +3544,12 @@ int LoadCLUIFramesModule(void)
static INT_PTR UnloadMainMenu()
{
CLUIFrameOnModulesUnload(0, 0);
- if (_hmiRoot != HGENMENU_ROOT) {
- Menu_RemoveItem(_hmiRoot);
- _hmiRoot = HGENMENU_ROOT;
+ if (cont.MainMenuItem != HGENMENU_ROOT) {
+ Menu_RemoveItem(cont.MainMenuItem);
+ cont.MainMenuItem = HGENMENU_ROOT;
}
- return (INT_PTR)_hmiRoot;
+ return (INT_PTR)cont.MainMenuItem;
}
int UnLoadCLUIFramesModule(void)
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.h b/plugins/Clist_modern/src/CLUIFrames/cluiframes.h
index 1d8b91c37c..c387e53dc8 100644
--- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.h
+++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.h
@@ -80,8 +80,8 @@ struct FrameTitleBar
HMENU hmenu;
HICON hicon;
- BOOLEAN ShowTitleBar;
- BOOLEAN ShowTitleBarTip;
+ bool ShowTitleBar;
+ bool ShowTitleBarTip;
COLORREF BackColour;
COLORREF TextColour;
int oldstyles;
@@ -105,27 +105,27 @@ struct FRAMEWND
int align;
int height;
int dwFlags;
- BOOLEAN Locked;
- BOOLEAN visible;
- BOOLEAN needhide;
- BOOLEAN collapsed;
+ bool Locked;
+ bool visible;
+ bool needhide;
+ bool collapsed;
int prevvisframe;
int HeightWhenCollapsed;
FrameTitleBar TitleBar;
FrameMenuHandles MenuHandles;
int oldstyles;
- BOOLEAN floating;
HWND ContainerWnd;
POINT FloatingPos;
POINT FloatingSize;
- BOOLEAN minmaxenabled;
- BOOLEAN UseBorder;
+ bool floating;
+ bool minmaxenabled;
+ bool UseBorder;
int order;
DockOpt dockOpt;
HWND OwnerWindow;
tPaintCallbackProc PaintCallbackProc;
sPaintRequest * PaintData;
- BOOLEAN bQueued;
+ bool bQueued;
HRGN UpdateRgn;
};
diff --git a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp
index ed9e5166ef..b9f6f06870 100644
--- a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp
+++ b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp
@@ -340,11 +340,11 @@ static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM)
if (gray1 && gray2) gray1 = FALSE; //should not be cause CLCItems_IsShowOfflineGroup return false if group->hideOffline
- int flags = ((group->hideOffline && !gray1) ? CMIF_CHECKED : 0) | (gray1 ? CMIF_GRAYED : 0);
- Menu_ModifyItem(hHideOfflineUsersHereMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_EnableItem(hHideOfflineUsersHereMenuItem, !gray1);
+ Menu_SetChecked(hHideOfflineUsersHereMenuItem, group->hideOffline && !gray1);
- flags = ((showOfflineinGroup && !gray2) ? CMIF_CHECKED : 0) | (gray2 ? CMIF_GRAYED : 0);
- Menu_ModifyItem(hShowOfflineUsersHereMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_EnableItem(hShowOfflineUsersHereMenuItem, !gray2);
+ Menu_SetChecked(hShowOfflineUsersHereMenuItem, showOfflineinGroup && !gray2);
return 0;
}
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
index 63c5f5ef09..d67cacb842 100644
--- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
+++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
@@ -208,7 +208,7 @@ int MenuModulesLoaded(WPARAM wParam, LPARAM lParam);
int MenuModulesShutdown(WPARAM wParam, LPARAM lParam); //clistmenu.c
int MenuProcessCommand(WPARAM wParam, LPARAM lParam); //clistmenu.c
int OnFrameTitleBarBackgroundChange(WPARAM wParam, LPARAM lParam); //cluiframes.c
-int QueueAllFramesUpdating(BYTE); //cluiframes.c
+int QueueAllFramesUpdating(bool); //cluiframes.c
int RecursiveDeleteMenu(HMENU hMenu); //clistmenus.c
int ModernSkinButtonRedrawAll(); //modern_button.c
int RegisterButtonByParce(char * ObjectName, char * Params); //mod_skin_selector.c
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp
index 5e71a539dd..dc92f299de 100644
--- a/plugins/Clist_modern/src/modern_skinengine.cpp
+++ b/plugins/Clist_modern/src/modern_skinengine.cpp
@@ -2754,8 +2754,8 @@ static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM) //
return 0;
RECT wnd;
- BOOL NoCancelPost = 0;
- BOOL IsAnyQueued = 0;
+ bool NoCancelPost = false;
+ bool IsAnyQueued = false;
if (!g_CluiData.mutexOnEdgeSizing)
GetWindowRect(pcli->hwndContactList, &wnd);
else
@@ -2840,9 +2840,9 @@ static INT_PTR ske_Service_InvalidateFrameImage(WPARAM wParam, LPARAM lParam)
}
}
}
- else Sync(QueueAllFramesUpdating, 1);
+ else Sync(QueueAllFramesUpdating, true);
}
- else Sync(QueueAllFramesUpdating, 1);
+ else Sync(QueueAllFramesUpdating, true);
if (!flag_bUpdateQueued || g_flag_bPostWasCanceled)
if (PostMessage(pcli->hwndContactList, UM_UPDATE, 0, 0)) {
@@ -3163,7 +3163,7 @@ int ske_ValidateFrameImageProc(RECT *r) // Callin
}
if (IsForceAllPainting) {
BitBlt(g_pCachedWindow->hImageDC, 0, 0, g_pCachedWindow->Width, g_pCachedWindow->Height, g_pCachedWindow->hBackDC, 0, 0, SRCCOPY);
- Sync(QueueAllFramesUpdating, (BYTE)1);
+ Sync(QueueAllFramesUpdating, true);
}
//-- Validating frames
for (int i = 0; i < g_nFramesCount; i++)
@@ -3178,7 +3178,7 @@ int ske_ValidateFrameImageProc(RECT *r) // Callin
ske_UpdateWindowImageRect(&wnd);
//-- Clear queue
- Sync(QueueAllFramesUpdating, 0);
+ Sync(QueueAllFramesUpdating, false);
flag_bUpdateQueued = 0;
g_flag_bPostWasCanceled = 0;
return 1;
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
index 011221b82a..6591280c40 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
@@ -93,11 +93,7 @@ static int TitleBarH = DEFAULT_TITLEBAR_HEIGHT;
static boolean resizing = FALSE;
// menus
-static HGENMENU contMIVisible, contMITitle, contMITBVisible, contMILock, contMIColl, contMIFloating;
-static HGENMENU contMIAlignRoot;
-static HGENMENU contMIAlignTop, contMIAlignClient, contMIAlignBottom;
-static HGENMENU contMIBorder, contMISkinned;
-static HGENMENU MainMIRoot = (HGENMENU)-1;
+static FrameMenuHandles cont = { HGENMENU_ROOT };
// others
static int ContactListHeight;
@@ -108,7 +104,7 @@ static int oldframeheight = -1;
static int curdragbar = -1;
static mir_cs csFrameHook;
-static BOOLEAN CLUIFramesFitInSize(void);
+static bool CLUIFramesFitInSize(void);
HWND hWndExplorerToolBar;
static int GapBetweenFrames = 1;
@@ -133,7 +129,7 @@ static int id2pos(int id)
return -1;
}
-int __forceinline btoint(BOOLEAN b)
+int __forceinline btoint(bool b)
{
return (b ? 1 : 0);
}
@@ -416,26 +412,26 @@ int DBLoadFrameSettingsAtPos(int pos, int Frameid)
_itoa(pos, sadd, 10);
- Frames[Frameid].collapsed = cfg::getByte(CLUIFrameModule, AS(buf, "Collapse", sadd), Frames[Frameid].collapsed);
+ Frames[Frameid].collapsed = 0 != cfg::getByte(CLUIFrameModule, AS(buf, "Collapse", sadd), Frames[Frameid].collapsed);
- Frames[Frameid].Locked = cfg::getByte(CLUIFrameModule, AS(buf, "Locked", sadd), Frames[Frameid].Locked);
- Frames[Frameid].visible = cfg::getByte(CLUIFrameModule, AS(buf, "Visible", sadd), Frames[Frameid].visible);
- Frames[Frameid].TitleBar.ShowTitleBar = cfg::getByte(CLUIFrameModule, AS(buf, "TBVisile", sadd), Frames[Frameid].TitleBar.ShowTitleBar);
+ Frames[Frameid].Locked = 0 != cfg::getByte(CLUIFrameModule, AS(buf, "Locked", sadd), Frames[Frameid].Locked);
+ Frames[Frameid].visible = 0 != cfg::getByte(CLUIFrameModule, AS(buf, "Visible", sadd), Frames[Frameid].visible);
+ Frames[Frameid].TitleBar.ShowTitleBar = 0 != cfg::getByte(CLUIFrameModule, AS(buf, "TBVisile", sadd), Frames[Frameid].TitleBar.ShowTitleBar);
- Frames[Frameid].height = cfg::getWord(CLUIFrameModule, AS(buf, "Height", sadd), Frames[Frameid].height);
- Frames[Frameid].HeightWhenCollapsed = cfg::getWord(CLUIFrameModule, AS(buf, "HeightCollapsed", sadd), 0);
- Frames[Frameid].align = cfg::getWord(CLUIFrameModule, AS(buf, "Align", sadd), Frames[Frameid].align);
+ Frames[Frameid].height = cfg::getWord(CLUIFrameModule, AS(buf, "Height", sadd), Frames[Frameid].height);
+ Frames[Frameid].HeightWhenCollapsed = cfg::getWord(CLUIFrameModule, AS(buf, "HeightCollapsed", sadd), 0);
+ Frames[Frameid].align = cfg::getWord(CLUIFrameModule, AS(buf, "Align", sadd), Frames[Frameid].align);
- Frames[Frameid].FloatingPos.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatX", sadd), 100, 0, 1024);
- Frames[Frameid].FloatingPos.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatY", sadd), 100, 0, 1024);
- Frames[Frameid].FloatingSize.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatW", sadd), 100, 0, 1024);
- Frames[Frameid].FloatingSize.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatH", sadd), 100, 0, 1024);
+ Frames[Frameid].FloatingPos.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatX", sadd), 100, 0, 1024);
+ Frames[Frameid].FloatingPos.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatY", sadd), 100, 0, 1024);
+ Frames[Frameid].FloatingSize.x = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatW", sadd), 100, 0, 1024);
+ Frames[Frameid].FloatingSize.y = DBGetContactSettingRangedWord(0, CLUIFrameModule, AS(buf, "FloatH", sadd), 100, 0, 1024);
- Frames[Frameid].floating = cfg::getByte(CLUIFrameModule, AS(buf, "Floating", sadd), 0);
- Frames[Frameid].order = cfg::getWord(CLUIFrameModule, AS(buf, "Order", sadd), 0);
+ Frames[Frameid].floating = 0 != cfg::getByte(CLUIFrameModule, AS(buf, "Floating", sadd), 0);
+ Frames[Frameid].order = cfg::getWord(CLUIFrameModule, AS(buf, "Order", sadd), 0);
- Frames[Frameid].UseBorder = cfg::getByte(CLUIFrameModule, AS(buf, "UseBorder", sadd), Frames[Frameid].UseBorder);
- Frames[Frameid].Skinned = cfg::getByte(CLUIFrameModule, AS(buf, "Skinned", sadd), Frames[Frameid].Skinned);
+ Frames[Frameid].UseBorder = 0 != cfg::getByte(CLUIFrameModule, AS(buf, "UseBorder", sadd), Frames[Frameid].UseBorder);
+ Frames[Frameid].Skinned = 0 != cfg::getByte(CLUIFrameModule, AS(buf, "Skinned", sadd), Frames[Frameid].Skinned);
return 0;
}
@@ -574,12 +570,12 @@ int CLUIFramesGetalClientFrame(void)
HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGENMENU (*pfnAdd )( CLISTMENUITEM* ))
{
- HGENMENU menuid;
- int framepos = id2pos(frameid);
-
if (FramesSysNotStarted)
return NULL;
+ int framepos = id2pos(frameid);
+ FrameMenuHandles &fmh = (frameid == -1) ? cont : Frames[framepos].MenuHandles;
+
CLISTMENUITEM mi = { 0 };
mi.popupPosition = frameid;
@@ -588,9 +584,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE
mi.position = popuppos++;
mi.pszName = LPGEN("&FrameTitle");
mi.flags = CMIF_ROOTHANDLE | CMIF_GRAYED;
- menuid = pfnAdd(&mi);
- if (frameid == -1) contMITitle = menuid;
- else Frames[framepos].MenuHandles.MITitle = menuid;
+ fmh.MITitle = pfnAdd(&mi);
popuppos += 100000;
@@ -599,17 +593,13 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE
mi.pszName = LPGEN("&Visible");
mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SHFRAME;
- menuid = pfnAdd(&mi);
- if (frameid == -1) contMIVisible = menuid;
- else Frames[framepos].MenuHandles.MIVisible = menuid;
+ fmh.MIVisible = pfnAdd(&mi);
mi.position = popuppos++;
mi.pszName = LPGEN("&Show title bar");
mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SHFRAMETITLEBAR;
- menuid = pfnAdd(&mi);
- if (frameid == -1) contMITBVisible = menuid;
- else Frames[framepos].MenuHandles.MITBVisible = menuid;
+ fmh.MITBVisible = pfnAdd(&mi);
popuppos += 100000;
@@ -617,26 +607,20 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE
mi.pszName = LPGEN("&Locked");
mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_ULFRAME;
- menuid = pfnAdd(&mi);
- if (frameid == -1) contMILock = menuid;
- else Frames[framepos].MenuHandles.MILock = menuid;
+ fmh.MILock = pfnAdd(&mi);
mi.position = popuppos++;
mi.pszName = LPGEN("&Collapsed");
mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_UCOLLFRAME;
- menuid = pfnAdd(&mi);
- if (frameid == -1) contMIColl = menuid;
- else Frames[framepos].MenuHandles.MIColl = menuid;
+ fmh.MIColl = pfnAdd(&mi);
// floating
mi.position = popuppos++;
mi.pszName = LPGEN("&Floating mode");
mi.flags = CMIF_ROOTHANDLE;
mi.pszService = "Set_Floating";
- menuid = pfnAdd(&mi);
- if (frameid == -1) contMIFloating = menuid;
- else Frames[framepos].MenuHandles.MIFloating = menuid;
+ fmh.MIFloating = pfnAdd(&mi);
popuppos += 100000;
@@ -644,9 +628,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE
mi.pszName = LPGEN("&Border");
mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SETUNBORDER;
- menuid = pfnAdd(&mi);
- if (frameid == -1) contMIBorder = menuid;
- else Frames[framepos].MenuHandles.MIBorder = menuid;
+ fmh.MIBorder = pfnAdd(&mi);
popuppos += 100000;
@@ -654,9 +636,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE
mi.pszName = LPGEN("&Skinned frame");
mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SETSKINNED;
- menuid = pfnAdd(&mi);
- if (frameid == -1) contMISkinned = menuid;
- else Frames[framepos].MenuHandles.MISkinned = menuid;
+ fmh.MISkinned = pfnAdd(&mi);
popuppos += 100000;
@@ -666,38 +646,30 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE
mi.pszName = LPGEN("&Align");
mi.flags = CMIF_ROOTHANDLE;
mi.pszService = "";
- menuid = pfnAdd(&mi);
- if (frameid == -1) contMIAlignRoot = menuid;
- else Frames[framepos].MenuHandles.MIAlignRoot = menuid;
+ fmh.MIAlignRoot = pfnAdd(&mi);
mi.flags = CMIF_ROOTHANDLE;
// align top
- mi.hParentMenu = menuid;
+ mi.hParentMenu = fmh.MIAlignRoot;
mi.position = popuppos++;
mi.pszName = LPGEN("&Top");
mi.pszService = CLUIFRAMESSETALIGNALTOP;
mi.pszContactOwner = (char*)alTop;
- menuid = pfnAdd(&mi);
- if (frameid == -1) contMIAlignTop = menuid;
- else Frames[framepos].MenuHandles.MIAlignTop = menuid;
+ fmh.MIAlignTop = pfnAdd(&mi);
// align client
mi.position = popuppos++;
mi.pszName = LPGEN("&Client");
mi.pszService = CLUIFRAMESSETALIGNALCLIENT;
mi.pszContactOwner = (char*)alClient;
- menuid = pfnAdd(&mi);
- if (frameid == -1) contMIAlignClient = menuid;
- else Frames[framepos].MenuHandles.MIAlignClient = menuid;
+ fmh.MIAlignClient = pfnAdd(&mi);
// align bottom
mi.position = popuppos++;
mi.pszName = LPGEN("&Bottom");
mi.pszService = CLUIFRAMESSETALIGNALBOTTOM;
mi.pszContactOwner = (char*)alBottom;
- menuid = pfnAdd(&mi);
- if (frameid == -1) contMIAlignBottom = menuid;
- else Frames[framepos].MenuHandles.MIAlignBottom = menuid;
+ fmh.MIAlignBottom = pfnAdd(&mi);
// position root
mi.hParentMenu = root;
@@ -707,7 +679,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE
mi.flags = CMIF_ROOTHANDLE;
mi.pszService = "";
mi.pszContactOwner = (char*)0;
- menuid = pfnAdd(&mi);
+ HGENMENU menuid = pfnAdd(&mi);
mi.hParentMenu = menuid;
mi.position = popuppos++;
@@ -735,21 +707,19 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM)
int pos = id2pos((INT_PTR)wParam);
if (pos >= 0 && pos < nFramescount) {
FRAMEWND &p = Frames[pos];
- Menu_ModifyItem(contMITitle, p.TitleBar.tbname ? p.TitleBar.tbname : p.name, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE);
- Menu_ModifyItem(contMIVisible, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.visible ? CMIF_CHECKED : 0));
- Menu_ModifyItem(contMILock, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.Locked ? CMIF_CHECKED : 0));
- Menu_ModifyItem(contMITBVisible, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.TitleBar.ShowTitleBar ? CMIF_CHECKED : 0));
- Menu_ModifyItem(contMIFloating, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.floating ? CMIF_CHECKED : 0));
- Menu_ModifyItem(contMIBorder, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.UseBorder ? CMIF_CHECKED : 0));
- Menu_ModifyItem(contMISkinned, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.Skinned ? CMIF_CHECKED : 0));
- Menu_ModifyItem(contMIAlignTop, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + ((p.align & alTop) ? CMIF_CHECKED : 0));
- Menu_ModifyItem(contMIAlignClient, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + ((p.align & alClient) ? CMIF_CHECKED : 0));
- Menu_ModifyItem(contMIAlignBottom, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + ((p.align & alBottom) ? CMIF_CHECKED : 0));
-
- int flags = CMIF_ROOTHANDLE + (!p.collapsed ? CMIF_CHECKED : 0);
- if ((!p.visible) || (p.Locked) || (pos == CLUIFramesGetalClientFrame()))
- flags |= CMIF_GRAYED;
- Menu_ModifyItem(contMIColl, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(cont.MITitle, p.TitleBar.tbname ? p.TitleBar.tbname : p.name);
+ Menu_SetChecked(cont.MIVisible, p.visible);
+ Menu_SetChecked(cont.MILock, p.Locked);
+ Menu_SetChecked(cont.MITBVisible, p.TitleBar.ShowTitleBar);
+ Menu_SetChecked(cont.MIFloating, p.floating);
+ Menu_SetChecked(cont.MIBorder, p.UseBorder);
+ Menu_SetChecked(cont.MISkinned, p.Skinned);
+ Menu_SetChecked(cont.MIAlignTop, (p.align & alTop) != 0);
+ Menu_SetChecked(cont.MIAlignClient, (p.align & alClient) != 0);
+ Menu_SetChecked(cont.MIAlignBottom, (p.align & alBottom) != 0);
+
+ Menu_SetChecked(cont.MIColl, !p.collapsed);
+ Menu_EnableItem(cont.MIColl, p.visible && !p.Locked && pos != CLUIFramesGetalClientFrame());
}
return 0;
}
@@ -764,29 +734,25 @@ INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM)
if (pos >= 0 && pos < nFramescount) {
FRAMEWND &p = Frames[pos];
- Menu_ModifyItem(p.MenuHandles.MITitle, p.TitleBar.tbname ? p.TitleBar.tbname : p.name, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE);
+ Menu_ModifyItem(p.MenuHandles.MITitle, p.TitleBar.tbname ? p.TitleBar.tbname : p.name);
- Menu_ModifyItem(p.MenuHandles.MIVisible, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.visible) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(p.MenuHandles.MILock, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.Locked) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(p.MenuHandles.MITBVisible, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.TitleBar.ShowTitleBar) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(p.MenuHandles.MIFloating, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.floating) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(p.MenuHandles.MIBorder, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + ((p.UseBorder)) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(p.MenuHandles.MISkinned, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + ((p.Skinned)) ? CMIF_CHECKED : 0);
+ Menu_SetChecked(p.MenuHandles.MIVisible, p.visible);
+ Menu_SetChecked(p.MenuHandles.MILock, p.Locked);
+ Menu_SetChecked(p.MenuHandles.MITBVisible, p.TitleBar.ShowTitleBar);
+ Menu_SetChecked(p.MenuHandles.MIFloating, p.floating);
+ Menu_SetChecked(p.MenuHandles.MIBorder, p.UseBorder);
+ Menu_SetChecked(p.MenuHandles.MISkinned, p.Skinned);
- int flags = CMIF_ROOTHANDLE | ((p.align & alClient) ? CMIF_GRAYED : 0);
- if (p.align & alTop) flags |= CMIF_CHECKED;
- Menu_ModifyItem(p.MenuHandles.MIAlignTop, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_EnableItem(p.MenuHandles.MIAlignTop, (p.align & alClient) == 0);
+ Menu_SetChecked(p.MenuHandles.MIAlignTop, (p.align & alTop) != 0);
- Menu_ModifyItem(p.MenuHandles.MIAlignClient, NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE + (p.align & alClient) ? CMIF_CHECKED : 0);
+ Menu_SetChecked(p.MenuHandles.MIAlignClient, (p.align & alClient) != 0);
- flags = CMIF_ROOTHANDLE | ((p.align & alClient) ? CMIF_GRAYED : 0);
- if (p.align & alBottom) flags |= CMIF_CHECKED;
- Menu_ModifyItem(p.MenuHandles.MIAlignBottom, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_EnableItem(p.MenuHandles.MIAlignTop, (p.align & alClient) == 0);
+ Menu_SetChecked(p.MenuHandles.MIAlignTop, (p.align & alBottom) != 0);
- flags = CMIF_ROOTHANDLE;
- if ( !p.collapsed) flags |= CMIF_CHECKED;
- if ((!p.visible) || p.Locked || (pos == CLUIFramesGetalClientFrame())) flags |= CMIF_GRAYED;
- Menu_ModifyItem(p.MenuHandles.MIColl, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_SetChecked(p.MenuHandles.MIColl, !p.collapsed);
+ Menu_EnableItem(p.MenuHandles.MIColl, p.visible && !p.Locked && pos != CLUIFramesGetalClientFrame());
}
return 0;
}
@@ -1380,9 +1346,9 @@ static int CLUIFramesLoadMainMenu()
if (FramesSysNotStarted)
return -1;
- if (MainMIRoot != (HANDLE)-1) {
- Menu_RemoveItem(MainMIRoot);
- MainMIRoot = (HGENMENU)-1;
+ if (cont.MainMenuItem != HGENMENU_ROOT) {
+ Menu_RemoveItem(cont.MainMenuItem);
+ cont.MainMenuItem = HGENMENU_ROOT;
}
// create root menu
@@ -1393,7 +1359,7 @@ static int CLUIFramesLoadMainMenu()
mi.hParentMenu = HGENMENU_ROOT;
mi.pszName = LPGEN("Frames");
mi.pszService = 0;
- MainMIRoot = Menu_AddMainMenuItem(&mi);
+ cont.MainMenuItem = Menu_AddMainMenuItem(&mi);
// create frames menu
int separator = (int)3000200000;
@@ -1401,7 +1367,7 @@ static int CLUIFramesLoadMainMenu()
mi.hIcon = Frames[i].TitleBar.hicon;
mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
mi.position = separator;
- mi.hParentMenu = MainMIRoot;
+ mi.hParentMenu = cont.MainMenuItem;
mi.ptszName = Frames[i].TitleBar.tbname ? Frames[i].TitleBar.tbname : Frames[i].name;
mi.pszService = 0;
Frames[i].MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi);
@@ -1418,7 +1384,7 @@ static int CLUIFramesLoadMainMenu()
mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA));
mi.flags = CMIF_ROOTHANDLE;
mi.position = separator++;
- mi.hParentMenu = MainMIRoot;
+ mi.hParentMenu = cont.MainMenuItem;
mi.pszName = LPGEN("Show all frames");
mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES;
Menu_AddMainMenuItem(&mi);
@@ -1426,7 +1392,6 @@ static int CLUIFramesLoadMainMenu()
// create "show all titlebars" menu
mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_HELP));
mi.position = separator++;
- mi.hParentMenu = MainMIRoot;
mi.flags = CMIF_ROOTHANDLE;
mi.pszName = LPGEN("Show all title bars");
mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMESTB;
@@ -1435,12 +1400,10 @@ static int CLUIFramesLoadMainMenu()
// create "hide all titlebars" menu
mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_HELP));
mi.position = separator++;
- mi.hParentMenu = MainMIRoot;
mi.flags = CMIF_ROOTHANDLE;
mi.pszName = LPGEN("Hide all title bars");
mi.pszService = MS_CLIST_FRAMES_HIDEALLFRAMESTB;
Menu_AddMainMenuItem(&mi);
-
return 0;
}
@@ -1845,7 +1808,7 @@ int CLUIFrameMoveResize(const FRAMEWND *Frame)
return 0;
}
-BOOLEAN CLUIFramesFitInSize(void)
+bool CLUIFramesFitInSize(void)
{
int i;
int sumheight = 0;
@@ -2920,11 +2883,10 @@ INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam)
RECT recttb, rectw, border;
int temp;
int neww, newh;
- BOOLEAN locked;
Frames[wParam].oldstyles = GetWindowLongPtr(Frames[wParam].hWnd, GWL_STYLE);
Frames[wParam].TitleBar.oldstyles = GetWindowLongPtr(Frames[wParam].TitleBar.hwnd, GWL_STYLE);
- locked = Frames[wParam].Locked;
+ bool locked = Frames[wParam].Locked;
Frames[wParam].Locked = FALSE;
Frames[wParam].minmaxenabled = FALSE;
@@ -3014,17 +2976,17 @@ static int CLUIFrameOnModulesUnload(WPARAM, LPARAM)
WaitForSingleObject(hThreadMFUpdate, 2000);
CloseHandle(g_hEventThread);
- Menu_RemoveItem(contMIVisible);
- Menu_RemoveItem(contMITitle);
- Menu_RemoveItem(contMITBVisible);
- Menu_RemoveItem(contMILock);
- Menu_RemoveItem(contMIColl);
- Menu_RemoveItem(contMIFloating);
- Menu_RemoveItem(contMIAlignRoot);
- Menu_RemoveItem(contMIAlignTop);
- Menu_RemoveItem(contMIAlignClient);
- Menu_RemoveItem(contMIAlignBottom);
- Menu_RemoveItem(contMIBorder);
+ Menu_RemoveItem(cont.MIVisible);
+ Menu_RemoveItem(cont.MITitle);
+ Menu_RemoveItem(cont.MITBVisible);
+ Menu_RemoveItem(cont.MILock);
+ Menu_RemoveItem(cont.MIColl);
+ Menu_RemoveItem(cont.MIFloating);
+ Menu_RemoveItem(cont.MIAlignRoot);
+ Menu_RemoveItem(cont.MIAlignTop);
+ Menu_RemoveItem(cont.MIAlignClient);
+ Menu_RemoveItem(cont.MIAlignBottom);
+ Menu_RemoveItem(cont.MIBorder);
return 0;
}
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.h b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.h
index 89ce883477..b3ff93c556 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.h
+++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.h
@@ -72,8 +72,8 @@ struct FrameTitleBar
HMENU hmenu;
HICON hicon;
- BOOLEAN ShowTitleBar;
- BOOLEAN ShowTitleBarTip;
+ bool ShowTitleBar;
+ bool ShowTitleBarTip;
int oldstyles;
POINT oldpos;
RECT wndSize;
@@ -95,22 +95,22 @@ struct FRAMEWND
int align;
int height;
int dwFlags;
- BOOLEAN Locked;
- BOOLEAN Skinned;
- BOOLEAN visible;
- BOOLEAN needhide;
- BOOLEAN collapsed;
+ bool Locked;
+ bool Skinned;
+ bool visible;
+ bool needhide;
+ bool collapsed;
+ bool floating;
+ bool minmaxenabled;
+ bool UseBorder;
int prevvisframe;
int HeightWhenCollapsed;
FrameTitleBar TitleBar;
FrameMenuHandles MenuHandles;
int oldstyles;
- BOOLEAN floating;
HWND ContainerWnd;
POINT FloatingPos;
POINT FloatingSize;
- BOOLEAN minmaxenabled;
- BOOLEAN UseBorder;
int order;
DockOpt dockOpt;
HWND OwnerWindow;
diff --git a/plugins/HistoryStats/src/main.cpp b/plugins/HistoryStats/src/main.cpp
index bad9b3ca5e..fceb2edb9b 100644
--- a/plugins/HistoryStats/src/main.cpp
+++ b/plugins/HistoryStats/src/main.cpp
@@ -305,14 +305,8 @@ static int EventPreBuildContactMenu(WPARAM hContact, LPARAM)
db.setContact(hContact);
db.setModule(con::ModHistoryStats);
- int menuState = db.readBool(con::SettExclude, false) ? CMIF_CHECKED : 0;
-
- // avoid collision with options page
- if (g_bExcludeLock)
- menuState |= CMIF_GRAYED;
-
- // set menu state
- Menu_ModifyItem(g_hMenuToggleExclude, NULL, INVALID_HANDLE_VALUE, menuState);
+ Menu_SetChecked(g_hMenuToggleExclude, db.readBool(con::SettExclude, false));
+ Menu_EnableItem(g_hMenuToggleExclude, !g_bExcludeLock); // avoid collision with options page
}
#if defined(HISTORYSTATS_HISTORYCOPY)
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp
index 9b62cb0633..8ca0d1aead 100644
--- a/plugins/ListeningTo/src/listeningto.cpp
+++ b/plugins/ListeningTo/src/listeningto.cpp
@@ -159,8 +159,8 @@ void UpdateGlobalStatusMenus()
{
BOOL enabled = ListeningToEnabled(NULL, TRUE);
- int flags = (enabled ? CMIF_CHECKED : 0) + (opts.enable_sending ? 0 : CMIF_GRAYED);
- Menu_ModifyItem(proto_items[0].hMenu, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_SetChecked(proto_items[0].hMenu, enabled);
+ Menu_EnableItem(proto_items[0].hMenu, opts.enable_sending);
if (hTTB != NULL)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM) hTTB, (LPARAM) (enabled ? TTBST_PUSHED : 0));
@@ -708,8 +708,8 @@ INT_PTR EnableListeningTo(char *proto,BOOL enabled)
ProtocolInfo *info = GetProtoInfo(proto);
if (info != NULL)
{
- int flags = (enabled ? CMIF_CHECKED : 0) | (opts.enable_sending ? 0 : CMIF_GRAYED);
- Menu_ModifyItem(info->hMenu, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_EnableItem(info->hMenu, opts.enable_sending);
+ Menu_SetChecked(info->hMenu, enabled);
SetListeningInfo(proto,(opts.enable_sending && enabled) ? GetListeningInfo() : NULL);
}
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp
index 087ea1a802..6ae5ed72e9 100644
--- a/plugins/LotusNotify/src/LotusNotify.cpp
+++ b/plugins/LotusNotify/src/LotusNotify.cpp
@@ -534,15 +534,6 @@ void ErMsgByLotusCode(STATUS erno)
ErMsgW(error_text_UNICODE);
}
-
-//set menu avainability
-static void LNEnableMenuItem(HGENMENU hMenuItem, BOOL bEnable)
-{
- log_p(L"LNEnableMenuItem: bEnable=%d", bEnable);
- Menu_ModifyItem(hMenuItem, NULL, INVALID_HANDLE_VALUE, bEnable ? 0 : CMIF_GRAYED);
-}
-
-
int check() {
log_p(L"check: Entering check function. running=%d", running);
@@ -563,11 +554,11 @@ int check() {
if(running) {
ErMsgT(TranslateT("Now checking Lotus, try again later"));
return 1;
- } else {
- running = TRUE;
- LNEnableMenuItem(hMenuHandle, !running);
}
+ running = TRUE;
+ Menu_EnableItem(hMenuHandle, !running);
+
log(L"check: starting checkthread");
mir_forkthread(checkthread, NULL);
@@ -830,9 +821,8 @@ void checkthread(void*)
log(L"checkthread: Terminating Notes thread");
running = FALSE;
- if(currentStatus != ID_STATUS_OFFLINE){
- LNEnableMenuItem(hMenuHandle, !running);
- }
+ if(currentStatus != ID_STATUS_OFFLINE)
+ Menu_EnableItem(hMenuHandle, !running);
return;
errorblock0:
@@ -845,7 +835,7 @@ errorblock:
// go offline if connection error occurs and let KeepStatus or other plugin managing reconnection
if(!settingKeepConnection && currentStatus!=ID_STATUS_OFFLINE) {
- LNEnableMenuItem(hMenuHandle,!running);
+ Menu_EnableItem(hMenuHandle,!running);
SetStatus(ID_STATUS_OFFLINE,0);
}
@@ -1547,12 +1537,12 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam)
{
if (wParam == ID_STATUS_OFFLINE){
// the status has been changed to online (maybe run some more code)
- LNEnableMenuItem(hMenuHandle, FALSE);
+ Menu_EnableItem(hMenuHandle, FALSE);
diffstat = 0;
} else if (wParam == ID_STATUS_ONLINE){
diffstat = 0;
- //LNEnableMenuItem(hMenuHandle ,TRUE);
+ //Menu_EnableItem(hMenuHandle ,TRUE);
//NotifyEventHooks(hCheckEvent,wParam,lParam);
// the status has been changed to offline (maybe run some more code)
if (currentStatus != ID_STATUS_ONLINE){
@@ -1567,7 +1557,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam)
if(check() == 0){
if(settingInterval != 0)
SetTimer(hTimerWnd, TID, settingInterval * 60000, atTime);
- LNEnableMenuItem(hMenuHandle, TRUE);
+ Menu_EnableItem(hMenuHandle, TRUE);
} else {
ProtoBroadcastAck(PLUGINNAME, NULL, ACKTYPE_STATUS, ACKRESULT_FAILED, (HANDLE)currentStatus, wParam);
return -1;
@@ -1579,7 +1569,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam)
retv = SetStatus(ID_STATUS_OFFLINE, lParam);
else
retv = SetStatus(ID_STATUS_ONLINE, lParam);
- //LNEnableMenuItem(hMenuHandle ,TRUE);
+ //Menu_EnableItem(hMenuHandle ,TRUE);
diffstat = wParam;
return retv;
// the status has been changed to unknown (maybe run some more code)
@@ -1663,7 +1653,7 @@ static int modulesloaded(WPARAM, LPARAM)
//initialize lotus //TODO: Lotus can terminate miranda process here with msgbox "Shared Memory from a previous Notes/Domino run has been detected, this process will exit now"
startuperror += 4;
running = TRUE;
- LNEnableMenuItem(hMenuHandle, !running);//disable menu cause lotus is not initialized
+ Menu_EnableItem(hMenuHandle, !running);//disable menu cause lotus is not initialized
} else {
log(L"Checking Notes Ini File");
@@ -1745,7 +1735,7 @@ extern "C" int __declspec(dllexport) Load(void)
mi.pszService = "LotusNotify/MenuCommand"; //service name thet listning for menu call
hMenuHandle = Menu_AddMainMenuItem(&mi); //create menu pos.
- LNEnableMenuItem(hMenuHandle ,FALSE);
+ Menu_EnableItem(hMenuHandle ,FALSE);
}
//create protocol
diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp
index 32a5f5e84e..01149affe1 100644
--- a/plugins/Quotes/src/QuoteInfoDlg.cpp
+++ b/plugins/Quotes/src/QuoteInfoDlg.cpp
@@ -269,22 +269,14 @@ int Quotes_OnContactDoubleClick(WPARAM wp, LPARAM/* lp*/)
return 0;
}
-namespace
-{
- void enable_menu(HGENMENU hMenu, bool bEnable)
- {
- Menu_ModifyItem(hMenu, NULL, INVALID_HANDLE_VALUE, (bEnable) ? 0 : CMIF_GRAYED);
- }
-}
-
int Quotes_PrebuildContactMenu(WPARAM wp, LPARAM)
{
- enable_menu(g_hMenuEditSettings, false);
- enable_menu(g_hMenuOpenLogFile, false);
+ Menu_EnableItem(g_hMenuEditSettings, false);
+ Menu_EnableItem(g_hMenuOpenLogFile, false);
#ifdef CHART_IMPLEMENT
- enable_menu(g_hMenuChart,false);
+ Menu_EnableItem(g_hMenuChart,false);
#endif
- enable_menu(g_hMenuRefresh, false);
+ Menu_EnableItem(g_hMenuRefresh, false);
MCONTACT hContact = MCONTACT(wp);
if (NULL == hContact)
@@ -292,9 +284,9 @@ int Quotes_PrebuildContactMenu(WPARAM wp, LPARAM)
return 0;
}
- enable_menu(g_hMenuEditSettings, true);
+ Menu_EnableItem(g_hMenuEditSettings, true);
- enable_menu(g_hMenuRefresh, true);
+ Menu_EnableItem(g_hMenuRefresh, true);
tstring sLogFileName;
bool bThereIsLogFile = (true == get_log_file(hContact, sLogFileName))
@@ -302,9 +294,9 @@ int Quotes_PrebuildContactMenu(WPARAM wp, LPARAM)
if (true == bThereIsLogFile)
{
#ifdef CHART_IMPLEMENT
- enable_menu(g_hMenuChart,true);
+ Menu_EnableItem(g_hMenuChart,true);
#endif
- enable_menu(g_hMenuOpenLogFile, true);
+ Menu_EnableItem(g_hMenuOpenLogFile, true);
}
return 0;
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index a43953e728..33cdd19bfe 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -224,7 +224,7 @@ public:
std::tstring GetAvatarFolder();
bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATION &ai, std::string *url);
void CheckAvatarChange(MCONTACT hContact, const std::string &image_url);
- void ToggleStatusMenuItems(BOOL bEnable);
+ void ToggleStatusMenuItems(bool bEnable);
void StickerAsSmiley(std::string stickerId, const std::string &url, MCONTACT hContact);
void SaveName(MCONTACT hContact, const facebook_user *fbu);
std::string PrepareUrl(std::string url);
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp
index 922c065db7..934dc808a9 100644
--- a/protocols/FacebookRM/src/theme.cpp
+++ b/protocols/FacebookRM/src/theme.cpp
@@ -292,10 +292,9 @@ int FacebookProto::OnBuildStatusMenu(WPARAM, LPARAM)
return 0;
}
-void FacebookProto::ToggleStatusMenuItems(BOOL bEnable)
+void FacebookProto::ToggleStatusMenuItems(bool bEnable)
{
- int flags = (bEnable) ? 0 : CMIF_GRAYED;
- Menu_ModifyItem(m_hMenuRoot, NULL, INVALID_HANDLE_VALUE, flags);
- Menu_ModifyItem(m_hStatusMind, NULL, INVALID_HANDLE_VALUE, flags);
- Menu_ModifyItem(m_hMenuServicesRoot, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_EnableItem(m_hMenuRoot, bEnable);
+ Menu_EnableItem(m_hStatusMind, bEnable);
+ Menu_EnableItem(m_hMenuServicesRoot, bEnable);
}
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 4567f48602..90ccf333b0 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -2298,9 +2298,9 @@ void CIrcProto::OnIrcDisconnected()
memcpy(m_nick, m_pNick, sizeof(m_nick));
setTString("Nick", m_pNick);
- Menu_ModifyItem(hMenuJoin, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
- Menu_ModifyItem(hMenuList, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
- Menu_ModifyItem(hMenuNick, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
+ Menu_EnableItem(hMenuJoin, false);
+ Menu_EnableItem(hMenuList, false);
+ Menu_EnableItem(hMenuNick, false);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index f741aa9525..19033eabdc 100644
--- a/protocols/IRCG/src/options.cpp
+++ b/protocols/IRCG/src/options.cpp
@@ -730,7 +730,7 @@ void CConnectPrefsDlg::OnApply()
m_proto->m_oldStyleModes = m_oldStyle.GetState();
m_proto->m_useServer = m_useServer.GetState();
- Menu_ModifyItem(m_proto->hMenuServer, NULL, INVALID_HANDLE_VALUE, (m_proto->m_useServer) ? 0 : CMIF_GRAYED);
+ Menu_EnableItem(m_proto->hMenuServer, m_proto->m_useServer != 0);
m_proto->m_joinOnInvite = m_autoJoin.GetState();
m_proto->m_hideServerWindow = !m_showServer.GetState();
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index 999ace6c06..53414f2e6c 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -904,19 +904,18 @@ void CJabberProto::EnableMenuItems(BOOL bEnable)
void CJabberProto::CheckMenuItems()
{
- int flags = (m_menuItemsStatus) ? 0 : CMIF_GRAYED;
-
- Menu_ModifyItem(m_hMenuChangePassword, NULL, INVALID_HANDLE_VALUE, flags);
- Menu_ModifyItem(m_hMenuGroupchat, NULL, INVALID_HANDLE_VALUE, flags);
-
- Menu_ModifyItem(m_hMenuPrivacyLists, NULL, INVALID_HANDLE_VALUE, flags);
- Menu_ModifyItem(m_hMenuRosterControl, NULL, INVALID_HANDLE_VALUE, flags);
- Menu_ModifyItem(m_hMenuServiceDiscovery, NULL, INVALID_HANDLE_VALUE, flags);
- Menu_ModifyItem(m_hMenuSDMyTransports, NULL, INVALID_HANDLE_VALUE, flags);
- Menu_ModifyItem(m_hMenuSDTransports, NULL, INVALID_HANDLE_VALUE, flags);
- Menu_ModifyItem(m_hMenuSDConferences, NULL, INVALID_HANDLE_VALUE, flags);
-
- bool bEnabled = m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE);
+ bool bEnabled = (m_menuItemsStatus != 0);
+ Menu_EnableItem(m_hMenuChangePassword, bEnabled);
+ Menu_EnableItem(m_hMenuGroupchat, bEnabled);
+
+ Menu_EnableItem(m_hMenuPrivacyLists, bEnabled);
+ Menu_EnableItem(m_hMenuRosterControl, bEnabled);
+ Menu_EnableItem(m_hMenuServiceDiscovery, bEnabled);
+ Menu_EnableItem(m_hMenuSDMyTransports, bEnabled);
+ Menu_EnableItem(m_hMenuSDTransports, bEnabled);
+ Menu_EnableItem(m_hMenuSDConferences, bEnabled);
+
+ bEnabled = m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE);
Menu_ShowItem(m_hMenuNotes, bEnabled);
Menu_ShowItem(m_hMenuBookmarks, bEnabled);
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp
index 0e87420ca3..7b0b5ae460 100644
--- a/protocols/Tlen/src/tlen_thread.cpp
+++ b/protocols/Tlen/src/tlen_thread.cpp
@@ -340,9 +340,9 @@ void __cdecl TlenServerThread(ThreadData *info)
info->proto->isOnline = FALSE;
info->proto->isConnected = FALSE;
- Menu_ModifyItem(info->proto->hMenuMUC, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
+ Menu_EnableItem(info->proto->hMenuMUC, false);
if (info->proto->hMenuChats != NULL)
- Menu_ModifyItem(info->proto->hMenuChats, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
+ Menu_EnableItem(info->proto->hMenuChats, false);
// Set status to offline
char *szProto = info->proto->m_szModuleName;
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h
index cc6d787b7f..5a3cf8cac9 100644
--- a/protocols/WhatsApp/src/proto.h
+++ b/protocols/WhatsApp/src/proto.h
@@ -125,7 +125,7 @@ private:
{ return ::_InterlockedIncrement(&m_iSerial);
}
- void ToggleStatusMenuItems(BOOL bEnable);
+ void ToggleStatusMenuItems(bool bEnable);
/// Avatars //////////////////////////////////////////////////////////////////////////
diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp
index 9ced4f036d..2d75c8908d 100644
--- a/protocols/WhatsApp/src/theme.cpp
+++ b/protocols/WhatsApp/src/theme.cpp
@@ -83,9 +83,8 @@ int WhatsAppProto::OnBuildStatusMenu(WPARAM wParam, LPARAM lParam)
return 0;
}
-void WhatsAppProto::ToggleStatusMenuItems(BOOL bEnable)
+void WhatsAppProto::ToggleStatusMenuItems(bool bEnable)
{
- int flags = (bEnable) ? 0 : CMIF_GRAYED;
- Menu_ModifyItem(m_hMenuRoot, NULL, INVALID_HANDLE_VALUE, flags);
- Menu_ModifyItem(m_hMenuCreateGroup, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_EnableItem(m_hMenuRoot, bEnable);
+ Menu_EnableItem(m_hMenuCreateGroup, bEnable);
}
diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp
index 9baf333882..d6ada2b63d 100644
--- a/src/mir_app/src/clistmenus.cpp
+++ b/src/mir_app/src/clistmenus.cpp
@@ -605,20 +605,6 @@ INT_PTR FreeOwnerDataStatusMenu(WPARAM, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// Other menu functions
-MIR_APP_DLL(void) Menu_ShowItem(HGENMENU hMenuItem, bool bShow)
-{
- TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
- if (pimi == NULL)
- return;
-
- int flags = pimi->mi.flags;
- if (bShow)
- flags &= ~CMIF_HIDDEN;
- else
- flags |= CMIF_HIDDEN;
- Menu_ModifyItem(hMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
-}
-
INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam)
{
WORD cmd = LOWORD(wParam);
diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/genmenu.cpp
index ef63bd933f..05babf2759 100644
--- a/src/mir_app/src/genmenu.cpp
+++ b/src/mir_app/src/genmenu.cpp
@@ -278,6 +278,40 @@ MIR_APP_DLL(HGENMENU) Menu_GetDefaultItem(HGENMENU hMenu)
/////////////////////////////////////////////////////////////////////////////////////////
+static void Menu_SetItemFlags(HGENMENU hMenuItem, bool bSet, int mask)
+{
+ TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
+ if (pimi == NULL)
+ return;
+
+ int flags = pimi->mi.flags;
+ if (bSet)
+ flags |= mask;
+ else
+ flags &= ~mask;
+
+ mir_cslock lck(csMenuHook);
+ int oldflags = (pimi->mi.flags & CMIF_ROOTHANDLE);
+ pimi->mi.flags = flags | oldflags;
+}
+
+MIR_APP_DLL(void) Menu_EnableItem(HGENMENU hMenuItem, bool bEnable)
+{
+ Menu_SetItemFlags(hMenuItem, !bEnable, CMIF_GRAYED);
+}
+
+MIR_APP_DLL(void) Menu_ShowItem(HGENMENU hMenuItem, bool bShow)
+{
+ Menu_SetItemFlags(hMenuItem, !bShow, CMIF_HIDDEN);
+}
+
+MIR_APP_DLL(void) Menu_SetChecked(HGENMENU hMenuItem, bool bSet)
+{
+ Menu_SetItemFlags(hMenuItem, bSet, CMIF_CHECKED);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HANDLE hIcon, int iFlags)
{
if (!bIsGenMenuInited)
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index ee225cae3c..4b2e9ec4fe 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -218,3 +218,5 @@ Menu_GetItemInfo @215
Menu_ProcessHotKey @216
Menu_DrawItem @217
Menu_MeasureItem @218
+Menu_EnableItem @219
+Menu_SetChecked @220
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index e0a756b14f..bb17f0e413 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -218,3 +218,5 @@ Menu_GetItemInfo @215
Menu_ProcessHotKey @216
Menu_DrawItem @217
Menu_MeasureItem @218
+Menu_EnableItem @219
+Menu_SetChecked @220