[Libreoffice-commits] core.git: sc/source sc/uiconfig

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 9 12:33:07 UTC 2021


 sc/source/ui/sidebar/AlignmentPropertyPanel.cxx |   49 +++++++++---------------
 sc/source/ui/sidebar/AlignmentPropertyPanel.hxx |    9 +---
 sc/uiconfig/scalc/ui/sidebaralignment.ui        |   12 +----
 3 files changed, 26 insertions(+), 44 deletions(-)

New commits:
commit 9834978391309818ffe28eb6efa3f7de04f426c9
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Aug 9 11:55:26 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Aug 9 14:32:33 2021 +0200

    change image-using RadioButtons to ToggleButtons instead
    
    Change-Id: I893ccdacfc76ecd9a3d83101f3b6f2e5f97fdb70
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120202
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index eb4dfd98ebd4..51beb4201402 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -47,9 +47,9 @@ AlignmentPropertyPanel::AlignmentPropertyPanel(
     , mxCBXMergeCell(m_xBuilder->weld_check_button("mergecells"))
     , mxFtRotate(m_xBuilder->weld_label("orientationlabel"))
     , mxMtrAngle(m_xBuilder->weld_metric_spin_button("orientationdegrees", FieldUnit::DEGREE))
-    , mxRefEdgeBottom(m_xBuilder->weld_radio_button("bottom"))
-    , mxRefEdgeTop(m_xBuilder->weld_radio_button("top"))
-    , mxRefEdgeStd(m_xBuilder->weld_radio_button("standard"))
+    , mxRefEdgeBottom(m_xBuilder->weld_toggle_button("bottom"))
+    , mxRefEdgeTop(m_xBuilder->weld_toggle_button("top"))
+    , mxRefEdgeStd(m_xBuilder->weld_toggle_button("standard"))
     , mxCBStacked(m_xBuilder->weld_check_button("stacked"))
     , mxTextOrientBox(m_xBuilder->weld_widget("textorientbox"))
     , mxHorizontalAlign(m_xBuilder->weld_toolbar("horizontalalignment"))
@@ -68,7 +68,6 @@ AlignmentPropertyPanel::AlignmentPropertyPanel(
     , maVrtStackControl(SID_ATTR_ALIGN_STACKED, *pBindings, *this)
     , maRefEdgeControl(SID_ATTR_ALIGN_LOCKPOS, *pBindings, *this)
     , mbMultiDisable(false)
-    , mbSettingToggles(false)
     , maContext()
     , mpBindings(pBindings)
 {
@@ -122,25 +121,26 @@ void AlignmentPropertyPanel::Initialize()
     mxMtrAngle->connect_value_changed(LINK( this, AlignmentPropertyPanel, AngleModifiedHdl));
     mxCBStacked->connect_toggled(LINK(this, AlignmentPropertyPanel, ClickStackHdl));
 
-    Link<weld::Toggleable&,void> aLink2 = LINK(this, AlignmentPropertyPanel, ReferenceEdgeHdl);
-    mxRefEdgeBottom->connect_toggled(aLink2);
-    mxRefEdgeTop->connect_toggled(aLink2);
-    mxRefEdgeStd->connect_toggled(aLink2);
+    Link<weld::Button&,void> aLink2 = LINK(this, AlignmentPropertyPanel, ReferenceEdgeHdl);
+    mxRefEdgeBottom->connect_clicked(aLink2);
+    mxRefEdgeTop->connect_clicked(aLink2);
+    mxRefEdgeStd->connect_clicked(aLink2);
 }
 
-IMPL_LINK(AlignmentPropertyPanel, ReferenceEdgeHdl, weld::Toggleable&, rToggle, void)
+IMPL_LINK(AlignmentPropertyPanel, ReferenceEdgeHdl, weld::Button&, rToggle, void)
 {
-    if (mbSettingToggles)
-        return;
     SvxRotateMode eMode;
-    if (&rToggle == mxRefEdgeBottom.get() && mxRefEdgeBottom->get_active())
+    if (&rToggle == mxRefEdgeBottom.get())
         eMode = SVX_ROTATE_MODE_BOTTOM;
-    else if (&rToggle == mxRefEdgeTop.get() && mxRefEdgeTop->get_active())
+    else if (&rToggle == mxRefEdgeTop.get())
         eMode = SVX_ROTATE_MODE_TOP;
-    else if (&rToggle == mxRefEdgeStd.get() && mxRefEdgeStd->get_active())
+    else /*if (&rToggle == mxRefEdgeStd.get())*/
         eMode = SVX_ROTATE_MODE_STANDARD;
-    else
-        return;
+
+    mxRefEdgeBottom->set_active(eMode == SVX_ROTATE_MODE_BOTTOM);
+    mxRefEdgeTop->set_active(eMode == SVX_ROTATE_MODE_TOP);
+    mxRefEdgeStd->set_active(eMode == SVX_ROTATE_MODE_STANDARD);
+
     SvxRotateModeItem aItem(eMode, ATTR_ROTATE_MODE);
     GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_ALIGN_LOCKPOS,
             SfxCallMode::RECORD, { &aItem });
@@ -312,22 +312,11 @@ void AlignmentPropertyPanel::NotifyItemUpdate(
     case SID_ATTR_ALIGN_LOCKPOS:
         if( eState >= SfxItemState::DEFAULT)
         {
-            mbSettingToggles = true;
             const SvxRotateModeItem* pItem = static_cast<const SvxRotateModeItem*>(pState);
             SvxRotateMode eMode = pItem->GetValue();
-            if(eMode == SVX_ROTATE_MODE_BOTTOM)
-            {
-                mxRefEdgeBottom->set_state(TRISTATE_TRUE);
-            }
-            else if(eMode == SVX_ROTATE_MODE_TOP)
-            {
-                mxRefEdgeTop->set_state(TRISTATE_TRUE);
-            }
-            else if(eMode == SVX_ROTATE_MODE_STANDARD)
-            {
-                mxRefEdgeStd->set_state(TRISTATE_TRUE);
-            }
-            mbSettingToggles = false;
+            mxRefEdgeBottom->set_active(eMode == SVX_ROTATE_MODE_BOTTOM);
+            mxRefEdgeTop->set_active(eMode == SVX_ROTATE_MODE_TOP);
+            mxRefEdgeStd->set_active(eMode == SVX_ROTATE_MODE_STANDARD);
         }
         break;
     case SID_ATTR_ALIGN_DEGREES:
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
index 77c3a3162a4e..7de9cc633049 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -66,9 +66,9 @@ private:
     std::unique_ptr<weld::CheckButton> mxCBXMergeCell;
     std::unique_ptr<weld::Label> mxFtRotate;
     std::unique_ptr<weld::MetricSpinButton> mxMtrAngle;
-    std::unique_ptr<weld::RadioButton> mxRefEdgeBottom;
-    std::unique_ptr<weld::RadioButton> mxRefEdgeTop;
-    std::unique_ptr<weld::RadioButton> mxRefEdgeStd;
+    std::unique_ptr<weld::ToggleButton> mxRefEdgeBottom;
+    std::unique_ptr<weld::ToggleButton> mxRefEdgeTop;
+    std::unique_ptr<weld::ToggleButton> mxRefEdgeStd;
     std::unique_ptr<weld::CheckButton> mxCBStacked;
     std::unique_ptr<weld::Widget> mxTextOrientBox;
 
@@ -93,7 +93,6 @@ private:
     ::sfx2::sidebar::ControllerItem             maRefEdgeControl;
 
     bool                                        mbMultiDisable : 1;
-    bool                                        mbSettingToggles : 1;
 
     vcl::EnumContext                            maContext;
     SfxBindings*                                mpBindings;
@@ -103,7 +102,7 @@ private:
     DECL_LINK( CBOXWrapTextClkHdl, weld::Toggleable&, void );
     DECL_LINK( AngleModifiedHdl, weld::MetricSpinButton&, void );
     DECL_LINK( ClickStackHdl, weld::Toggleable&, void );
-    DECL_LINK( ReferenceEdgeHdl, weld::Toggleable&, void );
+    DECL_LINK( ReferenceEdgeHdl, weld::Button&, void );
 
     void Initialize();
 };
diff --git a/sc/uiconfig/scalc/ui/sidebaralignment.ui b/sc/uiconfig/scalc/ui/sidebaralignment.ui
index f8e7f1492526..303896227bc2 100644
--- a/sc/uiconfig/scalc/ui/sidebaralignment.ui
+++ b/sc/uiconfig/scalc/ui/sidebaralignment.ui
@@ -330,7 +330,7 @@
                 <property name="valign">center</property>
                 <property name="spacing">3</property>
                 <child>
-                  <object class="GtkRadioButton" id="bottom">
+                  <object class="GtkToggleButton" id="bottom">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="focus_on_click">False</property>
@@ -339,8 +339,6 @@
                     <property name="image">image3</property>
                     <property name="use_underline">True</property>
                     <property name="always_show_image">True</property>
-                    <property name="draw_indicator">False</property>
-                    <property name="group">standard</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -349,7 +347,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkRadioButton" id="top">
+                  <object class="GtkToggleButton" id="top">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="focus_on_click">False</property>
@@ -358,8 +356,6 @@
                     <property name="image">image2</property>
                     <property name="use_underline">True</property>
                     <property name="always_show_image">True</property>
-                    <property name="draw_indicator">False</property>
-                    <property name="group">standard</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -368,7 +364,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkRadioButton" id="standard">
+                  <object class="GtkToggleButton" id="standard">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="focus_on_click">False</property>
@@ -378,7 +374,6 @@
                     <property name="use_underline">True</property>
                     <property name="always_show_image">True</property>
                     <property name="active">True</property>
-                    <property name="draw_indicator">False</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -425,7 +420,6 @@
             <property name="receives_default">False</property>
             <property name="tooltip_text" translatable="yes" context="sidebaralignment|mergecells|tooltip_text">Joins the selected cells into one.</property>
             <property name="use_underline">True</property>
-            <property name="image_position">right</property>
             <property name="draw_indicator">True</property>
           </object>
           <packing>


More information about the Libreoffice-commits mailing list