1 /*****************************************************************************
2 * interface.cpp: WinCE gui plugin for VLC
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
7 * Authors: Marodon Cedric <cedric_marodon@yahoo.fr>
8 * Gildas Bazin <gbazin@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,
24 *****************************************************************************/
26 /*****************************************************************************
28 *****************************************************************************/
36 #include <vlc_interface.h>
44 #define NUMIMAGES 9 // Number of buttons in the toolbar
45 #define IMAGEWIDTH 17 // Width of the buttons in the toolbar
46 #define IMAGEHEIGHT 16 // Height of the buttons in the toolbar
47 #define BUTTONWIDTH 0 // Width of the button images in the toolbar
48 #define BUTTONHEIGHT 0 // Height of the button images in the toolbar
49 #define ID_TOOLBAR 2000 // Identifier of the main tool bar
52 #define HELP_SIMPLE _T("Quick file open")
53 #define HELP_ADV _T("Advanced open")
54 #define HELP_FILE _T("Open a file")
55 #define HELP_DISC _T("Open Disc Media")
56 #define HELP_NET _T("Open a network stream")
57 #define HELP_SAT _T("Open a satellite stream")
58 #define HELP_EJECT _T("Eject the DVD/CD")
59 #define HELP_EXIT _T("Exit this program")
61 #define HELP_OTHER _T("Open other types of inputs")
63 #define HELP_PLAYLIST _T("Open the playlist")
64 #define HELP_LOGS _T("Show the program logs")
65 #define HELP_FILEINFO _T("Show information about the file being played")
67 #define HELP_PREFS _T("Go to the preferences menu")
69 #define HELP_ABOUT _T("About this program")
71 #define HELP_STOP _T("Stop")
73 #define HELP_PLAY _T("Play")
74 #define HELP_PAUSE _T("Pause")
75 #define HELP_PLO _T("Playlist")
76 #define HELP_PLP _T("Previous playlist item")
77 #define HELP_PLN _T("Next playlist item")
78 #define HELP_SLOW _T("Play slower")
79 #define HELP_FAST _T("Play faster")
81 // The TBBUTTON structure contains information the toolbar buttons.
82 static TBBUTTON tbButton[] =
84 {0, ID_FILE_QUICKOPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON},
85 {1, ID_FILE_OPENNET, TBSTATE_ENABLED, TBSTYLE_BUTTON},
86 {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
87 {2, StopStream_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON},
88 {3, PlayStream_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON},
89 {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
90 {4, ID_VIEW_PLAYLIST, TBSTATE_ENABLED, TBSTYLE_BUTTON},
91 {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
92 {5, PrevStream_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON},
93 {6, NextStream_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON},
94 {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
95 {7, SlowStream_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON},
96 {8, FastStream_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON},
100 TCHAR * szToolTips[] =
102 HELP_SIMPLE, HELP_NET, HELP_STOP, HELP_PLAY, HELP_PLO, HELP_PLP,
103 HELP_PLN, HELP_SLOW, HELP_FAST
106 /*****************************************************************************
108 *****************************************************************************/
109 Interface::Interface( intf_thread_t *p_intf, CBaseWindow *p_parent,
111 : CBaseWindow( p_intf, p_parent, h_inst ),
112 hwndMain(0), hwndCB(0), hwndTB(0), hwndSlider(0), hwndLabel(0),
113 hwndVol(0), hwndSB(0), timer(0), video(0), b_volume_hold(0)
117 Interface::~Interface()
123 BOOL Interface::InitInstance()
125 /* Initializations */
126 i_old_playing_status = PAUSE_S;
128 int i_style = WS_VISIBLE;
131 i_style |= WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
134 // Create main window
136 CreateWindow( _T("VLC WinCE"), _T("VLC media player"), i_style,
137 0, MENU_HEIGHT, CW_USEDEFAULT, CW_USEDEFAULT,
138 NULL, NULL, GetInstance(), (void *)this );
140 if( !hwndMain ) return FALSE;
142 ShowWindow( hwndMain, TRUE );
143 UpdateWindow( hwndMain );
148 /***********************************************************************
154 ***********************************************************************/
155 HWND Interface::CreateMenuBar( HWND hwnd, HINSTANCE hInst )
157 HMENU menu_file, menu_view;
161 memset( &mbi, 0, sizeof(SHMENUBARINFO) );
162 mbi.cbSize = sizeof(SHMENUBARINFO);
163 mbi.hwndParent = hwnd;
164 mbi.hInstRes = hInst;
165 mbi.nToolBarId = IDR_MENUBAR;
167 if( !SHCreateMenuBar( &mbi ) )
169 MessageBox(hwnd, _T("SHCreateMenuBar Failed"), _T("Error"), MB_OK);
174 tbbi.cbSize = sizeof(tbbi);
175 tbbi.dwMask = TBIF_LPARAM;
177 SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_FILE, (LPARAM)&tbbi );
178 menu_file = (HMENU)tbbi.lParam;
179 RemoveMenu( menu_file, 0, MF_BYPOSITION );
180 SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_VIEW, (LPARAM)&tbbi );
181 menu_view = (HMENU)tbbi.lParam;
182 RemoveMenu( menu_view, 0, MF_BYPOSITION );
183 SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_SETTINGS, (LPARAM)&tbbi );
184 menu_settings = (HMENU)tbbi.lParam;
185 SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_VIDEO, (LPARAM)&tbbi );
186 menu_video = (HMENU)tbbi.lParam;
187 SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_AUDIO, (LPARAM)&tbbi );
188 menu_audio = (HMENU)tbbi.lParam;
189 SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_NAVIGATION, (LPARAM)&tbbi );
190 menu_navigation = (HMENU)tbbi.lParam;
193 menu_file = CreatePopupMenu();
194 menu_view = CreatePopupMenu();
195 menu_settings = CreatePopupMenu();
196 menu_audio = CreatePopupMenu();
197 menu_video = CreatePopupMenu();
198 menu_navigation = CreatePopupMenu();
201 AppendMenu( menu_file, MF_STRING, ID_FILE_QUICKOPEN,
202 _T("Quick &Open File...") );
203 AppendMenu( menu_file, MF_SEPARATOR, 0, 0 );
204 AppendMenu( menu_file, MF_STRING, ID_FILE_OPENFILE,
205 _T("Open &File...") );
206 AppendMenu( menu_file, MF_STRING, ID_FILE_OPENDIR,
207 _T("Open &Directory...") );
208 AppendMenu( menu_file, MF_STRING, ID_FILE_OPENNET,
209 _T("Open &Network Stream...") );
210 AppendMenu( menu_file, MF_SEPARATOR, 0, 0 );
211 AppendMenu( menu_file, MF_STRING, ID_FILE_ABOUT,
213 AppendMenu( menu_file, MF_STRING, ID_FILE_EXIT,
216 AppendMenu( menu_view, MF_STRING, ID_VIEW_PLAYLIST,
217 _T("&Playlist...") );
218 AppendMenu( menu_view, MF_STRING, ID_VIEW_MESSAGES,
219 _T("&Messages...") );
220 AppendMenu( menu_view, MF_STRING, ID_VIEW_STREAMINFO,
221 _T("Stream and Media &info...") );
223 AppendMenu( menu_settings, MF_STRING, ID_PREFERENCES,
224 _T("&Preferences...") );
231 HMENU hmenu = CreateMenu();
233 AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_file, _T("File") );
234 AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_view, _T("View") );
235 AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_settings,
237 AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_audio, _T("Audio") );
238 AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_video, _T("Video") );
239 AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_navigation, _T("Nav") );
241 SetMenu( hwnd, hmenu );
247 /***********************************************************************
252 Registers the TOOLBAR control class and creates a toolbar.
253 ***********************************************************************/
254 HWND CreateToolBar( HWND hwnd, HINSTANCE hInst )
260 INITCOMMONCONTROLSEX iccex;
261 iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
262 iccex.dwICC = ICC_BAR_CLASSES;
264 // Registers TOOLBAR control classes from the common control dll
265 InitCommonControlsEx (&iccex);
267 // Create the toolbar control
268 dwStyle = WS_VISIBLE | WS_CHILD | TBSTYLE_TOOLTIPS |
269 WS_EX_OVERLAPPEDWINDOW | CCS_NOPARENTALIGN;
271 hwndTB = CreateToolbarEx( hwnd, dwStyle, 0, NUMIMAGES,
272 hInst, IDB_BITMAP1, tbButton, sizeof(tbButton) / sizeof(TBBUTTON),
273 BUTTONWIDTH, BUTTONHEIGHT, IMAGEWIDTH, IMAGEHEIGHT, sizeof(TBBUTTON) );
275 if( !hwndTB ) return NULL;
277 // Add ToolTips to the toolbar.
278 SendMessage( hwndTB, TB_SETTOOLTIPS, (WPARAM)NUMIMAGES,
279 (LPARAM)szToolTips );
281 // Reposition the toolbar.
282 GetClientRect( hwnd, &rect );
283 GetWindowRect( hwndTB, &rectTB );
284 MoveWindow( hwndTB, rect.left, rect.bottom - rect.top - 2*MENU_HEIGHT,
285 rect.right - rect.left, MENU_HEIGHT, TRUE );
290 /***********************************************************************
296 Registers the TRACKBAR_CLASS control class and creates a trackbar.
298 ***********************************************************************/
299 HWND CreateSliderBar( HWND hwnd, HINSTANCE hInst )
304 INITCOMMONCONTROLSEX iccex;
305 iccex.dwSize = sizeof( INITCOMMONCONTROLSEX );
306 iccex.dwICC = ICC_BAR_CLASSES;
308 // Registers TRACKBAR_CLASS control classes from the common control dll
309 InitCommonControlsEx( &iccex );
311 hwndSlider = CreateWindowEx( 0, TRACKBAR_CLASS, NULL,
312 WS_CHILD | WS_VISIBLE | TBS_HORZ | WS_EX_OVERLAPPEDWINDOW |
313 TBS_BOTTOM, //|WS_CLIPSIBLINGS,
314 0, 0, 0, 0, hwnd, NULL, hInst, NULL );
316 if( !hwndSlider ) return NULL;
318 SendMessage( hwndSlider, TBM_SETRANGEMIN, 1, 0 );
319 SendMessage( hwndSlider, TBM_SETRANGEMAX, 1, SLIDER_MAX_POS );
320 SendMessage( hwndSlider, TBM_SETPOS, 1, 0 );
322 // Reposition the trackbar
323 GetClientRect( hwnd, &rect );
324 MoveWindow( hwndSlider, rect.left,
325 rect.bottom - rect.top - 2*(MENU_HEIGHT-1) - SLIDER_HEIGHT,
326 rect.right - rect.left - 40, 30, TRUE );
328 ShowWindow( hwndSlider, SW_HIDE );
333 HWND CreateStaticText( HWND hwnd, HINSTANCE hInst )
338 hwndLabel = CreateWindowEx( 0, _T("STATIC"), _T("label"),
339 WS_CHILD | WS_VISIBLE | SS_CENTER ,
340 0, 0, 0, 0, hwnd, (HMENU)1980, hInst, NULL );
342 // Reposition the trackbar
343 GetClientRect( hwnd, &rect );
345 MoveWindow( hwndLabel, rect.left,
346 rect.bottom - rect.top - 2*(MENU_HEIGHT-1) - SLIDER_HEIGHT +30,
347 rect.right - rect.left - 40,
348 SLIDER_HEIGHT - 30, TRUE );
350 ShowWindow( hwndLabel, SW_HIDE );
355 /***********************************************************************
361 Registers the TRACKBAR_CLASS control class and creates a trackbar.
363 ***********************************************************************/
364 HWND CreateVolTrackBar( HWND hwnd, HINSTANCE hInst )
369 INITCOMMONCONTROLSEX iccex;
370 iccex.dwSize = sizeof( INITCOMMONCONTROLSEX );
371 iccex.dwICC = ICC_BAR_CLASSES;
373 // Registers TRACKBAR_CLASS control classes from the common control dll
374 InitCommonControlsEx( &iccex );
376 hwndVol = CreateWindowEx( 0, TRACKBAR_CLASS, NULL,
377 WS_CHILD | WS_VISIBLE | TBS_VERT | TBS_RIGHT | TBS_AUTOTICKS |
378 WS_EX_OVERLAPPEDWINDOW, //|WS_CLIPSIBLINGS,
379 0, 0, 0, 0, hwnd, NULL, hInst, NULL );
381 if( !hwndVol ) return NULL;
383 SendMessage( hwndVol, TBM_SETRANGEMIN, 1, 0 );
384 SendMessage( hwndVol, TBM_SETRANGEMAX, 1, 200 );
385 SendMessage( hwndVol, TBM_SETPOS, 1, 100 );
386 SendMessage( hwndVol, TBM_SETTICFREQ, 50, 0 );
388 // Reposition the trackbar
389 GetClientRect( hwnd, &rect );
390 MoveWindow( hwndVol, rect.right - rect.left - 40,
391 rect.bottom - rect.top - 2*(MENU_HEIGHT-1) - SLIDER_HEIGHT,
392 40, SLIDER_HEIGHT, TRUE );
394 ShowWindow( hwndVol, SW_HIDE );
399 /***********************************************************************
405 Registers the StatusBar control class and creates a Statusbar.
407 ***********************************************************************/
408 HWND CreateStatusBar( HWND hwnd, HINSTANCE hInst )
414 INITCOMMONCONTROLSEX iccex;
415 iccex.dwSize = sizeof (INITCOMMONCONTROLSEX);
416 iccex.dwICC = ICC_BAR_CLASSES;
418 // Registers Statusbar control classes from the common control dll
419 InitCommonControlsEx( &iccex );
421 // Create the statusbar control
422 dwStyle = WS_VISIBLE | WS_CHILD | TBSTYLE_TOOLTIPS | CCS_NOPARENTALIGN;
424 hwndSB = CreateWindowEx( 0, STATUSCLASSNAME, NULL,
425 WS_CHILD | WS_VISIBLE | TBS_VERT | TBS_BOTTOM |
426 TBS_RIGHT |WS_CLIPSIBLINGS,
427 0, 0, CW_USEDEFAULT, 50, hwnd, NULL, hInst, 0 );
429 if (!hwndSB ) return NULL;
431 // Get the coordinates of the parent window's client area.
432 GetClientRect( hwnd, &rect );
434 // allocate memory for the panes of status bar
436 int *indicators = new int[nopanes];
438 // set width for the panes
439 indicators[0] = 3 * ( rect.right - rect.left ) / 4;
440 indicators[1] = rect.right - rect.left;
442 // call functions to set style
443 SendMessage( hwndSB, SB_SETPARTS, (WPARAM)nopanes, (LPARAM)indicators );
448 /***********************************************************************
453 Processes messages sent to the main window.
454 ***********************************************************************/
455 LRESULT Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
460 hwndCB = CreateMenuBar( hwnd, hInst );
461 hwndTB = CreateToolBar( hwnd, hInst );
462 hwndSlider = CreateSliderBar( hwnd, hInst );
463 hwndLabel = CreateStaticText( hwnd, hInst );
464 hwndVol = CreateVolTrackBar( hwnd, hInst );
466 hwndSB = CreateStatusBar( hwnd, hInst );
470 if( config_GetInt( p_intf, "wince-embed" ) )
471 video = CreateVideoWindow( p_intf, hwnd );
473 timer = new Timer( p_intf, hwnd, this );
477 switch( GET_WM_COMMAND_ID(wp,lp) )
479 case ID_FILE_QUICKOPEN:
480 case ID_FILE_OPENFILE:
481 case ID_FILE_OPENDIR:
482 case ID_FILE_OPENNET:
483 case ID_VIEW_STREAMINFO:
484 case ID_VIEW_MESSAGES:
485 case ID_VIEW_PLAYLIST:
487 OnShowDialog( GET_WM_COMMAND_ID(wp,lp) );
490 case PlayStream_Event: OnPlayStream(); break;
491 case StopStream_Event: OnStopStream(); break;
492 case PrevStream_Event: OnPrevStream(); break;
493 case NextStream_Event: OnNextStream(); break;
494 case SlowStream_Event: OnSlowStream(); break;
495 case FastStream_Event: OnFastStream(); break;
499 string about = (string)"VLC media player " PACKAGE_VERSION +
500 _("\n(WinCE interface)\n\n") +
501 _("(c) 1996-2006 - the VideoLAN Team\n\n") +
502 _("Compiled by ") + VLC_CompileBy() + "@" +
503 VLC_CompileHost() + "." + VLC_CompileDomain() + ".\n" +
504 _("Compiler: ") + VLC_Compiler() + ".\n" +
505 _("Based on Git commit: ") + VLC_Changeset() + ".\n\n" +
506 _("The VideoLAN team <videolan@videolan.org>\n"
507 "http://www.videolan.org/");
509 MessageBox( hwnd, _FROMMB(about.c_str()),
510 _T("About VLC media player"), MB_OK );
515 SendMessage( hwnd, WM_CLOSE, 0, 0 );
519 OnMenuEvent( p_intf, GET_WM_COMMAND_ID(wp,lp) );
520 // we should test if it is a menu command
528 case WM_CTLCOLORSTATIC:
529 if( ( (HWND)lp == hwndSlider ) || ( (HWND)lp == hwndVol ) )
531 return( (LRESULT)::GetSysColorBrush(COLOR_3DFACE) );
533 if( (HWND)lp == hwndLabel )
535 SetBkColor( (HDC)wp, RGB (192, 192, 192) );
536 return( (LRESULT)::GetSysColorBrush(COLOR_3DFACE) );
541 if( (HWND)lp == hwndSlider ) OnSliderUpdate( wp );
545 if( (HWND)lp == hwndVol ) OnChange( wp );
548 case WM_INITMENUPOPUP:
549 if( (HMENU)wp == menu_settings )
550 RefreshSettingsMenu( p_intf, menu_settings );
551 if( (HMENU)wp == menu_audio )
552 RefreshAudioMenu( p_intf, menu_audio );
553 if( (HMENU)wp == menu_video )
554 RefreshVideoMenu( p_intf, menu_video );
555 if( (HMENU)wp == menu_navigation )
556 RefreshNavigMenu( p_intf, menu_navigation );
560 SHFullScreen( hwnd, SHFS_SHOWSIPBUTTON );
561 case WM_ENTERMENULOOP:
562 if( video && video->hWnd )
563 SendMessage( video->hWnd, WM_KILLFOCUS, 0, 0 );
567 SHSipPreference( hwnd, SIP_DOWN );
568 SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
569 case WM_EXITMENULOOP:
570 if( video && video->hWnd )
571 SendMessage( video->hWnd, WM_SETFOCUS, 0, 0 );
577 shrg.cbSize = sizeof( shrg );
578 shrg.hwndClient = hwnd;
579 shrg.ptDown.x = LOWORD(lp);
580 shrg.ptDown.y = HIWORD(lp);
581 shrg.dwFlags = SHRG_RETURNCMD ;
583 if( SHRecognizeGesture( &shrg ) == GN_CONTEXTMENU )
584 PopupMenu( p_intf, hwnd, shrg.ptDown );
591 point.x = LOWORD(lp);
592 point.y = HIWORD(lp);
593 PopupMenu( p_intf, hwnd, point );
598 MessageBox (hwnd, _T("Help"), _T("Help"), MB_OK);
602 if( hwndCB ) DestroyWindow( hwndCB );
603 DestroyWindow( hwnd );
607 PostQuitMessage( 0 );
611 return DefWindowProc( hwnd, msg, wp, lp );
614 void Interface::OnShowDialog( int i_dialog_event )
618 switch( i_dialog_event )
620 case ID_FILE_QUICKOPEN: i_id = INTF_DIALOG_FILE_SIMPLE; break;
621 case ID_FILE_OPENFILE: i_id = INTF_DIALOG_FILE; break;
622 case ID_FILE_OPENDIR: i_id = INTF_DIALOG_DIRECTORY; break;
623 case ID_FILE_OPENNET: i_id = INTF_DIALOG_NET; break;
624 case ID_VIEW_PLAYLIST: i_id = INTF_DIALOG_PLAYLIST; break;
625 case ID_VIEW_MESSAGES: i_id = INTF_DIALOG_MESSAGES; break;
626 case ID_VIEW_STREAMINFO: i_id = INTF_DIALOG_FILEINFO; break;
627 case ID_PREFERENCES: i_id = INTF_DIALOG_PREFS; break;
628 default: i_id = INTF_DIALOG_FILE; break;
631 if( p_intf->p_sys->pf_show_dialog )
632 p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
635 void Interface::OnPlayStream( void )
637 playlist_t *p_playlist = (playlist_t *)
638 vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
639 if( p_playlist == NULL ) return;
641 if( p_playlist->i_size )
645 input_thread_t *p_input = (input_thread_t *)
646 vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
648 if( p_input == NULL )
650 /* No stream was playing, start one */
651 playlist_Play( p_playlist );
652 TogglePlayButton( PLAYING_S );
653 vlc_object_release( p_playlist );
657 var_Get( p_input, "state", &state );
659 if( state.i_int != PAUSE_S )
661 /* A stream is being played, pause it */
662 state.i_int = PAUSE_S;
666 /* Stream is paused, resume it */
667 state.i_int = PLAYING_S;
669 var_Set( p_input, "state", state );
671 TogglePlayButton( state.i_int );
672 vlc_object_release( p_input );
673 vlc_object_release( p_playlist );
677 /* If the playlist is empty, open a file requester instead */
678 vlc_object_release( p_playlist );
679 OnShowDialog( ID_FILE_QUICKOPEN );
683 void Interface::TogglePlayButton( int i_playing_status )
685 TBREPLACEBITMAP tbrb;
686 tbrb.hInstOld = tbrb.hInstNew = (HINSTANCE) hInst;
687 tbrb.nButtons = NUMIMAGES;
689 if( i_playing_status == i_old_playing_status ) return;
691 if( i_playing_status == PLAYING_S )
693 tbrb.nIDOld = IDB_BITMAP2;
694 tbrb.nIDNew = IDB_BITMAP1;
696 SendMessage( hwndTB, TB_REPLACEBITMAP, (WPARAM)0,
697 (LPARAM)(LPTBREPLACEBITMAP)&tbrb );
701 tbrb.nIDOld = IDB_BITMAP1;
702 tbrb.nIDNew = IDB_BITMAP2;
704 SendMessage( hwndTB, TB_REPLACEBITMAP, (WPARAM)0,
705 (LPARAM)(LPTBREPLACEBITMAP)&tbrb );
708 UpdateWindow( hwndTB );
710 i_old_playing_status = i_playing_status;
713 void Interface::OnVideoOnTop( void )
717 vout_thread_t *p_vout = (vout_thread_t *)
718 vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
720 if( p_vout == NULL ) return;
722 if( var_Get( (vlc_object_t *)p_vout, "video-on-top", &val ) < 0 )
725 val.b_bool = !val.b_bool;
726 var_Set( (vlc_object_t *)p_vout, "video-on-top", val );
728 vlc_object_release( (vlc_object_t *)p_vout );
731 void Interface::OnSliderUpdate( int wp )
733 vlc_mutex_lock( &p_intf->change_lock );
734 input_thread_t *p_input = p_intf->p_sys->p_input;
736 int dwPos = SendMessage( hwndSlider, TBM_GETPOS, 0, 0 );
738 if( (int)LOWORD(wp) == SB_THUMBPOSITION ||
739 (int)LOWORD(wp) == SB_ENDSCROLL )
741 if( p_intf->p_sys->i_slider_pos != dwPos && p_input )
744 pos.f_float = (float)dwPos / (float)SLIDER_MAX_POS;
745 var_Set( p_input, "position", pos );
748 p_intf->p_sys->b_slider_free = true;
752 p_intf->p_sys->b_slider_free = false;
756 /* Update stream date */
757 char psz_time[ MSTRTIME_MAX_SIZE ], psz_total[ MSTRTIME_MAX_SIZE ];
760 i_seconds = var_GetTime( p_input, "length" ) / I64C(1000000 );
761 secstotimestr( psz_total, i_seconds );
763 i_seconds = var_GetTime( p_input, "time" ) / I64C(1000000 );
764 secstotimestr( psz_time, i_seconds );
766 SendMessage( hwndLabel, WM_SETTEXT, (WPARAM)1,
767 (LPARAM)_FROMMB(psz_time) );
771 vlc_mutex_unlock( &p_intf->change_lock );
774 void Interface::OnChange( int wp )
776 DWORD dwPos = SendMessage( hwndVol, TBM_GETPOS, 0, 0 );
778 if( LOWORD(wp) == SB_THUMBPOSITION || LOWORD(wp) == SB_ENDSCROLL )
780 VolumeChange( 200 - (int)dwPos );
781 b_volume_hold = false;
785 b_volume_hold = true;
789 void Interface::VolumeChange( int i_volume )
791 aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_MAX / 200 / 2 );
794 void Interface::VolumeUpdate()
796 audio_volume_t i_volume;
798 if( b_volume_hold ) return;
800 aout_VolumeGet( p_intf, &i_volume );
802 int i_volume_ctrl = 200 - i_volume * 200 * 2 / AOUT_VOLUME_MAX;
804 DWORD dwPos = SendMessage( hwndVol, TBM_GETPOS, 0, 0 );
805 if( i_volume_ctrl == (int)dwPos ) return;
807 SendMessage( hwndVol, TBM_SETPOS, 1, i_volume_ctrl );
810 void Interface::OnStopStream( void )
812 playlist_t * p_playlist = (playlist_t *)
813 vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
814 if( p_playlist == NULL ) return;
816 playlist_Stop( p_playlist );
817 TogglePlayButton( PAUSE_S );
818 vlc_object_release( p_playlist );
821 void Interface::OnPrevStream( void )
823 playlist_t * p_playlist = (playlist_t *)
824 vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
825 if( p_playlist == NULL ) return;
827 playlist_Prev( p_playlist );
828 vlc_object_release( p_playlist );
831 void Interface::OnNextStream( void )
833 playlist_t * p_playlist = (playlist_t *)
834 vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
835 if( p_playlist == NULL ) return;
837 playlist_Next( p_playlist );
838 vlc_object_release( p_playlist );
841 void Interface::OnSlowStream( void )
843 input_thread_t *p_input = (input_thread_t *)
844 vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
846 if( p_input == NULL ) return;
848 vlc_value_t val; val.b_bool = true;
849 var_Set( p_input, "rate-slower", val );
850 vlc_object_release( p_input );
853 void Interface::OnFastStream( void )
855 input_thread_t *p_input = (input_thread_t *)
856 vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
858 if( p_input == NULL ) return;
860 vlc_value_t val; val.b_bool = true;
861 var_Set( p_input, "rate-faster", val );
862 vlc_object_release( p_input );
865 void Interface::Update()