From: Jürgen Vigna Date: Fri, 12 Apr 2002 08:22:16 +0000 (+0000) Subject: Give fullRow insets a full row width, small bugfix, force rebreak of row when X-Git-Tag: 1.6.10~19428 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1dc3f4deb3f9071ecc6f5516db4e0fb1bca40c9d;p=features.git Give fullRow insets a full row width, small bugfix, force rebreak of row when inserting an inset (fix #292 hopefully). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3978 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 39925bdbfd..454ae73f1a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2002-04-12 Juergen Vigna + + * text.C (leftMargin): return LYX_PAPER_MARGIN if this row contains + an inset which uses the whole row! + (rightMargin): ditto. + (insertChar): force a rebreak if we inserted an inset! + 2002-03-28 Herbert Voss * lyxlength.[Ch]: add inBP() to get the right PS-point @@ -6,6 +13,7 @@ 2002-04-11 Juergen Vigna * text2.C (setCursorFromCoordinates): set iy to the right value. + (setCursor): add check if row->previous exists! * buffer.C (parseSingleLyXformat2Token): reset font after read of an old float_type as this was the case in the old code! diff --git a/src/text.C b/src/text.C index 7bbca3dfee..73690c491e 100644 --- a/src/text.C +++ b/src/text.C @@ -690,6 +690,12 @@ void LyXText::draw(DrawRowParams & p, pos_type & vpos) // exactly the label-width. int LyXText::leftMargin(BufferView * bview, Row const * row) const { + Inset * ins; + if ((row->par()->getChar(row->pos()) == Paragraph::META_INSET) && + (ins=row->par()->getInset(row->pos())) && + (ins->needFullRow() || ins->display())) + return LYX_PAPER_MARGIN; + LyXTextClass const & tclass = textclasslist[bview->buffer()->params.textclass]; LyXLayout const & layout = tclass[row->par()->layout()]; @@ -866,6 +872,12 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const int LyXText::rightMargin(Buffer const * buf, Row const * row) const { + Inset * ins; + if ((row->par()->getChar(row->pos()) == Paragraph::META_INSET) && + (ins=row->par()->getInset(row->pos())) && + (ins->needFullRow() || ins->display())) + return LYX_PAPER_MARGIN; + LyXTextClass const & tclass = textclasslist[buf->params.textclass]; LyXLayout const & layout = tclass[row->par()->layout()]; @@ -1937,12 +1949,12 @@ void LyXText::insertChar(BufferView * bview, char c) } // Is there a break one row above - if ((cursor.par()->isLineSeparator(cursor.pos()) - || cursor.par()->isNewline(cursor.pos()) - || ((cursor.pos() < cursor.par()->size()) && - cursor.par()->isInset(cursor.pos()+1)) - || cursor.row()->fill() == -1) - && row->previous() && row->previous()->par() == row->par()) + if (row->previous() && row->previous()->par() == row->par() + && (cursor.par()->isLineSeparator(cursor.pos()) + || cursor.par()->isNewline(cursor.pos()) + || ((cursor.pos() < cursor.par()->size()) && + cursor.par()->isInset(cursor.pos()+1)) + || cursor.row()->fill() == -1)) { pos_type z = nextBreakPoint(bview, row->previous(), @@ -1990,7 +2002,7 @@ void LyXText::insertChar(BufferView * bview, char c) * will set fill to -1. Otherwise * we would not get a rebreak! */ row->fill(fill(bview, row, workWidth(bview))); - if (row->fill() < 0) { + if (c == Paragraph::META_INSET || row->fill() < 0) { refresh_y = y; refresh_row = row; refresh_x = cursor.x(); @@ -2088,7 +2100,8 @@ void LyXText::prepareToPrint(BufferView * bview, x = (workWidth(bview) > 0) ? rightMargin(bview->buffer(), row) : 0; } else - x = (workWidth(bview) > 0) ? leftMargin(bview, row) : 0; + x = (workWidth(bview) > 0) + ? leftMargin(bview, row) : 0; // is there a manual margin with a manual label LyXTextClass const & tclass = textclasslist[bview->buffer()->params.textclass]; diff --git a/src/text2.C b/src/text2.C index 7ce0ae4a61..0057a8600f 100644 --- a/src/text2.C +++ b/src/text2.C @@ -2070,7 +2070,8 @@ void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par, // the end of the previous row cur.iy(y + row->baseline()); Inset * ins; - if (pos && par->getChar(pos) == Paragraph::META_INSET && + if (row->previous() && pos && + par->getChar(pos) == Paragraph::META_INSET && (ins=par->getInset(pos)) && (ins->needFullRow() || ins->display())) { row = row->previous();