Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional widgets Stage 1 #849

Open
8 tasks
p0nce opened this issue Jun 5, 2024 · 0 comments
Open
8 tasks

Conditional widgets Stage 1 #849

p0nce opened this issue Jun 5, 2024 · 0 comments
Labels
Enhancement This issue is about a new feature rather than a bug. Low interest Importance of this issue seems questionable for the bottom-line.. Mental load Is related to API usability.

Comments

@p0nce
Copy link
Collaborator

p0nce commented Jun 5, 2024

The issue is that at this point I have:

  • UICondKnob
  • UICondSlider
  • UICondSwitch
    etc etc.
    So there is about 10 conditional widget in Auburn codebase. Most of them define additional @ScriptProperty to control the appearance of the disabled widget.

All points towards a smallish Condition interpreter that can parse and evaluate an expression tree at given points in time (typically, when a listened parameter changes). For now the expression tree is implemented in Auburn codebase in a lame fixed way ( a set of && or || expressions, with 2 operators, and up to 12 operands).

Ideally we want:

  • the 4 operators: < > >= <=,
  • boolean and double expressions
  • && and ||
  • access to parameter
    The expression itself is evaluated when it's value may have changed.
    This evaluation will happen for many widgets, even inside audio thread as part of a host setParameter, and myst be quick!
  • there is a pre-parse that registers / deregisters Parameter to be listened to.

This will allows the agreeable idioms:

  • widget.enableIf(string expr); to control the .isDisabled state
  • widget.showIf(string expr); to control visibility

Any widget has such a conditional extension. This will avoid the existence of:

Stage 1

  • Add 2 owned CondLogic as a lazy extension of all UIElement. It's a set of || or && expression, suitable for most purposes but not very readable.
  • All UIElement have a queryable .isEnabled and .isDisabled. By default true, unless the condition is created and return false.

Now the sub-class are easier to write, but there are still multiple subclasses. This is 80% of the value.

Stage 2

  • Add an additional .enableIf call to UIElement that created the CondLogic and
  • Implement widget.enableIf
  • expression interpreter registers the listeners
  • expression interpreter eval the condition
  • The big issue is that because of our imperative styling, there is no way to not subclass in order to add the diffuseDisabled RGBA variables. Undoing that needs more declarative.
    * Perhaps find the semantic way to express al kind of disabled re-coloring.
  • Should this be Wren? Should this be fe-d, a Forth-like?
@p0nce p0nce added Enhancement This issue is about a new feature rather than a bug. Low interest Importance of this issue seems questionable for the bottom-line.. Mental load Is related to API usability. labels Jun 5, 2024
@p0nce p0nce changed the title Conditional widgets Conditional widgets Stage 1 Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement This issue is about a new feature rather than a bug. Low interest Importance of this issue seems questionable for the bottom-line.. Mental load Is related to API usability.
Projects
None yet
Development

No branches or pull requests

1 participant