summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2008-04-04 04:55:24 +0000
committergouldtj <gouldtj@users.sourceforge.net>2008-04-04 04:55:24 +0000
commit8a2ba4f29d0304fef7631e0efec8b10a2dc99121 (patch)
tree0eb2b0987084a55191da506c6c7e870bbe2d903d /src
parent* packaging/macosx/ScriptExec/main.c: Add a comment to clarify what looks (diff)
downloadinkscape-8a2ba4f29d0304fef7631e0efec8b10a2dc99121.tar.gz
inkscape-8a2ba4f29d0304fef7631e0efec8b10a2dc99121.zip
r18381@shi: ted | 2008-03-07 20:11:34 -0800
New work branch r18391@shi: ted | 2008-03-08 21:36:03 -0800 Moving the parameters around to clean up the directories. r18392@shi: ted | 2008-03-08 21:57:14 -0800 Moving the 'get' function to cpp r18870@shi: ted | 2008-04-03 21:10:20 -0700 Adding in to the parameter prototype the ability to have a gui-tip and a gui-hidden parameter r18871@shi: ted | 2008-04-03 21:17:39 -0700 Using the _gui-hidden parameter to block the creation of the widget if set. r18890@shi: ted | 2008-04-03 21:53:55 -0700 Merge from r18024 which got lost in the shuffle. (bzr r5322)
Diffstat (limited to 'src')
-rw-r--r--src/extension/Makefile_insert40
-rw-r--r--src/extension/extension.cpp2
-rw-r--r--src/extension/param/bool.cpp (renamed from src/extension/parambool.cpp)16
-rw-r--r--src/extension/param/bool.h (renamed from src/extension/parambool.h)5
-rw-r--r--src/extension/param/color.cpp (renamed from src/extension/paramcolor.cpp)12
-rw-r--r--src/extension/param/color.h (renamed from src/extension/paramcolor.h)4
-rw-r--r--src/extension/param/description.cpp (renamed from src/extension/paramdescription.cpp)12
-rw-r--r--src/extension/param/description.h (renamed from src/extension/paramdescription.h)2
-rw-r--r--src/extension/param/enum.cpp (renamed from src/extension/paramenum.cpp)16
-rw-r--r--src/extension/param/enum.h (renamed from src/extension/paramenum.h)4
-rw-r--r--src/extension/param/float.cpp (renamed from src/extension/paramfloat.cpp)10
-rw-r--r--src/extension/param/float.h (renamed from src/extension/paramfloat.h)2
-rw-r--r--src/extension/param/int.cpp (renamed from src/extension/paramint.cpp)10
-rw-r--r--src/extension/param/int.h (renamed from src/extension/paramint.h)2
-rw-r--r--src/extension/param/notebook.cpp (renamed from src/extension/paramnotebook.cpp)34
-rw-r--r--src/extension/param/notebook.h (renamed from src/extension/paramnotebook.h)4
-rw-r--r--src/extension/param/parameter.cpp (renamed from src/extension/parameter.cpp)135
-rw-r--r--src/extension/param/parameter.h (renamed from src/extension/parameter.h)14
-rw-r--r--src/extension/param/radiobutton.cpp (renamed from src/extension/paramradiobutton.cpp)10
-rw-r--r--src/extension/param/radiobutton.h (renamed from src/extension/paramradiobutton.h)4
-rw-r--r--src/extension/param/string.cpp (renamed from src/extension/paramstring.cpp)10
-rw-r--r--src/extension/param/string.h (renamed from src/extension/paramstring.h)2
-rw-r--r--src/extension/prefdialog.h2
23 files changed, 173 insertions, 179 deletions
diff --git a/src/extension/Makefile_insert b/src/extension/Makefile_insert
index 9c6cdd61f..bb0dc9cef 100644
--- a/src/extension/Makefile_insert
+++ b/src/extension/Makefile_insert
@@ -19,26 +19,26 @@ extension_libextension_a_SOURCES = \
extension/execution-env.h \
extension/init.cpp \
extension/init.h \
- extension/parameter.h \
- extension/parameter.cpp \
- extension/paramnotebook.h \
- extension/paramnotebook.cpp \
- extension/parambool.h \
- extension/parambool.cpp \
- extension/paramcolor.h \
- extension/paramcolor.cpp \
- extension/paramdescription.h \
- extension/paramdescription.cpp \
- extension/paramenum.h \
- extension/paramenum.cpp \
- extension/paramfloat.h \
- extension/paramfloat.cpp \
- extension/paramint.h \
- extension/paramint.cpp \
- extension/paramradiobutton.h \
- extension/paramradiobutton.cpp \
- extension/paramstring.h \
- extension/paramstring.cpp \
+ extension/param/parameter.h \
+ extension/param/parameter.cpp \
+ extension/param/notebook.h \
+ extension/param/notebook.cpp \
+ extension/param/bool.h \
+ extension/param/bool.cpp \
+ extension/param/color.h \
+ extension/param/color.cpp \
+ extension/param/description.h \
+ extension/param/description.cpp \
+ extension/param/enum.h \
+ extension/param/enum.cpp \
+ extension/param/float.h \
+ extension/param/float.cpp \
+ extension/param/int.h \
+ extension/param/int.cpp \
+ extension/param/radiobutton.h \
+ extension/param/radiobutton.cpp \
+ extension/param/string.h \
+ extension/param/string.cpp \
extension/prefdialog.cpp \
extension/prefdialog.h \
extension/system.cpp \
diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp
index 07803c187..a4ae7de9b 100644
--- a/src/extension/extension.cpp
+++ b/src/extension/extension.cpp
@@ -34,7 +34,7 @@
#include "db.h"
#include "dependency.h"
#include "timer.h"
-#include "parameter.h"
+#include "param/parameter.h"
namespace Inkscape {
namespace Extension {
diff --git a/src/extension/parambool.cpp b/src/extension/param/bool.cpp
index b324e6281..509ded032 100644
--- a/src/extension/parambool.cpp
+++ b/src/extension/param/bool.cpp
@@ -15,15 +15,15 @@
#include <xml/node.h>
-#include "extension.h"
-#include "parambool.h"
+#include "../extension.h"
+#include "bool.h"
namespace Inkscape {
namespace Extension {
/** \brief Use the superclass' allocator and set the \c _value */
-ParamBool::ParamBool (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
- Parameter(name, guitext, desc, scope, ext), _value(false)
+ParamBool::ParamBool (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
+ Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(false)
{
const char * defaultval = NULL;
if (sp_repr_children(xml) != NULL)
@@ -63,6 +63,13 @@ ParamBool::set( bool in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/ )
return _value;
}
+/** \brief Returns \c _value */
+bool
+ParamBool::get (const SPDocument * doc, const Inkscape::XML::Node * node)
+{
+ return _value;
+}
+
/** \brief A check button which is Param aware. It works with the
parameter to change it's value as the check button changes
value. */
@@ -125,6 +132,7 @@ ParamBool::string (std::string &string)
Gtk::Widget *
ParamBool::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
+ if (_gui_hidden) return NULL;
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_LEFT));
diff --git a/src/extension/parambool.h b/src/extension/param/bool.h
index 7f1be0fcc..a1cd4ce4a 100644
--- a/src/extension/parambool.h
+++ b/src/extension/param/bool.h
@@ -21,9 +21,8 @@ private:
/** \brief Internal value. */
bool _value;
public:
- ParamBool(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
- /** \brief Returns \c _value */
- bool get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; }
+ ParamBool(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
+ bool get (const SPDocument * doc, const Inkscape::XML::Node * node);
bool set (bool in, SPDocument * doc, Inkscape::XML::Node * node);
Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
void string (std::string &string);
diff --git a/src/extension/paramcolor.cpp b/src/extension/param/color.cpp
index cb7437be0..845a04824 100644
--- a/src/extension/paramcolor.cpp
+++ b/src/extension/param/color.cpp
@@ -19,10 +19,10 @@
#include <xml/node.h>
-#include "extension.h"
-#include "paramcolor.h"
-
+#include "../extension.h"
#include "color.h"
+
+#include <color.h>
#include "widgets/sp-color-selector.h"
#include "widgets/sp-color-notebook.h"
@@ -54,8 +54,8 @@ ParamColor::set( guint32 in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*
}
/** \brief Initialize the object, to do that, copy the data. */
-ParamColor::ParamColor (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
- Parameter(name, guitext, desc, scope, ext)
+ParamColor::ParamColor (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
+ Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext)
{
const char * defaulthex = NULL;
if (sp_repr_children(xml) != NULL)
@@ -85,6 +85,8 @@ ParamColor::string (std::string &string)
Gtk::Widget *
ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * changeSignal )
{
+ if (_gui_hidden) return NULL;
+
_changeSignal = new sigc::signal<void>(*changeSignal);
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
SPColorSelector* spColorSelector = (SPColorSelector*)sp_color_selector_new(SP_TYPE_COLOR_NOTEBOOK);
diff --git a/src/extension/paramcolor.h b/src/extension/param/color.h
index 87c0fdd9c..6836442a1 100644
--- a/src/extension/paramcolor.h
+++ b/src/extension/param/color.h
@@ -10,7 +10,7 @@
#include <gtkmm/widget.h>
#include <xml/node.h>
#include <document.h>
-#include "color.h"
+#include <color.h>
#include "parameter.h"
namespace Inkscape {
@@ -20,7 +20,7 @@ class ParamColor : public Parameter {
private:
guint32 _value;
public:
- ParamColor(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
+ ParamColor(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
virtual ~ParamColor(void);
/** \brief Returns \c _value, with a \i const to protect it. */
guint32 get( const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/ ) { return _value; }
diff --git a/src/extension/paramdescription.cpp b/src/extension/param/description.cpp
index f0c9fd8b7..61bfa9f5a 100644
--- a/src/extension/paramdescription.cpp
+++ b/src/extension/param/description.cpp
@@ -14,7 +14,7 @@
#endif
-#include "paramdescription.h"
+#include "description.h"
#include <gtkmm/adjustment.h>
#include <gtkmm/box.h>
@@ -26,16 +26,16 @@
#include <xml/node.h>
-#include "extension.h"
-#include "prefs-utils.h"
+#include <extension/extension.h>
+#include <prefs-utils.h>
namespace Inkscape {
namespace Extension {
/** \brief Initialize the object, to do that, copy the data. */
-ParamDescription::ParamDescription (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
- Parameter(name, guitext, desc, scope, ext), _value(NULL)
+ParamDescription::ParamDescription (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
+ Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(NULL)
{
// printf("Building Description\n");
const char * defaultval = NULL;
@@ -52,6 +52,8 @@ ParamDescription::ParamDescription (const gchar * name, const gchar * guitext, c
Gtk::Widget *
ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/)
{
+ if (_gui_hidden) return NULL;
+
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_value)));
label->set_line_wrap();
label->show();
diff --git a/src/extension/paramdescription.h b/src/extension/param/description.h
index 13b4e5eae..c305ea6df 100644
--- a/src/extension/paramdescription.h
+++ b/src/extension/param/description.h
@@ -22,7 +22,7 @@ private:
/** \brief Internal value. */
gchar * _value;
public:
- ParamDescription(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
+ ParamDescription(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
};
diff --git a/src/extension/paramenum.cpp b/src/extension/param/enum.cpp
index 336b4fd66..274220699 100644
--- a/src/extension/paramenum.cpp
+++ b/src/extension/param/enum.cpp
@@ -27,12 +27,12 @@
#include <xml/node.h>
-#include "extension.h"
-#include "prefs-utils.h"
-#include "document-private.h"
-#include "sp-object.h"
+#include <extension/extension.h>
+#include <prefs-utils.h>
+#include <document-private.h>
+#include <sp-object.h>
-#include "paramenum.h"
+#include "enum.h"
/** \brief The root directory in the preferences database for extension
related parameters. */
@@ -59,8 +59,8 @@ public:
};
-ParamComboBox::ParamComboBox (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
- Parameter(name, guitext, desc, scope, ext)
+ParamComboBox::ParamComboBox (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
+ Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext)
{
choices = NULL;
_value = NULL;
@@ -224,6 +224,8 @@ ParamComboBoxEntry::changed (void)
Gtk::Widget *
ParamComboBox::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
+ if (_gui_hidden) return NULL;
+
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_LEFT));
diff --git a/src/extension/paramenum.h b/src/extension/param/enum.h
index 5ea4a0196..3f9707c34 100644
--- a/src/extension/paramenum.h
+++ b/src/extension/param/enum.h
@@ -17,7 +17,7 @@
#include <gtkmm/widget.h>
#include "xml/document.h"
-#include "extension-forward.h"
+#include <extension/extension-forward.h>
#include "parameter.h"
@@ -37,7 +37,7 @@ private:
GSList * choices; /**< A table to store the choice strings */
public:
- ParamComboBox(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
+ ParamComboBox(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
virtual ~ParamComboBox(void);
Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
void string (std::string &string);
diff --git a/src/extension/paramfloat.cpp b/src/extension/param/float.cpp
index ee2284c8c..1225648d6 100644
--- a/src/extension/paramfloat.cpp
+++ b/src/extension/param/float.cpp
@@ -15,16 +15,16 @@
#include <xml/node.h>
-#include "extension.h"
-#include "paramfloat.h"
+#include <extension/extension.h>
+#include "float.h"
namespace Inkscape {
namespace Extension {
/** \brief Use the superclass' allocator and set the \c _value */
-ParamFloat::ParamFloat (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
- Parameter(name, guitext, desc, scope, ext), _value(0.0), _min(0.0), _max(10.0)
+ParamFloat::ParamFloat (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
+ Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(0.0), _min(0.0), _max(10.0)
{
const char * defaultval = NULL;
if (sp_repr_children(xml) != NULL)
@@ -142,6 +142,8 @@ ParamFloatAdjustment::val_changed (void)
Gtk::Widget *
ParamFloat::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
+ if (_gui_hidden) return NULL;
+
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_LEFT));
diff --git a/src/extension/paramfloat.h b/src/extension/param/float.h
index 25edad7b2..f105d8f0e 100644
--- a/src/extension/paramfloat.h
+++ b/src/extension/param/float.h
@@ -24,7 +24,7 @@ private:
float _max;
int _precision;
public:
- ParamFloat (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
+ ParamFloat (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
/** \brief Returns \c _value */
float get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; }
float set (float in, SPDocument * doc, Inkscape::XML::Node * node);
diff --git a/src/extension/paramint.cpp b/src/extension/param/int.cpp
index ca938141c..dc523435e 100644
--- a/src/extension/paramint.cpp
+++ b/src/extension/param/int.cpp
@@ -15,16 +15,16 @@
#include <xml/node.h>
-#include "extension.h"
-#include "paramint.h"
+#include <extension/extension.h>
+#include "int.h"
namespace Inkscape {
namespace Extension {
/** \brief Use the superclass' allocator and set the \c _value */
-ParamInt::ParamInt (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
- Parameter(name, guitext, desc, scope, ext), _value(0), _min(0), _max(10)
+ParamInt::ParamInt (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
+ Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(0), _min(0), _max(10)
{
const char * defaultval = NULL;
if (sp_repr_children(xml) != NULL)
@@ -127,6 +127,8 @@ ParamIntAdjustment::val_changed (void)
Gtk::Widget *
ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
+ if (_gui_hidden) return NULL;
+
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_LEFT));
diff --git a/src/extension/paramint.h b/src/extension/param/int.h
index aa0d05aa7..a4eb54c81 100644
--- a/src/extension/paramint.h
+++ b/src/extension/param/int.h
@@ -23,7 +23,7 @@ private:
int _min;
int _max;
public:
- ParamInt (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
+ ParamInt (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
/** \brief Returns \c _value */
int get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; }
int set (int in, SPDocument * doc, Inkscape::XML::Node * node);
diff --git a/src/extension/paramnotebook.cpp b/src/extension/param/notebook.cpp
index c80731adc..5c4f96759 100644
--- a/src/extension/paramnotebook.cpp
+++ b/src/extension/param/notebook.cpp
@@ -26,12 +26,12 @@
#include <xml/node.h>
-#include "extension.h"
+#include <extension/extension.h>
#include "prefs-utils.h"
#include "document-private.h"
#include "sp-object.h"
-#include "paramnotebook.h"
+#include "notebook.h"
/** \brief The root directory in the preferences database for extension
related parameters. */
@@ -52,7 +52,7 @@ private:
public:
static ParamNotebookPage * makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext);
- ParamNotebookPage(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
+ ParamNotebookPage(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
~ParamNotebookPage(void);
Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
void paramString (std::list <std::string> &list);
@@ -61,8 +61,8 @@ public:
}; /* class ParamNotebookPage */
-ParamNotebookPage::ParamNotebookPage (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
- Parameter(name, guitext, desc, scope, ext)
+ParamNotebookPage::ParamNotebookPage (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
+ Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext)
{
parameters = NULL;
@@ -140,15 +140,29 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension:
const char * desc;
const char * scope_str;
Parameter::_scope_t scope = Parameter::SCOPE_USER;
+ bool gui_hidden = false;
+ const char * gui_hide;
+ const char * gui_tip;
name = in_repr->attribute("name");
guitext = in_repr->attribute("gui-text");
if (guitext == NULL)
guitext = in_repr->attribute("_gui-text");
+ gui_tip = in_repr->attribute("gui-tip");
+ if (gui_tip == NULL)
+ gui_tip = in_repr->attribute("_gui-tip");
desc = in_repr->attribute("gui-description");
if (desc == NULL)
desc = in_repr->attribute("_gui-description");
scope_str = in_repr->attribute("scope");
+ gui_hide = in_repr->attribute("gui-hidden");
+ if (gui_hide != NULL) {
+ if (strcmp(gui_hide, "1") == 0 ||
+ strcmp(gui_hide, "true") == 0) {
+ gui_hidden = true;
+ }
+ /* else stays false */
+ }
/* In this case we just don't have enough information */
if (name == NULL) {
@@ -165,7 +179,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension:
}
}
- ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, scope, in_ext, in_repr);
+ ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, scope, gui_hide, gui_tip, in_ext, in_repr);
/* Note: page could equal NULL */
return page;
@@ -181,6 +195,8 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension:
Gtk::Widget *
ParamNotebookPage::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
+ if (_gui_hidden) return NULL;
+
if (!_tooltips) _tooltips = new Gtk::Tooltips();
Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox);
@@ -211,8 +227,8 @@ ParamNotebookPage::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sig
-ParamNotebook::ParamNotebook (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
- Parameter(name, guitext, desc, scope, ext)
+ParamNotebook::ParamNotebook (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
+ Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext)
{
pages = NULL;
@@ -374,6 +390,8 @@ ParamNotebookWdg::changed_page(GtkNotebookPage */*page*/,
Gtk::Widget *
ParamNotebook::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
+ if (_gui_hidden) return NULL;
+
ParamNotebookWdg * nb = Gtk::manage(new ParamNotebookWdg(this, doc, node));
// add pages (if any)
diff --git a/src/extension/paramnotebook.h b/src/extension/param/notebook.h
index 7f976113a..24d4ebfc1 100644
--- a/src/extension/paramnotebook.h
+++ b/src/extension/param/notebook.h
@@ -17,7 +17,7 @@
#include <gtkmm/widget.h>
#include "xml/document.h"
-#include "extension-forward.h"
+#include <extension/extension-forward.h>
#include "parameter.h"
@@ -38,7 +38,7 @@ private:
This only gets created if there are pages in this
notebook */
public:
- ParamNotebook(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
+ ParamNotebook(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
virtual ~ParamNotebook(void);
Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
void string (std::list <std::string> &list);
diff --git a/src/extension/parameter.cpp b/src/extension/param/parameter.cpp
index dd80cf59c..7e071e7e3 100644
--- a/src/extension/parameter.cpp
+++ b/src/extension/param/parameter.cpp
@@ -26,60 +26,27 @@
#include <xml/node.h>
-#include "extension.h"
+#include <extension/extension.h>
#include "document-private.h"
#include "sp-object.h"
-#include "color.h"
+#include <color.h>
#include "widgets/sp-color-selector.h"
#include "widgets/sp-color-notebook.h"
#include "parameter.h"
-#include "parambool.h"
-#include "paramcolor.h"
-#include "paramdescription.h"
-#include "paramenum.h"
-#include "paramfloat.h"
-#include "paramint.h"
-#include "paramnotebook.h"
-#include "paramradiobutton.h"
-#include "paramstring.h"
+#include "bool.h"
+#include "color.h"
+#include "description.h"
+#include "enum.h"
+#include "float.h"
+#include "int.h"
+#include "notebook.h"
+#include "radiobutton.h"
+#include "string.h"
namespace Inkscape {
namespace Extension {
-class ParamEnum : public Parameter {
-private:
- class Choice {
- public:
- gchar * _gui_name;
- gchar * _value;
- Choice(gchar * gui_name, gchar * value) : _gui_name(NULL), _value(NULL) {
- if (gui_name != NULL)
- _gui_name = g_strdup(_(gui_name));
- if (value != NULL)
- _value = g_strdup(value);
- return;
- };
- ~Choice (void) {
- g_free(_gui_name);
- g_free(_value);
- };
- }; /* class Choice */
- /** \brief Internal value. This should point to a string that has
- been allocated in memory. And should be free'd. */
- Choice * _current_choice;
- typedef std::list<Choice *> choice_list_t;
- choice_list_t _choice_list;
-public:
- ParamEnum(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
- ~ParamEnum(void);
- /** \brief Returns \c _value, with a \i const to protect it. */
- const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _current_choice != NULL ? _current_choice->_value : NULL; }
- const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node);
- Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
- Glib::ustring * string (void);
-}; /* class ParamEnum */
-
/**
\return None
\brief This function creates a parameter that can be used later. This
@@ -112,16 +79,30 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension *
const char * desc;
const char * scope_str;
Parameter::_scope_t scope = Parameter::SCOPE_USER;
+ bool gui_hidden = false;
+ const char * gui_hide;
+ const char * gui_tip;
name = in_repr->attribute("name");
type = in_repr->attribute("type");
guitext = in_repr->attribute("gui-text");
if (guitext == NULL)
guitext = in_repr->attribute("_gui-text");
+ gui_tip = in_repr->attribute("gui-tip");
+ if (gui_tip == NULL)
+ gui_tip = in_repr->attribute("_gui-tip");
desc = in_repr->attribute("gui-description");
if (desc == NULL)
desc = in_repr->attribute("_gui-description");
scope_str = in_repr->attribute("scope");
+ gui_hide = in_repr->attribute("gui-hidden");
+ if (gui_hide != NULL) {
+ if (strcmp(gui_hide, "1") == 0 ||
+ strcmp(gui_hide, "true") == 0) {
+ gui_hidden = true;
+ }
+ /* else stays false */
+ }
/* In this case we just don't have enough information */
if (name == NULL || type == NULL) {
@@ -140,23 +121,23 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension *
Parameter * param = NULL;
if (!strcmp(type, "boolean")) {
- param = new ParamBool(name, guitext, desc, scope, in_ext, in_repr);
+ param = new ParamBool(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
} else if (!strcmp(type, "int")) {
- param = new ParamInt(name, guitext, desc, scope, in_ext, in_repr);
+ param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
} else if (!strcmp(type, "float")) {
- param = new ParamFloat(name, guitext, desc, scope, in_ext, in_repr);
+ param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
} else if (!strcmp(type, "string")) {
- param = new ParamString(name, guitext, desc, scope, in_ext, in_repr);
+ param = new ParamString(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
} else if (!strcmp(type, "description")) {
- param = new ParamDescription(name, guitext, desc, scope, in_ext, in_repr);
+ param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
} else if (!strcmp(type, "enum")) {
- param = new ParamComboBox(name, guitext, desc, scope, in_ext, in_repr);
+ param = new ParamComboBox(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
} else if (!strcmp(type, "notebook")) {
- param = new ParamNotebook(name, guitext, desc, scope, in_ext, in_repr);
+ param = new ParamNotebook(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
} else if (!strcmp(type, "optiongroup")) {
- param = new ParamRadioButton(name, guitext, desc, scope, in_ext, in_repr);
+ param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
} else if (!strcmp(type, "color")) {
- param = new ParamColor(name, guitext, desc, scope, in_ext, in_repr);
+ param = new ParamColor(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
}
/* Note: param could equal NULL */
@@ -276,15 +257,19 @@ Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node)
/** \brief Oop, now that we need a parameter, we need it's name. */
-Parameter::Parameter (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext) :
- extension(ext), _name(NULL), _desc(NULL), _scope(scope), _text(NULL)
+Parameter::Parameter (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext) :
+ extension(ext), _name(NULL), _desc(NULL), _scope(scope), _text(NULL), _gui_hidden(gui_hidden), _gui_tip(NULL)
{
- if (name != NULL)
+ if (name != NULL) {
_name = g_strdup(name);
+ }
if (desc != NULL) {
_desc = g_strdup(desc);
// printf("Adding description: '%s' on '%s'\n", _desc, _name);
}
+ if (gui_tip != NULL) {
+ _gui_tip = g_strdup(gui_tip);
+ }
if (guitext != NULL)
@@ -300,6 +285,7 @@ Parameter::~Parameter (void)
{
g_free(_name);
g_free(_text);
+ g_free(_gui_tip);
}
/** \brief Build the name to write the parameter from the extension's
@@ -388,43 +374,6 @@ Parameter::string (std::list <std::string> &list)
return;
}
-
-
-
-
-ParamEnum::ParamEnum (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * /*xml*/) :
- Parameter(name, guitext, desc, scope, ext), _current_choice(NULL)
-{
- return;
-}
-
-ParamEnum::~ParamEnum (void)
-{
-
-}
-
-/** \brief Return the value as a string */
-Glib::ustring *
-ParamEnum::string (void)
-{
- Glib::ustring * mystring = new Glib::ustring("");
- *mystring += this->get(NULL, NULL);
- return mystring;
-}
-
-Gtk::Widget *
-ParamEnum::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/)
-{
- return NULL;
-}
-
-const gchar *
-ParamEnum::set (const gchar * /*in*/, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/)
-{
- return NULL;
-}
-
-
} /* namespace Extension */
} /* namespace Inkscape */
diff --git a/src/extension/parameter.h b/src/extension/param/parameter.h
index 1917ffa98..ca3a2a0d4 100644
--- a/src/extension/parameter.h
+++ b/src/extension/param/parameter.h
@@ -22,12 +22,12 @@
#include "xml/document.h"
#include "xml/node.h"
#include "document.h"
-#include "extension-forward.h"
+#include <extension/extension-forward.h>
#include "prefs-utils.h"
#include <glibmm/i18n.h>
-#include "color.h"
+#include <color.h>
namespace Inkscape {
namespace Extension {
@@ -58,7 +58,11 @@ protected:
/** \brief Scope of the parameter. */
_scope_t _scope;
/** \brief Text for the GUI selection of this. */
- gchar * _text;
+ gchar * _text;
+ /** \brief Whether the GUI is visible */
+ bool _gui_hidden;
+ /** \brief A tip for the GUI if there is one */
+ gchar * _gui_tip;
/* **** funcs **** */
@@ -72,11 +76,13 @@ public:
const gchar * guitext,
const gchar * desc,
const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
Inkscape::Extension::Extension * ext);
Parameter (const gchar * name,
const gchar * guitext,
Inkscape::Extension::Extension * ext) {
- Parameter(name, guitext, NULL, Parameter::SCOPE_USER, ext);
+ Parameter(name, guitext, NULL, Parameter::SCOPE_USER, false, NULL, ext);
};
virtual ~Parameter (void);
bool get_bool (const SPDocument * doc,
diff --git a/src/extension/paramradiobutton.cpp b/src/extension/param/radiobutton.cpp
index 5fce66910..1ab526d19 100644
--- a/src/extension/paramradiobutton.cpp
+++ b/src/extension/param/radiobutton.cpp
@@ -28,12 +28,12 @@
#include <xml/node.h>
-#include "extension.h"
+#include <extension/extension.h>
#include "prefs-utils.h"
#include "document-private.h"
#include "sp-object.h"
-#include "paramradiobutton.h"
+#include "radiobutton.h"
/** \brief The root directory in the preferences database for extension
related parameters. */
@@ -59,8 +59,8 @@ public:
Glib::ustring * guitext;
};
-ParamRadioButton::ParamRadioButton (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
- Parameter(name, guitext, desc, scope, ext)
+ParamRadioButton::ParamRadioButton (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
+ Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext)
{
choices = NULL;
_value = NULL;
@@ -226,6 +226,8 @@ ParamRadioButtonWdg::changed (void)
Gtk::Widget *
ParamRadioButton::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
+ if (_gui_hidden) return NULL;
+
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox(false, 0));
diff --git a/src/extension/paramradiobutton.h b/src/extension/param/radiobutton.h
index d7d034d60..4bf596e4f 100644
--- a/src/extension/paramradiobutton.h
+++ b/src/extension/param/radiobutton.h
@@ -17,7 +17,7 @@
#include <gtkmm/widget.h>
#include "xml/document.h"
-#include "extension-forward.h"
+#include <extension/extension-forward.h>
#include "parameter.h"
@@ -37,7 +37,7 @@ private:
GSList * choices; /**< A table to store the choice strings */
public:
- ParamRadioButton(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
+ ParamRadioButton(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
virtual ~ParamRadioButton(void);
Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
void string (std::string &string);
diff --git a/src/extension/paramstring.cpp b/src/extension/param/string.cpp
index 953cb7daf..36c3ce115 100644
--- a/src/extension/paramstring.cpp
+++ b/src/extension/param/string.cpp
@@ -15,8 +15,8 @@
#include <xml/node.h>
-#include "extension.h"
-#include "paramstring.h"
+#include <extension/extension.h>
+#include "string.h"
namespace Inkscape {
namespace Extension {
@@ -69,8 +69,8 @@ ParamString::string (std::string &string)
}
/** \brief Initialize the object, to do that, copy the data. */
-ParamString::ParamString (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
- Parameter(name, guitext, desc, scope, ext), _value(NULL)
+ParamString::ParamString (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
+ Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(NULL)
{
const char * defaultval = NULL;
if (sp_repr_children(xml) != NULL)
@@ -134,6 +134,8 @@ ParamStringEntry::changed_text (void)
Gtk::Widget *
ParamString::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
+ if (_gui_hidden) return NULL;
+
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_LEFT));
diff --git a/src/extension/paramstring.h b/src/extension/param/string.h
index 14a3f622f..0a1a0f2a3 100644
--- a/src/extension/paramstring.h
+++ b/src/extension/param/string.h
@@ -22,7 +22,7 @@ private:
been allocated in memory. And should be free'd. */
gchar * _value;
public:
- ParamString(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
+ ParamString(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
virtual ~ParamString(void);
/** \brief Returns \c _value, with a \i const to protect it. */
const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; }
diff --git a/src/extension/prefdialog.h b/src/extension/prefdialog.h
index 195ce8ea5..0a10881d6 100644
--- a/src/extension/prefdialog.h
+++ b/src/extension/prefdialog.h
@@ -19,7 +19,7 @@
#include <gtkmm/socket.h>
#include "execution-env.h"
-#include "parameter.h"
+#include "param/parameter.h"
namespace Inkscape {
namespace Extension {