Commit e39089dc authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/*: dshow open panel is fully functionnal.

parent a4c1c8f5
......@@ -2,7 +2,7 @@
* dialogs.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: dialogs.cpp,v 1.10 2003/10/29 17:32:54 zorglub Exp $
* $Id: dialogs.cpp,v 1.11 2003/11/10 00:14:05 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -314,11 +314,6 @@ void DialogsProvider::OnOpenNet( wxCommandEvent& event )
Open( NET_ACCESS, event.GetInt() );
}
void DialogsProvider::OnOpenSat( wxCommandEvent& event )
{
Open( SAT_ACCESS, event.GetInt() );
}
void DialogsProvider::Open( int i_access_method, int i_arg )
{
/* Show/hide the open dialog */
......
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -150,6 +150,65 @@ BEGIN_EVENT_TABLE(OpenDialog, wxFrame)
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.
*****************************************************************************/
......@@ -265,8 +324,10 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
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 */
......@@ -588,33 +649,9 @@ wxPanel *OpenDialog::V4LPanel( wxWindow* parent )
}
#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 )
......@@ -673,9 +710,6 @@ void OpenDialog::UpdateMRL( int i_access_method )
break;
}
break;
case SAT_ACCESS:
mrltemp = wxT("satellite") + demux + wxT("://");
break;
#ifndef WIN32
case V4L_ACCESS:
......@@ -701,6 +735,41 @@ void OpenDialog::UpdateMRL( int i_access_method )
#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;
}
......
......@@ -2,7 +2,7 @@
* 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>
......@@ -107,8 +107,11 @@ ConfigControl *CreateConfigControl( vlc_object_t *p_this,
*****************************************************************************/
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 );
}
......@@ -137,6 +140,21 @@ vlc_bool_t ConfigControl::IsAdvanced()
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
*****************************************************************************/
......@@ -229,7 +247,7 @@ KeyConfigControl::KeyConfigControl( vlc_object_t *p_this,
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 );
......@@ -357,6 +375,11 @@ wxString StringConfigControl::GetPszValue()
return textctrl->GetValue();
}
BEGIN_EVENT_TABLE(StringConfigControl, wxPanel)
/* Text events */
EVT_TEXT(-1, StringConfigControl::OnUpdate)
END_EVENT_TABLE()
/*****************************************************************************
* StringListConfigControl implementation
*****************************************************************************/
......@@ -420,6 +443,9 @@ void StringListConfigControl::UpdateCombo( module_config_t *p_item )
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 )
......
......@@ -2,7 +2,7 @@
* preferences_widgets.h : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2003 VideoLAN
* $Id: preferences_widgets.h,v 1.6 2003/11/05 17:46:21 gbazin Exp $
* $Id: preferences_widgets.h,v 1.7 2003/11/10 00:14:05 gbazin Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -36,11 +36,18 @@ public:
int GetType();
vlc_bool_t IsAdvanced();
void SetUpdateCallback( void (*)( void * ), void * );
protected:
wxBoxSizer *sizer;
wxStaticText *label;
vlc_object_t *p_this;
void (*pf_update_callback)( void * );
void *p_update_data;
void OnUpdate( wxCommandEvent& );
private:
wxString name;
int i_type;
......@@ -81,6 +88,8 @@ public:
virtual wxString GetPszValue();
private:
wxTextCtrl *textctrl;
DECLARE_EVENT_TABLE()
};
class StringListConfigControl: public ConfigControl
......
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -290,6 +290,8 @@ public:
};
/* Open Dialog */
class AutoBuiltPanel;
WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
class V4LDialog;
class SoutDialog;
class SubsFileDialog;
......@@ -308,6 +310,9 @@ public:
int Show();
int Show( int i_access_method, int i_arg = 0 );
void UpdateMRL();
void UpdateMRL( int i_access_method );
wxArrayString mrl;
private:
......@@ -315,9 +320,8 @@ 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 );
......@@ -408,8 +412,10 @@ enum
FILE_ACCESS = 0,
DISC_ACCESS,
NET_ACCESS,
SAT_ACCESS,
#ifndef WIN32
V4L_ACCESS,
#endif
MAX_ACCESS,
FILE_SIMPLE_ACCESS
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment