summaryrefslogtreecommitdiff
path: root/plugins/Watrack/watrack.dpr
diff options
context:
space:
mode:
authorAlexey Kulakov <panda75@bk.ru>2014-01-16 03:11:48 +0000
committerAlexey Kulakov <panda75@bk.ru>2014-01-16 03:11:48 +0000
commitde34b251b442cdf72b13c407d6b60c343c123bb3 (patch)
treea2e05db9606405b78b949ccc67860bb2096f1f5e /plugins/Watrack/watrack.dpr
parent74220939c1156067d46ccb85cbc307737cd5a244 (diff)
sync
git-svn-id: http://svn.miranda-ng.org/main/trunk@7674 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Watrack/watrack.dpr')
-rw-r--r--plugins/Watrack/watrack.dpr72
1 files changed, 44 insertions, 28 deletions
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.