diff options
-rw-r--r-- | plugins/mRadio/i_bass.inc | 2 | ||||
-rw-r--r-- | plugins/mRadio/i_optdlg.inc | 10 | ||||
-rw-r--r-- | plugins/mRadio/i_vars.inc | 22 | ||||
-rw-r--r-- | plugins/mRadio/mradio.dpr | 78 |
4 files changed, 47 insertions, 65 deletions
diff --git a/plugins/mRadio/i_bass.inc b/plugins/mRadio/i_bass.inc index b4df5cfc39..5e430de282 100644 --- a/plugins/mRadio/i_bass.inc +++ b/plugins/mRadio/i_bass.inc @@ -123,7 +123,7 @@ begin pc := nil;
if SelectDirectory(TranslateW('Choose BASS.dll path'),pc,0) then
begin
- CallService(MS_UTILS_PATHTORELATIVEW,wparam(pc),lparam(@buf));
+ PathToRelativeW(pc,buf);
pc:=StrCopyEW(basspath,buf);
if (pc-1)^<>'\' then
begin
diff --git a/plugins/mRadio/i_optdlg.inc b/plugins/mRadio/i_optdlg.inc index 7e72aa5409..7f1ec138cd 100644 --- a/plugins/mRadio/i_optdlg.inc +++ b/plugins/mRadio/i_optdlg.inc @@ -334,7 +334,7 @@ begin dst:=nil;
if SelectDirectory(pWideChar(nil),dst,Dialog) then
begin
- CallService(MS_UTILS_PATHTORELATIVEW,twparam(dst),tlparam(@buf));
+ PathToRelativeW(dst,buf);
SetDlgItemTextW(Dialog,IDC_ED_RECPATH,pWideChar(@buf));
mFreeMem(dst);
end;
@@ -468,8 +468,10 @@ begin begin
mGetMem(recpath,MAX_PATH*SizeOf(WideChar));
recpath^:=#0;
- CallService(MS_UTILS_PATHTORELATIVEW,twparam(@buf),tlparam(recpath));
- end;
+ PathToRelativeW(buf,recpath);
+ end
+ else
+ recpath:=GetDefaultRecPath;
DBWriteUnicode(0,PluginName,optRecPath,recpath);
end;
end;
@@ -713,7 +715,7 @@ begin dst:=nil;
if SelectDirectory(pWideChar(nil),dst,Dialog) then
begin
- CallService(MS_UTILS_PATHTORELATIVEW,twparam(dst),tlparam(@buf));
+ PathToRelativeW(dst,buf);
SetDlgItemTextW(Dialog,IDC_BASSPATH,pWideChar(@buf));
mFreeMem(dst);
end;
diff --git a/plugins/mRadio/i_vars.inc b/plugins/mRadio/i_vars.inc index 97db03260a..086279d522 100644 --- a/plugins/mRadio/i_vars.inc +++ b/plugins/mRadio/i_vars.inc @@ -47,29 +47,9 @@ const var
hhRadioStatus,
- // service handles
- hsPlayStop,
- hsRecord,
- hsSettings,
- hsSetVol,
- hsGetVol,
- hsMute,
- hsCommand,
- hsExport,
- hsImport,
- hsTrayMenu,
- hsEqOnOff,
-
- hNetLib,
- hDblClick,
- hHookShutdown,
hCMenuItemRec,
hCMenuItemPlay,
- contexthook,
- opthook,
- onsetting,
- ondelete,
- onloadhook:THANDLE;
+ hNetLib:THANDLE;
hiddenwindow:HWND;
var
plist:tPlaylist;
diff --git a/plugins/mRadio/mradio.dpr b/plugins/mRadio/mradio.dpr index 744ccc9813..4cf4aa75b5 100644 --- a/plugins/mRadio/mradio.dpr +++ b/plugins/mRadio/mradio.dpr @@ -81,6 +81,22 @@ begin DBWriteWord(hContact,PluginName,optStatus,status);
end;
+function GetDefaultRecPath:pWideChar;
+var
+ dat:TREPLACEVARSDATA;
+ mstr,szData:pWideChar;
+ buf:array [0..MAX_PATH-1] of WideChar;
+begin
+ FillChar(dat,SizeOf(dat),0);
+ dat.cbSize :=SizeOf(TREPLACEVARSDATA);
+ dat.dwFlags:=RVF_UNICODE;
+ szData:='%miranda_userdata%'+'\'+cPluginName;
+ mstr:=pWideChar(CallService(MS_UTILS_REPLACEVARS, WPARAM(szData), LPARAM(@dat)));
+ PathToRelativeW(mstr,buf);
+ StrDupW(result,buf);
+ mir_free(mstr);
+end;
+
{$include i_search.inc}
{$include i_bass.inc}
{$include i_cc.inc}
@@ -115,8 +131,6 @@ var szTemp:array [0..255] of AnsiChar;
i:integer;
begin
- UnhookEvent(onloadhook);
-
DBWriteDWord(0,PluginName,optVersion,PluginInfo.version);
szTemp[0]:='E';
@@ -146,6 +160,11 @@ begin // CallService(MS_RADIO_COMMAND,MRC_RECORD,2); record off - not so necessary
recpath:=DBReadUnicode(0,PluginName,optRecPath);
+ if (recpath=nil) or (recpath^=#0) then
+ begin
+ recpath:=GetDefaultRecPath;
+ end;
+
usedevice:=DBReadString(0,PluginName,optDevice);
sPreBuf:=DBReadWord(0,PluginName,optPreBuf,75);
@@ -185,8 +204,8 @@ begin else
ActiveContact:=0;
- onsetting:=HookEvent(ME_DB_CONTACT_SETTINGCHANGED,@OnSettingsChanged);
- ondelete :=HookEvent(ME_DB_CONTACT_DELETED ,@OnContactDeleted);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED,@OnSettingsChanged);
+ HookEvent(ME_DB_CONTACT_DELETED ,@OnContactDeleted);
randomize;
CreateFrame(0);
@@ -215,27 +234,8 @@ begin MyFreeBASS;
DBWriteByte(0,PluginName,optVolume,gVolume);
- DestroyServiceFunction(hsTrayMenu);
- DestroyServiceFunction(hsPlayStop);
- DestroyServiceFunction(hsRecord);
- DestroyServiceFunction(hsSettings);
- DestroyServiceFunction(hsSetVol);
- DestroyServiceFunction(hsGetVol);
- DestroyServiceFunction(hsMute);
- DestroyServiceFunction(hsCommand);
- DestroyServiceFunction(hsEqOnOff);
-
- DestroyServiceFunction(hsExport);
- DestroyServiceFunction(hsImport);
-
DestroyHookableEvent(hhRadioStatus);
- UnhookEvent(onsetting);
- UnhookEvent(ondelete);
- UnhookEvent(hHookShutdown);
- UnhookEvent(hDblClick);
- UnhookEvent(opthook);
- UnhookEvent(contexthook);
CallService(MS_NETLIB_CLOSEHANDLE,hNetLib,0);
mFreeMem(storage);
@@ -301,28 +301,28 @@ begin hhRadioStatus:=CreateHookableEvent(ME_RADIO_STATUS);
- hsPlayStop:=CreateServiceFunction(MS_RADIO_PLAYSTOP,@Service_RadioPlayStop);
- hsRecord :=CreateServiceFunction(MS_RADIO_RECORD ,@Service_RadioRecord);
- hsSettings:=CreateServiceFunction(MS_RADIO_SETTINGS,@Service_RadioSettings);
- hsSetVol :=CreateServiceFunction(MS_RADIO_SETVOL ,@Service_RadioSetVolume);
- hsGetVol :=CreateServiceFunction(MS_RADIO_GETVOL ,@Service_RadioGetVolume);
- hsMute :=CreateServiceFunction(MS_RADIO_MUTE ,@Service_RadioMute);
- hsCommand :=CreateServiceFunction(MS_RADIO_COMMAND ,@ControlCenter);
- hsEqOnOff :=CreateServiceFunction(MS_RADIO_EQONOFF ,@Service_EqOnOff);
+ CreateServiceFunction(MS_RADIO_PLAYSTOP,@Service_RadioPlayStop);
+ CreateServiceFunction(MS_RADIO_RECORD ,@Service_RadioRecord);
+ CreateServiceFunction(MS_RADIO_SETTINGS,@Service_RadioSettings);
+ CreateServiceFunction(MS_RADIO_SETVOL ,@Service_RadioSetVolume);
+ CreateServiceFunction(MS_RADIO_GETVOL ,@Service_RadioGetVolume);
+ CreateServiceFunction(MS_RADIO_MUTE ,@Service_RadioMute);
+ CreateServiceFunction(MS_RADIO_COMMAND ,@ControlCenter);
+ CreateServiceFunction(MS_RADIO_EQONOFF ,@Service_EqOnOff);
hiddenwindow:=CreateHiddenWindow;
- hsTrayMenu:=CreateServiceFunction(MS_RADIO_TRAYMENU,@CreateTrayMenu);
+ CreateServiceFunction(MS_RADIO_TRAYMENU,@CreateTrayMenu);
- hsExport :=CreateServiceFunction(MS_RADIO_EXPORT ,@ExportAll);
- hsImport :=CreateServiceFunction(MS_RADIO_IMPORT ,@ImportAll);
+ CreateServiceFunction(MS_RADIO_EXPORT ,@ExportAll);
+ CreateServiceFunction(MS_RADIO_IMPORT ,@ImportAll);
CreateProtoServices;
- onloadhook :=HookEvent(ME_SYSTEM_MODULESLOADED ,@OnModulesLoaded);
- hHookShutdown:=HookEvent(ME_SYSTEM_OKTOEXIT ,@PreShutdown);
- hDblClick :=HookEvent(ME_CLIST_DOUBLECLICKED ,@Service_RadioPlayStop{@DblClickProc});
- opthook :=HookEvent(ME_OPT_INITIALISE ,@OnOptInitialise);
- contexthook :=HookEvent(ME_CLIST_PREBUILDCONTACTMENU,@OnContactMenu);
+ HookEvent(ME_SYSTEM_MODULESLOADED ,@OnModulesLoaded);
+ HookEvent(ME_SYSTEM_OKTOEXIT ,@PreShutdown);
+ HookEvent(ME_CLIST_DOUBLECLICKED ,@Service_RadioPlayStop{@DblClickProc});
+ HookEvent(ME_OPT_INITIALISE ,@OnOptInitialise);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU,@OnContactMenu);
PluginStatus:=ID_STATUS_OFFLINE;
end;
|