Commit Graph

52 Commits

Author SHA1 Message Date
Stephan Witt
af77fb5186 #7208 reset undo group level in Undo::clear() too
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37161 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-10 09:44:55 +00:00
Abdelrazak Younes
a07d9f2192 Clear undo/redo stack when reloading buffer. This fixes #7208.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37155 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-09 17:55:16 +00:00
Jean-Marc Lasgouttes
3370b1d2fa Fix the last part of #3733:
- In GuiApplication::dispatch, do not call markDirty() for lfuns that are not ReadOnly
- In Undo::Private::recordUndo, call markDirty(). The indicator of dirtyness is now the existence of an undo element.
- In lyxfind, remove several markDirty calls that are not needed anymore.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36772 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-08 10:30:45 +00:00
Jean-Marc Lasgouttes
2661b9b22e Some Undo cleanup. Functionality should be unchanged
- whitespace and typos in comments
- make sure that the Undo::recordUndoXXX functions all go through
  Undo::Private::recordUndo


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36771 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-08 10:04:07 +00:00
Jean-Marc Lasgouttes
574931dcdb Fix bug #6930: no undo for inset type changing
THis is a consequence of the new AtPoint mechanism. In the old
world, recordUndoInset was called before INSET_MODIFY. I reintroduced
manual recordUndoInset calls in all places that matter. I suspect
that this issue should be revisited later.

Note that recordUndoInset can now take an optional parameter that tells
what inset is concerned. This is useful because the cursor can be
either just inside the inset or in front of it.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36580 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-29 09:47:46 +00:00
Jean-Marc Lasgouttes
3e99283f2b Make sure that the current undo element is finished before marking stacks dirty
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35075 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-07 10:40:25 +00:00
Jean-Marc Lasgouttes
f8eda52820 Fix bug #3733: 'undo' does not revert 'changed' status for file
* src/LyXAction.cpp: add ReadOnly flag to LFUN_UNDO and LFUN_REDO, since
  we do not want the dispatch mechanism to mark buffer dirty after them.
* src/BufferView.cpp: handle "by hand" the activation of undo/redo
* src/Undo.cpp: add lyx_clean member to UndoElement and make sure to 
  maintain it with undo operations; add a new markDirty() member for UndoStack
* src/Buffer.cpp: when saving a document, mark the undo and redo stacks 
  elements as dirty.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35068 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-06 23:54:04 +00:00
Richard Heck
5577e877bb Try to move all updateBuffer() calls to a central location. We now use
DispatchResult to store a flag that tells us whether we need a buffer
update or not. 

So: If you find a missing one, go to an appropriate place in the
dispatch and call cur.forceBufferUpdate() or, if you don't have a cursor
but do have a DispatchResult, call dr.forceBufferUpdate().

There is one remaining call I could not move, in
TextMetrics::redoParagraph. But this looks like an emergency call when
the macro context has not been set. There are also a couple calls that
are connected with buffer creation that I commented out, since the same
call is done again almost immediately. But I'm not positive about those.

Now the nice thing would be to do the same for updateMacros().


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34826 a592a061-630c-0410-9148-cb99ea01b6c8
2010-07-09 14:37:00 +00:00
Enrico Forestieri
cf1f59dd4d Fix bug #6678: Crash when undoing backspace inside math-macro
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34370 a592a061-630c-0410-9148-cb99ea01b6c8
2010-05-04 16:16:20 +00:00
Richard Heck
d65020b293 s/updateLabels/updateBuffer/g, per a suggestion of Abdel's.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33613 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-03 22:13:45 +00:00
Richard Heck
22ba8256b2 So we do, sometimes, need the setBuffer calls that were removed in r28720.
This patch encapsulates the needed call in Buffer::setBuffersForInsets(),
and calls it from Undo::Private::textUndoOrRedo(). As noted in the FIXME,
this is still a bit of a "hammer" and ought to be replaced with the sort of
more refined approach taken in r28709. But I don't at the moment see how to
do that. The place to do it, though, is in doTextUndoOrRed().
 


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28757 a592a061-630c-0410-9148-cb99ea01b6c8
2009-03-12 20:10:46 +00:00
Richard Heck
3aecc2c4ff Use an enum to make things a little clearer here.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28756 a592a061-630c-0410-9148-cb99ea01b6c8
2009-03-12 20:02:12 +00:00
André Pönitz
6192345f60 add Buffer * member to DocIterator
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27603 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-17 11:46:07 +00:00
André Pönitz
f8f5a7b28d move updateLables to buffer
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27562 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-16 16:43:49 +00:00
André Pönitz
f1cba8ff64 more latin1..utf8 schanges. all of src/* should be utf8 now
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27425 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-14 15:58:50 +00:00
Jean-Marc Lasgouttes
00cca05443 improve debug info
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26438 a592a061-630c-0410-9148-cb99ea01b6c8
2008-09-18 10:46:31 +00:00
Jean-Marc Lasgouttes
17dd645862 Bug 5173: Undo Grouping
http://bugzilla.lyx.org/show_bug.cgi?id=5173

	* Undo.cpp (beginUndoGroup, endUndoGroup): new methods.
	(UndoElement): add group_id member
	(UndoElementStack): when removing old undo entries, make sure to
	remove whole groups.
	(Undo::Private): add group_id and group_level (for nesting) members.
	(doTextUndoOrRedo): new method. Apply _one_ UndoElement.
	(textUndoOrRedo): call doTextUndoOrRedo on each element of the current
	group.
	(recordUndoFullDocument): put inside an undo group

	* Cursor.cpp (beginUndoGroup, endUndoGroup): new methods.

	* LyXFunc.cpp (dispatch): add calls to (begin|end)UndoGroup.

	* lyxfind.cpp (replaceAll): use several recordUndo instead
	of one recordUndoFullDocument.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26178 a592a061-630c-0410-9148-cb99ea01b6c8
2008-08-15 19:24:56 +00:00
Jean-Marc Lasgouttes
4d63bd347b constification without any code change. This is part of and effort to see whether BufferView::cursor() could be made const
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26141 a592a061-630c-0410-9148-cb99ea01b6c8
2008-08-13 13:46:19 +00:00
Abdelrazak Younes
0f9e4d7c2d Fix http://bugzilla.lyx.org/show_bug.cgi?id=5127
A call to updateLabels() was necessary (and safer) in all cases.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26081 a592a061-630c-0410-9148-cb99ea01b6c8
2008-08-06 16:08:50 +00:00
Abdelrazak Younes
0f7bae394c Redo 25580 the right way, again :-)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25618 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-14 17:11:19 +00:00
Richard Heck
a282ef926a I've had to revert r25548 because of:
gdb /home/rgheck/cvs/lyx-devel/trunk/src/lyx --interpreter=mi2 -quiet
Using host libthread_db library "/lib64/libthread_db.so.1".
(gdb) bt
bt
#0  0x000000369a230ec5 in raise () from /lib64/libc.so.6
#1  0x000000369a232970 in abort () from /lib64/libc.so.6
#2  0x000000369a26b0db in __libc_message () from /lib64/libc.so.6
#3  0x000000369a272832 in _int_free () from /lib64/libc.so.6
#4  0x000000369a275f2c in free () from /lib64/libc.so.6
#5  0x00000000004ebbdc in std::_Rb_tree<int, std::pair<int const, lyx::Author>, std::_Select1st<std::pair<int const, lyx::Author> >, std::less<int>, std::allocator<std::pair<int const, lyx::Author> > >::_M_erase (this=0x32c7f68, __x=0x30ece10) at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h:94
#6  0x00000000004ebe99 in ~map (this=0x32c7f68) at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:578
#7  0x00000000004df21f in lyx::BufferParams::MemoryTraits::destroy (ptr=0x32c7f60) at Author.h:50
#8  0x00000000004855e4 in ~copied_ptr (this=<value optimized out>) at ../../../src/support/copied_ptr.h:69
#9  0x0000000000488f93 in ~BufferParams (this=0x32c7b30) at ../../../src/BufferParams.h:52
#10 0x0000000000748585 in ~UndoElement (this=0x7fffc1aeebd0) at Undo.cpp:82
#11 0x0000000000745be8 in lyx::Undo::Private::doRecordUndo (this=0x2ef9630, kind=lyx::ATOMIC_UNDO, cell=<value optimized out>, first_pit=<value optimized out>, last_pit=<value optimized out>, cur=<value optimized out>, isFullBuffer=true, isUndoOperation=true) at Undo.cpp:278
#12 0x0000000000745ce7 in lyx::Undo::recordUndoFullDocument (this=0x2ea5620, cur=@0x2f04238) at Undo.cpp:443
#13 0x00000000007a73cc in lyx::Cursor::recordUndoFullDocument (this=0x2f04238) at Cursor.cpp:2139
#14 0x00000000006374e8 in lyx::LyXFunc::dispatch (this=0x2a431a0, cmd=@0x7fffc1af0e20) at LyXFunc.cpp:1426
#15 0x000000000060630c in lyx::dispatch (action=@0x7fffc1af0e20) at LyX.cpp:1131
#16 0x0000000000b1740a in lyx::frontend::Dialog::dispatch (this=<value optimized out>, fr=@0x7fffc1af0e20) at Dialog.cpp:62
#17 0x0000000000b6787b in dispatch_bufferparams (dialog=@0x30e1288, bp=@0x30e1470, lfun=lyx::LFUN_BUFFER_PARAMS_APPLY) at GuiDocument.cpp:2244
#18 0x0000000000b7825b in lyx::frontend::GuiDocument::dispatchParams (this=0x30e1260) at GuiDocument.cpp:2255
#19 0x0000000000b1766e in lyx::frontend::Dialog::apply (this=0x30e1288) at Dialog.cpp:159
#20 0x0000000000b647d8 in lyx::frontend::GuiDialog::slotOK (this=0x30e1260) at GuiDialog.cpp:56
#21 0x0000000000b64871 in lyx::frontend::GuiDialog::qt_metacall (this=0x30e1260, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffc1af2290) at GuiDialog_moc.cpp:73
#22 0x0000000000b83fed in lyx::frontend::GuiDocument::qt_metacall (this=0x4f17, _c=20247, _id=6, _a=0xffffffffffffffff) at GuiDocument_moc.cpp:90
#23 0x00000034e9cf3d71 in QMetaObject::activate () from /usr/lib64/libQtCore.so.4
#24 0x00000034ea5f3007 in QAbstractButton::clicked () from /usr/lib64/libQtGui.so.4
#25 0x00000034ea416c3b in QAbstractItemModel::sort () from /usr/lib64/libQtGui.so.4
#26 0x00000034ea4182c5 in QAbstractItemModel::sort () from /usr/lib64/libQtGui.so.4
#27 0x00000034ea4184cd in QAbstractButton::mouseReleaseEvent () from /usr/lib64/libQtGui.so.4
#28 0x00000034ea1cf35a in QWidget::event () from /usr/lib64/libQtGui.so.4
#29 0x00000034ea4177df in QAbstractButton::event () from /usr/lib64/libQtGui.so.4
#30 0x00000034ea491778 in QPushButton::event () from /usr/lib64/libQtGui.so.4
#31 0x00000034ea19274c in QApplicationPrivate::notify_helper () from /usr/lib64/libQtGui.so.4
#32 0x00000034ea198c1b in QApplication::notify () from /usr/lib64/libQtGui.so.4
#33 0x0000000000a8084a in lyx::frontend::GuiApplication::notify (this=0x4f17, receiver=0x4f17, event=0x6) at GuiApplication.cpp:1163
#34 0x00000034e9ce3700 in QCoreApplication::notifyInternal () from /usr/lib64/libQtCore.so.4
#35 0x00000034ea1df95d in QAbstractItemModel::sort () from /usr/lib64/libQtGui.so.4
#36 0x00000034ea1de900 in QApplication::x11ProcessEvent () from /usr/lib64/libQtGui.so.4
#37 0x00000034ea200778 in QAbstractItemModel::sort () from /usr/lib64/libQtGui.so.4
#38 0x000000369f62ef53 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#39 0x000000369f63224d in QAbstractItemModel::sort () from /lib64/libglib-2.0.so.0
#40 0x000000369f63277e in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#41 0x00000034e9d01930 in QEventDispatcherGlib::processEvents () from /usr/lib64/libQtCore.so.4
#42 0x00000034ea20057f in QAbstractItemModel::sort () from /usr/lib64/libQtGui.so.4
#43 0x00000034e9ce2da8 in QEventLoop::processEvents () from /usr/lib64/libQtCore.so.4
#44 0x00000034e9ce2ebd in QEventLoop::exec () from /usr/lib64/libQtCore.so.4
#45 0x00000034e9ce4e71 in QCoreApplication::exec () from /usr/lib64/libQtCore.so.4
#46 0x0000000000a7fb83 in lyx::frontend::GuiApplication::exec (this=<value optimized out>) at GuiApplication.cpp:1032
#47 0x00000000006101e4 in lyx::LyX::exec (this=0x7fffc1af4cf0, argc=@0x7fffc1af4cec, argv=<value optimized out>) at LyX.cpp:342
#48 0x0000000000433aa8 in main (argc=1, argv=0x7fffc1af4df8) at main.cpp:46
^done
I don't know at all what's up here with copied_ptr. Hadn't even heard of it until five minutes ago. ;-) You can cause this crash by opening a new document, opening Document>Settings and changing (say) the Bibliography settings, and then hitting "OK".



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25617 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-14 16:12:12 +00:00
Richard Heck
a24439b154 Redo 25580 the right way. (Failure to initialize bparams had caused constant crashes.)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25584 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-13 19:34:56 +00:00
Richard Heck
a692a56f4c Revert 25580.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25583 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-13 19:33:05 +00:00
Richard Heck
ec86523845 Another small optimization: Don't bother copying the BufferParams unless we need it.
This may speed up repeated undos a bit.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25580 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-13 19:04:44 +00:00
Richard Heck
9c6546fbd2 A small optimization: Don't do a copy here.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25578 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-13 19:00:55 +00:00
Richard Heck
f57a0a5dac Revert r25538.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25540 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-10 16:38:01 +00:00
Abdelrazak Younes
24a94f7254 Saves some more memory.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25538 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-10 16:13:43 +00:00
Richard Heck
aee1d2b0f7 Do this check before we start creating things.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25525 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-09 22:59:16 +00:00
Richard Heck
9aa5b42262 Fix bug 5010, for the most part. There's no need to construct a default UndoElement,
which involves constructing a default BufferParams (this is expensive), only then to
over-write everything. 


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25522 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-09 18:42:41 +00:00
Abdelrazak Younes
45bc27809b remove unneeded includes.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24628 a592a061-630c-0410-9148-cb99ea01b6c8
2008-05-06 06:48:38 +00:00
Jean-Marc Lasgouttes
9b4a26a252 rename assert.h to lassert.h
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24559 a592a061-630c-0410-9148-cb99ea01b6c8
2008-04-30 08:26:40 +00:00
André Pönitz
fa804db4ab fix leak in the undo stack
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24308 a592a061-630c-0410-9148-cb99ea01b6c8
2008-04-16 22:02:26 +00:00
André Pönitz
8d4b7cf4ff squash another valgrind warning. the code was safe, though...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24300 a592a061-630c-0410-9148-cb99ea01b6c8
2008-04-16 20:37:23 +00:00
André Pönitz
7f461f4392 infrastructure for 'graceful asserts'
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24216 a592a061-630c-0410-9148-cb99ea01b6c8
2008-04-10 21:49:34 +00:00
André Pönitz
f2c9b56fb4 cosmetics/#include cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23747 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-15 00:22:54 +00:00
Stefan Schimanski
e01f7e7105 * fix a serious data loss problem: undo did not save the whole
selection in mathed if more than one cell was selected.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23675 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-12 00:59:29 +00:00
Abdelrazak Younes
2bf1c09376 header cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23049 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-18 07:14:42 +00:00
Abdelrazak Younes
9abb7db468 getting rid of superfluous std:: statements.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22104 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-12 19:28:07 +00:00
Abdelrazak Younes
b89cc942eb 'using namespace lyx::support' instead of 'using support::xxx'
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22103 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-12 18:57:56 +00:00
Abdelrazak Younes
9383f4c3c6 'using namespace std' instead of 'using std::xxx'
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22097 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-12 10:16:00 +00:00
André Pönitz
9d0ea8aeff Move debug.{cpp,h}, Messages.{cpp,h} and gettext.{cpp,h} to support/.
Now support/* should have no dependencies on src/* anymore.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21851 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-29 07:04:28 +00:00
André Pönitz
150cf11651 hand-crafted LyXErr
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21849 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-28 22:12:03 +00:00
Abdelrazak Younes
2916b61086 Header cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21059 a592a061-630c-0410-9148-cb99ea01b6c8
2007-10-19 14:23:32 +00:00
Abdelrazak Younes
55beda376a Refactor Undo/Redo framework into an Undo class owned by a Buffer. This reduces header dependencies from Undo.h which was including lots of stuff previously. This also solves the bug where undo/redo were reset upon buffer switching. Now, each buffer has a truly independant undo/redo architecture.
In the future, when Cursor has been fixed to work correctly with multiple views of the same Buffer, we could transfer the Undo owner from Buffer to Cursor.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21031 a592a061-630c-0410-9148-cb99ea01b6c8
2007-10-18 11:51:17 +00:00
Abdelrazak Younes
0fcae6cc10 * BufferView::buffer() returns a reference instead of a pointer.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19691 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-21 13:03:55 +00:00
Stefan Schimanski
b06797a312 * move TOC update behind cur.fixIfBroken() to fix #3851
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18762 a592a061-630c-0410-9148-cb99ea01b6c8
2007-06-13 07:43:34 +00:00
André Pönitz
e0d54dd3b4 LyXText -> Text
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18103 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-29 23:33:02 +00:00
André Pönitz
32871c1284 rename InsetBase to Inset
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18089 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-29 13:39:47 +00:00
André Pönitz
51fbea02a8 Remove InsetOld
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18087 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-29 12:32:14 +00:00
André Pönitz
76dec26fec rename MathArray into MathData
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18044 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-26 16:06:39 +00:00