diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-10-25 21:07:06 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-10-26 10:07:02 +0200 |
commit | 312a32f6b6c83c5747b617249d794fc87ffd8b9b (patch) | |
tree | c9ddb3b771bbfc9165fc9e713584b72bb2f1c6a7 /svx/source | |
parent | 592235d64d6f9638a61865712ca385ec58d688c4 (diff) |
tdf#145296 use a 'clickable' widget for custom spacing
Change-Id: I7c0b609a074a68dcc7ca4f6a775743e836a6caa7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124165
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/tbxctrls/fontworkgallery.cxx | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index a5c812c03b63..a0071644d09f 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -470,17 +470,17 @@ public: virtual void statusChanged( const css::frame::FeatureStateEvent& Event ) override; private: rtl::Reference<svt::PopupWindowController> mxControl; - std::unique_ptr<weld::RadioButton> mxVeryTight; - std::unique_ptr<weld::RadioButton> mxTight; - std::unique_ptr<weld::RadioButton> mxNormal; - std::unique_ptr<weld::RadioButton> mxLoose; - std::unique_ptr<weld::RadioButton> mxVeryLoose; - std::unique_ptr<weld::RadioButton> mxCustom; + std::unique_ptr<weld::ToggleButton> mxVeryTight; + std::unique_ptr<weld::ToggleButton> mxTight; + std::unique_ptr<weld::ToggleButton> mxNormal; + std::unique_ptr<weld::ToggleButton> mxLoose; + std::unique_ptr<weld::ToggleButton> mxVeryLoose; + std::unique_ptr<weld::ToggleButton> mxCustom; std::unique_ptr<weld::CheckButton> mxKernPairs; bool mbSettingValue; DECL_LINK( KernSelectHdl, weld::Toggleable&, void ); - DECL_LINK( SelectHdl, weld::Toggleable&, void ); + DECL_LINK( SelectHdl, weld::Button&, void ); void implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled ); void implSetKernCharacterPairs(bool bKernOnOff, bool bEnabled); @@ -494,21 +494,21 @@ constexpr OUStringLiteral gsFontworkKernCharacterPairs(u".uno:FontworkKernCharac FontworkCharacterSpacingWindow::FontworkCharacterSpacingWindow(svt::PopupWindowController* pControl, weld::Widget* pParent) : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "svx/ui/fontworkcharacterspacingcontrol.ui", "FontworkCharacterSpacingControl") , mxControl(pControl) - , mxVeryTight(m_xBuilder->weld_radio_button("verytight")) - , mxTight(m_xBuilder->weld_radio_button("tight")) - , mxNormal(m_xBuilder->weld_radio_button("normal")) - , mxLoose(m_xBuilder->weld_radio_button("loose")) - , mxVeryLoose(m_xBuilder->weld_radio_button("veryloose")) - , mxCustom(m_xBuilder->weld_radio_button("custom")) + , mxVeryTight(m_xBuilder->weld_toggle_button("verytight")) + , mxTight(m_xBuilder->weld_toggle_button("tight")) + , mxNormal(m_xBuilder->weld_toggle_button("normal")) + , mxLoose(m_xBuilder->weld_toggle_button("loose")) + , mxVeryLoose(m_xBuilder->weld_toggle_button("veryloose")) + , mxCustom(m_xBuilder->weld_toggle_button("custom")) , mxKernPairs(m_xBuilder->weld_check_button("kernpairs")) , mbSettingValue(false) { - mxVeryTight->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, SelectHdl)); - mxTight->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, SelectHdl)); - mxNormal->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, SelectHdl)); - mxLoose->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, SelectHdl)); - mxVeryLoose->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, SelectHdl)); - mxCustom->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, SelectHdl)); + mxVeryTight->connect_clicked(LINK(this, FontworkCharacterSpacingWindow, SelectHdl)); + mxTight->connect_clicked(LINK(this, FontworkCharacterSpacingWindow, SelectHdl)); + mxNormal->connect_clicked(LINK(this, FontworkCharacterSpacingWindow, SelectHdl)); + mxLoose->connect_clicked(LINK(this, FontworkCharacterSpacingWindow, SelectHdl)); + mxVeryLoose->connect_clicked(LINK(this, FontworkCharacterSpacingWindow, SelectHdl)); + mxCustom->connect_clicked(LINK(this, FontworkCharacterSpacingWindow, SelectHdl)); mxKernPairs->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, KernSelectHdl)); @@ -542,7 +542,6 @@ void FontworkCharacterSpacingWindow::implSetCharacterSpacing( sal_Int32 nCharact mxNormal->set_active(false); mxLoose->set_active(false); mxVeryLoose->set_active(false); - mxCustom->set_active(true); switch(nCharacterSpacing) { @@ -563,6 +562,12 @@ void FontworkCharacterSpacingWindow::implSetCharacterSpacing( sal_Int32 nCharact break; } + mxCustom->set_active(!mxVeryTight->get_active() && + !mxTight->get_active() && + !mxNormal->get_active() && + !mxLoose->get_active() && + !mxVeryLoose->get_active()); + mbSettingValue = bSettingValue; } @@ -619,10 +624,14 @@ IMPL_LINK_NOARG(FontworkCharacterSpacingWindow, KernSelectHdl, weld::Toggleable& mxControl->EndPopupMode(); } -IMPL_LINK(FontworkCharacterSpacingWindow, SelectHdl, weld::Toggleable&, rButton, void) +IMPL_LINK(FontworkCharacterSpacingWindow, SelectHdl, weld::Button&, rButton, void) { - if (!rButton.get_active()) - return; + mxVeryTight->set_active(&rButton == mxVeryTight.get()); + mxTight->set_active(&rButton == mxTight.get()); + mxNormal->set_active(&rButton == mxNormal.get()); + mxLoose->set_active(&rButton == mxLoose.get()); + mxVeryLoose->set_active(&rButton == mxVeryLoose.get()); + mxCustom->set_active(&rButton == mxCustom.get()); if (mbSettingValue) return; |