From fb6af9a08a84b1c35356df4ecb6d8dfe31c8cf55 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 25 Sep 2007 07:41:03 +0000 Subject: [PATCH] Remove remnant of the past. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20481 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetSpace.cpp | 5 ++++- src/insets/InsetSpace.h | 4 ---- src/insets/InsetVSpace.cpp | 9 +++++---- src/insets/InsetVSpace.h | 4 ---- src/mathed/InsetMathBig.cpp | 6 ++++-- src/mathed/InsetMathBig.h | 2 -- src/mathed/InsetMathChar.h | 2 -- 7 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp index bb57145452..bbab7f278e 100644 --- a/src/insets/InsetSpace.cpp +++ b/src/insets/InsetSpace.cpp @@ -74,12 +74,15 @@ void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const dim.wid = 10; break; } + // Cache the inset dimension. + setDimCache(mi, dim); } void InsetSpace::draw(PainterInfo & pi, int x, int y) const { - int const w = dim_.wid; + Dimension const dim = dimension(*pi.base.bv); + int const w = dim.wid; int const h = theFontMetrics(pi.base.font) .ascent('x'); int xp[4], yp[4]; diff --git a/src/insets/InsetSpace.h b/src/insets/InsetSpace.h index 459afedcca..b254556185 100644 --- a/src/insets/InsetSpace.h +++ b/src/insets/InsetSpace.h @@ -58,8 +58,6 @@ public: /// void metrics(MetricsInfo &, Dimension &) const; /// - Dimension const dimension(BufferView const &) const { return dim_; }; - /// void draw(PainterInfo & pi, int x, int y) const; /// void write(Buffer const &, std::ostream &) const; @@ -94,8 +92,6 @@ private: /// And which kind is this? Kind kind_; - /// - mutable Dimension dim_; }; diff --git a/src/insets/InsetVSpace.cpp b/src/insets/InsetVSpace.cpp index f45801c7b6..0d630b5cdb 100644 --- a/src/insets/InsetVSpace.cpp +++ b/src/insets/InsetVSpace.cpp @@ -138,16 +138,17 @@ 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 * arrow_size + 5 + w; - dim_ = dim; + // Cache the inset dimension. + setDimCache(mi, dim); } void InsetVSpace::draw(PainterInfo & pi, int x, int y) const { + Dimension const dim = dimension(*pi.base.bv); x += ADD_TO_VSPACE_WIDTH; - - int const start = y - dim_.asc; - int const end = y + dim_.des; + int const start = y - dim.asc; + int const end = y + dim.des; // y-values for top arrow int ty1, ty2; diff --git a/src/insets/InsetVSpace.h b/src/insets/InsetVSpace.h index 916b440fa5..7d511d9b22 100644 --- a/src/insets/InsetVSpace.h +++ b/src/insets/InsetVSpace.h @@ -31,8 +31,6 @@ public: /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// - Dimension const dimension(BufferView const &) const { return dim_; }; - /// void draw(PainterInfo & pi, int x, int y) const; /// int latex(Buffer const &, odocstream &, @@ -63,8 +61,6 @@ private: /// VSpace space_; - /// - mutable Dimension dim_; }; diff --git a/src/mathed/InsetMathBig.cpp b/src/mathed/InsetMathBig.cpp index a5a0295fbf..117127e882 100644 --- a/src/mathed/InsetMathBig.cpp +++ b/src/mathed/InsetMathBig.cpp @@ -67,19 +67,21 @@ void InsetMathBig::metrics(MetricsInfo & mi, Dimension & dim) const dim.wid = 6; dim.asc = int(h + f * h); dim.des = int(f * h); - dim_ = dim; + // Cache the inset dimension. + setDimCache(mi, dim); } void InsetMathBig::draw(PainterInfo & pi, int x, int y) const { + Dimension const dim = dimension(*pi.base.bv); // mathed_draw_deco does not use the leading backslash, so remove it // (but don't use ltrim if this is the backslash delimiter). // Replace \| by \Vert (equivalent in LaTeX), since mathed_draw_deco // would treat it as |. docstring const delim = (delim_ == "\\|") ? from_ascii("Vert") : (delim_ == "\\\\") ? from_ascii("\\") : support::ltrim(delim_, "\\"); - mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 4, dim_.height(), + mathed_draw_deco(pi, x + 1, y - dim.ascent(), 4, dim.height(), delim); setPosCache(pi, x, y); } diff --git a/src/mathed/InsetMathBig.h b/src/mathed/InsetMathBig.h index ec590a094d..2736669b58 100644 --- a/src/mathed/InsetMathBig.h +++ b/src/mathed/InsetMathBig.h @@ -50,8 +50,6 @@ private: docstring const name_; /// ( or [ or \\Vert... docstring const delim_; - /// - mutable Dimension dim_; }; diff --git a/src/mathed/InsetMathChar.h b/src/mathed/InsetMathChar.h index 0b57bbe76a..3a65841c4f 100644 --- a/src/mathed/InsetMathChar.h +++ b/src/mathed/InsetMathChar.h @@ -55,8 +55,6 @@ private: char_type char_; /// cached kerning for superscript mutable int kerning_; - /// FIXME: move this out to BufferView - mutable Dimension dim_; }; } // namespace lyx