diff options
| author | Jabiertxo Arraiza Cenoz <jtx@jtx-desktop.markerlab.es> | 2017-11-15 18:36:31 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Cenoz <jtx@jtx-desktop.markerlab.es> | 2017-11-15 18:36:31 +0000 |
| commit | 1dfb2e9909f35cb96e4b697b62fe9e613ee50d61 (patch) | |
| tree | 0a6d462d4bb568f1584e01f456bd3e779ac977a4 /src/ui | |
| parent | Move icons into hicolor subdirectory. Theming should work if other directorie... (diff) | |
| download | inkscape-1dfb2e9909f35cb96e4b697b62fe9e613ee50d61.tar.gz inkscape-1dfb2e9909f35cb96e4b697b62fe9e613ee50d61.zip | |
Add auto update margins on checkbutton
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/widget/page-sizer.cpp | 28 | ||||
| -rw-r--r-- | src/ui/widget/page-sizer.h | 4 |
2 files changed, 29 insertions, 3 deletions
diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 06d54b682..521a67604 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -481,6 +481,7 @@ PageSizer::init () _changedvy_connection = _viewboxY.signal_value_changed().connect (sigc::mem_fun (*this, &PageSizer::on_viewbox_changed)); _changedvw_connection = _viewboxW.signal_value_changed().connect (sigc::mem_fun (*this, &PageSizer::on_viewbox_changed)); _changedvh_connection = _viewboxH.signal_value_changed().connect (sigc::mem_fun (*this, &PageSizer::on_viewbox_changed)); + _changedlk_connection = _marginLock.signal_clicked().connect (sigc::mem_fun (*this, &PageSizer::on_margin_lock_changed)); _changedmt_connection = _marginTop.signal_value_changed().connect (sigc::bind<RegisteredScalar*>(sigc::mem_fun (*this, &PageSizer::on_margin_changed), &_marginTop)); _changedmb_connection = _marginBottom.signal_value_changed().connect (sigc::bind<RegisteredScalar*>(sigc::mem_fun (*this, &PageSizer::on_margin_changed), &_marginBottom)); _changedml_connection = _marginLeft.signal_value_changed().connect (sigc::bind<RegisteredScalar*>(sigc::mem_fun (*this, &PageSizer::on_margin_changed), &_marginLeft)); @@ -903,9 +904,30 @@ PageSizer::on_viewbox_changed() } } -/** - * Callback for viewbox widgets - */ +void +PageSizer::on_margin_lock_changed() +{ + if (_marginLock.get_active()) { + double left = _marginLeft.getValue(); + double right = _marginRight.getValue(); + double top = _marginTop.getValue(); + double bottom = _marginBottom.getValue(); + if (Geom::are_near(left,right)) { + if (Geom::are_near(left, top)) { + on_margin_changed(&_marginBottom); + } else { + on_margin_changed(&_marginTop); + } + } else { + if (Geom::are_near(left, top)) { + on_margin_changed(&_marginRight); + } else { + on_margin_changed(&_marginLeft); + } + } + } +} + void PageSizer::on_margin_changed(RegisteredScalar* widg) { diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h index 7cf8bacfd..6a8403627 100644 --- a/src/ui/widget/page-sizer.h +++ b/src/ui/widget/page-sizer.h @@ -166,6 +166,9 @@ public: * Updates the margin widgets. If lock widget is active */ void on_margin_changed(RegisteredScalar* widg); + + void on_margin_lock_changed(); + /** * Updates the scale widgets. (Just changes the values of the ui widgets.) */ @@ -271,6 +274,7 @@ protected: sigc::connection _changedvy_connection; sigc::connection _changedvw_connection; sigc::connection _changedvh_connection; + sigc::connection _changedlk_connection; sigc::connection _changedmt_connection; sigc::connection _changedmb_connection; sigc::connection _changedml_connection; |
