[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jun 5 07:38:49 UTC 2020
vcl/unx/gtk3/gtk3gtkinst.cxx | 45 +++++++++++++++++++------------------------
1 file changed, 20 insertions(+), 25 deletions(-)
New commits:
commit 3ace835e16883f8f651437f905c6a65f6e2a2263
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jun 4 11:21:05 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jun 5 09:38:09 2020 +0200
simplify column/renderer mapping
Change-Id: I1949a9596d37009e8585dfd2181cc96c03d6e4b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95522
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 1d4fa5ae530f..b07acf43e0b6 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9107,7 +9107,6 @@ private:
std::vector<std::unique_ptr<GtkTreeRowReference, GtkTreeRowReferenceDeleter>> m_aSeparatorRows;
std::vector<GtkSortType> m_aSavedSortTypes;
std::vector<int> m_aSavedSortColumns;
- std::vector<int> m_aViewColToModelCol;
bool m_bWorkAroundBadDragRegion;
bool m_bInDrag;
gint m_nTextCol;
@@ -9540,11 +9539,6 @@ private:
pThis->signal_visible_range_changed();
}
- int get_model_col(int viewcol) const
- {
- return m_aViewColToModelCol[viewcol];
- }
-
// The outside concept of a column maps to a gtk CellRenderer, rather than
// a TreeViewColumn. If the first TreeViewColumn has two CellRenderers, and
// the first CellRenderer is an image, that CellRenderer is considered to
@@ -9859,7 +9853,6 @@ public:
++nIndex;
}
g_list_free(pRenderers);
- m_aViewColToModelCol.push_back(nIndex - 1);
++nViewColumn;
}
@@ -10376,8 +10369,10 @@ public:
virtual OUString get_text(int pos, int col) const override
{
if (col == -1)
- return get(pos, m_nTextCol);
- return get(pos, get_model_col(col));
+ col = m_nTextCol;
+ else
+ col = to_internal_model(col);
+ return get(pos, col);
}
virtual void set_text(int pos, const OUString& rText, int col) override
@@ -10385,13 +10380,13 @@ public:
if (col == -1)
col = m_nTextCol;
else
- col = get_model_col(col);
+ col = to_internal_model(col);
set(pos, col, rText);
}
virtual TriState get_toggle(int pos, int col) const override
{
- col = get_model_col(col);
+ col = to_internal_model(col);
if (get_bool(pos, m_aToggleTriStateMap.find(col)->second))
return TRISTATE_INDET;
return get_bool(pos, col) ? TRISTATE_TRUE : TRISTATE_FALSE;
@@ -10399,7 +10394,7 @@ public:
virtual TriState get_toggle(const weld::TreeIter& rIter, int col) const override
{
- col = get_model_col(col);
+ col = to_internal_model(col);
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
if (get_bool(rGtkIter.iter, m_aToggleTriStateMap.find(col)->second))
return TRISTATE_INDET;
@@ -10408,7 +10403,7 @@ public:
virtual void set_toggle(int pos, TriState eState, int col) override
{
- col = get_model_col(col);
+ col = to_internal_model(col);
// checkbuttons are invisible until toggled on or off
set(pos, m_aToggleVisMap[col], true);
if (eState == TRISTATE_INDET)
@@ -10423,7 +10418,7 @@ public:
virtual void set_toggle(const weld::TreeIter& rIter, TriState eState, int col) override
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
- col = get_model_col(col);
+ col = to_internal_model(col);
// checkbuttons are invisible until toggled on or off
set(rGtkIter.iter, m_aToggleVisMap[col], true);
if (eState == TRISTATE_INDET)
@@ -10444,39 +10439,39 @@ public:
virtual void set_text_emphasis(const weld::TreeIter& rIter, bool bOn, int col) override
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
- col = get_model_col(col);
+ col = to_internal_model(col);
set(rGtkIter.iter, m_aWeightMap[col], bOn ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL);
}
virtual void set_text_emphasis(int pos, bool bOn, int col) override
{
- col = get_model_col(col);
+ col = to_internal_model(col);
set(pos, m_aWeightMap[col], bOn ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL);
}
virtual bool get_text_emphasis(const weld::TreeIter& rIter, int col) const override
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
- col = get_model_col(col);
+ col = to_internal_model(col);
return get_int(rGtkIter.iter, m_aWeightMap.find(col)->second) == PANGO_WEIGHT_BOLD;
}
virtual bool get_text_emphasis(int pos, int col) const override
{
- col = get_model_col(col);
+ col = to_internal_model(col);
return get_int(pos, m_aWeightMap.find(col)->second) == PANGO_WEIGHT_BOLD;
}
virtual void set_text_align(const weld::TreeIter& rIter, double fAlign, int col) override
{
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
- col = get_model_col(col);
+ col = to_internal_model(col);
set(rGtkIter.iter, m_aAlignMap[col], fAlign);
}
virtual void set_text_align(int pos, double fAlign, int col) override
{
- col = get_model_col(col);
+ col = to_internal_model(col);
set(pos, m_aAlignMap[col], fAlign);
}
@@ -10487,7 +10482,7 @@ public:
if (col == -1)
col = m_nTextCol;
else
- col = get_model_col(col);
+ col = to_internal_model(col);
set(pos, m_aSensitiveMap[col], bSensitive);
}
@@ -10496,7 +10491,7 @@ public:
if (col == -1)
col = m_nTextCol;
else
- col = get_model_col(col);
+ col = to_internal_model(col);
const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
set(rGtkIter.iter, m_aSensitiveMap[col], bSensitive);
}
@@ -10506,7 +10501,7 @@ public:
if (col == -1)
col = m_nExpanderImageCol;
else
- col = get_model_col(col);
+ col = to_internal_model(col);
gtk_tree_store_set(m_pTreeStore, const_cast<GtkTreeIter*>(&iter), col, pixbuf, -1);
if (pixbuf)
g_object_unref(pixbuf);
@@ -11019,7 +11014,7 @@ public:
if (col == -1)
col = m_nTextCol;
else
- col = get_model_col(col);
+ col = to_internal_model(col);
return get(rGtkIter.iter, col);
}
@@ -11029,7 +11024,7 @@ public:
if (col == -1)
col = m_nTextCol;
else
- col = get_model_col(col);
+ col = to_internal_model(col);
set(rGtkIter.iter, col, rText);
}
More information about the Libreoffice-commits
mailing list