Simplified code.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3979 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2002-04-12 08:31:06 +00:00
parent 1dc3f4deb3
commit 2588a92167
4 changed files with 11 additions and 15 deletions

View File

@ -1,5 +1,8 @@
2002-04-12 Juergen Vigna <jug@sad.it> 2002-04-12 Juergen Vigna <jug@sad.it>
* text2.C (insertInset): freeze Undo after setUndo so that it is not
again called in insertChar().
* text.C (leftMargin): return LYX_PAPER_MARGIN if this row contains * text.C (leftMargin): return LYX_PAPER_MARGIN if this row contains
an inset which uses the whole row! an inset which uses the whole row!
(rightMargin): ditto. (rightMargin): ditto.

View File

@ -1,3 +1,7 @@
2002-04-12 Juergen Vigna <jug@sad.it>
* insettext.C (insertInset): remove unneeded code!
2002-04-08 Herbert Voss <voss@perce.de> 2002-04-08 Herbert Voss <voss@perce.de>
* insetgraphic.C (write): write the rotating angle as * insetgraphic.C (write): write the rotating angle as

View File

@ -1860,21 +1860,11 @@ bool InsetText::insertInset(BufferView * bv, Inset * inset)
return the_locking_inset->insertInset(bv, inset); return the_locking_inset->insertInset(bv, inset);
return false; return false;
} }
bool clear = false;
if (!lt) {
lt = getLyXText(bv);
clear = true;
}
setUndo(bv, Undo::FINISH, lt->cursor.par(), lt->cursor.par()->next());
freezeUndo();
inset->setOwner(this); inset->setOwner(this);
hideInsetCursor(bv); hideInsetCursor(bv);
lt->insertInset(bv, inset); getLyXText(bv)->insertInset(bv, inset);
bv->fitCursor(); bv->fitCursor();
if (clear)
lt = 0;
updateLocal(bv, CURSOR_PAR|CURSOR, true); updateLocal(bv, CURSOR_PAR|CURSOR, true);
unFreezeUndo();
return true; return true;
} }

View File

@ -1647,13 +1647,12 @@ void LyXText::insertInset(BufferView * bview, Inset * inset)
{ {
if (!cursor.par()->insetAllowed(inset->lyxCode())) if (!cursor.par()->insetAllowed(inset->lyxCode()))
return; return;
// I don't know if this is necessary here (Jug 20020102) setUndo(bview, Undo::FINISH, cursor.par(), cursor.par()->next());
setUndo(bview, Undo::INSERT, cursor.par(), cursor.par()->next()); freezeUndo();
cursor.par()->insertInset(cursor.pos(), inset); cursor.par()->insertInset(cursor.pos(), inset);
// Just to rebreak and refresh correctly. // Just to rebreak and refresh correctly.
// The character will not be inserted a second time // The character will not be inserted a second time
insertChar(bview, Paragraph::META_INSET); insertChar(bview, Paragraph::META_INSET);
#if 1
// If we enter a highly editable inset the cursor should be to before // If we enter a highly editable inset the cursor should be to before
// the inset. This couldn't happen before as Undo was not handled inside // the inset. This couldn't happen before as Undo was not handled inside
// inset now after the Undo LyX tries to call inset->Edit(...) again // inset now after the Undo LyX tries to call inset->Edit(...) again
@ -1662,7 +1661,7 @@ void LyXText::insertInset(BufferView * bview, Inset * inset)
if (isHighlyEditableInset(inset)) { if (isHighlyEditableInset(inset)) {
cursorLeft(bview, true); cursorLeft(bview, true);
} }
#endif unFreezeUndo();
} }