General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Undo/Redo clearing of a specific item

  • MrPaul

    Undo/Redo clearing of a specific item

    Participants 4
    Replies 5
    Last 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.

    Reply

    Derek Read

    Reply to: Undo/Redo clearing of a specific item

    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?

    Reply

    XMetaLOldTimer

    Reply to: Undo/Redo clearing of a specific item

    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:

    [code]
    XMAX.Document.Undo();
    [/code]

    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].

    Regards

    Reply

    paorear

    Reply to: Undo/Redo clearing of a specific item

    +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'Rear

    Reply

    Derek Read

    Reply to: Undo/Redo clearing of a specific item

    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.

    Reply

    paorear

    Reply to: Undo/Redo clearing of a specific item

    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're probably not aware just through my forum posts – Mag knows how my team has done some pretty extensive customization of XMetaL for our purposes via .NET – quite successfully. The blending of the technologies via JavaScript is quite an interesting feat, but still leaves some gaps with what we are able to do at times.

    Paul O'Rear

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support