diff options
| author | Matthew Petroff <matthew@mpetroff.net> | 2013-08-04 22:01:18 +0000 |
|---|---|---|
| committer | Matthew Petroff <matthew@mpetroff.net> | 2013-08-04 22:01:18 +0000 |
| commit | 6ae6c0bea96eef09907091279e0678aa5f83102d (patch) | |
| tree | 825708d13704e27c33cb90a5269b25ae390cf4d2 /src/widgets | |
| parent | Fix handling of SVG lengths with spaces [Bug #1208002]. (diff) | |
| download | inkscape-6ae6c0bea96eef09907091279e0678aa5f83102d.tar.gz inkscape-6ae6c0bea96eef09907091279e0678aa5f83102d.zip | |
Switched to global UnitTable.
(bzr r12380.1.62)
Diffstat (limited to 'src/widgets')
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/node-toolbar.cpp | 4 | ||||
| -rw-r--r-- | src/widgets/paintbucket-toolbar.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/rect-toolbar.cpp | 3 | ||||
| -rw-r--r-- | src/widgets/ruler.cpp | 6 | ||||
| -rw-r--r-- | src/widgets/select-toolbar.cpp | 5 | ||||
| -rw-r--r-- | src/widgets/stroke-style.cpp | 2 |
7 files changed, 7 insertions, 17 deletions
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 863912d03..6493da84d 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -83,6 +83,7 @@ using Inkscape::UI::Widget::UnitTracker; using Inkscape::UI::UXManager; using Inkscape::UI::ToolboxFactory; using ege::AppearTimeTracker; +using Inkscape::Util::unit_table; enum { ACTIVATE, @@ -393,7 +394,6 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) GtkWidget *eventbox = gtk_event_box_new (); dtw->hruler = sp_ruler_new(GTK_ORIENTATION_HORIZONTAL); dtw->hruler_box = eventbox; - Inkscape::Util::UnitTable unit_table; Inkscape::Util::Unit pt = unit_table.getUnit("pt"); sp_ruler_set_unit(SP_RULER(dtw->hruler), pt); gtk_widget_set_tooltip_text (dtw->hruler_box, gettext(pt.name_plural.c_str())); diff --git a/src/widgets/node-toolbar.cpp b/src/widgets/node-toolbar.cpp index 65e42a60b..a9e298f1d 100644 --- a/src/widgets/node-toolbar.cpp +++ b/src/widgets/node-toolbar.cpp @@ -70,6 +70,7 @@ using Inkscape::UI::UXManager; using Inkscape::DocumentUndo; using Inkscape::UI::ToolboxFactory; using Inkscape::UI::PrefPusher; +using Inkscape::Util::unit_table; //#################################### //# node editing callbacks @@ -249,7 +250,6 @@ static void sp_node_toolbox_coord_changed(gpointer /*shape_editor*/, GObject *tb } else { gtk_action_set_sensitive(xact, TRUE); gtk_action_set_sensitive(yact, TRUE); - Inkscape::Util::UnitTable unit_table; Geom::Coord oldx = Quantity::convert(gtk_adjustment_get_value(xadj), unit, "px"); Geom::Coord oldy = Quantity::convert(gtk_adjustment_get_value(yadj), unit, "px"); Geom::Point mid = nt->_selected_nodes->pointwiseBounds()->midpoint(); @@ -276,8 +276,6 @@ static void sp_node_path_value_changed(GtkAdjustment *adj, GObject *tbl, Geom::D } Unit const unit = tracker->getActiveUnit(); - Inkscape::Util::UnitTable unit_table; - if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { prefs->setDouble(Glib::ustring("/tools/nodes/") + (d == Geom::X ? "x" : "y"), Quantity::convert(gtk_adjustment_get_value(adj), unit, "px")); diff --git a/src/widgets/paintbucket-toolbar.cpp b/src/widgets/paintbucket-toolbar.cpp index 3bb1fa24a..7c23379cd 100644 --- a/src/widgets/paintbucket-toolbar.cpp +++ b/src/widgets/paintbucket-toolbar.cpp @@ -68,6 +68,7 @@ using Inkscape::UI::UXManager; using Inkscape::DocumentUndo; using Inkscape::UI::ToolboxFactory; using Inkscape::UI::PrefPusher; +using Inkscape::Util::unit_table; @@ -175,7 +176,6 @@ void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions // Create the units menu. UnitTracker* tracker = new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR); - Inkscape::Util::UnitTable unit_table; Glib::ustring stored_unit = prefs->getString("/tools/paintbucket/offsetunits"); if (!stored_unit.empty()) { Unit u = unit_table.getUnit(stored_unit); diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp index 29488031f..6dfd9cfcb 100644 --- a/src/widgets/rect-toolbar.cpp +++ b/src/widgets/rect-toolbar.cpp @@ -66,6 +66,7 @@ using Inkscape::UI::ToolboxFactory; using Inkscape::UI::PrefPusher; using Inkscape::Util::Unit; using Inkscape::Util::Quantity; +using Inkscape::Util::unit_table; //######################## @@ -93,7 +94,6 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" )); Unit const unit = tracker->getActiveUnit(); - Inkscape::Util::UnitTable unit_table; if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -187,7 +187,6 @@ static void rect_tb_event_attr_changed(Inkscape::XML::Node * /*repr*/, gchar con UnitTracker* tracker = reinterpret_cast<UnitTracker*>( g_object_get_data( tbl, "tracker" ) ); Unit const unit = tracker->getActiveUnit(); - Inkscape::Util::UnitTable unit_table; gpointer item = g_object_get_data( tbl, "item" ); if (item && SP_IS_RECT(item)) { diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp index 274e1df54..e4e72d86e 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -44,6 +44,7 @@ #define DEFAULT_RULER_FONT_SCALE PANGO_SCALE_X_SMALL #define MINIMUM_INCR 5 +using Inkscape::Util::unit_table; enum { PROP_0, @@ -258,8 +259,6 @@ sp_ruler_init (SPRuler *ruler) gtk_widget_set_has_window (GTK_WIDGET (ruler), FALSE); - Inkscape::Util::UnitTable unit_table; - priv->orientation = GTK_ORIENTATION_HORIZONTAL; priv->unit = new Inkscape::Util::Unit(unit_table.getUnit("px")); priv->lower = 0; @@ -380,8 +379,6 @@ sp_ruler_set_property (GObject *object, SPRuler *ruler = SP_RULER (object); SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler); - Inkscape::Util::UnitTable unit_table; - switch (prop_id) { case PROP_ORIENTATION: @@ -1189,7 +1186,6 @@ sp_ruler_draw_ticks (SPRuler *ruler) SPRulerMetric ruler_metric = ruler_metric_general; /* The metric to use for this unit system */ PangoLayout *layout; PangoRectangle logical_rect, ink_rect; - Inkscape::Util::UnitTable unit_table; if (! gtk_widget_is_drawable (widget)) return; diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index b39423635..e4a5a2905 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -59,6 +59,7 @@ using Inkscape::UI::Widget::UnitTracker; using Inkscape::Util::Unit; using Inkscape::Util::Quantity; using Inkscape::DocumentUndo; +using Inkscape::Util::unit_table; static void sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel) @@ -96,7 +97,6 @@ sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel) tracker->setFullVal( a, keyval[i].val ); } } else { - Inkscape::Util::UnitTable unit_table; for (unsigned i = 0; i < G_N_ELEMENTS(keyval); ++i) { GtkAdjustment *a = GTK_ADJUSTMENT(g_object_get_data(G_OBJECT(spw), keyval[i].key)); gtk_adjustment_set_value(a, Quantity::convert(keyval[i].val, "px", unit)); @@ -192,8 +192,6 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) GtkAdjustment* a_w = GTK_ADJUSTMENT( g_object_get_data( G_OBJECT(spw), "width" ) ); GtkAdjustment* a_h = GTK_ADJUSTMENT( g_object_get_data( G_OBJECT(spw), "height" ) ); - Inkscape::Util::UnitTable unit_table; - if (unit.type == Inkscape::Util::UNIT_TYPE_LINEAR) { x0 = Quantity::convert(gtk_adjustment_get_value(a_x), unit, "px"); y0 = Quantity::convert(gtk_adjustment_get_value(a_y), unit, "px"); @@ -493,7 +491,6 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb // Create the units menu. UnitTracker* tracker = new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR); - Inkscape::Util::UnitTable unit_table; tracker->addUnit(unit_table.getUnit("%")); tracker->setActiveUnit( sp_desktop_namedview(desktop)->doc_units ); diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index e35a8b36b..12d4002b8 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -26,6 +26,7 @@ #include "ui/widget/unit-menu.h" using Inkscape::DocumentUndo; +using Inkscape::Util::unit_table; /** * Creates a new widget for the line stroke paint. @@ -196,7 +197,6 @@ StrokeStyle::StrokeStyle() : Gtk::Widget *us = manage(unitSelector); SPDesktop *desktop = SP_ACTIVE_DESKTOP; - Inkscape::Util::UnitTable unit_table; unitSelector->addUnit(unit_table.getUnit("%")); if (desktop) { unitSelector->setUnit(sp_desktop_namedview(desktop)->doc_units->abbr); |
