From: Dirk B. <db...@us...> - 2005-05-22 10:22:42
|
Update of /cvsroot/win32forth/win32forth/apps/PlayVirginRadio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12115/apps/PlayVirginRadio Added Files: PlayVirginRadio.f Virgin.ico Log Message: New application "PlayVirginRadio" added --- NEW FILE: PlayVirginRadio.f --- \ File: PlayVirginRadio.f \ \ Authors: Dirk Busch di...@wi... \ \ Created: Montag, Mai 16 2005 - dbu \ Updated: Montag, Mai 16 2005 - dbu \ \ Simple application that play's "Virgin Radio" from the net \ The w32fHtmlDisplay.dll is nedded. cr .( Loading Player 4th...) anew -PlayVirginRadio.f needs struct.f needs apps\Player4\TrayWindow.f needs HtmlDisplayControl.f true value turnkey? \ false value turnkey? 0 value _CurrentPopup \ ----------------------------------------------------------------------------- \ Define the Main Window \ ----------------------------------------------------------------------------- :Object MainWindow <super TrayWindow HtmlDisplayControl Player :M WindowTitle: ( -- Zstring ) \ window caption z" Virgin Radio Player" ;M :M WindowStyle: ( -- n ) [ WS_OVERLAPPED WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX or WS_MINIMIZEBOX or ] literal ;M :M StartSize: ( -- w h ) 470 265 ;M :M On_Size: ( -- ) On_Size: super AutoSize: Player ;M :M WM_CLOSE ( h m w l -- res ) Stop: Player DestroyWindow: Player WM_CLOSE WM: Super bye 0 ;M :M ShowWindow: ( -- ) IsVisible?: self 0= if ShowWindow: super then ;M :M HideWindow: ( -- ) IsVisible?: self if HideWindow: super then ;M :M GetTooltip: ( -- addr len ) WindowTitle: self zcount ;M :M Play: ( -- ) z" http://www.smgradio.com/core/player/index.html?service=vc" SetURL: Player ;M :M Pause: ( -- ) Stop: Player ;M :M Resume: ( -- ) Refresh: Player ;M :M On_Init: ( -- ) On_Init: super 1001 SetId: Player self Start: Player ;M :M DefaultIcon: ( -- hIcon ) \ return the default icon handle for window s" Virgin.ico" LoadIconFile ;M ;Object \ ----------------------------------------------------------------------------- \ Turn the sound on and off \ ----------------------------------------------------------------------------- WinLibrary winmm.dll : (volume!) ( left-sound-volume right-sound-volume -- ) depth 2 >= if 0max 99 min 65535 100 */ 65536 * swap 0max 99 min 65535 100 */ + 0 Call waveOutSetVolume drop else cr ." No enough parameters !!! " then ; : volume! ( sound-volume -- ) dup (volume!) ; 100 value volume : SoundOn ( -- ) 100 dup to volume volume! ; : SoundOff ( -- ) 0 dup to volume volume! ; : SoundOnOff ( -- ) volume 0= if SoundOn else SoundOff then ; \ ----------------------------------------------------------------------------- \ Define the Popup bar \ ----------------------------------------------------------------------------- \ POPUPBAR player-popup-bar \ POPUP " " \ MENUITEM "&Sound on/off" SoundOnOff ; \ MENUSEPARATOR \ MENUITEM "&Exit\tAlt+F4" DestroyWindow: MainWindow ; \ ENDBAR \ ----------------------------------------------------------------------------- \ ----------------------------------------------------------------------------- : uninit-player ( -- ) DestroyWindow: MainWindow ExitHtmlControl SoundOn ; unload-chain chain-add-before uninit-player \ ----------------------------------------------------------------------------- \ ----------------------------------------------------------------------------- : InitPlayer ( -- ) InitHtmlControl \ must be called once at startup Start: MainWindow Play: MainWindow \ start playing radio... HideWindow: MainWindow \ hide the window in the traybar \ player-popup-bar SetPopupBar: MainWindow ; \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ \\\\\ Turnkey without needing w32fConsole.dll \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Create MessageStructure 32 allot : MessageLoop ( -- ) \ instead of "Begin key drop again" BEGIN 0 0 0 MessageStructure Call GetMessage WHILE MessageStructure HandleMessages drop REPEAT ; : NoConsole ( -- ) initialization-chain do-chain default-application ; ' NoConsole is default-hello \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ \\\\\ The application \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ : go ( -- ) InitPlayer Turnkeyed? IF MessageLoop bye THEN ; turnkey? [if] \ Tell Imageman that we don't need the w32fconsole.dll \ if possible (in older w32f versions you have to modify \ Imageman.f to do this). also VIMAGE [defined] CONSOLE-DLL? [if] false to CONSOLE-DLL? [then] \ Tell Imageman that we don't need the w32fHtmlDisplay.dll \ if possible (in older w32f versions you have to modify \ Imageman.f to do this). [defined] HTML-DISPLAY-DLL? [if] true to HTML-DISPLAY-DLL? [then] ' go turnkey PlayVirginRadio.exe 5 pause-seconds [else] go [then] |