From 2588a9216740a9361bfa083c8b6466a6ee8fc53e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Vigna?= Date: Fri, 12 Apr 2002 08:31:06 +0000 Subject: [PATCH] Simplified code. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3979 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 3 +++ src/insets/ChangeLog | 4 ++++ src/insets/insettext.C | 12 +----------- src/text2.C | 7 +++---- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 454ae73f1a..5b549f07ee 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2002-04-12 Juergen Vigna + * 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 an inset which uses the whole row! (rightMargin): ditto. diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index ab7ecbee06..4733247d65 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2002-04-12 Juergen Vigna + + * insettext.C (insertInset): remove unneeded code! + 2002-04-08 Herbert Voss * insetgraphic.C (write): write the rotating angle as diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 76676a24df..b532a4c79c 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -1860,21 +1860,11 @@ bool InsetText::insertInset(BufferView * bv, Inset * inset) return the_locking_inset->insertInset(bv, inset); 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); hideInsetCursor(bv); - lt->insertInset(bv, inset); + getLyXText(bv)->insertInset(bv, inset); bv->fitCursor(); - if (clear) - lt = 0; updateLocal(bv, CURSOR_PAR|CURSOR, true); - unFreezeUndo(); return true; } diff --git a/src/text2.C b/src/text2.C index 0057a8600f..bab91e6928 100644 --- a/src/text2.C +++ b/src/text2.C @@ -1647,13 +1647,12 @@ void LyXText::insertInset(BufferView * bview, Inset * inset) { if (!cursor.par()->insetAllowed(inset->lyxCode())) return; - // I don't know if this is necessary here (Jug 20020102) - setUndo(bview, Undo::INSERT, cursor.par(), cursor.par()->next()); + setUndo(bview, Undo::FINISH, cursor.par(), cursor.par()->next()); + freezeUndo(); cursor.par()->insertInset(cursor.pos(), inset); // Just to rebreak and refresh correctly. // The character will not be inserted a second time insertChar(bview, Paragraph::META_INSET); -#if 1 // 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 // 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)) { cursorLeft(bview, true); } -#endif + unFreezeUndo(); }