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

2019-12-03 Thread Caolán McNamara (via logerrit)
 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 
AuthorDate: Mon Dec 2 17:06:34 2019 +
Commit: Caolán McNamara 
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 
Tested-by: Caolán McNamara 

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 const&,
   Link const&,
-  Link const&);
+  Link 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(*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 const&,
@@ -458,10 +464,15 @@ void ColorConfigWindow_Impl::AdjustExtraWidths(int 
nTextWidth)
 // SetLinks()
 void ColorConfigWindow_Impl::SetLinks(Link const& 
aCheckLink,
   Link const& 
aColorLink,
-  Link const& 
rGetFocusLink)
+  Link 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 aCheckLink = LINK(this, 
ColorConfigCtrl_Impl, ClickHdl);
 Link aColorLink = LINK(this, ColorConfigCtrl_Impl, 
ColorHdl);
 Link 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& 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
+

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

2019-11-28 Thread Caolán McNamara (via logerrit)
 cui/source/customize/SvxMenuConfigPage.cxx|   29 ++---
 cui/source/customize/SvxToolbarConfigPage.cxx |   12 ++---
 cui/source/customize/cfg.cxx  |   57 --
 cui/source/inc/cfg.hxx|9 +++-
 include/vcl/weld.hxx  |5 +-
 vcl/source/app/salvtables.cxx |8 +++
 vcl/unx/gtk3/gtk3gtkinst.cxx  |6 ++
 7 files changed, 81 insertions(+), 45 deletions(-)

New commits:
commit 7f1a82783ce1bfad08fcf39025c985c56fc3d90f
Author: Caolán McNamara 
AuthorDate: Mon Nov 25 14:25:28 2019 +
Commit: Caolán McNamara 
CommitDate: Thu Nov 28 13:53:03 2019 +0100

tdf#126043 use another bulk_insert_for_each

Change-Id: I05c3fc6e708d000ba955981dbd8d11371ea99da2
Reviewed-on: https://gerrit.libreoffice.org/83686
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 05734503ed36cff64cfaac8afb7c6df5eced8873)
Reviewed-on: https://gerrit.libreoffice.org/83983

diff --git a/cui/source/customize/SvxMenuConfigPage.cxx 
b/cui/source/customize/SvxMenuConfigPage.cxx
index 218d087349ad..7289b3506a7c 100644
--- a/cui/source/customize/SvxMenuConfigPage.cxx
+++ b/cui/source/customize/SvxMenuConfigPage.cxx
@@ -263,22 +263,21 @@ short SvxMenuConfigPage::QueryReset()
 
 void SvxMenuConfigPage::SelectElement()
 {
-m_xContentsListBox->clear();
+weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
 
 SvxConfigEntry* pMenuData = GetTopLevelSelection();
-
-if ( pMenuData )
+if (!pMenuData)
+rTreeView.clear();
+else
 {
 SvxEntries* pEntries = pMenuData->GetEntries();
 
-int i = 0;
-for (auto const& entry : *pEntries)
-{
+rTreeView.bulk_insert_for_each(pEntries->size(), [this, , 
pEntries](weld::TreeIter& rIter, int nIdx) {
+auto const& entry = (*pEntries)[nIdx];
 OUString sId(OUString::number(reinterpret_cast(entry)));
-m_xContentsListBox->insert(i, sId);
-InsertEntryIntoUI(entry, i, 0);
-++i;
-}
+rTreeView.set_id(rIter, sId);
+InsertEntryIntoUI(entry, rTreeView, rIter, 0);
+});
 }
 
 UpdateButtonStates();
@@ -364,9 +363,10 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, AddCommandHdl, 
weld::Button&, void )
 int nPos = AddFunction(-1, /*bAllowDuplicates*/false);
 if (nPos == -1)
 return;
+weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
 SvxConfigEntry* pEntry =
-
reinterpret_cast(m_xContentsListBox->get_id(nPos).toInt64());
-InsertEntryIntoUI(pEntry, nPos, 0);
+reinterpret_cast(rTreeView.get_id(nPos).toInt64());
+InsertEntryIntoUI(pEntry, rTreeView, nPos, 0);
 }
 
 IMPL_LINK_NOARG( SvxMenuConfigPage, RemoveCommandHdl, weld::Button&, void )
@@ -380,12 +380,13 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, RemoveCommandHdl, 
weld::Button&, void )
 
 IMPL_LINK(SvxMenuConfigPage, InsertHdl, const OString&, rIdent, void)
 {
+weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
 if (rIdent == "insertseparator")
 {
 SvxConfigEntry* pNewEntryData = new SvxConfigEntry;
 pNewEntryData->SetUserDefined();
 int nPos = AppendEntry(pNewEntryData, -1);
-InsertEntryIntoUI(pNewEntryData, nPos, 0);
+InsertEntryIntoUI(pNewEntryData, rTreeView, nPos, 0);
 }
 else if (rIdent == "insertsubmenu")
 {
@@ -406,7 +407,7 @@ IMPL_LINK(SvxMenuConfigPage, InsertHdl, const OString&, 
rIdent, void)
 pNewEntryData->SetUserDefined();
 
 int nPos = AppendEntry(pNewEntryData, -1);
-InsertEntryIntoUI(pNewEntryData, nPos, 0);
+InsertEntryIntoUI(pNewEntryData, rTreeView, nPos, 0);
 
 ReloadTopLevelListBox();
 
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx 
b/cui/source/customize/SvxToolbarConfigPage.cxx
index b8058df387f5..b30302d52ed3 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -463,7 +463,7 @@ IMPL_LINK(SvxToolbarConfigPage, InsertHdl, const OString&, 
rIdent, void)
 pNewEntryData->SetUserDefined();
 
 int nPos = AppendEntry(pNewEntryData, -1);
-InsertEntryIntoUI(pNewEntryData, nPos, 1);
+InsertEntryIntoUI(pNewEntryData, m_xContentsListBox->get_widget(), 
nPos, 1);
 
 static_cast( GetSaveInData())->ApplyToolbar( 
pToolbar );
 
@@ -561,7 +561,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const 
OString&, rIdent, void)
 OUString 
sId(OUString::number(reinterpret_cast(pEntry)));
 m_xContentsListBox->insert(nActEntry, sId);
 m_xContentsListBox->set_toggle(nActEntry, 
pEntry->IsVisible() ? TRISTATE_TRUE : TRISTATE_FALSE, 0);
-InsertEntryIntoUI(pEntry, nActEntry, 1);
+