Refactored Undo to correct multiple undos required for some actions#525
Conversation
Moved calling of Value Change_Body Text.vi to after the Event Structure
Renamed Value Change_Body Text.vi to Apply Body Text.vi Moved VI into the lv_icon library Eliminated all calls to Fire Body Text Change.vi as it is not needed anymore with Apply Body Text.vi being called after the Event Structure Removed Fire Body Text Change.vi Still need to find other locations using the Body Text Value Change Signaling property
Moved Undo Redo Action.ctl into History class Cleanup of Body Text:Value Change event
Added History class to Global Data Created VI to build up the history state from the global data
Updated Classes Initialization.vi to use method Beginning of replacing FGV_Undo Redo.vi with class methods
Can now Add State, Get Current State, and Check for Changes Made necessary updates to Add Data to History and other VIs that were broken Still need to implement the Undo and Redo methods
Renamed class and moved to new folder
Added unit test Test Undo Flag Renamed Replay Data from History.vi to Set to State.vi
Changed all calls to Add Data to History.vi to Set Undo Flag.vi Removed setting of the undo flag from ViewLayer.vi and corrected all callers
Required clearing the undo flag even when data not added to the stack Clear Template layer on Layers tab when performing a Clear All
Development for Issue #514 - Created a History library and class to handle the undo/redo stack. The class is replacing the FGV_Undo Redo.vi. - History.lvclass was added to IE Classes.ctl, which is included in Global Data.ctl. This caused many VI updates purely related to the use of Global Data.ctl. - Moved Apply Body Text.vi and Add Data To History.vi to be called in the case structure with DrawIcon.vi. This makes it so that the icon text and adding to the undo/redo stack is performed after every action without the need to call them either directly or by creating an event. - Replaced all other calls to Add Data To History.vi with Set Undo Flag.vi. This flag is used by the Add Data To History.vi to see if actions should be added to the undo stack. The flag is cleared in the Add Data To History.vi to avoid the flag being persistent. - Removed all found Value(Signaling) property writes for the Body Text control. These were used to force the event that would draw the icon text, which often led to multiple undo states for a single action. - Fixed bug where Clear All menu item was not clearing out the Icon Template layer control. Template layer was still being cleared in the icon data, just not the control. - Updated unit tests related to the FGV_Undo Redo.vi to use History.lvclass instead. The tests were renamed accordingly. A unit test was added for testing the undo flag.
Created a VI Template.vi as a starting point of a VI with a built-in template layer
Set the Front Panel mode to match lv_icon.vi
Removed Deserialize Picture Control Data.vi from SET_UserLayers.vi Added Apply Transparency.vi to several VIs to accomplish the same goal
Template name in the Template class contained the extension, causing issues when performing an undo
Started Undo Redo manual test. Completed Templates Tab section.
Flattened folder hierarchy Moved VI Template.vi into Library Template.lvlib to aid testing import of library icon
- Corrected Layers being updated after Undo - Corrected template name during initialization - Corrected opacity changes flooding undo stack - Correct Filter Template value change not adding to the undo stack - Corrections to lv_icon to enable redraw after certain actions
Added Layers Tab and Menu Items sections
Bug corrections as well
When nothing is typed from the text tool, the Finalize Text does nothing. Added setting the Text Marker off when clicking outside of the icon preview
Because Eraser does not act on a temporary icon, the Add To History needs to be skipped on the Mouse Down The Eraser's actions will be added to the Undo stack on Mouse Up
…' into feature/514-multiple-undos-required-for-some-actions
Added tests for Layers Tab, Menu Items, and Tools. Corrected bugs involving the eraser tool, pencil tool, and text tool not properly being added to the undo/redo stack. All testing performed per 08 Undo Redo.md
|
Also I noticed that the following files in I know you didn't touch those files but did you want to fix them too? I think I am good with a static analysis of the code and will go on to run through the test plan tomorrow and report the results in a proper github review. |
Since I already need to add another correction, I can go ahead and clean those up. EDIT: Update is done |
Better error handling in Undo, Redo case of MenuSelection(User).vi Removed spaces in file names of Read Glyphs from File.vi and Write Glyphs to File.vi
j-medland
left a comment
There was a problem hiding this comment.
These look visually fine - I will run through the tests tomorrow as a review.
One additional thing - Can we take the extra space out of resource\plugins\NIIconEditor\Miscellaneous\Load Unload\Read Glyphs from File.vi?
Updated values were not passed out of Finalize Text.vi
Added History.lvlib:Unflatten State.vi Added a class data in History.lvclass to store flag to store the initial state and the initial state
Updates from comments made in #525 Corrected global data improperly wired Compare current and initial states in check change
|
Fantastic work @crossrulz. Thanks for your hard work on this PR and for putting up with my pedantry. I have merged this - I have noticed a couple of tiny tweaks for Test Firstly it has some typos on "Perform" at various places (eg Prerfom, Perorm) Section 3 - One of us can fix these at some point. |
Moved the handling of the undo stack into a class. States are now added to the stack in a single location with the Draw Icon. The handling of the body text was moved to the same location so that it does not cause multiple states from being created. All locations that previously added to the undo stack were updated to set the flag to add to the undo stack. This results in a single state being generated for a single action.
Unit tests were updated to test the History class instead of the Action Engine.
Manual tests were created and performed per 08 Undo Redo.md.
Resolves #514