summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2010-09-07 21:11:53 +0000
committerJazzyNico <nicoduf@yahoo.fr>2010-09-07 21:11:53 +0000
commit58e76e40aa940d05606412f232d179e867334455 (patch)
tree356e52968dc3f9bbc137fb6fb1ce99d1ec8ba1cc /src
parentConnected two toolbar buttons with the associated verbs (diff)
downloadinkscape-58e76e40aa940d05606412f232d179e867334455.tar.gz
inkscape-58e76e40aa940d05606412f232d179e867334455.zip
Extensions. General UI improvements (gnome HIG). New group header extension parameter.
(bzr r9748)
Diffstat (limited to 'src')
-rw-r--r--src/extension/Makefile_insert100
-rw-r--r--src/extension/extension.cpp2
-rw-r--r--src/extension/param/CMakeLists.txt1
-rw-r--r--src/extension/param/bool.cpp4
-rw-r--r--src/extension/param/description.cpp4
-rwxr-xr-xsrc/extension/param/groupheader.cpp68
-rwxr-xr-xsrc/extension/param/groupheader.h44
-rw-r--r--src/extension/param/notebook.cpp4
-rw-r--r--src/extension/param/parameter.cpp6
9 files changed, 176 insertions, 57 deletions
diff --git a/src/extension/Makefile_insert b/src/extension/Makefile_insert
index 1965dfa9a..b9ce224ca 100644
--- a/src/extension/Makefile_insert
+++ b/src/extension/Makefile_insert
@@ -1,53 +1,55 @@
## Makefile.am fragment sourced by src/Makefile.am.
ink_common_sources += \
- extension/extension.cpp \
- extension/extension.h \
- extension/extension-forward.h \
- extension/db.cpp \
- extension/db.h \
- extension/dependency.cpp \
- extension/dependency.h \
- extension/error-file.cpp \
- extension/error-file.h \
- extension/execution-env.cpp \
- extension/execution-env.h \
- extension/init.cpp \
- extension/init.h \
- extension/param/parameter.h \
- extension/param/parameter.cpp \
- extension/param/notebook.h \
- extension/param/notebook.cpp \
- extension/param/bool.h \
- extension/param/bool.cpp \
- extension/param/color.h \
- extension/param/color.cpp \
- extension/param/description.h \
- extension/param/description.cpp \
- extension/param/enum.h \
- extension/param/enum.cpp \
- extension/param/float.h \
- extension/param/float.cpp \
- extension/param/int.h \
- extension/param/int.cpp \
- extension/param/radiobutton.h \
- extension/param/radiobutton.cpp \
- extension/param/string.h \
- extension/param/string.cpp \
- extension/prefdialog.cpp \
- extension/prefdialog.h \
- extension/system.cpp \
- extension/system.h \
- extension/timer.cpp \
- extension/timer.h \
- extension/input.h \
- extension/input.cpp \
- extension/output.h \
- extension/output.cpp \
- extension/effect.h \
- extension/effect.cpp \
- extension/patheffect.h \
- extension/patheffect.cpp \
- extension/print.h \
- extension/print.cpp
+ extension/extension.cpp \
+ extension/extension.h \
+ extension/extension-forward.h \
+ extension/db.cpp \
+ extension/db.h \
+ extension/dependency.cpp \
+ extension/dependency.h \
+ extension/error-file.cpp \
+ extension/error-file.h \
+ extension/execution-env.cpp \
+ extension/execution-env.h \
+ extension/init.cpp \
+ extension/init.h \
+ extension/param/parameter.h \
+ extension/param/parameter.cpp \
+ extension/param/notebook.h \
+ extension/param/notebook.cpp \
+ extension/param/bool.h \
+ extension/param/bool.cpp \
+ extension/param/color.h \
+ 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 \
+ extension/param/float.cpp \
+ extension/param/int.h \
+ extension/param/int.cpp \
+ extension/param/radiobutton.h \
+ extension/param/radiobutton.cpp \
+ extension/param/string.h \
+ extension/param/string.cpp \
+ extension/prefdialog.cpp \
+ extension/prefdialog.h \
+ extension/system.cpp \
+ extension/system.h \
+ extension/timer.cpp \
+ extension/timer.h \
+ extension/input.h \
+ extension/input.cpp \
+ extension/output.h \
+ extension/output.cpp \
+ extension/effect.h \
+ extension/effect.cpp \
+ extension/patheffect.h \
+ extension/patheffect.cpp \
+ extension/print.h \
+ extension/print.cpp
diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp
index 3aed5a233..caed62735 100644
--- a/src/extension/extension.cpp
+++ b/src/extension/extension.cpp
@@ -669,7 +669,7 @@ public:
*/
void addWidget (Gtk::Widget * widg, gchar const * tooltip) {
if (widg == NULL) return;
- this->pack_start(*widg, true, true, 2);
+ this->pack_start(*widg, false, false, 2);
if (tooltip != NULL) {
_tooltips.set_tip(*widg, Glib::ustring(_(tooltip)));
}
diff --git a/src/extension/param/CMakeLists.txt b/src/extension/param/CMakeLists.txt
index 843de8b7a..2ef5d5005 100644
--- a/src/extension/param/CMakeLists.txt
+++ b/src/extension/param/CMakeLists.txt
@@ -2,6 +2,7 @@ SET(extension_param_SRC
bool.cpp
color.cpp
description.cpp
+groupheader.cpp
enum.cpp
parameter.cpp
float.cpp
diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp
index 1dda3d73f..299d8ffd1 100644
--- a/src/extension/param/bool.cpp
+++ b/src/extension/param/bool.cpp
@@ -139,9 +139,9 @@ ParamBool::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signa
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_LEFT));
label->show();
- hbox->pack_start(*label, true, true);
+ hbox->pack_end(*label, true, true);
- ParamBoolCheckButton * checkbox = new ParamBoolCheckButton(this, doc, node, changeSignal);
+ ParamBoolCheckButton * checkbox = Gtk::manage(new ParamBoolCheckButton(this, doc, node, changeSignal));
checkbox->show();
hbox->pack_start(*checkbox, false, false);
diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp
index 656e58c49..d73439414 100644
--- a/src/extension/param/description.cpp
+++ b/src/extension/param/description.cpp
@@ -50,12 +50,12 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node
{
if (_gui_hidden) return NULL;
- Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_value)));
+ Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_value), 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, 5);
+ hbox->pack_start(*label, true, true, 12);
hbox->show();
return hbox;
diff --git a/src/extension/param/groupheader.cpp b/src/extension/param/groupheader.cpp
new file mode 100755
index 000000000..8bdb7f382
--- /dev/null
+++ b/src/extension/param/groupheader.cpp
@@ -0,0 +1,68 @@
+/*
+ * 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);
+
+ 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;
+
+ Gtk::Label * label = Gtk::manage(new Gtk::Label(Glib::ustring("<b>") + _(_value) + 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
new file mode 100755
index 000000000..92908caaa
--- /dev/null
+++ b/src/extension/param/groupheader.h
@@ -0,0 +1,44 @@
+#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;
+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/notebook.cpp b/src/extension/param/notebook.cpp
index 1c30b7e0e..50cef0db7 100644
--- a/src/extension/param/notebook.cpp
+++ b/src/extension/param/notebook.cpp
@@ -210,8 +210,8 @@ ParamNotebookPage::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sig
Parameter * param = reinterpret_cast<Parameter *>(list->data);
Gtk::Widget * widg = param->get_widget(doc, node, changeSignal);
gchar const * tip = param->get_tooltip();
-
- vbox->pack_start(*widg, true, true, 2);
+// printf("Tip: '%s'\n", tip);
+ vbox->pack_start(*widg, false, false, 2);
if (tip != NULL) {
_tooltips->set_tip(*widg, Glib::ustring(tip));
}
diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp
index 3320cddca..91d614b93 100644
--- a/src/extension/param/parameter.cpp
+++ b/src/extension/param/parameter.cpp
@@ -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")) {
@@ -294,7 +297,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 +318,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