forked from cryos/avogadro
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Draws in edit mode are now properly undo-able
Added some functions called beginMergeMode() and endMergeMode() in RWMolecule. beginMergeMode() turns interactive mode on, and it calls QUndoStack::beginMacro(). This results in all changes being merged into a single undo command once endMergeMode() is called. Note that every beginMergeMode() must have one endMergeMode(). When a left click or right click is pressed, beginMergeMode() is called. When the click is released, endMergeMode() is called. This allows whole draw actions to be lumped into a single undo and redo command. This is necessary since draws typically consist of several different types of commands that cannot be merged by interactive mode (creating an atom, creating a bond, moving an atom, changing the bond order, changing an atom type, etc.). However, interactive mode still merges similar commands that are in series to save space. In addition, bond.setOrder() is only called now if the bond order has actually changed. This allows interactive mode to merge together the drawing properly. Unfortunately, if there is only one undo on the undo stack, and an undo and a redo is called, there seems to be a glitch where all atoms are put at (0,0,0). This was not introduced by this commit, but it needs to be fixed sometime in the future...
- Loading branch information
Showing
2 changed files
with
51 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters