[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 18 11:49:18 UTC 2020
vcl/unx/gtk3/gtk3gtkinst.cxx | 64 +++++++++++++++++++++----------------------
1 file changed, 32 insertions(+), 32 deletions(-)
New commits:
commit 897bd0517d835ba00458279311e5d8ff11079dd7
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Sep 18 10:09:54 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 18 13:48:35 2020 +0200
Related: tdf#136559 set multiple columns in model at the same time
reduces time from 40s to 13s
Change-Id: I01d6a4fcaa5a868f9b9f9292f4a7e99e216ea23b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102988
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 660e07374fb4..471b353bd64b 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9444,6 +9444,30 @@ private:
return bRet;
}
+ void set_toggle(const GtkTreeIter& iter, TriState eState, int col)
+ {
+ if (col == -1)
+ col = m_nExpanderToggleCol;
+ else
+ col = to_internal_model(col);
+
+ if (eState == TRISTATE_INDET)
+ {
+ gtk_tree_store_set(m_pTreeStore, const_cast<GtkTreeIter*>(&iter),
+ m_aToggleVisMap[col], true, // checkbuttons are invisible until toggled on or off
+ m_aToggleTriStateMap[col], true, // tristate on
+ -1);
+ }
+ else
+ {
+ gtk_tree_store_set(m_pTreeStore, const_cast<GtkTreeIter*>(&iter),
+ m_aToggleVisMap[col], true, // checkbuttons are invisible until toggled on or off
+ m_aToggleTriStateMap[col], false, // tristate off
+ col, eState == TRISTATE_TRUE, // set toggle state
+ -1);
+ }
+ }
+
void set(const GtkTreeIter& iter, int col, const OUString& rText)
{
OString aStr(OUStringToOString(rText, RTL_TEXTENCODING_UTF8));
@@ -10651,42 +10675,18 @@ public:
return get_bool(rGtkIter.iter, col) ? TRISTATE_TRUE : TRISTATE_FALSE;
}
- virtual void set_toggle(int pos, TriState eState, int col) override
- {
- if (col == -1)
- col = m_nExpanderToggleCol;
- else
- col = to_internal_model(col);
-
- // checkbuttons are invisible until toggled on or off
- set(pos, m_aToggleVisMap[col], true);
- if (eState == TRISTATE_INDET)
- set(pos, m_aToggleTriStateMap[col], true);
- else
- {
- set(pos, m_aToggleTriStateMap[col], false);
- set(pos, col, eState == TRISTATE_TRUE);
- }
- }
-
virtual void set_toggle(const weld::TreeIter& rIter, TriState eState, int col) override
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
+ set_toggle(rGtkIter.iter, eState, col);
+ }
- if (col == -1)
- col = m_nExpanderToggleCol;
- else
- col = to_internal_model(col);
-
- // checkbuttons are invisible until toggled on or off
- set(rGtkIter.iter, m_aToggleVisMap[col], true);
- if (eState == TRISTATE_INDET)
- set(rGtkIter.iter, m_aToggleTriStateMap[col], true);
- else
- {
- set(rGtkIter.iter, m_aToggleTriStateMap[col], false);
- set(rGtkIter.iter, col, eState == TRISTATE_TRUE);
- }
+ virtual void set_toggle(int pos, TriState eState, int col) override
+ {
+ GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+ GtkTreeIter iter;
+ if (gtk_tree_model_iter_nth_child(pModel, &iter, nullptr, pos))
+ set_toggle(iter, eState, col);
}
virtual void enable_toggle_buttons(weld::ColumnToggleType eType) override
More information about the Libreoffice-commits
mailing list