diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2011-04-16 21:09:31 +0000 |
|---|---|---|
| committer | Johan Engelen <goejendaagh@zonnet.nl> | 2011-04-16 21:09:31 +0000 |
| commit | a0d74348937bf217b073311936e5aefc6105a1b9 (patch) | |
| tree | ec76d62b9b49545ed55fb9f1df06230b6d5b99d2 /src/ui/widget/scalar-unit.cpp | |
| parent | * [INTL:sk] Slovak translation update (diff) | |
| download | inkscape-a0d74348937bf217b073311936e5aefc6105a1b9.tar.gz inkscape-a0d74348937bf217b073311936e5aefc6105a1b9.zip | |
ScalarUnit widget: fix initialization bug. add constructor which takes another scalarunit's unitmenu.
(bzr r10171)
Diffstat (limited to 'src/ui/widget/scalar-unit.cpp')
| -rw-r--r-- | src/ui/widget/scalar-unit.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/ui/widget/scalar-unit.cpp b/src/ui/widget/scalar-unit.cpp index 533f0a200..e713f3e06 100644 --- a/src/ui/widget/scalar-unit.cpp +++ b/src/ui/widget/scalar-unit.cpp @@ -68,8 +68,42 @@ ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, .connect_notify(sigc::mem_fun(*this, &ScalarUnit::on_unit_changed)); static_cast<SpinButton*>(_widget)->setUnitMenu(_unit_menu); + + lastUnits = _unit_menu->getUnitAbbr(); +} + +/** + * Construct a ScalarUnit + * + * \param label Label. + * \param tooltip Tooltip text. + * \param take_unitmenu Use the unitmenu from this parameter. + * \param suffix Suffix, placed after the widget (defaults to ""). + * \param icon Icon filename, placed before the label (defaults to ""). + * \param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to true). + */ +ScalarUnit::ScalarUnit(Glib::ustring const &label, Glib::ustring const &tooltip, + ScalarUnit &take_unitmenu, + Glib::ustring const &suffix, + Glib::ustring const &icon, + bool mnemonic) + : Scalar(label, tooltip, suffix, icon, mnemonic), + _unit_menu(take_unitmenu._unit_menu), + _hundred_percent(0), + _absolute_is_increment(false), + _percentage_is_increment(false) +{ + _unit_menu->signal_changed() + .connect_notify(sigc::mem_fun(*this, &ScalarUnit::on_unit_changed)); + + static_cast<SpinButton*>(_widget)->setUnitMenu(_unit_menu); + + lastUnits = _unit_menu->getUnitAbbr(); } + /** * Initializes the scalar based on the settings in _unit_menu. * Requires that _unit_menu has already been initialized. |
