]> git.lyx.org Git - features.git/commitdiff
Fixed bug 3449 by Stefan Schimanski:
authorAbdelrazak Younes <younes@lyx.org>
Mon, 16 Apr 2007 14:42:53 +0000 (14:42 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 16 Apr 2007 14:42:53 +0000 (14:42 +0000)
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
src/mathed/InsetMathMacro.h

index 5126e19ccc1bda1b7fc651c93e4636caef62c3a1..43cbed7c315ab6e9bb8d1540c3f8d5bc6f7fcc8c 100644 (file)
@@ -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();
index 478f08066cf22d85ba395e4145da7f9ded9cf056..cc2be0a014847f8fc718ee4d86fbeb8d6e27b1d7 100644 (file)
@@ -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;
        ///