summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorMatthew Petroff <matthew@mpetroff.net>2013-07-09 20:42:04 +0000
committerMatthew Petroff <matthew@mpetroff.net>2013-07-09 20:42:04 +0000
commit9dc7b786c9ef31060012ea4ae13a8188548b4f62 (patch)
treef8b063fe5b6da450ba252f2275aa342e2627b420 /src/util
parentSwitch setWidth and setHeight to use Quantity and switch to forward declarati... (diff)
downloadinkscape-9dc7b786c9ef31060012ea4ae13a8188548b4f62.tar.gz
inkscape-9dc7b786c9ef31060012ea4ae13a8188548b4f62.zip
Ported sp-namedview.cpp (todo: fix a bunch of things).
(bzr r12380.1.8)
Diffstat (limited to 'src/util')
-rw-r--r--src/util/units.cpp21
-rw-r--r--src/util/units.h1
2 files changed, 22 insertions, 0 deletions
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.
*
diff --git a/src/util/units.h b/src/util/units.h
index 0ea84bfbb..64eb4a665 100644
--- a/src/util/units.h
+++ b/src/util/units.h
@@ -54,6 +54,7 @@ class Unit {
// temporary
int svgUnit() const;
+ int metric() const;
};
class UnitTable {