[Libreoffice-commits] core.git: 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 c5fc7dd4475d21abdfc9663c3ac55cce319c299d
Author: Caolán McNamara 
AuthorDate: Mon Dec 2 17:06:34 2019 +
Commit: Caolán McNamara 
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 
Tested-by: Caolán McNamara 

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 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*);
@@ -212,6 +213,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 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& 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
+{

[Libreoffice-commits] core.git: cui/source include/vcl vcl/source vcl/unx

2019-11-26 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 05734503ed36cff64cfaac8afb7c6df5eced8873
Author: Caolán McNamara 
AuthorDate: Mon Nov 25 14:25:28 2019 +
Commit: Caolán McNamara 
CommitDate: Wed Nov 27 00:27:42 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 

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, &rTreeView, 
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);
+InsertEntryIntoUI(pEntry, 
m_xContentsListBox->get_widget(), nActEntry, 1);
 
 m_xContentsListBox->select

[Libreoffice-commits] core.git: cui/source include/vcl vcl/source vcl/unx

2019-05-20 Thread Caolán McNamara (via logerrit)
 cui/source/tabpages/autocdlg.cxx |   36 
 include/vcl/weld.hxx |   14 +++---
 vcl/source/app/salvtables.cxx|   20 
 vcl/unx/gtk3/gtk3gtkinst.cxx |   16 
 4 files changed, 63 insertions(+), 23 deletions(-)

New commits:
commit 50588a1583e3cc5dc647a35889e50478c7bfd033
Author: Caolán McNamara 
AuthorDate: Fri May 17 12:43:38 2019 +0100
Commit: Caolán McNamara 
CommitDate: Mon May 20 14:53:12 2019 +0200

Related: tdf#109158 GtkTreeStore append performance is poor

so prepend in opposite order

Change-Id: Ibfa2878d999b945e774b5a90309a663f11b132b5
Reviewed-on: https://gerrit.libreoffice.org/72488
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 20042f986d47..861f2a70396f 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -801,67 +801,63 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool 
bFromReset,
 }
 }
 
-m_xReplaceTLB->clear();
 if( !bSWriter )
 aFormatText.clear();
 
-m_xReplaceTLB->freeze();
-
-if( aDoubleStringTable.find(eLang) != aDoubleStringTable.end() )
+if (aDoubleStringTable.find(eLang) != aDoubleStringTable.end())
 {
 DoubleStringArray& rArray = aDoubleStringTable[eNewLanguage];
-for(DoubleString & rDouble : rArray)
-{
+
+m_xReplaceTLB->bulk_insert_for_each(rArray.size(), [this, 
&rArray](weld::TreeIter& rIter, int nIndex) {
+DoubleString &rDouble = rArray[nIndex];
 bool bTextOnly = nullptr == rDouble.pUserData;
 // formatted text is only in Writer
 if (bSWriter || bTextOnly)
 {
-OUString sId;
 if (!bTextOnly)
 {
 // that means: with format info or even with selection text
-sId = 
OUString::number(reinterpret_cast(rDouble.pUserData));
+OUString sId = 
OUString::number(reinterpret_cast(rDouble.pUserData));
+m_xReplaceTLB->set_id(rIter, sId);
 }
-m_xReplaceTLB->append(sId, rDouble.sShort);
-m_xReplaceTLB->set_text(m_xReplaceTLB->n_children() - 1, 
rDouble.sLong, 1);
+m_xReplaceTLB->set_text(rIter, rDouble.sShort, 0);
+m_xReplaceTLB->set_text(rIter, rDouble.sLong, 1);
 }
 else
 {
 aFormatText.insert(rDouble.sShort);
 }
-}
+});
 }
 else
 {
 SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
 SvxAutocorrWordList* pWordList = 
pAutoCorrect->LoadAutocorrWordList(eLang);
 SvxAutocorrWordList::Content aContent = pWordList->getSortedContent();
-for (auto const& elem : aContent)
-{
+m_xReplaceTLB->bulk_insert_for_each(aContent.size(), [this, 
&aContent](weld::TreeIter& rIter, int nIndex) {
+auto const& elem = aContent[nIndex];
 bool bTextOnly = elem->IsTextOnly();
 // formatted text is only in Writer
 if (bSWriter || bTextOnly)
 {
-OUString sId;
 if (!bTextOnly)
 {
 // that means: with format info or even with selection text
-sId = 
OUString::number(reinterpret_cast(m_xTextOnlyCB.get()));
+OUString sId = 
OUString::number(reinterpret_cast(m_xTextOnlyCB.get()));
+m_xReplaceTLB->set_id(rIter, sId);
 }
-m_xReplaceTLB->append(sId, elem->GetShort());
-m_xReplaceTLB->set_text(m_xReplaceTLB->n_children() - 1, 
elem->GetLong(), 1);
+m_xReplaceTLB->set_text(rIter, elem->GetShort(), 0);
+m_xReplaceTLB->set_text(rIter, elem->GetLong(), 1);
 }
 else
 {
 aFormatText.insert(elem->GetShort());
 }
-}
+});
 m_xNewReplacePB->set_sensitive(false);
 m_xDeleteReplacePB->set_sensitive(false);
 }
 
-m_xReplaceTLB->thaw();
-
 SfxViewShell* pViewShell = SfxViewShell::Current();
 if (pViewShell && pViewShell->HasSelection())
 {
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 6f01abf567c2..8ba41b4e5851 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -765,12 +765,20 @@ public:
 virtual void move_subtree(TreeIter& rNode, const TreeIter* pNewParent, int 
nIndexInNewParent)
 = 0;
 
-//calling func on each element until func returns true or we run out of 
elements
+// call func on each element until func returns true or we run out of 
elements
 virtual void all_foreach(const std::function& func) = 0;
-//calling func 

[Libreoffice-commits] core.git: cui/source include/vcl vcl/source vcl/unx

2019-03-07 Thread Libreoffice Gerrit user
 cui/source/dialogs/hangulhanjadlg.cxx |3 +--
 include/vcl/weld.hxx  |3 ---
 vcl/source/app/salvtables.cxx |5 -
 vcl/unx/gtk3/gtk3gtkinst.cxx  |5 -
 4 files changed, 1 insertion(+), 15 deletions(-)

New commits:
commit d0586b42a715e4d14eeb5b3e729f20c3fb40c391
Author: Caolán McNamara 
AuthorDate: Thu Mar 7 13:12:59 2019 +
Commit: Caolán McNamara 
CommitDate: Thu Mar 7 16:21:39 2019 +0100

can drop wallpaper if use alpha-enabled virdev

Change-Id: I655dca755ed8e1c1266c191f61998b3838fe9797
Reviewed-on: https://gerrit.libreoffice.org/68860
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/cui/source/dialogs/hangulhanjadlg.cxx 
b/cui/source/dialogs/hangulhanjadlg.cxx
index 6f63cb7d45b8..703d52ddb026 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -227,10 +227,9 @@ namespace svx
 };
 
 RubyRadioButton::RubyRadioButton(std::unique_ptr 
xControl)
-: m_xVirDev(VclPtr::Create())
+: 
m_xVirDev(VclPtr::Create(*Application::GetDefaultDevice(), 
DeviceFormat::DEFAULT, DeviceFormat::DEFAULT))
 , m_xControl(std::move(xControl))
 {
-m_xVirDev->SetBackground(m_xControl->get_wallpaper());
 // expand the point size of the desired font to the equivalent pixel 
size
 if (vcl::Window* pDefaultDevice = 
dynamic_cast(Application::GetDefaultDevice()))
 pDefaultDevice->SetPointFont(*m_xVirDev, m_xControl->get_font());
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index e25911f940da..f0b9a6994f87 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -184,8 +183,6 @@ public:
 // font size is in points, not pixels, e.g. see Window::[G]etPointFont
 virtual vcl::Font get_font() = 0;
 
-virtual Wallpaper get_wallpaper() const = 0;
-
 //true for rtl, false otherwise
 virtual bool get_direction() const = 0;
 virtual void set_direction(bool bRTL) = 0;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 35bf1e625c6f..e732939aed78 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -387,11 +387,6 @@ public:
 return m_xWidget->GetPointFont(*m_xWidget);
 }
 
-virtual Wallpaper get_wallpaper() const override
-{
-return 
Wallpaper(Application::GetSettings().GetStyleSettings().GetDialogColor());
-}
-
 virtual OString get_buildable_name() const override
 {
 return m_xWidget->get_id().toUtf8();
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index a11c943ae651..7e8334d30e8f 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1599,11 +1599,6 @@ public:
 
Application::GetSettings().GetUILanguageTag().getLocale());
 }
 
-virtual Wallpaper get_wallpaper() const override
-{
-return Wallpaper(COL_TRANSPARENT);
-}
-
 virtual void set_grid_left_attach(int nAttach) override
 {
 GtkContainer* pParent = 
GTK_CONTAINER(gtk_widget_get_parent(m_pWidget));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits