summaryrefslogtreecommitdiffstats
path: root/src/widgets/rect-toolbar.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2014-11-24 19:56:53 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2014-11-24 19:56:53 +0000
commitbad0504958a10f1b99db3ae2557305541f388a52 (patch)
tree2fdec1e71db3d37d097e07cdd5b210eaaa844bcf /src/widgets/rect-toolbar.cpp
parentExtensions: try to calculate the SVG unit (diff)
downloadinkscape-bad0504958a10f1b99db3ae2557305541f388a52.tar.gz
inkscape-bad0504958a10f1b99db3ae2557305541f388a52.zip
Units: make it absolutely clear that Document properties unit dropdown is for UI Display Units. Upon document load, calculate the units used for SVG values, if a viewbox is available. If not, default to "px" SVG units.
Change all code to use either Display units OR svg units. (bzr r13751)
Diffstat (limited to 'src/widgets/rect-toolbar.cpp')
-rw-r--r--src/widgets/rect-toolbar.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp
index b6b7e435d..5356ebb0d 100644
--- a/src/widgets/rect-toolbar.cpp
+++ b/src/widgets/rect-toolbar.cpp
@@ -109,7 +109,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)->svg_units));
} else {
SP_OBJECT(items->data)->getRepr()->setAttribute(value_name, NULL);
}
@@ -181,7 +181,7 @@ 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();
- Unit const *doc_unit = sp_desktop_namedview(SP_ACTIVE_DESKTOP)->doc_units;
+ Unit const *svg_unit = sp_desktop_namedview(SP_ACTIVE_DESKTOP)->svg_units;
g_return_if_fail(unit != NULL);
gpointer item = g_object_get_data( tbl, "item" );
@@ -190,28 +190,28 @@ static void rect_tb_event_attr_changed(Inkscape::XML::Node * /*repr*/, gchar con
GtkAdjustment *adj = GTK_ADJUSTMENT( g_object_get_data( tbl, "rx" ) );
gdouble rx = SP_RECT(item)->getVisibleRx();
- gtk_adjustment_set_value(adj, Quantity::convert(rx, doc_unit, unit));
+ gtk_adjustment_set_value(adj, Quantity::convert(rx, svg_unit, unit));
}
{
GtkAdjustment *adj = GTK_ADJUSTMENT( g_object_get_data( tbl, "ry" ) );
gdouble ry = SP_RECT(item)->getVisibleRy();
- gtk_adjustment_set_value(adj, Quantity::convert(ry, doc_unit, unit));
+ gtk_adjustment_set_value(adj, Quantity::convert(ry, svg_unit, unit));
}
{
GtkAdjustment *adj = GTK_ADJUSTMENT( g_object_get_data( tbl, "width" ) );
gdouble width = SP_RECT(item)->getVisibleWidth();
- gtk_adjustment_set_value(adj, Quantity::convert(width, doc_unit, unit));
+ gtk_adjustment_set_value(adj, Quantity::convert(width, svg_unit, unit));
}
{
GtkAdjustment *adj = GTK_ADJUSTMENT( g_object_get_data( tbl, "height" ) );
gdouble height = SP_RECT(item)->getVisibleHeight();
- gtk_adjustment_set_value(adj, Quantity::convert(height, doc_unit, unit));
+ gtk_adjustment_set_value(adj, Quantity::convert(height, svg_unit, unit));
}
}
@@ -307,7 +307,7 @@ void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
UnitTracker* tracker = new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR);
//tracker->addUnit( SP_UNIT_PERCENT, 0 );
// fixme: add % meaning per cent of the width/height
- tracker->setActiveUnit( sp_desktop_namedview(desktop)->doc_units );
+ tracker->setActiveUnit( sp_desktop_namedview(desktop)->display_units );
g_object_set_data( holder, "tracker", tracker );
/* W */