summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 07eaa1f)
raw | patch | inline | side by side (parent: 07eaa1f)
| author | gouldtj <gouldtj@users.sourceforge.net> | |
| Tue, 2 May 2006 05:25:04 +0000 (05:25 +0000) | ||
| committer | gouldtj <gouldtj@users.sourceforge.net> | |
| Tue, 2 May 2006 05:25:04 +0000 (05:25 +0000) |
Adding the _scope and _desc variables for the base parameters.
Currently they're just initialized to NULL and USER, but now they can
start to be used for more.
Currently they're just initialized to NULL and USER, but now they can
start to be used for more.
| src/extension/parameter.cpp | patch | blob | history | |
| src/extension/parameter.h | patch | blob | history |
index 7e5d46739b5e2e833db339ebf438a1972d07906a..ef0154d88caa54649ba644c1ca1a5b2279a16516 100644 (file)
namespace Inkscape {
namespace Extension {
-/*
-template <typename T> class ParamSpecific : public Parameter {
-private:
- T _value;
-public:
- ParamSpecific (const gchar * name, const gchar * guitext, Inkscape::Extension * ext, Inkscape::XML::Node * xml);
- T get (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node);
- T set (T in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node);
- Gtk::Widget * get_widget(void);
- Glib::ustring * string (void);
-};
-
-bool
-ParamSpecific<bool>::get (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node)
-{
- return _value;
-}
-
-int
-ParamSpecific<int>::get (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node)
-{
- return _value;
-}
-*/
-
/** \brief A boolean parameter */
class ParamBool : public Parameter {
private:
}
/** \brief Oop, now that we need a parameter, we need it's name. */
-Parameter::Parameter (const gchar * name, const gchar * guitext, Inkscape::Extension::Extension * ext) :
- extension(ext), _name(NULL), _text(NULL)
+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)
{
- _name = g_strdup(name);
+ if (name != NULL)
+ _name = g_strdup(name);
+ if (desc != NULL)
+ _desc = g_strdup(desc);
+
+
if (guitext != NULL)
_text = g_strdup(guitext);
else
_text = g_strdup(name);
+
+ return;
}
/** \brief Just free the allocated name. */
index d527421edfdedec84d13a1308add8d130bd018d5..54b5e554e3ee5a06316a6e894be05958ec123079 100644 (file)
Inkscape::Extension::Extension * extension;
/** \brief The name of this parameter. */
gchar * _name;
+ /** \brief Description of the parameter. */
+ gchar * _desc;
+ /** \brief List of possible scopes. */
+ typedef enum {
+ SCOPE_USER, /**< Parameter value is saved in the user's configuration file. (default) */
+ SCOPE_DOCUMENT, /**< Parameter value is saved in the document. */
+ SCOPE_NODE /**< Parameter value is attached to the node. */
+ } _scope_t;
+ /** \brief Scope of the parameter. */
+ _scope_t _scope;
protected:
/** \brief Text for the GUI selection of this. */
gchar * pref_name (void);
public:
- Parameter (const gchar * name, const gchar * guitext, Inkscape::Extension::Extension * ext);
- virtual ~Parameter(void);
+ Parameter (const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ Inkscape::Extension::Extension * ext);
+ Parameter (const gchar * name,
+ const gchar * guitext,
+ Inkscape::Extension::Extension * ext) {
+ Parameter(name, guitext, NULL, Parameter::SCOPE_USER, ext);
+ };
+ virtual ~Parameter (void);
bool get_bool (const Inkscape::XML::Document * doc,
const Inkscape::XML::Node * node);
int get_int (const Inkscape::XML::Document * doc,