diff options
Diffstat (limited to 'protocols/mRadio')
-rw-r--r-- | protocols/mRadio/i_frame.inc | 242 | ||||
-rw-r--r-- | protocols/mRadio/i_frameapi.inc | 48 | ||||
-rw-r--r-- | protocols/mRadio/i_myservice.inc | 30 | ||||
-rw-r--r-- | protocols/mRadio/i_tray.inc | 2 | ||||
-rw-r--r-- | protocols/mRadio/i_tray_api.inc | 125 | ||||
-rw-r--r-- | protocols/mRadio/i_vars.inc | 4 | ||||
-rw-r--r-- | protocols/mRadio/mradio.dpr | 8 | ||||
-rw-r--r-- | protocols/mRadio/mradio.rc | 4 | ||||
-rw-r--r-- | protocols/mRadio/mradio.res | bin | 18720 -> 18720 bytes |
9 files changed, 31 insertions, 432 deletions
diff --git a/protocols/mRadio/i_frame.inc b/protocols/mRadio/i_frame.inc deleted file mode 100644 index 89de119d0e..0000000000 --- a/protocols/mRadio/i_frame.inc +++ /dev/null @@ -1,242 +0,0 @@ -{mRadio frame}
-const
- frm_back:pAnsiChar = 'Frame background';
-const
- FrameWnd:HWND = 0;
- FrameId:integer = -1;
- OldEditProc:pointer=nil;
- pattern:pWideChar=nil;
- current: THANDLE = 0;
-var
- FrameCtrl:PControl;
- colorhook:THANDLE;
- hbr:HBRUSH;
- frm_bkg:TCOLORREF;
-
-function RadioFrameProc( Sender: PControl; var Msg: TMsg; var Rslt:Integer ): boolean;
-begin
- result:=false;
- rslt:=0;
-
- case Msg.message of
-
- WM_DESTROY: begin
- hVolFrmCtrl:=0;
- DeleteObject(hbr);
- end;
-
- WM_SHOWWINDOW: begin
- Rslt:=1;
- with Sender^ do
- hVolFrmCtrl:=Children[1].Handle;
- end;
-
- WM_CTLCOLORSTATIC: begin
-// SetBkColor(msg.wParam, frm_bkg);
- Rslt:=hbr;
- result:=True;
- end;
-
- WM_CONTEXTMENU: begin
- CallService('mRadio/Settings',0,0);
- end;
-
- WM_HSCROLL: begin
- case loword(msg.wParam) of
- SB_THUMBTRACK: begin
-// gVolume:=Hiword(msg.wParam);
- Service_RadioSetVolume(Hiword(msg.wParam){gVolume},2);
- end;
- SB_ENDSCROLL: begin
-// gVolume:=SendMessage(msg.lParam,TBM_GETPOS,0,0);
- Service_RadioSetVolume({Hiword(msg.wParam)}SendMessage(msg.lParam,TBM_GETPOS,0,0){gVolume},2)
- end;
- end;
- end;
-
- end;
-end;
-
-function DoAction(action:integer):integer;
-begin
- result:=Service_RadioMute(0,1);
-end;
-
-function ColorReload(wParam:WPARAM;lParam:LPARAM):int;cdecl;
-var
- cid:TColourID;
-// wnd:HWND;
-// i:integer;
-begin
- result:=0;
- cid.cbSize:=SizeOf(cid);
- StrCopy(cid.group,cPluginName);
- StrCopy(cid.name ,frm_back);
- frm_bkg:=CallService(MS_COLOUR_GETA,dword(@cid),0);
- if hbr<>0 then DeleteObject(hbr);
- hbr:=CreateSolidBrush(frm_bkg);
-
- FrameCtrl.Children[1].Width := FrameCtrl.Children[1].Width-1;
- FrameCtrl.Children[1].Width := FrameCtrl.Children[1].Width+1;
-
- FrameCtrl.InvalidateEx;
- FrameCtrl.Update;
-end;
-
-function GetIcon(action:integer;stat:integer=AST_NORMAL):cardinal;
-begin
- case stat of
- AST_NORMAL : result:=CallService(MS_SKIN2_GETICON,0,dword(IcoBtnOn));
- AST_PRESSED: result:=CallService(MS_SKIN2_GETICON,0,dword(IcoBtnOff));
- else
- result:=0;
- end;
-end;
-
-procedure MyErase(DummySelf, Sender:PControl; DC:HDC);
-begin
-end;
-
-procedure MyEraseFrame(DummySelf, Sender:PControl; DC:HDC);
-var
- rc:TRECT;
-begin
- GetClientRect(Sender.Handle, rc);
- Sender.Canvas.Brush.Color := frm_bkg;
- Sender.Canvas.FillRect(rc);
-end;
-
-function CreateFrameWindow(parent:HWND):THANDLE;
-var
- TB:PTrackbar;
-begin
- result:=0;
-
- FrameCtrl:=NewAlienPanel(parent,esNone);
- if FrameCtrl<>nil then
- begin
- result:=FrameCtrl.GetWindowHandle;
- with FrameCtrl^ do
- begin
- // Button
- btnMute:=CreateIcoButton(FrameCtrl,GetIcon,DoAction,IDC_RADIO_MUTE);
- with btnMute^ do
- begin
- SetSize(16,16);
- SetPosition(FrameCtrl.Width-18,0);
- Anchor(false,true,true,false);
-
- AsCheckbox:=true;
- end;
-
- // Trackbar
- TB:=NewTrackbar(FrameCtrl,[trbTooltips,trbNoTicks,trbBoth,trbNoBorder],nil);
- with TB^ do
- begin
- SetSize(FrameCtrl.Width-24,18);
- SetPosition(2,0);
- Anchor(true,true,true,false);
-
- RangeMin:=0;
- RangeMax:=100;
- PageSize:=20;
-
- OnEraseBkGnd:=TOnPaint(MakeMethod(nil, @MyErase));
- end;
-
- AttachProc(@RadioFrameProc);
- end;
-
- with FrameCtrl^ do
- begin
- MinWidth :=80;
- MinHeight:=20;
- Height:=18;
- Anchor(true,true,true,true);
-// OnMessage:=TOnMessage(MakeMethod(nil, @MyEraseFrame));
- OnEraseBkGnd:=TOnPaint(MakeMethod(nil, @MyEraseFrame));
-{
- OnPaint :=FrameCtrl.Paint;
- OnResize :=FrameCtrl.FrameResize;
- OnMouseDown:=FrameCtrl.MouseDown;
-}
- end;
- end;
-end;
-
-procedure CreateFrame(parent:HWND);
-var
- Frame:TCLISTFrame;
-// wnd:HWND;
-// tmp:cardinal;
- tr:TRECT;
- cid:TColourID;
-begin
- if ServiceExists(MS_CLIST_FRAMES_ADDFRAME)=0 then
- exit;
- if parent=0 then
- parent:=CallService(MS_CLUI_GETHWND,0,0);
-
- FrameWnd:=CreateFrameWindow(parent);
-
- if FrameWnd<>0 then
- begin
- GetWindowRect(FrameWnd,tr);
- FillChar(Frame,SizeOf(Frame),0);
- with Frame do
- begin
- cbSize :=SizeOf(Frame);
- hWnd :=FrameWnd;
- hIcon :=0;
- align :=alTop;
- height :=tr.bottom-tr.top+2;
- if IsAnsi then
- begin
- Flags :=F_VISIBLE or F_NOBORDER;
- name.a :=cPluginName;
- TBName.a:=cPluginName + ' volume control';
- end
- else
- begin
- Flags :=F_VISIBLE or F_NOBORDER or F_UNICODE;
- name.w :=cPluginName;
- TBName.w:=cPluginName + ' volume control';
- end;
- end;
-
- FrameId:=CallService(MS_CLIST_FRAMES_ADDFRAME,dword(@Frame),0);
- if FrameId>=0 then
- begin
- CallService(MS_CLIST_FRAMES_UPDATEFRAME,FrameId, FU_FMPOS);
-
- cid.cbSize:=SizeOf(cid);
- cid.flags :=0;
- StrCopy(cid.group,cPluginName);
- StrCopy(cid.dbSettingsGroup,cPluginName);
-
- StrCopy(cid.name ,frm_back);
- StrCopy(cid.setting,'frame_back');
- cid.defcolour:=COLOR_3DFACE;
- cid.order :=0;
- ColourRegister(@cid);
-
- hbr:=0;
- colorhook:=HookEvent(ME_COLOUR_RELOAD,@ColorReload);
- ColorReload(0,0);
- Service_RadioSetVolume(gVolume,0);
- end;
- end;
-end;
-
-procedure DestroyFrame;
-begin
- if FrameId>=0 then
- begin
- UnhookEvent(colorhook);
- CallService(MS_CLIST_FRAMES_REMOVEFRAME,FrameId,0);
- FrameId:=-1;
- end;
- FrameCtrl.Free;
- // DestroyWindow(FrameWnd);
- FrameWnd:=0;
-end;
diff --git a/protocols/mRadio/i_frameapi.inc b/protocols/mRadio/i_frameapi.inc index 002e2fc142..baca5d885f 100644 --- a/protocols/mRadio/i_frameapi.inc +++ b/protocols/mRadio/i_frameapi.inc @@ -8,7 +8,6 @@ var colorhook:THANDLE;
hbr:HBRUSH;
frm_bkg:TCOLORREF;
- OldBtnWndProc:pointer;
OldSliderWndProc:pointer;
function QSDlgResizer(Dialog:HWND;lParam:LPARAM;urc:PUTILRESIZECONTROL):int; cdecl;
@@ -29,20 +28,13 @@ begin result:=CallWindowProc(OldSliderWndProc, Dialog, hMessage, wParam, lParam);
end;
-function BtnWndProc(Dialog:HWnd;hMessage:UINT;wParam:WPARAM;lParam:LPARAM):lresult; stdcall;
-begin
- if hMessage=WM_ERASEBKGND then
- result:=1
- else
- result:=CallWindowProc(OldBtnWndProc, Dialog, hMessage, wParam, lParam);
-end;
-
function RadioFrameProc(Dialog:HWnd;hMessage:UINT;wParam:WPARAM;lParam:LPARAM):lresult; stdcall;
var
urd:TUTILRESIZEDIALOG;
rc:TRECT;
ti:TTOOLINFOW;
hwndTooltip:HWND;
+ tmp:pAnsiChar;
begin
result:=0;
case hMessage of
@@ -77,7 +69,6 @@ begin SendMessage(hVolFrmCtrl,TBM_SETPOS,1,gVolume);
OldSliderWndProc:=pointer(SetWindowLongPtrW(hVolFrmCtrl,GWL_WNDPROC,LONG_PTR(@SliderWndProc)));
- OldBtnWndProc :=pointer(SetWindowLongPtrW(hVolFrmCtrl,GWL_WNDPROC,LONG_PTR(@BtnWndProc)));
end;
WM_SIZE: begin
@@ -97,6 +88,28 @@ begin result:=1;
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);
+ end;
+ end;
+
+ WM_CTLCOLORBTN: begin
+ if THANDLE(lParam)=hMuteFrmCtrl then
+ begin
+ SetBkColor(wParam, frm_bkg);
+ result:=hbr;
+ end;
+ end;
+
WM_CTLCOLORSTATIC: begin
if THANDLE(lParam)=hVolFrmCtrl then
begin
@@ -179,18 +192,9 @@ begin hIcon :=0;
align :=alTop;
height :=tr.bottom-tr.top+2;
- if IsAnsi then
- begin
- Flags :=F_VISIBLE or F_NOBORDER;
- name.a :=cPluginName;
- TBName.a:=cPluginName + ' volume control';
- end
- else
- begin
- Flags :=F_VISIBLE or F_NOBORDER or F_UNICODE;
- name.w :=cPluginName;
- TBName.w:=cPluginName + ' volume control';
- end;
+ Flags :=F_VISIBLE or F_NOBORDER or F_UNICODE;
+ name.w :=cPluginName;
+ TBName.w:=cPluginName + ' volume control';
end;
FrameId:=CallService(MS_CLIST_FRAMES_ADDFRAME,wparam(@Frame),0);
diff --git a/protocols/mRadio/i_myservice.inc b/protocols/mRadio/i_myservice.inc index b8338a0d81..e4e76ba10f 100644 --- a/protocols/mRadio/i_myservice.inc +++ b/protocols/mRadio/i_myservice.inc @@ -116,12 +116,6 @@ begin end;
function Service_RadioMute(wParam:WPARAM;lParam:LPARAM):int;cdecl;
-var
-{$IFDEF KOL_MCK}
- med:TMouseEventData;
-{$ELSE}
- tmp:pAnsiChar;
-{$ENDIF}
begin
if gVolume=0 then
gVolume:=-1
@@ -131,30 +125,6 @@ begin if hVolFrmCtrl<>0 then
EnableWindow(hVolFrmCtrl,gVolume>=0);
-{$IFDEF KOL_MCK}
- if lParam=0 then // 0 - from Service, not frame
- begin
- if btnMute<>nil then
- begin
- FillChar(med,SizeOf(med),0);
- med.Button:=mbLeft;
- med.StopHandling:=true;
- btnMute.OnMouseDown(btnMute,med);
- // btnMute.Click; // without click processing
- btnMute.OnMouseUp (btnMute,med);
- btnMute.Invalidate;
- end
- end;
-{$ELSE}
- if hMuteFrmCtrl<>0 then
- begin
- if gVolume<0 then
- tmp:=IcoBtnOff
- else
- tmp:=IcoBtnOn;
- SetButtonIcon(hMuteFrmCtrl,tmp);
- end;
-{$ENDIF}
end;
function Service_EqOnOff(wParam:WPARAM;lParam:LPARAM):int;cdecl;
diff --git a/protocols/mRadio/i_tray.inc b/protocols/mRadio/i_tray.inc index 096e288691..fa63acc720 100644 --- a/protocols/mRadio/i_tray.inc +++ b/protocols/mRadio/i_tray.inc @@ -21,7 +21,7 @@ type function MyStrSort(para1:pointer; para2:pointer):int; cdecl;
begin
- result:=StrCmpW(pTrayRadioStation(para1).name,pTrayRadioStation(para2).name);
+ result:=lstrcmpiW{StrCmpW}(pTrayRadioStation(para1).name,pTrayRadioStation(para2).name);
end;
function ChooseStation(wParam:WPARAM;lParam,lParam1:LPARAM):int; cdecl;
diff --git a/protocols/mRadio/i_tray_api.inc b/protocols/mRadio/i_tray_api.inc deleted file mode 100644 index 9339a10613..0000000000 --- a/protocols/mRadio/i_tray_api.inc +++ /dev/null @@ -1,125 +0,0 @@ -{}
-type
- pTrayRadioStation = ^tTrayRadioStation;
- tTrayRadioStation = record
- name:pWideChar;
- handle:THANDLE;
- end;
-
-function MyStrSort(para1:pointer; para2:pointer):int; cdecl;
-begin
- result:=StrCmpW(pTrayRadioStation(para1).name,pTrayRadioStation(para2).name);
-end;
-
-function MakeStationsMenu:HMENU;
-var
- hContact:Cardinal;
- sl:TSortedList;
- p:pWideChar;
- i:integer;
- flag:integer;
- tmp:pTrayRadioStation;
-begin
- result:=CreatePopupMenu;
- if result<>0 then
- begin
- FillChar(sl,SizeOf(sl),0);
- sl.increment:=16;
- sl.sortFunc:=@MyStrSort;
- hContact:=CallService(MS_DB_CONTACT_FINDFIRST,0,0);
- while hContact<>0 do
- begin
- if StrCmp(PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0)),cPluginName)=0 then
- begin
- p:=DBReadUnicode(hContact,strCList,'MyHandle',nil);
- if p<>nil then
- begin
- mGetMem(tmp,SizeOf(tTrayRadioStation));
- tmp.name:=p;
- tmp.handle:=hContact;
- List_InsertPtr(@sl,tmp);
- end;
- end;
- hContact:=CallService(MS_DB_CONTACT_FINDNEXT,hContact,0);
- end;
-
- for i:=0 to sl.realCount-1 do
- begin
- if (i=0) or ((i mod 20)<>0) then
- flag:=MF_STRING
- else
- flag:=MF_STRING or MF_MENUBARBREAK;
- tmp:=sl.Items[i];
- AppendMenuW(result,flag,tmp.handle,tmp.name);
- mFreeMem(tmp.name);
- mFreeMem(tmp);
- end;
- List_Destroy(@sl);
- end;
-end;
-
-function CreateTrayMenu(wParam:WPARAM;lParam:LPARAM):int; cdecl;
-const
- startid = 100;
-var
- menu:HMENU;
- flag,id:integer;
- pt:TPOINT;
- playstr:pWideChar;
-begin
- id:=0;
- menu:=CreatePopupMenu;
- if menu<>0 then
- begin
- if gVolume<0 then
- flag:=MF_STRING+MF_CHECKED
- else
- flag:=MF_STRING+MF_UNCHECKED;
-
- if CallService(MS_RADIO_COMMAND,MRC_STATUS,RD_STATUS_GET)<>RD_STATUS_PAUSED then
- playstr:='Pause'
- else
- playstr:='Play';
-
- AppendMenuW(menu,flag ,startid+1,TranslateW('Mute'));
- AppendMenuW(menu,MF_STRING,startid+2,TranslateW(playstr));
- AppendMenuW(menu,MF_STRING,startid+3,TranslateW('Stop'));
- AppendMenuW(menu,MF_SEPARATOR,0,nil);
- AppendMenuW(menu,MF_POPUP,MakeStationsMenu,TranslateW('Play Station'));
- GetCursorPos(pt);
- id:=integer(TrackPopupMenu(menu,TPM_RETURNCMD+TPM_NONOTIFY,pt.x,pt.y,0,hiddenwindow,nil));
- case id of
- 0: ; // nothing
- startid+1: begin // mute
- Service_RadioMute(0,0);
- end;
- startid+2: begin // play/pause
- CallService(MS_RADIO_COMMAND,MRC_PAUSE,0);
- end;
- startid+3: begin // stop
- CallService(MS_RADIO_COMMAND,MRC_STOP,0);
- end;
- else // choose station
- Service_RadioPlayStop(id,0);
- end;
- DestroyMenu(menu);
- end;
- result:=id;
-end;
-
-procedure CreateMIMTrayMenu;
-var
- mi:TCListMenuItem;
-begin
- if ServiceExists(MS_CLIST_ADDTRAYMENUITEM)<>0 then
-// if hiddenwindow<>0 then
- begin
- FillChar(mi, sizeof(mi), 0);
- mi.cbSize :=sizeof(mi);
- mi.pszService:=MS_RADIO_TRAYMENU;
- mi.szName.a :=cPluginName;
- mi.hIcon :=CallService(MS_SKIN2_GETICON,0,lparam(IcoBtnSettings));
- Menu_AddTrayMenuItem(@mi);
- end;
-end;
-
diff --git a/protocols/mRadio/i_vars.inc b/protocols/mRadio/i_vars.inc index 26e7024cc1..5d75dc7fae 100644 --- a/protocols/mRadio/i_vars.inc +++ b/protocols/mRadio/i_vars.inc @@ -97,11 +97,7 @@ const hVolCtrl :HWND=0;
hVolFrmCtrl :HWND=0;
const
- {$IFDEF KOL_MCK}
- btnMute:pIcoButton = nil;
- {$ELSE}
hMuteFrmCtrl:HWND=0;
- {$ENDIF}
const
Inited:boolean=false;
const
diff --git a/protocols/mRadio/mradio.dpr b/protocols/mRadio/mradio.dpr index 56c2b7dba9..274fbd8977 100644 --- a/protocols/mRadio/mradio.dpr +++ b/protocols/mRadio/mradio.dpr @@ -9,7 +9,7 @@ library mradio; uses
// FastMM4,
- {$IFDEF KOL_MCK}kol,icobuttons,KOLCCtrls,{$ENDIF}Windows,messages,commctrl
+ Windows,messages,commctrl
,common,io,wrapper,wrapdlgs,syswin
,Dynamic_Bass,dynbasswma
,m_api,dbsettings,mirutils,playlist,memini;
@@ -91,11 +91,7 @@ end; {$include i_service.inc}
{$include i_myservice.inc}
{$include i_hotkey.inc}
-{$IFDEF KOL_MCK}
- {$include i_frame.inc}
-{$ELSE}
- {$include i_frameapi.inc}
-{$ENDIF}
+{$include i_frameapi.inc}
{$include i_tray.inc}
{$include i_visual.inc}
{$include i_optdlg.inc}
diff --git a/protocols/mRadio/mradio.rc b/protocols/mRadio/mradio.rc index 91e976fa35..2b81408090 100644 --- a/protocols/mRadio/mradio.rc +++ b/protocols/mRadio/mradio.rc @@ -138,8 +138,8 @@ 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
+ BS_OWNERDRAW
+// BS_FLAT | BS_ICON | BS_PUSHLIKE | BS_CHECKBOX | BS_DEFPUSHBUTTON | BS_CENTER | BS_VCENTER
END
diff --git a/protocols/mRadio/mradio.res b/protocols/mRadio/mradio.res Binary files differindex d70c64c58e..10d008f143 100644 --- a/protocols/mRadio/mradio.res +++ b/protocols/mRadio/mradio.res |