summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2017-04-26 09:16:33 +0000
committerjabiertxof <info@marker.es>2017-04-26 09:16:33 +0000
commitb84137c431a7e236131f71a17f8f2c71e26c6162 (patch)
tree04cbe26ab83d5a7ddf1fde8d2da153cc9039306b /src
parentAllow set and reset default values of LPE parameters (diff)
parentImprove 0.92 support for Clone Original LPE (diff)
downloadinkscape-b84137c431a7e236131f71a17f8f2c71e26c6162.tar.gz
inkscape-b84137c431a7e236131f71a17f8f2c71e26c6162.zip
Update to trunk
(bzr r15620.1.2)
Diffstat (limited to 'src')
-rw-r--r--src/extension/extension.cpp8
-rw-r--r--src/extension/internal/bluredge.cpp4
-rw-r--r--src/extension/param/bool.cpp15
-rw-r--r--src/extension/param/bool.h8
-rw-r--r--src/extension/param/color.cpp12
-rw-r--r--src/extension/param/color.h8
-rw-r--r--src/extension/param/description.cpp80
-rw-r--r--src/extension/param/description.h12
-rw-r--r--src/extension/param/enum.cpp48
-rw-r--r--src/extension/param/enum.h12
-rw-r--r--src/extension/param/float.cpp17
-rw-r--r--src/extension/param/float.h8
-rw-r--r--src/extension/param/int.cpp18
-rw-r--r--src/extension/param/int.h8
-rw-r--r--src/extension/param/notebook.cpp87
-rw-r--r--src/extension/param/notebook.h8
-rw-r--r--src/extension/param/parameter.cpp128
-rw-r--r--src/extension/param/parameter.h42
-rw-r--r--src/extension/param/radiobutton.cpp38
-rw-r--r--src/extension/param/radiobutton.h8
-rw-r--r--src/extension/param/string.cpp14
-rw-r--r--src/extension/param/string.h8
-rw-r--r--src/extension/prefdialog.cpp2
-rw-r--r--src/io/sys.cpp76
-rw-r--r--src/livarot/PathOutline.cpp6
-rw-r--r--src/live_effects/lpe-clone-original.cpp39
-rw-r--r--src/live_effects/lpe-clone-original.h3
-rw-r--r--src/live_effects/lpe-copy_rotate.cpp281
-rw-r--r--src/live_effects/lpe-copy_rotate.h19
-rw-r--r--src/live_effects/parameter/point.cpp19
-rw-r--r--src/live_effects/parameter/point.h2
-rw-r--r--src/main.cpp31
-rw-r--r--src/text-editing.cpp6
-rw-r--r--src/ui/clipboard.cpp2
-rw-r--r--src/ui/widget/color-scales.cpp1
-rw-r--r--src/ui/widget/rotateable.cpp1
-rw-r--r--src/ui/widget/selected-style.cpp10
-rw-r--r--src/ui/widget/selected-style.h3
38 files changed, 467 insertions, 625 deletions
diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp
index 6c6e2d71e..497f98431 100644
--- a/src/extension/extension.cpp
+++ b/src/extension/extension.cpp
@@ -701,7 +701,7 @@ public:
#endif
this->pack_start(*widg, false, false, 0);
if (tooltip) {
- widg->set_tooltip_text(_(tooltip));
+ widg->set_tooltip_text(tooltip);
} else {
widg->set_tooltip_text("");
widg->set_has_tooltip(false);
@@ -718,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_hidden = true NULL is returned as well.
*/
Gtk::Widget *
Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
@@ -732,7 +732,7 @@ Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<v
//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)) {
Parameter * param = reinterpret_cast<Parameter *>(list->data);
- if (param->get_gui_hidden()) continue; //Ignore hidden parameters
+ if (param->get_hidden()) continue; //Ignore hidden parameters
Gtk::Widget * widg = param->get_widget(doc, node, changeSignal);
gchar const * tip = param->get_tooltip();
int indent = param->get_indent();
@@ -837,7 +837,7 @@ 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++;
+ if (!param->get_hidden()) _visible_count++;
}
return _visible_count;
}
diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp
index 8aa982810..d1fe357da 100644
--- a/src/extension/internal/bluredge.cpp
+++ b/src/extension/internal/bluredge.cpp
@@ -131,8 +131,8 @@ BlurEdge::init (void)
"<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
"<name>" N_("Inset/Outset Halo") "</name>\n"
"<id>org.inkscape.effect.bluredge</id>\n"
- "<param name=\"blur-width\" _gui-text=\"" N_("Width:") "\" gui-description=\"" N_("Width in px of the halo") "\" scope=\"document\" type=\"float\" min=\"1.0\" max=\"50.0\">1.0</param>\n"
- "<param name=\"num-steps\" _gui-text=\"" N_("Number of steps:") "\" gui-description=\"" N_("Number of inset/outset copies of the object to make") "\" scope=\"document\" type=\"int\" min=\"5\" max=\"100\">11</param>\n"
+ "<param name=\"blur-width\" _gui-text=\"" N_("Width:") "\" gui-description=\"" N_("Width in px of the halo") "\" type=\"float\" min=\"1.0\" max=\"50.0\">1.0</param>\n"
+ "<param name=\"num-steps\" _gui-text=\"" N_("Number of steps:") "\" gui-description=\"" N_("Number of inset/outset copies of the object to make") "\" type=\"int\" min=\"5\" max=\"100\">11</param>\n"
"<effect>\n"
"<object-type>all</object-type>\n"
"<effects-menu>\n"
diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp
index 9f8d3dcc0..2c7e32480 100644
--- a/src/extension/param/bool.cpp
+++ b/src/extension/param/bool.cpp
@@ -14,7 +14,6 @@
#include <gtkmm/box.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/checkbutton.h>
-#include <glib/gi18n.h>
#include "xml/node.h"
#include "../extension.h"
@@ -25,15 +24,13 @@ 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,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml)
- : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ : Parameter(name, text, description, hidden, indent, ext)
, _value(false)
{
const char * defaultval = NULL;
@@ -129,14 +126,14 @@ void ParamBool::string(std::string &string) const
Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
- if (_gui_hidden) {
+ if (_hidden) {
return NULL;
}
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));
+ Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START));
label->show();
hbox->pack_end(*label, true, true);
diff --git a/src/extension/param/bool.h b/src/extension/param/bool.h
index 0af12b105..826a98927 100644
--- a/src/extension/param/bool.h
+++ b/src/extension/param/bool.h
@@ -33,11 +33,9 @@ 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,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml);
diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp
index fd88e9adb..035c43ba8 100644
--- a/src/extension/param/color.cpp
+++ b/src/extension/param/color.cpp
@@ -53,15 +53,13 @@ guint32 ParamColor::set( guint32 in, SPDocument * /*doc*/, Inkscape::XML::Node *
}
ParamColor::ParamColor(const gchar * name,
- const gchar * guitext,
- const gchar * desc,
- const Parameter::_scope_t scope,
- bool gui_hidden,
- const gchar * gui_tip,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml)
- : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ : Parameter(name, text, description, hidden, indent, ext)
, _changeSignal(0)
{
const char * defaulthex = NULL;
@@ -94,7 +92,7 @@ Gtk::Widget *ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node *
{
using Inkscape::UI::Widget::ColorNotebook;
- if (_gui_hidden) return NULL;
+ if (_hidden) return NULL;
if (changeSignal) {
_changeSignal = new sigc::signal<void>(*changeSignal);
diff --git a/src/extension/param/color.h b/src/extension/param/color.h
index d6e9d1fbe..890f5ba5f 100644
--- a/src/extension/param/color.h
+++ b/src/extension/param/color.h
@@ -32,11 +32,9 @@ private:
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,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml);
diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp
index 480a0898a..cf94918f7 100644
--- a/src/extension/param/description.cpp
+++ b/src/extension/param/description.cpp
@@ -29,41 +29,60 @@ 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,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml,
AppearanceMode mode)
- : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ : Parameter(name, text, description, hidden, indent, ext)
, _value(NULL)
, _mode(mode)
- , _preserve_whitespace(false)
{
- Glib::ustring defaultval;
+ // construct the text content by concatenating all (non-empty) text nodes,
+ // removing all other nodes (e.g. comment nodes) and replacing <extension:br> elements with "<br/>"
+ Glib::ustring value;
Inkscape::XML::Node * cur_child = xml->firstChild();
while (cur_child != NULL) {
if (cur_child->type() == XML::TEXT_NODE && cur_child->content() != NULL) {
- defaultval += cur_child->content();
+ value += cur_child->content();
} else if (cur_child->type() == XML::ELEMENT_NODE && !g_strcmp0(cur_child->name(), "extension:br")) {
- defaultval += "<br/>";
+ value += "<br/>";
}
cur_child = cur_child->next();
}
- if (defaultval != Glib::ustring("")) {
- _value = g_strdup(defaultval.c_str());
+ // if there is no text content we can return immediately (the description will be invisible)
+ if (value == Glib::ustring("")) {
+ return;
}
- _context = xml->attribute("msgctxt");
-
+ // do replacements in the source string to account for the attribute xml:space="preserve"
+ // (those should match replacements potentially performed by xgettext to allow for proper translation)
if (g_strcmp0(xml->attribute("xml:space"), "preserve") == 0) {
- _preserve_whitespace = true;
+ // xgettext copies the source string verbatim in this case, so no changes needed
+ } else {
+ // remove all whitespace from start/end of string and replace intermediate whitespace with a single space
+ value = Glib::Regex::create("^\\s+|\\s+$")->replace_literal(value, 0, "", (Glib::RegexMatchFlags)0);
+ value = Glib::Regex::create("\\s+")->replace_literal(value, 0, " ", (Glib::RegexMatchFlags)0);
+ }
+
+ // translate if underscored version (_param) was used
+ if (g_str_has_prefix(xml->name(), "extension:_")) {
+ const gchar * context = xml->attribute("msgctxt");
+ if (context != NULL) {
+ value = g_dpgettext2(NULL, context, value.c_str());
+ } else {
+ value = _(value.c_str());
+ }
}
+ // finally replace all remaining <br/> with a real newline character
+ value = Glib::Regex::create("<br/>")->replace_literal(value, 0, "\n", (Glib::RegexMatchFlags)0);
+
+ _value = g_strdup(value.c_str());
+
return;
}
@@ -71,44 +90,25 @@ ParamDescription::ParamDescription(const gchar * name,
Gtk::Widget *
ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/)
{
- if (_gui_hidden) {
+ if (_hidden) {
return NULL;
}
if (_value == NULL) {
return NULL;
}
- Glib::ustring newguitext = _value;
-
- // do replacements in the source string matching those performed by xgettext to allow for proper translation
- if (_preserve_whitespace) {
- // xgettext copies the source string verbatim in this case, so no changes needed
- } else {
- // remove all whitespace from start/end of string and replace intermediate whitespace with a single space
- newguitext = Glib::Regex::create("^\\s+|\\s+$")->replace_literal(newguitext, 0, "", (Glib::RegexMatchFlags)0);
- newguitext = Glib::Regex::create("\\s+")->replace_literal(newguitext, 0, " ", (Glib::RegexMatchFlags)0);
- }
-
- // translate
- if (_context != NULL) {
- newguitext = g_dpgettext2(NULL, _context, newguitext.c_str());
- } else {
- newguitext = _(newguitext.c_str());
- }
-
- // finally replace all remaining <br/> with a real newline character
- newguitext = Glib::Regex::create("<br/>")->replace_literal(newguitext, 0, "\n", (Glib::RegexMatchFlags)0);
+ Glib::ustring newtext = _value;
Gtk::Label * label = Gtk::manage(new Gtk::Label());
if (_mode == HEADER) {
- label->set_markup(Glib::ustring("<b>") + Glib::Markup::escape_text(newguitext) + Glib::ustring("</b>"));
+ label->set_markup(Glib::ustring("<b>") + Glib::Markup::escape_text(newtext) + 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);
+ Glib::ustring escaped_url = Glib::Markup::escape_text(newtext);
label->set_markup(Glib::ustring::compose("<a href='%1'>%1</a>", escaped_url));
} else {
- label->set_text(newguitext);
+ label->set_text(newtext);
}
label->set_line_wrap();
#if (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION >= 16)
@@ -125,7 +125,7 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node
// - 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();
+ int len = newtext.length();
label->set_width_chars(len > Parameter::GUI_MAX_LINE_LENGTH ? Parameter::GUI_MAX_LINE_LENGTH : len);
label->show();
diff --git a/src/extension/param/description.h b/src/extension/param/description.h
index 91342fa6a..599c4db78 100644
--- a/src/extension/param/description.h
+++ b/src/extension/param/description.h
@@ -27,14 +27,12 @@ namespace Extension {
class ParamDescription : public Parameter {
public:
enum AppearanceMode {
- DESC, HEADER, URL
+ DESCRIPTION, 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 * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml,
@@ -45,8 +43,6 @@ private:
/** \brief Internal value. */
gchar * _value;
AppearanceMode _mode;
- const gchar* _context;
- bool _preserve_whitespace;
};
} /* namespace Extension */
diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp
index a26458c35..7cd860465 100644
--- a/src/extension/param/enum.cpp
+++ b/src/extension/param/enum.cpp
@@ -33,29 +33,27 @@ namespace Inkscape {
namespace Extension {
/* For internal use only.
- Note that value and guitext MUST be non-NULL. This is ensured by newing only at one location in the code where non-NULL checks are made. */
+ Note that value and text MUST be non-NULL. This is ensured by newing only at one location in the code where non-NULL checks are made. */
class enumentry {
public:
enumentry (Glib::ustring &val, Glib::ustring &text) :
value(val),
- guitext(text)
+ text(text)
{}
Glib::ustring value;
- Glib::ustring guitext;
+ Glib::ustring text;
};
ParamComboBox::ParamComboBox(const gchar * name,
- const gchar * guitext,
- const gchar * desc,
- const Parameter::_scope_t scope,
- bool gui_hidden,
- const gchar * gui_tip,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml)
- : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ : Parameter(name, text, description, hidden, indent, ext)
, _value(NULL)
, choices(NULL)
{
@@ -66,7 +64,7 @@ ParamComboBox::ParamComboBox(const gchar * name,
for (Inkscape::XML::Node *node = xml->firstChild(); node; node = node->next()) {
char const * chname = node->name();
if (!strcmp(chname, INKSCAPE_EXTENSION_NS "item") || !strcmp(chname, INKSCAPE_EXTENSION_NS "_item")) {
- Glib::ustring newguitext, newvalue;
+ Glib::ustring newtext, newvalue;
const char * contents = NULL;
if (node->firstChild()) {
contents = node->firstChild()->content();
@@ -77,12 +75,12 @@ ParamComboBox::ParamComboBox(const gchar * name,
// still need to include if are to be localized
if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_item")) {
if (node->attribute("msgctxt") != NULL) {
- newguitext = g_dpgettext2(NULL, node->attribute("msgctxt"), contents);
+ newtext = g_dpgettext2(NULL, node->attribute("msgctxt"), contents);
} else {
- newguitext = _(contents);
+ newtext = _(contents);
}
} else {
- newguitext = contents;
+ newtext = contents;
}
} else
continue;
@@ -94,8 +92,8 @@ ParamComboBox::ParamComboBox(const gchar * name,
newvalue = contents;
}
- if ( (!newguitext.empty()) && (!newvalue.empty()) ) { // logical error if this is not true here
- choices = g_slist_append( choices, new enumentry(newvalue, newguitext) );
+ if ( (!newtext.empty()) && (!newvalue.empty()) ) { // logical error if this is not true here
+ choices = g_slist_append( choices, new enumentry(newvalue, newtext) );
}
}
}
@@ -155,7 +153,7 @@ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape
Glib::ustring settext;
for (GSList * list = choices; list != NULL; list = g_slist_next(list)) {
enumentry * entr = reinterpret_cast<enumentry *>(list->data);
- if ( !entr->guitext.compare(in) ) {
+ if ( !entr->text.compare(in) ) {
settext = entr->value;
break; // break out of for loop
}
@@ -175,20 +173,20 @@ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape
}
/**
- * function to test if \c guitext is selectable
+ * function to test if \c text is selectable
*/
-bool ParamComboBox::contains(const gchar * guitext, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const
+bool ParamComboBox::contains(const gchar * text, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const
{
- if (guitext == NULL) {
+ if (text == NULL) {
return false; /* Can't have NULL string */
}
for (GSList * list = choices; list != NULL; list = g_slist_next(list)) {
enumentry * entr = reinterpret_cast<enumentry *>(list->data);
- if ( !entr->guitext.compare(guitext) )
+ if ( !entr->text.compare(text) )
return true;
}
- // if we did not find the guitext in this ParamComboBox:
+ // if we did not find the text in this ParamComboBox:
return false;
}
@@ -246,12 +244,12 @@ ParamComboBoxEntry::changed (void)
*/
Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
- if (_gui_hidden) {
+ if (_hidden) {
return NULL;
}
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));
+ Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START));
label->show();
hbox->pack_start(*label, false, false);
@@ -260,11 +258,11 @@ Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * n
Glib::ustring settext;
for (GSList * list = choices; list != NULL; list = g_slist_next(list)) {
enumentry * entr = reinterpret_cast<enumentry *>(list->data);
- Glib::ustring text = entr->guitext;
+ Glib::ustring text = entr->text;
combo->append(text);
if ( _value && !entr->value.compare(_value) ) {
- settext = entr->guitext;
+ settext = entr->text;
}
}
if (!settext.empty()) {
diff --git a/src/extension/param/enum.h b/src/extension/param/enum.h
index f9d3d75f7..143a648d7 100644
--- a/src/extension/param/enum.h
+++ b/src/extension/param/enum.h
@@ -38,11 +38,9 @@ private:
public:
ParamComboBox(const gchar * name,
- const gchar * guitext,
- const gchar * desc,
- const Parameter::_scope_t scope,
- bool gui_hidden,
- const gchar * gui_tip,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml);
@@ -60,9 +58,9 @@ public:
const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node);
/**
- * @returns true if guitext is part of this enum
+ * @returns true if text is part of this enum
*/
- bool contains(const gchar * guitext, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const;
+ bool contains(const gchar * text, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const;
void changed (void);
}; /* class ParamComboBox */
diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp
index e3fdba826..69283a572 100644
--- a/src/extension/param/float.cpp
+++ b/src/extension/param/float.cpp
@@ -15,7 +15,6 @@
#include <gtkmm/scale.h>
#include "ui/widget/spinbutton.h"
#include "ui/widget/spin-scale.h"
-#include <glib/gi18n.h>
#include "xml/node.h"
#include "extension/extension.h"
@@ -28,16 +27,14 @@ 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,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml,
AppearanceMode mode)
- : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ : Parameter(name, text, description, hidden, indent, ext)
, _value(0.0)
, _mode(mode)
, _min(0.0)
@@ -170,7 +167,7 @@ void ParamFloatAdjustment::val_changed(void)
*/
Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
- if (_gui_hidden) {
+ if (_hidden) {
return NULL;
}
@@ -181,7 +178,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod
if (_mode == FULL) {
- UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, _precision);
+ UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_text, fadjust, _precision);
scale->set_size_request(400, -1);
scale->show();
hbox->pack_start(*scale, true, true);
@@ -189,7 +186,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod
}
else if (_mode == MINIMAL) {
- Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START));
+ Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START));
label->show();
hbox->pack_start(*label, true, true);
diff --git a/src/extension/param/float.h b/src/extension/param/float.h
index 7fd86cea7..d58253ccb 100644
--- a/src/extension/param/float.h
+++ b/src/extension/param/float.h
@@ -30,11 +30,9 @@ public:
FULL, MINIMAL
};
ParamFloat(const gchar * name,
- const gchar * guitext,
- const gchar * desc,
- const Parameter::_scope_t scope,
- bool gui_hidden,
- const gchar * gui_tip,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml,
diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp
index 538ddc08d..357f98590 100644
--- a/src/extension/param/int.cpp
+++ b/src/extension/param/int.cpp
@@ -15,7 +15,6 @@
#include <gtkmm/scale.h>
#include "ui/widget/spinbutton.h"
#include "ui/widget/spin-scale.h"
-#include <glib/gi18n.h>
#include "xml/node.h"
#include "extension/extension.h"
@@ -28,16 +27,14 @@ 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,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml,
AppearanceMode mode)
- : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ : Parameter(name, text, description, hidden, indent, ext)
, _value(0)
, _mode(mode)
, _min(0)
@@ -151,7 +148,7 @@ void ParamIntAdjustment::val_changed(void)
Gtk::Widget *
ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
- if (_gui_hidden) {
+ if (_hidden) {
return NULL;
}
@@ -162,14 +159,13 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal
if (_mode == FULL) {
- UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, 0);
+ UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_text, fadjust, 0);
scale->set_size_request(400, -1);
scale->show();
hbox->pack_start(*scale, true, true);
}
else if (_mode == MINIMAL) {
-
- Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START));
+ Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START));
label->show();
hbox->pack_start(*label, true, true);
diff --git a/src/extension/param/int.h b/src/extension/param/int.h
index 40c0395ec..fcb1ef3f1 100644
--- a/src/extension/param/int.h
+++ b/src/extension/param/int.h
@@ -30,11 +30,9 @@ public:
FULL, MINIMAL
};
ParamInt(const gchar * name,
- const gchar * guitext,
- const gchar * desc,
- const Parameter::_scope_t scope,
- bool gui_hidden,
- const gchar * gui_tip,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml,
diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp
index de86d1005..4e94b5216 100644
--- a/src/extension/param/notebook.cpp
+++ b/src/extension/param/notebook.cpp
@@ -55,31 +55,27 @@ 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,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
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;};
+ gchar * get_text (void) {return _text;};
Parameter * get_param (const gchar * name);
}; /* 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,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml)
- : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, /*indent*/ 0, ext)
+ : Parameter(name, text, description, hidden, /*indent*/ 0, ext)
{
parameters = NULL;
@@ -151,30 +147,23 @@ ParamNotebookPage *
ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext)
{
const char * name;
- const char * guitext;
- const char * desc;
- const char * scope_str;
- Parameter::_scope_t scope = Parameter::SCOPE_USER;
- bool gui_hidden = false;
- const char * gui_hide;
- const char * gui_tip;
+ const char * text;
+ const char * description;
+ bool hidden = false;
+ const char * hide;
name = in_repr->attribute("name");
- guitext = in_repr->attribute("gui-text");
- if (guitext == NULL)
- guitext = in_repr->attribute("_gui-text");
- gui_tip = in_repr->attribute("gui-tip");
- if (gui_tip == NULL)
- gui_tip = in_repr->attribute("_gui-tip");
- desc = in_repr->attribute("gui-description");
- if (desc == NULL)
- desc = in_repr->attribute("_gui-description");
- scope_str = in_repr->attribute("scope");
- gui_hide = in_repr->attribute("gui-hidden");
- if (gui_hide != NULL) {
- if (strcmp(gui_hide, "1") == 0 ||
- strcmp(gui_hide, "true") == 0) {
- gui_hidden = true;
+ text = in_repr->attribute("gui-text");
+ if (text == NULL)
+ text = in_repr->attribute("_gui-text");
+ description = in_repr->attribute("gui-description");
+ if (description == NULL)
+ description = in_repr->attribute("_gui-description");
+ hide = in_repr->attribute("gui-hidden");
+ if (hide != NULL) {
+ if (strcmp(hide, "1") == 0 ||
+ strcmp(hide, "true") == 0) {
+ hidden = true;
}
/* else stays false */
}
@@ -184,17 +173,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension:
return NULL;
}
- if (scope_str != NULL) {
- if (!strcmp(scope_str, "user")) {
- scope = Parameter::SCOPE_USER;
- } else if (!strcmp(scope_str, "document")) {
- scope = Parameter::SCOPE_DOCUMENT;
- } else if (!strcmp(scope_str, "node")) {
- scope = Parameter::SCOPE_NODE;
- }
- }
-
- ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr);
+ ParamNotebookPage * page = new ParamNotebookPage(name, text, description, hidden, in_ext, in_repr);
/* Note: page could equal NULL */
return page;
@@ -209,7 +188,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension:
*/
Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
- if (_gui_hidden) {
+ if (_hidden) {
return NULL;
}
@@ -232,7 +211,7 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod
gchar const * tip = param->get_tooltip();
if (tip) {
- widg->set_tooltip_text(_(tip));
+ widg->set_tooltip_text(tip);
} else {
widg->set_tooltip_text("");
widg->set_has_tooltip(false);
@@ -247,15 +226,13 @@ 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,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml)
- : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ : Parameter(name, text, description, hidden, indent, ext)
{
pages = NULL;
@@ -446,7 +423,7 @@ Parameter *ParamNotebookPage::get_param(const gchar * name)
*/
Gtk::Widget * ParamNotebook::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
- if (_gui_hidden) {
+ if (_hidden) {
return NULL;
}
@@ -459,7 +436,7 @@ Gtk::Widget * ParamNotebook::get_widget(SPDocument * doc, Inkscape::XML::Node *
i++;
ParamNotebookPage * page = reinterpret_cast<ParamNotebookPage *>(list->data);
Gtk::Widget * widg = page->get_widget(doc, node, changeSignal);
- nb->append_page(*widg, _(page->get_guitext()));
+ nb->append_page(*widg, _(page->get_text()));
if (!strcmp(_value, page->name())) {
pagenr = i; // this is the page to be displayed?
}
diff --git a/src/extension/param/notebook.h b/src/extension/param/notebook.h
index 278c4de12..8475de61d 100644
--- a/src/extension/param/notebook.h
+++ b/src/extension/param/notebook.h
@@ -42,11 +42,9 @@ private:
notebook */
public:
ParamNotebook(const gchar * name,
- const gchar * guitext,
- const gchar * desc,
- const Parameter::_scope_t scope,
- bool gui_hidden,
- const gchar * gui_tip,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml);
diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp
index 0eb491078..5c4fe591f 100644
--- a/src/extension/param/parameter.cpp
+++ b/src/extension/param/parameter.cpp
@@ -62,25 +62,39 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex
}
}
- const char *guitext = in_repr->attribute("gui-text");
- if (guitext == NULL) {
- guitext = in_repr->attribute("_gui-text");
- }
- const char *gui_tip = in_repr->attribute("gui-tip");
- if (gui_tip == NULL) {
- gui_tip = in_repr->attribute("_gui-tip");
+ const char *text = in_repr->attribute("gui-text");
+ if (text == NULL) {
+ text = in_repr->attribute("_gui-text");
+ if (text == NULL) {
+ // text = ""; // propably better to require devs to explicitly set an empty gui-text if this is what they want
+ } else {
+ const char *context = in_repr->attribute("msgctxt");
+ if (context != NULL) {
+ text = g_dpgettext2(NULL, context, text);
+ } else {
+ text = _(text);
+ }
+ }
}
- const char *desc = in_repr->attribute("gui-description");
- if (desc == NULL) {
- desc = in_repr->attribute("_gui-description");
+ const char *description = in_repr->attribute("gui-description");
+ if (description == NULL) {
+ description = in_repr->attribute("_gui-description");
+ if (description != NULL) {
+ const char *context = in_repr->attribute("msgctxt");
+ if (context != NULL) {
+ description = g_dpgettext2(NULL, context, description);
+ } else {
+ description = _(description);
+ }
+ }
}
- bool gui_hidden = false;
+ bool hidden = false;
{
const char *gui_hide = in_repr->attribute("gui-hidden");
if (gui_hide != NULL) {
if (strcmp(gui_hide, "1") == 0 ||
strcmp(gui_hide, "true") == 0) {
- gui_hidden = true;
+ hidden = true;
}
/* else stays false */
}
@@ -98,44 +112,30 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex
}
const gchar* appearance = in_repr->attribute("appearance");
- Parameter::_scope_t scope = Parameter::SCOPE_USER;
- {
- const char *scope_str = in_repr->attribute("scope");
- if (scope_str != NULL) {
- if (!strcmp(scope_str, "user")) {
- scope = Parameter::SCOPE_USER;
- } else if (!strcmp(scope_str, "document")) {
- scope = Parameter::SCOPE_DOCUMENT;
- } else if (!strcmp(scope_str, "node")) {
- scope = Parameter::SCOPE_NODE;
- }
- }
- }
-
Parameter * param = NULL;
if (!strcmp(type, "boolean")) {
- param = new ParamBool(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr);
+ param = new ParamBool(name, text, description, hidden, 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, indent, in_ext, in_repr, ParamInt::FULL);
+ param = new ParamInt(name, text, description, hidden, indent, in_ext, in_repr, ParamInt::FULL);
} else {
- param = new ParamInt(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamInt::MINIMAL);
+ param = new ParamInt(name, text, description, hidden, 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, indent, in_ext, in_repr, ParamFloat::FULL);
+ param = new ParamFloat(name, text, description, hidden, indent, in_ext, in_repr, ParamFloat::FULL);
} else {
- param = new ParamFloat(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamFloat::MINIMAL);
+ param = new ParamFloat(name, text, description, hidden, indent, in_ext, in_repr, ParamFloat::MINIMAL);
}
} else if (!strcmp(type, "string")) {
- param = new ParamString(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr);
+ param = new ParamString(name, text, description, hidden, 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")) {
- ParamDescription::AppearanceMode appearance_mode = ParamDescription::DESC;
+ ParamDescription::AppearanceMode appearance_mode = ParamDescription::DESCRIPTION;
if (appearance) {
if (!strcmp(appearance, "header")) {
appearance_mode = ParamDescription::HEADER;
@@ -143,19 +143,19 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex
appearance_mode = ParamDescription::URL;
}
}
- param = new ParamDescription(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, appearance_mode);
+ param = new ParamDescription(name, text, description, hidden, indent, in_ext, in_repr, appearance_mode);
} else if (!strcmp(type, "enum")) {
- param = new ParamComboBox(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr);
+ param = new ParamComboBox(name, text, description, hidden, indent, in_ext, in_repr);
} else if (!strcmp(type, "notebook")) {
- param = new ParamNotebook(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr);
+ param = new ParamNotebook(name, text, description, hidden, 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, indent, in_ext, in_repr, ParamRadioButton::MINIMAL);
+ param = new ParamRadioButton(name, text, description, hidden, indent, in_ext, in_repr, ParamRadioButton::MINIMAL);
} else {
- param = new ParamRadioButton(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr, ParamRadioButton::FULL);
+ param = new ParamRadioButton(name, text, description, hidden, indent, in_ext, in_repr, ParamRadioButton::FULL);
}
} else if (!strcmp(type, "color")) {
- param = new ParamColor(name, guitext, desc, scope, gui_hidden, gui_tip, indent, in_ext, in_repr);
+ param = new ParamColor(name, text, description, hidden, indent, in_ext, in_repr);
}
// Note: param could equal NULL
@@ -302,29 +302,24 @@ 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, int indent, Inkscape::Extension::Extension * ext) :
- _desc(0),
- _scope(scope),
+Parameter::Parameter(gchar const * name, gchar const * text, gchar const * description, bool hidden, int indent, Inkscape::Extension::Extension * ext) :
+ _description(0),
_text(0),
- _gui_hidden(gui_hidden),
- _gui_tip(0),
+ _hidden(hidden),
_indent(indent),
- extension(ext),
+ _extension(ext),
_name(0)
{
if (name != NULL) {
_name = g_strdup(name);
}
- if (desc != NULL) {
- _desc = g_strdup(desc);
-// printf("Adding description: '%s' on '%s'\n", _desc, _name);
- }
- if (gui_tip != NULL) {
- _gui_tip = g_strdup(gui_tip);
+
+ if (description != NULL) {
+ _description = g_strdup(description);
}
- if (guitext != NULL) {
- _text = g_strdup(guitext);
+ if (text != NULL) {
+ _text = g_strdup(text);
} else {
_text = g_strdup(name);
}
@@ -333,21 +328,19 @@ Parameter::Parameter(gchar const * name, gchar const * guitext, gchar const * de
}
/** Oop, now that we need a parameter, we need it's name. */
-Parameter::Parameter (gchar const * name, gchar const * guitext, Inkscape::Extension::Extension * ext) :
- _desc(0),
- _scope(Parameter::SCOPE_USER),
+Parameter::Parameter (gchar const * name, gchar const * text, Inkscape::Extension::Extension * ext) :
+ _description(0),
_text(0),
- _gui_hidden(false),
- _gui_tip(0),
+ _hidden(false),
_indent(0),
- extension(ext),
+ _extension(ext),
_name(0)
{
if (name != NULL) {
_name = g_strdup(name);
}
- if (guitext != NULL) {
- _text = g_strdup(guitext);
+ if (text != NULL) {
+ _text = g_strdup(text);
} else {
_text = g_strdup(name);
}
@@ -363,16 +356,13 @@ Parameter::~Parameter(void)
g_free(_text);
_text = 0;
- g_free(_gui_tip);
- _gui_tip = 0;
-
- g_free(_desc);
- _desc = 0;
+ g_free(_description);
+ _description = 0;
}
gchar *Parameter::pref_name(void) const
{
- return g_strdup_printf("%s.%s", extension->get_id(), _name);
+ return g_strdup_printf("%s.%s", _extension->get_id(), _name);
}
Inkscape::XML::Node *
@@ -405,7 +395,7 @@ Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc)
child != NULL;
child = child->next()) {
if ((GQuark)child->code() == name_quark &&
- !strcmp(child->attribute("extension"), extension->get_id())) {
+ !strcmp(child->attribute("extension"), _extension->get_id())) {
params = child;
break;
}
@@ -413,7 +403,7 @@ Inkscape::XML::Node *Parameter::document_param_node(SPDocument * doc)
if (params == NULL) {
params = xml_doc->createElement("inkscape:extension-param");
- params->setAttribute("extension", extension->get_id());
+ params->setAttribute("extension", _extension->get_id());
defs->appendChild(params);
Inkscape::GC::release(params);
}
diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h
index c107f24f9..96cc055d8 100644
--- a/src/extension/param/parameter.h
+++ b/src/extension/param/parameter.h
@@ -47,26 +47,16 @@ extern Glib::ustring const extension_pref_root;
*/
class Parameter {
-protected:
- /** List of possible scopes. */
- typedef enum {
- SCOPE_USER, /**< Parameter value is saved in the user's configuration file. (default) */
- SCOPE_DOCUMENT, /**< Parameter value is saved in the document. */
- SCOPE_NODE /**< Parameter value is attached to the node. */
- } _scope_t;
-
public:
Parameter(gchar const *name,
- gchar const *guitext,
- gchar const *desc,
- const Parameter::_scope_t scope,
- bool gui_hidden,
- gchar const *gui_tip,
+ gchar const *text,
+ gchar const *description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext);
Parameter(gchar const *name,
- gchar const *guitext,
+ gchar const *text,
Inkscape::Extension::Extension * ext);
virtual ~Parameter(void);
@@ -140,10 +130,10 @@ public:
virtual Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
- gchar const * get_tooltip(void) const { return _desc; }
+ gchar const * get_tooltip(void) const { return _description; }
/** Indicates if the GUI for this parameter is hidden or not */
- bool get_gui_hidden() const { return _gui_hidden; }
+ bool get_hidden() const { return _hidden; }
/** Indentation level of the parameter */
int get_indent() const { return _indent; }
@@ -173,20 +163,14 @@ public:
protected:
- /** Description of the parameter. */
- gchar * _desc;
-
- /** Scope of the parameter. */
- _scope_t _scope;
-
- /** Text for the GUI selection of this. */
- gchar * _text;
+ /** Parameter text to show as the GUI label. */
+ gchar * _text;
- /** Whether the GUI is visible. */
- bool _gui_hidden;
+ /** Extended description of the parameter (crrently shown as tooltip on hover). */
+ gchar * _description;
- /** A tip for the GUI if there is one. */
- gchar * _gui_tip;
+ /** Whether the parameter is visible. */
+ bool _hidden;
/** Indentation level of the parameter. */
int _indent;
@@ -207,7 +191,7 @@ protected:
private:
/** Which extension is this parameter attached to. */
- Inkscape::Extension::Extension *extension;
+ Inkscape::Extension::Extension *_extension;
/** The name of this parameter. */
gchar *_name;
diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp
index 178dc20e8..2e757febe 100644
--- a/src/extension/param/radiobutton.cpp
+++ b/src/extension/param/radiobutton.cpp
@@ -41,33 +41,31 @@ namespace Inkscape {
namespace Extension {
/* For internal use only.
- Note that value and guitext MUST be non-NULL. This is ensured by newing only at one location in the code where non-NULL checks are made. */
+ Note that value and text MUST be non-NULL. This is ensured by newing only at one location in the code where non-NULL checks are made. */
class optionentry {
public:
optionentry (Glib::ustring * val, Glib::ustring * text) {
value = val;
- guitext = text;
+ text = text;
}
~optionentry() {
delete value;
- delete guitext;
+ delete text;
}
Glib::ustring * value;
- Glib::ustring * guitext;
+ Glib::ustring * text;
};
ParamRadioButton::ParamRadioButton(const gchar * name,
- const gchar * guitext,
- const gchar * desc,
- const Parameter::_scope_t scope,
- bool gui_hidden,
- const gchar * gui_tip,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml,
AppearanceMode mode)
- : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ : Parameter(name, text, description, hidden, indent, ext)
, _value(0)
, _mode(mode)
, choices(0)
@@ -79,7 +77,7 @@ ParamRadioButton::ParamRadioButton(const gchar * name,
while (child_repr != NULL) {
char const * chname = child_repr->name();
if (!strcmp(chname, INKSCAPE_EXTENSION_NS "option") || !strcmp(chname, INKSCAPE_EXTENSION_NS "_option")) {
- Glib::ustring * newguitext = NULL;
+ Glib::ustring * newtext = NULL;
Glib::ustring * newvalue = NULL;
const char * contents = child_repr->firstChild()->content();
@@ -87,12 +85,12 @@ ParamRadioButton::ParamRadioButton(const gchar * name,
// don't translate when 'item' but do translate when '_option'
if (!strcmp(chname, INKSCAPE_EXTENSION_NS "_option")) {
if (child_repr->attribute("msgctxt") != NULL) {
- newguitext = new Glib::ustring(g_dpgettext2(NULL, child_repr->attribute("msgctxt"), contents));
+ newtext = new Glib::ustring(g_dpgettext2(NULL, child_repr->attribute("msgctxt"), contents));
} else {
- newguitext = new Glib::ustring(_(contents));
+ newtext = new Glib::ustring(_(contents));
}
} else {
- newguitext = new Glib::ustring(contents);
+ newtext = new Glib::ustring(contents);
}
} else {
continue;
@@ -106,8 +104,8 @@ ParamRadioButton::ParamRadioButton(const gchar * name,
newvalue = new Glib::ustring(contents);
}
- if ( (newguitext) && (newvalue) ) { // logical error if this is not true here
- choices = g_slist_append( choices, new optionentry(newvalue, newguitext) );
+ if ( (newtext) && (newvalue) ) { // logical error if this is not true here
+ choices = g_slist_append( choices, new optionentry(newvalue, newtext) );
}
}
child_repr = child_repr->next();
@@ -282,7 +280,7 @@ Glib::ustring ParamRadioButton::value_from_label(const Glib::ustring label)
for (GSList * list = choices; list != NULL; list = g_slist_next(list)) {
optionentry * entr = reinterpret_cast<optionentry *>(list->data);
- if ( !entr->guitext->compare(label) ) {
+ if ( !entr->text->compare(label) ) {
value = *(entr->value);
break;
}
@@ -297,7 +295,7 @@ Glib::ustring ParamRadioButton::value_from_label(const Glib::ustring label)
*/
Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
- if (_gui_hidden) {
+ if (_hidden) {
return NULL;
}
@@ -306,7 +304,7 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node
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));
+ Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START, Gtk::ALIGN_START));
label->show();
hbox->pack_start(*label, false, false);
@@ -323,7 +321,7 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node
Gtk::RadioButtonGroup group;
for (GSList * list = choices; list != NULL; list = g_slist_next(list)) {
optionentry * entr = reinterpret_cast<optionentry *>(list->data);
- Glib::ustring * text = entr->guitext;
+ Glib::ustring * text = entr->text;
switch ( _mode ) {
case MINIMAL:
{
diff --git a/src/extension/param/radiobutton.h b/src/extension/param/radiobutton.h
index 5e15dcb57..b91b11ea3 100644
--- a/src/extension/param/radiobutton.h
+++ b/src/extension/param/radiobutton.h
@@ -35,11 +35,9 @@ public:
};
ParamRadioButton(const gchar * name,
- const gchar * guitext,
- const gchar * desc,
- const Parameter::_scope_t scope,
- bool gui_hidden,
- const gchar * gui_tip,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml,
diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp
index 0c5238f99..51b5dfdf3 100644
--- a/src/extension/param/string.cpp
+++ b/src/extension/param/string.cpp
@@ -77,15 +77,13 @@ 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,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml)
- : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext)
+ : Parameter(name, text, description, hidden, indent, ext)
, _value(NULL)
{
const char * defaultval = NULL;
@@ -164,12 +162,12 @@ void ParamStringEntry::changed_text(void)
*/
Gtk::Widget * ParamString::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
- if (_gui_hidden) {
+ if (_hidden) {
return NULL;
}
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));
+ Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START));
label->show();
hbox->pack_start(*label, false, false);
diff --git a/src/extension/param/string.h b/src/extension/param/string.h
index f5412ebcc..d338f83b9 100644
--- a/src/extension/param/string.h
+++ b/src/extension/param/string.h
@@ -24,11 +24,9 @@ private:
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,
+ const gchar * text,
+ const gchar * description,
+ bool hidden,
int indent,
Inkscape::Extension::Extension * ext,
Inkscape::XML::Node * xml);
diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp
index 2bdbb081e..92ddd3050 100644
--- a/src/extension/prefdialog.cpp
+++ b/src/extension/prefdialog.cpp
@@ -246,7 +246,7 @@ PrefDialog::on_response (int signal) {
#include "internal/clear-n_.h"
-const char * PrefDialog::live_param_xml = "<param name=\"__live_effect__\" type=\"boolean\" _gui-text=\"" N_("Live preview") "\" gui-description=\"" N_("Is the effect previewed live on canvas?") "\" scope=\"user\">false</param>";
+const char * PrefDialog::live_param_xml = "<param name=\"__live_effect__\" type=\"boolean\" _gui-text=\"" N_("Live preview") "\" gui-description=\"" N_("Is the effect previewed live on canvas?") "\">false</param>";
}; }; /* namespace Inkscape, Extension */
diff --git a/src/io/sys.cpp b/src/io/sys.cpp
index 61a6a96f4..b06b550dd 100644
--- a/src/io/sys.cpp
+++ b/src/io/sys.cpp
@@ -37,36 +37,6 @@ void dump_ustr(Glib::ustring const &ustr);
extern guint update_in_progress;
-#define DEBUG_MESSAGE(key, ...) \
-{\
- Inkscape::Preferences *prefs = Inkscape::Preferences::get(); \
- gint dump = prefs->getBool("/options/bulia/" #key) ? 1 : 0;\
- gint dumpD = prefs->getBool("/options/bulia/" #key"D") ? 1 : 0;\
- gint dumpD2 = prefs->getBool("/options/bulia/" #key"D2") ? 1 : 0;\
- dumpD &= ( (update_in_progress == 0) || dumpD2 );\
- if ( dump )\
- {\
- g_message( __VA_ARGS__ );\
-\
- }\
- if ( dumpD )\
- {\
- GtkWidget *dialog = gtk_message_dialog_new(NULL,\
- GTK_DIALOG_DESTROY_WITH_PARENT, \
- GTK_MESSAGE_INFO, \
- GTK_BUTTONS_OK, \
- __VA_ARGS__ \
- );\
- g_signal_connect_swapped(dialog, "response",\
- G_CALLBACK(gtk_widget_destroy), \
- dialog); \
- gtk_widget_show_all( dialog );\
- }\
-}
-
-
-
-
void Inkscape::IO::dump_fopen_call( char const *utf8name, char const *id )
{
#ifdef INK_DUMP_FOPEN
@@ -97,65 +67,33 @@ void Inkscape::IO::dump_fopen_call( char const *utf8name, char const *id )
FILE *Inkscape::IO::fopen_utf8name( char const *utf8name, char const *mode )
{
- static gint counter = 0;
FILE* fp = NULL;
-
- DEBUG_MESSAGE( dumpOne, "entering fopen_utf8name( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
-
-#ifndef WIN32
- DEBUG_MESSAGE( dumpOne, " STEP 0 ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
gchar *filename = g_filename_from_utf8( utf8name, -1, NULL, NULL, NULL );
if ( filename )
{
- DEBUG_MESSAGE( dumpOne, " STEP 1 ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
- fp = std::fopen(filename, mode);
- DEBUG_MESSAGE( dumpOne, " STEP 2 ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
+ Glib::ustring how( mode );
+ if ( how.find("b") == Glib::ustring::npos )
+ {
+ how.append("b"); // not needed in POSIX but doesn't hurt either
+ }
+ fp = g_fopen(filename, how.c_str());
g_free(filename);
- DEBUG_MESSAGE( dumpOne, " STEP 3 ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
filename = 0;
}
-#else
- Glib::ustring how( mode );
- how.append("b");
- DEBUG_MESSAGE( dumpOne, " calling is_os_wide() ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
-
- fp = g_fopen(utf8name, how.c_str());
-#endif
-
- DEBUG_MESSAGE( dumpOne, "leaving fopen_utf8name( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
-
return fp;
}
int Inkscape::IO::mkdir_utf8name( char const *utf8name )
{
- static gint counter = 0;
int retval = -1;
-
- DEBUG_MESSAGE( dumpMk, "entering mkdir_utf8name( '%s' )[%d]", utf8name, (counter++) );
-
-#ifndef WIN32
- DEBUG_MESSAGE( dumpMk, " STEP 0 ( '%s' )[%d]", utf8name, (counter++) );
gchar *filename = g_filename_from_utf8( utf8name, -1, NULL, NULL, NULL );
if ( filename )
{
- DEBUG_MESSAGE( dumpMk, " STEP 1 ( '%s' )[%d]", utf8name, (counter++) );
- retval = ::mkdir(filename, S_IRWXU | S_IRGRP | S_IXGRP);
- DEBUG_MESSAGE( dumpMk, " STEP 2 ( '%s' )[%d]", utf8name, (counter++) );
+ retval = g_mkdir(filename, S_IRWXU | S_IRGRP | S_IXGRP); // The mode argument is ignored on Windows.
g_free(filename);
- DEBUG_MESSAGE( dumpMk, " STEP 3 ( '%s' )[%d]", utf8name, (counter++) );
filename = 0;
}
-#else
- DEBUG_MESSAGE( dumpMk, " calling is_os_wide() ( '%s' )[%d]", utf8name, (counter++) );
-
- // Mode should be ingnored inside of glib on the way in
- retval = g_mkdir( utf8name, 0 );
-#endif
-
- DEBUG_MESSAGE( dumpMk, "leaving mkdir_utf8name( '%s' )[%d]", utf8name, (counter++) );
-
return retval;
}
diff --git a/src/livarot/PathOutline.cpp b/src/livarot/PathOutline.cpp
index 7043469d2..c1a48d41f 100644
--- a/src/livarot/PathOutline.cpp
+++ b/src/livarot/PathOutline.cpp
@@ -158,7 +158,8 @@ void Path::Outline(Path *dest, double width, JoinType join, ButtType butt, doubl
join, butt, miter, false, false, endPos, endButt);
Geom::Point endNor=endButt.ccw();
if (butt == butt_round) {
- dest->ArcTo (endPos+width*endNor, 1.0001 * width, 1.0001 * width, 0.0, true, true);
+ dest->ArcTo (endPos+width*endButt, width, width, 0.0, false, true);
+ dest->ArcTo (endPos+width*endNor, width, width, 0.0, false, true);
} else if (butt == butt_square) {
dest->LineTo (endPos-width*endNor+width*endButt);
dest->LineTo (endPos+width*endNor+width*endButt);
@@ -175,7 +176,8 @@ void Path::Outline(Path *dest, double width, JoinType join, ButtType butt, doubl
endNor=endButt.ccw();
if (butt == butt_round) {
- dest->ArcTo (endPos+width*endNor, 1.0001 * width, 1.0001 * width, 0.0, true, true);
+ dest->ArcTo (endPos+width*endButt, width, width, 0.0, false, true);
+ dest->ArcTo (endPos+width*endNor, width, width, 0.0, false, true);
} else if (butt == butt_square) {
dest->LineTo (endPos-width*endNor+width*endButt);
dest->LineTo (endPos+width*endNor+width*endButt);
diff --git a/src/live_effects/lpe-clone-original.cpp b/src/live_effects/lpe-clone-original.cpp
index 74f93eddc..ae20b582a 100644
--- a/src/live_effects/lpe-clone-original.cpp
+++ b/src/live_effects/lpe-clone-original.cpp
@@ -20,8 +20,7 @@ namespace LivePathEffect {
LPECloneOriginal::LPECloneOriginal(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- linked_path("LEGACY FALLBACK", "LEGACY FALLBACK", "linkedpath", &wr, this),
- linked_item(_("Linked Item:"), _("Item from which to take the original data"), "linked_item", &wr, this),
+ linkeditem(_("Linked Item:"), _("Item from which to take the original data"), "linkeditem", &wr, this),
scale(_("Scale %"), _("Scale item %"), "scale", &wr, this, 100.0),
preserve_position(_("Preserve position"), _("Preserve position"), "preserve_position", &wr, this, false),
inverse(_("Inverse clone"), _("Use LPE item as origin"), "inverse", &wr, this, false),
@@ -37,8 +36,15 @@ LPECloneOriginal::LPECloneOriginal(LivePathEffectObject *lpeobject) :
expanded(false),
origin(Geom::Point(0,0))
{
- registerParameter(&linked_path);
- registerParameter(&linked_item);
+ //0.92 compatibility
+ const gchar * linkedpath = this->getRepr()->attribute("linkedpath");
+ if (linkedpath && strcmp(linkedpath, "") != 0){
+ this->getRepr()->setAttribute("linkeditem", linkedpath);
+ this->getRepr()->setAttribute("linkedpath", NULL);
+ this->getRepr()->setAttribute("transform", "false");
+ };
+
+ registerParameter(&linkeditem);
registerParameter(&scale);
registerParameter(&attributes);
registerParameter(&style_attributes);
@@ -208,19 +214,8 @@ LPECloneOriginal::cloneAttrbutes(SPObject *origin, SPObject *dest, bool live, co
void
LPECloneOriginal::doBeforeEffect (SPLPEItem const* lpeitem){
- if (linked_path.linksToPath()) { //Legacy staff
- Glib::ustring attributes_value("d");
- attributes.param_setValue(attributes_value);
- attributes.write_to_SVG();
- Glib::ustring style_attributes_value("");
- style_attributes.param_setValue(style_attributes_value);
- style_attributes.write_to_SVG();
- linked_item.param_readSVGValue(linked_path.param_getSVGValue());
- linked_path.param_readSVGValue("");
- }
-
- if (linked_item.linksToItem()) {
- linked_item.setInverse(inverse);
+ if (linkeditem.linksToItem()) {
+ linkeditem.setInverse(inverse);
if ( preserve_position_changed != preserve_position ) {
if (!preserve_position) {
sp_svg_transform_read(SP_ITEM(sp_lpe_item)->getAttribute("transform"), &preserve_affine);
@@ -262,8 +257,8 @@ LPECloneOriginal::doBeforeEffect (SPLPEItem const* lpeitem){
}
style_attr.append(Glib::ustring(style_attributes.param_getSVGValue()).append(","));
- SPItem * from = inverse ? SP_ITEM(sp_lpe_item) : SP_ITEM(linked_item.getObject());
- SPItem * to = !inverse ? SP_ITEM(sp_lpe_item) : SP_ITEM(linked_item.getObject());
+ SPItem * from = inverse ? SP_ITEM(sp_lpe_item) : SP_ITEM(linkeditem.getObject());
+ SPItem * to = !inverse ? SP_ITEM(sp_lpe_item) : SP_ITEM(linkeditem.getObject());
cloneAttrbutes(from, to, true, g_strdup(attr.c_str()), g_strdup(style_attr.c_str()), true);
Geom::OptRect bbox = from->geometricBounds();
if (bbox && preserve_position && origin != Geom::Point(0,0)) {
@@ -361,15 +356,15 @@ LPECloneOriginal::~LPECloneOriginal()
void
LPECloneOriginal::transform_multiply(Geom::Affine const& postmul, bool set)
{
- if (linked_item.linksToItem()) {
- linked_item.getObject()->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ if (linkeditem.linksToItem()) {
+ linkeditem.getObject()->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
}
void
LPECloneOriginal::doEffect (SPCurve * curve)
{
- if (linked_item.linksToItem() && !inverse) {
+ if (linkeditem.linksToItem() && !inverse) {
SPShape * shape = getCurrentShape();
if(shape){
curve->set_pathvector(shape->getCurve()->get_pathvector());
diff --git a/src/live_effects/lpe-clone-original.h b/src/live_effects/lpe-clone-original.h
index e4328c169..9bab8553f 100644
--- a/src/live_effects/lpe-clone-original.h
+++ b/src/live_effects/lpe-clone-original.h
@@ -32,8 +32,7 @@ public:
void cloneAttrbutes(SPObject *origin, SPObject *dest, bool live, const char * attributes, const char * style_attributes, bool root);
private:
- OriginalPathParam linked_path;
- OriginalItemParam linked_item;
+ OriginalItemParam linkeditem;
ScalarParam scale;
BoolParam preserve_position;
BoolParam inverse;
diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp
index a462c76a6..1fd0e466f 100644
--- a/src/live_effects/lpe-copy_rotate.cpp
+++ b/src/live_effects/lpe-copy_rotate.cpp
@@ -30,6 +30,14 @@
namespace Inkscape {
namespace LivePathEffect {
+static const Util::EnumData<RotateMethod> RotateMethodData[RM_END] = {
+ { RM_NORMAL, N_("Normal"), "normal" },
+ { RM_KALEIDOSCOPE, N_("Kaleidoscope"), "kaleidoskope" },
+ { RM_FUSE, N_("Fuse paths"), "fuse_paths" }
+};
+static const Util::EnumDataConverter<RotateMethod>
+RMConverter(RotateMethodData, RM_END);
+
bool
pointInTriangle(Geom::Point const &p, Geom::Point const &p1, Geom::Point const &p2, Geom::Point const &p3)
{
@@ -52,30 +60,37 @@ LPECopyRotate::LPECopyRotate(LivePathEffectObject *lpeobject) :
starting_angle(_("Starting angle"), _("Angle of the first copy"), "starting_angle", &wr, this, 0.0),
rotation_angle(_("Rotation angle"), _("Angle between two successive copies"), "rotation_angle", &wr, this, 60.0),
num_copies(_("Number of copies"), _("Number of copies of the original path"), "num_copies", &wr, this, 6),
- split_gap(_("Gap on split"), _("Gap on split"), "split_gap", &wr, this, -0.001),
+ gap(_("Gap"), _("Gap"), "gap", &wr, this, -0.0001),
copies_to_360(_("360º Copies"), _("No rotation angle, fixed to 360º"), "copies_to_360", &wr, this, true),
- fuse_paths(_("Kaleidoskope"), _("Kaleidoskope by helper line, use fill-rule: evenodd for best result"), "fuse_paths", &wr, this, false),
- join_paths(_("Join paths"), _("Join paths, use fill-rule: evenodd for best result"), "join_paths", &wr, this, false),
+ method(_("Method:"), _("Rotate methods"), "method", RMConverter, &wr, this, RM_NORMAL),
+ mirror_copies(_("Mirror copies"), _("Mirror between copies"), "mirror_copies", &wr, this, false),
split_items(_("Split elements"), _("Split elements, this allow gradients and other paints."), "split_items", &wr, this, false),
dist_angle_handle(100.0)
{
show_orig_path = true;
_provides_knotholder_entities = true;
+ //0.92 compatibility
+ if (this->getRepr()->attribute("fuse_paths") && strcmp(this->getRepr()->attribute("fuse_paths"), "true") == 0){
+ this->getRepr()->setAttribute("fuse_paths", NULL);
+ this->getRepr()->setAttribute("method", "kaleidoskope");
+ this->getRepr()->setAttribute("mirror_copies", "true");
+ };
// register all your parameters here, so Inkscape knows which parameters this effect has:
- registerParameter(&copies_to_360);
- registerParameter(&fuse_paths);
- registerParameter(&join_paths);
- registerParameter(&split_items);
+ registerParameter(&method);
+ registerParameter(&num_copies);
registerParameter(&starting_angle);
registerParameter(&starting_point);
registerParameter(&rotation_angle);
- registerParameter(&num_copies);
- registerParameter(&split_gap);
+ registerParameter(&gap);
registerParameter(&origin);
- split_gap.param_set_range(-999999.0, 999999.0);
- split_gap.param_set_increments(0.1, 0.1);
- split_gap.param_set_digits(5);
- num_copies.param_set_range(0, 999999);
+ registerParameter(&copies_to_360);
+ registerParameter(&mirror_copies);
+ registerParameter(&split_items);
+
+ gap.param_set_range(-99999.0, 99999.0);
+ gap.param_set_increments(0.1, 0.1);
+ gap.param_set_digits(5);
+ num_copies.param_set_range(1, 999999);
num_copies.param_make_integer(true);
apply_to_clippath_and_mask = true;
previous_num_copies = num_copies;
@@ -132,38 +147,21 @@ LPECopyRotate::doAfterEffect (SPLPEItem const* lpeitem)
counter++;
}
g_free(id);
- double diagonal = Geom::distance(Geom::Point(boundingbox_X.min(),boundingbox_Y.min()),Geom::Point(boundingbox_X.max(),boundingbox_Y.max()));
- Geom::Rect bbox(Geom::Point(boundingbox_X.min(),boundingbox_Y.min()),Geom::Point(boundingbox_X.max(),boundingbox_Y.max()));
- double size_divider = Geom::distance(origin,bbox) + (diagonal * 2);
- Geom::Point line_start = origin + dir * Geom::Rotate(-(Geom::rad_from_deg(starting_angle))) * size_divider;
- Geom::Point line_end = origin + dir * Geom::Rotate(-(Geom::rad_from_deg(rotation_angle + starting_angle))) * size_divider;
Geom::Affine m = Geom::Translate(-origin) * Geom::Rotate(-(Geom::rad_from_deg(starting_angle)));
- if (fuse_paths) {
- size_t rest = 0;
- for (size_t i = 1; i < num_copies; ++i) {
- Geom::Affine r = Geom::identity();
- Geom::Point dir = unit_vector((Geom::Point)origin - Geom::middle_point(line_start,line_end));
- if( rest%2 == 0) {
- r *= Geom::Rotate(Geom::Angle(dir)).inverse();
- r *= Geom::Scale(1, -1);
- r *= Geom::Rotate(Geom::Angle(dir));
- }
- Geom::Rotate rot(-(Geom::rad_from_deg(rotation_angle * i)));
- Geom::Affine t = m * r * rot * Geom::Rotate(Geom::rad_from_deg(starting_angle)) * Geom::Translate(origin);
- if( rest%2 == 0) {
- t = m * r * rot * Geom::Rotate(Geom::rad_from_deg(starting_angle)).inverse() * Geom::Translate(origin);
- }
- t *= sp_lpe_item->transform;
- toItem(t, i-1, reset);
- rest ++;
+ for (size_t i = 1; i < num_copies; ++i) {
+ Geom::Affine r = Geom::identity();
+ if( i%2 != 0 && mirror_copies) {
+ r *= Geom::Rotate(Geom::Angle(half_dir)).inverse();
+ r *= Geom::Scale(1, -1);
+ r *= Geom::Rotate(Geom::Angle(half_dir));
}
- } else {
- for (size_t i = 1; i < num_copies; ++i) {
- Geom::Rotate rot(-(Geom::rad_from_deg(rotation_angle * i)));
- Geom::Affine t = m * rot * Geom::Rotate(Geom::rad_from_deg(starting_angle)) * Geom::Translate(origin);
- t *= sp_lpe_item->transform;
- toItem(t, i - 1, reset);
+ Geom::Rotate rot(-(Geom::rad_from_deg(rotation_angle * i)));
+ Geom::Affine t = m * r * rot * Geom::Rotate(Geom::rad_from_deg(starting_angle)) * Geom::Translate(origin);
+ if( i%2 != 0 && mirror_copies) {
+ t = m * r * rot * Geom::Rotate(Geom::rad_from_deg(starting_angle)).inverse() * Geom::Translate(origin);
}
+ t *= sp_lpe_item->transform;
+ toItem(t, i-1, reset);
}
reset = false;
} else {
@@ -302,15 +300,6 @@ Gtk::Widget * LPECopyRotate::newWidget()
vbox->set_border_width(5);
vbox->set_homogeneous(false);
vbox->set_spacing(2);
- Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false,0));
- Gtk::VBox * vbox_expander = Gtk::manage( new Gtk::VBox(Effect::newWidget()) );
- vbox_expander->set_border_width(0);
- vbox_expander->set_spacing(2);
- Gtk::Button * reset_button = Gtk::manage(new Gtk::Button(Glib::ustring(_("Reset styles"))));
- reset_button->signal_clicked().connect(sigc::mem_fun (*this,&LPECopyRotate::resetStyles));
- reset_button->set_size_request(140,30);
- vbox->pack_start(*hbox, true,true,2);
- hbox->pack_start(*reset_button, false, false,2);
std::vector<Parameter *>::iterator it = param_vector.begin();
while (it != param_vector.end()) {
if ((*it)->widget_is_visible) {
@@ -332,6 +321,13 @@ Gtk::Widget * LPECopyRotate::newWidget()
++it;
}
+ Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false,0));
+ Gtk::Button * reset_button = Gtk::manage(new Gtk::Button(Glib::ustring(_("Reset styles"))));
+ reset_button->signal_clicked().connect(sigc::mem_fun (*this,&LPECopyRotate::resetStyles));
+ reset_button->set_size_request(110,20);
+ vbox->pack_start(*hbox, true,true,2);
+ hbox->pack_start(*reset_button, false, false,2);
+
if (show_default_widgets) {
Gtk::Label *default_label = Gtk::manage(new Gtk::Label(
Glib::ustring(_("<b>Defaults</b> set defaultable parameters")),
@@ -347,6 +343,7 @@ Gtk::Widget * LPECopyRotate::newWidget()
defaultBox->pack_start(*reset_default, true, true, 2);
vbox->pack_start(*defaultBox, true, true, 2);
}
+
return dynamic_cast<Gtk::Widget *>(vbox);
}
@@ -381,19 +378,24 @@ LPECopyRotate::doBeforeEffect (SPLPEItem const* lpeitem)
{
using namespace Geom;
original_bbox(lpeitem);
- if (copies_to_360) {
+ if (copies_to_360 && num_copies > 2) {
+ this->upd_params = true;
rotation_angle.param_set_value(360.0/(double)num_copies);
}
- if (fuse_paths && rotation_angle * num_copies > 360.1 && rotation_angle > 0) {
+
+ if ((method == RM_KALEIDOSCOPE || method == RM_FUSE) && rotation_angle * num_copies > 360.1 && rotation_angle > 0) {
+ this->upd_params = true;
num_copies.param_set_value(floor(360/rotation_angle));
}
- if (fuse_paths && copies_to_360) {
+ if ((method == RM_KALEIDOSCOPE || method == RM_FUSE) && mirror_copies && copies_to_360) {
+ this->upd_params = true;
num_copies.param_set_increments(2.0,10.0);
if ((int)num_copies%2 !=0) {
num_copies.param_set_value(num_copies+1);
rotation_angle.param_set_value(360.0/(double)num_copies);
}
} else {
+ this->upd_params = true;
num_copies.param_set_increments(1.0, 10.0);
}
@@ -406,7 +408,8 @@ LPECopyRotate::doBeforeEffect (SPLPEItem const* lpeitem)
// I first suspected the minus sign to be a bug in 2geom but it is
// likely due to SVG's choice of coordinate system orientation (max)
bool near = Geom::are_near(previous_start_point, (Geom::Point)starting_point, 0.01);
- if (!near) {
+ if (!near) {
+ this->upd_params = true;
starting_angle.param_set_value(deg_from_rad(-angle_between(dir, starting_point - origin)));
if (GDK_SHIFT_MASK) {
dist_angle_handle = L2(B - A);
@@ -420,11 +423,12 @@ LPECopyRotate::doBeforeEffect (SPLPEItem const* lpeitem)
start_pos = origin + dir * Rotate(-rad_from_deg(starting_angle)) * dist_angle_handle;
rot_pos = origin + dir * Rotate(-rad_from_deg(rotation_angle+starting_angle)) * dist_angle_handle;
near = Geom::are_near(start_pos, (Geom::Point)starting_point, 0.01);
- if (!near) {
+ if (!near) {
+ this->upd_params = true;
starting_point.param_setValue(start_pos, true);
}
previous_start_point = (Geom::Point)starting_point;
- if ( fuse_paths || copies_to_360 ) {
+ if ( method == RM_FUSE || copies_to_360 ) {
rot_pos = origin;
}
}
@@ -501,19 +505,21 @@ LPECopyRotate::setFusion(Geom::PathVector &path_on, Geom::Path divider, double s
}
Geom::PathVector tmp_path_helper;
Geom::Path append_path = original;
-
+ Geom::Point previous = original.finalPoint();
for (int i = 0; i < num_copies; ++i) {
Geom::Rotate rot(-Geom::rad_from_deg(rotation_angle * (i)));
Geom::Affine m = pre * rot * Geom::Translate(origin);
- if (i%2 != 0) {
- Geom::Point A = (Geom::Point)origin;
- Geom::Point B = origin + dir * Geom::Rotate(-Geom::rad_from_deg((rotation_angle*i)+starting_angle)) * size_divider;
- Geom::Line ls(A,B);
- m = Geom::reflection (ls.vector(), A);
+ if (i%2 != 0 && mirror_copies) {
+ Geom::Point point_a = (Geom::Point)origin;
+ Geom::Point point_b = origin + dir * Geom::Rotate(-Geom::rad_from_deg((rotation_angle*i)+starting_angle)) * size_divider;
+ Geom::Line ls(point_a, point_b);
+ m = Geom::reflection (ls.vector(), point_a);
+ append_path *= m;
} else {
append_path = original;
+ append_path *= m;
}
- append_path *= m;
+ previous = append_path.finalPoint();
if (tmp_path_helper.size() > 0) {
if (Geom::are_near(tmp_path_helper[tmp_path_helper.size()-1].finalPoint(), append_path.finalPoint())) {
Geom::Path tmp_append = append_path.reversed();
@@ -603,118 +609,83 @@ Geom::PathVector
LPECopyRotate::doEffect_path (Geom::PathVector const & path_in)
{
Geom::PathVector path_out;
- if (split_items && (fuse_paths || join_paths)) {
+ double diagonal = Geom::distance(Geom::Point(boundingbox_X.min(),boundingbox_Y.min()),Geom::Point(boundingbox_X.max(),boundingbox_Y.max()));
+ Geom::OptRect bbox = sp_lpe_item->geometricBounds();
+ size_divider = Geom::distance(origin,bbox) + (diagonal * 6);
+ Geom::Point line_start = origin + dir * Geom::Rotate(-(Geom::rad_from_deg(starting_angle))) * size_divider;
+ Geom::Point line_end = origin + dir * Geom::Rotate(-(Geom::rad_from_deg(rotation_angle + starting_angle))) * size_divider;
+ divider = Geom::Path(line_start);
+ divider.appendNew<Geom::LineSegment>((Geom::Point)origin);
+ divider.appendNew<Geom::LineSegment>(line_end);
+ divider.close();
+ half_dir = unit_vector(Geom::middle_point(line_start,line_end) - (Geom::Point)origin);
+ if (method == RM_KALEIDOSCOPE || method == RM_FUSE) {
+ if (method != RM_KALEIDOSCOPE) {
+ path_out = doEffect_path_post(path_in);
+ } else {
+ path_out = pathv_to_linear_and_cubic_beziers(path_in);
+ }
if (num_copies == 0) {
return path_out;
}
- path_out = pathv_to_linear_and_cubic_beziers(path_in);
- double diagonal = Geom::distance(Geom::Point(boundingbox_X.min(),boundingbox_Y.min()),Geom::Point(boundingbox_X.max(),boundingbox_Y.max()));
- Geom::OptRect bbox = sp_lpe_item->geometricBounds();
- double size_divider = Geom::distance(origin,bbox) + (diagonal * 2);
- Geom::Point line_start = origin + dir * Geom::Rotate(-(Geom::rad_from_deg(starting_angle))) * size_divider;
- Geom::Point line_end = origin + dir * Geom::Rotate(-(Geom::rad_from_deg(rotation_angle + starting_angle))) * size_divider;
- Geom::Path divider = Geom::Path(line_start);
- divider.appendNew<Geom::LineSegment>((Geom::Point)origin);
- divider.appendNew<Geom::LineSegment>(line_end);
- divider.close();
Geom::PathVector triangle;
triangle.push_back(divider);
Geom::PathIntersectionGraph *pig = new Geom::PathIntersectionGraph(triangle, path_out);
- if (pig && ! path_out.empty() && !triangle.empty()) {
- //TODO: Here can produce a crash because some knows problems in new boolops code
+ if (pig && !path_out.empty() && !triangle.empty()) {
path_out = pig->getIntersection();
}
- Geom::Affine r = Geom::identity();
- Geom::Point dir = unit_vector(Geom::middle_point(line_start,line_end) - (Geom::Point)origin);
- Geom::Point gap = dir * split_gap;
- path_out *= Geom::Translate(gap);
- } else {
- // default behavior
- for (unsigned int i=0; i < path_in.size(); i++) {
- Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_in = path_in[i].toPwSb();
- Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_out = doEffect_pwd2(pwd2_in);
- Geom::PathVector path = Geom::path_from_piecewise( pwd2_out, LPE_CONVERSION_TOLERANCE);
- // add the output path vector to the already accumulated vector:
- for (unsigned int j=0; j < path.size(); j++) {
- path_out.push_back(path[j]);
- }
+ path_out *= Geom::Translate(half_dir * gap);
+ if ( !split_items ) {
+ path_out *= Geom::Translate(half_dir * gap).inverse();
+ path_out = doEffect_path_post(path_out);
}
+ } else {
+ path_out = doEffect_path_post(path_in);
}
return pathv_to_linear_and_cubic_beziers(path_out);
}
-Geom::Piecewise<Geom::D2<Geom::SBasis> >
-LPECopyRotate::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
+Geom::PathVector
+LPECopyRotate::doEffect_path_post (Geom::PathVector const & path_in)
{
- using namespace Geom;
-
- if ((num_copies == 1 && !fuse_paths) || split_items) {
- return pwd2_in;
+ if ((split_items || num_copies == 1) && method != RM_FUSE && method != RM_KALEIDOSCOPE) {
+ return path_in;
}
- double diagonal = Geom::distance(Geom::Point(boundingbox_X.min(),boundingbox_Y.min()),Geom::Point(boundingbox_X.max(),boundingbox_Y.max()));
- Geom::Rect bbox(Geom::Point(boundingbox_X.min(),boundingbox_Y.min()),Geom::Point(boundingbox_X.max(),boundingbox_Y.max()));
- double size_divider = Geom::distance(origin,bbox) + (diagonal * 2);
- Geom::Point line_start = origin + dir * Rotate(-rad_from_deg(starting_angle)) * size_divider;
- Geom::Point line_end = origin + dir * Rotate(-rad_from_deg(rotation_angle + starting_angle)) * size_divider;
- //Note:: beter way to do this
- //Whith AppendNew have problems whith the crossing order
- Geom::Path divider = Geom::Path(line_start);
- divider.appendNew<Geom::LineSegment>((Geom::Point)origin);
- divider.appendNew<Geom::LineSegment>(line_end);
- Piecewise<D2<SBasis> > output;
- Affine pre = Translate(-origin) * Rotate(-rad_from_deg(starting_angle));
- PathVector const original_pathv = pathv_to_linear_and_cubic_beziers(path_from_piecewise(remove_short_cuts(pwd2_in, 0.1), 0.001));
- if (fuse_paths) {
- Geom::PathVector path_out;
- Geom::PathVector tmp_path;
- for (Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) {
- if (path_it->empty()) {
- continue;
- }
- bool end_open = false;
- if (path_it->closed()) {
- const Geom::Curve &closingline = path_it->back_closed();
- if (!are_near(closingline.initialPoint(), closingline.finalPoint())) {
- end_open = true;
- }
- }
- Geom::Path original = (Geom::Path)(*path_it);
- if (end_open && path_it->closed()) {
- original.close(false);
- original.appendNew<Geom::LineSegment>( original.initialPoint() );
- original.close(true);
- }
- tmp_path.push_back(original);
- setFusion(tmp_path, divider, size_divider);
- path_out.insert(path_out.end(), tmp_path.begin(), tmp_path.end());
- tmp_path.clear();
+ Geom::Affine pre = Geom::Translate(-origin) * Geom::Rotate(-Geom::rad_from_deg(starting_angle));
+ Geom::PathVector original_pathv = pathv_to_linear_and_cubic_beziers(path_in);
+ Geom::PathVector output_pv;
+ Geom::PathVector output;
+ for (int i = 0; i < num_copies; ++i) {
+ Geom::Rotate rot(-Geom::rad_from_deg(rotation_angle * i));
+ Geom::Affine r = Geom::identity();
+ if( i%2 != 0 && mirror_copies) {
+ r *= Geom::Rotate(Geom::Angle(half_dir)).inverse();
+ r *= Geom::Scale(1, -1);
+ r *= Geom::Rotate(Geom::Angle(half_dir));
}
- if (path_out.size()>0) {
- output = paths_to_pw(path_out);
+ Geom::Affine t = pre * r * rot * Geom::Rotate(Geom::rad_from_deg(starting_angle)) * Geom::Translate(origin);
+ if(mirror_copies && i%2 != 0) {
+ t = pre * r * rot * Geom::Rotate(Geom::rad_from_deg(starting_angle)).inverse() * Geom::Translate(origin);
}
- } else {
- Geom::PathVector output_pv;
- for (int i = 0; i < num_copies; ++i) {
- Rotate rot(-rad_from_deg(rotation_angle * i));
- Affine t = pre * rot * Translate(origin);
- if (join_paths) {
- Geom::PathVector join_pv = path_from_piecewise(pwd2_in * t , 0.01);
- Geom::PathIntersectionGraph *pig = new Geom::PathIntersectionGraph(output_pv, join_pv);
- if (pig) {
- if (!output_pv.empty()) {
- output_pv = pig->getUnion();
- } else {
- output_pv = join_pv;
- }
+ if (method == RM_FUSE || method == RM_KALEIDOSCOPE) {
+ Geom::PathVector join_pv = original_pathv * t;
+ join_pv *= Geom::Translate(half_dir * rot * gap);
+ Geom::PathIntersectionGraph *pig = new Geom::PathIntersectionGraph(output_pv, join_pv);
+ if (pig) {
+ if (!output_pv.empty()) {
+ output_pv = pig->getUnion();
+ } else {
+ output_pv = join_pv;
}
- } else {
- output.concat(pwd2_in * t);
}
+ } else {
+ output_pv = path_in * t;
+ output.insert(output.end(), output_pv.begin(), output_pv.end());
}
- if (join_paths) {
- output = paths_to_pw(output_pv);
- }
+ }
+ if (method == RM_FUSE || method == RM_KALEIDOSCOPE) {
+ output = output_pv;
}
return output;
}
diff --git a/src/live_effects/lpe-copy_rotate.h b/src/live_effects/lpe-copy_rotate.h
index dbec2e1c3..542a4e36e 100644
--- a/src/live_effects/lpe-copy_rotate.h
+++ b/src/live_effects/lpe-copy_rotate.h
@@ -15,6 +15,7 @@
*/
#include "live_effects/effect.h"
+#include "live_effects/parameter/enum.h"
#include "live_effects/parameter/parameter.h"
#include "live_effects/parameter/text.h"
#include "live_effects/parameter/point.h"
@@ -23,13 +24,20 @@
namespace Inkscape {
namespace LivePathEffect {
+enum RotateMethod {
+ RM_NORMAL,
+ RM_KALEIDOSCOPE,
+ RM_FUSE,
+ RM_END
+};
+
class LPECopyRotate : public Effect, GroupBBoxEffect {
public:
LPECopyRotate(LivePathEffectObject *lpeobject);
virtual ~LPECopyRotate();
virtual void doOnApply (SPLPEItem const* lpeitem);
virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
- virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
+ Geom::PathVector doEffect_path_post (Geom::PathVector const & path_in);
virtual void doBeforeEffect (SPLPEItem const* lpeitem);
virtual void doAfterEffect (SPLPEItem const* lpeitem);
virtual void setFusion(Geom::PathVector &path_in, Geom::Path divider, double sizeDivider);
@@ -51,18 +59,21 @@ private:
ScalarParam starting_angle;
ScalarParam rotation_angle;
ScalarParam num_copies;
- ScalarParam split_gap;
+ ScalarParam gap;
BoolParam copies_to_360;
- BoolParam fuse_paths;
- BoolParam join_paths;
+ EnumParam<RotateMethod> method;
+ BoolParam mirror_copies;
BoolParam split_items;
Geom::Point A;
Geom::Point B;
Geom::Point dir;
+ Geom::Point half_dir;
Geom::Point start_pos;
Geom::Point rot_pos;
Geom::Point previous_start_point;
double dist_angle_handle;
+ double size_divider;
+ Geom::Path divider;
double previous_num_copies;
bool reset;
SPObject * container;
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index 683cadc1f..561f1b34c 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -26,8 +26,7 @@ PointParam::PointParam( const Glib::ustring& label, const Glib::ustring& tip,
: Parameter(label, tip, key, wr, effect),
defvalue(default_value),
liveupdate(live_update),
- knoth(NULL),
- _pointwdg(NULL)
+ knoth(NULL)
{
knot_shape = SP_KNOT_SHAPE_DIAMOND;
knot_mode = SP_KNOT_MODE_XOR;
@@ -91,9 +90,7 @@ PointParam::param_setValue(Geom::Point newpoint, bool write)
if(knoth && liveupdate){
knoth->update_knots();
}
- if (_pointwdg) {
- _pointwdg->setValue( newpoint );
- }
+ param_effect->upd_params = true;
}
bool
@@ -129,7 +126,7 @@ PointParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/)
Gtk::Widget *
PointParam::param_newWidget()
{
- _pointwdg = Gtk::manage(
+ Inkscape::UI::Widget::RegisteredTransformedPoint * pointwdg = Gtk::manage(
new Inkscape::UI::Widget::RegisteredTransformedPoint( param_label,
param_tooltip,
param_key,
@@ -138,13 +135,13 @@ PointParam::param_newWidget()
param_effect->getSPDoc() ) );
Geom::Affine transf = Geom::Scale(1, -1);
transf[5] = SP_ACTIVE_DOCUMENT->getHeight().value("px");
- _pointwdg->setTransform(transf);
- _pointwdg->setValue( *this );
- _pointwdg->clearProgrammatically();
- _pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter"));
+ pointwdg->setTransform(transf);
+ pointwdg->setValue( *this );
+ pointwdg->clearProgrammatically();
+ pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter"));
Gtk::HBox * hbox = Gtk::manage( new Gtk::HBox() );
- static_cast<Gtk::HBox*>(hbox)->pack_start(*_pointwdg, true, true);
+ static_cast<Gtk::HBox*>(hbox)->pack_start(*pointwdg, true, true);
static_cast<Gtk::HBox*>(hbox)->show_all_children();
param_effect->upd_params = false;
return dynamic_cast<Gtk::Widget *> (hbox);
diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h
index a3797aea5..a5153ad80 100644
--- a/src/live_effects/parameter/point.h
+++ b/src/live_effects/parameter/point.h
@@ -44,6 +44,7 @@ public:
Geom::Point param_get_default() const;
void param_set_liveupdate(bool live_update);
void param_update_default(Geom::Point default_point);
+
virtual void param_update_default(const gchar * default_point);
virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/);
@@ -62,7 +63,6 @@ private:
SPKnotModeType knot_mode;
guint32 knot_color;
gchar *handle_tip;
- Inkscape::UI::Widget::RegisteredTransformedPoint * _pointwdg;
};
diff --git a/src/main.cpp b/src/main.cpp
index 8be9e2e44..f23f9a9f7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -146,6 +146,7 @@ enum {
SP_ARG_EXPORT_BACKGROUND,
SP_ARG_EXPORT_BACKGROUND_OPACITY,
SP_ARG_EXPORT_SVG,
+ SP_ARG_EXPORT_INKSCAPE_SVG,
SP_ARG_EXPORT_PS,
SP_ARG_EXPORT_EPS,
SP_ARG_EXPORT_PS_LEVEL,
@@ -205,6 +206,7 @@ static gboolean sp_export_area_snap = FALSE;
static gboolean sp_export_use_hints = FALSE;
static gboolean sp_export_id_only = FALSE;
static gchar *sp_export_svg = NULL;
+static gchar *sp_export_inkscape_svg = NULL;
static gchar *sp_export_ps = NULL;
static gchar *sp_export_eps = NULL;
static gint sp_export_ps_level = 3;
@@ -229,6 +231,7 @@ static gchar *sp_dbus_name = NULL;
#endif // WITH_DBUS
static gchar *sp_export_png_utf8 = NULL;
static gchar *sp_export_svg_utf8 = NULL;
+static gchar *sp_export_inkscape_svg_utf8 = NULL;
static gchar *sp_global_printer_utf8 = NULL;
#ifdef WITH_YAML
@@ -257,6 +260,7 @@ static void resetCommandlineGlobals() {
sp_export_use_hints = FALSE;
sp_export_id_only = FALSE;
sp_export_svg = NULL;
+ sp_export_inkscape_svg = NULL;
sp_export_ps = NULL;
sp_export_eps = NULL;
sp_export_ps_level = 3;
@@ -282,6 +286,7 @@ static void resetCommandlineGlobals() {
sp_export_png_utf8 = NULL;
sp_export_svg_utf8 = NULL;
+ sp_export_inkscape_svg_utf8 = NULL;
sp_global_printer_utf8 = NULL;
}
@@ -392,6 +397,10 @@ struct poptOption options[] = {
N_("Background opacity of exported bitmap (either 0.0 to 1.0, or 1 to 255)"),
N_("VALUE")},
+ {"export-inkscape-svg", 0,
+ POPT_ARG_STRING, &sp_export_inkscape_svg, SP_ARG_EXPORT_INKSCAPE_SVG,
+ N_("Export document to an inkscape SVG file (similar to save as.)"),
+ N_("FILENAME")},
{"export-plain-svg", 'l',
POPT_ARG_STRING, &sp_export_svg, SP_ARG_EXPORT_SVG,
N_("Export document to plain SVG file (no sodipodi or inkscape namespaces)"),
@@ -903,6 +912,7 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest )
{
fixupSingleFilename( &sp_export_png, &sp_export_png_utf8 );
fixupSingleFilename( &sp_export_svg, &sp_export_svg_utf8 );
+ fixupSingleFilename( &sp_export_inkscape_svg, &sp_export_inkscape_svg_utf8 );
fixupSingleFilename( &sp_global_printer, &sp_global_printer_utf8 );
#ifdef WITH_YAML
fixupSingleFilename( &sp_xverbs_yaml, &sp_xverbs_yaml_utf8 );
@@ -914,6 +924,8 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest )
sp_export_png_utf8 = g_strdup( sp_export_png );
if ( sp_export_svg )
sp_export_svg_utf8 = g_strdup( sp_export_svg );
+ if ( sp_export_inkscape_svg )
+ sp_export_inkscape_svg_utf8 = g_strdup( sp_export_inkscape_svg );
if ( sp_global_printer )
sp_global_printer_utf8 = g_strdup( sp_global_printer );
#ifdef WITH_YAML
@@ -1135,20 +1147,21 @@ static int sp_process_file_list(GSList *fl)
}
#endif // WITH_DBUS
- if (!sp_export_svg && (sp_vacuum_defs || has_performed_actions)) {
+ if (!sp_export_svg && !sp_export_inkscape_svg && (sp_vacuum_defs || has_performed_actions)) {
// save under the name given in the command line
Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.inkscape"), doc, filename, false,
false, false, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG);
}
+
if (sp_global_printer) {
sp_print_document_to_file(doc, sp_global_printer);
}
if (sp_export_png || (sp_export_id && sp_export_use_hints)) {
retVal |= sp_do_export_png(doc);
}
- if (sp_export_svg) {
+ if (sp_export_svg || sp_export_inkscape_svg) {
if (sp_export_text_to_path) {
- std::vector<SPItem*> items;
+ std::vector<SPItem*> items;
SPRoot *root = doc->getRoot();
doc->ensureUpToDate();
for (auto& iter: root->children) {
@@ -1180,9 +1193,15 @@ static int sp_process_file_list(GSList *fl)
s.set(obj);
s.fitCanvas(false);
}
-
- Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.plain"), doc, sp_export_svg, false,
- false, false, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY);
+ if (sp_export_svg) {
+ Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.plain"), doc, sp_export_svg, false,
+ false, false, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY);
+ }
+ if (sp_export_inkscape_svg) {
+ // Export as inkscape SVG.
+ Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.inkscape"), doc, sp_export_inkscape_svg, false,
+ false, false, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG);
+ }
}
if (sp_export_ps) {
retVal |= do_export_ps_pdf(doc, sp_export_ps, "image/x-postscript");
diff --git a/src/text-editing.cpp b/src/text-editing.cpp
index 6809a4bc5..193f4b15a 100644
--- a/src/text-editing.cpp
+++ b/src/text-editing.cpp
@@ -942,9 +942,9 @@ sp_te_set_repr_text_multiline(SPItem *text, gchar const *str)
gchar *content = g_strdup (str);
repr->setContent("");
- for (auto& child: object->children) {
- if (!SP_IS_FLOWREGION(&child) && !SP_IS_FLOWREGIONEXCLUDE(&child)) {
- repr->removeChild(child.getRepr());
+ for (auto& child: object->childList(false)) {
+ if (!SP_IS_FLOWREGION(child) && !SP_IS_FLOWREGIONEXCLUDE(child)) {
+ repr->removeChild(child->getRepr());
}
}
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 734640584..3cc8ac098 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -708,7 +708,7 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection)
// (we're dealing with unattached representations, so we write to their attributes
// instead of using sp_item_set_transform)
SPUse *use=dynamic_cast<SPUse *>(item);
- if( use && selection->includes(use->get_original()) ){//we are copying something whose parent is also copied (!)
+ if( use && use->get_original() && use->get_original()->parent ){//we are copying something whose parent is also copied (!)
transform = ((SPItem*)(use->get_original()->parent))->i2doc_affine().inverse() * transform;
}
gchar *transform_str = sp_svg_transform_write(transform );
diff --git a/src/ui/widget/color-scales.cpp b/src/ui/widget/color-scales.cpp
index 89913b01b..4023d227c 100644
--- a/src/ui/widget/color-scales.cpp
+++ b/src/ui/widget/color-scales.cpp
@@ -48,6 +48,7 @@ ColorScales::ColorScales(SelectedColor &color, SPColorScalesMode mode)
, _rangeLimit(255.0)
, _updating(FALSE)
, _dragging(FALSE)
+ , _mode(SP_COLOR_SCALES_MODE_NONE)
{
for (gint i = 0; i < 5; i++) {
_l[i] = 0;
diff --git a/src/ui/widget/rotateable.cpp b/src/ui/widget/rotateable.cpp
index e0de22335..0e290730d 100644
--- a/src/ui/widget/rotateable.cpp
+++ b/src/ui/widget/rotateable.cpp
@@ -34,6 +34,7 @@ Rotateable::Rotateable():
signal_button_press_event().connect(sigc::mem_fun(*this, &Rotateable::on_click));
signal_motion_notify_event().connect(sigc::mem_fun(*this, &Rotateable::on_motion));
signal_button_release_event().connect(sigc::mem_fun(*this, &Rotateable::on_release));
+ gtk_widget_add_events(GTK_WIDGET(gobj()), GDK_SCROLL_MASK);
signal_scroll_event().connect(sigc::mem_fun(*this, &Rotateable::on_scroll));
}
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index 0370d55db..65d68195c 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -1380,13 +1380,8 @@ RotateableStrokeWidth::value_adjust(double current, double by, guint /*modifier*
{
double newval;
// by is -1..1
- if (by < 0) {
- // map negative 0..-1 to current..0
- newval = current * (1 + by);
- } else {
- // map positive 0..1 to current..4*current
- newval = current * (1 + by) * (1 + by);
- }
+ double max_f = 50; // maximum width is (current * max_f), minimum - zero
+ newval = current * (std::exp(std::log(max_f-1) * (by+1)) - 1) / (max_f-2);
SPCSSAttr *css = sp_repr_css_attr_new ();
if (final && newval < 1e-6) {
@@ -1394,6 +1389,7 @@ RotateableStrokeWidth::value_adjust(double current, double by, guint /*modifier*
// if it's not final, leave it a chance to increase again (which is not possible with "none")
sp_repr_css_set_property (css, "stroke", "none");
} else {
+ newval = Inkscape::Util::Quantity::convert(newval, parent->_sw_unit, "px");
Inkscape::CSSOStringStream os;
os << newval;
sp_repr_css_set_property (css, "stroke-width", os.str().c_str());
diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h
index efac29f73..065d745f0 100644
--- a/src/ui/widget/selected-style.h
+++ b/src/ui/widget/selected-style.h
@@ -131,6 +131,7 @@ public:
guint _mode[2];
double current_stroke_width;
+ Inkscape::Util::Unit const *_sw_unit; // points to object in UnitTable, do not delete
protected:
SPDesktop *_desktop;
@@ -271,8 +272,6 @@ protected:
void on_popup_preset(int i);
Gtk::MenuItem _popup_sw_remove;
- Inkscape::Util::Unit const *_sw_unit; /// points to object in UnitTable, do not delete
-
void *_drop[2];
bool _dropEnabled[2];
};