diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2017-02-01 20:03:54 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2017-02-01 20:03:54 +0000 |
| commit | f1ddd1e70dbd780b0620bb86682ac0b55db0afce (patch) | |
| tree | 2341a6791dac54782952195cf7b67e00de0fbe19 /src | |
| parent | Avoid crash when opening files containing hrefs with invalid "file:" URIs (diff) | |
| download | inkscape-f1ddd1e70dbd780b0620bb86682ac0b55db0afce.tar.gz inkscape-f1ddd1e70dbd780b0620bb86682ac0b55db0afce.zip | |
Prevent display units from effecting 'line-height' unit.
Allow relative units to be saved in preferences for 'line-height'.
Fixed bugs:
- https://launchpad.net/bugs/1562217
(bzr r15462)
Diffstat (limited to 'src')
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 7 | ||||
| -rw-r--r-- | src/widgets/text-toolbar.cpp | 36 | ||||
| -rw-r--r-- | src/widgets/toolbox.cpp | 3 |
3 files changed, 24 insertions, 22 deletions
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 1884a685e..0a43bc7b2 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1749,9 +1749,16 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags) if (GTK_IS_CONTAINER(i->data)) { GList *grch = gtk_container_get_children (GTK_CONTAINER(i->data)); for (GList *j = grch; j != NULL; j = j->next) { + if (!GTK_IS_WIDGET(j->data)) // wasn't a widget continue; + // Don't apply to text toolbar. We want to be able to + // use different units for text. (Bug 1562217) + const gchar* name = gtk_widget_get_name( (GTK_WIDGET(j->data)) ); + if (strcmp( name, "TextToolbar") == 0) + continue; + gpointer t = sp_search_by_data_recursive(GTK_WIDGET(j->data), (gpointer) "tracker"); if (t == NULL) // didn't find any tracker data continue; diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp index ba79517d2..a0435f690 100644 --- a/src/widgets/text-toolbar.cpp +++ b/src/widgets/text-toolbar.cpp @@ -588,17 +588,14 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl ) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - // Only save if not relative unit - if ( !is_relative(unit) ) { - // This nonsense is to get SP_CSS_UNIT_xx value corresponding to unit so - // we can save it (allows us to adjust line height value when unit changes). - SPILength temp_length; - Inkscape::CSSOStringStream temp_stream; - temp_stream << 1 << unit->abbr; - temp_length.read(temp_stream.str().c_str()); - prefs->setInt("/tools/text/lineheight/display_unit", temp_length.unit); - g_object_set_data( tbl, "lineheight_unit", GINT_TO_POINTER(temp_length.unit)); - } + // This nonsense is to get SP_CSS_UNIT_xx value corresponding to unit so + // we can save it (allows us to adjust line height value when unit changes). + SPILength temp_length; + Inkscape::CSSOStringStream temp_stream; + temp_stream << 1 << unit->abbr; + temp_length.read(temp_stream.str().c_str()); + prefs->setInt("/tools/text/lineheight/display_unit", temp_length.unit); + g_object_set_data( tbl, "lineheight_unit", GINT_TO_POINTER(temp_length.unit)); // Set css line height. SPCSSAttr *css = sp_repr_css_attr_new (); @@ -701,16 +698,13 @@ static void sp_text_lineheight_unit_changed( gpointer /* */, GObject *tbl ) g_return_if_fail(unit != NULL); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - // Only save if not relative unit - if ( !is_relative(unit) ) { - // This nonsense is to get SP_CSS_UNIT_xx value corresponding to unit. - SPILength temp_length; - Inkscape::CSSOStringStream temp_stream; - temp_stream << 1 << unit->abbr; - temp_length.read(temp_stream.str().c_str()); - prefs->setInt("/tools/text/lineheight/display_unit", temp_length.unit); - g_object_set_data( tbl, "lineheight_unit", GINT_TO_POINTER(temp_length.unit)); - } + // This nonsense is to get SP_CSS_UNIT_xx value corresponding to unit. + SPILength temp_length; + Inkscape::CSSOStringStream temp_stream; + temp_stream << 1 << unit->abbr; + temp_length.read(temp_stream.str().c_str()); + prefs->setInt("/tools/text/lineheight/display_unit", temp_length.unit); + g_object_set_data( tbl, "lineheight_unit", GINT_TO_POINTER(temp_length.unit)); // Read current line height value EgeAdjustmentAction *line_height_act = diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 126eac9cd..f34b4625d 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -204,6 +204,7 @@ static struct { SP_VERB_CONTEXT_ERASER_PREFS, "/tools/eraser", _("TBD")}, { "/tools/lpetool", "lpetool_toolbox", 0, sp_lpetool_toolbox_prep, "LPEToolToolbar", SP_VERB_CONTEXT_LPETOOL_PREFS, "/tools/lpetool", _("TBD")}, + // If you change TextToolbar here, change it also in desktop-widget.cpp { "/tools/text", "text_toolbox", 0, sp_text_toolbox_prep, "TextToolbar", SP_VERB_INVALID, 0, 0}, { "/tools/dropper", "dropper_toolbox", 0, sp_dropper_toolbox_prep, "DropperToolbar", @@ -1428,7 +1429,7 @@ void setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop) auto kludge = dataHolders[aux_toolboxes[i].type_name]; auto holder = gtk_grid_new(); - gtk_widget_set_name( holder, "ToolbarHolder" ); + gtk_widget_set_name( holder, aux_toolboxes[i].ui_name ); gtk_grid_attach( GTK_GRID(holder), kludge, 2, 0, 1, 1); gchar* tmp = g_strdup_printf( "/ui/%s", aux_toolboxes[i].ui_name ); GtkWidget* toolBar = gtk_ui_manager_get_widget( mgr, tmp ); |
