* Copyright (C) 2000-2004 VideoLAN
* $Id$
*
- * Authors: Gildas Bazin <gbazin@netcourrier.com>
+ * Authors: Gildas Bazin <gbazin@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
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("=");
+
+ mrltemp += wxT(" :");
+
+ if( control->GetType() == CONFIG_ITEM_BOOL &&
+ !control->GetIntValue() ) mrltemp += wxT("no-");
+
+ mrltemp += control->GetName();
switch( control->GetType() )
{
case CONFIG_ITEM_FILE:
case CONFIG_ITEM_DIRECTORY:
case CONFIG_ITEM_MODULE:
- mrltemp += wxT("\"") + control->GetPszValue() + wxT("\"");
+ mrltemp += wxT("=\"") + control->GetPszValue() + wxT("\"");
break;
case CONFIG_ITEM_INTEGER:
- case CONFIG_ITEM_BOOL:
mrltemp +=
- wxString::Format( wxT("%i"), control->GetIntValue() );
+ wxString::Format( wxT("=%i"), control->GetIntValue() );
break;
case CONFIG_ITEM_FLOAT:
mrltemp +=
- wxString::Format( wxT("%f"), control->GetFloatValue());
+ wxString::Format(wxT("=%f"), control->GetFloatValue());
break;
}
}
* Copyright (C) 2000-2004 VideoLAN
* $Id$
*
- * Authors: Gildas Bazin <gbazin@netcourrier.com>
+ * Authors: Gildas Bazin <gbazin@videolan.org>
* Sigmund Augdal <sigmunau@idi.ntnu.no>
*
* This program is free software; you can redistribute it and/or modify
wxWindow *parent )
: ConfigControl( p_this, p_item, parent )
{
+ psz_default_value = p_item->psz_value;
+ if( psz_default_value ) psz_default_value = strdup( psz_default_value );
+
label = new wxStaticText(this, -1, wxU(p_item->psz_text));
sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
combo = new wxComboBox( this, -1, wxT(""),
StringListConfigControl::~StringListConfigControl()
{
+ if( psz_default_value ) free( psz_default_value );
}
void StringListConfigControl::UpdateCombo( module_config_t *p_item )
{
+ vlc_bool_t b_found = VLC_FALSE;
+ int i_index;
+
/* build a list of available options */
- for( int i_index = 0; i_index < p_item->i_list; i_index++ )
+ for( i_index = 0; i_index < p_item->i_list; i_index++ )
{
combo->Append( ( p_item->ppsz_list_text &&
p_item->ppsz_list_text[i_index] ) ?
p_item->ppsz_list_text[i_index] ) ?
wxU(p_item->ppsz_list_text[i_index]) :
wxL2U(p_item->ppsz_list[i_index]) );
+ b_found = VLC_TRUE;
}
}
+
+ if( p_item->psz_value && !b_found )
+ {
+ /* Add custom entry to list */
+ combo->Append( wxL2U(p_item->psz_value) );
+ combo->SetClientData( i_index, (void *)psz_default_value );
+ combo->SetSelection( i_index );
+ combo->SetValue( wxL2U(p_item->psz_value) );
+ }
}
BEGIN_EVENT_TABLE(StringListConfigControl, wxPanel)
/*****************************************************************************
* IntegerConfigControl implementation
*****************************************************************************/
+BEGIN_EVENT_TABLE(IntegerConfigControl, wxPanel)
+ EVT_COMMAND_SCROLL(-1, IntegerConfigControl::OnUpdate)
+END_EVENT_TABLE()
+
IntegerConfigControl::IntegerConfigControl( vlc_object_t *p_this,
module_config_t *p_item,
wxWindow *parent )
/*****************************************************************************
* RangedIntConfigControl implementation
*****************************************************************************/
+BEGIN_EVENT_TABLE(RangedIntConfigControl, wxPanel)
+ EVT_COMMAND_SCROLL(-1, RangedIntConfigControl::OnUpdate)
+END_EVENT_TABLE()
+
RangedIntConfigControl::RangedIntConfigControl( vlc_object_t *p_this,
module_config_t *p_item,
wxWindow *parent )
/*****************************************************************************
* FloatConfigControl implementation
*****************************************************************************/
+BEGIN_EVENT_TABLE(FloatConfigControl, wxPanel)
+ EVT_TEXT(-1, FloatConfigControl::OnUpdate)
+END_EVENT_TABLE()
+
FloatConfigControl::FloatConfigControl( vlc_object_t *p_this,
module_config_t *p_item,
wxWindow *parent )
/*****************************************************************************
* BoolConfigControl implementation
*****************************************************************************/
+BEGIN_EVENT_TABLE(BoolConfigControl, wxPanel)
+ EVT_CHECKBOX(-1, BoolConfigControl::OnUpdate)
+END_EVENT_TABLE()
+
BoolConfigControl::BoolConfigControl( vlc_object_t *p_this,
module_config_t *p_item,
wxWindow *parent )
int BoolConfigControl::GetIntValue()
{
- if( checkbox->IsChecked() )
- {
- return 1;
- }
- else
- {
- return 0;
- }
+ if( checkbox->IsChecked() ) return 1;
+ else return 0;
}
virtual wxString GetPszValue();
private:
wxComboBox *combo;
+ char *psz_default_value;
void UpdateCombo( module_config_t *p_item );
void OnAction( wxCommandEvent& );
void OnBrowse( wxCommandEvent& );
virtual wxString GetPszValue();
private:
- DECLARE_EVENT_TABLE()
wxTextCtrl *textctrl;
wxButton *browse;
bool directory;
+
+ DECLARE_EVENT_TABLE()
};
class IntegerConfigControl: public ConfigControl
virtual int GetIntValue();
private:
wxSpinCtrl *spin;
+
+ DECLARE_EVENT_TABLE()
};
class IntegerListConfigControl: public ConfigControl
virtual int GetIntValue();
private:
wxSlider *slider;
+
+ DECLARE_EVENT_TABLE()
};
class FloatConfigControl: public ConfigControl
virtual float GetFloatValue();
private:
wxTextCtrl *textctrl;
+
+ DECLARE_EVENT_TABLE()
};
class BoolConfigControl: public ConfigControl
virtual int GetIntValue();
private:
wxCheckBox *checkbox;
+
+ DECLARE_EVENT_TABLE()
};