diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-09-24 22:17:24 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-09-24 22:17:24 +0000 |
| commit | bcca22a25ae98f70c36fff6292f0a8fe4e578d89 (patch) | |
| tree | a18d382d32f471b7119b9b7b2782cec04d6da43f /src/ui/widget/spinbutton.cpp | |
| parent | Refactored SPUse. (diff) | |
| parent | Fix my email address through codebase (diff) | |
| download | inkscape-bcca22a25ae98f70c36fff6292f0a8fe4e578d89.tar.gz inkscape-bcca22a25ae98f70c36fff6292f0a8fe4e578d89.zip | |
Merged from trunk (r12588).
(bzr r11608.1.129)
Diffstat (limited to 'src/ui/widget/spinbutton.cpp')
| -rw-r--r-- | src/ui/widget/spinbutton.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp index c107979a8..1114ff32b 100644 --- a/src/ui/widget/spinbutton.cpp +++ b/src/ui/widget/spinbutton.cpp @@ -14,6 +14,7 @@ #include "spinbutton.h" #include "unit-menu.h" +#include "unit-tracker.h" #include "util/expression-evaluator.h" #include "event-context.h" @@ -32,16 +33,23 @@ SpinButton::connect_signals() { int SpinButton::on_input(double* newvalue) { try { - Inkscape::Util::GimpEevlQuantity result; - if (_unit_menu) { - Unit unit = _unit_menu->getUnit(); - result = Inkscape::Util::gimp_eevl_evaluate (get_text().c_str(), &unit); + Inkscape::Util::EvaluatorQuantity result; + if (_unit_menu || _unit_tracker) { + Unit unit; + if (_unit_menu) { + unit = _unit_menu->getUnit(); + } else { + unit = _unit_tracker->getActiveUnit(); + } + Inkscape::Util::ExpressionEvaluator eval = Inkscape::Util::ExpressionEvaluator(get_text().c_str(), &unit); + result = eval.evaluate(); // check if output dimension corresponds to input unit if (result.dimension != (unit.isAbsolute() ? 1 : 0) ) { throw Inkscape::Util::EvaluatorException("Input dimensions do not match with parameter dimensions.",""); } } else { - result = Inkscape::Util::gimp_eevl_evaluate (get_text().c_str(), NULL); + Inkscape::Util::ExpressionEvaluator eval = Inkscape::Util::ExpressionEvaluator(get_text().c_str(), NULL); + result = eval.evaluate(); } *newvalue = result.value; @@ -57,7 +65,7 @@ int SpinButton::on_input(double* newvalue) bool SpinButton::on_my_focus_in_event(GdkEventFocus* /*event*/) { - on_focus_in_value = get_value(); + _on_focus_in_value = get_value(); return false; // do not consume the event } @@ -84,7 +92,7 @@ bool SpinButton::on_my_key_press_event(GdkEventKey* event) void SpinButton::undo() { - set_value(on_focus_in_value); + set_value(_on_focus_in_value); } |
