int maxDesc = 0;
for (col_type j = 0; j < tabular.columns(); ++j) {
if (tabular.isPartOfMultiColumn(i, j))
+ // Multicolumn cell, but not first one
continue;
Dimension dim;
MetricsInfo m = mi;
- LyXLength p_width = tabular.column_info[j].p_width;
+ LyXLength p_width;
+ if (tabular.cell_info[i][j].multicolumn ==
+ LyXTabular::CELL_BEGIN_OF_MULTICOLUMN)
+ p_width = tabular.cellinfo_of_cell(cell).p_width;
+ else
+ p_width = tabular.column_info[j].p_width;
if (!p_width.zero())
m.base.textwidth = p_width.inPixels(mi.base.textwidth);
tabular.getCellInset(cell)->metrics(m, dim);
void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
{
- lyxerr << "# InsetTabular::doDispatch: cmd: " << cmd << endl;
- lyxerr << " cur:\n" << cur << endl;
+ lyxerr[Debug::DEBUG] << "# InsetTabular::doDispatch: cmd: " << cmd
+ << "\n cur:" << cur << endl;
CursorSlice sl = cur.top();
LCursor & bvcur = cur.bv().cursor();
case LFUN_RIGHTSEL:
case LFUN_RIGHT:
cell(cur.idx())->dispatch(cur, cmd);
- cur.dispatched(); // override the cell's decision
- if (sl == cur.top())
+ if (!cur.result().dispatched()) {
isRightToLeft(cur) ? movePrevCell(cur) : moveNextCell(cur);
- if (sl == cur.top()) {
- cmd = FuncRequest(LFUN_FINISHED_RIGHT);
- cur.undispatched();
+ if (sl == cur.top())
+ cmd = FuncRequest(LFUN_FINISHED_RIGHT);
+ else
+ cur.dispatched();
}
break;
case LFUN_LEFTSEL:
case LFUN_LEFT:
cell(cur.idx())->dispatch(cur, cmd);
- cur.dispatched(); // override the cell's decision
- if (sl == cur.top())
+ if (!cur.result().dispatched()) {
isRightToLeft(cur) ? moveNextCell(cur) : movePrevCell(cur);
- if (sl == cur.top()) {
- cmd = FuncRequest(LFUN_FINISHED_LEFT);
- cur.undispatched();
+ if (sl == cur.top())
+ cmd = FuncRequest(LFUN_FINISHED_LEFT);
+ else
+ cur.dispatched();
}
break;
case LFUN_CUT:
if (tablemode(cur)) {
if (copySelection(cur)) {
- recordUndo(cur, Undo::DELETE);
+ recordUndoInset(cur, Undo::DELETE);
cutSelection(cur);
}
}
case LFUN_BACKSPACE:
case LFUN_DELETE:
- recordUndo(cur, Undo::DELETE);
- if (tablemode(cur))
+ if (tablemode(cur)) {
+ recordUndoInset(cur, Undo::DELETE);
cutSelection(cur);
+ }
else
cell(cur.idx())->dispatch(cur, cmd);
break;
case LFUN_PASTE:
if (hasPasteBuffer() && tabularStackDirty()) {
- recordUndo(cur, Undo::INSERT);
+ recordUndoInset(cur, Undo::INSERT);
pasteSelection(cur);
break;
}
break;
}
- recordUndo(cur, Undo::ATOMIC);
+ recordUndoInset(cur, Undo::ATOMIC);
getSelection(cur, sel_row_start, sel_row_end, sel_col_start, sel_col_end);
row_type const row = tabular.row_of_cell(cur.idx());
case LyXTabular::SET_PWIDTH: {
LyXLength const len(value);
- tabular.setColumnPWidth(cur.idx(), len);
+ tabular.setColumnPWidth(cur, cur.idx(), len);
if (len.zero()
&& tabular.getAlignment(cur.idx(), true) == LYX_ALIGN_BLOCK)
tabularFeatures(cur, LyXTabular::ALIGN_CENTER, string());
- else if (!len.zero()
- && tabular.getAlignment(cur.idx(), true) != LYX_ALIGN_BLOCK)
- tabularFeatures(cur, LyXTabular::ALIGN_BLOCK, string());
break;
}
case LyXTabular::SET_MPWIDTH:
- tabular.setMColumnPWidth(cur.idx(), LyXLength(value));
+ tabular.setMColumnPWidth(cur, cur.idx(), LyXLength(value));
break;
case LyXTabular::SET_SPECIAL_COLUMN:
}
-bool InsetTabular::forceDefaultParagraphs(InsetBase const *) const
+bool InsetTabular::forceDefaultParagraphs(idx_type cell) const
{
-#if 0
- idx_type const cell = tabular.getCellFromInset(in);
- // FIXME: getCellFromInset() returns now always a valid cell, so
- // the stuff below can be deleted, and instead we have:
return tabular.getPWidth(cell).zero();
-
- if (cell != npos)
- return tabular.getPWidth(cell).zero();
-
- // this is a workaround for a crash (New, Insert->Tabular,
- // Insert->FootNote)
- if (!owner())
- return false;
-
- // well we didn't obviously find it so maybe our owner knows more
- BOOST_ASSERT(owner());
- return owner()->forceDefaultParagraphs(in);
-#endif
- return false;
}