/*****************************************************************************
* interface.cpp : wxWindows plugin for vlc
*****************************************************************************
- * Copyright (C) 2000-2001 VideoLAN
- * $Id: interface.cpp,v 1.72 2003/11/29 13:39:43 gbazin Exp $
+ * Copyright (C) 2000-2004, 2003 VideoLAN
+ * $Id: interface.cpp,v 1.87 2004/03/01 18:31:13 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <stdlib.h> /* malloc(), free() */
-#include <errno.h> /* ENOMEM */
-#include <string.h> /* strerror() */
-#include <stdio.h>
-
#include <vlc/vlc.h>
#include <vlc/aout.h>
#include <vlc/vout.h>
#include "bitmaps/fast.xpm"
#include "bitmaps/slow.xpm"
-#include <wx/listctrl.h>
-
#define TOOLBAR_BMP_WIDTH 36
#define TOOLBAR_BMP_HEIGHT 36
OpenOther_Event,
EjectDisc_Event,
- Stream_Event,
+ StreamWizard_Event,
Playlist_Event,
Logs_Event,
Contrast_Event,
Brightness_Event,
Saturation_Event,
+ Gamma_Event,
Ratio_Event,
Visual_Event,
EVT_MENU( Extra_Event, Interface::OnExtra)
EVT_CHECKBOX( Adjust_Event, Interface::OnEnableAdjust)
- EVT_COMBOBOX( Ratio_Event, Interface::OnRatio)
+ EVT_TEXT( Ratio_Event, Interface::OnRatio)
EVT_CHECKBOX( Visual_Event, Interface::OnEnableVisual)
#if defined( __WXMSW__ ) || defined( __WXMAC__ )
EVT_MENU(OpenDisc_Event, Interface::OnShowDialog)
EVT_MENU(OpenNet_Event, Interface::OnShowDialog)
EVT_MENU(OpenSat_Event, Interface::OnShowDialog)
- EVT_MENU(Stream_Event, Interface::OnStream)
+ EVT_MENU(StreamWizard_Event, Interface::OnShowDialog)
EVT_MENU(StopStream_Event, Interface::OnStopStream)
EVT_MENU(PlayStream_Event, Interface::OnPlayStream)
EVT_MENU(PrevStream_Event, Interface::OnPrevStream)
EVT_COMMAND_SCROLL(Contrast_Event, Interface::OnContrastUpdate)
EVT_COMMAND_SCROLL(Brightness_Event, Interface::OnBrightnessUpdate)
EVT_COMMAND_SCROLL(Saturation_Event, Interface::OnSaturationUpdate)
+ EVT_COMMAND_SCROLL(Gamma_Event, Interface::OnGammaUpdate)
END_EVENT_TABLE()
*****************************************************************************/
Interface::Interface( intf_thread_t *_p_intf ):
wxFrame( NULL, -1, wxT("VLC media player"),
- wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
+ wxDefaultPosition, wxSize(700,100), wxDEFAULT_FRAME_STYLE )
{
/* Initializations */
p_intf = _p_intf;
wxWindow *p_dummy = new wxWindow( this, 0, wxDefaultPosition,
wxSize(0,0) );
p_dummy->SetFocus();
- frame_sizer->Add( p_dummy );
+ frame_sizer->Add( p_dummy, 0, wxEXPAND );
/* Creation of the menu bar */
CreateOurMenuBar();
SetBackgroundColour( slider_frame->GetBackgroundColour() );
/* Layout everything */
- SetAutoLayout( TRUE );
frame_sizer->Layout();
frame_sizer->Fit(this);
#define HELP_SIMPLE N_("Quick file open")
#define HELP_ADV N_("Advanced open")
#define HELP_FILE N_("Open a file")
-#define HELP_DISC N_("Open a DVD or (S)VCD")
+#define HELP_DISC N_("Open Disc Media")
#define HELP_NET N_("Open a network stream")
#define HELP_SAT N_("Open a satellite stream")
#define HELP_EJECT N_("Eject the DVD/CD")
/* Create the "File" menu */
wxMenu *file_menu = new wxMenu;
- file_menu->Append( OpenFileSimple_Event, wxU(_("Quick &Open ...")),
+ file_menu->Append( OpenFileSimple_Event, wxU(_("Quick &Open File...")),
wxU(_(HELP_SIMPLE)) );
file_menu->AppendSeparator();
wxU(_(HELP_NET)) );
#endif
file_menu->AppendSeparator();
- file_menu->Append( Stream_Event, wxU(_("Streaming Wizard...")),
+ file_menu->Append( StreamWizard_Event, wxU(_("Streaming Wizard...")),
wxU(_(HELP_STREAMWIZARD)) );
file_menu->AppendSeparator();
file_menu->Append( Exit_Event, wxU(_("E&xit")), wxU(_(HELP_EXIT)) );
view_menu->Append( Playlist_Event, wxU(_("&Playlist...")),
wxU(_(HELP_PLAYLIST)) );
view_menu->Append( Logs_Event, wxU(_("&Messages...")), wxU(_(HELP_LOGS)) );
- view_menu->Append( FileInfo_Event, wxU(_("&File info...")),
+ view_menu->Append( FileInfo_Event, wxU(_("&Stream and Media info...")),
wxU(_(HELP_FILEINFO)) );
/* Create the "Settings" menu */
/* Create the "Help" menu */
wxMenu *help_menu = new wxMenu;
- help_menu->Append( About_Event, wxU(_("&About...")), wxU(_(HELP_ABOUT)) );
+ help_menu->Append( About_Event, wxU(_("About VLC media player")), wxU(_(HELP_ABOUT)) );
/* Append the freshly created menus to the menu bar... */
wxMenuBar *menubar = new wxMenuBar( wxMB_DOCKABLE );
void Interface::CreateOurToolBar()
{
-#define HELP_STOP N_("Stop current playlist item")
+#define HELP_STOP N_("Stop")
-#define HELP_PLAY N_("Play current playlist item")
-#define HELP_PAUSE N_("Pause current playlist item")
-#define HELP_PLO N_("Open playlist")
+#define HELP_PLAY N_("Play")
+#define HELP_PAUSE N_("Pause")
+#define HELP_PLO N_("Playlist")
#define HELP_PLP N_("Previous playlist item")
#define HELP_PLN N_("Next playlist item")
#define HELP_SLOW N_("Play slower")
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_FLAT | wxTB_DOCKABLE );
+ wxToolBar *toolbar =
+ CreateToolBar( wxTB_HORIZONTAL | wxTB_FLAT | wxTB_DOCKABLE );
toolbar->SetToolBitmapSize( wxSize(TOOLBAR_BMP_WIDTH,TOOLBAR_BMP_HEIGHT) );
- toolbar->AddTool( OpenFileSimple_Event, wxU(_("Quick")),
+ toolbar->AddTool( OpenFileSimple_Event, wxT(""),
wxBitmap( file_xpm ), wxU(_(HELP_SIMPLE)) );
toolbar->AddSeparator();
-
- toolbar->AddTool( OpenFile_Event, wxU(_("File")), wxBitmap( file_xpm ),
+ toolbar->AddTool( OpenFile_Event, wxT(""), wxBitmap( file_xpm ),
wxU(_(HELP_FILE)) );
- toolbar->AddTool( OpenDisc_Event, wxU(_("Disc")), wxBitmap( disc_xpm ),
+ toolbar->AddTool( OpenDisc_Event, wxT(""), wxBitmap( disc_xpm ),
wxU(_(HELP_DISC)) );
- toolbar->AddTool( OpenNet_Event, wxU(_("Net")), wxBitmap( net_xpm ),
+ toolbar->AddTool( OpenNet_Event, wxT(""), wxBitmap( net_xpm ),
wxU(_(HELP_NET)) );
-#if 0
- toolbar->AddTool( OpenSat_Event, wxU(_("Sat")), wxBitmap( sat_xpm ),
- wxU(_(HELP_SAT)) );
-#endif
toolbar->AddSeparator();
- toolbar->AddTool( StopStream_Event, wxU(_("Stop")), wxBitmap( stop_xpm ),
+ toolbar->AddTool( StopStream_Event, wxT(""), wxBitmap( stop_xpm ),
wxU(_(HELP_STOP)) );
- toolbar->AddTool( PlayStream_Event, wxU(_("Play")), wxBitmap( play_xpm ),
+ toolbar->AddTool( PlayStream_Event, wxT(""), wxBitmap( play_xpm ),
wxU(_(HELP_PLAY)) );
+
toolbar->AddSeparator();
- toolbar->AddTool( Playlist_Event, wxU(_("Playlist")),
+ toolbar->AddTool( Playlist_Event, wxT(""),
wxBitmap( playlist_xpm ), wxU(_(HELP_PLO)) );
- toolbar->AddTool( PrevStream_Event, wxU(_("Prev")),
+ toolbar->AddTool( PrevStream_Event, wxT(""),
wxBitmap( previous_xpm ), wxU(_(HELP_PLP)) );
- toolbar->AddTool( NextStream_Event, wxU(_("Next")), wxBitmap( next_xpm ),
+ toolbar->AddTool( NextStream_Event, wxT(""), wxBitmap( next_xpm ),
wxU(_(HELP_PLN)) );
- toolbar->AddTool( SlowStream_Event, wxU(_("Slower")), wxBitmap( slow_xpm ),
+ toolbar->AddTool( SlowStream_Event, wxT(""), wxBitmap( slow_xpm ),
wxU(_(HELP_SLOW)) );
- toolbar->AddTool( FastStream_Event, wxU(_("Faster")), wxBitmap( fast_xpm ),
+ toolbar->AddTool( FastStream_Event, wxT(""), wxBitmap( fast_xpm ),
wxU(_(HELP_FAST)) );
toolbar->Realize();
/* Place the toolbar in a sizer, so we can calculate the width of the
* toolbar and set this as the minimum for the main frame size. */
wxBoxSizer *toolbar_sizer = new wxBoxSizer( wxHORIZONTAL );
- toolbar_sizer->Add( toolbar, 0, 0, 0 );
-
+ toolbar_sizer->Add( toolbar, 1, 0, 0 );
toolbar_sizer->Layout();
#ifndef WIN32
frame_sizer->SetMinSize( toolbar_sizer->GetMinSize().GetWidth(), -1 );
-#else
- frame_sizer->SetMinSize( toolbar->GetToolSize().GetWidth() *
- toolbar->GetToolsCount(), -1 );
+#else /* That sucks but for some reason it works better */
+ frame_sizer->SetMinSize( toolbar_sizer->GetMinSize().GetWidth()*2/3, -1 );
#endif
#if !defined(__WXX11__)
/* Create static box to surround the adjust controls */
wxStaticBox *adjust_box =
- new wxStaticBox( extra_frame, -1, wxU(_("Image adjust")) );
+ new wxStaticBox( extra_frame, -1, wxU(_("Adjust Image")) );
/* Create the size for the frame */
wxStaticBoxSizer *adjust_sizer =
saturation_sizer->Add(saturation_slider,1,0,0);
saturation_sizer->Layout();
+ wxBoxSizer *gamma_sizer = new wxBoxSizer( wxHORIZONTAL );
+ wxStaticText *gamma_text = new wxStaticText( extra_frame, -1,
+ wxU(_("Gamma")) );
+ gamma_slider = new wxSlider ( extra_frame, Gamma_Event, 0, 0,
+ 100, wxDefaultPosition, wxDefaultSize );
+ gamma_sizer->Add(gamma_text,1,0,0);
+ gamma_sizer->Add(gamma_slider,1,0,0);
+ gamma_sizer->Layout();
+
adjust_sizer->Add(adjust_check, 1, wxEXPAND, 0);
adjust_sizer->Add(hue_sizer, 1, wxEXPAND, 0);
adjust_sizer->Add(contrast_sizer, 1, wxEXPAND, 0);
adjust_sizer->Add(brightness_sizer, 1, wxEXPAND, 0);
adjust_sizer->Add(saturation_sizer, 1, wxEXPAND, 0);
+ adjust_sizer->Add(gamma_sizer, 1, wxEXPAND, 0);
extra_sizer->Add(adjust_sizer,1,wxBOTTOM,5);
-
/* Create sizer to surround the other controls */
wxBoxSizer *other_sizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer *ratio_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText *ratio_text = new wxStaticText( extra_frame, -1,
- wxU(_("Ratio")) );
+ wxU(_("Aspect Ratio")) );
ratio_combo = new wxComboBox( extra_frame, Ratio_Event, wxT(""),
wxDefaultPosition, wxSize(120,-1),
video_sizer->Add( ratio_sizer , 0 , wxALL , 0 );
video_sizer->Layout();
+#if 0
wxBoxSizer *visual_sizer = new wxBoxSizer( wxHORIZONTAL );
wxCheckBox *visual_checkbox = new wxCheckBox( extra_frame, Visual_Event,
- wxU(_("Visualisation")) );
+ wxU(_("Visualisations")) );
visual_sizer->Add( visual_checkbox, 0, wxEXPAND, 0);
visual_sizer->Layout();
audio_sizer->Add( visual_sizer, 0, wxALL, 0);
audio_sizer->Layout();
- other_sizer->Add( video_sizer, 0, wxALL | wxEXPAND , 0);
other_sizer->Add( audio_sizer , 0 , wxALL | wxEXPAND , 0 );
+#endif
+ other_sizer->Add( video_sizer, 0, wxALL | wxEXPAND , 0);
other_sizer->Layout();
extra_sizer->Add(other_sizer,0,wxBOTTOM,5);
extra_sizer->SetSizeHints(extra_frame);
/* Write down initial values */
+#if 0
psz_filters = config_GetPsz( p_intf, "audio-filter" );
if( psz_filters && strstr( psz_filters, "visual" ) )
{
visual_checkbox->SetValue(1);
}
if( psz_filters ) free( psz_filters );
-
+#endif
psz_filters = config_GetPsz( p_intf, "filter" );
if( psz_filters && strstr( psz_filters, "adjust" ) )
{
contrast_slider->Enable();
brightness_slider->Enable();
hue_slider->Enable();
+ gamma_slider->Enable();
}
else
{
contrast_slider->Disable();
brightness_slider->Disable();
hue_slider->Disable();
+ gamma_slider->Disable();
}
if( psz_filters ) free( psz_filters );
f_value = config_GetFloat( p_intf, "brightness" );
if( f_value > 0 && f_value < 2 )
brightness_slider->SetValue( (int)(100 * f_value) );
+ f_value = config_GetFloat( p_intf, "gamma" );
+ if( f_value > 0 && f_value < 10 )
+ gamma_slider->SetValue( (int)(10 * f_value) );
extra_frame->Hide();
}
wxString msg;
msg.Printf( wxString(wxT("VLC media player " VERSION)) +
wxU(_(" (wxWindows interface)\n\n")) +
- wxU(_("(C) 1996-2003 - the VideoLAN Team\n\n")) +
+ wxU(_("(c) 1996-2004 - the VideoLAN Team\n\n")) +
wxU( vlc_wraptext(INTF_ABOUT_MSG,WRAPCOUNT,ISUTF8) ) + wxT("\n\n") +
wxU(_("The VideoLAN team <videolan@videolan.org>\n"
"http://www.videolan.org/\n\n")) );
case Prefs_Event:
i_id = INTF_DIALOG_PREFS;
break;
+ case StreamWizard_Event:
+ i_id = INTF_DIALOG_STREAMWIZARD;
+ break;
default:
i_id = INTF_DIALOG_FILE;
break;
-
}
p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
}
}
-
-void Interface::OnStream( wxCommandEvent& event )
-{
- StreamDialog *p_stream_dialog = new StreamDialog(p_intf,this);
- p_stream_dialog->Show();
-}
-
-
void Interface::OnExtra(wxCommandEvent& event)
{
if( b_extra == VLC_FALSE)
saturation_slider->Enable();
contrast_slider->Enable();
hue_slider->Enable();
+ gamma_slider->Enable();
}
else
{
saturation_slider->Disable();
contrast_slider->Disable();
hue_slider->Disable();
+ gamma_slider->Disable();
}
if(psz_filters) free(psz_filters);
if(psz_new) free(psz_new);
void Interface::OnHueUpdate( wxScrollEvent& event)
{
- config_PutInt( p_intf , "hue" , event.GetPosition() );
+ config_PutInt( p_intf , "hue" , event.GetPosition() );
}
void Interface::OnSaturationUpdate( wxScrollEvent& event)
{
- config_PutFloat( p_intf , "saturation" , (float)event.GetPosition()/100 );
+ config_PutFloat( p_intf , "saturation" , (float)event.GetPosition()/100 );
}
void Interface::OnBrightnessUpdate( wxScrollEvent& event)
{
- config_PutFloat( p_intf , "brightness", (float)event.GetPosition()/100 );
+ config_PutFloat( p_intf , "brightness", (float)event.GetPosition()/100 );
}
void Interface::OnContrastUpdate(wxScrollEvent& event)
{
- config_PutFloat( p_intf , "contrast" , (float)event.GetPosition()/100 );
+ config_PutFloat( p_intf , "contrast" , (float)event.GetPosition()/100 );
+}
+void Interface::OnGammaUpdate(wxScrollEvent& event)
+{
+ config_PutFloat( p_intf , "gamma" , (float)event.GetPosition()/10 );
}
void Interface::OnRatio( wxCommandEvent& event )
{
/* Update stream date */
#define p_area p_intf->p_sys->p_input->stream.p_selected_area
- char psz_time[ OFFSETTOTIME_MAX_SIZE ];
+ char psz_time[ MSTRTIME_MAX_SIZE ];
slider_box->SetLabel(
wxU(input_OffsetToTime( p_intf->p_sys->p_input,
}
#endif
+#undef WIN32
vlc_mutex_unlock( &p_intf->change_lock );
}
vlc_value_t val; val.b_bool = VLC_TRUE;
vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
var_Set( p_playlist->p_input, "prev-title", val );
- vlc_mutex_unlock( &p_playlist->object_lock );
- vlc_object_release( p_playlist );
- return;
- }
- vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
+ } else
+ vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
}
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_value_t val; val.b_bool = VLC_TRUE;
vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
var_Set( p_playlist->p_input, "next-title", val );
- vlc_mutex_unlock( &p_playlist->object_lock );
- vlc_object_release( p_playlist );
- return;
- }
- vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
+ } else
+ vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
}
vlc_mutex_unlock( &p_playlist->object_lock );
}
for( size_t i = 0; i < filenames.GetCount(); i++ )
- playlist_Add( p_playlist, (const char *)filenames[i].mb_str(), 0, 0,
+ playlist_Add( p_playlist, (const char *)filenames[i].mb_str(),
+ (const char *)filenames[i].mb_str(),
PLAYLIST_APPEND | ((i | b_enqueue) ? 0 : PLAYLIST_GO),
PLAYLIST_END );
* Definition of wxVolCtrl class.
*****************************************************************************/
wxVolCtrl::wxVolCtrl( intf_thread_t *_p_intf, wxWindow* parent, wxWindowID id )
- : wxGauge( parent, id, 200, wxDefaultPosition, wxDefaultSize,
+ : wxGauge( parent, id, 200, wxDefaultPosition, wxSize( 20, -1 ),
wxGA_VERTICAL | wxGA_SMOOTH )
{
p_intf = _p_intf;