From f2f42a46a95bdb6c412a2bf62aa538d6f02ba703 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Tue, 16 Dec 2014 21:32:42 +0000 Subject: Actman 30: some UA improvements git-svn-id: http://svn.miranda-ng.org/main/trunk@11477 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Actman30/ua/i_uaplaces.inc | 79 ++++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 21 deletions(-) (limited to 'plugins/Actman30/ua/i_uaplaces.inc') diff --git a/plugins/Actman30/ua/i_uaplaces.inc b/plugins/Actman30/ua/i_uaplaces.inc index b380f341ba..222065b460 100644 --- a/plugins/Actman30/ua/i_uaplaces.inc +++ b/plugins/Actman30/ua/i_uaplaces.inc @@ -342,12 +342,12 @@ end; procedure CreateMenuItem(var ActionItem:tMyActionItem;mtype:tMenuType); var - i:integer; + extra:pWideChar; ActItem:pMyActionItem; ActMItem,UAMenuItem:pUAMenuItem; clmi:TCListMenuItem; + i:integer; res:boolean; - extra:pWideChar; begin {} UAMenuItem:=@ActionItem.UAMenuItem[mtype]; @@ -376,7 +376,7 @@ begin end; end; end; - // popup menu not found + // need to create popup menu if not res then begin FillChar(clmi,SizeOf(clmi),0); @@ -387,8 +387,15 @@ begin clmi.flags :=CMIF_UNICODE{ or CMIF_ICONFROMICOLIB}; if (UAMenuItem.szMenuPopup<>nil) and (UAMenuItem.szMenuPopup^<>#0) then - clmi.szName.w:=ParseVarString(UAMenuItem.szMenuPopup) + begin + if (UAMenuItem.menu_opt and UAF_MSUBVAR)<>0 then + clmi.szName.w:=ParseVarString(UAMenuItem.szMenuPopup) + else + clmi.szName.w:=UAMenuItem.szMenuPopup; + end else + clmi.szName.w:=nil; + if clmi.szName.w=nil then clmi.szName.w:=ActionItem.szActDescr; clmi.hIcon :=AddRootMenuIcon(clmi.szName.w); @@ -399,8 +406,9 @@ begin (UAMenuItem.menu_opt and UAF_MENUSEP)<>0)); UAMenuItem.hMenuRoot:=MakeMenuItem(mtype,@clmi); - //CallService(MenuServices[mtype],0,LPARAM(@clmi)); - if clmi.szName.w<>ActionItem.szActDescr then + + if (clmi.szName.w<>ActionItem.szActDescr) and + (clmi.szName.w<>UAMenuItem.szMenuPopup) then mFreeMem(clmi.szName.w); for i:=1 to HIGH(arMenuRec) do @@ -437,18 +445,22 @@ begin extra:='1'; end; - with ActionItem.UAMenuItem[mtype] do + if (UAMenuItem.szMenuNameVars<>nil) and (UAMenuItem.szMenuNameVars^<>#0) then begin - if (szMenuNameVars<>nil) and (szMenuNameVars^<>#0) then - clmi.szName.w:=ParseVarString(szMenuNameVars,0,extra) + if (UAMenuItem.menu_opt and UAF_MNAMVAR)<>0 then + clmi.szName.w:=ParseVarString(UAMenuItem.szMenuNameVars,0,extra) else - clmi.szName.w:=ActionItem.szActDescr; + clmi.szName.w:=UAMenuItem.szMenuNameVars; + end + else + clmi.szName.w:=nil; + if clmi.szName.w=nil then + clmi.szName.w:=ActionItem.szActDescr; - if hMenuRoot<>0 then - begin - clmi.flags:=clmi.flags or CMIF_ROOTHANDLE; - clmi.szPopupName.w:=pWideChar(hMenuRoot); - end; + if UAMenuItem.hMenuRoot<>0 then + begin + clmi.flags:=clmi.flags or CMIF_ROOTHANDLE; + clmi.szPopupName.w:=pWideChar(UAMenuItem.hMenuRoot); end; clmi.pszService:=ActionItem.szNameID; @@ -463,7 +475,8 @@ begin UAMenuItem.hMenuItem:=MakeMenuItem(mtype,@clmi); //CallService(MenuServices[mtype],0,LPARAM(@clmi)); - if clmi.szName.w<>ActionItem.szActDescr then + if (clmi.szName.w<>ActionItem.szActDescr) and + (clmi.szName.w<>UAMenuItem.szMenuNameVars) then mFreeMem(clmi.szName.w); {} @@ -550,14 +563,22 @@ begin // new name mi.flags:=mi.flags or CMIM_NAME or CMIF_UNICODE; if (szMenuNameVars<>nil) and (szMenuNameVars^<>#0) then - mi.szName.w:=ParseVarString(szMenuNameVars,hContact,extra); - + begin + if (menu_opt and UAF_MNAMVAR)<>0 then + mi.szName.w:=ParseVarString(szMenuNameVars,hContact,extra) + else + mi.szName.w:=szMenuNameVars; + end + else + mi.szName.w:=nil; if mi.szName.w=nil then mi.szName.w:=szActDescr; end; CallService(MS_CLIST_MODIFYMENUITEM,hMenuItem,LPARAM(@mi)); - if mi.szName.w<>szActDescr then + + if (mi.szName.w<>szActDescr) and + (mi.szName.w<>szMenuNameVars) then mFreeMem(mi.szName.w); end; end; @@ -631,13 +652,24 @@ begin if ActionItem.szTTBTooltip =nil then pc1:=pc - else pc1:=ActionItem.szTTBTooltip; + else + begin + if (ActionItem.flags and UAF_TTBTTUV)<>0 then + pc1:=ParseVarString(ActionItem.szTTBTooltip) + else + pc1:=ActionItem.szTTBTooltip; + end; if ((ActionItem.flags and UAF_2STATE)=0) or (ActionItem.szTTBTooltipPressed=nil) then pc2:=pc1 else - pc2:=ActionItem.szTTBTooltipPressed; + begin + if (ActionItem.flags and UAF_TTBTTPV)<>0 then + pc2:=ParseVarString(ActionItem.szTTBTooltipPressed) + else + pc2:=ActionItem.szTTBTooltipPressed; + end; mtButton.Name :=pc; mtButton.pszTooltipUp :=pc1; @@ -646,6 +678,11 @@ begin ActionItem.hTTBButton:=TopToolbar_AddButton(@mtButton); if ActionItem.hTTBButton=THANDLE(-1) then ActionItem.hTTBButton:=0; + if (pc2<>pc1) and (pc2<>ActionItem.szTTBTooltipPressed) then + mFreeMem(pc2); + if (pc1<>pc) and (pc1<>ActionItem.szTTBTooltip) then + mFreeMem(pc1); + mFreeMem(pc); end; end; -- cgit v1.2.3