From 9dc7b786c9ef31060012ea4ae13a8188548b4f62 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Tue, 9 Jul 2013 16:42:04 -0400 Subject: Ported sp-namedview.cpp (todo: fix a bunch of things). (bzr r12380.1.8) --- src/widgets/measure-toolbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/measure-toolbar.cpp') diff --git a/src/widgets/measure-toolbar.cpp b/src/widgets/measure-toolbar.cpp index 21df4c6d9..387dbbeae 100644 --- a/src/widgets/measure-toolbar.cpp +++ b/src/widgets/measure-toolbar.cpp @@ -91,7 +91,7 @@ static void measure_unit_changed(GtkAction* /*act*/, GObject* tbl) void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, GObject* holder) { UnitTracker* tracker = new UnitTracker( SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE ); - tracker->setActiveUnit( sp_desktop_namedview(desktop)->doc_units ); + //tracker->setActiveUnit( sp_desktop_namedview(desktop)->doc_units ); g_object_set_data( holder, "tracker", tracker ); EgeAdjustmentAction *eact = 0; -- cgit v1.2.3 From 64bc8cf145b55d33469ef1b84e18ca8df580eda8 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Tue, 16 Jul 2013 20:42:12 -0400 Subject: Removed unused unit includes. (bzr r12380.1.10) --- src/widgets/measure-toolbar.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/widgets/measure-toolbar.cpp') diff --git a/src/widgets/measure-toolbar.cpp b/src/widgets/measure-toolbar.cpp index 387dbbeae..c72cb8fa3 100644 --- a/src/widgets/measure-toolbar.cpp +++ b/src/widgets/measure-toolbar.cpp @@ -52,13 +52,12 @@ #include "../xml/repr.h" #include "ui/uxmanager.h" #include "../ui/icon-names.h" -#include "../helper/unit-menu.h" -#include "../helper/units.h" -#include "../helper/unit-tracker.h" #include "../pen-context.h" #include "../sp-namedview.h" +#include "ui/widget/unit-tracker.h" -using Inkscape::UnitTracker; +using Inkscape::UI::Widget::UnitTracker; +using Inkscape::Util::Unit; using Inkscape::UI::UXManager; using Inkscape::DocumentUndo; using Inkscape::UI::ToolboxFactory; @@ -83,15 +82,20 @@ sp_measure_fontsize_value_changed(GtkAdjustment *adj, GObject *tbl) static void measure_unit_changed(GtkAction* /*act*/, GObject* tbl) { UnitTracker* tracker = reinterpret_cast(g_object_get_data(tbl, "tracker")); - SPUnit const *unit = tracker->getActiveUnit(); + Glib::ustring const unit = tracker->getActiveUnit().abbr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setInt("/tools/measure/unitid", unit->unit_id); + prefs->setString("/tools/measure/unit", unit); } void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, GObject* holder) { - UnitTracker* tracker = new UnitTracker( SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE ); - //tracker->setActiveUnit( sp_desktop_namedview(desktop)->doc_units ); + UnitTracker* tracker = new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + tracker->setActiveUnitByAbbr(prefs->getString("/tools/measure/unit").c_str()); + + //tracker->setUnitType(UNIT_TYPE_LINEAR); + //tracker->setUnit("px"); + g_object_set_data( holder, "tracker", tracker ); EgeAdjustmentAction *eact = 0; @@ -121,8 +125,10 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G // units menu { GtkAction* act = tracker->createAction( "MeasureUnitsAction", _("Units:"), _("The units to be used for the measurements") ); + //EgeOutputAction* act = ege_output_action_new( "MeasureUnitsAction", _("Units:"), _("The units to be used for the measurements"), 0 ); g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(measure_unit_changed), holder ); gtk_action_group_add_action( mainActions, act ); + //gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); } } // end of sp_measure_toolbox_prep() -- cgit v1.2.3 From ef3bfa7e8bb2996c4042314accc34f6a72f072e1 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Fri, 19 Jul 2013 14:19:03 -0400 Subject: Removed "helper/unit-menu.h" from "widgest/toolbar.*" and associated files. (bzr r12380.1.30) --- src/widgets/measure-toolbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/measure-toolbar.cpp') diff --git a/src/widgets/measure-toolbar.cpp b/src/widgets/measure-toolbar.cpp index c72cb8fa3..d51a81457 100644 --- a/src/widgets/measure-toolbar.cpp +++ b/src/widgets/measure-toolbar.cpp @@ -106,7 +106,7 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G _("Font Size"), _("Font Size:"), _("The font size to be used in the measurement labels"), "/tools/measure/fontsize", 0.0, - GTK_WIDGET(desktop->canvas), NULL, holder, FALSE, NULL, + GTK_WIDGET(desktop->canvas), holder, FALSE, NULL, 10, 36, 1.0, 4.0, 0, 0, 0, sp_measure_fontsize_value_changed); -- cgit v1.2.3 From 7aab446af9e2eb34ce50c8ef0ec58710fac49396 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Mon, 29 Jul 2013 22:51:28 -0400 Subject: Cleanup. (bzr r12380.1.52) --- src/widgets/measure-toolbar.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/widgets/measure-toolbar.cpp') diff --git a/src/widgets/measure-toolbar.cpp b/src/widgets/measure-toolbar.cpp index d51a81457..53ed2d275 100644 --- a/src/widgets/measure-toolbar.cpp +++ b/src/widgets/measure-toolbar.cpp @@ -93,9 +93,6 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G Inkscape::Preferences *prefs = Inkscape::Preferences::get(); tracker->setActiveUnitByAbbr(prefs->getString("/tools/measure/unit").c_str()); - //tracker->setUnitType(UNIT_TYPE_LINEAR); - //tracker->setUnit("px"); - g_object_set_data( holder, "tracker", tracker ); EgeAdjustmentAction *eact = 0; @@ -125,10 +122,8 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G // units menu { GtkAction* act = tracker->createAction( "MeasureUnitsAction", _("Units:"), _("The units to be used for the measurements") ); - //EgeOutputAction* act = ege_output_action_new( "MeasureUnitsAction", _("Units:"), _("The units to be used for the measurements"), 0 ); g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(measure_unit_changed), holder ); gtk_action_group_add_action( mainActions, act ); - //gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); } } // end of sp_measure_toolbox_prep() -- cgit v1.2.3