From fe875852760883dd20b6a57b57be50de83e37fc2 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 14 Apr 2011 00:04:49 +0200 Subject: add expression evaluator for spinbox input boxes. also knows a little about units. needs more work to fully integrate it in all of inkscape spinboxes also needs documentation rework (bzr r10162) --- src/ui/widget/preferences-widget.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index afcaa338e..f92e2518d 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -227,7 +227,6 @@ void PrefSpinButton::init(Glib::ustring const &prefs_path, this->set_range (lower, upper); this->set_increments (step_increment, 0); - this->set_numeric(); this->set_value (value); this->set_width_chars(6); if (is_int) -- cgit v1.2.3 From 70829da1b189d6d8f07f12d97b9273d56dbd789e Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 17 Apr 2011 14:51:06 +0200 Subject: add new preference widget for a number with a unit. change Preferences > Steps to this new widget (bzr r10177) --- src/ui/widget/preferences-widget.cpp | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index f92e2518d..9cf80153a 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -255,6 +255,45 @@ void PrefSpinButton::on_value_changed() } } +void PrefSpinUnit::init(Glib::ustring const &prefs_path, + double lower, double upper, double step_increment, + double default_value, UnitType unit_type, Glib::ustring const &default_unit) +{ + _prefs_path = prefs_path; + _is_percent = (unit_type == UNIT_TYPE_DIMENSIONLESS); + + setUnitType(unit_type); + setUnit(default_unit); + setRange (lower, upper); /// @fixme this disregards changes of units + setIncrements (step_increment, 0); + if (step_increment < 0.1) { + setDigits(4); + } else { + setDigits(2); + } + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + double value = prefs->getDoubleLimited(prefs_path, default_value, lower, upper); + Glib::ustring unitstr = prefs->getUnit(prefs_path); + if (unitstr.length() == 0) { + unitstr = default_unit; + // write the assumed unit to preferences: + prefs->setDoubleUnit(_prefs_path, value, unitstr); + } + setValue(value, unitstr); + + signal_value_changed().connect_notify(sigc::mem_fun(*this, &PrefSpinUnit::on_my_value_changed)); +} + +void PrefSpinUnit::on_my_value_changed() +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (getWidget()->is_visible()) //only take action if user changed value + { + prefs->setDoubleUnit(_prefs_path, getValue(getUnit().abbr), getUnit().abbr); + } +} + const double ZoomCorrRuler::textsize = 7; const double ZoomCorrRuler::textpadding = 5; -- cgit v1.2.3 From 6d0280ef0e02c447a9dfb5c91a1a506cee2333b6 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 17 Apr 2011 15:31:32 +0200 Subject: fix duplicate units in Preferences > Steps (bzr r10178) --- src/ui/widget/preferences-widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 9cf80153a..68faa3c66 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -262,7 +262,7 @@ void PrefSpinUnit::init(Glib::ustring const &prefs_path, _prefs_path = prefs_path; _is_percent = (unit_type == UNIT_TYPE_DIMENSIONLESS); - setUnitType(unit_type); + resetUnitType(unit_type); setUnit(default_unit); setRange (lower, upper); /// @fixme this disregards changes of units setIncrements (step_increment, 0); -- cgit v1.2.3 From 6343a24c5cd0a998e00ae05fc6abe2081be21c71 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Mon, 3 Oct 2011 00:24:15 -0700 Subject: Doxygen cleanup. (bzr r10660) --- src/ui/widget/preferences-widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 68faa3c66..b88123ab1 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -1,5 +1,5 @@ /** - * \brief Inkscape Preferences dialog + * Inkscape Preferences dialog. * * Authors: * Marco Scholten -- cgit v1.2.3 From 2633767789e4264b13ef91a684accf734fb4e94f Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 26 Oct 2011 21:55:51 -0700 Subject: Fixing more broken and split doc comments. (bzr r10697) --- src/ui/widget/preferences-widget.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/ui/widget/preferences-widget.cpp') diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index b88123ab1..001d2277d 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -1,4 +1,4 @@ -/** +/* * Inkscape Preferences dialog. * * Authors: @@ -583,10 +583,6 @@ void PrefCombo::init(Glib::ustring const &prefs_path, this->set_active(row); } -/** - initialize a combo box - second form uses strings as key values -*/ void PrefCombo::init(Glib::ustring const &prefs_path, Glib::ustring labels[], Glib::ustring values[], int num_items, Glib::ustring default_value) { -- cgit v1.2.3