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
This commit is contained in:
Abdelrazak Younes 2007-04-16 14:42:53 +00:00
parent 3ad8ca04b9
commit e216ceee77
2 changed files with 29 additions and 2 deletions

View File

@ -105,8 +105,8 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const
tmpl_.draw(pi, x + w + 12, h); tmpl_.draw(pi, x + w + 12, h);
h += tmpl_.descent(); h += tmpl_.descent();
Dimension ldim; Dimension ldim;
string t = "#1: "; docstring t = from_ascii("#1: ");
mathed_string_dim(font, name(), ldim); mathed_string_dim(font, t, ldim);
for (idx_type i = 0; i < nargs(); ++i) { for (idx_type i = 0; i < nargs(); ++i) {
MathArray const & c = cell(i); MathArray const & c = cell(i);
h += max(c.ascent(), ldim.asc) + 5; 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 void MathMacro::maple(MapleStream & os) const
{ {
updateExpansion(); updateExpansion();

View File

@ -43,6 +43,12 @@ public:
bool boundary, int & x, int & y) const; bool boundary, int & x, int & y) const;
/// ///
InsetBase * editXY(LCursor & cur, int x, int y); 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; docstring name() const;
/// ///