]> git.sesse.net Git - vlc/commitdiff
* modules/gui/wxwindows/*: misc small improvements and fixes.
authorGildas Bazin <gbazin@videolan.org>
Tue, 1 Apr 2003 16:11:43 +0000 (16:11 +0000)
committerGildas Bazin <gbazin@videolan.org>
Tue, 1 Apr 2003 16:11:43 +0000 (16:11 +0000)
modules/gui/wxwindows/fileinfo.cpp
modules/gui/wxwindows/interface.cpp
modules/gui/wxwindows/messages.cpp
modules/gui/wxwindows/open.cpp
modules/gui/wxwindows/playlist.cpp
modules/gui/wxwindows/preferences.cpp
modules/gui/wxwindows/streamout.cpp
modules/gui/wxwindows/wxwindows.h

index 4b20deefc5ebb2538b02843e0a6a9819eeaf046b..9cf0e9bcb30121914ad6f92206d9ad1c9a622868 100644 (file)
@@ -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 <sigmunau@idi.ntnu.no>
  *
@@ -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()
index b261bb47fb79787fe32ed336158426454fa67803..a422842d07ed0eef285ce14e0998a2d86e94d2a3 100644 (file)
@@ -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 <gbazin@netcourrier.com>
  *
@@ -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) )
index d00b506fb0279518a6708dc5f9cf1397eaf76465..bb1701f95bf2830dfd595c3d50b94709207cfc84 100644 (file)
@@ -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 <ipkiss@via.ecp.fr>
  *
@@ -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 );
index 0d13d04ee2babb4cadd8561b7837bd0f9ab1993a..2357efa45428339181ca87bed69642b7f0661aee 100644 (file)
@@ -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 <gbazin@netcourrier.com>
  *
@@ -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 );
index f5bfbf67464c10aa4a93b0dc16a24a4a09cef0c4..34341bc5786d4d98ef43b186da2838f853eb06d6 100644 (file)
@@ -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 <ipkiss@via.ecp.fr>
  *
@@ -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;
index 1c61f7d30543c73d2f618d44fc7f759a916692fa..856027d787eb07eae3c1331b87a9f8e44a0c4c54 100644 (file)
@@ -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 <gbazin@netcourrier.com>
  *
@@ -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 );
index def6ab20c8c0e7596a223e488e3cb8eeac442319..2fb7fca508078c5e46c0203f2c01596e73e5eb91 100644 (file)
@@ -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 <gbazin@netcourrier.com>
  *
@@ -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 );
index ffc0e7d8ecc7f0357ea129caec5008719995e5cc..e269f463c424f0b2979291f03f6d11dda71c6d0b 100644 (file)
@@ -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 <gbazin@netcourrier.com>
  *
@@ -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;
 };