summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/spinbutton.cpp
diff options
context:
space:
mode:
authorMatthew Petroff <matthew@mpetroff.net>2013-09-20 17:09:19 +0000
committerMatthew Petroff <matthew@mpetroff.net>2013-09-20 17:09:19 +0000
commitcf74f053a081f6f4b460da9cd72afaab23d54d13 (patch)
tree427aa22ba3dcad9b55edb90522b5ab0208074e06 /src/ui/widget/spinbutton.cpp
parentUsing inkscape compact settings to save the icons.svg file (diff)
parentMerge from trunk. (diff)
downloadinkscape-cf74f053a081f6f4b460da9cd72afaab23d54d13.tar.gz
inkscape-cf74f053a081f6f4b460da9cd72afaab23d54d13.zip
Merge Google Summer of Code unit improvement.
(bzr r12554)
Diffstat (limited to 'src/ui/widget/spinbutton.cpp')
-rw-r--r--src/ui/widget/spinbutton.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp
index c107979a8..62c17f821 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;