} else
#endif
if (c == LyXParagraph::META_INSET) {
- Inset const * tmpinset = row->par()->GetInset(pos);
+ Inset * tmpinset = row->par()->GetInset(pos);
if (tmpinset) {
+ tmpinset->update(bview, font, false);
tmpinset->draw(bview, font, offset+row->baseline(), x,
cleared);
}
par->Last();
// this is the usual handling
int x = LeftMargin(bview, row);
- while (x < width && i < last) {
+ bool doitonetime = true;
+ while (doitonetime || ((x < width) && (i < last))) {
+ doitonetime = false;
char c = par->GetChar(i);
if (IsNewlineChar(c)) {
last_separator = i;
x = width; // this means break
} else if (c == LyXParagraph::META_INSET &&
- par->GetInset(i) && par->GetInset(i)->display()){
+ par->GetInset(i)) {
+
// check wether a Display() inset is
// valid here. if not, change it to
// non-display
- if (layout.isCommand()
- || (layout.labeltype == LABEL_MANUAL
- && i < BeginningOfMainBody(bview->buffer(), par))){
+ if (par->GetInset(i)->display() &&
+ (layout.isCommand() ||
+ ((layout.labeltype == LABEL_MANUAL) &&
+ (i < BeginningOfMainBody(bview->buffer(), par))))) {
// display istn't allowd
par->GetInset(i)->display(false);
x += SingleWidth(bview, par, i, c);
- } else {
- // inset is display. So break the line here
- if (i == pos){
+ } else if (par->GetInset(i)->display() ||
+ par->GetInset(i)->needFullRow()) {
+ // So break the line here
+ if (i == pos) {
if (pos < last-1) {
last_separator = i;
if (IsLineSeparatorChar(par->GetChar(i+1)))
} else
last_separator = i - 1;
x = width; // this means break
+ } else {
+#if 0
+ last_separator = i;
+ x += width;
+#else
+ x += SingleWidth(bview, par, i, c);
+#endif
}
} else {
if (IsLineSeparatorChar(c))
row_ptr->width(maxwidth+x);
if (inset_owner) {
Row * r = firstrow;
- width = 0;
+ width = max(0,workWidth(bview));
while(r) {
if (r->width() > width)
width = r->width();
Language const * lang = cursor.par()->getParLanguage(bview->buffer()->params);
LyXFont font(LyXFont::ALL_INHERIT,lang);
for (int i = 0; i < number; ++i) {
-#ifdef NEW_WAY
cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE, font);
-#else
- cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE);
- cursor.par()->SetFont(pos, font);
-#endif
}
/* append the row into the table */
Language const * lang = cursor.par()->getParLanguage(bview->buffer()->params);
LyXFont font(LyXFont::ALL_INHERIT,lang);
for (int i = 0; i < number; ++i) {
-#ifdef NEW_WAY
cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE, font);
-#else
- cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE);
- cursor.par()->SetFont(pos, font);
-#endif
}
/* append the row into the table */
do{
if (pos && (cursor.par()->IsNewline(pos-1))){
if (cursor.par()->table->AppendCellAfterCell(cell_org, cell)) {
-#ifdef NEW_WAY
cursor.par()->InsertChar(pos,
LyXParagraph::META_NEWLINE,
font);
-#else
- cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE);
- cursor.par()->SetFont(pos, font);
-#endif
if (pos <= cursor.pos())
cursor.pos(cursor.pos() + 1);
++pos;
This saves one byte memory per table ;-) */
if (cursor.par()->table->AppendCellAfterCell(cell_org, cell)) {
LyXParagraph::size_type last = cursor.par()->Last();
-#ifdef NEW_WAY
cursor.par()->InsertChar(last,
LyXParagraph::META_NEWLINE, font);
-#else
- cursor.par()->InsertChar(last, LyXParagraph::META_NEWLINE);
- cursor.par()->SetFont(last, font);
-#endif
}
/* append the column into the table */
// the display inset stuff
if (cursor.row()->par()->GetChar(cursor.row()->pos()) == LyXParagraph::META_INSET
&& cursor.row()->par()->GetInset(cursor.row()->pos())
- && cursor.row()->par()->GetInset(cursor.row()->pos())->display())
+ && (cursor.row()->par()->GetInset(cursor.row()->pos())->display() ||
+ cursor.row()->par()->GetInset(cursor.row()->pos())->needFullRow()))
cursor.row()->fill(-1); // to force a new break
// get the cursor row fist
return;
// force complete redo when erasing display insets
// this is a cruel method but safe..... Matthias
- if (cursor.par()->GetInset(cursor.pos())->display()){
+ if (cursor.par()->GetInset(cursor.pos())->display() ||
+ cursor.par()->GetInset(cursor.pos())->needFullRow()) {
cursor.par()->Erase(cursor.pos());
RedoParagraph(bview);
return;
void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
- Row * row_ptr, long y)
+ Row * row_ptr, long y, bool cleared)
{
/* returns a printed row */
Painter & pain = bview->painter();
PrepareToPrint(bview, row_ptr, x, fill_separator,
fill_hfill, fill_label_hfill);
+ if (inset_owner && (x < 0))
+ x = 0;
x += x_offset;
// clear the area where we want to paint/print
{
clear_area = inset->doClearArea();
}
- if (clear_area) {
+ if (cleared) { // we don't need to clear it's already done!!!
+ clear_area = true;
+ } else if (clear_area) {
int w;
if (inset_owner)
w = inset_owner->width(bview->painter(), font);