Inconsistent API for change notifications on controls

Consider the following function signatures:

void Button::setToggleState (bool shouldBeOn, bool sendChangeNotification);
void ComboBox::setSelectedId (const int newItemId, const bool dontSendChangeMessage)

This is pretty self explanatory. true and false have opposite meanings for functions that perform similar operations.

That’s something that has been annoying me for a couple of years now!

It’s easy enough to change, but will mean a whole lot of annoyance to existing code. The only safe way to change it is to replace it with an enum or something, so all existing code breaks and people need to go through explicitly replacing the bools with a descriptor. That’d be a much better design, but I’ve been reluctant to do it because it’ll be such a nuisance to do!

You might hate this, but:

void Button::setToggleStateAndNotify (bool shouldBeOn) { setToggleState (shouldBeOn, true); }
void Button::setToggleStateWithoutNotify (bool shouldBeOn); { setToggleState (shouldBeOn, false); }

Of course I could just add this in a subclass without disturbing Juce.

Yes, that’d be another approach. It’s on my to-do-list to have a look at this!