Dplug icon indicating copy to clipboard operation
Dplug copied to clipboard

"Disabled" widgets

Open p0nce opened this issue 2 years ago • 1 comments

A useful class for widgets are conditional, and "enabled" only when certain Parameter conditions are met. Typically, interacting with them will force one of these conditions too. Right now, the widget is forced to listen to these "enabling" parameters.

Is there something more composable? So that the same widget could work with a Parameter that can be disabled by another Parameter, or just vanilla and never be disabled.

Should the disabled state be in Parameter? Should the disabled flag be in UIElement?

p0nce avatar Apr 29 '22 19:04 p0nce

In a first approximation:

  • [ ] disabled is a UIElement field, every UI element is enabled at first
  • [ ] it is inherited, an element is disabled if a parent is disabled (much like: visible)
  • [ ] the parent listen to the parameters to set itself enabled or not based upon that
  • [ ] Parameter stay unchanged
  • [ ] isDisabled can be used to draw widget in grey
  • [ ] when a click on a widget is successful, it calls the parent.requestEnable, it's up to the parent to do something or not (typically: change a BoolParameter to true) QUESTION: isn't this too detailed??? sometimes enabledness could be because of bypass, do we want that OR closure-like callbacks
  • [ ] when enabled-ness change, self (and transitively, children) must be setDirty

Main question is: how to manage "clicking on knob enables the whole section" thing? Would require a new virtual function "request section enable" for the information to bubble up to the parent. Should work with state, and parameters potentially. Must be restorable from save somehow.

p0nce avatar Aug 19 '22 12:08 p0nce