summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrian Boguszewski <adrbogus1@student.pg.gda.pl>2016-06-25 19:59:21 +0000
committerAdrian Boguszewski <adrbogus1@student.pg.gda.pl>2016-06-25 19:59:21 +0000
commitfd26a51b7a491e6a6d44d672901830cf8505cf2d (patch)
tree726ce6662fdb57d3773d3b299499f329e8fbfe23 /src
parentAdded first range to ObjectSet (diff)
parentFix bug#168286 also opem regression on bug#1594565 (diff)
downloadinkscape-fd26a51b7a491e6a6d44d672901830cf8505cf2d.tar.gz
inkscape-fd26a51b7a491e6a6d44d672901830cf8505cf2d.zip
Merged trunk
(bzr r14954.1.9)
Diffstat (limited to 'src')
-rw-r--r--src/sp-item-group.cpp104
-rw-r--r--src/widgets/paintbucket-toolbar.cpp16
2 files changed, 112 insertions, 8 deletions
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 83d67cf5a..70d2bc732 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -53,6 +53,10 @@
#include "layer-model.h"
#include "sp-textpath.h"
#include "sp-flowtext.h"
+#include "sp-tspan.h"
+#include "selection-chemistry.h"
+#include "xml/sp-css-attr.h"
+#include "svg/css-ostringstream.h"
using Inkscape::DocumentUndo;
@@ -389,6 +393,89 @@ void sp_item_group_ungroup_handle_clones(SPItem *parent, Geom::Affine const g)
}
void
+sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){
+ for (Inkscape::XML::Node *child = repr->firstChild() ; child; child = child->next() ){
+ if ( child) {
+ sp_recursive_scale_text_size(child, scale);
+ }
+ }
+ SPCSSAttr * css = sp_repr_css_attr(repr,"style");
+ Glib::ustring element = g_quark_to_string(repr->code());
+ if (css && element == "svg:text" || element == "svg:tspan") {
+ gchar const *w = sp_repr_css_property(css, "font-size", NULL);
+ if (w) {
+ gchar *units = NULL;
+ double wd = g_ascii_strtod(w, &units);
+ wd *= scale;
+ if (w != units) {
+ Inkscape::CSSOStringStream os;
+ os << wd << units; // reattach units
+ sp_repr_css_set_property(css, "font-size", os.str().c_str());
+ Glib::ustring css_str;
+ sp_repr_css_write_string(css,css_str);
+ repr->setAttribute("style", css_str.c_str());
+ }
+ }
+ w = NULL;
+ w = sp_repr_css_property(css, "letter-spacing", NULL);
+ if (w) {
+ gchar *units = NULL;
+ double wd = g_ascii_strtod(w, &units);
+ wd *= scale;
+ if (w != units) {
+ Inkscape::CSSOStringStream os;
+ os << wd << units; // reattach units
+ sp_repr_css_set_property(css, "letter-spacing", os.str().c_str());
+ Glib::ustring css_str;
+ sp_repr_css_write_string(css,css_str);
+ repr->setAttribute("style", css_str.c_str());
+ }
+ }
+ w = NULL;
+ w = sp_repr_css_property(css, "word-spacing", NULL);
+ if (w) {
+ gchar *units = NULL;
+ double wd = g_ascii_strtod(w, &units);
+ wd *= scale;
+ if (w != units) {
+ Inkscape::CSSOStringStream os;
+ os << wd << units; // reattach units
+ sp_repr_css_set_property(css, "word-spacing", os.str().c_str());
+ Glib::ustring css_str;
+ sp_repr_css_write_string(css,css_str);
+ repr->setAttribute("style", css_str.c_str());
+ }
+ }
+ gchar const *dx = repr->attribute("dx");
+ if (dx) {
+ gchar ** dxarray = g_strsplit(dx, " ", 0);
+ Inkscape::SVGOStringStream dx_data;
+ while (*dxarray != NULL) {
+ double pos;
+ sp_svg_number_read_d(*dxarray, &pos);
+ pos *= scale;
+ dx_data << pos << " ";
+ dxarray++;
+ }
+ repr->setAttribute("dx", dx_data.str().c_str());
+ }
+ gchar const *dy = repr->attribute("dy");
+ if (dy) {
+ gchar ** dyarray = g_strsplit(dy, " ", 0);
+ Inkscape::SVGOStringStream dy_data;
+ while (*dyarray != NULL) {
+ double pos;
+ sp_svg_number_read_d(*dyarray, &pos);
+ pos *= scale;
+ dy_data << pos << " ";
+ dyarray++;
+ }
+ repr->setAttribute("dy", dy_data.str().c_str());
+ }
+ }
+}
+
+void
sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_done)
{
g_return_if_fail (group != NULL);
@@ -492,7 +579,22 @@ sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_d
// reattached outside of the group, the transform will be written more properly
// (i.e. optimized into the object if the corresponding preference is set)
gchar *affinestr=sp_svg_transform_write(ctrans);
- nrepr->setAttribute("transform", affinestr);
+ SPText * text = dynamic_cast<SPText *>(citem);
+ if (text) {
+ //this causes a change in text-on-path appearance when there is a non-conformal transform, see bug #1594565
+ double scale = (ctrans.expansionX() + ctrans.expansionY()) / 2.0;
+ SPTextPath * text_path = dynamic_cast<SPTextPath *>(text->children);
+ if (!text_path) {
+ nrepr->setAttribute("transform", affinestr);
+ } else {
+ sp_recursive_scale_text_size(nrepr, scale);
+ Geom::Affine ttrans = ctrans.inverse() * SP_ITEM(text)->transform * ctrans;
+ gchar *affinestr = sp_svg_transform_write(ttrans);
+ nrepr->setAttribute("transform", affinestr);
+ }
+ } else {
+ nrepr->setAttribute("transform", affinestr);
+ }
g_free(affinestr);
items = g_slist_prepend (items, nrepr);
diff --git a/src/widgets/paintbucket-toolbar.cpp b/src/widgets/paintbucket-toolbar.cpp
index eb55287c4..b717d74fa 100644
--- a/src/widgets/paintbucket-toolbar.cpp
+++ b/src/widgets/paintbucket-toolbar.cpp
@@ -42,6 +42,7 @@
#include "ui/uxmanager.h"
#include "ui/widget/unit-tracker.h"
#include "util/units.h"
+#include "widgets/ink-action.h"
using Inkscape::UI::Widget::UnitTracker;
using Inkscape::UI::UXManager;
@@ -127,7 +128,7 @@ void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
iterator != channel_list.end(); ++iterator ) {
GtkTreeIter iter;
gtk_list_store_append( model, &iter );
- gtk_list_store_set( model, &iter, 0, (*iterator).c_str(), 1, count, -1 );
+ gtk_list_store_set( model, &iter, 0, _((*iterator).c_str()), 1, count, -1 );
count++;
}
@@ -193,7 +194,7 @@ void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
iterator != gap_list.end(); ++iterator ) {
GtkTreeIter iter;
gtk_list_store_append( model, &iter );
- gtk_list_store_set( model, &iter, 0, (*iterator).c_str(), 1, count, -1 );
+ gtk_list_store_set( model, &iter, 0, _((*iterator).c_str()), 1, count, -1 );
count++;
}
EgeSelectOneAction* act2 = ege_select_one_action_new( "AutoGapAction", _("Close gaps"), (""), NULL, GTK_TREE_MODEL(model) );
@@ -207,13 +208,14 @@ void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
/* Reset */
{
- GtkAction* act = gtk_action_new( "PaintbucketResetAction",
+ InkAction* inky = ink_action_new( "PaintbucketResetAction",
_("Defaults"),
_("Reset paint bucket parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
- INKSCAPE_ICON("edit-clear"));
- g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(paintbucket_defaults), holder );
- gtk_action_group_add_action( mainActions, act );
- gtk_action_set_sensitive( act, TRUE );
+ INKSCAPE_ICON("edit-clear"),
+ Inkscape::ICON_SIZE_SMALL_TOOLBAR);
+ g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(paintbucket_defaults), holder );
+ gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
+ gtk_action_set_sensitive( GTK_ACTION(inky), TRUE );
}
}