@@ -696,20 +696,8 @@ class LayoutSelector {
696696
697697 void toggleVisibility () {
698698 isVisible = ! isVisible;
699- if (isVisible) {
700- // the very convoluted way of locking all controllers of a single controlP5 instance...
701- for (int i = 0 ; i < widgetManager. widgets. size(); i++ ) {
702- for (int j = 0 ; j < widgetManager. widgets. get(i). cp5_widget. getAll(). size(); j++ ) {
703- widgetManager. widgets. get(i). cp5_widget. getController(widgetManager. widgets. get(i). cp5_widget. getAll(). get(j). getAddress()). lock();
704- }
705- }
706- } else {
707- // the very convoluted way of unlocking all controllers of a single controlP5 instance...
708- for (int i = 0 ; i < widgetManager. widgets. size(); i++ ) {
709- for (int j = 0 ; j < widgetManager. widgets. get(i). cp5_widget. getAll(). size(); j++ ) {
710- widgetManager. widgets. get(i). cp5_widget. getController(widgetManager. widgets. get(i). cp5_widget. getAll(). get(j). getAddress()). unlock();
711- }
712- }
699+ if (widgetManager != null ) {
700+ widgetManager. lockCp5ObjectsInAllWidgets(isVisible);
713701 }
714702 }
715703
@@ -880,23 +868,9 @@ class ConfigSelector {
880868
881869 void toggleVisibility () {
882870 isVisible = ! isVisible;
883- if (systemMode >= SYSTEMMODE_POSTINIT ) {
884- if (isVisible) {
885- // the very convoluted way of locking all controllers of a single controlP5 instance...
886- for (int i = 0 ; i < widgetManager. widgets. size(); i++ ) {
887- for (int j = 0 ; j < widgetManager. widgets. get(i). cp5_widget. getAll(). size(); j++ ) {
888- widgetManager. widgets. get(i). cp5_widget. getController(widgetManager. widgets. get(i). cp5_widget. getAll(). get(j). getAddress()). lock();
889- }
890- }
891- clearAllSettingsPressed = false ;
892- } else {
893- // the very convoluted way of unlocking all controllers of a single controlP5 instance...
894- for (int i = 0 ; i < widgetManager. widgets. size(); i++ ) {
895- for (int j = 0 ; j < widgetManager. widgets. get(i). cp5_widget. getAll(). size(); j++ ) {
896- widgetManager. widgets. get(i). cp5_widget. getController(widgetManager. widgets. get(i). cp5_widget. getAll(). get(j). getAddress()). unlock();
897- }
898- }
899- }
871+ if (widgetManager != null ) {
872+ widgetManager. lockCp5ObjectsInAllWidgets(isVisible);
873+ clearAllSettingsPressed = ! isVisible;
900874 }
901875
902876 // When closed by any means and confirmation buttons are open...
@@ -1188,22 +1162,8 @@ class TutorialSelector {
11881162
11891163 void toggleVisibility () {
11901164 isVisible = ! isVisible;
1191- if (systemMode >= SYSTEMMODE_POSTINIT ) {
1192- if (isVisible) {
1193- // the very convoluted way of locking all controllers of a single controlP5 instance...
1194- for (int i = 0 ; i < widgetManager. widgets. size(); i++ ) {
1195- for (int j = 0 ; j < widgetManager. widgets. get(i). cp5_widget. getAll(). size(); j++ ) {
1196- widgetManager. widgets. get(i). cp5_widget. getController(widgetManager. widgets. get(i). cp5_widget. getAll(). get(j). getAddress()). lock();
1197- }
1198- }
1199- } else {
1200- // the very convoluted way of unlocking all controllers of a single controlP5 instance...
1201- for (int i = 0 ; i < widgetManager. widgets. size(); i++ ) {
1202- for (int j = 0 ; j < widgetManager. widgets. get(i). cp5_widget. getAll(). size(); j++ ) {
1203- widgetManager. widgets. get(i). cp5_widget. getController(widgetManager. widgets. get(i). cp5_widget. getAll(). get(j). getAddress()). unlock();
1204- }
1205- }
1206- }
1165+ if (widgetManager != null ) {
1166+ widgetManager. lockCp5ObjectsInAllWidgets(isVisible);
12071167 }
12081168 }
12091169
0 commit comments