General XMetaL Discussion
MrPaul April 9, 2013 at 2:46 pm
Undo/Redo clearing of a specific itemApril 9, 2013 at 2:46 pmParticipants 4Replies 5Last Activity 9 years, 5 months ago
In XMAX v6, is there a way to clear the last item in the undo stack, as opposed to the entire thing via UndoClear? If not, is there a way to temporarily disable recording the action in the call stack?
Thanks.Derek Read April 9, 2013 at 6:45 pm
Reply to: Undo/Redo clearing of a specific itemApril 9, 2013 at 6:45 pm
The only way to “clear” the last item is to undo it.
A macro is undone all at once, so if you put everything into one macro (I'm taking a guess that this is an issue with scripting) then undo should reverse everything it did. Is there some particular issue you are seeing that you could elaborate on?XMetaLOldTimer April 15, 2013 at 10:49 pm
Reply to: Undo/Redo clearing of a specific itemApril 15, 2013 at 10:49 pm
In XMAX v6, is there a way to clear the last item in the undo stack, as opposed to the entire thing via UndoClear?
It is possible from the XMAX application, i.e. from outside of XMAX. It is not possible from within a macro running inside of XMAX script engine. To do from outside, take your XMAX instance from your application, I'll assume an HTML application with an object tag having an id=”XMAX” and Jscript:
This will rollback the last mutation the system did. If you ran a macro previously, it would undo everything the macro did as one action. If you did a XMAX.Document.Paste(), it would undo the paste.
XMAX 7.0 has two APIs, BeginMutation & EndMutations, which to enable grouping a series of document mutations invoked from the outside of XMAX (i.e. not from a macro). The whole idea here is to allow rolling back that grouping with a single call to Document.Undo(), or Redo() for that matter.
Related info can be read in this posting: [url=http://forums.xmetal.com/index.php/topic,550.msg2045.html]http://forums.xmetal.com/index.php/topic,550.msg2045.html[/url].
Regardspaorear February 2, 2015 at 9:03 pm
Reply to: Undo/Redo clearing of a specific itemFebruary 2, 2015 at 9:03 pm
+1 on this request and not limited to XMAX. We could use this XMetaL 8 (and 9 assuming it's not there, too). It would be great to have access to the Undo list in general.
Undo captures items like View switches, which for our users is somewhat unintuitive – a View switch is not an edit action. From another angle, we have a mechanism that provides a PI based comment UI that inserts and deletes comments in the content that are invisible in the Tags On view. Unfortunately, if a user inserts a comment and then hits Undo, it rolls back our content edit, but there is no mechanism for tracking this undo 'event' in order to update our UI (unless I'm missing something).
Being able to immediately remove certain types of actions from the Undo buffer would enable us to improve our user's experience.
Paul O'RearDerek Read February 2, 2015 at 11:44 pm
Reply to: Undo/Redo clearing of a specific itemFebruary 2, 2015 at 11:44 pm
I'll see if I can get XMetaLOldTimer to comment here, but…
I think you misunderstand the purpose of the BeginMutation & EndMutations APIs. They allow a group actions performed in a script to be grouped and undone all as one Undo action.
There is no way to skip over actions when performing an Undo. What makes the software so flexible (that any number of customizations might be added to it to extend or alter its behaviour) requires some fundamental limitations to be in place and one of those is currently that an Undo undoes whatever was done last, including changes made via script. At least that's my take on it.
When it comes to view switches being included in Undo, that is just something people using the software need to get used to, even if it is seen as a quirk unique to XMetaL Author. Tags On and Normal view are using the same DOM but a particular set of user interactions (keyboard and / or mouse input) might do something slightly different in each view (this includes many APIs that mimic these user interactions). This is true in general, but your specific case highlights this perhaps. You have PIs hidden in one view but not in the other so it would be possible for the user to select a PI in one view but not possible to select it in the other view.
Many APIs that function in these two views cannot be used in Plain Text view at all, primarily because Plain Text view does not use a DOM but also because it has a completely different rendering model. Switching from Plain Text view into one of the other views is effectively the same as opening the file from disk (the entire DOM is recreated during the view switch, just as it is built when reading a file in). Probably most important (or most obvious) is that in addition to these things, switching views triggers a bunch of events, inside any of which an application-level macro (often created by a partner) or a document-level macro might run script which might alter the document. So, because a view change might alter the document the entire thing (whatever might have run during the view switch, but including the view switch) is undone when the user asks to Undo.paorear February 3, 2015 at 1:00 am
Reply to: Undo/Redo clearing of a specific itemFebruary 3, 2015 at 1:00 am
Thanks for that explanation, Derek! I can see how this derives from the Document/View MFC model of things. I've not heard of those BeginMutation and EndMutation APIs – do you have a reference for those?
- You must be logged in to reply to this topic.