summaryrefslogtreecommitdiffstats
path: root/src/extension
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-03-16 19:08:44 +0000
committerJabiertxof <jtx@jtx>2017-03-16 19:08:44 +0000
commit8330d0ef2b97c73121ead78ea9fbcec6ee01f879 (patch)
tree1b1717d1706ee6ebfecc800f2cc80430eb0450e0 /src/extension
parentupdate to trunk (diff)
parentFix rendering when canvas rotated. General code clean-up and documentation. (diff)
downloadinkscape-8330d0ef2b97c73121ead78ea9fbcec6ee01f879.tar.gz
inkscape-8330d0ef2b97c73121ead78ea9fbcec6ee01f879.zip
Update to trunk
(bzr r13645.1.170)
Diffstat (limited to 'src/extension')
-rw-r--r--[-rwxr-xr-x]src/extension/dbus/builddocs.sh0
-rw-r--r--src/extension/dbus/document-interface.cpp6
-rw-r--r--src/extension/extension.cpp40
-rw-r--r--src/extension/extension.h2
-rw-r--r--src/extension/find_extension_by_mime.h36
-rw-r--r--src/extension/implementation/script.cpp3
-rw-r--r--src/extension/internal/bitmap/imagemagick.cpp1
-rw-r--r--src/extension/internal/cdr-input.cpp45
-rw-r--r--src/extension/internal/filter/color.h2
-rw-r--r--src/extension/internal/filter/protrusions.h2
-rw-r--r--src/extension/internal/metafile-print.cpp34
-rw-r--r--src/extension/internal/metafile-print.h1
-rw-r--r--src/extension/internal/vsd-input.cpp40
-rw-r--r--src/extension/internal/wmf-inout.cpp10
-rw-r--r--src/extension/internal/wmf-print.cpp23
-rw-r--r--src/extension/internal/wpg-input.cpp7
-rw-r--r--src/extension/param/bool.cpp25
-rw-r--r--src/extension/param/bool.h11
-rw-r--r--src/extension/param/color.cpp20
-rw-r--r--src/extension/param/color.h11
-rw-r--r--src/extension/param/description.cpp69
-rw-r--r--src/extension/param/description.h7
-rw-r--r--src/extension/param/enum.cpp26
-rw-r--r--src/extension/param/enum.h12
-rw-r--r--src/extension/param/float.cpp39
-rw-r--r--src/extension/param/float.h21
-rw-r--r--src/extension/param/int.cpp39
-rw-r--r--src/extension/param/int.h20
-rw-r--r--src/extension/param/notebook.cpp46
-rw-r--r--src/extension/param/notebook.h11
-rw-r--r--src/extension/param/parameter.cpp62
-rw-r--r--src/extension/param/parameter.h22
-rw-r--r--src/extension/param/radiobutton.cpp34
-rw-r--r--src/extension/param/radiobutton.h3
-rw-r--r--src/extension/param/string.cpp25
-rw-r--r--src/extension/param/string.h13
-rw-r--r--src/extension/prefdialog.cpp14
37 files changed, 519 insertions, 263 deletions
diff --git a/src/extension/dbus/builddocs.sh b/src/extension/dbus/builddocs.sh
index 2c16daf41..2c16daf41 100755..100644
--- a/src/extension/dbus/builddocs.sh
+++ b/src/extension/dbus/builddocs.sh
diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp
index d3a06b81c..435e347d0 100644
--- a/src/extension/dbus/document-interface.cpp
+++ b/src/extension/dbus/document-interface.cpp
@@ -606,11 +606,7 @@ document_interface_document_set_display_area (DocumentInterface *doc_interface,
{
SPDesktop *desk = doc_interface->target.getDesktop();
g_return_val_if_fail(ensure_desktop_valid(desk, error), FALSE);
- desk->set_display_area (x0,
- y0,
- x1,
- y1,
- border, false);
+ desk->set_display_area (Geom::Rect( Geom::Point(x0,y0), Geom::Point(x1,y1)), border, false );
return TRUE;
}
diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp
index c6dee1b70..6c6e2d71e 100644
--- a/src/extension/extension.cpp
+++ b/src/extension/extension.cpp
@@ -1,6 +1,6 @@
/** \file
*
- * Inkscape::Extension::Extension:
+ * Inkscape::Extension::Extension:
* the ability to have features that are more modular so that they
* can be added and removed easily. This is the basis for defining
* those actions.
@@ -144,15 +144,15 @@ Extension::~Extension (void)
delete timer;
timer = NULL;
/** \todo Need to do parameters here */
-
- // delete parameters:
+
+ // delete parameters:
for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) {
Parameter * param = reinterpret_cast<Parameter *>(list->data);
delete param;
}
g_slist_free(parameters);
-
-
+
+
for (unsigned int i = 0 ; i < _deps.size(); i++) {
delete _deps[i];
}
@@ -330,7 +330,7 @@ Extension::get_repr (void)
}
/**
- \return bool
+ \return bool
\brief Whether this extension should hide the "working, please wait" dialog
*/
bool
@@ -444,7 +444,7 @@ Extension::get_param_enum (const gchar * name, const SPDocument * doc, const Ink
/**
* This is useful to find out, if a given string \c value is selectable in a ComboBox named \cname.
- *
+ *
* @param name The name of the enum parameter to get.
* @param doc The document to look in for document specific parameters.
* @param node The node to look in for a specific parameter.
@@ -692,9 +692,14 @@ public:
* @param widg Widget to add.
* @param tooltip Tooltip for the widget.
*/
- void addWidget(Gtk::Widget *widg, gchar const *tooltip) {
+ void addWidget(Gtk::Widget *widg, gchar const *tooltip, int indent) {
if (widg) {
- this->pack_start(*widg, false, false, 2);
+#if GTK_CHECK_VERSION(3,12,0)
+ widg->set_margin_start(indent * Parameter::GUI_INDENTATION);
+#else
+ widg->set_margin_left(indent * Parameter::GUI_INDENTATION);
+#endif
+ this->pack_start(*widg, false, false, 0);
if (tooltip) {
widg->set_tooltip_text(_(tooltip));
} else {
@@ -713,7 +718,7 @@ public:
a Gtk::VBox, which is then returned to the calling function.
If there are no visible parameters, this function just returns NULL.
- If all parameters are gui_visible = false NULL is returned as well.
+ If all parameters are gui_visible = false NULL is returned as well.
*/
Gtk::Widget *
Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
@@ -721,6 +726,8 @@ Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<v
if (!_gui || param_visible_count() == 0) return NULL;
AutoGUI * agui = Gtk::manage(new AutoGUI());
+ agui->set_border_width(Parameter::GUI_BOX_MARGIN);
+ agui->set_spacing(Parameter::GUI_BOX_SPACING);
//go through the list of parameters to see if there are any non-hidden ones
for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) {
@@ -728,9 +735,10 @@ Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<v
if (param->get_gui_hidden()) continue; //Ignore hidden parameters
Gtk::Widget * widg = param->get_widget(doc, node, changeSignal);
gchar const * tip = param->get_tooltip();
- agui->addWidget(widg, tip);
- }
-
+ int indent = param->get_indent();
+ agui->addWidget(widg, tip, indent);
+ }
+
agui->show();
return agui;
};
@@ -780,7 +788,7 @@ void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Gri
Gtk::Label * label;
Gtk::Label * value;
- (*row)++;
+ (*row)++;
label = Gtk::manage(new Gtk::Label(labelstr));
value = Gtk::manage(new Gtk::Label(valuestr));
@@ -824,13 +832,13 @@ Extension::get_params_widget(void)
return retval;
}
-unsigned int Extension::param_visible_count ( )
+unsigned int Extension::param_visible_count ( )
{
unsigned int _visible_count = 0;
for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) {
Parameter * param = reinterpret_cast<Parameter *>(list->data);
if (!param->get_gui_hidden()) _visible_count++;
- }
+ }
return _visible_count;
}
diff --git a/src/extension/extension.h b/src/extension/extension.h
index cd29e1636..bbd6d068b 100644
--- a/src/extension/extension.h
+++ b/src/extension/extension.h
@@ -176,7 +176,7 @@ public:
private:
void make_param (Inkscape::XML::Node * paramrepr);
-
+
/**
* This function looks through the linked list for a parameter
* structure with the name of the passed in name.
diff --git a/src/extension/find_extension_by_mime.h b/src/extension/find_extension_by_mime.h
new file mode 100644
index 000000000..1686c62e4
--- /dev/null
+++ b/src/extension/find_extension_by_mime.h
@@ -0,0 +1,36 @@
+/**
+ * @file
+ * Find an extension by its mime type.
+ */
+/* Authors:
+ * Lauris Kaplinski <lauris@kaplinski.com>
+ * Frank Felfe <innerspace@iname.com>
+ * bulia byak <buliabyak@users.sf.net>
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
+ * Kris De Gussem <Kris.DeGussem@gmail.com>
+ *
+ * Copyright (C) 2012 Kris De Gussem
+ * Copyright (C) 2010 authors
+ * Copyright (C) 1999-2005 authors
+ * Copyright (C) 2004 David Turner
+ * Copyright (C) 2001-2002 Ximian, Inc.
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+namespace Inkscape {
+namespace Extension {
+static inline Inkscape::Extension::Extension *find_by_mime(const char *const mime)
+{
+
+ Inkscape::Extension::DB::InputList o;
+ Inkscape::Extension::db.get_input_list(o);
+ Inkscape::Extension::DB::InputList::const_iterator i = o.begin();
+ while (i != o.end() && strcmp((*i)->get_mimetype(), mime) != 0) {
+ ++i;
+ }
+ return *i;
+}
+}
+}
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index d2319c2e0..b1058d415 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -963,6 +963,9 @@ void Script::checkStderr (const Glib::ustring &data,
warning.run();
+ delete textview;
+ delete scrollwindow;
+
return;
}
diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp
index 472c2db91..cc5b3d1bc 100644
--- a/src/extension/internal/bitmap/imagemagick.cpp
+++ b/src/extension/internal/bitmap/imagemagick.cpp
@@ -213,6 +213,7 @@ ImageMagick::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::Vi
dc->_nodes[i]->setAttribute("xlink:href", dc->_caches[i], true);
dc->_nodes[i]->setAttribute("sodipodi:absref", NULL, true);
+ delete blob;
}
catch (Magick::Exception &error_) {
printf("Caught exception: %s \n", error_.what());
diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp
index 0435f1396..70bf84ef4 100644
--- a/src/extension/internal/cdr-input.cpp
+++ b/src/extension/internal/cdr-input.cpp
@@ -41,6 +41,7 @@
#endif
#include <gtkmm/alignment.h>
+#include <gtkmm/grid.h>
#include <gtkmm/spinbutton.h>
#include "extension/system.h"
@@ -83,6 +84,8 @@ private:
class Gtk::Widget * _previewArea;
class Gtk::Button * cancelbutton;
class Gtk::Button * okbutton;
+
+ class Gtk::HBox * _page_selector_box;
class Gtk::Label * _labelSelect;
class Gtk::Label * _labelTotalPages;
class Gtk::SpinButton * _pageNumberSpin;
@@ -114,36 +117,38 @@ CdrImportDialog::CdrImportDialog(const std::vector<RVNGString> &vec)
this->get_content_area()->pack_start(*vbox1);
// CONTROLS
+ _page_selector_box = Gtk::manage(new Gtk::HBox());
- // Buttons
- cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true));
- okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true));
-
- // Labels
+ // "Select page:" label
_labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:")));
_labelTotalPages = Gtk::manage(new class Gtk::Label());
_labelSelect->set_line_wrap(false);
_labelSelect->set_use_markup(false);
_labelSelect->set_selectable(false);
+ _page_selector_box->pack_start(*_labelSelect, Gtk::PACK_SHRINK);
+
+ // Adjustment + spinner
+ auto pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0);
+ _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(pageNumberSpin_adj, 1, 0));
+ _pageNumberSpin->set_can_focus();
+ _pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS);
+ _pageNumberSpin->set_numeric(true);
+ _pageNumberSpin->set_wrap(false);
+ _page_selector_box->pack_start(*_pageNumberSpin, Gtk::PACK_SHRINK);
+
_labelTotalPages->set_line_wrap(false);
_labelTotalPages->set_use_markup(false);
_labelTotalPages->set_selectable(false);
gchar *label_text = g_strdup_printf(_("out of %i"), num_pages);
_labelTotalPages->set_label(label_text);
g_free(label_text);
+ _page_selector_box->pack_start(*_labelTotalPages, Gtk::PACK_SHRINK);
- // Adjustment + spinner
- auto _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0);
- _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(_pageNumberSpin_adj, 1, 0));
- _pageNumberSpin->set_can_focus();
- _pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS);
- _pageNumberSpin->set_numeric(true);
- _pageNumberSpin->set_wrap(false);
+ vbox1->pack_end(*_page_selector_box, Gtk::PACK_SHRINK);
- this->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END);
- this->get_action_area()->add(*_labelSelect);
- this->add_action_widget(*_pageNumberSpin, Gtk::RESPONSE_ACCEPT);
- this->get_action_area()->add(*_labelTotalPages);
+ // Buttons
+ cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true));
+ okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true));
this->add_action_widget(*cancelbutton, Gtk::RESPONSE_CANCEL);
this->add_action_widget(*okbutton, Gtk::RESPONSE_OK);
@@ -218,11 +223,13 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u
// RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows
// therefore attempt to convert uri to the system codepage
// even if this is not possible the alternate short (8.3) file name will be used if available
- uri = g_win32_locale_filename_from_utf8(uri);
+ gchar * converted_uri = g_win32_locale_filename_from_utf8(uri);
+ RVNGFileStream input(converted_uri);
+ g_free(converted_uri);
+ #else
+ RVNGFileStream input(uri);
#endif
- RVNGFileStream input(uri);
-
if (!libcdr::CDRDocument::isSupported(&input)) {
return NULL;
}
diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h
index a6b777d20..6324dafa9 100644
--- a/src/extension/internal/filter/color.h
+++ b/src/extension/internal/filter/color.h
@@ -1480,7 +1480,7 @@ public:
static void init (void) {
Inkscape::Extension::build_from_mem(
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
- "<name>" N_("Quadritone fantasy") "</name>\n"
+ "<name>" N_("Quadritone Fantasy") "</name>\n"
"<id>org.inkscape.effect.filter.Quadritone</id>\n"
"<param name=\"dist\" _gui-text=\"" N_("Hue distribution (°)") "\" type=\"int\" appearance=\"full\" min=\"0\" max=\"360\">280</param>\n"
"<param name=\"colors\" _gui-text=\"" N_("Colors") "\" type=\"int\" appearance=\"full\" min=\"0\" max=\"360\">100</param>\n"
diff --git a/src/extension/internal/filter/protrusions.h b/src/extension/internal/filter/protrusions.h
index ad75d8896..d6fd315db 100644
--- a/src/extension/internal/filter/protrusions.h
+++ b/src/extension/internal/filter/protrusions.h
@@ -45,7 +45,7 @@ public:
static void init (void) {
Inkscape::Extension::build_from_mem(
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
- "<name>" N_("Snow crest") "</name>\n"
+ "<name>" N_("Snow Crest") "</name>\n"
"<id>org.inkscape.effect.filter.snow</id>\n"
"<param name=\"drift\" _gui-text=\"" N_("Drift Size") "\" type=\"float\" appearance=\"full\" min=\"0.0\" max=\"20.0\">3.5</param>\n"
"<effect>\n"
diff --git a/src/extension/internal/metafile-print.cpp b/src/extension/internal/metafile-print.cpp
index 061eb634d..11567ceb3 100644
--- a/src/extension/internal/metafile-print.cpp
+++ b/src/extension/internal/metafile-print.cpp
@@ -355,6 +355,27 @@ int PrintMetafile::hold_gradient(void *gr, int mode)
return 1;
}
+/* behaves like snprintf() but makes sure decimal separators are formatted as dots
+ otherwise invalid strings can be produced depending on the set locale
+*/
+int PrintMetafile::snprintf_dots(char * s, size_t n, const char * format, ...)
+{
+ int nChars;
+
+ char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL));
+ setlocale(LC_NUMERIC, "C");
+
+ va_list argptr;
+ va_start(argptr, format);
+ nChars = vsnprintf(s, n, format, argptr);
+ va_end(argptr);
+
+ setlocale(LC_NUMERIC, oldlocale);
+ g_free(oldlocale);
+
+ return nChars;
+}
+
/* convert from center ellipse to SVGEllipticalArc ellipse
From:
@@ -390,7 +411,8 @@ Geom::PathVector PrintMetafile::center_ellipse_as_SVG_PathV(Geom::Point ctr, dou
y2 = ctr[Y] + sin(F) * rx * cos(M_PI) + cos(F) * ry * sin(M_PI);
char text[256];
- sprintf(text, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z", x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1);
+ snprintf_dots(text, 256, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z",
+ x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1);
Geom::PathVector outres = Geom::parse_svg_path(text);
return outres;
}
@@ -418,9 +440,9 @@ Geom::PathVector PrintMetafile::center_elliptical_ring_as_SVG_PathV(Geom::Point
y22 = ctr[Y] + sin(F) * rx2 * cos(M_PI) + cos(F) * ry2 * sin(M_PI);
char text[512];
- sprintf(text, " M %f,%f A %f %f %f 0 1 %f %f A %f %f %f 0 1 %f %f z M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z",
- x11, y11, rx1, ry1, degrot, x12, y12, rx1, ry1, degrot, x11, y11,
- x21, y21, rx2, ry2, degrot, x22, y22, rx2, ry2, degrot, x21, y21);
+ snprintf_dots(text, 512, " M %f,%f A %f %f %f 0 1 %f %f A %f %f %f 0 1 %f %f z M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z",
+ x11, y11, rx1, ry1, degrot, x12, y12, rx1, ry1, degrot, x11, y11,
+ x21, y21, rx2, ry2, degrot, x22, y22, rx2, ry2, degrot, x21, y21);
Geom::PathVector outres = Geom::parse_svg_path(text);
return outres;
@@ -440,8 +462,8 @@ Geom::PathVector PrintMetafile::center_elliptical_hole_as_SVG_PathV(Geom::Point
y2 = ctr[Y] + sin(F) * rx * cos(M_PI) + cos(F) * ry * sin(M_PI);
char text[256];
- sprintf(text, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z M 50000,50000 50000,-50000 -50000,-50000 -50000,50000 z",
- x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1);
+ snprintf_dots(text, 256, " M %f,%f A %f %f %f 0 0 %f %f A %f %f %f 0 0 %f %f z M 50000,50000 50000,-50000 -50000,-50000 -50000,50000 z",
+ x1, y1, rx, ry, F * 360. / (2.*M_PI), x2, y2, rx, ry, F * 360. / (2.*M_PI), x1, y1);
Geom::PathVector outres = Geom::parse_svg_path(text);
return outres;
}
diff --git a/src/extension/internal/metafile-print.h b/src/extension/internal/metafile-print.h
index d184b72b7..9903cbb98 100644
--- a/src/extension/internal/metafile-print.h
+++ b/src/extension/internal/metafile-print.h
@@ -101,6 +101,7 @@ protected:
static void swapRBinRGBA(char *px, int pixels);
int hold_gradient(void *gr, int mode);
+ static int snprintf_dots(char * s, size_t n, const char * format, ...);
static Geom::PathVector center_ellipse_as_SVG_PathV(Geom::Point ctr, double rx, double ry, double F);
static Geom::PathVector center_elliptical_ring_as_SVG_PathV(Geom::Point ctr, double rx1, double ry1, double rx2, double ry2, double F);
static Geom::PathVector center_elliptical_hole_as_SVG_PathV(Geom::Point ctr, double rx, double ry, double F);
diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp
index 78783aa2d..b7277b99e 100644
--- a/src/extension/internal/vsd-input.cpp
+++ b/src/extension/internal/vsd-input.cpp
@@ -84,6 +84,8 @@ private:
class Gtk::Widget * _previewArea;
class Gtk::Button * cancelbutton;
class Gtk::Button * okbutton;
+
+ class Gtk::HBox * _page_selector_box;
class Gtk::Label * _labelSelect;
class Gtk::Label * _labelTotalPages;
class Gtk::SpinButton * _pageNumberSpin;
@@ -116,10 +118,7 @@ VsdImportDialog::VsdImportDialog(const std::vector<RVNGString> &vec)
this->get_content_area()->pack_start(*vbox1);
// CONTROLS
-
- // Buttons
- cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true));
- okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true));
+ _page_selector_box = Gtk::manage(new Gtk::HBox());
// Labels
_labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:")));
@@ -127,12 +126,7 @@ VsdImportDialog::VsdImportDialog(const std::vector<RVNGString> &vec)
_labelSelect->set_line_wrap(false);
_labelSelect->set_use_markup(false);
_labelSelect->set_selectable(false);
- _labelTotalPages->set_line_wrap(false);
- _labelTotalPages->set_use_markup(false);
- _labelTotalPages->set_selectable(false);
- gchar *label_text = g_strdup_printf(_("out of %i"), num_pages);
- _labelTotalPages->set_label(label_text);
- g_free(label_text);
+ _page_selector_box->pack_start(*_labelSelect, Gtk::PACK_SHRINK);
// Adjustment + spinner
auto _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0);
@@ -141,11 +135,21 @@ VsdImportDialog::VsdImportDialog(const std::vector<RVNGString> &vec)
_pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS);
_pageNumberSpin->set_numeric(true);
_pageNumberSpin->set_wrap(false);
+ _page_selector_box->pack_start(*_pageNumberSpin, Gtk::PACK_SHRINK);
- this->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END);
- this->get_action_area()->add(*_labelSelect);
- this->add_action_widget(*_pageNumberSpin, Gtk::RESPONSE_ACCEPT);
- this->get_action_area()->add(*_labelTotalPages);
+ _labelTotalPages->set_line_wrap(false);
+ _labelTotalPages->set_use_markup(false);
+ _labelTotalPages->set_selectable(false);
+ gchar *label_text = g_strdup_printf(_("out of %i"), num_pages);
+ _labelTotalPages->set_label(label_text);
+ g_free(label_text);
+ _page_selector_box->pack_start(*_labelTotalPages, Gtk::PACK_SHRINK);
+
+ vbox1->pack_end(*_page_selector_box, Gtk::PACK_SHRINK);
+
+ // Buttons
+ cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true));
+ okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true));
this->add_action_widget(*cancelbutton, Gtk::RESPONSE_CANCEL);
this->add_action_widget(*okbutton, Gtk::RESPONSE_OK);
@@ -220,11 +224,13 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u
// RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows
// therefore attempt to convert uri to the system codepage
// even if this is not possible the alternate short (8.3) file name will be used if available
- uri = g_win32_locale_filename_from_utf8(uri);
+ gchar * converted_uri = g_win32_locale_filename_from_utf8(uri);
+ RVNGFileStream input(converted_uri);
+ g_free(converted_uri);
+ #else
+ RVNGFileStream input(uri);
#endif
- RVNGFileStream input(uri);
-
if (!libvisio::VisioDocument::isSupported(&input)) {
return NULL;
}
diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp
index a79af5ec1..42ec2f2bb 100644
--- a/src/extension/internal/wmf-inout.cpp
+++ b/src/extension/internal/wmf-inout.cpp
@@ -1765,11 +1765,20 @@ std::cout << "BEFORE DRAW"
<< " test0 " << ( d->mask & U_DRAW_VISIBLE)
<< " test1 " << ( d->mask & U_DRAW_FORCE)
<< " test2 " << (wmr_mask & U_DRAW_ALTERS)
+ << " test2.5 " << ((d->mask & U_DRAW_NOFILL) != (wmr_mask & U_DRAW_NOFILL) )
<< " test3 " << (wmr_mask & U_DRAW_VISIBLE)
<< " test4 " << !(d->mask & U_DRAW_ONLYTO)
<< " test5 " << ((d->mask & U_DRAW_ONLYTO) && !(wmr_mask & U_DRAW_ONLYTO) )
<< std::endl;
*/
+ /* spurious moveto records should not affect the drawing. However, they set the NOFILL
+ bit and that messes up the logic about when to emit a path. So prune out any
+ stray moveto records. That is those which were never followed by a lineto.
+ */
+ if((d->mask & U_DRAW_NOFILL) && !(d->mask & U_DRAW_VISIBLE) &&
+ !(wmr_mask & U_DRAW_ONLYTO) && (wmr_mask & U_DRAW_VISIBLE)){
+ d->mask ^= U_DRAW_NOFILL;
+ }
if(
(wmr_mask != U_WMR_INVALID) && // next record is valid type
@@ -1777,6 +1786,7 @@ std::cout << "BEFORE DRAW"
(
(d->mask & U_DRAW_FORCE) || // This draw is forced by STROKE/FILL/STROKEANDFILL PATH
(wmr_mask & U_DRAW_ALTERS) || // Next record would alter the drawing environment in some way
+ ((d->mask & U_DRAW_NOFILL) != (wmr_mask & U_DRAW_NOFILL)) || // Fill<->!Fill requires a draw between
( (wmr_mask & U_DRAW_VISIBLE) && // Next record is visible...
(
( !(d->mask & U_DRAW_ONLYTO) ) || // Non *TO records cannot be followed by any Visible
diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp
index 3d913bf1e..6dd9d895e 100644
--- a/src/extension/internal/wmf-print.cpp
+++ b/src/extension/internal/wmf-print.cpp
@@ -598,7 +598,28 @@ int PrintWmf::create_pen(SPStyle const *style, const Geom::Affine &transform)
if (!style->stroke_dasharray.values.empty()) {
if (!FixPPTDashLine) { // if this is set code elsewhere will break dots/dashes into many smaller lines.
- penstyle = U_PS_DASH;// userstyle not supported apparently, for now map all Inkscape dot/dash to just dash
+ int n_dash = style->stroke_dasharray.values.size();
+ /* options are dash, dot, dashdot and dashdotdot. Try to pick the closest one. */
+ int mark_short=INT_MAX;
+ int mark_long =0;
+ int i;
+ for (i=0;i<n_dash;i++) {
+ int mark = style->stroke_dasharray.values[i];
+ if (mark>mark_long) { mark_long = mark; }
+ if (mark<mark_short) { mark_short = mark; }
+ }
+ if(mark_long == mark_short){ // only one mark size
+ penstyle = U_PS_DOT;
+ }
+ else if (n_dash==2) {
+ penstyle = U_PS_DASH;
+ }
+ else if (n_dash==4) {
+ penstyle = U_PS_DASHDOT;
+ }
+ else {
+ penstyle = U_PS_DASHDOTDOT;
+ }
}
}
diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp
index 12457791b..299614c94 100644
--- a/src/extension/internal/wpg-input.cpp
+++ b/src/extension/internal/wpg-input.cpp
@@ -85,10 +85,13 @@ SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u
// RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows
// therefore attempt to convert uri to the system codepage
// even if this is not possible the alternate short (8.3) file name will be used if available
- uri = g_win32_locale_filename_from_utf8(uri);
+ gchar * converted_uri = g_win32_locale_filename_from_utf8(uri);
+ RVNGInputStream* input = new RVNGFileStream(converted_uri);
+ g_free(converted_uri);
+ #else
+ RVNGInputStream* input = new RVNGFileStream(uri);
#endif
- RVNGInputStream* input = new RVNGFileStream(uri);
#if WITH_LIBWPG03
if (input->isStructured()) {
RVNGInputStream* olestream = input->getSubStreamByName("PerfectOffice_MAIN");
diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp
index ca61d8c51..9f8d3dcc0 100644
--- a/src/extension/param/bool.cpp
+++ b/src/extension/param/bool.cpp
@@ -24,9 +24,17 @@
namespace Inkscape {
namespace Extension {
-ParamBool::ParamBool(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(false), _indent(0)
+ParamBool::ParamBool(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml)
+ : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ , _value(false)
{
const char * defaultval = NULL;
if (xml->firstChild() != NULL) {
@@ -39,11 +47,6 @@ ParamBool::ParamBool(const gchar * name, const gchar * guitext, const gchar * de
_value = false;
}
- const char * indent = xml->attribute("indent");
- if (indent != NULL) {
- _indent = atoi(indent) * 12;
- }
-
gchar * pref_name = this->pref_name();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
_value = prefs->getBool(extension_pref_root + pref_name, _value);
@@ -66,7 +69,7 @@ bool ParamBool::set( bool in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node
bool ParamBool::get(const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) const
{
- return _value;
+ return _value;
}
/**
@@ -130,7 +133,7 @@ Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node,
return NULL;
}
- auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4));
+ auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING));
hbox->set_homogeneous(false);
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START));
@@ -139,7 +142,7 @@ Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node,
ParamBoolCheckButton * checkbox = Gtk::manage(new ParamBoolCheckButton(this, doc, node, changeSignal));
checkbox->show();
- hbox->pack_start(*checkbox, false, false, _indent);
+ hbox->pack_start(*checkbox, false, false);
hbox->show();
diff --git a/src/extension/param/bool.h b/src/extension/param/bool.h
index 5d190b9d3..0af12b105 100644
--- a/src/extension/param/bool.h
+++ b/src/extension/param/bool.h
@@ -32,7 +32,15 @@ public:
/**
* Use the superclass' allocator and set the \c _value.
*/
- ParamBool(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);
+ ParamBool(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml);
/**
* Returns the current state/value.
@@ -69,7 +77,6 @@ public:
private:
/** Internal value. */
bool _value;
- int _indent;
};
} // namespace Extension
diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp
index 0b58c5011..fd88e9adb 100644
--- a/src/extension/param/color.cpp
+++ b/src/extension/param/color.cpp
@@ -52,9 +52,17 @@ guint32 ParamColor::set( guint32 in, SPDocument * /*doc*/, Inkscape::XML::Node *
return in;
}
-ParamColor::ParamColor (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),
- _changeSignal(0)
+ParamColor::ParamColor(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml)
+ : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ , _changeSignal(0)
{
const char * defaulthex = NULL;
if (xml->firstChild() != NULL)
@@ -86,7 +94,7 @@ Gtk::Widget *ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node *
{
using Inkscape::UI::Widget::ColorNotebook;
- if (_gui_hidden) return NULL;
+ if (_gui_hidden) return NULL;
if (changeSignal) {
_changeSignal = new sigc::signal<void>(*changeSignal);
@@ -98,9 +106,9 @@ Gtk::Widget *ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node *
_color_changed.block(false);
}
- Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, 4));
+ Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING));
Gtk::Widget *selector = Gtk::manage(new ColorNotebook(_color));
- hbox->pack_start (*selector, true, true, 0);
+ hbox->pack_start(*selector, true, true, 0);
selector->show();
hbox->show();
return hbox;
diff --git a/src/extension/param/color.h b/src/extension/param/color.h
index ed2e57ceb..d6e9d1fbe 100644
--- a/src/extension/param/color.h
+++ b/src/extension/param/color.h
@@ -31,8 +31,15 @@ private:
Inkscape::UI::SelectedColor _color;
sigc::connection _color_changed;
public:
- ParamColor(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);
-
+ ParamColor(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml);
virtual ~ParamColor(void);
/** Returns \c _value, with a \i const to protect it. */
diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp
index 07aaa07cc..3c29b7c49 100644
--- a/src/extension/param/description.cpp
+++ b/src/extension/param/description.cpp
@@ -16,6 +16,7 @@
#include <gtkmm/box.h>
#include <gtkmm/label.h>
#include <glibmm/i18n.h>
+#include <glibmm/markup.h>
#include "xml/node.h"
#include "extension/extension.h"
@@ -26,17 +27,19 @@ 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,
- AppearanceMode mode) :
- Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext),
- _value(NULL), _mode(mode), _indent(0)
+ParamDescription::ParamDescription(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml,
+ AppearanceMode mode)
+ : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ , _value(NULL)
+ , _mode(mode)
{
// printf("Building Description\n");
const char * defaultval = NULL;
@@ -50,11 +53,6 @@ ParamDescription::ParamDescription (const gchar * name,
_context = xml->attribute("msgctxt");
- const char * indent = xml->attribute("indent");
- if (indent != NULL) {
- _indent = atoi(indent) * 12;
- }
-
return;
}
@@ -76,23 +74,40 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node
} else {
newguitext = _(_value);
}
-
- Gtk::Label * label;
- int padding = 12 + _indent;
+
+ Gtk::Label * label = Gtk::manage(new Gtk::Label());
if (_mode == HEADER) {
- label = Gtk::manage(new Gtk::Label(Glib::ustring("<b>") +newguitext + Glib::ustring("</b>"), Gtk::ALIGN_START));
- label->set_margin_top(5);
- label->set_margin_bottom(5);
- label->set_use_markup(true);
- padding = _indent;
+ label->set_markup(Glib::ustring("<b>") + Glib::Markup::escape_text(newguitext) + Glib::ustring("</b>"));
+ label->set_margin_top(5);
+ label->set_margin_bottom(5);
+ } else if (_mode == URL) {
+ Glib::ustring escaped_url = Glib::Markup::escape_text(newguitext);
+ label->set_markup(Glib::ustring::compose("<a href='%1'>%1</a>", escaped_url));
} else {
- label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_START));
+ label->set_text(newguitext);
}
label->set_line_wrap();
+#if (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION >= 16)
+ label->set_xalign(0);
+#else
+ label->set_alignment(Gtk::ALIGN_START);
+#endif
+
+ // TODO: Ugly "fix" for gtk3 width/height calculation of labels.
+ // - If not applying any limits long labels will make the window grow horizontally until it uses up
+ // most of the available space (i.e. most of the screen area) which is ridicously wide
+ // - By using "set_default_size(0,0)" in prefidalog.cpp we tell the window to shrink as much as possible,
+ // however this can result in a much to narrow dialog instead and much unnecessary wrapping
+ // - Here we set a lower limit of GUI_MAX_LINE_LENGTH characters per line that long texts will always use
+ // This means texts can not shrink anymore (they can still grow, though) and it's also necessary
+ // to prevent https://bugzilla.gnome.org/show_bug.cgi?id=773572
+ int len = newguitext.length();
+ label->set_width_chars(len > Parameter::GUI_MAX_LINE_LENGTH ? Parameter::GUI_MAX_LINE_LENGTH : len);
+
label->show();
- Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
- hbox->pack_start(*label, true, true, padding);
+ Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox());
+ hbox->pack_start(*label, true, true);
hbox->show();
return hbox;
diff --git a/src/extension/param/description.h b/src/extension/param/description.h
index 3a72c4112..c6c5f4013 100644
--- a/src/extension/param/description.h
+++ b/src/extension/param/description.h
@@ -27,23 +27,24 @@ namespace Extension {
class ParamDescription : public Parameter {
public:
enum AppearanceMode {
- DESC, HEADER
+ DESC, HEADER, URL
};
ParamDescription(const gchar * name,
const gchar * guitext,
const gchar * desc,
const Parameter::_scope_t scope,
bool gui_hidden,
- const gchar * gui_tip,
+ const gchar * gui_tip,
+ int indent,
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;
- int _indent;
const gchar* _context;
};
diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp
index 8bc0fbda7..a26458c35 100644
--- a/src/extension/param/enum.cpp
+++ b/src/extension/param/enum.cpp
@@ -46,12 +46,17 @@ public:
};
-ParamComboBox::ParamComboBox(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)
+ParamComboBox::ParamComboBox(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml)
+ : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
, _value(NULL)
- , _indent(0)
, choices(NULL)
{
const char *xmlval = NULL; // the value stored in XML
@@ -94,17 +99,12 @@ ParamComboBox::ParamComboBox(const gchar *name, const gchar *guitext, const gcha
}
}
}
-
+
// Initialize _value with the default value from xml
// for simplicity : default to the contents of the first xml-child
if (xml->firstChild() && xml->firstChild()->firstChild()) {
xmlval = xml->firstChild()->attribute("value");
}
-
- const char *indent = xml->attribute("indent");
- if (indent != NULL) {
- _indent = atoi(indent) * 12;
- }
}
gchar * pref_name = this->pref_name();
@@ -250,10 +250,10 @@ Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * n
return NULL;
}
- Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
+ Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING));
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START));
label->show();
- hbox->pack_start(*label, false, false, _indent);
+ hbox->pack_start(*label, false, false);
ParamComboBoxEntry * combo = Gtk::manage(new ParamComboBoxEntry(this, doc, node, changeSignal));
// add choice strings:
diff --git a/src/extension/param/enum.h b/src/extension/param/enum.h
index 52e018469..f9d3d75f7 100644
--- a/src/extension/param/enum.h
+++ b/src/extension/param/enum.h
@@ -34,12 +34,20 @@ private:
been allocated in memory. And should be free'd.
It is the value of the current selected string */
gchar * _value;
- int _indent;
GSList * choices; /**< A table to store the choice strings */
public:
- ParamComboBox(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);
+ ParamComboBox(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml);
virtual ~ParamComboBox(void);
+
Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
// Explicitly call superclass version to avoid method being hidden.
diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp
index 23a03ea8f..e3fdba826 100644
--- a/src/extension/param/float.cpp
+++ b/src/extension/param/float.cpp
@@ -27,17 +27,21 @@ namespace Extension {
/** Use the superclass' allocator and set the \c _value. */
-ParamFloat::ParamFloat (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(0.0), _mode(mode), _indent(0), _min(0.0), _max(10.0)
+ParamFloat::ParamFloat(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml,
+ AppearanceMode mode)
+ : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ , _value(0.0)
+ , _mode(mode)
+ , _min(0.0)
+ , _max(10.0)
{
const gchar * defaultval = NULL;
if (xml->firstChild() != NULL) {
@@ -69,11 +73,6 @@ ParamFloat::ParamFloat (const gchar * name,
_min = 0.0;
}
- const char * indent = xml->attribute("indent");
- if (indent != NULL) {
- _indent = atoi(indent) * 12;
- }
-
gchar * pref_name = this->pref_name();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
_value = prefs->getDouble(extension_pref_root + pref_name, _value);
@@ -175,24 +174,24 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod
return NULL;
}
- Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
+ Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING));
auto pfa = new ParamFloatAdjustment(this, doc, node, changeSignal);
Glib::RefPtr<Gtk::Adjustment> fadjust(pfa);
-
+
if (_mode == FULL) {
UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, _precision);
scale->set_size_request(400, -1);
scale->show();
- hbox->pack_start(*scale, false, false);
+ hbox->pack_start(*scale, true, true);
}
else if (_mode == MINIMAL) {
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START));
label->show();
- hbox->pack_start(*label, true, true, _indent);
+ hbox->pack_start(*label, true, true);
auto spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 0.1, _precision));
spin->show();
diff --git a/src/extension/param/float.h b/src/extension/param/float.h
index 42b1698b1..7fd86cea7 100644
--- a/src/extension/param/float.h
+++ b/src/extension/param/float.h
@@ -29,15 +29,17 @@ public:
enum AppearanceMode {
FULL, MINIMAL
};
- ParamFloat (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);
+ ParamFloat(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml,
+ AppearanceMode mode);
+
/** Returns \c _value. */
float get(const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) const { return _value; }
@@ -60,7 +62,6 @@ private:
/** Internal value. */
float _value;
AppearanceMode _mode;
- int _indent;
float _min;
float _max;
int _precision;
diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp
index 222d4f243..538ddc08d 100644
--- a/src/extension/param/int.cpp
+++ b/src/extension/param/int.cpp
@@ -27,17 +27,21 @@ namespace Extension {
/** Use the superclass' allocator and set the \c _value. */
-ParamInt::ParamInt (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(0), _mode(mode), _indent(0), _min(0), _max(10)
+ParamInt::ParamInt(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml,
+ AppearanceMode mode)
+ : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ , _value(0)
+ , _mode(mode)
+ , _min(0)
+ , _max(10)
{
const char * defaultval = NULL;
if (xml->firstChild() != NULL) {
@@ -62,11 +66,6 @@ ParamInt::ParamInt (const gchar * name,
_min = 0;
}
- const char * indent = xml->attribute("indent");
- if (indent != NULL) {
- _indent = atoi(indent) * 12;
- }
-
gchar *pref_name = this->pref_name();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
_value = prefs->getInt(extension_pref_root + pref_name, _value);
@@ -156,7 +155,7 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal
return NULL;
}
- Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
+ Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING));
auto pia = new ParamIntAdjustment(this, doc, node, changeSignal);
Glib::RefPtr<Gtk::Adjustment> fadjust(pia);
@@ -166,13 +165,13 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal
UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, 0);
scale->set_size_request(400, -1);
scale->show();
- hbox->pack_start(*scale, false, false);
+ hbox->pack_start(*scale, true, true);
}
else if (_mode == MINIMAL) {
-
+
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START));
label->show();
- hbox->pack_start(*label, true, true, _indent);
+ hbox->pack_start(*label, true, true);
auto spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 1.0, 0));
spin->show();
diff --git a/src/extension/param/int.h b/src/extension/param/int.h
index 3fd6cea9b..40c0395ec 100644
--- a/src/extension/param/int.h
+++ b/src/extension/param/int.h
@@ -29,15 +29,16 @@ public:
enum AppearanceMode {
FULL, MINIMAL
};
- ParamInt (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);
+ ParamInt(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml,
+ AppearanceMode mode);
/** Returns \c _value. */
int get(const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) const { return _value; }
@@ -59,7 +60,6 @@ private:
/** Internal value. */
int _value;
AppearanceMode _mode;
- int _indent;
int _min;
int _max;
};
diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp
index 957d12d06..de86d1005 100644
--- a/src/extension/param/notebook.cpp
+++ b/src/extension/param/notebook.cpp
@@ -54,8 +54,16 @@ private:
public:
static ParamNotebookPage * makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext);
- ParamNotebookPage(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);
+ ParamNotebookPage(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);
~ParamNotebookPage(void);
+
Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
void paramString (std::list <std::string> &list);
gchar * get_guitext (void) {return _text;};
@@ -63,8 +71,15 @@ public:
}; /* class ParamNotebookPage */
-ParamNotebookPage::ParamNotebookPage (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)
+ParamNotebookPage::ParamNotebookPage(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, /*indent*/ 0, ext)
{
parameters = NULL;
@@ -199,16 +214,23 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod
}
Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox);
- vbox->set_border_width(5);
+ vbox->set_border_width(Parameter::GUI_BOX_MARGIN);
+ vbox->set_spacing(Parameter::GUI_BOX_SPACING);
// add parameters onto page (if any)
for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) {
Parameter * param = reinterpret_cast<Parameter *>(list->data);
Gtk::Widget * widg = param->get_widget(doc, node, changeSignal);
if (widg) {
+ int indent = param->get_indent();
+#if GTK_CHECK_VERSION(3,12,0)
+ widg->set_margin_start(indent * Parameter::GUI_INDENTATION);
+#else
+ widg->set_margin_left(indent * Parameter::GUI_INDENTATION);
+#endif
+ vbox->pack_start(*widg, false, false, 0);
+
gchar const * tip = param->get_tooltip();
- // printf("Tip: '%s'\n", tip);
- vbox->pack_start(*widg, false, false, 2);
if (tip) {
widg->set_tooltip_text(_(tip));
} else {
@@ -224,8 +246,16 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod
}
-ParamNotebook::ParamNotebook (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)
+ParamNotebook::ParamNotebook(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml)
+ : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
{
pages = NULL;
diff --git a/src/extension/param/notebook.h b/src/extension/param/notebook.h
index 3c90964fd..278c4de12 100644
--- a/src/extension/param/notebook.h
+++ b/src/extension/param/notebook.h
@@ -41,8 +41,17 @@ private:
This only gets created if there are pages in this
notebook */
public:
- ParamNotebook(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);
+ ParamNotebook(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml);
virtual ~ParamNotebook(void);
+
Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
/**
diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp
index a5632a39a..0eb491078 100644
--- a/src/extension/param/parameter.cpp
+++ b/src/extension/param/parameter.cpp
@@ -50,10 +50,17 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex
const char *name = in_repr->attribute("name");
const char *type = in_repr->attribute("type");
- // In this case we just don't have enough information
- if (!name || !type) {
+ // we can't create a parameter without type
+ if (!type) {
return NULL;
}
+ // also require name unless it's a pure UI element that does not store its value
+ if (!name) {
+ static std::vector<std::string> ui_elements = {"description"};
+ if (std::find(ui_elements.begin(), ui_elements.end(), type) == ui_elements.end()) {
+ return NULL;
+ }
+ }
const char *guitext = in_repr->attribute("gui-text");
if (guitext == NULL) {
@@ -78,6 +85,17 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex
/* else stays false */
}
}
+ int indent = 0;
+ {
+ const char *indent_attr = in_repr->attribute("indent");
+ if (indent_attr != NULL) {
+ if (strcmp(indent_attr, "true") == 0) {
+ indent = 1;
+ } else {
+ indent = atoi(indent_attr);
+ }
+ }
+ }
const gchar* appearance = in_repr->attribute("appearance");
Parameter::_scope_t scope = Parameter::SCOPE_USER;
@@ -96,44 +114,48 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex
Parameter * param = NULL;
if (!strcmp(type, "boolean")) {
- param = new ParamBool(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
+ param = new ParamBool(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr);
} else if (!strcmp(type, "int")) {
if (appearance && !strcmp(appearance, "full")) {
- param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamInt::FULL);
+ param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamInt::FULL);
} else {
- param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamInt::MINIMAL);
+ param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamInt::MINIMAL);
}
} else if (!strcmp(type, "float")) {
if (appearance && !strcmp(appearance, "full")) {
- param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamFloat::FULL);
+ param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamFloat::FULL);
} else {
- param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamFloat::MINIMAL);
+ param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamFloat::MINIMAL);
}
} else if (!strcmp(type, "string")) {
- param = new ParamString(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
+ param = new ParamString(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr);
gchar const * max_length = in_repr->attribute("max_length");
if (max_length != NULL) {
ParamString * ps = dynamic_cast<ParamString *>(param);
ps->setMaxLength(atoi(max_length));
}
} else if (!strcmp(type, "description")) {
- 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);
- }
+ ParamDescription::AppearanceMode appearance_mode = ParamDescription::DESC;
+ if (appearance) {
+ if (!strcmp(appearance, "header")) {
+ appearance_mode = ParamDescription::HEADER;
+ } else if (!strcmp(appearance, "url")) {
+ appearance_mode = ParamDescription::URL;
+ }
+ }
+ param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, appearance_mode);
} else if (!strcmp(type, "enum")) {
- param = new ParamComboBox(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
+ param = new ParamComboBox(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr);
} else if (!strcmp(type, "notebook")) {
- param = new ParamNotebook(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
+ param = new ParamNotebook(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr);
} else if (!strcmp(type, "optiongroup")) {
if (appearance && !strcmp(appearance, "minimal")) {
- param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamRadioButton::MINIMAL);
+ param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamRadioButton::MINIMAL);
} else {
- param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr, ParamRadioButton::FULL);
+ param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamRadioButton::FULL);
}
} else if (!strcmp(type, "color")) {
- param = new ParamColor(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
+ param = new ParamColor(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr);
}
// Note: param could equal NULL
@@ -280,12 +302,13 @@ Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node)
/** Oop, now that we need a parameter, we need it's name. */
-Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * desc, const Parameter::_scope_t scope, bool gui_hidden, gchar const * gui_tip, Inkscape::Extension::Extension * ext) :
+Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * desc, const Parameter::_scope_t scope, bool gui_hidden, gchar const * gui_tip, int indent, Inkscape::Extension::Extension * ext) :
_desc(0),
_scope(scope),
_text(0),
_gui_hidden(gui_hidden),
_gui_tip(0),
+ _indent(indent),
extension(ext),
_name(0)
{
@@ -316,6 +339,7 @@ Parameter::Parameter (gchar const * name, gchar const * guitext, Inkscape::Exten
_text(0),
_gui_hidden(false),
_gui_tip(0),
+ _indent(0),
extension(ext),
_name(0)
{
diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h
index 5e1e3897f..c107f24f9 100644
--- a/src/extension/param/parameter.h
+++ b/src/extension/param/parameter.h
@@ -37,7 +37,7 @@ class Extension;
*/
extern Glib::ustring const extension_pref_root;
-/**
+/**
* A class to represent the parameter of an extension.
*
* This is really a super class that allows them to abstract all
@@ -62,6 +62,7 @@ public:
const Parameter::_scope_t scope,
bool gui_hidden,
gchar const *gui_tip,
+ int indent,
Inkscape::Extension::Extension * ext);
Parameter(gchar const *name,
@@ -144,6 +145,9 @@ public:
/** Indicates if the GUI for this parameter is hidden or not */
bool get_gui_hidden() const { return _gui_hidden; }
+ /** Indentation level of the parameter */
+ int get_indent() const { return _indent; }
+
virtual void string(std::list <std::string> &list) const;
/**
@@ -155,6 +159,19 @@ public:
/** All the code in Notebook::get_param to get the notebook content. */
virtual Parameter *get_param(gchar const *name);
+
+ /** Recommended margin of boxes containing multiple Parameters (in px) */
+ const static int GUI_BOX_MARGIN = 10;
+ /** Recommended spacing between multiple Parameters packed into a box (in px) */
+ const static int GUI_BOX_SPACING = 4;
+ /** Recommended spacing between the widgets making up a signle Parameter (e.g. label and input) (in px) */
+ const static int GUI_PARAM_WIDGETS_SPACING = 4;
+ /** Recommended indentation width of parameters (in px) */
+ const static int GUI_INDENTATION = 12;
+ /** Recommended maximum line lenght for wrapping textual parameters (in chars) */
+ const static int GUI_MAX_LINE_LENGTH = 60;
+
+
protected:
/** Description of the parameter. */
gchar * _desc;
@@ -171,6 +188,9 @@ protected:
/** A tip for the GUI if there is one. */
gchar * _gui_tip;
+ /** Indentation level of the parameter. */
+ int _indent;
+
/* **** funcs **** */
diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp
index c54cc0ec3..178dc20e8 100644
--- a/src/extension/param/radiobutton.cpp
+++ b/src/extension/param/radiobutton.cpp
@@ -57,17 +57,20 @@ public:
Glib::ustring * guitext;
};
-ParamRadioButton::ParamRadioButton (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(0), _mode(mode), _indent(0), choices(0)
+ParamRadioButton::ParamRadioButton(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml,
+ AppearanceMode mode)
+ : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ , _value(0)
+ , _mode(mode)
+ , choices(0)
{
// Read XML tree to add enumeration items:
// printf("Extension Constructor: ");
@@ -118,11 +121,6 @@ ParamRadioButton::ParamRadioButton (const gchar * name,
defaultval = (static_cast<optionentry*> (choices->data))->value->c_str();
}
- const char *indent = xml ? xml->attribute("indent") : NULL;
- if (indent != NULL) {
- _indent = atoi(indent) * 12;
- }
-
gchar * pref_name = this->pref_name();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
Glib::ustring paramval = prefs->getString(extension_pref_root + pref_name);
@@ -303,14 +301,14 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node
return NULL;
}
- auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4));
+ auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING));
hbox->set_homogeneous(false);
auto vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
vbox->set_homogeneous(false);
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START, Gtk::ALIGN_START));
label->show();
- hbox->pack_start(*label, false, false, _indent);
+ hbox->pack_start(*label, false, false);
Gtk::ComboBoxText* cbt = 0;
bool comboSet = false;
diff --git a/src/extension/param/radiobutton.h b/src/extension/param/radiobutton.h
index 0e0f643c9..5e15dcb57 100644
--- a/src/extension/param/radiobutton.h
+++ b/src/extension/param/radiobutton.h
@@ -40,10 +40,12 @@ public:
const Parameter::_scope_t scope,
bool gui_hidden,
const gchar * gui_tip,
+ int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml,
AppearanceMode mode);
virtual ~ParamRadioButton(void);
+
Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
// Explicitly call superclass version to avoid method being hidden.
@@ -63,7 +65,6 @@ private:
It is the value of the current selected string */
gchar * _value;
AppearanceMode _mode;
- int _indent;
GSList * choices; /**< A table to store the choice strings */
}; /* class ParamRadioButton */
diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp
index 1d9205502..0c5238f99 100644
--- a/src/extension/param/string.cpp
+++ b/src/extension/param/string.cpp
@@ -24,7 +24,7 @@
namespace Inkscape {
namespace Extension {
-
+
/** Free the allocated data. */
ParamString::~ParamString(void)
@@ -76,20 +76,23 @@ void ParamString::string(std::string &string) const
}
/** Initialize the object, to do that, copy the data. */
-ParamString::ParamString (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), _indent(0)
+ParamString::ParamString(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml)
+ : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ , _value(NULL)
{
const char * defaultval = NULL;
if (xml->firstChild() != NULL) {
defaultval = xml->firstChild()->content();
}
- const char * indent = xml->attribute("indent");
- if (indent != NULL) {
- _indent = atoi(indent) * 12;
- }
-
gchar * pref_name = this->pref_name();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
Glib::ustring paramval = prefs->getString(extension_pref_root + pref_name);
@@ -165,10 +168,10 @@ Gtk::Widget * ParamString::get_widget(SPDocument * doc, Inkscape::XML::Node * no
return NULL;
}
- Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
+ Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING));
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START));
label->show();
- hbox->pack_start(*label, false, false, _indent);
+ hbox->pack_start(*label, false, false);
ParamStringEntry * textbox = new ParamStringEntry(this, doc, node, changeSignal);
textbox->show();
diff --git a/src/extension/param/string.h b/src/extension/param/string.h
index 3b137aeac..f5412ebcc 100644
--- a/src/extension/param/string.h
+++ b/src/extension/param/string.h
@@ -19,12 +19,19 @@ private:
/** \brief Internal value. This should point to a string that has
been allocated in memory. And should be free'd. */
gchar * _value;
- /** \brief Internal value. This indicates the maximum leght of the string. Zero meaning unlimited.
+ /** \brief Internal value. This indicates the maximum lenth of the string. Zero meaning unlimited.
*/
- int _indent;
gint _max_length;
public:
- ParamString(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);
+ ParamString(const gchar * name,
+ const gchar * guitext,
+ const gchar * desc,
+ const Parameter::_scope_t scope,
+ bool gui_hidden,
+ const gchar * gui_tip,
+ int indent,
+ Inkscape::Extension::Extension * ext,
+ Inkscape::XML::Node * xml);
virtual ~ParamString(void);
/** \brief Returns \c _value, with a \i const to protect it. */
diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp
index fcc88853d..2bdbb081e 100644
--- a/src/extension/prefdialog.cpp
+++ b/src/extension/prefdialog.cpp
@@ -50,6 +50,8 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co
_effect(effect),
_exEnv(NULL)
{
+ this->set_default_size(0,0); // we want the window to be as small as possible instead of clobbering up space
+
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox());
if (controls == NULL) {
if (_effect == NULL) {
@@ -59,11 +61,10 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co
controls = _effect->get_imp()->prefs_effect(_effect, SP_ACTIVE_DESKTOP, &_signal_param_change, NULL);
_signal_param_change.connect(sigc::mem_fun(this, &PrefDialog::param_change));
}
-
- hbox->pack_start(*controls, true, true, 6);
+ hbox->pack_start(*controls, true, true, 0);
hbox->show();
- this->get_content_area()->pack_start(*hbox, true, true, 6);
+ this->get_content_area()->pack_start(*hbox, true, true, 0);
/*
Gtk::Button * help_button = add_button(Gtk::Stock::HELP, Gtk::RESPONSE_HELP);
@@ -88,15 +89,16 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co
auto sep = Gtk::manage(new Gtk::Separator());
sep->show();
- this->get_content_area()->pack_start(*sep, true, true, 4);
+ this->get_content_area()->pack_start(*sep, false, false, Parameter::GUI_BOX_SPACING);
hbox = Gtk::manage(new Gtk::HBox());
+ hbox->set_border_width(Parameter::GUI_BOX_MARGIN);
_button_preview = _param_preview->get_widget(NULL, NULL, &_signal_preview);
_button_preview->show();
- hbox->pack_start(*_button_preview, true, true,6);
+ hbox->pack_start(*_button_preview, true, true, 0);
hbox->show();
- this->get_content_area()->pack_start(*hbox, true, true, 6);
+ this->get_content_area()->pack_start(*hbox, false, false, 0);
Gtk::Box * hbox = dynamic_cast<Gtk::Box *>(_button_preview);
if (hbox != NULL) {