mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
minor cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3206 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
06fbab0b77
commit
3677e0f57b
@ -1,3 +1,9 @@
|
||||
|
||||
2001-12-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* undostack.[Ch]:
|
||||
* undo_func.C: minor cleanup
|
||||
|
||||
2001-12-12 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||
|
||||
* FontLoader.C (getFontinfo): only use symbol fonts with encoding
|
||||
|
@ -26,10 +26,12 @@ bool undo_finished;
|
||||
/// a flag
|
||||
bool undo_frozen;
|
||||
|
||||
|
||||
bool textUndo(BufferView * bv)
|
||||
{
|
||||
// returns false if no undo possible
|
||||
Undo * undo = bv->buffer()->undostack.pop();
|
||||
Undo * undo = bv->buffer()->undostack.top();
|
||||
bv->buffer()->undostack.pop();
|
||||
if (undo) {
|
||||
finishUndo();
|
||||
if (!undo_frozen) {
|
||||
@ -50,7 +52,8 @@ bool textUndo(BufferView * bv)
|
||||
bool textRedo(BufferView * bv)
|
||||
{
|
||||
// returns false if no redo possible
|
||||
Undo * undo = bv->buffer()->redostack.pop();
|
||||
Undo * undo = bv->buffer()->redostack.top();
|
||||
bv->buffer()->redostack.pop();
|
||||
if (undo) {
|
||||
finishUndo();
|
||||
if (!undo_frozen) {
|
||||
@ -247,7 +250,6 @@ void setRedo(BufferView * bv, Undo::undo_kind kind,
|
||||
bv->buffer()->redostack.push(createUndo(bv, kind, first, behind));
|
||||
}
|
||||
|
||||
using lyx::pos_type;
|
||||
|
||||
Undo * createUndo(BufferView * bv, Undo::undo_kind kind,
|
||||
Paragraph const * first, Paragraph const * behind)
|
||||
@ -277,7 +279,7 @@ Undo * createUndo(BufferView * bv, Undo::undo_kind kind,
|
||||
if (!bv->buffer()->undostack.empty() &&
|
||||
bv->buffer()->undostack.top()->kind == kind &&
|
||||
bv->buffer()->undostack.top()->number_of_before_par == before_number &&
|
||||
bv->buffer()->undostack.top()->number_of_behind_par == behind_number ){
|
||||
bv->buffer()->undostack.top()->number_of_behind_par == behind_number) {
|
||||
// no undo needed
|
||||
return 0;
|
||||
}
|
||||
@ -345,6 +347,7 @@ void setCursorParUndo(BufferView * bv)
|
||||
bv->text->cursor.par()->next());
|
||||
}
|
||||
|
||||
|
||||
Paragraph * firstUndoParagraph(BufferView * bv, int inset_id)
|
||||
{
|
||||
Inset * inset = bv->buffer()->getInsetFromID(inset_id);
|
||||
@ -356,6 +359,7 @@ Paragraph * firstUndoParagraph(BufferView * bv, int inset_id)
|
||||
return bv->text->ownerParagraph();
|
||||
}
|
||||
|
||||
|
||||
LyXCursor const & undoCursor(BufferView * bv)
|
||||
{
|
||||
if (bv->theLockingInset())
|
||||
|
@ -23,18 +23,18 @@ UndoStack::UndoStack()
|
||||
: limit(100) {}
|
||||
|
||||
|
||||
Undo * UndoStack::pop()
|
||||
void UndoStack::pop()
|
||||
{
|
||||
if (stakk.empty()) return 0;
|
||||
Undo * result = stakk.front();
|
||||
if (stakk.empty())
|
||||
return;
|
||||
stakk.pop_front();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Undo * UndoStack::top()
|
||||
Undo * UndoStack::top() const
|
||||
{
|
||||
if (stakk.empty()) return 0;
|
||||
if (stakk.empty())
|
||||
return 0;
|
||||
return stakk.front();
|
||||
}
|
||||
|
||||
@ -63,7 +63,8 @@ void UndoStack::SetStackLimit(Stakk::size_type l)
|
||||
|
||||
void UndoStack::push(Undo * undo_arg)
|
||||
{
|
||||
if (!undo_arg) return;
|
||||
if (!undo_arg)
|
||||
return;
|
||||
|
||||
stakk.push_front(undo_arg);
|
||||
if (stakk.size() > limit) {
|
||||
@ -74,6 +75,7 @@ void UndoStack::push(Undo * undo_arg)
|
||||
}
|
||||
|
||||
|
||||
bool UndoStack::empty() const {
|
||||
bool UndoStack::empty() const
|
||||
{
|
||||
return stakk.empty();
|
||||
}
|
||||
|
@ -33,14 +33,14 @@ public:
|
||||
///
|
||||
UndoStack();
|
||||
///
|
||||
Undo * pop();
|
||||
~UndoStack();
|
||||
///
|
||||
Undo * top();
|
||||
void pop();
|
||||
///
|
||||
Undo * top() const;
|
||||
///
|
||||
bool empty() const;
|
||||
///
|
||||
~UndoStack();
|
||||
///
|
||||
void clear();
|
||||
///
|
||||
void SetStackLimit(Stakk::size_type l);
|
||||
|
Loading…
Reference in New Issue
Block a user