diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-10-25 20:39:41 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-10-26 10:06:49 +0200 |
commit | 592235d64d6f9638a61865712ca385ec58d688c4 (patch) | |
tree | 0d2b74e88313161d82a112ef1505819bf37cc526 /svx/source | |
parent | 30f1617bd873d9ccf343a280ba27f476d4c7726e (diff) |
tdf#145296 use a 'clickable' widget for custom depth
Change-Id: Ifb64e1bef2a0b216f97fe112115a997973201268
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124164
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/tbxctrls/extrusioncontrols.cxx | 52 | ||||
-rw-r--r-- | svx/source/tbxctrls/extrusioncontrols.hxx | 17 |
2 files changed, 36 insertions, 33 deletions
diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index bed16752433f..5f6544404a67 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -331,24 +331,23 @@ constexpr OUStringLiteral gsMetricUnit( u".uno:MetricUnit" ); ExtrusionDepthWindow::ExtrusionDepthWindow(svt::PopupWindowController* pControl, weld::Widget* pParent) : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "svx/ui/depthwindow.ui", "DepthWindow") , mxControl(pControl) - , mxDepth0(m_xBuilder->weld_radio_button("depth0")) - , mxDepth1(m_xBuilder->weld_radio_button("depth1")) - , mxDepth2(m_xBuilder->weld_radio_button("depth2")) - , mxDepth3(m_xBuilder->weld_radio_button("depth3")) - , mxDepth4(m_xBuilder->weld_radio_button("depth4")) - , mxInfinity(m_xBuilder->weld_radio_button("infinity")) - , mxCustom(m_xBuilder->weld_radio_button("custom")) + , mxDepth0(m_xBuilder->weld_toggle_button("depth0")) + , mxDepth1(m_xBuilder->weld_toggle_button("depth1")) + , mxDepth2(m_xBuilder->weld_toggle_button("depth2")) + , mxDepth3(m_xBuilder->weld_toggle_button("depth3")) + , mxDepth4(m_xBuilder->weld_toggle_button("depth4")) + , mxInfinity(m_xBuilder->weld_toggle_button("infinity")) + , mxCustom(m_xBuilder->weld_toggle_button("custom")) , meUnit(FieldUnit::NONE) , mfDepth( -1.0 ) - , mbSettingValue(false) { - mxDepth0->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); - mxDepth1->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); - mxDepth2->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); - mxDepth3->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); - mxDepth4->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); - mxInfinity->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); - mxCustom->connect_toggled(LINK(this, ExtrusionDepthWindow, SelectHdl)); + mxDepth0->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl)); + mxDepth1->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl)); + mxDepth2->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl)); + mxDepth3->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl)); + mxDepth4->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl)); + mxInfinity->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl)); + mxCustom->connect_clicked(LINK(this, ExtrusionDepthWindow, SelectHdl)); AddStatusListener( gsExtrusionDepth ); AddStatusListener( gsMetricUnit ); @@ -363,10 +362,6 @@ void ExtrusionDepthWindow::implSetDepth( double fDepth ) { mfDepth = fDepth; - bool bSettingValue = mbSettingValue; - mbSettingValue = true; - - mxCustom->set_active(true); bool bIsMetric = IsMetric(meUnit); mxDepth0->set_active(fDepth == (bIsMetric ? aDepthListMM[0] : aDepthListInch[0])); mxDepth1->set_active(fDepth == (bIsMetric ? aDepthListMM[1] : aDepthListInch[1])); @@ -374,8 +369,12 @@ void ExtrusionDepthWindow::implSetDepth( double fDepth ) mxDepth3->set_active(fDepth == (bIsMetric ? aDepthListMM[3] : aDepthListInch[3])); mxDepth4->set_active(fDepth == (bIsMetric ? aDepthListMM[4] : aDepthListInch[4])); mxInfinity->set_active(fDepth >= 338666); - - mbSettingValue = bSettingValue; + mxCustom->set_active(!mxDepth0->get_active() && + !mxDepth1->get_active() && + !mxDepth2->get_active() && + !mxDepth3->get_active() && + !mxDepth4->get_active() && + !mxInfinity->get_active()); } void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) @@ -443,10 +442,15 @@ void ExtrusionDepthWindow::statusChanged( } } -IMPL_LINK(ExtrusionDepthWindow, SelectHdl, weld::Toggleable&, rButton, void) +IMPL_LINK(ExtrusionDepthWindow, SelectHdl, weld::Button&, rButton, void) { - if (mbSettingValue || !rButton.get_active()) - return; + mxDepth0->set_active(&rButton == mxDepth0.get()); + mxDepth1->set_active(&rButton == mxDepth1.get()); + mxDepth2->set_active(&rButton == mxDepth2.get()); + mxDepth3->set_active(&rButton == mxDepth3.get()); + mxDepth4->set_active(&rButton == mxDepth4.get()); + mxInfinity->set_active(&rButton == mxInfinity.get()); + mxCustom->set_active(&rButton == mxCustom.get()); if (mxCustom->get_active()) { diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx index 0f0f54dbf457..531ae48bbfb7 100644 --- a/svx/source/tbxctrls/extrusioncontrols.hxx +++ b/svx/source/tbxctrls/extrusioncontrols.hxx @@ -93,19 +93,18 @@ class ExtrusionDepthWindow final : public WeldToolbarPopup { private: rtl::Reference<svt::PopupWindowController> mxControl; - std::unique_ptr<weld::RadioButton> mxDepth0; - std::unique_ptr<weld::RadioButton> mxDepth1; - std::unique_ptr<weld::RadioButton> mxDepth2; - std::unique_ptr<weld::RadioButton> mxDepth3; - std::unique_ptr<weld::RadioButton> mxDepth4; - std::unique_ptr<weld::RadioButton> mxInfinity; - std::unique_ptr<weld::RadioButton> mxCustom; + std::unique_ptr<weld::ToggleButton> mxDepth0; + std::unique_ptr<weld::ToggleButton> mxDepth1; + std::unique_ptr<weld::ToggleButton> mxDepth2; + std::unique_ptr<weld::ToggleButton> mxDepth3; + std::unique_ptr<weld::ToggleButton> mxDepth4; + std::unique_ptr<weld::ToggleButton> mxInfinity; + std::unique_ptr<weld::ToggleButton> mxCustom; FieldUnit meUnit; double mfDepth; - bool mbSettingValue; - DECL_LINK( SelectHdl, weld::Toggleable&, void ); + DECL_LINK( SelectHdl, weld::Button&, void ); void implFillStrings( FieldUnit eUnit ); void implSetDepth( double fDepth ); |