summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthew Petroff <matthew@mpetroff.net>2013-07-20 19:08:31 +0000
committerMatthew Petroff <matthew@mpetroff.net>2013-07-20 19:08:31 +0000
commitfdf69629c66f6c1a69d88a00bb6c1311c97b631b (patch)
treed35f16b943cf6b1635e12d16e2452b034643fea5 /src
parentAdd string output functions for units. (diff)
downloadinkscape-fdf69629c66f6c1a69d88a00bb6c1311c97b631b.tar.gz
inkscape-fdf69629c66f6c1a69d88a00bb6c1311c97b631b.zip
Ported away from and removed "sp-metrics.*".
(bzr r12380.1.47)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile_insert1
-rw-r--r--src/arc-context.cpp7
-rw-r--r--src/box3d-context.cpp1
-rw-r--r--src/desktop-events.cpp1
-rw-r--r--src/doxygen-main.cpp2
-rw-r--r--src/flood-context.cpp1
-rw-r--r--src/live_effects/lpe-path_length.cpp1
-rw-r--r--src/pen-context.cpp4
-rw-r--r--src/rect-context.cpp7
-rw-r--r--src/seltrans.cpp13
-rw-r--r--src/sp-guide.cpp9
-rw-r--r--src/sp-metrics.cpp120
-rw-r--r--src/sp-metrics.h20
-rw-r--r--src/sp-text.cpp4
-rw-r--r--src/spiral-context.cpp4
-rw-r--r--src/star-context.cpp4
-rw-r--r--src/text-context.cpp7
-rw-r--r--src/ui/tool/node.cpp18
19 files changed, 44 insertions, 182 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fa54940db..f975f16bf 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -46,7 +46,6 @@ set(sp_SRC
sp-mesh-patch.cpp
sp-mesh-row.cpp
sp-metadata.cpp
- sp-metrics.cpp
sp-missing-glyph.cpp
sp-namedview.cpp
sp-object-group.cpp
@@ -137,7 +136,6 @@ set(sp_SRC
sp-mesh-row.h
sp-metadata.h
sp-metric.h
- sp-metrics.h
sp-missing-glyph.h
sp-namedview.h
sp-object-group.h
diff --git a/src/Makefile_insert b/src/Makefile_insert
index 88f809b52..ba14056e5 100644
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
@@ -200,7 +200,6 @@ ink_common_sources += \
sp-mesh-row-fns.h \
sp-mesh-row.cpp sp-mesh-row.h \
sp-metric.h \
- sp-metrics.cpp sp-metrics.h \
sp-missing-glyph.cpp sp-missing-glyph.h \
sp-namedview.cpp sp-namedview.h \
sp-object.cpp sp-object.h \
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index 34e4bbeab..115f45493 100644
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
@@ -32,7 +32,6 @@
#include "desktop-handles.h"
#include "snap.h"
#include "pixmaps/cursor-ellipse.xpm"
-#include "sp-metrics.h"
#include "xml/repr.h"
#include "xml/node-event-vector.h"
#include "preferences.h"
@@ -450,8 +449,10 @@ static void sp_arc_drag(SPArcContext *ac, Geom::Point pt, guint state)
double rdimx = r.dimensions()[Geom::X];
double rdimy = r.dimensions()[Geom::Y];
- GString *xs = SP_PX_TO_METRIC_STRING(rdimx, desktop->namedview->getDefaultMetric());
- GString *ys = SP_PX_TO_METRIC_STRING(rdimy, desktop->namedview->getDefaultMetric());
+ Inkscape::Util::Quantity rdimx_q = Inkscape::Util::Quantity(rdimx, "px");
+ Inkscape::Util::Quantity rdimy_q = Inkscape::Util::Quantity(rdimy, "px");
+ GString *xs = g_string_new(rdimx_q.string(*desktop->namedview->doc_units).c_str());
+ GString *ys = g_string_new(rdimy_q.string(*desktop->namedview->doc_units).c_str());
if (state & GDK_CONTROL_MASK) {
int ratio_x, ratio_y;
if (fabs (rdimx) > fabs (rdimy)) {
diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp
index a55aba00d..7491520de 100644
--- a/src/box3d-context.cpp
+++ b/src/box3d-context.cpp
@@ -35,7 +35,6 @@
#include "pixmaps/cursor-3dbox.xpm"
#include "box3d.h"
#include "box3d-context.h"
-#include "sp-metrics.h"
#include <glibmm/i18n.h>
#include "xml/repr.h"
#include "xml/node-event-vector.h"
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index 473ccfa9f..5cb26abc0 100644
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
@@ -39,7 +39,6 @@
#include "snap.h"
#include "display/sp-canvas.h"
#include "sp-guide.h"
-#include "sp-metrics.h"
#include "sp-namedview.h"
#include "tools-switch.h"
#include "verbs.h"
diff --git a/src/doxygen-main.cpp b/src/doxygen-main.cpp
index 04e5ab33e..d254299c8 100644
--- a/src/doxygen-main.cpp
+++ b/src/doxygen-main.cpp
@@ -334,8 +334,6 @@ namespace XML {}
*
* Inkscape::GC
*
- * [\ref sp-metrics.cpp, \ref sp-metrics.h]
- *
* [\ref prefs-utils.cpp] [\ref print.cpp]
*
* - Inkscape::GZipBuffer [\ref streams-gzip.h]
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index 8fde11f88..a719f1202 100644
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
@@ -54,7 +54,6 @@
#include "sp-defs.h"
#include "sp-item.h"
#include "splivarot.h"
-#include "sp-metrics.h"
#include "sp-namedview.h"
#include "sp-object.h"
#include "sp-path.h"
diff --git a/src/live_effects/lpe-path_length.cpp b/src/live_effects/lpe-path_length.cpp
index 504fb53c0..4ca380c15 100644
--- a/src/live_effects/lpe-path_length.cpp
+++ b/src/live_effects/lpe-path_length.cpp
@@ -14,7 +14,6 @@
#include <glibmm/i18n.h>
#include "live_effects/lpe-path_length.h"
-#include "sp-metrics.h"
#include "util/units.h"
#include "2geom/sbasis-geometric.h"
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index eac2ce5d1..69abf3513 100644
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
@@ -22,7 +22,6 @@
#include "pen-context.h"
#include "sp-namedview.h"
-#include "sp-metrics.h"
#include "desktop.h"
#include "desktop-handles.h"
#include "selection.h"
@@ -1184,7 +1183,8 @@ static void spdc_pen_set_angle_distance_status_message(SPPenContext *const pc, G
SPDesktop *desktop = SP_EVENT_CONTEXT(pc)->desktop;
Geom::Point rel = p - pc->p[pc_point_to_compare];
- GString *dist = SP_PX_TO_METRIC_STRING(Geom::L2(rel), desktop->namedview->getDefaultMetric());
+ Inkscape::Util::Quantity q = Inkscape::Util::Quantity(Geom::L2(rel), "px");
+ GString *dist = g_string_new(q.string(*desktop->namedview->doc_units).c_str());
double angle = atan2(rel[Geom::Y], rel[Geom::X]) * 180 / M_PI;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/options/compassangledisplay/value", 0) != 0) {
diff --git a/src/rect-context.cpp b/src/rect-context.cpp
index 06745564f..17675745f 100644
--- a/src/rect-context.cpp
+++ b/src/rect-context.cpp
@@ -35,7 +35,6 @@
#include "message-context.h"
#include "pixmaps/cursor-rect.xpm"
#include "rect-context.h"
-#include "sp-metrics.h"
#include <glibmm/i18n.h>
#include "xml/repr.h"
#include "xml/node-event-vector.h"
@@ -483,8 +482,10 @@ static void sp_rect_drag(SPRectContext &rc, Geom::Point const pt, guint state)
// status text
double rdimx = r.dimensions()[Geom::X];
double rdimy = r.dimensions()[Geom::Y];
- GString *xs = SP_PX_TO_METRIC_STRING(rdimx, desktop->namedview->getDefaultMetric());
- GString *ys = SP_PX_TO_METRIC_STRING(rdimy, desktop->namedview->getDefaultMetric());
+ Inkscape::Util::Quantity rdimx_q = Inkscape::Util::Quantity(rdimx, "px");
+ Inkscape::Util::Quantity rdimy_q = Inkscape::Util::Quantity(rdimy, "px");
+ GString *xs = g_string_new(rdimx_q.string(*desktop->namedview->doc_units).c_str());
+ GString *ys = g_string_new(rdimy_q.string(*desktop->namedview->doc_units).c_str());
if (state & GDK_CONTROL_MASK) {
int ratio_x, ratio_y;
bool is_golden_ratio = false;
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 33bfe3e4a..f614853bc 100644
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -37,7 +37,6 @@
#include "seltrans-handles.h"
#include "seltrans.h"
#include "selection-chemistry.h"
-#include "sp-metrics.h"
#include "verbs.h"
#include <glibmm/i18n.h>
#include "display/sp-ctrlline.h"
@@ -1273,8 +1272,10 @@ gboolean Inkscape::SelTrans::centerRequest(Geom::Point &pt, guint state)
m.unSetup();
// status text
- GString *xs = SP_PX_TO_METRIC_STRING(pt[Geom::X], _desktop->namedview->getDefaultMetric());
- GString *ys = SP_PX_TO_METRIC_STRING(pt[Geom::Y], _desktop->namedview->getDefaultMetric());
+ Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(pt[Geom::X], "px");
+ Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(pt[Geom::Y], "px");
+ GString *xs = g_string_new(x_q.string(*_desktop->namedview->doc_units).c_str());
+ GString *ys = g_string_new(y_q.string(*_desktop->namedview->doc_units).c_str());
_message_context.setF(Inkscape::NORMAL_MESSAGE, _("Move <b>center</b> to %s, %s"), xs->str, ys->str);
g_string_free(xs, FALSE);
g_string_free(ys, FALSE);
@@ -1425,8 +1426,10 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state)
transform(move, norm);
// status text
- GString *xs = SP_PX_TO_METRIC_STRING(dxy[Geom::X], _desktop->namedview->getDefaultMetric());
- GString *ys = SP_PX_TO_METRIC_STRING(dxy[Geom::Y], _desktop->namedview->getDefaultMetric());
+ Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(dxy[Geom::X], "px");
+ Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(dxy[Geom::Y], "px");
+ GString *xs = g_string_new(x_q.string(*_desktop->namedview->doc_units).c_str());
+ GString *ys = g_string_new(y_q.string(*_desktop->namedview->doc_units).c_str());
_message_context.setF(Inkscape::NORMAL_MESSAGE, _("<b>Move</b> by %s, %s; with <b>Ctrl</b> to restrict to horizontal/vertical; with <b>Shift</b> to disable snapping"), xs->str, ys->str);
g_string_free(xs, TRUE);
g_string_free(ys, TRUE);
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp
index 48596cbc0..961e53e04 100644
--- a/src/sp-guide.cpp
+++ b/src/sp-guide.cpp
@@ -35,7 +35,6 @@
#include <glibmm/i18n.h>
#include <xml/repr.h>
#include <remove-last.h>
-#include "sp-metrics.h"
#include "inkscape.h"
#include "desktop.h"
#include "sp-namedview.h"
@@ -463,10 +462,10 @@ char *sp_guide_description(SPGuide const *guide, const bool verbose)
} else {
SPNamedView *namedview = sp_document_namedview(guide->document, NULL);
- GString *position_string_x = SP_PX_TO_METRIC_STRING(guide->point_on_line[X],
- namedview->getDefaultMetric());
- GString *position_string_y = SP_PX_TO_METRIC_STRING(guide->point_on_line[Y],
- namedview->getDefaultMetric());
+ Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(guide->point_on_line[X], "px");
+ Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(guide->point_on_line[Y], "px");
+ GString *position_string_x = g_string_new(x_q.string(*namedview->doc_units).c_str());
+ GString *position_string_y = g_string_new(y_q.string(*namedview->doc_units).c_str());
gchar *shortcuts = g_strdup_printf("; %s", _("<b>Shift+drag</b> to rotate, <b>Ctrl+drag</b> to move origin, <b>Del</b> to delete"));
diff --git a/src/sp-metrics.cpp b/src/sp-metrics.cpp
deleted file mode 100644
index 2b421cf05..000000000
--- a/src/sp-metrics.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-#include "sp-metrics.h"
-#include "unit-constants.h"
-
-/*
- * SPMetric handling and stuff
- * I hope this will be usefull :-)
- */
-
-gdouble
-sp_absolute_metric_to_metric (gdouble length_src, const SPMetric metric_src, const SPMetric metric_dst)
-{
- gdouble src = 1;
- gdouble dst = 1;
-
- switch (metric_src) {
- case SP_M:
- src = M_PER_IN;
- break;
- case SP_MM:
- src = MM_PER_IN;
- break;
- case SP_CM:
- src = CM_PER_IN;
- break;
- case SP_IN:
- src = IN_PER_IN;
- break;
- case SP_FT:
- src = FT_PER_IN;
- break;
- case SP_PT:
- src = PT_PER_IN;
- break;
- case SP_PC:
- src = PC_PER_IN;
- break;
- case SP_PX:
- src = PX_PER_IN;
- break;
- case SP_NONE:
- src = 1;
- break;
- }
-
- switch (metric_dst) {
- case SP_M:
- dst = M_PER_IN;
- break;
- case SP_MM:
- dst = MM_PER_IN;
- break;
- case SP_CM:
- dst = CM_PER_IN;
- break;
- case SP_IN:
- dst = IN_PER_IN;
- break;
- case SP_FT:
- dst = FT_PER_IN;
- break;
- case SP_PT:
- dst = PT_PER_IN;
- break;
- case SP_PC:
- dst = PC_PER_IN;
- break;
- case SP_PX:
- dst = PX_PER_IN;
- break;
- case SP_NONE:
- dst = 1;
- break;
- }
-
- return length_src * (dst/src);
-}
-
-/**
- * Create a human-readable string suitable for status-bar display.
- */
-GString *
-sp_metric_to_metric_string(gdouble const length,
- SPMetric const metric_src, SPMetric const metric_dst,
- gboolean const m)
-{
- gdouble const len = sp_absolute_metric_to_metric(length, metric_src, metric_dst);
- GString *str = g_string_new("");
- g_string_printf(str, "%0.02f", len);
- /* We need a fixed number of fractional digits, because otherwise the live statusbar display of
- * lengths will be too jerky */
-
- if (m) {
- char const *unit_str;
- switch (metric_dst) {
- case SP_M: unit_str = " m"; break;
- case SP_MM: unit_str = " mm"; break;
- case SP_CM: unit_str = " cm"; break;
- case SP_IN: unit_str = "\""; break;
- case SP_PT: unit_str = " pt"; break;
- case SP_PX: unit_str = " px"; break;
- default: unit_str = NULL; break;
- }
- if (unit_str) {
- g_string_append(str, unit_str);
- }
- }
- return str;
-}
-
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/sp-metrics.h b/src/sp-metrics.h
deleted file mode 100644
index c2f968797..000000000
--- a/src/sp-metrics.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef SP_METRICS_H
-#define SP_METRICS_H
-
-#include <glib.h>
-#include "sp-metric.h"
-
-gdouble sp_absolute_metric_to_metric (gdouble length_src, const SPMetric metric_src, const SPMetric metric_dst);
-GString * sp_metric_to_metric_string (gdouble length, const SPMetric metric_src, const SPMetric metric_dst, gboolean m);
-
-// convenience since we mostly deal with points
-#define SP_METRIC_TO_PT(l,m) sp_absolute_metric_to_metric(l,m,SP_PT);
-#define SP_PT_TO_METRIC(l,m) sp_absolute_metric_to_metric(l,SP_PT,m);
-
-#define SP_PT_TO_METRIC_STRING(l,m) sp_metric_to_metric_string(l, SP_PT, m, TRUE)
-#define SP_PT_TO_STRING(l,m) sp_metric_to_metric_string(l, SP_PT, m, FALSE)
-
-#define SP_PX_TO_METRIC_STRING(l,m) sp_metric_to_metric_string(l, SP_PX, m, TRUE)
-#define SP_PX_TO_STRING(l,m) sp_metric_to_metric_string(l, SP_PX, m, FALSE)
-
-#endif
diff --git a/src/sp-text.cpp b/src/sp-text.cpp
index 8d42b7d59..d84bbdc6c 100644
--- a/src/sp-text.cpp
+++ b/src/sp-text.cpp
@@ -43,7 +43,6 @@
#include "sp-namedview.h"
#include "style.h"
#include "inkscape.h"
-#include "sp-metrics.h"
#include "xml/quote.h"
#include "xml/repr.h"
#include "mod360.h"
@@ -392,7 +391,8 @@ static char * sp_text_description(SPItem *item)
n = g_strdup(_("&lt;no name found&gt;"));
}
- GString *xs = SP_PX_TO_METRIC_STRING(style->font_size.computed, sp_desktop_namedview(SP_ACTIVE_DESKTOP)->getDefaultMetric());
+ Inkscape::Util::Quantity q = Inkscape::Util::Quantity(style->font_size.computed, "px");
+ GString *xs = g_string_new(q.string(*sp_desktop_namedview(SP_ACTIVE_DESKTOP)->doc_units).c_str());
char const *trunc = "";
Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) item);
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index b7bf5aead..a6cdc6bc4 100644
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
@@ -34,7 +34,6 @@
#include "message-context.h"
#include "pixmaps/cursor-spiral.xpm"
#include "spiral-context.h"
-#include "sp-metrics.h"
#include <glibmm/i18n.h>
#include "xml/repr.h"
#include "xml/node-event-vector.h"
@@ -437,7 +436,8 @@ static void sp_spiral_drag(SPSpiralContext *sc, Geom::Point const &p, guint stat
/*t0*/ sc->t0);
/* status text */
- GString *rads = SP_PX_TO_METRIC_STRING(rad, desktop->namedview->getDefaultMetric());
+ Inkscape::Util::Quantity q = Inkscape::Util::Quantity(rad, "px");
+ GString *rads = g_string_new(q.string(*desktop->namedview->doc_units).c_str());
sc->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE,
_("<b>Spiral</b>: radius %s, angle %5g&#176;; with <b>Ctrl</b> to snap angle"),
rads->str, sp_round((arg + 2.0*M_PI*spiral->revo)*180/M_PI, 0.0001));
diff --git a/src/star-context.cpp b/src/star-context.cpp
index 5fb33a180..d4996e189 100644
--- a/src/star-context.cpp
+++ b/src/star-context.cpp
@@ -36,7 +36,6 @@
#include "desktop-style.h"
#include "message-context.h"
#include "pixmaps/cursor-star.xpm"
-#include "sp-metrics.h"
#include <glibmm/i18n.h>
#include "preferences.h"
#include "xml/repr.h"
@@ -450,7 +449,8 @@ static void sp_star_drag(SPStarContext *sc, Geom::Point p, guint state)
arg1, arg1 + M_PI / sides, sc->isflatsided, sc->rounded, sc->randomized);
/* status text */
- GString *rads = SP_PX_TO_METRIC_STRING(r1, desktop->namedview->getDefaultMetric());
+ Inkscape::Util::Quantity q = Inkscape::Util::Quantity(r1, "px");
+ GString *rads = g_string_new(q.string(*desktop->namedview->doc_units).c_str());
sc->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE,
( sc->isflatsided?
_("<b>Polygon</b>: radius %s, angle %5g&#176;; with <b>Ctrl</b> to snap angle")
diff --git a/src/text-context.cpp b/src/text-context.cpp
index 862c50737..719a82156 100644
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
@@ -42,7 +42,6 @@
#include "selection.h"
#include "shape-editor.h"
#include "sp-flowtext.h"
-#include "sp-metrics.h"
#include "sp-namedview.h"
#include "sp-text.h"
#include "style.h"
@@ -640,8 +639,10 @@ static gint sp_text_context_root_handler(SPEventContext *const event_context, Gd
gobble_motion_events(GDK_BUTTON1_MASK);
// status text
- GString *xs = SP_PX_TO_METRIC_STRING(fabs((p - tc->p0)[Geom::X]), desktop->namedview->getDefaultMetric());
- GString *ys = SP_PX_TO_METRIC_STRING(fabs((p - tc->p0)[Geom::Y]), desktop->namedview->getDefaultMetric());
+ Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(fabs((p - tc->p0)[Geom::X]), "px");
+ Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(fabs((p - tc->p0)[Geom::Y]), "px");
+ GString *xs = g_string_new(x_q.string(*desktop->namedview->doc_units).c_str());
+ GString *ys = g_string_new(y_q.string(*desktop->namedview->doc_units).c_str());
event_context->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Flowed text frame</b>: %s &#215; %s"), xs->str, ys->str);
g_string_free(xs, FALSE);
g_string_free(ys, FALSE);
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index dc6e0fbae..82eb697bd 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -22,7 +22,6 @@
#include "preferences.h"
#include "snap.h"
#include "snap-preferences.h"
-#include "sp-metrics.h"
#include "sp-namedview.h"
#include "ui/control-manager.h"
#include "ui/tool/control-point-selection.h"
@@ -490,9 +489,13 @@ Glib::ustring Handle::_getDragTip(GdkEventMotion */*event*/) const
double angle = Geom::angle_between(Geom::Point(-1,0), position() - _parent->position());
angle += M_PI; // angle is (-M_PI...M_PI] - offset by +pi and scale to 0...360
angle *= 360.0 / (2 * M_PI);
- GString *x = SP_PX_TO_METRIC_STRING(dist[Geom::X], _desktop->namedview->getDefaultMetric());
- GString *y = SP_PX_TO_METRIC_STRING(dist[Geom::Y], _desktop->namedview->getDefaultMetric());
- GString *len = SP_PX_TO_METRIC_STRING(length(), _desktop->namedview->getDefaultMetric());
+
+ Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(dist[Geom::X], "px");
+ Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(dist[Geom::Y], "px");
+ Inkscape::Util::Quantity len_q = Inkscape::Util::Quantity(length(), "px");
+ GString *x = g_string_new(x_q.string(*_desktop->namedview->doc_units).c_str());
+ GString *y = g_string_new(y_q.string(*_desktop->namedview->doc_units).c_str());
+ GString *len = g_string_new(len_q.string(*_desktop->namedview->doc_units).c_str());
Glib::ustring ret = format_tip(C_("Path handle tip",
"Move handle by %s, %s; angle %.2f°, length %s"), x->str, y->str, angle, len->str);
g_string_free(x, TRUE);
@@ -1294,8 +1297,11 @@ Glib::ustring Node::_getTip(unsigned state) const
Glib::ustring Node::_getDragTip(GdkEventMotion */*event*/) const
{
Geom::Point dist = position() - _last_drag_origin();
- GString *x = SP_PX_TO_METRIC_STRING(dist[Geom::X], _desktop->namedview->getDefaultMetric());
- GString *y = SP_PX_TO_METRIC_STRING(dist[Geom::Y], _desktop->namedview->getDefaultMetric());
+
+ Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(dist[Geom::X], "px");
+ Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(dist[Geom::Y], "px");
+ GString *x = g_string_new(x_q.string(*_desktop->namedview->doc_units).c_str());
+ GString *y = g_string_new(y_q.string(*_desktop->namedview->doc_units).c_str());
Glib::ustring ret = format_tip(C_("Path node tip", "Move node by %s, %s"),
x->str, y->str);
g_string_free(x, TRUE);