summaryrefslogtreecommitdiffstats
path: root/src/util/units.cpp
diff options
context:
space:
mode:
authorMatthew Petroff <matthew@mpetroff.net>2013-08-25 23:42:22 +0000
committerMatthew Petroff <matthew@mpetroff.net>2013-08-25 23:42:22 +0000
commit77f61343ff18f29f05331131c2fe2bd810a64498 (patch)
tree9fe41722d2228560f34db2119ca4f6bed26c9704 /src/util/units.cpp
parentMerge bool fix and clean up the warning (diff)
downloadinkscape-77f61343ff18f29f05331131c2fe2bd810a64498.tar.gz
inkscape-77f61343ff18f29f05331131c2fe2bd810a64498.zip
Use real world units for page sizes.
(bzr r12475.1.1)
Diffstat (limited to 'src/util/units.cpp')
-rw-r--r--src/util/units.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/util/units.cpp b/src/util/units.cpp
index 7bc910fcc..e7be3f5e6 100644
--- a/src/util/units.cpp
+++ b/src/util/units.cpp
@@ -220,6 +220,36 @@ Unit UnitTable::getUnit(Glib::ustring const &unit_abbr) const
return Unit();
}
}
+Unit UnitTable::getUnit(SVGLength::Unit const u) const
+{
+ Glib::ustring u_str;
+ switch(u) {
+ case 1:
+ u_str = "px"; break;
+ case 2:
+ u_str = "pt"; break;
+ case 3:
+ u_str = "pc"; break;
+ case 4:
+ u_str = "mm"; break;
+ case 5:
+ u_str = "cm"; break;
+ case 6:
+ u_str = "in"; break;
+ case 7:
+ u_str = "ft"; break;
+ case 8:
+ u_str = "em"; break;
+ case 9:
+ u_str = "ex"; break;
+ case 10:
+ u_str = "%"; break;
+ default:
+ u_str = "";
+ }
+
+ return getUnit(u_str);
+}
Quantity UnitTable::getQuantity(Glib::ustring const& q) const
{