diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2014-02-24 19:32:07 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2014-02-24 19:32:07 +0000 |
| commit | f6060c9447e6f2e5a70e957c19bd4eb1ae4babef (patch) | |
| tree | 9e3b09e1b7e94229eafefadf5c96cc2fa8869518 /src/util/units.cpp | |
| parent | fix typos in page-sizer (Bug 1240308) (diff) | |
| download | inkscape-f6060c9447e6f2e5a70e957c19bd4eb1ae4babef.tar.gz inkscape-f6060c9447e6f2e5a70e957c19bd4eb1ae4babef.zip | |
inspired by r13052, fix up the code to hopefully work when someone has different units for height and width of the page.
Fixed bugs:
- https://launchpad.net/bugs/1240308
(bzr r13053)
Diffstat (limited to 'src/util/units.cpp')
| -rw-r--r-- | src/util/units.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/util/units.cpp b/src/util/units.cpp index 40cce028d..d2053f60b 100644 --- a/src/util/units.cpp +++ b/src/util/units.cpp @@ -505,16 +505,23 @@ double Quantity::convert(double from_dist, char const *from, char const *to) return convert(from_dist, unit_table.getUnit(from), unit_table.getUnit(to)); } -bool Quantity::operator<(Quantity const &other) const +bool Quantity::operator<(Quantity const &rhs) const { - if (unit->type != other.unit->type) { + if (unit->type != rhs.unit->type) { g_warning("Incompatible units"); return false; } - return quantity < other.value(unit); + return quantity < rhs.value(unit); } bool Quantity::operator==(Quantity const &other) const { + /** \fixme This is overly strict. I think we should change this to: + if (unit->type != other.unit->type) { + g_warning("Incompatible units"); + return false; + } + return are_near(quantity, other.value(unit)); + */ return (*unit == *other.unit) && (quantity == other.quantity); } |
