summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2011-03-25 15:09:55 +0000
committerJazzyNico <nicoduf@yahoo.fr>2011-03-25 15:09:55 +0000
commit939f84facd2f8beb4f5a1601c09bf7b71f1274a0 (patch)
tree45b38c9ce784ec1327204193b37ee0aab10d090c /src
parentemf import. create dummy object CREATEDIBPATTERNBRUSHPT (Bug 382420) (diff)
downloadinkscape-939f84facd2f8beb4f5a1601c09bf7b71f1274a0.tar.gz
inkscape-939f84facd2f8beb4f5a1601c09bf7b71f1274a0.zip
Extensions. Replacing the groupheader element with an appearance mode in the description element.
(bzr r10129)
Diffstat (limited to 'src')
-rw-r--r--src/extension/Makefile_insert2
-rwxr-xr-xsrc/extension/internal/filter/experimental.h6
-rw-r--r--src/extension/param/description.cpp26
-rw-r--r--src/extension/param/description.h18
-rwxr-xr-xsrc/extension/param/groupheader.cpp78
-rwxr-xr-xsrc/extension/param/groupheader.h45
-rw-r--r--src/extension/param/parameter.cpp9
7 files changed, 44 insertions, 140 deletions
diff --git a/src/extension/Makefile_insert b/src/extension/Makefile_insert
index b9ce224ca..ffcee5f9a 100644
--- a/src/extension/Makefile_insert
+++ b/src/extension/Makefile_insert
@@ -24,8 +24,6 @@ ink_common_sources += \
extension/param/color.cpp \
extension/param/description.h \
extension/param/description.cpp \
- extension/param/groupheader.h \
- extension/param/groupheader.cpp \
extension/param/enum.h \
extension/param/enum.cpp \
extension/param/float.h \
diff --git a/src/extension/internal/filter/experimental.h b/src/extension/internal/filter/experimental.h
index 6617866f5..efc35b418 100755
--- a/src/extension/internal/filter/experimental.h
+++ b/src/extension/internal/filter/experimental.h
@@ -331,16 +331,16 @@ public:
"<id>org.inkscape.effect.filter.Drawing</id>\n"
"<param name=\"tab\" type=\"notebook\">\n"
"<page name=\"optionstab\" _gui-text=\"Options\">\n"
- "<_param name=\"simplifyheader\" type=\"groupheader\">Simplify</_param>\n"
+ "<_param name=\"simplifyheader\" type=\"description\" appearance=\"header\">Simplify</_param>\n"
"<param name=\"simply\" gui-text=\"" N_("Strength:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">0.6</param>\n"
"<param name=\"clean\" gui-text=\"" N_("Clean-up:") "\" type=\"int\" appearance=\"full\" min=\"1\" max=\"500\">10</param>\n"
"<param name=\"erase\" gui-text=\"" N_("Erase:") "\" type=\"float\" appearance=\"full\" min=\"0\" max=\"60\">0</param>\n"
"<param name=\"transluscent\" gui-text=\"" N_("Transluscent") "\" type=\"boolean\" >false</param>\n"
- "<_param name=\"smoothheader\" type=\"groupheader\">Smoothness</_param>\n"
+ "<_param name=\"smoothheader\" type=\"description\" appearance=\"header\">Smoothness</_param>\n"
"<param name=\"smooth\" gui-text=\"" N_("Strength:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">0.6</param>\n"
"<param name=\"dilat\" gui-text=\"" N_("Dilatation:") "\" type=\"float\" appearance=\"full\" min=\"1\" max=\"50\">6</param>\n"
"<param name=\"erosion\" gui-text=\"" N_("Erosion:") "\" type=\"float\" appearance=\"full\" min=\"0\" max=\"50\">2</param>\n"
- "<_param name=\"meltheader\" type=\"groupheader\">Melt</_param>\n"
+ "<_param name=\"meltheader\" type=\"description\" appearance=\"header\">Melt</_param>\n"
"<param name=\"blur\" gui-text=\"" N_("Level:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">1</param>\n"
"<param name=\"bdilat\" gui-text=\"" N_("Dilatation:") "\" type=\"float\" appearance=\"full\" min=\"1\" max=\"50\">6</param>\n"
"<param name=\"berosion\" gui-text=\"" N_("Erosion:") "\" type=\"float\" appearance=\"full\" min=\"0\" max=\"50\">2</param>\n"
diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp
index f17b45b4b..049b7d5a3 100644
--- a/src/extension/param/description.cpp
+++ b/src/extension/param/description.cpp
@@ -30,8 +30,16 @@ namespace Extension {
/** \brief Initialize the object, to do that, copy the data. */
-ParamDescription::ParamDescription (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
- Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(NULL)
+ParamDescription::ParamDescription (const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml,
+ AppearanceMode mode) :
+ Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(NULL), _mode(mode)
{
// printf("Building Description\n");
const char * defaultval = NULL;
@@ -60,13 +68,21 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node
newguitext = _(_value);
}
- Gtk::Label * label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_LEFT));
-
+ Gtk::Label * label;
+ int padding = 12;
+ if (_mode == HEADER) {
+ label = Gtk::manage(new Gtk::Label(Glib::ustring("<b>") +newguitext + Glib::ustring("</b>"), Gtk::ALIGN_LEFT));
+ label->set_padding(0,5);
+ label->set_use_markup(true);
+ padding = 0;
+ } else {
+ label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_LEFT));
+ }
label->set_line_wrap();
label->show();
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
- hbox->pack_start(*label, true, true, 12);
+ hbox->pack_start(*label, true, true, padding);
hbox->show();
return hbox;
diff --git a/src/extension/param/description.h b/src/extension/param/description.h
index c56b5c21d..c34e4ee38 100644
--- a/src/extension/param/description.h
+++ b/src/extension/param/description.h
@@ -18,13 +18,25 @@ namespace Extension {
/** \brief A description parameter */
class ParamDescription : public Parameter {
+public:
+ enum AppearanceMode {
+ DESC, HEADER
+ };
+ ParamDescription(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml,
+ AppearanceMode mode);
+ Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
private:
/** \brief Internal value. */
gchar * _value;
+ AppearanceMode _mode;
const gchar* _context;
-public:
- ParamDescription(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
- Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
};
} /* namespace Extension */
diff --git a/src/extension/param/groupheader.cpp b/src/extension/param/groupheader.cpp
deleted file mode 100755
index abf5f8beb..000000000
--- a/src/extension/param/groupheader.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2005-2010 Authors:
- * Ted Gould <ted@gould.cx>
- * Johan Engelen <johan@shouraizou.nl> *
- * Nicolas Dufour <nicoduf@yahoo.fr>
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#ifdef linux // does the dollar sign need escaping when passed as string parameter?
-# define ESCAPE_DOLLAR_COMMANDLINE
-#endif
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-
-#include "groupheader.h"
-
-#include <gtkmm/adjustment.h>
-#include <gtkmm/box.h>
-#include <gtkmm/spinbutton.h>
-#include <sstream>
-#include <glibmm/i18n.h>
-
-#include "xml/node.h"
-#include "extension/extension.h"
-
-namespace Inkscape {
-namespace Extension {
-
-
-/** \brief Initialize the object, to do that, copy the data. */
-ParamGroupHeader::ParamGroupHeader (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
- Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(NULL)
-{
- // printf("Building GroupHeader\n");
- const char * defaultval = NULL;
- if (sp_repr_children(xml) != NULL)
- defaultval = sp_repr_children(xml)->content();
-
- if (defaultval != NULL)
- _value = g_strdup(defaultval);
-
- _context = xml->attribute("msgctxt");
-
- return;
-}
-
-/** \brief Create a label for the GroupHeader */
-Gtk::Widget *
-ParamGroupHeader::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/)
-{
- if (_gui_hidden) return NULL;
-
- Glib::ustring newguitext;
-
- if (_context != NULL) {
- newguitext = g_dpgettext2(NULL, _context, _value);
- } else {
- newguitext = _(_value);
- }
-
- Gtk::Label * label = Gtk::manage(new Gtk::Label(Glib::ustring("<b>") +newguitext + Glib::ustring("</b>"), Gtk::ALIGN_LEFT));
- label->set_line_wrap();
- label->set_padding(0,5);
- label->set_use_markup(true);
- label->show();
-
- Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
- hbox->pack_start(*label, true, true);
- hbox->show();
-
- return hbox;
-}
-
-} /* namespace Extension */
-} /* namespace Inkscape */
diff --git a/src/extension/param/groupheader.h b/src/extension/param/groupheader.h
deleted file mode 100755
index 94fe880f9..000000000
--- a/src/extension/param/groupheader.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef __INK_EXTENSION_PARAMGROUPHEADER_H__
-#define __INK_EXTENSION_PARAMGROUPHEADER_H__
-
-/*
- * Copyright (C) 2005-2010 Authors:
- * Ted Gould <ted@gould.cx>
- * Johan Engelen <johan@shouraizou.nl> *
- * Nicolas Dufour <nicoduf@yahoo.fr>
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include <gtkmm/widget.h>
-#include <xml/node.h>
-#include <document.h>
-#include "parameter.h"
-
-namespace Inkscape {
-namespace Extension {
-
-/** \brief A GroupLabel parameter */
-class ParamGroupHeader : public Parameter {
-private:
- /** \brief Internal value. */
- gchar * _value;
- const gchar* _context;
-public:
- ParamGroupHeader(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
- Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
-};
-
-} /* namespace Extension */
-} /* namespace Inkscape */
-
-#endif /* __INK_EXTENSION_PARAMGROUPHEADER_H__ */
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp
index d35fb3d3c..a9935cfe6 100644
--- a/src/extension/param/parameter.cpp
+++ b/src/extension/param/parameter.cpp
@@ -36,7 +36,6 @@
#include "bool.h"
#include "color.h"
#include "description.h"
-#include "groupheader.h"
#include "enum.h"
#include "float.h"
#include "int.h"
@@ -143,9 +142,11 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension *
ps->setMaxLength(atoi(max_length));
}
} 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);
+ if (appearance && !strcmp(appearance, "header")) {
+ param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamDescription::HEADER);
+ } else {
+ param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamDescription::DESC);
+ }
} 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")) {