summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src/CLUIFrames
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-27 11:09:19 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-27 11:09:19 +0000
commitab4abbb7a60f941acab8f0566c6b619f68f1b489 (patch)
treea67f4d3bde6bb59d3c49195a8c6e9085e01124eb /plugins/Clist_modern/src/CLUIFrames
parent9d65ee38c92c7a0656ddc6c4c26017b7226fc44b (diff)
- CLISTMENUITEM::pszContactOwner removed, because it's supported only by contact's menu;
- Menu_AddContactMenuItem now receives parameter szProto; - Menu_Add* helpers are converted into real functions; git-svn-id: http://svn.miranda-ng.org/main/trunk@14409 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src/CLUIFrames')
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp308
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/cluiframes.h6
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp47
3 files changed, 139 insertions, 222 deletions
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
index 989a515ea7..ca7f000fbc 100644
--- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
@@ -69,7 +69,7 @@ static int _iNextFrameId = 100;
static HFONT _hTitleBarFont = NULL;
// menus
-static FrameMenuHandles cont = { NULL };
+static FrameMenuHandles cont = { NULL };
// others
static int _nContactListHeight = 0;
@@ -101,7 +101,7 @@ static int sortfunc(const void *a, const void *b)
sd1 = (SortData *)a;
sd2 = (SortData *)b;
if (sd1->order > sd2->order) { return(1); };
- if (sd1->order < sd2->order) { return(-1); };
+ if (sd1->order < sd2->order) return -1;;
return (0);
};
int CLUIFrames_OnMoving(HWND hwnd, RECT *r)
@@ -749,7 +749,17 @@ static int CLUIFramesGetalClientFrame(void)
return -1;
}
-static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGENMENU(*pfnAdd)(CLISTMENUITEM*))
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static HGENMENU addFrameMenuItem(CLISTMENUITEM *pmi, int frameid, bool bMain)
+{
+ HGENMENU res = (bMain) ? Menu_AddMainMenuItem(pmi) : Menu_AddContextFrameMenuItem(pmi);
+ if (pmi->pszService != NULL)
+ Menu_ConfigureItem(res, MCI_OPT_EXECPARAM, frameid);
+ return res;
+}
+
+static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, bool bMain)
{
if (_fCluiFramesModuleNotStarted)
return NULL;
@@ -760,92 +770,85 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp
CLISTMENUITEM mi = { 0 };
mi.hParentMenu = root;
mi.position = popuppos++;
- mi.pszName = LPGEN("&Visible");
+ mi.name.a = LPGEN("&Visible");
mi.flags = CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SHFRAME;
- Menu_ConfigureItem(fmh.MIVisible = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
+ fmh.MIVisible = addFrameMenuItem(&mi, frameid, bMain);
popuppos += 100000;
mi.position = popuppos++;
- mi.pszName = LPGEN("&Show title");
+ mi.name.a = LPGEN("&Show title");
mi.pszService = MS_CLIST_FRAMES_SHFRAMETITLEBAR;
- Menu_ConfigureItem(fmh.MITBVisible = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
+ fmh.MITBVisible = addFrameMenuItem(&mi, frameid, bMain);
mi.position = popuppos++;
- mi.pszName = LPGEN("&Locked");
+ mi.name.a = LPGEN("&Locked");
mi.pszService = MS_CLIST_FRAMES_ULFRAME;
- Menu_ConfigureItem(fmh.MILock = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
+ fmh.MILock = addFrameMenuItem(&mi, frameid, bMain);
mi.position = popuppos++;
- mi.pszName = LPGEN("&Expanded");
+ mi.name.a = LPGEN("&Expanded");
mi.pszService = MS_CLIST_FRAMES_UCOLLFRAME;
- Menu_ConfigureItem(fmh.MIColl = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
+ fmh.MIColl = addFrameMenuItem(&mi, frameid, bMain);
// floating
mi.position = popuppos++;
- mi.pszName = LPGEN("&Floating mode");
+ mi.name.a = LPGEN("&Floating mode");
mi.flags = 0;
mi.pszService = "Set_Floating";
- Menu_ConfigureItem(fmh.MIFloating = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
+ fmh.MIFloating = addFrameMenuItem(&mi, frameid, bMain);
mi.position = popuppos++;
- mi.pszName = LPGEN("&Border");
+ mi.name.a = LPGEN("&Border");
mi.flags = CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SETUNBORDER;
- Menu_ConfigureItem(fmh.MIBorder = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
+ fmh.MIBorder = addFrameMenuItem(&mi, frameid, bMain);
popuppos += 100000;
// alignment root
mi.position = popuppos++;
- mi.pszName = LPGEN("&Align");
+ mi.name.a = LPGEN("&Align");
mi.flags = 0;
- mi.pszService = "";
- fmh.MIAlignRoot = pfnAdd(&mi);
+ mi.pszService = NULL;
+ fmh.MIAlignRoot = addFrameMenuItem(&mi, frameid, bMain);
// align top
mi.hParentMenu = fmh.MIAlignRoot;
mi.position = popuppos++;
- mi.pszName = LPGEN("&Top");
+ mi.name.a = LPGEN("&Top");
mi.pszService = CLUIFRAMESSETALIGNALTOP;
- mi.pszContactOwner = (char*)alTop;
- Menu_ConfigureItem(fmh.MIAlignTop = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
+ fmh.MIAlignTop = addFrameMenuItem(&mi, frameid, bMain);
// align client
mi.position = popuppos++;
- mi.pszName = LPGEN("&Client");
+ mi.name.a = LPGEN("&Client");
mi.pszService = CLUIFRAMESSETALIGNALCLIENT;
- mi.pszContactOwner = (char*)alClient;
- Menu_ConfigureItem(fmh.MIAlignClient = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
+ fmh.MIAlignClient = addFrameMenuItem(&mi, frameid, bMain);
// align bottom
mi.position = popuppos++;
- mi.pszName = LPGEN("&Bottom");
+ mi.name.a = LPGEN("&Bottom");
mi.pszService = CLUIFRAMESSETALIGNALBOTTOM;
- mi.pszContactOwner = (char*)alBottom;
- Menu_ConfigureItem(fmh.MIAlignBottom = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
+ fmh.MIAlignBottom = addFrameMenuItem(&mi, frameid, bMain);
// position root
mi.hParentMenu = root;
mi.position = popuppos++;
- mi.pszName = LPGEN("&Position");
- mi.pszService = "";
- mi.pszContactOwner = (char*)0;
- fmh.MIPosRoot = pfnAdd(&mi);
+ mi.name.a = LPGEN("&Position");
+ mi.pszService = NULL;
+ mi.hParentMenu = addFrameMenuItem(&mi, frameid, bMain);
- mi.hParentMenu = fmh.MIPosRoot;
mi.position = popuppos++;
- mi.pszName = LPGEN("&Up");
+ mi.name.a = LPGEN("&Up");
mi.pszService = CLUIFRAMESMOVEUP;
- mi.pszContactOwner = (char*)1;
- Menu_ConfigureItem(fmh.MIPosUp = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
+ addFrameMenuItem(&mi, frameid, bMain);
mi.position = popuppos++;
- mi.pszName = LPGEN("&Down");
+ mi.name.a = LPGEN("&Down");
mi.pszService = CLUIFRAMESMOVEDOWN;
- mi.pszContactOwner = (char*)-1;
- Menu_ConfigureItem(fmh.MIPosDown = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
+ addFrameMenuItem(&mi, frameid, bMain);
return 0;
}
@@ -916,81 +919,58 @@ static int CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM)
static INT_PTR _us_DoGetFrameOptions(WPARAM wParam, LPARAM)
{
- INT_PTR retval;
- BOOL bUnicodeText = (LOWORD(wParam) & FO_UNICODETEXT) != 0;
- wParam = MAKEWPARAM((LOWORD(wParam)) & ~FO_UNICODETEXT, HIWORD(wParam));
-
- if (_fCluiFramesModuleNotStarted) return -1;
+ if (_fCluiFramesModuleNotStarted)
+ return -1;
int pos = id2pos(HIWORD(wParam));
if (pos < 0 || pos >= g_nFramesCount)
return -1;
- switch (LOWORD(wParam)) {
- case FO_FLAGS:
- retval = 0;
- if (g_pfwFrames[pos].visible) retval |= F_VISIBLE;
- if (!g_pfwFrames[pos].collapsed) retval |= F_UNCOLLAPSED;
- if (g_pfwFrames[pos].Locked) retval |= F_LOCKED;
- if (g_pfwFrames[pos].TitleBar.ShowTitleBar) retval |= F_SHOWTB;
- if (g_pfwFrames[pos].TitleBar.ShowTitleBarTip) retval |= F_SHOWTBTIP;
- if (!g_CluiData.fLayered) {
- if (!(GetWindowLongPtr(g_pfwFrames[pos].hWnd, GWL_STYLE)&WS_BORDER))
- retval |= F_NOBORDER;
- }
- else if (!g_pfwFrames[pos].UseBorder)
- retval |= F_NOBORDER;
- break;
-
+ switch (LOWORD(wParam) & ~FO_UNICODETEXT) {
case FO_NAME:
- if (bUnicodeText)
- retval = (INT_PTR)g_pfwFrames[pos].name;
- else
- retval = (INT_PTR)g_pfwFrames[pos].szName;
- break;
+ return (INT_PTR)g_pfwFrames[pos].name;
case FO_TBNAME:
- if (bUnicodeText)
- retval = (INT_PTR)g_pfwFrames[pos].TitleBar.tbname;
- else
- retval = (INT_PTR)g_pfwFrames[pos].TitleBar.sztbname;
- break;
+ return (INT_PTR)g_pfwFrames[pos].TitleBar.tbname;
case FO_TBTIPNAME:
- if (bUnicodeText)
- retval = (INT_PTR)g_pfwFrames[pos].TitleBar.tooltip;
- else
- retval = (INT_PTR)g_pfwFrames[pos].TitleBar.sztooltip;
- break;
+ return (INT_PTR)g_pfwFrames[pos].TitleBar.tooltip;
case FO_TBSTYLE:
- retval = GetWindowLongPtr(g_pfwFrames[pos].TitleBar.hwnd, GWL_STYLE);
- break;
+ return GetWindowLongPtr(g_pfwFrames[pos].TitleBar.hwnd, GWL_STYLE);
case FO_TBEXSTYLE:
- retval = GetWindowLongPtr(g_pfwFrames[pos].TitleBar.hwnd, GWL_EXSTYLE);
- break;
+ return GetWindowLongPtr(g_pfwFrames[pos].TitleBar.hwnd, GWL_EXSTYLE);
case FO_ICON:
- retval = (INT_PTR)g_pfwFrames[pos].TitleBar.hicon;
- break;
+ return (INT_PTR)g_pfwFrames[pos].TitleBar.hicon;
case FO_HEIGHT:
- retval = (INT_PTR)g_pfwFrames[pos].height;
- break;
+ return (INT_PTR)g_pfwFrames[pos].height;
case FO_ALIGN:
- retval = (INT_PTR)g_pfwFrames[pos].align;
- break;
+ return (INT_PTR)g_pfwFrames[pos].align;
+
case FO_FLOATING:
- retval = (INT_PTR)g_pfwFrames[pos].floating;
- break;
- default:
- retval = -1;
- break;
+ return (INT_PTR)g_pfwFrames[pos].floating;
+
+ case FO_FLAGS:
+ INT_PTR retval = 0;
+ if (g_pfwFrames[pos].visible) retval |= F_VISIBLE;
+ if (!g_pfwFrames[pos].collapsed) retval |= F_UNCOLLAPSED;
+ if (g_pfwFrames[pos].Locked) retval |= F_LOCKED;
+ if (g_pfwFrames[pos].TitleBar.ShowTitleBar) retval |= F_SHOWTB;
+ if (g_pfwFrames[pos].TitleBar.ShowTitleBarTip) retval |= F_SHOWTBTIP;
+ if (!g_CluiData.fLayered) {
+ if (!(GetWindowLongPtr(g_pfwFrames[pos].hWnd, GWL_STYLE)&WS_BORDER))
+ retval |= F_NOBORDER;
+ }
+ else if (!g_pfwFrames[pos].UseBorder)
+ retval |= F_NOBORDER;
+ return retval;
}
- return retval;
+ return -1;
}
static int UpdateTBToolTip(int framepos)
@@ -1059,47 +1039,37 @@ static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam)
return -1;
mir_free(fw.name);
- mir_free(fw.szName);
- if (bUnicodeText) {
+ if (bUnicodeText)
fw.name = mir_tstrdup((LPTSTR)lParam);
- fw.szName = mir_t2a((LPTSTR)lParam);
- }
- else {
- fw.szName = mir_strdup((char*)lParam);
+ else
fw.name = mir_a2t((char *)lParam);
- }
return 0;
case FO_TBNAME:
- if (lParam == 0) { return(-1); }
+ if (lParam == 0)
+ return -1;
mir_free(fw.TitleBar.tbname);
- mir_free(fw.TitleBar.sztbname);
- if (bUnicodeText) {
+ if (bUnicodeText)
fw.TitleBar.tbname = mir_tstrdup((LPTSTR)lParam);
- fw.TitleBar.sztbname = mir_t2a((LPTSTR)lParam);
- }
- else {
- fw.TitleBar.sztbname = mir_strdup((char*)lParam);
+ else
fw.TitleBar.tbname = mir_a2t((char*)lParam);
- }
if (fw.floating && (fw.TitleBar.tbname != NULL))
SetWindowText(fw.ContainerWnd, fw.TitleBar.tbname);
return 0;
case FO_TBTIPNAME:
- if (lParam == 0) { return(-1); }
- if (fw.TitleBar.tooltip != NULL) mir_free_and_nil(fw.TitleBar.tooltip);
- if (fw.TitleBar.sztooltip != NULL) mir_free_and_nil(fw.TitleBar.sztooltip);
- if (bUnicodeText) {
+ if (lParam == 0)
+ return -1;
+
+ if (fw.TitleBar.tooltip != NULL)
+ mir_free_and_nil(fw.TitleBar.tooltip);
+ if (bUnicodeText)
fw.TitleBar.tooltip = mir_tstrdup((LPTSTR)lParam);
- fw.TitleBar.sztooltip = mir_t2a((LPTSTR)lParam);
- }
- else {
- fw.TitleBar.sztooltip = mir_strdup((char*)lParam);
+ else
fw.TitleBar.tooltip = mir_a2t((char*)lParam);
- }
+
UpdateTBToolTip(pos);
return 0;
@@ -1520,20 +1490,20 @@ static int CLUIFramesLoadMainMenu()
CLISTMENUITEM mi = { 0 };
mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_FRAME);
mi.position = 3000090000;
- mi.pszName = LPGEN("Frames");
+ mi.name.a = LPGEN("Frames");
cont.MainMenuItem = Menu_AddMainMenuItem(&mi);
// create frames menu
int separator = 3000200000;
for (int i = 0; i < g_nFramesCount; i++) {
- mi.hIcon = g_pfwFrames[i].TitleBar.hicon;
+ mi.icolibItem = g_pfwFrames[i].TitleBar.hicon;
mi.flags = CMIF_TCHAR;
mi.position = separator;
mi.hParentMenu = cont.MainMenuItem;
- mi.ptszName = g_pfwFrames[i].TitleBar.tbname ? g_pfwFrames[i].TitleBar.tbname : g_pfwFrames[i].name;
+ mi.name.t = 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);
- CLUIFramesCreateMenuForFrame(g_pfwFrames[i].id, g_pfwFrames[i].MenuHandles.MainMenuItem, separator, Menu_AddMainMenuItem);
+ CLUIFramesCreateMenuForFrame(g_pfwFrames[i].id, g_pfwFrames[i].MenuHandles.MainMenuItem, separator, true);
CLUIFramesModifyMainMenuItems(g_pfwFrames[i].id, 0);
CallService(MS_CLIST_FRAMEMENUNOTIFY, (WPARAM)g_pfwFrames[i].id, (LPARAM)g_pfwFrames[i].MenuHandles.MainMenuItem);
separator++;
@@ -1542,23 +1512,23 @@ static int CLUIFramesLoadMainMenu()
separator += 100000;
// create "show all frames" menu
- mi.hIcon = NULL;
+ mi.icolibItem = NULL;
mi.flags = 0;
mi.position = separator++;
mi.hParentMenu = cont.MainMenuItem;
- mi.pszName = LPGEN("Show all frames");
+ mi.name.a = LPGEN("Show all frames");
mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMES;
Menu_AddMainMenuItem(&mi);
// create "show all titlebars" menu
mi.position = separator++;
- mi.pszName = LPGEN("Show all title bars");
+ mi.name.a = LPGEN("Show all title bars");
mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMESTB;
Menu_AddMainMenuItem(&mi);
// create "hide all titlebars" menu
mi.position = separator++;
- mi.pszName = LPGEN("Hide all title bars");
+ mi.name.a = LPGEN("Hide all title bars");
mi.pszService = MS_CLIST_FRAMES_HIDEALLFRAMESTB;
Menu_AddMainMenuItem(&mi);
return 0;
@@ -1618,32 +1588,29 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM)
g_pfwFrames[g_nFramesCount].name = (LPTSTR)mir_alloc(255 * sizeof(TCHAR));
GetClassName(g_pfwFrames[g_nFramesCount].hWnd, g_pfwFrames[g_nFramesCount].name, 255);
}
- else {
- g_pfwFrames[g_nFramesCount].name = (clfrm->Flags&F_UNICODE) ? mir_u2t(clfrm->wname) : mir_a2t(clfrm->name);
- }
- g_pfwFrames[g_nFramesCount].szName = mir_t2a(g_pfwFrames[g_nFramesCount].name);
+ else g_pfwFrames[g_nFramesCount].name = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->wname) : mir_a2t(clfrm->name);
+
if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == NULL
|| ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->TBwname) : mir_strlen(clfrm->TBname)) == 0)
g_pfwFrames[g_nFramesCount].TitleBar.tbname = mir_tstrdup(g_pfwFrames[g_nFramesCount].name);
else
- g_pfwFrames[g_nFramesCount].TitleBar.tbname = (clfrm->Flags&F_UNICODE) ? mir_u2t(clfrm->TBwname) : mir_a2t(clfrm->TBname);
- g_pfwFrames[g_nFramesCount].TitleBar.sztbname = mir_t2a(g_pfwFrames[g_nFramesCount].TitleBar.tbname);
+ g_pfwFrames[g_nFramesCount].TitleBar.tbname = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->TBwname) : mir_a2t(clfrm->TBname);
+
g_pfwFrames[g_nFramesCount].needhide = FALSE;
- g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBar = (clfrm->Flags&F_SHOWTB ? TRUE : FALSE);
- g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBarTip = (clfrm->Flags&F_SHOWTBTIP ? TRUE : FALSE);
+ g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBar = (clfrm->Flags & F_SHOWTB ? TRUE : FALSE);
+ g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBarTip = (clfrm->Flags & F_SHOWTBTIP ? TRUE : FALSE);
- g_pfwFrames[g_nFramesCount].collapsed = (clfrm->Flags&F_UNCOLLAPSED) ? FALSE : TRUE;
+ g_pfwFrames[g_nFramesCount].collapsed = (clfrm->Flags & F_UNCOLLAPSED) ? FALSE : TRUE;
- g_pfwFrames[g_nFramesCount].Locked = clfrm->Flags&F_LOCKED ? TRUE : FALSE;
- g_pfwFrames[g_nFramesCount].visible = clfrm->Flags&F_VISIBLE ? TRUE : FALSE;
+ g_pfwFrames[g_nFramesCount].Locked = clfrm->Flags & F_LOCKED ? TRUE : FALSE;
+ g_pfwFrames[g_nFramesCount].visible = clfrm->Flags & F_VISIBLE ? TRUE : FALSE;
g_pfwFrames[g_nFramesCount].UseBorder = ((clfrm->Flags&F_NOBORDER) || g_CluiData.fLayered) ? FALSE : TRUE;
//Frames[nFramescount].OwnerWindow = 0;
- g_pfwFrames[g_nFramesCount].TitleBar.hwnd
- = CreateWindow(CLUIFrameTitleBarClassName, g_pfwFrames[g_nFramesCount].name,
+ g_pfwFrames[g_nFramesCount].TitleBar.hwnd = CreateWindow(CLUIFrameTitleBarClassName, g_pfwFrames[g_nFramesCount].name,
(db_get_b(0, CLUIFrameModule, "RemoveAllTitleBarBorders", 1) ? 0 : WS_BORDER)
| WS_CHILD | WS_CLIPCHILDREN |
(g_pfwFrames[g_nFramesCount].TitleBar.ShowTitleBar ? WS_VISIBLE : 0) |
@@ -1651,8 +1618,7 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM)
0, 0, 0, 0, pcli->hwndContactList, NULL, g_hInst, NULL);
SetWindowLongPtr(g_pfwFrames[g_nFramesCount].TitleBar.hwnd, GWLP_USERDATA, g_pfwFrames[g_nFramesCount].id);
- g_pfwFrames[g_nFramesCount].TitleBar.hwndTip
- = CreateWindowEx(0, TOOLTIPS_CLASS, NULL,
+ g_pfwFrames[g_nFramesCount].TitleBar.hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
@@ -1740,14 +1706,11 @@ static int _us_DoRemoveFrame(WPARAM wParam, LPARAM)
pos = id2pos(wParam);
- if (pos < 0 || pos>g_nFramesCount) { return(-1); };
+ if (pos < 0 || pos>g_nFramesCount) return -1;;
mir_free_and_nil(g_pfwFrames[pos].name);
- mir_free_and_nil(g_pfwFrames[pos].szName);
mir_free_and_nil(g_pfwFrames[pos].TitleBar.tbname);
- mir_free_and_nil(g_pfwFrames[pos].TitleBar.sztbname);
mir_free_and_nil(g_pfwFrames[pos].TitleBar.tooltip);
- mir_free_and_nil(g_pfwFrames[pos].TitleBar.sztooltip);
DestroyWindow(g_pfwFrames[pos].hWnd);
g_pfwFrames[pos].hWnd = (HWND)-1;
DestroyWindow(g_pfwFrames[pos].TitleBar.hwnd);
@@ -1990,7 +1953,7 @@ static int CLUIFramesResizeFrames(const RECT newsize)
{
//sorting stuff
sdarray = (SortData*)malloc(sizeof(SortData)*g_nFramesCount);
- if (sdarray == NULL) { return(-1); };
+ if (sdarray == NULL) return -1;;
for (i = 0; i < g_nFramesCount; i++) {
sdarray[i].order = g_pfwFrames[i].order;
sdarray[i].realpos = i;
@@ -2779,21 +2742,16 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam
int pos;
//tbinfo
{
- char TBcapt[255];
-
-
+ TCHAR TBcapt[255];
pos = id2pos(Frameid);
-
if (pos != -1) {
int oldflags;
-
- mir_snprintf(TBcapt, _countof(TBcapt), "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
- g_pfwFrames[pos].szName, g_pfwFrames[pos].height, g_pfwFrames[pos].visible, g_pfwFrames[pos].floating,
+ mir_sntprintf(TBcapt, _countof(TBcapt), _T("%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d"),
+ g_pfwFrames[pos].name, g_pfwFrames[pos].height, g_pfwFrames[pos].visible, g_pfwFrames[pos].floating,
g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y,
g_pfwFrames[pos].FloatingSize.x, g_pfwFrames[pos].FloatingSize.y,
- g_pfwFrames[pos].order
- );
+ g_pfwFrames[pos].order);
oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, g_pfwFrames[pos].id), 0);
if (!(oldflags&F_SHOWTBTIP)) {
@@ -3041,7 +2999,6 @@ static int CLUIFrameResizeFloatingFrame(int framepos)
if (g_pfwFrames[framepos].TitleBar.ShowTitleBar) {
CLUI_ShowWindowMod(g_pfwFrames[framepos].TitleBar.hwnd, SW_SHOW/*NOACTIVATE*/);
- //if (Frames[framepos].Locked){return 0;};
g_pfwFrames[framepos].height = height - DEFAULT_TITLEBAR_HEIGHT;
SetWindowPos(g_pfwFrames[framepos].TitleBar.hwnd, HWND_TOP, 0, 0, width, DEFAULT_TITLEBAR_HEIGHT, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_DRAWFRAME);
@@ -3049,20 +3006,13 @@ static int CLUIFrameResizeFloatingFrame(int framepos)
}
else {
- //SetWindowPos(Frames[framepos].TitleBar.hwnd,HWND_TOP, 0, 0, width,DEFAULT_TITLEBAR_HEIGHT,SWP_SHOWWINDOW|SWP_NOMOVE);
- //if (Frames[framepos].Locked){return 0;};
g_pfwFrames[framepos].height = height;
CLUI_ShowWindowMod(g_pfwFrames[framepos].TitleBar.hwnd, SW_HIDE);
SetWindowPos(g_pfwFrames[framepos].hWnd, HWND_TOP, 0, 0, width, height, SWP_SHOWWINDOW | SWP_NOACTIVATE);
};
- // CLUIFramesForceUpdateFrame(&Frames[framepos]);
if (g_pfwFrames[framepos].ContainerWnd != 0) UpdateWindow(g_pfwFrames[framepos].ContainerWnd);
- //GetClientRect(Frames[framepos].TitleBar.hwnd,&Frames[framepos].TitleBar.wndSize);
GetWindowRect(g_pfwFrames[framepos].hWnd, &g_pfwFrames[framepos].wndSize);
- //Frames[framepos].height = Frames[framepos].wndSize.bottom-Frames[framepos].wndSize.top;
- //GetClientRect(Frames[framepos].hWnd,&Frames[framepos].wndSize);
- //Frames[framepos].height = Frames[framepos].wndSize.bottom-Frames[framepos].wndSize.top;
return 0;
};
@@ -3385,43 +3335,18 @@ int CLUIFrameOnModulesLoad(WPARAM, LPARAM)
{
/* HOOK */
CLUIFramesLoadMainMenu();
- CLUIFramesCreateMenuForFrame(-1, NULL, 000010000, Menu_AddContextFrameMenuItem);
+ CLUIFramesCreateMenuForFrame(-1, NULL, 000010000, false);
return 0;
}
int CLUIFrameOnModulesUnload(WPARAM, LPARAM)
{
- g_CluiData.bSTATE = STATE_PREPEARETOEXIT;
+ g_CluiData.bSTATE = STATE_PREPARETOEXIT;
- if (!cont.MIVisible)
- return 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();
+ if (cont.MIVisible) {
+ cont.MIVisible = NULL;
+ _AniAva_OnModulesUnload();
+ }
return 0;
}
@@ -3510,11 +3435,8 @@ int UnLoadCLUIFramesModule(void)
if (g_pfwFrames[i].UpdateRgn) DeleteObject(g_pfwFrames[i].UpdateRgn);
mir_free_and_nil(g_pfwFrames[i].name);
- mir_free_and_nil(g_pfwFrames[i].szName);
mir_free_and_nil(g_pfwFrames[i].TitleBar.tbname);
- mir_free_and_nil(g_pfwFrames[i].TitleBar.sztbname);
mir_free_and_nil(g_pfwFrames[i].TitleBar.tooltip);
- mir_free_and_nil(g_pfwFrames[i].TitleBar.sztooltip);
}
free(g_pfwFrames);
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.h b/plugins/Clist_modern/src/CLUIFrames/cluiframes.h
index b4d89866b3..09af1b44f2 100644
--- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.h
+++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.h
@@ -62,7 +62,7 @@ struct FrameMenuHandles
HGENMENU MainMenuItem;
HGENMENU MIVisible, MITitle, MITBVisible, MILock, MIColl, MIFloating, MIAlignRoot;
HGENMENU MIAlignTop, MIAlignClient, MIAlignBottom;
- HGENMENU MIBorder, MIPosRoot, MIPosUp, MIPosDown;
+ HGENMENU MIBorder;
};
struct FrameTitleBar
@@ -74,9 +74,6 @@ struct FrameTitleBar
LPTSTR tbname;
LPTSTR tooltip;
- char * sztbname;
- char * sztooltip;
-
HMENU hmenu;
HICON hicon;
@@ -101,7 +98,6 @@ struct FRAMEWND
HWND hWnd;
RECT wndSize;
LPTSTR name;
- LPSTR szName;
int align;
int height;
int dwFlags;
diff --git a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp
index 0c6a9a5e77..a63d2279ae 100644
--- a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp
+++ b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp
@@ -84,7 +84,7 @@ static INT_PTR AddGroupMenuItem(WPARAM wParam, LPARAM lParam)
HGENMENU hNewItem = Menu_AddItem(hGroupMenuObject, &tmi);
char buf[1024];
- mir_snprintf(buf, "%s/%s", mi->pszService, mi->pszName);
+ mir_snprintf(buf, "%s/%s", mi->pszService, mi->name.a);
Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, buf);
return (INT_PTR)hNewItem;
}
@@ -229,43 +229,43 @@ void InitGroupMenus(void)
mi.position = 1900000;
mi.pszService = "CloseAction";
mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_EXIT);
- mi.pszName = LPGEN("E&xit");
+ mi.name.a = LPGEN("E&xit");
AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 500;
mi.pszService = MS_CLIST_SHOWHIDE;
mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_SHOWHIDE);
- mi.pszName = LPGEN("&Hide/show");
+ mi.name.a = LPGEN("&Hide/show");
hHideShowMainMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 200000;
mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_FINDUSER);
mi.pszService = "FindAdd/FindAddCommand";
- mi.pszName = LPGEN("&Find/add contacts...");
+ mi.name.a = LPGEN("&Find/add contacts...");
AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 300000;
mi.pszService = "";
mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_MAINMENU);
- mi.pszName = LPGEN("&Main menu");
+ mi.name.a = LPGEN("&Main menu");
hGroupMainMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 300100;
mi.pszService = "";
mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_STATUS);
- mi.pszName = LPGEN("&Status");
+ mi.name.a = LPGEN("&Status");
hGroupStatusMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 400000;
mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_OPTIONS);
mi.pszService = "Options/OptionsCommand";
- mi.pszName = LPGEN("&Options...");
+ mi.name.a = LPGEN("&Options...");
AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 500000;
mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA);
mi.pszService = "Help/AboutCommand";
- mi.pszName = LPGEN("&About");
+ mi.name.a = LPGEN("&About");
AddGroupMenuItem(0, (LPARAM)&mi);
GroupMenuParam gmp = {};
@@ -273,31 +273,31 @@ void InitGroupMenus(void)
mi.position = 100000;
mi.icolibItem = iconItem[0].hIcolib;
mi.pszService = "CLISTMENUSGroup/CreateGroupHelper";
- mi.pszName = LPGEN("&New group");
+ mi.name.a = LPGEN("&New group");
hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);
- DestroyIcon_protect(mi.hIcon);
+ DestroyIcon_protect((HICON)mi.icolibItem);
mi.position = 100001;
- mi.hIcon = NULL;
+ mi.icolibItem = NULL;
mi.icolibItem = NULL;
mi.pszService = MS_CLIST_SETHIDEOFFLINE;
- mi.pszName = LPGEN("&Hide offline users");
+ mi.name.a = LPGEN("&Hide offline users");
gmp.lParam = 0; gmp.wParam = -1;
hHideOfflineUsersMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);
mi.position = 100002;
mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper";
- mi.pszName = LPGEN("Hide &offline users out here");
+ mi.name.a = LPGEN("Hide &offline users out here");
hHideOfflineUsersOutHereMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 100003;
mi.pszService = "CLISTMENUSGroup/HideGroupsHelper";
- mi.pszName = LPGEN("Hide &empty groups");
+ mi.name.a = LPGEN("Hide &empty groups");
hHideEmptyGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
mi.position = 100004;
mi.pszService = "CLISTMENUSGroup/UseGroupsHelper";
- mi.pszName = LPGEN("Disable &groups");
+ mi.name.a = LPGEN("Disable &groups");
hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
}
@@ -384,7 +384,7 @@ static INT_PTR AddSubGroupMenuItem(WPARAM wParam, LPARAM lParam)
HGENMENU hNewItem = Menu_AddItem(hSubGroupMenuObject, &tmi);
char buf[1024];
- mir_snprintf(buf, "%s/%s", mi->pszService, mi->pszName);
+ mir_snprintf(buf, "%s/%s", mi->pszService, mi->name.a);
Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, buf);
return (INT_PTR)hNewItem;
}
@@ -472,25 +472,24 @@ void InitSubGroupMenus(void)
mi.position = 1000;
mi.icolibItem = iconItem[0].hIcolib;
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
- mi.pszName = LPGEN("&New subgroup");
+ mi.name.a = LPGEN("&New subgroup");
gmp.lParam = 0;
gmp.wParam = POPUP_NEWSUBGROUP;
hNewSubGroupMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);
- DestroyIcon_protect(mi.hIcon);
mi.position = 1001;
- mi.hIcon = NULL;
+ mi.icolibItem = NULL;
mi.icolibItem = NULL;
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
- mi.pszName = LPGEN("&Hide offline users in here");
+ mi.name.a = LPGEN("&Hide offline users in here");
gmp.lParam = 0;
gmp.wParam = POPUP_GROUPHIDEOFFLINE;
hHideOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);
mi.position = 1002;
- mi.hIcon = NULL;
+ mi.icolibItem = NULL;
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
- mi.pszName = LPGEN("&Show offline users in here");
+ mi.name.a = LPGEN("&Show offline users in here");
gmp.lParam = 0;
gmp.wParam = POPUP_GROUPSHOWOFFLINE;
hShowOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);
@@ -499,7 +498,7 @@ void InitSubGroupMenus(void)
mi.position = 900001;
mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_RENAME);
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
- mi.pszName = LPGEN("&Rename group");
+ mi.name.a = LPGEN("&Rename group");
gmp.lParam = 0;
gmp.wParam = POPUP_RENAMEGROUP;
AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);
@@ -507,7 +506,7 @@ void InitSubGroupMenus(void)
mi.position = 900002;
mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_DELETE);
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
- mi.pszName = LPGEN("&Delete group");
+ mi.name.a = LPGEN("&Delete group");
gmp.lParam = 0;
gmp.wParam = POPUP_DELETEGROUP;
AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);