From be489c4e6f4c1ab4b4d7f84e35a73e34e1b0b331 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 25 Jun 2015 23:34:47 +0000 Subject: - Menu_EnableItem & Menu_SetChecked - more suitable helpers to set flags; - fix for checks in frame menus; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@14389 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp | 233 +++++++++------------ plugins/Clist_modern/src/CLUIFrames/cluiframes.h | 20 +- plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp | 8 +- .../Clist_modern/src/hdr/modern_commonprototypes.h | 2 +- plugins/Clist_modern/src/modern_skinengine.cpp | 12 +- 5 files changed, 122 insertions(+), 153 deletions(-) (limited to 'plugins/Clist_modern/src') 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; -- cgit v1.2.3