From 34353afa23f23d9bc3470896248b8c387465a4b2 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Mon, 10 Feb 2014 17:25:36 +0000 Subject: Miranda API sync with small compilation fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@8083 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Actman30/actman30.dpr | 2 +- plugins/Actman30/hooks/i_opt_dlg.inc | 13 +- plugins/Actman30/i_cnst_service.inc | 12 - plugins/Actman30/i_opt_dlg.inc | 2 +- plugins/Actman30/i_opt_dlg2.inc | 2 +- plugins/Actman30/i_sparam_const.inc | 10 - plugins/Actman30/iac_call.pas | 20 +- plugins/Actman30/iac_contact.pas | 2 +- plugins/Actman30/iac_contact.rc | 2 +- plugins/Actman30/iac_dbrw.pas | 4 +- plugins/Actman30/iac_global.pas | 101 +++-- plugins/Actman30/iac_inout.pas | 2 +- plugins/Actman30/iac_service.pas | 509 ++----------------------- plugins/Actman30/iac_service.rc | 21 -- plugins/Actman30/services.ini | 23 +- plugins/Actman30/sparam.pas | 708 ----------------------------------- plugins/Actman30/sparam.rc | 27 -- plugins/Actman30/tasks/i_opt_dlg.inc | 7 +- plugins/Actman30/ua/i_opt_dlg.inc | 4 +- plugins/Actman30/ua/i_uaplaces.inc | 2 +- 20 files changed, 150 insertions(+), 1323 deletions(-) delete mode 100644 plugins/Actman30/i_cnst_service.inc delete mode 100644 plugins/Actman30/i_sparam_const.inc delete mode 100644 plugins/Actman30/sparam.pas delete mode 100644 plugins/Actman30/sparam.rc (limited to 'plugins/Actman30') diff --git a/plugins/Actman30/actman30.dpr b/plugins/Actman30/actman30.dpr index 404b2f1054..2f7a24e573 100644 --- a/plugins/Actman30/actman30.dpr +++ b/plugins/Actman30/actman30.dpr @@ -28,8 +28,8 @@ library actman; uses // fastmm4, - m_api, Windows, + m_api, messages, commctrl, common, diff --git a/plugins/Actman30/hooks/i_opt_dlg.inc b/plugins/Actman30/hooks/i_opt_dlg.inc index 69c59c7cc2..8fac1007a1 100644 --- a/plugins/Actman30/hooks/i_opt_dlg.inc +++ b/plugins/Actman30/hooks/i_opt_dlg.inc @@ -157,7 +157,7 @@ procedure CheckButtons(Dialog:HWND); var b:bool; begin - b:=ListView_GetItemCount(GetDlgItem(Dialog,IDC_HOOKLIST))>0; + b:=SendDlgItemMessage(Dialog,IDC_HOOKLIST,LVM_GETITEMCOUNT, 0, 0)>0; EnableWindow(GetDlgItem(Dialog,IDC_EVENTLIST ),b); EnableWindow(GetDlgItem(Dialog,IDC_ACTIONLIST ),b); @@ -190,13 +190,14 @@ end; function DeleteHook(Dialog:HWND):integer; var wnd:HWND; - i:integer; + i,j:integer; begin result:=0; wnd:=GetDlgItem(Dialog,IDC_HOOKLIST); - for i:=ListView_GetItemCount(wnd)-1 downto 0 do + j:=SendMessage(wnd,LVM_GETITEMCOUNT,0,0); + for i:=j-1 downto 0 do begin - if ListView_GetItemState(wnd,i,LVIS_SELECTED)<>0 then + if SendMessage(wnd,LVM_GETITEMSTATE,i,LVIS_SELECTED)<>0 then SendMessage(wnd,LVM_DELETEITEM,i,0); end; Listview_SetItemState(wnd,0, @@ -302,8 +303,6 @@ end; function DlgProcOpt(Dialog:HWnd;hMessage:UINT;wParam:WPARAM;lParam:LPARAM):lresult; stdcall; var - wnd:HWND; - lv:LV_COLUMNW; i:integer; tmp:pAnsiChar; buf:array [0..255] of AnsiChar; @@ -330,7 +329,7 @@ begin FillActionList(GetDlgItem(Dialog,IDC_ACTIONLIST)); CreateHKTable(Dialog); - FillHookList(wnd); + FillHookList(GetDlgItem(Dialog,IDC_HOOKLIST)); ShowHookData(Dialog); CheckButtons(Dialog); diff --git a/plugins/Actman30/i_cnst_service.inc b/plugins/Actman30/i_cnst_service.inc deleted file mode 100644 index 2e5f0cca83..0000000000 --- a/plugins/Actman30/i_cnst_service.inc +++ /dev/null @@ -1,12 +0,0 @@ -const - IDC_FLAG_WPAR = 2154; - IDC_FLAG_LPAR = 2155; - IDC_EDIT_WPAR = 2156; - IDC_EDIT_LPAR = 2157; - IDC_EDIT_SERVICE = 2159; - IDC_WSTRUCT = 2160; - IDC_LSTRUCT = 2161; - - IDC_SRV_RESULT = 2255; - IDC_RES_FREEMEM = 2256; - IDC_RES_UNICODE = 2257; diff --git a/plugins/Actman30/i_opt_dlg.inc b/plugins/Actman30/i_opt_dlg.inc index 62a0a6c66f..e7a9e206ef 100644 --- a/plugins/Actman30/i_opt_dlg.inc +++ b/plugins/Actman30/i_opt_dlg.inc @@ -17,7 +17,7 @@ var i:integer; begin result:=0; - NoDescription:=TranslateW('No Description'); + NoDescription:=TranslateW('No description'); StrCopyW(xmlfilename,'c:\export.xml'); diff --git a/plugins/Actman30/i_opt_dlg2.inc b/plugins/Actman30/i_opt_dlg2.inc index 330be64780..3a816a481a 100644 --- a/plugins/Actman30/i_opt_dlg2.inc +++ b/plugins/Actman30/i_opt_dlg2.inc @@ -225,7 +225,7 @@ begin while p<>nil do begin StrCopy(StrCopyE(@buf,IcoLibPrefix),p^.Name); - ImageList_AddIcon(il,CallService(MS_SKIN2_GETICON,0,lparam(@buf))); + ImageList_ReplaceIcon(il,-1,CallService(MS_SKIN2_GETICON,0,lparam(@buf))); cbei.pszText :=TranslateW(FastAnsiToWideBuf(p^.Name,buf)); cbei.iItem :=i; diff --git a/plugins/Actman30/i_sparam_const.inc b/plugins/Actman30/i_sparam_const.inc deleted file mode 100644 index 5571dd96e0..0000000000 --- a/plugins/Actman30/i_sparam_const.inc +++ /dev/null @@ -1,10 +0,0 @@ -const - IDC_FLAG_PAR = 2150; - IDC_EDIT_PAR = 2151; - IDC_STRUCT = 2152; - IDC_STAT_PAR = 2153; - - IDC_RES_TYPE = 2160; - IDC_RES_FREEMEM = 2161; - IDC_RES_GROUP = 2162; - IDC_RES_STAT = 2163; diff --git a/plugins/Actman30/iac_call.pas b/plugins/Actman30/iac_call.pas index 9b0c8dbe3a..33208fb16a 100644 --- a/plugins/Actman30/iac_call.pas +++ b/plugins/Actman30/iac_call.pas @@ -57,17 +57,6 @@ const ACF_CACHE_NOW = $00000002; ACF_CACHE_MACRO = $00000004; -// param flags, same as for service -const - ACF_RSTRING = $00010000; // Service result is string - ACF_RUNICODE = $00020000; // Service result is Widestring - ACF_RSTRUCT = $00040000; // Service result in structure - ACF_RFREEMEM = $00080000; // Need to free memory - - ACF_SCRIPT_PARAM = $00001000; - // dummy - ACF_STRING = 0; - type sp0 = function:int_ptr; stdcall; sp1 = function(arg1:int_ptr):int_ptr; stdcall; @@ -144,7 +133,7 @@ begin for i:=0 to argcount-1 do begin largv[i]:=argv[i]; - PreProcess(argf[i],LPARAM(largv[i]),WorkData); +//!! PreProcess(argf[i],LPARAM(largv[i]),WorkData); end; // call function case argcount of @@ -206,7 +195,7 @@ begin ClearResult(WorkData); // result type processing - if (flags and ACF_RSTRING)<>0 then + if (flags and (ACF_RSTRING or ACF_UNICODE))<>0 then begin if (flags and ACF_RUNICODE)=0 then AnsiToWide(pAnsiChar(res),pWideChar(WorkData.LastResult),MirandaCP) @@ -659,7 +648,8 @@ begin pt.x:=rc.left; pt.y:=rc.bottom; ScreenToClient(Dialog,pt); - SetWindowLongPtrW(wnd1,GWLP_USERDATA,CreateParamBlock(Dialog,0,pt.y+2,168)); + GetClientRect(wnd1,rc); + SetWindowLongPtrW(wnd1,GWLP_USERDATA,CreateParamBlock(Dialog,0,pt.y+2,rc.right)); CheckDlgButton(Dialog,IDC_CLOSE_RES,BST_UNCHECKED); wnd:=GetDlgItem(Dialog,IDC_CLOSE_RES); // count offset from initial pos @@ -668,7 +658,7 @@ begin pt.x:=rc.left; pt.y:=rc.bottom; ScreenToClient(Dialog,pt); - wnd1:=CreateResultBlock(Dialog,0,pt.y+2,168); + wnd1:=CreateResultBlock(Dialog,0,pt.y+2,rc.right-rc.left,ACF_NOVISUAL); SetWindowLongPtrW(wnd,GWLP_USERDATA,wnd1); ShowWindow(wnd1,SW_HIDE); diff --git a/plugins/Actman30/iac_contact.pas b/plugins/Actman30/iac_contact.pas index eb9a5790cd..1ab918e43f 100644 --- a/plugins/Actman30/iac_contact.pas +++ b/plugins/Actman30/iac_contact.pas @@ -24,7 +24,7 @@ const type tContactAction = class(tBaseAction) private - contact:THANDLE; + contact:HCONTACT; public constructor Create(uid:dword); // function Clone:tBaseAction; override; diff --git a/plugins/Actman30/iac_contact.rc b/plugins/Actman30/iac_contact.rc index b3923502b3..65a7d2843e 100644 --- a/plugins/Actman30/iac_contact.rc +++ b/plugins/Actman30/iac_contact.rc @@ -7,7 +7,7 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0 { - RTEXT "Choose Contact", -1 , 0, 2, 160, 10 + RTEXT "Choose contact", -1 , 0, 2, 160, 10 CONTROL "Refresh",IDC_CNT_REFRESH,"MButtonClass",WS_TABSTOP,1,12,16,16,$18000000 COMBOBOX IDC_CONTACTLIST, 19, 14, 148, 128, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL AUTOCHECKBOX "Keep handle only", IDC_CNT_KEEP , 1, 31, 160, 11 diff --git a/plugins/Actman30/iac_dbrw.pas b/plugins/Actman30/iac_dbrw.pas index 0c9e0ad502..96a44b3f7f 100644 --- a/plugins/Actman30/iac_dbrw.pas +++ b/plugins/Actman30/iac_dbrw.pas @@ -68,7 +68,7 @@ const type tDataBaseAction = class(tBaseAction) private - dbcontact:THANDLE; + dbcontact:HCONTACT; dbmodule :PWideChar; dbsetting:PWideChar; dbvalue :PWideChar; // keep all in unicode (str to int translation fast) @@ -129,7 +129,7 @@ var ambuf,asbuf:array [0..127] of AnsiChar; ls,tmp:pWideChar; tmpa,tmpa1:pAnsiChar; - hContact:THANDLE; + hContact:THCONTACT; proto:pAnsiChar; avalue:uint_ptr; begin diff --git a/plugins/Actman30/iac_global.pas b/plugins/Actman30/iac_global.pas index 1d7957a3bc..cba955d762 100644 --- a/plugins/Actman30/iac_global.pas +++ b/plugins/Actman30/iac_global.pas @@ -89,8 +89,8 @@ procedure InsertString(wnd:HWND;num:dword;str:PAnsiChar); function GetLink(hash:dword):pActModule; function GetLinkByName(name:pAnsiChar):pActModule; -function ImportContact (node:HXML ):THANDLE; -function ImportContactINI(node:pointer):THANDLE; +function ImportContact (node:HXML ):HCONTACT; +function ImportContactINI(node:pointer):HCONTACT; implementation @@ -301,7 +301,7 @@ const ioCUID = 'cuid'; ioCUIDType = 'cuidtype'; -function ImportContact(node:HXML):THANDLE; +function ImportContact(node:HXML):HCONTACT; var proto:pAnsiChar; tmpbuf:array [0..63] of AnsiChar; @@ -352,7 +352,7 @@ begin end; end; -function ImportContactINI(node:pointer):THANDLE; +function ImportContactINI(node:pointer):HCONTACT; { var proto:pAnsiChar; @@ -441,48 +441,84 @@ type const actDLLCache: tDLLCache = nil; -function GetDllHandle(dllname:pAnsiChar;mode:dword=0):THANDLE; +function GetDllHandle(adllname:pAnsiChar;mode:dword=0):THANDLE; var - i:integer; + i,zero:integer; begin - result:=LoadLibraryA(dllname); -exit; + // 1 - search that name in cache i:=0; + zero:=-1; while i<=HIGH(actDLLCache) do begin - if StrCmp(actDLLCache[i].DllName,dllname)=0 then + with actDLLCache[i] do begin - result:=actDLLCache[i].DllHandle; - // check mode - exit; + // remember first empty slot + if DllHandle=0 then + begin + if zero<0 then + zero:=i; + end + else if StrCmp(DllName,adllname)=0 then + begin + result:=DllHandle; + inc(count); + if mode=3 then // per-session + flags:=3; + exit; + end; end; inc(i); end; - result:=LoadLibraryA(dllname); - // check mode - SetLength(actDLLCache,i); - StrDup(actDLLCache[i].DllName,dllname); - actDLLCache[i].DllHandle:=result; -// actDLLCache.flags:=; + // 2 - not found, load library + result:=LoadLibraryA(adllname); + // 3 - add to cache if not per-action + if mode<>0 then + begin + if zero>=0 then + i:=zero + else + begin + SetLength(actDLLCache,i); + dec(i); + end; + + with actDLLCache[i] do + begin + StrDup(DllName,adllname); + DllHandle:=result; + count :=0; + flags :=mode; + end; + end; end; procedure CloseDllHandle(handle:THANDLE); var i:integer; begin - FreeLibrary(handle); -exit; - i:=0; - while i<=HIGH(actDLLCache) do + i:=HIGH(actDLLCache); + while i>=0 do begin - if actDLLCache[i].DllHandle=handle then + with actDLLCache[i] do begin - // check mode - FreeLibrary(actDLLCache[i].DllHandle); - exit; + if DllHandle=handle then + begin + dec(count); + if count=0 then + begin + if flags=2 then // per-macro+not needed -> free + begin + FreeLibrary(DllHandle); + DllHandle:=0; + mFreeMem(DllName); + end; + end; + exit; + end; end; - inc(i); + dec(i); end; + // if not found in cache FreeLibrary(handle); end; @@ -490,10 +526,17 @@ procedure FreeDllHandleCache; var i:integer; begin - i:=0; - while i<=HIGH(actDLLCache) do + i:=HIGH(actDLLCache); + while i>=0 do begin + if actDLLCache[i].DllHandle<>0 then + begin + FreeLibrary(actDLLCache[i].DllHandle); + mFreeMem(actDLLCache[i].DllName); + end; + dec(i); end; + SetLength(actDLLCache,0); end; end. diff --git a/plugins/Actman30/iac_inout.pas b/plugins/Actman30/iac_inout.pas index 999d3fccaf..c64b96e669 100644 --- a/plugins/Actman30/iac_inout.pas +++ b/plugins/Actman30/iac_inout.pas @@ -85,7 +85,7 @@ var tmp:PWideChar; blob,p:PAnsiChar; w:PWideChar; - hContact:THANDLE; + hContact:THCONTACT; wnd:HWND; fexist:bool; dbei:TDBEVENTINFO; diff --git a/plugins/Actman30/iac_service.pas b/plugins/Actman30/iac_service.pas index 67a565c477..b31ab403b1 100644 --- a/plugins/Actman30/iac_service.pas +++ b/plugins/Actman30/iac_service.pas @@ -10,9 +10,9 @@ uses m_api, sedit,strans,mApiCardM, mirutils,dbsettings, editwrapper, + sparam,srvblock, syswin,wrapper,common; -{$include i_cnst_service.inc} {$resource iac_service.res} const @@ -254,7 +254,7 @@ begin ClearResult(WorkData); // result type processing - if (flags and ACF_RSTRING)<>0 then + if (flags and (ACF_RSTRING or ACF_UNICODE))<>0 then begin //!! delete old or not? if (flags and ACF_RUNICODE)=0 then @@ -467,420 +467,62 @@ end; //----- Dialog realization ----- -const - ptNumber = 0; - ptString = 1; - ptUnicode = 2; - ptCurrent = 3; - ptResult = 4; - ptParam = 5; - ptStruct = 6; -const - sresInt = 0; - sresString = 1; - sresStruct = 2; - -procedure MakeResultTypeList(wnd:HWND); -begin - SendMessage(wnd,CB_RESETCONTENT,0,0); - InsertString(wnd,sresInt ,'Integer'); - InsertString(wnd,sresString,'String'); - InsertString(wnd,sresStruct,'Structure'); - SendMessage(wnd,CB_SETCURSEL,0,0); -end; - -procedure MakeParamTypeList(wnd:HWND); -begin - SendMessage(wnd,CB_RESETCONTENT,0,0); - InsertString(wnd,ptNumber ,'number value'); - InsertString(wnd,ptString ,'ANSI string'); - InsertString(wnd,ptUnicode,'Unicode string'); - InsertString(wnd,ptCurrent,'current contact'); - InsertString(wnd,ptResult ,'last result'); - InsertString(wnd,ptParam ,'parameter'); - InsertString(wnd,ptStruct ,'structure'); - SendMessage(wnd,CB_SETCURSEL,0,0); -end; - -var - ApiCard:tmApiCard; - -function FixParam(Dialog:HWND;buf:PAnsiChar;flag:integer):integer; -begin - if StrCmp(buf,Translate('hContact' ))=0 then result:=ptCurrent - else if StrCmp(buf,Translate('parameter' ))=0 then result:=ptParam - else if StrCmp(buf,Translate('result' ))=0 then result:=ptResult - else if StrCmp(buf,Translate('structure' ))=0 then result:=ptStruct - else if StrCmp(buf,Translate('Unicode text'))=0 then result:=ptUnicode - else - begin - if (buf[0] in ['0'..'9']) or ((buf[0]='-') and (buf[1] in ['0'..'9'])) or - ((buf[0]='$') and (buf[1] in sHexNum)) or - ((buf[0]='0') and (buf[1]='x') and (buf[2] in sHexNum)) then - result:=ptNumber - else - result:=ptString; - end; - - CB_SelectData(Dialog,flag,result); -// SendDlgItemMessage(Dialog,flag,CB_SETCURSEL,result,0); - SendMessage(Dialog,WM_COMMAND,(CBN_SELCHANGE shl 16) or flag,GetDlgItem(Dialog,flag)); -end; - -procedure ReloadService(Dialog:HWND;setvalue:boolean); -var - pc:pAnsiChar; - buf,buf1:array [0..127] of AnsiChar; - wnd:hwnd; - i:integer; - struct:pAnsiChar; -// bufw:array [0..MaxDescrLen] of WideChar; -begin - wnd:=GetDlgItem(Dialog,IDC_EDIT_SERVICE); - SendMessageA(wnd,CB_GETLBTEXT,SendMessage(wnd,CB_GETCURSEL,0,0),tlparam(@buf)); - ApiCard.Service:=@buf; - - pc:=ApiCard.FillParams(GetDlgItem(Dialog,IDC_EDIT_WPAR),true); - if pc<>nil then - begin - if GetDlgItemTextA(Dialog,IDC_EDIT_WPAR,buf1,SizeOf(buf1))>0 then - case FixParam(Dialog,@buf1,IDC_FLAG_WPAR) of - ptStruct: begin - if setvalue then - begin - struct:=pAnsiChar(SetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA, - long_ptr(StrDup(struct,StrScan(pc,'|')+1)))); - mFreeMem(struct); - end; - -{ struct:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA)); - mFreeMem(struct); - StrDup(struct,StrScan(pc,'|')+1); - SetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA,long_ptr(struct)); -// AnsiToWide(StrScan(pc,'|')+1,wstruct,MirandaCP); -} - end; - end; - mFreeMem(pc); - end; - - pc:=ApiCard.FillParams(GetDlgItem(Dialog,IDC_EDIT_LPAR),false); - if pc<>nil then - begin - if GetDlgItemTextA(Dialog,IDC_EDIT_LPAR,buf1,SizeOf(buf1))>0 then - case FixParam(Dialog,@buf1,IDC_FLAG_LPAR) of - ptStruct: begin - if setvalue then - begin - struct:=pAnsiChar(SetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA, - long_ptr(StrDup(struct,StrScan(pc,'|')+1)))); - mFreeMem(struct); - end; -{ - struct:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA)); - mFreeMem(struct); - StrDup(struct,StrScan(pc,'|')+1); - SetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA,long_ptr(struct)); -// AnsiToWide(StrScan(pc,'|')+1,lstruct,MirandaCP); -} - end; - end; - mFreeMem(pc); - end; - - pc:=ApiCard.ResultType; - i:=sresInt; - if pc<>nil then - begin - if lstrcmpia(pc,'struct')=0 then i:=sresStruct - else if lstrcmpia(pc,'str')=0 then - begin - i:=sresString; - CheckDlgButton(Dialog,IDC_RES_UNICODE,BST_UNCHECKED); - end - else if lstrcmpia(pc,'wide')=0 then - begin - i:=sresString; - CheckDlgButton(Dialog,IDC_RES_UNICODE,BST_CHECKED); - end; - mFreeMem(pc); - end; - CB_SelectData(Dialog,IDC_SRV_RESULT,i); -// ApiCard.Show; -end; - -// true - need to show structure -function SetParam(Dialog:HWND; aflags:dword; id:integer; aparam:pWideChar):integer; -var - wnd:HWND; -begin - wnd:=GetDlgItem(Dialog,id); - if (aflags and ACF_PARAM)<>0 then - begin - EnableWindow(wnd,false); - result:=ptParam; - end - else if (aflags and ACF_RESULT)<>0 then - begin - EnableWindow(wnd,false); - result:=ptResult; - end - else if (aflags and ACF_CURRENT)<>0 then - begin - EnableWindow(wnd,false); - result:=ptCurrent; - end - else if (aflags and ACF_PARNUM)<>0 then - begin - result:=ptNumber; - SetDlgItemTextW(Dialog,id,aparam); - end - else if (aflags and ACF_STRUCT)<>0 then - begin - result:=ptStruct; - end - else if (aflags and ACF_UNICODE)<>0 then - begin - result:=ptUnicode; - SetDlgItemTextW(Dialog,id,aparam); - end - else - begin - result:=ptString; - SetDlgItemTextW(Dialog,id,aparam); - end; - SetEditFlags(wnd,EF_SCRIPT,ord((aflags and ACF_SCRIPT_PARAM)<>0)); -end; - -procedure ClearFields(Dialog:HWND); -var - wnd:HWND; -begin - ShowWindow(GetDlgItem(Dialog,IDC_WSTRUCT),SW_HIDE); - wnd:=GetDlgItem(Dialog,IDC_EDIT_WPAR); - ShowEditField (wnd,SW_SHOW); - EnableEditField(wnd,true); - SendMessage (wnd,CB_RESETCONTENT,0,0); -//?? SetDlgItemTextW(Dialog,IDC_EDIT_WPAR,nil); - CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_WPAR),ptNumber); - SetEditFlags(wnd,EF_ALL,0); - - ShowWindow (GetDlgItem(Dialog,IDC_LSTRUCT),SW_HIDE); - wnd:=GetDlgItem(Dialog,IDC_EDIT_LPAR); - ShowEditField (wnd,SW_SHOW); - EnableEditField(wnd,true); - SendMessage (wnd,CB_RESETCONTENT,0,0); -//?? SetDlgItemTextW(Dialog,IDC_EDIT_LPAR,nil); - CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_LPAR),ptNumber); - SetEditFlags(wnd,EF_ALL,0); - - ShowWindow(GetDlgItem(Dialog,IDC_RES_FREEMEM),SW_HIDE); - ShowWindow(GetDlgItem(Dialog,IDC_RES_UNICODE),SW_HIDE); - CheckDlgButton(Dialog,IDC_RES_FREEMEM,BST_UNCHECKED); - CheckDlgButton(Dialog,IDC_RES_UNICODE,BST_UNCHECKED); - - CB_SelectData(Dialog,IDC_SRV_RESULT,sresInt); -end; - function DlgProc(Dialog:HWnd;hMessage:UINT;wParam:WPARAM;lParam:LPARAM):lresult; stdcall; -const - NoProcess:boolean=true; var - i:integer; - pc,pc1:pAnsiChar; - wnd,wnd1:HWND; - pcw:PWideChar; + ServiceBlock:HWND; + rc:TRECT; + sv:tServiceValue; begin result:=0; case hMessage of WM_DESTROY: begin - ApiCard.Free; - pc:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA)); - mFreeMem(pc); - pc:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA)); - mFreeMem(pc); end; WM_INITDIALOG: begin - MakeResultTypeList(GetDlgItem(Dialog,IDC_SRV_RESULT)); - MakeParamTypeList(GetDlgItem(Dialog,IDC_FLAG_WPAR)); - MakeParamTypeList(GetDlgItem(Dialog,IDC_FLAG_LPAR)); + GetClientRect(Dialog,rc); + ServiceBlock:=CreateServiceBlock(Dialog,0,0,rc.right,rc.bottom,ACF_NOVISUAL or ACF_SCRIPT_EXPAND); + SetWindowLongPtrW(Dialog,GWLP_USERDATA,ServiceBlock); + SetServiceListMode(ServiceBlock,DBReadByte(0,DBBranch,'SrvListMode')); TranslateDialogDefault(Dialog); - -//?? - MakeEditField(Dialog,IDC_EDIT_SERVICE); - MakeEditField(Dialog,IDC_EDIT_WPAR); - MakeEditField(Dialog,IDC_EDIT_LPAR); - - ApiCard:=CreateServiceCard(Dialog); - ApiCard.FillList(GetDlgItem(Dialog,IDC_EDIT_SERVICE), - DBReadByte(0,DBBranch,'SrvListMode')); end; WM_ACT_SETVALUE: begin - NoProcess:=true; - ClearFields(Dialog); - + ServiceBlock:=GetWindowLongPtrW(Dialog,GWLP_USERDATA); with tServiceAction(lParam) do begin - if CB_SelectData(Dialog,IDC_EDIT_SERVICE,Hash(service,StrLen(service)))<>CB_ERR then -// if SendDlgItemMessageA(Dialog,IDC_EDIT_SERVICE,CB_SELECTSTRING,twparam(-1),tlparam(service))<>CB_ERR then - ReloadService(Dialog,false) - else - SetDlgItemTextA(Dialog,IDC_EDIT_SERVICE,service); -//!! - SetEditFlags(GetDlgItem(Dialog,IDC_EDIT_SERVICE),EF_SCRIPT, - ord((flags and ACF_SCRIPT_SERVICE)<>0)); - - // RESULT - if (flags and ACF_RSTRUCT)<>0 then - i:=sresStruct - else if (flags and ACF_RSTRING)<>0 then - begin - i:=sresString; - if (flags and ACF_RUNICODE)<>0 then CheckDlgButton(Dialog,IDC_RES_UNICODE,BST_CHECKED); - if (flags and ACF_RFREEMEM)<>0 then CheckDlgButton(Dialog,IDC_RES_FREEMEM,BST_CHECKED); - end - else - begin - i:=sresInt; - end; - CB_SelectData(Dialog,IDC_SRV_RESULT,i); - - // WPARAM - i:=SetParam(Dialog,flags,IDC_EDIT_WPAR,pWideChar(wparam)); - if i=ptStruct then - begin - ShowEditField(GetDlgItem(Dialog,IDC_EDIT_WPAR),SW_HIDE); - ShowWindow (GetDlgItem(Dialog,IDC_WSTRUCT ),SW_SHOW); - -{ - p:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA)); - mFreeMem(p); -} - SetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA, - long_ptr(StrDup(pc,pAnsiChar(wparam)))); - end; - CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_WPAR),i); - - // LPARAM - i:=SetParam(Dialog,flags2,IDC_EDIT_LPAR,pWideChar(lparam)); - if i=ptStruct then - begin - ShowEditField(GetDlgItem(Dialog,IDC_EDIT_LPAR),SW_HIDE); - ShowWindow (GetDlgItem(Dialog,IDC_LSTRUCT ),SW_SHOW); - -{ - p:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA)); - mFreeMem(p); -} - SetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA, - long_ptr(StrDup(pc,pAnsiChar(lparam)))); - end; - CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_LPAR),i); - + sv.service:=service; + sv.w_flag :=flags; + sv.wparam :=wparam; + sv.l_flag :=flags2; + sv.lparam :=lparam; + sv.flags :=flags; end; - NoProcess:=false; + SetSrvBlockValue(ServiceBlock,sv); end; WM_ACT_RESET: begin - NoProcess:=true; - ClearFields(Dialog); - SetDlgItemTextW(Dialog,IDC_EDIT_SERVICE,nil); - SetDlgItemTextW(Dialog,IDC_EDIT_WPAR,'0'); - SetDlgItemTextW(Dialog,IDC_EDIT_LPAR,'0'); -{ - ShowWindow(GetDlgItem(Dialog,IDC_WSTRUCT),SW_HIDE); - ShowWindow(GetDlgItem(Dialog,IDC_LSTRUCT),SW_HIDE); -} - NoProcess:=false; + ClearServiceBlock(GetWindowLongPtrW(Dialog,GWLP_USERDATA)); end; WM_ACT_SAVE: begin with tServiceAction(lParam) do begin - //WPARAM - wnd:=GetDlgItem(Dialog,IDC_EDIT_WPAR); - case CB_GetData(GetDlgItem(Dialog,IDC_FLAG_WPAR)) of - ptParam: begin - flags:=flags or ACF_PARAM - end; - ptResult: begin - flags:=flags or ACF_RESULT - end; - ptCurrent: begin - flags:=flags or ACF_CURRENT - end; - ptNumber: begin - flags:=flags or ACF_PARNUM; - wparam:=GetDlgText(wnd); - end; - ptStruct: begin - flags:=flags or ACF_STRUCT; - StrDup(pAnsiChar(wparam), - pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_WSTRUCT),GWLP_USERDATA))); - end; - ptUnicode: begin - flags:=flags or ACF_UNICODE; - wparam:=GetDlgText(wnd); - end; - ptString: wparam:=GetDlgText(wnd); - end; - if (GetEditFlags(wnd) and EF_SCRIPT)<>0 then - flags:=flags or ACF_SCRIPT_PARAM; - - // LPARAM - wnd:=GetDlgItem(Dialog,IDC_EDIT_LPAR); - case CB_GetData(GetDlgItem(Dialog,IDC_FLAG_LPAR)) of - ptParam: begin - flags2:=flags2 or ACF_PARAM - end; - ptResult: begin - flags2:=flags2 or ACF_RESULT - end; - ptCurrent: begin - flags2:=flags2 or ACF_CURRENT - end; - ptNumber: begin - flags2:=flags2 or ACF_PARNUM; - lparam:=GetDlgText(wnd); - end; - ptStruct: begin - flags2:=flags2 or ACF_STRUCT; - StrDup(pAnsiChar(lparam), - pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA))); - end; - ptUnicode: begin - flags2:=flags2 or ACF_UNICODE; - lparam:=GetDlgText(wnd); - end; - ptString: lparam:=GetDlgText(wnd); - end; - if (GetEditFlags(wnd) and EF_SCRIPT)<>0 then - flags2:=flags2 or ACF_SCRIPT_PARAM; - - // RESULT - case CB_GetData(GetDlgItem(Dialog,IDC_SRV_RESULT)) of - sresString: begin - flags:=flags or ACF_RSTRING; - if IsDlgButtonChecked(Dialog,IDC_RES_UNICODE)=BST_CHECKED then - flags:=flags or ACF_RUNICODE; - if IsDlgButtonChecked(Dialog,IDC_RES_FREEMEM)=BST_CHECKED then - flags:=flags or ACF_RFREEMEM; - end; - sresStruct: flags:=flags or ACF_RSTRUCT; - end; - - service:=ApiCard.NameFromList(GetDlgItem(Dialog,IDC_EDIT_SERVICE)); -//!! - if (GetEditFlags(Dialog,IDC_EDIT_SERVICE) and EF_SCRIPT)<>0 then - flags:=flags or ACF_SCRIPT_SERVICE; + ServiceBlock:=GetWindowLongPtrW(Dialog,GWLP_USERDATA); + GetSrvBlockValue(ServiceBlock,sv); + + service:=sv.service; + wparam :=sv.wparam; + lparam :=sv.lparam; + flags2 :=sv.l_flag; + flags :=sv.flags or sv.w_flag; end; end; + //?? WM_SHOWWINDOW: begin +{ // hide window by ShowWindow function if (lParam=0) and (wParam=0) then begin @@ -889,100 +531,15 @@ begin pc:=pAnsiChar(SetWindowLongPtrW(GetDlgItem(Dialog,IDC_LSTRUCT),GWLP_USERDATA,0)); mFreeMem(pc); end; +} end; - +{ WM_COMMAND: begin - case wParam shr 16 of -{ CBN_EDITUPDATE, -} - CBN_EDITCHANGE, - EN_CHANGE: if not NoProcess then - SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0); - - CBN_SELCHANGE: begin - case loword(wParam) of - IDC_SRV_RESULT: begin - i:=CB_GetData(lParam); - case i of - sresInt,sresStruct: begin - ShowWindow(GetDlgItem(Dialog,IDC_RES_FREEMEM),SW_HIDE); - ShowWindow(GetDlgItem(Dialog,IDC_RES_UNICODE),SW_HIDE); - end; - sresString: begin - ShowWindow(GetDlgItem(Dialog,IDC_RES_FREEMEM),SW_SHOW); - ShowWindow(GetDlgItem(Dialog,IDC_RES_UNICODE),SW_SHOW); - end; - end; - end; - - IDC_FLAG_WPAR,IDC_FLAG_LPAR: begin - if loword(wParam)=IDC_FLAG_WPAR then - begin - wnd :=GetDlgItem(Dialog,IDC_EDIT_WPAR); - wnd1:=GetDlgItem(Dialog,IDC_WSTRUCT); - end - else - begin - wnd :=GetDlgItem(Dialog,IDC_EDIT_LPAR); - wnd1:=GetDlgItem(Dialog,IDC_LSTRUCT); - end; - i:=CB_GetData(GetDlgItem(Dialog,loword(wParam))); - - if i=ptStruct then - begin - ShowEditField(wnd,SW_HIDE); - ShowWindow(wnd1,SW_SHOW); - end - else - begin - ShowEditField(wnd,SW_SHOW); - ShowWindow(wnd1,SW_HIDE); - if i in [ptCurrent,ptResult,ptParam] then - EnableEditField(wnd,false) - else - begin - if i=ptNumber then - begin - pcw:='0'; - SendMessageW(wnd,WM_SETTEXT,0,TLParam(pcw)); - end; - EnableEditField(wnd,true); - end; - end; - end; - - IDC_EDIT_SERVICE: ReloadService(Dialog,true); - end; - if not NoProcess then - SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0); - end; - - BN_CLICKED: begin - case loword(wParam) of - IDC_WSTRUCT, IDC_LSTRUCT: begin - pc:=pAnsiChar(GetWindowLongPtrW(lParam,GWLP_USERDATA)); -//!!!! - pc1:=EditStructure(pAnsiChar(pc),Dialog); - if pc1<>nil then - begin - mFreeMem(pc); - SetWindowLongPtrW(lParam,GWLP_USERDATA,long_ptr(pc1)); - SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0); - end; - end; - else - SendMessage(GetParent(GetParent(Dialog)),PSM_CHANGED,0,0); - end; - end; - - end; end; - +} WM_HELP: begin - pc:=ApiCard.NameFromList(GetDlgItem(Dialog,IDC_EDIT_SERVICE)); - ApiCard.Service:=pc; - mFreeMem(pc); - ApiCard.Show; + ServiceBlock:=GetWindowLongPtrW(Dialog,GWLP_USERDATA); + SendMessage(ServiceBlock,WM_HELP,0,0); result:=1; end; diff --git a/plugins/Actman30/iac_service.rc b/plugins/Actman30/iac_service.rc index 10160c5361..ff9f972ff4 100644 --- a/plugins/Actman30/iac_service.rc +++ b/plugins/Actman30/iac_service.rc @@ -1,4 +1,3 @@ -#include "i_cnst_service.inc" LANGUAGE 0,0 @@ -7,26 +6,6 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0 { - GROUPBOX "Result" , -1, 1, 0, 166, 64, WS_GROUP - RTEXT "Result type" , -1 , 4, 10, 159, 11 - COMBOBOX IDC_SRV_RESULT , 4, 21, 159, 76, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL - AUTOCHECKBOX "Free memory" , IDC_RES_FREEMEM, 4, 38, 159, 11 - AUTOCHECKBOX "Unicode string", IDC_RES_UNICODE, 4, 50, 159, 11 - - RTEXT "Service name", -1, 1, 68, 160, 8 - COMBOBOX IDC_EDIT_SERVICE , 1, 78, 166, 96, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL | CBS_SORT - - RTEXT "wParam type", -1, 1, 101, 63, 14, SS_CENTERIMAGE - COMBOBOX IDC_FLAG_WPAR, 66, 101, 102, 56, CBS_DROPDOWNLIST | WS_VSCROLL -// RTEXT "wParam" , -1, 1, 116, 160, 8 - COMBOBOX IDC_EDIT_WPAR, 1, 116, 166, 76, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL - PUSHBUTTON "Structure" , IDC_WSTRUCT , 1, 116, 166, 14 - - RTEXT "lParam type", -1, 1, 142, 63, 14, SS_CENTERIMAGE - COMBOBOX IDC_FLAG_LPAR, 66, 142, 102, 56, CBS_DROPDOWNLIST | WS_VSCROLL -// RTEXT "lParam" , -1, 1, 157, 160, 8 - COMBOBOX IDC_EDIT_LPAR, 1, 157, 166, 76, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL - PUSHBUTTON "Structure" , IDC_LSTRUCT , 1, 157, 166, 14 } IDI_SERVICE ICON "ico\service.ico" diff --git a/plugins/Actman30/services.ini b/plugins/Actman30/services.ini index 853155450d..f40d814f67 100644 --- a/plugins/Actman30/services.ini +++ b/plugins/Actman30/services.ini @@ -11,10 +11,10 @@ ;if "return" starts from int/hex/str/struct then separator, result type will set -;[Event:Event (name or constant] +;[Event:Event (name or constant)] ;alias=constant name ;descr=text -;plugin=placement (including "core" and empty = "unknown" +;plugin=placement (including "core" and empty = "unknown") ;wparam= ;lparam= @@ -23,6 +23,14 @@ ;descr: structure description ;plugin: where defined +[Service:DB/UI/ChangePassword] +alias=MS_DB_CHANGEPASSWORD +wparam=0 +lparam=0 +return=0 +descr=Show window for new/changed profile password +plugin=db3x_mmap + [Service:CListFrames/HideALLFramesTB] alias=MS_CLIST_FRAMES_HIDEALLFRAMESTB wparam=0 @@ -280,7 +288,14 @@ alias=MS_PROTO_CALLCONTACTSERVICE wparam=0 lparam=structure|0|native|b.ptr|native|native| return=result of protocol service call -descr=send a general request through the protocol chain for a contact +descr=Send a general request through the protocol chain for a contact + +[Service:Proto/GetContactBaseAccount] +alias=MS_PROTO_GETCONTACTBASEACCOUNT +wparam=hContact +lparam=0 +return=str, account name +descr=Return account name associated to contact (no need to free it) [Service:Protos/ShowAccountManager] alias=MS_PROTO_SHOWACCMGR @@ -464,7 +479,7 @@ lparam=0 [Event:CList/DoubleClicked] alias=ME_CLIST_DOUBLECLICKED plugin=contact list -descr='Double click on the CList' +descr='Double click on the contact list' wparam=hContact lparam=0 diff --git a/plugins/Actman30/sparam.pas b/plugins/Actman30/sparam.pas deleted file mode 100644 index e29d375ae4..0000000000 --- a/plugins/Actman30/sparam.pas +++ /dev/null @@ -1,708 +0,0 @@ -unit sparam; - -interface - -uses windows,iac_global; - -const - ACF_PARNUM = $00000001; // Param is number - ACF_UNICODE = $00000002; // Param is Unicode string - ACF_CURRENT = $00000004; // Param is ignored, used current user handle - // from current message window - ACF_RESULT = $00000008; // Param is previous action result - ACF_PARAM = $00000010; // Param is Call parameter - ACF_STRUCT = $00000020; - ACF_PARTYPE = ACF_PARNUM or ACF_UNICODE or - ACF_CURRENT or ACF_RESULT or - ACF_PARAM or ACF_STRUCT; - ACF_TEMPLATE = $00000800; - ACF_SCRIPT_PARAM = $00001000; - // dummy - ACF_STRING = 0; - - ACF_RSTRING = $00010000; // Service result is string - ACF_RUNICODE = $00020000; // Service result is Widestring - ACF_RSTRUCT = $00040000; // Service result in structure - ACF_RFREEMEM = $00080000; // Need to free memory - -function CreateParamBlock(parent:HWND;x,y,width:integer):THANDLE; -procedure ClearParamFields(Dialog:HWND); -function FillParam (Dialog:HWND;txt:pAnsiChar):integer; -function SetParamValue (Dialog:HWND; flags:dword; value:pointer):boolean; -function GetParamValue (Dialog:HWND;var flags:dword;var value:pointer):boolean; - -procedure ClearParam (flags:dword; var param); -function DuplicateParam(flags:dword; var sparam,dparam):dword; - -procedure PreProcess(flags:dword;var l_param:LPARAM;const WorkData:tWorkData); - -function CreateResultBlock(parent:HWND;x,y,width:integer):THANDLE; -procedure ClearResultFields(Dialog:HWND); -function SetResultValue(Dialog:HWND;flags:dword):integer; -function GetResultValue(Dialog:HWND):dword; - -implementation - -uses - messages, - common, editwrapper, wrapper, syswin, - m_api, sedit, strans, mirutils; - -{$include i_sparam_const.inc} -{$resource sparam.res} - -const - ptNumber = 0; - ptString = 1; - ptUnicode = 2; - ptCurrent = 3; - ptResult = 4; - ptParam = 5; - ptStruct = 6; - -const - sresInt = 0; - sresString = 1; - sresWide = 2; - sresStruct = 3; - -//----- Processing functions ----- - -procedure PreProcess(flags:dword;var l_param:LPARAM;const WorkData:tWorkData); -var - tmp1:pWideChar; -begin - with WorkData do - begin - if (flags and ACF_STRUCT)<>0 then - begin - l_param:=uint_ptr(MakeStructure(pAnsiChar(l_param),Parameter,LastResult,ResultType)) - end - else if (flags and ACF_PARAM)<>0 then - begin - l_param:=Parameter; - end - else if (flags and ACF_RESULT)<>0 then - begin - l_param:=LastResult; - end - else if (flags and ACF_CURRENT)<>0 then - begin - l_param:=WndToContact(WaitFocusedWndChild(GetForegroundwindow){GetFocus}); - end - else - begin - if (flags and ACF_SCRIPT_PARAM)<>0 then - l_param:=uint_ptr(ParseVarString(pWideChar(l_param),Parameter)); - - tmp1:=pWideChar(l_param); - if (flags and ACF_PARNUM)=0 then - begin - if (flags and ACF_UNICODE)=0 then - WideToAnsi(tmp1,pAnsiChar(l_param),MirandaCP) - else - StrDupW(pWideChar(l_param),tmp1); - end - else - l_param:=NumToInt(tmp1); - - if (flags and ACF_SCRIPT_PARAM)<>0 then - mFreeMem(tmp1); - end; - end; -end; - -procedure PostProcess(flags:dword;var l_param:LPARAM; var WorkData:tWorkData); -var - code:integer; - len:integer; - pc:pAnsiChar; -begin - if (flags and ACF_STRUCT)<>0 then - begin - with WorkData do - begin - LastResult:=GetStructureResult(l_param,@code,@len); - case code of -{ - SST_LAST: begin - result:=LastResult; - end; -} - SST_PARAM: begin //?? - LastResult:=Parameter; - ResultType:=rtInt; - end; - SST_BYTE,SST_WORD,SST_DWORD, - SST_QWORD,SST_NATIVE: begin - ResultType:=rtInt; - end; - SST_BARR: begin - StrDup(pAnsiChar(pc),pAnsiChar(LastResult),len); - AnsiToWide(pAnsiChar(pc),PWideChar(LastResult),MirandaCP); - mFreeMem(pAnsiChar(pc)); - ResultType:=rtWide; - end; - SST_WARR: begin - StrDupW(pWideChar(LastResult),pWideChar(LastResult),len); - ResultType:=rtWide; - end; - SST_BPTR: begin - AnsiToWide(pAnsiChar(LastResult),pWideChar(LastResult),MirandaCP); - ResultType:=rtWide; - end; - SST_WPTR: begin - StrDupW(pWideChar(LastResult),pWideChar(LastResult)); - ResultType:=rtWide; - end; - end; - FreeStructure(l_param); - l_param:=0; - end - end; -end; - -//----- Dialog functions ----- - -procedure MakeParamTypeList(wnd:HWND); -begin - SendMessage(wnd,CB_RESETCONTENT,0,0); - InsertString(wnd,ptNumber ,'number value'); - InsertString(wnd,ptString ,'ANSI string'); - InsertString(wnd,ptUnicode,'Unicode string'); - InsertString(wnd,ptCurrent,'current contact'); - InsertString(wnd,ptResult ,'last result'); - InsertString(wnd,ptParam ,'parameter'); - InsertString(wnd,ptStruct ,'structure'); - SendMessage(wnd,CB_SETCURSEL,0,0); -end; - -function IsParamNumber(txt:pAnsiChar):boolean; -begin - if (txt[0] in ['0'..'9']) or ((txt[0]='-') and (txt[1] in ['0'..'9'])) or - ((txt[0]='$') and (txt[1] in sHexNum)) or - ((txt[0]='0') and (txt[1]='x') and (txt[2] in sHexNum)) then - result:=true - else - result:=false; -end; - -// Set parameter type by parameter template -function FixParam(buf:PAnsiChar):integer; -begin - if StrCmp(buf,'hContact' )=0 then result:=ptCurrent - else if StrCmp(buf,'parameter' )=0 then result:=ptParam - else if StrCmp(buf,'result' )=0 then result:=ptResult - else if StrCmp(buf,'structure' )=0 then result:=ptStruct - else if StrCmp(buf,'Unicode text')=0 then result:=ptUnicode - else result:=ptString; -end; - -// get line from template -function GetParamLine(src:pAnsiChar;dst:pWideChar;var ltype:integer):pAnsiChar; -var - pp,pc:pAnsiChar; - savechar:AnsiChar; - j:integer; -begin - pc:=StrScan(src,'|'); - - if pc<>nil then - begin - savechar:=pc^; - pc^:=#0; - end; - - if IsParamNumber(src) then - begin - j:=0; - pp:=src; - repeat - dst[j]:=WideChar(pp^); - inc(j); inc(pp); - until (pp^=#0) or (pp^=' '); - dst[j]:=WideChar(pp^); // anyway, #0 or " " needs - if pp^<>#0 then - begin - dst[j+1]:='-'; dst[j+2]:=' '; inc(j,3); - FastAnsitoWideBuf(pp+1,dst+j); - StrCopyW(dst+j,TranslateW(dst+j)); - end; - ltype:=ptNumber; - end - else - begin - ltype:=FixParam(src); - StrCopyW(dst,TranslateW(FastAnsitoWideBuf(src,dst))); - end; - - if pc<>nil then - begin - pc^:=savechar; - inc(pc); - end; - - result:=pc; -end; - -// Set parameter value by parameter template -function FillParam(Dialog:HWND;txt:pAnsiChar):integer; -var - bufw:array [0..2047] of WideChar; - wnd:HWND; - p,pc:PAnsiChar; - ltype:integer; -begin - wnd:=GetDlgItem(Dialog,IDC_EDIT_PAR); - SendMessage(wnd,CB_RESETCONTENT,0,0); - if (txt<>nil) and (txt^<>#0) then - begin - result:=-1; - p:=txt; - repeat - pc:=GetParamLine(p,bufw,ltype); - if result<0 then - result:=ltype; - SendMessageW(wnd,CB_ADDSTRING,0,lparam(@bufw)); - - if result=ptStruct then - break - else - p:=pc; - until pc=nil; - end - else - result:=ptNumber; - SendMessage(wnd,CB_SETCURSEL,0,0); -end; - -procedure ClearParamFields(Dialog:HWND); -var - wnd:HWND; -begin - ShowWindow(GetDlgItem(Dialog,IDC_STRUCT),SW_HIDE); - wnd:=GetDlgItem(Dialog,IDC_EDIT_PAR); - ShowEditField (wnd,SW_SHOW); - EnableEditField(wnd,true); - SendMessage (wnd,CB_RESETCONTENT,0,0); - SetEditFlags (wnd,EF_ALL,0); - CB_SelectData(Dialog,IDC_FLAG_PAR,ptNumber); -end; - -function ParamDlgResizer(Dialog:HWND;lParam:LPARAM;urc:PUTILRESIZECONTROL):int; cdecl; -begin - case urc^.wId of - IDC_FLAG_PAR: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; //RD_ANCHORX_RIGHT - IDC_EDIT_PAR: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; - IDC_STRUCT: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; - IDC_STAT_PAR: result:=RD_ANCHORX_LEFT or RD_ANCHORY_TOP; -// IDC_CLOSE: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; - else - result:=0; - end; -end; - -function DlgParamProc(Dialog:HWnd;hMessage:uint;wParam:WPARAM;lParam:LPARAM):lresult; stdcall; -var - wnd,wnd1:HWND; - i:integer; - pcw:pWideChar; - pc:pAnsiChar; - urd:TUTILRESIZEDIALOG; -begin - result:=0; - - case hMessage of - WM_DESTROY: begin - pc:=pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_STRUCT),GWLP_USERDATA)); - mFreeMem(pc); - end; - - WM_INITDIALOG: begin - MakeEditField(Dialog,IDC_EDIT_PAR); - - MakeParamTypeList(GetDlgItem(Dialog,IDC_FLAG_PAR)); - end; - - WM_SIZE: begin - FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0); - urd.cbSize :=SizeOf(urd); - urd.hwndDlg :=Dialog; - urd.hInstance :=hInstance; - urd.lpTemplate:=MAKEINTRESOURCEA('IDD_SPARAM'); - urd.lParam :=0; - urd.pfnResizer:=@ParamDlgResizer; - CallService(MS_UTILS_RESIZEDIALOG,0,tlparam(@urd)); - end; - - WM_SHOWWINDOW: begin - // hide window by ShowWindow function - if (lParam=0) and (wParam=0) then - begin - pc:=pAnsiChar(SetWindowLongPtrW(GetDlgItem(Dialog,IDC_STRUCT),GWLP_USERDATA,0)); - mFreeMem(pc); - end; - end; - - WM_COMMAND: begin - case wParam shr 16 of - CBN_EDITCHANGE, - EN_CHANGE: begin - SendMessage(GetParent(Dialog),WM_COMMAND,CBN_EDITCHANGE shl 16,Dialog); - end; - - CBN_SELCHANGE: begin - SendMessage(GetParent(Dialog),WM_COMMAND,CBN_EDITCHANGE shl 16,Dialog); - case loword(wParam) of - IDC_FLAG_PAR: begin - wnd :=GetDlgItem(Dialog,IDC_EDIT_PAR); - wnd1:=GetDlgItem(Dialog,IDC_STRUCT); - - i:=CB_GetData(GetDlgItem(Dialog,loword(wParam))); - - if i=ptStruct then - begin - ShowEditField(wnd ,SW_HIDE); - ShowWindow (wnd1,SW_SHOW); - end - else - begin - ShowEditField(wnd ,SW_SHOW); - ShowWindow (wnd1,SW_HIDE); - - if i in [ptCurrent,ptResult,ptParam] then - EnableEditField(wnd,false) - else - begin - if i=ptNumber then - begin - pcw:='0'; - SendMessageW(wnd,WM_SETTEXT,0,TLParam(pcw)); - end; - EnableEditField(wnd,true); - end; - end; - end; - end; - end; - end; - end; - end; -end; - -//----- Common interface functions ----- - -function CreateParamBlock(parent:HWND;x,y,width:integer):THANDLE; -var - rc,rc1:TRECT; -begin - SetRect(rc,x,y,x+width,y+0{dlgheight}); - MapDialogRect(parent,rc); - - result:=CreateDialogW(hInstance,'IDD_SPARAM',parent,@DlgParamProc); - GetClientRect(result,rc1); - SetWindowPos(result,0, - x,y{rc.left,rc.top},rc.right-rc.left,rc1.bottom-rc1.top, - SWP_NOZORDER); -end; - -// if separate -function DestroyBlock(block:pointer):integer; -begin - result:=0; -end; - -function SetParamValue(Dialog:HWND;flags:dword;value:pointer):boolean; -var - wnd,wnd1:HWND; - pc:pAnsiChar; - vtype:integer; -begin - result:=true; -//?? Check for "Apply" activation - - wnd:=GetDlgItem(Dialog,IDC_EDIT_PAR); - if (flags and ACF_TEMPLATE)<>0 then - begin - vtype:=FillParam(Dialog,value); - end - else if (flags and ACF_PARAM)<>0 then - begin - SendMessageW(wnd,WM_SETTEXT,0,LPARAM(TranslateW('Parameter'))); - EnableWindow(wnd,false); - vtype:=ptParam; - end - else if (flags and ACF_RESULT)<>0 then - begin - SendMessageW(wnd,WM_SETTEXT,0,LPARAM(TranslateW('Last result'))); - EnableWindow(wnd,false); - vtype:=ptResult; - end - else if (flags and ACF_CURRENT)<>0 then - begin - SendMessageW(wnd,WM_SETTEXT,0,LPARAM(TranslateW('Current user'))); - EnableWindow(wnd,false); - vtype:=ptCurrent; - end - else if (flags and ACF_STRUCT)<>0 then - begin - vtype:=ptStruct; - - ShowEditField(wnd,SW_HIDE); - wnd1:=GetDlgItem(Dialog,IDC_STRUCT); - ShowWindow(wnd1,SW_SHOW); - // delete old value - pc:=pAnsiChar(GetWindowLongPtrW(wnd1,GWLP_USERDATA)); - mFreeMem(pc); - // set newly allocated - SetWindowLongPtrW(wnd1,GWLP_USERDATA,long_ptr(StrDup(pc,pAnsiChar(value)))); -//!!!!!!!! - end - else if (flags and ACF_PARNUM)<>0 then - begin - vtype:=ptNumber; - SendMessageW(wnd,WM_SETTEXT,0,LPARAM(value)); - end - else if (flags and ACF_UNICODE)<>0 then - begin - vtype:=ptUnicode; - SendMessageW(wnd,WM_SETTEXT,0,LPARAM(value)); - end - else - begin - vtype:=ptString; - SendMessageW(wnd,WM_SETTEXT,0,LPARAM(value)); - end; - SetEditFlags(wnd,EF_SCRIPT,ord((flags and ACF_SCRIPT_PARAM)<>0)); - - CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_PAR),vtype); -end; - -function GetParamValue(Dialog:HWND;var flags:dword;var value:pointer):boolean; -var - wnd:HWND; -begin - result:=true; - flags:=0; - value:=nil; - wnd:=GetDlgItem(Dialog,IDC_EDIT_PAR); - case CB_GetData(GetDlgItem(Dialog,IDC_FLAG_PAR)) of - ptParam: begin - flags:=flags or ACF_PARAM - end; - ptResult: begin - flags:=flags or ACF_RESULT - end; - ptCurrent: begin - flags:=flags or ACF_CURRENT - end; - ptNumber: begin - flags:=flags or ACF_PARNUM; - value:=GetDlgText(wnd); - end; - ptStruct: begin - flags:=flags or ACF_STRUCT; - StrDup(pAnsiChar(value), - pAnsiChar(GetWindowLongPtrW(GetDlgItem(Dialog,IDC_STRUCT),GWLP_USERDATA))); - end; - ptUnicode: begin - flags:=flags or ACF_UNICODE; - value:=GetDlgText(wnd); - end; - ptString: value:=GetDlgText(wnd); - end; - if (GetEditFlags(wnd) and EF_SCRIPT)<>0 then - flags:=flags or ACF_SCRIPT_PARAM; -end; - -procedure ClearParam(flags:dword; var param); -begin - if (flags and (ACF_CURRENT or ACF_RESULT or ACF_PARAM))=0 then - mFreeMem(pointer(param)); -end; - -function DuplicateParam(flags:dword; var sparam,dparam):dword; -var - tmpdst:array [0..2047] of WideChar; - ltype:integer; -begin - mFreeMem(dparam); - - if (flags and ACF_TEMPLATE)<>0 then - begin - flags:=flags and not (ACF_TEMPLATE or ACF_PARTYPE); - GetParamLine(pAnsiChar(sparam),tmpdst,ltype); - case ltype of - ptNumber: begin - flags:=flags or ACF_PARNUM; - StrDupW(pWideChar(dparam),pWideChar(@tmpdst)); - end; - ptString: begin - flags:=flags or ACF_STRING; - StrDupW(pWideChar(dparam),pWideChar(@tmpdst)); - end; - ptUnicode: begin - flags:=flags or ACF_UNICODE; - StrDupW(pWideChar(dparam),pWideChar(@tmpdst)); - end; - ptStruct: begin - flags:=flags or ACF_STRUCT; - StrDup(pAnsiChar(dparam),pAnsiChar(sparam)+10); //10=StrLen('structure|') - end; - ptCurrent: flags:=flags or ACF_CURRENT; - ptResult : flags:=flags or ACF_RESULT; - ptParam : flags:=flags or ACF_PARAM; - end; - end - else if (flags and (ACF_CURRENT or ACF_RESULT or ACF_PARAM))=0 then - begin - if (flags and ACF_PARNUM)<>0 then - StrDupW(pWideChar(dparam),pWideChar(sparam)) - else if (flags and ACF_STRUCT)<>0 then - StrDup(pAnsiChar(dparam),pAnsiChar(sparam)) - else if (flags and ACF_UNICODE)<>0 then - StrDupW(pWideChar(dparam),pWideChar(sparam)) - else - StrDupW(pWideChar(dparam),pWideChar(sparam)); - end; - result:=flags; -end; - -//----- result block ----- - -procedure MakeResultTypeList(wnd:HWND); -begin - SendMessage(wnd,CB_RESETCONTENT,0,0); - InsertString(wnd,sresInt ,'Integer'); - InsertString(wnd,sresString,'String'); - InsertString(wnd,sresWide ,'Wide String'); - InsertString(wnd,sresStruct,'Structure'); - SendMessage(wnd,CB_SETCURSEL,0,0); -end; - -function ResultDlgResizer(Dialog:HWND;lParam:LPARAM;urc:PUTILRESIZECONTROL):int; cdecl; -begin - case urc^.wId of - IDC_RES_TYPE : result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; //RD_ANCHORX_RIGHT - IDC_RES_FREEMEM: result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; - IDC_RES_STAT : result:=RD_ANCHORX_LEFT or RD_ANCHORY_TOP; - IDC_RES_GROUP : result:=RD_ANCHORX_WIDTH or RD_ANCHORY_TOP; - else - result:=0; - end; -end; - -procedure ClearResultFields(Dialog:HWND); -begin - CheckDlgButton(Dialog,IDC_RES_FREEMEM,BST_UNCHECKED); - ShowWindow(GetDlgItem(Dialog,IDC_RES_FREEMEM),SW_HIDE); - CB_SelectData(Dialog,IDC_RES_TYPE,sresInt); -end; - -function DlgResultProc(Dialog:HWnd;hMessage:uint;wParam:WPARAM;lParam:LPARAM):lresult; stdcall; -var - urd:TUTILRESIZEDIALOG; - i:integer; -begin - result:=0; - - case hMessage of - WM_INITDIALOG: begin - MakeResultTypeList(GetDlgItem(Dialog,IDC_RES_TYPE)); - end; - - WM_SIZE: begin - FillChar(urd,SizeOf(TUTILRESIZEDIALOG),0); - urd.cbSize :=SizeOf(urd); - urd.hwndDlg :=Dialog; - urd.hInstance :=hInstance; - urd.lpTemplate:=MAKEINTRESOURCEA('IDD_SRESULT'); - urd.lParam :=0; - urd.pfnResizer:=@ResultDlgResizer; - CallService(MS_UTILS_RESIZEDIALOG,0,tlparam(@urd)); - end; - - WM_COMMAND: begin - case wParam shr 16 of - CBN_SELCHANGE: begin - case loword(wParam) of - IDC_RES_TYPE: begin - case CB_GetData(lParam) of - sresInt,sresStruct: begin - i:=SW_HIDE; - end; - sresString,sresWide: begin - i:=SW_SHOW; - end; - end; - ShowWindow(GetDlgItem(Dialog,IDC_RES_FREEMEM),i); - end; - end; - end; - end; - end; - end; -end; - -function CreateResultBlock(parent:HWND;x,y,width:integer):THANDLE; -var - rc,rc1:TRECT; -begin - SetRect(rc,x,y,x+width,y+0{dlgheight}); - MapDialogRect(parent,rc); - - result:=CreateDialogW(hInstance,'IDD_SRESULT',parent,@DlgResultProc); - GetClientRect(result,rc1); - SetWindowPos(result,0, - x,y{rc.left,rc.top},rc.right-rc.left,rc1.bottom-rc1.top, - SWP_NOZORDER); -end; - -function SetResultValue(Dialog:HWND;flags:dword):integer; -var - btn:integer; -begin - // RESULT - if (flags and ACF_RSTRUCT)<>0 then - result:=sresStruct - else if (flags and ACF_RSTRING)<>0 then - begin - if (flags and ACF_RFREEMEM)<>0 then - btn:=BST_CHECKED - else - btn:=BST_UNCHECKED; - CheckDlgButton(Dialog,IDC_RES_FREEMEM,btn); - - if (flags and ACF_RUNICODE)<>0 then - result:=sresWide - else - result:=sresString; - end - else - begin - result:=sresInt; - end; - CB_SelectData(Dialog,IDC_RES_TYPE,result); -end; - -function GetResultValue(Dialog:HWND):dword; -begin - case CB_GetData(GetDlgItem(Dialog,IDC_RES_TYPE)) of - sresString: begin - result:=ACF_RSTRING; - if IsDlgButtonChecked(Dialog,IDC_RES_FREEMEM)=BST_CHECKED then - result:=result or ACF_RFREEMEM; - end; - sresWide: begin - result:=ACF_RSTRING or ACF_RUNICODE; - if IsDlgButtonChecked(Dialog,IDC_RES_FREEMEM)=BST_CHECKED then - result:=result or ACF_RFREEMEM; - end; - sresStruct: result:=ACF_RSTRUCT; - else - result:=0; - end; - -end; - -end. diff --git a/plugins/Actman30/sparam.rc b/plugins/Actman30/sparam.rc deleted file mode 100644 index a36fc5b680..0000000000 --- a/plugins/Actman30/sparam.rc +++ /dev/null @@ -1,27 +0,0 @@ -#include "i_sparam_const.inc" - -LANGUAGE 0,0 - -IDD_SPARAM DIALOGEX 0, 0, 168, 31, 0 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0 -{ -// PUSHBUTTON "open/close" , IDC_CLOSE , 1, 116, 166, 14 - RTEXT "wParam type", IDC_STAT_PAR, 1, 1, 63, 14, SS_CENTERIMAGE - COMBOBOX IDC_FLAG_PAR, 66, 1, 102, 56, CBS_DROPDOWNLIST | WS_VSCROLL -// RTEXT "wParam" , -1, 1, 116, 160, 8 - COMBOBOX IDC_EDIT_PAR, 1, 16, 166, 76, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL - PUSHBUTTON "Structure" , IDC_STRUCT , 1, 16, 166, 14 -} - -IDD_SRESULT DIALOGEX 0, 0, 168, 53, 0 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0 -{ - GROUPBOX "Result" , IDC_RES_GROUP , 1, 0, 166, 50, WS_GROUP - RTEXT "Result type" , IDC_RES_STAT , 4, 9, 159, 11 - COMBOBOX IDC_RES_TYPE , 4, 20, 159, 76, CBS_DROPDOWN | WS_VSCROLL | CBS_AUTOHSCROLL - AUTOCHECKBOX "Free memory" , IDC_RES_FREEMEM, 4, 36, 159, 11 -} diff --git a/plugins/Actman30/tasks/i_opt_dlg.inc b/plugins/Actman30/tasks/i_opt_dlg.inc index c8025c278d..e6797e3a9a 100644 --- a/plugins/Actman30/tasks/i_opt_dlg.inc +++ b/plugins/Actman30/tasks/i_opt_dlg.inc @@ -275,13 +275,14 @@ function DeleteTask(Dialog:HWND):integer; var li:LV_ITEM; wnd:HWND; - i:integer; + i,j:integer; begin result:=0; wnd:=GetDlgItem(Dialog,IDC_TASK_NAME); - for i:=ListView_GetItemCount(wnd)-1 downto 0 do + j:=SendMessage(wnd,LVM_GETITEMCOUNT,0,0); + for i:=j-1 downto 0 do begin - if ListView_GetItemState(wnd,i,LVIS_SELECTED)<>0 then + if SendMessage(wnd,LVM_GETITEMSTATE,i,LVIS_SELECTED)<>0 then begin li.iItem :=i; li.mask :=LVIF_PARAM; diff --git a/plugins/Actman30/ua/i_opt_dlg.inc b/plugins/Actman30/ua/i_opt_dlg.inc index b7ff28483a..643aa253b7 100644 --- a/plugins/Actman30/ua/i_opt_dlg.inc +++ b/plugins/Actman30/ua/i_opt_dlg.inc @@ -372,7 +372,7 @@ begin li.iItem :=i; li.lParam :=i; li.pszText :=UActionList[i].szActDescr; - li.iImage:=ImageList_AddIcon(il, + 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)); @@ -405,7 +405,7 @@ begin li.mask :=LVIF_IMAGE; li.iSubItem:=0; li.iItem :=i; - li.iImage:=ImageList_AddIcon(il, + li.iImage:=ImageList_ReplaceIcon(il, -1, HICON(CallService(MS_SKIN2_GETICONBYHANDLE,0,TLPARAM(UActionList[i].hIcolibIcon)))); SendMessageW(wnd,LVM_SETITEM,0,TLPARAM(@li)); end; diff --git a/plugins/Actman30/ua/i_uaplaces.inc b/plugins/Actman30/ua/i_uaplaces.inc index bbd6571aaa..4bd8d18bd0 100644 --- a/plugins/Actman30/ua/i_uaplaces.inc +++ b/plugins/Actman30/ua/i_uaplaces.inc @@ -463,7 +463,7 @@ begin end; -function PreBuildMenu(mtype:tMenuType;hContact:THANDLE=0):int; +function PreBuildMenu(mtype:tMenuType;hContact:HCONTACT=0):int; var i:integer; mi:TCListMenuItem; -- cgit v1.2.3