From 3fafb26dd126ef1bbb4563619e5060cf02ad0d9e Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 13 May 2010 10:37:58 +0200 Subject: Add ability to set icons to insensitive. Used to disable "Justify" button for non-flowed text in text-tool toolbar. (bzr r9408) --- src/widgets/toolbox.cpp | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index de97e9ea4..8aed18d7b 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -7033,31 +7033,37 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(textItalicAction), italicSet ); + + EgeSelectOneAction* textAlignAction = EGE_SELECT_ONE_ACTION( g_object_get_data( tbl, "TextAlignAction" ) ); // Alignment // Note: SVG 1.1 doesn't include text-align, SVG 1.2 Tiny doesn't include text-align="justify" // text-align="justify" was a draft SVG 1.2 item (along with flowed text). // Only flowed text can be left and right justified at the same time. // Check if we have flowed text and disable botton. - // NEED: ege_select_one_action_set_sensitve( ) - /* gboolean isFlow = false; for (GSList const *items = sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList(); items != NULL; items = items->next) { - const gchar* id = SP_OBJECT_ID((SPItem *) items->data); - std::cout << " " << id << std::endl; + // const gchar* id = SP_OBJECT_ID((SPItem *) items->data); + // std::cout << " " << id << std::endl; if( SP_IS_FLOWTEXT(( SPItem *) items->data )) { isFlow = true; - std::cout << " Found flowed text" << std::endl; + // std::cout << " Found flowed text" << std::endl; break; } } - if( isFlow ) { - // enable justify button - } else { - // disable justify button - } - */ + + // The GtkTreeModel class doesn't have a set function so we can't + // simply add an ege_select_one_action_set_sensitive method! + // We must set values directly with the GtkListStore and then + // ask that the GtkAction update the sensitive parameters. + GtkListStore * model = GTK_LIST_STORE( ege_select_one_action_get_model( textAlignAction ) ); + GtkTreePath * path = gtk_tree_path_new_from_string("3"); // Justify entry + GtkTreeIter iter; + gtk_tree_model_get_iter( GTK_TREE_MODEL (model), &iter, path ); + gtk_list_store_set( model, &iter, /* column */ 3, isFlow, -1 ); + ege_select_one_action_update_sensitive( textAlignAction ); + // ege_select_one_action_set_sensitive( textAlignAction, 3, isFlow ); int activeButton = 0; if (query->text_align.computed == SP_CSS_TEXT_ALIGN_JUSTIFY) @@ -7068,7 +7074,6 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_MIDDLE) activeButton = 1; if (query->text_anchor.computed == SP_CSS_TEXT_ANCHOR_END) activeButton = 2; } - EgeSelectOneAction* textAlignAction = EGE_SELECT_ONE_ACTION( g_object_get_data( tbl, "TextAlignAction" ) ); ege_select_one_action_set_active( textAlignAction, activeButton ); @@ -7258,7 +7263,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions /* Alignment */ { - GtkListStore* model = gtk_list_store_new( 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); + GtkListStore* model = gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN ); GtkTreeIter iter; @@ -7267,6 +7272,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions 0, _("Align left"), 1, _("Align left"), 2, GTK_STOCK_JUSTIFY_LEFT, + 3, true, -1 ); gtk_list_store_append( model, &iter ); @@ -7274,6 +7280,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions 0, _("Align center"), 1, _("Align center"), 2, GTK_STOCK_JUSTIFY_CENTER, + 3, true, -1 ); gtk_list_store_append( model, &iter ); @@ -7281,6 +7288,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions 0, _("Align right"), 1, _("Align right"), 2, GTK_STOCK_JUSTIFY_RIGHT, + 3, true, -1 ); gtk_list_store_append( model, &iter ); @@ -7288,6 +7296,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions 0, _("Justify"), 1, _("Justify - Only flowed text"), 2, GTK_STOCK_JUSTIFY_FILL, + 3, false, -1 ); EgeSelectOneAction* act = ege_select_one_action_new( "TextAlignAction", // Name @@ -7305,7 +7314,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions ege_select_one_action_set_icon_column( act, 2 ); ege_select_one_action_set_icon_size( act, secondarySize ); ege_select_one_action_set_tooltip_column( act, 1 ); - + ege_select_one_action_set_sensitive_column( act, 3 ); gint mode = prefs->getInt("/tools/text/align_mode", 0); ege_select_one_action_set_active( act, mode ); g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_text_align_mode_changed), holder ); -- cgit v1.2.3 From 4e30cc37538c7d0c68a8183f352fa4c96476cc17 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 13 May 2010 14:16:04 +0200 Subject: Get rid of unneeded labels when the icons are self-explanatory. (bzr r9410) --- src/widgets/toolbox.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 8aed18d7b..6a5ac6ebe 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -7304,7 +7304,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions _("Text Alignment"), // Tooltip NULL, // StockID GTK_TREE_MODEL(model) ); // Model - g_object_set( act, "short_label", _("Align"), NULL ); + g_object_set( act, "short_label", "NotUsed", NULL ); gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); g_object_set_data( holder, "TextAlignAction", act ); @@ -7346,7 +7346,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions NULL, // StockID GTK_TREE_MODEL(model) ); // Model - g_object_set( act, "short_label", _("O:"), NULL ); + g_object_set( act, "short_label", "NotUsed", NULL ); gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); g_object_set_data( holder, "TextOrientationAction", act ); -- cgit v1.2.3 From f1b28615cb0ce50d3e0d9ba841d700a2905fdbec Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 14 May 2010 22:13:53 +0200 Subject: Add dx (kerning), dy (vertical shifting), and rotate widgets to text toolbar along with routines needed by them. (bzr r9417) --- src/widgets/toolbox.cpp | 219 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 216 insertions(+), 3 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 6a5ac6ebe..4078fec06 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -85,6 +85,8 @@ #include "../sp-text.h" #include "../style.h" #include "../svg/css-ostringstream.h" +#include "../text-context.h" +#include "../text-editing.h" #include "../tools-switch.h" #include "../tweak-context.h" #include "../spray-context.h" @@ -490,6 +492,9 @@ static gchar const * ui_descr = " " " " " " + " " + " " + " " " " " " " " @@ -6869,6 +6874,82 @@ static void sp_text_letterspacing_value_changed( GtkAdjustment *adj, GObject *tb g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); } + +static void sp_text_dx_value_changed( GtkAdjustment *adj, 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) ); + + gdouble new_dx = adj->value; + + SPTextContext *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context); + if( tc ) { + unsigned char_index = -1; + TextTagAttributes *attributes = + text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index ); + if( attributes ) { + double old_dx = attributes->getDx( char_index ); + double delta_dx = new_dx - old_dx; + sp_te_adjust_dx( tc->text, tc->text_sel_start, tc->text_sel_end, SP_ACTIVE_DESKTOP, delta_dx ); + } + } + + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); +} + +static void sp_text_dy_value_changed( GtkAdjustment *adj, 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) ); + + gdouble new_dy = adj->value; + + SPTextContext *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context); + if( tc ) { + unsigned char_index = -1; + TextTagAttributes *attributes = + text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index ); + if( attributes ) { + double old_dy = attributes->getDy( char_index ); + double delta_dy = new_dy - old_dy; + sp_te_adjust_dy( tc->text, tc->text_sel_start, tc->text_sel_end, SP_ACTIVE_DESKTOP, delta_dy ); + } + } + + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); +} + +static void sp_text_rotation_value_changed( GtkAdjustment *adj, 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) ); + + gdouble new_degrees = adj->value; + + SPTextContext *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context); + if( tc ) { + unsigned char_index = -1; + TextTagAttributes *attributes = + text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index ); + if( attributes ) { + double old_degrees = attributes->getRotate( char_index ); + double delta_deg = new_degrees - old_degrees; + sp_te_adjust_rotation( tc->text, tc->text_sel_start, tc->text_sel_end, SP_ACTIVE_DESKTOP, delta_deg ); + } + } + + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); +} + static void sp_text_orientation_mode_changed( EgeSelectOneAction *act, GObject *tbl ) { // quit if run by the _changed callbacks @@ -6938,6 +7019,9 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ const gchar* id = SP_OBJECT_ID((SPItem *) items->data); std::cout << " " << id << std::endl; } + Glib::ustring selected_text = sp_text_get_selected_text((SP_ACTIVE_DESKTOP)->event_context); + std::cout << " Selected text:" << std::endl; + std::cout << selected_text << std::endl; #endif // quit if run by the _changed callbacks @@ -7116,7 +7200,6 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION( letterSpacingAction )); gtk_adjustment_set_value( letterSpacingAdjustment, letterSpacing ); - // Orientation int activeButton2 = (query->writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB ? 0 : 1); @@ -7146,12 +7229,52 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ << " letter_spacing.value: " << query->letter_spacing.value << " letter_spacing.unit: " << query->letter_spacing.unit << std::endl; std::cout << " GUI: writing_mode.computed: " << query->writing_mode.computed << std::endl; - std::cout << "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << std::endl; - std::cout << std::endl; #endif sp_style_unref(query); + // Kerning (xshift), yshift, rotation. NB: These are not CSS attributes. + SPTextContext *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context); + if( tc ) { + unsigned char_index = -1; + TextTagAttributes *attributes = + text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index ); + if( attributes ) { + + // Dx + double dx = attributes->getDx( char_index ); + GtkAction* dxAction = GTK_ACTION( g_object_get_data( tbl, "TextDxAction" )); + GtkAdjustment *dxAdjustment = + ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION( dxAction )); + gtk_adjustment_set_value( dxAdjustment, dx ); + + // Dy + double dy = attributes->getDy( char_index ); + GtkAction* dyAction = GTK_ACTION( g_object_get_data( tbl, "TextDyAction" )); + GtkAdjustment *dyAdjustment = + ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION( dyAction )); + gtk_adjustment_set_value( dyAdjustment, dy ); + + // Rotation + double rotation = attributes->getRotate( char_index ); + GtkAction* rotationAction = GTK_ACTION( g_object_get_data( tbl, "TextRotationAction" )); + GtkAdjustment *rotationAdjustment = + ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION( rotationAction )); + gtk_adjustment_set_value( rotationAdjustment, rotation ); + +#ifdef DEBUG_TEXT + std::cout << " GUI: Dx: " << dx << std::endl; + std::cout << " GUI: Dy: " << dy << std::endl; + std::cout << " GUI: Rotation: " << rotation << std::endl; +#endif + } + } + +#ifdef DEBUG_TEXT + std::cout << "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << std::endl; + std::cout << std::endl; +#endif + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); } @@ -7452,6 +7575,96 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions g_object_set_data( holder, "TextLetterSpacingAction", eact ); } + /* Character kerning (horizontal shift) */ + { + // Drop down menu + gchar const* labels[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + gdouble values[] = { -2.0, -1.5, -1.0, -0.5, 0, 0.5, 1.0, 1.5, 2.0, 2.5 }; + + EgeAdjustmentAction *eact = create_adjustment_action( + "TextDxAction", /* name */ + _("Kerning"), /* label */ + _("Kern:"), /* short label */ + _("Kerning (horizontal shift of characters)."), /* tooltip */ + "/tools/text/dx", /* path? */ + 0.0, /* default */ + GTK_WIDGET(desktop->canvas), /* focusTarget */ + NULL, /* unit selector */ + holder, /* dataKludge */ + FALSE, /* set alt-x keyboard shortcut? */ + NULL, /* altx_mark */ + -100.0, 100.0, 0.01, 0.1, /* lower, upper, step (arrow up/down), page up/down */ + labels, values, G_N_ELEMENTS(labels), /* drop down menu */ + sp_text_dx_value_changed, /* callback */ + 0.1, /* step (used?) */ + 2, /* digits to show */ + 1.0 /* factor (multiplies default) */ + ); + gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); + gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); + g_object_set_data( holder, "TextDxAction", eact ); + } + + /* Character vertical shift */ + { + // Drop down menu + gchar const* labels[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + gdouble values[] = { -2.0, -1.5, -1.0, -0.5, 0, 0.5, 1.0, 1.5, 2.0, 2.5 }; + + EgeAdjustmentAction *eact = create_adjustment_action( + "TextDyAction", /* name */ + _("Vertical Shift"), /* label */ + _("Vert:"), /* short label */ + _("Vertical shift of characters."), /* tooltip */ + "/tools/text/dy", /* path? */ + 0.0, /* default */ + GTK_WIDGET(desktop->canvas), /* focusTarget */ + NULL, /* unit selector */ + holder, /* dataKludge */ + FALSE, /* set alt-x keyboard shortcut? */ + NULL, /* altx_mark */ + -100.0, 100.0, 0.01, 0.1, /* lower, upper, step (arrow up/down), page up/down */ + labels, values, G_N_ELEMENTS(labels), /* drop down menu */ + sp_text_dy_value_changed, /* callback */ + 0.1, /* step (used?) */ + 2, /* digits to show */ + 1.0 /* factor (multiplies default) */ + ); + gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); + gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); + g_object_set_data( holder, "TextDyAction", eact ); + } + + /* Character rotation */ + { + // Drop down menu + gchar const* labels[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + gdouble values[] = { -90, -45, -30, -15, 0, 15, 30, 45, 90, 180 }; + + EgeAdjustmentAction *eact = create_adjustment_action( + "TextRotationAction", /* name */ + _("Letter rotation"), /* label */ + _("Rot:"), /* short label */ + _("Rotation of selected characters (degrees)."),/* tooltip */ + "/tools/text/letterspacing", /* path? */ + 0.0, /* default */ + GTK_WIDGET(desktop->canvas), /* focusTarget */ + NULL, /* unit selector */ + holder, /* dataKludge */ + FALSE, /* set alt-x keyboard shortcut? */ + NULL, /* altx_mark */ + -180.0, 180.0, 0.1, 1.0, /* lower, upper, step (arrow up/down), page up/down */ + labels, values, G_N_ELEMENTS(labels), /* drop down menu */ + sp_text_rotation_value_changed, /* callback */ + 0.1, /* step (used?) */ + 2, /* digits to show */ + 1.0 /* factor (multiplies default) */ + ); + gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); + gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); + g_object_set_data( holder, "TextRotationAction", eact ); + } + // Is this necessary to call? Shouldn't hurt. sp_text_toolbox_selection_changed(sp_desktop_selection(desktop), holder); -- cgit v1.2.3 From fb55d9b4e2b5e99d425a2b9e22026c0c1867386a Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 15 May 2010 06:29:37 +0200 Subject: A couple small bug fixes for new text toolbar widgets. (bzr r9420) --- src/widgets/toolbox.cpp | 130 ++++++++++++++++++++++++++---------------------- 1 file changed, 70 insertions(+), 60 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 4078fec06..62af61943 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -6885,15 +6885,17 @@ static void sp_text_dx_value_changed( GtkAdjustment *adj, GObject *tbl ) gdouble new_dx = adj->value; - SPTextContext *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context); - if( tc ) { - unsigned char_index = -1; - TextTagAttributes *attributes = - text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index ); - if( attributes ) { - double old_dx = attributes->getDx( char_index ); - double delta_dx = new_dx - old_dx; - sp_te_adjust_dx( tc->text, tc->text_sel_start, tc->text_sel_end, SP_ACTIVE_DESKTOP, delta_dx ); + if( SP_IS_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context) ) { + SPTextContext *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context); + if( tc ) { + unsigned char_index = -1; + TextTagAttributes *attributes = + text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index ); + if( attributes ) { + double old_dx = attributes->getDx( char_index ); + double delta_dx = new_dx - old_dx; + sp_te_adjust_dx( tc->text, tc->text_sel_start, tc->text_sel_end, SP_ACTIVE_DESKTOP, delta_dx ); + } } } @@ -6910,15 +6912,17 @@ static void sp_text_dy_value_changed( GtkAdjustment *adj, GObject *tbl ) gdouble new_dy = adj->value; - SPTextContext *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context); - if( tc ) { - unsigned char_index = -1; - TextTagAttributes *attributes = - text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index ); - if( attributes ) { - double old_dy = attributes->getDy( char_index ); - double delta_dy = new_dy - old_dy; - sp_te_adjust_dy( tc->text, tc->text_sel_start, tc->text_sel_end, SP_ACTIVE_DESKTOP, delta_dy ); + if( SP_IS_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context) ) { + SPTextContext *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context); + if( tc ) { + unsigned char_index = -1; + TextTagAttributes *attributes = + text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index ); + if( attributes ) { + double old_dy = attributes->getDy( char_index ); + double delta_dy = new_dy - old_dy; + sp_te_adjust_dy( tc->text, tc->text_sel_start, tc->text_sel_end, SP_ACTIVE_DESKTOP, delta_dy ); + } } } @@ -6935,15 +6939,17 @@ static void sp_text_rotation_value_changed( GtkAdjustment *adj, GObject *tbl ) gdouble new_degrees = adj->value; - SPTextContext *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context); - if( tc ) { - unsigned char_index = -1; - TextTagAttributes *attributes = - text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index ); - if( attributes ) { - double old_degrees = attributes->getRotate( char_index ); - double delta_deg = new_degrees - old_degrees; - sp_te_adjust_rotation( tc->text, tc->text_sel_start, tc->text_sel_end, SP_ACTIVE_DESKTOP, delta_deg ); + if( SP_IS_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context) ) { + SPTextContext *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context); + if( tc ) { + unsigned char_index = -1; + TextTagAttributes *attributes = + text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index ); + if( attributes ) { + double old_degrees = attributes->getRotate( char_index ); + double delta_deg = new_degrees - old_degrees; + sp_te_adjust_rotation( tc->text, tc->text_sel_start, tc->text_sel_end, SP_ACTIVE_DESKTOP, delta_deg ); + } } } @@ -7091,6 +7097,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ ink_comboboxentry_action_set_active_text( fontFamilyAction, fontFamily ); } + // Size (average of text selected) double size = query->font_size.computed; gchar size_text[G_ASCII_DTOSTR_BUF_SIZE]; @@ -7100,6 +7107,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ INK_COMBOBOXENTRY_ACTION( g_object_get_data( tbl, "TextFontSizeAction" ) ); ink_comboboxentry_action_set_active_text( fontSizeAction, size_text ); + // Weight (Bold) // Note: in the enumeration, normal and lighter come at the end so we must explicitly test for them. gboolean boldSet = ((query->font_weight.computed >= SP_CSS_FONT_WEIGHT_700) && @@ -7116,8 +7124,6 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ InkToggleAction* textItalicAction = INK_TOGGLE_ACTION( g_object_get_data( tbl, "TextItalicAction" ) ); gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(textItalicAction), italicSet ); - - EgeSelectOneAction* textAlignAction = EGE_SELECT_ONE_ACTION( g_object_get_data( tbl, "TextAlignAction" ) ); // Alignment // Note: SVG 1.1 doesn't include text-align, SVG 1.2 Tiny doesn't include text-align="justify" @@ -7200,6 +7206,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION( letterSpacingAction )); gtk_adjustment_set_value( letterSpacingAdjustment, letterSpacing ); + // Orientation int activeButton2 = (query->writing_mode.computed == SP_CSS_WRITING_MODE_LR_TB ? 0 : 1); @@ -7234,42 +7241,45 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ sp_style_unref(query); // Kerning (xshift), yshift, rotation. NB: These are not CSS attributes. - SPTextContext *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context); - if( tc ) { - unsigned char_index = -1; - TextTagAttributes *attributes = - text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index ); - if( attributes ) { - - // Dx - double dx = attributes->getDx( char_index ); - GtkAction* dxAction = GTK_ACTION( g_object_get_data( tbl, "TextDxAction" )); - GtkAdjustment *dxAdjustment = - ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION( dxAction )); - gtk_adjustment_set_value( dxAdjustment, dx ); - - // Dy - double dy = attributes->getDy( char_index ); - GtkAction* dyAction = GTK_ACTION( g_object_get_data( tbl, "TextDyAction" )); - GtkAdjustment *dyAdjustment = - ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION( dyAction )); - gtk_adjustment_set_value( dyAdjustment, dy ); - - // Rotation - double rotation = attributes->getRotate( char_index ); - GtkAction* rotationAction = GTK_ACTION( g_object_get_data( tbl, "TextRotationAction" )); - GtkAdjustment *rotationAdjustment = - ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION( rotationAction )); - gtk_adjustment_set_value( rotationAdjustment, rotation ); + if( SP_IS_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context) ) { + SPTextContext *const tc = SP_TEXT_CONTEXT((SP_ACTIVE_DESKTOP)->event_context); + if( tc ) { + unsigned char_index = -1; + TextTagAttributes *attributes = + text_tag_attributes_at_position( tc->text, std::min(tc->text_sel_start, tc->text_sel_end), &char_index ); + if( attributes ) { + + // Dx + double dx = attributes->getDx( char_index ); + GtkAction* dxAction = GTK_ACTION( g_object_get_data( tbl, "TextDxAction" )); + GtkAdjustment *dxAdjustment = + ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION( dxAction )); + gtk_adjustment_set_value( dxAdjustment, dx ); + + // Dy + double dy = attributes->getDy( char_index ); + GtkAction* dyAction = GTK_ACTION( g_object_get_data( tbl, "TextDyAction" )); + GtkAdjustment *dyAdjustment = + ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION( dyAction )); + gtk_adjustment_set_value( dyAdjustment, dy ); + + // Rotation + double rotation = attributes->getRotate( char_index ); + /* SVG value is between 0 and 360 but we're using -180 to 180 in widget */ + if( rotation > 180.0 ) rotation -= 360.0; + GtkAction* rotationAction = GTK_ACTION( g_object_get_data( tbl, "TextRotationAction" )); + GtkAdjustment *rotationAdjustment = + ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION( rotationAction )); + gtk_adjustment_set_value( rotationAdjustment, rotation ); #ifdef DEBUG_TEXT - std::cout << " GUI: Dx: " << dx << std::endl; - std::cout << " GUI: Dy: " << dy << std::endl; - std::cout << " GUI: Rotation: " << rotation << std::endl; + std::cout << " GUI: Dx: " << dx << std::endl; + std::cout << " GUI: Dy: " << dy << std::endl; + std::cout << " GUI: Rotation: " << rotation << std::endl; #endif + } } } - #ifdef DEBUG_TEXT std::cout << "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << std::endl; std::cout << std::endl; -- cgit v1.2.3 From ae12f6dcaa6a8214bcea75c3f9219ec7d2473189 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 16 May 2010 20:52:17 +0200 Subject: Text toolbar: Write out deprecated sodipodi:linespacing attribute (otherwise new line-height value gets overwritten by old linespacing value if text duplicated). "Fixes" 575829. Add calls to sp_document_maybe_done for dx, dy, rotate attributes. (bzr r9424) --- src/widgets/toolbox.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 62af61943..2c129f02c 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -6776,6 +6776,16 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl ) SPDesktop *desktop = SP_ACTIVE_DESKTOP; sp_desktop_set_style (desktop, css, true, true); + + // Until deprecated sodipodi:linespacing purged: + Inkscape::Selection *selection = sp_desktop_selection(desktop); + GSList const *items = selection->itemList(); + for (; items != NULL; items = items->next) { + if (SP_IS_TEXT (items->data)) { + SP_OBJECT_REPR(items->data)->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL)); + } + } + // Save for undo sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:line-height", SP_VERB_NONE, _("Text: Change line-height")); @@ -6899,6 +6909,10 @@ static void sp_text_dx_value_changed( GtkAdjustment *adj, GObject *tbl ) } } + // Save for undo + sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:dx", SP_VERB_NONE, + _("Text: Change dx (kern)")); + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); } @@ -6926,6 +6940,10 @@ static void sp_text_dy_value_changed( GtkAdjustment *adj, GObject *tbl ) } } + // Save for undo + sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:dy", SP_VERB_NONE, + _("Text: Change dy")); + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); } @@ -6953,6 +6971,10 @@ static void sp_text_rotation_value_changed( GtkAdjustment *adj, GObject *tbl ) } } + // Save for undo + sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:rotate", SP_VERB_NONE, + _("Text: Change rotate")); + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); } -- cgit v1.2.3 From 0c1f4430e921e1f2ae508bb11916a28569d2e581 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 18 May 2010 13:54:03 +0200 Subject: Add icons for line-height, letter-spacing, etc. to text toolbar. Include units in tooltips. (bzr r9427) --- src/widgets/toolbox.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 2c129f02c..e505412d0 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -7381,7 +7381,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions Ink_ComboBoxEntry_Action* act = ink_comboboxentry_action_new( "TextFontSizeAction", _("Font Size"), - _("Select Font Size"), + _("Select Font Size (px)"), NULL, GTK_TREE_MODEL(model_size), 4 ); // Width in characters @@ -7527,7 +7527,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions "TextLineHeightAction", /* name */ _("Line Height"), /* label */ _("Line:"), /* short label */ - _("Spacing between lines."), /* tooltip */ + _("Spacing between lines (%)."), /* tooltip */ "/tools/text/lineheight", /* path? */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ @@ -7545,6 +7545,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); g_object_set_data( holder, "TextLineHeightAction", eact ); + g_object_set( G_OBJECT(eact), "iconId", "text_line_spacing", NULL ); } /* Word spacing */ @@ -7557,7 +7558,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions "TextWordSpacingAction", /* name */ _("Word spacing"), /* label */ _("Word:"), /* short label */ - _("Spacing between words."), /* tooltip */ + _("Spacing between words (px)."), /* tooltip */ "/tools/text/wordspacing", /* path? */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ @@ -7575,6 +7576,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); g_object_set_data( holder, "TextWordSpacingAction", eact ); + g_object_set( G_OBJECT(eact), "iconId", "text_word_spacing", NULL ); } /* Letter spacing */ @@ -7587,7 +7589,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions "TextLetterSpacingAction", /* name */ _("Letter spacing"), /* label */ _("Letter:"), /* short label */ - _("Spacing between letters."), /* tooltip */ + _("Spacing between letters (px)."), /* tooltip */ "/tools/text/letterspacing", /* path? */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ @@ -7605,6 +7607,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); g_object_set_data( holder, "TextLetterSpacingAction", eact ); + g_object_set( G_OBJECT(eact), "iconId", "text_letter_spacing", NULL ); } /* Character kerning (horizontal shift) */ @@ -7617,7 +7620,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions "TextDxAction", /* name */ _("Kerning"), /* label */ _("Kern:"), /* short label */ - _("Kerning (horizontal shift of characters)."), /* tooltip */ + _("Kerning (horizontal shift of characters) (px)."), /* tooltip */ "/tools/text/dx", /* path? */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ @@ -7635,6 +7638,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); g_object_set_data( holder, "TextDxAction", eact ); + g_object_set( G_OBJECT(eact), "iconId", "text_horz_kern", NULL ); } /* Character vertical shift */ @@ -7647,7 +7651,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions "TextDyAction", /* name */ _("Vertical Shift"), /* label */ _("Vert:"), /* short label */ - _("Vertical shift of characters."), /* tooltip */ + _("Vertical shift of characters (px)."), /* tooltip */ "/tools/text/dy", /* path? */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ @@ -7665,6 +7669,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); g_object_set_data( holder, "TextDyAction", eact ); + g_object_set( G_OBJECT(eact), "iconId", "text_vert_kern", NULL ); } /* Character rotation */ @@ -7695,6 +7700,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); g_object_set_data( holder, "TextRotationAction", eact ); + g_object_set( G_OBJECT(eact), "iconId", "text_rotation", NULL ); } // Is this necessary to call? Shouldn't hurt. -- cgit v1.2.3 From bda0089e631128132f50b017cfc1878c7e4604dd Mon Sep 17 00:00:00 2001 From: buliabyak <> Date: Tue, 18 May 2010 13:41:06 -0300 Subject: copyedit tooltips (bzr r9428) --- src/widgets/toolbox.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index e505412d0..f0a223a3c 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -7381,7 +7381,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions Ink_ComboBoxEntry_Action* act = ink_comboboxentry_action_new( "TextFontSizeAction", _("Font Size"), - _("Select Font Size (px)"), + _("Font size (px)"), NULL, GTK_TREE_MODEL(model_size), 4 ); // Width in characters @@ -7394,7 +7394,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions { InkToggleAction* act = ink_toggle_action_new( "TextBoldAction", // Name _("Toggle Bold"), // Label - _("Toggle On/Off Bold Style"), // Tooltip + _("Toggle bold or normal weight"), // Tooltip GTK_STOCK_BOLD, // Icon (inkId) secondarySize ); // Icon size gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); @@ -7407,7 +7407,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions { InkToggleAction* act = ink_toggle_action_new( "TextItalicAction", // Name _("Toggle Italic/Oblique"), // Label - _("Toggle On/Off Italic/Oblique Style"),// Tooltip + _("Toggle italic/oblique style"),// Tooltip GTK_STOCK_ITALIC, // Icon (inkId) secondarySize ); // Icon size gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); @@ -7449,14 +7449,14 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Justify"), - 1, _("Justify - Only flowed text"), + 1, _("Justify (only flowed text)"), 2, GTK_STOCK_JUSTIFY_FILL, 3, false, -1 ); EgeSelectOneAction* act = ege_select_one_action_new( "TextAlignAction", // Name _("Alignment"), // Label - _("Text Alignment"), // Tooltip + _("Text alignment"), // Tooltip NULL, // StockID GTK_TREE_MODEL(model) ); // Model g_object_set( act, "short_label", "NotUsed", NULL ); @@ -7484,20 +7484,20 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Horizontal"), - 1, _("Horizontal Text"), + 1, _("Horizontal text"), 2, INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_HORIZONTAL, -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Vertical"), - 1, _("Vertical Text"), + 1, _("Vertical text"), 2, INKSCAPE_ICON_FORMAT_TEXT_DIRECTION_VERTICAL, -1 ); EgeSelectOneAction* act = ege_select_one_action_new( "TextOrientationAction", // Name _("Orientation"), // Label - _("Text Orientation"), // Tooltip + _("Text orientation"), // Tooltip NULL, // StockID GTK_TREE_MODEL(model) ); // Model @@ -7527,7 +7527,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions "TextLineHeightAction", /* name */ _("Line Height"), /* label */ _("Line:"), /* short label */ - _("Spacing between lines (%)."), /* tooltip */ + _("Spacing between lines (times font size)"), /* tooltip */ "/tools/text/lineheight", /* path? */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ @@ -7558,7 +7558,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions "TextWordSpacingAction", /* name */ _("Word spacing"), /* label */ _("Word:"), /* short label */ - _("Spacing between words (px)."), /* tooltip */ + _("Spacing between words (px)"), /* tooltip */ "/tools/text/wordspacing", /* path? */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ @@ -7589,7 +7589,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions "TextLetterSpacingAction", /* name */ _("Letter spacing"), /* label */ _("Letter:"), /* short label */ - _("Spacing between letters (px)."), /* tooltip */ + _("Spacing between letters (px)"), /* tooltip */ "/tools/text/letterspacing", /* path? */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ @@ -7620,7 +7620,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions "TextDxAction", /* name */ _("Kerning"), /* label */ _("Kern:"), /* short label */ - _("Kerning (horizontal shift of characters) (px)."), /* tooltip */ + _("Horizontal kerning (px)"), /* tooltip */ "/tools/text/dx", /* path? */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ @@ -7651,7 +7651,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions "TextDyAction", /* name */ _("Vertical Shift"), /* label */ _("Vert:"), /* short label */ - _("Vertical shift of characters (px)."), /* tooltip */ + _("Vertical shift (px)"), /* tooltip */ "/tools/text/dy", /* path? */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ @@ -7682,7 +7682,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions "TextRotationAction", /* name */ _("Letter rotation"), /* label */ _("Rot:"), /* short label */ - _("Rotation of selected characters (degrees)."),/* tooltip */ + _("Character rotation (degrees)"),/* tooltip */ "/tools/text/letterspacing", /* path? */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ -- cgit v1.2.3 From 732f0b7edebb12ce1414aefd29ccc6655fc8174b Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 1 Jun 2010 23:04:14 +0200 Subject: Flowed text does not support dx (kerning), dy, and rotation attributes. Disable corresponding widgets if flowed text selected. (bzr r9468) --- src/widgets/toolbox.cpp | 56 +++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 20 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index f0a223a3c..f3cfe621d 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -7063,6 +7063,21 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ } g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE) ); + // Only flowed text can be justified, only normal text can be kerned... + // Find out if we have flowed text now so we can use it several places + gboolean isFlow = false; + for (GSList const *items = sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList(); + items != NULL; + items = items->next) { + // const gchar* id = SP_OBJECT_ID((SPItem *) items->data); + // std::cout << " " << id << std::endl; + if( SP_IS_FLOWTEXT(( SPItem *) items->data )) { + isFlow = true; + // std::cout << " Found flowed text" << std::endl; + break; + } + } + /* * Query from current selection: * Font family (font-family) @@ -7151,19 +7166,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ // Note: SVG 1.1 doesn't include text-align, SVG 1.2 Tiny doesn't include text-align="justify" // text-align="justify" was a draft SVG 1.2 item (along with flowed text). // Only flowed text can be left and right justified at the same time. - // Check if we have flowed text and disable botton. - gboolean isFlow = false; - for (GSList const *items = sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList(); - items != NULL; - items = items->next) { - // const gchar* id = SP_OBJECT_ID((SPItem *) items->data); - // std::cout << " " << id << std::endl; - if( SP_IS_FLOWTEXT(( SPItem *) items->data )) { - isFlow = true; - // std::cout << " Found flowed text" << std::endl; - break; - } - } + // Disable button if we don't have flowed text. // The GtkTreeModel class doesn't have a set function so we can't // simply add an ege_select_one_action_set_sensitive method! @@ -7216,7 +7219,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ GtkAdjustment *wordSpacingAdjustment = ege_adjustment_action_get_adjustment(EGE_ADJUSTMENT_ACTION( wordSpacingAction )); gtk_adjustment_set_value( wordSpacingAdjustment, wordSpacing ); - + // Letter spacing double letterSpacing; @@ -7302,6 +7305,19 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ } } } + + { + // Set these here as we don't always have kerning/rotating attributes + GtkAction* dxAction = GTK_ACTION( g_object_get_data( tbl, "TextDxAction" )); + gtk_action_set_sensitive( GTK_ACTION(dxAction), !isFlow ); + + GtkAction* dyAction = GTK_ACTION( g_object_get_data( tbl, "TextDyAction" )); + gtk_action_set_sensitive( GTK_ACTION(dyAction), !isFlow ); + + GtkAction* rotationAction = GTK_ACTION( g_object_get_data( tbl, "TextRotationAction" )); + gtk_action_set_sensitive( GTK_ACTION(rotationAction), !isFlow ); + } + #ifdef DEBUG_TEXT std::cout << "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << std::endl; std::cout << std::endl; @@ -7528,7 +7544,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions _("Line Height"), /* label */ _("Line:"), /* short label */ _("Spacing between lines (times font size)"), /* tooltip */ - "/tools/text/lineheight", /* path? */ + "/tools/text/lineheight", /* preferences path */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ NULL, /* unit selector */ @@ -7559,7 +7575,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions _("Word spacing"), /* label */ _("Word:"), /* short label */ _("Spacing between words (px)"), /* tooltip */ - "/tools/text/wordspacing", /* path? */ + "/tools/text/wordspacing", /* preferences path */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ NULL, /* unit selector */ @@ -7590,7 +7606,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions _("Letter spacing"), /* label */ _("Letter:"), /* short label */ _("Spacing between letters (px)"), /* tooltip */ - "/tools/text/letterspacing", /* path? */ + "/tools/text/letterspacing", /* preferences path */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ NULL, /* unit selector */ @@ -7621,7 +7637,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions _("Kerning"), /* label */ _("Kern:"), /* short label */ _("Horizontal kerning (px)"), /* tooltip */ - "/tools/text/dx", /* path? */ + "/tools/text/dx", /* preferences path */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ NULL, /* unit selector */ @@ -7652,7 +7668,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions _("Vertical Shift"), /* label */ _("Vert:"), /* short label */ _("Vertical shift (px)"), /* tooltip */ - "/tools/text/dy", /* path? */ + "/tools/text/dy", /* preferences path */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ NULL, /* unit selector */ @@ -7683,7 +7699,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions _("Letter rotation"), /* label */ _("Rot:"), /* short label */ _("Character rotation (degrees)"),/* tooltip */ - "/tools/text/letterspacing", /* path? */ + "/tools/text/rotation", /* preferences path */ 0.0, /* default */ GTK_WIDGET(desktop->canvas), /* focusTarget */ NULL, /* unit selector */ -- cgit v1.2.3 From 763ecf36ae7377cd9c1fadefbe0c4c24b37a3ab0 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 4 Jun 2010 21:41:52 +0200 Subject: Add support for baseline-shift attribute (all possible values). Add superscript and subscript support to Text toolbar. Missing icons for superscript and subscript. Known bug: adding a character to a superscript or subscript text string resets baseline-shift attribute. (bzr r9475) --- src/widgets/toolbox.cpp | 130 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 129 insertions(+), 1 deletion(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index f3cfe621d..502de27df 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -489,6 +489,9 @@ static gchar const * ui_descr = " " " " " " + " " + " " + " " " " " " " " @@ -6610,6 +6613,79 @@ static void sp_text_style_changed( InkToggleAction* act, GObject *tbl ) 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 ) +{ + // 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) ); + + // Called by Superscript or Subscript button? + const gchar* name = gtk_action_get_name( GTK_ACTION( act ) ); + gint prop = (strcmp(name, "TextSuperscriptAction") == 0) ? 0 : 1; + +#ifdef DEBUG_TEXT + std::cout << "sp_text_script_changed: " << prop << std::endl; +#endif + + // Query baseline + SPStyle *query = sp_style_new (SP_ACTIVE_DOCUMENT); + int result_baseline = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_BASELINES); + + bool setSuper = false; + bool setSub = false; + + if(result_baseline == QUERY_STYLE_NOTHING || result_baseline == QUERY_STYLE_MULTIPLE_DIFFERENT ) { + // If not set or mixed, turn on superscript or subscript + if( prop == 0 ) { + setSuper = true; + } else { + setSub = true; + } + } else { + // Superscript + gboolean superscriptSet = (query->baseline_shift.set && + query->baseline_shift.type == SP_BASELINE_SHIFT_LITERAL && + query->baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUPER ); + + // Subscript + gboolean subscriptSet = (query->baseline_shift.set && + query->baseline_shift.type == SP_BASELINE_SHIFT_LITERAL && + query->baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUB ); + + setSuper = !superscriptSet && prop == 0; + setSub = !subscriptSet && prop == 1; + } + + // Set css properties + SPCSSAttr *css = sp_repr_css_attr_new (); + if( setSuper || setSub ) { + // Openoffice 2.3 and Adobe use 58%, Microsoft Word 2002 uses 65%. + sp_repr_css_set_property (css, "font-size", "58%"); + } else { + sp_repr_css_set_property (css, "font-size", ""); + } + if( setSuper ) { + sp_repr_css_set_property (css, "baseline-shift", "super"); + } else if( setSub ) { + sp_repr_css_set_property (css, "baseline-shift", "sub"); + } else { + sp_repr_css_set_property (css, "baseline-shift", "baseline"); + } + + // Apply css to selected objects. + SPDesktop *desktop = SP_ACTIVE_DESKTOP; + sp_desktop_set_style (desktop, css, true, true); + + // Save for undo + sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:script", SP_VERB_NONE, + _("Text: Change superscript or subscript")); + + g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) ); +} + static void sp_text_align_mode_changed( EgeSelectOneAction *act, GObject *tbl ) { // quit if run by the _changed callbacks @@ -7090,6 +7166,8 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ int result_family = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTFAMILY); int result_style = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTSTYLE); int result_numbers = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONTNUMBERS); + int result_baseline = sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_BASELINES); + // Used later: sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION); @@ -7161,8 +7239,32 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/ InkToggleAction* textItalicAction = INK_TOGGLE_ACTION( g_object_get_data( tbl, "TextItalicAction" ) ); gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(textItalicAction), italicSet ); - EgeSelectOneAction* textAlignAction = EGE_SELECT_ONE_ACTION( g_object_get_data( tbl, "TextAlignAction" ) ); + + // Superscript + gboolean superscriptSet = + ((result_baseline == QUERY_STYLE_SINGLE || result_baseline == QUERY_STYLE_MULTIPLE_SAME ) && + query->baseline_shift.set && + query->baseline_shift.type == SP_BASELINE_SHIFT_LITERAL && + query->baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUPER ); + + InkToggleAction* textSuperscriptAction = INK_TOGGLE_ACTION( g_object_get_data( tbl, "TextSuperscriptAction" ) ); + gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(textSuperscriptAction), superscriptSet ); + + + // Subscript + gboolean subscriptSet = + ((result_baseline == QUERY_STYLE_SINGLE || result_baseline == QUERY_STYLE_MULTIPLE_SAME ) && + query->baseline_shift.set && + query->baseline_shift.type == SP_BASELINE_SHIFT_LITERAL && + query->baseline_shift.literal == SP_CSS_BASELINE_SHIFT_SUB ); + + InkToggleAction* textSubscriptAction = INK_TOGGLE_ACTION( g_object_get_data( tbl, "TextSubscriptAction" ) ); + gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(textSubscriptAction), subscriptSet ); + + // Alignment + EgeSelectOneAction* textAlignAction = EGE_SELECT_ONE_ACTION( g_object_get_data( tbl, "TextAlignAction" ) ); + // Note: SVG 1.1 doesn't include text-align, SVG 1.2 Tiny doesn't include text-align="justify" // text-align="justify" was a draft SVG 1.2 item (along with flowed text). // Only flowed text can be left and right justified at the same time. @@ -7432,6 +7534,32 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions g_object_set_data( holder, "TextItalicAction", act ); } + /* Style - Superscript */ + { + InkToggleAction* act = ink_toggle_action_new( "TextSuperscriptAction", // Name + _("Toggle Superscript"), // Label + _("Toggle superscript"), // Tooltip + GTK_STOCK_ITALIC, // Icon (inkId) + secondarySize ); // Icon size + gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); + g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_text_script_changed), holder ); + gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/text/super", false) ); + g_object_set_data( holder, "TextSuperscriptAction", act ); + } + + /* Style - Subscript */ + { + InkToggleAction* act = ink_toggle_action_new( "TextSubscriptAction", // Name + _("Toggle Subscript"), // Label + _("Toggle subscript"), // Tooltip + GTK_STOCK_ITALIC, // Icon (inkId) + secondarySize ); // Icon size + gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); + g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_text_script_changed), holder ); + gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/text/sub", false) ); + g_object_set_data( holder, "TextSubscriptAction", act ); + } + /* Alignment */ { GtkListStore* model = gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN ); -- cgit v1.2.3 From d0ad4f7ee5bfdf73d49d299cd8c8567cf3f2650c Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 5 Jun 2010 07:30:04 +0200 Subject: Moved spray tool down, text tool up. (bzr r9479) --- src/widgets/toolbox.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 502de27df..5079e4ffd 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -1861,26 +1861,40 @@ void setup_tool_toolbox(GtkWidget *toolbox, SPDesktop *desktop) gchar const * descr = "" " " + + " " " " " " " " - " " " " + + " " " " " " " " " " " " + + " " " " " " " " + + " " + " " + + " " + " " " " -// " " + + " " " " - " " - " " " " " " + + " " + +// " " " " ""; -- cgit v1.2.3 From 9311f26aa7c215fff1793c03da20258f8f5b96ff Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 7 Jun 2010 12:49:12 +0200 Subject: "Fix" for bug #583593 (Default tool styles are not loaded for new users). (Call sp_desktop_set_style() with write_current = false.) Tweak superscript/subscript shifts/sizes. (bzr r9489) --- src/widgets/toolbox.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 5079e4ffd..5950bf841 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -6676,8 +6676,11 @@ static void sp_text_script_changed( InkToggleAction* act, GObject *tbl ) // Set css properties SPCSSAttr *css = sp_repr_css_attr_new (); if( setSuper || setSub ) { - // Openoffice 2.3 and Adobe use 58%, Microsoft Word 2002 uses 65%. - sp_repr_css_set_property (css, "font-size", "58%"); + // Openoffice 2.3 and Adobe use 58%, Microsoft Word 2002 uses 65%, LaTex about 70%. + // 58% looks too small to me, especially if a superscript is placed on a superscript. + // If you make a change here, consider making a change to baseline-shift amount + // in style.cpp. + sp_repr_css_set_property (css, "font-size", "65%"); } else { sp_repr_css_set_property (css, "font-size", ""); } @@ -6691,7 +6694,7 @@ static void sp_text_script_changed( InkToggleAction* act, GObject *tbl ) // Apply css to selected objects. SPDesktop *desktop = SP_ACTIVE_DESKTOP; - sp_desktop_set_style (desktop, css, true, true); + sp_desktop_set_style (desktop, css, true, false); // Save for undo sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:script", SP_VERB_NONE, @@ -6864,7 +6867,7 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl ) // Apply line-height to selected objects. SPDesktop *desktop = SP_ACTIVE_DESKTOP; - sp_desktop_set_style (desktop, css, true, true); + sp_desktop_set_style (desktop, css, true, false); // Until deprecated sodipodi:linespacing purged: @@ -6913,7 +6916,7 @@ static void sp_text_wordspacing_value_changed( GtkAdjustment *adj, GObject *tbl // Apply word-spacing to selected objects. SPDesktop *desktop = SP_ACTIVE_DESKTOP; - sp_desktop_set_style (desktop, css, true, true); + sp_desktop_set_style (desktop, css, true, false); // Save for undo sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:word-spacing", SP_VERB_NONE, @@ -6952,7 +6955,7 @@ static void sp_text_letterspacing_value_changed( GtkAdjustment *adj, GObject *tb // Apply letter-spacing to selected objects. SPDesktop *desktop = SP_ACTIVE_DESKTOP; - sp_desktop_set_style (desktop, css, true, true); + sp_desktop_set_style (desktop, css, true, false); // Save for undo sp_document_maybe_done (sp_desktop_document (SP_ACTIVE_DESKTOP), "ttb:letter-spacing", SP_VERB_NONE, -- cgit v1.2.3 From 8f9159e07b633c211f7e42a1176927c14c7c3449 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 7 Jun 2010 17:03:57 +0200 Subject: Added icons for Superscript and Subscript. (bzr r9490) --- src/widgets/toolbox.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 5950bf841..68f7e0972 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -7556,7 +7556,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkToggleAction* act = ink_toggle_action_new( "TextSuperscriptAction", // Name _("Toggle Superscript"), // Label _("Toggle superscript"), // Tooltip - GTK_STOCK_ITALIC, // Icon (inkId) + "text_superscript", // Icon (inkId) secondarySize ); // Icon size gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_text_script_changed), holder ); @@ -7569,7 +7569,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions InkToggleAction* act = ink_toggle_action_new( "TextSubscriptAction", // Name _("Toggle Subscript"), // Label _("Toggle subscript"), // Tooltip - GTK_STOCK_ITALIC, // Icon (inkId) + "text_subscript", // Icon (inkId) secondarySize ); // Icon size gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_text_script_changed), holder ); -- cgit v1.2.3 From de71f527765af3f177bfab6cbf74d26746ad7b32 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Tue, 15 Jun 2010 23:35:11 -0700 Subject: Move the task view changing to the "View" menu. Fixes bugs #170781 and #171663. Fixed bugs: - https://launchpad.net/bugs/170781 - https://launchpad.net/bugs/171663 (bzr r9503) --- src/widgets/toolbox.cpp | 51 ------------------------------------------------- 1 file changed, 51 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 68f7e0972..c255e087b 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -108,7 +108,6 @@ #include "toolbox.h" -#define ENABLE_TASK_SUPPORT 1 //#define DEBUG_TEXT using Inkscape::UnitTracker; @@ -147,14 +146,6 @@ static void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mai static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); static void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder); -#if ENABLE_TASK_SUPPORT -static void fireTaskChange( EgeSelectOneAction *act, SPDesktop *dt ) -{ - gint selected = ege_select_one_action_get_active( act ); - UXManager::getInstance()->setTask(dt, selected); -} -#endif // ENABLE_TASK_SUPPORT - using Inkscape::UI::ToolboxFactory; @@ -978,44 +969,6 @@ static Glib::RefPtr create_or_fetch_actions( SPDesktop* deskto } } -#if ENABLE_TASK_SUPPORT - if ( !mainActions->get_action("TaskSetAction") ) { - GtkListStore* model = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING ); - - GtkTreeIter iter; - gtk_list_store_append( model, &iter ); - gtk_list_store_set( model, &iter, - 0, _("Default"), - 1, _("Default interface setup"), - -1 ); - - gtk_list_store_append( model, &iter ); - gtk_list_store_set( model, &iter, - 0, _("Custom"), - 1, _("Set the custom task"), - -1 ); - - gtk_list_store_append( model, &iter ); - gtk_list_store_set( model, &iter, - 0, _("Wide"), - 1, _("Setup for widescreen work"), - -1 ); - - EgeSelectOneAction* act = ege_select_one_action_new( "TaskSetAction", _("Task"), (""), NULL, GTK_TREE_MODEL(model) ); - g_object_set( act, "short_label", _("Task:"), NULL ); - mainActions->add(Glib::wrap(GTK_ACTION(act))); - //g_object_set_data( holder, "mode_action", act ); - - ege_select_one_action_set_appearance( act, "minimal" ); - ege_select_one_action_set_radio_action_type( act, INK_RADIO_ACTION_TYPE ); - //ege_select_one_action_set_icon_size( act, secondarySize ); - ege_select_one_action_set_tooltip_column( act, 1 ); - - //ege_select_one_action_set_active( act, mode ); - g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(fireTaskChange), desktop ); - } -#endif // ENABLE_TASK_SUPPORT - return mainActions; } @@ -2061,10 +2014,6 @@ void setup_commands_toolbox(GtkWidget *toolbox, SPDesktop *desktop) " " " " " " -#if ENABLE_TASK_SUPPORT - " " - " " -#endif // ENABLE_TASK_SUPPORT " " ""; -- cgit v1.2.3 From cd7aee702af257919f2220d89fb26af05a8e2599 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Fri, 2 Jul 2010 13:54:46 -0700 Subject: Added hidden preference to re-enable floating dialogs on problematic window managers. (bzr r9557) --- src/widgets/toolbox.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index c255e087b..b68d8404d 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -992,7 +992,8 @@ static GtkWidget* toolboxNewCommon( GtkWidget* tb, BarId id, GtkPositionType han gtk_widget_set_sensitive(tb, FALSE); GtkWidget *hb = 0; - if ( UXManager::getInstance()->isFloatWindowProblem() ) { + gboolean forceFloatAllowed = Inkscape::Preferences::get()->getBool("/options/workarounds/floatallowed", false); + if ( UXManager::getInstance()->isFloatWindowProblem() && !forceFloatAllowed ) { hb = gtk_event_box_new(); // A simple, neutral container. } else { hb = gtk_handle_box_new(); -- cgit v1.2.3 From a03928688ee7805ad8bf79e384769d983dbc451d Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 10 Jul 2010 10:36:42 +0200 Subject: CSS length attributes must have units. (bzr r9605) --- src/widgets/toolbox.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets/toolbox.cpp') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index b68d8404d..bdf1e6ff2 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -6861,7 +6861,7 @@ static void sp_text_wordspacing_value_changed( GtkAdjustment *adj, GObject *tbl // Set css word-spacing SPCSSAttr *css = sp_repr_css_attr_new (); Inkscape::CSSOStringStream osfs; - osfs << adj->value; + osfs << adj->value << "px"; // For now always use px sp_repr_css_set_property (css, "word-spacing", osfs.str().c_str()); // Apply word-spacing to selected objects. @@ -6900,7 +6900,7 @@ static void sp_text_letterspacing_value_changed( GtkAdjustment *adj, GObject *tb // Set css letter-spacing SPCSSAttr *css = sp_repr_css_attr_new (); Inkscape::CSSOStringStream osfs; - osfs << adj->value; + osfs << adj->value << "px"; // For now always use px sp_repr_css_set_property (css, "letter-spacing", osfs.str().c_str()); // Apply letter-spacing to selected objects. -- cgit v1.2.3