diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-10 19:12:33 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-10 19:12:33 +0000 |
commit | 6ad65c4d4fce1d5ce1a1873ee84feaff753c9d48 (patch) | |
tree | 94e232bdd680291eb7192851d71935f89b196fd2 /plugins/Watrack | |
parent | 9a4be1a673e76cb205a11076b7d8162eb593feab (diff) |
Watrack:
- event hooks wiped out;
- icons & menus optimization;
- merge of memory leak fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@3963 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Watrack')
-rw-r--r-- | plugins/Watrack/global.pas | 1 | ||||
-rw-r--r-- | plugins/Watrack/i_gui.inc | 8 | ||||
-rw-r--r-- | plugins/Watrack/i_vars.inc | 4 | ||||
-rw-r--r-- | plugins/Watrack/kolframe/frm_vars.inc | 3 | ||||
-rw-r--r-- | plugins/Watrack/kolframe/kolframe.pas | 8 | ||||
-rw-r--r-- | plugins/Watrack/lastfm/lastfm.pas | 12 | ||||
-rw-r--r-- | plugins/Watrack/myshows/myshows.pas | 18 | ||||
-rw-r--r-- | plugins/Watrack/popup/pop_vars.inc | 6 | ||||
-rw-r--r-- | plugins/Watrack/popup/popups.pas | 30 | ||||
-rw-r--r-- | plugins/Watrack/proto/proto.pas | 62 | ||||
-rw-r--r-- | plugins/Watrack/srv_player.pas | 12 | ||||
-rw-r--r-- | plugins/Watrack/stat/stat_vars.inc | 2 | ||||
-rw-r--r-- | plugins/Watrack/stat/statlog.pas | 7 | ||||
-rw-r--r-- | plugins/Watrack/status/i_st_vars.inc | 2 | ||||
-rw-r--r-- | plugins/Watrack/status/status.pas | 9 | ||||
-rw-r--r-- | plugins/Watrack/templates/templates.pas | 2 | ||||
-rw-r--r-- | plugins/Watrack/watrack.dpr | 78 |
17 files changed, 105 insertions, 159 deletions
diff --git a/plugins/Watrack/global.pas b/plugins/Watrack/global.pas index 14d915a973..748fcaa0f5 100644 --- a/plugins/Watrack/global.pas +++ b/plugins/Watrack/global.pas @@ -28,6 +28,7 @@ type Init :function(aGetStatus:boolean=false):integer;
DeInit :procedure(aSetDisable:boolean);
AddOption :function(var tmpl:pAnsiChar;var proc:pointer;var name:pAnsiChar):integer;
+ Check :function(load:boolean):boolean;
ModuleName:pWideChar;
ModuleStat:integer; // filling by the way
Button :HWND; // checkboxes for switch on/off
diff --git a/plugins/Watrack/i_gui.inc b/plugins/Watrack/i_gui.inc index dc79632b1e..2ed5411bed 100644 --- a/plugins/Watrack/i_gui.inc +++ b/plugins/Watrack/i_gui.inc @@ -4,8 +4,6 @@ function OnTTBLoaded(wParam:WPARAM;lParam:LPARAM):int;cdecl; var
ttb:m_api.TTBButton;
begin
- UnhookEvent(onloadhook);
-
FillChar(ttb,SizeOf(ttb),0);
ttb.cbSize :=SizeOf(ttb);
ttb.dwFlags:=TTBBF_VISIBLE or TTBBF_SHOWTOOLTIP;
@@ -99,12 +97,6 @@ begin // toptoolbar
if ServiceExists(MS_TTB_GETBUTTONOPTIONS)<>0 then
begin
-{
- CallService(MS_TTB_GETBUTTONOPTIONS,(ttbInfo shl 16)+TTBO_ALLDATA,tlparam(@ttb));
- ttb.hIconUp:=CallService(MS_SKIN2_GETICON,0,tlparam(IcoBtnInfo));
- ttb.hIconDn:=ttb.hIconUp;
- CallService(MS_TTB_SETBUTTONOPTIONS,(ttbInfo shl 16)+TTBO_ALLDATA,tlparam(@ttb));
-}
CallService(MS_TTB_GETBUTTONOPTIONS,(ttbState shl 16)+TTBO_ALLDATA,tlparam(@ttb));
ttb.hIconDn:=CallService(MS_SKIN2_GETICON,0,tlparam(IcoBtnEnable));
ttb.hIconUp:=CallService(MS_SKIN2_GETICON,0,tlparam(IcoBtnDisable));
diff --git a/plugins/Watrack/i_vars.inc b/plugins/Watrack/i_vars.inc index 955170fdfa..73bba4fa05 100644 --- a/plugins/Watrack/i_vars.inc +++ b/plugins/Watrack/i_vars.inc @@ -15,11 +15,7 @@ var hFMT,
hPLR,
hRGS,
- wsic,
hHookWATLoaded:THANDLE;
- opthook:cardinal;
- onloadhook:cardinal;
- hHookShutdown:cardinal;
inshotkey:cardinal;
globhotkey:cardinal;
hTimer:cardinal;
diff --git a/plugins/Watrack/kolframe/frm_vars.inc b/plugins/Watrack/kolframe/frm_vars.inc index 88dd71f0d1..f4d9372002 100644 --- a/plugins/Watrack/kolframe/frm_vars.inc +++ b/plugins/Watrack/kolframe/frm_vars.inc @@ -1,8 +1,5 @@ {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 615991d810..4e93b6dcc2 100644 --- a/plugins/Watrack/kolframe/kolframe.pas +++ b/plugins/Watrack/kolframe/kolframe.pas @@ -223,7 +223,7 @@ begin PWATFrameData(FrameCtrl.CustomData).FrameId:=CallService(MS_CLIST_FRAMES_ADDFRAME,dword(@CLFrame),0);
if PWATFrameData(FrameCtrl.CustomData).FrameId>=0 then
begin
- plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
+ HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
end;
end;
result:=FrameWnd<>0;
@@ -235,8 +235,6 @@ var begin
if (FrameCtrl<>nil) and (PWATFrameData(FrameCtrl.CustomData).FrameId>=0) then
begin
- UnhookEvent(plStatusHook);
-
id:=PWATFrameData(FrameCtrl.CustomData).FrameId;
FrameCtrl.Free;
FrameCtrl:=nil;
@@ -273,7 +271,7 @@ begin result:=ord(CreateFrame(0));
if result<>0 then
- sic:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
end;
procedure DeInitProc(aSetDisable:boolean);
@@ -281,8 +279,6 @@ begin if aSetDisable then
SetModStatus(0);
- if sic<>0 then UnhookEvent(sic);
- sic:=0;
DestroyFrame;
end;
diff --git a/plugins/Watrack/lastfm/lastfm.pas b/plugins/Watrack/lastfm/lastfm.pas index 1b7d3e0f3d..e91aafffa9 100644 --- a/plugins/Watrack/lastfm/lastfm.pas +++ b/plugins/Watrack/lastfm/lastfm.pas @@ -15,7 +15,6 @@ const IcoLastFM:pAnsiChar = 'WATrack_lasfm';
var
lfm_tries:integer;
- sic:THANDLE;
slastinf:THANDLE;
slast:THANDLE;
const
@@ -222,9 +221,6 @@ begin result:=0;
end;
-var
- plStatusHook:THANDLE;
-
function InitProc(aGetStatus:boolean=false):integer;
begin
slastinf:=CreateServiceFunction(MS_WAT_LASTFMINFO,@SrvLastFMInfo);
@@ -248,9 +244,9 @@ begin slast:=CreateServiceFunction(MS_WAT_LASTFM,@SrvLastFM);
if hMenuLast=0 then
CreateMenus;
- sic:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
if (lfm_on and 4)=0 then
- plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
+ HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
end;
procedure DeInitProc(aSetDisable:boolean);
@@ -263,8 +259,6 @@ begin CallService(MS_CLIST_REMOVEMAINMENUITEM,hMenuLast,0);
hMenuLast:=0;
DestroyServiceFunction(slast);
- UnhookEvent(plStatusHook);
- UnhookEvent(sic);
if hTimer<>0 then
begin
@@ -289,7 +283,7 @@ begin last.Next :=ModuleLink;
last.Init :=@InitProc;
last.DeInit :=@DeInitProc;
- last.AddOption:=@AddOptionsPage;
+ last.AddOption :=@AddOptionsPage;
last.ModuleName:='Last.FM';
ModuleLink :=@last;
diff --git a/plugins/Watrack/myshows/myshows.pas b/plugins/Watrack/myshows/myshows.pas index 0e6ff07da2..5715c530d9 100644 --- a/plugins/Watrack/myshows/myshows.pas +++ b/plugins/Watrack/myshows/myshows.pas @@ -27,10 +27,7 @@ type end;
var
msh_tries,
-// msh_timeout,
msh_scrobpos:integer;
- sic:THANDLE;
-// slastinf:THANDLE;
slast:THANDLE;
MSData:tMyShowsData;
const
@@ -255,9 +252,6 @@ begin result:=0;
end;
-var
- plStatusHook:THANDLE;
-
function InitProc(aGetStatus:boolean=false):integer;
begin
// slastinf:=CreateServiceFunction(MS_WAT_MYSHOWSINFO,@SrvMyShowsInfo);
@@ -281,21 +275,17 @@ begin slast:=CreateServiceFunction(MS_WAT_MYSHOWS,@SrvMyShows);
if hMenuMyShows=0 then
CreateMenus;
- sic:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
if (msh_on and 4)=0 then
- plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
+ HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
end;
procedure DeInitProc(aSetDisable:boolean);
begin
if aSetDisable then
- SetModStatus(0)
- else
-;// DestroyServiceFunction(slastinf);
+ SetModStatus(0);
DestroyServiceFunction(slast);
- UnhookEvent(plStatusHook);
- UnhookEvent(sic);
if hTimer<>0 then
begin
@@ -324,7 +314,7 @@ begin mmyshows.DeInit :=@DeInitProc;
mmyshows.AddOption :=@AddOptionsPage;
mmyshows.ModuleName:='MyShows.ru';
- ModuleLink :=@mmyshows;
+ ModuleLink :=@mmyshows;
end;
diff --git a/plugins/Watrack/popup/pop_vars.inc b/plugins/Watrack/popup/pop_vars.inc index 4a845aaadc..0be12fd5e8 100644 --- a/plugins/Watrack/popup/pop_vars.inc +++ b/plugins/Watrack/popup/pop_vars.inc @@ -19,9 +19,5 @@ var IsFreeImagePresent:boolean;
var
hMenuInfo :THANDLE;
- ssmi,sic,
- plStatusHook:THANDLE;
PopupPresent:Bool;
- onttbhook,
- opthook:THANDLE;
- ttbInfo:THANDLE;
\ No newline at end of file + ttbInfo :THANDLE;
\ No newline at end of file diff --git a/plugins/Watrack/popup/popups.pas b/plugins/Watrack/popup/popups.pas index 8fe3f69ae1..2d4ba8d08c 100644 --- a/plugins/Watrack/popup/popups.pas +++ b/plugins/Watrack/popup/popups.pas @@ -403,8 +403,6 @@ var ttb:TTBButton;
begin
result:=0;
- if onttbhook<>0 then
- UnhookEvent(onttbhook);
// get info button
FillChar(ttb,SizeOf(ttb),0);
ttb.cbSize :=SizeOf(ttb);
@@ -414,8 +412,6 @@ 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 -------------
@@ -437,7 +433,7 @@ begin SetModStatus(1);
result:=1;
- ssmi:=CreateServiceFunction(MS_WAT_SHOWMUSICINFO,@OpenPopUp);
+ CreateServiceFunction(MS_WAT_SHOWMUSICINFO,@OpenPopUp);
FillChar(sid,SizeOf(TSKINICONDESC),0);
sid.cbSize:=SizeOf(TSKINICONDESC);
@@ -449,7 +445,7 @@ begin sid.szDescription.a:='Music Info';
Skin_AddIcon(@sid);
DestroyIcon(sid.hDefaultIcon);
- sic:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
FillChar(mi,SizeOf(mi),0);
mi.cbSize :=SizeOf(mi);
@@ -465,7 +461,7 @@ begin IsFreeImagePresent:=ServiceExists(MS_IMG_LOAD )<>0;
IsPopup2Present :=ServiceExists(MS_POPUP_ADDPOPUP2)<>0;
PopupPresent:=true;
- opthook:=HookEvent(ME_OPT_INITIALISE,@OnOptInitialise);
+ HookEvent(ME_OPT_INITIALISE,@OnOptInitialise);
loadpopup;
regpophotkey;
@@ -485,17 +481,8 @@ begin PopupPresent:=false;
end;
- 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;
+ HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
+ HookEvent(ME_TTB_MODULELOADED,@OnTTBLoaded);
end;
procedure DeInitProc(aSetDisable:boolean);
@@ -504,22 +491,17 @@ begin SetModStatus(0);
CallService(MS_CLIST_REMOVEMAINMENUITEM,hMenuInfo,0);
- UnhookEvent(plStatusHook);
- DestroyServiceFunction(ssmi);
- UnhookEvent(sic);
freepopup;
if ttbInfo<>0 then
begin
- if ServiceExists(MS_TTB_REMOVEBUTTON)>0 then
- CallService(MS_TTB_REMOVEBUTTON,WPARAM(ttbInfo),0);
+ CallService(MS_TTB_REMOVEBUTTON,WPARAM(ttbInfo),0);
ttbInfo:=0;
end;
if PopupPresent then
begin
- UnhookEvent(opthook);
mFreeMem(ActionList);
end;
end;
diff --git a/plugins/Watrack/proto/proto.pas b/plugins/Watrack/proto/proto.pas index 254a02bac6..44efda6ec8 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,
- icchangedhook,
- hAddUserHook,
- hContactMenuItem,
- contexthook:THANDLE;
+ hContactMenuItem:THANDLE;
ProtoText:pWideChar;
HistMask:cardinal;
@@ -231,7 +231,7 @@ begin isNewRequest:=StrCmp(PPROTORECVEVENT(ccs^.lParam)^.szMessage.a,
wpRequestNew,Length(wpRequestNew))=0;
- if isNewRequest or
+ if isNewRequest or
(StrCmp(PPROTORECVEVENT(ccs^.lParam)^.szMessage.a,
wpRequest,Length(wpRequest))=0) then
begin
@@ -255,7 +255,7 @@ begin curpos:=nil;
if DisablePlugin<>dsPermanent then
begin
- if CallService(MS_WAT_GETMUSICINFO,0,0)=WAT_PLS_NOTFOUND then
+ if CallService(MS_WAT_GETMUSICINFO,0,0)=uint_ptr(WAT_PLS_NOTFOUND) then
begin
s:=#0#0#0'No player found at this time';
textpos:=s+3;
@@ -448,42 +448,7 @@ begin desc._type :=PROTOTYPE_TRANSLATION;
CallService(MS_PROTO_REGISTERMODULE,0,lparam(@desc));
-// CreateProtoServiceFunction(PluginShort,PSS_MESSAGE ,@SendMessageProcW);
-// CreateProtoServiceFunction(PluginShort,PSS_MESSAGEW,@SendMessageProcW);
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 -------------
@@ -505,14 +470,15 @@ begin result:=1;
ReadOptions;
- RegisterIcons;
+
+ Icon_Register(hInstance,PluginShort,@Icons,1);
FillChar(mi, sizeof(mi), 0);
mi.cbSize :=sizeof(mi);
mi.szPopupName.a:=PluginShort;
- mi.flags :=CMIF_NOTOFFLINE or CMIF_NOTOFFLIST;
+ mi.flags :=CMIF_NOTOFFLINE or CMIF_NOTOFFLIST or CMIF_ICONFROMICOLIB;
// mi.popupPosition:=MenuUserInfoPos;
- mi.hIcon :=CallService(MS_SKIN2_GETICON,0,lparam(IcoBtnContext));
+ mi.hIcon :=Icons.hIcolib;
mi.szName.a :='Get user''s Music Info';
mi.pszService :=MS_WAT_GETCONTACTINFO;
hContactMenuItem:=Menu_AddContactMenuItem(@mi);
@@ -520,8 +486,8 @@ begin SetProtocol;
RegisterContacts;
hGCI:=CreateServiceFunction(MS_WAT_GETCONTACTINFO,@SendRequest);
- contexthook :=HookEvent(ME_CLIST_PREBUILDCONTACTMENU,@OnContactMenu);
- hAddUserHook:=HookEvent(ME_DB_CONTACT_ADDED ,@HookAddUser);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU,@OnContactMenu);
+ HookEvent(ME_DB_CONTACT_ADDED ,@HookAddUser);
end;
procedure DeInitProc(aSetDisable:boolean);
@@ -529,10 +495,6 @@ begin if aSetDisable then
SetModStatus(0);
- UnhookEvent(hAddUserHook);
- UnhookEvent(contexthook);
- UnhookEvent(icchangedhook);
-
DestroyServiceFunction(hSRM);
DestroyServiceFunction(hGCI);
mFreeMem(ProtoText);
diff --git a/plugins/Watrack/srv_player.pas b/plugins/Watrack/srv_player.pas index 69bac628fd..07db406a8a 100644 --- a/plugins/Watrack/srv_player.pas +++ b/plugins/Watrack/srv_player.pas @@ -550,9 +550,15 @@ begin UTF8ToWide(GetParamSectionStr(sec,'notes'),rec.Notes);
- ServicePlayer(WAT_ACT_REGISTER,lparam(@rec));
+ if ServicePlayer(WAT_ACT_REGISTER,lparam(@rec))=WAT_RES_ERROR then
+ begin
+ ClearTemplate(pcell);
+// mFreeMem(rec.URL);
+ mFreeMem(rec.Notes);
+ end
+ else
+ inc(NumPlayers);
- inc(NumPlayers);
while ptr^<>#0 do inc(ptr);
inc(ptr);
end;
@@ -740,7 +746,7 @@ var begin
result:=WAT_RES_ERROR;
wnd:=CheckAllPlayers(flags,lstat,dummy);
- if wnd<>dword(WAT_RES_NOTFOUND) then
+ if wnd<>THANDLE(WAT_RES_NOTFOUND) then
if plyLink^[0].Command<>nil then
result:=tCommandProc(plyLink^[0].Command)(wnd,wParam,lParam)
else if (plyLink^[0].flags and WAT_OPT_WINAMPAPI)<>0 then
diff --git a/plugins/Watrack/stat/stat_vars.inc b/plugins/Watrack/stat/stat_vars.inc index ccc7c0c5b2..d609329c4c 100644 --- a/plugins/Watrack/stat/stat_vars.inc +++ b/plugins/Watrack/stat/stat_vars.inc @@ -16,6 +16,4 @@ var hPackLog,
hMakeReport,
hAddToLog,
- plStatusHook,
- sic,
hMenuReport:THANDLE;
diff --git a/plugins/Watrack/stat/statlog.pas b/plugins/Watrack/stat/statlog.pas index 25ad6f1d6f..4eb275e142 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);
- sic:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
FillChar(mi, sizeof(mi), 0);
mi.cbSize :=sizeof(mi);
@@ -602,7 +602,8 @@ begin mi.pszService :=MS_WAT_MAKEREPORT;
mi.popupPosition:=MenuReportPos;
hMenuReport :=Menu_AddMainMenuItem(@mi);
- plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
+
+ HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
end;
procedure DeInitProc(aSetDisable:boolean);
@@ -611,8 +612,6 @@ begin SetModStatus(0);
CallService(MS_CLIST_REMOVEMAINMENUITEM,hMenuReport,0);
- UnhookEvent(plStatusHook);
- UnhookEvent(sic);
DestroyServiceFunction(hPackLog);
DestroyServiceFunction(hMakeReport);
DestroyServiceFunction(hAddToLog);
diff --git a/plugins/Watrack/status/i_st_vars.inc b/plugins/Watrack/status/i_st_vars.inc index e1696c3621..50113b293c 100644 --- a/plugins/Watrack/status/i_st_vars.inc +++ b/plugins/Watrack/status/i_st_vars.inc @@ -18,8 +18,6 @@ var XStatusSet :cardinal;
ClearXStat :cardinal;
hINS :THANDLE;
-// hLTo :THANDLE;
- plStatusHook :THANDLE;
const
Changed:cardinal=0;
diff --git a/plugins/Watrack/status/status.pas b/plugins/Watrack/status/status.pas index b5db16bb1c..ccc9b2a447 100644 --- a/plugins/Watrack/status/status.pas +++ b/plugins/Watrack/status/status.pas @@ -66,12 +66,7 @@ begin CreateTemplates;
hINS:=CreateServiceFunction(MS_WAT_INSERT,@InsertProc);
reghotkey;
- plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
-
-// mStatus.ModuleStat:=1;
-
-// if ServiceExists(MS_LISTENINGTO_GETPARSEDTEXT)<>0 then
-// hLTo:=CreateServiceFunction(MS_LISTENINGTO_GETPARSEDTEXT,@ListenProc);
+ HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus);
end;
procedure DeInitProc(aSetDisable:boolean);
@@ -88,7 +83,6 @@ begin end;
// DestroyServiceFunction(hLTo);
DestroyServiceFunction(hINS);
- UnhookEvent(plStatusHook);
FreeProtoList;
FreeTemplates;
@@ -133,7 +127,6 @@ begin mStatus.DeInit :=@DeInitProc;
mStatus.AddOption :=@AddOptionsPage;
mStatus.ModuleName:='Statuses';
-// mStatus.ModuleStat:=0;
ModuleLink :=@mStatus;
end;
diff --git a/plugins/Watrack/templates/templates.pas b/plugins/Watrack/templates/templates.pas index ec56580852..b18c346f33 100644 --- a/plugins/Watrack/templates/templates.pas +++ b/plugins/Watrack/templates/templates.pas @@ -105,7 +105,7 @@ begin Tmpl.DeInit :=@DeInitProc;
Tmpl.AddOption :=@AddOptionsPage;
Tmpl.ModuleName:=nil;
- ModuleLink :=@Tmpl;
+ ModuleLink :=@Tmpl;
end;
begin
diff --git a/plugins/Watrack/watrack.dpr b/plugins/Watrack/watrack.dpr index a3d7abf464..7c48e5eb29 100644 --- a/plugins/Watrack/watrack.dpr +++ b/plugins/Watrack/watrack.dpr @@ -8,7 +8,7 @@ library WATrack; uses
// FastMM not compatible with FPC, internal for delphi xe
// {$IFNDEF COMPILER_16_UP}{$IFNDEF FPC}fastmm4,{$ENDIF}{$ENDIF}
- m_api,dbsettings,winampapi,
+ m_api,dbsettings,activex,winampapi,
Windows,messages,commctrl,//uxtheme,
srv_format,srv_player,wat_api,wrapper,
common,syswin,HlpDlg,mirutils
@@ -66,7 +66,6 @@ begin move(SongInfo,SongInfoA,SizeOf(tSongInfo));
with SongInfoA do
begin
- FastWideToAnsi(SongInfo.url,url);
if enc=WAT_INF_ANSI then
begin
WideToAnsi(SongInfo.artist ,artist ,cp);
@@ -125,9 +124,15 @@ begin result:=1;
if (lParam=0) or (pSongInfo(lParam).mfile=nil) then exit;
dst:=pointer(lParam);
+
+ p:=dst^.mfile;
+ ClearTrackInfo(dst^,false);
+ dst^.mfile:=p;
+{
StrDupW(p,dst^.mfile);
ClearTrackInfo(dst^,false); //!!!!
dst^.mfile:=p;
+}
// FillChar(dst,SizeOf(dst),0);
// FillChar(si,SizeOf(si),0);
{
@@ -484,25 +489,65 @@ begin CloseHandle(hEvent);
end;
+procedure DoTheDew(load:boolean);
+var
+ ptr:pwModule;
+ newstate:boolean;
+begin
+ ptr:=ModuleLink;
+ while ptr<>nil do
+ begin
+ if @ptr^.Check<>nil then
+ ptr^.Check(load);
+ ptr:=ptr^.Next;
+ end;
+
+ // TTB
+ newstate:=ServiceExists(MS_TTB_ADDBUTTON)<>0;
+ if newstate=(ttbState<>0) then
+ exit;
+
+ if ttbState=0 then
+ begin
+ HookEvent(ME_TTB_MODULELOADED,@OnTTBLoaded);
+ end
+ else
+ begin
+ if ServiceExists(MS_TTB_REMOVEBUTTON)>0 then
+ CallService(MS_TTB_REMOVEBUTTON,WPARAM(ttbState),0);
+ ttbState:=0;
+ end;
+end;
+
+function OnPluginLoad(wParam:WPARAM;lParam:LPARAM):int;cdecl;
+begin
+ DoTheDew(true);
+ result:=0;
+end;
+
+function OnPluginUnload(wParam:WPARAM;lParam:LPARAM):int;cdecl;
+begin
+ DoTheDew(false);
+ result:=0;
+end;
+
function OnModulesLoaded(wParam:WPARAM;lParam:LPARAM):int;cdecl;
var
p:PAnsiChar;
begin
- UnhookEvent(onloadhook);
-
CallService(MS_DBEDIT_REGISTERSINGLEMODULE,twparam(PluginShort),0);
hTimer:=0;
+ OleInitialize(nil);
+
if RegisterIcons then
- wsic:=HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged)
- else
- wsic:=0;
+ HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged);
CreateMenus;
if ServiceExists(MS_TTB_ADDBUTTON)<>0 then
- onloadhook:=HookEvent(ME_TTB_MODULELOADED,@OnTTBLoaded)
+ HookEvent(ME_TTB_MODULELOADED,@OnTTBLoaded)
else
ttbState:=0;
@@ -539,6 +584,9 @@ begin StartMSNHook;
result:=0;
+
+ HookEvent(ME_SYSTEM_MODULELOAD ,@OnPluginLoad);
+ HookEvent(ME_SYSTEM_MODULEUNLOAD,@OnPluginUnLoad);
end;
procedure FreeVariables;
@@ -598,17 +646,14 @@ begin ptr:=ptr^.Next;
end;
-// UnhookEvent(plStatusHook);
- UnhookEvent(hHookShutdown);
- UnhookEvent(opthook);
- if wsic<>0 then UnhookEvent(wsic);
-
FreeServices;
FreeVariables;
DestroyHookableEvent(hHookWATLoaded);
DestroyHookableEvent(hHookWATStatus);
+ OleUnInitialize;
+
//delete cover files
buf[0]:=#0;
GetTempPathW(511,buf);
@@ -637,8 +682,9 @@ begin hHookWATLoaded:=CreateHookableEvent(ME_WAT_MODULELOADED);
hHookWATStatus:=CreateHookableEvent(ME_WAT_NEWSTATUS);
- hHookShutdown :=HookEvent(ME_SYSTEM_OKTOEXIT,@PreShutdown);
- opthook :=HookEvent(ME_OPT_INITIALISE ,@OnOptInitialise);
+
+ HookEvent(ME_SYSTEM_OKTOEXIT,@PreShutdown);
+ HookEvent(ME_OPT_INITIALISE ,@OnOptInitialise);
hGFI:=CreateServiceFunction(MS_WAT_GETFILEINFO ,@WATGetFileInfo);
hRGS:=CreateServiceFunction(MS_WAT_RETURNGLOBAL ,@WATReturnGlobal);
@@ -655,7 +701,7 @@ begin FillChar(SongInfoA,SizeOf(SongInfoA),0);
FillChar(SongInfo ,SizeOf(SongInfo ),0);
FillChar(WorkSI ,SizeOf(SongInfo ),0);
- onloadhook:=HookEvent(ME_SYSTEM_MODULESLOADED,@OnModulesLoaded);
+ HookEvent(ME_SYSTEM_MODULESLOADED,@OnModulesLoaded);
end;
function Unload:int; cdecl;
|