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 *****************************************************************************/
40 #define NUMIMAGES 9 // Number of buttons in the toolbar
41 #define IMAGEWIDTH 17 // Width of the buttons in the toolbar
42 #define IMAGEHEIGHT 16 // Height of the buttons in the toolbar
43 #define BUTTONWIDTH 0 // Width of the button images in the toolbar
44 #define BUTTONHEIGHT 0 // Height of the button images in the toolbar
45 #define ID_TOOLBAR 2000 // Identifier of the main tool bar
48 #define HELP_SIMPLE _T("Quick file open")
49 #define HELP_ADV _T("Advanced open")
50 #define HELP_FILE _T("Open a file")
51 #define HELP_DISC _T("Open Disc Media")
52 #define HELP_NET _T("Open a network stream")
53 #define HELP_SAT _T("Open a satellite stream")
54 #define HELP_EJECT _T("Eject the DVD/CD")
55 #define HELP_EXIT _T("Exit this program")
57 #define HELP_OTHER _T("Open other types of inputs")
59 #define HELP_PLAYLIST _T("Open the playlist")
60 #define HELP_LOGS _T("Show the program logs")
61 #define HELP_FILEINFO _T("Show information about the file being played")
63 #define HELP_PREFS _T("Go to the preferences menu")
65 #define HELP_ABOUT _T("About this program")
67 #define HELP_STOP _T("Stop")
69 #define HELP_PLAY _T("Play")
70 #define HELP_PAUSE _T("Pause")
71 #define HELP_PLO _T("Playlist")
72 #define HELP_PLP _T("Previous playlist item")
73 #define HELP_PLN _T("Next playlist item")
74 #define HELP_SLOW _T("Play slower")
75 #define HELP_FAST _T("Play faster")
77 // The TBBUTTON structure contains information the toolbar buttons.
78 static TBBUTTON tbButton[] =
80 {0, ID_FILE_QUICKOPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON},
81 {1, ID_FILE_OPENNET, TBSTATE_ENABLED, TBSTYLE_BUTTON},
82 {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
83 {2, StopStream_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON},
84 {3, PlayStream_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON},
85 {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
86 {4, ID_VIEW_PLAYLIST, TBSTATE_ENABLED, TBSTYLE_BUTTON},
87 {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
88 {5, PrevStream_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON},
89 {6, NextStream_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON},
90 {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP},
91 {7, SlowStream_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON},
92 {8, FastStream_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON},
96 TCHAR * szToolTips[] =
98 HELP_SIMPLE, HELP_NET, HELP_STOP, HELP_PLAY, HELP_PLO, HELP_PLP,
99 HELP_PLN, HELP_SLOW, HELP_FAST
102 /*****************************************************************************
104 *****************************************************************************/
105 Interface::Interface( intf_thread_t *p_intf, CBaseWindow *p_parent,
107 : CBaseWindow( p_intf, p_parent, h_inst ),
108 hwndMain(0), hwndCB(0), hwndTB(0), hwndSlider(0), hwndLabel(0),
109 hwndVol(0), hwndSB(0), timer(0), video(0), b_volume_hold(0)
113 Interface::~Interface()
115 if( timer ) delete timer;
116 if( video ) delete video;
119 BOOL Interface::InitInstance()
121 /* Initializations */
122 i_old_playing_status = PAUSE_S;
124 int i_style = WS_VISIBLE;
127 i_style |= WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
130 // Create main window
132 CreateWindow( _T("VLC WinCE"), _T("VLC media player"), i_style,
133 0, MENU_HEIGHT, CW_USEDEFAULT, CW_USEDEFAULT,
134 NULL, NULL, GetInstance(), (void *)this );
136 if( !hwndMain ) return FALSE;
138 ShowWindow( hwndMain, TRUE );
139 UpdateWindow( hwndMain );
144 /***********************************************************************
150 ***********************************************************************/
151 HWND Interface::CreateMenuBar( HWND hwnd, HINSTANCE hInst )
153 HMENU menu_file, menu_view;
157 memset( &mbi, 0, sizeof(SHMENUBARINFO) );
158 mbi.cbSize = sizeof(SHMENUBARINFO);
159 mbi.hwndParent = hwnd;
160 mbi.hInstRes = hInst;
161 mbi.nToolBarId = IDR_MENUBAR;
163 if( !SHCreateMenuBar( &mbi ) )
165 MessageBox(hwnd, _T("SHCreateMenuBar Failed"), _T("Error"), MB_OK);
170 tbbi.cbSize = sizeof(tbbi);
171 tbbi.dwMask = TBIF_LPARAM;
173 SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_FILE, (LPARAM)&tbbi );
174 menu_file = (HMENU)tbbi.lParam;
175 RemoveMenu( menu_file, 0, MF_BYPOSITION );
176 SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_VIEW, (LPARAM)&tbbi );
177 menu_view = (HMENU)tbbi.lParam;
178 RemoveMenu( menu_view, 0, MF_BYPOSITION );
179 SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_SETTINGS, (LPARAM)&tbbi );
180 menu_settings = (HMENU)tbbi.lParam;
181 SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_VIDEO, (LPARAM)&tbbi );
182 menu_video = (HMENU)tbbi.lParam;
183 SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_AUDIO, (LPARAM)&tbbi );
184 menu_audio = (HMENU)tbbi.lParam;
185 SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_NAVIGATION, (LPARAM)&tbbi );
186 menu_navigation = (HMENU)tbbi.lParam;
189 menu_file = CreatePopupMenu();
190 menu_view = CreatePopupMenu();
191 menu_settings = CreatePopupMenu();
192 menu_audio = CreatePopupMenu();
193 menu_video = CreatePopupMenu();
194 menu_navigation = CreatePopupMenu();
197 AppendMenu( menu_file, MF_STRING, ID_FILE_QUICKOPEN,
198 _T("Quick &Open File...") );
199 AppendMenu( menu_file, MF_SEPARATOR, 0, 0 );
200 AppendMenu( menu_file, MF_STRING, ID_FILE_OPENFILE,
201 _T("Open &File...") );
202 AppendMenu( menu_file, MF_STRING, ID_FILE_OPENDIR,
203 _T("Open &Directory...") );
204 AppendMenu( menu_file, MF_STRING, ID_FILE_OPENNET,
205 _T("Open &Network Stream...") );
206 AppendMenu( menu_file, MF_SEPARATOR, 0, 0 );
207 AppendMenu( menu_file, MF_STRING, ID_FILE_ABOUT,
209 AppendMenu( menu_file, MF_STRING, ID_FILE_EXIT,
212 AppendMenu( menu_view, MF_STRING, ID_VIEW_PLAYLIST,
213 _T("&Playlist...") );
214 AppendMenu( menu_view, MF_STRING, ID_VIEW_MESSAGES,
215 _T("&Messages...") );
216 AppendMenu( menu_view, MF_STRING, ID_VIEW_STREAMINFO,
217 _T("Stream and Media &info...") );
219 AppendMenu( menu_settings, MF_STRING, ID_PREFERENCES,
220 _T("&Preferences...") );
227 HMENU hmenu = CreateMenu();
229 AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_file, _T("File") );
230 AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_view, _T("View") );
231 AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_settings,
233 AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_audio, _T("Audio") );
234 AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_video, _T("Video") );
235 AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)menu_navigation, _T("Nav") );
237 SetMenu( hwnd, hmenu );
243 /***********************************************************************
248 Registers the TOOLBAR control class and creates a toolbar.
249 ***********************************************************************/
250 HWND CreateToolBar( HWND hwnd, HINSTANCE hInst )
256 INITCOMMONCONTROLSEX iccex;
257 iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
258 iccex.dwICC = ICC_BAR_CLASSES;
260 // Registers TOOLBAR control classes from the common control dll
261 InitCommonControlsEx (&iccex);
263 // Create the toolbar control
264 dwStyle = WS_VISIBLE | WS_CHILD | TBSTYLE_TOOLTIPS |
265 WS_EX_OVERLAPPEDWINDOW | CCS_NOPARENTALIGN;
267 hwndTB = CreateToolbarEx( hwnd, dwStyle, 0, NUMIMAGES,
268 hInst, IDB_BITMAP1, tbButton, sizeof(tbButton) / sizeof(TBBUTTON),
269 BUTTONWIDTH, BUTTONHEIGHT, IMAGEWIDTH, IMAGEHEIGHT, sizeof(TBBUTTON) );
271 if( !hwndTB ) return NULL;
273 // Add ToolTips to the toolbar.
274 SendMessage( hwndTB, TB_SETTOOLTIPS, (WPARAM)NUMIMAGES,
275 (LPARAM)szToolTips );
277 // Reposition the toolbar.
278 GetClientRect( hwnd, &rect );
279 GetWindowRect( hwndTB, &rectTB );
280 MoveWindow( hwndTB, rect.left, rect.bottom - rect.top - 2*MENU_HEIGHT,
281 rect.right - rect.left, MENU_HEIGHT, TRUE );
286 /***********************************************************************
292 Registers the TRACKBAR_CLASS control class and creates a trackbar.
294 ***********************************************************************/
295 HWND CreateSliderBar( HWND hwnd, HINSTANCE hInst )
300 INITCOMMONCONTROLSEX iccex;
301 iccex.dwSize = sizeof( INITCOMMONCONTROLSEX );
302 iccex.dwICC = ICC_BAR_CLASSES;
304 // Registers TRACKBAR_CLASS control classes from the common control dll
305 InitCommonControlsEx( &iccex );
307 hwndSlider = CreateWindowEx( 0, TRACKBAR_CLASS, NULL,
308 WS_CHILD | WS_VISIBLE | TBS_HORZ | WS_EX_OVERLAPPEDWINDOW |
309 TBS_BOTTOM, //|WS_CLIPSIBLINGS,
310 0, 0, 0, 0, hwnd, NULL, hInst, NULL );
312 if( !hwndSlider ) return NULL;
314 SendMessage( hwndSlider, TBM_SETRANGEMIN, 1, 0 );
315 SendMessage( hwndSlider, TBM_SETRANGEMAX, 1, SLIDER_MAX_POS );
316 SendMessage( hwndSlider, TBM_SETPOS, 1, 0 );
318 // Reposition the trackbar
319 GetClientRect( hwnd, &rect );
320 MoveWindow( hwndSlider, rect.left,
321 rect.bottom - rect.top - 2*(MENU_HEIGHT-1) - SLIDER_HEIGHT,
322 rect.right - rect.left - 40, 30, TRUE );
324 ShowWindow( hwndSlider, SW_HIDE );
329 HWND CreateStaticText( HWND hwnd, HINSTANCE hInst )
334 hwndLabel = CreateWindowEx( 0, _T("STATIC"), _T("label"),
335 WS_CHILD | WS_VISIBLE | SS_CENTER ,
336 0, 0, 0, 0, hwnd, (HMENU)1980, hInst, NULL );
338 // Reposition the trackbar
339 GetClientRect( hwnd, &rect );
341 MoveWindow( hwndLabel, rect.left,
342 rect.bottom - rect.top - 2*(MENU_HEIGHT-1) - SLIDER_HEIGHT +30,
343 rect.right - rect.left - 40,
344 SLIDER_HEIGHT - 30, TRUE );
346 ShowWindow( hwndLabel, SW_HIDE );
351 /***********************************************************************
357 Registers the TRACKBAR_CLASS control class and creates a trackbar.
359 ***********************************************************************/
360 HWND CreateVolTrackBar( HWND hwnd, HINSTANCE hInst )
365 INITCOMMONCONTROLSEX iccex;
366 iccex.dwSize = sizeof( INITCOMMONCONTROLSEX );
367 iccex.dwICC = ICC_BAR_CLASSES;
369 // Registers TRACKBAR_CLASS control classes from the common control dll
370 InitCommonControlsEx( &iccex );
372 hwndVol = CreateWindowEx( 0, TRACKBAR_CLASS, NULL,
373 WS_CHILD | WS_VISIBLE | TBS_VERT | TBS_RIGHT | TBS_AUTOTICKS |
374 WS_EX_OVERLAPPEDWINDOW, //|WS_CLIPSIBLINGS,
375 0, 0, 0, 0, hwnd, NULL, hInst, NULL );
377 if( !hwndVol ) return NULL;
379 SendMessage( hwndVol, TBM_SETRANGEMIN, 1, 0 );
380 SendMessage( hwndVol, TBM_SETRANGEMAX, 1, 200 );
381 SendMessage( hwndVol, TBM_SETPOS, 1, 100 );
382 SendMessage( hwndVol, TBM_SETTICFREQ, 50, 0 );
384 // Reposition the trackbar
385 GetClientRect( hwnd, &rect );
386 MoveWindow( hwndVol, rect.right - rect.left - 40,
387 rect.bottom - rect.top - 2*(MENU_HEIGHT-1) - SLIDER_HEIGHT,
388 40, SLIDER_HEIGHT, TRUE );
390 ShowWindow( hwndVol, SW_HIDE );
395 /***********************************************************************
401 Registers the StatusBar control class and creates a Statusbar.
403 ***********************************************************************/
404 HWND CreateStatusBar( HWND hwnd, HINSTANCE hInst )
410 INITCOMMONCONTROLSEX iccex;
411 iccex.dwSize = sizeof (INITCOMMONCONTROLSEX);
412 iccex.dwICC = ICC_BAR_CLASSES;
414 // Registers Statusbar control classes from the common control dll
415 InitCommonControlsEx( &iccex );
417 // Create the statusbar control
418 dwStyle = WS_VISIBLE | WS_CHILD | TBSTYLE_TOOLTIPS | CCS_NOPARENTALIGN;
420 hwndSB = CreateWindowEx( 0, STATUSCLASSNAME, NULL,
421 WS_CHILD | WS_VISIBLE | TBS_VERT | TBS_BOTTOM |
422 TBS_RIGHT |WS_CLIPSIBLINGS,
423 0, 0, CW_USEDEFAULT, 50, hwnd, NULL, hInst, 0 );
425 if (!hwndSB ) return NULL;
427 // Get the coordinates of the parent window's client area.
428 GetClientRect( hwnd, &rect );
430 // allocate memory for the panes of status bar
432 int *indicators = new int[nopanes];
434 // set width for the panes
435 indicators[0] = 3 * ( rect.right - rect.left ) / 4;
436 indicators[1] = rect.right - rect.left;
438 // call functions to set style
439 SendMessage( hwndSB, SB_SETPARTS, (WPARAM)nopanes, (LPARAM)indicators );
444 /***********************************************************************
449 Processes messages sent to the main window.
450 ***********************************************************************/
451 LRESULT Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
456 hwndCB = CreateMenuBar( hwnd, hInst );
457 hwndTB = CreateToolBar( hwnd, hInst );
458 hwndSlider = CreateSliderBar( hwnd, hInst );
459 hwndLabel = CreateStaticText( hwnd, hInst );
460 hwndVol = CreateVolTrackBar( hwnd, hInst );
462 hwndSB = CreateStatusBar( hwnd, hInst );
466 if( config_GetInt( p_intf, "wince-embed" ) )
467 video = CreateVideoWindow( p_intf, hwnd );
469 timer = new Timer( p_intf, hwnd, this );
473 switch( GET_WM_COMMAND_ID(wp,lp) )
475 case ID_FILE_QUICKOPEN:
476 case ID_FILE_OPENFILE:
477 case ID_FILE_OPENDIR:
478 case ID_FILE_OPENNET:
479 case ID_VIEW_STREAMINFO:
480 case ID_VIEW_MESSAGES:
481 case ID_VIEW_PLAYLIST:
483 OnShowDialog( GET_WM_COMMAND_ID(wp,lp) );
486 case PlayStream_Event: OnPlayStream(); break;
487 case StopStream_Event: OnStopStream(); break;
488 case PrevStream_Event: OnPrevStream(); break;
489 case NextStream_Event: OnNextStream(); break;
490 case SlowStream_Event: OnSlowStream(); break;
491 case FastStream_Event: OnFastStream(); break;
495 string about = (string)"VLC media player " PACKAGE_VERSION +
496 _("\n(WinCE interface)\n\n") +
497 _("(c) 1996-2006 - the VideoLAN Team\n\n") +
498 _("Compiled by ") + VLC_CompileBy() + "@" +
499 VLC_CompileHost() + "." + VLC_CompileDomain() + ".\n" +
500 _("Compiler: ") + VLC_Compiler() + ".\n" +
501 _("Based on SVN revision: ") + VLC_Changeset() + ".\n\n" +
502 _("The VideoLAN team <videolan@videolan.org>\n"
503 "http://www.videolan.org/");
505 MessageBox( hwnd, _FROMMB(about.c_str()),
506 _T("About VLC media player"), MB_OK );
511 SendMessage( hwnd, WM_CLOSE, 0, 0 );
515 OnMenuEvent( p_intf, GET_WM_COMMAND_ID(wp,lp) );
516 // we should test if it is a menu command
524 case WM_CTLCOLORSTATIC:
525 if( ( (HWND)lp == hwndSlider ) || ( (HWND)lp == hwndVol ) )
527 return( (LRESULT)::GetSysColorBrush(COLOR_3DFACE) );
529 if( (HWND)lp == hwndLabel )
531 SetBkColor( (HDC)wp, RGB (192, 192, 192) );
532 return( (LRESULT)::GetSysColorBrush(COLOR_3DFACE) );
537 if( (HWND)lp == hwndSlider ) OnSliderUpdate( wp );
541 if( (HWND)lp == hwndVol ) OnChange( wp );
544 case WM_INITMENUPOPUP:
545 if( (HMENU)wp == menu_settings )
546 RefreshSettingsMenu( p_intf, menu_settings );
547 if( (HMENU)wp == menu_audio )
548 RefreshAudioMenu( p_intf, menu_audio );
549 if( (HMENU)wp == menu_video )
550 RefreshVideoMenu( p_intf, menu_video );
551 if( (HMENU)wp == menu_navigation )
552 RefreshNavigMenu( p_intf, menu_navigation );
556 SHFullScreen( hwnd, SHFS_SHOWSIPBUTTON );
557 case WM_ENTERMENULOOP:
558 if( video && video->hWnd )
559 SendMessage( video->hWnd, WM_KILLFOCUS, 0, 0 );
563 SHSipPreference( hwnd, SIP_DOWN );
564 SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
565 case WM_EXITMENULOOP:
566 if( video && video->hWnd )
567 SendMessage( video->hWnd, WM_SETFOCUS, 0, 0 );
573 shrg.cbSize = sizeof( shrg );
574 shrg.hwndClient = hwnd;
575 shrg.ptDown.x = LOWORD(lp);
576 shrg.ptDown.y = HIWORD(lp);
577 shrg.dwFlags = SHRG_RETURNCMD ;
579 if( SHRecognizeGesture( &shrg ) == GN_CONTEXTMENU )
580 PopupMenu( p_intf, hwnd, shrg.ptDown );
587 point.x = LOWORD(lp);
588 point.y = HIWORD(lp);
589 PopupMenu( p_intf, hwnd, point );
594 MessageBox (hwnd, _T("Help"), _T("Help"), MB_OK);
598 if( hwndCB ) DestroyWindow( hwndCB );
599 DestroyWindow( hwnd );
603 PostQuitMessage( 0 );
607 return DefWindowProc( hwnd, msg, wp, lp );
610 void Interface::OnShowDialog( int i_dialog_event )
614 switch( i_dialog_event )
616 case ID_FILE_QUICKOPEN: i_id = INTF_DIALOG_FILE_SIMPLE; break;
617 case ID_FILE_OPENFILE: i_id = INTF_DIALOG_FILE; break;
618 case ID_FILE_OPENDIR: i_id = INTF_DIALOG_DIRECTORY; break;
619 case ID_FILE_OPENNET: i_id = INTF_DIALOG_NET; break;
620 case ID_VIEW_PLAYLIST: i_id = INTF_DIALOG_PLAYLIST; break;
621 case ID_VIEW_MESSAGES: i_id = INTF_DIALOG_MESSAGES; break;
622 case ID_VIEW_STREAMINFO: i_id = INTF_DIALOG_FILEINFO; break;
623 case ID_PREFERENCES: i_id = INTF_DIALOG_PREFS; break;
624 default: i_id = INTF_DIALOG_FILE; break;
627 if( p_intf->p_sys->pf_show_dialog )
628 p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
631 void Interface::OnPlayStream( void )
633 playlist_t *p_playlist = (playlist_t *)
634 vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
635 if( p_playlist == NULL ) return;
637 if( p_playlist->i_size && p_playlist->i_enabled )
641 input_thread_t *p_input = (input_thread_t *)
642 vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
644 if( p_input == NULL )
646 /* No stream was playing, start one */
647 playlist_Play( p_playlist );
648 TogglePlayButton( PLAYING_S );
649 vlc_object_release( p_playlist );
653 var_Get( p_input, "state", &state );
655 if( state.i_int != PAUSE_S )
657 /* A stream is being played, pause it */
658 state.i_int = PAUSE_S;
662 /* Stream is paused, resume it */
663 state.i_int = PLAYING_S;
665 var_Set( p_input, "state", state );
667 TogglePlayButton( state.i_int );
668 vlc_object_release( p_input );
669 vlc_object_release( p_playlist );
673 /* If the playlist is empty, open a file requester instead */
674 vlc_object_release( p_playlist );
675 OnShowDialog( ID_FILE_QUICKOPEN );
679 void Interface::TogglePlayButton( int i_playing_status )
681 TBREPLACEBITMAP tbrb;
682 tbrb.hInstOld = tbrb.hInstNew = (HINSTANCE) hInst;
683 tbrb.nButtons = NUMIMAGES;
685 if( i_playing_status == i_old_playing_status ) return;
687 if( i_playing_status == PLAYING_S )
689 tbrb.nIDOld = IDB_BITMAP2;
690 tbrb.nIDNew = IDB_BITMAP1;
692 SendMessage( hwndTB, TB_REPLACEBITMAP, (WPARAM)0,
693 (LPARAM)(LPTBREPLACEBITMAP)&tbrb );
697 tbrb.nIDOld = IDB_BITMAP1;
698 tbrb.nIDNew = IDB_BITMAP2;
700 SendMessage( hwndTB, TB_REPLACEBITMAP, (WPARAM)0,
701 (LPARAM)(LPTBREPLACEBITMAP)&tbrb );
704 UpdateWindow( hwndTB );
706 i_old_playing_status = i_playing_status;
709 void Interface::OnVideoOnTop( void )
713 vout_thread_t *p_vout = (vout_thread_t *)
714 vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
716 if( p_vout == NULL ) return;
718 if( var_Get( (vlc_object_t *)p_vout, "video-on-top", &val ) < 0 )
721 val.b_bool = !val.b_bool;
722 var_Set( (vlc_object_t *)p_vout, "video-on-top", val );
724 vlc_object_release( (vlc_object_t *)p_vout );
727 void Interface::OnSliderUpdate( int wp )
729 vlc_mutex_lock( &p_intf->change_lock );
730 input_thread_t *p_input = p_intf->p_sys->p_input;
732 int dwPos = SendMessage( hwndSlider, TBM_GETPOS, 0, 0 );
734 if( (int)LOWORD(wp) == SB_THUMBPOSITION ||
735 (int)LOWORD(wp) == SB_ENDSCROLL )
737 if( p_intf->p_sys->i_slider_pos != dwPos && p_input )
740 pos.f_float = (float)dwPos / (float)SLIDER_MAX_POS;
741 var_Set( p_input, "position", pos );
744 p_intf->p_sys->b_slider_free = VLC_TRUE;
748 p_intf->p_sys->b_slider_free = VLC_FALSE;
752 /* Update stream date */
753 char psz_time[ MSTRTIME_MAX_SIZE ], psz_total[ MSTRTIME_MAX_SIZE ];
756 i_seconds = var_GetTime( p_input, "length" ) / I64C(1000000 );
757 secstotimestr( psz_total, i_seconds );
759 i_seconds = var_GetTime( p_input, "time" ) / I64C(1000000 );
760 secstotimestr( psz_time, i_seconds );
762 SendMessage( hwndLabel, WM_SETTEXT, (WPARAM)1,
763 (LPARAM)_FROMMB(psz_time) );
767 vlc_mutex_unlock( &p_intf->change_lock );
770 void Interface::OnChange( int wp )
772 DWORD dwPos = SendMessage( hwndVol, TBM_GETPOS, 0, 0 );
774 if( LOWORD(wp) == SB_THUMBPOSITION || LOWORD(wp) == SB_ENDSCROLL )
776 VolumeChange( 200 - (int)dwPos );
777 b_volume_hold = VLC_FALSE;
781 b_volume_hold = VLC_TRUE;
785 void Interface::VolumeChange( int i_volume )
787 aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_MAX / 200 / 2 );
790 void Interface::VolumeUpdate()
792 audio_volume_t i_volume;
794 if( b_volume_hold ) return;
796 aout_VolumeGet( p_intf, &i_volume );
798 int i_volume_ctrl = 200 - i_volume * 200 * 2 / AOUT_VOLUME_MAX;
800 DWORD dwPos = SendMessage( hwndVol, TBM_GETPOS, 0, 0 );
801 if( i_volume_ctrl == (int)dwPos ) return;
803 SendMessage( hwndVol, TBM_SETPOS, 1, i_volume_ctrl );
806 void Interface::OnStopStream( void )
808 playlist_t * p_playlist = (playlist_t *)
809 vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
810 if( p_playlist == NULL ) return;
812 playlist_Stop( p_playlist );
813 TogglePlayButton( PAUSE_S );
814 vlc_object_release( p_playlist );
817 void Interface::OnPrevStream( void )
819 playlist_t * p_playlist = (playlist_t *)
820 vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
821 if( p_playlist == NULL ) return;
823 playlist_Prev( p_playlist );
824 vlc_object_release( p_playlist );
827 void Interface::OnNextStream( void )
829 playlist_t * p_playlist = (playlist_t *)
830 vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
831 if( p_playlist == NULL ) return;
833 playlist_Next( p_playlist );
834 vlc_object_release( p_playlist );
837 void Interface::OnSlowStream( void )
839 input_thread_t *p_input = (input_thread_t *)
840 vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
842 if( p_input == NULL ) return;
844 vlc_value_t val; val.b_bool = VLC_TRUE;
845 var_Set( p_input, "rate-slower", val );
846 vlc_object_release( p_input );
849 void Interface::OnFastStream( void )
851 input_thread_t *p_input = (input_thread_t *)
852 vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
854 if( p_input == NULL ) return;
856 vlc_value_t val; val.b_bool = VLC_TRUE;
857 var_Set( p_input, "rate-faster", val );
858 vlc_object_release( p_input );
861 void Interface::Update()