diff options
author | George Hazan <george.hazan@gmail.com> | 2013-12-17 22:39:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-12-17 22:39:14 +0000 |
commit | 1a69d21a165c1b952d697aab49b7cb4e14573c58 (patch) | |
tree | e0490b0f7e8c8e4f7b299fcd22610e08cddde8b4 /plugins/Clist_mw | |
parent | c5cd9533eabe06dd7cc3eda31290f8b11d09c79d (diff) |
further frames code merging
git-svn-id: http://svn.miranda-ng.org/main/trunk@7266 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_mw')
-rw-r--r-- | plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp | 115 | ||||
-rw-r--r-- | plugins/Clist_mw/src/CLUIFrames/cluiframes.h | 87 | ||||
-rw-r--r-- | plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp | 74 | ||||
-rw-r--r-- | plugins/Clist_mw/src/clc.h | 2 | ||||
-rw-r--r-- | plugins/Clist_mw/src/clisttray.cpp | 4 | ||||
-rw-r--r-- | plugins/Clist_mw/src/groupmenu.cpp | 22 |
6 files changed, 142 insertions, 162 deletions
diff --git a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp index cadc31aadd..c62eee2855 100644 --- a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp @@ -46,13 +46,6 @@ LOGFONTA TitleBarLogFont = {0}; boolean FramesSysNotStarted = TRUE;
-typedef struct
-{
- int order;
- int realpos;
-}
- SortData;
-
static int sortfunc(const void *a,const void *b)
{
SortData *sd1,*sd2;
@@ -64,76 +57,8 @@ static int sortfunc(const void *a,const void *b) return 0;
}
-
-//============
-#define CLUIFRAMESSETALIGN "CLUIFramesSetAlign"
-
-#define CLUIFRAMESSETALIGNALTOP "CLUIFramesSetAlignalTop"
-#define CLUIFRAMESSETALIGNALCLIENT "CLUIFramesSetAlignalClient"
-#define CLUIFRAMESSETALIGNALBOTTOM "CLUIFramesSetAlignalBottom"
-
-#define CLUIFRAMESMOVEUPDOWN "CLUIFramesMoveUpDown"
-typedef struct tagMenuHandles
-{
- HGENMENU MainMenuItem;
- HGENMENU MIVisible,MITitle,MITBVisible,MILock,MIColl,MIFloating,MIAlignRoot;
- HGENMENU MIAlignTop,MIAlignClient,MIAlignBottom,MIBorder;
-} FrameMenuHandles;
-
-typedef struct tagFrameTitleBar{
- HWND hwnd;
- HWND TitleBarbutt;
- HWND hwndTip;
-
- LPTSTR tbname;
- LPTSTR tooltip;
- HMENU hmenu;
- HICON hicon;
-
- BOOLEAN ShowTitleBar;
- BOOLEAN ShowTitleBarTip;
- COLORREF BackColour;
- int oldstyles;
- POINT oldpos;
- RECT wndSize;
-} FrameTitleBar;
-
-typedef struct _DockOpt
-{
- HWND hwndLeft;
- HWND hwndRight;
-}
-DockOpt;
-
-typedef struct {
- int id;
- HWND hWnd ;
- RECT wndSize;
- LPTSTR name;
- int align;
- int height;
- int dwFlags;
- BOOLEAN Locked;
- BOOLEAN visible;
- BOOLEAN needhide;
- BOOLEAN collapsed;
- int prevvisframe;
- int HeightWhenCollapsed;
- FrameTitleBar TitleBar;
- FrameMenuHandles MenuHandles;
- int oldstyles;
- BOOLEAN floating;
- HWND ContainerWnd;
- POINT FloatingPos;
- POINT FloatingSize;
- BOOLEAN minmaxenabled;
- BOOLEAN UseBorder;
- int order;
- DockOpt dockOpt;
-} wndFrame;
-
-//static wndFrame Frames[MAX_FRAMES];
-static wndFrame *Frames = NULL;
+//static FRAMEWND Frames[MAX_FRAMES];
+static FRAMEWND *Frames = NULL;
static int nFramescount = 0;
static int alclientFrame = -1;//for fast access to frame with alclient properties
@@ -160,15 +85,15 @@ static int curdragbar = -1; static CRITICAL_SECTION csFrameHook;
static BOOLEAN CLUIFramesFitInSize(void);
-static int RemoveItemFromList(int pos,wndFrame **lpFrames,int *FrameItemCount);
+static int RemoveItemFromList(int pos,FRAMEWND **lpFrames,int *FrameItemCount);
HWND hWndExplorerToolBar;
static int GapBetweenFrames = 1;
-static int RemoveItemFromList(int pos,wndFrame **lpFrames,int *FrameItemCount)
+static int RemoveItemFromList(int pos,FRAMEWND **lpFrames,int *FrameItemCount)
{
- memcpy(&((*lpFrames)[pos]),&((*lpFrames)[pos+1]),sizeof(wndFrame)*(*FrameItemCount-pos-1));
+ memcpy(&((*lpFrames)[pos]),&((*lpFrames)[pos+1]),sizeof(FRAMEWND)*(*FrameItemCount-pos-1));
(*FrameItemCount)--;
- (*lpFrames) = (wndFrame*)realloc((*lpFrames),sizeof(wndFrame)*(*FrameItemCount));
+ (*lpFrames) = (FRAMEWND*)realloc((*lpFrames),sizeof(FRAMEWND)*(*FrameItemCount));
return 0;
}
@@ -202,7 +127,7 @@ static void __inline ulockfrm() //////////screen docking,code from "floating contacts" plugin.
-static wndFrame* FindFrameByWnd( HWND hwnd )
+static FRAMEWND* FindFrameByWnd( HWND hwnd )
{
if ( hwnd == NULL )
return NULL;
@@ -214,7 +139,7 @@ static wndFrame* FindFrameByWnd( HWND hwnd ) return NULL;
}
-static void DockThumbs( wndFrame *pThumbLeft, wndFrame *pThumbRight, BOOL bMoveLeft )
+static void DockThumbs( FRAMEWND *pThumbLeft, FRAMEWND *pThumbRight, BOOL bMoveLeft )
{
if ( pThumbRight->dockOpt.hwndLeft == NULL && pThumbLeft->dockOpt.hwndRight == NULL ) {
pThumbRight->dockOpt.hwndLeft = pThumbLeft->ContainerWnd;
@@ -222,7 +147,7 @@ static void DockThumbs( wndFrame *pThumbLeft, wndFrame *pThumbRight, BOOL bMoveL }
}
-static void UndockThumbs( wndFrame *pThumb1, wndFrame *pThumb2 )
+static void UndockThumbs( FRAMEWND *pThumb1, FRAMEWND *pThumb2 )
{
if ( pThumb1 == NULL || pThumb2 == NULL )
return;
@@ -242,12 +167,12 @@ static void UndockThumbs( wndFrame *pThumb1, wndFrame *pThumb2 ) BOOLEAN bMoveTogether;
-static void PositionThumb( wndFrame *pThumb, short nX, short nY )
+static void PositionThumb( FRAMEWND *pThumb, short nX, short nY )
{
- wndFrame *pCurThumb = &Frames[0];
- wndFrame *pDockThumb = pThumb;
- wndFrame fakeMainWindow;
- wndFrame fakeTaskBarWindow;
+ FRAMEWND *pCurThumb = &Frames[0];
+ FRAMEWND *pDockThumb = pThumb;
+ FRAMEWND fakeMainWindow;
+ FRAMEWND fakeTaskBarWindow;
RECT rc;
RECT rcThumb;
RECT rcOld;
@@ -1501,9 +1426,9 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam,LPARAM lParam) lockfrm();
if (nFramescount>=MAX_FRAMES) { ulockfrm(); return -1;}
- Frames = (wndFrame*)realloc(Frames,sizeof(wndFrame)*(nFramescount+1));
+ Frames = (FRAMEWND*)realloc(Frames,sizeof(FRAMEWND)*(nFramescount+1));
- memset(&Frames[nFramescount],0,sizeof(wndFrame));
+ memset(&Frames[nFramescount],0,sizeof(FRAMEWND));
Frames[nFramescount].id = NextFrameId++;
Frames[nFramescount].align = clfrm->align;
Frames[nFramescount].hWnd = clfrm->hWnd;
@@ -1626,14 +1551,14 @@ static INT_PTR CLUIFramesRemoveFrame(WPARAM wParam,LPARAM lParam) }
-int CLUIFramesForceUpdateTB(const wndFrame *Frame)
+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);
return 0;
}
-int CLUIFramesForceUpdateFrame(const wndFrame *Frame)
+int CLUIFramesForceUpdateFrame(const FRAMEWND *Frame)
{
if (Frame->hWnd != 0) {
RedrawWindow(Frame->hWnd,NULL,NULL,RDW_UPDATENOW|RDW_FRAME|RDW_ERASE|RDW_INVALIDATE);
@@ -1646,7 +1571,7 @@ int CLUIFramesForceUpdateFrame(const wndFrame *Frame) return 0;
}
-int CLUIFrameMoveResize(const wndFrame *Frame)
+int CLUIFrameMoveResize(const FRAMEWND *Frame)
{
//int b;
// we need to show or hide the frame?
@@ -2684,7 +2609,7 @@ static HWND CreateContainerWindow(HWND parent,int x,int y,int width,int height) INT_PTR CLUIFrameSetFloat(WPARAM wParam,LPARAM lParam)
{
HWND hwndtmp, hwndtooltiptmp;
- wndFrame *frame;
+ FRAMEWND *frame;
int pos;
lockfrm();
diff --git a/plugins/Clist_mw/src/CLUIFrames/cluiframes.h b/plugins/Clist_mw/src/CLUIFrames/cluiframes.h index d36dff07da..2161b6623b 100644 --- a/plugins/Clist_mw/src/CLUIFrames/cluiframes.h +++ b/plugins/Clist_mw/src/CLUIFrames/cluiframes.h @@ -1,5 +1,5 @@ /*
-Miranda ICQ: the free icq client for MS Windows
+Miranda ICQ: the free icq client for MS Windows
Copyright (C) 2000-2 Richard Hughes, Roland Rabien & Tristan Van de Vreede
This program is free software; you can redistribute it and/or
@@ -17,6 +17,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#pragma once
+
+#ifndef _CLUIFRAMES_H_
+#define _CLUIFRAMES_H_
+
int LoadCLUIFramesModule(void);
int UnLoadCLUIFramesModule(void);
int CLUIFramesGetMinHeight();
@@ -28,8 +33,88 @@ typedef struct tagProtocolData { boolean show;
} ProtocolData;
+typedef struct
+{
+ int order;
+ int realpos;
+}SortData;
+
+
+
+
+//============
+#define CLUIFRAMESSETALIGN "CLUIFramesSetAlign"
+
+#define CLUIFRAMESSETALIGNALTOP "CLUIFramesSetAlignalTop"
+#define CLUIFRAMESSETALIGNALCLIENT "CLUIFramesSetAlignalClient"
+#define CLUIFRAMESSETALIGNALBOTTOM "CLUIFramesSetAlignalBottom"
+
+#define CLUIFRAMESMOVEUPDOWN "CLUIFramesMoveUpDown"
+
+struct FrameMenuHandles
+{
+ HGENMENU MainMenuItem;
+ HGENMENU MIVisible, MITitle, MITBVisible, MILock, MIColl, MIFloating, MIAlignRoot;
+ HGENMENU MIAlignTop, MIAlignClient, MIAlignBottom, MIBorder;
+};
+
+struct FrameTitleBar
+{
+ HWND hwnd;
+ HWND TitleBarbutt;
+ HWND hwndTip;
+
+ LPTSTR tbname;
+ LPTSTR tooltip;
+ HMENU hmenu;
+ HICON hicon;
+
+ BOOLEAN ShowTitleBar;
+ BOOLEAN ShowTitleBarTip;
+ COLORREF BackColour;
+ int oldstyles;
+ POINT oldpos;
+ RECT wndSize;
+};
+
+struct DockOpt
+{
+ HWND hwndLeft;
+ HWND hwndRight;
+};
+
+struct FRAMEWND
+{
+ int id;
+ HWND hWnd;
+ RECT wndSize;
+ LPTSTR name;
+ int align;
+ int height;
+ int dwFlags;
+ BOOLEAN Locked;
+ BOOLEAN visible;
+ BOOLEAN needhide;
+ BOOLEAN collapsed;
+ int prevvisframe;
+ int HeightWhenCollapsed;
+ FrameTitleBar TitleBar;
+ FrameMenuHandles MenuHandles;
+ int oldstyles;
+ BOOLEAN floating;
+ HWND ContainerWnd;
+ POINT FloatingPos;
+ POINT FloatingSize;
+ BOOLEAN minmaxenabled;
+ BOOLEAN UseBorder;
+ int order;
+ DockOpt dockOpt;
+};
+
#define OFFSET_PROTOPOS 200
#define OFFSET_VISIBLE 400
#define CLUIFrameTitleBarClassName _T("CLUIFrameTitleBar")
#define CLUIFrameModule "CLUIFrames"
+
+#endif
diff --git a/plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp b/plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp index 4e94c8b75f..7c1832e177 100644 --- a/plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp @@ -1,6 +1,6 @@ #include "../commonheaders.h"
-// == == == == == == == == == == == == == Frames
+//========================== Frames
HANDLE hFrameMenuObject;
static HANDLE hPreBuildFrameMenuEvent;
extern int InitCustomMenus(void);
@@ -13,37 +13,25 @@ typedef struct{ INT_PTR param1;
}FrameMenuExecParam,*lpFrameMenuExecParam;
-void FreeAndNil( void **p )
+INT_PTR FreeOwnerDataFrameMenu(WPARAM wParam, LPARAM lParam)
{
- if ( p == NULL )
- return;
-
- if ( *p != NULL ) {
- mir_free( *p );
- *p = NULL;
-} }
-
-INT_PTR FreeOwnerDataFrameMenu (WPARAM wParam,LPARAM lParam)
-{
- lpFrameMenuExecParam cmep;
-
- cmep = (lpFrameMenuExecParam)lParam;
+ lpFrameMenuExecParam cmep = (lpFrameMenuExecParam)lParam;
if (cmep != NULL){
- FreeAndNil((void**)&cmep->szServiceName);
- FreeAndNil((void**)&cmep);
+ mir_free(cmep->szServiceName);
+ mir_free(cmep);
}
return 0;
}
-static INT_PTR AddContextFrameMenuItem(WPARAM wParam,LPARAM lParam)
+static INT_PTR AddContextFrameMenuItem(WPARAM wParam, LPARAM lParam)
{
- TMO_MenuItem tmi;
CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+
+ TMO_MenuItem tmi;
if ( !pcli->pfnConvertMenu(mi, &tmi))
- return 0;
+ return NULL;
- if ((mi->flags & CMIF_ROOTPOPUP) || (mi->flags & CMIF_CHILDPOPUP))
- tmi.root = mi->hParentMenu;
+ tmi.root = (mi->flags & CMIF_ROOTHANDLE) ? mi->hParentMenu : NULL;
lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mir_alloc(sizeof(FrameMenuExecParam));
if (fmep == NULL)
@@ -57,19 +45,8 @@ static INT_PTR AddContextFrameMenuItem(WPARAM wParam,LPARAM lParam) return CallService(MO_ADDNEWMENUITEM, (WPARAM)hFrameMenuObject, (LPARAM)&tmi);
}
-static INT_PTR RemoveContextFrameMenuItem(WPARAM wParam,LPARAM lParam)
+static INT_PTR RemoveContextFrameMenuItem(WPARAM wParam, LPARAM lParam)
{
- /* this do by free service
- lpFrameMenuExecParam fmep;
- fmep = (lpFrameMenuExecParam)CallService(MO_MENUITEMGETOWNERDATA,wParam,lParam);
- if (fmep != NULL){
- if (fmep->szServiceName != NULL){
- mir_free(fmep->szServiceName);
- fmep->szServiceName = NULL;
- }
- mir_free(fmep);
- }
- */
CallService(MO_REMOVEMENUITEM,wParam,0);
return 0;
}
@@ -77,34 +54,36 @@ static INT_PTR RemoveContextFrameMenuItem(WPARAM wParam,LPARAM lParam) //called with:
//wparam - ownerdata
//lparam - lparam from winproc
-INT_PTR FrameMenuExecService(WPARAM wParam,LPARAM lParam)
+INT_PTR FrameMenuExecService(WPARAM wParam, LPARAM lParam)
{
lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)wParam;
- if (fmep == NULL){return(-1);}
- CallService(fmep->szServiceName,lParam,fmep->param1);
+ if (fmep == NULL)
+ return -1;
+ CallService(fmep->szServiceName, lParam, fmep->param1);
return 0;
}
//true - ok,false ignore
-INT_PTR FrameMenuCheckService(WPARAM wParam,LPARAM lParam)
+INT_PTR FrameMenuCheckService(WPARAM wParam, LPARAM lParam)
{
PCheckProcParam pcpp = (PCheckProcParam)wParam;
if (pcpp == NULL)
return FALSE;
TMO_MenuItem mi;
- if (CallService(MO_GETMENUITEM,(WPARAM)pcpp->MenuItemHandle,(LPARAM)&mi) == 0) {
- lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mi.ownerdata;
+ if (CallService(MO_GETMENUITEM, (WPARAM)pcpp->MenuItemHandle, (LPARAM)&mi) == 0) {
+ lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mi.ownerdata;
if (fmep != NULL) {
//pcpp->wParam - frameid
- if (((WPARAM)fmep->Frameid == pcpp->wParam)||fmep->Frameid == -1) return(TRUE);
+ if (((WPARAM)fmep->Frameid == pcpp->wParam) || fmep->Frameid == -1)
+ return TRUE;
}
}
return FALSE;
}
-static INT_PTR ContextFrameMenuNotify(WPARAM wParam,LPARAM lParam)
+static INT_PTR ContextFrameMenuNotify(WPARAM wParam, LPARAM lParam)
{
NotifyEventHooks(hPreBuildFrameMenuEvent,wParam,lParam);
return 0;
@@ -112,21 +91,18 @@ static INT_PTR ContextFrameMenuNotify(WPARAM wParam,LPARAM lParam) static INT_PTR BuildContextFrameMenu(WPARAM wParam,LPARAM lParam)
{
- CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
- HMENU hMenu;
ListParam param = { 0 };
param.MenuObjectHandle = hFrameMenuObject;
param.wParam = wParam;
param.lParam = lParam;
- hMenu = CreatePopupMenu();
- //NotifyEventHooks(hPreBuildFrameMenuEvent,wParam,-1);
- ContextFrameMenuNotify(wParam,-1);
- CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m);
+ HMENU hMenu = CreatePopupMenu();
+ ContextFrameMenuNotify(wParam, -1);
+ CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)¶m);
return (INT_PTR)hMenu;
}
-// == == == == == == == == == == == == == Frames end
+//========================== Frames end
int InitFramesMenus(void)
{
diff --git a/plugins/Clist_mw/src/clc.h b/plugins/Clist_mw/src/clc.h index 7d8e8c7e82..58dea44696 100644 --- a/plugins/Clist_mw/src/clc.h +++ b/plugins/Clist_mw/src/clc.h @@ -144,6 +144,4 @@ typedef struct { extern ExternDrawer SED;
-void FreeAndNil( void** p );
-
#endif /* _CLC_H_ */
diff --git a/plugins/Clist_mw/src/clisttray.cpp b/plugins/Clist_mw/src/clisttray.cpp index ddfcb22811..65ff0b8cec 100644 --- a/plugins/Clist_mw/src/clisttray.cpp +++ b/plugins/Clist_mw/src/clisttray.cpp @@ -183,8 +183,8 @@ INT_PTR FreeOwnerDataTrayMenu (WPARAM wParam,LPARAM lParam) lpTrayMenuExecParam mmep;
mmep = (lpTrayMenuExecParam)lParam;
if (mmep != NULL){
- FreeAndNil((void**)&mmep->szServiceName);
- FreeAndNil((void**)&mmep);
+ mir_free(mmep->szServiceName);
+ mir_free(mmep);
}
return 0;
diff --git a/plugins/Clist_mw/src/groupmenu.cpp b/plugins/Clist_mw/src/groupmenu.cpp index ba13c66479..c6fd1ea357 100644 --- a/plugins/Clist_mw/src/groupmenu.cpp +++ b/plugins/Clist_mw/src/groupmenu.cpp @@ -164,17 +164,15 @@ INT_PTR GroupMenuExecService(WPARAM wParam,LPARAM lParam) { }
return(1);
}
+
INT_PTR FreeOwnerDataGroupMenu (WPARAM wParam,LPARAM lParam)
{
-
- lpGroupMenuExecParam mmep;
- mmep = (lpGroupMenuExecParam)lParam;
- if (mmep != NULL){
- FreeAndNil((void**)&mmep->szServiceName);
- FreeAndNil((void**)&mmep);
+ lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)lParam;
+ if (mmep != NULL) {
+ mir_free(mmep->szServiceName);
+ mir_free(mmep);
}
-
-return 0;
+ return 0;
}
INT_PTR HideGroupsHelper(WPARAM wParam,LPARAM lParam)
@@ -489,13 +487,11 @@ INT_PTR SubGroupMenuExecService(WPARAM wParam,LPARAM lParam) INT_PTR FreeOwnerDataSubGroupMenu (WPARAM wParam,LPARAM lParam)
{
- lpSubGroupMenuExecParam mmep;
- mmep = (lpSubGroupMenuExecParam)lParam;
+ lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)lParam;
if (mmep != NULL) {
- FreeAndNil((void**)&mmep->szServiceName);
- FreeAndNil((void**)&mmep);
+ mir_free(mmep->szServiceName);
+ mir_free(mmep);
}
-
return 0;
}
|