diff options
Diffstat (limited to 'plugins')
28 files changed, 291 insertions, 142 deletions
diff --git a/plugins/Watrack/formats/fmt_mp3.pas b/plugins/Watrack/formats/fmt_mp3.pas index 5d6c94745a..45c0888daa 100644 --- a/plugins/Watrack/formats/fmt_mp3.pas +++ b/plugins/Watrack/formats/fmt_mp3.pas @@ -161,8 +161,11 @@ begin ReadID3v2(f,Info);
BlockRead(f,l,4);
// if l[0]<>$FF then
- if not SearchStart(f,l) then
- Exit;
+ if not SearchStart(f,l) then
+ begin
+ CloseHandle(f);
+ Exit;
+ end;
TranslateFrameHdr(l,hdr);
CheckVBR(f,hdr);
Info.kbps :=hdr.Bitrate;
diff --git a/plugins/Watrack/i_vars.inc b/plugins/Watrack/i_vars.inc index 73bba4fa05..66d136f355 100644 --- a/plugins/Watrack/i_vars.inc +++ b/plugins/Watrack/i_vars.inc @@ -5,16 +5,7 @@ var WorkSI :tSongInfo;
var
hEvent:THANDLE;
- hGFI,
- hWI,
- hGMI,
- hPS,
- hPB,
- hWATI,
- hWC,
- hFMT,
- hPLR,
- hRGS,
+ hHookWATStatus,
hHookWATLoaded:THANDLE;
inshotkey:cardinal;
globhotkey:cardinal;
diff --git a/plugins/Watrack/kolframe/frm_dlg1.inc b/plugins/Watrack/kolframe/frm_dlg1.inc index 08028a3356..401e04536d 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,wparam(buf),lparam(buf1));
+ PathToRelative(buf,buf1);
if StrCmp(buf1,D.BkDefFile)<>0 then
begin
mFreeMem(D.BkDefFile);
diff --git a/plugins/Watrack/kolframe/frm_frame.inc b/plugins/Watrack/kolframe/frm_frame.inc index 8c3034327c..8911f868c4 100644 --- a/plugins/Watrack/kolframe/frm_frame.inc +++ b/plugins/Watrack/kolframe/frm_frame.inc @@ -63,7 +63,7 @@ begin if D.Trackbar<>nil then
begin
- if (CallService(MS_WAT_GETMUSICINFO,WAT_INF_CHANGES,dword(@psi))<>WAT_PLS_NOTFOUND) then
+ if (CallService(MS_WAT_GETMUSICINFO,WAT_INF_CHANGES,tlparam(@psi))<>WAT_PLS_NOTFOUND) then
begin
SetTrackBarPosition(D.Trackbar,(psi^.time*1000) div D.UpdInterval)
end;
@@ -265,7 +265,7 @@ begin if D.BkBitmap=0 then
begin
if (D.BkFile<>nil) and (D.BkFile^<>#0) then
- D.BkBitmap:=CallService(MS_UTILS_LOADBITMAP,0,dword(D.BkFile));
+ D.BkBitmap:=CallService(MS_UTILS_LOADBITMAP,0,tlparam(D.BkFile));
end;
if D.BkBitmap<>0 then
@@ -309,7 +309,7 @@ begin Exit;
end;
- result:=CallService(MS_UTILS_LOADBITMAP,0,dword(CoverFName));
+ result:=CallService(MS_UTILS_LOADBITMAP,0,tlparam(CoverFName));
if result<>0 then
begin
mFreeMem(D.BkFile);
@@ -325,7 +325,7 @@ begin begin
if (not check) or (StrCmp(tmpstr,D.BkFile)<>0) then
begin
- result:=CallService(MS_UTILS_LOADBITMAP,0,dword(tmpstr));
+ result:=CallService(MS_UTILS_LOADBITMAP,0,tlparam(tmpstr));
if result<>0 then
begin
mFreeMem(D.BkFile);
@@ -412,7 +412,7 @@ begin RegisterButtonIcons;
D.Trackbar:=MakeNewTrackbar(@self);
// for case when TB creating after track start (fastest way)
- // can use (CallService(MS_WAT_GETMUSICINFO,WAT_INF_CHANGES,dword(@psi))<>WAT_PLS_NOTFOUND)
+ // can use (CallService(MS_WAT_GETMUSICINFO,WAT_INF_CHANGES,tlparam(@psi))<>WAT_PLS_NOTFOUND)
psi:=pointer(CallService(MS_WAT_RETURNGLOBAL,WAT_INF_UNICODE,1));
TrackbarSetRange(D.Trackbar,D.UpdInterval,psi^.total);
end;
diff --git a/plugins/Watrack/kolframe/frm_text.inc b/plugins/Watrack/kolframe/frm_text.inc index 66c00a1b2b..f77d2de009 100644 --- a/plugins/Watrack/kolframe/frm_text.inc +++ b/plugins/Watrack/kolframe/frm_text.inc @@ -41,7 +41,7 @@ begin (StrPosW(D.Template,'%time%' )=nil) then // need to |remake
exit;
end;
- tmp:=pWideChar(CallService(MS_WAT_REPLACETEXT,0,dword(D.Template)));
+ tmp:=pWideChar(CallService(MS_WAT_REPLACETEXT,0,tlparam(D.Template)));
D.TextBlock.BlockText:=tmp;
mFreeMem(tmp);
end;
diff --git a/plugins/Watrack/kolframe/frm_trackbar.inc b/plugins/Watrack/kolframe/frm_trackbar.inc index d6e08c56a7..eb9ad5c285 100644 --- a/plugins/Watrack/kolframe/frm_trackbar.inc +++ b/plugins/Watrack/kolframe/frm_trackbar.inc @@ -160,7 +160,7 @@ var rc, rc1:TRECT;
w:integer;
begin
- SendMessage(Sender.Handle,TBM_GETTHUMBRECT,0,dword(@rc));
+ SendMessage(Sender.Handle,TBM_GETTHUMBRECT,0,tlparam(@rc));
w:=rc.right-rc.left;
if w<>16 then
diff --git a/plugins/Watrack/kolframe/frm_vars.inc b/plugins/Watrack/kolframe/frm_vars.inc index f4d9372002..88dd71f0d1 100644 --- a/plugins/Watrack/kolframe/frm_vars.inc +++ b/plugins/Watrack/kolframe/frm_vars.inc @@ -1,5 +1,8 @@ {Frame variables}
var
+ sic,
+ PlStatusHook:cardinal;
+
HiddenByMe:bool;
FrameHeight:dword;
diff --git a/plugins/Watrack/kolframe/kolframe.pas b/plugins/Watrack/kolframe/kolframe.pas index 4e93b6dcc2..27fe7dde26 100644 --- a/plugins/Watrack/kolframe/kolframe.pas +++ b/plugins/Watrack/kolframe/kolframe.pas @@ -31,7 +31,7 @@ var begin
D:=FrameCtrl.CustomData;
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,
- (D.FrameId shl 16)+FO_TBNAME+addflag,dword(title));
+ (D.FrameId shl 16)+FO_TBNAME+addflag,tlparam(title));
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,(D.FrameId shl 16)+FO_ICON,icon);
CallService(MS_CLIST_FRAMES_UPDATEFRAME,D.FrameId,FU_TBREDRAW);
end;
@@ -220,10 +220,10 @@ begin end;
FrameHeight:=CLFrame.height;
- PWATFrameData(FrameCtrl.CustomData).FrameId:=CallService(MS_CLIST_FRAMES_ADDFRAME,dword(@CLFrame),0);
+ PWATFrameData(FrameCtrl.CustomData).FrameId:=CallService(MS_CLIST_FRAMES_ADDFRAME,twparam(@CLFrame),0);
if PWATFrameData(FrameCtrl.CustomData).FrameId>=0 then
begin
- HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
+ plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
end;
end;
result:=FrameWnd<>0;
@@ -235,6 +235,8 @@ var begin
if (FrameCtrl<>nil) and (PWATFrameData(FrameCtrl.CustomData).FrameId>=0) then
begin
+ UnhookEvent(plStatusHook);
+
id:=PWATFrameData(FrameCtrl.CustomData).FrameId;
FrameCtrl.Free;
FrameCtrl:=nil;
@@ -271,7 +273,7 @@ begin result:=ord(CreateFrame(0));
if result<>0 then
- HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
+ sic:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
end;
procedure DeInitProc(aSetDisable:boolean);
@@ -279,6 +281,11 @@ begin if aSetDisable then
SetModStatus(0);
+ if sic<>0 then
+ begin
+ UnhookEvent(sic);
+ sic:=0;
+ end;
DestroyFrame;
end;
@@ -314,6 +321,7 @@ begin Frame.Init :=@InitProc;
Frame.DeInit :=@DeInitProc;
Frame.AddOption :=@AddOptionsPage;
+ Frame.Check :=nil;
Frame.ModuleName:='Frame';
ModuleLink :=@Frame;
end;
diff --git a/plugins/Watrack/lastfm/i_last_api.inc b/plugins/Watrack/lastfm/i_last_api.inc index 73328366ba..1f934646a3 100644 --- a/plugins/Watrack/lastfm/i_last_api.inc +++ b/plugins/Watrack/lastfm/i_last_api.inc @@ -34,7 +34,7 @@ function GetMD5(const data;datalen:integer;var digest:TMD5Hash):TMD5Hash; begin
FillChar(digest,16,0);
- mir_md5_hash(pmir_md5_byte_t(data),datalen,digest);
+ mir_md5_hash(pbyte(data),datalen,digest);
result:=digest;
end;
diff --git a/plugins/Watrack/lastfm/i_last_opt.inc b/plugins/Watrack/lastfm/i_last_opt.inc index a8fb4457af..c629962697 100644 --- a/plugins/Watrack/lastfm/i_last_opt.inc +++ b/plugins/Watrack/lastfm/i_last_opt.inc @@ -7,8 +7,6 @@ const optLanguage:pAnsiChar='lfm/language';
procedure SaveOpt;
-var
- tmppass:array [0..255] of AnsiChar;
begin
DBWriteString(0,PluginShort,optPassword,lfm_password);
DBWriteString(0,PluginShort,optLogin ,lfm_login);
diff --git a/plugins/Watrack/lastfm/lastfm.pas b/plugins/Watrack/lastfm/lastfm.pas index e91aafffa9..d2a5cbc8a7 100644 --- a/plugins/Watrack/lastfm/lastfm.pas +++ b/plugins/Watrack/lastfm/lastfm.pas @@ -15,6 +15,7 @@ const IcoLastFM:pAnsiChar = 'WATrack_lasfm';
var
lfm_tries:integer;
+ sic:THANDLE;
slastinf:THANDLE;
slast:THANDLE;
const
@@ -221,6 +222,9 @@ begin result:=0;
end;
+var
+ plStatusHook:THANDLE;
+
function InitProc(aGetStatus:boolean=false):integer;
begin
slastinf:=CreateServiceFunction(MS_WAT_LASTFMINFO,@SrvLastFMInfo);
@@ -244,9 +248,9 @@ begin slast:=CreateServiceFunction(MS_WAT_LASTFM,@SrvLastFM);
if hMenuLast=0 then
CreateMenus;
- HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
+ sic:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
if (lfm_on and 4)=0 then
- HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
+ plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
end;
procedure DeInitProc(aSetDisable:boolean);
@@ -259,6 +263,8 @@ begin CallService(MS_CLIST_REMOVEMAINMENUITEM,hMenuLast,0);
hMenuLast:=0;
DestroyServiceFunction(slast);
+ UnhookEvent(plStatusHook);
+ UnhookEvent(sic);
if hTimer<>0 then
begin
@@ -284,6 +290,7 @@ begin last.Init :=@InitProc;
last.DeInit :=@DeInitProc;
last.AddOption :=@AddOptionsPage;
+ last.Check :=nil;
last.ModuleName:='Last.FM';
ModuleLink :=@last;
diff --git a/plugins/Watrack/myrtf.pas b/plugins/Watrack/myrtf.pas index 7a6bf2255f..a789b95d6a 100644 --- a/plugins/Watrack/myrtf.pas +++ b/plugins/Watrack/myrtf.pas @@ -8,7 +8,7 @@ uses windows; procedure SendRTF(wnd:hwnd;txt:PWideChar;isUnicode:Boolean;CP:integer=CP_ACP);
implementation
-uses richedit,common,messages,m_api;
+uses richedit,common,messages{,m_api};
const
RTFBufferSize = 16384;
diff --git a/plugins/Watrack/myshows/i_myshows_api.inc b/plugins/Watrack/myshows/i_myshows_api.inc index 572cc3ee31..2e9f51773d 100644 --- a/plugins/Watrack/myshows/i_myshows_api.inc +++ b/plugins/Watrack/myshows/i_myshows_api.inc @@ -68,7 +68,7 @@ function GetMD5(const data;datalen:integer;var digest:TMD5Hash):TMD5Hash; begin
FillChar(digest,16,0);
- mir_md5_hash(pmir_md5_byte_t(data),datalen,digest);
+ mir_md5_hash(pbyte(data),datalen,digest);
result:=digest;
end;
@@ -154,9 +154,9 @@ var buf:array [0..511] of AnsiChar;
// bufw:array [0..511] of WideChar;
res,pc:PAnsiChar;
- {img,}shId,epId:pAnsiChar;
+ epId:pAnsiChar;
+ shId:pWideChar;
// imgw:pWideChar;
- json:TJSONSERVICEINTERFACE;
jn,jroot:PJSONNODE;
begin
result:=false;
@@ -171,21 +171,13 @@ begin res:=SendRequest(buf,REQUEST_GET);
if uint_ptr(res)>$0FFF then
begin
- CallService(MS_JSON_GETINTERFACE,wparam(@json),0);
+ jroot:=json_parse(res);
- jroot:=json.parse(res);
+ jn:=json_get(jroot,'show');
+ shId:=json_as_string(json_get(jn,'id'));
- jn:=json.get(jroot,'show');
- shId:=json.as_string(json.get(jn,'id'));
-
- jn:=json.get(jn,'episodes');
- epId:=json.name(json.at(jn,0));
-{
-kinopoiskId
-image
-ruTitle
-episodes:{:{id:
-}
+ jn:=json_get(jn,'episodes');
+ epId:=json_name(json_at(jn,0));
end
else
begin
@@ -195,7 +187,9 @@ episodes:{:{id: end;
// Show mark as "watching"
- StrCopy(StrCopyE(StrCopyE(buf,API_URL+'profile/shows/'),shId),'/watching');
+ pc:=StrCopyE(buf,API_URL+'profile/shows/');
+ FastWideToAnsiBuf(shId,pc);
+ StrCat(pc,'/watching');
if SendMSRequest(buf,show) then
begin
// Episode check
@@ -206,42 +200,44 @@ episodes:{:{id: {
if si.cover=nil then
begin
- jn:=json.get(jroot,'show');
- img:=json.as_string(json.get(jn,'image'));
+ jn:=json_get(jroot,'show');
+ img:=json_as_string(json_get(jn,'image'));
si:=pointer(CallService(MS_WAT_RETURNGLOBAL,WAT_INF_UNICODE,0));
FastAnsiToWide(img,pSongInfoW(si)^.cover);
- json.free(img);
+ json_free(img);
end;
}
//!! add option to show it??
if ServiceExists(MS_POPUP_SHOWMESSAGE)<>0 then
begin
- json.free(shId);
- json.free(epId);
+ json_free(shId);
+ json_free(epId);
- jn:=json.get(jroot,'show');
- shId:=json.as_string(json.get(jn,'title'));
+ jn:=json_get(jroot,'show');
+ shId:=json_as_string(json_get(jn,'title'));
- jn:=json.get(jn,'episodes');
- epId:=json.as_string(json.get(jn,'title'));
+ jn:=json_get(jn,'episodes');
+ pWideChar(epId):=json_as_string(json_get(jn,'title'));
- StrCopy(
- StrCopyE(
- StrCopyE(
- StrCopyE(
- StrCopyE(buf,'Show "'),
+ mGetMem(pc,1024);
+ StrCopyW(
+ StrCopyEW(
+ StrCopyEW(
+ StrCopyEW(
+ StrCopyEW(pWideChar(pc),'Show "'),
shId),
'"'#13#10'episode "'),
- epId),
+ pWideChar(epId)),
'" checked');
- CallService(MS_POPUP_SHOWMESSAGE,TWPARAM(@buf),SM_NOTIFY);
+ CallService(MS_POPUP_SHOWMESSAGEW,TWPARAM(pc),SM_NOTIFY);
+ mFreeMem(pc);
end;
result:=true;
end;
end;
- json.free(shId);
- json.free(epId);
+ json_free(shId);
+ json_free(epId);
- json.delete_(jroot);
+ json_delete(jroot);
end;
diff --git a/plugins/Watrack/myshows/i_myshows_opt.inc b/plugins/Watrack/myshows/i_myshows_opt.inc index f136c4c658..42b9e88cee 100644 --- a/plugins/Watrack/myshows/i_myshows_opt.inc +++ b/plugins/Watrack/myshows/i_myshows_opt.inc @@ -8,8 +8,6 @@ const optScrobble:pAnsiChar='myshows/scrobble';
procedure SaveOpt;
-var
- tmppass:array [0..255] of AnsiChar;
begin
DBWriteString(0,PluginShort,optPassword,msh_password);
DBWriteString(0,PluginShort,optLogin ,msh_login);
diff --git a/plugins/Watrack/myshows/myshows.pas b/plugins/Watrack/myshows/myshows.pas index 5715c530d9..a26c7dd4ae 100644 --- a/plugins/Watrack/myshows/myshows.pas +++ b/plugins/Watrack/myshows/myshows.pas @@ -28,6 +28,7 @@ type var
msh_tries,
msh_scrobpos:integer;
+ sic:THANDLE;
slast:THANDLE;
MSData:tMyShowsData;
const
@@ -108,7 +109,6 @@ begin begin
if pSongInfo(lParam).width>0 then // for video only
begin
- if ServiceExists(MS_JSON_GETINTERFACE)<>0 then
begin
timervalue:=integer(pSongInfo(lParam).total)*10*msh_scrobpos; // 1000(msec) div 100(%)
if timervalue=0 then
@@ -252,6 +252,8 @@ begin result:=0;
end;
+var
+ plStatusHook:THANDLE;
function InitProc(aGetStatus:boolean=false):integer;
begin
// slastinf:=CreateServiceFunction(MS_WAT_MYSHOWSINFO,@SrvMyShowsInfo);
@@ -275,9 +277,9 @@ begin slast:=CreateServiceFunction(MS_WAT_MYSHOWS,@SrvMyShows);
if hMenuMyShows=0 then
CreateMenus;
- HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
+ sic:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
if (msh_on and 4)=0 then
- HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
+ plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
end;
procedure DeInitProc(aSetDisable:boolean);
@@ -286,6 +288,8 @@ begin SetModStatus(0);
DestroyServiceFunction(slast);
+ UnhookEvent(plStatusHook);
+ UnhookEvent(sic);
if hTimer<>0 then
begin
@@ -313,6 +317,7 @@ begin mmyshows.Init :=@InitProc;
mmyshows.DeInit :=@DeInitProc;
mmyshows.AddOption :=@AddOptionsPage;
+ mmyshows.Check :=nil;
mmyshows.ModuleName:='MyShows.ru';
ModuleLink :=@mmyshows;
diff --git a/plugins/Watrack/player.ini b/plugins/Watrack/player.ini index 37f667c737..2b0ede81a3 100644 --- a/plugins/Watrack/player.ini +++ b/plugins/Watrack/player.ini @@ -130,9 +130,6 @@ Notes='Winamp API used to get more info' class='MPlayer - The Movie Player'
url='http://www.mplayerhq.hu/'
-[MPC-BE]
-class='MPC-BE'
-url='http://sourceforge.net/projects/mpcbe/'
[Media Commander Express]
class='TApplication'
@@ -149,6 +146,9 @@ url='http://www.grafmstudio.narod.ru/mlmaster.htm' class='wxWindowClassNR'
file='MOREAMP.EXE'
url='http://sourceforge.net/projects/moreamp/'
+[MPC-BE]
+class='MPC-BE'
+url='http://sourceforge.net/projects/mpcbe/'
[MusicCube One]
class='TfMain'
diff --git a/plugins/Watrack/popup/pop_vars.inc b/plugins/Watrack/popup/pop_vars.inc index 63048e7555..4a845aaadc 100644 --- a/plugins/Watrack/popup/pop_vars.inc +++ b/plugins/Watrack/popup/pop_vars.inc @@ -5,19 +5,23 @@ var PopTitle,
PopText:pWideChar;
PopRequest,
- PopupFile:dword;
- PopupColor:dword;
- PopupFore,
- PopupBack:cardinal;
- PopupPause:cardinal;
- PopupDelay:integer;
- PopupAction:cardinal;
- PopupButtons:cardinal;
+ PopUpFile:dword;
+ PopUpColor:dword;
+ PopUpFore,
+ PopUpBack:cardinal;
+ PopUpPause:cardinal;
+ PopUpDelay:integer;
+ PopUpAction:cardinal;
+ PopUpButtons:cardinal;
DisablePlugin:integer;
IsPopup2Present:boolean;
IsFreeImagePresent:boolean;
var
hMenuInfo :THANDLE;
+ ssmi,sic,
+ plStatusHook:THANDLE;
PopupPresent:Bool;
- ttbInfo :THANDLE;
\ No newline at end of file + onttbhook,
+ opthook:THANDLE;
+ ttbInfo:THANDLE;
\ No newline at end of file diff --git a/plugins/Watrack/popup/popups.pas b/plugins/Watrack/popup/popups.pas index 0fe52a5301..b671c60346 100644 --- a/plugins/Watrack/popup/popups.pas +++ b/plugins/Watrack/popup/popups.pas @@ -385,7 +385,7 @@ var odp:TOPTIONSDIALOGPAGE;
begin
FillChar(odp,SizeOf(odp),0);
- odp.cbSize :=sizeof(odp);
+ odp.cbSize :=SizeOf(odp);
odp.flags :=ODPF_BOLDGROUPS;
odp.Position :=900003000;
odp.hInstance :=hInstance;
@@ -403,6 +403,8 @@ var ttb:TTBButton;
begin
result:=0;
+ if onttbhook<>0 then
+ UnhookEvent(onttbhook);
// get info button
FillChar(ttb,SizeOf(ttb),0);
ttb.cbSize :=SizeOf(ttb);
@@ -412,10 +414,67 @@ begin ttb.pszService:=MS_WAT_SHOWMUSICINFO;
ttb.name :='Music Info';
ttbInfo:=TopToolbar_AddButton(@ttb);
+ if ttbInfo=THANDLE(-1) then
+ ttbInfo:=0;
end;
// ------------ base interface functions -------------
+function CheckProc(load:boolean):boolean;
+var
+ newstate:boolean;
+begin
+ result:=true;
+ // Popups
+ newstate:=ServiceExists(MS_POPUP_ADDPOPUPW)<>0;
+ if newstate=PopupPresent then
+ exit;
+
+ PopupPresent:=newstate;
+ if PopupPresent then
+ begin
+ IsFreeImagePresent:=ServiceExists(MS_IMG_LOAD )<>0;
+ IsPopup2Present :=ServiceExists(MS_POPUP_ADDPOPUP2)<>0;
+ opthook:=HookEvent(ME_OPT_INITIALISE,@OnOptInitialise);
+
+ if ServiceExists(MS_POPUP_REGISTERACTIONS)<>0 then
+ begin
+ if RegisterButtonIcons then
+ begin
+ ActionList:=MakeActions;
+ if ActionList<>nil then
+ CallService(MS_POPUP_REGISTERACTIONS,wparam(ActionList),7);
+ end;
+ end;
+ end
+ else
+ begin
+ UnhookEvent(opthook);
+ mFreeMem(ActionList);
+ end;
+
+ // TTB
+ newstate:=ServiceExists(MS_TTB_ADDBUTTON)<>0;
+ if newstate=(ttbInfo<>0) then
+ exit;
+
+ if ttbInfo=0 then
+ begin
+ onttbhook:=0;
+ OnTTBLoaded(0,0);
+ if ttbInfo=0 then
+ onttbhook:=HookEvent(ME_TTB_MODULELOADED,@OnTTBLoaded);
+ end
+ else
+ begin
+ if ServiceExists(MS_TTB_REMOVEBUTTON)>0 then
+ CallService(MS_TTB_REMOVEBUTTON,WPARAM(ttbInfo),0);
+ ttbInfo:=0;
+ end;
+
+ // Variables ?
+end;
+
function InitProc(aGetStatus:boolean=false):integer;
var
mi:TCListMenuItem;
@@ -433,7 +492,7 @@ begin SetModStatus(1);
result:=1;
- CreateServiceFunction(MS_WAT_SHOWMUSICINFO,@OpenPopup);
+ ssmi:=CreateServiceFunction(MS_WAT_SHOWMUSICINFO,@OpenPopup);
FillChar(sid,SizeOf(TSKINICONDESC),0);
sid.cbSize:=SizeOf(TSKINICONDESC);
@@ -445,7 +504,7 @@ begin sid.szDescription.a:='Music Info';
Skin_AddIcon(@sid);
DestroyIcon(sid.hDefaultIcon);
- HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
+ sic:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
FillChar(mi,SizeOf(mi),0);
mi.cbSize :=SizeOf(mi);
@@ -456,16 +515,15 @@ begin mi.popupPosition:=MenuInfoPos;
hMenuInfo :=Menu_AddMainMenuItem(@mi);
+ ActionList:=nil;
if ServiceExists(MS_POPUP_ADDPOPUPW)<>0 then
begin
IsFreeImagePresent:=ServiceExists(MS_IMG_LOAD )<>0;
IsPopup2Present :=ServiceExists(MS_POPUP_ADDPOPUP2)<>0;
PopupPresent:=true;
- HookEvent(ME_OPT_INITIALISE,@OnOptInitialise);
+ opthook:=HookEvent(ME_OPT_INITIALISE,@OnOptInitialise);
loadpopup;
- regpophotkey;
- ActionList:=nil;
if ServiceExists(MS_POPUP_REGISTERACTIONS)<>0 then
begin
if RegisterButtonIcons then
@@ -479,10 +537,21 @@ begin else
begin
PopupPresent:=false;
+ opthook:=0;
end;
+ regpophotkey;
- HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
- HookEvent(ME_TTB_MODULELOADED,@OnTTBLoaded);
+ plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
+
+ if ServiceExists(MS_TTB_ADDBUTTON)>0 then
+ begin
+ onttbhook:=0;
+ OnTTBLoaded(0,0);
+ if ttbInfo=0 then
+ onttbhook:=HookEvent(ME_TTB_MODULELOADED,@OnTTBLoaded);
+ end
+ else
+ ttbInfo:=0;
end;
procedure DeInitProc(aSetDisable:boolean);
@@ -491,17 +560,22 @@ begin SetModStatus(0);
CallService(MS_CLIST_REMOVEMAINMENUITEM,hMenuInfo,0);
+ UnhookEvent(plStatusHook);
+ DestroyServiceFunction(ssmi);
+ UnhookEvent(sic);
freepopup;
if ttbInfo<>0 then
begin
- CallService(MS_TTB_REMOVEBUTTON,WPARAM(ttbInfo),0);
+ if ServiceExists(MS_TTB_REMOVEBUTTON)>0 then
+ CallService(MS_TTB_REMOVEBUTTON,WPARAM(ttbInfo),0);
ttbInfo:=0;
end;
if PopupPresent then
begin
+ UnhookEvent(opthook);
mFreeMem(ActionList);
end;
end;
@@ -515,6 +589,7 @@ begin Popup.Init :=@InitProc;
Popup.DeInit :=@DeInitProc;
Popup.AddOption :=nil;
+ Popup.Check :=@CheckProc;
Popup.ModuleName:='Popups';
ModuleLink :=@Popup;
end;
diff --git a/plugins/Watrack/proto/proto.pas b/plugins/Watrack/proto/proto.pas index e0e3a94dcf..f1c6eff06b 100644 --- a/plugins/Watrack/proto/proto.pas +++ b/plugins/Watrack/proto/proto.pas @@ -45,12 +45,12 @@ const hmISend = $0080;
var
- Icons : tIconItem = (szDescr: 'Context Menu'; szName: @IcoBtnContext; defIconID: BTN_CONTEXT; size: 0; hIcolib: 0;);
-
-var
hSRM,
hGCI,
- hContactMenuItem:THANDLE;
+ icchangedhook,
+ hAddUserHook,
+ hContactMenuItem,
+ contexthook:THANDLE;
ProtoText:pWideChar;
HistMask:cardinal;
@@ -446,6 +446,39 @@ begin CallService(MS_PROTO_REGISTERMODULE,0,lparam(@desc));
hSRM:=CreateProtoServiceFunction(PluginShort,PSR_MESSAGE ,@ReceiveMessageProcW);
+// CreateProtoServiceFunction(PluginShort,PSR_MESSAGEW,@ReceiveMessageProcW);
+end;
+
+function IconChanged(wParam:WPARAM;lParam:LPARAM):int;cdecl;
+var
+ mi:TCListMenuItem;
+begin
+ result:=0;
+ FillChar(mi,SizeOf(mi),0);
+ mi.cbSize:=sizeof(mi);
+ mi.flags :=CMIM_ICON;
+
+ mi.hIcon:=CallService(MS_SKIN2_GETICON,0,tlparam(IcoBtnContext));
+ CallService(MS_CLIST_MODIFYMENUITEM,hContactMenuItem,tlparam(@mi));
+end;
+
+procedure RegisterIcons;
+var
+ sid:TSKINICONDESC;
+begin
+ FillChar(sid,SizeOf(TSKINICONDESC),0);
+ sid.cbSize:=SizeOf(TSKINICONDESC);
+ sid.cx:=16;
+ sid.cy:=16;
+ sid.szSection.a:=PluginShort;
+
+ sid.hDefaultIcon :=LoadImage(hInstance,MAKEINTRESOURCE(BTN_CONTEXT),IMAGE_ICON,16,16,0);
+ sid.pszName :=IcoBtnContext;
+ sid.szDescription.a:='Context Menu';
+ Skin_AddIcon(@sid);
+ DestroyIcon(sid.hDefaultIcon);
+//!!
+ icchangedhook:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
end;
// ------------ base interface functions -------------
@@ -468,14 +501,14 @@ begin ReadOptions;
- Icon_Register(hInstance,PluginShort,@Icons,1);
+ RegisterIcons;
FillChar(mi, sizeof(mi), 0);
mi.cbSize :=sizeof(mi);
mi.szPopupName.a:=PluginShort;
mi.flags :=CMIF_NOTOFFLINE or CMIF_NOTOFFLIST;
// mi.popupPosition:=MenuUserInfoPos;
- mi.hIcon :=Icons.hIcolib;
+ mi.hIcon :=CallService(MS_SKIN2_GETICON,0,lparam(IcoBtnContext));
mi.szName.a :='Get user''s Music Info';
mi.pszService :=MS_WAT_GETCONTACTINFO;
hContactMenuItem:=Menu_AddContactMenuItem(@mi);
@@ -483,14 +516,17 @@ begin SetProtocol;
RegisterContacts;
hGCI:=CreateServiceFunction(MS_WAT_GETCONTACTINFO,@SendRequest);
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU,@OnContactMenu);
- HookEvent(ME_DB_CONTACT_ADDED ,@HookAddUser);
+ contexthook :=HookEvent(ME_CLIST_PREBUILDCONTACTMENU,@OnContactMenu);
+ hAddUserHook:=HookEvent(ME_DB_CONTACT_ADDED ,@HookAddUser);
end;
procedure DeInitProc(aSetDisable:boolean);
begin
if aSetDisable then
SetModStatus(0);
+ UnhookEvent(hAddUserHook);
+ UnhookEvent(contexthook);
+ UnhookEvent(icchangedhook);
DestroyServiceFunction(hSRM);
DestroyServiceFunction(hGCI);
diff --git a/plugins/Watrack/srv_player.pas b/plugins/Watrack/srv_player.pas index 07db406a8a..dff61191b5 100644 --- a/plugins/Watrack/srv_player.pas +++ b/plugins/Watrack/srv_player.pas @@ -365,9 +365,8 @@ begin begin
p:=PlyNum;
result:=WAT_RES_OK;
- inc(PlyNum);
- if PlyNum>PlyMax then // expand array when append
+ if PlyNum=PlyMax then // expand array when append
begin
if PlyMax=0 then
PlyMax:=StartSize
@@ -412,6 +411,7 @@ begin else
plyLink^[p].URL:=nil;
+ inc(PlyNum);
end
else // existing player
begin
diff --git a/plugins/Watrack/stat/stat_dlg.inc b/plugins/Watrack/stat/stat_dlg.inc index 64a9b97f7c..6a3747c476 100644 --- a/plugins/Watrack/stat/stat_dlg.inc +++ b/plugins/Watrack/stat/stat_dlg.inc @@ -185,7 +185,7 @@ begin if buf[0]<>#0 then
begin
buf1[0]:=#0;
- CallService(MS_UTILS_PATHTORELATIVE,TWPARAM(@buf),TLPARAM(@buf1));
+ PathToRelative(buf,buf1);
StrDup(StatName,buf1);
end;
@@ -194,7 +194,7 @@ begin if buf[0]<>#0 then
begin
buf1[0]:=#0;
- CallService(MS_UTILS_PATHTORELATIVE,TWPARAM(@buf),TLPARAM(@buf1));
+ PathToRelative(buf,buf1);
StrDup(ReportName,buf1);
end;
@@ -203,7 +203,7 @@ begin if buf[0]<>#0 then
begin
buf1[0]:=#0;
- CallService(MS_UTILS_PATHTORELATIVE,TWPARAM(@buf),TLPARAM(@buf1));
+ PathToRelative(buf,buf1);
StrDup(TmplName,buf1);
end;
diff --git a/plugins/Watrack/stat/stat_vars.inc b/plugins/Watrack/stat/stat_vars.inc index d609329c4c..ccc7c0c5b2 100644 --- a/plugins/Watrack/stat/stat_vars.inc +++ b/plugins/Watrack/stat/stat_vars.inc @@ -16,4 +16,6 @@ var hPackLog,
hMakeReport,
hAddToLog,
+ plStatusHook,
+ sic,
hMenuReport:THANDLE;
diff --git a/plugins/Watrack/stat/statlog.pas b/plugins/Watrack/stat/statlog.pas index 4eb275e142..6cbcaf35b7 100644 --- a/plugins/Watrack/stat/statlog.pas +++ b/plugins/Watrack/stat/statlog.pas @@ -591,7 +591,7 @@ begin sid.szDescription.a:='Create Report';
Skin_AddIcon(@sid);
DestroyIcon(sid.hDefaultIcon);
- HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
+ sic:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
FillChar(mi, sizeof(mi), 0);
mi.cbSize :=sizeof(mi);
@@ -602,8 +602,7 @@ begin mi.pszService :=MS_WAT_MAKEREPORT;
mi.popupPosition:=MenuReportPos;
hMenuReport :=Menu_AddMainMenuItem(@mi);
-
- HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
+ plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
end;
procedure DeInitProc(aSetDisable:boolean);
@@ -612,6 +611,8 @@ begin SetModStatus(0);
CallService(MS_CLIST_REMOVEMAINMENUITEM,hMenuReport,0);
+ UnhookEvent(plStatusHook);
+ UnhookEvent(sic);
DestroyServiceFunction(hPackLog);
DestroyServiceFunction(hMakeReport);
DestroyServiceFunction(hAddToLog);
@@ -635,6 +636,7 @@ begin Stat.Init :=@InitProc;
Stat.DeInit :=@DeInitProc;
Stat.AddOption :=@AddOptionsPage;
+ Stat.Check :=nil;
Stat.ModuleName:='Statistic';
ModuleLink :=@Stat;
end;
diff --git a/plugins/Watrack/status/i_st_vars.inc b/plugins/Watrack/status/i_st_vars.inc index 50113b293c..4db2bbb44c 100644 --- a/plugins/Watrack/status/i_st_vars.inc +++ b/plugins/Watrack/status/i_st_vars.inc @@ -18,6 +18,7 @@ var XStatusSet :cardinal;
ClearXStat :cardinal;
hINS :THANDLE;
+ plStatusHook :THANDLE;
const
Changed:cardinal=0;
diff --git a/plugins/Watrack/status/status.pas b/plugins/Watrack/status/status.pas index ccc9b2a447..1ffbeb6b84 100644 --- a/plugins/Watrack/status/status.pas +++ b/plugins/Watrack/status/status.pas @@ -66,7 +66,8 @@ begin CreateTemplates;
hINS:=CreateServiceFunction(MS_WAT_INSERT,@InsertProc);
reghotkey;
- HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
+ plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
+
end;
procedure DeInitProc(aSetDisable:boolean);
@@ -83,6 +84,7 @@ begin end;
// DestroyServiceFunction(hLTo);
DestroyServiceFunction(hINS);
+ UnhookEvent(plStatusHook);
FreeProtoList;
FreeTemplates;
@@ -126,6 +128,7 @@ begin mStatus.Init :=@InitProc;
mStatus.DeInit :=@DeInitProc;
mStatus.AddOption :=@AddOptionsPage;
+ mStatus.Check :=nil;
mStatus.ModuleName:='Statuses';
ModuleLink :=@mStatus;
end;
diff --git a/plugins/Watrack/templates/templates.pas b/plugins/Watrack/templates/templates.pas index b18c346f33..62de1f825e 100644 --- a/plugins/Watrack/templates/templates.pas +++ b/plugins/Watrack/templates/templates.pas @@ -104,8 +104,9 @@ begin Tmpl.Init :=@InitProc;
Tmpl.DeInit :=@DeInitProc;
Tmpl.AddOption :=@AddOptionsPage;
+ Tmpl.Check :=nil;
Tmpl.ModuleName:=nil;
- ModuleLink :=@Tmpl;
+ ModuleLink :=@Tmpl;
end;
begin
diff --git a/plugins/Watrack/waticons.pas b/plugins/Watrack/waticons.pas index 94b511767e..b6a9bbc2b4 100644 --- a/plugins/Watrack/waticons.pas +++ b/plugins/Watrack/waticons.pas @@ -51,13 +51,13 @@ var begin
result:=true;
sid.szDefaultFile.a:='icons\'+ICOCtrlName;
- CallService(MS_UTILS_PATHTOABSOLUTE,wparam(sid.szDefaultFile),lparam(@buf));
+ PathToAbsolute(sid.szDefaultFile.a,buf);
hIconDLL:=LoadLibraryA(buf);
if hIconDLL=0 then // not found
begin
sid.szDefaultFile.a:='plugins\'+ICOCtrlName;
- CallService(MS_UTILS_PATHTOABSOLUTE,wparam(sid.szDefaultFile),lparam(@buf));
+ PathToAbsolute(sid.szDefaultFile.a,buf);
hIconDLL:=LoadLibraryA(buf);
end;
@@ -142,13 +142,13 @@ begin if not IconsLoaded then
begin
path:='icons\'+ICOCtrlName;
- CallService(MS_UTILS_PATHTOABSOLUTE,wparam(path),lparam(@buf));
+ PathToAbsolute(path,buf);
hIconDLL:=LoadLibraryA(buf);
if hIconDLL=0 then // not found
begin
sid.szDefaultFile.a:='plugins\'+ICOCtrlName;
- CallService(MS_UTILS_PATHTOABSOLUTE,wparam(path),lparam(@buf));
+ PathToAbsolute(path,buf);
hIconDLL:=LoadLibraryA(buf);
end;
diff --git a/plugins/Watrack/watrack.dpr b/plugins/Watrack/watrack.dpr index 363dd8dd12..0664dfa8f2 100644 --- a/plugins/Watrack/watrack.dpr +++ b/plugins/Watrack/watrack.dpr @@ -531,9 +531,26 @@ begin result:=0;
end;
+type
+ tdbetd = record
+ flags:dword;
+ event:int;
+ descr:pAnsiChar;
+ end;
+
+const
+ cdbetd: array [0..3] of tdbetd = (
+ (flags:DETF_HISTORY or DETF_MSGWINDOW; event:EVENTTYPE_WAT_REQUEST; descr:'WATrack: information request'),
+ (flags:DETF_HISTORY or DETF_MSGWINDOW; event:EVENTTYPE_WAT_ANSWER ; descr:nil),
+ (flags:DETF_HISTORY or DETF_MSGWINDOW; event:EVENTTYPE_WAT_ERROR ; descr:'WATrack: request denied'),
+ (flags:DETF_HISTORY or DETF_NONOTIFY ; event:EVENTTYPE_WAT_MESSAGE; descr:nil)
+ );
+
function OnModulesLoaded(wParam:WPARAM;lParam:LPARAM):int;cdecl;
var
p:PAnsiChar;
+ dbetd:TDBEVENTTYPEDESCR;
+ i:integer;
begin
hTimer:=0;
@@ -567,11 +584,27 @@ begin IsMultiThread:=true;
+ // Register WATrack events
+ dbetd.cbSize :=DBEVENTTYPEDESCR_SIZE;
+ dbetd.module :=PluginShort;
+ dbetd.textService:=nil;
+ dbetd.iconService:=nil;
+ dbetd.eventIcon :=0;
+
+ for i:=0 to HIGH(cdbetd) do
+ begin
+ dbetd.flags :=cdbetd[i].flags;
+ dbetd.eventType :=cdbetd[i].event;
+ dbetd.descr :=cdbetd[i].descr;
+ CallService(MS_DB_EVENT_REGISTERTYPE,0,TLPARAM(@dbetd));
+ end;
+
+ // Load WATrack modules
hEvent:=CreateEvent(nil,true,true,nil);
if hEvent<>0 then
begin
p:='WAT_INIT';
- hWATI:=CreateServiceFunction(p,@WaitAllModules);
+ CreateServiceFunction(p,@WaitAllModules);
CallService(MS_SYSTEM_WAITONHANDLE,hEvent,tlparam(p));
end;
@@ -597,22 +630,6 @@ begin ClearPlayers;
end;
-procedure FreeServices;
-begin
- DestroyServiceFunction(hGFI);
- DestroyServiceFunction(hRGS);
-
- DestroyServiceFunction(hWI);
- DestroyServiceFunction(hGMI);
- DestroyServiceFunction(hPS);
- DestroyServiceFunction(hPB);
- DestroyServiceFunction(hWATI);
- DestroyServiceFunction(hWC);
-
- DestroyServiceFunction(hFMT);
- DestroyServiceFunction(hPLR);
-end;
-
function PreShutdown(wParam:WPARAM;lParam:LPARAM):int;cdecl;
var
buf:array [0..511] of WideChar;
@@ -644,7 +661,6 @@ begin ptr:=ptr^.Next;
end;
- FreeServices;
FreeVariables;
DestroyHookableEvent(hHookWATLoaded);
@@ -684,17 +700,17 @@ begin HookEvent(ME_SYSTEM_OKTOEXIT,@PreShutdown);
HookEvent(ME_OPT_INITIALISE ,@OnOptInitialise);
- hGFI:=CreateServiceFunction(MS_WAT_GETFILEINFO ,@WATGetFileInfo);
- hRGS:=CreateServiceFunction(MS_WAT_RETURNGLOBAL ,@WATReturnGlobal);
+ CreateServiceFunction(MS_WAT_GETFILEINFO ,@WATGetFileInfo);
+ CreateServiceFunction(MS_WAT_RETURNGLOBAL ,@WATReturnGlobal);
- hGMI:=CreateServiceFunction(MS_WAT_GETMUSICINFO ,@WATGetMusicInfo);
- hPS :=CreateServiceFunction(MS_WAT_PLUGINSTATUS ,@WATPluginStatus);
- hPB :=CreateServiceFunction(MS_WAT_PRESSBUTTON ,@PressButton);
- hWI :=CreateServiceFunction(MS_WAT_WINAMPINFO ,@WinampGetInfo);
- hWC :=CreateServiceFunction(MS_WAT_WINAMPCOMMAND,@WinampCommand);
+ CreateServiceFunction(MS_WAT_GETMUSICINFO ,@WATGetMusicInfo);
+ CreateServiceFunction(MS_WAT_PLUGINSTATUS ,@WATPluginStatus);
+ CreateServiceFunction(MS_WAT_PRESSBUTTON ,@PressButton);
+ CreateServiceFunction(MS_WAT_WINAMPINFO ,@WinampGetInfo);
+ CreateServiceFunction(MS_WAT_WINAMPCOMMAND,@WinampCommand);
- hFMT:=CreateServiceFunction(MS_WAT_FORMAT,@ServiceFormat);
- hPLR:=CreateServiceFunction(MS_WAT_PLAYER,@ServicePlayer);
+ CreateServiceFunction(MS_WAT_FORMAT,@ServiceFormat);
+ CreateServiceFunction(MS_WAT_PLAYER,@ServicePlayer);
FillChar(SongInfoA,SizeOf(SongInfoA),0);
FillChar(SongInfo ,SizeOf(SongInfo ),0);
@@ -711,7 +727,7 @@ exports Load, Unload,
MirandaPluginInfoEx;
-initialization
+begin
DisableThreadLibraryCalls(hInstance);
end.
|