diff options
| author | Matthew Petroff <matthew@mpetroff.net> | 2013-07-02 03:40:52 +0000 |
|---|---|---|
| committer | Matthew Petroff <matthew@mpetroff.net> | 2013-07-02 03:40:52 +0000 |
| commit | bd77ef25e9161acb007323f851ba77e106036939 (patch) | |
| tree | 4c38776379d63e26de436a85476d73566205476d /src/sp-namedview.cpp | |
| parent | Renamed Length class to Quantity class, fixed bugs, and added functions. (diff) | |
| download | inkscape-bd77ef25e9161acb007323f851ba77e106036939.tar.gz inkscape-bd77ef25e9161acb007323f851ba77e106036939.zip | |
Ported "ui/widget/page-sizer.cpp" and "document.cpp" to "Util::Unit" class.
(bzr r12380.1.4)
Diffstat (limited to 'src/sp-namedview.cpp')
| -rw-r--r-- | src/sp-namedview.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 452f57425..5184d37a9 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -1101,20 +1101,23 @@ bool SPNamedView::getGuides() * \return the margin size in px, else 0.0 if anything is invalid. */ double SPNamedView::getMarginLength(gchar const * const key, - SPUnit const * const margin_units, - SPUnit const * const return_units, + Inkscape::Util::Unit const * const margin_units, + Inkscape::Util::Unit const * const return_units, double const width, double const height, bool const use_width) { double value; + static Inkscape::Util::UnitTable unit_table; + Inkscape::Util::Unit percent = unit_table.getUnit("%"); if(!this->storeAsDouble(key,&value)) { return 0.0; } - if (margin_units == &sp_unit_get_by_id (SP_UNIT_PERCENT)) { + if (*margin_units == percent) { return (use_width)? width * value : height * value; } - if (!sp_convert_distance (&value, margin_units, return_units)) { +// if (!sp_convert_distance (&value, margin_units, return_units)) { + if (!margin_units->compatibleWith(return_units)) { return 0.0; } return value; |
