summaryrefslogtreecommitdiff
path: root/plugins/mRadio
diff options
context:
space:
mode:
authorAlexey Kulakov <panda75@bk.ru>2014-04-05 17:52:11 +0000
committerAlexey Kulakov <panda75@bk.ru>2014-04-05 17:52:11 +0000
commitc4e2e2cfa438205154e7a074e46bd0fb267bb35d (patch)
treed75c11082a4d9f71a4858af52d216e3b2b907fd9 /plugins/mRadio
parent0b9c05beba5766dfc43e127244b1c4893e9c8a5d (diff)
mRadio "Quick Open" added
git-svn-id: http://svn.miranda-ng.org/main/trunk@8863 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/mRadio')
-rw-r--r--plugins/mRadio/i_myservice.inc36
-rw-r--r--plugins/mRadio/i_optdlg.inc68
-rw-r--r--plugins/mRadio/i_tray.inc8
-rw-r--r--plugins/mRadio/i_visual.inc6
-rw-r--r--plugins/mRadio/mr_rc.inc2
-rw-r--r--plugins/mRadio/mradio.dpr28
-rw-r--r--plugins/mRadio/mradio.rc34
-rw-r--r--plugins/mRadio/rbass.pas68
-rw-r--r--plugins/mRadio/rframeapi.pas35
-rw-r--r--plugins/mRadio/rglobal.pas2
10 files changed, 184 insertions, 103 deletions
diff --git a/plugins/mRadio/i_myservice.inc b/plugins/mRadio/i_myservice.inc
index dc144b616d..74b4c11b4f 100644
--- a/plugins/mRadio/i_myservice.inc
+++ b/plugins/mRadio/i_myservice.inc
@@ -281,3 +281,39 @@ begin
end;
end;
end;
+
+function QuickOpen(wParam:WPARAM;lParam:LPARAM):int; cdecl;
+var
+ filter:pWideChar;
+ buf:array [0..MAX_PATH-1] of WideChar;
+begin
+ filter:=ConstructFilter;
+ if ShowDlgW(@buf,nil,filter) then
+ begin
+ result:=CallService(MS_DB_CONTACT_ADD,0,0);
+ if result<>0 then
+ begin
+ CallService(MS_PROTO_ADDTOCONTACT,result,tlparam(PluginName));
+ //
+// DBWriteByte(result,strCList,'Hidden' ,0);
+ DBWriteByte(result,strCList,'NotOnList',1);
+ // URL
+ DBWriteUnicode(result,PluginName,optStationURL,@buf);
+ DBWriteUnicode(result,PluginName,optFirstName ,@buf);
+ // Name
+ DBWriteUnicode(result,strCList ,optMyHandle,@buf);
+ DBWriteUnicode(result,PluginName,optNick ,@buf);
+
+ SetStatus(result,ID_STATUS_OFFLINE);
+
+ CallService(MS_IGNORE_IGNORE,result,IGNOREEVENT_USERONLINE{IGNOREEVENT_ALL});
+
+ CallService(MS_RADIO_COMMAND,MRC_PLAY,result);
+ end;
+ end
+ else
+ begin
+ result:=0;
+ end;
+ mFreeMem(filter);
+end;
diff --git a/plugins/mRadio/i_optdlg.inc b/plugins/mRadio/i_optdlg.inc
index c09e302e13..20e8b86786 100644
--- a/plugins/mRadio/i_optdlg.inc
+++ b/plugins/mRadio/i_optdlg.inc
@@ -1,72 +1,4 @@
{Options dialog}
-
-function MakeFilter(dst,descr,full,filter:PWideChar;show:bool=true):pWideChar;
-var
- p:PWideChar;
-begin
- if full<>nil then
- begin
- p:=StrEndW(full);
- p^:=';';
- StrCopyW(p+1,filter);
- end;
-
- dst:=StrCopyEW(dst,TranslateW(descr));
- if show then
- begin
- dst^ :=' ';
- (dst+1)^:='(';
- dst:=StrCopyEW(dst+2,filter);
- dst^:=')';
- inc(dst);
- dst^:=#0;
- end;
- inc(dst);
- result:=StrCopyEW(dst,filter)+1;
-end;
-
-function ConstructFilter:pointer;
-var
- pc:pWideChar;
- ph:PDWord;
- Info:PBASS_PLUGININFO;
- i:integer;
- full:array [0..511] of WideChar;
- tmpbuf1,tmpbuf2:array [0..127] of WideChar;
-begin
- mGetMem(pc,4096);
-// FillChar(pc^,4096,0);
- result:=pc;
- full[0]:=#0;
- pc:=MakeFilter(pc,'All files' ,nil ,'*.*',false);
- pc:=MakeFilter(pc,'Playlist files',full,'*.pls;*.m3u;*.m3u8;*.asx');
- pc:=MakeFilter(pc,'BASS built-in' ,full,'*.mp3;*.mp2;*.mp1;*.ogg;*.wav;*.aif');
-
- if BassStatus=rbs_null then
- MyLoadBass;
-
- if BassStatus<>rbs_null then
- begin
- ph:=pointer(BASS_PluginGetInfo(0));
- if ph<>nil then
- begin
- while ph^<>0 do
- begin
- Info:=BASS_PluginGetInfo(ph^);
- for i:=0 to Info^.formatc-1 do
- //!! need to translate Ansi -> wide
- with Info^.Formats[i] do
- begin
- pc:=MakeFilter(pc,FastAnsiToWideBuf(name,tmpbuf1),full,FastAnsiToWideBuf(exts,tmpbuf2));
- end;
- inc(ph);
- end;
- end;
- end;
- pc:=MakeFilter(pc,'All supported formats',nil,full,false);
- pc^:=#0;
-end;
-
procedure SetButtonIcons(Dialog:HWND);
var
ti:TTOOLINFOW;
diff --git a/plugins/mRadio/i_tray.inc b/plugins/mRadio/i_tray.inc
index ab0a04e41d..85d4841dcf 100644
--- a/plugins/mRadio/i_tray.inc
+++ b/plugins/mRadio/i_tray.inc
@@ -201,6 +201,14 @@ begin
else
Menu_AddMainMenuItem(@mi);
+ mi.szName.w :='Quick Open';
+ mi.position :=4;
+ mi.pszService:=MS_RADIO_QUICKOPEN;
+ if doTray then
+ Menu_AddTrayMenuItem(@mi)
+ else
+ Menu_AddMainMenuItem(@mi);
+
mi.szName.w :='Play Station';
mi.position :=1000;
mi.pszService:=nil;
diff --git a/plugins/mRadio/i_visual.inc b/plugins/mRadio/i_visual.inc
index 3c0b56ebb2..86ba8fb2c6 100644
--- a/plugins/mRadio/i_visual.inc
+++ b/plugins/mRadio/i_visual.inc
@@ -105,6 +105,12 @@ begin
Skin_AddIcon(@sid);
DestroyIcon(sid.hDefaultIcon);
+ sid.hDefaultIcon :=LoadImage(hInstance,MAKEINTRESOURCE(IDI_OPEN),IMAGE_ICON,16,16,0);
+ sid.pszName :=IcoBtnOpen;
+ sid.szDescription.a:='Quick Open';
+ Skin_AddIcon(@sid);
+ DestroyIcon(sid.hDefaultIcon);
+
sid.hDefaultIcon :=LoadImage(hInstance,MAKEINTRESOURCE(IDI_ADD),IMAGE_ICON,16,16,0);
sid.pszName :=IcoBtnAdd;
sid.szDescription.a:='Add EQ preset';
diff --git a/plugins/mRadio/mr_rc.inc b/plugins/mRadio/mr_rc.inc
index 9cabc91824..363a3a0d98 100644
--- a/plugins/mRadio/mr_rc.inc
+++ b/plugins/mRadio/mr_rc.inc
@@ -77,6 +77,7 @@ const
IDC_RADIO_MUTE = 1025;
IDC_RADIO_VOL = 1026;
+ IDC_RADIO_OPEN = 1027;
BTN_RECUP = 202;
BTN_RECDN = 203;
@@ -86,3 +87,4 @@ const
IDI_OFF = 304;
IDI_ADD = 305;
IDI_DEL = 306;
+ IDI_OPEN = 307;
diff --git a/plugins/mRadio/mradio.dpr b/plugins/mRadio/mradio.dpr
index de7d7219da..e20e020ffc 100644
--- a/plugins/mRadio/mradio.dpr
+++ b/plugins/mRadio/mradio.dpr
@@ -173,19 +173,21 @@ begin
// hooks and services
hhRadioStatus:=CreateHookableEvent(ME_RADIO_STATUS);
- 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);
-
- CreateServiceFunction(MS_RADIO_TRAYMENU,@CreateTrayMenu);
-
- CreateServiceFunction(MS_RADIO_EXPORT ,@ExportAll);
- CreateServiceFunction(MS_RADIO_IMPORT ,@ImportAll);
+ 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);
+
+ CreateServiceFunction(MS_RADIO_TRAYMENU ,@CreateTrayMenu);
+
+ CreateServiceFunction(MS_RADIO_QUICKOPEN,@QuickOpen);
+
+ CreateServiceFunction(MS_RADIO_EXPORT ,@ExportAll);
+ CreateServiceFunction(MS_RADIO_IMPORT ,@ImportAll);
CreateProtoServices;
diff --git a/plugins/mRadio/mradio.rc b/plugins/mRadio/mradio.rc
index 9d51638bc1..6a21f46294 100644
--- a/plugins/mRadio/mradio.rc
+++ b/plugins/mRadio/mradio.rc
@@ -108,7 +108,22 @@ FONT 8, "MS Shell Dlg", 0, 0
CONTROL "",IDC_EQ09,"msctls_trackbar32",TBS_LEFT|TBS_VERT|WS_TABSTOP,263,137,22,75
GROUPBOX "Equalizer",IDC_STATIC,2,131,298,92
}
-
+/*
+IDD_INFO DIALOGEX 0, 0, 222, 132
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | DS_3DLOOK
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0
+BEGIN
+ LTEXT "Station",IDC_STATIC,8,1,98,8
+ EDITTEXT IDC_STATION,4,11,102,12,ES_AUTOHSCROLL
+ LTEXT "URL",IDC_STATIC,8,27,98,8
+ EDITTEXT IDC_STATIONURL,4,37,102,12,ES_AUTOHSCROLL
+ LTEXT "Genre",IDC_STATIC,8,53,98,8
+ EDITTEXT IDC_GENRE,4,63,102,12,ES_AUTOHSCROLL
+ LTEXT "Bitrate",IDC_STATIC,8,79,72,8
+ EDITTEXT IDC_BITRATE,4,89,76,12, ES_RIGHT | ES_NUMBER
+END
+*/
IDD_SEARCH DIALOGEX 0, 0, 110, 140
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
@@ -138,11 +153,9 @@ STYLE DS_SETFONT | WS_CHILD | DS_FIXEDSYS | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0
BEGIN
- CONTROL "" ,IDC_RADIO_VOL ,"msctls_trackbar32", TBS_BOTTOM|TBS_NOTICKS|$100,0,2,98,11
-// CONTROL "*",IDC_RADIO_MUTE,"MButtonClass" ,WS_TABSTOP,100,1,12,12//,$18000000
- PUSHBUTTON "*" ,IDC_RADIO_MUTE, 100,1,12,12,
- BS_OWNERDRAW
-// BS_FLAT | BS_ICON | BS_PUSHLIKE | BS_CHECKBOX | BS_DEFPUSHBUTTON | BS_CENTER | BS_VCENTER
+ PUSHBUTTON "*" ,IDC_RADIO_OPEN, 2,1,12,12, BS_OWNERDRAW
+ CONTROL "" ,IDC_RADIO_VOL ,"msctls_trackbar32", TBS_BOTTOM|TBS_NOTICKS|$100,16,2,82,11
+ PUSHBUTTON "*" ,IDC_RADIO_MUTE, 100,1,12,12, BS_OWNERDRAW
END
@@ -151,13 +164,14 @@ IDI_ON ICON "ico\on.ico"
IDI_OFF ICON "ico\off.ico"
IDI_ADD ICON "ico\new.ico"
IDI_DEL ICON "ico\delete.ico"
+IDI_OPEN ICON "ico\open.ico"
BTN_RECUP ICON "ico\recon.ico"
BTN_RECDN ICON "ico\recoff.ico"
/*
LANGUAGE 0,0
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,0,2,4
- PRODUCTVERSION 0,0,2,4
+ FILEVERSION 0,0,2,2
+ PRODUCTVERSION 0,0,8,0
FILEFLAGSMASK $3F
FILEOS 4
FILETYPE 2
@@ -170,11 +184,11 @@ BEGIN
VALUE "CompanyName",""0
VALUE "Comments", "Plugin to play Internet radio"0
VALUE "FileDescription", "mRadio Mod plugin for Miranda NG"0
- VALUE "FileVersion", "0, 0, 2, 4 "0
+ VALUE "FileVersion", "0, 0, 2, 2 "0
VALUE "InternalName", "mRadio Mod"0
VALUE "OriginalFilename", "mradio.dll"0
VALUE "ProductName", "mRadio Mod Dynamic Link Library (DLL)"0
- VALUE "ProductVersion", "0, 0, 2, 4 "0
+ VALUE "ProductVersion", "0, 0, 8, 0 "0
VALUE "SpecialBuild", "10.05.2012 "0
END
END
diff --git a/plugins/mRadio/rbass.pas b/plugins/mRadio/rbass.pas
index 77957f4a46..ebdb33f913 100644
--- a/plugins/mRadio/rbass.pas
+++ b/plugins/mRadio/rbass.pas
@@ -10,6 +10,7 @@ procedure BassError(text:PWideChar);
procedure OpenURL(url:PWideChar); cdecl;
procedure StopStation;
function GetMusicFormat:PAnsiChar;
+function ConstructFilter:pointer;
procedure EQ_ON;
procedure EQ_OFF;
@@ -1115,4 +1116,71 @@ begin
end;
end;
+function MakeFilter(dst,descr,full,filter:PWideChar;show:bool=true):pWideChar;
+var
+ p:PWideChar;
+begin
+ if full<>nil then
+ begin
+ p:=StrEndW(full);
+ p^:=';';
+ StrCopyW(p+1,filter);
+ end;
+
+ dst:=StrCopyEW(dst,TranslateW(descr));
+ if show then
+ begin
+ dst^ :=' ';
+ (dst+1)^:='(';
+ dst:=StrCopyEW(dst+2,filter);
+ dst^:=')';
+ inc(dst);
+ dst^:=#0;
+ end;
+ inc(dst);
+ result:=StrCopyEW(dst,filter)+1;
+end;
+
+function ConstructFilter:pointer;
+var
+ pc:pWideChar;
+ ph:PDWord;
+ Info:PBASS_PLUGININFO;
+ i:integer;
+ full:array [0..511] of WideChar;
+ tmpbuf1,tmpbuf2:array [0..127] of WideChar;
+begin
+ mGetMem(pc,4096);
+// FillChar(pc^,4096,0);
+ result:=pc;
+ full[0]:=#0;
+ pc:=MakeFilter(pc,'All files' ,nil ,'*.*',false);
+ pc:=MakeFilter(pc,'Playlist files',full,'*.pls;*.m3u;*.m3u8;*.asx');
+ pc:=MakeFilter(pc,'BASS built-in' ,full,'*.mp3;*.mp2;*.mp1;*.ogg;*.wav;*.aif');
+
+ if BassStatus=rbs_null then
+ MyLoadBass;
+
+ if BassStatus<>rbs_null then
+ begin
+ ph:=pointer(BASS_PluginGetInfo(0));
+ if ph<>nil then
+ begin
+ while ph^<>0 do
+ begin
+ Info:=BASS_PluginGetInfo(ph^);
+ for i:=0 to Info^.formatc-1 do
+ //!! need to translate Ansi -> wide
+ with Info^.Formats[i] do
+ begin
+ pc:=MakeFilter(pc,FastAnsiToWideBuf(name,tmpbuf1),full,FastAnsiToWideBuf(exts,tmpbuf2));
+ end;
+ inc(ph);
+ end;
+ end;
+ end;
+ pc:=MakeFilter(pc,'All supported formats',nil,full,false);
+ pc^:=#0;
+end;
+
end.
diff --git a/plugins/mRadio/rframeapi.pas b/plugins/mRadio/rframeapi.pas
index dd44aaa353..84a5e25f76 100644
--- a/plugins/mRadio/rframeapi.pas
+++ b/plugins/mRadio/rframeapi.pas
@@ -35,6 +35,7 @@ var
function QSDlgResizer(Dialog:HWND;lParam:LPARAM;urc:PUTILRESIZECONTROL):int; cdecl;
begin
case urc^.wId of
+ IDC_RADIO_OPEN: result:=RD_ANCHORX_LEFT or RD_ANCHORY_CENTRE;
IDC_RADIO_MUTE: result:=RD_ANCHORX_RIGHT or RD_ANCHORY_CENTRE;
IDC_RADIO_VOL : result:=RD_ANCHORX_WIDTH or RD_ANCHORY_CENTRE;
else
@@ -115,21 +116,30 @@ begin
end;
WM_DRAWITEM: begin
- if wParam=IDC_RADIO_MUTE then
- begin
- result:=1;
- if gVolume<0 then
- tmp:=IcoBtnOff
- else
- tmp:=IcoBtnOn;
- DrawIconEx(PDRAWITEMSTRUCT(lParam)^.hDC,0,0,
- CallService(MS_SKIN2_GETICON,0,TLPARAM(tmp)),
- 16,16,0,hbr,DI_NORMAL);
+ case wParam of
+ IDC_RADIO_OPEN: begin
+ result:=1;
+ DrawIconEx(PDRAWITEMSTRUCT(lParam)^.hDC,0,0,
+ CallService(MS_SKIN2_GETICON,0,TLPARAM(IcoBtnOpen)),
+ 16,16,0,hbr,DI_NORMAL);
+ end;
+
+ IDC_RADIO_MUTE: begin
+ result:=1;
+ if gVolume<0 then
+ tmp:=IcoBtnOff
+ else
+ tmp:=IcoBtnOn;
+ DrawIconEx(PDRAWITEMSTRUCT(lParam)^.hDC,0,0,
+ CallService(MS_SKIN2_GETICON,0,TLPARAM(tmp)),
+ 16,16,0,hbr,DI_NORMAL);
+ end;
end;
end;
WM_CTLCOLORBTN: begin
- if THANDLE(lParam)=GetDlgItem(Dialog,IDC_RADIO_MUTE) then
+ if (THANDLE(lParam)=GetDlgItem(Dialog,IDC_RADIO_MUTE)) or
+ (THANDLE(lParam)=GetDlgItem(Dialog,IDC_RADIO_OPEN)) then
begin
SetBkColor(wParam, frm_bkg);
result:=hbr;
@@ -153,6 +163,9 @@ begin
BN_CLICKED: begin
case loword(wParam) of
+ IDC_RADIO_OPEN: begin
+ CallService(MS_RADIO_QUICKOPEN,0,0);
+ end;
IDC_RADIO_MUTE: begin
CallService(MS_RADIO_MUTE,0,1);
end;
diff --git a/plugins/mRadio/rglobal.pas b/plugins/mRadio/rglobal.pas
index 313c62015c..04c36e8696 100644
--- a/plugins/mRadio/rglobal.pas
+++ b/plugins/mRadio/rglobal.pas
@@ -119,6 +119,7 @@ const
IcoBtnRecDn :PAnsiChar = 'Radio_RecDn';
IcoBtnAdd :PAnsiChar = 'Radio_Add';
IcoBtnDel :PAnsiChar = 'Radio_Del';
+ IcoBtnOpen :PAnsiChar = 'Radio_Open';
//----- EAX -----
@@ -163,7 +164,6 @@ procedure SetStatus(hContact:TMCONTACT;status:integer);
function GetDefaultRecPath:pWideChar;
function GetStatusText(status:integer;toCList:boolean=false):PWideChar;
-
implementation
uses