* interface.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: interface.cpp,v 1.27 2003/05/12 17:33:19 gbazin Exp $
+ * $Id: interface.cpp,v 1.32 2003/05/22 12:00:56 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
#include "bitmaps/previous.xpm"
#include "bitmaps/next.xpm"
#include "bitmaps/playlist.xpm"
-#define TOOLBAR_BMP_WIDTH 24
-#define TOOLBAR_BMP_HEIGHT 24
+#include "bitmaps/fast.xpm"
+#include "bitmaps/slow.xpm"
+
+#define TOOLBAR_BMP_WIDTH 36
+#define TOOLBAR_BMP_HEIGHT 36
/* include the icon graphic */
#include "share/vlc32x32.xpm"
PlayStream_Event,
PrevStream_Event,
NextStream_Event,
+ SlowStream_Event,
+ FastStream_Event,
/* it is important for the id corresponding to the "About" command to have
* this standard value as otherwise it won't be handled properly under Mac
EVT_MENU(PlayStream_Event, Interface::OnPlayStream)
EVT_MENU(PrevStream_Event, Interface::OnPrevStream)
EVT_MENU(NextStream_Event, Interface::OnNextStream)
+ EVT_MENU(SlowStream_Event, Interface::OnSlowStream)
+ EVT_MENU(FastStream_Event, Interface::OnFastStream)
/* Slider events */
EVT_COMMAND_SCROLL(SliderScroll_Event, Interface::OnSliderUpdate)
p_intf = _p_intf;
p_prefs_dialog = NULL;
i_old_playing_status = PAUSE_S;
+ p_open_dialog = NULL;
/* Give our interface a nice little icon */
p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
/* Creation of the status bar
* Helptext for menu items and toolbar tools will automatically get
* displayed here. */
- int i_status_width[2] = {-2,-3};
- statusbar = CreateStatusBar( 2 ); /* 2 fields */
- statusbar->SetStatusWidths( 2, i_status_width );
+ int i_status_width[3] = {-6, -2, -9};
+ statusbar = CreateStatusBar( 3 ); /* 2 fields */
+ statusbar->SetStatusWidths( 3, i_status_width );
+ statusbar->SetStatusText( wxString::Format(wxT("x%.2f"), 1.0), 1 );
+
/* Make sure we've got the right background colour */
SetBackgroundColour( slider_frame->GetBackgroundColour() );
Interface::~Interface()
{
+ /* Clean up */
+ if( p_open_dialog ) delete p_open_dialog;
if( p_prefs_dialog ) p_prefs_dialog->Destroy();
}
p_video_menu = new wxMenu;
b_video_menu = 1;
+ /* Create the "Navigation" menu */
+ p_navig_menu = new wxMenu;
+ b_navig_menu = 1;
+
/* Create the "Help" menu */
wxMenu *help_menu = new wxMenu;
help_menu->Append( About_Event, wxU(_("&About...")), wxU(_(HELP_ABOUT)) );
menubar->Append( settings_menu, wxU(_("&Settings")) );
menubar->Append( p_audio_menu, wxU(_("&Audio")) );
menubar->Append( p_video_menu, wxU(_("&Video")) );
+ menubar->Append( p_navig_menu, wxU(_("&Navigation")) );
menubar->Append( help_menu, wxU(_("&Help")) );
/* Attach the menu bar to the frame */
#define HELP_PLO N_("Open playlist")
#define HELP_PLP N_("Previous playlist item")
#define HELP_PLN N_("Next playlist item")
+#define HELP_SLOW N_("Play slower")
+#define HELP_FAST N_("Play faster")
wxLogNull LogDummy; /* Hack to suppress annoying log message on the win32
* version because we don't include wx.rc */
wxToolBar *toolbar = CreateToolBar(
- wxTB_HORIZONTAL | wxTB_TEXT | wxTB_FLAT | wxTB_DOCKABLE );
+ wxTB_HORIZONTAL | wxTB_FLAT | wxTB_DOCKABLE );
toolbar->SetToolBitmapSize( wxSize(TOOLBAR_BMP_WIDTH,TOOLBAR_BMP_HEIGHT) );
wxBitmap( previous_xpm ), wxU(_(HELP_PLP)) );
toolbar->AddTool( NextStream_Event, wxU(_("Next")), wxBitmap( next_xpm ),
wxU(_(HELP_PLN)) );
+ toolbar->AddTool( SlowStream_Event, wxU(_("Slower")), wxBitmap( slow_xpm ),
+ wxU(_(HELP_SLOW)) );
+ toolbar->AddTool( FastStream_Event, wxU(_("Faster")), wxBitmap( fast_xpm ),
+ wxU(_(HELP_FAST)) );
toolbar->Realize();
void Interface::Open( int i_access_method )
{
/* Show/hide the open dialog */
- OpenDialog dialog( p_intf, this, i_access_method );
+ if( p_open_dialog == NULL )
+ p_open_dialog = new OpenDialog( p_intf, this, i_access_method );
- if( dialog.ShowModal() == wxID_OK )
+ if( p_open_dialog && p_open_dialog->ShowModal() == wxID_OK )
{
/* Update the playlist */
playlist_t *p_playlist =
return;
}
- playlist_Add( p_playlist, (const char *)dialog.mrl.mb_str(),
- PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
+ for( size_t i = 0; i < p_open_dialog->mrl.GetCount(); i++ )
+ {
+ playlist_Add( p_playlist,
+ (const char *)p_open_dialog->mrl[i].mb_str(),
+ PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
+ }
TogglePlayButton( PLAYING_S );
for( ; node; )
{
wxMenuItem *item = node->GetData();
- node = node->GetNext();
-
- /* Delete the submenus */
- wxMenu *submenu = item->GetSubMenu();
- if( submenu )
- {
- RecursiveDestroy( submenu );
- }
- menu->Delete( item );
+ node = node->GetNext();
+
+ /* Delete the submenus */
+ wxMenu *submenu = item->GetSubMenu();
+ if( submenu )
+ {
+ RecursiveDestroy( submenu );
+ }
+ menu->Delete( item );
}
}
}
else b_video_menu = 1;
}
+ else if( event.GetEventObject() == p_navig_menu )
+ {
+ if( b_navig_menu )
+ {
+ p_navig_menu = NavigMenu( p_intf, this );
+
+ /* Work-around for buggy wxGTK */
+ wxMenu *menu = GetMenuBar()->GetMenu( 5 );
+ RecursiveDestroy( menu );
+ /* End work-around */
+
+ menu =
+ GetMenuBar()->Replace( 5, p_navig_menu, wxU(_("&Navigation")));
+ if( menu ) delete menu;
+
+ b_navig_menu = 0;
+ }
+ else b_navig_menu = 1;
+ }
#else
p_audio_menu = AudioMenu( p_intf, this );
menu = GetMenuBar()->Replace( 4, p_video_menu, wxU(_("&Video")) );
if( menu ) delete menu;
+ p_navig_menu = NavigMenu( p_intf, this );
+ menu = GetMenuBar()->Replace( 5, p_navig_menu, wxU(_("&Navigation")) );
+ if( menu ) delete menu;
+
#endif
}
vlc_object_release( p_playlist );
}
+void Interface::OnSlowStream( wxCommandEvent& WXUNUSED(event) )
+{
+ input_thread_t *p_input =
+ (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
+ FIND_ANYWHERE );
+ if( p_input )
+ {
+ input_SetStatus( p_input, INPUT_STATUS_SLOWER );
+ vlc_object_release( p_input );
+ }
+}
+
+void Interface::OnFastStream( wxCommandEvent& WXUNUSED(event) )
+{
+ input_thread_t *p_input =
+ (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
+ FIND_ANYWHERE );
+ if( p_input )
+ {
+ input_SetStatus( p_input, INPUT_STATUS_FASTER );
+ vlc_object_release( p_input );
+ }
+}
+
void Interface::TogglePlayButton( int i_playing_status )
{
if( i_playing_status == i_old_playing_status )
bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
const wxArrayString& filenames )
{
- unsigned int i;
-
/* Add dropped files to the playlist */
playlist_t *p_playlist =
return FALSE;
}
- for( i = 0; i < filenames.GetCount(); i++ )
+ for( size_t i = 0; i < filenames.GetCount(); i++ )
playlist_Add( p_playlist, (const char *)filenames[i].mb_str(),
- PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
+ PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
vlc_object_release( p_playlist );