summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2016-12-16 12:00:49 +0000
committerJabiertxof <jtx@jtx>2016-12-16 12:00:49 +0000
commit4446366fd075fb801420da520848c774b8ac4254 (patch)
treec2fc74dabefc43fd586aaf51405bebc698d7ba94 /src
parentFixing nested mirrors (diff)
parentFix bug where conical gradient drawn in wrong arc. (diff)
downloadinkscape-4446366fd075fb801420da520848c774b8ac4254.tar.gz
inkscape-4446366fd075fb801420da520848c774b8ac4254.zip
Update to trunk
(bzr r15295.1.23)
Diffstat (limited to 'src')
-rw-r--r--src/desktop-style.cpp11
-rw-r--r--src/file.cpp270
-rw-r--r--src/sp-item-group.cpp5
-rw-r--r--src/sp-mesh-array.cpp2
-rw-r--r--src/ui/tools/tweak-tool.cpp3
-rw-r--r--src/widgets/text-toolbar.cpp48
-rw-r--r--src/widgets/toolbox.cpp1
7 files changed, 295 insertions, 45 deletions
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index dee36d681..4c07c76ea 100644
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
@@ -209,7 +209,7 @@ sp_desktop_set_style(Inkscape::ObjectSet *set, SPDesktop *desktop, SPCSSAttr *cs
if (!change)
return;
-// 2. Emit signal... See desktop->connectStyleSet in text-tool, tweak-tool, and gradient-drag.
+// 2. Emit signal... See desktop->connectSetStyle in text-tool, tweak-tool, and gradient-drag.
bool intercepted = desktop->_set_style_signal.emit(css);
/** \todo
@@ -1045,6 +1045,7 @@ objects_query_fontnumbers (const std::vector<SPItem*> &objects, SPStyle *style_r
bool lineheight_normal = false;
bool lineheight_unit_proportional = false;
bool lineheight_unit_absolute = false;
+ bool lineheight_set = false; // Set true if any object has lineheight set.
double size_prev = 0;
double letterspacing_prev = 0;
@@ -1130,6 +1131,9 @@ objects_query_fontnumbers (const std::vector<SPItem*> &objects, SPStyle *style_r
lineheight_normal = false;
lineheight += lineheight_current * doc_scale;
}
+ if (style->line_height.set) {
+ lineheight_set = true;
+ }
if ((size_prev != 0 && style->font_size.computed != size_prev) ||
(letterspacing_prev != 0 && style->letter_spacing.computed != letterspacing_prev) ||
@@ -1205,6 +1209,9 @@ objects_query_fontnumbers (const std::vector<SPItem*> &objects, SPStyle *style_r
}
}
+ // Used by text toolbar unset 'line-height'
+ style_res->line_height.set = lineheight_set;
+
if (texts > 1) {
if (different || different_lineheight) {
return QUERY_STYLE_MULTIPLE_AVERAGED;
@@ -1907,7 +1914,7 @@ sp_desktop_query_style_from_list (const std::vector<SPItem*> &list, SPStyle *sty
int
sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property)
{
- // Used by text tool and in gradient dragging
+ // Used by text tool and in gradient dragging. See connectQueryStyle.
int ret = desktop->_query_style_signal.emit(style, property);
if (ret != QUERY_STYLE_NOTHING)
diff --git a/src/file.cpp b/src/file.cpp
index 55089209a..8f283e1f8 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -66,6 +66,10 @@
// For updating old Inkscape SVG files
#include "display/canvas-grid.h"
#include "sp-guide.h"
+#include "selection-chemistry.h"
+#include "persp3d.h"
+#include "proj_pt.h"
+#include "ui/shape-editor.h"
#include <gtkmm.h>
@@ -353,11 +357,13 @@ bool sp_file_open(const Glib::ustring &uri,
bool need_fix_units = false;
bool need_fix_guides = false;
bool need_fix_grid_mm = false;
- bool is_extension = false;
+ bool need_fix_box3d = false;
+ bool did_scaling = false;
// Check if potentially need viewbox or unit fix
switch (root->width.unit) {
case SP_CSS_UNIT_PC:
+ case SP_CSS_UNIT_PT:
case SP_CSS_UNIT_MM:
case SP_CSS_UNIT_CM:
case SP_CSS_UNIT_IN:
@@ -366,13 +372,19 @@ bool sp_file_open(const Glib::ustring &uri,
case SP_CSS_UNIT_NONE:
case SP_CSS_UNIT_PX:
need_fix_units = true;
- default:
break;
+ case SP_CSS_UNIT_EM:
+ case SP_CSS_UNIT_EX:
+ case SP_CSS_UNIT_PERCENT:
// OK
+ break;
+ default:
+ std::cerr << "sp_file_open: Unhandled width unit!" << std::endl;
}
switch (root->height.unit) {
case SP_CSS_UNIT_PC:
+ case SP_CSS_UNIT_PT:
case SP_CSS_UNIT_MM:
case SP_CSS_UNIT_CM:
case SP_CSS_UNIT_IN:
@@ -381,14 +393,21 @@ bool sp_file_open(const Glib::ustring &uri,
case SP_CSS_UNIT_NONE:
case SP_CSS_UNIT_PX:
need_fix_units = true;
- default:
break;
+ case SP_CSS_UNIT_EM:
+ case SP_CSS_UNIT_EX:
+ case SP_CSS_UNIT_PERCENT:
// OK
+ break;
+ default:
+ std::cerr << "sp_file_open: Unhandled height unit!" << std::endl;
}
// std::cout << "Absolute SVG units in root? " << (need_fix_viewbox?"true":"false") << std::endl;
// std::cout << "User units in root? " << (need_fix_units ?"true":"false") << std::endl;
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+
if (!root->viewBox_set && need_fix_viewbox) {
Glib::ustring msg = _(
@@ -401,31 +420,37 @@ bool sp_file_open(const Glib::ustring &uri,
Gtk::Label info;
info.set_markup(msg.c_str());
info.show();
-
scaleDialog.get_content_area()->pack_start(info, false, false, 20);
+
Gtk::CheckButton backupButton( _("Create backup file (in same directory).") );
- backupButton.set_active();
+ bool backup = prefs->getBool("/options/dpifixbackup", true);
+ backupButton.set_active( backup );
backupButton.show();
-
scaleDialog.get_content_area()->pack_start(backupButton, false, false, 20);
- scaleDialog.add_button("Set 'viewBox'", 1);
- scaleDialog.add_button("Scale elements", 2);
- scaleDialog.add_button("Ignore", 3);
+
+ scaleDialog.add_button(_("Set 'viewBox'"), 1);
+ scaleDialog.add_button(_("Scale elements"), 2);
+ scaleDialog.add_button(_("Ignore"), 3);
+ scaleDialog.add_button("Scale test - group", 4);
+ scaleDialog.add_button("Scale test - children", 5);
gint response = scaleDialog.run();
- bool backup = backupButton.get_active();
+ backup = backupButton.get_active();
+ prefs->setBool("/options/dpifixbackup", backup);
+
+ if ( backup && response != 3) {
+ sp_file_save_backup( uri );
+ }
+
if (response == 1) {
- if (backup) {
- sp_file_save_backup( uri );
- }
+
doc->setViewBox(Geom::Rect::from_xywh(
0, 0,
doc->getWidth().value("px") * ratio,
doc->getHeight().value("px") * ratio));
+
} else if (response == 2 ) {
- if (backup) {
- sp_file_save_backup( uri );
- }
+
std::list<Inkscape::Extension::Effect *> effects;
Inkscape::Extension::db.get_effect_list(effects);
std::list<Inkscape::Extension::Effect *>::iterator it = effects.begin();
@@ -442,12 +467,65 @@ bool sp_file_open(const Glib::ustring &uri,
if (!did) {
std::cerr << "sp_file_open: Failed to find dpi90to96 extension." << std::endl;
}
- is_extension = true;
+ did_scaling = true;
+
+ } else if (response == 4) {
+
+ // Save preferences
+ bool onlysensitive = prefs->getBool("/options/kbselection/onlysensitive",true);
+ bool onlyvisible = prefs->getBool("/options/kbselection/onlyvisible", true);
+
+ prefs->setBool("/options/kbselection/onlysensitive", false);
+ prefs->setBool("/options/kbselection/onlyvisible", false);
+
+ Inkscape::Selection *selection = desktop->getSelection();
+ Inkscape::SelectionHelper::selectAllInAll( desktop );
+ selection->group();
+ SPItem * group = selection->singleItem();
+ if (group) {
+ group->setAttribute("transform","scale(1.06666667,1.06666667)");
+ } else {
+ std::cerr << "sp_file_open: Failed to get group!" << std::endl;
+ }
+ selection->clear();
+ selection->add( group );
+ selection->ungroup();
+ selection->clear();
+
+ prefs->setBool("/options/kbselection/onlysensitive", onlysensitive);
+ prefs->setBool("/options/kbselection/onlyvisible", onlyvisible );
+
+ did_scaling = true;
+
+ } else if (response == 5) {
+
+ // Save preferences
+ bool transform_stroke = prefs->getBool("/options/transform/stroke", true);
+ bool transform_rectcorners = prefs->getBool("/options/transform/rectcorners", true);
+ bool transform_pattern = prefs->getBool("/options/transform/pattern", true);
+ bool transform_gradient = prefs->getBool("/options/transform/gradient", true);
+
+ prefs->setBool("/options/transform/stroke", true);
+ prefs->setBool("/options/transform/rectcorners", true);
+ prefs->setBool("/options/transform/pattern", true);
+ prefs->setBool("/options/transform/gradient", true);
+
+ Inkscape::UI::ShapeEditor::blockSetItem(true);
+ doc->getRoot()->scaleChildItemsRec(Geom::Scale(1/ratio),Geom::Point(0, 0), false);
+ Inkscape::UI::ShapeEditor::blockSetItem(false);
+
+ // Restore preferences
+ prefs->setBool("/options/transform/stroke", transform_stroke);
+ prefs->setBool("/options/transform/rectcorners", transform_rectcorners);
+ prefs->setBool("/options/transform/pattern", transform_pattern);
+ prefs->setBool("/options/transform/gradient", transform_gradient);
}
+
+ need_fix_box3d = true;
need_fix_guides = true; // Always fix guides
}
- if (need_fix_units) {
+ else if (need_fix_units) {
Glib::ustring msg = (
"Old Inkscape files use 1in == 90px. CSS requires 1in == 96px.\n"
"Drawings meant to match a physical size (e.g. Letter or A4)\n"
@@ -462,19 +540,27 @@ bool sp_file_open(const Glib::ustring &uri,
scaleDialog.get_content_area()->pack_start(info, false, false, 20);
Gtk::CheckButton backupButton( _("Create backup file (in same directory).") );
- scaleDialog.get_content_area()->pack_start(backupButton, false, false, 20);
+ bool backup = prefs->getBool("/options/dpifixbackup", true);
+ backupButton.set_active( backup );
backupButton.show();
+ scaleDialog.get_content_area()->pack_start(backupButton, false, false, 20);
- scaleDialog.add_button("Set 'viewBox'", 1);
- scaleDialog.add_button("Scale elements", 2);
- scaleDialog.add_button("Ignore", 3);
+ scaleDialog.add_button(_("Set 'viewBox'"), 1);
+ scaleDialog.add_button(_("Scale elements"), 2);
+ scaleDialog.add_button(_("Ignore"), 3);
+ scaleDialog.add_button("Scale test - group", 4);
+ scaleDialog.add_button("Scale test - children", 5);
gint response = scaleDialog.run();
- bool backup = backupButton.get_active();
+ backup = backupButton.get_active();
+ prefs->setBool("/options/dpifixbackup", backup);
+
+ if ( backup && response != 3) {
+ sp_file_save_backup( uri );
+ }
+
if (response == 1) {
- if (backup) {
- sp_file_save_backup( uri );
- }
+
if (!root->viewBox_set) {
doc->setViewBox(Geom::Rect::from_xywh(
0, 0,
@@ -488,10 +574,10 @@ bool sp_file_open(const Glib::ustring &uri,
doc->setWidthAndHeight( width, height, false );
need_fix_guides = true; // Only fix guides if drawing scaled
+ need_fix_box3d = true;
+
} else if (response == 2) {
- if (backup) {
- sp_file_save_backup( uri );
- }
+
std::list<Inkscape::Extension::Effect *> effects;
Inkscape::Extension::db.get_effect_list(effects);
std::list<Inkscape::Extension::Effect *>::iterator it = effects.begin();
@@ -509,14 +595,94 @@ bool sp_file_open(const Glib::ustring &uri,
std::cerr << "sp_file_open: Failed to find dpi90to96 extension." << std::endl;
}
need_fix_guides = true; // Only fix guides if drawing scaled
- is_extension = true;
+ did_scaling = true;
+
+ } else if (response == 4) {
+
+ Inkscape::Util::Quantity width =
+ Inkscape::Util::Quantity(doc->getWidth().value("px")/ratio, "px" );
+ Inkscape::Util::Quantity height =
+ Inkscape::Util::Quantity(doc->getHeight().value("px")/ratio,"px" );
+ doc->setWidthAndHeight( width, height, false );
+
+ if (!root->viewBox_set) {
+
+ // Save preferences
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ bool onlysensitive = prefs->getBool("/options/kbselection/onlysensitive",true);
+ bool onlyvisible = prefs->getBool("/options/kbselection/onlyvisible", true);
+
+ prefs->setBool("/options/kbselection/onlysensitive", false);
+ prefs->setBool("/options/kbselection/onlyvisible", false);
+
+ Inkscape::Selection *selection = desktop->getSelection();
+ Inkscape::SelectionHelper::selectAllInAll( desktop );
+ selection->group();
+ SPItem * group = selection->singleItem();
+ if (group) {
+ group->setAttribute("transform","scale(1.06666667,1.06666667)");
+ } else {
+ std::cerr << "sp_file_open: Failed to get group!" << std::endl;
+ }
+ selection->clear();
+ selection->add( group );
+ selection->ungroup();
+ selection->clear();
+
+ prefs->setBool("/options/kbselection/onlysensitive", onlysensitive);
+ prefs->setBool("/options/kbselection/onlyvisible", onlyvisible );
+
+ did_scaling = true;
+ }
+
+ need_fix_box3d = true;
+ need_fix_guides = true; // Only fix guides if drawing scaled
+
+ } else if (response == 5) {
+
+ Inkscape::Util::Quantity width =
+ Inkscape::Util::Quantity(doc->getWidth().value("px")/ratio, "px" );
+ Inkscape::Util::Quantity height =
+ Inkscape::Util::Quantity(doc->getHeight().value("px")/ratio,"px" );
+ doc->setWidthAndHeight( width, height, false );
+
+ if (!root->viewBox_set) {
+
+ // Save preferences
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ bool transform_stroke = prefs->getBool("/options/transform/stroke", true);
+ bool transform_rectcorners = prefs->getBool("/options/transform/rectcorners", true);
+ bool transform_pattern = prefs->getBool("/options/transform/pattern", true);
+ bool transform_gradient = prefs->getBool("/options/transform/gradient", true);
+
+ prefs->setBool("/options/transform/stroke", true);
+ prefs->setBool("/options/transform/rectcorners", true);
+ prefs->setBool("/options/transform/pattern", true);
+ prefs->setBool("/options/transform/gradient", true);
+
+ Inkscape::UI::ShapeEditor::blockSetItem(true);
+ doc->getRoot()->scaleChildItemsRec(Geom::Scale(1/ratio),Geom::Point(0, 0), false);
+ Inkscape::UI::ShapeEditor::blockSetItem(false);
+
+ // Restore preferences
+ prefs->setBool("/options/transform/stroke", transform_stroke);
+ prefs->setBool("/options/transform/rectcorners", transform_rectcorners);
+ prefs->setBool("/options/transform/pattern", transform_pattern);
+ prefs->setBool("/options/transform/gradient", transform_gradient);
+
+ did_scaling = true;
+ }
+
+ need_fix_box3d = true;
+ need_fix_guides = true; // Only fix guides if drawing scaled
+
} else {
// Ignore
need_fix_grid_mm = true;
}
}
- // Fix guides and grids
+ // Fix guides and grids and perspective
for (SPObject *child = root->firstChild() ; child; child = child->getNext() ) {
SPNamedView *nv = dynamic_cast<SPNamedView *>(child);
if (nv) {
@@ -555,21 +721,53 @@ bool sp_file_open(const Glib::ustring &uri,
}
} else {
if (need_fix_guides) {
- // HACK: Scaling the document does not seem to cause
- // grids defined in document units to be updated.
- // This forces an update.
- if(is_extension){
+ if(did_scaling){
xy->Scale( Geom::Scale(ratio,ratio).inverse() );
} else {
+ // HACK: Scaling the document does not seem to cause
+ // grids defined in document units to be updated.
+ // This forces an update.
xy->Scale( Geom::Scale(1,1) );
}
}
}
}
}
+ } // If SPNamedView
+
+ SPDefs *defs = dynamic_cast<SPDefs *>(child);
+ if (defs && need_fix_box3d) {
+ for (SPObject *child = defs->firstChild() ; child; child = child->getNext() ) {
+ Persp3D* persp3d = dynamic_cast<Persp3D *>(child);
+ if (persp3d) {
+ std::vector<Glib::ustring> tokens;
+
+ const gchar* vp_x = persp3d->getAttribute("inkscape:vp_x");
+ const gchar* vp_y = persp3d->getAttribute("inkscape:vp_y");
+ const gchar* vp_z = persp3d->getAttribute("inkscape:vp_z");
+ const gchar* vp_o = persp3d->getAttribute("inkscape:persp3d-origin");
+ // std::cout << "Found Persp3d: "
+ // << " vp_x: " << vp_x
+ // << " vp_y: " << vp_y
+ // << " vp_z: " << vp_z << std::endl;
+ Proj::Pt2 pt_x (vp_x);
+ Proj::Pt2 pt_y (vp_y);
+ Proj::Pt2 pt_z (vp_z);
+ Proj::Pt2 pt_o (vp_o);
+ pt_x = pt_x * (1.0/ratio);
+ pt_y = pt_y * (1.0/ratio);
+ pt_z = pt_z * (1.0/ratio);
+ pt_o = pt_o * (1.0/ratio);
+ persp3d->setAttribute("inkscape:vp_x",pt_x.coord_string());
+ persp3d->setAttribute("inkscape:vp_y",pt_y.coord_string());
+ persp3d->setAttribute("inkscape:vp_z",pt_z.coord_string());
+ persp3d->setAttribute("inkscape:persp3d-origin",pt_o.coord_string());
+ }
+ }
}
- } // Look for SPNamedView loop
+ } // Look for SPNamedView and SPDefs loop
+ // desktop->getDocument()->ensureUpToDate(); // Does not update box3d!
DocumentUndo::done(desktop->getDocument(), SP_VERB_NONE, _("Update Document"));
} // If old Inkscape version
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 96dcdbe30..7b2507b5e 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -584,12 +584,13 @@ sp_item_group_ungroup (SPGroup *group, std::vector<SPItem*> &children, bool do_d
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->firstChild());
if (!text_path) {
nrepr->setAttribute("transform", affinestr);
} else {
- sp_recursive_scale_text_size(nrepr, scale);
+ // The following breaks roundtripping group -> ungroup
+ // double scale = (ctrans.expansionX() + ctrans.expansionY()) / 2.0;
+ // 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);
diff --git a/src/sp-mesh-array.cpp b/src/sp-mesh-array.cpp
index b522d577b..f192d0e44 100644
--- a/src/sp-mesh-array.cpp
+++ b/src/sp-mesh-array.cpp
@@ -1198,7 +1198,7 @@ void SPMeshNodeArray::create( SPMeshGradient *mg, SPItem *item, Geom::OptRect bb
ry = arc->ry.computed;
start = arc->start;
end = arc->end;
- if( end == start ) {
+ if( end <= start ) {
end += 2.0 * M_PI;
}
}
diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp
index 56939cc30..ff5d623c2 100644
--- a/src/ui/tools/tweak-tool.cpp
+++ b/src/ui/tools/tweak-tool.cpp
@@ -1084,7 +1084,8 @@ sp_tweak_dilate (TweakTool *tc, Geom::Point event_p, Geom::Point p, Geom::Point
double move_force = get_move_force(tc);
double color_force = MIN(sqrt(path_force)/20.0, 1);
- auto items= selection->items();
+// auto items= selection->items();
+ std::vector<SPItem*> items(selection->items().begin(), selection->items().end());
for(auto i=items.begin();i!=items.end(); ++i){
SPItem *item = *i;
diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp
index 847ebd8c1..784c467f1 100644
--- a/src/widgets/text-toolbar.cpp
+++ b/src/widgets/text-toolbar.cpp
@@ -239,7 +239,7 @@ static void sp_text_fontsize_value_changed( Ink_ComboBoxEntry_Action *act, GObje
if (dynamic_cast<SPText *>(*i) || dynamic_cast<SPFlowtext *>(*i)) {
SPItem *item = *i;
- // Scale by inverse of accumulated paraent transform
+ // Scale by inverse of accumulated parent transform
SPCSSAttr *css_set = sp_repr_css_attr_new();
sp_repr_css_merge(css_set, css);
Geom::Affine const local(item->i2doc_affine());
@@ -321,6 +321,29 @@ static void sp_text_outer_style_changed( InkToggleAction*act, GObject *tbl )
sp_text_toolbox_selection_changed( NULL, tbl );
}
+// Unset line height on selection's inner text objects (tspan, etc.).
+static void sp_text_lineheight_unset_changed( InkToggleAction*act, GObject *tbl )
+{
+ // quit if run by the _changed callbacks
+ if (g_object_get_data(G_OBJECT(tbl), "freeze")) {
+ return;
+ }
+ g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE) );
+
+ SPCSSAttr *css = sp_repr_css_attr_new();
+ sp_repr_css_unset_property(css, "line-height");
+
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ sp_desktop_set_style (desktop, css);
+
+ sp_repr_css_attr_unref(css);
+
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT,
+ _("Text: Unset line height."));
+
+ g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
+}
+
// Handles both Superscripts and Subscripts
static void sp_text_script_changed( InkToggleAction* act, GObject *tbl )
{
@@ -599,7 +622,7 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl )
if (dynamic_cast<SPText *>(*i) || dynamic_cast<SPFlowtext *>(*i)) {
SPItem *item = *i;
- // Scale by inverse of accumulated paraent transform
+ // Scale by inverse of accumulated parent transform
SPCSSAttr *css_set = sp_repr_css_attr_new();
sp_repr_css_merge(css_set, css);
Geom::Affine const local(item->i2doc_affine());
@@ -1405,7 +1428,13 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
}
// Save unit so we can do convertions between new/old units.
g_object_set_data( tbl, "lineheight_unit", GINT_TO_POINTER(line_height_unit));
-
+
+ // Enable and turn on only if selection includes an object with line height set.
+ InkToggleAction* lineHeightUnset =
+ INK_TOGGLE_ACTION( g_object_get_data( tbl, "TextLineHeightUnsetAction"));
+ gtk_action_set_sensitive(GTK_ACTION(lineHeightUnset), query.line_height.set );
+ gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(lineHeightUnset), query.line_height.set );
+
// Word spacing
double wordSpacing;
if (query.word_spacing.normal) wordSpacing = 0.0;
@@ -2100,6 +2129,19 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
g_object_set( G_OBJECT(eact), "iconId", "text_rotation", NULL );
}
+ /* Text line height unset */
+ {
+ InkToggleAction* act = ink_toggle_action_new( "TextLineHeightUnsetAction", // Name
+ _("Unset line height"), // Label
+ _("If enabled, line height is set on part of selection. Click to unset."),
+ INKSCAPE_ICON("paint-unknown"),
+ secondarySize ); // Icon size
+ gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
+ g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_text_lineheight_unset_changed), holder );
+ gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/text/line_height_unset", false) );
+ g_object_set_data( holder, "TextLineHeightUnsetAction", act );
+ }
+
/* Text outer style */
{
InkToggleAction* act = ink_toggle_action_new( "TextOuterStyleAction", // Name
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 1f6cb136c..a3db3c33d 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -514,6 +514,7 @@ static gchar const * ui_descr =
" <toolitem action='TextFontSizeAction' />"
" <toolitem action='TextLineHeightAction' />"
" <toolitem action='TextLineHeightUnitsAction' />"
+ " <toolitem action='TextLineHeightUnsetAction' />"
" <separator />"
" <toolitem action='TextAlignAction' />"
" <separator />"