From e216ceee772cc0d4e2f24068c914de751f322083 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Mon, 16 Apr 2007 14:42:53 +0000 Subject: [PATCH] Fixed bug 3449 by Stefan Schimanski: http://bugzilla.lyx.org/show_bug.cgi?id=3449 One problem was no metric calculation was done for insets on cursor movement. Of course scrolling or entering character caused the missing metric calls, hence the described behavior in the bug report. This is fixed by re-implementing idxLast(), idxFirst() and notifyCursorLeaves(). Another problem was that 'a' and '1' were drawn at the same position because of a mis-calculation of the x-position in InsetMathMacro::draw(). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17826 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/InsetMathMacro.C | 25 +++++++++++++++++++++++-- src/mathed/InsetMathMacro.h | 6 ++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/mathed/InsetMathMacro.C b/src/mathed/InsetMathMacro.C index 5126e19ccc..43cbed7c31 100644 --- a/src/mathed/InsetMathMacro.C +++ b/src/mathed/InsetMathMacro.C @@ -105,8 +105,8 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const tmpl_.draw(pi, x + w + 12, h); h += tmpl_.descent(); Dimension ldim; - string t = "#1: "; - mathed_string_dim(font, name(), ldim); + docstring t = from_ascii("#1: "); + mathed_string_dim(font, t, ldim); for (idx_type i = 0; i < nargs(); ++i) { MathArray const & c = cell(i); h += max(c.ascent(), ldim.asc) + 5; @@ -156,6 +156,27 @@ InsetBase * MathMacro::editXY(LCursor & cur, int x, int y) } +bool MathMacro::idxFirst(LCursor & cur) const +{ + cur.updateFlags(Update::Force); + return InsetMathNest::idxFirst(cur); +} + + +bool MathMacro::idxLast(LCursor & cur) const +{ + cur.updateFlags(Update::Force); + return InsetMathNest::idxLast(cur); +} + + +bool MathMacro::notifyCursorLeaves(LCursor & cur) +{ + cur.updateFlags(Update::Force); + return InsetMathNest::notifyCursorLeaves(cur); +} + + void MathMacro::maple(MapleStream & os) const { updateExpansion(); diff --git a/src/mathed/InsetMathMacro.h b/src/mathed/InsetMathMacro.h index 478f08066c..cc2be0a014 100644 --- a/src/mathed/InsetMathMacro.h +++ b/src/mathed/InsetMathMacro.h @@ -43,6 +43,12 @@ public: bool boundary, int & x, int & y) const; /// InsetBase * editXY(LCursor & cur, int x, int y); + /// target pos when we enter the inset from the left by pressing "Right" + bool idxFirst(LCursor &) const; + /// target pos when we enter the inset from the right by pressing "Left" + bool idxLast(LCursor &) const; + /// + virtual bool notifyCursorLeaves(LCursor &); /// docstring name() const; /// -- 2.39.2