[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - cui/source include/vcl vcl/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 3 12:03:02 UTC 2019


 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 23ad16498adf24af7cc6fba243f1593147b65891
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Dec 2 17:06:34 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Dec 3 13:02:05 2019 +0100

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

diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index 56e75fecd969..b0e11d5ad72b 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -171,7 +171,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*);
@@ -214,6 +215,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 abe71e42fedb..940b2b0fb7c5 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -297,6 +297,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)
@@ -315,6 +316,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 de9b7a8040e2..d340fad0f6c1 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2067,6 +2067,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);
@@ -2162,6 +2168,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 643502e6368f..4edb50253d13 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -5200,6 +5200,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;
@@ -5281,6 +5286,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;


More information about the Libreoffice-commits mailing list