smeerten / ssnake

A program for the analysis of NMR data.
Other
20 stars 15 forks source link

User x-axis cannot be restored by undo/redo after it is cleared #96

Closed wfranssen closed 2 years ago

wfranssen commented 3 years ago

Setting a user x-axis and then doing undo/redo works as it should. However, if the axis is cleared (e.g. by setting the sw again) this cannot be undone anymore. The user x-axis is not stored, and undoing and redoing does not make it appear again.

In essence this is because the 'resetXax' routine is run, but is not part of the operation that is saved in the undo. Just after the user X-axis is set, this axis info is still in the active data set, and can be used when making the 'redo' after the 'undo' is done. After the sw reset, this info is lost, and the redo of the user x-axis does nothing.

In order to fix this, I think a user x-axis needs to be recognized, and saved in the operation that removes it. Undoing this operation than must also restore the user x-axis. Quite cumbersome I guess. But perhaps there is a better idea?