Skip to content

Components: refactor Button input handling#1271

Merged
daschuer merged 4 commits intomixxxdj:masterfrom
Be-ing:components_button_types
May 31, 2017
Merged

Components: refactor Button input handling#1271
daschuer merged 4 commits intomixxxdj:masterfrom
Be-ing:components_button_types

Conversation

@Be-ing
Copy link
Copy Markdown
Contributor

@Be-ing Be-ing commented May 29, 2017

Remove the old onlyOnPress Button property. When set to false, this would toggle the value of a Control on button up and button down, which is not really the correct behavior. Instead, let Buttons have a type, with the default type being push. The button types are:

  • push: set inKey to 1 on button press and 0 on button release
  • toggle: invert value of inKey on button press
  • powerWindow: like toggle, but toggles the value of inKey again on button up when long pressed

The ComponentContainer.shift() and ComponentContainer.unshift() functions automatically take care of setting the inKey of push type Buttons to 0 on shift/unshift to ensure that it does not matter whether shift or the Button is released first. Before this required some ugly hacks that would have to be implemented by each Button.

This is a backwards incompatible change. Previously, the default was to set the onlyOnPress property to true, equivalent to the new toggle type. Buttons that had onlyOnPress set to false before can simply remove that and use the default push type. All the special Buttons implemented in the library such as HotcueButton and the Buttons for the EffectUnit have been updated appropriately. I'll update #1200 and #1243 for the new API.

remove the old onlyOnPress Button property. When set to false, this
would toggle the value of a Control on button up and button down, which
is not really the correct behavior. Instead, let Buttons have a type,
with the default type being push. The button types are:

push: set inKey to 1 on button press and 0 on button release
toggle: toggle value of inKey on button press
trigger: set inKey to 1 on button press
powerWindow: like toggle, but toggles the value of inKey again on button
up when long pressed

The ComponentContainer.shift() and ComponentContainer.unshift()
functions automatically take care of setting the inKey of push type
Buttons to 0 on shift/unshift to ensure that it does not matter whether
shift or the Button is released first.
@Be-ing Be-ing mentioned this pull request May 29, 2017
4 tasks
that have specialized input functions instead of the prototype
Button input function
@Be-ing
Copy link
Copy Markdown
Contributor Author

Be-ing commented May 29, 2017

@ronso0 and @uklotzde, any thoughts on this?

@ronso0
Copy link
Copy Markdown
Member

ronso0 commented May 30, 2017

I can test this next days.
Essentially, now the physical FX enable buttons would work like respective buttons in skin, right?

@Be-ing
Copy link
Copy Markdown
Contributor Author

Be-ing commented May 30, 2017

Essentially, now the physical FX enable buttons would work like respective buttons in skin, right?

That has already been the case since #1249 was merged. The EffectUnit API has not changed, neither has its behavior. I'm looking for feedback on the changes to the Button API.

Be-ing added 2 commits May 30, 2017 12:42
I do not think there is a use case for it. Controls that only do
something when set to 1 still need to be reset to 0 or their button in
the skin will remain on after releasing the controller Button.
remove log spam from killing expired timers
@Be-ing
Copy link
Copy Markdown
Contributor Author

Be-ing commented May 30, 2017

Can we think of a better name than powerWindow? toggleHold?

@ronso0
Copy link
Copy Markdown
Member

ronso0 commented May 30, 2017

That has already been the case since #1249 was merged. The EffectUnit API has not changed, neither has its behavior.

Woohoo, wasn't aware of that PR. Thanks!
I use Components for effects only.

@daschuer
Copy link
Copy Markdown
Member

@ronso0 can we merge this now?

@ronso0
Copy link
Copy Markdown
Member

ronso0 commented May 31, 2017

@daschuer Sorry, I can't tell...as I said I use Components for effects only, don't know what difference it makes for a complete Components mapping

@daschuer
Copy link
Copy Markdown
Member

daschuer commented May 31, 2017 via email

@Be-ing
Copy link
Copy Markdown
Contributor Author

Be-ing commented May 31, 2017

Sure, then #1200 and #1243 can be merged, but those need #940 merged to see beatloop_size and beatjump_size on screen.

@daschuer
Copy link
Copy Markdown
Member

Ok, Thank you for your work.

@daschuer daschuer merged commit df521cc into mixxxdj:master May 31, 2017
@Be-ing Be-ing deleted the components_button_types branch June 1, 2017 20:09
@Be-ing Be-ing mentioned this pull request Jun 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants