+2000-11-10 Juergen Vigna <jug@sad.it>
+
+ * src/insets/insettext.C (resizeLyXText): check !cache[bv]
+ (deleteLyXText): ditto
+
+ * src/insets/insettabular.C (InsetButtonPress): don't clear the
+ selection on mouse-button-3.
+
+ * src/insets/insettabular.h: new function clearSelection(), use this
+ functions inside insettabular.C.
+
+ * src/insets/insettabular.C (TabularFeatures): clear the selection
+ on remove_row/column.
+
+ * src/insets/inset.C (scroll): fixed some scroll stuff.
+
+ * src/insets/insettabular.C (draw): fixed another minor draw problem.
+
2000-11-10 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* lib/CREDITS: add Yves Bastide
locked = no_selection = cursor_visible = false;
cursor.x_fix(-1);
oldcell = -1;
- actcell = 0;
+ actrow = actcell = 0;
cursor.pos(0);
- sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
+ clearSelection();
need_update = INIT;
}
locked = no_selection = cursor_visible = false;
cursor.x_fix(-1);
oldcell = -1;
- actcell = 0;
+ actrow = actcell = 0;
cursor.pos(0);
sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
need_update = INIT;
}
i = tabular->row_of_cell(actcell);
if (the_locking_inset == tabular->GetCellInset(cell)) {
+#if 0
LyXText::text_status st = bv->text->status;
do {
cx = nx + tabular->GetBeginningOfTextInCell(cell);
baseline - tabular->GetAscentOfRow(i) + 1,
tabular->GetWidthOfColumn(cell) -
tabular->GetBeginningOfTextInCell(cell) -
- the_locking_inset->width(bv,font) - 1,
+ the_locking_inset->width(bv,font) -
+ tabular->GetAdditionalWidth(cell) - 1,
tabular->GetAscentOfRow(i) +
tabular->GetDescentOfRow(i) - 1);
}
tabular->GetCellInset(cell)->draw(bv,font,baseline, cx, false);
} while(bv->text->status == LyXText::CHANGED_IN_DRAW);
+#else
+ cx = nx + tabular->GetBeginningOfTextInCell(cell);
+ if (need_update == CELL) {
+ // clear before the inset
+ pain.fillRectangle(
+ nx + 1,
+ baseline - tabular->GetAscentOfRow(i) + 1,
+ int(cx - nx - 1),
+ tabular->GetAscentOfRow(i) +
+ tabular->GetDescentOfRow(i) - 1);
+ // clear behind the inset
+ pain.fillRectangle(
+ int(cx + the_locking_inset->width(bv,font) + 1),
+ baseline - tabular->GetAscentOfRow(i) + 1,
+ tabular->GetWidthOfColumn(cell) -
+ tabular->GetBeginningOfTextInCell(cell) -
+ the_locking_inset->width(bv,font) -
+ tabular->GetAdditionalWidth(cell) - 1,
+ tabular->GetAscentOfRow(i) +
+ tabular->GetDescentOfRow(i) - 1);
+ }
+ tabular->GetCellInset(cell)->draw(bv,font,baseline, cx, false);
+ if (bv->text->status == LyXText::CHANGED_IN_DRAW)
+ return;
+#endif
}
}
x -= ADD_TO_TABULAR_WIDTH;
void InsetTabular::InsetButtonPress(BufferView * bv, int x, int y, int button)
{
- if (hasSelection()) {
- sel_pos_start = sel_pos_end = sel_cell_start = sel_cell_end = 0;
+ if (hasSelection() && (button != 3)) {
+ clearSelection();
UpdateLocal(bv, SELECTION, false);
}
no_selection = false;
}
}
static int const offset = ADD_TO_TABULAR_WIDTH + 2;
- cursor.x(getCellXPos(actcell) + offset);
+ int new_x = getCellXPos(actcell);
+ new_x += offset;
+ cursor.x(new_x);
+// cursor.x(getCellXPos(actcell) + offset);
if (((cursor.x() - offset) > 20) &&
((cursor.x()-offset+tabular->GetWidthOfColumn(actcell)) >
(bv->workWidth()-20)))
if ((row+1) > tabular->rows())
--row;
actcell = tabular->GetCellNumber(row, column);
+ clearSelection();
UpdateLocal(bv, INIT, true);
break;
case LyXTabular::DELETE_COLUMN:
if ((column+1) > tabular->columns())
--column;
actcell = tabular->GetCellNumber(row, column);
+ clearSelection();
UpdateLocal(bv, INIT, true);
break;
case LyXTabular::M_TOGGLE_LINE_TOP:
if (need_update == INIT) {
resizeLyXText(bv);
need_update = FULL;
-// if (!owner() && bv->text)
-// bv->text->UpdateInset(bv, this);
}
int oldw = insetWidth;
#if 1
// textWidth(bv->painter()),static_cast<int>(TEXT(bv)->width));
resizeLyXText(bv);
need_update = FULL;
-#if 0
- if (owner()) {
- owner()->update(bv, font, reinit);
- return;
- } else {
- update(bv, font, reinit);
- }
-#else
-#if 1
update(bv, font, reinit);
-#else
- UpdateLocal(bv, INIT, false);
-#endif
-#endif
return;
}
if ((need_update==CURSOR_PAR) && (TEXT(bv)->status==LyXText::UNCHANGED) &&
void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
{
- if (cache.find(bv) == cache.end())
+ if ((cache.find(bv) == cache.end()) || !cache[bv])
return;
delete cache[bv];
cache.erase(bv);
{
if (!par->next && !par->size()) // resize not neccessary!
return;
- if (cache.find(bv) == cache.end())
+ if ((cache.find(bv) == cache.end()) || !cache[bv])
return;
LyXParagraph * lpar = 0;