summaryrefslogtreecommitdiff
path: root/plugins/Actman/ua/i_ua.inc
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2014-12-19 20:02:47 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2014-12-19 20:02:47 +0000
commitf2cce78db24a0f0a53b8ca41ff112968a5f2d86b (patch)
tree5dce24a102dc4117ab993e201811948927842e47 /plugins/Actman/ua/i_ua.inc
parenta1ff366b1634ed741bdc764489f9e715f90900f5 (diff)
Actman 2.0 is moved to deprecated, Actman 3.0 is a new default Actman (with database settings converter from older version)
git-svn-id: http://svn.miranda-ng.org/main/trunk@11533 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Actman/ua/i_ua.inc')
-rw-r--r--plugins/Actman/ua/i_ua.inc100
1 files changed, 82 insertions, 18 deletions
diff --git a/plugins/Actman/ua/i_ua.inc b/plugins/Actman/ua/i_ua.inc
index 61641a7447..b3b4cdaa47 100644
--- a/plugins/Actman/ua/i_ua.inc
+++ b/plugins/Actman/ua/i_ua.inc
@@ -13,8 +13,6 @@ begin
begin
// get Action settings
dwActID:=ptr^.id;
- if (ptr^.flags and ACCF_DISABLED)<>0 then
- flags:=UAF_DISABLED;
StrDupW(szActDescr,ptr^.descr);
wSortIndex:=idx;
@@ -57,6 +55,71 @@ begin
end;
end;
+// "compact" means need to compact list/delete settings (Delete, not just exit)
+procedure DeleteUAction(num:integer;compact:boolean);
+var
+ ActionItem:pMyActionItem;
+ luse:boolean;
+ lmenu:tMenuType;
+begin
+ if compact then
+ DeleteUASettings(num);
+
+ ActionItem:=@UActionList[num];
+
+ DeleteIcolibIcon(ActionItem^);
+
+ if (ActionItem.flags and UAF_REGHOTKEY)<>0 then
+ DeleteCoreHotkey(ActionItem^);
+
+ if (ActionItem.flags and UAF_REGTTBB)<>0 then
+ DeleteTTBButton(ActionItem^);
+ mFreeMem(ActionItem.szTTBTooltip);
+ mFreeMem(ActionItem.szTTBTooltipPressed);
+ mFreeMem(ActionItem.szTTBShowWhenVars);
+
+ if (ActionItem.flags and UAF_REGTABB)<>0 then
+ DeleteTabBBButton(ActionItem^);
+ mFreeMem(ActionItem.szTabBTooltip);
+ mFreeMem(ActionItem.szTabBTooltipPressed);
+
+ luse:=false;
+ for lmenu:=main_menu to HIGH(tMenuType) do
+ begin
+ with ActionItem.UAMenuItem[lmenu] do
+ begin
+ if (menu_opt and UAF_MENUUSE)<>0 then
+ begin
+ luse:=true;
+ DeleteMenuItem(ActionItem^,lmenu);
+ end;
+ mFreeMem(szMenuPopup);
+ mFreeMem(szMenuNameVars);
+ mFreeMem(szMenuShowWhenVars);
+ end;
+ end;
+
+ if (not luse) and (ActionItem.hMenuService<>0) then
+ begin
+ DestroyServiceFunction(ActionItem.hMenuService);
+ ActionItem.hMenuService:=0;
+ end;
+
+ // Free Memory
+ mFreeMem(ActionItem.szNameID);
+ mFreeMem(ActionItem.szActDescr);
+
+ if compact then
+ begin
+ // compact list
+ if num<HIGH(UActionList) then
+ begin
+ move(UActionList[num+1],UActionList[num],(HIGH(UActionList)-num)*SizeOf(tMyActionItem));
+ end;
+ SetLength(UActionList,Length(UActionList)-1);
+ end;
+end;
+
function ActListChange(wParam:WPARAM;lParam:LPARAM):integer; cdecl;
var
ptr,ptr1:pChain;
@@ -71,8 +134,8 @@ begin
begin
ptr1:=ptr;
inc(pbyte(ptr),4);
- // maybe add ACTM_RELOAD (as NEW and DELETE) here too?
- if (wParam and (ACTM_NEW or ACTM_RENAME or ACTM_SORT or ACTM_DELETE))<>0 then
+ if wParam<>0 then
+// if (wParam and (ACTM_NEW or ACTM_RENAME or ACTM_SORT or ACTM_DELETE))<>0 then
for i:=0 to count-1 do
begin
// search corresponding element
@@ -87,7 +150,9 @@ begin
end;
// if we have no item in list for this action - then add new one
if idx<0 then
- AddUAction(-1,ptr)
+ begin
+ idx:=AddUAction(-1,ptr);
+ end
else
begin
if (wParam and ACTM_RENAME)<>0 then
@@ -99,10 +164,11 @@ begin
StrDupW (UActionList[idx].szActDescr,ptr^.descr);
end;
end;
-
- if (wParam and (ACTM_SORT or ACTM_DELETE or ACTM_NEW))<>0 then
- UActionList[idx].wSortIndex:=i;
end;
+// not so necessary to check really
+// if (wParam and (ACTM_SORT or ACTM_DELETE or ACTM_NEW))<>0 then
+ UActionList[idx].wSortIndex:=i;
+
inc(ptr);
end;
end
@@ -130,26 +196,24 @@ begin
end;
end;
if not bFound then
- DeleteUAction(j);
+ DeleteUAction(j,true);
end;
end;
if count>0 then
CallService(MS_ACT_FREELIST,0,TLPARAM(ptr1));
+ // show changes in dialog
if settings<>0 then
begin
FillActionList(settings);
ShowAction(settings,-1);
- SendMessage(GetParent(settings),PSM_CHANGED,0,0);
- end
- else
+ end;
+
+ SaveUAs;
+ FillChar(arMenuRec[0],Length(arMenuRec)*SizeOf(tuaMenuRecA),0);
+ for i:=0 to HIGH(UActionList) do
begin
- SaveUAs;
- FillChar(arMenuRec[0],Length(arMenuRec)*SizeOf(tuaMenuRecA),0);
- for i:=0 to HIGH(UActionList) do
- begin
- SetAllActionUsers(UActionList[i],false);
- end;
+ SetAllActionUsers(UActionList[i],false);
end;
end;