lyx_mirror/src/undo_funcs.h
Asger Ottar Alstrup c3a34a64f1 Undo cleaned up. It seems to work pretty well now.
* undo_funcs.h: Removed setCursorParUndo to simplify things a bit.
	Renamed setUndo family to recordUndo. Renamed FINISH to ATOMIC
	which I think is a bit clearer. EDIT is gone, since it was
	premature optimisation, and broken for mathed anyway.
	* undo_funcs.C (performUndoOrRedo): Cleaned up and made it work
	with cursor positioning in insets as well (math insets still do not
	work, but that's a different story anyway.) It mysteriously
	crashes sometimes with undo in the first paragraph, but I'm fairly
	confident that this is a compiler bug.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7358 a592a061-630c-0410-9148-cb99ea01b6c8
2003-07-25 19:18:43 +00:00

58 lines
1.6 KiB
C++

// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995-2001 The LyX Team.
*
* ====================================================== */
#ifndef UNDO_FUNCS_H
#define UNDO_FUNCS_H
#include "undo.h"
#include "ParagraphList.h"
class BufferView;
class Paragraph;
/// This will undo the last action - returns false if no undo possible
bool textUndo(BufferView *);
/// This will redo the last undo - returns false if no redo possible
bool textRedo(BufferView *);
/// Makes sure the next operation will be stored
void finishUndo();
/**
* Whilst undo is frozen, all actions do not get added
* to the undo stack
*/
void freezeUndo();
/// Track undos again
void unFreezeUndo();
/**
* Record undo information - call with the first paragraph that will be changed
* and the last paragraph that will be changed. So we give an inclusive
* range.
* This is called before you make the changes to the paragraph, and it
* will record the original information of the paragraphs in the undo stack.
*/
void recordUndo(BufferView *, Undo::undo_kind kind,
ParagraphList::iterator first, ParagraphList::iterator last);
/// Convienience: Prepare undo when change in a single paragraph.
void recordUndo(BufferView *, Undo::undo_kind kind,
ParagraphList::iterator first);
/// Convienience: Prepare undo for the paragraph that contains the cursor
void recordUndo(BufferView *, Undo::undo_kind kind);
/// Are we avoiding tracking undos currently ?
extern bool undo_frozen;
#endif // UNDO_FUNCS_H