59 FXIMPLEMENT_ABSTRACT(
GNEUndoList, FXUndoList, GNEUndoListMap, ARRAYNUMBER(GNEUndoListMap))
68 myGNEApplicationWindowParent(parent) {
155 sender->handle(
this, enable ? FXSEL(SEL_COMMAND, FXWindow::ID_ENABLE) : FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE),
nullptr);
157 FXString caption = undoName();
162 caption = (
"Cannot Undo in the middle of " +
myCommandGroups.top()->getDescription()).c_str();
163 }
else if (!canUndo()) {
167 if (dynamic_cast<FXMenuCommand*>(sender)) {
168 sender->handle(
this, FXSEL(SEL_COMMAND, FXMenuCaption::ID_SETSTRINGVALUE), (
void*)&caption);
179 sender->handle(
this, enable ? FXSEL(SEL_COMMAND, FXWindow::ID_ENABLE) : FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE),
nullptr);
181 FXString caption = redoName();
186 caption = (
"Cannot Redo in the middle of " +
myCommandGroups.top()->getDescription()).c_str();
187 }
else if (!canRedo()) {
191 if (dynamic_cast<FXMenuCommand*>(sender)) {
192 sender->handle(
this, FXSEL(SEL_COMMAND, FXMenuCaption::ID_SETSTRINGVALUE), (
void*)&caption);
205 myDescription(description) {
FXDEFMAP(GNEUndoList) GNEUndoListMap[]
const std::string & isUndoRedoEnabled() const
check if undo-redo is enabled
The main window of the Netedit.
const std::string myDescription
description of command
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
void redo()
redo the last command group
void updateControls()
update control contents after undo/redo or recompute
void undo()
undo the last command group
void p_clear()
clears the undo list (implies abort)
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
the function-object for an editing operation (abstract base)
bool trueChange()
wether original and new value differ
bool hasCommandGroup() const
Check if undoList has command group.
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
FXString redoName() const
get redo name
std::stack< CommandGroup * > myCommandGroups
int currentCommandGroupSize() const
get size of current CommandGroup
void p_abort()
reverts and discards ALL active command groups
void p_abortLastCommandGroup()
reverts last command group
long p_onUpdRedo(FXObject *, FXSelector, void *)
event after Redo
CommandGroup(std::string description)
Constructor.
GNEApplicationWindow *const myGNEApplicationWindowParent
FXString undoName() const
get undo Name
const std::string & getDescription()
get description
long p_onUpdUndo(FXObject *, FXSelector, void *)