Changeset 2458a977ecf22a95a75153471ff0733d922d90d2

Show
Ignore:
Timestamp:
29/01/06 18:33:55 (3 years ago)
Author:
Christophe Mutricy <xtophe@videolan.org>
git-committer:
Christophe Mutricy <xtophe@videolan.org> 1138556035 +0000
git-parent:

[0638177349c21821748e4d329f509f7bf266f41d]

git-author:
Christophe Mutricy <xtophe@videolan.org> 1138556035 +0000
Message:

infopanels: Redimension the text area. implement modifiable
iteminfo: Use infopanel.

Files:

Legend:

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

    ra838001 r2458a97  
    4141    wxPanel( _p_parent, -1 ) 
    4242{ 
     43    int flags= wxTE_PROCESS_ENTER; 
    4344    /* Initializations */ 
    4445    p_intf = _p_intf; 
     
    5051    wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); 
    5152 
    52     wxFlexGridSizer *sizer = new wxFlexGridSizer(2,3,20); 
     53    wxFlexGridSizer *sizer = new wxFlexGridSizer(2,8,20); 
     54    sizer->AddGrowableCol(1); 
     55 
     56    if( !b_modifiable ) 
     57        flags |= wxTE_READONLY; 
     58 
    5359    /* URI Textbox */ 
    5460    wxStaticText *uri_static = 
    5561           new wxStaticText( this, -1, wxU(_("URI")) ); 
    56     sizer->Add( uri_static, 0 , wxALL , 5 ); 
     62    sizer->Add( uri_static, 0 , wxALL , 0 ); 
    5763 
    5864    uri_text = new wxTextCtrl( this, -1, 
    59             wxU(""), wxDefaultPosition, wxSize( 300, -1 ), 
    60             wxTE_PROCESS_ENTER ); 
    61     sizer->Add( uri_text, 1 ,  wxALL , 5 ); 
     65            wxU(""), wxDefaultPosition, wxSize( 300, -1 ), flags ); 
     66    sizer->Add( uri_text, 1 ,  wxALL|wxEXPAND , 0 ); 
    6267 
    6368    /* Name Textbox */ 
    6469    wxStaticText *name_static = 
    6570           new wxStaticText(  this, -1, wxU(_("Name")) ); 
    66     sizer->Add( name_static, 0 , wxALL , 5  ); 
     71    sizer->Add( name_static, 0 , wxALL , 0  ); 
    6772 
    6873    name_text = new wxTextCtrl( this, -1, 
    69             wxU(""), wxDefaultPosition, wxSize( 300, -1 ), 
    70             wxTE_PROCESS_ENTER ); 
    71     sizer->Add( name_text, 1 , wxALL , 5 ); 
     74            wxU(""), wxDefaultPosition, wxSize( 300, -1 ), flags ); 
     75    sizer->Add( name_text, 1 , wxALL|wxEXPAND , 0 ); 
    7276 
    7377    /* Treeview */ 
     
    7983 
    8084    sizer->Layout(); 
    81     panel_sizer->Add( sizer, 0, wxEXPAND | wxALL, 5 ); 
     85    panel_sizer->Add( sizer, 0, wxEXPAND | wxALL, 15 ); 
    8286    panel_sizer->Add( info_tree, 1, wxEXPAND | wxALL, 5 ); 
    8387    panel_sizer->Layout(); 
     
    112116        info_tree->Expand( cat ); 
    113117    } 
     118} 
     119 
     120char* ItemInfoPanel::GetURI( ) 
     121{ 
     122    return  strdup( uri_text->GetLineText(0).mb_str() ); 
     123} 
     124 
     125char* ItemInfoPanel::GetName( ) 
     126{ 
     127    return  strdup( name_text->GetLineText(0).mb_str() ); 
    114128} 
    115129 
  • modules/gui/wxwidgets/dialogs/infopanels.hpp

    ra838001 r2458a97  
    4040    void Update( input_item_t *); 
    4141    void Clear(); 
     42 
     43 
     44    char* GetURI(); 
     45    char* GetName(); 
    4246 
    4347    void OnOk(); 
  • modules/gui/wxwidgets/dialogs/iteminfo.cpp

    r822000a r2458a97  
    2323 
    2424#include "dialogs/iteminfo.hpp" 
     25#include "dialogs/infopanels.hpp" 
    2526#include <wx/combobox.h> 
    2627#include <wx/statline.h> 
     
    6970 
    7071    /* Create the standard info panel */ 
    71     wxPanel *info_panel = InfoPanel( panel ); 
    72  
     72    info_panel = new ItemInfoPanel(p_intf, panel, true ); 
     73    info_panel->Update( &(p_item->input) ); 
    7374    /* Separation */ 
    7475    wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK ); 
     
    8788    wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); 
    8889    wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); 
    89     panel_sizer->Add( info_panel, 0, wxEXPAND | wxALL, 5 ); 
     90    panel_sizer->Add( info_panel, 1, wxEXPAND | wxALL, 5 ); 
    9091    panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 ); 
    9192    panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALIGN_BOTTOM | 
     
    102103} 
    103104 
    104 /***************************************************************************** 
    105  * Private methods. 
    106  *****************************************************************************/ 
    107 wxPanel *ItemInfoDialog::InfoPanel( wxWindow* parent ) 
    108 { 
    109     wxPanel *info_panel = new wxPanel( parent, -1, wxDefaultPosition, 
    110                                   wxDefaultSize ); 
    111     info_panel->SetAutoLayout( TRUE ); 
    112     wxBoxSizer *info_sizer = new wxBoxSizer( wxHORIZONTAL ); 
    113  
    114     /* Create a box to surround the controls */ 
    115     wxStaticBox *panel_box = new wxStaticBox( info_panel, -1, 
    116                                    wxU(_("Item Info")) ); 
    117  
    118     wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( panel_box, 
    119                                                           wxVERTICAL ); 
    120  
    121     wxFlexGridSizer *sizer = new wxFlexGridSizer(2,3,20); 
    122     /* URI Textbox */ 
    123     wxStaticText *uri_label = 
    124            new wxStaticText( info_panel, -1, wxU(_("URI")) ); 
    125  
    126     uri_text = new wxTextCtrl( info_panel, Uri_Event, 
    127         wxU(p_item->input.psz_uri), wxDefaultPosition, wxSize( 300, -1 ), 
    128         wxTE_PROCESS_ENTER ); 
    129  
    130     sizer->Add( uri_label, 0 , wxALIGN_LEFT |wxALL , 5 ); 
    131     sizer->Add( uri_text, 1 , wxALIGN_RIGHT | wxALL , 5 ); 
    132  
    133     /* Name Textbox */ 
    134     wxStaticText *name_label = 
    135            new wxStaticText(  info_panel, -1, wxU(_("Name")) ); 
    136  
    137     name_text = new wxTextCtrl( info_panel, Uri_Event, 
    138         wxU(p_item->input.psz_name), wxDefaultPosition, wxSize( 300, -1 ), 
    139         wxTE_PROCESS_ENTER ); 
    140  
    141     sizer->Add( name_label, 0 , wxALIGN_LEFT |wxALL , 5  ); 
    142     sizer->Add( name_text, 1 , wxALIGN_RIGHT | wxALL , 5 ); 
    143  
    144     /* Treeview */ 
    145     info_tree = new wxTreeCtrl( info_panel, -1, wxDefaultPosition, 
    146                                 wxSize(220,200), 
    147                                 wxSUNKEN_BORDER |wxTR_HAS_BUTTONS | 
    148                                 wxTR_HIDE_ROOT | wxTR_HAS_VARIABLE_ROW_HEIGHT ); 
    149  
    150     sizer->Layout(); 
    151     box_sizer->Add( sizer, 0, wxEXPAND, 5 ); 
    152     box_sizer->Add( info_tree, 0, wxEXPAND, 5 ); 
    153     info_sizer->Add( box_sizer, 1, wxBOTTOM, 5 ); 
    154  
    155     info_panel->SetSizer( info_sizer ); 
    156     info_sizer->Layout(); 
    157     info_sizer->SetSizeHints( info_panel ); 
    158  
    159     UpdateInfo(); 
    160  
    161     return info_panel; 
    162 } 
    163  
    164 void ItemInfoDialog::UpdateInfo() 
    165 { 
    166     if( !info_root ) 
    167     { 
    168        info_root = info_tree->AddRoot( wxU( p_item->input.psz_name) ); 
    169     } 
    170  
    171     /* Rebuild the tree */ 
    172     for( int i = 0; i< p_item->input.i_categories ; i++) 
    173     { 
    174         wxTreeItemId cat = info_tree->AppendItem( info_root, 
    175                             wxU( p_item->input.pp_categories[i]->psz_name) ); 
    176  
    177         for( int j = 0 ; j < p_item->input.pp_categories[i]->i_infos ; j++ ) 
    178         { 
    179            info_tree->AppendItem( cat , (wxString) 
    180                wxU(p_item->input.pp_categories[i]->pp_infos[j]->psz_name) + 
    181                wxT(": ") + 
    182                wxU(p_item->input.pp_categories[i]->pp_infos[j]->psz_value) ); 
    183         } 
    184  
    185         info_tree->Expand( cat ); 
    186     } 
    187 } 
    188105 
    189106/***************************************************************************** 
     
    193110{ 
    194111    vlc_mutex_lock( &p_item->input.lock ); 
    195     p_item->input.psz_name = strdup( name_text->GetLineText(0).mb_str() ); 
    196     p_item->input.psz_uri = strdup( uri_text->GetLineText(0).mb_str() ); 
     112    p_item->input.psz_name = info_panel->GetName(); 
     113    p_item->input.psz_uri = info_panel->GetURI(); 
    197114    vlc_mutex_unlock( &p_item->input.lock ); 
    198115    EndModal( wxID_OK ); 
  • modules/gui/wxwidgets/dialogs/iteminfo.hpp

    r2cb472d r2458a97  
    2626 
    2727#include "wxwidgets.hpp" 
    28  
     28#include "dialogs/infopanels.hpp" 
    2929#include <wx/treectrl.h> 
    3030 
     
    4242 
    4343private: 
    44     wxPanel *InfoPanel( wxWindow* parent ); 
    4544    wxPanel *GroupPanel( wxWindow* parent ); 
    4645 
     
    5958    /* Controls for the iteminfo dialog box */ 
    6059    wxPanel *info_subpanel; 
    61     wxPanel *info_panel; 
     60    ItemInfoPanel *info_panel; 
    6261 
    6362    wxPanel *group_subpanel;