From aed527316ca2cff495c32f57f68e37cd5b346f12 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 18 Oct 2015 13:51:14 +0200 Subject: Added Scale option (bzr r14393.1.27) --- src/widgets/measure-toolbar.cpp | 46 ++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-) (limited to 'src/widgets/measure-toolbar.cpp') diff --git a/src/widgets/measure-toolbar.cpp b/src/widgets/measure-toolbar.cpp index 8256abc76..8d7146a46 100644 --- a/src/widgets/measure-toolbar.cpp +++ b/src/widgets/measure-toolbar.cpp @@ -102,6 +102,20 @@ sp_measure_offset_value_changed(GtkAdjustment *adj, GObject *tbl) } } +static void sp_measure_scale_value_changed(GtkAdjustment *adj, GObject *tbl) +{ + SPDesktop *desktop = static_cast(g_object_get_data( tbl, "desktop" )); + + if (DocumentUndo::getUndoSensitive(desktop->getDocument())) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setInt(Glib::ustring("/tools/measure/scale"), + gtk_adjustment_get_value(adj)); + MeasureTool *mt = get_measure_tool(); + if (mt) { + mt->showCanvasItems(); + } + } +} static void sp_measure_precision_value_changed(GtkAdjustment *adj, GObject *tbl) @@ -233,7 +247,7 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G gtk_action_group_add_action( mainActions, GTK_ACTION(eact)); } - // units label + /* units label */ { EgeOutputAction* act = ege_output_action_new( "measure_units_label", _("Units:"), _("The units to be used for the measurements"), 0 ); ege_output_action_set_use_markup( act, TRUE ); @@ -241,7 +255,7 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); } - // units menu + /* units menu */ { GtkAction* act = tracker->createAction( "MeasureUnitsAction", _("Units:"), _("The units to be used for the measurements") ); g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(measure_unit_changed), holder ); @@ -261,13 +275,25 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G gtk_action_group_add_action( mainActions, GTK_ACTION(eact)); } + /* Scale */ + { + eact = create_adjustment_action( "MeasureScaleAction", + _("Scale %"), _("Scale %:"), + _("Scale the results"), + "/tools/measure/scale", 100.0, + GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, + 0.0, 90000.0, 1.0, 4.0, + 0, 0, 0, + sp_measure_scale_value_changed, NULL, 0 , 3); + gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); + } /* Offset */ { eact = create_adjustment_action( "MeasureOffsetAction", _("Offset"), _("Offset:"), _("The offset size"), - "/tools/measure/offset", 30.0, + "/tools/measure/offset", 5.0, GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, 0.0, 90000.0, 1.0, 4.0, 0, 0, 0, @@ -275,7 +301,7 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); } - // ignore_1st_and_last + /* ignore_1st_and_last */ { InkToggleAction* act = ink_toggle_action_new( "MeasureIgnore1stAndLast", _("Ignore first and last"), @@ -286,7 +312,7 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_ignore_1st_and_last), desktop) ; gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); } - // measure imbetweens + /* measure imbetweens */ { InkToggleAction* act = ink_toggle_action_new( "MeasureInBettween", _("Show measures between items"), @@ -297,7 +323,7 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_show_in_between), desktop) ; gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); } - // measure only current layer + /* measure only current layer */ { InkToggleAction* act = ink_toggle_action_new( "MeasureAllLayers", _("Measure all layers"), @@ -308,7 +334,7 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_all_layers), desktop) ; gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); } - //toogle start end + /* toogle start end */ { InkAction* act = ink_action_new( "MeasureReverse", _("Reverse measure"), @@ -318,7 +344,7 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(sp_reverse_knots), 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); } - //to guides + /* to guides */ { InkAction* act = ink_action_new( "MeasureToGuides", _("To guides"), @@ -328,7 +354,7 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(sp_to_guides), 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); } - //to mark dimensions + /* to mark dimensions */ { InkAction* act = ink_action_new( "MeasureMarkDimension", _("Mark Dimension"), @@ -338,7 +364,7 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(sp_to_mark_dimension), 0 ); gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); } - //to item + /* to item */ { InkAction* act = ink_action_new( "MeasureToItem", _("Convert to item"), -- cgit v1.2.3