commit 7f6f56f40ab4aab138621361ce90953b5f0ccbe4
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Mon Dec 5 17:37:51 2016 +0100
Get rid of Inset::setDimCache
This helper method is used to set the inset dimension cache at metrics
time. However this is already done by the metrics code itself
(MathRow::metrics, TextMetrics::redoParagraph), so that there is no
need to do this same work again in a different place.
Also, InsetPhantom::metrics is removed, since it does not do anything
interesting.
This commit comes with a mild risk attached (it might be that some of
these calls were useful after all!), but all of this is fixable.
---
src/insets/Inset.cpp | 6 ------
src/insets/Inset.h | 2 --
src/insets/InsetIPA.cpp | 2 --
src/insets/InsetIPAMacro.cpp | 4 ----
src/insets/InsetLine.cpp | 3 ---
src/insets/InsetNewpage.cpp | 2 --
src/insets/InsetPhantom.cpp | 9 ---------
src/insets/InsetPhantom.h | 2 --
src/insets/InsetPreview.cpp | 2 --
src/insets/InsetSpace.cpp | 2 --
src/insets/InsetSpecialChar.cpp | 2 --
src/insets/InsetVSpace.cpp | 2 --
src/mathed/CommandInset.cpp | 2 --
src/mathed/InsetMathGrid.cpp | 2 --
src/mathed/InsetMathHull.cpp | 5 -----
src/mathed/MathMacroTemplate.cpp | 2 --
16 files changed, 0 insertions(+), 49 deletions(-)
diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp
index c00f27e..21d54e0 100644
--- a/src/insets/Inset.cpp
+++ b/src/insets/Inset.cpp
@@ -625,12 +625,6 @@ ColorCode Inset::labelColor() const
}
-void Inset::setDimCache(MetricsInfo const & mi, Dimension const & dim) const
-{
- mi.base.bv->coordCache().insets().add(this, dim);
-}
-
-
Buffer const * Inset::updateFrontend() const
{
//FIXME (Abdel 03/12/10): see bugs #6814 and #6949
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index 1b3f85e..4f6db3a 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -216,8 +216,6 @@ public:
int xo(BufferView const & bv) const;
/// last drawn position for 'important' insets
int yo(BufferView const & bv) const;
- ///
- void setDimCache(MetricsInfo const &, Dimension const &) const;
/// do we cover screen position x/y?
bool covers(BufferView const & bv, int x, int y) const;
/// get the screen positions of the cursor (see note in Cursor.cpp)
diff --git a/src/insets/InsetIPA.cpp b/src/insets/InsetIPA.cpp
index a574da8..29ed000 100644
--- a/src/insets/InsetIPA.cpp
+++ b/src/insets/InsetIPA.cpp
@@ -188,8 +188,6 @@ void InsetIPA::metrics(MetricsInfo & mi, Dimension & dim)
const
dim.des += TEXT_TO_INSET_OFFSET;
// insert a one pixel gap
dim.wid += 1;
- // Cache the inset dimension.
- setDimCache(mi, dim);
Dimension dim_dummy;
MetricsInfo mi_dummy = mi;
InsetText::metrics(mi_dummy, dim_dummy);
diff --git a/src/insets/InsetIPAMacro.cpp b/src/insets/InsetIPAMacro.cpp
index bf3cab5..7852486 100644
--- a/src/insets/InsetIPAMacro.cpp
+++ b/src/insets/InsetIPAMacro.cpp
@@ -173,9 +173,6 @@ void InsetIPADeco::metrics(MetricsInfo & mi, Dimension &
dim) const
theFontMetrics(font).rectText(label, w, a, d);
dim.des += int(d * 1.5);
}
-
- // cache the inset dimension
- setDimCache(mi, dim);
}
@@ -413,7 +410,6 @@ void InsetIPAChar::metrics(MetricsInfo & mi, Dimension &
dim) const
}
docstring ds(s.begin(), s.end());
dim.wid = fm.width(ds);
- setDimCache(mi, dim);
}
diff --git a/src/insets/InsetLine.cpp b/src/insets/InsetLine.cpp
index 46e017f..dc75aa4 100644
--- a/src/insets/InsetLine.cpp
+++ b/src/insets/InsetLine.cpp
@@ -132,9 +132,6 @@ void InsetLine::metrics(MetricsInfo & mi, Dimension & dim)
const
dim.asc = max(fm.maxAscent(), offset_ + height_);
dim.des = max(fm.maxDescent(), - offset_);
-
- // Cache the inset dimension
- setDimCache(mi, dim);
}
diff --git a/src/insets/InsetNewpage.cpp b/src/insets/InsetNewpage.cpp
index b369ce1..e83f56d 100644
--- a/src/insets/InsetNewpage.cpp
+++ b/src/insets/InsetNewpage.cpp
@@ -103,8 +103,6 @@ void InsetNewpage::metrics(MetricsInfo & mi, Dimension &
dim) const
dim.asc = defaultRowHeight();
dim.des = defaultRowHeight();
dim.wid = mi.base.textwidth;
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
diff --git a/src/insets/InsetPhantom.cpp b/src/insets/InsetPhantom.cpp
index 78bc55e..8a156ea 100644
--- a/src/insets/InsetPhantom.cpp
+++ b/src/insets/InsetPhantom.cpp
@@ -135,15 +135,6 @@ docstring InsetPhantom::layoutName() const
}
-void InsetPhantom::metrics(MetricsInfo & mi, Dimension & dim) const
-{
- InsetCollapsable::metrics(mi, dim);
-
- // cache the inset dimension
- setDimCache(mi, dim);
-}
-
-
void InsetPhantom::draw(PainterInfo & pi, int x, int y) const
{
// draw the text
diff --git a/src/insets/InsetPhantom.h b/src/insets/InsetPhantom.h
index fad5063..42c3da1 100644
--- a/src/insets/InsetPhantom.h
+++ b/src/insets/InsetPhantom.h
@@ -62,8 +62,6 @@ private:
///
docstring layoutName() const;
///
- void metrics(MetricsInfo &, Dimension &) const;
- ///
void draw(PainterInfo & pi, int x, int y) const;
///
void write(std::ostream &) const;
diff --git a/src/insets/InsetPreview.cpp b/src/insets/InsetPreview.cpp
index 739322b..c306ae9 100644
--- a/src/insets/InsetPreview.cpp
+++ b/src/insets/InsetPreview.cpp
@@ -174,8 +174,6 @@ void InsetPreview::metrics(MetricsInfo & mi, Dimension &
dim) const
dim.des += TEXT_TO_INSET_OFFSET;
// insert a one pixel gap
dim.wid += 1;
- // Cache the inset dimension.
- setDimCache(mi, dim);
Dimension dim_dummy;
MetricsInfo mi_dummy = mi;
InsetText::metrics(mi_dummy, dim_dummy);
diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp
index 7d76f3f..6593d04 100644
--- a/src/insets/InsetSpace.cpp
+++ b/src/insets/InsetSpace.cpp
@@ -260,8 +260,6 @@ void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim)
const
// shut up compiler
break;
}
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
diff --git a/src/insets/InsetSpecialChar.cpp b/src/insets/InsetSpecialChar.cpp
index b6bcb47..4626205 100644
--- a/src/insets/InsetSpecialChar.cpp
+++ b/src/insets/InsetSpecialChar.cpp
@@ -129,8 +129,6 @@ void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension
& dim) const
}
if (dim.wid == 0)
dim.wid = fm.width(s);
-
- setDimCache(mi, dim);
}
diff --git a/src/insets/InsetVSpace.cpp b/src/insets/InsetVSpace.cpp
index 461933c..d4e1aaf 100644
--- a/src/insets/InsetVSpace.cpp
+++ b/src/insets/InsetVSpace.cpp
@@ -150,8 +150,6 @@ void InsetVSpace::metrics(MetricsInfo & mi, Dimension &
dim) const
dim.asc = height / 2 + (a - d) / 2; // align cursor with the
dim.des = height - dim.asc; // label text
dim.wid = ADD_TO_VSPACE_WIDTH + 2 * vspace_arrow_size + 5 + w;
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
diff --git a/src/mathed/CommandInset.cpp b/src/mathed/CommandInset.cpp
index 6b94664..0c9e585 100644
--- a/src/mathed/CommandInset.cpp
+++ b/src/mathed/CommandInset.cpp
@@ -43,8 +43,6 @@ void CommandInset::metrics(MetricsInfo & mi, Dimension & dim)
const
button_.update(screenLabel(), true);
}
button_.metrics(mi, dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index fca8f38..72adce7 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -589,8 +589,6 @@ void InsetMathGrid::metrics(MetricsInfo & mi, Dimension &
dim) const
*/
dim.wid += leftMargin() + rightMargin();
metricsMarkers2(mi, dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 4027707..807475e 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -515,8 +515,6 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension &
dim) const
if (display())
dim.des += displayMargin();
}
- // Cache the inset dimension.
- setDimCache(mi, dim);
return;
}
@@ -550,9 +548,6 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension &
dim) const
math_font_max_dim(mi.base.font, asc, des);
dim.asc = max(dim.asc, asc);
dim.des = max(dim.des, des);
- // Cache the inset dimension.
- // FIXME: This will overwrite InsetMathGrid dimension, is that OK?
- setDimCache(mi, dim);
}
diff --git a/src/mathed/MathMacroTemplate.cpp b/src/mathed/MathMacroTemplate.cpp
index 2a7dc77..2ac8703 100644
--- a/src/mathed/MathMacroTemplate.cpp
+++ b/src/mathed/MathMacroTemplate.cpp
@@ -578,8 +578,6 @@ void MathMacroTemplate::metrics(MetricsInfo & mi, Dimension
& dim) const
dim.wid += 6;
dim.des += 2;
dim.asc += 2;
-
- setDimCache(mi, dim);
}