Code

r11140@tres: ted | 2006-03-27 21:37:00 -0800
authorgouldtj <gouldtj@users.sourceforge.net>
Tue, 2 May 2006 05:22:24 +0000 (05:22 +0000)
committergouldtj <gouldtj@users.sourceforge.net>
Tue, 2 May 2006 05:22:24 +0000 (05:22 +0000)
 Adding nodes as parameters all the way through the parameter chain.  Now
 all we need is to start using them!

src/extension/extension.cpp
src/extension/extension.h
src/extension/parameter.cpp
src/extension/parameter.h

index 6eb3a1728abd1dce629d25a9e6bf2433c5db24e8..7004e848f2c1ab41e22b2e3d00b2bc7622decd31 100644 (file)
@@ -405,17 +405,18 @@ param_shared (const gchar * name, GSList * list)
               in value.  It isn't duplicated into the value string.
     \param    name    The name of the parameter to get
     \param    doc    The document to look in for document specific parameters
+    \param    node   The node to look in for a specific parameter
 
     Look up in the parameters list, then execute the function on that
     found parameter.
 */
 const gchar *
-Extension::get_param_string (const gchar * name, const Inkscape::XML::Document * doc)
+Extension::get_param_string (const gchar * name, const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node)
 {
     Parameter * param;
 
     param = param_shared(name, parameters);
-    return param->get_string(doc);
+    return param->get_string(doc, node);
 }
 
 /**
@@ -424,17 +425,18 @@ Extension::get_param_string (const gchar * name, const Inkscape::XML::Document *
               in value.
     \param    name    The name of the parameter to get
     \param    doc    The document to look in for document specific parameters
+    \param    node   The node to look in for a specific parameter
 
     Look up in the parameters list, then execute the function on that
     found parameter.
 */
 bool
-Extension::get_param_bool (const gchar * name, const Inkscape::XML::Document * doc)
+Extension::get_param_bool (const gchar * name, const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node)
 {
     Parameter * param;
 
     param = param_shared(name, parameters);
-    return param->get_bool(doc);
+    return param->get_bool(doc, node);
 }
 
 /**
@@ -443,17 +445,18 @@ Extension::get_param_bool (const gchar * name, const Inkscape::XML::Document * d
               in value.
     \param    name    The name of the parameter to get
     \param    doc    The document to look in for document specific parameters
+    \param    node   The node to look in for a specific parameter
 
     Look up in the parameters list, then execute the function on that
     found parameter.
 */
 int
-Extension::get_param_int (const gchar * name, const Inkscape::XML::Document * doc)
+Extension::get_param_int (const gchar * name, const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node)
 {
     Parameter * param;
 
     param = param_shared(name, parameters);
-    return param->get_int(doc);
+    return param->get_int(doc, node);
 }
 
 /**
@@ -462,16 +465,17 @@ Extension::get_param_int (const gchar * name, const Inkscape::XML::Document * do
               in value.
     \param    name    The name of the parameter to get
     \param    doc    The document to look in for document specific parameters
+    \param    node   The node to look in for a specific parameter
 
     Look up in the parameters list, then execute the function on that
     found parameter.
 */
 float
-Extension::get_param_float (const gchar * name, const Inkscape::XML::Document * doc)
+Extension::get_param_float (const gchar * name, const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node)
 {
     Parameter * param;
     param = param_shared(name, parameters);
-    return param->get_float(doc);
+    return param->get_float(doc, node);
 }
 
 /**
@@ -481,16 +485,17 @@ Extension::get_param_float (const gchar * name, const Inkscape::XML::Document *
     \param    name    The name of the parameter to set
     \param    value   The value to set the parameter to
     \param    doc    The document to look in for document specific parameters
+    \param    node   The node to look in for a specific parameter
 
     Look up in the parameters list, then execute the function on that
     found parameter.
 */
 bool
-Extension::set_param_bool (const gchar * name, bool value, Inkscape::XML::Document * doc)
+Extension::set_param_bool (const gchar * name, bool value, Inkscape::XML::Document * doc, Inkscape::XML::Node * node)
 {
     Parameter * param;
     param = param_shared(name, parameters);
-    return param->set_bool(value, doc);
+    return param->set_bool(value, doc, node);
 }
 
 /**
@@ -500,16 +505,17 @@ Extension::set_param_bool (const gchar * name, bool value, Inkscape::XML::Docume
     \param    name    The name of the parameter to set
     \param    value   The value to set the parameter to
     \param    doc    The document to look in for document specific parameters
+    \param    node   The node to look in for a specific parameter
 
     Look up in the parameters list, then execute the function on that
     found parameter.
 */
 int
-Extension::set_param_int (const gchar * name, int value, Inkscape::XML::Document * doc)
+Extension::set_param_int (const gchar * name, int value, Inkscape::XML::Document * doc, Inkscape::XML::Node * node)
 {
     Parameter * param;
     param = param_shared(name, parameters);
-    return param->set_int(value, doc);
+    return param->set_int(value, doc, node);
 }
 
 /**
@@ -519,16 +525,17 @@ Extension::set_param_int (const gchar * name, int value, Inkscape::XML::Document
     \param    name    The name of the parameter to set
     \param    value   The value to set the parameter to
     \param    doc    The document to look in for document specific parameters
+    \param    node   The node to look in for a specific parameter
 
     Look up in the parameters list, then execute the function on that
     found parameter.
 */
 float
-Extension::set_param_float (const gchar * name, float value, Inkscape::XML::Document * doc)
+Extension::set_param_float (const gchar * name, float value, Inkscape::XML::Document * doc, Inkscape::XML::Node * node)
 {
     Parameter * param;
     param = param_shared(name, parameters);
-    return param->set_float(value, doc);
+    return param->set_float(value, doc, node);
 }
 
 /**
@@ -538,16 +545,17 @@ Extension::set_param_float (const gchar * name, float value, Inkscape::XML::Docu
     \param    name    The name of the parameter to set
     \param    value   The value to set the parameter to
     \param    doc    The document to look in for document specific parameters
+    \param    node   The node to look in for a specific parameter
 
     Look up in the parameters list, then execute the function on that
     found parameter.
 */
 const gchar *
-Extension::set_param_string (const gchar * name, const gchar * value, Inkscape::XML::Document * doc)
+Extension::set_param_string (const gchar * name, const gchar * value, Inkscape::XML::Document * doc, Inkscape::XML::Node * node)
 {
     Parameter * param;
     param = param_shared(name, parameters);
-    return param->set_string(value, doc);
+    return param->set_string(value, doc, node);
 }
 
 /** \brief A function to open the error log file. */
index 2e05865018a361a409a03432577aad5105048baa..f6010b1ea856f297fefb2986af94b5246c0758fd 100644 (file)
@@ -143,25 +143,33 @@ private:
 #endif
 public:
     bool             get_param_bool   (const gchar * name,
-                                       const Inkscape::XML::Document *   doc = NULL);
+                                       const Inkscape::XML::Document *   doc = NULL,
+                                       const Inkscape::XML::Node * node = NULL);
     int              get_param_int    (const gchar * name,
-                                       const Inkscape::XML::Document *   doc = NULL);
+                                       const Inkscape::XML::Document *   doc = NULL,
+                                       const Inkscape::XML::Node * node = NULL);
     float            get_param_float  (const gchar * name,
-                                       const Inkscape::XML::Document *   doc = NULL);
+                                       const Inkscape::XML::Document *   doc = NULL,
+                                       const Inkscape::XML::Node * node = NULL);
     const gchar *    get_param_string (const gchar * name,
-                                       const Inkscape::XML::Document *   doc = NULL);
+                                       const Inkscape::XML::Document *   doc = NULL,
+                                       const Inkscape::XML::Node * node = NULL);
     bool             set_param_bool   (const gchar * name,
                                        bool          value,
-                                       Inkscape::XML::Document *   doc = NULL);
+                                       Inkscape::XML::Document *   doc = NULL,
+                                       Inkscape::XML::Node *       node = NULL);
     int              set_param_int    (const gchar * name,
                                        int           value,
-                                       Inkscape::XML::Document *   doc = NULL);
+                                       Inkscape::XML::Document *   doc = NULL,
+                                       Inkscape::XML::Node *       node = NULL);
     float            set_param_float  (const gchar * name,
                                        float         value,
-                                       Inkscape::XML::Document *   doc = NULL);
+                                       Inkscape::XML::Document *   doc = NULL,
+                                       Inkscape::XML::Node *       node = NULL);
     const gchar *    set_param_string (const gchar * name,
                                        const gchar * value,
-                                       Inkscape::XML::Document *   doc = NULL);
+                                       Inkscape::XML::Document *   doc = NULL,
+                                       Inkscape::XML::Node *       node = NULL);
 
     /* Error file handling */
 public:
index 88da74a1dd689bc5fedc34b7727fc25d9faa7335..5d62030993deb76b3234245e94cf9a6a9c5c60ca 100644 (file)
@@ -42,8 +42,8 @@ private:
 public:
     ParamBool(const gchar * name, const gchar * guitext, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
     /** \brief  Returns \c _value */
-    bool get (const Inkscape::XML::Document * doc) { return _value; }
-    bool set (bool in, Inkscape::XML::Document * doc);
+    bool get (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) { return _value; }
+    bool set (bool in, Inkscape::XML::Document * doc, const Inkscape::XML::Node * node);
     Gtk::Widget * get_widget(void);
     Glib::ustring * string (void);
 };
@@ -78,8 +78,8 @@ private:
 public:
     ParamInt (const gchar * name, const gchar * guitext, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
     /** \brief  Returns \c _value */
-    int get (const Inkscape::XML::Document * doc) { return _value; }
-    int set (int in, Inkscape::XML::Document * doc);
+    int get (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) { return _value; }
+    int set (int in, Inkscape::XML::Document * doc, const Inkscape::XML::Node * node);
     int max (void) { return _max; }
     int min (void) { return _min; }
     Gtk::Widget * get_widget(void);
@@ -132,8 +132,8 @@ private:
 public:
     ParamFloat (const gchar * name, const gchar * guitext, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
     /** \brief  Returns \c _value */
-    float get (const Inkscape::XML::Document * doc) { return _value; }
-    float set (float in, Inkscape::XML::Document * doc);
+    float get (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) { return _value; }
+    float set (float in, Inkscape::XML::Document * doc, const Inkscape::XML::Node * node);
     float max (void) { return _max; }
     float min (void) { return _min; }
     Gtk::Widget * get_widget(void);
@@ -186,8 +186,8 @@ public:
     ParamString(const gchar * name, const gchar * guitext, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
     ~ParamString(void);
     /** \brief  Returns \c _value, with a \i const to protect it. */
-    const gchar * get (const Inkscape::XML::Document * doc) { return _value; }
-    const gchar * set (const gchar * in, Inkscape::XML::Document * doc);
+    const gchar * get (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node) { return _value; }
+    const gchar * set (const gchar * in, Inkscape::XML::Document * doc, const Inkscape::XML::Node * node);
     Gtk::Widget * get_widget(void);
     Glib::ustring * string (void);
 };
@@ -251,13 +251,14 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension *
 /** \brief  A function to set the \c _value
     \param  in   The value to set to
     \param  doc  A document that should be used to set the value.
+    \param  node The node where the value may be placed
 
     This function sets the internal value, but it also sets the value
     in the preferences structure.  To put it in the right place, \c PREF_DIR
     and \c pref_name() are used.
 */
 bool
-ParamBool::set (bool in, Inkscape::XML::Document * doc)
+ParamBool::set (bool in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node)
 {
     _value = in;
 
@@ -271,13 +272,14 @@ ParamBool::set (bool in, Inkscape::XML::Document * doc)
 /** \brief  A function to set the \c _value
     \param  in   The value to set to
     \param  doc  A document that should be used to set the value.
+    \param  node The node where the value may be placed
 
     This function sets the internal value, but it also sets the value
     in the preferences structure.  To put it in the right place, \c PREF_DIR
     and \c pref_name() are used.
 */
 int
-ParamInt::set (int in, Inkscape::XML::Document * doc)
+ParamInt::set (int in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node)
 {
     _value = in;
     if (_value > _max) _value = _max;
@@ -293,13 +295,14 @@ ParamInt::set (int in, Inkscape::XML::Document * doc)
 /** \brief  A function to set the \c _value
     \param  in   The value to set to
     \param  doc  A document that should be used to set the value.
+    \param  node The node where the value may be placed
 
     This function sets the internal value, but it also sets the value
     in the preferences structure.  To put it in the right place, \c PREF_DIR
     and \c pref_name() are used.
 */
 float
-ParamFloat::set (float in, Inkscape::XML::Document * doc)
+ParamFloat::set (float in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node)
 {
     _value = in;
     if (_value > _max) _value = _max;
@@ -315,6 +318,7 @@ ParamFloat::set (float in, Inkscape::XML::Document * doc)
 /** \brief  A function to set the \c _value
     \param  in   The value to set to
     \param  doc  A document that should be used to set the value.
+    \param  node The node where the value may be placed
 
     This function sets the internal value, but it also sets the value
     in the preferences structure.  To put it in the right place, \c PREF_DIR
@@ -325,7 +329,7 @@ ParamFloat::set (float in, Inkscape::XML::Document * doc)
     the passed in value is duplicated using \c g_strdup().
 */
 const gchar *
-ParamString::set (const gchar * in, Inkscape::XML::Document * doc)
+ParamString::set (const gchar * in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node)
 {
     if (in == NULL) return NULL; /* Can't have NULL string */
 
@@ -342,18 +346,18 @@ ParamString::set (const gchar * in, Inkscape::XML::Document * doc)
 
 /** \brief  Wrapper to cast to the object and use it's function.  */
 bool
-Parameter::get_bool (const Inkscape::XML::Document * doc)
+Parameter::get_bool (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node)
 {
     ParamBool * boolpntr;
     boolpntr = dynamic_cast<ParamBool *>(this);
     if (boolpntr == NULL)
         throw Extension::param_wrong_type();
-    return boolpntr->get(doc);
+    return boolpntr->get(doc, node);
 }
 
 /** \brief  Wrapper to cast to the object and use it's function.  */
 int
-Parameter::get_int (const Inkscape::XML::Document * doc)
+Parameter::get_int (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node)
 {
     ParamInt * intpntr;
     intpntr = dynamic_cast<ParamInt *>(this);
@@ -364,7 +368,7 @@ Parameter::get_int (const Inkscape::XML::Document * doc)
 
 /** \brief  Wrapper to cast to the object and use it's function.  */
 float
-Parameter::get_float (const Inkscape::XML::Document * doc)
+Parameter::get_float (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node)
 {
     ParamFloat * floatpntr;
     floatpntr = dynamic_cast<ParamFloat *>(this);
@@ -375,7 +379,7 @@ Parameter::get_float (const Inkscape::XML::Document * doc)
 
 /** \brief  Wrapper to cast to the object and use it's function.  */
 const gchar *
-Parameter::get_string (const Inkscape::XML::Document * doc)
+Parameter::get_string (const Inkscape::XML::Document * doc, const Inkscape::XML::Node * node)
 {
     ParamString * stringpntr;
     stringpntr = dynamic_cast<ParamString *>(this);
@@ -386,46 +390,46 @@ Parameter::get_string (const Inkscape::XML::Document * doc)
 
 /** \brief  Wrapper to cast to the object and use it's function.  */
 bool
-Parameter::set_bool (bool in, Inkscape::XML::Document * doc)
+Parameter::set_bool (bool in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node)
 {
     ParamBool * boolpntr;
     boolpntr = dynamic_cast<ParamBool *>(this);
     if (boolpntr == NULL)
         throw Extension::param_wrong_type();
-    return boolpntr->set(in, doc);
+    return boolpntr->set(in, doc, node);
 }
 
 /** \brief  Wrapper to cast to the object and use it's function.  */
 int
-Parameter::set_int (int in, Inkscape::XML::Document * doc)
+Parameter::set_int (int in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node)
 {
     ParamInt * intpntr;
     intpntr = dynamic_cast<ParamInt *>(this);
     if (intpntr == NULL)
         throw Extension::param_wrong_type();
-    return intpntr->set(in, doc);
+    return intpntr->set(in, doc, node);
 }
 
 /** \brief  Wrapper to cast to the object and use it's function.  */
 float
-Parameter::set_float (float in, Inkscape::XML::Document * doc)
+Parameter::set_float (float in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node)
 {
     ParamFloat * floatpntr;
     floatpntr = dynamic_cast<ParamFloat *>(this);
     if (floatpntr == NULL)
         throw Extension::param_wrong_type();
-    return floatpntr->set(in, doc);
+    return floatpntr->set(in, doc, node);
 }
 
 /** \brief  Wrapper to cast to the object and use it's function.  */
 const gchar *
-Parameter::set_string (const gchar * in, Inkscape::XML::Document * doc)
+Parameter::set_string (const gchar * in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node)
 {
     ParamString * stringpntr;
     stringpntr = dynamic_cast<ParamString *>(this);
     if (stringpntr == NULL)
         throw Extension::param_wrong_type();
-    return stringpntr->set(in, doc);
+    return stringpntr->set(in, doc, node);
 }
 
 /** \brief  Initialize the object, to do that, copy the data. */
index afaecbdc44b1eac9fbd097308bc666904f7e593c..d527421edfdedec84d13a1308add8d130bd018d5 100644 (file)
@@ -36,15 +36,19 @@ protected:
 public:
     Parameter (const gchar * name, const gchar * guitext, Inkscape::Extension::Extension * ext);
     virtual ~Parameter(void);
-    bool          get_bool   (const Inkscape::XML::Document * doc);
-    int           get_int    (const Inkscape::XML::Document * doc);
-    float         get_float  (const Inkscape::XML::Document * doc);
-    const gchar * get_string (const Inkscape::XML::Document * doc);
+    bool          get_bool   (const Inkscape::XML::Document * doc,
+                              const Inkscape::XML::Node * node);
+    int           get_int    (const Inkscape::XML::Document * doc,
+                              const Inkscape::XML::Node * node);
+    float         get_float  (const Inkscape::XML::Document * doc,
+                              const Inkscape::XML::Node * node);
+    const gchar * get_string (const Inkscape::XML::Document * doc,
+                              const Inkscape::XML::Node * node);
 
-    bool          set_bool   (bool in,          Inkscape::XML::Document * doc);
-    int           set_int    (int  in,          Inkscape::XML::Document * doc);
-    float         set_float  (float in,         Inkscape::XML::Document * doc);
-    const gchar * set_string (const gchar * in, Inkscape::XML::Document * doc);
+    bool          set_bool   (bool in,          Inkscape::XML::Document * doc, Inkscape::XML::Node * node);
+    int           set_int    (int  in,          Inkscape::XML::Document * doc, Inkscape::XML::Node * node);
+    float         set_float  (float in,         Inkscape::XML::Document * doc, Inkscape::XML::Node * node);
+    const gchar * set_string (const gchar * in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node);
 
     const gchar * name       (void) {return _name;}