cui/source/options/optcolor.cxx |   17 ++++++++++++++---
 include/vcl/weld.hxx            |    2 ++
 vcl/source/app/salvtables.cxx   |   12 ++++++++++++
 vcl/unx/gtk3/gtk3gtkinst.cxx    |   10 ++++++++++
 4 files changed, 38 insertions(+), 3 deletions(-)

New commits:
commit c5fc7dd4475d21abdfc9663c3ac55cce319c299d
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Dec 2 17:06:34 2019 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Dec 3 09:56:32 2019 +0100

    tdf#129134 ApplicationColors Scrolled List moves too little
    
    Change-Id: I5cb6ac017f1d2a916297676724d523634afb2020
    Reviewed-on: https://gerrit.libreoffice.org/84252
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index 244cbbbf0dea..0e6cb822715a 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -169,7 +169,8 @@ public:
 public:
     void SetLinks(Link<weld::ToggleButton&,void> const&,
                   Link<ColorListBox&,void> const&,
-                  Link<weld::Widget&,void> const&);
+                  Link<weld::Widget&,void> const&,
+                  weld::ScrolledWindow& rScroll);
     void Update(EditableColorConfig const*, EditableExtendedColorConfig 
const*);
     void ClickHdl(EditableColorConfig*, weld::ToggleButton&);
     void ColorHdl(EditableColorConfig*, EditableExtendedColorConfig*, const 
ColorListBox*);
@@ -212,6 +213,11 @@ private:
     public:
         void SetText(const OUString& rLabel) { 
dynamic_cast<weld::Label&>(*m_xText).set_label(rLabel); }
         void set_width_request(int nTextWidth) { 
m_xText->set_size_request(nTextWidth, -1); }
+        int get_height_request() const
+        {
+            return std::max(m_xText->get_preferred_size().Height(),
+                            
m_xColorList->get_widget().get_preferred_size().Height());
+        }
         void Hide ();
     public:
         void SetLinks(Link<weld::ToggleButton&,void> const&,
@@ -458,10 +464,15 @@ void ColorConfigWindow_Impl::AdjustExtraWidths(int 
nTextWidth)
 // SetLinks()
 void ColorConfigWindow_Impl::SetLinks(Link<weld::ToggleButton&,void> const& 
aCheckLink,
                                       Link<ColorListBox&,void> const& 
aColorLink,
-                                      Link<weld::Widget&,void> const& 
rGetFocusLink)
+                                      Link<weld::Widget&,void> const& 
rGetFocusLink,
+                                      weld::ScrolledWindow& rScroll)
 {
+    if (vEntries.empty())
+        return;
     for (auto const & i: vEntries)
         i->SetLinks(aCheckLink, aColorLink, rGetFocusLink);
+    // 6 is the spacing set on ColorConfigWindow
+    rScroll.vadjustment_set_step_increment(vEntries[0]->get_height_request() + 
6);
 }
 
 // Update()
@@ -622,7 +633,7 @@ ColorConfigCtrl_Impl::ColorConfigCtrl_Impl(weld::Window* 
pTopLevel, weld::Builde
     Link<weld::ToggleButton&,void> aCheckLink = LINK(this, 
ColorConfigCtrl_Impl, ClickHdl);
     Link<ColorListBox&,void> aColorLink = LINK(this, ColorConfigCtrl_Impl, 
ColorHdl);
     Link<weld::Widget&,void> const& aGetFocusLink = LINK(this, 
ColorConfigCtrl_Impl, ControlFocusHdl);
-    m_xScrollWindow->SetLinks(aCheckLink, aColorLink, aGetFocusLink);
+    m_xScrollWindow->SetLinks(aCheckLink, aColorLink, aGetFocusLink, 
*m_xVScroll);
 }
 
 void ColorConfigCtrl_Impl::Update ()
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index e7025b134506..60f705e1e624 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -298,6 +298,7 @@ public:
     virtual int hadjustment_get_page_size() const = 0;
     virtual void hadjustment_set_page_size(int size) = 0;
     virtual void hadjustment_set_page_increment(int size) = 0;
+    virtual void hadjustment_set_step_increment(int size) = 0;
     virtual void set_hpolicy(VclPolicyType eHPolicy) = 0;
     virtual VclPolicyType get_hpolicy() const = 0;
     void connect_hadjustment_changed(const Link<ScrolledWindow&, void>& rLink)
@@ -316,6 +317,7 @@ public:
     virtual int vadjustment_get_page_size() const = 0;
     virtual void vadjustment_set_page_size(int size) = 0;
     virtual void vadjustment_set_page_increment(int size) = 0;
+    virtual void vadjustment_set_step_increment(int size) = 0;
     virtual int vadjustment_get_lower() const = 0;
     virtual void vadjustment_set_lower(int upper) = 0;
     virtual void set_vpolicy(VclPolicyType eVPolicy) = 0;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 3bfc4e1e92a7..f45f550e5985 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2091,6 +2091,12 @@ public:
         return rHorzScrollBar.SetPageSize(size);
     }
 
+    virtual void hadjustment_set_step_increment(int size) override
+    {
+        ScrollBar& rHorzScrollBar = m_xScrolledWindow->getHorzScrollBar();
+        return rHorzScrollBar.SetLineSize(size);
+    }
+
     virtual void set_hpolicy(VclPolicyType eHPolicy) override
     {
         WinBits nWinBits = m_xScrolledWindow->GetStyle() & 
~(WB_AUTOHSCROLL|WB_HSCROLL);
@@ -2186,6 +2192,12 @@ public:
         return rVertScrollBar.SetPageSize(size);
     }
 
+    virtual void vadjustment_set_step_increment(int size) override
+    {
+        ScrollBar& rVertScrollBar = m_xScrolledWindow->getVertScrollBar();
+        return rVertScrollBar.SetLineSize(size);
+    }
+
     virtual void set_vpolicy(VclPolicyType eVPolicy) override
     {
         WinBits nWinBits = m_xScrolledWindow->GetStyle() & 
~(WB_AUTOVSCROLL|WB_VSCROLL);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 39b3357fe4a2..fc1e893d9633 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -5230,6 +5230,11 @@ public:
         gtk_adjustment_set_page_increment(m_pHAdjustment, size);
     }
 
+    virtual void hadjustment_set_step_increment(int size) override
+    {
+        gtk_adjustment_set_step_increment(m_pHAdjustment, size);
+    }
+
     virtual void set_hpolicy(VclPolicyType eHPolicy) override
     {
         GtkPolicyType eGtkVPolicy;
@@ -5311,6 +5316,11 @@ public:
         gtk_adjustment_set_page_increment(m_pVAdjustment, size);
     }
 
+    virtual void vadjustment_set_step_increment(int size) override
+    {
+        gtk_adjustment_set_step_increment(m_pVAdjustment, size);
+    }
+
     virtual void set_vpolicy(VclPolicyType eVPolicy) override
     {
         GtkPolicyType eGtkHPolicy;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to