Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#2892 closed enhancement (fixed)

Undo/Redo feature in the Diagram view editing

Reported by: casella Owned by: adeas31
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 Changed 10 years ago by adeas31

  • Cc jan.kokert@… added

comment:2 follow-up: Changed 10 years ago by 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.

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

comment:3 in reply to: ↑ 2 Changed 10 years ago by adeas31

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 Changed 10 years ago by janK

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

comment:5 Changed 10 years ago by sjoelund.se

  • Milestone changed from 1.9.2 to 1.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:6 Changed 9 years ago by anonymous

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 Changed 9 years ago by sjoelund.se

  • Milestone changed from 1.9.3 to 1.9.4

Moved to new milestone 1.9.4

comment:8 Changed 9 years ago by adeas31

  • Status changed from new to accepted

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 Changed 9 years ago by adeas31

  • Resolution set to fixed
  • Status changed from accepted to closed

The fix is now available via the nightly build.

comment:10 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4 to 1.9.4-1.9.x

Milestone renamed

comment:11 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4-1.9.x to 1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.