Changeset 1595dc2534196eac95a1488e864292fab033e99c

Show
Ignore:
Timestamp:
05/01/04 14:00:39 (5 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1073307639 +0000
git-parent:

[aa830d43217dd81fa8dda23613d394d58c0f38d0]

git-author:
Clément Stenac <zorglub@videolan.org> 1073307639 +0000
Message:

modules/gui/wxwindows/playlist.cpp
modules/gui/wxwindows/iteminfo.cpp

  • Show the info as a tree view.
    At the moment, all is shown. We should maybe hide the "Options" tree
    as it rather "internal"
  • Improved a little the layout
  • Added a popup menu to to the playlist
  • Minimize playlist rebuilds
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/gui/wxwindows/dialogs.cpp

    r3a6a1ce r1595dc2  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000-2001 VideoLAN 
    5  * $Id: dialogs.cpp,v 1.12 2003/12/11 02:26:03 asmax Exp $ 
     5 * $Id: dialogs.cpp,v 1.13 2004/01/05 13:00:39 zorglub Exp $ 
    66 * 
    77 * Authors: Gildas Bazin <gbazin@netcourrier.com> 
     
    290290            if( event.GetInt() ) 
    291291                playlist_Add( p_playlist, (const char *)paths[i].mb_str(), 
    292                               0, 0
     292                              (const char *)paths[i].mb_str()
    293293                              PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), 
    294294                              PLAYLIST_END ); 
    295295            else 
    296296                playlist_Add( p_playlist, (const char *)paths[i].mb_str(), 
    297                               0, 0, PLAYLIST_APPEND, PLAYLIST_END ); 
     297                              (const char *)paths[i].mb_str(), 
     298                              PLAYLIST_APPEND, PLAYLIST_END ); 
    298299    } 
    299300 
  • modules/gui/wxwindows/interface.cpp

    r1fc66ed r1595dc2  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000-2001, 2003 VideoLAN 
    5  * $Id: interface.cpp,v 1.82 2004/01/03 10:55:07 gbazin Exp $ 
     5 * $Id: interface.cpp,v 1.83 2004/01/05 13:00:39 zorglub Exp $ 
    66 * 
    77 * Authors: Gildas Bazin <gbazin@netcourrier.com> 
     
    209209Interface::Interface( intf_thread_t *_p_intf ): 
    210210    wxFrame( NULL, -1, wxT("VLC media player"), 
    211              wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE ) 
     211             wxDefaultPosition, wxSize(700,100), wxDEFAULT_FRAME_STYLE ) 
    212212{ 
    213213    /* Initializations */ 
     
    11751175#endif 
    11761176 
     1177#undef WIN32 
    11771178    vlc_mutex_unlock( &p_intf->change_lock ); 
    11781179} 
     
    13131314 
    13141315    for( size_t i = 0; i < filenames.GetCount(); i++ ) 
    1315         playlist_Add( p_playlist, (const char *)filenames[i].mb_str(), 0, 0, 
     1316        playlist_Add( p_playlist, (const char *)filenames[i].mb_str(), 
     1317                      (const char *)filenames[i].mb_str(), 
    13161318                      PLAYLIST_APPEND | ((i | b_enqueue) ? 0 : PLAYLIST_GO), 
    13171319                      PLAYLIST_END ); 
  • modules/gui/wxwindows/iteminfo.cpp

    r4219568 r1595dc2  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000-2001 VideoLAN 
    5  * $Id: iteminfo.cpp,v 1.5 2003/12/22 02:24:52 sam Exp $ 
     5 * $Id: iteminfo.cpp,v 1.6 2004/01/05 13:00:39 zorglub Exp $ 
    66 * 
    77 * Authors: Cl�nt Stenac <zorglub@videolan.org> 
     
    141141wxPanel *ItemInfoDialog::InfoPanel( wxWindow* parent ) 
    142142{ 
    143     wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition, 
     143    wxPanel *info_panel = new wxPanel( parent, -1, wxDefaultPosition, 
    144144                                  wxDefaultSize ); 
    145  
    146     wxStaticBox *panel_box = new wxStaticBox( panel, -1, 
     145    info_panel->SetAutoLayout( TRUE ); 
     146    wxBoxSizer *info_sizer = new wxBoxSizer( wxHORIZONTAL ); 
     147 
     148    /* Create a box to surround the controls */ 
     149    wxStaticBox *panel_box = new wxStaticBox( info_panel, -1, 
    147150                                   wxU(_("Item informations")) ); 
    148     wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box, 
     151 
     152    wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( panel_box, 
    149153                                                          wxVERTICAL ); 
    150  
    151     info_subpanel = new wxPanel( panel, -1 ); 
    152  
    153     wxFlexGridSizer *subpanel_sizer = 
    154                     new wxFlexGridSizer( 3, 1 , 0 , 0 ); 
    155154 
    156155    /* URI Textbox */ 
    157156    wxStaticText *uri_label = 
    158            new wxStaticText(info_subpanel, -1, wxU(_("URI")) ); 
    159  
    160     uri_text =  new wxTextCtrl( info_subpanel, Uri_Event, 
     157           new wxStaticText( info_panel, -1, wxU(_("URI")) ); 
     158 
     159    uri_text =  new wxTextCtrl( info_panel, Uri_Event, 
    161160                                wxU(p_item->psz_uri), 
    162161                                wxDefaultPosition, wxSize( 300, -1 ), 
    163162                                wxTE_PROCESS_ENTER); 
    164163 
    165     subpanel_sizer->Add( uri_label, 0, wxALIGN_LEFT | 
    166                          wxALIGN_CENTER_VERTICAL ); 
    167     subpanel_sizer->Add( uri_text, 0, wxALIGN_RIGHT | 
    168                          wxALIGN_CENTER_VERTICAL ); 
    169  
     164    wxBoxSizer *uri_sizer = new wxBoxSizer( wxHORIZONTAL ); 
     165 
     166    uri_sizer->Add( uri_label, 0 , wxALIGN_RIGHT |wxALL , 5 ); 
     167    uri_sizer->Add( uri_text, 1 , wxALIGN_RIGHT | wxALL , 5 ); 
     168    uri_sizer->Layout(); 
     169    box_sizer->Add( uri_sizer, 1, wxEXPAND , 5); 
    170170 
    171171    /* Name Textbox */ 
    172172    wxStaticText *name_label = 
    173            new wxStaticText(info_subpanel, -1, wxU(_("Name")) ); 
     173           new wxStaticText(  info_panel, -1, wxU(_("Name")) ); 
    174174 
    175175    name_text = 
    176                    new wxTextCtrl( info_subpanel, Uri_Event, 
     176                   new wxTextCtrl( info_panel, Uri_Event, 
    177177                                   wxU(p_item->psz_name), 
    178178                                   wxDefaultPosition, wxSize( 300, -1 ), 
    179179                                   wxTE_PROCESS_ENTER); 
    180180 
    181     subpanel_sizer->Add( name_label, 0, wxALIGN_LEFT | 
    182                          wxALIGN_CENTER_VERTICAL ); 
    183     subpanel_sizer->Add( name_text, 0, wxALIGN_RIGHT | 
    184                          wxALIGN_CENTER_VERTICAL ); 
     181    wxBoxSizer *name_sizer = new wxBoxSizer( wxHORIZONTAL ); 
     182 
     183    name_sizer->Add( name_label, 0 , wxALIGN_RIGHT |wxALL , 5  ); 
     184    name_sizer->Add( name_text, 1 , wxALIGN_RIGHT | wxALL , 5 ); 
     185    name_sizer->Layout(); 
     186    box_sizer->Add( name_sizer, 1 , wxEXPAND, 5 ); 
    185187 
    186188    /* Author Textbox */ 
    187189    wxStaticText *author_label = 
    188            new wxStaticText(info_subpanel, -1, wxU(_("Author")) ); 
     190           new wxStaticText( info_panel, -1, wxU(_("Author")) ); 
    189191 
    190192    author_text = 
    191                    new wxTextCtrl( info_subpanel, Uri_Event, 
    192                                    wxU(p_item->psz_author), 
     193                   new wxTextCtrl( info_panel, Uri_Event, 
     194                                   wxU( playlist_GetItemInfo( p_item, 
     195                                          _("General"), _("Author") ) ), 
    193196                                   wxDefaultPosition, wxSize( 300, -1 ), 
    194197                                   wxTE_PROCESS_ENTER); 
    195198 
    196     subpanel_sizer->Add( author_label, 0, wxALIGN_LEFT | 
    197                          wxALIGN_CENTER_VERTICAL ); 
    198     subpanel_sizer->Add( author_text, 0, wxALIGN_RIGHT | 
    199                          wxALIGN_CENTER_VERTICAL ); 
    200  
    201     info_subpanel->SetSizerAndFit( subpanel_sizer ); 
    202  
    203     /* Stuff everything into the main panel */ 
    204     panel_sizer->Add( info_subpanel, 1, 
    205                       wxEXPAND | wxALIGN_LEFT | 
    206                       wxALIGN_CENTER_VERTICAL | wxALL, 5 ); 
    207  
    208     panel->SetSizerAndFit( panel_sizer ); 
    209  
    210     return panel; 
     199    wxBoxSizer *author_sizer = new wxBoxSizer( wxHORIZONTAL ); 
     200    author_sizer->Add( author_label, 0 , wxALIGN_RIGHT | wxALL , 5 ); 
     201    author_sizer->Add( author_text, 1 , wxALIGN_RIGHT | wxALL , 5); 
     202    author_sizer->Layout(); 
     203    box_sizer->Add( author_sizer, 1, wxEXPAND, 5 ); 
     204 
     205    /* Treeview */ 
     206    info_tree = new wxTreeCtrl( info_panel, -1, wxDefaultPosition, 
     207                                wxSize(220,200), 
     208                                wxSUNKEN_BORDER |wxTR_HAS_BUTTONS | 
     209                                wxTR_HIDE_ROOT ); 
     210 
     211    box_sizer->Add( info_tree, 0, wxEXPAND, 5 ); 
     212    info_sizer->Add( box_sizer, 1, wxBOTTOM, 5 ); 
     213 
     214    info_panel->SetSizer( info_sizer ); 
     215    info_sizer->Layout(); 
     216    info_sizer->SetSizeHints( info_panel ); 
     217 
     218    UpdateInfo(); 
     219 
     220    return info_panel; 
    211221} 
    212222 
     
    277287} 
    278288 
     289void ItemInfoDialog::UpdateInfo() 
     290{ 
     291    if( !info_root ) 
     292    { 
     293       info_root = info_tree->AddRoot( wxU( p_item->psz_name) ); 
     294    } 
     295 
     296    /* Rebuild the tree */ 
     297    for( int i = 0; i< p_item->i_categories ; i++) 
     298    { 
     299        if( !strcmp( p_item->pp_categories[i]->psz_name, _("Options") ) ) 
     300        { 
     301            continue; 
     302        } 
     303        wxTreeItemId cat = info_tree->AppendItem( info_root, 
     304                            wxU( p_item->pp_categories[i]->psz_name) ); 
     305 
     306        for( int j = 0 ; j < p_item->pp_categories[i]->i_infos ; j++ ) 
     307        { 
     308           info_tree->AppendItem( cat , (wxString) 
     309                      wxU(p_item->pp_categories[i]->pp_infos[j]->psz_name) + 
     310                      wxT(": ") + 
     311                      wxU(p_item->pp_categories[i]->pp_infos[j]->psz_value) ); 
     312        } 
     313    } 
     314} 
     315 
    279316/***************************************************************************** 
    280317 * Events methods. 
     
    284321    p_item->psz_name = strdup( name_text->GetLineText(0).mb_str() ); 
    285322    p_item->psz_uri = strdup( uri_text->GetLineText(0).mb_str() ); 
    286     p_item->psz_author = strdup( author_text->GetLineText(0).mb_str() ); 
     323    playlist_AddItemInfo( p_item,"General","Author", 
     324                            author_text->GetLineText(0).mb_str() ); 
    287325    vlc_bool_t b_old_enabled = p_item->b_enabled; 
    288326 
  • modules/gui/wxwindows/open.cpp

    rdc93d55 r1595dc2  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000, 2001, 2003 VideoLAN 
    5  * $Id: open.cpp,v 1.61 2003/12/22 15:42:43 gbazin Exp $ 
     5 * $Id: open.cpp,v 1.62 2004/01/05 13:00:39 zorglub Exp $ 
    66 * 
    77 * Authors: Gildas Bazin <gbazin@netcourrier.com> 
     
    903903    for( int i = 0; i < (int)mrl.GetCount(); i++ ) 
    904904    { 
    905         int i_options = 0, i_total_options; 
    906         char **ppsz_options = NULL; 
     905        int i_options = 0; 
     906 
     907        int i_id = playlist_Add( p_playlist, (const char *)mrl[i].mb_str(), 
     908                      (const char *)mrl[i].mb_str(), 
     909                      PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END ); 
     910        int i_pos = playlist_GetPositionById( p_playlist, i_id ); 
    907911 
    908912        /* Count the input options */ 
     
    913917        } 
    914918 
    915         /* Allocate ppsz_options */ 
     919        /* Insert options */ 
    916920        for( int j = 0; j < i_options; j++ ) 
    917921        { 
    918             if( !ppsz_options ) 
    919                 ppsz_options = (char **)malloc( sizeof(char *) * i_options ); 
    920  
    921             ppsz_options[j] = strdup( mrl[i + j  + 1].mb_str() ); 
    922         } 
    923  
    924         i_total_options = i_options; 
     922            playlist_AddOption( p_playlist, i_pos, mrl[i + j  + 1].mb_str() ); 
     923        } 
    925924 
    926925        /* Get the options from the subtitles dialog */ 
    927926        if( subsfile_checkbox->IsChecked() && subsfile_mrl.GetCount() ) 
    928927        { 
    929             ppsz_options = (char **)realloc( ppsz_options, sizeof(char *) * 
    930                                (i_total_options + subsfile_mrl.GetCount()) ); 
    931  
    932928            for( int j = 0; j < (int)subsfile_mrl.GetCount(); j++ ) 
    933929            { 
    934                 ppsz_options[i_total_options + j] = 
    935                     strdup( subsfile_mrl[j].mb_str() ); 
     930                playlist_AddOption( p_playlist, i_pos , 
     931                                    subsfile_mrl[j].mb_str() ); 
    936932            } 
    937  
    938             i_total_options += subsfile_mrl.GetCount(); 
    939933        } 
    940934 
     
    942936        if( sout_checkbox->IsChecked() && sout_mrl.GetCount() ) 
    943937        { 
    944             ppsz_options = (char **)realloc( ppsz_options, sizeof(char *) * 
    945                                (i_total_options + sout_mrl.GetCount()) ); 
    946  
    947938            for( int j = 0; j < (int)sout_mrl.GetCount(); j++ ) 
    948939            { 
    949                 ppsz_options[i_total_options + j] = 
    950                     strdup( sout_mrl[j].mb_str() ); 
     940                playlist_AddOption( p_playlist, i_pos , 
     941                                    sout_mrl[j].mb_str() ); 
    951942            } 
    952  
    953             i_total_options += sout_mrl.GetCount(); 
    954  
    955         } 
    956  
    957         playlist_Add( p_playlist, (const char *)mrl[i].mb_str(), 
    958                       (const char **)ppsz_options, i_total_options, 
    959                       PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END ); 
    960  
    961         /* clean up */ 
    962         for( int j = 0; j < i_total_options; j++ ) 
    963             free( ppsz_options[j] ); 
    964         if( ppsz_options ) free( ppsz_options ); 
    965  
     943        } 
    966944        i += i_options; 
    967945    } 
  • modules/gui/wxwindows/playlist.cpp

    r973409a r1595dc2  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000-2001, 2003 VideoLAN 
    5  * $Id: playlist.cpp,v 1.32 2003/12/22 14:31:01 gbazin Exp $ 
     5 * $Id: playlist.cpp,v 1.33 2004/01/05 13:00:39 zorglub Exp $ 
    66 * 
    77 * Authors: Olivier Teuli� <ipkiss@via.ecp.fr> 
     
    3434int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable, 
    3535                     vlc_value_t old_val, vlc_value_t new_val, void *param ); 
     36int PlaylistNext( vlc_object_t *p_this, const char *psz_variable, 
     37                     vlc_value_t old_val, vlc_value_t new_val, void *param ); 
     38int ItemChanged( vlc_object_t *p_this, const char *psz_variable, 
     39                     vlc_value_t old_val, vlc_value_t new_val, void *param ); 
    3640 
    3741/***************************************************************************** 
     
    7377    Down_Event, 
    7478    Infos_Event, 
     79 
     80    PopupPlay_Event, 
     81    PopupDel_Event, 
     82    PopupEna_Event, 
     83    PopupInfo_Event, 
    7584 
    7685    SearchText_Event, 
     
    115124    EVT_LIST_COL_CLICK(ListView_Event, Playlist::OnColSelect) 
    116125    EVT_LIST_KEY_DOWN(ListView_Event, Playlist::OnKeyDown) 
     126    EVT_LIST_ITEM_RIGHT_CLICK(ListView_Event, Playlist::OnPopup) 
     127 
     128    /* Popup events */ 
     129    EVT_MENU( PopupPlay_Event, Playlist::OnPopupPlay) 
     130    EVT_MENU( PopupDel_Event, Playlist::OnPopupDel) 
     131    EVT_MENU( PopupEna_Event, Playlist::OnPopupEna) 
     132    EVT_MENU( PopupInfo_Event, Playlist::OnPopupInfo) 
     133 
    117134 
    118135    /* Button events */ 
     
    215232    SetMenuBar( menubar ); 
    216233 
     234    /* Create the popup menu */ 
     235    popup_menu = new wxMenu; 
     236    popup_menu->Append( PopupPlay_Event, wxU(_("Play item")) ); 
     237    popup_menu->Append( PopupDel_Event, wxU(_("Delete item")) ); 
     238    popup_menu->Append( PopupEna_Event, wxU(_("Toggle enabled")) ); 
     239    popup_menu->Append( PopupInfo_Event, wxU(_("Info on item")) ); 
    217240 
    218241    /* Create a panel to put everything in */ 
     
    341364 
    342365    /* We want to be noticed of playlist changes */ 
     366 
     367    /* Some global changes happened -> Rebuild all */ 
    343368    var_AddCallback( p_playlist, "intf-change", PlaylistChanged, this ); 
     369 
     370    /* We went to the next item */ 
     371    var_AddCallback( p_playlist, "playlist-current", PlaylistNext, this ); 
     372 
     373    /* One item has been updated */ 
     374    var_AddCallback( p_playlist, "item-change", ItemChanged, this ); 
     375 
     376 
    344377    vlc_object_release( p_playlist ); 
    345378 
     
    362395    var_DelCallback( p_playlist, "intf-change", PlaylistChanged, this ); 
    363396    vlc_object_release( p_playlist ); 
     397} 
     398 
     399/********************************************************************** 
     400 * Update one playlist item 
     401 **********************************************************************/ 
     402void Playlist::UpdateItem( int i ) 
     403{ 
     404    playlist_t *p_playlist = 
     405        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 
     406                                       FIND_ANYWHERE ); 
     407    if( p_playlist == NULL ) 
     408    { 
     409        return; 
     410    } 
     411    if( i < 0 || i > p_playlist->i_size ) 
     412    { 
     413        vlc_object_release(p_playlist); 
     414        return; 
     415    } 
     416    listview->SetItem( i, 0, wxL2U(p_playlist->pp_items[i]->psz_name) ); 
     417    listview->SetItem( i, 1, wxL2U( playlist_GetInfo( p_playlist, i, 
     418                                       "General" , "Author" ) ) ); 
     419    listview->SetItem( i, 2, 
     420             wxL2U(playlist_FindGroup(p_playlist,p_playlist-> 
     421                                    pp_items[i]->i_group) ) ); 
     422 
     423    if( p_playlist->pp_items[i]->b_enabled == VLC_FALSE ) 
     424    { 
     425        wxListItem listitem; 
     426        listitem.m_itemId = i; 
     427        listitem.SetTextColour( *wxLIGHT_GREY); 
     428        listview->SetItem(listitem); 
     429    } 
     430 
     431    char psz_duration[MSTRTIME_MAX_SIZE]; 
     432    mtime_t dur = p_playlist->pp_items[i]->i_duration; 
     433    if( dur != -1 ) secstotimestr( psz_duration, dur/1000000 ); 
     434    else memcpy( psz_duration , "-:--:--", sizeof("-:--:--") ); 
     435    listview->SetItem( i, 3, wxU(psz_duration) ); 
     436 
     437    /* Change the colour for the currenty played stream */ 
     438    wxListItem listitem; 
     439    listitem.m_itemId = i; 
     440    if( i == p_playlist->i_index ) 
     441    { 
     442        listitem.SetTextColour( *wxRED ); 
     443    } 
     444    else 
     445    { 
     446        listitem.SetTextColour( *wxBLACK ); 
     447    } 
     448    listview->SetItem( listitem ); 
     449 
     450    vlc_object_release(p_playlist); 
    364451} 
    365452 
     
    388475        wxString filename = wxL2U(p_playlist->pp_items[i]->psz_name); 
    389476        listview->InsertItem( i, filename ); 
    390         listview->SetItem( i, 1, wxL2U(p_playlist->pp_items[i]->psz_author) ); 
    391         listview->SetItem( i, 2, 
    392             wxL2U(playlist_FindGroup( p_playlist, 
    393                                       p_playlist->pp_items[i]->i_group )) ); 
    394         if( p_playlist->pp_items[i]->b_enabled == VLC_FALSE ) 
    395         { 
    396             wxListItem listitem; 
    397             listitem.m_itemId = i; 
    398             listitem.SetTextColour( *wxLIGHT_GREY); 
    399             listview->SetItem(listitem); 
    400         } 
    401  
    402         char psz_duration[MSTRTIME_MAX_SIZE]; 
    403         mtime_t dur = p_playlist->pp_items[i]->i_duration; 
    404         if( dur != -1 ) secstotimestr( psz_duration, dur/1000000 ); 
    405         else memcpy( psz_duration , "-:--:--", sizeof("-:--:--") ); 
    406         listview->SetItem( i, 3, wxU(psz_duration) ); 
     477        UpdateItem( i ); 
    407478    } 
    408479    vlc_mutex_unlock( &p_playlist->object_lock ); 
    409  
    410     /* Change the colour for the currenty played stream */ 
    411     wxListItem listitem; 
    412     listitem.m_itemId = p_playlist->i_index; 
    413     listitem.SetTextColour( *wxRED ); 
    414     listview->SetItem( listitem ); 
    415480 
    416481    if( i_focused ) 
     
    816881        { 
    817882            playlist_Enable( p_playlist, item ); 
     883            UpdateItem( item ); 
    818884        } 
    819885    } 
    820886    vlc_object_release( p_playlist); 
    821     Rebuild(); 
    822887} 
    823888 
     
    837902        { 
    838903            playlist_Disable( p_playlist, item ); 
     904            UpdateItem( item ); 
    839905        } 
    840906    } 
    841907    vlc_object_release( p_playlist); 
    842     Rebuild(); 
    843908} 
    844909 
     
    913978    vlc_object_release( p_playlist ); 
    914979} 
     980 
    915981void Playlist::OnKeyDown( wxListEvent& event ) 
    916982{ 
     
    924990} 
    925991 
    926 void Playlist::OnInfos( wxCommandEvent& WXUNUSED(event) ) 
    927 
    928     playlist_t *p_playlist = 
    929         (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 
    930                                        FIND_ANYWHERE ); 
    931     if( p_playlist == NULL ) 
    932     { 
    933         return; 
    934     } 
    935  
     992void Playlist::ShowInfos( int i_item ) 
     993
     994    playlist_t *p_playlist = 
     995        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 
     996                                       FIND_ANYWHERE ); 
     997    if( p_playlist == NULL ) 
     998    { 
     999        return; 
     1000    } 
    9361001    if( iteminfo_dialog == NULL ) 
    9371002    { 
    938         /* We use the first selected item, so find it */ 
    939         long i_item = listview->GetNextItem( i_item, wxLIST_NEXT_ALL, 
    940                                              wxLIST_STATE_SELECTED ); 
    9411003        if( i_item >= 0 && i_item < p_playlist->i_size ) 
    9421004        { 
     
    9441006                              p_intf, p_playlist->pp_items[i_item], this ); 
    9451007            if( iteminfo_dialog->ShowModal()  == wxID_OK ) 
    946                 Rebuild(); 
     1008                UpdateItem( i_item ); 
    9471009            delete iteminfo_dialog; 
    9481010            iteminfo_dialog = NULL; 
     
    9501012    } 
    9511013    vlc_object_release( p_playlist ); 
     1014} 
     1015 
     1016void Playlist::OnInfos( wxCommandEvent& WXUNUSED(event) ) 
     1017{ 
     1018    /* We use the first selected item, so find it */ 
     1019    long i_item = listview->GetNextItem( -1 , wxLIST_NEXT_ALL, 
     1020                                         wxLIST_STATE_SELECTED ); 
     1021    ShowInfos( i_item ); 
    9521022} 
    9531023 
     
    9851055 
    9861056/***************************************************************************** 
     1057 * Popup management functions 
     1058 *****************************************************************************/ 
     1059void Playlist::OnPopup( wxListEvent& event ) 
     1060{ 
     1061    i_popup_item = event.GetIndex(); 
     1062    Playlist::PopupMenu( popup_menu , ScreenToClient( wxGetMousePosition() ) ); 
     1063} 
     1064 
     1065 
     1066void Playlist::OnPopupPlay( wxMenuEvent& event ) 
     1067{ 
     1068    playlist_t *p_playlist = 
     1069        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 
     1070                                       FIND_ANYWHERE ); 
     1071    if( p_playlist == NULL ) 
     1072    { 
     1073        return; 
     1074    } 
     1075    if( i_popup_item != -1 ) 
     1076    { 
     1077        playlist_Goto( p_playlist, i_popup_item ); 
     1078    } 
     1079    vlc_object_release( p_playlist ); 
     1080} 
     1081 
     1082void Playlist::OnPopupDel( wxMenuEvent& event ) 
     1083{ 
     1084    DeleteItem( i_popup_item ); 
     1085} 
     1086 
     1087void Playlist::OnPopupEna( wxMenuEvent& event ) 
     1088{ 
     1089    playlist_t *p_playlist = 
     1090        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, 
     1091                                       FIND_ANYWHERE ); 
     1092    if( p_playlist == NULL ) 
     1093    { 
     1094        return; 
     1095    } 
     1096 
     1097    if( p_playlist->pp_items[i_popup_item]->b_enabled ) 
     1098        //playlist_IsEnabled( p_playlist, i_popup_item ) ) 
     1099    { 
     1100        playlist_Disable( p_playlist, i_popup_item ); 
     1101    } 
     1102    else 
     1103    { 
     1104        playlist_Enable( p_playlist, i_popup_item ); 
     1105    } 
     1106    vlc_object_release( p_playlist); 
     1107    UpdateItem( i_popup_item ); 
     1108} 
     1109 
     1110void Playlist::OnPopupInfo( wxMenuEvent& event ) 
     1111{ 
     1112    ShowInfos( i_popup_item ); 
     1113} 
     1114 
     1115/***************************************************************************** 
    9871116 * PlaylistChanged: callback triggered by the intf-change playlist variable 
    9881117 *  We don't rebuild the playlist directly here because we don't want the 
     
    9991128} 
    10001129 
     1130/***************************************************************************** 
     1131 * Next: callback triggered by the playlist-current playlist variable 
     1132 *****************************************************************************/ 
     1133int PlaylistNext( vlc_object_t *p_this, const char *psz_variable, 
     1134                 vlc_value_t old_val, vlc_value_t new_val, void *param ) 
     1135{ 
     1136    Playlist *p_playlist_dialog = (Playlist *)param; 
     1137    p_playlist_dialog->UpdateItem( old_val.i_int ); 
     1138    p_playlist_dialog->UpdateItem( new_val.i_int ); 
     1139    return 0; 
     1140} 
     1141 
     1142 
     1143/***************************************************************************** 
     1144 * ItemChanged: callback triggered by the item-change playlist variable 
     1145 *****************************************************************************/ 
     1146int ItemChanged( vlc_object_t *p_this, const char *psz_variable, 
     1147                 vlc_value_t old_val, vlc_value_t new_val, void *param ) 
     1148{ 
     1149    Playlist *p_playlist_dialog = (Playlist *)param; 
     1150    p_playlist_dialog->UpdateItem( new_val.i_int ); 
     1151} 
     1152 
    10011153 
    10021154/*************************************************************************** 
  • modules/gui/wxwindows/streamwizard.cpp

    r4219568 r1595dc2  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000-2001 VideoLAN 
    5  * $Id: streamwizard.cpp,v 1.3 2003/12/22 02:24:52 sam Exp $ 
     5 * $Id: streamwizard.cpp,v 1.4 2004/01/05 13:00:39 zorglub Exp $ 
    66 * 
    77 * Authors: Cl�nt Stenac <zorglub@videolan.org> 
     
    205205    for( int i = 0; i < (int)p_open_dialog->mrl.GetCount(); i++ ) 
    206206    { 
    207         int i_options = 0, i_total_options; 
    208         char **ppsz_options = NULL; 
     207        int i_id = playlist_Add( p_playlist, 
     208                      (const char *)p_open_dialog->mrl[i].mb_str(), 
     209                      (const char *)p_open_dialog->mrl[i].mb_str(), 
     210                      PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END ); 
     211        int i_pos = playlist_GetPositionById( p_playlist, i_id ); 
     212        int i_options = 0; 
    209213 
    210214        /* Count the input options */ 
     
    216220        } 
    217221 
    218         /* Allocate ppsz_options */ 
     222        /* Insert options */ 
    219223        for( int j = 0; j < i_options; j++ ) 
    220224        { 
    221             if( !ppsz_options ) 
    222                 ppsz_options = (char **)malloc( sizeof(char *) * i_options ); 
    223  
    224             ppsz_options[j] = strdup( p_open_dialog->mrl[i + j  + 1].mb_str() ); 
     225            playlist_AddOption( p_playlist, i_pos, 
     226                                p_open_dialog->mrl[i + j  + 1].mb_str() ); 
    225227        } 
    226  
    227         i_total_options = i_options; 
    228228 
    229229        /* Get the options from the stream output dialog */ 
    230230        if( sout_mrl.GetCount() ) 
    231231        { 
    232             ppsz_options = (char **)realloc( ppsz_options, sizeof(char *) * 
    233                                (i_total_options + sout_mrl.GetCount()) ); 
    234  
    235232            for( int j = 0; j < (int)sout_mrl.GetCount(); j++ ) 
    236233            { 
    237                 ppsz_options[i_total_options + j] = 
    238                     strdup( sout_mrl[j].mb_str() ); 
     234                playlist_AddOption( p_playlist, i_pos , 
     235                                    sout_mrl[j].mb_str() ); 
    239236            } 
    240  
    241             i_total_options += sout_mrl.GetCount(); 
    242  
    243237        } 
    244         msg_Dbg(p_intf,"playings %s",(const char *)p_open_dialog->mrl[i].mb_str()); 
    245         playlist_Add( p_playlist, (const char *)p_open_dialog->mrl[i].mb_str(), 
    246                       (const char **)ppsz_options, i_total_options, 
    247                       PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END ); 
    248         /* clean up */ 
    249         for( int j = 0; j < i_total_options; j++ ) 
    250             free( ppsz_options[j] ); 
    251         if( ppsz_options ) free( ppsz_options ); 
     238        msg_Dbg(p_intf,"playings %s", 
     239                 (const char *)p_open_dialog->mrl[i].mb_str()); 
    252240 
    253241        i += i_options; 
  • modules/gui/wxwindows/wxwindows.h

    r973409a r1595dc2  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999, 2000 VideoLAN 
    5  * $Id: wxwindows.h,v 1.82 2003/12/22 14:31:01 gbazin Exp $ 
     5 * $Id: wxwindows.h,v 1.83 2004/01/05 13:00:39 zorglub Exp $ 
    66 * 
    77 * Authors: Gildas Bazin <gbazin@netcourrier.com> 
     
    750750    void UpdatePlaylist(); 
    751751    void ShowPlaylist( bool show ); 
     752    void UpdateItem( int ); 
    752753 
    753754    bool b_need_update; 
     
    756757private: 
    757758    void DeleteItem( int item ); 
     759    void ShowInfos( int item ); 
    758760 
    759761    /* Event handlers (these functions should _not_ be virtual) */ 
     
    786788    void OnNewGroup( wxCommandEvent& event ); 
    787789 
     790    /* Popup functions */ 
     791    void OnPopup( wxListEvent& event ); 
     792    void OnPopupPlay( wxMenuEvent& event ); 
     793    void OnPopupDel( wxMenuEvent& event ); 
     794    void OnPopupEna( wxMenuEvent& event ); 
     795    void OnPopupInfo( wxMenuEvent& event ); 
    788796    void Rebuild(); 
    789797 
     
    792800    DECLARE_EVENT_TABLE(); 
    793801 
     802    wxMenu *popup_menu; 
    794803 
    795804    ItemInfoDialog *iteminfo_dialog; 
     
    801810    int i_sort_mode; 
    802811 
     812    int i_popup_item; 
     813 
    803814    int i_title_sorted; 
    804815    int i_author_sorted; 
     
    852863    void OnNewGroup( wxCommandEvent& event ); 
    853864 
     865    void UpdateInfo(); 
     866 
    854867    DECLARE_EVENT_TABLE(); 
    855868 
     
    868881    wxTextCtrl *name_text; 
    869882    wxTextCtrl *author_text; 
     883 
     884    wxTreeCtrl *info_tree; 
     885    wxTreeItemId info_root; 
    870886 
    871887    wxCheckBox *enabled_checkbox;