* open.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: open.cpp,v 1.41 2003/11/09 20:13:46 gbazin Exp $
+ * $Id: open.cpp,v 1.42 2003/11/10 00:14:05 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
END_EVENT_TABLE()
+/*****************************************************************************
+ * AutoBuiltPanel.
+ *****************************************************************************/
+WX_DEFINE_ARRAY(ConfigControl *, ArrayOfConfigControls);
+
+class AutoBuiltPanel : public wxPanel
+{
+public:
+
+ AutoBuiltPanel() { }
+ AutoBuiltPanel( wxWindow *, OpenDialog *, intf_thread_t *,
+ const module_t * );
+
+ virtual ~AutoBuiltPanel() {}
+
+ wxString name;
+ ArrayOfConfigControls config_array;
+
+private:
+ intf_thread_t *p_intf;
+};
+
+void AutoBuildCallback( void *p_data )
+{
+ ((OpenDialog *)p_data)->UpdateMRL();
+}
+
+AutoBuiltPanel::AutoBuiltPanel( wxWindow *parent, OpenDialog *dialog,
+ intf_thread_t *_p_intf,
+ const module_t *p_module )
+ : wxPanel( parent, -1, wxDefaultPosition, wxSize(200, 200) ),
+ name( wxU(p_module->psz_object_name) ), p_intf( _p_intf )
+{
+ wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
+
+ module_config_t *p_item = p_module->p_config;
+
+ if( p_item ) do
+ {
+ if( p_item->i_type & CONFIG_HINT || p_item->b_advanced )
+ continue;
+
+ ConfigControl *control =
+ CreateConfigControl( VLC_OBJECT(p_intf), p_item, this );
+
+ config_array.Add( control );
+
+ /* Don't add items that were not recognized */
+ if( control == NULL ) continue;
+
+ control->SetUpdateCallback( AutoBuildCallback, (void *)dialog );
+
+ sizer->Add( control, 0, wxEXPAND | wxALL, 2 );
+ }
+ while( p_item->i_type != CONFIG_HINT_END && p_item++ );
+
+ this->SetSizerAndFit( sizer );
+}
+
/*****************************************************************************
* Constructor.
*****************************************************************************/
module_t *p_module = config_FindModule( VLC_OBJECT(p_intf), "dshow" );
if( p_module )
{
- notebook->AddPage( AutoBuildPanel( notebook, p_module ),
- wxU( p_module->psz_longname ) );
+ AutoBuiltPanel *autopanel =
+ new AutoBuiltPanel( notebook, this, p_intf, p_module );
+ input_tab_array.Add( autopanel );
+ notebook->AddPage( autopanel, wxU( p_module->psz_longname ) );
}
/* Update Disc panel */
}
#endif
-wxPanel *OpenDialog::AutoBuildPanel( wxWindow* parent,
- const module_t *p_module )
+void OpenDialog::UpdateMRL()
{
- wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
- wxSize(200, 200) );
-
- wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
-
- module_config_t *p_item = p_module->p_config;
-
- if( p_item ) do
- {
- if( p_item->i_type & CONFIG_HINT || p_item->b_advanced )
- continue;
-
- ConfigControl *control =
- CreateConfigControl( VLC_OBJECT(p_intf), p_item, panel );
-
- /* Don't add items that were not recognized */
- if( control == NULL ) continue;
-
- sizer->Add( control, 0, wxEXPAND | wxALL, 2 );
- }
- while( p_item->i_type != CONFIG_HINT_END && p_item++ );
-
- panel->SetSizerAndFit( sizer );
- return panel;
+ UpdateMRL( i_current_access_method );
}
void OpenDialog::UpdateMRL( int i_access_method )
break;
}
break;
- case SAT_ACCESS:
- mrltemp = wxT("satellite") + demux + wxT("://");
- break;
#ifndef WIN32
case V4L_ACCESS:
#endif
default:
+ {
+ int i_item = i_access_method - MAX_ACCESS;
+
+ if( i_item < 0 || i_item >= (int)input_tab_array.GetCount() )
+ break;
+
+ AutoBuiltPanel *input_panel = input_tab_array.Item( i_item );
+
+ mrltemp = input_panel->name + wxT("://");
+
+ for( int i=0; i < (int)input_panel->config_array.GetCount(); i++ )
+ {
+ ConfigControl *control = input_panel->config_array.Item(i);
+ mrltemp += wxT(" :") + control->GetName() + wxT("=");
+
+ switch( control->GetType() )
+ {
+ case CONFIG_ITEM_STRING:
+ case CONFIG_ITEM_FILE:
+ case CONFIG_ITEM_DIRECTORY:
+ case CONFIG_ITEM_MODULE:
+ mrltemp += wxT("\"") + control->GetPszValue() + wxT("\"");
+ break;
+ case CONFIG_ITEM_INTEGER:
+ case CONFIG_ITEM_BOOL:
+ mrltemp +=
+ wxString::Format( "%i", control->GetIntValue() );
+ break;
+ case CONFIG_ITEM_FLOAT:
+ mrltemp +=
+ wxString::Format( "%f", control->GetFloatValue() );
+ break;
+ }
+ }
+ }
break;
}
if( ppsz_options ) free( ppsz_options );
i += i_options;
- }
+ }
//TogglePlayButton( PLAYING_S );
* preferences_widgets.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: preferences_widgets.cpp,v 1.14 2003/11/09 13:20:32 gbazin Exp $
+ * $Id: preferences_widgets.cpp,v 1.15 2003/11/10 00:14:05 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Sigmund Augdal <sigmunau@idi.ntnu.no>
*****************************************************************************/
ConfigControl::ConfigControl( vlc_object_t *_p_this,
module_config_t *p_item, wxWindow *parent )
- : wxPanel( parent ), p_this( _p_this ), name( wxU(p_item->psz_name) ),
- i_type( p_item->i_type ), b_advanced( p_item->b_advanced )
+ : wxPanel( parent ), p_this( _p_this ),
+ pf_update_callback( NULL ), p_update_data( NULL ),
+ name( wxU(p_item->psz_name) ), i_type( p_item->i_type ),
+ b_advanced( p_item->b_advanced )
+
{
sizer = new wxBoxSizer( wxHORIZONTAL );
}
return b_advanced;
}
+void ConfigControl::SetUpdateCallback( void (*p_callback)( void * ),
+ void *p_data )
+{
+ pf_update_callback = p_callback;
+ p_update_data = p_data;
+}
+
+void ConfigControl::OnUpdate( wxCommandEvent& WXUNUSED(event) )
+{
+ if( pf_update_callback )
+ {
+ pf_update_callback( p_update_data );
+ }
+}
+
/*****************************************************************************
* KeyConfigControl implementation
*****************************************************************************/
for( unsigned int i = 0; i < WXSIZEOF(KeysList); i++ )
{
combo->SetClientData( i, (void*)vlc_keys[i].i_key_code );
- if( vlc_keys[i].i_key_code ==
+ if( (unsigned int)vlc_keys[i].i_key_code ==
( ((unsigned int)p_item->i_value) & ~KEY_MODIFIER ) )
{
combo->SetSelection( i );
return textctrl->GetValue();
}
+BEGIN_EVENT_TABLE(StringConfigControl, wxPanel)
+ /* Text events */
+ EVT_TEXT(-1, StringConfigControl::OnUpdate)
+END_EVENT_TABLE()
+
/*****************************************************************************
* StringListConfigControl implementation
*****************************************************************************/
BEGIN_EVENT_TABLE(StringListConfigControl, wxPanel)
/* Button events */
EVT_BUTTON(wxID_HIGHEST, StringListConfigControl::OnRefresh)
+
+ /* Text events */
+ EVT_TEXT(-1, StringListConfigControl::OnUpdate)
END_EVENT_TABLE()
void StringListConfigControl::OnRefresh( wxCommandEvent& event )
* wxwindows.h: private wxWindows interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: wxwindows.h,v 1.68 2003/11/09 20:13:46 gbazin Exp $
+ * $Id: wxwindows.h,v 1.69 2003/11/10 00:14:05 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
};
/* Open Dialog */
+class AutoBuiltPanel;
+WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
class V4LDialog;
class SoutDialog;
class SubsFileDialog;
int Show();
int Show( int i_access_method, int i_arg = 0 );
+ void UpdateMRL();
+ void UpdateMRL( int i_access_method );
+
wxArrayString mrl;
private:
wxPanel *DiscPanel( wxWindow* parent );
wxPanel *NetPanel( wxWindow* parent );
wxPanel *V4LPanel( wxWindow* parent );
- wxPanel *AutoBuildPanel( wxWindow* parent, const module_t * );
- void UpdateMRL( int i_access_method );
+ ArrayOfAutoBuiltPanel input_tab_array;
/* Event handlers (these functions should _not_ be virtual) */
void OnOk( wxCommandEvent& event );
FILE_ACCESS = 0,
DISC_ACCESS,
NET_ACCESS,
- SAT_ACCESS,
+#ifndef WIN32
V4L_ACCESS,
+#endif
+ MAX_ACCESS,
FILE_SIMPLE_ACCESS
};