Performing Undo on non-parameter changes in host

I’m trying to make Ctrl-Z in for example Ableton Live work also when my plugin performs changes that are not tied to a plugin parameter – For example per-sample parameters, channel naming, stuff that can’t be represented as a proper plugin parameter.

Reason as a host handles this brilliantly: Whenever I call updateHostDisplay(), Reason saves the entire state of the plugin and creates a new Undo entry called “Undo Change Patch”, so Undo/Redo will work as expected.

But in Live, all non-parameter changes seem to be completely ignored by the Undo system… I tried downloading JUCE 6.1.3 and called updateHostDisplay() with ChangeDetails().withNonParameterStateChanged(true). The only thing it achieved was that Live now flags the session as “dirty”, which is some kind of progress, I guess.

And this also applies when I load patches in my plugin: It will flag the session “dirty”, but nothing happens with the Undo history.

Are there any known workarounds for these problems that someone would like to share? Or something that I might be handling completely wrong in the first place?

Hosts are free to implement whatever Undo system they desire (or none, for that matter). I’d hate to use Reason for my plugin, if that’s what it does, because our non-parameter data might be quite large, and involve writing to disk. We have our own internal Undo stack for changes in our graph, and handle Ctrl-Z (etc.) ourselves when the graph is in use.

It will only save and recall whatever data the plugin gives it via getStateInformation(), so I think external disk data would be excluded?

I’ve been considering this option as well, but I’m not sure how to override Cmd/Ctrl-Z on both Windows and macOS via JUCE? Are you using some additional platform specific code to do this? Or maybe something I’ve overlooked in JUCE?

When saving a session, we (sometimes) write some data to an external file to save space in the session state data that the host saves, and we specify the location of that file in that data.

You can override keyPressed() in your Editor to trap those keystrokes, and check for key.getModifiers().isCommandDown() and key.getKeyCode() == ‘Z’ or ‘z’, etc.