Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / extension / param / parameter.cpp
index 3320cddcac2fd2ea8047d1563fa75b0bcf476ce1..ac7c8b8dd7df668cda1b4d9dd8f95496b88beac9 100644 (file)
@@ -4,6 +4,7 @@
 /* Author:
  *   Ted Gould <ted@gould.cx>
  *   Johan Engelen <johan@shouraizou.nl>
+ *   Jon A. Cruz <jon@joncruz.org>
  *
  * Copyright (C) 2005-2007 Authors
  *
@@ -35,6 +36,7 @@
 #include "bool.h"
 #include "color.h"
 #include "description.h"
+#include "groupheader.h"
 #include "enum.h"
 #include "float.h"
 #include "int.h"
@@ -134,6 +136,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 +156,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)
@@ -294,7 +296,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);
@@ -315,6 +317,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
@@ -343,10 +346,9 @@ Parameter::new_child (Inkscape::XML::Node * parent)
     return retval;
 }
 
-Inkscape::XML::Node *
-Parameter::document_param_node (SPDocument * doc)
+Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc)
 {
-    Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
+    Inkscape::XML::Document *xml_doc = doc->getReprDoc();
     Inkscape::XML::Node * defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc));
     Inkscape::XML::Node * params = NULL;
 
@@ -405,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 */
@@ -419,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 :