summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorMatthew Petroff <matthew@mpetroff.net>2013-08-28 03:32:14 +0000
committerMatthew Petroff <matthew@mpetroff.net>2013-08-28 03:32:14 +0000
commit3bfb610bb7719d49821fe5381ae449789c3cb968 (patch)
treec6c221e0c7bfcc6399ee4aee360b7b1d4de3f896 /src/ui
parentUse Quantity comparisons in PageSizer. (diff)
downloadinkscape-3bfb610bb7719d49821fe5381ae449789c3cb968.tar.gz
inkscape-3bfb610bb7719d49821fe5381ae449789c3cb968.zip
Improve code readability.
(bzr r12475.1.9)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/clipboard.cpp4
-rw-r--r--src/ui/dialog/print.cpp4
-rw-r--r--src/ui/dialog/text-edit.cpp2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 629960613..084b2ebd8 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -1084,8 +1084,8 @@ void ClipboardManagerImpl::_onGet(Gtk::SelectionData &sel, guint /*info*/)
Geom::Point origin (_clipboardSPDoc->getRoot()->x.computed, _clipboardSPDoc->getRoot()->y.computed);
Geom::Rect area = Geom::Rect(origin, origin + _clipboardSPDoc->getDimensions());
- unsigned long int width = (unsigned long int) (area.width() * dpi / Inkscape::Util::Quantity::convert(1, "in", "px") + 0.5);
- unsigned long int height = (unsigned long int) (area.height() * dpi / Inkscape::Util::Quantity::convert(1, "in", "px") + 0.5);
+ unsigned long int width = (unsigned long int) (Inkscape::Util::Quantity::convert(area.width(), "px", "in") * dpi + 0.5);
+ unsigned long int height = (unsigned long int) (Inkscape::Util::Quantity::convert(area.height(), "in", "px") * dpi + 0.5);
// read from namedview
Inkscape::XML::Node *nv = sp_repr_lookup_name (_clipboardSPDoc->rroot, "sodipodi:namedview");
diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp
index 3ce75327f..e6dae278b 100644
--- a/src/ui/dialog/print.cpp
+++ b/src/ui/dialog/print.cpp
@@ -72,8 +72,8 @@ static void draw_page(
sp_export_png_file(junk->_doc, tmp_png.c_str(), 0.0, 0.0,
width, height,
- (unsigned long)(width * dpi / Inkscape::Util::Quantity::convert(1, "in", "px")),
- (unsigned long)(height * dpi / Inkscape::Util::Quantity::convert(1, "in", "px")),
+ (unsigned long)(Inkscape::Util::Quantity::convert(width, "px", "in") * dpi),
+ (unsigned long)(Inkscape::Util::Quantity::convert(height, "px", "in") * dpi),
dpi, dpi, bgcolor, NULL, NULL, true, NULL);
// This doesn't seem to work:
diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp
index 4a25f723b..9124681a0 100644
--- a/src/ui/dialog/text-edit.cpp
+++ b/src/ui/dialog/text-edit.cpp
@@ -401,7 +401,7 @@ void TextEdit::setPreviewText (Glib::ustring font_spec, Glib::ustring phrase)
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int unit = prefs->getInt("/options/font/unitType", SP_CSS_UNIT_PT);
- double pt_size = sp_style_css_size_units_to_px(sp_font_selector_get_size(fsel), unit) * Inkscape::Util::Quantity::convert(1, "px", "pt");
+ double pt_size = Inkscape::Util::Quantity::convert(sp_style_css_size_units_to_px(sp_font_selector_get_size(fsel), unit), "px", "pt");
// Pango font size is in 1024ths of a point
// C++11: Glib::ustring size = std::to_string( pt_size * PANGO_SCALE );