mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
fix a few of the tabular crashes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7889 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
760829360d
commit
839576adbc
@ -1,3 +1,13 @@
|
|||||||
|
|
||||||
|
2003-10-10 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
|
* lyxfunc.C:
|
||||||
|
* lyxtext.h:
|
||||||
|
* tabular.C:
|
||||||
|
* text.C:
|
||||||
|
* text2.C:
|
||||||
|
* text3.C: fix some of the tabular crashes
|
||||||
|
|
||||||
2003-10-09 Lars Gullik Bjønnes <larsbj@lyx.org>
|
2003-10-09 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
* MenuBackend.C (binding): put debug message into Debug::KBMAP
|
* MenuBackend.C (binding): put debug message into Debug::KBMAP
|
||||||
|
@ -1300,7 +1300,7 @@ void InsetTabular::resetPos(BufferView * bv) const
|
|||||||
}
|
}
|
||||||
// we need this only from here on!!!
|
// we need this only from here on!!!
|
||||||
++in_reset_pos;
|
++in_reset_pos;
|
||||||
static int const offset = ADD_TO_TABULAR_WIDTH + 2;
|
int const offset = ADD_TO_TABULAR_WIDTH + 2;
|
||||||
int new_x = getCellXPos(actcell);
|
int new_x = getCellXPos(actcell);
|
||||||
int old_x = cursorx_;
|
int old_x = cursorx_;
|
||||||
new_x += offset;
|
new_x += offset;
|
||||||
@ -1633,12 +1633,11 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
|
|
||||||
case LyXTabular::SET_PWIDTH:
|
case LyXTabular::SET_PWIDTH:
|
||||||
{
|
{
|
||||||
LyXLength const vallen(value);
|
LyXLength const len(value);
|
||||||
LyXLength const & tmplen = tabular.getColumnPWidth(actcell);
|
LyXLength const & oldlen = tabular.getColumnPWidth(actcell);
|
||||||
|
|
||||||
bool const update = (tmplen != vallen);
|
tabular.setColumnPWidth(actcell, len);
|
||||||
tabular.setColumnPWidth(actcell, vallen);
|
if (oldlen != len) {
|
||||||
if (update) {
|
|
||||||
// We need this otherwise we won't resize
|
// We need this otherwise we won't resize
|
||||||
// the insettext of the active cell (if any)
|
// the insettext of the active cell (if any)
|
||||||
// until later (see InsetText::do_resize)
|
// until later (see InsetText::do_resize)
|
||||||
@ -1646,10 +1645,10 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
bv->update();
|
bv->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vallen.zero()
|
if (len.zero()
|
||||||
&& tabular.getAlignment(actcell, true) == LYX_ALIGN_BLOCK)
|
&& tabular.getAlignment(actcell, true) == LYX_ALIGN_BLOCK)
|
||||||
tabularFeatures(bv, LyXTabular::ALIGN_CENTER, string());
|
tabularFeatures(bv, LyXTabular::ALIGN_CENTER, string());
|
||||||
else if (!vallen.zero()
|
else if (!len.zero()
|
||||||
&& tabular.getAlignment(actcell, true) != LYX_ALIGN_BLOCK)
|
&& tabular.getAlignment(actcell, true) != LYX_ALIGN_BLOCK)
|
||||||
tabularFeatures(bv, LyXTabular::ALIGN_BLOCK, string());
|
tabularFeatures(bv, LyXTabular::ALIGN_BLOCK, string());
|
||||||
break;
|
break;
|
||||||
@ -1657,12 +1656,10 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
|
|
||||||
case LyXTabular::SET_MPWIDTH:
|
case LyXTabular::SET_MPWIDTH:
|
||||||
{
|
{
|
||||||
LyXLength const vallen(value);
|
LyXLength const len(value);
|
||||||
LyXLength const & tmplen = tabular.getPWidth(actcell);
|
LyXLength const & oldlen = tabular.getPWidth(actcell);
|
||||||
|
tabular.setMColumnPWidth(actcell, len);
|
||||||
bool const update = (tmplen != vallen);
|
if (oldlen != len) {
|
||||||
tabular.setMColumnPWidth(actcell, vallen);
|
|
||||||
if (update) {
|
|
||||||
// We need this otherwise we won't resize
|
// We need this otherwise we won't resize
|
||||||
// the insettext of the active cell (if any)
|
// the insettext of the active cell (if any)
|
||||||
// until later (see InsetText::do_resize)
|
// until later (see InsetText::do_resize)
|
||||||
@ -1681,7 +1678,6 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
unlockInsetInInset(bv, the_locking_inset);
|
unlockInsetInInset(bv, the_locking_inset);
|
||||||
tabular.appendRow(bv->buffer()->params(), actcell);
|
tabular.appendRow(bv->buffer()->params(), actcell);
|
||||||
tabular.setOwner(this);
|
tabular.setOwner(this);
|
||||||
//tabular.init(bv->buffer()->params(), tabular.rows(), tabular.columns());
|
|
||||||
updateLocal(bv);
|
updateLocal(bv);
|
||||||
break;
|
break;
|
||||||
case LyXTabular::APPEND_COLUMN:
|
case LyXTabular::APPEND_COLUMN:
|
||||||
@ -1689,7 +1685,6 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
unlockInsetInInset(bv, the_locking_inset);
|
unlockInsetInInset(bv, the_locking_inset);
|
||||||
tabular.appendColumn(bv->buffer()->params(), actcell);
|
tabular.appendColumn(bv->buffer()->params(), actcell);
|
||||||
tabular.setOwner(this);
|
tabular.setOwner(this);
|
||||||
//tabular.init(bv->buffer()->params(), tabular.rows(), tabular.columns());
|
|
||||||
actcell = tabular.getCellNumber(row, column);
|
actcell = tabular.getCellNumber(row, column);
|
||||||
updateLocal(bv);
|
updateLocal(bv);
|
||||||
break;
|
break;
|
||||||
@ -2309,7 +2304,8 @@ bool InsetTabular::cutSelection(BufferParams const & bp)
|
|||||||
|
|
||||||
for (int i = sel_row_start; i <= sel_row_end; ++i)
|
for (int i = sel_row_start; i <= sel_row_end; ++i)
|
||||||
for (int j = sel_col_start; j <= sel_col_end; ++j)
|
for (int j = sel_col_start; j <= sel_col_end; ++j)
|
||||||
tabular.getCellInset(tabular.getCellNumber(i, j)).clear(bp.tracking_changes);
|
tabular.getCellInset(tabular.getCellNumber(i, j))
|
||||||
|
.clear(bp.tracking_changes);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,13 +111,13 @@ void InsetText::init()
|
|||||||
top_y = 0;
|
top_y = 0;
|
||||||
|
|
||||||
locked = false;
|
locked = false;
|
||||||
inset_par = paragraphs.end();
|
inset_par = -1;
|
||||||
inset_pos = 0;
|
inset_pos = 0;
|
||||||
inset_x = 0;
|
inset_x = 0;
|
||||||
inset_y = 0;
|
inset_y = 0;
|
||||||
no_selection = true;
|
no_selection = true;
|
||||||
the_locking_inset = 0;
|
the_locking_inset = 0;
|
||||||
old_par = paragraphs.end();
|
old_par = -1;
|
||||||
in_insetAllowed = false;
|
in_insetAllowed = false;
|
||||||
mouse_x = 0;
|
mouse_x = 0;
|
||||||
mouse_y = 0;
|
mouse_y = 0;
|
||||||
@ -270,7 +270,8 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
|
|||||||
top_baseline = y;
|
top_baseline = y;
|
||||||
top_y = y - dim_.asc;
|
top_y = y - dim_.asc;
|
||||||
|
|
||||||
if (the_locking_inset && cpar() == inset_par && cpos() == inset_pos) {
|
if (the_locking_inset
|
||||||
|
&& text_.cursor.par() == inset_par && cpos() == inset_pos) {
|
||||||
inset_x = cx() - x;
|
inset_x = cx() - x;
|
||||||
inset_y = cy();
|
inset_y = cy();
|
||||||
}
|
}
|
||||||
@ -311,9 +312,9 @@ void InsetText::updateLocal(BufferView * bv, bool /*mark_dirty*/)
|
|||||||
bv->owner()->view_state_changed();
|
bv->owner()->view_state_changed();
|
||||||
bv->owner()->updateMenubar();
|
bv->owner()->updateMenubar();
|
||||||
bv->owner()->updateToolbar();
|
bv->owner()->updateToolbar();
|
||||||
if (old_par != cpar()) {
|
if (old_par != text_.cursor.par()) {
|
||||||
bv->owner()->setLayout(cpar()->layout()->name());
|
bv->owner()->setLayout(cpar()->layout()->name());
|
||||||
old_par = cpar();
|
old_par = text_.cursor.par();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,8 +356,8 @@ void InsetText::lockInset(BufferView * bv)
|
|||||||
the_locking_inset = 0;
|
the_locking_inset = 0;
|
||||||
inset_pos = inset_x = inset_y = 0;
|
inset_pos = inset_x = inset_y = 0;
|
||||||
inset_boundary = false;
|
inset_boundary = false;
|
||||||
inset_par = paragraphs.end();
|
inset_par = -1;
|
||||||
old_par = paragraphs.end();
|
old_par = -1;
|
||||||
text_.setCursorIntern(0, 0);
|
text_.setCursorIntern(0, 0);
|
||||||
text_.clearSelection();
|
text_.clearSelection();
|
||||||
finishUndo();
|
finishUndo();
|
||||||
@ -377,7 +378,7 @@ void InsetText::lockInset(BufferView * /*bv*/, UpdatableInset * inset)
|
|||||||
inset_x = cx() - top_x;
|
inset_x = cx() - top_x;
|
||||||
inset_y = cy();
|
inset_y = cy();
|
||||||
inset_pos = cpos();
|
inset_pos = cpos();
|
||||||
inset_par = cpar();
|
inset_par = text_.cursor.par();
|
||||||
inset_boundary = cboundary();
|
inset_boundary = cboundary();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,7 +419,7 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (the_locking_inset && the_locking_inset == inset) {
|
if (the_locking_inset && the_locking_inset == inset) {
|
||||||
if (cpar() == inset_par && cpos() == inset_pos) {
|
if (text_.cursor.par() == inset_par && cpos() == inset_pos) {
|
||||||
lyxerr[Debug::INSETS] << "OK" << endl;
|
lyxerr[Debug::INSETS] << "OK" << endl;
|
||||||
inset_x = cx() - top_x;
|
inset_x = cx() - top_x;
|
||||||
inset_y = cy();
|
inset_y = cy();
|
||||||
@ -444,7 +445,7 @@ bool InsetText::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
|
|||||||
the_locking_inset = 0;
|
the_locking_inset = 0;
|
||||||
if (lr)
|
if (lr)
|
||||||
moveRightIntern(bv, true, false);
|
moveRightIntern(bv, true, false);
|
||||||
old_par = paragraphs.end(); // force layout setting
|
old_par = -1; // force layout setting
|
||||||
if (scroll())
|
if (scroll())
|
||||||
scroll(bv, 0.0F);
|
scroll(bv, 0.0F);
|
||||||
else
|
else
|
||||||
@ -521,7 +522,7 @@ void InsetText::lfunMousePress(FuncRequest const & cmd)
|
|||||||
// we moved the view we cannot do mouse selection in this case!
|
// we moved the view we cannot do mouse selection in this case!
|
||||||
if (bv->top_y() != old_top_y)
|
if (bv->top_y() != old_top_y)
|
||||||
no_selection = true;
|
no_selection = true;
|
||||||
old_par = cpar();
|
old_par = text_.cursor.par();
|
||||||
// Insert primary selection with middle mouse
|
// Insert primary selection with middle mouse
|
||||||
// if there is a local selection in the current buffer,
|
// if there is a local selection in the current buffer,
|
||||||
// insert this
|
// insert this
|
||||||
@ -551,29 +552,13 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
|
|||||||
int tmp_x = cmd.x;
|
int tmp_x = cmd.x;
|
||||||
int tmp_y = cmd.y + dim_.asc - bv->top_y();
|
int tmp_y = cmd.y + dim_.asc - bv->top_y();
|
||||||
InsetOld * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y);
|
InsetOld * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y);
|
||||||
bool ret = false;
|
if (!inset)
|
||||||
if (inset) {
|
return false;
|
||||||
// This code should probably be removed now. Simple insets
|
|
||||||
// (!highlyEditable) can actually take the localDispatch,
|
|
||||||
// and turn it into edit() if necessary. But we still
|
|
||||||
// need to deal properly with the whole relative vs.
|
|
||||||
// absolute mouse co-ords thing in a realiable, sensible way
|
|
||||||
#if 0
|
|
||||||
if (isHighlyEditableInset(inset))
|
|
||||||
ret = inset->localDispatch(cmd1);
|
|
||||||
else {
|
|
||||||
inset_x = cx(bv) - top_x;
|
|
||||||
inset_y = cy();
|
|
||||||
cmd1.x = cmd.x - inset_x;
|
|
||||||
cmd1.y = cmd.x - inset_y;
|
|
||||||
inset->edit(bv, cmd1.x, cmd1.y, cmd.button());
|
|
||||||
ret = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ret = inset->localDispatch(cmd1);
|
|
||||||
updateLocal(bv, false);
|
|
||||||
|
|
||||||
}
|
// We still need to deal properly with the whole relative vs.
|
||||||
|
// absolute mouse co-ords thing in a realiable, sensible way
|
||||||
|
bool ret = inset->localDispatch(cmd1);
|
||||||
|
updateLocal(bv, false);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,8 +608,8 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd)
|
|||||||
inset_x = 0;
|
inset_x = 0;
|
||||||
inset_y = 0;
|
inset_y = 0;
|
||||||
inset_boundary = false;
|
inset_boundary = false;
|
||||||
inset_par = paragraphs.end();
|
inset_par = -1;
|
||||||
old_par = paragraphs.end();
|
old_par = -1;
|
||||||
|
|
||||||
|
|
||||||
if (cmd.argument.size()) {
|
if (cmd.argument.size()) {
|
||||||
@ -820,61 +805,57 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd)
|
|||||||
updflag = true;
|
updflag = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_PASTE: {
|
case LFUN_PASTE:
|
||||||
if (!autoBreakRows_) {
|
if (!autoBreakRows_) {
|
||||||
if (CutAndPaste::nrOfParagraphs() > 1) {
|
if (CutAndPaste::nrOfParagraphs() > 1) {
|
||||||
#ifdef WITH_WARNINGS
|
#ifdef WITH_WARNINGS
|
||||||
#warning FIXME horrendously bad UI
|
#warning FIXME horrendously bad UI
|
||||||
#endif
|
#endif
|
||||||
Alert::error(_("Paste failed"), _("Cannot include more than one paragraph."));
|
Alert::error(_("Paste failed"), _("Cannot include more than one paragraph."));
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
|
||||||
replaceSelection(bv->getLyXText());
|
replaceSelection(bv->getLyXText());
|
||||||
size_t sel_index = 0;
|
size_t sel_index = 0;
|
||||||
string const & arg = cmd.argument;
|
string const & arg = cmd.argument;
|
||||||
if (isStrUnsignedInt(arg)) {
|
if (isStrUnsignedInt(arg)) {
|
||||||
size_t const paste_arg = strToUnsignedInt(arg);
|
|
||||||
#warning FIXME Check if the arg is in the domain of available selections.
|
#warning FIXME Check if the arg is in the domain of available selections.
|
||||||
sel_index = paste_arg;
|
sel_index = strToUnsignedInt(arg);
|
||||||
}
|
}
|
||||||
text_.pasteSelection(sel_index);
|
text_.pasteSelection(sel_index);
|
||||||
// bug 393
|
// bug 393
|
||||||
text_.clearSelection();
|
text_.clearSelection();
|
||||||
updflag = true;
|
updflag = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case LFUN_BREAKPARAGRAPH:
|
case LFUN_BREAKPARAGRAPH:
|
||||||
if (!autoBreakRows_) {
|
if (!autoBreakRows_) {
|
||||||
result = DISPATCHED;
|
result = DISPATCHED;
|
||||||
break;
|
} else {
|
||||||
}
|
|
||||||
replaceSelection(bv->getLyXText());
|
replaceSelection(bv->getLyXText());
|
||||||
text_.breakParagraph(paragraphs, 0);
|
text_.breakParagraph(paragraphs, 0);
|
||||||
updflag = true;
|
updflag = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
|
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
|
||||||
if (!autoBreakRows_) {
|
if (!autoBreakRows_) {
|
||||||
result = DISPATCHED;
|
result = DISPATCHED;
|
||||||
break;
|
} else {
|
||||||
}
|
|
||||||
replaceSelection(bv->getLyXText());
|
replaceSelection(bv->getLyXText());
|
||||||
text_.breakParagraph(paragraphs, 1);
|
text_.breakParagraph(paragraphs, 1);
|
||||||
updflag = true;
|
updflag = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_BREAKLINE: {
|
case LFUN_BREAKLINE: {
|
||||||
if (!autoBreakRows_) {
|
if (!autoBreakRows_) {
|
||||||
result = DISPATCHED;
|
result = DISPATCHED;
|
||||||
break;
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
replaceSelection(bv->getLyXText());
|
replaceSelection(bv->getLyXText());
|
||||||
text_.insertInset(new InsetNewline);
|
text_.insertInset(new InsetNewline);
|
||||||
updflag = true;
|
updflag = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ private:
|
|||||||
///
|
///
|
||||||
mutable int top_y;
|
mutable int top_y;
|
||||||
///
|
///
|
||||||
ParagraphList::iterator inset_par;
|
lyx::paroffset_type inset_par;
|
||||||
///
|
///
|
||||||
lyx::pos_type inset_pos;
|
lyx::pos_type inset_pos;
|
||||||
///
|
///
|
||||||
@ -290,7 +290,7 @@ private:
|
|||||||
///
|
///
|
||||||
UpdatableInset * the_locking_inset;
|
UpdatableInset * the_locking_inset;
|
||||||
///
|
///
|
||||||
mutable ParagraphList::iterator old_par;
|
mutable lyx::paroffset_type old_par;
|
||||||
|
|
||||||
///
|
///
|
||||||
// to remember old painted frame dimensions to clear it on the right spot!
|
// to remember old painted frame dimensions to clear it on the right spot!
|
||||||
|
@ -888,7 +888,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
|||||||
if (view()->available())
|
if (view()->available())
|
||||||
view()->hideCursor();
|
view()->hideCursor();
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
{
|
{
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
buildCursor(cursor, *view());
|
buildCursor(cursor, *view());
|
||||||
@ -932,28 +932,36 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
|||||||
if (action == LFUN_UNDO) {
|
if (action == LFUN_UNDO) {
|
||||||
view()->undo();
|
view()->undo();
|
||||||
goto exit_with_message;
|
goto exit_with_message;
|
||||||
} else if (action == LFUN_REDO) {
|
}
|
||||||
|
|
||||||
|
if (action == LFUN_REDO) {
|
||||||
view()->redo();
|
view()->redo();
|
||||||
goto exit_with_message;
|
goto exit_with_message;
|
||||||
} else if (((result=inset->
|
}
|
||||||
|
|
||||||
// Hand-over to inset's own dispatch:
|
// Hand-over to inset's own dispatch:
|
||||||
localDispatch(FuncRequest(view(), action, argument))) ==
|
result = inset->localDispatch(FuncRequest(view(), action, argument));
|
||||||
DISPATCHED) ||
|
if (result == DISPATCHED || result == DISPATCHED_NOUPDATE) {
|
||||||
(result == DISPATCHED_NOUPDATE))
|
|
||||||
goto exit_with_message;
|
goto exit_with_message;
|
||||||
|
}
|
||||||
|
|
||||||
// If UNDISPATCHED, just soldier on
|
// If UNDISPATCHED, just soldier on
|
||||||
else if (result == FINISHED) {
|
if (result == FINISHED) {
|
||||||
owner->clearMessage();
|
owner->clearMessage();
|
||||||
goto exit_with_message;
|
goto exit_with_message;
|
||||||
// We do not need special RTL handling here:
|
// We do not need special RTL handling here:
|
||||||
// FINISHED means that the cursor should be
|
// FINISHED means that the cursor should be
|
||||||
// one position after the inset.
|
// one position after the inset.
|
||||||
} else if (result == FINISHED_RIGHT) {
|
}
|
||||||
|
|
||||||
|
if (result == FINISHED_RIGHT) {
|
||||||
view()->text->cursorRight(view());
|
view()->text->cursorRight(view());
|
||||||
moveCursorUpdate();
|
moveCursorUpdate();
|
||||||
owner->clearMessage();
|
owner->clearMessage();
|
||||||
goto exit_with_message;
|
goto exit_with_message;
|
||||||
} else if (result == FINISHED_UP) {
|
}
|
||||||
|
|
||||||
|
if (result == FINISHED_UP) {
|
||||||
RowList::iterator const irow = view()->text->cursorIRow();
|
RowList::iterator const irow = view()->text->cursorIRow();
|
||||||
if (irow != view()->text->firstRow()) {
|
if (irow != view()->text->firstRow()) {
|
||||||
#if 1
|
#if 1
|
||||||
@ -971,7 +979,9 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
|||||||
}
|
}
|
||||||
owner->clearMessage();
|
owner->clearMessage();
|
||||||
goto exit_with_message;
|
goto exit_with_message;
|
||||||
} else if (result == FINISHED_DOWN) {
|
}
|
||||||
|
|
||||||
|
if (result == FINISHED_DOWN) {
|
||||||
RowList::iterator const irow = view()->text->cursorIRow();
|
RowList::iterator const irow = view()->text->cursorIRow();
|
||||||
if (irow != view()->text->lastRow()) {
|
if (irow != view()->text->lastRow()) {
|
||||||
#if 1
|
#if 1
|
||||||
@ -991,8 +1001,9 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
|||||||
owner->clearMessage();
|
owner->clearMessage();
|
||||||
goto exit_with_message;
|
goto exit_with_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
#warning I am not sure this is still right, please have a look! (Jug 20020417)
|
#warning I am not sure this is still right, please have a look! (Jug 20020417)
|
||||||
else { // result == UNDISPATCHED
|
// result == UNDISPATCHED
|
||||||
//setMessage(N_("Text mode"));
|
//setMessage(N_("Text mode"));
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case LFUN_UNKNOWN_ACTION:
|
case LFUN_UNKNOWN_ACTION:
|
||||||
@ -1029,7 +1040,6 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
|
||||||
@ -1521,8 +1531,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
|||||||
case LFUN_CHILDOPEN:
|
case LFUN_CHILDOPEN:
|
||||||
{
|
{
|
||||||
string const filename =
|
string const filename =
|
||||||
MakeAbsPath(argument,
|
MakeAbsPath(argument, owner->buffer()->filePath());
|
||||||
owner->buffer()->filePath());
|
|
||||||
setMessage(N_("Opening child document ") +
|
setMessage(N_("Opening child document ") +
|
||||||
MakeDisplayPath(filename) + "...");
|
MakeDisplayPath(filename) + "...");
|
||||||
view()->savePosition(0);
|
view()->savePosition(0);
|
||||||
@ -1647,8 +1656,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_EXTERNAL_EDIT: {
|
case LFUN_EXTERNAL_EDIT: {
|
||||||
InsetExternal()
|
InsetExternal().localDispatch(FuncRequest(view(), action, argument));
|
||||||
.localDispatch(FuncRequest(view(), action, argument));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,7 +506,6 @@ public:
|
|||||||
|
|
||||||
///
|
///
|
||||||
std::string selectionAsString(Buffer const & buffer, bool label) const;
|
std::string selectionAsString(Buffer const & buffer, bool label) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Cursor related data.
|
/** Cursor related data.
|
||||||
Later this variable has to be removed. There should be now internal
|
Later this variable has to be removed. There should be now internal
|
||||||
|
@ -407,10 +407,6 @@ void LyXTabular::setOwner(InsetTabular * inset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#warning for some strange reason, cellstruct does not seem to have copy-semantics
|
|
||||||
|
|
||||||
// work around using 'swap' only...
|
|
||||||
|
|
||||||
void LyXTabular::appendRow(BufferParams const & bp, int cell)
|
void LyXTabular::appendRow(BufferParams const & bp, int cell)
|
||||||
{
|
{
|
||||||
++rows_;
|
++rows_;
|
||||||
@ -458,8 +454,6 @@ void LyXTabular::appendColumn(BufferParams const & bp, int cell)
|
|||||||
{
|
{
|
||||||
++columns_;
|
++columns_;
|
||||||
|
|
||||||
cell_vvector c_info = cell_vvector(rows_, cell_vector(columns_,
|
|
||||||
cellstruct(bp)));
|
|
||||||
int const column = column_of_cell(cell);
|
int const column = column_of_cell(cell);
|
||||||
column_vector::iterator cit = column_info.begin() + column + 1;
|
column_vector::iterator cit = column_info.begin() + column + 1;
|
||||||
column_info.insert(cit, columnstruct());
|
column_info.insert(cit, columnstruct());
|
||||||
@ -467,21 +461,16 @@ void LyXTabular::appendColumn(BufferParams const & bp, int cell)
|
|||||||
column_info[column + 1] = column_info[column];
|
column_info[column + 1] = column_info[column];
|
||||||
|
|
||||||
for (int i = 0; i < rows_; ++i) {
|
for (int i = 0; i < rows_; ++i) {
|
||||||
for (int j = 0; j <= column; ++j)
|
cell_info[i].insert(cell_info[i].begin() + column + 1, cellstruct(bp));
|
||||||
c_info[i][j] = cell_info[i][j];
|
|
||||||
|
|
||||||
for (int j = column + 1; j < columns_; ++j)
|
|
||||||
c_info[i][j] = cell_info[i][j - 1];
|
|
||||||
|
|
||||||
// care about multicolumns
|
// care about multicolumns
|
||||||
if (c_info[i][column + 1].multicolumn == CELL_BEGIN_OF_MULTICOLUMN)
|
if (cell_info[i][column + 1].multicolumn == CELL_BEGIN_OF_MULTICOLUMN)
|
||||||
c_info[i][column + 1].multicolumn = CELL_PART_OF_MULTICOLUMN;
|
cell_info[i][column + 1].multicolumn = CELL_PART_OF_MULTICOLUMN;
|
||||||
|
|
||||||
if (column + 2 >= columns_
|
if (column + 2 >= columns_
|
||||||
|| c_info[i][column + 2].multicolumn != CELL_PART_OF_MULTICOLUMN)
|
|| cell_info[i][column + 2].multicolumn != CELL_PART_OF_MULTICOLUMN)
|
||||||
c_info[i][column + 1].multicolumn = LyXTabular::CELL_NORMAL;
|
cell_info[i][column + 1].multicolumn = LyXTabular::CELL_NORMAL;
|
||||||
}
|
}
|
||||||
cell_info = c_info;
|
|
||||||
//++column;
|
//++column;
|
||||||
for (int i = 0; i < rows_; ++i) {
|
for (int i = 0; i < rows_; ++i) {
|
||||||
cell_info[i][column + 1].inset.clear(false);
|
cell_info[i][column + 1].inset.clear(false);
|
||||||
|
@ -1987,6 +1987,8 @@ ParagraphList::iterator LyXText::getPar(LyXCursor const & cur) const
|
|||||||
|
|
||||||
ParagraphList::iterator LyXText::getPar(int par) const
|
ParagraphList::iterator LyXText::getPar(int par) const
|
||||||
{
|
{
|
||||||
|
BOOST_ASSERT(par >= 0);
|
||||||
|
BOOST_ASSERT(par < ownerParagraphs().size());
|
||||||
ParagraphList::iterator pit = ownerParagraphs().begin();
|
ParagraphList::iterator pit = ownerParagraphs().begin();
|
||||||
std::advance(pit, par);
|
std::advance(pit, par);
|
||||||
return pit;
|
return pit;
|
||||||
|
10
src/text2.C
10
src/text2.C
@ -1161,7 +1161,7 @@ void LyXText::cutSelection(bool doclear, bool realcut)
|
|||||||
// and selection.end
|
// and selection.end
|
||||||
|
|
||||||
// make sure that the depth behind the selection are restored, too
|
// make sure that the depth behind the selection are restored, too
|
||||||
ParagraphList::iterator endpit = getPar(selection.end.par() + 1);
|
ParagraphList::iterator endpit = boost::next(getPar(selection.end.par()));
|
||||||
ParagraphList::iterator undoendpit = endpit;
|
ParagraphList::iterator undoendpit = endpit;
|
||||||
ParagraphList::iterator pars_end = ownerParagraphs().end();
|
ParagraphList::iterator pars_end = ownerParagraphs().end();
|
||||||
|
|
||||||
@ -1810,8 +1810,13 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
|
|||||||
if (selection.set())
|
if (selection.set())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Don't do anything if the cursor is invalid
|
||||||
|
if (old_cursor.par() == -1)
|
||||||
|
return false;
|
||||||
|
|
||||||
// We allow all kinds of "mumbo-jumbo" when freespacing.
|
// We allow all kinds of "mumbo-jumbo" when freespacing.
|
||||||
if (getPar(old_cursor)->isFreeSpacing())
|
ParagraphList::iterator const old_pit = getPar(old_cursor);
|
||||||
|
if (old_pit->isFreeSpacing())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Ok I'll put some comments here about what is missing.
|
/* Ok I'll put some comments here about what is missing.
|
||||||
@ -1838,7 +1843,6 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
|
|||||||
// MISSING
|
// MISSING
|
||||||
|
|
||||||
// If the pos around the old_cursor were spaces, delete one of them.
|
// If the pos around the old_cursor were spaces, delete one of them.
|
||||||
ParagraphList::iterator const old_pit = getPar(old_cursor);
|
|
||||||
if (old_cursor.par() != cursor.par()
|
if (old_cursor.par() != cursor.par()
|
||||||
|| old_cursor.pos() != cursor.pos()) {
|
|| old_cursor.pos() != cursor.pos()) {
|
||||||
|
|
||||||
|
82
src/text3.C
82
src/text3.C
@ -716,23 +716,21 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
|||||||
case LFUN_DELETE_SKIP:
|
case LFUN_DELETE_SKIP:
|
||||||
// Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
|
// Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
|
||||||
if (!selection.set()) {
|
if (!selection.set()) {
|
||||||
LyXCursor cur = cursor;
|
if (cursor.pos() == cursorPar()->size()) {
|
||||||
if (cur.pos() == getPar(cur)->size()) {
|
|
||||||
cursorRight(bv);
|
cursorRight(bv);
|
||||||
cur = cursor;
|
ParagraphParameters & params = cursorPar()->params();
|
||||||
if (cur.pos() == 0
|
if (cursor.pos() == 0
|
||||||
&& !(getPar(cur)->params().spaceTop()
|
&& !(params.spaceTop() == VSpace (VSpace::NONE))) {
|
||||||
== VSpace (VSpace::NONE))) {
|
|
||||||
setParagraph(
|
setParagraph(
|
||||||
getPar(cur)->params().lineTop(),
|
params.lineTop(),
|
||||||
getPar(cur)->params().lineBottom(),
|
params.lineBottom(),
|
||||||
getPar(cur)->params().pagebreakTop(),
|
params.pagebreakTop(),
|
||||||
getPar(cur)->params().pagebreakBottom(),
|
params.pagebreakBottom(),
|
||||||
VSpace(VSpace::NONE),
|
VSpace(VSpace::NONE),
|
||||||
getPar(cur)->params().spaceBottom(),
|
params.spaceBottom(),
|
||||||
getPar(cur)->params().spacing(),
|
params.spacing(),
|
||||||
getPar(cur)->params().align(),
|
params.align(),
|
||||||
getPar(cur)->params().labelWidthString(), 0);
|
params.labelWidthString(), 0);
|
||||||
cursorLeft(bv);
|
cursorLeft(bv);
|
||||||
} else {
|
} else {
|
||||||
cursorLeft(bv);
|
cursorLeft(bv);
|
||||||
@ -769,20 +767,20 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
|||||||
case LFUN_BACKSPACE_SKIP:
|
case LFUN_BACKSPACE_SKIP:
|
||||||
// Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
|
// Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP.
|
||||||
if (!selection.set()) {
|
if (!selection.set()) {
|
||||||
LyXCursor cur = cursor;
|
ParagraphParameters & params = cursorPar()->params();
|
||||||
if (cur.pos() == 0
|
if (cursor.pos() == 0 && !(params.spaceTop() == VSpace(VSpace::NONE))) {
|
||||||
&& !(getPar(cur)->params().spaceTop() == VSpace(VSpace::NONE))) {
|
|
||||||
setParagraph(
|
setParagraph(
|
||||||
getPar(cur)->params().lineTop(),
|
params.lineTop(),
|
||||||
getPar(cur)->params().lineBottom(),
|
params.lineBottom(),
|
||||||
getPar(cur)->params().pagebreakTop(),
|
params.pagebreakTop(),
|
||||||
getPar(cur)->params().pagebreakBottom(),
|
params.pagebreakBottom(),
|
||||||
VSpace(VSpace::NONE),
|
VSpace(VSpace::NONE),
|
||||||
getPar(cur)->params().spaceBottom(),
|
params.spaceBottom(),
|
||||||
getPar(cur)->params().spacing(),
|
params.spacing(),
|
||||||
getPar(cur)->params().align(),
|
params.align(),
|
||||||
getPar(cur)->params().labelWidthString(), 0);
|
params.labelWidthString(), 0);
|
||||||
} else {
|
} else {
|
||||||
|
LyXCursor cur = cursor;
|
||||||
backspace();
|
backspace();
|
||||||
selection.cursor = cur;
|
selection.cursor = cur;
|
||||||
}
|
}
|
||||||
@ -817,16 +815,17 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
|||||||
LyXCursor cur = cursor;
|
LyXCursor cur = cursor;
|
||||||
replaceSelection(bv->getLyXText());
|
replaceSelection(bv->getLyXText());
|
||||||
if (cur.pos() == 0) {
|
if (cur.pos() == 0) {
|
||||||
if (getPar(cur)->params().spaceTop() == VSpace(VSpace::NONE)) {
|
ParagraphParameters & params = getPar(cur)->params();
|
||||||
|
if (params.spaceTop() == VSpace(VSpace::NONE)) {
|
||||||
setParagraph(
|
setParagraph(
|
||||||
getPar(cur)->params().lineTop(),
|
params.lineTop(),
|
||||||
getPar(cur)->params().lineBottom(),
|
params.lineBottom(),
|
||||||
getPar(cur)->params().pagebreakTop(),
|
params.pagebreakTop(),
|
||||||
getPar(cur)->params().pagebreakBottom(),
|
params.pagebreakBottom(),
|
||||||
VSpace(VSpace::DEFSKIP), getPar(cur)->params().spaceBottom(),
|
VSpace(VSpace::DEFSKIP), params.spaceBottom(),
|
||||||
getPar(cur)->params().spacing(),
|
params.spacing(),
|
||||||
getPar(cur)->params().align(),
|
params.align(),
|
||||||
getPar(cur)->params().labelWidthString(), 1);
|
params.labelWidthString(), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -969,22 +968,19 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
|
|||||||
bv->update();
|
bv->update();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_PASTE: {
|
case LFUN_PASTE:
|
||||||
cmd.message(_("Paste"));
|
cmd.message(_("Paste"));
|
||||||
replaceSelection(bv->getLyXText());
|
replaceSelection(bv->getLyXText());
|
||||||
size_t sel_index = 0;
|
|
||||||
string const & arg = cmd.argument;
|
|
||||||
if (isStrUnsignedInt(arg)) {
|
|
||||||
size_t const paste_arg = strToUnsignedInt(arg);
|
|
||||||
#warning FIXME Check if the arg is in the domain of available selections.
|
#warning FIXME Check if the arg is in the domain of available selections.
|
||||||
sel_index = paste_arg;
|
if (isStrUnsignedInt(cmd.argument))
|
||||||
}
|
pasteSelection(strToUnsignedInt(cmd.argument));
|
||||||
pasteSelection(sel_index);
|
else
|
||||||
|
pasteSelection(0);
|
||||||
clearSelection(); // bug 393
|
clearSelection(); // bug 393
|
||||||
bv->update();
|
bv->update();
|
||||||
bv->switchKeyMap();
|
bv->switchKeyMap();
|
||||||
|
finishUndo();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case LFUN_CUT:
|
case LFUN_CUT:
|
||||||
cutSelection(true, true);
|
cutSelection(true, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user