From a26b59b904144f95f87bd5926787dba0568a4c5b Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Sun, 21 Dec 2014 20:36:45 +0000 Subject: Actman: "Single instance" default (for every new macro) flag introduced Small options GUI logic changes git-svn-id: http://svn.miranda-ng.org/main/trunk@11564 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Actman/i_cnst_settings.inc | 1 + plugins/Actman/i_opt_dlg2.inc | 43 +++++++++++++++++++++++++++++-------- plugins/Actman/i_services.inc | 6 ++++++ plugins/Actman/iac_settings.pas | 39 +++++++++++++++++++++++++++++++++ plugins/Actman/iac_settings.rc | 5 +++-- plugins/Actman/iac_settings.res | Bin 3636 -> 3696 bytes plugins/Actman/lowlevelc.pas | 16 ++++++++------ 7 files changed, 92 insertions(+), 18 deletions(-) diff --git a/plugins/Actman/i_cnst_settings.inc b/plugins/Actman/i_cnst_settings.inc index c8c495a24a..e4b859f2cd 100644 --- a/plugins/Actman/i_cnst_settings.inc +++ b/plugins/Actman/i_cnst_settings.inc @@ -10,3 +10,4 @@ const IDC_FR_FLAG = 2155; IDC_HC_WPAR = 2156; IDC_VL_FLAG = 2157; + IDC_SI_FLAG = 2158; diff --git a/plugins/Actman/i_opt_dlg2.inc b/plugins/Actman/i_opt_dlg2.inc index 75e1a51685..a8d1b2d2f0 100644 --- a/plugins/Actman/i_opt_dlg2.inc +++ b/plugins/Actman/i_opt_dlg2.inc @@ -148,11 +148,12 @@ end; // clear "introduced" and "replaced" flags procedure SetSave(Dialog:HWND); var - i,j:integer; TmpMacroList:tMacroList; - TmpMacroCount:integer; + TmpMacro:pMacroRecord; wnd:HWND; li:LV_ITEMW; + i,j:integer; + TmpMacroCount:integer; begin wnd:=MacroListWindow; TmpMacroCount:=SendMessageW(wnd,LVM_GETITEMCOUNT,0,0); @@ -183,10 +184,23 @@ begin li.iItem:=i; SendMessageW(wnd,LVM_GETITEMW,0,lparam(@li)); // GetLParam(wnd,i); move(EditMacroList[loword(li.lParam)]^,TmpMacroList[i]^,SizeOf(tMacroRecord)); + + // macro flags + TmpMacroList[i]^.flags:= + (TmpMacroList[i]^.flags and not ACF_MACROFLAG) or + (li.lParam and ACF_MACROFLAG); +{!! + TmpMacro:=TmpMacroList[i]; if (li.lParam and ACF_FIRSTRUN)<>0 then - TmpMacroList[i]^.flags:=TmpMacroList[i]^.flags or ACF_FIRSTRUN + TmpMacro^.flags:=TmpMacro^.flags or ACF_FIRSTRUN + else + TmpMacro^.flags:=TmpMacro^.flags and not ACF_FIRSTRUN; + + if (li.lParam and ACF_SINGLEINST)<>0 then + TmpMacro^.flags:=TmpMacro^.flags or ACF_SINGLEINST else - TmpMacroList[i]^.flags:=TmpMacroList[i]^.flags and not ACF_FIRSTRUN; + TmpMacro^.flags:=TmpMacro^.flags and not ACF_SINGLEINST; +!!} li.lParam:=(li.lParam and (not $FFFF)) or i; SendMessageW(wnd,LVM_SETITEMW,0,lparam(@li)); end; @@ -747,10 +761,15 @@ begin begin lvi.iItem :=i; - lvi.lParam:=i; + lvi.lParam:=i or (CurMacro^.flags and ACF_MACROFLAG); +{!! if (CurMacro^.flags and ACF_FIRSTRUN)<>0 then lvi.lParam:=lvi.lParam or ACF_FIRSTRUN; - + if (CurMacro^.flags and ACF_VOLATILE)<>0 then + lvi.lParam:=lvi.lParam or ACF_VOLATILE; + if (CurMacro^.flags and ACF_SINGLEINST)<>0 then + lvi.lParam:=lvi.lParam or ACF_SINGLEINST; +!!} lvi.pszText:=@(CurMacro^.descr); SendMessageW(list,LVM_INSERTITEMW,0,tlparam(@lvi)); inc(result); @@ -976,10 +995,12 @@ begin end; case loword(wParam) of -{ + IDC_GROUP_EXPORT: begin if ShowDlgW(xmlfilename,xmlfilename,TranslateW(inoutfilter),false) then begin +aExport(EditMacroList,xmlfilename,0); +{ wnd:=MacroListWindow; for i:=0 to ListView_GetItemCount(wnd)-1 do begin @@ -1004,15 +1025,19 @@ begin // we MUST Export EditMacroList, NOT MacroList // OR // Use "Apply" code before - CallService(MS_ACT_INOUT,i,TLPARAM(@xmlfilename)); + +// CallService(MS_ACT_INOUT,i,TLPARAM(@xmlfilename)); + for i:=0 to MaxGroups-1 do with EditMacroList[i] do if (flags and (ACF_EXPORT or ACF_ASSIGNED))= (ACF_EXPORT or ACF_ASSIGNED) then flags:=flags and not ACF_EXPORT; +} end; + end; -} + IDC_GROUP_IMPORT: begin if ShowDlgW(xmlfilename,xmlfilename,TranslateW(inoutfilter)) then begin diff --git a/plugins/Actman/i_services.inc b/plugins/Actman/i_services.inc index 2954fa4b15..6bd0ddc0e3 100644 --- a/plugins/Actman/i_services.inc +++ b/plugins/Actman/i_services.inc @@ -180,6 +180,12 @@ var tmp:pActStartData; i:integer; begin + if (macro.flags and (ACF_USEDNOW or ACF_SINGLEINST))=(ACF_USEDNOW or ACF_SINGLEINST) then + begin + result:=-1; + exit; + end; + mGetMem (tmp ,SizeOf(tActStartData)); FillChar(tmp^,SizeOf(tActStartData),0); diff --git a/plugins/Actman/iac_settings.pas b/plugins/Actman/iac_settings.pas index 3997fbe73d..9d17be2846 100644 --- a/plugins/Actman/iac_settings.pas +++ b/plugins/Actman/iac_settings.pas @@ -42,6 +42,7 @@ var fCLformat:pWideChar; lp:TLPARAM; stat:integer; + flag:dword; begin result:=0; @@ -76,6 +77,7 @@ begin if (lParam=0) and (wParam=1) then begin lp:=LV_GetLParam(MacroListWindow); + if (lp and ACF_FIRSTRUN)<>0 then stat:=BST_CHECKED else @@ -87,6 +89,12 @@ begin else stat:=BST_UNCHECKED; CheckDlgButton(Dialog,IDC_VL_FLAG,stat); + + if (lp and ACF_SINGLEINST)<>0 then + stat:=BST_CHECKED + else + stat:=BST_UNCHECKED; + CheckDlgButton(Dialog,IDC_SI_FLAG,stat); end; end; @@ -109,6 +117,25 @@ begin DBWriteByte(0,DBBranch,'CLfilter',IsDlgButtonChecked(Dialog,IDC_CNT_FILTER)); end; + IDC_FR_FLAG, + IDC_VL_FLAG, + IDC_SI_FLAG: begin + lp:=LV_GetLParam(MacroListWindow); + case loword(wParam) of + IDC_FR_FLAG: flag:=ACF_FIRSTRUN; + IDC_VL_FLAG: flag:=ACF_VOLATILE; + IDC_SI_FLAG: flag:=ACF_SINGLEINST; + end; + if IsDlgButtonChecked(Dialog,loword(wParam))=BST_UNCHECKED then + lp:=lp and not flag + else + lp:=lp or flag; + + LV_SetLParam(MacroListWindow,lp); + + SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0); + end; +{!! IDC_FR_FLAG: begin lp:=LV_GetLParam(MacroListWindow); if IsDlgButtonChecked(Dialog,IDC_FR_FLAG)=BST_UNCHECKED then @@ -130,6 +157,18 @@ begin SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0); end; + + IDC_SI_FLAG: begin + lp:=LV_GetLParam(MacroListWindow); + if IsDlgButtonChecked(Dialog,IDC_SI_FLAG)=BST_UNCHECKED then + lp:=lp and not ACF_SINGLEINST + else + lp:=lp or ACF_SINGLEINST; + LV_SetLParam(MacroListWindow,lp); + + SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0); + end; +!!} end; end; end; diff --git a/plugins/Actman/iac_settings.rc b/plugins/Actman/iac_settings.rc index 69487dd87d..59df6066af 100644 --- a/plugins/Actman/iac_settings.rc +++ b/plugins/Actman/iac_settings.rc @@ -18,9 +18,10 @@ FONT 8, "MS Shell Dlg", 0, 0 COMBOBOX IDC_SERVICELIST , 19, 94, 148, 96, CBS_DROPDOWNLIST | WS_VSCROLL CONTROL "Apply",IDC_SRV_APPLY,"MButtonClass",WS_TABSTOP,1,93,16,16,$18000000 - GROUPBOX "Current Macro", -1, 1, 116, 166, 40, WS_GROUP + GROUPBOX "Current Macro", -1, 1, 116, 166, 50, WS_GROUP AUTOCHECKBOX "Select for FirstRun",IDC_FR_FLAG, 4, 126, 160, 12 - AUTOCHECKBOX "Select as Volatile" ,IDC_VL_FLAG, 4, 138, 160, 12 + AUTOCHECKBOX "Mark as Volatile" ,IDC_VL_FLAG, 4, 138, 160, 12 + AUTOCHECKBOX "Single instance" ,IDC_SI_FLAG, 4, 150, 160, 12 // AUTOCHECKBOX "hContact in wParam" ,IDC_HC_WPAR, 4, 138, 160, 12 } diff --git a/plugins/Actman/iac_settings.res b/plugins/Actman/iac_settings.res index 1aaef00324..459c9ac3b1 100644 Binary files a/plugins/Actman/iac_settings.res and b/plugins/Actman/iac_settings.res differ diff --git a/plugins/Actman/lowlevelc.pas b/plugins/Actman/lowlevelc.pas index fe6d9bde31..64018f7b18 100644 --- a/plugins/Actman/lowlevelc.pas +++ b/plugins/Actman/lowlevelc.pas @@ -8,12 +8,14 @@ uses // Macro flags const - ACF_ASSIGNED = $80000000; // macro assigned - ACF_FIRSTRUN = $40000000; // FirstRun flag - ACF_USEDNOW = $20000000; // macro in use (reserved) - ACF_VOLATILE = $10000000; // don't save in DB + ACF_ASSIGNED = $80000000; // macro assigned + ACF_FIRSTRUN = $40000000; // FirstRun flag + ACF_USEDNOW = $20000000; // macro in use (reserved) + ACF_VOLATILE = $10000000; // don't save in DB + ACF_SINGLEINST = $08000000; // Single macro instance - ACF_TOSAVE = ACF_ASSIGNED or ACF_FIRSTRUN; + ACF_TOSAVE = ACF_ASSIGNED or ACF_FIRSTRUN or ACF_SINGLEINST; + ACF_MACROFLAG = $FF000000; type pActionList = ^tActionList; @@ -264,8 +266,8 @@ begin begin StrCopyW(descr,NoDescription,MacroNameLen-1); QueryPerformanceCounter(tmp); - id :=tmp and $FFFFFFFF; - flags :=ACF_ASSIGNED; + id :=tmp and $FFFFFFFF; + flags:=ACF_ASSIGNED or ACF_SINGLEINST; end; end; -- cgit v1.2.3