I’m trying to set up my slider class (that inherits from juce::Slider) to break up it’s value change actions into different transactions every time the user starts a new “dragging” action.
It looks like the default behaviour of the juce::UndoManager is to group actions together into a single transaction, and that it’s up to me to call beginNewTransaction() to break them up.
My problem is that the way to call beginNewTransaction() seems overly convoluted.
I have a juce::Value as a property in a juce::ValueTree, which I then get the Slider::getValueObject to refer to for any value change callbacks.
If I want each new dragging action to start a new transaction, I have to either
- store a pointer to the undo manager in my slider class, and call beginNewTransaction on an overridden mouseDown() callback or
- make my plugin editor inherit from Slider::Listener and use the sliderDragStarted() listener callback to then access the UndoManager and call beginNewTransaction().
which both seem like a lot of work for something that seems like I’d want to happen for all of my controls.
Sorry if I’ve lost the point a bit, but I think my question is what’s the best way to break up slider transactions?