[Libreoffice-commits] core.git: cui/source cui/uiconfig include/tools solenv/sanitizers

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 3 09:41:38 UTC 2019


 cui/source/inc/cuitabarea.hxx    |    2 -
 cui/source/tabpages/tparea.cxx   |    2 +
 cui/source/tabpages/tpgradnt.cxx |   19 ++++------
 cui/uiconfig/ui/gradientpage.ui  |   68 +++++++++++++++++----------------------
 include/tools/gen.hxx            |    6 +++
 solenv/sanitizers/ui/cui.suppr   |    1 
 6 files changed, 47 insertions(+), 51 deletions(-)

New commits:
commit 994b41a6c69d20637dcb95894c385f5c0102d600
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Apr 3 12:21:08 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Wed Apr 3 11:41:14 2019 +0200

    tdf#124155 change "gradient tab page" - increment & angle slider
    
    Remove slider for increments as the increments should better be
    left to "auto" and rarely modified (setting a value means it will
    use a limitied amount of increments, but auto effectively means
    as much as it is needed and can use the native backend for
    drawing).
    
    OTOH use a slider for setting the "angle" as it is already present
    in hatch tab page. Angle needs a slider as it is usually one of
    the main properties of a gradient (especially linear).
    
    Increase the tab pages a bit (10px on every side) to have a bit of
    breating space for all the widgets.
    
    Change-Id: I66167fe2c97b53bc3627237279332bdd59fb03d7
    Reviewed-on: https://gerrit.libreoffice.org/70175
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index fc45f9922c9b..016b976ae374 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -378,6 +378,7 @@ private:
     std::unique_ptr<weld::MetricSpinButton> m_xMtrCenterY;
     std::unique_ptr<weld::Label> m_xFtAngle;
     std::unique_ptr<weld::MetricSpinButton> m_xMtrAngle;
+    std::unique_ptr<weld::Scale> m_xSliderAngle;
     std::unique_ptr<weld::MetricSpinButton> m_xMtrBorder;
     std::unique_ptr<weld::Scale> m_xSliderBorder;
     std::unique_ptr<ColorListBox> m_xLbColorFrom;
@@ -387,7 +388,6 @@ private:
     std::unique_ptr<SvxPresetListBox> m_xGradientLB;
     std::unique_ptr<weld::SpinButton> m_xMtrIncrement;
     std::unique_ptr<weld::CheckButton> m_xCbIncrement;
-    std::unique_ptr<weld::Scale> m_xSliderIncrement;
     std::unique_ptr<weld::Button> m_xBtnAdd;
     std::unique_ptr<weld::Button> m_xBtnModify;
     std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index 83ffcb3c8a7e..c4d2c3e40864 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -158,6 +158,8 @@ void SvxAreaTabPage::SetOptimalSize(weld::DialogController* pController)
     }
     m_pFillTabPage.disposeAndClear();
 
+    aSize.extendBy(10, 10); // apply a bit of margin
+
     m_xFillTab->set_size_request(aSize.Width(), aSize.Height());
 }
 
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index d9cb5c3fddf7..529ce2e8ce81 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -60,6 +60,7 @@ SvxGradientTabPage::SvxGradientTabPage(TabPageParent pParent, const SfxItemSet&
     , m_xMtrCenterY(m_xBuilder->weld_metric_spin_button("centerymtr", FieldUnit::PERCENT))
     , m_xFtAngle(m_xBuilder->weld_label("angleft"))
     , m_xMtrAngle(m_xBuilder->weld_metric_spin_button("anglemtr", FieldUnit::DEGREE))
+    , m_xSliderAngle(m_xBuilder->weld_scale("angleslider"))
     , m_xMtrBorder(m_xBuilder->weld_metric_spin_button("bordermtr", FieldUnit::PERCENT))
     , m_xSliderBorder(m_xBuilder->weld_scale("borderslider"))
     , m_xLbColorFrom(new ColorListBox(m_xBuilder->weld_menu_button("colorfromlb"), pParent.GetFrameWeld()))
@@ -69,7 +70,6 @@ SvxGradientTabPage::SvxGradientTabPage(TabPageParent pParent, const SfxItemSet&
     , m_xGradientLB(new SvxPresetListBox(m_xBuilder->weld_scrolled_window("gradientpresetlistwin")))
     , m_xMtrIncrement(m_xBuilder->weld_spin_button("incrementmtr"))
     , m_xCbIncrement(m_xBuilder->weld_check_button("autoincrement"))
-    , m_xSliderIncrement(m_xBuilder->weld_scale("incrementslider"))
     , m_xBtnAdd(m_xBuilder->weld_button("add"))
     , m_xBtnModify(m_xBuilder->weld_button("modify"))
     , m_xCtlPreview(new weld::CustomWeld(*m_xBuilder, "previewctl", m_aCtlPreview))
@@ -103,10 +103,10 @@ SvxGradientTabPage::SvxGradientTabPage(TabPageParent pParent, const SfxItemSet&
     m_xLbGradientType->connect_changed( aLink2 );
     m_xCbIncrement->connect_toggled(LINK(this, SvxGradientTabPage, ChangeAutoStepHdl_Impl));
     m_xMtrIncrement->connect_value_changed(LINK(this, SvxGradientTabPage, ModifiedEditHdl_Impl));
-    m_xSliderIncrement->connect_value_changed(LINK(this, SvxGradientTabPage, ModifiedSliderHdl_Impl));
     m_xMtrCenterX->connect_value_changed( aLink );
     m_xMtrCenterY->connect_value_changed( aLink );
     m_xMtrAngle->connect_value_changed( aLink );
+    m_xSliderAngle->connect_value_changed(LINK(this, SvxGradientTabPage, ModifiedSliderHdl_Impl));
     m_xMtrBorder->connect_value_changed( aLink );
     m_xSliderBorder->connect_value_changed(LINK(this, SvxGradientTabPage, ModifiedSliderHdl_Impl));
     m_xMtrColorFrom->connect_value_changed( aLink );
@@ -231,7 +231,6 @@ bool SvxGradientTabPage::FillItemSet( SfxItemSet* rSet )
 void SvxGradientTabPage::Reset( const SfxItemSet* )
 {
     m_xMtrIncrement->set_value(DEFAULT_GRADIENTSTEP);
-    m_xSliderIncrement->set_value(DEFAULT_GRADIENTSTEP);
     ChangeGradientHdl_Impl();
 
     // determine state of the buttons
@@ -282,12 +281,10 @@ IMPL_LINK_NOARG( SvxGradientTabPage, ChangeAutoStepHdl_Impl, weld::ToggleButton&
 {
     if (m_xCbIncrement->get_active())
     {
-        m_xSliderIncrement->set_sensitive(false);
         m_xMtrIncrement->set_sensitive(false);
     }
     else
     {
-        m_xSliderIncrement->set_sensitive(true);
         m_xMtrIncrement->set_sensitive(true);
     }
     ModifiedHdl_Impl(m_xMtrIncrement.get());
@@ -299,10 +296,10 @@ void SvxGradientTabPage::ModifiedHdl_Impl( void const * pControl )
         m_xSliderBorder->set_value(m_xMtrBorder->get_value(FieldUnit::NONE));
     if (pControl == m_xSliderBorder.get())
         m_xMtrBorder->set_value(m_xSliderBorder->get_value(), FieldUnit::NONE);
-    if (pControl == m_xMtrIncrement.get())
-        m_xSliderIncrement->set_value(m_xMtrIncrement->get_value());
-    if (pControl == m_xSliderIncrement.get())
-        m_xMtrIncrement->set_value(m_xSliderIncrement->get_value());
+    if (pControl == m_xMtrAngle.get())
+        m_xSliderAngle->set_value(m_xMtrAngle->get_value(FieldUnit::NONE));
+    if (pControl == m_xSliderAngle.get())
+        m_xMtrAngle->set_value(m_xSliderAngle->get_value(), FieldUnit::NONE);
 
     css::awt::GradientStyle eXGS = static_cast<css::awt::GradientStyle>(m_xLbGradientType->get_active());
 
@@ -543,15 +540,12 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl()
         {
             m_xCbIncrement->set_state(TRISTATE_TRUE);
             m_xMtrIncrement->set_sensitive(false);
-            m_xSliderIncrement->set_sensitive(false);
         }
         else
         {
             m_xCbIncrement->set_state(TRISTATE_FALSE);
             m_xMtrIncrement->set_sensitive(true);
             m_xMtrIncrement->set_value( nValue );
-            m_xSliderIncrement->set_sensitive(true);
-            m_xSliderIncrement->set_value(nValue);
         }
         m_xLbGradientType->set_active(
             sal::static_int_cast< sal_Int32 >( eXGS ) );
@@ -564,6 +558,7 @@ void SvxGradientTabPage::ChangeGradientHdl_Impl()
         m_xLbColorTo->SelectEntry( pGradient->GetEndColor() );
 
         m_xMtrAngle->set_value(pGradient->GetAngle() / 10, FieldUnit::NONE); // should be changed in resource
+        m_xSliderAngle->set_value(pGradient->GetAngle() / 10);
         m_xMtrBorder->set_value(pGradient->GetBorder(), FieldUnit::NONE);
         m_xSliderBorder->set_value(pGradient->GetBorder());
         m_xMtrCenterX->set_value(pGradient->GetXOffset(), FieldUnit::NONE);
diff --git a/cui/uiconfig/ui/gradientpage.ui b/cui/uiconfig/ui/gradientpage.ui
index 3fa4b9332c6f..a3b3d751caf9 100644
--- a/cui/uiconfig/ui/gradientpage.ui
+++ b/cui/uiconfig/ui/gradientpage.ui
@@ -249,7 +249,6 @@
                         <property name="use_underline">True</property>
                         <property name="mnemonic_widget">incrementmtr</property>
                         <property name="xalign">0</property>
-                        <property name="yalign">0.43999999761581421</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
@@ -258,20 +257,6 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkScale" id="incrementslider">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="hexpand">True</property>
-                        <property name="adjustment">adjustment2</property>
-                        <property name="round_digits">1</property>
-                        <property name="draw_value">False</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">2</property>
-                      </packing>
-                    </child>
-                    <child>
                       <object class="GtkSpinButton" id="incrementmtr">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
@@ -280,7 +265,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">2</property>
+                        <property name="top_attach">1</property>
                       </packing>
                     </child>
                     <child>
@@ -289,6 +274,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
+                        <property name="hexpand">True</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
@@ -296,7 +282,6 @@
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">1</property>
-                        <property name="width">2</property>
                       </packing>
                     </child>
                   </object>
@@ -320,7 +305,6 @@
                         <property name="label" translatable="yes" context="gradientpage|centerft">Center ( X / Y ):</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0</property>
-                        <property name="yalign">0.43999999761581421</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
@@ -373,9 +357,6 @@
                   </packing>
                 </child>
                 <child>
-                  <placeholder/>
-                </child>
-                <child>
                   <object class="GtkGrid" id="grid3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
@@ -390,11 +371,10 @@
                         <property name="use_underline">True</property>
                         <property name="mnemonic_widget">bordermtr</property>
                         <property name="xalign">0</property>
-                        <property name="yalign">0.43999999761581421</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
+                        <property name="top_attach">2</property>
                         <property name="width">2</property>
                       </packing>
                     </child>
@@ -410,7 +390,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">2</property>
+                        <property name="top_attach">3</property>
                       </packing>
                     </child>
                     <child>
@@ -422,7 +402,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">2</property>
+                        <property name="top_attach">3</property>
                       </packing>
                     </child>
                     <child>
@@ -433,7 +413,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">0</property>
+                        <property name="top_attach">1</property>
                       </packing>
                     </child>
                     <child>
@@ -444,12 +424,12 @@
                         <property name="label" translatable="yes" context="gradientpage|angleft">A_ngle:</property>
                         <property name="use_underline">True</property>
                         <property name="mnemonic_widget">anglemtr</property>
-                        <property name="xalign">1</property>
-                        <property name="yalign">0.43999999761581421</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">0</property>
+                        <property name="width">2</property>
                       </packing>
                     </child>
                     <child>
@@ -460,7 +440,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">6</property>
+                        <property name="top_attach">7</property>
                       </packing>
                     </child>
                     <child>
@@ -470,14 +450,13 @@
                         <property name="receives_default">False</property>
                         <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
-                        <property name="label" translatable="no"></property>
                         <child>
                           <placeholder/>
                         </child>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">6</property>
+                        <property name="top_attach">7</property>
                       </packing>
                     </child>
                     <child>
@@ -491,7 +470,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">5</property>
+                        <property name="top_attach">6</property>
                         <property name="width">2</property>
                       </packing>
                     </child>
@@ -502,14 +481,13 @@
                         <property name="receives_default">False</property>
                         <property name="xalign">0</property>
                         <property name="draw_indicator">True</property>
-                        <property name="label" translatable="no"></property>
                         <child>
                           <placeholder/>
                         </child>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">4</property>
+                        <property name="top_attach">5</property>
                       </packing>
                     </child>
                     <child>
@@ -520,7 +498,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">4</property>
+                        <property name="top_attach">5</property>
                       </packing>
                     </child>
                     <child>
@@ -534,15 +512,29 @@
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">3</property>
+                        <property name="top_attach">4</property>
                         <property name="width">2</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkScale" id="angleslider">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="adjustment">angleadjustment</property>
+                        <property name="fill_level">0</property>
+                        <property name="draw_value">False</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">4</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
                 <child>
@@ -608,7 +600,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">9</property>
+                    <property name="position">4</property>
                   </packing>
                 </child>
               </object>
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 5d6ff5ea66b8..0d9a81ebdcee 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -197,6 +197,12 @@ public:
     void            setWidth(long nWidth)  { nA = nWidth; }
     void            setHeight(long nHeight)  { nB = nHeight; }
 
+    void extendBy(long x, long y)
+    {
+        nA += x;
+        nB += y;
+    }
+
     Pair const &    toPair() const { return *this; }
     Pair &          toPair() { return *this; }
 
diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr
index 1ee15b260d09..c789c27b59a0 100644
--- a/solenv/sanitizers/ui/cui.suppr
+++ b/solenv/sanitizers/ui/cui.suppr
@@ -202,6 +202,7 @@ cui/uiconfig/ui/fmsearchdialog.ui://GtkLabel[@id='ftRecord'] orphan-label
 cui/uiconfig/ui/fmsearchdialog.ui://GtkLabel[@id='ftHint'] orphan-label
 cui/uiconfig/ui/gradientpage.ui://GtkScale[@id='incrementslider'] no-labelled-by
 cui/uiconfig/ui/gradientpage.ui://GtkLabel[@id='centerft'] orphan-label
+cui/uiconfig/ui/gradientpage.ui://GtkScale[@id='angleslider'] no-labelled-by
 cui/uiconfig/ui/gradientpage.ui://GtkScale[@id='borderslider'] no-labelled-by
 cui/uiconfig/ui/effectspage.ui://GtkLabel[@id='label1'] orphan-label
 cui/uiconfig/ui/effectspage.ui://GtkLabel[@id='label2'] orphan-label


More information about the Libreoffice-commits mailing list