57 FXIMPLEMENT_ABSTRACT(
GNEUndoList, FXUndoList, GNEUndoListMap, ARRAYNUMBER(GNEUndoListMap))
66 myGNEApplicationWindowParent(parent) {
166 FXButton* button =
dynamic_cast<FXButton*
>(sender);
170 if (enable && !button->isEnabled()) {
171 sender->handle(
this, FXSEL(SEL_COMMAND, FXWindow::ID_ENABLE),
nullptr);
173 }
else if (!enable && button->isEnabled()) {
174 sender->handle(
this, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE),
nullptr);
178 sender->handle(
this, enable ? FXSEL(SEL_COMMAND, FXWindow::ID_ENABLE) : FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE),
nullptr);
181 FXMenuCommand* menuCommand =
dynamic_cast<FXMenuCommand*
>(sender);
185 FXString caption = undoName();
190 caption = (
"Cannot Undo in the middle of " +
myCommandGroups.top()->getDescription()).c_str();
191 }
else if (!canUndo()) {
194 menuCommand->handle(
this, FXSEL(SEL_COMMAND, FXMenuCaption::ID_SETSTRINGVALUE), (
void*)&caption);
195 menuCommand->update();
206 FXButton* button =
dynamic_cast<FXButton*
>(sender);
210 if (enable && !button->isEnabled()) {
211 sender->handle(
this, FXSEL(SEL_COMMAND, FXWindow::ID_ENABLE),
nullptr);
213 }
else if (!enable && button->isEnabled()) {
214 sender->handle(
this, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE),
nullptr);
218 sender->handle(
this, enable ? FXSEL(SEL_COMMAND, FXWindow::ID_ENABLE) : FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE),
nullptr);
221 FXMenuCommand* menuCommand =
dynamic_cast<FXMenuCommand*
>(sender);
225 FXString caption = redoName();
230 caption = (
"Cannot Redo in the middle of " +
myCommandGroups.top()->getDescription()).c_str();
231 }
else if (!canRedo()) {
234 menuCommand->handle(
this, FXSEL(SEL_COMMAND, FXMenuCaption::ID_SETSTRINGVALUE), (
void*)&caption);
235 menuCommand->update();
248 myDescription(description) {
254 return myDescription;
260 return (
"Undo " + myDescription).c_str();
266 return (
"Redo " + myDescription).c_str();
FXDEFMAP(GNEUndoList) GNEUndoListMap[]
The main window of the Netedit.
void updateControls()
update control contents after undo/redo or recompute
GNEViewNet * getViewNet()
get pointer to viewNet
const std::string & isUndoRedoEnabled() const
check if undo-redo is enabled
the function-object for an editing operation (abstract base)
bool trueChange()
wether original and new value differ
FXString undoName() const
get undo Name
FXString redoName() const
get redo name
CommandGroup(std::string description)
Constructor.
const std::string & getDescription()
get description
bool hasCommandGroup() const
Check if undoList has command group.
void undo()
undo the last command group
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
GNEApplicationWindow *const myGNEApplicationWindowParent
void p_clear()
clears the undo list (implies abort)
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...
std::stack< CommandGroup * > myCommandGroups
void redo()
redo the last command group
int currentCommandGroupSize() const
get size of current CommandGroup
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
long p_onUpdUndo(FXObject *, FXSelector, void *)
long p_onUpdRedo(FXObject *, FXSelector, void *)
event after Redo
void p_abort()
reverts and discards ALL active command groups
void p_abortLastCommandGroup()
reverts last command group
void enableIntervalBarUpdate()
enable interval bar update
void disableIntervalBarUpdate()
enable interval bar update
GNEViewNetHelper::IntervalBar & getIntervalBar()
get interval bar
void updateViewNet() const
Mark the entire GNEViewNet to be repainted later.