summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Kulakov <panda75@bk.ru>2014-12-16 21:32:42 +0000
committerAlexey Kulakov <panda75@bk.ru>2014-12-16 21:32:42 +0000
commitf2f42a46a95bdb6c412a2bf62aa538d6f02ba703 (patch)
tree9f56f0e1ed0ffadc36ad7a531e0147f273586469
parentd785da88b3d23c794241203bc34564c38de43f6e (diff)
Actman 30: some UA improvements
git-svn-id: http://svn.miranda-ng.org/main/trunk@11477 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Actman30/ua/i_opt_dlg.inc20
-rw-r--r--plugins/Actman30/ua/i_uaplaces.inc79
-rw-r--r--plugins/Actman30/ua/i_uavars.inc4
3 files changed, 80 insertions, 23 deletions
diff --git a/plugins/Actman30/ua/i_opt_dlg.inc b/plugins/Actman30/ua/i_opt_dlg.inc
index 5a85bf2a52..6e5cc4d117 100644
--- a/plugins/Actman30/ua/i_opt_dlg.inc
+++ b/plugins/Actman30/ua/i_opt_dlg.inc
@@ -160,9 +160,7 @@ end;
procedure InitActionSettings(Dialog:HWND);
begin
MakeEditField(Dialog,IDC_UA_TTNORMALV);
- SetEditFlags(GetDlgItem(Dialog,IDC_UA_TTNORMALV),EF_FORCE,EF_FORCET);
MakeEditField(Dialog,IDC_UA_TTPRESSEDV);
- SetEditFlags(GetDlgItem(Dialog,IDC_UA_TTPRESSEDV),EF_FORCE,EF_FORCET);
MakeEditField(Dialog,IDC_UA_POPUPV);
MakeEditField(Dialog,IDC_UA_VARNAMESV);
@@ -241,6 +239,7 @@ procedure ShowSubAction(Dialog:HWND;aType:integer;item:integer=-1);
var
UA:pMyActionItem;
s:HWND;
+ i:integer;
begin
s:=settings;
settings:=0;
@@ -267,6 +266,11 @@ begin
SetDlgItemTextA(Dialog,IDC_UA_TTNORMALV ,UA.szTTBTooltip);
SetDlgItemTextA(Dialog,IDC_UA_TTPRESSEDV,UA.szTTBTooltipPressed);
SetDlgItemTextW(Dialog,IDC_UA_SHOWVARV ,UA.szTTBShowWhenVars);
+
+ if (UA.flags and UAF_TTBTTUV)<>0 then i:=EF_SCRIPT else i:=0;
+ SetEditFlags(Dialog,IDC_UA_TTNORMALV ,EF_ALL,i);
+ if (UA.flags and UAF_TTBTTPV)<>0 then i:=EF_SCRIPT else i:=0;
+ SetEditFlags(Dialog,IDC_UA_TTPRESSEDV,EF_ALL,i);
end;
uaTAB: begin // TabSRMM toolbar
@@ -284,6 +288,10 @@ begin
SetDlgItemTextW(Dialog,IDC_UA_POPUPV ,szMenuPopup);
SetDlgItemTextW(Dialog,IDC_UA_VARNAMESV,szMenuNameVars);
SetDlgItemTextW(Dialog,IDC_UA_SHOWVARV ,szMenuShowWhenVars);
+ if (menu_opt and UAF_MNAMVAR)<>0 then i:=EF_SCRIPT else i:=0;
+ SetEditFlags(Dialog,IDC_UA_VARNAMESV,EF_ALL,i);
+ if (menu_opt and UAF_MSUBVAR)<>0 then i:=EF_SCRIPT else i:=0;
+ SetEditFlags(Dialog,IDC_UA_POPUPV,EF_ALL,i);
end;
end;
@@ -383,6 +391,10 @@ begin
menu_opt:=menu_opt or UAF_NOTRANS;
if IsDlgButtonchecked(Dialog,IDC_UA_SEPARATE)<>BST_UNCHECKED then
menu_opt:=menu_opt or UAF_MENUSEP;
+ if (GetEditFlags(Dialog,IDC_UA_VARNAMESV) and EF_SCRIPT)<>0 then
+ menu_opt:=menu_opt or UAF_MNAMVAR;
+ if (GetEditFlags(Dialog,IDC_UA_POPUPV) and EF_SCRIPT)<>0 then
+ menu_opt:=menu_opt or UAF_MSUBVAR;
end;
end;
@@ -436,6 +448,10 @@ begin
mFreeMem(szTTBTooltip ); szTTBTooltip :=GetDlgText(Dialog,IDC_UA_TTNORMALV ,true);
mFreeMem(szTTBTooltipPressed); szTTBTooltipPressed:=GetDlgText(Dialog,IDC_UA_TTPRESSEDV,true);
mFreeMem(szTTBShowWhenVars ); szTTBShowWhenVars :=GetDlgText(Dialog,IDC_UA_SHOWVARV);
+ if (GetEditFlags(Dialog,IDC_UA_TTNORMALV ) and EF_SCRIPT)<>0 then
+ flags:=flags or UAF_TTBTTUV;
+ if (GetEditFlags(Dialog,IDC_UA_TTPRESSEDV) and EF_SCRIPT)<>0 then
+ flags:=flags or UAF_TTBTTPV;
end;
uaTAB: begin // TabSRMM toolbar
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;
diff --git a/plugins/Actman30/ua/i_uavars.inc b/plugins/Actman30/ua/i_uavars.inc
index dc11d5b76d..f2cf1ba42f 100644
--- a/plugins/Actman30/ua/i_uavars.inc
+++ b/plugins/Actman30/ua/i_uavars.inc
@@ -62,6 +62,8 @@ const
UAF_REGTABB = 1 shl 5; // TabSRMM toolbar
UAF_USING = UAF_REGHOTKEY or UAF_REGTTBB or UAF_REGTABB;
+ UAF_TTBTTPV = 1 shl 9; // TTB pressed hint script
+ UAF_TTBTTUV = 1 shl 10; // TTB unpressed hint script
UAF_2STATE = 1 shl 11; // Buttons/menu items are 2-state
UAF_PRESSED = 1 shl 12; // Button pressed/menu item selected
UAF_SAVESTATE = 1 shl 13; // Save or not "pressed" state
@@ -77,6 +79,8 @@ const
// menu options
UAF_MENUSEP = 1 shl 1; // menu item separated
+ UAF_MSUBVAR = 1 shl 2; // submenu name script
+ UAF_MNAMVAR = 1 shl 3; // menu name script
UAF_MENUUSE = 1 shl 8; // use this menu
UAF_NOTRANS = 1 shl 9; // do not translate menus