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 );
}
}
/*****************************************************************************
* preferences.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: preferences.cpp,v 1.1 2003/03/26 00:56:22 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <errno.h> /* ENOMEM */
#include <string.h> /* strerror() */
#include <stdio.h>
#include <vlc/vlc.h>
#ifdef WIN32 /* mingw32 hack */
#undef Yield
#undef CreateDialog
#endif
/* Let vlc take care of the i18n stuff */
#define WXINTL_NO_GETTEXT_MACRO
#include <wx/wxprec.h>
#include <wx/wx.h>
#include <wx/notebook.h>
#include <wx/textctrl.h>
#include <wx/combobox.h>
#include <wx/spinctrl.h>
#include <wx/statline.h>
#include <wx/treectrl.h>
#include <vlc/intf.h>
#include "wxwindows.h"
#ifndef wxRB_SINGLE
# define wxRB_SINGLE 0
#endif
/*****************************************************************************
* Classes declarations.
*****************************************************************************/
class PrefsTreeCtrl : public wxTreeCtrl
{
public:
PrefsTreeCtrl() { }
PrefsTreeCtrl( wxWindow *parent, intf_thread_t *_p_intf,
PrefsDialog *p_prefs_dialog, wxBoxSizer *_p_sizer );
virtual ~PrefsTreeCtrl();
private:
/* Event handlers (these functions should _not_ be virtual) */
void OnSelectTreeItem( wxTreeEvent& event );
DECLARE_EVENT_TABLE()
intf_thread_t *p_intf;
PrefsDialog *p_prefs_dialog;
wxBoxSizer *p_sizer;
wxWindow *p_parent;
};
class PrefsPanel : public wxScrolledWindow
{
public:
PrefsPanel() { }
PrefsPanel( wxWindow *parent, intf_thread_t *_p_intf,
module_t *p_module, char * );
virtual ~PrefsPanel() {}
private:
void OnFileBrowse( wxCommandEvent& WXUNUSED(event) );
void OnDirectoryBrowse( wxCommandEvent& WXUNUSED(event) );
DECLARE_EVENT_TABLE()
intf_thread_t *p_intf;
};
class ConfigData : public wxTreeItemData
{
public:
ConfigData() { panel == NULL; }
virtual ~ConfigData() { if( panel ) delete panel; }
wxWindow *panel;
wxBoxSizer *sizer;
};
/*****************************************************************************
* Event Table.
*****************************************************************************/
/* IDs for the controls and the menu commands */
enum
{
Notebook_Event = wxID_HIGHEST,
MRL_Event,
};
BEGIN_EVENT_TABLE(PrefsDialog, wxDialog)
/* Button events */
EVT_BUTTON(wxID_OK, PrefsDialog::OnOk)
EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel)
END_EVENT_TABLE()
// menu and control ids
enum
{
PrefsTree_Ctrl = wxID_HIGHEST
};
BEGIN_EVENT_TABLE(PrefsTreeCtrl, wxTreeCtrl)
EVT_TREE_SEL_CHANGED(PrefsTree_Ctrl, PrefsTreeCtrl::OnSelectTreeItem)
END_EVENT_TABLE()
enum
{
FileBrowse_Event = wxID_HIGHEST,
DirectoryBrowse_Event,
};
BEGIN_EVENT_TABLE(PrefsPanel, wxScrolledWindow)
/* Button events */
EVT_BUTTON(FileBrowse_Event, PrefsPanel::OnFileBrowse)
EVT_BUTTON(DirectoryBrowse_Event, PrefsPanel::OnDirectoryBrowse)
END_EVENT_TABLE()
/*****************************************************************************
* Constructor.
*****************************************************************************/
PrefsDialog::PrefsDialog( intf_thread_t *_p_intf, Interface *_p_main_interface)
: wxDialog( _p_main_interface, -1, _("Preferences"), wxDefaultPosition,
wxSize(600,400), wxDEFAULT_FRAME_STYLE )
{
/* Initializations */
p_intf = _p_intf;
p_main_interface = _p_main_interface;
/* Create a panel to put everything in */
wxPanel *panel = new wxPanel( this, -1 );
panel->SetAutoLayout( TRUE );
/* Create the preferences tree control */
wxBoxSizer *controls_sizer = new wxBoxSizer( wxHORIZONTAL );
PrefsTreeCtrl *prefs_tree =
new PrefsTreeCtrl( panel, p_intf, this, controls_sizer );
/* Separation */
wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
/* Create the buttons */
wxButton *ok_button = new wxButton( panel, wxID_OK, _("OK") );
ok_button->SetDefault();
wxButton *cancel_button = new wxButton( panel, wxID_CANCEL, _("Cancel") );
/* Place everything in sizers */
wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
button_sizer->Add( ok_button, 0, wxALL, 5 );
button_sizer->Add( cancel_button, 0, wxALL, 5 );
button_sizer->Layout();
wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
panel_sizer->Add( controls_sizer, 1, wxEXPAND | wxALL, 5 );
panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALIGN_BOTTOM |
wxALL, 5 );
panel_sizer->Layout();
panel->SetSizer( panel_sizer );
main_sizer->Add( panel, 1, wxEXPAND, 0 );
main_sizer->Layout();
SetSizer( main_sizer );
}
PrefsDialog::~PrefsDialog()
{
}
/*****************************************************************************
* Private methods.
*****************************************************************************/
/*****************************************************************************
* Events methods.
*****************************************************************************/
void PrefsDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
{
this->Hide();
}
void PrefsDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
{
this->Hide();
}
void PrefsTreeCtrl::OnSelectTreeItem( wxTreeEvent& event )
{
ConfigData *config_data;
config_data = (ConfigData *)GetItemData( event.GetOldItem() );
if( config_data && config_data->panel )
{
config_data->panel->Hide();
p_sizer->Remove( config_data->panel );
}
config_data = (ConfigData *)GetItemData( event.GetItem() );
if( config_data && config_data->panel )
{
config_data->panel->Show();
config_data->panel->FitInside();
p_sizer->Add( config_data->panel, 2, wxEXPAND | wxALL, 0 );
p_sizer->Layout();
}
}
void PrefsPanel::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
{
wxFileDialog dialog( this, _("Open file"), "", "", "*.*",
wxOPEN );
if( dialog.ShowModal() == wxID_OK )
{
#if 0
file_combo->SetValue( dialog.GetPath() );
#endif
}
}
void PrefsPanel::OnDirectoryBrowse( wxCommandEvent& WXUNUSED(event) )
{
wxFileDialog dialog( this, _("Open file"), "", "", "*.*",
wxOPEN );
if( dialog.ShowModal() == wxID_OK )
{
#if 0
file_combo->SetValue( dialog.GetPath() );
#endif
}
}
/*****************************************************************************
* PrefsTreeCtrl class definition.
*****************************************************************************/
PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
PrefsDialog *_p_prefs_dialog,
wxBoxSizer *_p_sizer )
: wxTreeCtrl( _p_parent, PrefsTree_Ctrl, wxDefaultPosition, wxDefaultSize,
wxTR_NO_LINES | wxTR_FULL_ROW_HIGHLIGHT |
wxTR_LINES_AT_ROOT | wxTR_HIDE_ROOT |
wxTR_HAS_BUTTONS | wxTR_TWIST_BUTTONS | wxSUNKEN_BORDER )
{
vlc_list_t *p_list;
module_t *p_module;
module_config_t *p_item;
int i_index;
/* Initializations */
p_intf = _p_intf;
p_prefs_dialog = _p_prefs_dialog;
p_sizer = _p_sizer;
p_parent = _p_parent;
wxTreeItemId root_item = AddRoot( "" );
/* List the plugins */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
if( !p_list ) return;
/*
* Build a tree of the main options
*/
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_module = (module_t *)p_list->p_values[i_index].p_object;
if( !strcmp( p_module->psz_object_name, "main" ) )
break;
}
if( i_index < p_list->i_count )
{
/* We found the main module */
/* Enumerate config options and add corresponding config boxes */
p_item = p_module->p_config;
if( p_item ) do
{
if( p_item->b_advanced && !config_GetInt( p_intf, "advanced" ))
{
continue;
}
switch( p_item->i_type )
{
case CONFIG_HINT_CATEGORY:
ConfigData *config_data = new ConfigData;
config_data->panel =
new PrefsPanel( p_parent, p_intf,
p_module, p_item->psz_text );
config_data->panel->Hide();
/* Add the category to the tree */
AppendItem( root_item, p_item->psz_text, -1, -1, config_data );
break;
}
}
while( p_item->i_type != CONFIG_HINT_END && p_item++ );
SortChildren( root_item );
}
/*
* Build a tree of all the plugins
*/
wxTreeItemId plugins_item = AppendItem( root_item, _("Plugins") );
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_module = (module_t *)p_list->p_values[i_index].p_object;
/* Find the capabiltiy child item */
long cookie; size_t i_child_index;
wxTreeItemId capability_item = GetFirstChild( plugins_item, cookie);
for( i_child_index = 0;
i_child_index < GetChildrenCount( plugins_item, FALSE );
i_child_index++ )
{
if( !GetItemText(capability_item).Cmp(p_module->psz_capability) )
{
break;
}
capability_item = GetNextChild( plugins_item, cookie );
}
if( i_child_index == GetChildrenCount( plugins_item, FALSE ) )
{
/* We didn't find it, add it */
capability_item = AppendItem( plugins_item,
p_module->psz_capability );
}
/* Add the plugin to the tree */
ConfigData *config_data = new ConfigData;
config_data->panel =
new PrefsPanel( p_parent, p_intf, p_module, NULL );
config_data->panel->Hide();
AppendItem( capability_item, p_module->psz_object_name, -1, -1,
config_data );
}
/* Sort all this mess */
long cookie; size_t i_child_index;
SortChildren( plugins_item );
wxTreeItemId capability_item = GetFirstChild( plugins_item, cookie);
for( i_child_index = 0;
i_child_index < GetChildrenCount( plugins_item, FALSE );
i_child_index++ )
{
capability_item = GetNextChild( plugins_item, cookie );
SortChildren( capability_item );
}
/* Clean-up everything */
vlc_list_release( p_list );
p_sizer->Add( this, 1, wxEXPAND | wxALL, 0 );
p_sizer->Layout();
}
PrefsTreeCtrl::~PrefsTreeCtrl()
{
}
/*****************************************************************************
* PrefsPanel class definition.
*****************************************************************************/
PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
module_t *p_module, char *psz_section )
: wxScrolledWindow( parent, -1, wxDefaultPosition, wxDefaultSize )
{
module_config_t *p_item;
wxStaticText *label;
wxComboBox *combo;
wxRadioButton *radio;
wxSpinCtrl *spin;
wxCheckBox *checkbox;
wxTextCtrl *textctrl;
wxButton *button;
wxStaticLine *static_line;
wxBoxSizer *horizontal_sizer;
/* Initializations */
p_intf = _p_intf;
SetAutoLayout( TRUE );
SetScrollRate( 5, 5 );
wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
/* Enumerate config options and add corresponding config boxes */
p_item = p_module->p_config;
/* Find the category if it has been specified */
if( psz_section && p_item->i_type == CONFIG_HINT_CATEGORY )
{
while( !p_item->i_type == CONFIG_HINT_CATEGORY ||
strcmp( psz_section, p_item->psz_text ) )
{
if( p_item->i_type == CONFIG_HINT_END )
break;
p_item++;
}
}
/* Add a head title to the panel */
wxStaticBox *static_box = new wxStaticBox( this, -1, "" );
wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( static_box,
wxHORIZONTAL );
label = new wxStaticText( this, -1,
psz_section ? p_item->psz_text :
p_module->psz_longname );
box_sizer->Add( label, 1, wxALL, 5 );
sizer->Add( box_sizer, 0, wxEXPAND | wxALL, 5 );
if( p_item ) do
{
if( p_item->b_advanced && !config_GetInt( p_intf, "advanced" ) )
{
continue;
}
/* If a category has been specified, check we finished the job */
if( psz_section && p_item->i_type == CONFIG_HINT_CATEGORY &&
strcmp( psz_section, p_item->psz_text ) )
break;
switch( p_item->i_type )
{
case CONFIG_HINT_CATEGORY:
#if 0
label = new wxStaticText(this, -1, p_item->psz_text);
sizer->Add( label, 0, wxALL, 5 );
#endif
break;
case CONFIG_ITEM_MODULE:
/* build a list of available modules */
label = new wxStaticText(this, -1, p_item->psz_text);
combo = new wxComboBox( this, -1, "", wxPoint(20,25),
wxSize(120, -1), 0, NULL );
combo->SetToolTip( p_item->psz_longtext );
horizontal_sizer = new wxBoxSizer( wxHORIZONTAL );
horizontal_sizer->Add( label, 0, wxALL, 5 );
horizontal_sizer->Add( combo, 0, wxALL, 5 );
sizer->Add( horizontal_sizer, 0, wxALL, 5 );
break;
case CONFIG_ITEM_STRING:
case CONFIG_ITEM_FILE:
label = new wxStaticText(this, -1, p_item->psz_text);
textctrl = new wxTextCtrl( this, -1, "",
wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER);
#if 0
combo = new wxComboBox( this, -1, "", wxPoint(20,25),
wxSize(120, -1), 0, NULL );
#endif
textctrl->SetToolTip( p_item->psz_longtext );
horizontal_sizer = new wxBoxSizer( wxHORIZONTAL );
horizontal_sizer->Add( label, 0, wxALL, 5 );
horizontal_sizer->Add( textctrl, 0, wxALL, 5 );
if( p_item->i_type == CONFIG_ITEM_FILE )
{
button = new wxButton( this, -1, _("Browse...") );
horizontal_sizer->Add( button, 0, wxALL, 5 );
}
sizer->Add( horizontal_sizer, 0, wxALL, 5 );
break;
case CONFIG_ITEM_INTEGER:
label = new wxStaticText(this, -1, p_item->psz_text);
spin = new wxSpinCtrl( this, -1, p_item->psz_text,
wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS,
0, 16000, 8);
spin->SetToolTip( p_item->psz_longtext );
horizontal_sizer = new wxBoxSizer( wxHORIZONTAL );
horizontal_sizer->Add( label, 0, wxALL, 5 );
horizontal_sizer->Add( spin, 0, wxALL, 5 );
sizer->Add( horizontal_sizer, 0, wxALL, 5 );
break;
case CONFIG_ITEM_FLOAT:
label = new wxStaticText(this, -1, p_item->psz_text);
spin = new wxSpinCtrl( this, -1, p_item->psz_text,
wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS,
0, 16000, 8);
spin->SetToolTip( p_item->psz_longtext );
horizontal_sizer = new wxBoxSizer( wxHORIZONTAL );
horizontal_sizer->Add( label, 0, wxALL, 5 );
horizontal_sizer->Add( spin, 0, wxALL, 5 );
sizer->Add( horizontal_sizer, 0, wxALL, 5 );
break;
case CONFIG_ITEM_BOOL:
checkbox = new wxCheckBox( this, -1, p_item->psz_text );
checkbox->SetToolTip( p_item->psz_longtext );
horizontal_sizer = new wxBoxSizer( wxHORIZONTAL );
horizontal_sizer->Add( checkbox, 0, wxALL, 5 );
sizer->Add( horizontal_sizer, 0, wxALL, 5 );
break;
}
}
while( p_item->i_type != CONFIG_HINT_END && p_item++ );
sizer->Layout();
SetSizer( sizer );
}
......@@ -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 )
......@@ -184,9 +197,9 @@ void Timer::Notify()
p_main_interface->slider->SetValue(
p_intf->p_sys->i_slider_pos );
DisplayStreamDate( p_main_interface->slider_box,
p_intf,
p_intf->p_sys->i_slider_pos );
DisplayStreamDate( p_main_interface->slider_box,
p_intf,
p_intf->p_sys->i_slider_pos );
}
}
......@@ -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 );
setlocale( LC_MESSAGES, psz_lang );
# endif
setlocale( LC_CTYPE, psz_lang );
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