Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#2892 closed enhancement (fixed)

Undo/Redo feature in the Diagram view editing

Reported by: Francesco Casella Owned by: Adeel Asghar
Priority: high Milestone: 1.9.4
Component: OMEdit Version: trunk
Keywords: Cc: jan.kokert@…

Description

When editing a model in the Text view, it is possible to Undo/Redo changes. However, this is not possible in the Diagram view. If one delets or moves some models by accident, restoring the previous situation is pretty inconvenient. It should be possible to do it by just hitting Ctrl-Z.

Change History (11)

comment:1 by Adeel Asghar, 10 years ago

Cc: jan.kokert@… added

comment:2 by Jan Kokert, 10 years ago

After the implementation of snap to grid, manhattanize connection lines and resimulate control, the missing UNDO/REDO feature is the only remaining blocker of modelling in OMEdit in my eyes (see also #2478).

One possible data structure for a multi-level UNDO is a stack of course. In order to support REDO, a second stack keeps all the commands you've undone. So when you pop the undo stack to undo a command, you push the same command onto the redo stack. Further it's important to always clear the redo stack if you push a different command. The standard design pattern for this functionality seems to be Memento.

In two weeks I will present OpenModelica at our chair with a live demo. So it would be awesome if a rudimentary undo feature for component movement and connection lines would be available. =D

in reply to:  2 comment:3 by Adeel Asghar, 10 years ago

Replying to janK:

After the implementation of snap to grid, manhattanize connection lines and resimulate control, the missing UNDO/REDO feature is the only remaining blocker of modelling in OMEdit in my eyes (see also #2478).

One possible data structure for a multi-level UNDO is a stack of course. In order to support REDO, a second stack keeps all the commands you've undone. So when you pop the undo stack to undo a command, you push the same command onto the redo stack. Further it's important to always clear the redo stack if you push a different command. The standard design pattern for this functionality seems to be Memento.

We don't need to implement anything by our own. Qt has its own way of doing it. Qt's Undo Framework. Of course the implementation is stack based!

In two weeks I will present OpenModelica at our chair with a live demo. So it would be awesome if a rudimentary undo feature for component movement and connection lines would be available. =D

I am sorry but its not possible. There are some other projects on which I should work now otherwise I will miss deadlines. I will come back to GUI work next year and then I will implement it.

comment:4 by Jan Kokert, 10 years ago

Hi Adeas! "Qt's Undo Framework" -> This is great!
Sure, no hurry! Thanks for the willingness of implemeting it!

comment:5 by Martin Sjölund, 10 years ago

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:6 by anonymous, 9 years ago

Are any news about this ticket?
We've been waiting for undo for many months (it was discussed in other tickets even earlier than 2892).
Hope some activity on this is planned for the coming weeks or months!
Thank you.

comment:7 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:8 by Adeel Asghar, 9 years ago

Status: newaccepted

This issue has now been fixed in a development branch https://github.com/adeas31/OMEdit/tree/indentation for OpenModelica 1.9.4 final release.

comment:9 by Adeel Asghar, 9 years ago

Resolution: fixed
Status: acceptedclosed

The fix is now available via the nightly build.

comment:10 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.4-1.9.x

Milestone renamed

comment:11 by Martin Sjölund, 9 years ago

Milestone: 1.9.4-1.9.x1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.