diff options
Diffstat (limited to 'src/widgets')
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 6 | ||||
| -rw-r--r-- | src/widgets/lpe-toolbar.cpp | 8 | ||||
| -rw-r--r-- | src/widgets/measure-toolbar.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/node-toolbar.cpp | 4 | ||||
| -rw-r--r-- | src/widgets/paintbucket-toolbar.cpp | 8 | ||||
| -rw-r--r-- | src/widgets/rect-toolbar.cpp | 8 | ||||
| -rw-r--r-- | src/widgets/ruler.cpp | 18 | ||||
| -rw-r--r-- | src/widgets/ruler.h | 4 | ||||
| -rw-r--r-- | src/widgets/select-toolbar.cpp | 20 | ||||
| -rw-r--r-- | src/widgets/stroke-style.cpp | 30 | ||||
| -rw-r--r-- | src/widgets/stroke-style.h | 2 |
11 files changed, 55 insertions, 55 deletions
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index e9a834db7..3ca433586 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -394,9 +394,9 @@ 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::Unit pt = unit_table.getUnit("pt"); + Inkscape::Util::Unit const *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())); + gtk_widget_set_tooltip_text (dtw->hruler_box, gettext(pt->name_plural.c_str())); gtk_container_add (GTK_CONTAINER (eventbox), dtw->hruler); g_signal_connect (G_OBJECT (eventbox), "button_press_event", G_CALLBACK (sp_dt_hruler_event), dtw); g_signal_connect (G_OBJECT (eventbox), "button_release_event", G_CALLBACK (sp_dt_hruler_event), dtw); @@ -425,7 +425,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) dtw->vruler = sp_ruler_new(GTK_ORIENTATION_VERTICAL); dtw->vruler_box = eventbox; sp_ruler_set_unit (SP_RULER (dtw->vruler), pt); - gtk_widget_set_tooltip_text (dtw->vruler_box, gettext(pt.name_plural.c_str())); + gtk_widget_set_tooltip_text (dtw->vruler_box, gettext(pt->name_plural.c_str())); gtk_container_add (GTK_CONTAINER (eventbox), GTK_WIDGET (dtw->vruler)); #if GTK_CHECK_VERSION(3,0,0) diff --git a/src/widgets/lpe-toolbar.cpp b/src/widgets/lpe-toolbar.cpp index 922526a9f..045d7aa78 100644 --- a/src/widgets/lpe-toolbar.cpp +++ b/src/widgets/lpe-toolbar.cpp @@ -198,9 +198,9 @@ static void lpetool_toggle_show_measuring_info(GtkToggleAction *act, GObject *tb static void lpetool_unit_changed(GtkAction* /*act*/, GObject* tbl) { UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(tbl, "tracker")); - Unit const unit = tracker->getActiveUnit(); + Unit const *unit = tracker->getActiveUnit(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString("/tools/lpetool/unit", unit.abbr); + prefs->setString("/tools/lpetool/unit", unit->abbr); SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" )); if (SP_IS_LPETOOL_CONTEXT(desktop->event_context)) { @@ -299,10 +299,10 @@ void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GO UnitTracker* tracker = new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR); tracker->setActiveUnit(sp_desktop_namedview(desktop)->doc_units); g_object_set_data(holder, "tracker", tracker); - Unit const unit = tracker->getActiveUnit(); + Unit const *unit = tracker->getActiveUnit(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString("/tools/lpetool/unit", unit.abbr); + prefs->setString("/tools/lpetool/unit", unit->abbr); /** Automatically create a list of LPEs that get added to the toolbar **/ { diff --git a/src/widgets/measure-toolbar.cpp b/src/widgets/measure-toolbar.cpp index 53ed2d275..58244566d 100644 --- a/src/widgets/measure-toolbar.cpp +++ b/src/widgets/measure-toolbar.cpp @@ -82,7 +82,7 @@ sp_measure_fontsize_value_changed(GtkAdjustment *adj, GObject *tbl) static void measure_unit_changed(GtkAction* /*act*/, GObject* tbl) { UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(tbl, "tracker")); - Glib::ustring const unit = tracker->getActiveUnit().abbr; + Glib::ustring const unit = tracker->getActiveUnit()->abbr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setString("/tools/measure/unit", unit); } diff --git a/src/widgets/node-toolbar.cpp b/src/widgets/node-toolbar.cpp index 2348acc46..0d4868642 100644 --- a/src/widgets/node-toolbar.cpp +++ b/src/widgets/node-toolbar.cpp @@ -240,7 +240,7 @@ static void sp_node_toolbox_coord_changed(gpointer /*shape_editor*/, GObject *tb if (!tracker) { return; } - Unit const unit = tracker->getActiveUnit(); + Unit const *unit = tracker->getActiveUnit(); InkNodeTool *nt = get_node_tool(); if (!nt || nt->_selected_nodes->empty()) { @@ -274,7 +274,7 @@ static void sp_node_path_value_changed(GtkAdjustment *adj, GObject *tbl, Geom::D if (!tracker) { return; } - Unit const unit = tracker->getActiveUnit(); + Unit const *unit = tracker->getActiveUnit(); if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { prefs->setDouble(Glib::ustring("/tools/nodes/") + (d == Geom::X ? "x" : "y"), diff --git a/src/widgets/paintbucket-toolbar.cpp b/src/widgets/paintbucket-toolbar.cpp index 028753b59..363fadd3d 100644 --- a/src/widgets/paintbucket-toolbar.cpp +++ b/src/widgets/paintbucket-toolbar.cpp @@ -98,13 +98,13 @@ static void paintbucket_autogap_changed(EgeSelectOneAction* act, GObject * /*tbl static void paintbucket_offset_changed(GtkAdjustment *adj, GObject *tbl) { UnitTracker* tracker = static_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" )); - Unit const unit = tracker->getActiveUnit(); + Unit const *unit = tracker->getActiveUnit(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // Don't adjust the offset value because we're saving the // unit and it'll be correctly handled on load. prefs->setDouble("/tools/paintbucket/offset", (gdouble)gtk_adjustment_get_value(adj)); - prefs->setString("/tools/paintbucket/offsetunits", unit.abbr); + prefs->setString("/tools/paintbucket/offsetunits", unit->abbr); } static void paintbucket_defaults(GtkWidget *, GObject *tbl) @@ -179,8 +179,8 @@ void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions UnitTracker* tracker = new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR); Glib::ustring stored_unit = prefs->getString("/tools/paintbucket/offsetunits"); if (!stored_unit.empty()) { - Unit u = unit_table.getUnit(stored_unit); - tracker->setActiveUnit(&u); + Unit const *u = unit_table.getUnit(stored_unit); + tracker->setActiveUnit(u); } g_object_set_data( holder, "tracker", tracker ); { diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp index 0d5d3a688..0287a9aeb 100644 --- a/src/widgets/rect-toolbar.cpp +++ b/src/widgets/rect-toolbar.cpp @@ -93,7 +93,7 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data( tbl, "desktop" )); UnitTracker* tracker = reinterpret_cast<UnitTracker*>(g_object_get_data( tbl, "tracker" )); - Unit const unit = tracker->getActiveUnit(); + Unit const *unit = tracker->getActiveUnit(); if (DocumentUndo::getUndoSensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -114,7 +114,7 @@ static void sp_rtb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const * for (GSList const *items = selection->itemList(); items != NULL; items = items->next) { if (SP_IS_RECT(items->data)) { if (gtk_adjustment_get_value(adj) != 0) { - (SP_RECT(items->data)->*setter)(Quantity::convert(gtk_adjustment_get_value(adj), unit, *sp_desktop_namedview(desktop)->doc_units)); + (SP_RECT(items->data)->*setter)(Quantity::convert(gtk_adjustment_get_value(adj), unit, sp_desktop_namedview(desktop)->doc_units)); } else { SP_OBJECT(items->data)->getRepr()->setAttribute(value_name, NULL); } @@ -185,8 +185,8 @@ static void rect_tb_event_attr_changed(Inkscape::XML::Node * /*repr*/, gchar con g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE) ); UnitTracker* tracker = reinterpret_cast<UnitTracker*>( g_object_get_data( tbl, "tracker" ) ); - Unit const unit = tracker->getActiveUnit(); - Unit const doc_unit = *sp_desktop_namedview(SP_ACTIVE_DESKTOP)->doc_units; + Unit const *unit = tracker->getActiveUnit(); + Unit const *doc_unit = sp_desktop_namedview(SP_ACTIVE_DESKTOP)->doc_units; 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 e4e72d86e..2604ebf22 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -63,7 +63,7 @@ enum { typedef struct { GtkOrientation orientation; - Inkscape::Util::Unit *unit; + Inkscape::Util::Unit const *unit; gdouble lower; gdouble upper; gdouble position; @@ -260,7 +260,7 @@ sp_ruler_init (SPRuler *ruler) gtk_widget_set_has_window (GTK_WIDGET (ruler), FALSE); priv->orientation = GTK_ORIENTATION_HORIZONTAL; - priv->unit = new Inkscape::Util::Unit(unit_table.getUnit("px")); + priv->unit = unit_table.getUnit("px"); priv->lower = 0; priv->upper = 0; priv->position = 0; @@ -1071,15 +1071,15 @@ sp_ruler_remove_track_widget (SPRuler *ruler, */ void sp_ruler_set_unit (SPRuler *ruler, - const Inkscape::Util::Unit &unit) + Inkscape::Util::Unit const *unit) { SPRulerPrivate *priv = SP_RULER_GET_PRIVATE (ruler); g_return_if_fail (SP_IS_RULER (ruler)); - if (*priv->unit != unit) + if (*priv->unit != *unit) { - priv->unit = new Inkscape::Util::Unit(unit); + priv->unit = unit; g_object_notify(G_OBJECT(ruler), "unit"); gtk_widget_queue_draw (GTK_WIDGET (ruler)); @@ -1092,7 +1092,7 @@ sp_ruler_set_unit (SPRuler *ruler, * * Return value: the unit currently used in the @ruler widget. **/ -Inkscape::Util::Unit* +Inkscape::Util::Unit const* sp_ruler_get_unit (SPRuler *ruler) { return SP_RULER_GET_PRIVATE (ruler)->unit; @@ -1182,7 +1182,7 @@ sp_ruler_draw_ticks (SPRuler *ruler) gint text_size; gint pos; gdouble max_size; - Inkscape::Util::Unit *unit; + Inkscape::Util::Unit const *unit = NULL; SPRulerMetric ruler_metric = ruler_metric_general; /* The metric to use for this unit system */ PangoLayout *layout; PangoRectangle logical_rect, ink_rect; @@ -1298,7 +1298,7 @@ sp_ruler_draw_ticks (SPRuler *ruler) /* Inkscape change to ruler: Use a 1,2,4,8... scale for inches * or a 1,2,5,10... scale for everything else */ - if (*sp_ruler_get_unit (ruler) == unit_table.getUnit("in")) + if (*sp_ruler_get_unit (ruler) == *unit_table.getUnit("in")) ruler_metric = ruler_metric_inches; for (scale = 0; scale < G_N_ELEMENTS (ruler_metric.ruler_scale); scale++) @@ -1317,7 +1317,7 @@ sp_ruler_draw_ticks (SPRuler *ruler) gdouble subd_incr; /* hack to get proper subdivisions at full pixels */ - if (*unit == unit_table.getUnit("px") && scale == 1 && i == 1) + if (*unit == *unit_table.getUnit("px") && scale == 1 && i == 1) subd_incr = 1.0; else subd_incr = ((gdouble) ruler_metric.ruler_scale[scale] / diff --git a/src/widgets/ruler.h b/src/widgets/ruler.h index 08760f584..ed529d082 100644 --- a/src/widgets/ruler.h +++ b/src/widgets/ruler.h @@ -56,8 +56,8 @@ void sp_ruler_remove_track_widget (SPRuler *ruler, GtkWidget *widget); void sp_ruler_set_unit (SPRuler *ruler, - const Inkscape::Util::Unit &unit); -Inkscape::Util::Unit *sp_ruler_get_unit (SPRuler *ruler); + const Inkscape::Util::Unit *unit); +Inkscape::Util::Unit const * sp_ruler_get_unit (SPRuler *ruler); void sp_ruler_set_position (SPRuler *ruler, gdouble set_position); gdouble sp_ruler_get_position (SPRuler *ruler); diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index 590b0867f..58d7134b3 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -80,7 +80,7 @@ sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel) Geom::OptRect const bbox(sel->bounds(bbox_type)); if ( bbox ) { UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(G_OBJECT(spw), "tracker")); - Unit const unit = tracker->getActiveUnit(); + Unit const *unit = tracker->getActiveUnit(); struct { char const *key; double val; } const keyval[] = { { "X", bbox->min()[X] }, @@ -89,8 +89,8 @@ sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel) { "height", bbox->dimensions()[Y] } }; - if (unit.type == Inkscape::Util::UNIT_TYPE_DIMENSIONLESS) { - double const val = unit.factor * 100; + if (unit->type == Inkscape::Util::UNIT_TYPE_DIMENSIONLESS) { + double const val = unit->factor * 100; 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, val); @@ -185,14 +185,14 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) gdouble y1 = 0; gdouble xrel = 0; gdouble yrel = 0; - Unit const unit = tracker->getActiveUnit(); + Unit const *unit = tracker->getActiveUnit(); GtkAdjustment* a_x = GTK_ADJUSTMENT( g_object_get_data( G_OBJECT(spw), "X" ) ); GtkAdjustment* a_y = GTK_ADJUSTMENT( g_object_get_data( G_OBJECT(spw), "Y" ) ); 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" ) ); - if (unit.type == Inkscape::Util::UNIT_TYPE_LINEAR) { + 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"); x1 = x0 + Quantity::convert(gtk_adjustment_get_value(a_w), unit, "px"); @@ -200,13 +200,13 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) y1 = y0 + Quantity::convert(gtk_adjustment_get_value(a_h), unit, "px");; yrel = Quantity::convert(gtk_adjustment_get_value(a_h), unit, "px") / bbox_user->dimensions()[Geom::Y]; } else { - double const x0_propn = gtk_adjustment_get_value (a_x) / 100 / unit.factor; + double const x0_propn = gtk_adjustment_get_value (a_x) / 100 / unit->factor; x0 = bbox_user->min()[Geom::X] * x0_propn; - double const y0_propn = gtk_adjustment_get_value (a_y) / 100 / unit.factor; + double const y0_propn = gtk_adjustment_get_value (a_y) / 100 / unit->factor; y0 = y0_propn * bbox_user->min()[Geom::Y]; - xrel = gtk_adjustment_get_value (a_w) / (100 / unit.factor); + xrel = gtk_adjustment_get_value (a_w) / (100 / unit->factor); x1 = x0 + xrel * bbox_user->dimensions()[Geom::X]; - yrel = gtk_adjustment_get_value (a_h) / (100 / unit.factor); + yrel = gtk_adjustment_get_value (a_h) / (100 / unit->factor); y1 = y0 + yrel * bbox_user->dimensions()[Geom::Y]; } @@ -227,7 +227,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) double sv = fabs(y1 - bbox_user->max()[Geom::Y]); // unless the unit is %, convert the scales and moves to the unit - if (unit.type == Inkscape::Util::UNIT_TYPE_LINEAR) { + if (unit->type == Inkscape::Util::UNIT_TYPE_LINEAR) { mh = Quantity::convert(mh, "px", unit); sh = Quantity::convert(sh, "px", unit); mv = Quantity::convert(mv, "px", unit); diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index a0b638031..d140cfb21 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -147,7 +147,8 @@ StrokeStyle::StrokeStyle() : selectModifiedConn(), startMarkerConn(), midMarkerConn(), - endMarkerConn() + endMarkerConn(), + _old_unit(NULL) { Gtk::HBox *hb; Gtk::HBox *f = new Gtk::HBox(false, 0); @@ -199,12 +200,12 @@ StrokeStyle::StrokeStyle() : Gtk::Widget *us = manage(unitSelector); SPDesktop *desktop = SP_ACTIVE_DESKTOP; - unitSelector->addUnit(unit_table.getUnit("%")); + unitSelector->addUnit(*unit_table.getUnit("%")); + _old_unit = unitSelector->getUnit(); if (desktop) { unitSelector->setUnit(sp_desktop_namedview(desktop)->doc_units->abbr); - _old_unit = new Inkscape::Util::Unit(*sp_desktop_namedview(desktop)->doc_units); + _old_unit = sp_desktop_namedview(desktop)->doc_units; } - _old_unit = new Inkscape::Util::Unit(unitSelector->getUnit()); widthSpin->setUnitMenu(unitSelector); unitChangedConn = unitSelector->signal_changed().connect(sigc::mem_fun(*this, &StrokeStyle::unitChangedCB)); @@ -529,12 +530,12 @@ void StrokeStyle::updateMarkerHist(SPMarkerLoc const which) */ void StrokeStyle::unitChangedCB() { - Inkscape::Util::Unit new_unit = unitSelector->getUnit(); - if (new_unit.type == Inkscape::Util::UNIT_TYPE_DIMENSIONLESS) { + Inkscape::Util::Unit const *new_unit = unitSelector->getUnit(); + if (new_unit->type == Inkscape::Util::UNIT_TYPE_DIMENSIONLESS) { widthSpin->set_value(100); } - widthSpin->set_value(Inkscape::Util::Quantity::convert(widthSpin->get_value(), *_old_unit, new_unit)); - _old_unit = new Inkscape::Util::Unit(new_unit); + widthSpin->set_value(Inkscape::Util::Quantity::convert(widthSpin->get_value(), _old_unit, new_unit)); + _old_unit = new_unit; } /** @@ -824,21 +825,20 @@ StrokeStyle::updateLine() } else { table->set_sensitive(true); - Inkscape::Util::Unit const *unit = new Inkscape::Util::Unit(unitSelector->getUnit()); - if (result_sw == QUERY_STYLE_MULTIPLE_AVERAGED) { unitSelector->setUnit("%"); } else { // same width, or only one object; no sense to keep percent, switch to absolute - if (unit->type != Inkscape::Util::UNIT_TYPE_LINEAR) { + Inkscape::Util::Unit const *tempunit = unitSelector->getUnit(); + if (tempunit->type != Inkscape::Util::UNIT_TYPE_LINEAR) { unitSelector->setUnit(sp_desktop_namedview(SP_ACTIVE_DESKTOP)->doc_units->abbr); } } - unit = new Inkscape::Util::Unit(unitSelector->getUnit()); + Inkscape::Util::Unit const *unit = unitSelector->getUnit(); if (unit->type == Inkscape::Util::UNIT_TYPE_LINEAR) { - double avgwidth = Inkscape::Util::Quantity::convert(query->stroke_width.computed, "px", *unit); + double avgwidth = Inkscape::Util::Quantity::convert(query->stroke_width.computed, "px", unit); #if WITH_GTKMM_3_0 (*widthAdj)->set_value(avgwidth); #else @@ -964,7 +964,7 @@ StrokeStyle::scaleLine() double const miterlimit = miterLimitAdj->get_value(); #endif - Inkscape::Util::Unit const *const unit = new Inkscape::Util::Unit(unitSelector->getUnit()); + Inkscape::Util::Unit const *const unit = unitSelector->getUnit(); double *dash, offset; int ndash; @@ -974,7 +974,7 @@ StrokeStyle::scaleLine() /* Set stroke width */ double width; if (unit->type == Inkscape::Util::UNIT_TYPE_LINEAR) { - width = Inkscape::Util::Quantity::convert(width_typed, *unit, "px"); + width = Inkscape::Util::Quantity::convert(width_typed, unit, "px"); } else { // percentage gdouble old_w = SP_OBJECT(i->data)->style->stroke_width.computed; width = old_w * width_typed / 100; diff --git a/src/widgets/stroke-style.h b/src/widgets/stroke-style.h index 440881c6d..6f0fe583b 100644 --- a/src/widgets/stroke-style.h +++ b/src/widgets/stroke-style.h @@ -214,7 +214,7 @@ private: sigc::connection endMarkerConn; sigc::connection unitChangedConn; - Inkscape::Util::Unit *_old_unit; + Inkscape::Util::Unit const *_old_unit; }; } // namespace Inkscape |
