From 8ef40f0bd018c6f9295977c206714db8d1e6159c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 1 Mar 2013 23:11:39 +0000 Subject: code cleanup for pascal plugins git-svn-id: http://svn.miranda-ng.org/main/trunk@3828 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Actman/i_action.inc | 5 +- plugins/Actman/i_opt_dlg2.inc | 25 +++----- plugins/Utils.pas/mApiCardM.pas | 8 +-- plugins/Utils.pas/old/mApiCardC.pas | 6 +- plugins/Watrack/kolframe/frm_dlg1.inc | 2 +- plugins/Watrack/stat/statlog.pas | 7 +-- plugins/Watrack/waticons.pas | 6 +- plugins/mRadio/i_bass.inc | 13 ++-- plugins/mRadio/i_optdlg.inc | 30 +++------- plugins/mRadio/i_search.inc | 109 ---------------------------------- 10 files changed, 31 insertions(+), 180 deletions(-) diff --git a/plugins/Actman/i_action.inc b/plugins/Actman/i_action.inc index 1dd9719d35..390f745bf8 100644 --- a/plugins/Actman/i_action.inc +++ b/plugins/Actman/i_action.inc @@ -198,7 +198,7 @@ begin vars1:=false; tmpp:=replPrg; end; - + if StrScanW(tmpp,'%')<>nil then begin mGetMem(replPrg1,8192*SizeOf(WideChar)); @@ -263,7 +263,7 @@ begin begin if (flags2 and ACF2_SRV_SRVC)<>0 then lservice:=ParseVarString(lservice,Param); - + StrCopy(buf,lservice); if StrPos(lservice,protostr)<>nil then if CallService(MS_DB_CONTACT_IS,Param,0)=0 then @@ -677,7 +677,6 @@ begin begin StrDeleteW(dst,i shr 16,loword(i)); ConvertFileName(r.text,buf); -// CallService(MS_UTILS_PATHTOABSOLUTE,dword(r.text),dword(@buf)); lp:=GetFileString(@buf,r.one); if lp<>nil then begin diff --git a/plugins/Actman/i_opt_dlg2.inc b/plugins/Actman/i_opt_dlg2.inc index 3c6b4e974b..96846bd3ef 100644 --- a/plugins/Actman/i_opt_dlg2.inc +++ b/plugins/Actman/i_opt_dlg2.inc @@ -297,7 +297,7 @@ begin SendMessage(ti.uId,BM_SETIMAGE,IMAGE_ICON, CallService(MS_SKIN_LOADICON,SKINICON_OTHER_HELP,0)); SendMessageW(hwndTooltip,TTM_ADDTOOLW,0,lparam(@ti)); - + ti.uId :=GetDlgItem(Dialog,IDC_ACTION_NEW); ti.lpszText:=TranslateW('New'); SetButtonIcon(ti.uId,ACI_NEW); @@ -820,7 +820,7 @@ function DlgProcOpt2(Dialog:HWnd;hMessage:uint;wParam:WPARAM;lParam:LPARAM):lres if IsDlgButtonChecked(Dialog,IDC_CNT_KEEP)=BST_CHECKED then flags:=flags or ACF_KEEPONLY; end; - + ACT_SERVICE: begin if IsDlgButtonChecked(Dialog,IDC_SRV_WPAR)=BST_CHECKED then flags2:=flags2 or ACF2_SRV_WPAR; @@ -914,15 +914,6 @@ function DlgProcOpt2(Dialog:HWnd;hMessage:uint;wParam:WPARAM;lParam:LPARAM):lres ACT_PROGRAM: begin prgname:=GetDlgText(Dialog,IDC_EDIT_PRGPATH); - { - p:=GetDlgText(IDC_EDIT_PRGPATH); - if p<>nil then - begin - CallService(MS_UTILS_PATHTORELATIVE,dword(p),dword(@buf)); - StrDupW(prgname,@buf); - mFreeMem(p); - end; - } args:=GetDlgText(Dialog,IDC_EDIT_PRGARGS); if IsDlgButtonChecked(Dialog,IDC_FLAG_PARALLEL)=BST_CHECKED then flags:=flags or ACF_PRTHREAD; @@ -987,7 +978,7 @@ function DlgProcOpt2(Dialog:HWnd;hMessage:uint;wParam:WPARAM;lParam:LPARAM):lres else if IsDlgButtonChecked(Dialog,IDC_FLAG_EQ )=BST_CHECKED then condition:=ADV_COND_EQ; value:=GetDlgItemInt(Dialog,IDC_ADV_VALUE,pbool(nil)^,false); - + if IsDlgButtonChecked(Dialog,IDC_FLAG_NOT)=BST_CHECKED then condition:=condition or ADV_COND_NOT; @@ -1079,7 +1070,7 @@ function DlgProcOpt2(Dialog:HWnd;hMessage:uint;wParam:WPARAM;lParam:LPARAM):lres pWideChar(dbvalue):=GetDlgText(Dialog,IDC_RW_TEXT); end; - if (IsDlgButtonChecked(Dialog,IDC_RW_LAST)=BST_CHECKED) or + if (IsDlgButtonChecked(Dialog,IDC_RW_LAST)=BST_CHECKED) or ((flags and ACF_LAST)<>0) then flags:=flags or ACF_LAST; end; @@ -1369,7 +1360,7 @@ begin EnableWindow(GetDlgItem(Dialog,IDC_GROUP_EXPORT),false); EnableWindow(GetDlgItem(Dialog,IDC_GROUP_IMPORT),false); end; - + OldActTableProc :=pointer(SetWindowLongPtrW(wnd,GWL_WNDPROC,long_ptr(@NewActTableProc))); OldGroupTableProc:=pointer(SetWindowLongPtrW(GetDlgItem(Dialog,IDC_ACTION_GROUP), GWL_WNDPROC,long_ptr(@NewGroupTableProc))); @@ -1429,7 +1420,7 @@ begin end; end; end; - + IDC_ADV_OPER: begin EnableWindow(GetDlgItem(Dialog,IDC_ADV_VAL1), (CB_GetData(lParam)<>lresult(aeNot))); @@ -1596,7 +1587,7 @@ begin i:=SendMessage(wnd,CB_GETITEMDATA,SendMessage(wnd,CB_GETCURSEL,0,0),0); FillContactList(wnd,fCLfilter,fCLformat); - + SendMessage(wnd,CB_SETCURSEL,FindContact(wnd,i),0); end; IDC_HLP_FVARS, @@ -1824,7 +1815,7 @@ begin Listview_SetItemState(wnd,0,LVIS_FOCUSED or LVIS_SELECTED, LVIS_FOCUSED or LVIS_SELECTED); CheckActionList(0); -{ +{ wnd:=GetDlgItem(Dialog,IDC_ACTION_LIST); li.iItem:=SendMessage(wnd,LVM_GETNEXTITEM,-1,LVNI_FOCUSED); //?? if li.iItem>=0 then diff --git a/plugins/Utils.pas/mApiCardM.pas b/plugins/Utils.pas/mApiCardM.pas index ff289168f3..8a3011153d 100644 --- a/plugins/Utils.pas/mApiCardM.pas +++ b/plugins/Utils.pas/mApiCardM.pas @@ -8,8 +8,8 @@ uses windows,messages; type tmApiCard = class private - function GetDescription:pAnsiChar; - function GetResultType :pAnsiChar; + function GetDescription:pAnsiChar; + function GetResultType :pAnsiChar; procedure SetCurrentService(item:pAnsiChar); public constructor Create(fname:pAnsiChar; lparent:HWND=0); @@ -239,7 +239,7 @@ begin SetDlgItemTextA(Dialog,IDC_HLP_ALIAS, GetParamSectionStr(current,'alias','')); - + FastAnsiToWideBuf(GetParamSectionStr(current,'return','Undefined'),tmp); SetDlgItemTextW(Dialog,IDC_HLP_RETURN,TranslateW(tmp)); @@ -367,8 +367,6 @@ begin if fname<>nil then begin ConvertFileName(fname,@INIFile); - // CallService(MS_UTILS_PATHTOABSOLUTE, - // dword(PAnsiChar(ServiceHlpFile)),dword(INIFile)); if GetFSize(pAnsiChar(@INIFile))=0 then begin INIFile[0]:=#0; diff --git a/plugins/Utils.pas/old/mApiCardC.pas b/plugins/Utils.pas/old/mApiCardC.pas index 507bc79d79..7c67443087 100644 --- a/plugins/Utils.pas/old/mApiCardC.pas +++ b/plugins/Utils.pas/old/mApiCardC.pas @@ -8,8 +8,8 @@ uses windows,messages; type tmApiCard = class private - function GetDescription:pAnsiChar; - function GetResultType :pAnsiChar; + function GetDescription:pAnsiChar; + function GetResultType :pAnsiChar; procedure SetCurrentService(item:pAnsiChar); public constructor Create(fname:pAnsiChar; lparent:HWND=0); @@ -371,8 +371,6 @@ begin if fname<>nil then begin ConvertFileName(fname,@INIFile); - // PluginLink^.CallService(MS_UTILS_PATHTOABSOLUTE, - // dword(PAnsiChar(ServiceHlpFile)),dword(INIFile)); if GetFSize(pAnsiChar(@INIFile))=0 then begin INIFile[0]:=#0; diff --git a/plugins/Watrack/kolframe/frm_dlg1.inc b/plugins/Watrack/kolframe/frm_dlg1.inc index 19f590af66..08028a3356 100644 --- a/plugins/Watrack/kolframe/frm_dlg1.inc +++ b/plugins/Watrack/kolframe/frm_dlg1.inc @@ -200,7 +200,7 @@ begin mGetMem(buf1,1024{*SizeOf(WideChar)}); buf1^:=#0; buf:=GetDlgText(Dialog,IDC_FRMBKPIC,true); - CallService(MS_UTILS_PATHTORELATIVE,dword(buf),dword(buf1)); + CallService(MS_UTILS_PATHTORELATIVE,wparam(buf),lparam(buf1)); if StrCmp(buf1,D.BkDefFile)<>0 then begin mFreeMem(D.BkDefFile); diff --git a/plugins/Watrack/stat/statlog.pas b/plugins/Watrack/stat/statlog.pas index 50af34508d..fa49bc5fb0 100644 --- a/plugins/Watrack/stat/statlog.pas +++ b/plugins/Watrack/stat/statlog.pas @@ -358,7 +358,7 @@ begin begin CurCell^.next:=Cell; CurCell:=Cell; - end; + end; end; end; inc(p,2); p1:=p; @@ -414,7 +414,6 @@ var begin Lock:=true; ConvertFileName(fname,buf1); -// CallService(MS_UTILS_PATHTOABSOLUTE,dword(fname),dword(@buf1)); Root:=BuildTree(buf1,buf); if Root<>nil then begin @@ -459,7 +458,6 @@ begin else fname:=PAnsiChar(wParam); ConvertFileName(fname,log); -// CallService(MS_UTILS_PATHTOABSOLUTE,dword(fname),dword(@log)); AppendStat(log,pSongInfo(lParam)); end; @@ -491,9 +489,6 @@ begin ConvertFileName(r,report); ConvertFileName(l,template); ConvertFileName(StatName,log); -// CallService(MS_UTILS_PATHTOABSOLUTE,dword(r),dword(@report)); -// CallService(MS_UTILS_PATHTOABSOLUTE,dword(l),dword(@template)); -// CallService(MS_UTILS_PATHTOABSOLUTE,dword(StatName),dword(@log)); if DoAddExt=BST_CHECKED then ChangeExt(report,'htm'); if StatOut(report,log,template) then diff --git a/plugins/Watrack/waticons.pas b/plugins/Watrack/waticons.pas index 5b61af18dd..94b511767e 100644 --- a/plugins/Watrack/waticons.pas +++ b/plugins/Watrack/waticons.pas @@ -51,14 +51,12 @@ var begin result:=true; sid.szDefaultFile.a:='icons\'+ICOCtrlName; -// ConvertFileName(sid.szDefaultFile.a,buf); CallService(MS_UTILS_PATHTOABSOLUTE,wparam(sid.szDefaultFile),lparam(@buf)); hIconDLL:=LoadLibraryA(buf); if hIconDLL=0 then // not found begin sid.szDefaultFile.a:='plugins\'+ICOCtrlName; -// ConvertFileName(sid.szDefaultFile.a,buf); CallService(MS_UTILS_PATHTOABSOLUTE,wparam(sid.szDefaultFile),lparam(@buf)); hIconDLL:=LoadLibraryA(buf); end; @@ -107,7 +105,7 @@ const ((descr:'Play' ;name:'WATrack_Play' ; id:IDI_PLAY_NORMAL), (descr:'Play Hovered' ;name:'WATrack_PlayH' ; id:IDI_PLAY_HOVERED), (descr:'Play Pushed' ;name:'WATrack_PlayP' ; id:IDI_PLAY_PRESSED)), - + ((descr:'Pause' ;name:'WATrack_Pause' ; id:IDI_PAUSE_NORMAL), (descr:'Pause Hovered' ;name:'WATrack_PauseH' ; id:IDI_PAUSE_HOVERED), (descr:'Pause Pushed' ;name:'WATrack_PauseP' ; id:IDI_PAUSE_PRESSED)), @@ -144,14 +142,12 @@ begin if not IconsLoaded then begin path:='icons\'+ICOCtrlName; -// ConvertFileName(sid.szDefaultFile.a,buf); CallService(MS_UTILS_PATHTOABSOLUTE,wparam(path),lparam(@buf)); hIconDLL:=LoadLibraryA(buf); if hIconDLL=0 then // not found begin sid.szDefaultFile.a:='plugins\'+ICOCtrlName; -// ConvertFileName(sid.szDefaultFile.a,buf); CallService(MS_UTILS_PATHTOABSOLUTE,wparam(path),lparam(@buf)); hIconDLL:=LoadLibraryA(buf); end; diff --git a/plugins/mRadio/i_bass.inc b/plugins/mRadio/i_bass.inc index 77f0d3650a..e52d7f377a 100644 --- a/plugins/mRadio/i_bass.inc +++ b/plugins/mRadio/i_bass.inc @@ -53,7 +53,7 @@ begin end else pcw:=FastAnsiToWideBuf(BASS_ERRORS[idx],@buf); - + MessageBoxW(0,TranslateW(pcw), TranslateW('Oops! BASS error'),MB_ICONERROR) end; @@ -139,7 +139,7 @@ begin else result:=true; end; - + end; end; @@ -316,9 +316,6 @@ begin if recpath<>nil then begin ConvertFileName(recpath,buf,ActiveContact); -// pcw:=ParseVarString(recpath,ActiveContact); -// CallService(MS_UTILS_PATHTOABSOLUTEW,dword(pcw),dword(buf)); -// mFreeMem(pcw); if not ForceDirectories(buf) then begin result:=nil; @@ -549,7 +546,7 @@ begin end else needtofree:=true; - + // to avoid mem leak and wrong tag process result:=true; end; @@ -699,7 +696,7 @@ begin end; end; end; -{$IFDEF Debug} +{$IFDEF Debug} logmeta(tag,artist,title); {$ENDIF} mFreeMem(oldartist); @@ -855,7 +852,7 @@ begin if chan=0 then begin - if (CallService(MS_RADIO_COMMAND,MRC_STATUS,RD_STATUS_GET)=RD_STATUS_ABORT) or + if (CallService(MS_RADIO_COMMAND,MRC_STATUS,RD_STATUS_GET)=RD_STATUS_ABORT) or (plist=nil) then begin CallService(MS_RADIO_COMMAND,MRC_STOP,1); diff --git a/plugins/mRadio/i_optdlg.inc b/plugins/mRadio/i_optdlg.inc index e047fe20a1..d9fe1c4779 100644 --- a/plugins/mRadio/i_optdlg.inc +++ b/plugins/mRadio/i_optdlg.inc @@ -148,7 +148,7 @@ begin if lstorage<>nil then begin list:=GetSectionList(lstorage); - + pc:=list; while pc^<>#0 do begin @@ -174,7 +174,7 @@ begin pc:=DBReadString(hContact,strCList,optMyHandle); WritePrivateProfileStringA(section,'Name',pc,fname); mFreeMem(pc); - + pc:=DBReadString(hContact,PluginName,optStationURL); WritePrivateProfileStringA(section,'URL',pc,fname); mFreeMem(pc); @@ -316,7 +316,7 @@ begin SetButtonIcon(ti.uId,IcoBtnAdd); SendMessageW(hwndTooltip,TTM_ADDTOOLW,0,lparam(@ti)); - + ti.uId :=GetDlgItem(Dialog,IDC_EQ_DEL); ti.lpszText:=TranslateW('Delete'); SetButtonIcon(ti.uId,IcoBtnDel); @@ -331,7 +331,6 @@ var psr:TPROTOSEARCHRESULT; dst:pWideChar; i:dword; -// info:BASS_CHANNELINFO; vhi:TVARHELPINFO; wnd:HWND; p:pWideChar; @@ -381,7 +380,7 @@ begin CheckDlgButton(Dialog,IDC_OFFLINE ,AsOffline); SetDlgItemTextW(Dialog,IDC_STATUS,StatusTmpl); - + DlgInit:=0; end; @@ -420,7 +419,7 @@ begin end; IDC_BN_URLPATH: begin - + dst:=ConstructFilter; if ShowDlgW(@buf,nil,dst) then SetDlgItemTextW(Dialog,IDC_STATIONURL,@buf); @@ -467,20 +466,14 @@ begin StrDupW(email.w,@buf); i:=Service_AddToList(0,tlparam(@psr)); -{ - GetDlgItemTextW(Dialog,IDC_STATION,@buf,SizeOf(buf)); - DBWriteUnicode(i,strCList,optMyHandle,@buf); - GetDlgItemTextW(Dialog,IDC_STATIONURL,@buf,SizeOf(buf)); - DBWriteUnicode(i,PluginName,optStationURL,@buf); -} // "changing" station group dst:=GetNewGroupName(Dialog); if dst<>nil then DBWriteUnicode(i,strCList,optGroup,dst) else DBDeleteSetting(i,strCList,optGroup); - + end else if loword(wParam)=IDC_ADD_INI then begin @@ -548,13 +541,6 @@ begin doLoop:=IsDlgButtonChecked(Dialog,IDC_LOOP); if chan<>0 then begin -{ - BASS_ChannelGetInfo(chan,info); - if doLoop<>BST_UNCHECKED then - info.flags:=info.flags or BASS_SAMPLE_LOOP - else - info.flags:=info.flags and not BASS_SAMPLE_LOOP; -} BASS_ChannelFlags(chan,ord(doLoop<>BST_UNCHECKED),BASS_SAMPLE_LOOP); end; @@ -642,7 +628,7 @@ begin SendDlgItemMessageA(Dialog,IDC_0+i,WM_SETTEXT,0,tlparam(eq[i].text)); EnableWindow(eq[i].wnd,isEQ_OFF=BST_UNCHECKED); end; - + CheckDlgButton(Dialog,IDC_EQOFF,isEQ_OFF); dst:=DBReadUnicode(0,PluginName,optBASSPath,nil); @@ -922,7 +908,7 @@ begin DBWriteString(wParam,PluginName,optBitrate,IntToStr(buf,i)); exit; end; - + case value._type of DBVT_DELETED, DBVT_ASCIIZ , diff --git a/plugins/mRadio/i_search.inc b/plugins/mRadio/i_search.inc index d4330e84d1..ffd0b8b6de 100644 --- a/plugins/mRadio/i_search.inc +++ b/plugins/mRadio/i_search.inc @@ -1,90 +1,5 @@ {search station code} -(* -procedure SetAvatar(hContact:THANDLE); -var - success:boolean; - fname:pAnsiChar; - url:pWideChar; - buf,buf1,buf2:array [0..MAX_PATH-1] of AnsiChar; - ext:array [0..15] of AnsiChar; - section:pAnsiChar; - pc:pAnsiChar; - i:integer; -begin - // get url - url:=DBReadUnicode(hContact,PluginName,optStationURL); - // translate to Ansi - FastWideToAnsiBuf(url,buf); - mFreeMem(url); - - // search in INI - i:=GetFSize(storage); - if i=0 then - i:=32767; - mGetMem(pc,i+1); - pc^:=#0; - GetPrivateProfileSectionNamesA(pc,i,storage); - section:=pc; - - while section^<>#0 do - begin - GetPrivateProfileStringA(section,'URL','',buf1,SizeOf(buf1),storage); - if StrCmp(@buf,@buf1)=0 then - break; - - while section^<>#0 do inc(section); - inc(section); - end; - mFreeMem(pc); - - if section^<>#0 then - begin - // get avatar link - buf[0]:=#0; - GetPrivateProfileStringA(section,'Avatar','',buf,SizeOf(buf),storage); - - if buf[0]<>#0 then - begin - // Here we trying to get Avatar chache directory - // (create it if needs) - // and copy (load) owr avatars there - // in : buf = source avatar path - // out: fname = destination (file name in cache) - // rule for name is?.. - - - if StrPos(buf,'://')=nil then - begin - fname:=@buf; - success:=FileExists(fname); - // need to copy this file to avatar cache - end - else - begin - // download file -{ - GetTempPathA(MAX_PATH,pAnsiChar(@buf1)); - pc:=extract(pAnsiChar(@buf),true); - StrCat(pAnsiChar(@buf1),pc); - mFreeMem(pc); -} - //mrAvt - - GetExt(pAnsiChar(@buf),pAnsiChar(@ext)); - GetTempPathA(MAX_PATH,pAnsiChar(@buf2)); - GetTempFileNameA(pAnsiChar(@buf2),'mrAvt',GetCurrentTime,pAnsiChar(@buf1)); - ChangeExt(pAnsiChar(@buf1),PAnsiChar(@ext)); - // - fname:=@buf1; - success:=GetFile(pAnsiChar(@buf),fname); - end; - if success then - CallService(MS_AV_SETAVATAR,hContact,LPARAM(fname)); - end; - end; -end; -*) type TMySearchFilter = record lStation, @@ -239,7 +154,6 @@ begin with filter do begin -// CallService(MS_UTILS_PATHTOABSOLUTE,dword(@ini1),dword(@ini)); lBitrate:=GetDlgItemInt(wnd,IDC_BITRATE,ltmp,false); if IsDlgButtonChecked(wnd,IDC_LT)=BST_CHECKED then lBitrateMode:=-1 else if IsDlgButtonChecked(wnd,IDC_EQ)=BST_CHECKED then lBitrateMode:=0 @@ -378,29 +292,6 @@ begin if lurl<>nil then begin -{ -// find contact - hContact:=CallService(MS_DB_CONTACT_FINDFIRST,0,0); - while hContact<>0 do - begin - if StrCmp(PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0)), - PluginName)=0 then - begin - p:=DBReadString(hContact,PluginName,optStationURL); - l:=StrCmp(p,lurl)=0; - mFreeMem(p); - if l then - begin - DBDeleteSetting(hContact,strCList,'NotOnList'); - DBDeleteSetting(hContact,strCList,'Hidden'); - result:=hContact; - exit; - end; - end; - hContact:=CallService(MS_DB_CONTACT_FINDNEXT,hContact,0); - end; -// if not found -} hContact:=CallService(MS_DB_CONTACT_ADD,0,0); if hContact<>0 then begin -- cgit v1.2.3