From a8e8e755fc32233e91bf787d5032fd81147d0909 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 27 May 2003 13:55:03 +0000 Subject: [PATCH] rename the members of Dimension * dimension.[Ch]: a -> asc, d -> des, w -> wid git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7053 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 ++++ src/dimension.C | 16 +++++------ src/dimension.h | 22 ++++++++-------- src/insets/ChangeLog | 16 +++++++++++ src/insets/insetbutton.C | 6 ++--- src/insets/insetcollapsable.C | 14 +++++----- src/insets/inseterror.C | 6 ++--- src/insets/insetgraphics.C | 8 +++--- src/insets/insetlatexaccent.C | 20 +++++++------- src/insets/insetminipage.C | 14 +++++----- src/insets/insetnewline.C | 6 ++--- src/insets/insetquotes.C | 12 ++++----- src/insets/insetspace.C | 14 +++++----- src/insets/insetspecialchar.C | 10 +++---- src/insets/insettabular.C | 6 ++--- src/insets/insettext.C | 44 +++++++++++++++---------------- src/mathed/ChangeLog | 5 ++++ src/mathed/button_inset.C | 8 +++--- src/mathed/formula.C | 10 +++---- src/mathed/formulamacro.C | 10 +++---- src/mathed/math_amsarrayinset.C | 3 +-- src/mathed/math_biginset.C | 7 +++-- src/mathed/math_binominset.C | 6 ++--- src/mathed/math_braceinset.C | 8 +++--- src/mathed/math_casesinset.C | 2 +- src/mathed/math_charinset.C | 10 +++---- src/mathed/math_data.C | 2 +- src/mathed/math_data.h | 12 ++++----- src/mathed/math_decorationinset.C | 8 +++--- src/mathed/math_deliminset.C | 12 ++++----- src/mathed/math_diminset.C | 6 ++--- src/mathed/math_dotsinset.C | 2 +- src/mathed/math_fracinset.C | 12 ++++----- src/mathed/math_frameboxinset.C | 2 +- src/mathed/math_gridinset.C | 12 ++++----- src/mathed/math_hullinset.C | 16 +++++------ src/mathed/math_kerninset.C | 6 ++--- src/mathed/math_lefteqninset.C | 6 ++--- src/mathed/math_macro.C | 18 ++++++------- src/mathed/math_macrotemplate.C | 6 ++--- src/mathed/math_makeboxinset.C | 2 +- src/mathed/math_nestinset.C | 10 +++---- src/mathed/math_rootinset.C | 6 ++--- src/mathed/math_scriptinset.C | 24 ++++++++--------- src/mathed/math_spaceinset.C | 26 +++++++++--------- src/mathed/math_sqrtinset.C | 12 ++++----- src/mathed/math_stackrelinset.C | 6 ++--- src/mathed/math_support.C | 20 +++++++------- src/mathed/math_symbolinset.C | 10 +++---- src/mathed/math_undersetinset.C | 6 ++--- src/mathed/math_xarrowinset.C | 6 ++--- src/undo_funcs.C | 20 +++++--------- 52 files changed, 287 insertions(+), 269 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 583a2e75fc..39d56ec09c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ + +2003-05-27 André Pönitz + + * dimension.[Ch]: a -> asc, d -> des, w -> wid + 2003-05-27 Jean-Marc Lasgouttes * lyxfont.C (latexWriteStartChanges): fix character count for \noun diff --git a/src/dimension.C b/src/dimension.C index f7fdd75089..efe6ec387b 100644 --- a/src/dimension.C +++ b/src/dimension.C @@ -17,17 +17,17 @@ void Dimension::operator+=(Dimension const & dim) { - if (a < dim.a) - a = dim.a; - if (d < dim.d) - d = dim.d; - w += dim.w; + if (asc < dim.asc) + asc = dim.asc; + if (des < dim.des) + des = dim.des; + wid += dim.wid; } void Dimension::clear(LyXFont const & font) { - a = font_metrics::maxAscent(font); - d = font_metrics::maxDescent(font); - w = 0; + asc = font_metrics::maxAscent(font); + des = font_metrics::maxDescent(font); + wid = 0; } diff --git a/src/dimension.h b/src/dimension.h index 7fe34b34d6..2b732584ff 100644 --- a/src/dimension.h +++ b/src/dimension.h @@ -21,29 +21,29 @@ class LyXFont; struct Dimension { public: /// constructor - Dimension() : w(0), a(0), d(0) {} + Dimension() : wid(0), asc(0), des(0) {} /// initialize data - Dimension(int ww, int aa, int dd) : w(ww), a(aa), d(dd) {} + Dimension(int w, int a, int d) : wid(w), asc(a), des(d) {} /// glue horizontally void operator+=(Dimension const & dim); /// set to empty box - void clear() { w = a = d = 0; } + void clear() { wid = asc = des = 0; } /// set to empty box suitble for given font void clear(LyXFont const & font); /// get height - int height() const { return a + d; } + int height() const { return asc + des; } /// get ascent - int ascent() const { return a; } + int ascent() const { return asc; } /// get descent - int descent() const { return d; } + int descent() const { return des; } /// get width - int width() const { return w; } + int width() const { return wid; } public: /// these are intentionally public as things like /// - /// dim.a += 20; + /// dim.asc += 20; /// /// are used all over the place and "hiding" those behind /// @@ -51,11 +51,11 @@ public: /// /// makes the code neither faster nor clearer /// width - int w; + int wid; /// ascent - int a; + int asc; /// descent - int d; + int des; }; #endif diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index db9980c9e3..6808d777e8 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,19 @@ + +2003-05-27 André Pönitz + + * insetbutton.C: + * insetcollapsable.C: + * inseterror.C: + * insetgraphics.C: + * insetlatexaccent.C: + * insetminipage.C: + * insetnewline.C: + * insetquotes.C: + * insetspace.C: + * insetspecialchar.C: + * insettabular.C: + * insettext.C: dim.w -> dim.wid + 2003-05-26 John Levon * insettabular.C: avoid drawing all of a long table diff --git a/src/insets/insetbutton.C b/src/insets/insetbutton.C index 7367a638ac..bac1e65c34 100644 --- a/src/insets/insetbutton.C +++ b/src/insets/insetbutton.C @@ -38,11 +38,11 @@ void InsetButton::dimension(BufferView * bv, LyXFont const &, string const s = getScreenLabel(bv->buffer()); if (editable()) - font_metrics::buttonText(s, font, dim.w, dim.a, dim.d); + font_metrics::buttonText(s, font, dim.wid, dim.asc, dim.des); else - font_metrics::rectText(s, font, dim.w, dim.a, dim.d); + font_metrics::rectText(s, font, dim.wid, dim.asc, dim.des); - dim.w += 4; + dim.wid += 4; } diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 811c1317eb..89f9a82de3 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -125,16 +125,16 @@ void InsetCollapsable::read(Buffer const * buf, LyXLex & lex) void InsetCollapsable::dimension_collapsed(Dimension & dim) const { - font_metrics::buttonText(label, labelfont, dim.w, dim.a, dim.d); - dim.w += 2 * TEXT_TO_INSET_OFFSET; + font_metrics::buttonText(label, labelfont, dim.wid, dim.asc, dim.des); + dim.wid += 2 * TEXT_TO_INSET_OFFSET; } int InsetCollapsable::height_collapsed() const { Dimension dim; - font_metrics::buttonText(label, labelfont, dim.w, dim.a, dim.d); - return dim.a + dim.d; + font_metrics::buttonText(label, labelfont, dim.wid, dim.asc, dim.des); + return dim.asc + dim.des; } @@ -146,8 +146,8 @@ void InsetCollapsable::dimension(BufferView * bv, LyXFont const & font, return; Dimension insetdim; inset.dimension(bv, font, insetdim); - dim.d += insetdim.height() + TEXT_TO_BOTTOM_OFFSET; - dim.w = max(dim.w, insetdim.width()); + dim.des += insetdim.height() + TEXT_TO_BOTTOM_OFFSET; + dim.wid = max(dim.wid, insetdim.width()); } @@ -158,7 +158,7 @@ void InsetCollapsable::draw_collapsed(Painter & pain, baseline, label, labelfont); Dimension dim; dimension_collapsed(dim); - x += dim.w; + x += dim.wid; } diff --git a/src/insets/inseterror.C b/src/insets/inseterror.C index 27147233ce..a0dd7e9a64 100644 --- a/src/insets/inseterror.C +++ b/src/insets/inseterror.C @@ -65,9 +65,9 @@ void InsetError::dimension(BufferView *, LyXFont const & font, { LyXFont efont; efont.setSize(font.size()).decSize(); - dim.a = font_metrics::maxAscent(efont) + 1; - dim.d = font_metrics::maxDescent(efont) + 1; - dim.w = 6 + font_metrics::width(_("Error"), efont); + dim.asc = font_metrics::maxAscent(efont) + 1; + dim.des = font_metrics::maxDescent(efont) + 1; + dim.wid = 6 + font_metrics::width(_("Error"), efont); } diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 63152f4e7d..11b5945d30 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -308,10 +308,10 @@ void InsetGraphics::dimension(BufferView *, LyXFont const & font, cache_->old_ascent = 50; if (imageIsDrawable()) cache_->old_ascent = cache_->loader.image()->getHeight(); - dim.a = cache_->old_ascent; - dim.d = 0; + dim.asc = cache_->old_ascent; + dim.des = 0; if (imageIsDrawable()) - dim.w = cache_->loader.image()->getWidth() + 2 * TEXT_TO_INSET_OFFSET; + dim.wid = cache_->loader.image()->getWidth() + 2 * TEXT_TO_INSET_OFFSET; else { int font_width = 0; @@ -330,7 +330,7 @@ void InsetGraphics::dimension(BufferView *, LyXFont const & font, font_width = std::max(font_width, font_metrics::width(msg, msgFont)); } - dim.w = std::max(50, font_width + 15); + dim.wid = std::max(50, font_width + 15); } } diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index d7027507e4..b5e51eb57b 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -272,24 +272,24 @@ void InsetLatexAccent::dimension(BufferView *, LyXFont const & font, // used and add to max based on that. if (candisp) { if (ic == ' ') - dim.a = font_metrics::ascent('a', font); + dim.asc = font_metrics::ascent('a', font); else - dim.a = font_metrics::ascent(ic, font); + dim.asc = font_metrics::ascent(ic, font); if (plusasc) - dim.a += (font_metrics::maxAscent(font) + 3) / 3; + dim.asc += (font_metrics::maxAscent(font) + 3) / 3; if (ic == ' ') - dim.d = font_metrics::descent('a', font); + dim.des = font_metrics::descent('a', font); else - dim.d = font_metrics::descent(ic, font); + dim.des = font_metrics::descent(ic, font); if (plusdesc) - dim.d += 3; + dim.des += 3; - dim.w = font_metrics::width(ic, font); + dim.wid = font_metrics::width(ic, font); } else { - dim.a = font_metrics::maxAscent(font) + 4; - dim.d = font_metrics::maxDescent(font) + 4; - dim.w = font_metrics::width(contents, font) + 4; + dim.asc = font_metrics::maxAscent(font) + 4; + dim.des = font_metrics::maxDescent(font) + 4; + dim.wid = font_metrics::width(contents, font) + 4; } } diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index d6ea2a3bfc..e58e7ecaa2 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -239,16 +239,16 @@ void InsetMinipage::dimension(BufferView * bv, LyXFont const & font, InsetCollapsable::dimension(bv, font, dim); switch (params_.pos) { case top: - dim.a = d.a; - dim.d = d.d; + dim.asc = d.asc; + dim.des = d.des; break; case center: - dim.a = d.height() / 2; - dim.d = dim.a; + dim.asc = d.height() / 2; + dim.des = dim.asc; break; case bottom: - dim.a = d.d; - dim.d = d.a; + dim.asc = d.des; + dim.des = d.asc; break; } } @@ -288,7 +288,7 @@ int InsetMinipage::latex(Buffer const * buf, ostream & os, bool InsetMinipage::insetAllowed(Inset::Code code) const { - if ((code == Inset::FLOAT_CODE) || (code == Inset::MARGIN_CODE)) + if (code == Inset::FLOAT_CODE || code == Inset::MARGIN_CODE) return false; return InsetCollapsable::insetAllowed(code); diff --git a/src/insets/insetnewline.C b/src/insets/insetnewline.C index 6e92e72444..dd38c7490d 100644 --- a/src/insets/insetnewline.C +++ b/src/insets/insetnewline.C @@ -40,9 +40,9 @@ void InsetNewline::write(Buffer const *, ostream & os) const void InsetNewline::dimension(BufferView *, LyXFont const & font, Dimension & dim) const { - dim.a = font_metrics::maxAscent(font); - dim.d = font_metrics::maxDescent(font); - dim.w = font_metrics::width('n', font); + dim.asc = font_metrics::maxAscent(font); + dim.des = font_metrics::maxDescent(font); + dim.wid = font_metrics::width('n', font); } diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 5f0b6491e2..3a336968f3 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -173,18 +173,18 @@ string const InsetQuotes::dispString(Language const * loclang) const void InsetQuotes::dimension(BufferView *, LyXFont const & font, Dimension & dim) const { - dim.a = font_metrics::maxAscent(font); - dim.d = font_metrics::maxDescent(font); - dim.w = 0; + dim.asc = font_metrics::maxAscent(font); + dim.des = font_metrics::maxDescent(font); + dim.wid = 0; string const text = dispString(font.language()); for (string::size_type i = 0; i < text.length(); ++i) { if (text[i] == ' ') - dim.w += font_metrics::width('i', font); + dim.wid += font_metrics::width('i', font); else if (i == 0 || text[i] != text[i - 1]) - dim.w += font_metrics::width(text[i], font); + dim.wid += font_metrics::width(text[i], font); else - dim.w += font_metrics::width(',', font); + dim.wid += font_metrics::width(',', font); } } diff --git a/src/insets/insetspace.C b/src/insets/insetspace.C index d0b15c8903..dcceb3b655 100644 --- a/src/insets/insetspace.C +++ b/src/insets/insetspace.C @@ -43,27 +43,27 @@ InsetSpace::Kind InsetSpace::kind() const void InsetSpace::dimension(BufferView *, LyXFont const & font, Dimension & dim) const { - dim.a = font_metrics::maxAscent(font); - dim.d = font_metrics::maxDescent(font); + dim.asc = font_metrics::maxAscent(font); + dim.des = font_metrics::maxDescent(font); switch (kind_) { case THIN: case NEGTHIN: - dim.w = font_metrics::width("x", font) / 3; + dim.wid = font_metrics::width("x", font) / 3; break; case PROTECTED: case NORMAL: - dim.w = font_metrics::width("x", font); + dim.wid = font_metrics::width("x", font); break; case QUAD: - dim.w = 20; + dim.wid = 20; break; case QQUAD: - dim.w = 40; + dim.wid = 40; break; case ENSPACE: case ENSKIP: - dim.w = 10; + dim.wid = 10; break; } } diff --git a/src/insets/insetspecialchar.C b/src/insets/insetspecialchar.C index b43100020f..31e8c0a9ca 100644 --- a/src/insets/insetspecialchar.C +++ b/src/insets/insetspecialchar.C @@ -41,8 +41,8 @@ InsetSpecialChar::Kind InsetSpecialChar::kind() const void InsetSpecialChar::dimension(BufferView *, LyXFont const & font, Dimension & dim) const { - dim.a = font_metrics::maxAscent(font); - dim.d = font_metrics::maxDescent(font); + dim.asc = font_metrics::maxAscent(font); + dim.des = font_metrics::maxDescent(font); string s; switch (kind_) { @@ -52,9 +52,9 @@ void InsetSpecialChar::dimension(BufferView *, LyXFont const & font, case MENU_SEPARATOR: s = " x "; break; case HYPHENATION: s = "-"; break; } - dim.w = font_metrics::width(s, font); - if (kind_ == HYPHENATION && dim.w > 5) - dim.w -= 2; // to make it look shorter + dim.wid = font_metrics::width(s, font); + if (kind_ == HYPHENATION && dim.wid > 5) + dim.wid -= 2; // to make it look shorter } diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 8342529be1..d22eb5de66 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -272,9 +272,9 @@ void InsetTabular::read(Buffer const * buf, LyXLex & lex) void InsetTabular::dimension(BufferView *, LyXFont const &, Dimension & dim) const { - dim.a = tabular->GetAscentOfRow(0); - dim.d = tabular->GetHeightOfTabular() - tabular->GetAscentOfRow(0) + 1; - dim.w = tabular->GetWidthOfTabular() + 2 * ADD_TO_TABULAR_WIDTH; + dim.asc = tabular->GetAscentOfRow(0); + dim.des = tabular->GetHeightOfTabular() - tabular->GetAscentOfRow(0) + 1; + dim.wid = tabular->GetWidthOfTabular() + 2 * ADD_TO_TABULAR_WIDTH; } diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 57dc7ccbba..ffcd351f4f 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -344,10 +344,10 @@ void InsetText::dimension(BufferView * bv, LyXFont const &, Dimension & dim) const { LyXText * text = getLyXText(bv); - dim.a = text->rows().begin()->ascent_of_text() + TEXT_TO_INSET_OFFSET; - dim.d = text->height - dim.a + TEXT_TO_INSET_OFFSET; - dim.w = max(textWidth(bv), int(text->width)) + 2 * TEXT_TO_INSET_OFFSET; - dim.w = max(dim.w, 10); + dim.asc = text->rows().begin()->ascent_of_text() + TEXT_TO_INSET_OFFSET; + dim.des = text->height - dim.asc + TEXT_TO_INSET_OFFSET; + dim.wid = max(textWidth(bv), int(text->width)) + 2 * TEXT_TO_INSET_OFFSET; + dim.wid = max(dim.wid, 10); // cache it dim_ = dim; } @@ -402,11 +402,11 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, x += static_cast(scroll()); top_baseline = baseline; - top_y = baseline - dim_.a; + top_y = baseline - dim_.asc; - if (last_drawn_width != dim_.w) { + if (last_drawn_width != dim_.wid) { need_update |= FULL; - last_drawn_width = dim_.w; + last_drawn_width = dim_.wid; } if (the_locking_inset && (cpar(bv) == inset_par) @@ -462,7 +462,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, drawFrame(pain, int(start_x)); } - x += dim_.w - TEXT_TO_INSET_OFFSET; + x += dim_.wid - TEXT_TO_INSET_OFFSET; if (need_update != INIT) { need_update = NONE; @@ -476,9 +476,9 @@ void InsetText::drawFrame(Painter & pain, int x) const { static int const ttoD2 = TEXT_TO_INSET_OFFSET / 2; frame_x = x + ttoD2; - frame_y = top_baseline - dim_.a + ttoD2; - frame_w = dim_.w - TEXT_TO_INSET_OFFSET; - frame_h = dim_.a + dim_.d - TEXT_TO_INSET_OFFSET; + frame_y = top_baseline - dim_.asc + ttoD2; + frame_w = dim_.wid - TEXT_TO_INSET_OFFSET; + frame_h = dim_.asc + dim_.des - TEXT_TO_INSET_OFFSET; pain.rectangle(frame_x, frame_y, frame_w, frame_h, frame_color); } @@ -852,7 +852,7 @@ void InsetText::lfunMousePress(FuncRequest const & cmd) lockInset(bv); int tmp_x = cmd.x - drawTextXOffset; - int tmp_y = cmd.y + dim_.a - getLyXText(bv)->top_y(); + int tmp_y = cmd.y + dim_.asc - getLyXText(bv)->top_y(); Inset * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y); if (the_locking_inset) { @@ -895,7 +895,7 @@ void InsetText::lfunMousePress(FuncRequest const & cmd) int old_top_y = lt->top_y(); lt->setCursorFromCoordinates(cmd.x - drawTextXOffset, - cmd.y + dim_.a); + cmd.y + dim_.asc); // set the selection cursor! lt->selection.cursor = lt->cursor; lt->cursor.x_fix(lt->cursor.x()); @@ -944,7 +944,7 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd) return the_locking_inset->localDispatch(cmd1); int tmp_x = cmd.x - drawTextXOffset; - int tmp_y = cmd.y + dim_.a - getLyXText(bv)->top_y(); + int tmp_y = cmd.y + dim_.asc - getLyXText(bv)->top_y(); Inset * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y); bool ret = false; if (inset) { @@ -995,7 +995,7 @@ void InsetText::lfunMouseMotion(FuncRequest const & cmd) } LyXCursor cur = lt->cursor; lt->setCursorFromCoordinates - (cmd.x - drawTextXOffset, cmd.y + dim_.a); + (cmd.x - drawTextXOffset, cmd.y + dim_.asc); lt->cursor.x_fix(lt->cursor.x()); if (cur == lt->cursor) { if (clear) @@ -1057,7 +1057,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & cmd) // FIXME: GUII I've changed this to none: probably WRONG if (!checkAndActivateInset(bv, cmd.x, tmp_y, mouse_button::none)) { lt->setCursorFromCoordinates(cmd.x - drawTextXOffset, - cmd.y + dim_.a); + cmd.y + dim_.asc); lt->cursor.x_fix(lt->cursor.x()); } } @@ -1938,7 +1938,7 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y, { x -= drawTextXOffset; int dummyx = x; - int dummyy = y + dim_.a; + int dummyy = y + dim_.asc; Inset * inset = getLyXText(bv)->checkInsetHit(dummyx, dummyy); // we only do the edit() call if the inset was hit by the mouse // or if it is a highly editable inset. So we should call this @@ -1950,9 +1950,9 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y, if (inset) { if (x < 0) - x = dim_.w; + x = dim_.wid; if (y < 0) - y = dim_.d; + y = dim_.des; inset_x = cix(bv) - top_x + drawTextXOffset; inset_y = ciy(bv) + drawTextYOffset; FuncRequest cmd(bv, LFUN_INSET_EDIT, x - inset_x, y - inset_y, button); @@ -2404,9 +2404,9 @@ void InsetText::clearSelection(BufferView * bv) void InsetText::clearInset(BufferView * bv, int start_x, int baseline) const { Painter & pain = bv->painter(); - int w = dim_.w; - int h = dim_.a + dim_.d; - int ty = baseline - dim_.a; + int w = dim_.wid; + int h = dim_.asc + dim_.des; + int ty = baseline - dim_.asc; if (ty < 0) { h += ty; diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index e4e6c52362..71ffdd4742 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,8 @@ + +2003-05-23 André Pönitz + + * *.C: dim.w -> dim.wid etc + 2003-05-26 Lars Gullik Bjønnes * remove same_id from function signatures, adjust diff --git a/src/mathed/button_inset.C b/src/mathed/button_inset.C index 91d6cfcbb1..e7d81e14a0 100644 --- a/src/mathed/button_inset.C +++ b/src/mathed/button_inset.C @@ -21,12 +21,12 @@ void ButtonInset::metrics(MetricsInfo & mi) const FontSetChanger dummy(mi.base, "textnormal"); if (editing()) { MathNestInset::metrics(mi); - dim_.w = cell(0).width() + cell(1).width() + 4; - dim_.a = max(cell(0).ascent(), cell(1).ascent()); - dim_.d = max(cell(0).descent(), cell(1).descent()); + dim_.wid = cell(0).width() + cell(1).width() + 4; + dim_.asc = max(cell(0).ascent(), cell(1).ascent()); + dim_.des = max(cell(0).descent(), cell(1).descent()); } else { mathed_string_dim(mi.base.font, screenLabel(), dim_); - dim_.w += 10; + dim_.wid += 10; } } diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 2a6575b9b3..0065c5d257 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -289,15 +289,15 @@ void InsetFormula::dimension(BufferView * bv, LyXFont const & font, { metrics(bv, font); if (preview_->previewReady()) { - dim.a = preview_->pimage()->ascent(); + dim.asc = preview_->pimage()->ascent(); int const descent = preview_->pimage()->descent(); - dim.d = display() ? descent + 12 : descent; + dim.des = display() ? descent + 12 : descent; // insert a one pixel gap in front of the formula - dim.w = 1 + preview_->pimage()->width(); + dim.wid = 1 + preview_->pimage()->width(); } else { dim = par_->dimensions(); - dim.a += 1; - dim.d += 1; + dim.asc += 1; + dim.des += 1; } } diff --git a/src/mathed/formulamacro.C b/src/mathed/formulamacro.C index 0358a4a328..c8b96229f7 100644 --- a/src/mathed/formulamacro.C +++ b/src/mathed/formulamacro.C @@ -146,9 +146,9 @@ void InsetFormulaMacro::dimension(BufferView * bv, LyXFont const & font, { metrics(bv, font); dim = par()->dimensions(); - dim.a += 5; - dim.d += 5; - dim.w += 10 + font_metrics::width(prefix(), font); + dim.asc += 5; + dim.des += 5; + dim.wid += 10 + font_metrics::width(prefix(), font); } @@ -184,8 +184,8 @@ void InsetFormulaMacro::draw(BufferView * bv, LyXFont const & f, Dimension dim; dimension(bv, font, dim); int const x = int(xx); - int const a = y - dim.a + 1; - int const w = dim.w - 2; + int const a = y - dim.asc + 1; + int const w = dim.wid - 2; int const h = dim.height() - 2; // LColor::mathbg used to be "AntiqueWhite" but is "linen" now, too diff --git a/src/mathed/math_amsarrayinset.C b/src/mathed/math_amsarrayinset.C index ca329ca041..16ab3802e7 100644 --- a/src/mathed/math_amsarrayinset.C +++ b/src/mathed/math_amsarrayinset.C @@ -1,6 +1,5 @@ #include - #include "math_amsarrayinset.h" #include "math_mathmlstream.h" #include "metricsinfo.h" @@ -64,7 +63,7 @@ void MathAMSArrayInset::metrics(MetricsInfo & mi) const if (m.base.style == LM_ST_DISPLAY) m.base.style = LM_ST_TEXT; MathGridInset::metrics(m); - dim_.w += 12; + dim_.wid += 12; } diff --git a/src/mathed/math_biginset.C b/src/mathed/math_biginset.C index ecceb7948f..5c02ff8207 100644 --- a/src/mathed/math_biginset.C +++ b/src/mathed/math_biginset.C @@ -1,6 +1,5 @@ #include - #include "math_biginset.h" #include "math_support.h" #include "math_parser.h" @@ -41,9 +40,9 @@ void MathBigInset::metrics(MetricsInfo & mi) const { double const h = mathed_char_ascent(mi.base.font, 'I'); double const f = increase(); - dim_.w = 6; - dim_.a = int(h + f * h); - dim_.d = int(f * h); + dim_.wid = 6; + dim_.asc = int(h + f * h); + dim_.des = int(f * h); } diff --git a/src/mathed/math_binominset.C b/src/mathed/math_binominset.C index 88cc3ed8ba..9bb1e8de15 100644 --- a/src/mathed/math_binominset.C +++ b/src/mathed/math_binominset.C @@ -37,9 +37,9 @@ void MathBinomInset::metrics(MetricsInfo & mi) const ScriptChanger dummy(mi.base); cell(0).metrics(mi); cell(1).metrics(mi); - dim_.a = cell(0).height() + 4 + 5; - dim_.d = cell(1).height() + 4 - 5; - dim_.w = max(cell(0).width(), cell(1).width()) + 2 * dw() + 4; + dim_.asc = cell(0).height() + 4 + 5; + dim_.des = cell(1).height() + 4 - 5; + dim_.wid = max(cell(0).width(), cell(1).width()) + 2 * dw() + 4; } diff --git a/src/mathed/math_braceinset.C b/src/mathed/math_braceinset.C index b0213e2c38..69bea7dfcf 100644 --- a/src/mathed/math_braceinset.C +++ b/src/mathed/math_braceinset.C @@ -33,10 +33,10 @@ void MathBraceInset::metrics(MetricsInfo & mi) const cell(0).metrics(mi); Dimension t; mathed_char_dim(mi.base.font, '{', t); - wid_ = t.w; - dim_.a = max(cell(0).ascent(), t.a); - dim_.d = max(cell(0).descent(), t.d); - dim_.w = cell(0).width() + 2 * wid_; + wid_ = t.wid; + dim_.asc = max(cell(0).ascent(), t.asc); + dim_.des = max(cell(0).descent(), t.des); + dim_.wid = cell(0).width() + 2 * wid_; } diff --git a/src/mathed/math_casesinset.C b/src/mathed/math_casesinset.C index ae53aa089d..bc0f7d370e 100644 --- a/src/mathed/math_casesinset.C +++ b/src/mathed/math_casesinset.C @@ -23,7 +23,7 @@ MathInset * MathCasesInset::clone() const void MathCasesInset::metrics(MetricsInfo & mi) const { MathGridInset::metrics(mi); - dim_.w += 8; + dim_.wid += 8; } diff --git a/src/mathed/math_charinset.C b/src/mathed/math_charinset.C index f19371233c..f5192cb4a9 100644 --- a/src/mathed/math_charinset.C +++ b/src/mathed/math_charinset.C @@ -72,9 +72,9 @@ void MathCharInset::metrics(MetricsInfo & mi) const } int const em = mathed_char_width(mi.base.font, 'M'); if (isBinaryOp(char_)) - dim_.w += static_cast(0.5*em+0.5); + dim_.wid += static_cast(0.5*em+0.5); else if (char_ == '\'') - dim_.w += static_cast(0.1667*em+0.5); + dim_.wid += static_cast(0.1667*em+0.5); #else whichFont(font_, code_, mi); mathed_char_dim(font_, char_, dim_); @@ -114,9 +114,9 @@ void MathCharInset::draw(PainterInfo & pi, int x, int y) const void MathCharInset::metricsT(TextMetricsInfo const &) const { - dim_.w = 1; - dim_.a = 1; - dim_.d = 0; + dim_.wid = 1; + dim_.asc = 1; + dim_.des = 0; } diff --git a/src/mathed/math_data.C b/src/mathed/math_data.C index 4e0c68db48..119313692e 100644 --- a/src/mathed/math_data.C +++ b/src/mathed/math_data.C @@ -215,7 +215,7 @@ Dimension const & MathArray::metrics(MetricsInfo & mi) const if (empty()) return dim_; - dim_.w = 0; + dim_.wid = 0; for (const_iterator it = begin(), et = end(); it != et; ++it) { (*it)->metrics(mi); dim_ += (*it)->dimensions(); diff --git a/src/mathed/math_data.h b/src/mathed/math_data.h index e66b7ca9d6..1d6728126a 100644 --- a/src/mathed/math_data.h +++ b/src/mathed/math_data.h @@ -120,9 +120,9 @@ public: /// access to cached y coordinate of last drawing int yo() const { return yo_; } /// access to cached x coordinate of mid point of last drawing - int xm() const { return xo_ + dim_.w / 2; } + int xm() const { return xo_ + dim_.wid / 2; } /// access to cached y coordinate of mid point of last drawing - int ym() const { return yo_ + (dim_.d - dim_.a) / 2; } + int ym() const { return yo_ + (dim_.des - dim_.asc) / 2; } /// write access to coordinate; void setXY(int x, int y) const; /// returns x coordinate of given position in the array @@ -138,13 +138,13 @@ public: int dist(int x, int y) const; /// ascent of this cell above the baseline - int ascent() const { return dim_.a; } + int ascent() const { return dim_.asc; } /// descent of this cell below the baseline - int descent() const { return dim_.d; } + int descent() const { return dim_.des; } /// height of the cell - int height() const { return dim_.a + dim_.d; } + int height() const { return dim_.asc + dim_.des; } /// width of this cell - int width() const { return dim_.w; } + int width() const { return dim_.wid; } /// dimensions of cell Dimension const & dim() const { return dim_; } /// dimensions of cell diff --git a/src/mathed/math_decorationinset.C b/src/mathed/math_decorationinset.C index fc8aee71a9..64078471aa 100644 --- a/src/mathed/math_decorationinset.C +++ b/src/mathed/math_decorationinset.C @@ -80,11 +80,11 @@ void MathDecorationInset::metrics(MetricsInfo & mi) const dw_ = 6; //mathed_char_width(LM_TC_VAR, mi, 'x'); if (upper()) { - dy_ = -dim_.a - dh_; - dim_.a += dh_ + 1; + dy_ = -dim_.asc - dh_; + dim_.asc += dh_ + 1; } else { - dy_ = dim_.d + 1; - dim_.d += dh_ + 2; + dy_ = dim_.des + 1; + dim_.des += dh_ + 2; } metricsMarkers(); diff --git a/src/mathed/math_deliminset.C b/src/mathed/math_deliminset.C index ea73243b1f..82b58813cf 100644 --- a/src/mathed/math_deliminset.C +++ b/src/mathed/math_deliminset.C @@ -89,12 +89,12 @@ void MathDelimInset::metrics(MetricsInfo & mi) const cell(0).metrics(mi); Dimension t; mathed_char_dim(mi.base.font, 'I', t); - int h0 = (t.a + t.d) / 2; - int a0 = max(cell(0).ascent(), t.a) - h0; - int d0 = max(cell(0).descent(), t.d) + h0; - dim_.a = max(a0, d0) + h0; - dim_.d = max(a0, d0) - h0; - dim_.w = cell(0).width() + 2 * dw() + 8; + int h0 = (t.asc + t.des) / 2; + int a0 = max(cell(0).ascent(), t.asc) - h0; + int d0 = max(cell(0).descent(), t.des) + h0; + dim_.asc = max(a0, d0) + h0; + dim_.des = max(a0, d0) - h0; + dim_.wid = cell(0).width() + 2 * dw() + 8; } diff --git a/src/mathed/math_diminset.C b/src/mathed/math_diminset.C index 6f35928e06..c2d0f9b404 100644 --- a/src/mathed/math_diminset.C +++ b/src/mathed/math_diminset.C @@ -12,9 +12,9 @@ void MathDimInset::metricsT(TextMetricsInfo const &) const /* std::ostringstream os; os << MathAtom(this); - dim_.w = int(os.str().size()); - dim_.a = 1; - dim_.d = 0; + dim_.wid = int(os.str().size()); + dim_.asc = 1; + dim_.des = 0; */ } diff --git a/src/mathed/math_dotsinset.C b/src/mathed/math_dotsinset.C index c322ada2b3..821ad4c70c 100644 --- a/src/mathed/math_dotsinset.C +++ b/src/mathed/math_dotsinset.C @@ -29,7 +29,7 @@ void MathDotsInset::metrics(MetricsInfo & mi) const else if (key_->name == "dotsc") dh_ = ascent() / 4; else if (key_->name == "vdots") { - dim_.w = (dim_.w / 2) + 1; + dim_.wid = (dim_.wid / 2) + 1; dh_ = ascent(); } else if (key_->name == "ddots") diff --git a/src/mathed/math_fracinset.C b/src/mathed/math_fracinset.C index 5af56d7b53..ea05d41c66 100644 --- a/src/mathed/math_fracinset.C +++ b/src/mathed/math_fracinset.C @@ -37,9 +37,9 @@ void MathFracInset::metrics(MetricsInfo & mi) const FracChanger dummy(mi.base); cell(0).metrics(mi); cell(1).metrics(mi); - dim_.w = max(cell(0).width(), cell(1).width()) + 2; - dim_.a = cell(0).height() + 2 + 5; - dim_.d = cell(1).height() + 2 - 5; + dim_.wid = max(cell(0).width(), cell(1).width()) + 2; + dim_.asc = cell(0).height() + 2 + 5; + dim_.des = cell(1).height() + 2 - 5; } @@ -58,9 +58,9 @@ void MathFracInset::metricsT(TextMetricsInfo const & mi) const { cell(0).metricsT(mi); cell(1).metricsT(mi); - dim_.w = max(cell(0).width(), cell(1).width()); - dim_.a = cell(0).height() + 1; - dim_.d = cell(1).height(); + dim_.wid = max(cell(0).width(), cell(1).width()); + dim_.asc = cell(0).height() + 1; + dim_.des = cell(1).height(); } diff --git a/src/mathed/math_frameboxinset.C b/src/mathed/math_frameboxinset.C index c2f804c2f8..a8381fb386 100644 --- a/src/mathed/math_frameboxinset.C +++ b/src/mathed/math_frameboxinset.C @@ -28,7 +28,7 @@ void MathFrameboxInset::metrics(MetricsInfo & mi) const dim_ = cell(0).dim(); dim_ += cell(1).dim(); dim_ += cell(2).dim(); - dim_.w += 4 * w_ + 4; + dim_.wid += 4 * w_ + 4; metricsMarkers2(5); // 5 pixels margin } diff --git a/src/mathed/math_gridinset.C b/src/mathed/math_gridinset.C index 65894947cf..c6310c7cb2 100644 --- a/src/mathed/math_gridinset.C +++ b/src/mathed/math_gridinset.C @@ -368,17 +368,17 @@ void MathGridInset::metrics(MetricsInfo & mi) const } - dim_.w = colinfo_[ncols() - 1].offset_ + dim_.wid = colinfo_[ncols() - 1].offset_ + colinfo_[ncols() - 1].width_ + vlinesep() * colinfo_[ncols()].lines_ + border(); - dim_.a = - rowinfo_[0].offset_ + dim_.asc = - rowinfo_[0].offset_ + rowinfo_[0].ascent_ + hlinesep() * rowinfo_[0].lines_ + border(); - dim_.d = rowinfo_[nrows() - 1].offset_ + dim_.des = rowinfo_[nrows() - 1].offset_ + rowinfo_[nrows() - 1].descent_ + hlinesep() * rowinfo_[nrows()].lines_ + border(); @@ -530,17 +530,17 @@ void MathGridInset::metricsT(TextMetricsInfo const & mi) const } - dim_.w = colinfo_[ncols() - 1].offset_ + dim_.wid = colinfo_[ncols() - 1].offset_ + colinfo_[ncols() - 1].width_ //+ vlinesep() * colinfo_[ncols()].lines_ + 2; - dim_.a = -rowinfo_[0].offset_ + dim_.asc = -rowinfo_[0].offset_ + rowinfo_[0].ascent_ //+ hlinesep() * rowinfo_[0].lines_ + 1; - dim_.d = rowinfo_[nrows() - 1].offset_ + dim_.des = rowinfo_[nrows() - 1].offset_ + rowinfo_[nrows() - 1].descent_ //+ hlinesep() * rowinfo_[nrows()].lines_ + 1; diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C index 14c7ff7bd4..4712712de2 100644 --- a/src/mathed/math_hullinset.C +++ b/src/mathed/math_hullinset.C @@ -175,8 +175,8 @@ void MathHullInset::metrics(MetricsInfo & mi) const MathGridInset::metrics(mi); if (display()) { - dim_.a += 12; - dim_.d += 12; + dim_.asc += 12; + dim_.des += 12; } if (numberedType()) { @@ -186,15 +186,15 @@ void MathHullInset::metrics(MetricsInfo & mi) const l = max(l, mathed_string_width(mi.base.font, nicelabel(row))); if (l) - dim_.w += 30 + l; + dim_.wid += 30 + l; } // make it at least as high as the current font int asc = 0; int des = 0; math_font_max_dim(mi.base.font, asc, des); - dim_.a = max(dim_.a, asc); - dim_.d = max(dim_.d, des); + dim_.asc = max(dim_.asc, asc); + dim_.des = max(dim_.des, des); // for markers metricsMarkers2(); @@ -228,9 +228,9 @@ void MathHullInset::metricsT(TextMetricsInfo const & mi) const ostringstream os; WriteStream wi(os, false, true); write(wi); - dim_.w = os.str().size(); - dim_.a = 1; - dim_.d = 0; + dim_.wid = os.str().size(); + dim_.asc = 1; + dim_.des = 0; } } diff --git a/src/mathed/math_kerninset.C b/src/mathed/math_kerninset.C index 9d7f7489e3..19658fa516 100644 --- a/src/mathed/math_kerninset.C +++ b/src/mathed/math_kerninset.C @@ -30,9 +30,9 @@ MathInset * MathKernInset::clone() const void MathKernInset::metrics(MetricsInfo & mi) const { - dim_.w = wid_.inPixels(0, mathed_char_width(mi.base.font, 'M')); - dim_.a = 0; - dim_.d = 0; + dim_.wid = wid_.inPixels(0, mathed_char_width(mi.base.font, 'M')); + dim_.asc = 0; + dim_.des = 0; } diff --git a/src/mathed/math_lefteqninset.C b/src/mathed/math_lefteqninset.C index febd73aafe..5d8a2e67e3 100644 --- a/src/mathed/math_lefteqninset.C +++ b/src/mathed/math_lefteqninset.C @@ -18,9 +18,9 @@ MathInset * MathLefteqnInset::clone() const void MathLefteqnInset::metrics(MetricsInfo & mi) const { cell(0).metrics(mi); - dim_.a = cell(0).ascent() + 2; - dim_.d = cell(0).descent() + 2; - dim_.w = 4; + dim_.asc = cell(0).ascent() + 2; + dim_.des = cell(0).descent() + 2; + dim_.wid = 4; metricsMarkers2(); } diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index 17c05dcbea..13aab1ae9b 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -84,17 +84,17 @@ void MathMacro::metrics(MetricsInfo & mi) const dim_ = expanded_.metrics(mi_); metricsMarkers2(2); - dim_.w += mathed_string_width(font_, name()) + 10; + dim_.wid += mathed_string_width(font_, name()) + 10; - Dimension ldim; - mathed_string_dim(font_, "#1: ", ldim); + Dimension dim; + mathed_string_dim(font_, "#1: ", dim); for (idx_type i = 0; i < nargs(); ++i) { MathArray const & c = cell(i); c.metrics(mi_); - dim_.w = max(dim_.w, c.width() + ldim.w); - dim_.d += max(c.ascent(), ldim.a) + 5; - dim_.d += max(c.descent(), ldim.d) + 5; + dim_.wid = max(dim_.wid, c.width() + dim.wid); + dim_.des += max(c.ascent(), dim.asc) + 5; + dim_.des += max(c.descent(), dim.des) + 5; } return; } @@ -131,12 +131,12 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const for (idx_type i = 0; i < nargs(); ++i) { MathArray const & c = cell(i); - h += max(c.ascent(), ldim.a) + 5; - c.draw(pi, x + ldim.w, h); + h += max(c.ascent(), ldim.asc) + 5; + c.draw(pi, x + ldim.wid, h); char str[] = "#1:"; str[1] += static_cast(i); drawStr(pi, texfont, x + 3, h, str); - h += max(c.descent(), ldim.d) + 5; + h += max(c.descent(), ldim.des) + 5; } return; } diff --git a/src/mathed/math_macrotemplate.C b/src/mathed/math_macrotemplate.C index 4f1ae017ec..1342198e05 100644 --- a/src/mathed/math_macrotemplate.C +++ b/src/mathed/math_macrotemplate.C @@ -66,9 +66,9 @@ void MathMacroTemplate::metrics(MetricsInfo & mi) const { cell(0).metrics(mi); cell(1).metrics(mi); - dim_.w = cell(0).width() + cell(1).width() + 10; - dim_.a = std::max(cell(0).ascent(), cell(1).ascent()) + 2; - dim_.d = std::max(cell(0).descent(), cell(1).descent()) + 2; + dim_.wid = cell(0).width() + cell(1).width() + 10; + dim_.asc = std::max(cell(0).ascent(), cell(1).ascent()) + 2; + dim_.des = std::max(cell(0).descent(), cell(1).descent()) + 2; } diff --git a/src/mathed/math_makeboxinset.C b/src/mathed/math_makeboxinset.C index 730604a58d..c2b6264da3 100644 --- a/src/mathed/math_makeboxinset.C +++ b/src/mathed/math_makeboxinset.C @@ -31,7 +31,7 @@ void MathMakeboxInset::metrics(MetricsInfo & mi) const dim_ = cell(0).dim(); dim_ += cell(1).dim(); dim_ += cell(2).dim(); - dim_.w += 4 * w_ + 4; + dim_.wid += 4 * w_ + 4; metricsMarkers2(); } diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index b4163ca3e7..d3954a3b49 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -60,16 +60,16 @@ void MathNestInset::metrics(MetricsInfo const & mi) const void MathNestInset::metricsMarkers(int frame) const { - dim_.d += frame; - dim_.w += 2 * frame; + dim_.des += frame; + dim_.wid += 2 * frame; } void MathNestInset::metricsMarkers2(int frame) const { - dim_.a += frame; - dim_.d += frame; - dim_.w += 2 * frame; + dim_.asc += frame; + dim_.des += frame; + dim_.wid += 2 * frame; } diff --git a/src/mathed/math_rootinset.C b/src/mathed/math_rootinset.C index 345b4c31ea..cd56b6b0db 100644 --- a/src/mathed/math_rootinset.C +++ b/src/mathed/math_rootinset.C @@ -34,9 +34,9 @@ MathInset * MathRootInset::clone() const void MathRootInset::metrics(MetricsInfo & mi) const { MathNestInset::metrics(mi); - dim_.a = max(cell(0).ascent() + 5, cell(1).ascent()) + 2; - dim_.d = max(cell(1).descent() + 5, cell(0).descent()) + 2; - dim_.w = cell(0).width() + cell(1).width() + 10; + dim_.asc = max(cell(0).ascent() + 5, cell(1).ascent()) + 2; + dim_.des = max(cell(1).descent() + 5, cell(0).descent()) + 2; + dim_.wid = cell(0).width() + cell(1).width() + 10; metricsMarkers(); } diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index c118f4be3c..ea01864bad 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -145,20 +145,20 @@ int MathScriptInset::dy1() const int MathScriptInset::dx0() const { lyx::Assert(hasDown()); - return hasLimits() ? (dim_.w - down().width()) / 2 : nwid(); + return hasLimits() ? (dim_.wid - down().width()) / 2 : nwid(); } int MathScriptInset::dx1() const { lyx::Assert(hasUp()); - return hasLimits() ? (dim_.w - up().width()) / 2 : nwid(); + return hasLimits() ? (dim_.wid - up().width()) / 2 : nwid(); } int MathScriptInset::dxx() const { - return hasLimits() ? (dim_.w - nwid()) / 2 : 0; + return hasLimits() ? (dim_.wid - nwid()) / 2 : 0; } @@ -186,22 +186,22 @@ void MathScriptInset::metrics(MetricsInfo & mi) const ScriptChanger dummy(mi.base); cell(0).metrics(mi); cell(1).metrics(mi); - dim_.w = 0; + dim_.wid = 0; if (hasLimits()) { - dim_.w = nwid(); + dim_.wid = nwid(); if (hasUp()) - dim_.w = max(dim_.w, up().width()); + dim_.wid = max(dim_.wid, up().width()); if (hasDown()) - dim_.w = max(dim_.w, down().width()); + dim_.wid = max(dim_.wid, down().width()); } else { if (hasUp()) - dim_.w = max(dim_.w, up().width()); + dim_.wid = max(dim_.wid, up().width()); if (hasDown()) - dim_.w = max(dim_.w, down().width()); - dim_.w += nwid(); + dim_.wid = max(dim_.wid, down().width()); + dim_.wid += nwid(); } - dim_.a = dy1() + (hasUp() ? up().ascent() : 0); - dim_.d = dy0() + (hasDown() ? down().descent() : 0); + dim_.asc = dy1() + (hasUp() ? up().ascent() : 0); + dim_.des = dy0() + (hasDown() ? down().descent() : 0); metricsMarkers2(); } diff --git a/src/mathed/math_spaceinset.C b/src/mathed/math_spaceinset.C index 101553962d..1dda4d5352 100644 --- a/src/mathed/math_spaceinset.C +++ b/src/mathed/math_spaceinset.C @@ -41,20 +41,20 @@ MathInset * MathSpaceInset::clone() const void MathSpaceInset::metrics(MetricsInfo &) const { switch (space_) { - case 0: dim_.w = 6; break; - case 1: dim_.w = 8; break; - case 2: dim_.w = 10; break; - case 3: dim_.w = 6; break; - case 4: dim_.w = 8; break; - case 5: dim_.w = 10; break; - case 6: dim_.w = 20; break; - case 7: dim_.w = 40; break; - case 8: dim_.w = -2; break; - case 9: dim_.w = 2; break; - default: dim_.w = 6; + case 0: dim_.wid = 6; break; + case 1: dim_.wid = 8; break; + case 2: dim_.wid = 10; break; + case 3: dim_.wid = 6; break; + case 4: dim_.wid = 8; break; + case 5: dim_.wid = 10; break; + case 6: dim_.wid = 20; break; + case 7: dim_.wid = 40; break; + case 8: dim_.wid = -2; break; + case 9: dim_.wid = 2; break; + default: dim_.wid = 6; } - dim_.a = 4; - dim_.d = 0; + dim_.asc = 4; + dim_.des = 0; } diff --git a/src/mathed/math_sqrtinset.C b/src/mathed/math_sqrtinset.C index 93f08762eb..de320a9c5d 100644 --- a/src/mathed/math_sqrtinset.C +++ b/src/mathed/math_sqrtinset.C @@ -20,9 +20,9 @@ MathInset * MathSqrtInset::clone() const void MathSqrtInset::metrics(MetricsInfo & mi) const { cell(0).metrics(mi); - dim_.a = cell(0).ascent() + 4; - dim_.d = cell(0).descent() + 2; - dim_.w = cell(0).width() + 12; + dim_.asc = cell(0).ascent() + 4; + dim_.des = cell(0).descent() + 2; + dim_.wid = cell(0).width() + 12; metricsMarkers(); } @@ -46,9 +46,9 @@ void MathSqrtInset::draw(PainterInfo & pi, int x, int y) const void MathSqrtInset::metricsT(TextMetricsInfo const & mi) const { cell(0).metricsT(mi); - dim_.a = cell(0).ascent() + 1; - dim_.d = cell(0).descent(); - dim_.w = cell(0).width() + 2; + dim_.asc = cell(0).ascent() + 1; + dim_.des = cell(0).descent(); + dim_.wid = cell(0).width() + 2; } diff --git a/src/mathed/math_stackrelinset.C b/src/mathed/math_stackrelinset.C index bb62d6e7a7..760903a3a7 100644 --- a/src/mathed/math_stackrelinset.C +++ b/src/mathed/math_stackrelinset.C @@ -22,9 +22,9 @@ void MathStackrelInset::metrics(MetricsInfo & mi) const cell(1).metrics(mi); FracChanger dummy(mi.base); cell(0).metrics(mi); - dim_.w = max(cell(0).width(), cell(1).width()) + 4; - dim_.a = cell(1).ascent() + cell(0).height() + 4; - dim_.d = cell(1).descent(); + dim_.wid = max(cell(0).width(), cell(1).width()) + 4; + dim_.asc = cell(1).ascent() + cell(0).height() + 4; + dim_.des = cell(1).descent(); } diff --git a/src/mathed/math_support.C b/src/mathed/math_support.C index a893da51ce..f85f7f62b5 100644 --- a/src/mathed/math_support.C +++ b/src/mathed/math_support.C @@ -348,9 +348,9 @@ deco_struct const * search_deco(string const & name) void mathed_char_dim(LyXFont const & font, unsigned char c, Dimension & dim) { - dim.d = font_metrics::descent(c, font); - dim.a = font_metrics::ascent(c, font); - dim.w = mathed_char_width(font, c); + dim.des = font_metrics::descent(c, font); + dim.asc = font_metrics::ascent(c, font); + dim.wid = mathed_char_width(font, c); } @@ -375,17 +375,17 @@ int mathed_char_width(LyXFont const & font, unsigned char c) void mathed_string_dim(LyXFont const & font, string const & s, Dimension & dim) { #if 1 - dim.a = 0; - dim.d = 0; + dim.asc = 0; + dim.des = 0; for (string::const_iterator it = s.begin(); it != s.end(); ++it) { - dim.a = max(dim.a, font_metrics::ascent(*it, font)); - dim.d = max(dim.d, font_metrics::descent(*it, font)); + dim.asc = max(dim.asc, font_metrics::ascent(*it, font)); + dim.des = max(dim.des, font_metrics::descent(*it, font)); } #else - dim.a = font_metrics::maxAscent(font); - dim.d = font_metrics::maxDescent(font); + dim.asc = font_metrics::maxAscent(font); + dim.des = font_metrics::maxDescent(font); #endif - dim.w = font_metrics::width(s, font); + dim.wid = font_metrics::width(s, font); } diff --git a/src/mathed/math_symbolinset.C b/src/mathed/math_symbolinset.C index 774366aa03..6e4d71b7ff 100644 --- a/src/mathed/math_symbolinset.C +++ b/src/mathed/math_symbolinset.C @@ -49,15 +49,15 @@ void MathSymbolInset::metrics(MetricsInfo & mi) const mathed_string_dim(mi.base.font, sym_->draw, dim_); // correct height for broken cmex and wasy font if (sym_->inset == "cmex" || sym_->inset == "wasy") { - h_ = 4 * dim_.d / 5; - dim_.a += h_; - dim_.d -= h_; + h_ = 4 * dim_.des / 5; + dim_.asc += h_; + dim_.des -= h_; } // seperate things a bit if (isRelOp()) - dim_.w += static_cast(0.5*em+0.5); + dim_.wid += static_cast(0.5*em+0.5); else - dim_.w += static_cast(0.1667*em+0.5); + dim_.wid += static_cast(0.1667*em+0.5); scriptable_ = false; if (mi.base.style == LM_ST_DISPLAY) diff --git a/src/mathed/math_undersetinset.C b/src/mathed/math_undersetinset.C index 5093baa814..07968726b5 100644 --- a/src/mathed/math_undersetinset.C +++ b/src/mathed/math_undersetinset.C @@ -22,9 +22,9 @@ void MathUndersetInset::metrics(MetricsInfo & mi) const cell(1).metrics(mi); FracChanger dummy(mi.base); cell(0).metrics(mi); - dim_.w = max(cell(0).width(), cell(1).width()) + 4; - dim_.a = cell(1).ascent(); - dim_.d = cell(1).descent() + cell(0).height() + 4; + dim_.wid = max(cell(0).width(), cell(1).width()) + 4; + dim_.asc = cell(1).ascent(); + dim_.des = cell(1).descent() + cell(0).height() + 4; } diff --git a/src/mathed/math_xarrowinset.C b/src/mathed/math_xarrowinset.C index d5ca0388ea..84951c97de 100644 --- a/src/mathed/math_xarrowinset.C +++ b/src/mathed/math_xarrowinset.C @@ -24,9 +24,9 @@ void MathXArrowInset::metrics(MetricsInfo & mi) const ScriptChanger dummy(mi.base); cell(0).metrics(mi); cell(1).metrics(mi); - dim_.w = std::max(cell(0).width(), cell(1).width()) + 10; - dim_.a = cell(0).height() + 10; - dim_.d = cell(1).height(); + dim_.wid = std::max(cell(0).width(), cell(1).width()) + 10; + dim_.asc = cell(0).height() + 10; + dim_.des = cell(1).height(); } diff --git a/src/undo_funcs.C b/src/undo_funcs.C index 4d895fbe32..3630619a4e 100644 --- a/src/undo_funcs.C +++ b/src/undo_funcs.C @@ -214,7 +214,6 @@ bool textHandleUndo(BufferView * bv, Undo & undo) bv->text->cursor.pos()); } - finishUndo(); bv->text->postPaint(0); @@ -223,8 +222,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo) bool createUndo(BufferView * bv, Undo::undo_kind kind, - ParagraphList::iterator itfirst, ParagraphList::iterator itlast, - shared_ptr & u) + int first_id, int last_id, shared_ptr & u) { Buffer * b = bv->buffer(); @@ -235,9 +233,6 @@ bool createUndo(BufferView * bv, Undo::undo_kind kind, ParIterator last = null; ParIterator behind = null; - int const first_id = itfirst->id(); - int const last_id = itlast->id(); - for (ParIterator it = b->par_iterator_begin(); it != null; ++it) { if ((*it)->id() == first_id) { first = it; @@ -331,8 +326,6 @@ bool textUndoOrRedo(BufferView * bv, limited_stack > & stack, limited_stack > & /*otherstack*/) { - //Buffer * b = bv->buffer(); - if (stack.empty()) { finishNoUndo(bv); return false; @@ -342,27 +335,28 @@ bool textUndoOrRedo(BufferView * bv, stack.pop(); finishUndo(); - if (!undo_frozen) { /* + if (!undo_frozen) { + Buffer * buf = bv->buffer(); ParIterator p = b->getParFromID(undo->number_of_before_par); + ParIterator const end = b->par_iterator_end(); bool ok = false; ParagraphList::iterator first; // default constructed? - ParIterator const end = b->par_iterator_end(); if (p != end) { first = p.par(); if (first->next()) first = first->next(); } else first = undoParagraphs(bv, undo->number_of_inset_id)->begin(); - if (first) { + if (ok) { shared_ptr u; ParIterator behind = b->getParFromID(undo->number_of_behind_par); if (createUndo(bv, undo->kind, first, behind.par(), u)) otherstack.push(u); } -*/ } +*/ // Now we can unlock the inset for saftey because the inset // pointer could be changed during the undo-function. Anyway @@ -427,7 +421,7 @@ void setUndo(BufferView * bv, Undo::undo_kind kind, //return; if (!undo_frozen) { shared_ptr u; - if (createUndo(bv, kind, first, last, u)) + if (createUndo(bv, kind, first->id(), last->id(), u)) bv->buffer()->undostack.push(u); bv->buffer()->redostack.clear(); } -- 2.39.2