summaryrefslogtreecommitdiff
path: root/plugins/Actman/ua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Actman/ua')
-rw-r--r--plugins/Actman/ua/action.icobin1150 -> 2550 bytes
-rw-r--r--plugins/Actman/ua/i_inoutjson.inc361
-rw-r--r--plugins/Actman/ua/i_inoutxm.inc14
-rw-r--r--plugins/Actman/ua/i_opt_dlg.inc471
-rw-r--r--plugins/Actman/ua/i_options.inc93
-rw-r--r--plugins/Actman/ua/i_ua.inc100
-rw-r--r--plugins/Actman/ua/i_uaplaces.inc108
-rw-r--r--plugins/Actman/ua/i_uavars.inc15
-rw-r--r--plugins/Actman/ua/i_uconst.inc40
-rw-r--r--plugins/Actman/ua/ua.pas69
-rw-r--r--plugins/Actman/ua/ua.rc47
-rw-r--r--plugins/Actman/ua/ua.resbin2512 -> 3992 bytes
12 files changed, 904 insertions, 414 deletions
diff --git a/plugins/Actman/ua/action.ico b/plugins/Actman/ua/action.ico
index 06db21a127..9e4c60d9d3 100644
--- a/plugins/Actman/ua/action.ico
+++ b/plugins/Actman/ua/action.ico
Binary files differ
diff --git a/plugins/Actman/ua/i_inoutjson.inc b/plugins/Actman/ua/i_inoutjson.inc
new file mode 100644
index 0000000000..b560e99fb1
--- /dev/null
+++ b/plugins/Actman/ua/i_inoutjson.inc
@@ -0,0 +1,361 @@
+{}
+var
+ jsonparser:TJSONSERVICEINTERFACE;
+
+const
+ ioAction :PWideChar = 'Action';
+ ioUA :PWideChar = 'UA';
+
+ ioName :PWideChar = 'name';
+
+ ioTwoState :PWideChar = 'twostate';
+ ioSaveState :PWideChar = 'savestate';
+
+ ioHotkey :PWideChar = 'Hotkey';
+ ioToolbar :PWideChar = 'Toolbar';
+ ioTabSRMM :PWideChar = 'TabSRMM';
+ ioMenuItem :PWideChar = 'Menu';
+
+ ioTooltip :PWideChar = 'tooltip';
+ ioTooltipPressed :PWideChar = 'tt_pressed';
+
+ ioType :PWideChar = 'type';
+ ioMenuPopup :PWideChar = 'Popup';
+ ioMenuName :PWideChar = 'Name';
+ ioMenuShow :PWideChar = 'Show';
+ ioMenuUsed :PWideChar = 'Used';
+ ioMenuSeparated :PWideChar = 'Separated';
+ ioNoTRanslate :PWideChar = 'NoTranslate';
+
+
+function ImportMenuItems(node:JSONNODE;var MenuItem:tUAMenuItem):integer;
+begin
+ result:=0;
+
+ with jsonparser do
+ begin
+ with MenuItem do
+ begin
+ menu_opt:=0;
+ // popup
+ StrDupW(szMenuPopup,getAttrValue(node,ioMenuPopup));
+ // name
+ StrDupW(szMenuNameVars,getAttrValue(node,ioMenuName));
+ // show
+ StrDupW(szMenuShowWhenVars,getAttrValue(node,ioMenuShow));
+ // used
+ if StrToInt(getAttrValue(node,ioMenuUsed))<>0 then
+ menu_opt:=menu_opt or UAF_MENUUSE;
+ // separated
+ if StrToInt(getAttrValue(node,ioMenuSeparated))<>0 then
+ menu_opt:=menu_opt or UAF_MENUSEP;
+ // no translate
+ if StrToInt(getAttrValue(node,ioMenuNotranslate))<>0 then
+ menu_opt:=menu_opt or UAF_NOTRANAS;
+ end;
+ end;
+end;
+
+function ImportUAction(actnode:JSONNODE;var UA:tMyActionItem):integer;
+var
+ num,i:integer;
+ sub:JSONNODE;
+begin
+ result:=0;
+ if actnode=0 then exit;
+
+ with jsonparser do
+ begin
+ // we don't need that node as is, just it's child for UA
+// actnode:=GetNthChild(actnode,ioUA,0);
+
+ UA.flags:=0;
+ // ----- Common -----
+ if StrToInt(getAttrValue(actnode,ioTwoState))<>0 then
+ UA.flags:=UA.flags or UAF_2STATE;
+
+ if StrToInt(getAttrValue(actnode,ioSaveState))<>0 then
+ UA.flags:=UA.flags or UAF_SAVESTATE;
+
+ // sub:=AddChild(actnode,ioRegister,nil);
+ if StrToInt(getAttrValue(actnode,ioHotkey))<>0 then
+ UA.flags:=UA.flags or UAF_REGHOTKEY;
+ if StrToInt(getAttrValue(actnode,ioToolbar))<>0 then
+ UA.flags:=UA.flags or UAF_REGTTBB;
+ if StrToInt(getAttrValue(actnode,ioTabSRMM))<>0 then
+ UA.flags:=UA.flags or UAF_REGTABB;
+
+ // ----- Hotkey -----
+ // nothing
+
+ // ----- Modern CList toolbar -----
+ // source - ANSI text
+ sub:=GetNthChild(actnode,ioToolbar,0);
+ WideToAnsi(GetAttrValue(sub,ioTooltip ),UA.szTTBTooltip ,MirandaCP);
+ WideToAnsi(GetAttrValue(sub,ioTooltipPressed),UA.szTTBTooltipPressed,MirandaCP);
+
+ // ----- TabSRMM toolbar -----
+ sub:=GetNthChild(actnode,ioTabSRMM,0);
+ StrDupW(UA.szTabBTooltip ,getAttrValue(sub,ioTooltip));
+ StrDupW(UA.szTabBTooltipPressed,getAttrValue(sub,ioTooltipPressed));
+
+ // ----- Menus -----
+ num:=0;
+ repeat
+ sub:=getNextChild(actnode,ioMenuItem,@num);
+ if sub=0 then break;
+
+ i:=StrToInt(getAttrValue(sub,ioType));
+ ImportMenuItems(sub,
+ UA.UAMenuItem[tMenuType(i)]);
+ until false;
+ end;
+end;
+
+function Import(fname:PWideChar;aflags:dword):integer;
+var
+ i,j,act:integer;
+ root,actnode:JSONNODE;
+ pcw,res:pWideChar;
+ f:THANDLE;
+ num,num1:integer;
+ ptr,ptr1:pChain;
+begin
+ result:=0;
+
+ if (fname=nil) or (fname^=#0) then
+ exit;
+ i:=GetFSize(fname);
+ if i=0 then
+ exit;
+
+ num:=CallService(MS_ACT_GETLIST,0,LPARAM(@ptr));
+ if num=0 then exit;
+ ptr1:=ptr;
+
+ mGetMem (res ,i+SizeOf(WideChar));
+ FillChar(res^,i+SizeOf(WideChar),0);
+ f:=Reset(fname);
+ BlockRead(f,res^,i);
+ CloseHandle(f);
+
+ CallService(MS_JSON_GETINTERFACE,0,lparam(@jsonparser));
+ with jsonparser do
+ begin
+ root:=parseString(ChangeUnicode(res),@i,nil);
+ j:=0;
+ repeat
+ actnode:=getNthChild(root,ioAction,j);
+ if actnode=0 then break;
+ // search id by name?
+ pcw:=GetAttrValue(actnode,ioName);
+ ptr:=ptr1;
+ inc(pbyte(ptr),4);
+ for i:=0 to num-1 do
+ begin
+ if (ptr.flags and ACCF_IMPORTED)<>0 then
+ begin
+ if StrCmpw(pcw,ptr.descr)=0 then
+ begin
+ // delete old UA for overwrited actions
+ if (ptr.flags and ACCF_OVERLOAD)<>0 then
+ begin
+ for act:=0 to HIGH(UActionList) do
+ begin
+ if ptr.id=UActionList[act].dwActID then
+ begin
+ DeleteUAction(act,true);
+ break;
+ end;
+ end;
+ end;
+ num1:=AddUAction(-1,ptr);
+ ImportUAction(getNthChild(actnode,ioUA,0),UActionList[num1]);
+ break;
+ end;
+ end;
+ inc(ptr);
+ end;
+
+ inc(j);
+ until false;
+
+ DestroyNode(root);
+ end;
+ CallService(MS_ACT_FREELIST,0,LPARAM(ptr1));
+ mFreeMem(res);
+ result:=1;
+ if settings<>0 then
+ begin
+ FillActionList(settings);
+ ShowAction(settings,-1);
+ end;
+end;
+
+//--------------------------
+
+function ExportMenuItems(node:JSONNODE;MenuItem:tUAMenuItem):HXML;
+begin
+ with jsonparser do
+ begin
+ result:=AddChild(node,ioMenuItem,nil);
+ with MenuItem do
+ begin
+ // popup
+ if (szMenuPopup<>nil) and (szMenuPopup^<>#0) then
+ AddAttr(result,ioMenuPopup,szMenuPopup);
+ // name
+ if (szMenuNameVars<>nil) and (szMenuNameVars^<>#0) then
+ AddAttr(result,ioMenuName,szMenuNameVars);
+ // show
+ if (szMenuShowWhenVars<>nil) and (szMenuShowWhenVars^<>#0) then
+ AddAttr(result,ioMenuShow,szMenuShowWhenVars);
+ // used
+ AddAttrInt(result,ioMenuUsed,ord((menu_opt AND UAF_MENUUSE)<>0));
+ // separated
+ AddAttrInt(result,ioMenuSeparated,ord((menu_opt AND UAF_MENUSEP)<>0));
+ // no translate
+ AddAttrInt(result,ioNoTranslate,ord((menu_opt AND UAF_NOTRANS)<>0));
+ end;
+ end;
+end;
+
+procedure WriteUAction(root:JSONNODE;id:dword;name:pWideChar);
+var
+ i:integer;
+ lmenu:tMenuType;
+ pc:pWideChar;
+ actnode,sub:JSONNODE;
+ UA:pMyActionItem;
+begin
+ with jsonparser do
+ begin
+ for i:=0 to HIGH(UActionList) do
+ begin
+ if UActionList[i].dwActID=id then
+ begin
+ UA:=@UActionList[i];
+ actnode:=getChildByAttrValue(root,ioAction,ioName,name);
+ if actnode=0 then break;
+ // we don't need that node as is, just it's child for UA
+ actnode:=addChild(actnode,ioUA,nil);
+
+ // ----- Common -----
+ AddAttrInt(actnode,ioTwoState ,ORD((UA.flags and UAF_2STATE )<>0));
+ AddAttrInt(actnode,ioSaveState,ORD((UA.flags and UAF_SAVESTATE)<>0));
+
+ // sub:=AddChild(actnode,ioRegister,nil);
+ AddAttrInt(actnode,ioHotkey ,ORD((UA.flags and UAF_REGHOTKEY)<>0));
+ AddAttrInt(actnode,ioToolbar,ORD((UA.flags and UAF_REGTTBB )<>0));
+ AddAttrInt(actnode,ioTabSRMM,ORD((UA.flags and UAF_REGTABB )<>0));
+
+ // ----- Hotkey -----
+ // nothing
+
+ // ----- Modern CList toolbar -----
+ // source - ANSI text
+ if ((UA.szTTBTooltip <>nil) and (UA.szTTBTooltip^ <>#0)) or
+ ((UA.szTTBTooltipPressed<>nil) and (UA.szTTBTooltipPressed^<>#0)) then
+ begin
+ sub:=AddChild(actnode,ioToolbar,nil);
+ if (UA.szTTBTooltip<>nil) and (UA.szTTBTooltip^<>#0) then
+ begin
+ AnsiToWide(UA.szTTBTooltip,pc,MirandaCP);
+ AddAttr(sub,ioTooltip,pc);
+ mFreeMem(pc);
+ end;
+ if (UA.szTTBTooltipPressed<>nil) and (UA.szTTBTooltipPressed^<>#0) then
+ begin
+ AnsiToWide(UA.szTTBTooltipPressed,pc,MirandaCP);
+ AddAttr(sub,ioTooltipPressed,pc);
+ mFreeMem(pc);
+ end;
+ end;
+
+ // ----- TabSRMM toolbar -----
+ if ((UA.szTabBTooltip <>nil) and (UA.szTabBTooltip^ <>#0)) or
+ ((UA.szTabBTooltipPressed<>nil) and (UA.szTabBTooltipPressed^<>#0)) then
+ begin
+ sub:=AddChild(actnode,ioTabSRMM,nil);
+ if (UA.szTabBTooltip<>nil) and (UA.szTabBTooltip^<>#0) then
+ AddAttr(sub,ioTooltip,UA.szTabBTooltip);
+ if (UA.szTabBTooltipPressed<>nil) and (UA.szTabBTooltipPressed^<>#0) then
+ AddAttr(sub,ioTooltipPressed,UA.szTabBTooltipPressed);
+ end;
+
+ // ----- Menus -----
+ for lmenu:=main_menu to HIGH(tMenuType) do
+ begin
+ sub:=ExportMenuItems(actnode,UA.UAMenuItem[lmenu]);
+ AddAttrInt(sub,ioType,ORD(lmenu));
+ end;
+
+ break;
+ end;
+ end;
+ end;
+end;
+
+function Export(fname:pWideChar;aflags:dword):integer;
+var
+ i,num:integer;
+ f:THANDLE;
+ root:JSONNODE;
+ res:pWideChar;
+ ptr,ptr1:pChain;
+begin
+ result:=0;
+ CallService(MS_JSON_GETINTERFACE,0,lparam(@jsonparser));
+ with jsonparser do
+ begin
+ // we need append file, not rewrite
+ i:=GetFSize(fname);
+ if i=0 then exit;
+
+ mGetMem (res ,i+SizeOf(WideChar));
+ FillChar(res^,i+SizeOf(WideChar),0);
+ f:=Reset(fname);
+ BlockRead(f,res^,i);
+ CloseHandle(f);
+ root:=parseString(res,@i,nil);
+ mFreeMem(res);
+
+ num:=CallService(MS_ACT_GETLIST,0,LPARAM(@ptr));
+ if num>0 then
+ begin
+ ptr1:=ptr;
+ inc(pbyte(ptr),4);
+ for i:=0 to num-1 do
+ begin
+ if ((aflags and ACIO_SELECTED)=0) or
+ ((ptr.flags and ACCF_EXPORT)<>0) then
+ begin
+ WriteUAction(root,ptr.id,ptr.descr);
+ end;
+ inc(ptr);
+ end;
+ CallService(MS_ACT_FREELIST,0,LPARAM(ptr1));
+ end;
+
+ res:=toString(root,@i);
+
+ f:=Rewrite(fname);
+ BlockWrite(f,res^,i*SizeOf(WideChar));
+ CloseHandle(f);
+ xmlparser.FreeMem(res);
+ DestroyNode(root);
+ end;
+ result:=1;
+end;
+
+function ActInOut(wParam:WPARAM;lParam:LPARAM):int_ptr; cdecl;
+begin
+ if (wParam and ACIO_EXPORT)=0 then
+ begin
+ result:=Import(pWideChar(lParam),wParam);
+ end
+ else
+ begin
+ result:=Export(pWideChar(lParam),wParam);
+ end;
+end;
diff --git a/plugins/Actman/ua/i_inoutxm.inc b/plugins/Actman/ua/i_inoutxm.inc
index 098a262b1e..bf53ff954a 100644
--- a/plugins/Actman/ua/i_inoutxm.inc
+++ b/plugins/Actman/ua/i_inoutxm.inc
@@ -25,6 +25,7 @@ const
ioMenuShow :PWideChar = 'Show';
ioMenuUsed :PWideChar = 'Used';
ioMenuSeparated :PWideChar = 'Separated';
+ ioNoTranslate :PWideChar = 'NoTranslate';
function ImportMenuItems(node:HXML;var MenuItem:tUAMenuItem):integer;
@@ -48,6 +49,9 @@ begin
// separated
if StrToInt(getAttrValue(node,ioMenuSeparated))<>0 then
menu_opt:=menu_opt or UAF_MENUSEP;
+ // no translate
+ if StrToInt(getAttrValue(node,ioNoTranslate))<>0 then
+ menu_opt:=menu_opt or UAF_NOTRANS;
end;
end;
end;
@@ -150,18 +154,18 @@ begin
inc(pbyte(ptr),4);
for i:=0 to num-1 do
begin
- if (ptr.flags and ACCF_IMPORTED)<>0 then
+ if (ptr.flags and ACF_SELECTED)<>0 then
begin
if StrCmpw(pcw,ptr.descr)=0 then
begin
// delete old UA for overwrited actions
- if (ptr.flags and ACCF_OVERLOAD)<>0 then
+ if (ptr.flags and ACF_OVERLOAD)<>0 then
begin
for act:=0 to HIGH(UActionList) do
begin
if ptr.id=UActionList[act].dwActID then
begin
- DeleteUAction(act);
+ DeleteUAction(act,true);
break;
end;
end;
@@ -191,7 +195,7 @@ end;
//--------------------------
-function ExportMenuItems(node:HXML;MenuItem:tUAMenuItem):HXML;
+function ExportMenuItems(node:HXML;const MenuItem:tUAMenuItem):HXML;
begin
with xmlparser do
begin
@@ -211,6 +215,8 @@ begin
AddAttrInt(result,ioMenuUsed,ord((menu_opt AND UAF_MENUUSE)<>0));
// separated
AddAttrInt(result,ioMenuSeparated,ord((menu_opt AND UAF_MENUSEP)<>0));
+ // no translate
+ AddAttrInt(result,ioNoTranslate,ord((menu_opt AND UAF_NOTRANS)<>0));
end;
end;
end;
diff --git a/plugins/Actman/ua/i_opt_dlg.inc b/plugins/Actman/ua/i_opt_dlg.inc
index e9d7dc5048..6e5cc4d117 100644
--- a/plugins/Actman/ua/i_opt_dlg.inc
+++ b/plugins/Actman/ua/i_opt_dlg.inc
@@ -1,127 +1,133 @@
{}
const
settings:HWND = 0;
-const
- NumControls = 17;
-
- IDsArray:array [0..NumControls-1] of integer =(
- // Menu settings controls
- IDC_UA_SEPARATE ,IDC_UA_POPUPT ,IDC_UA_POPUPV,
- IDC_UA_VARNAMEST,IDC_UA_VARNAMESV,IDC_UA_VARNAMESH,
- IDC_UA_SHOWVART ,IDC_UA_SHOWVARV ,IDC_UA_SHOWVARH,
- IDC_UA_TWOSTATE ,IDC_UA_SAVSTATE ,IDC_UA_COMMON,
- // toolbar settings controls
- IDC_UA_TTNORMALT,IDC_UA_TTNORMALV,IDC_UA_TTPRESSEDT,IDC_UA_TTPRESSEDV,
- IDC_UA_GLOBAL
- );
-
- // Show-hide controls by place type
- SHArray:array [0..NumTypes-1, 0..NumControls-1] of integer = (
- // CList Modern toolbar
- (SW_HIDE,SW_HIDE,SW_HIDE, SW_HIDE,SW_HIDE,SW_HIDE, SW_SHOW,SW_SHOW,SW_SHOW,
- SW_SHOW,SW_SHOW,SW_SHOW, SW_SHOW,SW_SHOW,SW_SHOW,SW_SHOW, SW_HIDE),
- // TabSRMM toolbar
- (SW_HIDE,SW_HIDE,SW_HIDE, SW_HIDE,SW_HIDE,SW_HIDE, SW_HIDE,SW_HIDE,SW_HIDE,
- SW_SHOW,SW_SHOW,SW_SHOW, SW_SHOW,SW_SHOW,SW_SHOW,SW_SHOW, SW_SHOW),
- // Core Hotkey
- (SW_HIDE,SW_HIDE,SW_HIDE, SW_HIDE,SW_HIDE,SW_HIDE, SW_HIDE,SW_HIDE,SW_HIDE,
- SW_HIDE,SW_HIDE,SW_HIDE, SW_HIDE,SW_HIDE,SW_HIDE,SW_HIDE, SW_HIDE),
- // Main menu
- (SW_SHOW,SW_SHOW,SW_SHOW, SW_SHOW,SW_SHOW,SW_SHOW, SW_SHOW,SW_SHOW,SW_SHOW,
- SW_SHOW,SW_SHOW,SW_SHOW, SW_HIDE,SW_HIDE,SW_HIDE,SW_HIDE, SW_HIDE),
- // Contact menu
- (SW_SHOW,SW_SHOW,SW_SHOW, SW_SHOW,SW_SHOW,SW_SHOW, SW_SHOW,SW_SHOW,SW_SHOW,
- SW_SHOW,SW_SHOW,SW_SHOW, SW_HIDE,SW_HIDE,SW_HIDE,SW_HIDE, SW_SHOW),
- // Tray menu
- (SW_SHOW,SW_SHOW,SW_SHOW, SW_SHOW,SW_SHOW,SW_SHOW, SW_SHOW,SW_SHOW,SW_SHOW,
- SW_SHOW,SW_SHOW,SW_SHOW, SW_HIDE,SW_HIDE,SW_HIDE,SW_HIDE, SW_HIDE),
- // Protocol menu
- (SW_SHOW,SW_SHOW,SW_SHOW, SW_SHOW,SW_SHOW,SW_SHOW, SW_SHOW,SW_SHOW,SW_SHOW,
- SW_SHOW,SW_SHOW,SW_SHOW, SW_HIDE,SW_HIDE,SW_HIDE,SW_HIDE, SW_HIDE),
- // Status menu
- (SW_SHOW,SW_SHOW,SW_SHOW, SW_SHOW,SW_SHOW,SW_SHOW, SW_SHOW,SW_SHOW,SW_SHOW,
- SW_SHOW,SW_SHOW,SW_SHOW, SW_HIDE,SW_HIDE,SW_HIDE,SW_HIDE, SW_HIDE)
- );
- // additional show/hide controls check by Variables installings (1 - need to check)
- SHVarArray:array [0..NumControls-1] of byte = (
- 0,0,0, 0,0,1, 1,1,1,
- 0,0,0,0,0,0,0, 0);
- // additional enable/disable controls check (1 - always enable)
- EnDisArray:array [0..NumControls-1] of byte = (
- 0,0,0, 0,0,0, 0,0,0,
- 1,1,1,0,0,0,0, 1);
var
hIC:THANDLE;
-procedure CheckPlacesAbility;
-var
- i:integer;
-begin
- for i:=0 to NumTypes-1 do
- begin
- with NamesArray[i] do
- begin
- enable:=(service=nil) or (ServiceExists(service)<>0);
- end;
- end;
-end;
+//----- Static (no option-depended) control view -----
-function CompareItem(lParam1,lParam2:LPARAM;SortType:LPARAM):int; stdcall;
+procedure HideAllControls(Dialog:HWND);
begin
- result:=UActionList[lParam1].wSortIndex-UActionList[lParam2].wSortIndex;
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_GLOBAL ),SW_HIDE);
+
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_BLOCK ),SW_HIDE);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_MENU ),SW_HIDE);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_NOTRANSLATE),SW_HIDE);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_SEPARATE ),SW_HIDE);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_POPUPT ),SW_HIDE);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_VARNAMEST ),SW_HIDE);
+// ShowWindow(GetDlgItem(Dialog,IDC_UA_NOTRANSLATE),SW_HIDE);
+
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_TTNORMALT ),SW_HIDE);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_TTPRESSEDT ),SW_HIDE);
+
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_SHOWVART ),SW_HIDE);
+
+
+ ShowEditField(Dialog,IDC_UA_SHOWVARV ,SW_HIDE);
+ ShowEditField(Dialog,IDC_UA_VARNAMESV ,SW_HIDE);
+ ShowEditField(Dialog,IDC_UA_POPUPV ,SW_HIDE);
+ ShowEditField(Dialog,IDC_UA_TTNORMALV ,SW_HIDE);
+ ShowEditField(Dialog,IDC_UA_TTPRESSEDV,SW_HIDE);
end;
-// Show or hide option items
-procedure SetupControls(Dialog:HWND;atype:integer;item:integer=-1);
+// Show or hide option items ("static options")
+procedure ShowHideControls(Dialog:HWND;atype:integer;item:integer=-1);
var
- i: cardinal;
- typ:integer;
- wnd,wnd1:HWND;
- enable:boolean;
+ show:integer;
begin
- if atype<0 then
- begin
- for i:=0 to NumControls-1 do
- begin
- ShowWindow(GetDlgItem(Dialog,IDsArray[i]),SW_HIDE);
- end;
- end
- else
+ HideAllControls(Dialog);
+ if atype>=0 then
begin
- wnd1:=GetDlgItem(Dialog,IDC_UA_PLACELIST);
- if item<0 then
- item:=SendMessage(wnd1,LVM_GETNEXTITEM,-1,LVNI_FOCUSED);
- enable:=ListView_GetCheckState(wnd1,item)<>0;
+ if LoByte(atype)<>uaHotkey then
+ show:=SW_SHOW
+ else
+ show:=SW_HIDE;
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_TWOSTATE),show);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_SAVSTATE),show);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_COMMON ),show);
- for i:=0 to NumControls-1 do
- begin
- typ:=SHArray[LoByte(atype)+HiByte(atype)][i];
- if typ=SW_SHOW then
- if (SHVarArray[i]<>0) and (not IsVarsInstalled) then
- typ:=SW_HIDE;
- wnd:=GetDlgItem(Dialog,IDsArray[i]);
- ShowWindow(wnd,typ);
- EnableWindow(wnd,enable or (EnDisArray[i]<>0));
- end;
+ case LoByte(atype) of
+ uaTTB: begin
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_SHOWVART ),SW_SHOW);
+ ShowEditField(Dialog,IDC_UA_SHOWVARV ,SW_SHOW);
+
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_TTNORMALT ),SW_SHOW);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_TTPRESSEDT),SW_SHOW);
+ ShowEditField(Dialog,IDC_UA_TTNORMALV ,SW_SHOW);
+ ShowEditField(Dialog,IDC_UA_TTPRESSEDV,SW_SHOW);
+ end;
+ uaTAB: begin
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_GLOBAL ),SW_SHOW);
- // common settings
- EnableWindow(GetDlgItem(Dialog,IDC_UA_SAVSTATE),
- IsDlgButtonChecked(Dialog,IDC_UA_TWOSTATE)<>BST_UNCHECKED);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_TTNORMALT ),SW_SHOW);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_TTPRESSEDT),SW_SHOW);
+ ShowEditField(Dialog,IDC_UA_TTNORMALV ,SW_SHOW);
+ ShowEditField(Dialog,IDC_UA_TTPRESSEDV,SW_SHOW);
+ end;
+ uaHotkey: begin
+ end;
+ uaMenu: begin
+ if tMenuType(HiByte(atype))=contact_menu then
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_GLOBAL),SW_SHOW);
- // personal settings
- case LoByte(atype) of
- uaTTB, uaTAB: begin
- enable:=false;
- if IsDlgButtonChecked(Dialog,IDC_UA_TWOSTATE)<>BST_UNCHECKED then
- if IsWindowEnabled(GetDlgItem(Dialog,IDC_UA_TTNORMALV)) then
- enable:=true;
- EnableWindow(GetDlgItem(Dialog,IDC_UA_TTPRESSEDV),enable);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_BLOCK ),SW_SHOW);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_MENU ),SW_SHOW);
+
+//!! ShowWindow(GetDlgItem(Dialog,IDC_UA_SEPARATE ),SW_SHOW);
+//!! ShowWindow(GetDlgItem(Dialog,IDC_UA_SEPARATE ),SW_SHOW);
+
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_SHOWVART ),SW_SHOW);
+ ShowEditField(Dialog,IDC_UA_SHOWVARV ,SW_SHOW);
+
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_POPUPT ),SW_SHOW);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_VARNAMEST ),SW_SHOW);
+ ShowEditField(Dialog,IDC_UA_VARNAMESV ,SW_SHOW);
+ ShowEditField(Dialog,IDC_UA_POPUPV ,SW_SHOW);
+
+// ShowWindow(GetDlgItem(Dialog,IDC_UA_NOTRANSLATE),SW_SHOW);
end;
end;
end;
end;
+procedure EnableDisableCheck(Dialog:HWND);
+var
+ wnd:HWND;
+ item:integer;
+ two,enable:boolean;
+begin
+ wnd:=GetDlgItem(Dialog,IDC_UA_PLACELIST);
+ item:=SendMessage(wnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED);
+ enable:=ListView_GetCheckState(wnd,item)<>0;
+
+ // common settings
+ two:=IsDlgButtonChecked(Dialog,IDC_UA_TWOSTATE)<>BST_UNCHECKED;
+ EnableWindow(GetDlgItem(Dialog,IDC_UA_SAVSTATE),two);
+
+ // all others
+ EnableWindow(GetDlgItem(Dialog,IDC_UA_BLOCK ),enable);
+ EnableWindow(GetDlgItem(Dialog,IDC_UA_MENU ),enable);
+
+ EnableWindow(GetDlgItem(Dialog,IDC_UA_NOTRANSLATE),enable);
+ EnableWindow(GetDlgItem(Dialog,IDC_UA_SEPARATE ),enable);
+ EnableWindow(GetDlgItem(Dialog,IDC_UA_POPUPT ),enable);
+ EnableWindow(GetDlgItem(Dialog,IDC_UA_VARNAMEST ),enable);
+
+ EnableWindow(GetDlgItem(Dialog,IDC_UA_TTNORMALT ),enable);
+ EnableWindow(GetDlgItem(Dialog,IDC_UA_TTPRESSEDT ),enable);
+
+ EnableWindow(GetDlgItem(Dialog,IDC_UA_SHOWVART ),enable);
+
+ EnableEditField(Dialog,IDC_UA_SHOWVARV ,enable);
+ EnableEditField(Dialog,IDC_UA_VARNAMESV ,enable);
+ EnableEditField(Dialog,IDC_UA_POPUPV ,enable);
+ EnableEditField(Dialog,IDC_UA_TTNORMALV ,enable);
+
+ EnableEditField(Dialog,IDC_UA_TTPRESSEDV,enable and two);
+end;
+
// Clear all screen buttons/text fields (reset)
procedure ClearControls(Dialog:HWND);
var
@@ -129,20 +135,111 @@ var
begin
s:=settings;
settings:=0;
- CheckDlgButton (Dialog,IDC_UA_TWOSTATE ,BST_UNCHECKED);
- CheckDlgButton (Dialog,IDC_UA_SAVSTATE ,BST_UNCHECKED);
+ // common
+ CheckDlgButton (Dialog,IDC_UA_TWOSTATE,BST_UNCHECKED);
+ CheckDlgButton (Dialog,IDC_UA_SAVSTATE,BST_UNCHECKED);
+
+ // menu items
+ SetDlgItemTextW(Dialog,IDC_UA_BLOCK ,'>');
+ CheckDlgButton (Dialog,IDC_UA_SEPARATE ,BST_UNCHECKED);
+ CheckDlgButton (Dialog,IDC_UA_NOTRANSLATE,BST_UNCHECKED);
+ SetDlgItemTextW(Dialog,IDC_UA_POPUPV ,nil);
+ SetDlgItemTextW(Dialog,IDC_UA_VARNAMESV ,nil);
+
+ SetDlgItemTextW(Dialog,IDC_UA_SHOWVARV ,nil);
+ // buttons
+ SetDlgItemTextW(Dialog,IDC_UA_TTNORMALV ,nil);
+ SetDlgItemTextW(Dialog,IDC_UA_TTPRESSEDV,nil);
+
+ // contact related
+ CheckDlgButton (Dialog,IDC_UA_GLOBAL,BST_UNCHECKED);
- CheckDlgButton (Dialog,IDC_UA_SEPARATE ,BST_UNCHECKED);
- SetDlgItemTextW(Dialog,IDC_UA_POPUPV ,nil);
- SetDlgItemTextW(Dialog,IDC_UA_VARNAMESV,nil);
- SetDlgItemTextW(Dialog,IDC_UA_SHOWVARV ,nil);
settings:=s;
end;
+procedure InitActionSettings(Dialog:HWND);
+begin
+ MakeEditField(Dialog,IDC_UA_TTNORMALV);
+ MakeEditField(Dialog,IDC_UA_TTPRESSEDV);
+
+ MakeEditField(Dialog,IDC_UA_POPUPV);
+ MakeEditField(Dialog,IDC_UA_VARNAMESV);
+
+ MakeEditField(Dialog,IDC_UA_SHOWVARV);
+ SetEditFlags(GetDlgItem(Dialog,IDC_UA_SHOWVARV),EF_FORCE,EF_FORCES);
+end;
+
+function CompareItem(lParam1,lParam2:LPARAM;SortType:LPARAM):int; stdcall;
+begin
+ result:=UActionList[lParam1].wSortIndex-UActionList[lParam2].wSortIndex;
+end;
+
+procedure FillActionList(wnd:HWND);
+var
+ i:integer;
+ li:LV_ITEMW;
+ il:HIMAGELIST;
+ lmenu:tMenuType;
+begin
+ wnd:=GetDlgItem(wnd,IDC_UA_ACTIONLIST);
+ SendMessage(wnd,LVM_DELETEALLITEMS,0,0);
+
+ il:=ImageList_Create(16,16,ILC_COLOR32 or ILC_MASK,0,1);
+ for i:=0 to HIGH(UActionList) do
+ begin
+ li.mask :=LVIF_TEXT+LVIF_PARAM+LVIF_IMAGE;
+ li.iSubItem:=0;
+ li.iItem :=i;
+ li.lParam :=i;
+ li.pszText :=UActionList[i].szActDescr;
+ li.iImage:=ImageList_ReplaceIcon(il, -1,
+ HICON(CallService(MS_SKIN2_GETICONBYHANDLE,0,LPARAM(UActionList[i].hIcolibIcon))));
+ li.iItem :=SendMessageW(wnd,LVM_INSERTITEMW,0,LPARAM(@li));
+
+ for lmenu:=main_menu to HIGH(tMenuType) do
+ UActionList[i].UAMenuItem[lmenu].changed:=false;
+ end;
+ ImageList_Destroy(SendMessage(wnd,LVM_SETIMAGELIST,LVSIL_SMALL,il));
+
+ SendMessage(wnd,LVM_SORTITEMS,0,LPARAM(@CompareItem));
+
+ ListView_SetItemState(wnd,0,
+ LVIS_FOCUSED or LVIS_SELECTED,
+ LVIS_FOCUSED or LVIS_SELECTED);
+end;
+
+// refresh icons in UA list (at least)
+function IconChanged(wParam:WPARAM;lParam:LPARAM):int;cdecl;
+var
+ i:integer;
+ li:LV_ITEMW;
+ il:HIMAGELIST;
+ wnd:HWND;
+begin
+ result:=0;
+ wnd:=GetDlgItem(settings,IDC_UA_ACTIONLIST);
+
+ il:=ImageList_Create(16,16,ILC_COLOR32 or ILC_MASK,0,1);
+ for i:=0 to HIGH(UActionList) do
+ begin
+ li.mask :=LVIF_IMAGE;
+ li.iSubItem:=0;
+ li.iItem :=i;
+ li.iImage:=ImageList_ReplaceIcon(il, -1,
+ HICON(CallService(MS_SKIN2_GETICONBYHANDLE,0,TLPARAM(UActionList[i].hIcolibIcon))));
+ SendMessageW(wnd,LVM_SETITEM,0,TLPARAM(@li));
+ end;
+ ImageList_Destroy(SendMessage(wnd,LVM_SETIMAGELIST,LVSIL_SMALL,il));
+//!!refresh?
+end;
+
+//----- Dynamic (option-depended) view -----
+
procedure ShowSubAction(Dialog:HWND;aType:integer;item:integer=-1);
var
UA:pMyActionItem;
s:HWND;
+ i:integer;
begin
s:=settings;
settings:=0;
@@ -169,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
@@ -181,9 +283,15 @@ begin
begin
if (menu_opt and UAF_MENUSEP)<>0 then
CheckDlgButton(Dialog,IDC_UA_SEPARATE,BST_CHECKED);
+ if (menu_opt and UAF_NOTRANS)<>0 then
+ CheckDlgButton(Dialog,IDC_UA_NOTRANSLATE,BST_CHECKED);
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;
@@ -191,7 +299,8 @@ begin
// Settings in Customize/Hotkeys
end;
end;
- SetupControls(Dialog,aType,-1);
+ ShowHideControls(Dialog,aType,-1);
+ EnableDisableCheck(Dialog);
settings:=s;
end;
@@ -255,10 +364,12 @@ begin
else
begin
ClearControls(Dialog);
- SetupControls(Dialog,-1,-1);
+ ShowHideControls(Dialog,-1,-1);
end;
end;
+//----- Saving -----
+
procedure SetChangedFlag(Dialog:HWND);
var
num,atype:integer;
@@ -276,8 +387,14 @@ begin
mFreeMem(szMenuNameVars ); szMenuNameVars :=GetDlgText(Dialog,IDC_UA_VARNAMESV);
mFreeMem(szMenuShowWhenVars); szMenuShowWhenVars:=GetDlgText(Dialog,IDC_UA_SHOWVARV);
menu_opt:=0;
+ if IsDlgButtonchecked(Dialog,IDC_UA_NOTRANSLATE)<>BST_UNCHECKED then
+ 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;
@@ -331,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
@@ -354,70 +475,46 @@ begin
end;
end;
-procedure FillActionList(wnd:HWND);
+procedure ChangeBlock(Dialog:HWND);
var
- i:integer;
- li:LV_ITEMW;
- il:HIMAGELIST;
- lmenu:tMenuType;
+ pc:pWideChar;
+ sh_main,sh_add:integer;
begin
- wnd:=GetDlgItem(wnd,IDC_UA_ACTIONLIST);
- SendMessage(wnd,LVM_DELETEALLITEMS,0,0);
-
- il:=ImageList_Create(16,16,ILC_COLOR32 or ILC_MASK,0,1);
- for i:=0 to HIGH(UActionList) do
- begin
- li.mask :=LVIF_TEXT+LVIF_PARAM+LVIF_IMAGE;
- li.iSubItem:=0;
- li.iItem :=i;
- li.lParam :=i;
- li.pszText :=UActionList[i].szActDescr;
- li.iImage:=ImageList_AddIcon(il,
- HICON(CallService(MS_SKIN2_GETICONBYHANDLE,0,LPARAM(UActionList[i].hIcolibIcon))));
- li.iItem :=SendMessageW(wnd,LVM_INSERTITEMW,0,LPARAM(@li));
-
- for lmenu:=main_menu to HIGH(tMenuType) do
- UActionList[i].UAMenuItem[lmenu].changed:=false;
- end;
- ImageList_Destroy(SendMessage(wnd,LVM_SETIMAGELIST,LVSIL_SMALL,il));
-
- SendMessage(wnd,LVM_SORTITEMS,0,LPARAM(@CompareItem));
-
- ListView_SetItemState(wnd,0,
- LVIS_FOCUSED or LVIS_SELECTED,
- LVIS_FOCUSED or LVIS_SELECTED);
-end;
-
-// refresh icons in UA list (at least)
-function IconChanged(wParam:WPARAM;lParam:LPARAM):int;cdecl;
-var
- i:integer;
- li:LV_ITEMW;
- il:HIMAGELIST;
- wnd:HWND;
-begin
- result:=0;
- wnd:=GetDlgItem(settings,IDC_UA_ACTIONLIST);
-
- il:=ImageList_Create(16,16,ILC_COLOR32 or ILC_MASK,0,1);
- for i:=0 to HIGH(UActionList) do
+ if IsWindowVisible(GetDlgItem(Dialog,IDC_UA_POPUPV)) then
begin
- li.mask :=LVIF_IMAGE;
- li.iSubItem:=0;
- li.iItem :=i;
- li.iImage:=ImageList_AddIcon(il,
- HICON(CallService(MS_SKIN2_GETICONBYHANDLE,0,TLPARAM(UActionList[i].hIcolibIcon))));
- SendMessageW(wnd,LVM_SETITEM,0,TLPARAM(@li));
+ pc:='<';
+ sh_main:=SW_HIDE;
+ sh_add :=SW_SHOW;
+ end
+ else
+ begin
+ pc:='>';
+ sh_main:=SW_SHOW;
+ sh_add :=SW_HIDE;
end;
- ImageList_Destroy(SendMessage(wnd,LVM_SETIMAGELIST,LVSIL_SMALL,il));
-//!!refresh?
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_NOTRANSLATE),sh_add);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_SEPARATE ),sh_add);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_POPUPT ),sh_main);
+ ShowWindow(GetDlgItem(Dialog,IDC_UA_VARNAMEST ),sh_main);
+ ShowEditField(Dialog,IDC_UA_VARNAMESV,sh_main);
+ ShowEditField(Dialog,IDC_UA_POPUPV ,sh_main);
+
+ SetDlgItemTextW(Dialog,IDC_UA_BLOCK,pc);
+ if sh_main=SW_SHOW then
+ pc:='Main settings'
+ else
+ pc:='Custom settings';
+ SetDlgItemTextW(Dialog,IDC_UA_MENU,TranslateW(pc));
end;
-function DlgProcOpt(Dialog:HWnd;hMessage:UINT;wParam:WPARAM;lParam:LPARAM):lresult; stdcall;
+//----- Main Dialog -----
+
+function DlgProcOpt(Dialog:HWND;hMessage:uint;wParam:WPARAM;lParam:LPARAM):LRESULT; stdcall;
var
wnd:HWND;
lv:LV_COLUMNW;
i:integer;
+ twostate:bool;
begin
result:=0;
case hMessage of
@@ -430,6 +527,8 @@ begin
settings:=0;
TranslateDialogDefault(Dialog);
+ InitActionSettings(Dialog);
+
wnd:=GetDlgItem(Dialog,IDC_UA_PLACELIST);
SendMessage(wnd,LVM_SETEXTENDEDLISTVIEWSTYLE,LVS_EX_CHECKBOXES,LVS_EX_CHECKBOXES);
SendMessage(wnd,LVM_SETUNICODEFORMAT,1,0);
@@ -450,16 +549,6 @@ begin
FillActionList(Dialog);
ShowAction(Dialog,-1);
-// if isVarsInstalled then
- begin
- SendDlgItemMessage(Dialog,IDC_UA_VARNAMESH,BM_SETIMAGE,IMAGE_ICON,
- CallService(MS_VARS_GETSKINITEM,0,VSI_HELPICON));
- SendDlgItemMessage(Dialog,IDC_UA_SHOWVARH,BM_SETIMAGE,IMAGE_ICON,
- CallService(MS_VARS_GETSKINITEM,0,VSI_HELPICON));
-// SendDlgItemMessage(Dialog,IDC_UA_VARNAMESH,BUTTONSETASFLATBTN,0,0);
-// SendDlgItemMessage(Dialog,IDC_UA_SHOWVARH ,BUTTONSETASFLATBTN,0,0);
- end;
-
settings:=Dialog;
hIC:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
end;
@@ -480,28 +569,36 @@ begin
begin
case loword(wParam) of
IDC_UA_TWOSTATE: begin
- SetupControls(Dialog,
+ twostate:=IsDlgButtonChecked(Dialog,IDC_UA_TWOSTATE)<>BST_UNCHECKED;
+ EnableWindow(GetDlgItem(Dialog,IDC_UA_SAVSTATE),twostate);
+
+ if LoByte(LV_GetLParam(GetDlgItem(Dialog,IDC_UA_PLACELIST))) in [uaTTB,uaTAB] then
+ EnableEditField(Dialog,IDC_UA_TTPRESSEDV,
+ twostate and IsWindowEnabled(GetDlgItem(Dialog,IDC_UA_TTNORMALV))
+ );
+
+ ShowHideControls(Dialog,
LV_GetLParam(GetDlgItem(Dialog,IDC_UA_PLACELIST)),-1);
- {
- EnableWindow(GetDlgItem(Dialog,IDC_UA_TTPRESSEDV),
- IsDlgButtonChecked(Dialog,IDC_UA_TWOSTATE)<>BST_UNCHECKED);
- }
- if IsDlgButtonChecked(Dialog,IDC_UA_TWOSTATE)=BST_UNCHECKED then
- DeleteIcolibIconP(
+
+ if twostate then
+ AddIcolibIconP(
UActionList[LV_GetLParam(GetDlgItem(Dialog,IDC_UA_ACTIONLIST),-1)])
else
- AddIcolibIconP(
+ DeleteIcolibIconP(
UActionList[LV_GetLParam(GetDlgItem(Dialog,IDC_UA_ACTIONLIST),-1)]);
SendMessage(GetParent(Dialog),PSM_CHANGED,0,0);
end;
- IDC_UA_VARNAMESH: ShowVarHelp(Dialog,IDC_UA_VARNAMESV);
- IDC_UA_SHOWVARH : ShowVarHelp(Dialog,IDC_UA_SHOWVARV);
-
+//was commented. why?
IDC_UA_SAVSTATE,
IDC_UA_GLOBAL: SendMessage(GetParent(Dialog),PSM_CHANGED,0,0);
+ IDC_UA_BLOCK: begin
+ ChangeBlock(Dialog);
+ end;
+
+ IDC_UA_NOTRANSLATE,
IDC_UA_SEPARATE: begin
SetChangedFlag(Dialog);
SendMessage(GetParent(Dialog),PSM_CHANGED,0,0);
@@ -547,6 +644,7 @@ begin
LV_GetLParam(GetDlgItem(Dialog,IDC_UA_PLACELIST),
PNMLISTVIEW(lParam)^.iItem));
end
+ // checkboxes
else if (settings<>0) and
((PNMLISTVIEW(lParam)^.uOldState or PNMLISTVIEW(lParam)^.uNewState)=$3000) then
begin
@@ -558,8 +656,7 @@ begin
LVIS_FOCUSED or LVIS_SELECTED,
LVIS_FOCUSED or LVIS_SELECTED)
else
- SetupControls(Dialog,LV_GetLParam(wnd,PNMLISTVIEW(lParam)^.iItem),
- PNMLISTVIEW(lParam)^.iItem);
+ EnableDisableCheck(Dialog);
SendMessage(GetParent(Dialog),PSM_CHANGED,0,0);
end;
diff --git a/plugins/Actman/ua/i_options.inc b/plugins/Actman/ua/i_options.inc
index 91f54e89d8..977ff7891b 100644
--- a/plugins/Actman/ua/i_options.inc
+++ b/plugins/Actman/ua/i_options.inc
@@ -26,7 +26,10 @@ begin
begin
p:=StrCopyE(p,opt_UA);
p^:='/'; inc(p);
-
+{!!
+ p^:='*'; inc(p); p^:=#0;
+ DBDeleteGroup(0,DBBranch,setting);
+!!}
StrCopy(p,opt_Flags); DBDeleteSetting(0,DBBranch,setting);
StrCopy(p,opt_TTBTooltip ); DBDeleteSetting(0,DBBranch,setting);
@@ -196,8 +199,6 @@ end;
*)
procedure SetAllActionUsers(var ActionItem:tMyActionItem; initial:boolean);
var
- setting:array [0..63] of AnsiChar;
- p:pAnsiChar;
luse:boolean;
lmenu:tMenuType;
begin
@@ -248,90 +249,4 @@ begin
DestroyServiceFunction(ActionItem.hMenuService);
ActionItem.hMenuService:=0;
end;
-
- // First run (ok ok, if ppl ask for it....)
- p:=GetUABranch(setting,ActionItem.dwActID);
- if p<>nil then
- begin
- p:=StrCopyE(p,opt_UA);
- p^:='/'; inc(p);
- StrCopy(p,'_FirstRun');
- if DBReadByte(0,DBBranch,setting,0)<>0 then
- begin
- CAllService(MS_ACT_RUNBYID,ActionItem.dwActID,0);
- DBDeleteSetting(0,DBBranch,setting);
- end;
- end;
-
-end;
-
-procedure DeleteUAction(num:integer);
-var
- ActionItem:pMyActionItem;
- setting:array [0..63] of AnsiChar;
- p:pAnsiChar;
- luse:boolean;
- lmenu:tMenuType;
-begin
- 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;
-
- p:=GetUABranch(setting,ActionItem.dwActID);
- if p<>nil then
- begin
- p:=StrCopyE(p,opt_UA);
- p^:='/'; inc(p);
- StrCopy(p,'_FirstRun');
- DBDeleteSetting(0,DBBranch,setting);
- end;
-
- // Free Memory
- mFreeMem(ActionItem.szNameID);
- mFreeMem(ActionItem.szActDescr);
-
- // 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;
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;
diff --git a/plugins/Actman/ua/i_uaplaces.inc b/plugins/Actman/ua/i_uaplaces.inc
index 4b1f46a762..222065b460 100644
--- a/plugins/Actman/ua/i_uaplaces.inc
+++ b/plugins/Actman/ua/i_uaplaces.inc
@@ -1,5 +1,5 @@
{}
-
+(*
const
MenuServices:array [tMenuType] of pAnsiChar = (
'CList/AddMainMenuItem' {MS_CLIST_ADDMAINMENUITEM },
@@ -8,6 +8,7 @@ const
'CList/AddProtoMenuItem' {MS_CLIST_ADDPROTOMENUITEM },
'CList/AddStatusMenuItem' {MS_CLIST_ADDSTATUSMENUITEM }
);
+*)
type
tuaMenuRec = record
hMenuRoot:HMENU;
@@ -25,7 +26,7 @@ begin
result:=CallService(MS_ACT_RUNBYID, lParam, wParam);
end;
-procedure SetTTBState(var ActionItem:tMyActionItem);
+procedure SetTTBState(const ActionItem:tMyActionItem);
var
lflag:integer;
begin
@@ -47,7 +48,7 @@ begin
CallService(MS_TTB_SETBUTTONSTATE,ActionItem.hTTBButton,lflag);
end;
-procedure SetTABState(hContact:THANDLE;var ActionItem:tMyActionItem;pressed:integer);
+procedure SetTABState(hContact:THANDLE;const ActionItem:tMyActionItem;pressed:integer);
var
tabb:TBBButton;
pc:pWideChar;
@@ -224,8 +225,8 @@ begin
if (ActionItem.flags and UAF_HKREGGED)=0 then
begin
FillChar(hkd,SizeOf(hkd),0);
- hkd.cbSize := SizeOf(hkd);
- hkd.dwFlags := HKD_UNICODE;
+ hkd.cbSize := SizeOf(hkd); // HOTKEYDESC_SIZE_V1 for pre-0.9
+ hkd.dwFlags := HKD_UNICODE; // since 0.9 only
hkd.pszName := ActionItem.szNameID;
hkd.pszDescription.w:= ActionItem.szActDescr;
hkd.pszSection .w:= MODULE_NAME;
@@ -341,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];
@@ -375,16 +376,26 @@ begin
end;
end;
end;
- // popup menu not found
+ // need to create popup menu
if not res then
begin
FillChar(clmi,SizeOf(clmi),0);
clmi.cbSize:=SizeOf(clmi);
- clmi.flags :=CMIF_UNICODE;
+ if (UAMenuItem.menu_opt and UAF_NOTRANS)<>0 then
+ clmi.flags :=CMIF_UNICODE or CMIF_KEEPUNTRANSLATED
+ else
+ 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);
@@ -395,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
@@ -417,7 +429,10 @@ begin
{}{}
FillChar(clmi,SizeOf(clmi),0);
clmi.cbSize:=SizeOf(clmi);
- clmi.flags:=CMIF_UNICODE;
+ if (UAMenuItem.menu_opt and UAF_NOTRANS)<>0 then
+ clmi.flags :=CMIF_UNICODE or CMIF_KEEPUNTRANSLATED
+ else
+ clmi.flags :=CMIF_UNICODE{ or CMIF_ICONFROMICOLIB};
if (ActionItem.flags and (UAF_2STATE+UAF_PRESSED))<>(UAF_2STATE+UAF_PRESSED) then
begin
clmi.hIcon:=ActionItem.hIcolibIcon;
@@ -426,22 +441,26 @@ begin
else
begin
clmi.hIcon:=ActionItem.hIcolibIconPressed;
- clmi.flags:=CMIF_UNICODE or CMIF_CHECKED;
+ clmi.flags:=clmi.flags or CMIF_CHECKED;
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;
@@ -456,13 +475,14 @@ 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);
{}
end;
-function PreBuildMenu(mtype:tMenuType;hContact:THANDLE=0):int;
+function PreBuildMenu(mtype:tMenuType;hContact:TMCONTACT=0):int;
var
i:integer;
mi:TCListMenuItem;
@@ -504,7 +524,7 @@ begin
if (mi.flags and CMIF_HIDDEN)=0 then
begin
//!!!! icon (check for contact menu)
- mi.flags:=mi.flags or CMIM_ICON or CMIM_FLAGS;
+ mi.flags:=mi.flags or CMIM_ICON or CMIM_FLAGS{ or CMIF_ICONFROMICOLIB};
if (mtype=contact_menu) and IsLocalItem(UActionList[i]) then
begin
@@ -543,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;
@@ -624,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;
@@ -639,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;
@@ -751,7 +795,7 @@ end;
function OnTabButtonPressed(wParam:WPARAM;lParam:LPARAM):int; cdecl;
var
cbcd:pCustomButtonClickData;
-// tabb:TBBButton;
+// tabb:BBButton;
// pc:pWideChar;
i:integer;
begin
diff --git a/plugins/Actman/ua/i_uavars.inc b/plugins/Actman/ua/i_uavars.inc
index bab2ac12a1..f2cf1ba42f 100644
--- a/plugins/Actman/ua/i_uavars.inc
+++ b/plugins/Actman/ua/i_uavars.inc
@@ -29,9 +29,6 @@ type
type
pMyActionItem = ^tMyActionItem;
tMyActionItem = record
- flags :dword;
- dwActID :dword; // action ID
- wSortIndex :word; // list/menu/toolbar order
// UseActions/Action_ID
szNameID :pAnsiChar; // uaction ID
szActDescr :pWideChar; // action name
@@ -50,6 +47,10 @@ type
lastContact :THANDLE; // for contact menu
hMenuService :THANDLE; // common menu service
UAMenuItem :array [tMenuType] of tUAMenuItem;
+ // moved to the end for better align
+ flags :dword;
+ dwActID :dword; // action ID
+ wSortIndex :word; // list/menu/toolbar order
end;
const
@@ -61,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
@@ -76,7 +79,10 @@ 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
type
tNameRec = record
@@ -119,6 +125,3 @@ var
UActionList:array of tMyActionItem;
var
szMyPath:array [0..MAX_PATH] of WideChar;
-var
- hServiceWithLParam:THANDLE;
- hTTBService:THANDLE;
diff --git a/plugins/Actman/ua/i_uconst.inc b/plugins/Actman/ua/i_uconst.inc
index 34dde3ee9e..cffbfdcc76 100644
--- a/plugins/Actman/ua/i_uconst.inc
+++ b/plugins/Actman/ua/i_uconst.inc
@@ -2,33 +2,35 @@
const
IDD_UA = 1031;
- IDC_UA_ACTIONLIST = 1025;
- IDC_UA_PLACELIST = 1026;
+ IDC_UA_ACTIONLIST = 1025;
+ IDC_UA_PLACELIST = 1026;
// menu settings
- IDC_UA_SEPARATE = 1027;
- IDC_UA_POPUPT = 1028;
- IDC_UA_POPUPV = 1029;
+ IDC_UA_POPUPT = 1030;
+ IDC_UA_POPUPV = 1031;
- IDC_UA_VARNAMEST = 1030;
- IDC_UA_VARNAMESV = 1031;
- IDC_UA_VARNAMESH = 1032;
+ IDC_UA_VARNAMEST = 1032;
+ IDC_UA_VARNAMESV = 1033;
- IDC_UA_SHOWVART = 1033;
- IDC_UA_SHOWVARV = 1034;
- IDC_UA_SHOWVARH = 1035;
+ IDC_UA_SHOWVART = 1034;
+ IDC_UA_SHOWVARV = 1035;
+
+ IDC_UA_BLOCK = 1040;
+ IDC_UA_SEPARATE = 1041;
+ IDC_UA_NOTRANSLATE = 1042;
+ IDC_UA_MENU = 1043;
// toolbar settings
- IDC_UA_TTNORMALT = 2028;
- IDC_UA_TTNORMALV = 2029;
- IDC_UA_TTPRESSEDT = 2030;
- IDC_UA_TTPRESSEDV = 2031;
+ IDC_UA_TTNORMALT = 2028;
+ IDC_UA_TTNORMALV = 2029;
+ IDC_UA_TTPRESSEDT = 2030;
+ IDC_UA_TTPRESSEDV = 2031;
// common
- IDC_UA_COMMON = 2000;
- IDC_UA_TWOSTATE = 2001;
- IDC_UA_SAVSTATE = 2002;
+ IDC_UA_COMMON = 2000;
+ IDC_UA_TWOSTATE = 2001;
+ IDC_UA_SAVSTATE = 2002;
- IDC_UA_GLOBAL = 2003;
+ IDC_UA_GLOBAL = 2003;
IDI_ACTION = 101;
diff --git a/plugins/Actman/ua/ua.pas b/plugins/Actman/ua/ua.pas
index 62b9604286..e6e33aeaad 100644
--- a/plugins/Actman/ua/ua.pas
+++ b/plugins/Actman/ua/ua.pas
@@ -2,21 +2,15 @@ unit ua;
interface
-procedure Init;
-procedure DeInit;
-function AddOptionPage(var tmpl:pAnsiChar;var proc:pointer;var name:PAnsiChar):integer;
-
implementation
uses
windows, commctrl, messages,
- mirutils, common, dbsettings, io, m_api, wrapper,
+ mirutils, common, dbsettings, io, m_api, wrapper, editwrapper,
global;
{$R ua.res}
-{$include m_actman.inc}
-
{$include i_uconst.inc}
{$include i_uavars.inc}
@@ -53,53 +47,54 @@ var
// ------------ base interface functions -------------
+procedure CheckPlacesAbility;
var
- iohook:THANDLE;
- hontabloaded,
- honttbloaded,
- ontabbtnpressed,
- onactchanged:THANDLE;
- hPreBuildMMenu,
- hPreBuildCMenu,
- hPreBuildTMenu:THANDLE;
+ i:integer;
+begin
+ for i:=0 to NumTypes-1 do
+ begin
+ with NamesArray[i] do
+ begin
+ enable:=(service=nil) or (ServiceExists(service)<>0);
+ end;
+ end;
+end;
procedure Init;
begin
GetModuleFileNameW(hInstance,szMyPath,MAX_PATH);
- hServiceWithLParam:=CreateServiceFunction(SERVICE_WITH_LPARAM_NAME,@ServiceCallWithLParam);
- hTTBService :=CreateServiceFunction(TTB_SERVICE_NAME ,@TTBServiceCall);
+ CreateServiceFunction(SERVICE_WITH_LPARAM_NAME,@ServiceCallWithLParam);
+ CreateServiceFunction(TTB_SERVICE_NAME ,@TTBServiceCall);
CheckPlacesAbility;
CreateUActionList;
- honttbloaded :=HookEvent(ME_TTB_MODULELOADED ,@OnTTBLoaded);
- hontabloaded :=HookEvent(ME_MSG_TOOLBARLOADED,@OnTabBBLoaded);
- ontabbtnpressed:=HookEvent(ME_MSG_BUTTONPRESSED,@OnTabButtonPressed);
- onactchanged :=HookEvent(ME_ACT_CHANGED ,@ActListChange);
+ HookEvent(ME_TTB_MODULELOADED ,@OnTTBLoaded);
+ HookEvent(ME_MSG_TOOLBARLOADED,@OnTabBBLoaded);
+ HookEvent(ME_MSG_BUTTONPRESSED,@OnTabButtonPressed);
+ HookEvent(ME_ACT_CHANGED ,@ActListChange);
- hPreBuildMMenu:=HookEvent(ME_CLIST_PREBUILDMAINMENU , PreBuildMainMenu);
- hPreBuildCMenu:=HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu);
- hPreBuildTMenu:=HookEvent(ME_CLIST_PREBUILDTRAYMENU , PreBuildTrayMenu);
+ HookEvent(ME_CLIST_PREBUILDMAINMENU , PreBuildMainMenu);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu);
+ HookEvent(ME_CLIST_PREBUILDTRAYMENU , PreBuildTrayMenu);
- iohook:=HookEvent(ME_ACT_INOUT,@ActInOut);
+ HookEvent(ME_ACT_INOUT,@ActInOut);
end;
procedure DeInit;
+var
+ i:integer;
begin
+ if Length(UActionList)>0 then
+ begin
+ for i:=HIGH(UActionList) downto 0 do
+ begin
+ DeleteUAction(i,false);
+ end;
+ SetLength(UActionList,0);
+ end;
SetLength(arMenuRec,0);
-
- UnhookEvent(hPreBuildMMenu);
- UnhookEvent(hPreBuildCMenu);
- UnhookEvent(hPreBuildTMenu);
-
- UnhookEvent(honttbloaded);
- UnhookEvent(hontabloaded);
- UnhookEvent(ontabbtnpressed);
- UnhookEvent(onactchanged);
- UnhookEvent(iohook);
- DestroyServiceFunction(hServiceWithLParam);
- DestroyServiceFunction(hTTBService);
end;
function AddOptionPage(var tmpl:pAnsiChar;var proc:pointer;var name:PAnsiChar):integer;
diff --git a/plugins/Actman/ua/ua.rc b/plugins/Actman/ua/ua.rc
index 76d8c0ad77..6e0fdde413 100644
--- a/plugins/Actman/ua/ua.rc
+++ b/plugins/Actman/ua/ua.rc
@@ -7,44 +7,47 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0
{
- CTEXT "Action list",-1, 2,2,132,10, SS_CENTERIMAGE
+ CTEXT "Action list",-1, 0,2,134,11, SS_CENTERIMAGE
CONTROL "", IDC_UA_ACTIONLIST, "SysListView32",
WS_BORDER | WS_TABSTOP |
LVS_NOCOLUMNHEADER | LVS_SHOWSELALWAYS | LVS_REPORT | LVS_SINGLESEL,
- 2, 12, 132, 212, WS_EX_CONTROLPARENT
+ 0, 13, 134, 212, WS_EX_CONTROLPARENT
- CTEXT "Where to use",-1, 138,2,160,10, SS_CENTERIMAGE
+ CTEXT "Where to use",-1, 138,2,160,11, SS_CENTERIMAGE
CONTROL "", IDC_UA_PLACELIST, "SysListView32",
WS_BORDER | WS_TABSTOP |
LVS_NOCOLUMNHEADER | LVS_SHOWSELALWAYS | LVS_REPORT | LVS_SINGLESEL,
- 138, 12, 160, 74, WS_EX_CONTROLPARENT
+ 138, 13, 160, 74, WS_EX_CONTROLPARENT
- GROUPBOX "Common" , IDC_UA_COMMON , 138, 88,160,38
- AUTOCHECKBOX "2 state button/item" , IDC_UA_TWOSTATE, 140, 96,156,14, BS_LEFTTEXT | BS_RIGHT
- AUTOCHECKBOX "Save button/item state", IDC_UA_SAVSTATE, 140,110,156,14, BS_LEFTTEXT | BS_RIGHT
+ GROUPBOX "Common" , IDC_UA_COMMON , 138, 88,164,38
+ AUTOCHECKBOX "2 state button/item" , IDC_UA_TWOSTATE, 140, 96,160,14, BS_LEFTTEXT | BS_RIGHT
+ AUTOCHECKBOX "Save button/item state", IDC_UA_SAVSTATE, 140,110,160,14, BS_LEFTTEXT | BS_RIGHT
- AUTOCHECKBOX "Contact related", IDC_UA_GLOBAL, 138,128,160,14, BS_LEFTTEXT | BS_RIGHT
+ AUTOCHECKBOX "Contact related", IDC_UA_GLOBAL, 138,128,164,14, BS_LEFTTEXT | BS_RIGHT
// Buttons settings block
- RTEXT "Normal button tooltip",IDC_UA_TTNORMALT, 138,148,160,8
- EDITTEXT IDC_UA_TTNORMALV, 138,158,160,12, ES_AUTOHSCROLL
+ RTEXT "Normal button tooltip",IDC_UA_TTNORMALT, 138,144,164,12, SS_CENTERIMAGE
+ EDITTEXT IDC_UA_TTNORMALV, 138,157,164,12, ES_AUTOHSCROLL
- RTEXT "Pressed button tooltip",IDC_UA_TTPRESSEDT, 138,172,160,8
- EDITTEXT IDC_UA_TTPRESSEDV, 138,182,160,12, ES_AUTOHSCROLL
+ RTEXT "Pressed button tooltip",IDC_UA_TTPRESSEDT, 138,172,164,12, SS_CENTERIMAGE
+ EDITTEXT IDC_UA_TTPRESSEDV, 138,185,164,12, ES_AUTOHSCROLL
- // Menu settings block
- AUTOCHECKBOX "Separated",IDC_UA_SEPARATE, 138,142,160,14, BS_LEFTTEXT | BS_RIGHT
+ PUSHBUTTON ">" , IDC_UA_BLOCK, 292,146, 10,52
+ GROUPBOX "Main settings", IDC_UA_MENU , 138,142,152,58
- RTEXT "Root popup:",IDC_UA_POPUPT,138,158,80,12, SS_CENTERIMAGE
- EDITTEXT IDC_UA_POPUPV, 218,158,80,12, ES_AUTOHSCROLL
+ // Block #1 (Menu data block)
+ RTEXT "Root popup:",IDC_UA_POPUPT, 140,150,146,12, SS_CENTERIMAGE
+ EDITTEXT IDC_UA_POPUPV, 141,162,146,12, ES_AUTOHSCROLL
- RTEXT "Menu item name:",IDC_UA_VARNAMEST, 138,172,140,8
- EDITTEXT IDC_UA_VARNAMESV, 138,182,140,12, ES_AUTOHSCROLL
- CONTROL "V",IDC_UA_VARNAMESH,"MButtonClass",WS_TABSTOP, 282,180,16,16, $18000000
+ RTEXT "Menu item name:",IDC_UA_VARNAMEST, 140,174,146,12, SS_CENTERIMAGE
+ EDITTEXT IDC_UA_VARNAMESV, 141,186,146,12, ES_AUTOHSCROLL
- RTEXT "Show only if variables return 1",IDC_UA_SHOWVART, 138,200,140,8
- EDITTEXT IDC_UA_SHOWVARV,138,210,140,12,ES_AUTOHSCROLL
- CONTROL "V",IDC_UA_SHOWVARH,"MButtonClass",WS_TABSTOP, 282,208,16,16, $18000000
+ // Block #2 (Menu settings block)
+ AUTOCHECKBOX "Separated" ,IDC_UA_SEPARATE , 140,150,148,14, BS_LEFTTEXT | BS_RIGHT
+ AUTOCHECKBOX "Do not translate",IDC_UA_NOTRANSLATE, 140,166,148,14, BS_LEFTTEXT | BS_RIGHT
+
+ RTEXT "Show only if variables return 1",IDC_UA_SHOWVART, 138,200,164,12, SS_CENTERIMAGE
+ EDITTEXT IDC_UA_SHOWVARV, 138,213,164,12, ES_AUTOHSCROLL
}
diff --git a/plugins/Actman/ua/ua.res b/plugins/Actman/ua/ua.res
index c8f5fd5ea1..25b0f7f2ca 100644
--- a/plugins/Actman/ua/ua.res
+++ b/plugins/Actman/ua/ua.res
Binary files differ