99 myCurrentChange = myCurrentChange->next;
107 myCurrentChange(change),
113 myCurrentChange(nullptr),
144 throw ProcessError(
"GNEUndoList::undo() cannot call undo inside begin-end block");
168 throw ProcessError(
"GNEUndoList::redo() cannot call undo inside begin-end block");
231 throw ProcessError(
"GNEChangeGroup::begin: already working on undo or redo");
236 while (changeGroup->
group) {
237 changeGroup = changeGroup->
group;
273 if (!changeGroup->
group) {
274 throw ProcessError(
"GNEChangeGroup::end: no matching call to begin");
278 throw ProcessError(
"GNEChangeGroup::end: already working on undo or redo");
282 changeGroup = changeGroup->
group;
285 change = changeGroup->
group;
286 changeGroup->
group =
nullptr;
288 if (!change->
empty()) {
349 throw ProcessError(
"GNEChangeGroup::add: nullptr change argument");
353 throw ProcessError(
"GNEChangeGroup::add: already working on undo or redo");
363 while (changeGroup->
group) {
364 changeGroup = changeGroup->
group;
447 const FXButton* button =
dynamic_cast<FXButton*
>(sender);
451 if (buttonEnabled && !button->isEnabled()) {
452 sender->handle(
this, FXSEL(SEL_COMMAND, FXWindow::ID_ENABLE),
nullptr);
454 }
else if (!buttonEnabled && button->isEnabled()) {
455 sender->handle(
this, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE),
nullptr);
459 sender->handle(
this, buttonEnabled ? FXSEL(SEL_COMMAND, FXWindow::ID_ENABLE) : FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE),
nullptr);
462 FXMenuCommand* menuCommand =
dynamic_cast<FXMenuCommand*
>(sender);
469 caption =
TL(
"Disabled undo");
473 caption =
TL(
"Cannot Undo in the middle of ") +
myChangeGroups.top()->getDescription();
475 caption =
TL(
"Undo");
477 menuCommand->setText(caption.c_str());
478 menuCommand->update();
498 const FXButton* button =
dynamic_cast<FXButton*
>(sender);
502 if (enable && !button->isEnabled()) {
503 sender->handle(
this, FXSEL(SEL_COMMAND, FXWindow::ID_ENABLE),
nullptr);
505 }
else if (!enable && button->isEnabled()) {
506 sender->handle(
this, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE),
nullptr);
510 sender->handle(
this, enable ? FXSEL(SEL_COMMAND, FXWindow::ID_ENABLE) : FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE),
nullptr);
513 FXMenuCommand* menuCommand =
dynamic_cast<FXMenuCommand*
>(sender);
520 caption =
TL(
"Disabled redo");
524 caption =
TL(
"Cannot Redo in the middle of ") +
myChangeGroups.top()->getDescription();
526 caption =
TL(
"Redo");
528 menuCommand->setText(caption.c_str());
529 menuCommand->update();
552 if (!changeGroup->
group) {
553 throw ProcessError(
"GNEChangeGroup::abort: no matching call to begin");
557 throw ProcessError(
"GNEChangeGroup::abort: already working on undo or redo");
561 changeGroup = changeGroup->
group;
564 delete changeGroup->
group;
566 changeGroup->
group =
nullptr;
FXDEFMAP(GNEUndoList) GNEUndoListMap[]
@ DATA_SELECT
mode for selecting data elements
@ DATA_INSPECT
mode for inspecting data elements
Supermode
@brie enum for supermodes
@ NETWORK
Network mode (Edges, junctions, etc..)
@ NETWORK_SELECT
mode for selecting network elements
@ NETWORK_INSPECT
mode for inspecting network elements
@ DEMAND_INSPECT
mode for inspecting demand elements
@ DEMAND_SELECT
mode for selecting demand elements
@ MID_HOTKEY_CTRL_Y_REDO
Undo.
@ MID_HOTKEY_CTRL_Z_UNDO
Redo.
GUIViewUpdater gViewUpdater
GUIIcon
An enumeration of icons used by the gui applications.
The main window of Netedit.
const std::string & isUndoRedoEnabledTemporally() const
check if undo-redo is enabled temporally
void updateControls()
update control contents after undo/redo or recompute
GNEViewNet * getViewNet()
get pointer to viewNet
bool isUndoRedoAllowed() const
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNEChange * undoList
undo list command (can be access by GNEUndoList)
const std::string & getTimeStamp()
get timeStamp
GUIIcon getGroupIcon() const
get icon associated with this ChangeGroup
GNEChange * redoList
redo list command (can be access by GNEUndoList)
GNEChangeGroup * group
group (can be access by GNEUndoList)
bool empty() const
Return TRUE if empty.
Supermode getGroupSupermode() const
get supermode associated with this ChangeGroup
void undo()
Undo whole command group.
GNEChangeGroup()
FOX need this.
the function-object for an editing operation (abstract base)
virtual void redo()=0
redo action/operation
virtual int size() const
Return the size of the command group.
virtual void undo()=0
undo action/operation
Supermode getSupermode() const
get supermode
bool mergeWith(GNEChange *command)
Called by the undo system to try and merge the new incoming command with this command; should return ...
virtual std::string redoName() const =0
return redoName
virtual std::string undoName() const =0
return undoName
bool canMerge() const
Return TRUE if this command can be merged with previous undo commands. This is useful to combine e....
void refreshInspection()
refresh current inspection
SelectionInformation * getSelectionInformation() const
get modul for selection information
GUIIcon getGUIIcon() const
get GUI icon associated to this tag property
const std::string getTimeStamp() const
get timeStamp
const std::string getDescription() const
get description
bool end() const
check if iterator is at the end
FXIcon * getIcon() const
get icon
Iterator()
default constructor
Iterator & operator++(int)
increment operator
GNEChange * myCurrentChange
current change
int getIndex() const
get index
RedoIterator(const GNEUndoList *undoList)
constructor for GNEUndoList
UndoIterator(const GNEUndoList *undoList)
constructor for GNEUndoList
void abortCurrentSubGroup()
Abort the current command sub-group being compiled. All commands already added to the sub-groups undo...
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
bool hasCommandGroup() const
Check if undoList has command group.
void undo()
undo the last command group
long onUpdUndo(FXObject *, FXSelector, void *)
event after Undo
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
std::string undoName() const
Return name of the first undo command available; if no undo command available this will return the em...
GNEApplicationWindow *const myGNEApplicationWindowParent
void abortAllChangeGroups()
reverts and discards ALL active chained change groups
Supermode getRedoSupermode() const
get redo supermode
long onUpdRedo(FXObject *, FXSelector, void *)
event after Redo
bool myWorking
Currently busy with undo or redo.
void cut()
Cut the redo list. This is automatically invoked when a new undo command is added.
bool canRedo() const
Can we redo more commands.
Supermode getUndoSupermode() const
get undo supermode
bool canUndo() const
Can we undo more commands.
std::stack< GNEChangeGroup * > myChangeGroups
void redo()
redo the last command group
long onCmdUndo(FXObject *, FXSelector, void *)
int currentCommandGroupSize() const
get size of current CommandGroup
void abortLastChangeGroup()
reverts last active chained change group
long onCmdRedo(FXObject *, FXSelector, void *)
redo change
bool busy() const
Return TRUE if currently inside undo or redo operation; this is useful to avoid generating another un...
std::string redoName() const
Return name of the first redo command available; if no Redo command available this will return the em...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
GNEViewParent * getViewParent() const
get the net object
void updateViewNet(const bool ignoreViewUpdater=true) const
Mark the entire GNEViewNet to be repainted later.
GNESelectorFrame * getSelectorFrame() const
get frame for select elements
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void enableUpdate()
enable update
void disableUpdate()
disable update
Supermode currentSupermode
the current supermode