Commit 3cec32c6 authored by Gildas Bazin's avatar Gildas Bazin

* src/libvlc.c, src/libvlc.h: added a config option to disable the translation of the interface.
* modules/gui/wxwindows/*: misc improvements + skeleton for a preferences panel.
parent 86c227e6
......@@ -7,6 +7,7 @@ SOURCES_wxwindows = \
modules/gui/wxwindows/messages.cpp \
modules/gui/wxwindows/playlist.cpp \
modules/gui/wxwindows/popup.cpp \
modules/gui/wxwindows/preferences.cpp \
modules/gui/wxwindows/timer.cpp \
modules/gui/wxwindows/fileinfo.cpp \
$(NULL)
......
......@@ -2,7 +2,7 @@
* fileinfo.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: fileinfo.cpp,v 1.4 2003/03/13 22:45:32 sigmunau Exp $
* $Id: fileinfo.cpp,v 1.5 2003/03/26 00:56:22 gbazin Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -75,11 +75,12 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, Interface *_p_main_interface ):
{
/* Initializations */
intf_thread_t *p_intf = _p_intf;
input_thread_t *p_input;
input_thread_t *p_input = p_intf->p_sys->p_input;
wxTreeCtrl *tree =
new wxTreeCtrl( this, -1, wxDefaultPosition, wxSize(350,350),
wxTR_HAS_BUTTONS | wxTR_HIDE_ROOT | wxSUNKEN_BORDER );
wxTreeCtrl *tree = new wxTreeCtrl( this, -1, wxDefaultPosition, wxSize(350,350),
wxTR_HAS_BUTTONS|wxTR_HIDE_ROOT );
p_input = p_intf->p_sys->p_input;
/* Create the OK button */
wxButton *ok_button = new wxButton( this, wxID_OK, _("OK") );
ok_button->SetDefault();
......
......@@ -2,7 +2,7 @@
* interface.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: interface.cpp,v 1.15 2003/01/26 13:37:09 gbazin Exp $
* $Id: interface.cpp,v 1.16 2003/03/26 00:56:22 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -112,6 +112,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
EVT_MENU(Playlist_Event, Interface::OnPlaylist)
EVT_MENU(Logs_Event, Interface::OnLogs)
EVT_MENU(FileInfo_Event, Interface::OnFileInfo)
EVT_MENU(Prefs_Event, Interface::OnPreferences)
/* Toolbar events */
EVT_MENU(OpenFile_Event, Interface::OnOpenFile)
......@@ -136,7 +137,9 @@ Interface::Interface( intf_thread_t *_p_intf ):
{
/* Initializations */
p_intf = _p_intf;
i_playing_status = PAUSE_S;
p_prefs_dialog = NULL;
p_fileinfo_window = NULL;
i_old_playing_status = PAUSE_S;
/* Give our interface a nice little icon */
SetIcon( *new wxIcon( vlc_xpm ) );
......@@ -177,6 +180,8 @@ Interface::Interface( intf_thread_t *_p_intf ):
Interface::~Interface()
{
if( p_prefs_dialog ) p_prefs_dialog->Destroy();
if( p_fileinfo_window ) p_fileinfo_window->Destroy();
}
/*****************************************************************************
......@@ -353,8 +358,7 @@ void Interface::Open( int i_access_method )
playlist_Add( p_playlist, (char *)dialog.mrl.c_str(),
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
i_playing_status = PLAYING_S;
TogglePlayButton();
TogglePlayButton( PLAYING_S );
/* Rebuild the playlist */
p_intf->p_sys->p_playlist_window->Rebuild();
......@@ -410,13 +414,31 @@ void Interface::OnLogs( wxCommandEvent& WXUNUSED(event) )
void Interface::OnFileInfo( wxCommandEvent& WXUNUSED(event) )
{
/* Show/hide the fileinfo window */
wxFrame *p_fileinfo_window = new FileInfo( p_intf, this );
if( p_fileinfo_window == NULL )
{
p_fileinfo_window = new FileInfo( p_intf, this );
}
if( p_fileinfo_window )
{
p_fileinfo_window->Show( true );//! p_messages_window->IsShown() );
}
}
void Interface::OnPreferences( wxCommandEvent& WXUNUSED(event) )
{
/* Show/hide the open dialog */
if( p_prefs_dialog == NULL )
{
p_prefs_dialog = new PrefsDialog( p_intf, this );
}
if( p_prefs_dialog )
{
p_prefs_dialog->Show( true );
}
}
void Interface::OnOpenFile( wxCommandEvent& WXUNUSED(event) )
{
Open( FILE_ACCESS );
......@@ -445,11 +467,11 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
FIND_ANYWHERE );
if( p_playlist == NULL )
{
/* If the playlist is empty, open a file requester instead */
OnOpenFile( dummy );
return;
}
/* If the playlist is empty, open a file requester instead */
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size )
{
......@@ -462,8 +484,7 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
{
/* No stream was playing, start one */
playlist_Play( p_playlist );
i_playing_status = PLAYING_S;
TogglePlayButton();
TogglePlayButton( PLAYING_S );
vlc_object_release( p_playlist );
return;
}
......@@ -472,8 +493,7 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
{
/* A stream is being played, pause it */
input_SetStatus( p_input, INPUT_STATUS_PAUSE );
i_playing_status = PAUSE_S;
TogglePlayButton();
TogglePlayButton( PAUSE_S );
vlc_object_release( p_playlist );
vlc_object_release( p_input );
return;
......@@ -481,8 +501,7 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
/* Stream is paused, resume it */
playlist_Play( p_playlist );
i_playing_status = PLAYING_S;
TogglePlayButton();
TogglePlayButton( PLAYING_S );
vlc_object_release( p_input );
vlc_object_release( p_playlist );
}
......@@ -505,8 +524,7 @@ void Interface::OnStopStream( wxCommandEvent& WXUNUSED(event) )
}
playlist_Stop( p_playlist );
i_playing_status = PAUSE_S;
TogglePlayButton();
TogglePlayButton( PAUSE_S );
vlc_object_release( p_playlist );
}
......@@ -582,8 +600,11 @@ void Interface::OnNextStream( wxCommandEvent& WXUNUSED(event) )
vlc_object_release( p_playlist );
}
void Interface::TogglePlayButton( )
void Interface::TogglePlayButton( int i_playing_status )
{
if( i_playing_status == i_old_playing_status )
return;
GetToolBar()->DeleteTool( PlayStream_Event );
if( i_playing_status == PLAYING_S )
......@@ -598,6 +619,8 @@ void Interface::TogglePlayButton( )
}
GetToolBar()->Realize();
i_old_playing_status = i_playing_status;
}
#if !defined(__WXX11__)
......
......@@ -2,7 +2,7 @@
* playlist.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: playlist.cpp,v 1.5 2002/12/08 19:56:04 gbazin Exp $
* $Id: playlist.cpp,v 1.6 2003/03/26 00:56:22 gbazin Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
*
......@@ -130,8 +130,8 @@ Playlist::Playlist( intf_thread_t *_p_intf, Interface *_p_main_interface ):
* themselves to the size of a listview, and with a wxDefaultSize the
* playlist window is ridiculously small */
listview = new wxListView( playlist_panel, ListView_Event,
wxDefaultPosition,
wxSize( 350, 300 ), wxLC_REPORT );
wxDefaultPosition, wxSize( 350, 300 ),
wxLC_REPORT | wxSUNKEN_BORDER );
listview->InsertColumn( 0, _("Url") );
listview->InsertColumn( 1, _("Duration") );
listview->SetColumnWidth( 0, 250 );
......@@ -323,4 +323,3 @@ void Playlist::OnKeyDown( wxListEvent& event )
OnDeleteSelection( event );
}
}
This diff is collapsed.
......@@ -2,7 +2,7 @@
* timer.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: timer.cpp,v 1.10 2003/01/28 21:08:29 sam Exp $
* $Id: timer.cpp,v 1.11 2003/03/26 00:56:22 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -56,6 +56,7 @@ Timer::Timer( intf_thread_t *_p_intf, Interface *_p_main_interface )
{
p_intf = _p_intf;
p_main_interface = _p_main_interface;
i_old_playing_status = PAUSE_S;
Start( 100 /*milliseconds*/, wxTIMER_CONTINUOUS );
}
......@@ -129,6 +130,9 @@ void Timer::Notify()
p_main_interface->frame_sizer->Fit( p_main_interface );
p_main_interface->statusbar->SetStatusText(
p_intf->p_sys->p_input->psz_source, 1 );
p_main_interface->TogglePlayButton( PLAYING_S );
i_old_playing_status = PLAYING_S;
}
}
else if( p_intf->p_sys->p_input->b_dead )
......@@ -141,6 +145,9 @@ void Timer::Notify()
p_main_interface->slider_frame );
p_main_interface->frame_sizer->Layout();
p_main_interface->frame_sizer->Fit( p_main_interface );
p_main_interface->TogglePlayButton( PAUSE_S );
i_old_playing_status = PAUSE_S;
}
p_main_interface->statusbar->SetStatusText( "", 1 );
......@@ -158,12 +165,18 @@ void Timer::Notify()
if( !p_input->b_die )
{
/* New input or stream map change */
p_intf->p_sys->b_playing = 1;
#if 0
if( p_input->stream.b_changed )
{
wxModeManage( p_intf );
wxSetupMenus( p_intf );
p_intf->p_sys->b_playing = 1;
p_main_interface->TogglePlayButton( PLAYING_S );
i_old_playing_status = PLAYING_S;
}
#endif
/* Manage the slider */
if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
......@@ -196,6 +209,20 @@ void Timer::Notify()
p_intf->p_sys->b_chapter_update = 1;
wxSetupMenus( p_intf );
}
/* Manage Playing status */
if( i_old_playing_status != p_input->stream.control.i_status )
{
if( p_input->stream.control.i_status == PAUSE_S )
{
p_main_interface->TogglePlayButton( PAUSE_S );
}
else
{
p_main_interface->TogglePlayButton( PLAYING_S );
}
i_old_playing_status = p_input->stream.control.i_status;
}
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
......@@ -204,6 +231,8 @@ void Timer::Notify()
{
wxModeManage( p_intf );
p_intf->p_sys->b_playing = 0;
p_main_interface->TogglePlayButton( PAUSE_S );
i_old_playing_status = PAUSE_S;
}
if( p_intf->b_die )
......
......@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.10 2003/03/22 11:21:58 gbazin Exp $
* $Id: wxwindows.h,v 1.11 2003/03/26 00:56:22 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -101,6 +101,7 @@ public:
private:
intf_thread_t *p_intf;
Interface *p_main_interface;
int i_old_playing_status;
};
/* Main Interface */
......@@ -110,6 +111,7 @@ public:
/* Constructor */
Interface( intf_thread_t *p_intf );
virtual ~Interface();
void TogglePlayButton( int i_playing_status );
wxBoxSizer *frame_sizer;
wxStatusBar *statusbar;
......@@ -135,6 +137,7 @@ private:
void OnPlaylist( wxCommandEvent& event );
void OnLogs( wxCommandEvent& event );
void OnFileInfo( wxCommandEvent& event );
void OnPreferences( wxCommandEvent& event );
void OnOpenFile( wxCommandEvent& event );
void OnOpenDisc( wxCommandEvent& event );
......@@ -147,13 +150,15 @@ private:
void OnPrevStream( wxCommandEvent& event );
void OnNextStream( wxCommandEvent& event );
void TogglePlayButton();
DECLARE_EVENT_TABLE();
Timer *timer;
intf_thread_t *p_intf;
int i_playing_status;
wxDialog *p_prefs_dialog;
wxFrame *p_fileinfo_window;
int i_old_playing_status;
};
/* Open Dialog */
......@@ -293,6 +298,27 @@ private:
};
/* Preferences Dialog */
class PrefsDialog: public wxDialog
{
public:
/* Constructor */
PrefsDialog( intf_thread_t *p_intf, Interface *p_main_interface );
virtual ~PrefsDialog();
private:
wxPanel *PrefsPanel( wxWindow* parent );
/* Event handlers (these functions should _not_ be virtual) */
void OnOk( wxCommandEvent& event );
void OnCancel( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
Interface *p_main_interface;
};
/* Messages */
class Messages: public wxFrame
{
......
......@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.70 2003/03/04 23:36:57 massiot Exp $
* $Id: libvlc.c,v 1.71 2003/03/26 00:56:22 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -321,6 +321,18 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
return VLC_EEXIT;
}
/* Check for translation config option */
if( !config_GetInt( p_vlc, "translation" ) )
{
/* Reset the default domain */
SetLanguage( "C" );
#if defined( ENABLE_NLS ) \
&& ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
textdomain( "dummy" );
#endif
}
/*
* Load the builtins and plugins into the module_bank.
* We have to do it before config_Load*() because this also gets the
......@@ -996,10 +1008,17 @@ static void SetLanguage ( char const *psz_lang )
}
# endif
if( psz_lang && !*psz_lang )
{
# if defined( HAVE_LC_MESSAGES )
setlocale( LC_MESSAGES, psz_lang );
# endif
setlocale( LC_CTYPE, psz_lang );
}
else
{
setlocale( LC_ALL, psz_lang );
}
/* Specify where to find the locales for current domain */
#if !defined( SYS_DARWIN ) && !defined( WIN32 )
......@@ -1421,4 +1440,3 @@ static int ConsoleWidth( void )
return i_width;
}
......@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.49 2003/03/17 12:14:26 massiot Exp $
* $Id: libvlc.h,v 1.50 2003/03/26 00:56:22 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -55,6 +55,10 @@ static char *ppsz_sout_vcodec[] = { "", "mpeg1", "mpeg2", "mpeg4", NULL };
#define QUIET_LONGTEXT N_( \
"This options turns off all warning and information messages.")
#define TRANSLATION_TEXT N_("translation")
#define TRANSLATION_LONGTEXT N_( \
"This option allows you to enable the translation of the interface.")
#define COLOR_TEXT N_("color messages")
#define COLOR_LONGTEXT N_( \
"When this option is turned on, the messages sent to the console will " \
......@@ -449,6 +453,7 @@ vlc_module_begin();
add_integer_with_short( "verbose", 'v', -1, NULL,
VERBOSE_TEXT, VERBOSE_LONGTEXT, VLC_FALSE );
add_bool_with_short( "quiet", 'q', 0, NULL, QUIET_TEXT, QUIET_LONGTEXT, VLC_TRUE );
add_bool( "translation", 1, NULL, TRANSLATION_TEXT, TRANSLATION_LONGTEXT, VLC_FALSE );
add_bool( "color", 0, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );
add_bool( "advanced", 0, NULL, ADVANCED_TEXT, ADVANCED_LONGTEXT, VLC_FALSE );
add_string( "search-path", NULL, NULL, INTF_PATH_TEXT, INTF_PATH_LONGTEXT, VLC_TRUE );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment