From 5cc093863eeec09933ab896764e5f1a3b3d9d0b1 Mon Sep 17 00:00:00 2001 From: Gildas Bazin Date: Tue, 1 Apr 2003 16:11:43 +0000 Subject: [PATCH] * modules/gui/wxwindows/*: misc small improvements and fixes. --- modules/gui/wxwindows/fileinfo.cpp | 37 +++++++++++++++++++-------- modules/gui/wxwindows/interface.cpp | 19 ++++---------- modules/gui/wxwindows/messages.cpp | 3 ++- modules/gui/wxwindows/open.cpp | 3 ++- modules/gui/wxwindows/playlist.cpp | 3 ++- modules/gui/wxwindows/preferences.cpp | 11 +++++--- modules/gui/wxwindows/streamout.cpp | 5 ++-- modules/gui/wxwindows/wxwindows.h | 4 +-- 8 files changed, 51 insertions(+), 34 deletions(-) diff --git a/modules/gui/wxwindows/fileinfo.cpp b/modules/gui/wxwindows/fileinfo.cpp index 4b20deefc5..9cf0e9bcb3 100644 --- a/modules/gui/wxwindows/fileinfo.cpp +++ b/modules/gui/wxwindows/fileinfo.cpp @@ -2,7 +2,7 @@ * fileinfo.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: fileinfo.cpp,v 1.5 2003/03/26 00:56:22 gbazin Exp $ + * $Id: fileinfo.cpp,v 1.6 2003/04/01 16:11:43 gbazin Exp $ * * Authors: Sigmund Augdal * @@ -61,9 +61,9 @@ BEGIN_EVENT_TABLE(FileInfo, wxFrame) /* Button events */ EVT_BUTTON(wxID_OK, FileInfo::OnClose) - /* Special events : we don't want to destroy the window when the user - * clicks on (X) */ + /* Destroy the window when the user closes the window */ EVT_CLOSE(FileInfo::OnClose) + END_EVENT_TABLE() /***************************************************************************** @@ -76,13 +76,19 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, Interface *_p_main_interface ): /* Initializations */ intf_thread_t *p_intf = _p_intf; input_thread_t *p_input = p_intf->p_sys->p_input; + SetIcon( *p_intf->p_sys->p_icon ); + SetAutoLayout(TRUE); + + /* Create a panel to put everything in */ + wxPanel *panel = new wxPanel( this, -1 ); + panel->SetAutoLayout( TRUE ); wxTreeCtrl *tree = - new wxTreeCtrl( this, -1, wxDefaultPosition, wxSize(350,350), + new wxTreeCtrl( panel, -1, wxDefaultPosition, wxSize(350,350), wxTR_HAS_BUTTONS | wxTR_HIDE_ROOT | wxSUNKEN_BORDER ); /* Create the OK button */ - wxButton *ok_button = new wxButton( this, wxID_OK, _("OK") ); + wxButton *ok_button = new wxButton( panel, wxID_OK, _("OK") ); ok_button->SetDefault(); /* Place everything in sizers */ @@ -90,14 +96,22 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, Interface *_p_main_interface ): ok_button_sizer->Add( ok_button, 0, wxALL, 5 ); ok_button_sizer->Layout(); wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); - main_sizer->Add( tree, 1, wxGROW|wxEXPAND | wxALL, 5 ); - main_sizer->Add( ok_button_sizer, 0, wxALIGN_CENTRE ); + wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); + panel_sizer->Add( tree, 1, wxEXPAND | wxALL, 5 ); + panel_sizer->Add( ok_button_sizer, 0, wxALIGN_CENTRE ); + panel_sizer->Layout(); + panel->SetSizerAndFit( panel_sizer ); + main_sizer->Add( panel, 1, wxEXPAND, 0 ); main_sizer->Layout(); - SetAutoLayout(TRUE); SetSizerAndFit( main_sizer ); - if ( !p_intf->p_sys->p_input ) { + + if ( !p_intf->p_sys->p_input ) + { + /* Nothing to show, but hey... */ + Show( true ); return; } + vlc_mutex_lock( &p_input->stream.stream_lock ); wxTreeItemId root = tree->AddRoot( p_input->psz_name ); tree->Expand( root ); @@ -107,12 +121,15 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, Interface *_p_main_interface ): wxTreeItemId cat = tree->AppendItem( root, p_cat->psz_name ); input_info_t *p_info = p_cat->p_info; while ( p_info ) { - tree->AppendItem( cat, wxString(p_info->psz_name) + ": " + p_info->psz_value ); + tree->AppendItem( cat, wxString(p_info->psz_name) + ": " + + p_info->psz_value ); p_info = p_info->p_next; } p_cat = p_cat->p_next; } vlc_mutex_unlock( &p_input->stream.stream_lock ); + + Show( true ); } FileInfo::~FileInfo() diff --git a/modules/gui/wxwindows/interface.cpp b/modules/gui/wxwindows/interface.cpp index b261bb47fb..a422842d07 100644 --- a/modules/gui/wxwindows/interface.cpp +++ b/modules/gui/wxwindows/interface.cpp @@ -2,7 +2,7 @@ * interface.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: interface.cpp,v 1.18 2003/04/01 00:18:29 gbazin Exp $ + * $Id: interface.cpp,v 1.19 2003/04/01 16:11:43 gbazin Exp $ * * Authors: Gildas Bazin * @@ -138,11 +138,11 @@ Interface::Interface( intf_thread_t *_p_intf ): /* Initializations */ p_intf = _p_intf; 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 ) ); + p_intf->p_sys->p_icon = new wxIcon( vlc_xpm ); + SetIcon( *p_intf->p_sys->p_icon ); /* Create a sizer for the main frame */ frame_sizer = new wxBoxSizer( wxHORIZONTAL ); @@ -183,7 +183,6 @@ 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(); } /***************************************************************************** @@ -417,16 +416,8 @@ void Interface::OnLogs( wxCommandEvent& WXUNUSED(event) ) void Interface::OnFileInfo( wxCommandEvent& WXUNUSED(event) ) { - /* Show/hide the fileinfo window */ - 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() ); - } + /* Open a fileinfo window */ + new FileInfo( p_intf, this ); } void Interface::OnPreferences( wxCommandEvent& WXUNUSED(event) ) diff --git a/modules/gui/wxwindows/messages.cpp b/modules/gui/wxwindows/messages.cpp index d00b506fb0..bb1701f95b 100644 --- a/modules/gui/wxwindows/messages.cpp +++ b/modules/gui/wxwindows/messages.cpp @@ -2,7 +2,7 @@ * playlist.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: messages.cpp,v 1.1 2002/12/15 22:45:09 ipkiss Exp $ + * $Id: messages.cpp,v 1.2 2003/04/01 16:11:43 gbazin Exp $ * * Authors: Olivier Teulière * @@ -76,6 +76,7 @@ Messages::Messages( intf_thread_t *_p_intf, Interface *_p_main_interface ): /* Initializations */ p_intf = _p_intf; p_main_interface = _p_main_interface; + SetIcon( *p_intf->p_sys->p_icon ); /* Create a panel to put everything in */ wxPanel *messages_panel = new wxPanel( this, -1 ); diff --git a/modules/gui/wxwindows/open.cpp b/modules/gui/wxwindows/open.cpp index 0d13d04ee2..2357efa454 100644 --- a/modules/gui/wxwindows/open.cpp +++ b/modules/gui/wxwindows/open.cpp @@ -2,7 +2,7 @@ * open.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: open.cpp,v 1.11 2003/04/01 00:18:29 gbazin Exp $ + * $Id: open.cpp,v 1.12 2003/04/01 16:11:43 gbazin Exp $ * * Authors: Gildas Bazin * @@ -144,6 +144,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, Interface *_p_main_interface, /* Initializations */ p_intf = _p_intf; p_main_interface = _p_main_interface; + SetIcon( *p_intf->p_sys->p_icon ); /* Create a panel to put everything in */ wxPanel *panel = new wxPanel( this, -1 ); diff --git a/modules/gui/wxwindows/playlist.cpp b/modules/gui/wxwindows/playlist.cpp index f5bfbf6746..34341bc578 100644 --- a/modules/gui/wxwindows/playlist.cpp +++ b/modules/gui/wxwindows/playlist.cpp @@ -2,7 +2,7 @@ * playlist.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: playlist.cpp,v 1.6 2003/03/26 00:56:22 gbazin Exp $ + * $Id: playlist.cpp,v 1.7 2003/04/01 16:11:43 gbazin Exp $ * * Authors: Olivier Teulière * @@ -98,6 +98,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, Interface *_p_main_interface ): /* Initializations */ p_intf = _p_intf; p_main_interface = _p_main_interface; + SetIcon( *p_intf->p_sys->p_icon ); /* Create our "Manage" menu */ wxMenu *manage_menu = new wxMenu; diff --git a/modules/gui/wxwindows/preferences.cpp b/modules/gui/wxwindows/preferences.cpp index 1c61f7d305..856027d787 100644 --- a/modules/gui/wxwindows/preferences.cpp +++ b/modules/gui/wxwindows/preferences.cpp @@ -2,7 +2,7 @@ * preferences.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: preferences.cpp,v 1.9 2003/04/01 00:18:29 gbazin Exp $ + * $Id: preferences.cpp,v 1.10 2003/04/01 16:11:43 gbazin Exp $ * * Authors: Gildas Bazin * @@ -188,6 +188,8 @@ BEGIN_EVENT_TABLE(PrefsDialog, wxFrame) EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel) EVT_BUTTON(wxID_SAVE, PrefsDialog::OnSave) + /* Don't destroy the window when the user closes it */ + EVT_CLOSE(PrefsDialog::OnCancel) END_EVENT_TABLE() // menu and control ids @@ -223,6 +225,7 @@ PrefsDialog::PrefsDialog( intf_thread_t *_p_intf, Interface *_p_main_interface) /* Initializations */ p_intf = _p_intf; p_main_interface = _p_main_interface; + SetIcon( *p_intf->p_sys->p_icon ); /* Create a panel to put everything in */ wxPanel *panel = new wxPanel( this, -1 ); @@ -435,7 +438,9 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf, p_sizer->Layout(); /* Update Tree Ctrl */ +#ifndef WIN32 /* Workaround a bug in win32 implementation */ SelectItem( GetFirstChild( root_item, cookie ) ); +#endif } PrefsTreeCtrl::~PrefsTreeCtrl() @@ -677,10 +682,10 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, case CONFIG_ITEM_FLOAT: label = new wxStaticText(panel, -1, p_item->psz_text); spin = new wxSpinCtrl( panel, -1, - wxString::Format("%d", p_item->i_value), + wxString::Format("%f", p_item->f_value), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, - 0, 16000, p_item->i_value); + 0, 16000, (int)p_item->f_value); spin->SetToolTip( p_item->psz_longtext ); config_data->control.spinctrl = spin; panel_sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); diff --git a/modules/gui/wxwindows/streamout.cpp b/modules/gui/wxwindows/streamout.cpp index def6ab20c8..2fb7fca508 100644 --- a/modules/gui/wxwindows/streamout.cpp +++ b/modules/gui/wxwindows/streamout.cpp @@ -2,7 +2,7 @@ * streamout.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: streamout.cpp,v 1.4 2003/04/01 00:18:29 gbazin Exp $ + * $Id: streamout.cpp,v 1.5 2003/04/01 16:11:43 gbazin Exp $ * * Authors: Gildas Bazin * @@ -132,6 +132,7 @@ SoutDialog::SoutDialog( intf_thread_t *_p_intf, Interface *_p_main_interface ): /* Initializations */ p_intf = _p_intf; p_main_interface = _p_main_interface; + SetIcon( *p_intf->p_sys->p_icon ); /* Create a panel to put everything in */ wxPanel *panel = new wxPanel( this, -1 ); @@ -356,7 +357,7 @@ wxPanel *SoutDialog::EncapsulationPanel( wxWindow* parent ) new wxRadioButton( panel, EncapsulationRadio1_Event + i, encapsulation_array[i] ); panel_sizer->Add( encapsulation_radios[i], 0, - wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5 ); + wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5 ); } panel->SetSizerAndFit( panel_sizer ); diff --git a/modules/gui/wxwindows/wxwindows.h b/modules/gui/wxwindows/wxwindows.h index ffc0e7d8ec..e269f463c4 100644 --- a/modules/gui/wxwindows/wxwindows.h +++ b/modules/gui/wxwindows/wxwindows.h @@ -2,7 +2,7 @@ * wxwindows.h: private wxWindows interface description ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: wxwindows.h,v 1.14 2003/03/30 11:43:38 gbazin Exp $ + * $Id: wxwindows.h,v 1.15 2003/04/01 16:11:43 gbazin Exp $ * * Authors: Gildas Bazin * @@ -39,6 +39,7 @@ struct intf_sys_t { /* the wx parent window */ wxWindow *p_wxwindow; + wxIcon *p_icon; /* secondary windows */ Playlist *p_playlist_window; @@ -156,7 +157,6 @@ private: intf_thread_t *p_intf; wxFrame *p_prefs_dialog; - wxFrame *p_fileinfo_window; int i_old_playing_status; }; -- 2.39.5