#include <UndoHistory.h>
Public Methods | |
UndoHistory () | |
virtual | ~UndoHistory () |
void | Clear (Undoable *u=0) |
void | Undo () |
void | Redo () |
void | Store (Undoable *u) |
Private Methods | |
void | ClearOneList (std::list< UndoRecord > &l, Undoable *u) |
Private Attributes | |
std::list< UndoRecord > | fUndoList |
std::list< UndoRecord > | fRedoList |
|
|
|
Definition at line 13 of file UndoHistory.cxx. References Clear().
00014 { 00015 this->Clear(); 00016 } |
|
Definition at line 33 of file UndoHistory.cxx. References ClearOneList(), fRedoList, fUndoList, Msg::kDebug, and MSG. Referenced by DisplayBase::Configure(), Undoable::~Undoable(), and ~UndoHistory().
00034 { 00035 MSG("UndoHistory",Msg::kDebug) << "Clear: " << (void*)u << endl; 00036 00037 this->ClearOneList(fUndoList,u); 00038 this->ClearOneList(fRedoList,u); 00039 } |
|
Definition at line 18 of file UndoHistory.cxx. References UndoHistory::UndoRecord::object, and UndoHistory::UndoRecord::state. Referenced by Clear().
00019 { 00020 list<UndoRecord>::iterator lit; 00021 lit = l.begin(); 00022 while (lit != l.end()) { 00023 UndoRecord ur = *lit; 00024 if (!u || ur.object == u) { 00025 lit = l.erase(lit); 00026 delete ur.state; 00027 } 00028 else ++lit; 00029 } 00030 00031 } |
|
Definition at line 58 of file UndoHistory.cxx. References fRedoList, fUndoList, Undoable::GetState(), Msg::kDebug, Msg::kWarning, MSG, UndoHistory::UndoRecord::object, Undoable::Restore(), and UndoHistory::UndoRecord::state. Referenced by test1(), and test2().
00059 { 00060 if (fRedoList.begin() == fRedoList.end()) { 00061 MSG("UndoHistory",Msg::kWarning) << "Redo: nothing to redo\n"; 00062 return; 00063 } 00064 MSG("UndoHistory",Msg::kDebug) << "Redoing\n"; 00065 00066 UndoRecord ur = fRedoList.back(); 00067 fRedoList.pop_back(); 00068 00069 UndoRecord urcur(ur.object,ur.object->GetState()); 00070 fUndoList.push_back(urcur); 00071 00072 ur.object->Restore(ur.state); 00073 } |
|
Definition at line 75 of file UndoHistory.cxx. References fUndoList, Undoable::GetState(), Msg::kDebug, and MSG. Referenced by Undoable::Store(), test1(), and test2().
00076 { 00077 MSG("UndoHistory",Msg::kDebug) << "Store: " << (void*)u << endl; 00078 UndoRecord ur(u,u->GetState()); 00079 fUndoList.push_back(ur); 00080 } |
|
Definition at line 41 of file UndoHistory.cxx. References fRedoList, fUndoList, Undoable::GetState(), Msg::kDebug, Msg::kWarning, MSG, UndoHistory::UndoRecord::object, Undoable::Restore(), and UndoHistory::UndoRecord::state. Referenced by test1(), and test2().
00042 { 00043 if (fUndoList.begin() == fUndoList.end()) { 00044 MSG("UndoHistory",Msg::kWarning) << "Undo: nothing to undo\n"; 00045 return; 00046 } 00047 MSG("UndoHistory",Msg::kDebug) << "Undoing\n"; 00048 00049 UndoRecord ur = fUndoList.back(); 00050 fUndoList.pop_back(); 00051 00052 UndoRecord urcur(ur.object,ur.object->GetState()); 00053 fRedoList.push_back(urcur); 00054 00055 ur.object->Restore(ur.state); 00056 } |
|
Definition at line 60 of file UndoHistory.h. |
|
Definition at line 59 of file UndoHistory.h. |