* InsetTabular.cpp: Make sure the caption is inserted in the correct cell. This means we first have to reset the cursor to point to the new multicolumn, and then insert the caption.

See:
http://www.lyx.org/trac/changeset/28440

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28651 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-03-01 15:50:46 +00:00
parent 439588d206
commit ab3be86f96

View File

@ -1750,9 +1750,6 @@ Tabular::idx_type Tabular::setLTCaption(row_type row, bool what)
setBottomLine(i, false);
setLeftLine(i, false);
setRightLine(i, false);
// When a row is set as caption, then also insert a caption. Otherwise
// the LaTeX output is broken, when the user don't add a caption.
dispatch(FuncRequest(LFUN_CAPTION_INSERT));
} else {
unsetMultiColumn(i);
// FIXME: when unsetting a caption row, also all existing captions
@ -4769,12 +4766,18 @@ void InsetTabular::tabularFeatures(Cursor & cur,
tabular.setLTNewPage(row, !tabular.getLTNewPage(row));
break;
case Tabular::TOGGLE_LTCAPTION:
cur.idx() = tabular.setLTCaption(row, !tabular.ltCaption(row));
case Tabular::TOGGLE_LTCAPTION: {
bool set = !tabular.ltCaption(row);
cur.idx() = tabular.setLTCaption(row, set);
cur.pit() = 0;
cur.pos() = 0;
cur.setSelection(false);
// When a row is set as caption, then also insert a caption. Otherwise
// the LaTeX output is broken, when the user doesn't add a caption.
if (set)
lyx::dispatch(FuncRequest(LFUN_CAPTION_INSERT));
break;
}
case Tabular::SET_BOOKTABS:
tabular.use_booktabs = true;