MP 0.68 Undo, Redo and the asterix in the image tab

*** Please report new bugs here! ***

Moderators: helmut, XnTriq, xnview, Dreamer

Post Reply
HanVroon
Posts: 225
Joined: Thu Jan 28, 2010 7:30 am

MP 0.68 Undo, Redo and the asterix in the image tab

Post by HanVroon »

Hi,

I have noticed (in my opinion) incorrect behaviour regarding the changed status of an opened image.
For clarity: I have added the Undo button to the View mode toolbar.

Strange behaviour: Open image in View mode, open and cancel a change dialog:
- If an image is opened in View mode, the Undo button is already colored (not grayed out) though nothing is changed yet. Also the Undo and Redo menu options are colored.
- After a change dialog is opened (as example Levels) and cancelled, the Undo and Redo icons are still colored. The asterix that appeared in the image tab when the change dialog was opened remains there when the change dialog is cancelled. When closing the image tab, a Confirm to save changes dialog appears, though nothing has changed.

Correct behaviour: Open image in View mode, change and confirm:
- For the next case, an image is opened, a change dialog is opened (as example Levels), levels are modified and confirmed with OK, so the image is changed.
- The Undo and Redo buttons are correct. Something has changed, so Undo is colored. Nothing has been un-done yet, so Redo is grayed. The asterix is in the image tab, also correct.
- Choosing Undo works also correct. The image is back to original, Undo is grayed, Redo is colored and the asterix in the image tab is gone.
- Choosing Redo brings the change back in the image (levels are modified). after that Undo is colored, Redo is grayed, and the asterix is in the image tab.
- Toggle between Undo and Redo works fine.
- After the Undo, when the image is in original state, after closing the image tab there is no Confirm to save changes dialog.

I found a structure in this behaviour where after canceling a dialog that would modify the image, the image still keeps the changed status.
It only happens when modifications are choosen that have a dialog where "Apply to image" is an option and that option is checked. So all the options under menu Image, and then the menu options and sub options that have three dots, meaning there is a dialog, and then only thos that have the "Apply to image" possibility checked.

What I would ecpect to happen, is what is also seen in XnView classic behaviour:
- A fresh opened image should have Undo and Redo grayed out. There is nothing to undo or redo.
- When a modify dialog is opened, the Undo may be colored and the asterix may appear. Probably presets are applied directly, a slider might be moved, so that's OK.
- After a modify dialog is closed with Cancel, the Undo and Redo should be grayed out again and the asterix removed from the tab.,There should be no dialog Confirm to save changes when closing the image. Unless of cource a previous edit to the image was applied and not saved yet.

This issue might relate to: http://newsgroup.xnview.com/viewtopic.php?f=62&t=30676

Regards,
Han
User avatar
m.Th.
XnThusiast
Posts: 1676
Joined: Wed Aug 16, 2006 6:31 am
Contact:

Re: MP 0.68 Undo, Redo and the asterix in the image tab

Post by m.Th. »

Classical problems with the Undo/Redo state machine.

Usually these are solved by checking the count of actions in the history/undo list as well as where is the pointer in the list. These checks must be done at the beginning, after save (which will reset the Undo list) and after each editing action. Of course Undo/Redo buttons have a special treatment.
m. Th.

- Dark Themed XnViewMP 1.7.1 64bit on Win11 x64 -
Post Reply