Commit 095c755b authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/*: improved preferences widgets a bit.

parent 55837a58
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Copyright (C) 2000-2004 VideoLAN * Copyright (C) 2000-2004 VideoLAN
* $Id$ * $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 * 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 * it under the terms of the GNU General Public License as published by
...@@ -849,7 +849,13 @@ void OpenDialog::UpdateMRL( int i_access_method ) ...@@ -849,7 +849,13 @@ void OpenDialog::UpdateMRL( int i_access_method )
for( int i=0; i < (int)input_panel->config_array.GetCount(); i++ ) for( int i=0; i < (int)input_panel->config_array.GetCount(); i++ )
{ {
ConfigControl *control = input_panel->config_array.Item(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() ) switch( control->GetType() )
{ {
...@@ -857,16 +863,15 @@ void OpenDialog::UpdateMRL( int i_access_method ) ...@@ -857,16 +863,15 @@ void OpenDialog::UpdateMRL( int i_access_method )
case CONFIG_ITEM_FILE: case CONFIG_ITEM_FILE:
case CONFIG_ITEM_DIRECTORY: case CONFIG_ITEM_DIRECTORY:
case CONFIG_ITEM_MODULE: case CONFIG_ITEM_MODULE:
mrltemp += wxT("\"") + control->GetPszValue() + wxT("\""); mrltemp += wxT("=\"") + control->GetPszValue() + wxT("\"");
break; break;
case CONFIG_ITEM_INTEGER: case CONFIG_ITEM_INTEGER:
case CONFIG_ITEM_BOOL:
mrltemp += mrltemp +=
wxString::Format( wxT("%i"), control->GetIntValue() ); wxString::Format( wxT("=%i"), control->GetIntValue() );
break; break;
case CONFIG_ITEM_FLOAT: case CONFIG_ITEM_FLOAT:
mrltemp += mrltemp +=
wxString::Format( wxT("%f"), control->GetFloatValue()); wxString::Format(wxT("=%f"), control->GetFloatValue());
break; break;
} }
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Copyright (C) 2000-2004 VideoLAN * Copyright (C) 2000-2004 VideoLAN
* $Id$ * $Id$
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@videolan.org>
* Sigmund Augdal <sigmunau@idi.ntnu.no> * Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -335,6 +335,9 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *p_this, ...@@ -335,6 +335,9 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *p_this,
wxWindow *parent ) wxWindow *parent )
: ConfigControl( p_this, p_item, 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)); label = new wxStaticText(this, -1, wxU(p_item->psz_text));
sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
combo = new wxComboBox( this, -1, wxT(""), combo = new wxComboBox( this, -1, wxT(""),
...@@ -359,12 +362,16 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *p_this, ...@@ -359,12 +362,16 @@ StringListConfigControl::StringListConfigControl( vlc_object_t *p_this,
StringListConfigControl::~StringListConfigControl() StringListConfigControl::~StringListConfigControl()
{ {
if( psz_default_value ) free( psz_default_value );
} }
void StringListConfigControl::UpdateCombo( module_config_t *p_item ) void StringListConfigControl::UpdateCombo( module_config_t *p_item )
{ {
vlc_bool_t b_found = VLC_FALSE;
int i_index;
/* build a list of available options */ /* 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 && combo->Append( ( p_item->ppsz_list_text &&
p_item->ppsz_list_text[i_index] ) ? p_item->ppsz_list_text[i_index] ) ?
...@@ -380,8 +387,18 @@ void StringListConfigControl::UpdateCombo( module_config_t *p_item ) ...@@ -380,8 +387,18 @@ void StringListConfigControl::UpdateCombo( module_config_t *p_item )
p_item->ppsz_list_text[i_index] ) ? p_item->ppsz_list_text[i_index] ) ?
wxU(p_item->ppsz_list_text[i_index]) : wxU(p_item->ppsz_list_text[i_index]) :
wxL2U(p_item->ppsz_list[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) BEGIN_EVENT_TABLE(StringListConfigControl, wxPanel)
...@@ -494,6 +511,10 @@ wxString FileConfigControl::GetPszValue() ...@@ -494,6 +511,10 @@ wxString FileConfigControl::GetPszValue()
/***************************************************************************** /*****************************************************************************
* IntegerConfigControl implementation * IntegerConfigControl implementation
*****************************************************************************/ *****************************************************************************/
BEGIN_EVENT_TABLE(IntegerConfigControl, wxPanel)
EVT_COMMAND_SCROLL(-1, IntegerConfigControl::OnUpdate)
END_EVENT_TABLE()
IntegerConfigControl::IntegerConfigControl( vlc_object_t *p_this, IntegerConfigControl::IntegerConfigControl( vlc_object_t *p_this,
module_config_t *p_item, module_config_t *p_item,
wxWindow *parent ) wxWindow *parent )
...@@ -621,6 +642,10 @@ int IntegerListConfigControl::GetIntValue() ...@@ -621,6 +642,10 @@ int IntegerListConfigControl::GetIntValue()
/***************************************************************************** /*****************************************************************************
* RangedIntConfigControl implementation * RangedIntConfigControl implementation
*****************************************************************************/ *****************************************************************************/
BEGIN_EVENT_TABLE(RangedIntConfigControl, wxPanel)
EVT_COMMAND_SCROLL(-1, RangedIntConfigControl::OnUpdate)
END_EVENT_TABLE()
RangedIntConfigControl::RangedIntConfigControl( vlc_object_t *p_this, RangedIntConfigControl::RangedIntConfigControl( vlc_object_t *p_this,
module_config_t *p_item, module_config_t *p_item,
wxWindow *parent ) wxWindow *parent )
...@@ -650,6 +675,10 @@ int RangedIntConfigControl::GetIntValue() ...@@ -650,6 +675,10 @@ int RangedIntConfigControl::GetIntValue()
/***************************************************************************** /*****************************************************************************
* FloatConfigControl implementation * FloatConfigControl implementation
*****************************************************************************/ *****************************************************************************/
BEGIN_EVENT_TABLE(FloatConfigControl, wxPanel)
EVT_TEXT(-1, FloatConfigControl::OnUpdate)
END_EVENT_TABLE()
FloatConfigControl::FloatConfigControl( vlc_object_t *p_this, FloatConfigControl::FloatConfigControl( vlc_object_t *p_this,
module_config_t *p_item, module_config_t *p_item,
wxWindow *parent ) wxWindow *parent )
...@@ -684,6 +713,10 @@ float FloatConfigControl::GetFloatValue() ...@@ -684,6 +713,10 @@ float FloatConfigControl::GetFloatValue()
/***************************************************************************** /*****************************************************************************
* BoolConfigControl implementation * BoolConfigControl implementation
*****************************************************************************/ *****************************************************************************/
BEGIN_EVENT_TABLE(BoolConfigControl, wxPanel)
EVT_CHECKBOX(-1, BoolConfigControl::OnUpdate)
END_EVENT_TABLE()
BoolConfigControl::BoolConfigControl( vlc_object_t *p_this, BoolConfigControl::BoolConfigControl( vlc_object_t *p_this,
module_config_t *p_item, module_config_t *p_item,
wxWindow *parent ) wxWindow *parent )
...@@ -704,12 +737,6 @@ BoolConfigControl::~BoolConfigControl() ...@@ -704,12 +737,6 @@ BoolConfigControl::~BoolConfigControl()
int BoolConfigControl::GetIntValue() int BoolConfigControl::GetIntValue()
{ {
if( checkbox->IsChecked() ) if( checkbox->IsChecked() ) return 1;
{ else return 0;
return 1;
}
else
{
return 0;
}
} }
...@@ -102,6 +102,7 @@ public: ...@@ -102,6 +102,7 @@ public:
virtual wxString GetPszValue(); virtual wxString GetPszValue();
private: private:
wxComboBox *combo; wxComboBox *combo;
char *psz_default_value;
void UpdateCombo( module_config_t *p_item ); void UpdateCombo( module_config_t *p_item );
void OnAction( wxCommandEvent& ); void OnAction( wxCommandEvent& );
...@@ -117,10 +118,11 @@ public: ...@@ -117,10 +118,11 @@ public:
void OnBrowse( wxCommandEvent& ); void OnBrowse( wxCommandEvent& );
virtual wxString GetPszValue(); virtual wxString GetPszValue();
private: private:
DECLARE_EVENT_TABLE()
wxTextCtrl *textctrl; wxTextCtrl *textctrl;
wxButton *browse; wxButton *browse;
bool directory; bool directory;
DECLARE_EVENT_TABLE()
}; };
class IntegerConfigControl: public ConfigControl class IntegerConfigControl: public ConfigControl
...@@ -131,6 +133,8 @@ public: ...@@ -131,6 +133,8 @@ public:
virtual int GetIntValue(); virtual int GetIntValue();
private: private:
wxSpinCtrl *spin; wxSpinCtrl *spin;
DECLARE_EVENT_TABLE()
}; };
class IntegerListConfigControl: public ConfigControl class IntegerListConfigControl: public ConfigControl
...@@ -156,6 +160,8 @@ public: ...@@ -156,6 +160,8 @@ public:
virtual int GetIntValue(); virtual int GetIntValue();
private: private:
wxSlider *slider; wxSlider *slider;
DECLARE_EVENT_TABLE()
}; };
class FloatConfigControl: public ConfigControl class FloatConfigControl: public ConfigControl
...@@ -166,6 +172,8 @@ public: ...@@ -166,6 +172,8 @@ public:
virtual float GetFloatValue(); virtual float GetFloatValue();
private: private:
wxTextCtrl *textctrl; wxTextCtrl *textctrl;
DECLARE_EVENT_TABLE()
}; };
class BoolConfigControl: public ConfigControl class BoolConfigControl: public ConfigControl
...@@ -176,4 +184,6 @@ public: ...@@ -176,4 +184,6 @@ public:
virtual int GetIntValue(); virtual int GetIntValue();
private: private:
wxCheckBox *checkbox; wxCheckBox *checkbox;
DECLARE_EVENT_TABLE()
}; };
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