From 985cddceaca1d74cf90b218b05dbeb71e5916e04 Mon Sep 17 00:00:00 2001 From: George Hazan <ghazan@miranda.im> Date: Mon, 11 Feb 2019 18:56:03 +0300 Subject: old xml api removed from pascal plugins --- plugins/Actman/actman.dpr | 1 - plugins/Actman/i_opt_dlg.inc | 4 - plugins/Actman/i_opt_dlg2.inc | 23 --- plugins/Actman/iac_call.pas | 9 +- plugins/Actman/iac_chain.pas | 43 +---- plugins/Actman/iac_contact.pas | 19 +- plugins/Actman/iac_dbrw.pas | 61 +------ plugins/Actman/iac_global.pas | 71 +------- plugins/Actman/iac_ini.pas | 9 +- plugins/Actman/iac_inout.pas | 77 +------- plugins/Actman/iac_jump.pas | 78 +------- plugins/Actman/iac_messagebox.pas | 26 +-- plugins/Actman/iac_notes.pas | 2 +- plugins/Actman/iac_program.pas | 62 +------ plugins/Actman/iac_service.pas | 116 +----------- plugins/Actman/iac_storage.pas | 19 +- plugins/Actman/iac_text.pas | 22 +-- plugins/Actman/inoutxml.pas | 145 --------------- plugins/Actman/ua/i_inoutjson.inc | 2 +- plugins/Actman/ua/i_inoutxm.inc | 334 ---------------------------------- plugins/Actman/ua/ua.pas | 3 - plugins/Watrack/lastfm/i_last_api.inc | 315 -------------------------------- plugins/Watrack/lastfm/i_last_dlg.inc | 5 - plugins/Watrack/lastfm/lastfm.pas | 10 +- 24 files changed, 23 insertions(+), 1433 deletions(-) delete mode 100644 plugins/Actman/inoutxml.pas delete mode 100644 plugins/Actman/ua/i_inoutxm.inc (limited to 'plugins') diff --git a/plugins/Actman/actman.dpr b/plugins/Actman/actman.dpr index 296c02e1ef..128abd0ea9 100644 --- a/plugins/Actman/actman.dpr +++ b/plugins/Actman/actman.dpr @@ -54,7 +54,6 @@ uses iac_call, iac_ini, iac_notes, - inoutxml, ua in 'ua\ua.pas', hooks in 'hooks\hooks.pas', scheduler in 'tasks\scheduler.pas'; diff --git a/plugins/Actman/i_opt_dlg.inc b/plugins/Actman/i_opt_dlg.inc index 878f127427..c1a7de4817 100644 --- a/plugins/Actman/i_opt_dlg.inc +++ b/plugins/Actman/i_opt_dlg.inc @@ -1,6 +1,4 @@ {} -var - xmlfilename:array [0..511] of WideChar; const etMacro = 1; // Groups changed etACT = 2; // Actions changed @@ -19,8 +17,6 @@ begin result:=0; NoDescription:=TranslateW('No description'); - StrCopyW(xmlfilename,'c:\export.xml'); - DoInitCommonControls(ICC_USEREX_CLASSES); FillChar(odp,SizeOf(odp),0); diff --git a/plugins/Actman/i_opt_dlg2.inc b/plugins/Actman/i_opt_dlg2.inc index 0a50f9d171..e247b1c9c3 100644 --- a/plugins/Actman/i_opt_dlg2.inc +++ b/plugins/Actman/i_opt_dlg2.inc @@ -1,7 +1,5 @@ {} -const - inoutfilter:pWideChar = 'XML files'#0'*.xml'#0'All files'#0'*.*'#0#0; const MaxDescrLen = 128; const @@ -935,27 +933,6 @@ begin end; case loword(wParam) of - IDC_GROUP_IMPORT: begin - if ShowDlgW(xmlfilename,xmlfilename,TranslateW(inoutfilter)) then - begin - // "save" selected macro (in edit list only) - BuildActionChain(Dialog); - - if Import(EditMacroList,xmlfilename,0)<>0 then - begin - // copy from WM_INITDIALOG - FillMacroList(Dialog); - ChangeListNotify(1); - - // fill current group - FillActionList(Dialog,EditMacroList[0]); - ChangeListNotify(2); - - CheckMacroListDirectionButtons(Dialog); - end; - end; - end; - IDC_GROUP_TEST: begin li.mask :=LVIF_PARAM; li.iSubItem:=0; diff --git a/plugins/Actman/iac_call.pas b/plugins/Actman/iac_call.pas index 0ff306e4b9..e368bb456b 100644 --- a/plugins/Actman/iac_call.pas +++ b/plugins/Actman/iac_call.pas @@ -45,7 +45,7 @@ type public constructor Create(uid:dword); destructor Destroy; override; -// function Clone:tBaseAction; override; + function DoAction(var WorkData:tWorkData):LRESULT; override; procedure Save(node:pointer;fmt:integer); override; procedure Load(node:pointer;fmt:integer); override; @@ -101,14 +101,7 @@ begin inherited Destroy; end; -{ -function tCallAction.Clone:tBaseAction; -begin - result:=.Create(0); - Duplicate(result); -end; -} function tCallAction.DoAction(var WorkData:tWorkData):LRESULT; var hDLL:THANDLE; diff --git a/plugins/Actman/iac_chain.pas b/plugins/Actman/iac_chain.pas index 5be20d6d8c..ee2a73f4ca 100644 --- a/plugins/Actman/iac_chain.pas +++ b/plugins/Actman/iac_chain.pas @@ -35,7 +35,7 @@ type public constructor Create(uid:dword); destructor Destroy; override; -// function Clone:tBaseAction; override; + function DoAction(var WorkData:tWorkData):LRESULT; override; procedure Save(node:pointer;fmt:integer); override; procedure Load(node:pointer;fmt:integer); override; @@ -60,16 +60,7 @@ begin inherited Destroy; end; -{ -function tChainAction.Clone:tBaseAction; -begin - result:=tChainAction.Create(0); - Duplicate(result); - tChainAction(result).id:=id; - StrDupW(tChainAction(result).actname,actname); -end; -} function tChainAction.DoAction(var WorkData:tWorkData):LRESULT; var params:tAct_Param; @@ -139,20 +130,6 @@ begin pc:=StrCopyE(section,pAnsiChar(node)); StrCopy(pc,'text'); id:=DBReadDWord(0,DBBranch,section); end; - - 1: begin - StrDupW(actname,xmlGetText(HXML(node))); - flags:=flags or ACF_BYNAME; - - if StrToInt(xmlGetAttrValue(HXML(node),ioNoWait))=1 then - flags:=flags or ACF_NOWAIT; - - if StrToInt(xmlGetAttrValue(HXML(node),ioKeepOld))=1 then - flags:=flags or ACF_KEEPOLD; - - if StrToInt(xmlGetAttrValue(HXML(node),ioSameThread))=1 then - flags:=flags or ACF_SAMETHREAD; - end; end; end; @@ -174,23 +151,7 @@ begin StrCopy(pc,opt_actname); DBWriteUnicode(0,DBBranch,section,actname); end; end; -{ - 1: begin - end; -} -{ - 2: begin - end; -} -{ - 3: begin - Out(node,['CallAction',actname, - IFF(flags or ACF_SAMETHREAD,'samethread',''), - IFF(flags or ACF_NOWAIT ,'nowait',''), - IFF(flags or ACF_KEEPOLD ,'keepold','') - ]); - end; -} + 13: begin tTextExport(node).AddTextW('actionname',actname); tTextExport(node).AddFlag('samethread',(flags or ACF_SAMETHREAD)<>0); diff --git a/plugins/Actman/iac_contact.pas b/plugins/Actman/iac_contact.pas index ffcfd47bd5..bf19f02020 100644 --- a/plugins/Actman/iac_contact.pas +++ b/plugins/Actman/iac_contact.pas @@ -27,7 +27,7 @@ type contact:TMCONTACT; public constructor Create(uid:dword); -// function Clone:tBaseAction; override; + function DoAction(var WorkData:tWorkData):LRESULT; override; procedure Save(node:pointer;fmt:integer); override; procedure Load(node:pointer;fmt:integer); override; @@ -41,15 +41,6 @@ begin contact:=0; end; -{ -function tContactAction.Clone:tBaseAction; -begin - result:=tContactAction.Create(0); - Duplicate(result); - - tContactAction(result).contact:=contact; -end; -} //----- Object realization ----- @@ -82,14 +73,6 @@ begin case fmt of 0: if (flags and ACF_GETACTIVE)=0 then contact:=LoadContact(DBBranch,node); - - 1: begin - contact:=ImportContact(HXML(node)); - if StrToInt(xmlGetAttrValue(HXML(node),ioKeepOnly))=1 then - flags:=flags or ACF_KEEPONLY; - if StrToInt(xmlGetAttrValue(HXML(node),ioWindow))=1 then - flags:=flags or ACF_GETACTIVE; - end; end; end; diff --git a/plugins/Actman/iac_dbrw.pas b/plugins/Actman/iac_dbrw.pas index f03e5048a7..5031e5ee7e 100644 --- a/plugins/Actman/iac_dbrw.pas +++ b/plugins/Actman/iac_dbrw.pas @@ -92,7 +92,7 @@ type public constructor Create(uid:dword); destructor Destroy; override; -// function Clone:tBaseAction; override; + function DoAction(var WorkData:tWorkData):LRESULT; override; procedure Save(node:pointer;fmt:integer); override; procedure Load(node:pointer;fmt:integer); override; @@ -120,25 +120,7 @@ begin inherited Destroy; end; -{ -function tDataBaseAction.Clone:tBaseAction; -var - tmp:tDataBaseAction; -begin - result:=tDataBaseAction.Create(0); - Duplicate(result); - - tmp.dbcontact:=dbcontact; - StrDupW(tmp.dbmodule ,dbmodule); - StrDupW(tmp.dbsetting,dbsetting); - if ((flags and ACF_DBDELETE)=0) and - ((flags and ACF_LAST)=0) then - StrDupW(tmp.dbvalue,dbvalue); - - result:=tmp; -end; -} function tDataBaseAction.DoAction(var WorkData:tWorkData):LRESULT; var sbuf:array [0..31] of WideChar; @@ -387,42 +369,6 @@ begin if (flags2 and ACF2_RW_TVAR)<>0 then flags:=flags or ACF_RW_VALUE; end; - - 1: begin - tmp:=xmlGetAttrValue(HXML(node),ioOper); - if lstrcmpiw(tmp,ioDelete)=0 then flags:=flags or ACF_DBDELETE - else if lstrcmpiw(tmp,ioWrite )=0 then flags:=flags or ACF_DBWRITE; - tmp:=xmlGetAttrValue(HXML(node),ioContact); - if lstrcmpiw(tmp,ioCurrent)=0 then flags:=flags or ACF_CURRENT - else if lstrcmpiw(tmp,ioResult )=0 then flags:=flags or ACF_RESULT - else if lstrcmpiw(tmp,ioParam )=0 then flags:=flags or ACF_PARAM - else if lstrcmpiw(tmp,ioContact)=0 then - begin - dbcontact:=ImportContact(HXML(node)); - end; - - StrDupW(dbmodule ,xmlGetAttrValue(HXML(node),ioModule)); - StrDupW(dbsetting,xmlGetAttrValue(HXML(node),ioSetting)); - - if StrToInt(xmlGetAttrValue(HXML(node),ioFileVariable))=1 then flags:=flags or ACF_RW_MODULE; - if StrToInt(xmlGetAttrValue(HXML(node),ioArgVariable ))=1 then flags:=flags or ACF_RW_SETTING; - if StrToInt(xmlGetAttrValue(HXML(node),ioVariables ))=1 then flags:=flags or ACF_RW_VALUE; - - tmp:=xmlGetAttrValue(HXML(node),ioType); - if lstrcmpiw(tmp,ioByte )=0 then flags:=flags or ACF_DBBYTE - else if lstrcmpiw(tmp,ioWord )=0 then flags:=flags or ACF_DBWORD - else if lstrcmpiw(tmp,ioDword)=0 then - else if lstrcmpiw(tmp,ioAnsi )=0 then flags:=flags or ACF_DBANSI - else flags:=flags or ACF_DBUTEXT; - - if StrToInt(xmlGetAttrValue(HXML(node),ioSaveValue))=1 then - flags:=flags or ACF_SAVE; - - if StrToInt(xmlGetAttrValue(HXML(node),ioLast))=1 then - flags:=flags or ACF_LAST - else - StrDupW(dbvalue,xmlGetText(HXML(node))); - end; end; end; @@ -445,10 +391,7 @@ begin StrCopy(pc,opt_value); DBWriteUnicode(0,DBBranch,section,dbvalue); end; end; -{ - 1: begin - end; -} + 13: begin end; end; diff --git a/plugins/Actman/iac_global.pas b/plugins/Actman/iac_global.pas index aa5b9bb87c..57ff40e383 100644 --- a/plugins/Actman/iac_global.pas +++ b/plugins/Actman/iac_global.pas @@ -62,7 +62,7 @@ type constructor Create(uid:dword); destructor Destroy; override; -// function Clone:tBaseAction; virtual; + function DoAction(var WorkData:tWorkData):LRESULT; virtual; // process action procedure Load(node:pointer;fmt:integer); virtual; // load/import action procedure Save(node:pointer;fmt:integer); virtual; // save/export action @@ -99,7 +99,6 @@ function GetLinkName (hash:dword ):PAnsiChar; function GetLink (hash:dword ):pActModule; function GetLinkByName(name:pAnsiChar):pActModule; -function ImportContact (node:HXML ):TMCONTACT; function ImportContactINI(node:pointer):TMCONTACT; @@ -143,13 +142,7 @@ begin dst.UID :=UID; dst.flags:=flags; end; -{ -function tBaseAction.Clone:tBaseAction; -begin - //dummy - result:=nil; -end; -} + function tBaseAction.DoAction(var WorkData:tWorkData):LRESULT; begin result:=0; @@ -170,13 +163,6 @@ begin StrCopy(pc,opt_flags); flags :=DBReadDword (0,DBBranch,section); // UID reading in main program, set by constructor end; - - 1: begin - if StrToInt(xmlGetAttrValue(HXML(node),ioDisabled))=1 then - flags:=flags or ACF_DISABLED; - - StrDupW(ActionDescr,xmlGetAttrValue(HXML(node),ioName)); - end; end; end; @@ -192,10 +178,7 @@ begin StrCopy(pc,opt_flags); DBWriteDWord (0,DBBranch,section,flags); StrCopy(pc,opt_descr); DBWriteUnicode(0,DBBranch,section,ActionDescr); end; -{ - 1: begin - end; -} + 13: begin tTextExport(node).AddText ('type' ,GetLinkName(UID)); tTextExport(node).AddTextW('name' ,ActionDescr); @@ -312,54 +295,6 @@ const ioCUID = 'cuid'; ioCUIDType = 'cuidtype'; -function ImportContact(node:HXML):TMCONTACT; -var - proto:pAnsiChar; - tmpbuf:array [0..63] of AnsiChar; - dbv:TDBVARIANT; - tmp:pWideChar; - is_chat:boolean; - bufLen:int; -begin - proto:=FastWideToAnsiBuf(xmlGetAttrValue(node,ioCProto),tmpbuf); - if (proto=nil) or (proto^=#0) then - begin - result:=0; - exit; - end; - is_chat:=StrToInt(xmlGetAttrValue(node,ioIsChat))<>0; - - tmp:=xmlGetAttrValue(node,ioCUID); - if is_chat then - begin - dbv.szVal.W:=tmp; - end - else - begin - FillChar(dbv,SizeOf(TDBVARIANT),0); - dbv._type:=StrToInt(xmlGetAttrValue(node,ioCUIDType)); - case dbv._type of - DBVT_BYTE : dbv.bVal:=StrToInt(tmp); - DBVT_WORD : dbv.wVal:=StrToInt(tmp); - DBVT_DWORD : dbv.dVal:=StrToInt(tmp); - DBVT_ASCIIZ: FastWideToAnsi(tmp,dbv.szVal.A); - DBVT_UTF8 : WideToUTF8(tmp,dbv.szVal.A); - DBVT_WCHAR : dbv.szVal.W:=tmp; - DBVT_BLOB : begin - dbv.pbVal := mir_base64_decode(FastWideToAnsi(tmp,pAnsiChar(dbv.pbVal)),bufLen); - dbv.cpbVal := bufLen; - end; - end; - end; - result:=FindContactHandle(proto,dbv,is_chat); - if not is_chat then - case dbv._type of - DBVT_ASCIIZ, - DBVT_UTF8 : mFreeMem(dbv.szVal.A); - DBVT_BLOB : mFreeMem(dbv.pbVal); - end; -end; - function ImportContactINI(node:pointer):TMCONTACT; { var diff --git a/plugins/Actman/iac_ini.pas b/plugins/Actman/iac_ini.pas index 03c8d7a9d6..fa417c14dd 100644 --- a/plugins/Actman/iac_ini.pas +++ b/plugins/Actman/iac_ini.pas @@ -38,7 +38,7 @@ type public constructor Create(uid:dword); destructor Destroy; override; -// function Clone:tBaseAction; override; + function DoAction(var WorkData:tWorkData):LRESULT; override; procedure Save(node:pointer;fmt:integer); override; procedure Load(node:pointer;fmt:integer); override; @@ -62,14 +62,7 @@ begin inherited Destroy; end; -{ -function tINIAction.Clone:tBaseAction; -begin - result:=tServiceAction.Create(0); - Duplicate(result); -end; -} function tINIAction.DoAction(var WorkData:tWorkData):LRESULT; var linifile, diff --git a/plugins/Actman/iac_inout.pas b/plugins/Actman/iac_inout.pas index dc048411cc..d6abe6085b 100644 --- a/plugins/Actman/iac_inout.pas +++ b/plugins/Actman/iac_inout.pas @@ -52,7 +52,7 @@ type public constructor Create(uid:dword); destructor Destroy; override; -// function Clone:tBaseAction; override; + function DoAction(var WorkData:tWorkData):LRESULT; override; procedure Save(node:pointer;fmt:integer); override; procedure Load(node:pointer;fmt:integer); override; @@ -75,14 +75,7 @@ begin inherited Destroy; end; -{ -function tInOutAction.Clone:tBaseAction; -begin - result:=.Create(0); - Duplicate(result); -end; -} function tInOutAction.DoAction(var WorkData:tWorkData):LRESULT; var tmp:PWideChar; @@ -329,74 +322,6 @@ begin if (flags2 and ACF2_TXT_FILE)<>0 then flags:=flags or ACF_FILE_PATH; end; - - 1: begin - tmp:=xmlGetAttrValue(HXML(node),ioObject); - if lstrcmpiw(tmp,ioClipboard)=0 then - begin - flags:=flags or ACF_CLIPBRD; - tmp:=xmlGetAttrValue(HXML(node),ioOper); - if lstrcmpiw(tmp,ioCopy)=0 then flags:=flags or ACF_COPYTO; - end - else - begin - if lstrcmpiw(tmp,ioFile)=0 then - begin - - if StrToInt(xmlGetAttrValue(HXML(node),ioFileVariable))=1 then - flags:=flags or ACF_FILE_PATH; - - flags:=flags or ACF_FILE; - StrDupW(tfile,xmlGetAttrValue(HXML(node),ioFile)); - tmp:=xmlGetAttrValue(HXML(node),ioOper); - if lstrcmpiw(tmp,ioWrite )=0 then flags:=flags or ACF_FWRITE - else if lstrcmpiw(tmp,ioAppend)=0 then flags:=flags or ACF_FAPPEND; - case StrToInt(xmlGetAttrValue(HXML(node),ioEnc)) of - 0: flags:=flags or ACF_ANSI; - 1: flags:=flags or ACF_UTF8; - 2: flags:=flags or ACF_UTF8 or ACF_SIGN; - 3: flags:=flags or 0; - 4: flags:=flags or ACF_SIGN; - end; - end; - end; - end; -{ - 2: begin - pc:=GetParamSectionStr(node,ioObject); - if lstrcmpi(tmp,ioClipboard)=0 then - begin - flags:=flags or ACF_CLIPBRD; - pc:=GetParamSectionStr(node,ioOper); - if lstrcmpi(pc,ioCopy)=0 then flags:=flags or ACF_COPYTO; -// else if lstrcmpi(pc,'paste')=0 then ; - end - else - begin - if lstrcmpi(pc,ioFile)=0 then - begin - flags:=flags or ACF_FILE; - - if GetParamSectionInt(node,ioFileVariable))=1 then - flags:=flags or ACF_FILE_PATH; - - UTF8ToWide(GetParamSectionStr(node,ioFile),tfile); - - pc:=GetParamSectionStr(node,ioOper); - if lstrcmpi(pc,ioWrite )=0 then flags:=flags or ACF_FWRITE - else if lstrcmpi(pc,ioAppend)=0 then flags:=flags or ACF_FAPPEND; - - case GetParamSectionInt(node,ioEnc)) of - 0: flags:=flags or ACF_ANSI; - 1: flags:=flags or ACF_UTF8; - 2: flags:=flags or ACF_UTF8 or ACF_SIGN; - 3: flags:=flags or 0; - 4: flags:=flags or ACF_SIGN; - end; - end; - end; - end; -} end; end; diff --git a/plugins/Actman/iac_jump.pas b/plugins/Actman/iac_jump.pas index 8e2bba787c..53268ea5e3 100644 --- a/plugins/Actman/iac_jump.pas +++ b/plugins/Actman/iac_jump.pas @@ -68,7 +68,7 @@ type public constructor Create(uid:dword); destructor Destroy; override; -// function Clone:tBaseAction; override; + function DoAction(var WorkData:tWorkData):LRESULT; override; procedure Save(node:pointer;fmt:integer); override; procedure Load(node:pointer;fmt:integer); override; @@ -94,17 +94,7 @@ begin inherited Destroy; end; -{ -function tJumpAction.Clone:tBaseAction; -begin - result:=tJumpAction.Create(0); - Duplicate(result); - result.condition:=condition; - StrDupW(result.value,value); - StrDupW(result.actlabel,actlabel); -end; -} function tJumpAction.DoAction(var WorkData:tWorkData):LRESULT; var tmpint:int64; @@ -229,7 +219,6 @@ var buf:array [0..31] of WideChar; pc:pAnsiChar; tmp:pWideChar; - sub:HXML; oper,cond:byte; begin inherited Load(node,fmt); @@ -291,56 +280,6 @@ begin end; end; end; - - 1: begin - sub:=xmlGetNthChild(HXML(node),ioIf,0); - if sub<>0 then - begin - tmp:=xmlGetAttrValue(sub,ioOper); - if lstrcmpiw(tmp,'math')=0 then flags:=flags or ACF_MATH - else if lstrcmpiw(tmp,ioNop )=0 then flags:=flags or ACF_NOP; - - tmp:=xmlGetAttrValue(sub,ioCond); - if lstrcmpiw(tmp,ioNop)=0 then flags:=flags or ACF_NOP // compatibility - else if (flags and ACF_NOP)=0 then - begin - if flags and ACF_MATH<>0 then - begin - if lstrcmpiw(tmp,'gt' )=0 then condition:=aeGT - else if lstrcmpiw(tmp,'lt' )=0 then condition:=aeLT - else if lstrcmpiw(tmp,'eq' )=0 then condition:=aeEQ - else if lstrcmpiw(tmp,'xor')=0 then condition:=aeXR - else if lstrcmpiw(tmp,'and')=0 then condition:=aeND; - end - else - begin - if lstrcmpiw(tmp,'empty')=0 then condition:=aeEMP - else if lstrcmpiw(tmp,'eq' )=0 then condition:=aeEQU - else if lstrcmpiw(tmp,'cont' )=0 then condition:=aeCON - else if lstrcmpiw(tmp,'start')=0 then condition:=aeSTR - else if lstrcmpiw(tmp,'ends' )=0 then condition:=aeEND; - - if StrToInt(xmlGetAttrValue(sub,ioCase))=1 then - flags:=flags or ACF_CASE; - if StrToInt(xmlGetAttrValue(sub,ioBack))=1 then - flags:=flags or ACF_BACK; - end; - if StrToInt(xmlGetAttrValue(sub,ioNot))=1 then - flags:=flags or ACF_NOT; - - if ((flags and ACF_MATH)<>0) or (condition<>aeEMP) then - StrDupW(value,xmlGetAttrValue(sub,ioValue)); - end; - end; - - sub:=xmlGetNthChild(HXML(node),ioPost,0); - if sub<>0 then - begin - tmp:=xmlGetAttrValue(sub,ioOper); - if lstrcmpiw(tmp,ioBreak)=0 then flags:=flags or ACF_BREAK - else if lstrcmpiw(tmp,ioJump )=0 then StrDupW(actlabel,xmlGetAttrValue(sub,ioValue)); - end; - end; end; end; @@ -363,21 +302,6 @@ begin StrCopy(pc,opt_label); DBWriteUnicode(0,DBBranch,section,actlabel); end; end; -{ - 1: begin - end; -} - 13: begin -{ - ACF_NOP = $00000001; - ACF_MATH = $00000002; - ACF_NOT = $00000004; - ACF_CASE = $00000008; - ACF_BREAK = $00000010; - ACF_BACK = $00000020; - ACF_VALUE = $00000100; -} - end; end; end; diff --git a/plugins/Actman/iac_messagebox.pas b/plugins/Actman/iac_messagebox.pas index 78320e1cd5..54adf70879 100644 --- a/plugins/Actman/iac_messagebox.pas +++ b/plugins/Actman/iac_messagebox.pas @@ -36,7 +36,7 @@ type public constructor Create(uid:dword); destructor Destroy; override; -// function Clone:tBaseAction; override; + function DoAction(var WorkData:tWorkData):LRESULT; override; procedure Save(node:pointer;fmt:integer); override; procedure Load(node:pointer;fmt:integer); override; @@ -60,17 +60,7 @@ begin inherited Destroy; end; -{ -function tMessageAction.Clone:tBaseAction; -begin - result:=tMessageAction.Create(0); - Duplicate(result); - StrDupW(tMessageAction(result).msgtext ,msgtext); - StrDupW(tMessageAction(result).msgtitle,msgtitle); - tMessageAction(result).boxopts:=boxopts; -end; -} function tMessageAction.DoAction(var WorkData:tWorkData):LRESULT; var i:integer; @@ -145,15 +135,6 @@ begin StrCopy(pc,opt_msgtext ); msgtext :=DBReadUnicode(0,DBBranch,section); StrCopy(pc,opt_boxopts ); boxopts :=DBReadDword (0,DBBranch,section); // v2 = byte end; - - 1: begin - StrDupW(msgtitle,xmlGetAttrValue(HXML(node),ioTitle)); - StrDupW(msgtext,xmlGetText(HXML(node))); - boxopts:=StrToInt(xmlGetAttrValue(HXML(node),ioType)); - - if StrToInt(xmlGetAttrValue(HXML(node),ioArgVariable))=1 then flags:=flags or ACF_MSG_TXT; - if StrToInt(xmlGetAttrValue(HXML(node),ioVariables ))=1 then flags:=flags or ACF_MSG_TTL; - end; end; end; @@ -170,10 +151,7 @@ begin StrCopy(pc,opt_msgtext ); DBWriteUnicode(0,DBBranch,section,msgtext); StrCopy(pc,opt_boxopts ); DBWriteDWord (0,DBBranch,section,boxopts); end; -{ - 1: begin - end; -} + 13: begin end; end; diff --git a/plugins/Actman/iac_notes.pas b/plugins/Actman/iac_notes.pas index 182e1aba9e..85c29fe802 100644 --- a/plugins/Actman/iac_notes.pas +++ b/plugins/Actman/iac_notes.pas @@ -23,7 +23,7 @@ type public constructor Create(uid:dword); destructor Destroy; override; -// function Clone:tBaseAction; override; + function DoAction(var WorkData:tWorkData):LRESULT; override; procedure Save(node:pointer;fmt:integer); override; procedure Load(node:pointer;fmt:integer); override; diff --git a/plugins/Actman/iac_program.pas b/plugins/Actman/iac_program.pas index b62e774da2..0f7ad393e9 100644 --- a/plugins/Actman/iac_program.pas +++ b/plugins/Actman/iac_program.pas @@ -52,7 +52,7 @@ type public constructor Create(uid:dword); destructor Destroy; override; -// function Clone:tBaseAction; override; + function DoAction(var WorkData:tWorkData):LRESULT; override; procedure Save(node:pointer;fmt:integer); override; procedure Load(node:pointer;fmt:integer); override; @@ -98,18 +98,7 @@ begin inherited Destroy; end; -{ -function tProgramAction.Clone:tBaseAction; -begin - result:=tProgramAction.Create(0); - Duplicate(result); - tProgramAction(result).show :=show; - tProgramAction(result).time :=time; - StrDupW(tProgramAction(result).prgname,prgname); - StrDupW(tProgramAction(result).args ,args); -end; -} function tProgramAction.DoAction(var WorkData:tWorkData):LRESULT; var tmp,tmpp,lpath:PWideChar; @@ -242,55 +231,6 @@ begin if (flags2 and ACF2_PRG_PRG)<>0 then flags:=flags or ACF_PRG_PRG; if (flags2 and ACF2_PRG_ARG)<>0 then flags:=flags or ACF_PRG_ARG; end; - - 1: begin - StrDupW(prgname,xmlGetText(HXML(node))); - StrDupW(args,xmlGetAttrValue(HXML(node),ioArgs)); - if StrToInt(xmlGetAttrValue(HXML(node),ioCurrent))=1 then - flags:=flags or ACF_CURPATH; - - if StrToInt(xmlGetAttrValue(HXML(node),ioParallel))=1 then - flags:=flags or ACF_PRTHREAD - else - time:=StrToInt(xmlGetAttrValue(HXML(node),ioWait)); - - if StrToInt(xmlGetAttrValue(HXML(node),ioFileVariable))=1 then - flags:=flags or ACF_PRG_PRG; - - if StrToInt(xmlGetAttrValue(HXML(node),ioArgVariable))=1 then - flags:=flags or ACF_PRG_ARG; - - tmp:=xmlGetAttrValue(HXML(node),ioWindow); - if lstrcmpiw(tmp,ioHidden )=0 then show:=SW_HIDE - else if lstrcmpiw(tmp,ioMinimized)=0 then show:=SW_SHOWMINIMIZED - else if lstrcmpiw(tmp,ioMaximized)=0 then show:=SW_SHOWMAXIMIZED - else show:=SW_SHOWNORMAL; - end; -{ - 2: begin - UTF8ToWide(GetParamSectionStr(node,ioProgram),prgname); - UTF8ToWide(GetParamSectionStr(node,ioArgs ),args); - if GetParamSectionInt(node,ioCurrent)=1 then - flags:=flags or ACF_CURPATH; - - if GetParamSectionInt(node,ioParallel)=1 then - flags:=flags or ACF_PRTHREAD - else - time:=GetParamSectionInt(node,ioWait); - - if GetParamSectionInt(node,ioFileVariable)=1 then - flags:=flags or ACF_PRG_PRG; - - if GetParamSectionInt(node,ioArgVariable)=1 then - flags:=flags or ACF_PRG_ARG; - - pc:=GetParamSectionStr(node,ioWindow); - if lstrcmpi(pc,ioHidden )=0 then show:=SW_HIDE - else if lstrcmpi(pc,ioMinimized)=0 then show:=SW_SHOWMINIMIZED - else if lstrcmpi(pc,ioMaximized)=0 then show:=SW_SHOWMAXIMIZED - else show:=SW_SHOWNORMAL; - end; -} end; end; diff --git a/plugins/Actman/iac_service.pas b/plugins/Actman/iac_service.pas index 1868b89214..fd4a8e8e07 100644 --- a/plugins/Actman/iac_service.pas +++ b/plugins/Actman/iac_service.pas @@ -73,7 +73,7 @@ type public constructor Create(uid:dword); destructor Destroy; override; -// function Clone:tBaseAction; override; + function DoAction(var WorkData:tWorkData):LRESULT; override; procedure Save(node:pointer;fmt:integer); override; procedure Load(node:pointer;fmt:integer); override; @@ -94,30 +94,6 @@ begin inherited Destroy; end; -{ -function tServiceAction.Clone:tBaseAction; -begin - result:=tServiceAction.Create(0); - Duplicate(result); - - tServiceAction(result).flags2 :=flags2; - StrDup(tServiceAction(result).service,service); - - if (flags and (ACF_NUMBER or ACF_RESULT or ACF_PARAM))=0 then - StrDup(pAnsiChar(tServiceAction(result).wparam),pAnsiChar(wparam)) - else if ((flags and ACF_NUMBER)<>0) and ((flags and ACF_SCRIPT_PARAM)<>0) then - StrDup(pAnsiChar(tServiceAction(result).wparam),pAnsiChar(wparam)) - else - tServiceAction(result).wparam:=wparam; - - if (flags2 and (ACF_NUMBER or ACF_RESULT or ACF_PARAM))=0 then - StrDup(pAnsiChar(tServiceAction(result).lparam),pAnsiChar(lparam)) - else if ((flags2 and ACF_NUMBER)<>0) and ((flags and ACF_SCRIPT_PARAM)<>0) then - StrDup(pAnsiChar(tServiceAction(result).lparam),pAnsiChar(lparam)) - else - tServiceAction(result).lparam:=lparam; -end; -} function tServiceAction.DoAction(var WorkData:tWorkData):LRESULT; var @@ -167,64 +143,11 @@ begin end; end; -function ReadParam(act:HXML; var param:pWideChar;isvar:boolean):dword; -var - tmp:pWideChar; -begin - result:=ACF_TYPE_NUMBER; - if act=0 then - exit; - - tmp:=xmlGetAttrValue(act,ioType); - if lstrcmpiw(tmp,ioCurrent)=0 then result:=ACF_TYPE_CURRENT - else if lstrcmpiw(tmp,ioResult )=0 then result:=ACF_TYPE_RESULT - else if lstrcmpiw(tmp,ioParam )=0 then result:=ACF_TYPE_PARAM - else if lstrcmpiw(tmp,ioStruct )=0 then - begin - result:=ACF_TYPE_STRUCT; - end - else - begin - StrDupW(pWideChar(param),xmlGetAttrValue(act,ioValue)); - - if lstrcmpiw(tmp,ioNumber )=0 then result:=ACF_TYPE_NUMBER - else if lstrcmpiw(tmp,ioUnicode)=0 then result:=ACF_TYPE_UNICODE - else if lstrcmpiw(tmp,ioAnsi )=0 then result:=ACF_TYPE_STRING; - end; -end; -{ -function ReadParamINI(node:pointer;prefix:pAnsiChar;var param:pWideChar;isvar:boolean):dword; -var - pc,pc1:pAnsiChar; - buf:array [0..63] of AnsiChar; -begin - result:=0; - pc1:=StrCopyE(buf,prefix); - pc:=GetParamSectionStr(node,StrCopy(pc1,ioType)); - if lstrcmpi(pc,ioCurrent)=0 then result:=result or ACF_CURRENT - else if lstrcmpi(pc,ioResult )=0 then result:=result or ACF_RESULT - else if lstrcmpi(pc,ioParam )=0 then result:=result or ACF_PARAM - else if lstrcmpi(pc,ioStruct )=0 then - begin - result:=result or ACF_STRUCT; -//!!!! param:=ReadStruct(act); - end - else - begin - UTF8ToWide(GetParamSectionInt(node,StrCopy(pc1,ioValue)),param); - - if lstrcmpi(pc,ioNumber )=0 then result:=result or ACF_NUMBER - else if lstrcmpi(pc,ioUnicode)=0 then result:=result or ACF_UNICODE; -// else if lstrcmpi(pc,ioAnsi)=0 then; - end; -end; -} procedure tServiceAction.Load(node:pointer;fmt:integer); var section:array [0..127] of AnsiChar; buf:array [0..31] of WideChar; pc:pAnsiChar; - sub:HXML; tmp:pWideChar; lflags,lflags2:dword; begin @@ -320,38 +243,6 @@ begin if (lflags2 and ACF2_FREEMEM )<>0 then service.flags:=service.flags or ACF_FLAG_FREEMEM; if (lflags2 and ACF2_SRV_SRVC)<>0 then service.flags:=service.flags or ACF_FLAG_SCRIPT; end; - - 1: begin - service.flags :=0; - service.w_flags:=0; - service.l_flags:=0; - - FastWideToAnsi(xmlGetAttrValue(HXML(node),ioService),service.service); - if StrToInt(xmlGetAttrValue(HXML(node),ioVariables))=1 then - service.flags:=service.flags or ACF_FLAG_SCRIPT; - - sub:=xmlGetNthChild(HXML(node),ioWParam,0); - if StrToInt(xmlGetAttrValue(sub,ioVariables))=1 then - service.w_flags:=service.w_flags or ACF_FLAG_SCRIPT; - service.w_flags:=service.w_flags or - ReadParam(sub,PWideChar(service.wparam),(service.w_flags and ACF_FLAG_SCRIPT)<>0); - - sub:=xmlGetNthChild(HXML(node),ioLParam,0); - if StrToInt(xmlGetAttrValue(sub,ioVariables))=1 then - service.l_flags:=service.l_flags or ACF_FLAG_SCRIPT; - service.l_flags:=service.l_flags or - ReadParam(sub,PWideChar(service.lparam),(service.l_flags and ACF_FLAG_SCRIPT)<>0); - - sub:=xmlGetNthChild(HXML(node),ioOutput,0); - if StrToInt(xmlGetAttrValue(sub,ioFree))=1 then - service.flags:=service.flags or ACF_FLAG_FREEMEM; - - tmp:=xmlGetAttrValue(sub,ioType); - if lstrcmpiw(tmp,ioUnicode)=0 then service.flags:=service.flags or ACF_TYPE_UNICODE - else if lstrcmpiw(tmp,ioAnsi )=0 then service.flags:=service.flags or ACF_TYPE_STRING - else if lstrcmpiw(tmp,ioStruct )=0 then service.flags:=service.flags or ACF_TYPE_STRUCT - else if lstrcmpiw(tmp,ioInt )=0 then service.flags:=service.flags or ACF_TYPE_NUMBER; - end; end; end; @@ -369,10 +260,7 @@ begin StrCopy(pc,opt_service); SaveServiceValue(service,DBBranch,section); end; -{ - 1: begin - end; -} + 13: begin end; end; diff --git a/plugins/Actman/iac_storage.pas b/plugins/Actman/iac_storage.pas index 186e88240a..55111c2daf 100644 --- a/plugins/Actman/iac_storage.pas +++ b/plugins/Actman/iac_storage.pas @@ -28,7 +28,6 @@ type public constructor Create(uid:dword); destructor Destroy; override; -// function Clone:tBaseAction; override; function DoAction(var WorkData:tWorkData):LRESULT; override; procedure Save(node:pointer;fmt:integer); override; procedure Load(node:pointer;fmt:integer); override; @@ -50,14 +49,7 @@ begin inherited Destroy; end; -{ -function tStorageAction.Clone:tBaseAction; -begin - result:=.Create(0); - Duplicate(result); -end; -} function tStorageAction.DoAction(var WorkData:tWorkData):LRESULT; var num:integer; @@ -153,12 +145,6 @@ begin pc:=StrCopyE(section,pAnsiChar(node)); StrCopy(pc,opt_number); Number:=DBReadByte(0,DBBranch,section,0); end; - - 1: begin - if lstrcmpiw(xmlGetAttrValue(HXML(node),ioOper),ioCopy)=1 then - flags:=flags or ACF_COPYFROM; - Number:=StrToInt(xmlGetAttrValue(HXML(node),ioNumber)); - end; end; end; @@ -173,10 +159,7 @@ begin pc:=StrCopyE(section,pAnsiChar(node)); StrCopy(pc,opt_number); DBWriteByte(0,DBBranch,section,Number); end; -{ - 1: begin - end; -} + 13: begin tTextExport(node).AddDWord('slot',Number); tTextExport(node).AddFlag ('copy',(flags or ACF_COPYFROM)<>0); diff --git a/plugins/Actman/iac_text.pas b/plugins/Actman/iac_text.pas index 8614d6430e..ee7830d39b 100644 --- a/plugins/Actman/iac_text.pas +++ b/plugins/Actman/iac_text.pas @@ -36,7 +36,7 @@ type public constructor Create(uid:dword); destructor Destroy; override; -// function Clone:tBaseAction; override; + function DoAction(var WorkData:tWorkData):LRESULT; override; procedure Save(node:pointer;fmt:integer); override; procedure Load(node:pointer;fmt:integer); override; @@ -59,14 +59,7 @@ begin inherited Destroy; end; -{ -function tTextAction.Clone:tBaseAction; -begin - result:=.Create(0); - Duplicate(result); -end; -} type trec = record text:PAnsiChar; @@ -359,14 +352,6 @@ begin StrCopy(pc,'varval'); text:=DBReadUnicode(0,DBBranch,section); flags:=flags or ACF_TEXTSCRIPT; end; - - 1: begin - StrDupW(text,xmlGetText(HXML(node))); - if StrToInt(xmlGetAttrValue(HXML(node),ioVariables))=1 then - flags:=flags or ACF_TEXTSCRIPT; - if StrToInt(xmlGetAttrValue(HXML(node),ioPost))=1 then - flags:=flags or ACF_POSTPROCESS; - end; end; end; @@ -382,10 +367,7 @@ begin StrCopy(pc,opt_text); DBWriteUnicode(0,DBBranch,section,text); end; -{ - 1: begin - end; -} + 13: begin tTextExport(node).AddTextW('text' ,text); tTextExport(node).AddFlag ('script' ,(flags or ACF_TEXTSCRIPT )<>0); diff --git a/plugins/Actman/inoutxml.pas b/plugins/Actman/inoutxml.pas deleted file mode 100644 index bcf91222bf..0000000000 --- a/plugins/Actman/inoutxml.pas +++ /dev/null @@ -1,145 +0,0 @@ -unit inoutxml; - -interface - -uses windows, lowlevelc; - -function Import(list:tMacroList;fname:PWideChar;aflags:dword):integer; - -implementation - -uses - io, common, m_api, question, - iac_global, global; - -const - ioAction = 'Action'; - ioClass = 'class'; - ioName = 'name'; - ioVolatile = 'volatile'; -const - imp_yes = 1; - imp_yesall = 2; - imp_no = 3; - imp_noall = 4; - imp_append = 5; - -function ImportAction(actnode:HXML):tBaseAction; -var - pa:pActModule; - buf:array [0..127] of AnsiChar; -begin - result:=nil; - if actnode=0 then exit; - pa:=GetLinkByName(FastWideToAnsiBuf(xmlGetAttrValue(actnode,ioClass),buf)); - if pa<>nil then - begin - result:=pa.Create; - result.Load(pointer(actnode),1); - end - else - result:=tBaseAction(1); -end; - -function Import(list:tMacroList;fname:PWideChar;aflags:dword):integer; -var - f:THANDLE; - i,nodenum,actcnt:integer; - tmp,res:pWideChar; - root,actnode:HXML; - impact:integer; - buf:array [0..511] of WideChar; - oldid:dword; - arr:array [0..63] of tBaseAction; - act:tBaseAction; - p:pMacroRecord; -begin - result:=0; - - for i:=0 to list.Count-1 do - with list[i]^ do - if (flags and (ACF_IMPORT or ACF_ASSIGNED))= - (ACF_IMPORT or ACF_ASSIGNED) then - flags:=flags and not (ACF_IMPORT or ACF_OVERLOAD); - - if (fname=nil) or (fname^=#0) then - exit; - 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:=xmlParseString(ChangeUnicode(res),@i,nil); - nodenum:=0; - impact:=imp_yes; - repeat - actnode:=xmlGetNthChild(root,ioAction,nodenum); - if actnode=0 then break; - tmp:=xmlGetAttrValue(actnode,ioName); - if tmp<>nil then //!! - begin - p:=list.GetMacro(tmp); - oldid:=$FFFFFFFF; - if p<>nil then - begin - if (impact<>imp_yesall) and (impact<>imp_noall) then - begin - StrCopyW(buf,TranslateW('Action "$" exists, do you want to rewrite it?')); - impact:=ShowQuestion(StrReplaceW(buf,'$',tmp)); - end; - if (impact=imp_yesall) or (impact=imp_yes) then - begin - oldid:=p^.id; - FreeMacro(p); - end; - end; - // if new or overwriting then read macro details/actions - if (p=nil) or (impact=imp_yesall) or (impact=imp_yes) or (impact=imp_append) then - begin - with List[list.NewMacro()]^ do - begin - if (p<>nil) and (oldid<>$FFFFFFFF) then // set old id to keep UseAction setting - begin - flags:=flags or ACF_IMPORT or ACF_OVERLOAD; - id:=oldid; - end - else - flags:=flags or ACF_IMPORT; - if StrToInt(xmlGetAttrValue(actnode,ioVolatile))=1 then flags:=flags or ACF_VOLATILE; - StrCopyW(descr,tmp,MacroNameLen-1); - - // reading actions - actcnt:=0; // count in file - ActionCount:=0; // amount of loaded - repeat - act:=ImportAction(xmlGetChild(actnode,actcnt)); - if act=nil then - break; - if uint_ptr(act)<>1 then - begin - arr[ActionCount]:=act; - inc(ActionCount); - end; - inc(actcnt); - until false; - // moving actions to their place - if Actioncount>0 then - begin - GetMem(ActionList,SizeOf(tBaseAction)*ActionCount); - move(arr,ActionList^,SizeOf(tBaseAction)*ActionCount); - end; - inc(result); - end; - end; - end; - inc(nodenum); - until false; - xmlDestroyNode(root); - mFreeMem(res); -end; - -end. diff --git a/plugins/Actman/ua/i_inoutjson.inc b/plugins/Actman/ua/i_inoutjson.inc index 95f793e9f2..e06474c5e3 100644 --- a/plugins/Actman/ua/i_inoutjson.inc +++ b/plugins/Actman/ua/i_inoutjson.inc @@ -194,7 +194,7 @@ end; //-------------------------- -function ExportMenuItems(node:JSONNODE;MenuItem:tUAMenuItem):HXML; +function ExportMenuItems(node:JSONNODE;MenuItem:tUAMenuItem):JSONNODE; begin with jsonparser do begin diff --git a/plugins/Actman/ua/i_inoutxm.inc b/plugins/Actman/ua/i_inoutxm.inc deleted file mode 100644 index 4a539a8275..0000000000 --- a/plugins/Actman/ua/i_inoutxm.inc +++ /dev/null @@ -1,334 +0,0 @@ -{} - -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:HXML;var MenuItem:tUAMenuItem):integer; -begin - result:=0; - - with MenuItem do - begin - menu_opt:=0; - // popup - StrDupW(szMenuPopup,xmlGetAttrValue(node,ioMenuPopup)); - // name - StrDupW(szMenuNameVars,xmlGetAttrValue(node,ioMenuName)); - // show - StrDupW(szMenuShowWhenVars,xmlGetAttrValue(node,ioMenuShow)); - // used - if StrToInt(xmlGetAttrValue(node,ioMenuUsed))<>0 then - menu_opt:=menu_opt or UAF_MENUUSE; - // separated - if StrToInt(xmlGetAttrValue(node,ioMenuSeparated))<>0 then - menu_opt:=menu_opt or UAF_MENUSEP; - // no translate - if StrToInt(xmlGetAttrValue(node,ioNoTranslate))<>0 then - menu_opt:=menu_opt or UAF_NOTRANS; - end; -end; - -function ImportUAction(actnode:HXML;var UA:tMyActionItem):integer; -var - num,i:integer; - sub:HXML; -begin - result:=0; - if actnode=0 then exit; - - UA.flags:=0; - // ----- Common ----- - if StrToInt(xmlGetAttrValue(actnode,ioTwoState))<>0 then - UA.flags:=UA.flags or UAF_2STATE; - - if StrToInt(xmlGetAttrValue(actnode,ioSaveState))<>0 then - UA.flags:=UA.flags or UAF_SAVESTATE; - - if StrToInt(xmlGetAttrValue(actnode,ioHotkey))<>0 then - UA.flags:=UA.flags or UAF_REGHOTKEY; - if StrToInt(xmlGetAttrValue(actnode,ioToolbar))<>0 then - UA.flags:=UA.flags or UAF_REGTTBB; - if StrToInt(xmlGetAttrValue(actnode,ioTabSRMM))<>0 then - UA.flags:=UA.flags or UAF_REGTABB; - - // ----- Hotkey ----- - // nothing - - // ----- Modern CList toolbar ----- - // source - ANSI text - sub:=xmlGetNthChild(actnode,ioToolbar,0); - WideToAnsi(xmlGetAttrValue(sub,ioTooltip ),UA.szTTBTooltip ,MirandaCP); - WideToAnsi(xmlGetAttrValue(sub,ioTooltipPressed),UA.szTTBTooltipPressed,MirandaCP); - - // ----- TabSRMM toolbar ----- - sub:=xmlGetNthChild(actnode,ioTabSRMM,0); - StrDupW(UA.szTabBTooltip ,xmlGetAttrValue(sub,ioTooltip)); - StrDupW(UA.szTabBTooltipPressed,xmlGetAttrValue(sub,ioTooltipPressed)); - - // ----- Menus ----- - num:=0; - repeat - sub:=xmlGetNextChild(actnode,ioMenuItem,@num); - if sub=0 then break; - - i:=StrToInt(xmlGetAttrValue(sub,ioType)); - ImportMenuItems(sub,UA.UAMenuItem[tMenuType(i)]); - until false; -end; - -function Import(fname:PWideChar;aflags:dword):integer; -var - i,j,act:integer; - root,actnode:HXML; - 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); - - root:=xmlParseString(ChangeUnicode(res),@i,nil); - j:=0; - repeat - actnode:=xmlGetNthChild(root,ioAction,j); - if actnode=0 then break; - // search id by name? - pcw:=xmlGetAttrValue(actnode,ioName); - ptr:=ptr1; - inc(pbyte(ptr),4); - for i:=0 to num-1 do - begin - 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 ACF_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(xmlGetNthChild(actnode,ioUA,0),UActionList[num1]); - break; - end; - end; - inc(ptr); - end; - - inc(j); - until false; - xmlDestroyNode(root); - - 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:HXML;const MenuItem:tUAMenuItem):HXML; -begin - result:=xmlAddChild(node,ioMenuItem,nil); - with MenuItem do - begin - // popup - if (szMenuPopup<>nil) and (szMenuPopup^<>#0) then - xmlAddAttr(result,ioMenuPopup,szMenuPopup); - // name - if (szMenuNameVars<>nil) and (szMenuNameVars^<>#0) then - xmlAddAttr(result,ioMenuName,szMenuNameVars); - // show - if (szMenuShowWhenVars<>nil) and (szMenuShowWhenVars^<>#0) then - xmlAddAttr(result,ioMenuShow,szMenuShowWhenVars); - // used - xmlAddAttrInt(result,ioMenuUsed,ord((menu_opt AND UAF_MENUUSE)<>0)); - // separated - xmlAddAttrInt(result,ioMenuSeparated,ord((menu_opt AND UAF_MENUSEP)<>0)); - // no translate - xmlAddAttrInt(result,ioNoTranslate,ord((menu_opt AND UAF_NOTRANS)<>0)); - end; -end; - -procedure WriteUAction(root:HXML;id:dword;name:pWideChar); -var - i:integer; - lmenu:tMenuType; - pc:pWideChar; - actnode,sub:HXML; - UA:pMyActionItem; -begin - for i:=0 to HIGH(UActionList) do - begin - if UActionList[i].dwActID=id then - begin - UA:=@UActionList[i]; - actnode:=xmlGetChildByAttrValue(root,ioAction,ioName,name); - if actnode=0 then break; - // we don't need that node as is, just it's child for UA - actnode:=xmlAddChild(actnode,ioUA,nil); - - // ----- Common ----- - xmlAddAttrInt(actnode,ioTwoState ,ORD((UA.flags and UAF_2STATE )<>0)); - xmlAddAttrInt(actnode,ioSaveState,ORD((UA.flags and UAF_SAVESTATE)<>0)); - - xmlAddAttrInt(actnode,ioHotkey ,ORD((UA.flags and UAF_REGHOTKEY)<>0)); - xmlAddAttrInt(actnode,ioToolbar,ORD((UA.flags and UAF_REGTTBB )<>0)); - xmlAddAttrInt(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:=xmlAddChild(actnode,ioToolbar,nil); - if (UA.szTTBTooltip<>nil) and (UA.szTTBTooltip^<>#0) then - begin - AnsiToWide(UA.szTTBTooltip,pc,MirandaCP); - xmlAddAttr(sub,ioTooltip,pc); - mFreeMem(pc); - end; - if (UA.szTTBTooltipPressed<>nil) and (UA.szTTBTooltipPressed^<>#0) then - begin - AnsiToWide(UA.szTTBTooltipPressed,pc,MirandaCP); - xmlAddAttr(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:=xmlAddChild(actnode,ioTabSRMM,nil); - if (UA.szTabBTooltip<>nil) and (UA.szTabBTooltip^<>#0) then - xmlAddAttr(sub,ioTooltip,UA.szTabBTooltip); - if (UA.szTabBTooltipPressed<>nil) and (UA.szTabBTooltipPressed^<>#0) then - xmlAddAttr(sub,ioTooltipPressed,UA.szTabBTooltipPressed); - end; - - // ----- Menus ----- - for lmenu:=main_menu to HIGH(tMenuType) do - begin - sub:=ExportMenuItems(actnode,UA.UAMenuItem[lmenu]); - xmlAddAttrInt(sub,ioType,ORD(lmenu)); - end; - - break; - end; - end; -end; - -function Export(fname:pWideChar;aflags:dword):integer; -var - i,num:integer; - f:THANDLE; - root:HXML; - res:pWideChar; - ptr,ptr1:pChain; -begin - result:=0; - - // 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:=xmlParseString(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:=xmlToString(root,@i); - - f:=Rewrite(fname); - BlockWrite(f,res^,i*SizeOf(WideChar)); - CloseHandle(f); - xmlFree(res); - xmlDestroyNode(root); - 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/ua.pas b/plugins/Actman/ua/ua.pas index da59fda540..7f3c9e1b61 100644 --- a/plugins/Actman/ua/ua.pas +++ b/plugins/Actman/ua/ua.pas @@ -43,7 +43,6 @@ var {$include i_options.inc} {$include i_opt_dlg.inc} {$include i_ua.inc} -{$include i_inoutxm.inc} // ------------ base interface functions ------------- @@ -78,8 +77,6 @@ begin HookEvent(ME_CLIST_PREBUILDMAINMENU , PreBuildMainMenu); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu); HookEvent(ME_CLIST_PREBUILDTRAYMENU , PreBuildTrayMenu); - - HookEvent(ME_ACT_INOUT,@ActInOut); end; procedure DeInit; diff --git a/plugins/Watrack/lastfm/i_last_api.inc b/plugins/Watrack/lastfm/i_last_api.inc index a5be3d3111..3d58bd27dd 100644 --- a/plugins/Watrack/lastfm/i_last_api.inc +++ b/plugins/Watrack/lastfm/i_last_api.inc @@ -265,318 +265,3 @@ begin else StrDupW(result,Info); end; - -function GetArtistInfo(var data:tLastFMInfo;lang:integer):int; -var - si:pSongInfo; - res,pc:pAnsiChar; - request:array [0..1023] of AnsiChar; - root,actnode,node,nnode:HXML; - i:integer; - pcw,p,pp:PWideChar; - artist:pAnsiChar; -begin - result:=0; - if data.artist=nil then - begin - si:=pointer(CallService(MS_WAT_RETURNGLOBAL,WAT_INF_UNICODE,0)); - pWideChar(artist):=si^.artist; - end - else - pWideChar(artist):=data.artist; - if artist=nil then - exit; - WideToUTF8(pWideChar(artist),artist); - pc:=FullEncode(StrCopyE(request, - 'http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&api_key='+api_key+'&artist='), - artist); - mFreeMem(artist); - if lang<>0 then - StrCopyE(StrCopyE(pc,'&lang='),pAnsiChar(@lang)); - res:=SendRequest(request,REQUEST_GET); - if (res<>nil) and (uint_ptr(res)>$0FFF) then - begin - UTF8ToWide(res,pcw); - mFreeMem(res); - - i:=StrLenW(pcw)*SizeOf(WideChar); - root:=xmlParseString(pcw,@i,nil); - - actnode:=xmlGetChild(xmlGetChild(root,0),0); // "artist" - - if data.artist=nil then - StrDupW(data.artist,xmlGetText(xmlGetNthChild(actnode,'name',0))); - - i:=0; - repeat - node:=xmlGetNthChild(actnode,'image',i); - if node=0 then break; - if StrCmpW(xmlGetAttrValue(node,'size'),'medium')=0 then - begin - WideToUTF8(xmlGetText(node),data.image); - break; - end; - inc(i); - until false; - - // bio - p:=StrPosW(pcw,'<content><![CDATA['); - if p<>nil then - begin - inc(p,18); - pp:=StrPosW(p,']]'); - if pp<> nil then pp^:=#0; - data.info:=FixInfo(p); - end; - - // similar - i:=0; - pcw:=pWideChar(@request); pcw^:=#0; - node:=xmlGetNthChild(actnode,'similar',0); - repeat - nnode:=xmlGetNthChild(xmlGetNthChild(node,'artist',i),'name',0); - if nnode=0 then break; - if pcw<>@request then - begin - pcw^:=','; inc(pcw); - pcw^:=' '; inc(pcw); - end; - pcw:=StrCopyEW(pcw,xmlGetText(nnode)); - inc(i); - until false; - pcw:=#0; - StrDupW(data.similar,pWideChar(@request)); - - // tags - i:=0; - pcw:=pWideChar(@request); pcw^:=#0; - node:=xmlGetNthChild(actnode,'tags',0); - repeat - nnode:=xmlGetNthChild(xmlGetNthChild(node,'tag',i),'name',0); - if nnode=0 then break; - if pcw<>@request then - begin - pcw^:=','; inc(pcw); - pcw^:=' '; inc(pcw); - end; - pcw:=StrCopyEW(pcw,xmlGetText(nnode)); - inc(i); - until false; - pcw:=#0; - StrDupW(data.tags,pWideChar(@request)); - xmlDestroyNode(root); - end; -end; - -function GetAlbumInfo(var data:tLastFMInfo;lang:integer):int; -var - si:pSongInfo; - res,pc:pAnsiChar; - request:array [0..1023] of AnsiChar; - root,actnode,node,nnode:HXML; - i:integer; - p,pp,pcw:PWideChar; - album,artist:pAnsiChar; -begin - result:=0; - si:=nil; - if data.album=nil then - begin - si:=pointer(CallService(MS_WAT_RETURNGLOBAL,WAT_INF_UNICODE,0)); - pWideChar(album):=si^.album; - end - else - pWideChar(album):=data.album; - if album=nil then - exit; - WideToUTF8(pWideChar(album),album); - pc:=FullEncode(StrCopyE(request, - 'http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key='+api_key+'&album='), - album); - mFreeMem(album); - if data.artist=nil then - begin - if si=nil then - si:=pointer(CallService(MS_WAT_RETURNGLOBAL,WAT_INF_UNICODE,0)); - pWideChar(artist):=si^.artist; - end - else - pWideChar(artist):=data.artist; - if artist<>nil then - begin - WideToUTF8(pWideChar(artist),artist); - pc:=FullEncode(StrCopyE(pc,'&artist='),artist); - mFreeMem(artist); - end; - - if lang<>0 then - StrCopyE(StrCopyE(pc,'&lang='),pAnsiChar(@lang)); - - res:=SendRequest(request,REQUEST_GET); - if res<>nil then - begin - UTF8ToWide(res,pcw); - mFreeMem(res); - - i:=StrLenW(pcw)*SizeOf(WideChar); - root:=xmlParseString(pcw,@i,nil); - - actnode:=xmlGetChild(xmlGetChild(root,0),0); // "album" - - if data.album=nil then - StrDupW(data.album,xmlGetText(xmlGetNthChild(actnode,'name',0))); - StrDupW(data.release,xmlGetText(xmlGetNthChild(actnode,'releasedate',0))); - if data.artist=nil then - StrDupW(data.artist,xmlGetText(xmlGetNthChild(actnode,'artist',0))); - - i:=0; - repeat - node:=xmlGetNthChild(actnode,'image',i); - if node=0 then break; - if StrCmpW(xmlGetAttrValue(node,'size'),'medium')=0 then - begin - WideToUTF8(xmlGetText(node),data.image); - break; - end; - inc(i); - until false; - - p:=StrPosW(pcw,'<content><![CDATA['); - if p<>nil then - begin - inc(p,18); - pp:=StrPosW(p,']]'); - if pp<> nil then pp^:=#0; - data.info:=FixInfo(p); - end; - - // tags - i:=0; - pcw:=pWideChar(@request); pcw^:=#0; - node:=xmlGetNthChild(actnode,'toptags',0); - repeat - nnode:=xmlGetNthChild(xmlGetNthChild(node,'tag',i),'name',0); - if nnode=0 then break; - if pcw<>@request then - begin - pcw^:=','; inc(pcw); - pcw^:=' '; inc(pcw); - end; - pcw:=StrCopyEW(pcw,xmlGetText(nnode)); - inc(i); - until false; - pcw:=#0; - StrDupW(data.tags,pWideChar(@request)); - - xmlDestroyNode(root); - end; -end; - -function GetTrackInfo(var data:tLastFMInfo;lang:integer):int; -var - si:pSongInfo; - res,pc:pAnsiChar; - request:array [0..1023] of AnsiChar; - root,actnode,node,anode:HXML; - i:integer; - p,pp,pcw:PWideChar; - title,artist:pAnsiChar; -begin - result:=0; - si:=nil; - if data.album=nil then - begin - si:=pointer(CallService(MS_WAT_RETURNGLOBAL,WAT_INF_UNICODE,0)); - pWideChar(title):=si^.title; - end - else - pWideChar(title):=data.title; - if title=nil then - exit; - WideToUTF8(pWideChar(title),title); - pc:=FullEncode(StrCopyE(request, - 'http://ws.audioscrobbler.com/2.0/?method=track.getinfo&api_key='+api_key+'&track='), - title); - mFreeMem(title); - if data.artist=nil then - begin - if si=nil then - si:=pointer(CallService(MS_WAT_RETURNGLOBAL,WAT_INF_UNICODE,0)); - pWideChar(artist):=si^.artist; - end - else - pWideChar(artist):=data.artist; - if artist<>nil then - begin - WideToUTF8(pWideChar(artist),artist); - pc:=FullEncode(StrCopyE(pc,'&artist='),artist); - mFreeMem(artist); - end; - - if lang<>0 then - StrCopyE(StrCopyE(pc,'&lang='),pAnsiChar(@lang)); - - res:=SendRequest(request,REQUEST_GET); - if res<>nil then - begin - UTF8ToWide(res,pcw); - mFreeMem(res); - - i:=StrLenW(pcw)*SizeOf(WideChar); - root:=xmlParseString(pcw,@i,nil); - - actnode:=xmlGetChild(xmlGetChild(root,0),0); // "track" - if data.artist=nil then - StrDupW(data.artist,xmlGetText(xmlGetNthChild(xmlGetNthChild(actnode,'artist',0),'name',0))); - - anode:=xmlGetNthChild(actnode,'album',i); - - if data.album=nil then - StrDupW(data.album,xmlGetText(xmlGetNthChild(anode,'title',0))); - - data.trknum:=StrToInt(xmlGetAttrValue(anode,'position')); - if data.title=nil then - StrDupW(data.title,xmlGetText(xmlGetNthChild(actnode,'name',0))); - - i:=0; - repeat - node:=xmlGetNthChild(anode,'image',i); - if node=0 then break; - if StrCmpW(xmlGetAttrValue(node,'size'),'medium')=0 then - begin - WideToUTF8(xmlGetText(node),data.image); - break; - end; - inc(i); - until false; - - p:=StrPosW(pcw,'<content><![CDATA['); - if p<>nil then - begin - inc(p,18); - pp:=StrPosW(p,']]'); - if pp<> nil then pp^:=#0; - data.info:=FixInfo(p); - end; - - // tags - i:=0; - pcw:=pWideChar(@request); pcw^:=#0; - node:=xmlGetNthChild(actnode,'toptags',0); - repeat - anode:=xmlGetNthChild(xmlGetNthChild(node,'tag',i),'name',0); - if anode=0 then break; - if pcw<>@request then - begin - pcw^:=','; inc(pcw); - pcw^:=' '; inc(pcw); - end; - pcw:=StrCopyEW(pcw,xmlGetText(anode)); - inc(i); - until false; - pcw:=#0; - StrDupW(data.tags,pWideChar(@request)); - - xmlDestroyNode(root); - end; -end; diff --git a/plugins/Watrack/lastfm/i_last_dlg.inc b/plugins/Watrack/lastfm/i_last_dlg.inc index 44beb5bdf7..ab15fc8cd2 100644 --- a/plugins/Watrack/lastfm/i_last_dlg.inc +++ b/plugins/Watrack/lastfm/i_last_dlg.inc @@ -69,16 +69,11 @@ begin if loword(wParam)=IDC_INFO_ARTIST then begin SetDlgItemTextW(Dialog,IDC_ALT,TranslateW('Similar artists')); - GetArtistInfo(data,lfm_lang); SetDlgItemTextW(Dialog,IDC_DATA_ALBUM,data.similar); end else begin SetDlgItemTextW(Dialog,IDC_ALT,TranslateW('Album')); - if loword(wParam)=IDC_INFO_TRACK then - GetTrackInfo (data,lfm_lang) - else - GetAlbumInfo (data,lfm_lang); SetDlgItemTextW(Dialog,IDC_DATA_ALBUM,data.album); end; diff --git a/plugins/Watrack/lastfm/lastfm.pas b/plugins/Watrack/lastfm/lastfm.pas index 2c0428de6b..f83601f966 100644 --- a/plugins/Watrack/lastfm/lastfm.pas +++ b/plugins/Watrack/lastfm/lastfm.pas @@ -132,16 +132,8 @@ end; {$i i_last_dlg.inc} function SrvLastFMInfo(wParam:WPARAM;lParam:LPARAM):int;cdecl; -var - data:tLastFMInfo; begin - case wParam of - 0: result:=GetArtistInfo(data,lParam); - 1: result:=GetAlbumInfo (data,lParam); - 2: result:=GetTrackInfo (data,lParam); - else - result:=0; - end; + result:=0; end; function SrvLastFM(wParam:WPARAM;lParam:LPARAM):int;cdecl; -- cgit v1.2.3