diff options
| author | Matthew Petroff <matthew@mpetroff.net> | 2013-07-19 20:31:57 +0000 |
|---|---|---|
| committer | Matthew Petroff <matthew@mpetroff.net> | 2013-07-19 20:31:57 +0000 |
| commit | 5b8a6e510cb69d33bc8834a7586142be800471b5 (patch) | |
| tree | 80b05fee53e72d25f56def6dfd14e104c18f8d45 /src/live_effects/parameter/unit.cpp | |
| parent | Ported "ui/widget/style-swatch.*". (diff) | |
| download | inkscape-5b8a6e510cb69d33bc8834a7586142be800471b5.tar.gz inkscape-5b8a6e510cb69d33bc8834a7586142be800471b5.zip | |
Ported "live_effects/parameter/unit.*".
(bzr r12380.1.41)
Diffstat (limited to 'src/live_effects/parameter/unit.cpp')
| -rw-r--r-- | src/live_effects/parameter/unit.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/live_effects/parameter/unit.cpp b/src/live_effects/parameter/unit.cpp index fffbabb1d..264b4b9ee 100644 --- a/src/live_effects/parameter/unit.cpp +++ b/src/live_effects/parameter/unit.cpp @@ -10,6 +10,7 @@ #include "live_effects/parameter/unit.h" #include "live_effects/effect.h" #include "verbs.h" +#include "util/units.h" namespace Inkscape { @@ -18,10 +19,11 @@ namespace LivePathEffect { UnitParam::UnitParam( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, - Effect* effect, SPUnitId default_value) + Effect* effect, Glib::ustring default_unit) : Parameter(label, tip, key, wr, effect) { - defunit = &sp_unit_get_by_id(default_value);; + Inkscape::Util::UnitTable unit_table; + defunit = new Inkscape::Util::Unit(unit_table.getUnit(default_unit)); unit = defunit; } @@ -32,9 +34,9 @@ UnitParam::~UnitParam() bool UnitParam::param_readSVGValue(const gchar * strvalue) { - SPUnit const *newval = sp_unit_get_by_abbreviation(strvalue); - if (newval) { - param_set_value(newval); + Inkscape::Util::UnitTable unit_table; + if (strvalue) { + param_set_value(unit_table.getUnit(strvalue)); return true; } return false; @@ -43,25 +45,25 @@ UnitParam::param_readSVGValue(const gchar * strvalue) gchar * UnitParam::param_getSVGValue() const { - return g_strdup(sp_unit_get_abbreviation(unit)); + return g_strdup(unit->abbr.c_str()); } void UnitParam::param_set_default() { - param_set_value(defunit); + param_set_value(*defunit); } void -UnitParam::param_set_value(SPUnit const *val) +UnitParam::param_set_value(Inkscape::Util::Unit const &val) { - unit = val; + unit = new Inkscape::Util::Unit(val); } const gchar * UnitParam::get_abbreviation() const { - return sp_unit_get_abbreviation(unit); + return unit->abbr.c_str(); } Gtk::Widget * |
