summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c6dd322)
raw | patch | inline | side by side (parent: c6dd322)
| author | gouldtj <gouldtj@users.sourceforge.net> | |
| Tue, 2 May 2006 05:27:56 +0000 (05:27 +0000) | ||
| committer | gouldtj <gouldtj@users.sourceforge.net> | |
| Tue, 2 May 2006 05:27:56 +0000 (05:27 +0000) |
Added in some helper functions.
| src/extension/parameter.cpp | patch | blob | history | |
| src/extension/parameter.h | patch | blob | history |
index 0e67d96c85b741794be3d98e96a88aef205416b9..00bc8369a783453463dc080ac15f2ba8d6df2238 100644 (file)
#include "extension.h"
#include "prefs-utils.h"
+#include "document-private.h"
+#include "sp-object.h"
#include "parameter.h"
return g_strdup_printf("%s.%s", extension->get_id(), _name);
}
+/** \brief Build the name to write the parameter in a node object. This
+ requires the inkscape namespace and the other info. */
+gchar *
+Parameter::node_name (void)
+{
+ return g_strdup_printf("inkscape:extension-param-%s-%s", extension->get_id(), _name);
+}
+
+Inkscape::XML::Node *
+Parameter::document_param_node (SPDocument * doc)
+{
+ Inkscape::XML::Node * defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc));
+ Inkscape::XML::Node * params = NULL;
+
+ for (Inkscape::XML::Node * child = defs->firstChild();
+ child != NULL;
+ child = child->next()) {
+ if (!strcmp(child->name(), "inkscape:extension-param")) {
+ params = child;
+ break;
+ }
+ }
+
+ if (params == NULL) {
+ params = sp_repr_new("inkscape:extension-param");
+ defs->appendChild(params);
+ }
+
+ return params;
+}
+
/** \brief Basically, if there is no widget pass a NULL. */
Gtk::Widget *
Parameter::get_widget (void)
index 67cceff60c935a00ef6b001d2d431d43d30230cc..a29c5cb672723f53e2dd133f212b8a015c954c13 100644 (file)
_scope_t _scope;
/** \brief Text for the GUI selection of this. */
gchar * _text;
- gchar * pref_name (void);
+
+
+ /* **** funcs **** */
+ gchar * pref_name (void);
+ gchar * node_name (void);
+ Inkscape::XML::Node * document_param_node (SPDocument * doc);
public:
Parameter (const gchar * name,