Code

Pot and Dutch translation update
[inkscape.git] / src / extension / param / parameter.cpp
index 2773af61dde709ad4c9ae3206b00a50392b9e0fa..94260cc56523e59ed3bdd0416d86a952e21c6e5f 100644 (file)
@@ -35,6 +35,7 @@
 #include "bool.h"
 #include "color.h"
 #include "description.h"
+#include "groupheader.h"
 #include "enum.h"
 #include "float.h"
 #include "int.h"
@@ -134,6 +135,8 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension *
         }
     } else if (!strcmp(type, "description")) {
         param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
+    } else if (!strcmp(type, "groupheader")) {
+        param = new ParamGroupHeader(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);        
     } else if (!strcmp(type, "enum")) {
         param = new ParamComboBox(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
     } else if (!strcmp(type, "notebook")) {
@@ -152,8 +155,6 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension *
     return param;
 }
 
-
-
 /** \brief  Wrapper to cast to the object and use it's function.  */
 bool
 Parameter::get_bool (const SPDocument * doc, const Inkscape::XML::Node * node)
@@ -204,6 +205,16 @@ Parameter::get_enum (const SPDocument * doc, const Inkscape::XML::Node * node)
     return param->get(doc, node);
 }
 
+/** \brief  Wrapper to cast to the object and use it's function.  */
+gchar const *Parameter::get_optiongroup(SPDocument const * doc, Inkscape::XML::Node const * node)
+{
+    ParamRadioButton * param = dynamic_cast<ParamRadioButton *>(this);
+    if (!param) {
+        throw Extension::param_not_optiongroup_param();
+    }
+    return param->get(doc, node);
+}
+
 guint32
 Parameter::get_color(const SPDocument* doc, const Inkscape::XML::Node* node)
 {
@@ -253,6 +264,17 @@ Parameter::set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node *
         throw Extension::param_not_string_param();
     return stringpntr->set(in, doc, node);
 }
+
+gchar const * Parameter::set_optiongroup( gchar const * in, SPDocument * doc, Inkscape::XML::Node * node )
+{
+    ParamRadioButton *param = dynamic_cast<ParamRadioButton *>(this);
+    if (!param) {
+        throw Extension::param_not_optiongroup_param();
+    }
+    return param->set(in, doc, node);
+}
+
+
 /** \brief  Wrapper to cast to the object and use it's function.  */
 guint32
 Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node)
@@ -273,7 +295,7 @@ Parameter::Parameter (const gchar * name, const gchar * guitext, const gchar * d
     }
     if (desc != NULL) {
         _desc = g_strdup(desc);
-        // printf("Adding description: '%s' on '%s'\n", _desc, _name);
+//        printf("Adding description: '%s' on '%s'\n", _desc, _name);
     }
     if (gui_tip != NULL) {
         _gui_tip = g_strdup(gui_tip);
@@ -294,6 +316,7 @@ Parameter::~Parameter (void)
     g_free(_name);
     g_free(_text);
        g_free(_gui_tip);
+    g_free(_desc);
 }
 
 /** \brief  Build the name to write the parameter from the extension's
@@ -384,6 +407,13 @@ Parameter::string (std::list <std::string> &list)
     return;
 }
 
+/** \brief  All the code in Notebook::get_param to get the notebook content */
+Parameter *
+Parameter::get_param(const gchar * name)
+{
+    return NULL;
+}
+
 Glib::ustring const extension_pref_root = "/extensions/";
 
 }  /* namespace Extension */
@@ -398,4 +428,4 @@ Glib::ustring const extension_pref_root = "/extensions/";
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :