Skip to content

Commit 43f91d6

Browse files
committed
Update variable name for WidgetManager and NAV_HEIGHT
1 parent 6b83bc3 commit 43f91d6

20 files changed

Lines changed: 86 additions & 99 deletions

OpenBCI_GUI/ControlPanel.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2509,7 +2509,7 @@ class InitBox {
25092509
w_focus.killAuditoryFeedback();
25102510
w_marker.disposeUdpMarkerReceiver();
25112511
haltSystem();
2512-
wm.setAllWidgetsNull();
2512+
widgetManager.setAllWidgetsNull();
25132513
}
25142514
}
25152515

OpenBCI_GUI/Interactivity.pde

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ void mouseDragged() {
241241

242242
//calling mouse dragged inly outside of Control Panel
243243
if (controlPanel.isOpen == false) {
244-
wm.mouseDragged();
244+
widgetManager.mouseDragged();
245245
}
246246
}
247247
}
@@ -261,7 +261,7 @@ synchronized void mousePressed() {
261261
if (controlPanel.isOpen == false) {
262262
//was the stopButton pressed?
263263

264-
wm.mousePressed();
264+
widgetManager.mousePressed();
265265

266266
}
267267
}
@@ -295,7 +295,7 @@ synchronized void mouseReleased() {
295295
if (systemMode >= SYSTEMMODE_POSTINIT) {
296296

297297
// GUIWidgets_mouseReleased(); // to replace GUI_Manager version (above) soon... cdr 7/25/16
298-
wm.mouseReleased();
298+
widgetManager.mouseReleased();
299299
}
300300
}
301301

OpenBCI_GUI/OpenBCI_GUI.pde

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,10 @@ final int COLOR_SCHEME_ALTERNATIVE_A = 2;
275275
// int COLOR_SCHEME_ALTERNATIVE_B = 3;
276276
int colorScheme = COLOR_SCHEME_ALTERNATIVE_A;
277277

278-
WidgetManager wm;
279-
boolean wmVisible = true;
280-
CColor cp5_colors;
278+
WidgetManager widgetManager;
281279

282280
//Global variable for general navigation bar height
283-
final int navHeight = 22;
281+
final int NAV_HEIGHT = 22;
284282

285283
ButtonHelpText buttonHelpText;
286284

@@ -743,7 +741,7 @@ void initSystem() {
743741
topNav.controlPanelCollapser.setOff();
744742

745743
verbosePrint("OpenBCI_GUI: initSystem: -- Init 4 -- " + millis());
746-
wm = new WidgetManager();
744+
widgetManager = new WidgetManager();
747745

748746
verbosePrint("OpenBCI_GUI: initSystem: -- Init 5 -- " + millis());
749747

@@ -993,12 +991,12 @@ void systemUpdate() { // for updating data values and variables
993991
if (sessionSettings.screenHasBeenResized && sessionSettings.timeOfLastScreenResize + 500 > millis()) {
994992
ourApplet = this; //reset PApplet...
995993
topNav.screenHasBeenResized(width, height);
996-
wm.screenResized();
994+
widgetManager.screenResized();
997995
sessionSettings.screenHasBeenResized = false;
998996
}
999997

1000-
if (wm.isWMInitialized) {
1001-
wm.update();
998+
if (widgetManager != null) {
999+
widgetManager.update();
10021000
}
10031001
}
10041002
}
@@ -1010,7 +1008,7 @@ void systemDraw() { //for drawing to the screen
10101008
//background(255); //clear the screen
10111009

10121010
if (systemMode >= SYSTEMMODE_POSTINIT) {
1013-
wm.draw();
1011+
widgetManager.draw();
10141012
drawContainers();
10151013
}
10161014

OpenBCI_GUI/SessionSettings.pde

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -437,23 +437,23 @@ class SessionSettings {
437437

438438
int numActiveWidgets = 0;
439439
//Save what Widgets are active and respective Container number (see Containers.pde)
440-
for (int i = 0; i < wm.widgets.size(); i++) { //increment through all widgets
441-
if (wm.widgets.get(i).getIsActive()) { //If a widget is active...
440+
for (int i = 0; i < widgetManager.widgets.size(); i++) { //increment through all widgets
441+
if (widgetManager.widgets.get(i).getIsActive()) { //If a widget is active...
442442
numActiveWidgets++; //increment numActiveWidgets
443443
//println("Widget" + i + " is active");
444444
// activeWidgets.add(i); //keep track of the active widget
445-
int containerCountsave = wm.widgets.get(i).currentContainer;
445+
int containerCountsave = widgetManager.widgets.get(i).currentContainer;
446446
//println("Widget " + i + " is in Container " + containerCountsave);
447447
saveWidgetSettings.setInt("Widget_"+i, containerCountsave);
448-
} else if (!wm.widgets.get(i).getIsActive()) { //If a widget is not active...
448+
} else if (!widgetManager.widgets.get(i).getIsActive()) { //If a widget is not active...
449449
saveWidgetSettings.remove("Widget_"+i); //remove non-active widget from JSON
450450
//println("widget"+i+" is not active");
451451
}
452452
}
453453
println("SessionSettings: " + numActiveWidgets + " active widgets saved!");
454454
//Print what widgets are in the containers used by current layout for only the number of active widgets
455455
//for (int i = 0; i < numActiveWidgets; i++) {
456-
//int containerCounter = wm.layouts.get(currentLayout).containerInts[i];
456+
//int containerCounter = widgetManager.layouts.get(currentLayout).containerInts[i];
457457
//println("Container " + containerCounter + " is available"); //For debugging
458458
//}
459459
saveSettingsJSONData.setJSONObject(kJSONKeyWidget, saveWidgetSettings);
@@ -613,16 +613,16 @@ class SessionSettings {
613613
//get the Widget/Container settings
614614
JSONObject loadWidgetSettings = loadSettingsJSONData.getJSONObject(kJSONKeyWidget);
615615
//Apply Layout directly before loading and applying widgets to containers
616-
wm.setNewContainerLayout(currentLayout);
616+
widgetManager.setNewContainerLayout(currentLayout);
617617
verbosePrint("LoadGUISettings: Layout " + currentLayout + " Loaded!");
618618
numLoadedWidgets = loadWidgetSettings.size();
619619

620620

621621
//int numActiveWidgets = 0; //reset the counter
622-
for (int w = 0; w < wm.widgets.size(); w++) { //increment through all widgets
623-
if (wm.widgets.get(w).getIsActive()) { //If a widget is active...
622+
for (int w = 0; w < widgetManager.widgets.size(); w++) { //increment through all widgets
623+
if (widgetManager.widgets.get(w).getIsActive()) { //If a widget is active...
624624
verbosePrint("Deactivating widget [" + w + "]");
625-
wm.widgets.get(w).setIsActive(false);
625+
widgetManager.widgets.get(w).setIsActive(false);
626626
//numActiveWidgets++; //counter the number of de-activated widgets
627627
}
628628
}
@@ -638,8 +638,8 @@ class SessionSettings {
638638
//Load the container for the current widget[w]
639639
int containerToApply = loadWidgetSettings.getInt(loadedWidgetsArray[w]);
640640

641-
wm.widgets.get(widgetToActivate).setIsActive(true);//activate the new widget
642-
wm.widgets.get(widgetToActivate).setContainer(containerToApply);//map it to the container that was loaded!
641+
widgetManager.widgets.get(widgetToActivate).setIsActive(true);//activate the new widget
642+
widgetManager.widgets.get(widgetToActivate).setContainer(containerToApply);//map it to the container that was loaded!
643643
println("LoadGUISettings: Applied Widget " + widgetToActivate + " to Container " + containerToApply);
644644
}//end case for all widget/container settings
645645

@@ -673,7 +673,7 @@ class SessionSettings {
673673
} else {
674674
hpWidgetNumber = 5;
675675
}
676-
if (wm.widgets.get(hpWidgetNumber).getIsActive()) {
676+
if (widgetManager.widgets.get(hpWidgetNumber).getIsActive()) {
677677
w_headPlot.headPlot.setPositionSize(w_headPlot.headPlot.hp_x, w_headPlot.headPlot.hp_y, w_headPlot.headPlot.hp_w, w_headPlot.headPlot.hp_h, w_headPlot.headPlot.hp_win_x, w_headPlot.headPlot.hp_win_y);
678678
println("Headplot is active: Redrawing");
679679
}

OpenBCI_GUI/TopNav.pde

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -698,16 +698,16 @@ class LayoutSelector {
698698
isVisible = !isVisible;
699699
if (isVisible) {
700700
//the very convoluted way of locking all controllers of a single controlP5 instance...
701-
for (int i = 0; i < wm.widgets.size(); i++) {
702-
for (int j = 0; j < wm.widgets.get(i).cp5_widget.getAll().size(); j++) {
703-
wm.widgets.get(i).cp5_widget.getController(wm.widgets.get(i).cp5_widget.getAll().get(j).getAddress()).lock();
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();
704704
}
705705
}
706706
} else {
707707
//the very convoluted way of unlocking all controllers of a single controlP5 instance...
708-
for (int i = 0; i < wm.widgets.size(); i++) {
709-
for (int j = 0; j < wm.widgets.get(i).cp5_widget.getAll().size(); j++) {
710-
wm.widgets.get(i).cp5_widget.getController(wm.widgets.get(i).cp5_widget.getAll().get(j).getAddress()).unlock();
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();
711711
}
712712
}
713713
}
@@ -728,7 +728,7 @@ class LayoutSelector {
728728
public void controlEvent(CallbackEvent theEvent) {
729729
output("Layout [" + (layoutNumber) + "] selected.");
730730
toggleVisibility(); //shut layoutSelector if something is selected
731-
wm.setNewContainerLayout(layoutNumber); //have WidgetManager update Layout and active widgets
731+
widgetManager.setNewContainerLayout(layoutNumber); //have WidgetManager update Layout and active widgets
732732
sessionSettings.currentLayout = layoutNumber; //copy this value to be used when saving Layout setting
733733
}
734734
});
@@ -883,17 +883,17 @@ class ConfigSelector {
883883
if (systemMode >= SYSTEMMODE_POSTINIT) {
884884
if (isVisible) {
885885
//the very convoluted way of locking all controllers of a single controlP5 instance...
886-
for (int i = 0; i < wm.widgets.size(); i++) {
887-
for (int j = 0; j < wm.widgets.get(i).cp5_widget.getAll().size(); j++) {
888-
wm.widgets.get(i).cp5_widget.getController(wm.widgets.get(i).cp5_widget.getAll().get(j).getAddress()).lock();
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();
889889
}
890890
}
891891
clearAllSettingsPressed = false;
892892
} else {
893893
//the very convoluted way of unlocking all controllers of a single controlP5 instance...
894-
for (int i = 0; i < wm.widgets.size(); i++) {
895-
for (int j = 0; j < wm.widgets.get(i).cp5_widget.getAll().size(); j++) {
896-
wm.widgets.get(i).cp5_widget.getController(wm.widgets.get(i).cp5_widget.getAll().get(j).getAddress()).unlock();
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();
897897
}
898898
}
899899
}
@@ -1191,16 +1191,16 @@ class TutorialSelector {
11911191
if (systemMode >= SYSTEMMODE_POSTINIT) {
11921192
if (isVisible) {
11931193
//the very convoluted way of locking all controllers of a single controlP5 instance...
1194-
for (int i = 0; i < wm.widgets.size(); i++) {
1195-
for (int j = 0; j < wm.widgets.get(i).cp5_widget.getAll().size(); j++) {
1196-
wm.widgets.get(i).cp5_widget.getController(wm.widgets.get(i).cp5_widget.getAll().get(j).getAddress()).lock();
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();
11971197
}
11981198
}
11991199
} else {
12001200
//the very convoluted way of unlocking all controllers of a single controlP5 instance...
1201-
for (int i = 0; i < wm.widgets.size(); i++) {
1202-
for (int j = 0; j < wm.widgets.get(i).cp5_widget.getAll().size(); j++) {
1203-
wm.widgets.get(i).cp5_widget.getController(wm.widgets.get(i).cp5_widget.getAll().get(j).getAddress()).unlock();
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();
12041204
}
12051205
}
12061206
}

OpenBCI_GUI/W_Accelerometer.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class W_Accelerometer extends Widget {
6464
accelerometerBar.adjustTimeAxis(horizontalScale.getValue());
6565
accelerometerBar.adjustVertScale(verticalScale.getValue());
6666

67-
createAccelModeButton("accelModeButton", "Turn Accel. Off", (int)(x + 1), (int)(y0 + navHeight + 1), 120, navHeight - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE);
67+
createAccelModeButton("accelModeButton", "Turn Accel. Off", (int)(x + 1), (int)(y0 + NAV_HEIGHT + 1), 120, NAV_HEIGHT - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE);
6868
}
6969

7070
float adjustYMaxMinBasedOnSource() {
@@ -162,7 +162,7 @@ class W_Accelerometer extends Widget {
162162
//resize the accelerometer line graph
163163
accelerometerBar.screenResized(accelGraphX, accelGraphY, accelGraphWidth, accelGraphHeight); //bar x, bar y, bar w, bar h
164164
//update the position of the accel mode button
165-
accelModeButton.setPosition((int)(x0 + 1), (int)(y0 + navHeight + 1));
165+
accelModeButton.setPosition((int)(x0 + 1), (int)(y0 + NAV_HEIGHT + 1));
166166
}
167167

168168
void mousePressed() {

OpenBCI_GUI/W_AnalogRead.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class W_AnalogRead extends Widget {
5656
setVerticalScale(verticalScale.getIndex());
5757
setHorizontalScale(horizontalScale.getIndex());
5858

59-
createAnalogModeButton("analogModeButton", "Turn Analog Read On", (int)(x0 + 1), (int)(y0 + navHeight + 1), 128, navHeight - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE);
59+
createAnalogModeButton("analogModeButton", "Turn Analog Read On", (int)(x0 + 1), (int)(y0 + NAV_HEIGHT + 1), 128, NAV_HEIGHT - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE);
6060
}
6161

6262
public void update() {
@@ -111,7 +111,7 @@ class W_AnalogRead extends Widget {
111111
analogReadBars[i].screenResized(int(ar_x), analogReadBarY, int(ar_w), analogReadBarHeight); //bar x, bar y, bar w, bar h
112112
}
113113

114-
analogModeButton.setPosition((int)(x0 + 1), (int)(y0 + navHeight + 1));
114+
analogModeButton.setPosition((int)(x0 + 1), (int)(y0 + NAV_HEIGHT + 1));
115115
}
116116

117117
public void mousePressed() {

OpenBCI_GUI/W_BandPower.pde

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ class W_BandPower extends Widget {
6565
addDropdown("bandPowerDataFilteringDropdown", "Filtered?", filteredEnum.getEnumStringsAsList(), filteredEnum.getIndex());
6666

6767
// Setup for the BandPower plot
68-
bp_plot = new GPlot(ourApplet, x, y-navHeight, w, h+navHeight);
69-
// bp_plot.setPos(x, y+navHeight);
68+
bp_plot = new GPlot(ourApplet, x, y-NAV_HEIGHT, w, h+NAV_HEIGHT);
69+
// bp_plot.setPos(x, y+NAV_HEIGHT);
7070
bp_plot.setDim(w, h);
7171
bp_plot.setLogScale("y");
7272
bp_plot.setYLim(0.1, 100);
@@ -151,7 +151,7 @@ class W_BandPower extends Widget {
151151

152152
//for this widget need to redraw the grey bar, bc the FFT plot covers it up...
153153
fill(200, 200, 200);
154-
rect(x, y - navHeight, w, navHeight); //button bar
154+
rect(x, y - NAV_HEIGHT, w, NAV_HEIGHT); //button bar
155155

156156
popStyle();
157157
bpChanSelect.draw();

OpenBCI_GUI/W_CytonImpedance.pde

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ class W_CytonImpedance extends Widget {
9494
//Init the electrode map and fill and create signal check buttons
9595
initCytonImpedanceMap();
9696

97-
cytonResetAllChannels = createCytonResetChannelsButton("cytonResetAllChannels", "Reset Channels", (int)(x0 + 1), (int)(y0 + navHeight + 1), 90, navHeight - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE);
98-
cytonImpedanceMasterCheck = createCytonImpMasterCheckButton("cytonImpedanceMasterCheck", "Check All Channels", (int)(x0 + 1 + padding_3 + 90), (int)(y0 + navHeight + 1), 120, navHeight - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE);
97+
cytonResetAllChannels = createCytonResetChannelsButton("cytonResetAllChannels", "Reset Channels", (int)(x0 + 1), (int)(y0 + NAV_HEIGHT + 1), 90, NAV_HEIGHT - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE);
98+
cytonImpedanceMasterCheck = createCytonImpMasterCheckButton("cytonImpedanceMasterCheck", "Check All Channels", (int)(x0 + 1 + padding_3 + 90), (int)(y0 + NAV_HEIGHT + 1), 120, NAV_HEIGHT - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE);
9999
errorThreshold = new SignalCheckThresholdUI(threshold_ui_cp5, "errorThreshold", x + tableWidth + padding, y + h - navH, thresholdTFWidth, thresholdTFHeight, SIGNAL_CHECK_RED, signalCheckMode);
100100
warningThreshold = new SignalCheckThresholdUI(threshold_ui_cp5, "warningThreshold", x + tableWidth + padding, y + h - navH/2, thresholdTFWidth, thresholdTFHeight, SIGNAL_CHECK_YELLOW, signalCheckMode);
101101
}
@@ -187,8 +187,8 @@ class W_CytonImpedance extends Widget {
187187
imp_buttons_cp5.setGraphics(ourApplet, 0, 0);
188188
threshold_ui_cp5.setGraphics(ourApplet, 0, 0);
189189

190-
cytonResetAllChannels.setPosition((int)(x0 + 1), (int)(y0 + navHeight + 1));
191-
cytonImpedanceMasterCheck.setPosition((int)(x0 + 1 + padding_3 + 90), (int)(y0 + navHeight + 1));
190+
cytonResetAllChannels.setPosition((int)(x0 + 1), (int)(y0 + NAV_HEIGHT + 1));
191+
cytonImpedanceMasterCheck.setPosition((int)(x0 + 1 + padding_3 + 90), (int)(y0 + NAV_HEIGHT + 1));
192192

193193
resizeTable();
194194

OpenBCI_GUI/W_DigitalRead.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class W_DigitalRead extends Widget {
5858
digitalReadDots[i] = tempDot;
5959
}
6060

61-
createDigitalModeButton("digitalModeButton", "Turn Digital Read On", (int)(x0 + 1), (int)(y0 + navHeight + 1), 128, navHeight - 3, p5, 12, buttonsLightBlue, WHITE);
61+
createDigitalModeButton("digitalModeButton", "Turn Digital Read On", (int)(x0 + 1), (int)(y0 + NAV_HEIGHT + 1), 128, NAV_HEIGHT - 3, p5, 12, buttonsLightBlue, WHITE);
6262
}
6363

6464
public int getNumDigitalReads() {
@@ -126,7 +126,7 @@ class W_DigitalRead extends Widget {
126126

127127
}
128128

129-
digitalModeButton.setPosition((int)(x0 + 1), (int)(y0 + navHeight + 1));
129+
digitalModeButton.setPosition((int)(x0 + 1), (int)(y0 + NAV_HEIGHT + 1));
130130
}
131131

132132
public void mousePressed() {

0 commit comments

Comments
 (0)