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_modern | |
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_modern')
-rw-r--r-- | plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp | 40 | ||||
-rw-r--r-- | plugins/Clist_modern/src/CLUIFrames/cluiframes.h | 18 | ||||
-rw-r--r-- | plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp | 47 | ||||
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_commonprototypes.h | 1 | ||||
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_global_structure.h | 1 | ||||
-rw-r--r-- | plugins/Clist_modern/src/init.cpp | 1 |
6 files changed, 50 insertions, 58 deletions
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp index f30b090a19..6b3fa35d5f 100644 --- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp @@ -698,7 +698,7 @@ static int DBStoreFrameSettingsAtPos(int pos,int Frameid) _itoa(pos,sadd,10);
- db_set_ws(0, CLUIFrameModule,AS(buf,"Name",sadd),g_pfwFrames[Frameid].Name);
+ db_set_ws(0, CLUIFrameModule,AS(buf,"Name",sadd),g_pfwFrames[Frameid].name);
//bool
db_set_b(0, CLUIFrameModule,AS(buf,"Collapse",sadd),(BYTE)btoint(g_pfwFrames[Frameid].collapsed));
db_set_b(0, CLUIFrameModule,AS(buf,"Locked",sadd),(BYTE)btoint(g_pfwFrames[Frameid].Locked));
@@ -722,7 +722,7 @@ static int DBStoreFrameSettingsAtPos(int pos,int Frameid) static int LocateStorePosition(int Frameid,int maxstored)
{
- if (g_pfwFrames[Frameid].Name == NULL)
+ if (g_pfwFrames[Frameid].name == NULL)
return -1;
char settingname[255];
@@ -732,7 +732,7 @@ static int LocateStorePosition(int Frameid,int maxstored) if ( db_get_ts( NULL, CLUIFrameModule, settingname, &dbv ))
continue;
- if ( lstrcmpi(dbv.ptszVal, g_pfwFrames[Frameid].Name) == 0) {
+ if ( lstrcmpi(dbv.ptszVal, g_pfwFrames[Frameid].name) == 0) {
db_free( &dbv );
return i;
}
@@ -995,7 +995,7 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam,LPARAM lParam) CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS|CMIM_NAME|CMIF_CHILDPOPUP|CMIF_TCHAR;
if (g_pfwFrames[pos].visible) mi.flags |= CMIF_CHECKED;
- mi.ptszName = g_pfwFrames[pos].TitleBar.tbname ? g_pfwFrames[pos].TitleBar.tbname : g_pfwFrames[pos].Name;
+ mi.ptszName = g_pfwFrames[pos].TitleBar.tbname ? g_pfwFrames[pos].TitleBar.tbname : g_pfwFrames[pos].name;
ModifyMItem((WPARAM)_hmiVisible,(LPARAM)&mi);
mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP;
@@ -1047,7 +1047,7 @@ static int CLUIFramesModifyMainMenuItems(WPARAM wParam,LPARAM lParam) CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS|CMIM_NAME|CMIF_CHILDPOPUP|CMIF_TCHAR;
if (g_pfwFrames[pos].visible) mi.flags |= CMIF_CHECKED;
- mi.ptszName = g_pfwFrames[pos].TitleBar.tbname ? g_pfwFrames[pos].TitleBar.tbname : g_pfwFrames[pos].Name;
+ mi.ptszName = g_pfwFrames[pos].TitleBar.tbname ? g_pfwFrames[pos].TitleBar.tbname : g_pfwFrames[pos].name;
Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIVisible, &mi);
mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP;
@@ -1120,7 +1120,7 @@ static INT_PTR _us_DoGetFrameOptions(WPARAM wParam,LPARAM lParam) case FO_NAME:
if (bUnicodeText)
- retval = (INT_PTR)g_pfwFrames[pos].Name;
+ retval = (INT_PTR)g_pfwFrames[pos].name;
else
retval = (INT_PTR)g_pfwFrames[pos].szName;
break;
@@ -1234,15 +1234,15 @@ static int _us_DoSetFrameOptions(WPARAM wParam,LPARAM lParam) if (lParam == 0)
return -1;
- mir_free(fw.Name);
+ mir_free(fw.name);
mir_free(fw.szName);
if (bUnicodeText) {
- fw.Name = mir_tstrdup((LPTSTR)lParam);
+ fw.name = mir_tstrdup((LPTSTR)lParam);
fw.szName = mir_t2a((LPTSTR)lParam);
}
else {
fw.szName = mir_strdup((char*)lParam);
- fw.Name = mir_a2t((char *)lParam);
+ fw.name = mir_a2t((char *)lParam);
}
return 0;
@@ -1724,7 +1724,7 @@ static int CLUIFramesLoadMainMenu() mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
mi.position = separator;
mi.hParentMenu = _hmiRoot;
- mi.ptszName = g_pfwFrames[i].TitleBar.tbname ? g_pfwFrames[i].TitleBar.tbname : g_pfwFrames[i].Name;
+ mi.ptszName = g_pfwFrames[i].TitleBar.tbname ? g_pfwFrames[i].TitleBar.tbname : g_pfwFrames[i].name;
mi.pszService = 0;
g_pfwFrames[i].MenuHandles.MainMenuItem = Menu_AddMainMenuItem(&mi);
CLUIFramesCreateMenuForFrame(g_pfwFrames[i].id,(int)g_pfwFrames[i].MenuHandles.MainMenuItem,separator,Menu_AddMainMenuItem);
@@ -1809,17 +1809,17 @@ static int _us_DoAddFrame(WPARAM wParam,LPARAM lParam) g_pfwFrames[g_nFramesCount].dwFlags = clfrm->Flags;
if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? lstrlenW(clfrm->wname) : lstrlenA(clfrm->name)) == 0) {
- g_pfwFrames[g_nFramesCount].Name = (LPTSTR)mir_alloc(255 * sizeof(TCHAR));
- GetClassName(g_pfwFrames[g_nFramesCount].hWnd,g_pfwFrames[g_nFramesCount].Name,255);
+ 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].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);
+ g_pfwFrames[g_nFramesCount].szName = mir_t2a(g_pfwFrames[g_nFramesCount].name);
if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == NULL
|| ((clfrm->Flags&F_UNICODE) ? lstrlenW(clfrm->TBwname) : lstrlenA(clfrm->TBname)) == 0)
- g_pfwFrames[g_nFramesCount].TitleBar.tbname = mir_tstrdup(g_pfwFrames[g_nFramesCount].Name);
+ 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);
@@ -1840,7 +1840,7 @@ static int _us_DoAddFrame(WPARAM wParam,LPARAM lParam) g_pfwFrames[g_nFramesCount].TitleBar.hwnd
- = CreateWindow(CLUIFrameTitleBarClassName,g_pfwFrames[g_nFramesCount].Name,
+ = CreateWindow(CLUIFrameTitleBarClassName,g_pfwFrames[g_nFramesCount].name,
( db_get_b(0, CLUIFrameModule,"RemoveAllTitleBarBorders",1)?0:WS_BORDER)
|WS_CHILD|WS_CLIPCHILDREN|
@@ -1954,7 +1954,7 @@ static int _us_DoRemoveFrame(WPARAM wParam,LPARAM lParam) if (pos < 0 || pos>g_nFramesCount){return(-1);};
- mir_free_and_nil(g_pfwFrames[pos].Name);
+ 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);
@@ -2998,7 +2998,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam if (framepos == -1){break;};
hmenu = CreatePopupMenu();
// Frames[Frameid].TitleBar.hmenu = hmenu;
- AppendMenu(hmenu,MF_STRING|MF_DISABLED|MF_GRAYED,15,g_pfwFrames[framepos].Name);
+ AppendMenu(hmenu,MF_STRING|MF_DISABLED|MF_GRAYED,15,g_pfwFrames[framepos].name);
AppendMenu(hmenu,MF_SEPARATOR,16,_T(""));
if (g_pfwFrames[framepos].Locked)
@@ -3916,8 +3916,6 @@ int UnLoadCLUIFramesModule(void) CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0);
CLUIFramesStoreAllFrames();
-
- UnitFramesMenu();
UnloadMainMenu();
for (i=0; i < g_nFramesCount; i++)
{
@@ -3935,7 +3933,7 @@ int UnLoadCLUIFramesModule(void) g_pfwFrames[i].OwnerWindow = (HWND)-2;
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].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);
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.h b/plugins/Clist_modern/src/CLUIFrames/cluiframes.h index 75bf89a8bd..4e9f831250 100644 --- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.h +++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.h @@ -60,8 +60,8 @@ typedef struct struct FrameMenuHandles
{
HGENMENU MainMenuItem;
- HGENMENU MIVisible,MITitle,MITBVisible,MILock,MIColl,MIFloating,MIAlignRoot;
- HGENMENU MIAlignTop,MIAlignClient,MIAlignBottom;
+ HGENMENU MIVisible, MITitle, MITBVisible, MILock, MIColl, MIFloating, MIAlignRoot;
+ HGENMENU MIAlignTop, MIAlignClient, MIAlignBottom;
HGENMENU MIBorder, MIPosRoot, MIPosUp, MIPosDown;
};
@@ -71,8 +71,8 @@ struct FrameTitleBar HWND TitleBarbutt;
HWND hwndTip;
- TCHAR* tbname;
- TCHAR* tooltip;
+ LPTSTR tbname;
+ LPTSTR tooltip;
char * sztbname;
char * sztooltip;
@@ -98,10 +98,10 @@ struct DockOpt struct FRAMEWND
{
int id;
- HWND hWnd ;
+ HWND hWnd;
RECT wndSize;
- TCHAR * Name;
- char * szName;
+ LPTSTR name;
+ LPSTR szName;
int align;
int height;
int dwFlags;
@@ -137,7 +137,3 @@ struct FRAMEWND #define CLUIFrameModule "CLUIFrames"
#endif
-
-
-
-
diff --git a/plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp index 8473c9403b..80ba3433c0 100644 --- a/plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp @@ -3,6 +3,7 @@ //========================== Frames
HANDLE hFrameMenuObject;
+static HANDLE hPreBuildFrameMenuEvent;
//contactmenu exec param(ownerdata)
//also used in checkservice
@@ -10,8 +11,17 @@ typedef struct{ char *szServiceName;
int Frameid;
INT_PTR param1;
+}FrameMenuExecParam,*lpFrameMenuExecParam;
+
+INT_PTR FreeOwnerDataFrameMenu(WPARAM wParam, LPARAM lParam)
+{
+ lpFrameMenuExecParam cmep = (lpFrameMenuExecParam)lParam;
+ if (cmep != NULL){
+ mir_free(cmep->szServiceName);
+ mir_free(cmep);
+ }
+ return 0;
}
- FrameMenuExecParam,*lpFrameMenuExecParam;
static INT_PTR AddContextFrameMenuItem(WPARAM wParam, LPARAM lParam)
{
@@ -27,23 +37,16 @@ static INT_PTR AddContextFrameMenuItem(WPARAM wParam, LPARAM lParam) if (fmep == NULL)
return 0;
- memset(fmep, 0, sizeof(FrameMenuExecParam));
fmep->szServiceName = mir_strdup(mi->pszService);
fmep->Frameid = mi->popupPosition;
fmep->param1 = (INT_PTR)mi->pszContactOwner;
tmi.ownerdata = fmep;
+
return CallService(MO_ADDNEWMENUITEM, (WPARAM)hFrameMenuObject, (LPARAM)&tmi);
}
static INT_PTR RemoveContextFrameMenuItem(WPARAM wParam, LPARAM lParam)
{
- lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)CallService(MO_MENUITEMGETOWNERDATA, wParam, lParam);
- if (fmep != NULL) {
- if (fmep->szServiceName != NULL)
- mir_free(fmep->szServiceName);
- mir_free(fmep);
- }
-
if (lParam != 1)
CallService(MO_REMOVEMENUITEM, wParam, 0);
@@ -56,7 +59,7 @@ static INT_PTR RemoveContextFrameMenuItem(WPARAM wParam, LPARAM lParam) INT_PTR FrameMenuExecService(WPARAM wParam, LPARAM lParam)
{
lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)wParam;
- if (fmep ==NULL)
+ if (fmep == NULL)
return -1;
CallService(fmep->szServiceName, lParam, fmep->param1);
@@ -71,7 +74,7 @@ INT_PTR FrameMenuCheckService(WPARAM wParam, LPARAM lParam) return FALSE;
TMO_MenuItem mi;
- if ( CallService(MO_GETMENUITEM, (WPARAM)pcpp->MenuItemHandle, (LPARAM)&mi) == 0) {
+ if (CallService(MO_GETMENUITEM, (WPARAM)pcpp->MenuItemHandle, (LPARAM)&mi) == 0) {
lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mi.ownerdata;
if (fmep != NULL) {
//pcpp->wParam - frameid
@@ -84,7 +87,7 @@ INT_PTR FrameMenuCheckService(WPARAM wParam, LPARAM lParam) static INT_PTR ContextFrameMenuNotify(WPARAM wParam, LPARAM lParam)
{
- NotifyEventHooks(g_CluiData.hEventPreBuildFrameMenu, wParam, lParam);
+ NotifyEventHooks(hPreBuildFrameMenuEvent,wParam,lParam);
return 0;
}
@@ -105,20 +108,18 @@ static INT_PTR BuildContextFrameMenu(WPARAM wParam,LPARAM lParam) int InitFramesMenus(void)
{
- CreateServiceFunction("FrameMenuExecService",FrameMenuExecService);
- CreateServiceFunction("FrameMenuCheckService",FrameMenuCheckService);
+ CreateServiceFunction("FrameMenuExecService", FrameMenuExecService);
+ CreateServiceFunction("FrameMenuCheckService", FrameMenuCheckService);
+ CreateServiceFunction("FrameMenuFreeService", FreeOwnerDataFrameMenu);
- CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM,RemoveContextFrameMenuItem);
- CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem);
- CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu);
- CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify);
+ CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, RemoveContextFrameMenuItem);
+ CreateServiceFunction("CList/AddContextFrameMenuItem", AddContextFrameMenuItem);
+ CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT, BuildContextFrameMenu);
+ CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY, ContextFrameMenuNotify);
+ hPreBuildFrameMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU);
// frame menu object
hFrameMenuObject = MO_CreateMenuObject("FrameMenu", LPGEN("Frame menu"), "FrameMenuCheckService", "FrameMenuExecService");
- return 0;
-}
-
-int UnitFramesMenu()
-{
+ MO_SetMenuObjectParam(hFrameMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "FrameMenuFreeService");
return 0;
}
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index 449bc44caf..5f7b6cbf0e 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -242,7 +242,6 @@ INT_PTR ToggleHideOffline(WPARAM wParam,LPARAM lParam); INT_PTR ToggleGroups(WPARAM wParam,LPARAM lParam); //contact.c
INT_PTR SetUseGroups(WPARAM wParam,LPARAM lParam); //contact.c
INT_PTR ToggleSounds(WPARAM wParam,LPARAM lParam); //contact.c
-int UnitFramesMenu(); //framesmenu.c
void ClcOptionsChanged(); //clc.c
void Docking_GetMonitorRectFromWindow(HWND hWnd,RECT *rc); //Docking.c
void DrawAvatarImageWithGDIp(HDC hDestDC,int x, int y, DWORD width, DWORD height, HBITMAP hbmp, int x1, int y1, DWORD width1, DWORD height1,DWORD flag,BYTE alpha); //gdiplus.cpp
diff --git a/plugins/Clist_modern/src/hdr/modern_global_structure.h b/plugins/Clist_modern/src/hdr/modern_global_structure.h index b8742177a0..f76999b8c1 100644 --- a/plugins/Clist_modern/src/hdr/modern_global_structure.h +++ b/plugins/Clist_modern/src/hdr/modern_global_structure.h @@ -76,7 +76,6 @@ typedef struct tagCLUIDATA HANDLE hEventExtraClick;
HANDLE hEventBkgrChanged;
HANDLE hEventPreBuildTrayMenu;
- HANDLE hEventPreBuildFrameMenu;
HANDLE hEventPreBuildGroupMenu;
HANDLE hEventPreBuildSubGroupMenu;
HANDLE hEventStatusBarShowToolTip;
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 86d22f0929..1d14999269 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -202,7 +202,6 @@ static HRESULT CreateHookableEvents() {
g_CluiData.hEventBkgrChanged = CreateHookableEvent(ME_BACKGROUNDCONFIG_CHANGED);
g_CluiData.hEventPreBuildTrayMenu = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU);
- g_CluiData.hEventPreBuildFrameMenu = CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU);
g_CluiData.hEventPreBuildGroupMenu = CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU);
g_CluiData.hEventPreBuildSubGroupMenu = CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU);
g_CluiData.hEventStatusBarShowToolTip = CreateHookableEvent(ME_CLIST_FRAMES_SB_SHOW_TOOLTIP);
|