]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/iteminfo.cpp
* modules/gui/wxwindows/interface.cpp: update the checkbox of the extended gui menu...
[vlc] / modules / gui / wxwindows / iteminfo.cpp
index 8dd78ba1adae8a2d64ccd5a462e832450ffb77fa..1d97d9dbf80166e9494ef4d43ccc7f5524ca12d1 100644 (file)
@@ -2,7 +2,7 @@
  * iteminfo.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2004 VideoLAN
- * $Id: iteminfo.cpp,v 1.7 2004/01/25 03:29:01 hartman Exp $
+ * $Id$
  *
  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
  *
@@ -139,55 +139,41 @@ wxPanel *ItemInfoDialog::InfoPanel( wxWindow* parent )
     wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( panel_box,
                                                           wxVERTICAL );
 
+    wxFlexGridSizer *sizer = new wxFlexGridSizer(2,3,20);
     /* URI Textbox */
     wxStaticText *uri_label =
            new wxStaticText( info_panel, -1, wxU(_("URI")) );
 
-    uri_text =  new wxTextCtrl( info_panel, Uri_Event,
-                                wxU(p_item->psz_uri),
-                                wxDefaultPosition, wxSize( 300, -1 ),
-                                wxTE_PROCESS_ENTER);
+    uri_text = new wxTextCtrl( info_panel, Uri_Event,
+        wxU(p_item->input.psz_uri), wxDefaultPosition, wxSize( 300, -1 ),
+        wxTE_PROCESS_ENTER );
 
-    wxBoxSizer *uri_sizer = new wxBoxSizer( wxHORIZONTAL );
-
-    uri_sizer->Add( uri_label, 0 , wxALIGN_RIGHT |wxALL , 5 );
-    uri_sizer->Add( uri_text, 1 , wxALIGN_RIGHT | wxALL , 5 );
-    uri_sizer->Layout();
-    box_sizer->Add( uri_sizer, 1, wxEXPAND , 5);
+    sizer->Add( uri_label, 0 , wxALIGN_LEFT |wxALL , 5 );
+    sizer->Add( uri_text, 1 , wxALIGN_RIGHT | wxALL , 5 );
 
     /* Name Textbox */
     wxStaticText *name_label =
            new wxStaticText(  info_panel, -1, wxU(_("Name")) );
 
-    name_text =
-                   new wxTextCtrl( info_panel, Uri_Event,
-                                   wxU(p_item->psz_name),
-                                   wxDefaultPosition, wxSize( 300, -1 ),
-                                   wxTE_PROCESS_ENTER);
-
-    wxBoxSizer *name_sizer = new wxBoxSizer( wxHORIZONTAL );
+    name_text = new wxTextCtrl( info_panel, Uri_Event,
+        wxU(p_item->input.psz_name), wxDefaultPosition, wxSize( 300, -1 ),
+        wxTE_PROCESS_ENTER );
 
-    name_sizer->Add( name_label, 0 , wxALIGN_RIGHT |wxALL , 5  );
-    name_sizer->Add( name_text, 1 , wxALIGN_RIGHT | wxALL , 5 );
-    name_sizer->Layout();
-    box_sizer->Add( name_sizer, 1 , wxEXPAND, 5 );
+    sizer->Add( name_label, 0 , wxALIGN_LEFT |wxALL , 5  );
+    sizer->Add( name_text, 1 , wxALIGN_RIGHT | wxALL , 5 );
 
     /* Author Textbox */
     wxStaticText *author_label =
            new wxStaticText( info_panel, -1, wxU(_("Author")) );
 
-    author_text =
-                   new wxTextCtrl( info_panel, Uri_Event,
-                                   wxU( playlist_GetItemInfo( p_item,
+    author_text = new wxTextCtrl( info_panel, Uri_Event,
+                                   wxU( playlist_ItemGetInfo( p_item,
                                           _("General"), _("Author") ) ),
                                    wxDefaultPosition, wxSize( 300, -1 ),
                                    wxTE_PROCESS_ENTER);
 
-    wxBoxSizer *author_sizer = new wxBoxSizer( wxHORIZONTAL );
-    author_sizer->Add( author_label, 0 , wxALIGN_RIGHT | wxALL , 5 );
-    author_sizer->Add( author_text, 1 , wxALIGN_RIGHT | wxALL , 5);
-    author_sizer->Layout();
-    box_sizer->Add( author_sizer, 1, wxEXPAND, 5 );
+    sizer->Add( author_label, 0 , wxALIGN_LEFT | wxALL , 5 );
+    sizer->Add( author_text, 1 , wxALIGN_RIGHT | wxALL , 5);
 
     /* Treeview */
     info_tree = new wxTreeCtrl( info_panel, -1, wxDefaultPosition,
@@ -195,6 +181,8 @@ wxPanel *ItemInfoDialog::InfoPanel( wxWindow* parent )
                                 wxSUNKEN_BORDER |wxTR_HAS_BUTTONS |
                                 wxTR_HIDE_ROOT );
 
+    sizer->Layout();
+    box_sizer->Add( sizer, 0, wxEXPAND, 5 );
     box_sizer->Add( info_tree, 0, wxEXPAND, 5 );
     info_sizer->Add( box_sizer, 1, wxBOTTOM, 5 );
 
@@ -236,8 +224,7 @@ wxPanel *ItemInfoDialog::GroupPanel( wxWindow* parent )
 
     group_combo = new wxComboBox( group_subpanel, -1,
                                  wxT(""),wxDefaultPosition, wxDefaultSize,
-                                 0, NULL,
-                                 wxCB_READONLY );
+                                 0, NULL, wxCB_READONLY );
 
     wxButton *newgroup_button = new wxButton( group_subpanel, New_Event,
                                     wxU(_("New Group")));
@@ -245,6 +232,11 @@ wxPanel *ItemInfoDialog::GroupPanel( wxWindow* parent )
     for( int i=0; i< p_playlist->i_groups ; i++)
     {
         group_combo->Append( wxU( p_playlist->pp_groups[i]->psz_name ) );
+        if( p_playlist->pp_groups[i]->i_id == p_item->i_group )
+        {
+            group_combo->SetSelection( i );
+            group_combo->SetValue( wxU( p_playlist->pp_groups[i]->psz_name ) );
+        }
     }
 
     vlc_object_release ( p_playlist );
@@ -277,26 +269,28 @@ void ItemInfoDialog::UpdateInfo()
 {
     if( !info_root )
     {
-       info_root = info_tree->AddRoot( wxU( p_item->psz_name) );
+       info_root = info_tree->AddRoot( wxU( p_item->input.psz_name) );
     }
 
     /* Rebuild the tree */
-    for( int i = 0; i< p_item->i_categories ; i++)
+    for( int i = 0; i< p_item->input.i_categories ; i++)
     {
-        if( !strcmp( p_item->pp_categories[i]->psz_name, _("Options") ) )
+        if( !strcmp( p_item->input.pp_categories[i]->psz_name, _("Options") ) )
         {
             continue;
         }
         wxTreeItemId cat = info_tree->AppendItem( info_root,
-                            wxU( p_item->pp_categories[i]->psz_name) );
+                            wxU( p_item->input.pp_categories[i]->psz_name) );
 
-        for( int j = 0 ; j < p_item->pp_categories[i]->i_infos ; j++ )
+        for( int j = 0 ; j < p_item->input.pp_categories[i]->i_infos ; j++ )
         {
            info_tree->AppendItem( cat , (wxString)
-                      wxU(p_item->pp_categories[i]->pp_infos[j]->psz_name) +
-                      wxT(": ") +
-                      wxU(p_item->pp_categories[i]->pp_infos[j]->psz_value) );
+               wxU(p_item->input.pp_categories[i]->pp_infos[j]->psz_name) +
+               wxT(": ") +
+               wxU(p_item->input.pp_categories[i]->pp_infos[j]->psz_value) );
         }
+
+        info_tree->Expand( cat );
     }
 }
 
@@ -305,9 +299,10 @@ void ItemInfoDialog::UpdateInfo()
  *****************************************************************************/
 void ItemInfoDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
 {
-    p_item->psz_name = strdup( name_text->GetLineText(0).mb_str() );
-    p_item->psz_uri = strdup( uri_text->GetLineText(0).mb_str() );
-    playlist_AddItemInfo( p_item,"General","Author",
+    vlc_mutex_lock( &p_item->input.lock );
+    p_item->input.psz_name = strdup( name_text->GetLineText(0).mb_str() );
+    p_item->input.psz_uri = strdup( uri_text->GetLineText(0).mb_str() );
+    playlist_ItemAddInfo( p_item,"General","Author",
                             author_text->GetLineText(0).mb_str() );
     vlc_bool_t b_old_enabled = p_item->b_enabled;
 
@@ -335,6 +330,7 @@ void ItemInfoDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
     }
 
     p_item->b_enabled = enabled_checkbox->IsChecked() ? VLC_TRUE : VLC_FALSE ;
+    vlc_mutex_unlock( &p_item->input.lock );
     EndModal( wxID_OK );
 }