Factored the code for each of the different types of config options out into

separate widgets. This makes preferences.cpp much cleaner and opens up
greater possibilities for the config item controls.
* Added "browse..." button to CONFIG_ITEM_DIRECTORY
* Added a slider to CONFIG_ITEM_INTEGER when i_min or i_max differs from 0
* Made it possible to change CONFIG_ITEM_KEY options with the preferences
dialog
parent ed1df1f7
...@@ -10,6 +10,7 @@ SOURCES_wxwindows = \ ...@@ -10,6 +10,7 @@ SOURCES_wxwindows = \
iteminfo.cpp \ iteminfo.cpp \
menus.cpp \ menus.cpp \
preferences.cpp \ preferences.cpp \
preferences_widgets.cpp \
timer.cpp \ timer.cpp \
fileinfo.cpp \ fileinfo.cpp \
subtitles.cpp \ subtitles.cpp \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* interface.cpp : wxWindows plugin for vlc * interface.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: interface.cpp,v 1.65 2003/10/14 22:41:41 gbazin Exp $ * $Id: interface.cpp,v 1.66 2003/10/19 22:41:18 sigmunau Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "stream_control.h" #include "stream_control.h"
#include "wxwindows.h" #include "wxwindows.h"
#include <wx/url.h>
/* include the toolbar graphics */ /* include the toolbar graphics */
#include "bitmaps/file.xpm" #include "bitmaps/file.xpm"
...@@ -1244,7 +1245,7 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord, ...@@ -1244,7 +1245,7 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
} }
for( size_t i = 0; i < filenames.GetCount(); i++ ) for( size_t i = 0; i < filenames.GetCount(); i++ )
playlist_Add( p_playlist, (const char *)filenames[i].mb_str(), 0, 0, playlist_Add( p_playlist, (const char *)wxURL("file:///" + filenames[i]).GetPath().mb_str(), 0, 0,
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END ); PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
......
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* preferences_widgets.h : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2003 VideoLAN
* $Id: preferences_widgets.h,v 1.1 2003/10/19 22:41:18 sigmunau Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
class ConfigControl: public wxPanel
{
public:
ConfigControl( wxWindow *parent );
~ConfigControl();
wxSizer *Sizer();
virtual int GetIntValue();
virtual float GetFloatValue();
virtual const char * GetPszValue();
protected:
wxBoxSizer *sizer;
wxStaticText *label;
private:
int i_value;
float f_value;
char *psz_value;
};
class KeyConfigControl: public ConfigControl
{
public:
KeyConfigControl( module_config_t *p_item, wxWindow *parent );
~KeyConfigControl();
virtual int GetIntValue();
private:
wxCheckBox *alt;
wxCheckBox *ctrl;
wxCheckBox *shift;
wxComboBox *combo;
};
class ModuleConfigControl: public ConfigControl
{
public:
ModuleConfigControl( intf_thread_t *p_intf, module_config_t *p_item,
wxWindow *parent );
~ModuleConfigControl();
virtual const char *GetPszValue();
private:
wxComboBox *combo;
};
class StringConfigControl: public ConfigControl
{
public:
StringConfigControl( module_config_t *p_item, wxWindow *parent );
~StringConfigControl();
virtual const char *GetPszValue();
private:
wxTextCtrl *textctrl;
};
class StringListConfigControl: public ConfigControl
{
public:
StringListConfigControl( module_config_t *p_item, wxWindow *parent );
~StringListConfigControl();
virtual const char *GetPszValue();
private:
wxComboBox *combo;
};
class FileConfigControl: public ConfigControl
{
public:
FileConfigControl( module_config_t *p_item, wxWindow *parent );
~FileConfigControl();
void FileConfigControl::OnBrowse( wxCommandEvent& );
virtual const char *GetPszValue();
private:
DECLARE_EVENT_TABLE()
wxTextCtrl *textctrl;
wxButton *browse;
bool directory;
};
class IntegerConfigControl: public ConfigControl
{
public:
IntegerConfigControl( module_config_t *p_item, wxWindow *parent );
~IntegerConfigControl();
virtual int GetIntValue();
private:
wxSpinCtrl *spin;
};
class RangedIntConfigControl: public ConfigControl
{
public:
RangedIntConfigControl( module_config_t *p_item, wxWindow *parent );
~RangedIntConfigControl();
virtual int GetIntValue();
private:
wxSlider *slider;
};
class FloatConfigControl: public ConfigControl
{
public:
FloatConfigControl( module_config_t *p_item, wxWindow *parent );
~FloatConfigControl();
virtual float GetFloatValue();
private:
wxTextCtrl *textctrl;
};
class BoolConfigControl: public ConfigControl
{
public:
BoolConfigControl( module_config_t *p_item, wxWindow *parent );
~BoolConfigControl();
virtual int GetIntValue();
private:
wxCheckBox *checkbox;
};
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