From 9dc7b786c9ef31060012ea4ae13a8188548b4f62 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Tue, 9 Jul 2013 16:42:04 -0400 Subject: Ported sp-namedview.cpp (todo: fix a bunch of things). (bzr r12380.1.8) --- src/util/units.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/util/units.cpp') diff --git a/src/util/units.cpp b/src/util/units.cpp index a51eb2570..6c225f717 100644 --- a/src/util/units.cpp +++ b/src/util/units.cpp @@ -106,6 +106,27 @@ int Unit::svgUnit() const { return 0; } +/** Temporary - get metric. */ +int Unit::metric() const { + if (!abbr.compare("mm")) + return 1; + if (!abbr.compare("cm")) + return 2; + if (!abbr.compare("in")) + return 3; + if (!abbr.compare("ft")) + return 4; + if (!abbr.compare("pt")) + return 5; + if (!abbr.compare("pc")) + return 6; + if (!abbr.compare("px")) + return 7; + if (!abbr.compare("m")) + return 8; + return 0; +} + /** * Initializes the unit tables and identifies the primary unit types. * -- cgit v1.2.3