summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-26 19:04:26 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-26 19:04:26 +0000
commitb52ba14782bc2e5fc3eb7452dcebe67bfed095f1 (patch)
tree83241babcd4b2ddb2f424801a3d2f78b0087b213
parent6832a62358ac308843016c7d133c0feaeca4549b (diff)
final fix for the frame menus
git-svn-id: http://svn.miranda-ng.org/main/trunk@14402 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp293
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/cluiframes.h6
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp193
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.h6
-rw-r--r--src/mir_app/src/framesmenu.cpp61
5 files changed, 248 insertions, 311 deletions
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
index 8f364c467f..6128f93967 100644
--- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
@@ -36,7 +36,7 @@ static const int DEFAULT_TITLEBAR_HEIGHT = 18;
void _AniAva_OnModulesUnload();
-//GLOBALS
+// GLOBALS
FRAMEWND *g_pfwFrames = NULL;
int g_nFramesCount = 0;
int g_nTitleBarHeight = DEFAULT_TITLEBAR_HEIGHT;
@@ -339,7 +339,6 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY)
RECT rc;
RECT rcThumb;
RECT rcOld;
- SIZE sizeScreen;
int nNewX;
int nNewY;
int nOffs = 10;
@@ -358,6 +357,7 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY)
if (pThumb == NULL) return;
+ SIZE sizeScreen;
sizeScreen.cx = GetSystemMetrics(SM_CXSCREEN);
sizeScreen.cy = GetSystemMetrics(SM_CYSCREEN);
@@ -758,42 +758,41 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp
CLISTMENUITEM mi = { 0 };
mi.hParentMenu = root;
- // mi.popupPosition = frameid; !!!!!!!!!!!!!!!!!!!!!!!!!!
mi.position = popuppos++;
mi.pszName = LPGEN("&Visible");
mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SHFRAME;
- fmh.MIVisible = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIVisible = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
popuppos += 100000;
mi.position = popuppos++;
mi.pszName = LPGEN("&Show title");
mi.pszService = MS_CLIST_FRAMES_SHFRAMETITLEBAR;
- fmh.MITBVisible = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MITBVisible = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
mi.position = popuppos++;
mi.pszName = LPGEN("&Locked");
mi.pszService = MS_CLIST_FRAMES_ULFRAME;
- fmh.MILock = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MILock = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
mi.position = popuppos++;
mi.pszName = LPGEN("&Expanded");
mi.pszService = MS_CLIST_FRAMES_UCOLLFRAME;
- fmh.MIColl = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIColl = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
// floating
mi.position = popuppos++;
mi.pszName = LPGEN("&Floating mode");
mi.flags = CMIF_ROOTHANDLE;
mi.pszService = "Set_Floating";
- fmh.MIFloating = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIFloating = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
mi.position = popuppos++;
mi.pszName = LPGEN("&Border");
mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SETUNBORDER;
- fmh.MIBorder = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIBorder = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
popuppos += 100000;
@@ -812,21 +811,21 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp
mi.pszName = LPGEN("&Top");
mi.pszService = CLUIFRAMESSETALIGNALTOP;
mi.pszContactOwner = (char*)alTop;
- fmh.MIAlignTop = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIAlignTop = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
// align client
mi.position = popuppos++;
mi.pszName = LPGEN("&Client");
mi.pszService = CLUIFRAMESSETALIGNALCLIENT;
mi.pszContactOwner = (char*)alClient;
- fmh.MIAlignClient = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIAlignClient = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
// align bottom
mi.position = popuppos++;
mi.pszName = LPGEN("&Bottom");
mi.pszService = CLUIFRAMESSETALIGNALBOTTOM;
mi.pszContactOwner = (char*)alBottom;
- fmh.MIAlignBottom = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIAlignBottom = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
// position root
mi.hParentMenu = root;
@@ -843,13 +842,13 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp
mi.flags = CMIF_ROOTHANDLE;
mi.pszService = CLUIFRAMESMOVEUP;
mi.pszContactOwner = (char*)1;
- fmh.MIPosUp = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIPosUp = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
mi.position = popuppos++;
mi.pszName = LPGEN("&Down");
mi.pszService = CLUIFRAMESMOVEDOWN;
mi.pszContactOwner = (char*)-1;
- fmh.MIPosDown = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIPosDown = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
return 0;
}
@@ -885,7 +884,7 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM)
static int CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM)
{
- //hiword(wParam) = frameid,loword(wParam) = flag
+ // hiword(wParam) = frameid,loword(wParam) = flag
if (_fCluiFramesModuleNotStarted)
return -1;
@@ -1781,7 +1780,8 @@ static int _us_DoRemoveFrame(WPARAM wParam, LPARAM)
static int CLUIFramesForceUpdateTB(const FRAMEWND *Frame)
{
- if (Frame->TitleBar.hwnd != 0) RedrawWindow(Frame->TitleBar.hwnd, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
+ if (Frame->TitleBar.hwnd != 0)
+ RedrawWindow(Frame->TitleBar.hwnd, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
//UpdateWindow(Frame->TitleBar.hwnd);
return 0;
}
@@ -1791,11 +1791,10 @@ static int CLUIFramesForceUpdateFrame(const FRAMEWND *Frame)
if (Frame->hWnd != 0) {
RedrawWindow(Frame->hWnd, NULL, NULL, RDW_UPDATENOW | RDW_FRAME | RDW_ERASE | RDW_INVALIDATE);
UpdateWindow(Frame->hWnd);
- };
- if (Frame->floating) {
- if (Frame->ContainerWnd != 0) RedrawWindow(Frame->ContainerWnd, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
- //UpdateWindow(Frame->ContainerWnd);
- };
+ }
+
+ if (Frame->floating && Frame->ContainerWnd != 0)
+ RedrawWindow(Frame->ContainerWnd, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
return 0;
}
@@ -1881,15 +1880,16 @@ static BOOL CLUIFramesFitInSize(void)
if ((g_pfwFrames[i].align != alClient) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide)) {
sumheight += (g_pfwFrames[i].height) + (g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar)) + 2/*+btoint(Frames[i].UseBorder)*2*/;
if (sumheight>_nContactListHeight - tbh - 2) {
- if (!g_CluiData.fDocked && g_CluiData.fAutoSize) {
+ if (!g_CluiData.fDocked && g_CluiData.fAutoSize)
return TRUE; //Can be required to enlarge
- }
+
return FALSE;
}
}
}
return TRUE;
}
+
int CLUIFrames_GetTotalHeight()
{
if (pcli->hwndContactList == NULL) return 0;
@@ -3142,27 +3142,18 @@ static HWND CreateSubContainerWindow(HWND parent, int x, int y, int width, int h
static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ int framepos, Frameid = GetWindowLongPtr(hwnd, GWLP_USERDATA);
+
RECT rect;
- int Frameid = (GetWindowLongPtr(hwnd, GWLP_USERDATA));
memset(&rect, 0, sizeof(rect));
switch (msg) {
case WM_CREATE:
- {
- int framepos;
-
framepos = id2pos(Frameid);
- //SetWindowPos(Frames[framepos].TitleBar.hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
-
return 0;
- };
+
case WM_GETMINMAXINFO:
- //DefWindowProc(hwnd,msg,wParam,lParam);
- {
- int framepos;
MINMAXINFO minmax;
-
-
framepos = id2pos(Frameid);
if (framepos < 0 || framepos >= g_nFramesCount) { break; };
if (!g_pfwFrames[framepos].minmaxenabled) { break; };
@@ -3178,8 +3169,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP
((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = rct.bottom - rct.top;
//
//return 0;
- };
-
+ }
memset(&minmax, 0, sizeof(minmax));
if (SendMessage(g_pfwFrames[framepos].hWnd, WM_GETMINMAXINFO, 0, (LPARAM)&minmax) == 0) {
@@ -3192,29 +3182,16 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP
((LPMINMAXINFO)lParam)->ptMinTrackSize.y = minmax.ptMinTrackSize.y;
((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = minmax.ptMaxTrackSize.x + border.left + border.right;
((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = minmax.ptMaxTrackSize.y + tbh + border.top + border.bottom;
- };
-
+ }
}
- else {
-
-
- return(DefWindowProc(hwnd, msg, wParam, lParam));
- };
-
-
-
- }
- //return 0;
+ else return(DefWindowProc(hwnd, msg, wParam, lParam));
case WM_MOVE:
- {
- int framepos;
- RECT rect;
-
framepos = id2pos(Frameid);
-
- if (framepos < 0 || framepos >= g_nFramesCount) { break; };
- if (g_pfwFrames[framepos].ContainerWnd == 0) { return 0; };
+ if (framepos < 0 || framepos >= g_nFramesCount)
+ break;
+ if (g_pfwFrames[framepos].ContainerWnd == 0)
+ return 0;
GetWindowRect(g_pfwFrames[framepos].ContainerWnd, &rect);
g_pfwFrames[framepos].FloatingPos.x = rect.left;
@@ -3235,10 +3212,6 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP
rcwnd.right = curpt.x + 5;
GetWindowRect(pcli->hwndContactList, &rcMiranda);
- //GetWindowRect( Frames[pos].ContainerWnd, &rcwnd );
- //IntersectRect( &rcOverlap, &rcwnd, &rcMiranda )
-
-
if (IntersectRect(&rcOverlap, &rcwnd, &rcMiranda)) {
GetCursorPos(&curpt);
GetWindowRect(g_pfwFrames[framepos].hWnd, &rcwnd);
@@ -3250,15 +3223,12 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP
if (curpt.y >= (rcMiranda.bottom - 1)) { newpos.y = curpt.y + 5; };
if (curpt.y <= (rcMiranda.top + 1)) { newpos.y = curpt.y - (rcwnd.top) - 5; };
ofspt.x = 0; ofspt.y = 0;
- //ClientToScreen(Frames[pos].TitleBar.hwnd,&ofspt);
GetWindowRect(g_pfwFrames[framepos].TitleBar.hwnd, &rcwnd);
ofspt.x = curpt.x - ofspt.x; ofspt.y = curpt.y - ofspt.y;
g_pfwFrames[framepos].FloatingPos.x = newpos.x;
g_pfwFrames[framepos].FloatingPos.y = newpos.y;
CLUIFrames_SetFrameFloat(Frameid, 0);
- //SetWindowPos(Frames[pos].ContainerWnd, 0, newpos.x,newpos.y, 0, 0, SWP_NOSIZE);
-
newpt.x = 0; newpt.y = 0;
ClientToScreen(g_pfwFrames[framepos].TitleBar.hwnd, &newpt);
@@ -3268,22 +3238,13 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP
GetCursorPos(&curpt);
g_pfwFrames[framepos].TitleBar.oldpos = curpt;
-
-
return 0;
- };
-
- };
-
+ }
+ }
return 0;
- };
case WM_SIZE:
- {
- int framepos;
- RECT rect;
-
CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
framepos = id2pos(Frameid);
@@ -3299,152 +3260,127 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP
g_pfwFrames[framepos].FloatingSize.y = rect.bottom - rect.top;
CLUIFramesStoreFrameSettings(framepos);
-
-
return 0;
- };
+
case WM_LBUTTONDOWN:
- {
if (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) {
POINT pt;
GetCursorPos(&pt);
return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
}
break;
- }
+
case WM_CLOSE:
- {
DestroyWindow(hwnd);
break;
- };
case WM_DESTROY:
- {
- //{ CLUIFramesStoreAllFrames();};
return 0;
- };
- /*
- case WM_COMMAND:
- case WM_NOTIFY:
- return(SendMessage(pcli->hwndContactList,msg,wParam,lParam));
- */
-
-
- };
+ }
return DefWindowProc(hwnd, msg, wParam, lParam);
-};
+}
+
static HWND CreateContainerWindow(HWND parent, int x, int y, int width, int height)
{
- return(CreateWindow(_T("FramesContainer"), _T("FramesContainer"), WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, 0, g_hInst, 0));
-};
-
+ return CreateWindow(_T("FramesContainer"), _T("FramesContainer"), WS_POPUP | WS_THICKFRAME, x, y, width, height, parent, 0, g_hInst, 0);
+}
static int _us_DoSetFrameFloat(WPARAM wParam, LPARAM lParam)
{
HWND hwndtmp, hwndtooltiptmp;
-
int pos = id2pos(wParam);
- if (pos >= 0 && pos < g_nFramesCount)
+ if (pos < 0 || pos >= g_nFramesCount)
+ return 0;
- if (g_pfwFrames[pos].floating || (lParam & 2)) {
- if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].visible) {
- if (g_pfwFrames[pos].OwnerWindow == 0) g_pfwFrames[pos].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10);
- CLUI_ShowWindowMod(g_pfwFrames[pos].OwnerWindow, (g_pfwFrames[pos].visible && g_pfwFrames[pos].collapsed && IsWindowVisible(pcli->hwndContactList)) ? SW_SHOW/*NOACTIVATE*/ : SW_HIDE);
- SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].OwnerWindow);
- SetParent(g_pfwFrames[pos].TitleBar.hwnd, pcli->hwndContactList);
- SetWindowLongPtr(g_pfwFrames[pos].OwnerWindow, GWLP_USERDATA, g_pfwFrames[pos].id);
- g_pfwFrames[pos].floating = FALSE;
- if (!(lParam & 2)) {
- DestroyWindow(g_pfwFrames[pos].ContainerWnd);
- g_pfwFrames[pos].ContainerWnd = 0;
- }
- }
- else {
- SetParent(g_pfwFrames[pos].hWnd, pcli->hwndContactList);
- SetParent(g_pfwFrames[pos].TitleBar.hwnd, pcli->hwndContactList);
- g_pfwFrames[pos].floating = FALSE;
- if (g_pfwFrames[pos].ContainerWnd) DestroyWindow(g_pfwFrames[pos].ContainerWnd);
+ if (g_pfwFrames[pos].floating || (lParam & 2)) {
+ if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].visible) {
+ if (g_pfwFrames[pos].OwnerWindow == 0) g_pfwFrames[pos].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10);
+ CLUI_ShowWindowMod(g_pfwFrames[pos].OwnerWindow, (g_pfwFrames[pos].visible && g_pfwFrames[pos].collapsed && IsWindowVisible(pcli->hwndContactList)) ? SW_SHOW/*NOACTIVATE*/ : SW_HIDE);
+ SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].OwnerWindow);
+ SetParent(g_pfwFrames[pos].TitleBar.hwnd, pcli->hwndContactList);
+ SetWindowLongPtr(g_pfwFrames[pos].OwnerWindow, GWLP_USERDATA, g_pfwFrames[pos].id);
+ g_pfwFrames[pos].floating = FALSE;
+ if (!(lParam & 2)) {
+ DestroyWindow(g_pfwFrames[pos].ContainerWnd);
g_pfwFrames[pos].ContainerWnd = 0;
}
}
else {
- RECT recttb, rectw, border;
- LONG_PTR temp;
- int neww, newh;
-
- g_pfwFrames[pos].oldstyles = GetWindowLongPtr(g_pfwFrames[pos].hWnd, GWL_STYLE);
- g_pfwFrames[pos].TitleBar.oldstyles = GetWindowLongPtr(g_pfwFrames[pos].TitleBar.hwnd, GWL_STYLE);
- bool locked = g_pfwFrames[pos].Locked;
- g_pfwFrames[pos].Locked = FALSE;
- g_pfwFrames[pos].minmaxenabled = FALSE;
-
- GetWindowRect(g_pfwFrames[pos].hWnd, &rectw);
- GetWindowRect(g_pfwFrames[pos].TitleBar.hwnd, &recttb);
- if (!g_pfwFrames[pos].TitleBar.ShowTitleBar) {
- recttb.top = recttb.bottom = recttb.left = recttb.right = 0;
- };
-
- g_pfwFrames[pos].ContainerWnd = CreateContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10);
-
-
-
+ SetParent(g_pfwFrames[pos].hWnd, pcli->hwndContactList);
+ SetParent(g_pfwFrames[pos].TitleBar.hwnd, pcli->hwndContactList);
+ g_pfwFrames[pos].floating = FALSE;
+ if (g_pfwFrames[pos].ContainerWnd) DestroyWindow(g_pfwFrames[pos].ContainerWnd);
+ g_pfwFrames[pos].ContainerWnd = 0;
+ }
+ }
+ else {
+ RECT recttb, rectw, border;
+ LONG_PTR temp;
+ int neww, newh;
- SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].ContainerWnd);
- SetParent(g_pfwFrames[pos].TitleBar.hwnd, g_pfwFrames[pos].ContainerWnd);
- if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].OwnerWindow != 0) {
- DestroyWindow(g_pfwFrames[pos].OwnerWindow);
- g_pfwFrames[pos].OwnerWindow = 0;
- }
+ g_pfwFrames[pos].oldstyles = GetWindowLongPtr(g_pfwFrames[pos].hWnd, GWL_STYLE);
+ g_pfwFrames[pos].TitleBar.oldstyles = GetWindowLongPtr(g_pfwFrames[pos].TitleBar.hwnd, GWL_STYLE);
+ bool locked = g_pfwFrames[pos].Locked;
+ g_pfwFrames[pos].Locked = FALSE;
+ g_pfwFrames[pos].minmaxenabled = FALSE;
- GetBorderSize(g_pfwFrames[pos].ContainerWnd, &border);
+ GetWindowRect(g_pfwFrames[pos].hWnd, &rectw);
+ GetWindowRect(g_pfwFrames[pos].TitleBar.hwnd, &recttb);
+ if (!g_pfwFrames[pos].TitleBar.ShowTitleBar)
+ recttb.top = recttb.bottom = recttb.left = recttb.right = 0;
+ g_pfwFrames[pos].ContainerWnd = CreateContainerWindow(pcli->hwndContactList, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, 10, 10);
- SetWindowLongPtr(g_pfwFrames[pos].ContainerWnd, GWLP_USERDATA, g_pfwFrames[pos].id);
- if ((lParam == 1)) {
- //if ((Frames[pos].FloatingPos.x != 0) && (Frames[pos].FloatingPos.y != 0))
- {
- if (g_pfwFrames[pos].FloatingPos.x < 0) { g_pfwFrames[pos].FloatingPos.x = 0; };
- if (g_pfwFrames[pos].FloatingPos.y < 0) { g_pfwFrames[pos].FloatingPos.y = 0; };
+ SetParent(g_pfwFrames[pos].hWnd, g_pfwFrames[pos].ContainerWnd);
+ SetParent(g_pfwFrames[pos].TitleBar.hwnd, g_pfwFrames[pos].ContainerWnd);
+ if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].OwnerWindow != 0) {
+ DestroyWindow(g_pfwFrames[pos].OwnerWindow);
+ g_pfwFrames[pos].OwnerWindow = 0;
+ }
- SetWindowPos(g_pfwFrames[pos].ContainerWnd, HWND_TOPMOST, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, g_pfwFrames[pos].FloatingSize.x, g_pfwFrames[pos].FloatingSize.y, SWP_HIDEWINDOW | SWP_NOACTIVATE);
- }
- }
- else if (lParam == 0) {
- neww = rectw.right - rectw.left + border.left + border.right;
- newh = (rectw.bottom - rectw.top) + (recttb.bottom - recttb.top) + border.top + border.bottom;
- if (neww < 20) { neww = 40; };
- if (newh < 20) { newh = 40; };
- if (g_pfwFrames[pos].FloatingPos.x < 20) { g_pfwFrames[pos].FloatingPos.x = 40; };
- if (g_pfwFrames[pos].FloatingPos.y < 20) { g_pfwFrames[pos].FloatingPos.y = 40; };
-
- SetWindowPos(g_pfwFrames[pos].ContainerWnd, HWND_TOPMOST, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, neww, newh, SWP_HIDEWINDOW | SWP_NOACTIVATE);
- };
+ GetBorderSize(g_pfwFrames[pos].ContainerWnd, &border);
+ SetWindowLongPtr(g_pfwFrames[pos].ContainerWnd, GWLP_USERDATA, g_pfwFrames[pos].id);
+ if ((lParam == 1)) {
+ if (g_pfwFrames[pos].FloatingPos.x < 0) { g_pfwFrames[pos].FloatingPos.x = 0; };
+ if (g_pfwFrames[pos].FloatingPos.y < 0) { g_pfwFrames[pos].FloatingPos.y = 0; };
- SetWindowText(g_pfwFrames[pos].ContainerWnd, g_pfwFrames[pos].TitleBar.tbname);
+ SetWindowPos(g_pfwFrames[pos].ContainerWnd, HWND_TOPMOST, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, g_pfwFrames[pos].FloatingSize.x, g_pfwFrames[pos].FloatingSize.y, SWP_HIDEWINDOW | SWP_NOACTIVATE);
+ }
+ else if (lParam == 0) {
+ neww = rectw.right - rectw.left + border.left + border.right;
+ newh = (rectw.bottom - rectw.top) + (recttb.bottom - recttb.top) + border.top + border.bottom;
+ if (neww < 20) { neww = 40; };
+ if (newh < 20) { newh = 40; };
+ if (g_pfwFrames[pos].FloatingPos.x < 20) { g_pfwFrames[pos].FloatingPos.x = 40; };
+ if (g_pfwFrames[pos].FloatingPos.y < 20) { g_pfwFrames[pos].FloatingPos.y = 40; };
- temp = GetWindowLongPtr(g_pfwFrames[pos].ContainerWnd, GWL_EXSTYLE);
- temp |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
- SetWindowLongPtr(g_pfwFrames[pos].ContainerWnd, GWL_EXSTYLE, temp);
+ SetWindowPos(g_pfwFrames[pos].ContainerWnd, HWND_TOPMOST, g_pfwFrames[pos].FloatingPos.x, g_pfwFrames[pos].FloatingPos.y, neww, newh, SWP_HIDEWINDOW | SWP_NOACTIVATE);
+ }
- g_pfwFrames[pos].floating = TRUE;
- g_pfwFrames[pos].Locked = locked;
+ SetWindowText(g_pfwFrames[pos].ContainerWnd, g_pfwFrames[pos].TitleBar.tbname);
- }
- CLUIFramesStoreFrameSettings(pos);
- g_pfwFrames[pos].minmaxenabled = TRUE;
- hwndtooltiptmp = g_pfwFrames[pos].TitleBar.hwndTip;
+ temp = GetWindowLongPtr(g_pfwFrames[pos].ContainerWnd, GWL_EXSTYLE);
+ temp |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
+ SetWindowLongPtr(g_pfwFrames[pos].ContainerWnd, GWL_EXSTYLE, temp);
- hwndtmp = g_pfwFrames[pos].ContainerWnd;
+ g_pfwFrames[pos].floating = TRUE;
+ g_pfwFrames[pos].Locked = locked;
+ }
- CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0);
- if (hwndtmp) SendMessage(hwndtmp, WM_SIZE, 0, 0);
+ CLUIFramesStoreFrameSettings(pos);
+ g_pfwFrames[pos].minmaxenabled = TRUE;
+ hwndtooltiptmp = g_pfwFrames[pos].TitleBar.hwndTip;
+ hwndtmp = g_pfwFrames[pos].ContainerWnd;
- SetWindowPos(hwndtooltiptmp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0);
+ if (hwndtmp)
+ SendMessage(hwndtmp, WM_SIZE, 0, 0);
- return 0;
+ SetWindowPos(hwndtooltiptmp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ return 0;
}
int CLUIFrameOnModulesLoad(WPARAM, LPARAM)
@@ -3567,7 +3503,8 @@ int UnLoadCLUIFramesModule(void)
g_pfwFrames[i].TitleBar.hwnd = (HWND)-1;
if (g_pfwFrames[i].ContainerWnd && g_pfwFrames[i].ContainerWnd != (HWND)(-2) && g_pfwFrames[i].ContainerWnd != (HWND)(-1)) DestroyWindow(g_pfwFrames[i].ContainerWnd);
g_pfwFrames[i].ContainerWnd = (HWND)-1;
- if (g_pfwFrames[i].TitleBar.hmenu) DestroyMenu(g_pfwFrames[i].TitleBar.hmenu);
+ if (g_pfwFrames[i].TitleBar.hmenu)
+ DestroyMenu(g_pfwFrames[i].TitleBar.hmenu);
if (g_pfwFrames[i].OwnerWindow && g_pfwFrames[i].OwnerWindow != (HWND)(-2) && g_pfwFrames[i].OwnerWindow != (HWND)(-1))
DestroyWindow(g_pfwFrames[i].OwnerWindow);
g_pfwFrames[i].OwnerWindow = (HWND)-2;
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.h b/plugins/Clist_modern/src/CLUIFrames/cluiframes.h
index c387e53dc8..b4d89866b3 100644
--- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.h
+++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.h
@@ -109,6 +109,9 @@ struct FRAMEWND
bool visible;
bool needhide;
bool collapsed;
+ bool floating;
+ bool minmaxenabled;
+ bool UseBorder;
int prevvisframe;
int HeightWhenCollapsed;
FrameTitleBar TitleBar;
@@ -117,9 +120,6 @@ struct FRAMEWND
HWND ContainerWnd;
POINT FloatingPos;
POINT FloatingSize;
- bool floating;
- bool minmaxenabled;
- bool UseBorder;
int order;
DockOpt dockOpt;
HWND OwnerWindow;
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
index 298addb76f..c1dbc69c9c 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
@@ -36,7 +36,7 @@ void MF_UpdateThread(LPVOID);
HANDLE hStatusBarShowToolTipEvent, hStatusBarHideToolTipEvent;
HANDLE g_hEventThread = 0;
-LOGFONT TitleBarLogFont = {0};
+LOGFONT TitleBarLogFont = { 0 };
extern HINSTANCE g_hInst;
@@ -201,9 +201,9 @@ static void PositionThumb(FRAMEWND *pThumb, short nX, short nY)
// Docking to the edges of the screen
int nNewX = nX < nOffs ? 0 : nX;
- nNewX = nNewX > (sizeScreen.cx - nWidth - nOffs) ? (sizeScreen.cx - nWidth) : nNewX;
+ nNewX = nNewX >(sizeScreen.cx - nWidth - nOffs) ? (sizeScreen.cx - nWidth) : nNewX;
int nNewY = nY < nOffs ? 0 : nY;
- nNewY = nNewY > (sizeScreen.cy - nHeight - nOffs) ? (sizeScreen.cy - nHeight) : nNewY;
+ nNewY = nNewY >(sizeScreen.cy - nHeight - nOffs) ? (sizeScreen.cy - nHeight) : nNewY;
bool bLeading = pThumb->dockOpt.hwndRight != NULL;
@@ -534,7 +534,7 @@ int CLUIFramesStoreAllFrames()
return -1;
mir_cslock lck(csFrameHook);
- for (i = 0;i < nFramescount;i++)
+ for (i = 0; i < nFramescount; i++)
CLUIFramesStoreFrameSettings(i);
return 0;
}
@@ -556,7 +556,7 @@ int CLUIFramesGetalClientFrame(void)
}
}
- for (i = 0;i < nFramescount;i++)
+ for (i = 0; i < nFramescount; i++)
if (Frames[i].align == alClient) {
alclientFrame = i;
return i;
@@ -564,7 +564,7 @@ int CLUIFramesGetalClientFrame(void)
return -1;
}
-HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGENMENU (*pfnAdd )( CLISTMENUITEM* ))
+HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGENMENU(*pfnAdd)(CLISTMENUITEM*))
{
if (FramesSysNotStarted)
return NULL;
@@ -587,13 +587,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;
- fmh.MIVisible = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIVisible = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
mi.position = popuppos++;
mi.pszName = LPGEN("&Show title bar");
mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_SHFRAMETITLEBAR;
- fmh.MITBVisible = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MITBVisible = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
popuppos += 100000;
@@ -601,13 +601,13 @@ 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;
- fmh.MILock = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MILock = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
mi.position = popuppos++;
mi.pszName = LPGEN("&Collapsed");
mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED;
mi.pszService = MS_CLIST_FRAMES_UCOLLFRAME;
- fmh.MIColl = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIColl = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
// floating
mi.position = popuppos++;
@@ -622,7 +622,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;
- fmh.MIBorder = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIBorder = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
popuppos += 100000;
@@ -630,7 +630,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;
- fmh.MISkinned = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MISkinned = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
popuppos += 100000;
@@ -649,21 +649,21 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE
mi.pszName = LPGEN("&Top");
mi.pszService = CLUIFRAMESSETALIGNALTOP;
mi.pszContactOwner = (char*)alTop;
- fmh.MIAlignTop = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIAlignTop = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
// align client
mi.position = popuppos++;
mi.pszName = LPGEN("&Client");
mi.pszService = CLUIFRAMESSETALIGNALCLIENT;
mi.pszContactOwner = (char*)alClient;
- fmh.MIAlignClient = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIAlignClient = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
// align bottom
mi.position = popuppos++;
mi.pszName = LPGEN("&Bottom");
mi.pszService = CLUIFRAMESSETALIGNALBOTTOM;
mi.pszContactOwner = (char*)alBottom;
- fmh.MIAlignBottom = pfnAdd(&mi);
+ Menu_ConfigureItem(fmh.MIAlignBottom = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
// position root
mi.hParentMenu = root;
@@ -680,14 +680,14 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE
mi.flags = CMIF_ROOTHANDLE;
mi.pszService = CLUIFRAMESMOVEUP;
mi.pszContactOwner = (char*)1;
- pfnAdd(&mi);
+ Menu_ConfigureItem(pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
mi.position = popuppos++;
mi.pszName = LPGEN("&Down");
mi.flags = CMIF_ROOTHANDLE;
mi.pszService = CLUIFRAMESMOVEDOWN;
mi.pszContactOwner = (char*)-1;
- pfnAdd(&mi);
+ Menu_ConfigureItem(pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid);
return 0;
}
@@ -697,7 +697,7 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM)
return -1;
mir_cslock lck(csFrameHook);
- int pos = id2pos((INT_PTR)wParam);
+ int pos = id2pos(wParam);
if (pos >= 0 && pos < nFramescount) {
FRAMEWND &p = Frames[pos];
Menu_ModifyItem(cont.MITitle, p.TitleBar.tbname ? p.TitleBar.tbname : p.name);
@@ -717,13 +717,13 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM)
return 0;
}
-INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM)
+INT_PTR CLUIFramesModifyMainMenuItems(WPARAM frameId, LPARAM)
{
if (FramesSysNotStarted)
return -1;
mir_cslock lck(csFrameHook);
- int pos = id2pos((INT_PTR)wParam);
+ int pos = id2pos(frameId);
if (pos >= 0 && pos < nFramescount) {
FRAMEWND &p = Frames[pos];
@@ -852,7 +852,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam)
if (flag & F_SKINNED)
Frames[pos].Skinned = TRUE;
- if ( !(flag & F_SKINNED))
+ if (!(flag & F_SKINNED))
style &= ~CLS_SKINNEDFRAME;
SetWindowLongPtr(Frames[pos].hWnd, GWL_STYLE, (LONG_PTR)style);
@@ -913,24 +913,24 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam)
int uID = (Frames[pos].TitleBar.ShowTitleBar ? ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE : ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE);
lParam += (arStatusItems[uID]->MARGIN_BOTTOM + arStatusItems[uID]->MARGIN_TOP);
}
- if (Frames[pos].collapsed) {
+ if (Frames[pos].collapsed) {
int oldHeight = Frames[pos].height;
retval = Frames[pos].height;
Frames[pos].height = lParam;
- if ( !CLUIFramesFitInSize())
+ if (!CLUIFramesFitInSize())
Frames[pos].height = retval;
retval = Frames[pos].height;
if (Frames[pos].height != oldHeight) {
- CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0);
+ CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0);
if (Frames[pos].Skinned)
- RedrawWindow(Frames[pos].hWnd, 0, 0, RDW_FRAME|RDW_UPDATENOW|RDW_INVALIDATE);
+ RedrawWindow(Frames[pos].hWnd, 0, 0, RDW_FRAME | RDW_UPDATENOW | RDW_INVALIDATE);
}
}
else {
retval = Frames[pos].HeightWhenCollapsed;
Frames[pos].HeightWhenCollapsed = lParam;
- if ( !CLUIFramesFitInSize())
+ if (!CLUIFramesFitInSize())
Frames[pos].HeightWhenCollapsed = retval;
retval = Frames[pos].HeightWhenCollapsed;
}
@@ -949,7 +949,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam)
return wParam;
case FO_ALIGN:
- if ( !(lParam&alTop || lParam&alBottom || lParam&alClient))
+ if (!(lParam&alTop || lParam&alBottom || lParam&alClient))
return -1;
if ((lParam&alClient) && (CLUIFramesGetalClientFrame() >= 0)) { //only one alClient frame possible
@@ -970,9 +970,9 @@ static INT_PTR CLUIFramesShowAll(WPARAM, LPARAM)
if (FramesSysNotStarted)
return -1;
- for (int i = 0;i < nFramescount;i++)
+ for (int i = 0; i < nFramescount; i++)
Frames[i].visible = TRUE;
-
+
CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0);
return 0;
}
@@ -982,7 +982,7 @@ INT_PTR CLUIFramesShowAllTitleBars(WPARAM, LPARAM)
if (FramesSysNotStarted)
return -1;
- for (int i = 0;i < nFramescount;i++) {
+ for (int i = 0; i < nFramescount; i++) {
Frames[i].TitleBar.ShowTitleBar = TRUE;
SetWindowPos(Frames[i].hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
}
@@ -991,13 +991,12 @@ INT_PTR CLUIFramesShowAllTitleBars(WPARAM, LPARAM)
return 0;
}
-//wparam=lparam=0
INT_PTR CLUIFramesHideAllTitleBars(WPARAM, LPARAM)
{
if (FramesSysNotStarted)
return -1;
- for (int i = 0;i < nFramescount;i++) {
+ for (int i = 0; i < nFramescount; i++) {
Frames[i].TitleBar.ShowTitleBar = FALSE;
SetWindowPos(Frames[i].hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
}
@@ -1006,8 +1005,7 @@ INT_PTR CLUIFramesHideAllTitleBars(WPARAM, LPARAM)
return 0;
}
-//wparam=frameid
-INT_PTR CLUIFramesShowHideFrame(WPARAM wParam, LPARAM)
+INT_PTR CLUIFramesShowHideFrame(WPARAM frameId, LPARAM)
{
if (FramesSysNotStarted)
return -1;
@@ -1015,7 +1013,7 @@ INT_PTR CLUIFramesShowHideFrame(WPARAM wParam, LPARAM)
int pos;
{
mir_cslock lck(csFrameHook);
- pos = id2pos((INT_PTR)wParam);
+ pos = id2pos(frameId);
if (pos >= 0 && !mir_tstrcmp(Frames[pos].name, _T("My contacts")))
Frames[pos].visible = 1;
else {
@@ -1025,22 +1023,21 @@ INT_PTR CLUIFramesShowHideFrame(WPARAM wParam, LPARAM)
CLUIFrameResizeFloatingFrame(pos);
}
}
-
+
if (!Frames[pos].floating)
CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0);
RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN);
return 0;
}
-//wparam=frameid
-INT_PTR CLUIFramesShowHideFrameTitleBar(WPARAM wParam, LPARAM)
+INT_PTR CLUIFramesShowHideFrameTitleBar(WPARAM frameId, LPARAM)
{
if (FramesSysNotStarted)
return -1;
{
mir_cslock lck(csFrameHook);
- int pos = id2pos((INT_PTR)wParam);
+ int pos = id2pos(frameId);
if (pos >= 0 && (int)pos < nFramescount) {
Frames[pos].TitleBar.ShowTitleBar = !Frames[pos].TitleBar.ShowTitleBar;
SetWindowPos(Frames[pos].hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
@@ -1052,10 +1049,8 @@ INT_PTR CLUIFramesShowHideFrameTitleBar(WPARAM wParam, LPARAM)
return 0;
}
-
-//wparam=frameid
-//lparam=-1 up ,1 down
-INT_PTR CLUIFramesMoveUpDown(WPARAM wParam, LPARAM lParam)
+// lparam=-1 up ,1 down
+INT_PTR CLUIFramesMoveUpDown(WPARAM frameId, LPARAM lParam)
{
int i, tmpval;
@@ -1063,14 +1058,14 @@ INT_PTR CLUIFramesMoveUpDown(WPARAM wParam, LPARAM lParam)
return -1;
mir_cslockfull lck(csFrameHook);
- int pos = id2pos((INT_PTR)wParam);
+ int pos = id2pos(frameId);
if (pos < 0 || pos >= nFramescount)
return 0;
int curalign = Frames[pos].align;
int v = 0;
memset(g_sd, 0, sizeof(SortData) * MAX_FRAMES);
- for (i = 0;i < nFramescount;i++) {
+ for (i = 0; i < nFramescount; i++) {
if (Frames[i].floating || (!Frames[i].visible) || (Frames[i].align != curalign))
continue;
g_sd[v].order = Frames[i].order;
@@ -1081,19 +1076,19 @@ INT_PTR CLUIFramesMoveUpDown(WPARAM wParam, LPARAM lParam)
return 0;
qsort(g_sd, v, sizeof(SortData), sortfunc);
- for (i = 0;i < v;i++) {
+ for (i = 0; i < v; i++) {
if (g_sd[i].realpos == pos) {
if (lParam == -1) {
if (i < 1) break;
- tmpval = Frames[g_sd[i-1].realpos].order;
- Frames[g_sd[i-1].realpos].order = Frames[pos].order;
+ tmpval = Frames[g_sd[i - 1].realpos].order;
+ Frames[g_sd[i - 1].realpos].order = Frames[pos].order;
Frames[pos].order = tmpval;
break;
}
if (lParam == 1) {
if (i > v - 1) break;
- tmpval = Frames[g_sd[i+1].realpos].order;
- Frames[g_sd[i+1].realpos].order = Frames[pos].order;
+ tmpval = Frames[g_sd[i + 1].realpos].order;
+ Frames[g_sd[i + 1].realpos].order = Frames[pos].order;
Frames[pos].order = tmpval;
break;
}
@@ -1107,23 +1102,22 @@ INT_PTR CLUIFramesMoveUpDown(WPARAM wParam, LPARAM lParam)
return 0;
}
-static INT_PTR CLUIFramesMoveUp(WPARAM wParam, LPARAM)
+static INT_PTR CLUIFramesMoveUp(WPARAM frameId, LPARAM)
{
- return CLUIFramesMoveUpDown(wParam, -1);
+ return CLUIFramesMoveUpDown(frameId, -1);
}
-static INT_PTR CLUIFramesMoveDown(WPARAM wParam, LPARAM)
+static INT_PTR CLUIFramesMoveDown(WPARAM frameId, LPARAM)
{
- return CLUIFramesMoveUpDown(wParam, 1);
+ return CLUIFramesMoveUpDown(frameId, 1);
}
-//wparam=frameid
//lparam=alignment
-INT_PTR CLUIFramesSetAlign(WPARAM wParam, LPARAM lParam)
+INT_PTR CLUIFramesSetAlign(WPARAM frameId, LPARAM lParam)
{
if (FramesSysNotStarted) return -1;
- CLUIFramesSetFrameOptions(MAKEWPARAM(FO_ALIGN, wParam), lParam);
+ CLUIFramesSetFrameOptions(MAKEWPARAM(FO_ALIGN, frameId), lParam);
CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0);
RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN);
return 0;
@@ -1157,7 +1151,7 @@ INT_PTR CLUIFramesLockUnlockFrame(WPARAM wParam, LPARAM)
return -1;
mir_cslock lck(csFrameHook);
- int pos = id2pos((INT_PTR)wParam);
+ int pos = id2pos(wParam);
if (pos >= 0 && (int)pos < nFramescount) {
Frames[pos].Locked = !Frames[pos].Locked;
CLUIFramesStoreFrameSettings(pos);
@@ -1175,7 +1169,7 @@ INT_PTR CLUIFramesSetUnSetBorder(WPARAM wParam, LPARAM)
int FrameId, oldflags;
{
mir_cslock lck(csFrameHook);
- FrameId = id2pos((INT_PTR)wParam);
+ FrameId = id2pos(wParam);
if (FrameId == -1)
return -1;
@@ -1203,7 +1197,7 @@ INT_PTR CLUIFramesSetUnSetSkinned(WPARAM wParam, LPARAM)
int FrameId, oldflags;
{
mir_cslock lck(csFrameHook);
- FrameId = id2pos((INT_PTR)wParam);
+ FrameId = id2pos(wParam);
if (FrameId == -1)
return -1;
@@ -1230,10 +1224,10 @@ INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam, LPARAM)
TitleBarH = cfg::dat.titleBarHeight;
mir_cslockfull lck(csFrameHook);
- int FrameId = id2pos((INT_PTR)wParam);
+ int FrameId = id2pos(wParam);
if (FrameId < 0 || FrameId >= nFramescount)
return -1;
-
+
int oldHeight;
// do not collapse/uncollapse client/locked/invisible frames
@@ -1642,8 +1636,8 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM)
else Frames[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)
- Frames[nFramescount].TitleBar.tbname = mir_tstrdup(Frames[nFramescount].name);
+ || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->TBwname) : mir_strlen(clfrm->TBname)) == 0)
+ Frames[nFramescount].TitleBar.tbname = mir_tstrdup(Frames[nFramescount].name);
else
Frames[nFramescount].TitleBar.tbname = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->TBwname) : mir_a2t(clfrm->TBname);
Frames[nFramescount].needhide = FALSE;
@@ -1667,8 +1661,8 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM)
SetWindowLongPtr(Frames[nFramescount].TitleBar.hwnd, GWLP_USERDATA, Frames[nFramescount].id);
Frames[nFramescount].TitleBar.hwndTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- pcli->hwndContactList, NULL, g_hInst, NULL);
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+ pcli->hwndContactList, NULL, g_hInst, NULL);
SetWindowPos(Frames[nFramescount].TitleBar.hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
{
@@ -1723,7 +1717,7 @@ static INT_PTR CLUIFramesRemoveFrame(WPARAM wParam, LPARAM)
{
mir_cslock lck(csFrameHook);
- int pos = id2pos((INT_PTR)wParam);
+ int pos = id2pos(wParam);
if (pos < 0 || pos > nFramescount)
return -1;
@@ -1790,12 +1784,12 @@ int CLUIFrameMoveResize(const FRAMEWND *Frame)
}
SetWindowPos(Frame->hWnd, NULL, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset,
- (Frame->wndSize.right - Frame->wndSize.left),
- (Frame->wndSize.bottom - Frame->wndSize.top), SWP_NOZORDER | SWP_NOREDRAW);
+ (Frame->wndSize.right - Frame->wndSize.left),
+ (Frame->wndSize.bottom - Frame->wndSize.top), SWP_NOZORDER | SWP_NOREDRAW);
if (Frame->TitleBar.ShowTitleBar) {
SetWindowPos(Frame->TitleBar.hwnd, NULL, Frame->wndSize.left + cfg::dat.bCLeft, Frame->wndSize.top + cfg::dat.topOffset - TitleBarH,
- (Frame->wndSize.right - Frame->wndSize.left),
- TitleBarH + (Frame->UseBorder ? (!Frame->collapsed ? (Frame->align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER);
+ (Frame->wndSize.right - Frame->wndSize.left),
+ TitleBarH + (Frame->UseBorder ? (!Frame->collapsed ? (Frame->align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER);
}
return 0;
}
@@ -2009,17 +2003,17 @@ INT_PTR CLUIFramesUpdateFrame(WPARAM wParam, LPARAM lParam)
int pos;
if (FramesSysNotStarted)
return -1;
-
+
if (wParam == -1) {
CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0);
return 0;
}
-
+
if (lParam & FU_FMPOS)
CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 1);
mir_cslock lck(csFrameHook);
- pos = id2pos((INT_PTR)wParam);
+ pos = id2pos(wParam);
if (pos < 0 || pos >= nFramescount)
return -1;
@@ -2038,7 +2032,7 @@ int CLUIFramesApplyNewSizes(int mode)
for (int i = 0; i < nFramescount; i++) {
if ((mode == 1 && Frames[i].OwnerWindow != (HWND)-2 && Frames[i].OwnerWindow) ||
- (mode == 2 && Frames[i].OwnerWindow == (HWND)-2) || (mode == 3))
+ (mode == 2 && Frames[i].OwnerWindow == (HWND)-2) || (mode == 3))
if (Frames[i].floating)
CLUIFrameResizeFloatingFrame(i);
else
@@ -2090,26 +2084,26 @@ int SizeFramesByWindowRect(RECT *r)
CopyRect(&Frames[i].oldWndSize, &Frames[i].wndSize);
}*/
SetWindowPos(Frames[i].hWnd, NULL, Frames[i].wndSize.left + cfg::dat.bCLeft, Frames[i].wndSize.top + cfg::dat.topOffset,
- (Frames[i].wndSize.right - Frames[i].wndSize.left),
- (Frames[i].wndSize.bottom - Frames[i].wndSize.top), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS | noSize);
+ (Frames[i].wndSize.right - Frames[i].wndSize.left),
+ (Frames[i].wndSize.bottom - Frames[i].wndSize.top), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS | noSize);
if (Frames[i].TitleBar.ShowTitleBar) {
SetWindowPos(Frames[i].TitleBar.hwnd, NULL, Frames[i].wndSize.left + cfg::dat.bCLeft, Frames[i].wndSize.top + cfg::dat.topOffset - TitleBarH,
- (Frames[i].wndSize.right - Frames[i].wndSize.left),
- TitleBarH + (Frames[i].UseBorder ? (!Frames[i].collapsed ? (Frames[i].align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS);
+ (Frames[i].wndSize.right - Frames[i].wndSize.left),
+ TitleBarH + (Frames[i].UseBorder ? (!Frames[i].collapsed ? (Frames[i].align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS);
}
}
else {
// set frame position
SetWindowPos(Frames[i].hWnd, NULL, Frames[i].wndSize.left + cfg::dat.bCLeft, Frames[i].wndSize.top + cfg::dat.topOffset,
- (Frames[i].wndSize.right - Frames[i].wndSize.left),
- (Frames[i].wndSize.bottom - Frames[i].wndSize.top), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOREDRAW);
+ (Frames[i].wndSize.right - Frames[i].wndSize.left),
+ (Frames[i].wndSize.bottom - Frames[i].wndSize.top), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOREDRAW);
// set titlebar position
if (Frames[i].TitleBar.ShowTitleBar) {
SetWindowPos(Frames[i].TitleBar.hwnd, NULL, Frames[i].wndSize.left + cfg::dat.bCLeft, Frames[i].wndSize.top + cfg::dat.topOffset - TitleBarH,
- (Frames[i].wndSize.right - Frames[i].wndSize.left),
- TitleBarH + (Frames[i].UseBorder ? (!Frames[i].collapsed ? (Frames[i].align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOREDRAW);
+ (Frames[i].wndSize.right - Frames[i].wndSize.left),
+ TitleBarH + (Frames[i].UseBorder ? (!Frames[i].collapsed ? (Frames[i].align == alClient ? 0 : 2) : 1) : 0), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOREDRAW);
}
//UpdateWindow(Frames[i].hWnd);
if (Frames[i].TitleBar.ShowTitleBar)
@@ -2260,7 +2254,7 @@ static int DrawTitleBar(HDC dc, RECT rect, int Frameid)
rc.left += item->MARGIN_LEFT;
rc.right -= item->MARGIN_RIGHT;
DrawAlpha(hdcMem, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT,
- item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem);
+ item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem);
SetTextColor(hdcMem, item->TEXTCOLOR);
}
else if (cfg::clcdat) {
@@ -2465,11 +2459,11 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
if (pos != -1) {
int oldflags;
mir_snprintf(TBcapt, _countof(TBcapt), "%s - h:%d, vis:%d, fl:%d, fl:(%d,%d,%d,%d),or: %d",
- Frames[pos].name, Frames[pos].height, Frames[pos].visible, Frames[pos].floating,
- Frames[pos].FloatingPos.x, Frames[pos].FloatingPos.y,
- Frames[pos].FloatingSize.x, Frames[pos].FloatingSize.y,
- Frames[pos].order
- );
+ Frames[pos].name, Frames[pos].height, Frames[pos].visible, Frames[pos].floating,
+ Frames[pos].FloatingPos.x, Frames[pos].FloatingPos.y,
+ Frames[pos].FloatingSize.x, Frames[pos].FloatingSize.y,
+ Frames[pos].order
+ );
oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, Frames[pos].id), 0);
if (!(oldflags&F_SHOWTBTIP))
@@ -2862,7 +2856,7 @@ INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam)
HWND hwndtmp, hwndtooltiptmp;
{
mir_cslock lck(csFrameHook);
- wParam = id2pos((INT_PTR)wParam);
+ wParam = id2pos(wParam);
if ((int)wParam >= 0 && (int)wParam < nFramescount) {
if (Frames[wParam].floating) {
SetParent(Frames[wParam].hWnd, pcli->hwndContactList);
@@ -2989,30 +2983,19 @@ static int CLUIFrameOnModulesUnload(WPARAM, LPARAM)
void RegisterCLUIFrameClasses()
{
- WNDCLASS wndclass;
- WNDCLASS cntclass;
-
- wndclass.style = CS_DBLCLKS;//|CS_HREDRAW|CS_VREDRAW ;
+ WNDCLASS wndclass = {};
+ wndclass.style = CS_DBLCLKS;
wndclass.lpfnWndProc = CLUIFrameTitleBarProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
wndclass.hInstance = g_hInst;
- wndclass.hIcon = NULL;
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = NULL;
- wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = CLUIFrameTitleBarClassName;
RegisterClass(&wndclass);
- cntclass.style = CS_DBLCLKS/*|CS_HREDRAW|CS_VREDRAW*/ | CS_DROPSHADOW;
+ WNDCLASS cntclass = {};
+ cntclass.style = CS_DBLCLKS | CS_DROPSHADOW;
cntclass.lpfnWndProc = CLUIFrameContainerWndProc;
- cntclass.cbClsExtra = 0;
- cntclass.cbWndExtra = 0;
cntclass.hInstance = g_hInst;
- cntclass.hIcon = NULL;
cntclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- cntclass.hbrBackground = NULL;
- cntclass.lpszMenuName = NULL;
cntclass.lpszClassName = _T("FramesContainer");
RegisterClass(&cntclass);
}
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.h b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.h
index b3ff93c556..86aba956b1 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.h
+++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.h
@@ -39,7 +39,7 @@ typedef struct
{
int order;
int realpos;
-} SortData;
+}SortData;
@@ -90,13 +90,11 @@ struct FRAMEWND
int id;
HWND hWnd;
RECT wndSize;
- RECT oldWndSize;
LPTSTR name;
int align;
int height;
int dwFlags;
bool Locked;
- bool Skinned;
bool visible;
bool needhide;
bool collapsed;
@@ -114,6 +112,8 @@ struct FRAMEWND
int order;
DockOpt dockOpt;
HWND OwnerWindow;
+ bool Skinned;
+ RECT oldWndSize;
WNDPROC wndProc;
};
diff --git a/src/mir_app/src/framesmenu.cpp b/src/mir_app/src/framesmenu.cpp
index ce17f358ff..34061566ae 100644
--- a/src/mir_app/src/framesmenu.cpp
+++ b/src/mir_app/src/framesmenu.cpp
@@ -1,26 +1,46 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org),
+Copyright (c) 2000-12 Miranda IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
#include "stdafx.h"
#include <m_cluiframes.h>
-//========================== Frames
-HANDLE hFrameMenuObject;
+static HANDLE hFrameMenuObject;
static HANDLE hPreBuildFrameMenuEvent;
-//contactmenu exec param(ownerdata)
-//also used in checkservice
-typedef struct{
- char *szServiceName;
- int Frameid;
+// contactmenu exec param(ownerdata)
+// also used in checkservice
+struct FrameMenuExecParam
+{
+ ptrA szServiceName;
+ int Frameid;
INT_PTR param1;
-}FrameMenuExecParam, *lpFrameMenuExecParam;
+};
INT_PTR FreeOwnerDataFrameMenu(WPARAM, LPARAM lParam)
{
- lpFrameMenuExecParam cmep = (lpFrameMenuExecParam)lParam;
- if (cmep != NULL){
- mir_free(cmep->szServiceName);
- mir_free(cmep);
- }
+ delete (FrameMenuExecParam*)lParam;
return 0;
}
@@ -34,10 +54,7 @@ static INT_PTR AddContextFrameMenuItem(WPARAM, LPARAM lParam)
tmi.root = (mi->flags & CMIF_ROOTHANDLE) ? mi->hParentMenu : NULL;
- lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mir_alloc(sizeof(FrameMenuExecParam));
- if (fmep == NULL)
- return 0;
-
+ FrameMenuExecParam *fmep = new FrameMenuExecParam();
fmep->szServiceName = mir_strdup(mi->pszService);
fmep->Frameid = 0; // mi->popupPosition; !!!!!!!!!!!!!!!!!!!!!!!!!!
fmep->param1 = (INT_PTR)mi->pszContactOwner;
@@ -45,12 +62,12 @@ static INT_PTR AddContextFrameMenuItem(WPARAM, LPARAM lParam)
return (INT_PTR)Menu_AddItem(hFrameMenuObject, &tmi);
}
-//called with:
-//wparam - ownerdata
-//lparam - lparam from winproc
+// called with:
+// wparam - ownerdata
+// lparam - lparam from winproc
INT_PTR FrameMenuExecService(WPARAM wParam, LPARAM lParam)
{
- lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)wParam;
+ FrameMenuExecParam *fmep = (FrameMenuExecParam*)wParam;
if (fmep == NULL)
return -1;
@@ -67,7 +84,7 @@ INT_PTR FrameMenuCheckService(WPARAM wParam, LPARAM)
TMO_MenuItem mi;
if (Menu_GetItemInfo(pcpp->MenuItemHandle, mi) == 0) {
- lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mi.ownerdata;
+ FrameMenuExecParam *fmep = (FrameMenuExecParam*)mi.ownerdata;
if (fmep != NULL) {
//pcpp->wParam - frameid
if (((WPARAM)fmep->Frameid == pcpp->wParam) || fmep->Frameid == -1)