diff --git a/OpenBCI_GUI/ADS1299SettingsController.pde b/OpenBCI_GUI/ADS1299SettingsController.pde index 9d1f8dacb..a5f5d1c0c 100644 --- a/OpenBCI_GUI/ADS1299SettingsController.pde +++ b/OpenBCI_GUI/ADS1299SettingsController.pde @@ -102,7 +102,7 @@ class ADS1299SettingsController { if (isVisible) { //Control button space above channels pushStyle(); - //stroke(31,69,110, 50); + //stroke(OPENBCI_BLUE_ALPHA50); stroke(OBJECT_BORDER_GREY); fill(GREY_100); rect(x, y - columnLabelH, w, columnLabelH); @@ -300,7 +300,7 @@ class ADS1299SettingsController { if (!atLeastOneChannelHasChanged) { output("No new settings to send to board."); } else if (noErrors) { - output("Hardware Settings sent to board!"); + outputSuccess("Hardware Settings sent to board!"); } else { PopupMessage msg = new PopupMessage("Error", "Failed to send one or more Hardware Settings to board. Check hardware and battery level. Cyton users, check that your dongle is connected with blue light shining."); } diff --git a/OpenBCI_GUI/Containers.pde b/OpenBCI_GUI/Containers.pde index 15e419703..1dbd200e4 100644 --- a/OpenBCI_GUI/Containers.pde +++ b/OpenBCI_GUI/Containers.pde @@ -210,7 +210,7 @@ public class Container { //stroke(255, 0, 0); //rect(x0, y0, w0, h0); - fill(31, 69, 110, 100); + fill(OPENBCI_BLUE_ALPHA100); noStroke(); rect(x, y, w, h); diff --git a/OpenBCI_GUI/ControlPanel.pde b/OpenBCI_GUI/ControlPanel.pde index f6f8356c7..a18e39e40 100644 --- a/OpenBCI_GUI/ControlPanel.pde +++ b/OpenBCI_GUI/ControlPanel.pde @@ -1339,7 +1339,7 @@ class SessionDataBox { .setOpen(false) .setColor(settings.dropdownColors) .setOutlineColor(150) - //.setColorBackground(color(31,69,110)) // text field bg color + //.setColorBackground(OPENBCI_BLUE) // text field bg color .setColorValueLabel(OPENBCI_DARKBLUE) // text color //.setColorCaptionLabel(color(255)) //.setColorForeground(color(125)) // border color when not selected @@ -1987,7 +1987,7 @@ class RecentPlaybackBox { void createRecentPlaybackFilesDropdown(String name, List _items){ recentPlaybackSL = rpb_cp5.addScrollableList(name) .setOpen(false) - .setColorBackground(color(31,69,110)) // text field bg color + .setColorBackground(OPENBCI_BLUE) // text field bg color .setColorValueLabel(color(255)) // text color .setColorCaptionLabel(color(255)) .setColorForeground(color(125)) // border color when not selected @@ -2132,7 +2132,7 @@ class GaleaBox { private ScrollableList createDropdown(String name, GaleaSettingsEnum[] enumValues){ ScrollableList list = localCP5.addScrollableList(name) .setOpen(false) - .setColorBackground(color(31,69,110)) // text field bg color + .setColorBackground(OPENBCI_BLUE) // text field bg color .setColorValueLabel(color(255)) // text color .setColorCaptionLabel(color(255)) .setColorForeground(color(125)) // border color when not selected @@ -2598,7 +2598,7 @@ class StreamingBoardBox { private ScrollableList createDropdown(String name, BrainFlowStreaming_Boards[] enumValues){ ScrollableList list = localCP5.addScrollableList(name) .setOpen(false) - .setColorBackground(color(31,69,110)) // text field bg color + .setColorBackground(OPENBCI_BLUE) // text field bg color .setColorValueLabel(color(255)) // text color .setColorCaptionLabel(color(255)) .setColorForeground(color(125)) // border color when not selected @@ -3089,25 +3089,26 @@ class InitBox { public void initButtonPressed() { if (getInitSessionButtonText().equals("START SESSION")) { if ((eegDataSource == DATASOURCE_CYTON && selectedProtocol == BoardProtocol.NONE) || (eegDataSource == DATASOURCE_GANGLION && selectedProtocol == BoardProtocol.NONE)) { - output("No Transfer Protocol selected. Please select your Transfer Protocol and retry system initiation."); + outputWarn("No Transfer Protocol selected. Please select your Transfer Protocol and retry system initiation."); return; } else if (eegDataSource == DATASOURCE_CYTON && selectedProtocol == BoardProtocol.SERIAL && openBCI_portName == "N/A") { //if data source == normal && if no serial port selected OR no SD setting selected - output("No Serial/COM port selected. Please select your Serial/COM port and retry system initiation."); + outputWarn("No Serial/COM port selected. Attempting to AUTO-CONNECT to Cyton."); + controlPanel.comPortBox.attemptAutoConnectCyton(); return; } else if (eegDataSource == DATASOURCE_CYTON && selectedProtocol == BoardProtocol.WIFI && wifi_portName == "N/A" && controlPanel.getWifiSearchStyle() == controlPanel.WIFI_DYNAMIC) { - output("No Wifi Shield selected. Please select your Wifi Shield and retry system initiation."); + outputWarn("No Wifi Shield selected. Please select your Wifi Shield and retry system initiation."); return; } else if (eegDataSource == DATASOURCE_PLAYBACKFILE && playbackData_fname == "N/A" && sdData_fname == "N/A") { //if data source == playback && playback file == 'N/A' - output("No playback file selected. Please select a playback file and retry system initiation."); // tell user that they need to select a file before the system can be started + outputWarn("No playback file selected. Please select a playback file and retry system initiation."); // tell user that they need to select a file before the system can be started return; } else if (eegDataSource == DATASOURCE_GANGLION && (selectedProtocol == BoardProtocol.BLE || selectedProtocol == BoardProtocol.BLED112) && ganglion_portName == "N/A") { - output("No BLE device selected. Please select your Ganglion device and retry system initiation."); + outputWarn("No BLE device selected. Please select your Ganglion device and retry system initiation."); return; } else if (eegDataSource == DATASOURCE_GANGLION && selectedProtocol == BoardProtocol.WIFI && wifi_portName == "N/A" && controlPanel.getWifiSearchStyle() == controlPanel.WIFI_DYNAMIC) { - output("No Wifi Shield selected. Please select your Wifi Shield and retry system initiation."); + outputWarn("No Wifi Shield selected. Please select your Wifi Shield and retry system initiation."); return; } else if (eegDataSource == -1) {//if no data source selected - output("No DATA SOURCE selected. Please select a DATA SOURCE and retry system initiation.");//tell user they must select a data source before initiating system + outputWarn("No DATA SOURCE selected. Please select a DATA SOURCE and retry system initiation.");//tell user they must select a data source before initiating system return; } else { //otherwise, initiate system! //verbosePrint("ControlPanel: CPmouseReleased: init"); diff --git a/OpenBCI_GUI/CustomCp5Classes.pde b/OpenBCI_GUI/CustomCp5Classes.pde index 8d2dd1ffa..ced72f01b 100644 --- a/OpenBCI_GUI/CustomCp5Classes.pde +++ b/OpenBCI_GUI/CustomCp5Classes.pde @@ -115,11 +115,11 @@ class ButtonHelpText{ //if on left side of screen, draw box brightness to prevent box off screen if(x <= width/2){ rect(x, y, 200, 2*padding + numLines*lineSpacing + 4); - fill(31,69,110, masterOpacity); //text colof + fill(31,69,110, masterOpacity); //text color text(myText, x + padding, y + padding, 180, (numLines*lineSpacing + 4)); } else{ //if on right side of screen, draw box left to prevent box off screen rect(x - 200, y, 200, 2*padding + numLines*lineSpacing + 4); - fill(31,69,110); //text colof + fill(OPENBCI_BLUE); //text color text(myText, x + padding - 200, y + padding, 180, (numLines*lineSpacing + 4)); } popStyle(); diff --git a/OpenBCI_GUI/Debugging.pde b/OpenBCI_GUI/Debugging.pde index 26258292c..caffb8fd9 100644 --- a/OpenBCI_GUI/Debugging.pde +++ b/OpenBCI_GUI/Debugging.pde @@ -95,7 +95,7 @@ class HelpWidget { } else if (colorScheme == COLOR_SCHEME_ALTERNATIVE_A){ // draw background of widget stroke(OPENBCI_DARKBLUE); - fill(31,69,110); + fill(OPENBCI_BLUE); rect(-1, height-h, width+2, h); noStroke(); @@ -158,8 +158,8 @@ class HelpWidget { return color(199, sat, 97); case SUCCESS: //base color - #DFF2BF; - maxSat = 50; - sat = 25; + maxSat = 25; + sat = 0; sat = (int)map(fadeVal, 0, 100, sat, maxSat); return color(106, sat, 95); case WARN: diff --git a/OpenBCI_GUI/FilterUI.pde b/OpenBCI_GUI/FilterUI.pde index 9abb9c5d4..ed6ea3925 100644 --- a/OpenBCI_GUI/FilterUI.pde +++ b/OpenBCI_GUI/FilterUI.pde @@ -88,6 +88,8 @@ class FilterUIPopup extends PApplet implements Runnable { private int expanderLineTwoStart; private int[] expanderTriangleXYCollapsed = new int[6]; private int[] expanderTriangleXYExpanded = new int[6]; + private boolean ignoreExpanderInteraction = false; + List cp5ElementsToCheck = new ArrayList(); DecimalFormat df = new DecimalFormat("#.0"); @@ -206,10 +208,12 @@ class FilterUIPopup extends PApplet implements Runnable { rect(0, 0, width, headerHeight); // Draw Channel Expander + lockExpanderOnOverlapCheck(cp5ElementsToCheck); expanderIsHover = mouseY > expanderY - expanderH/2 && mouseX < expanderX + expanderW && mouseY < expanderY + expanderH/2 - && mouseX > expanderX; + && mouseX > expanderX + && !ignoreExpanderInteraction; color expanderColor = expanderIsHover ? OPENBCI_BLUE : color(102); int[] triXY = filterSettings.values.filterChannelSelect == FilterChannelSelect.ALL_CHANNELS ? expanderTriangleXYCollapsed : @@ -327,6 +331,8 @@ class FilterUIPopup extends PApplet implements Runnable { // Create header objects last so they always draw on top! bfGlobalFilterDropdown = createDropdown("filter", -1, headerObjX[1], headerObjY, headerObjWidth, filterSettings.values.brainFlowFilter, BFFilter.values()); bfEnvironmentalNoiseDropdown = createDropdown("environmentalFilter", -1, headerObjX[3], headerObjY, headerObjWidth - 10, filterSettings.values.globalEnvFilter, GlobalEnvironmentalFilter.values()); + cp5ElementsToCheck.add(bfGlobalFilterDropdown); + cp5ElementsToCheck.add(bfEnvironmentalNoiseDropdown); updateChannelCp5Objects(); arrangeAllObjectsXY(); @@ -910,6 +916,7 @@ class FilterUIPopup extends PApplet implements Runnable { filterTypeDropdowns[chan] = createDropdown("filterType"+chan, chan, lg_spacer*4 + textfieldWidth*3, headerHeight*2 + sm_spacer*(chan+2) + uiObjectHeight*(chan+1), typeDropdownWidth, filterSettings.values.masterBandPassFilterType, BrainFlowFilterType.values()); } masterFilterTypeDropdown = createDropdown("masterFilterTypeDropdown", -1, lg_spacer*4 + textfieldWidth*3, headerHeight*2 + sm_spacer, typeDropdownWidth, filterSettings.values.masterBandPassFilterType, BrainFlowFilterType.values()); + cp5ElementsToCheck.add(masterFilterTypeDropdown); } private void createOrderDropdowns() { @@ -917,6 +924,7 @@ class FilterUIPopup extends PApplet implements Runnable { filterOrderDropdowns[chan] = createDropdown("filterOrder"+chan, chan, lg_spacer*5 + textfieldWidth*3 + typeDropdownWidth, headerHeight*2 + sm_spacer*(chan+2) + uiObjectHeight*(chan+1), orderDropdownWidth, filterSettings.values.masterBandPassFilterOrder, BrainFlowFilterOrder.values()); } masterFilterOrderDropdown = createDropdown("masterFilterOrderDropdown", -1, lg_spacer*5 + textfieldWidth*3 + typeDropdownWidth, headerHeight*2 + sm_spacer, orderDropdownWidth, filterSettings.values.masterBandPassFilterOrder, BrainFlowFilterOrder.values()); + cp5ElementsToCheck.add(masterFilterOrderDropdown); } private void createFilterSettingsSaveButton(String name, String text, int _x, int _y, int _w, int _h) { @@ -1029,4 +1037,18 @@ class FilterUIPopup extends PApplet implements Runnable { private void checkIfExpanderWasClicked() { setUItoChannelMode(filterSettings.values.filterChannelSelect); } + + private void lockExpanderOnOverlapCheck(List listOfControllers) { + for (controlP5.ScrollableList c : listOfControllers) { + if (c == null) { + continue; //Gracefully skip over a controller if it is null + } + if (c.isOpen()) { + ignoreExpanderInteraction = true; + return; + } else { + ignoreExpanderInteraction = false; + } + } + } } \ No newline at end of file diff --git a/OpenBCI_GUI/OpenBCI_GUI.pde b/OpenBCI_GUI/OpenBCI_GUI.pde index c5ed95c5c..82b1a3f9c 100644 --- a/OpenBCI_GUI/OpenBCI_GUI.pde +++ b/OpenBCI_GUI/OpenBCI_GUI.pde @@ -231,11 +231,15 @@ final color WHITE = color(255); final color BLACK = color(0); final color OPENBCI_DARKBLUE = color(1, 18, 41); final color OPENBCI_BLUE = color(31, 69, 110); +final color OPENBCI_BLUE_ALPHA50 = color(31, 69, 110, 50); +final color OPENBCI_BLUE_ALPHA100 = color(31, 69, 110, 100); final color boxColor = color(200); final color boxStrokeColor = OPENBCI_DARKBLUE; final color isSelected_color = color(184, 220, 105); //Used for textfield borders, final color colorNotPressed = WHITE; final color buttonsLightBlue = color(57,128,204); +final color GREY_235 = color(235); +final color GREY_200 = color(200); final color GREY_125 = color(125); final color GREY_100 = color(100); final color GREY_20 = color(20); diff --git a/OpenBCI_GUI/RadioConfig.pde b/OpenBCI_GUI/RadioConfig.pde index f3871c1c8..60b96dd00 100644 --- a/OpenBCI_GUI/RadioConfig.pde +++ b/OpenBCI_GUI/RadioConfig.pde @@ -333,7 +333,7 @@ class RadioConfig { return false; } } else { - output("No Serial/COM port selected. Please select your Serial/COM port and retry"); + outputWarn("No Serial/COM port selected. Please select your Serial/COM port and retry."); rcConfig.print_onscreen("Select a Serial/COM port, then try again."); return false; } @@ -364,7 +364,7 @@ class RadioConfig { return false; } } else { - output("No Serial/COM port selected. Please select your Serial/COM port and retry"); + outputWarn("No Serial/COM port selected. Please select your Serial/COM port and retry."); return false; } } diff --git a/OpenBCI_GUI/TopNav.pde b/OpenBCI_GUI/TopNav.pde index 660c4a50c..0d717eb1f 100644 --- a/OpenBCI_GUI/TopNav.pde +++ b/OpenBCI_GUI/TopNav.pde @@ -132,6 +132,9 @@ class TopNav { configSelector.update(); previousSystemMode = systemMode; } + + boolean topNavSubClassIsOpen = layoutSelector.isVisible || configSelector.isVisible || tutorialSelector.isVisible; + setDropdownMenuIsOpen(topNavSubClassIsOpen); } void draw() { @@ -631,7 +634,6 @@ class LayoutSelector { void toggleVisibility() { isVisible = !isVisible; - topNav.setDropdownMenuIsOpen(isVisible); if (isVisible) { //the very convoluted way of locking all controllers of a single controlP5 instance... for (int i = 0; i < wm.widgets.size(); i++) { @@ -815,7 +817,6 @@ class ConfigSelector { void toggleVisibility() { isVisible = !isVisible; - topNav.setDropdownMenuIsOpen(isVisible); if (systemMode >= SYSTEMMODE_POSTINIT) { if (isVisible) { //the very convoluted way of locking all controllers of a single controlP5 instance... @@ -1061,7 +1062,6 @@ class TutorialSelector { void toggleVisibility() { isVisible = !isVisible; - topNav.setDropdownMenuIsOpen(isVisible); if (systemMode >= SYSTEMMODE_POSTINIT) { if (isVisible) { //the very convoluted way of locking all controllers of a single controlP5 instance... diff --git a/OpenBCI_GUI/W_Accelerometer.pde b/OpenBCI_GUI/W_Accelerometer.pde index e57efa982..620f4ac9c 100644 --- a/OpenBCI_GUI/W_Accelerometer.pde +++ b/OpenBCI_GUI/W_Accelerometer.pde @@ -72,7 +72,7 @@ class W_Accelerometer extends Widget { accelerometerBar.adjustTimeAxis(xLimOptions[settings.accHorizScaleSave]); accelerometerBar.adjustVertScale(yLimOptions[settings.accVertScaleSave]); - createAccelModeButton("accelModeButton", "Turn Accel. Off", (int)(x + 3), (int)(y + 3 - navHeight), 120, navHeight - 6, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); + createAccelModeButton("accelModeButton", "Turn Accel. Off", (int)(x + 1), (int)(y0 + navHeight + 1), 120, navHeight - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); } float adjustYMaxMinBasedOnSource() { @@ -175,7 +175,7 @@ class W_Accelerometer extends Widget { //resize the accelerometer line graph accelerometerBar.screenResized(accelGraphX, accelGraphY, accelGraphWidth-accPadding*2, accelGraphHeight); //bar x, bar y, bar w, bar h //update the position of the accel mode button - accelModeButton.setPosition((int)(x + 3), (int)(y + 3 - navHeight)); + accelModeButton.setPosition((int)(x0 + 1), (int)(y0 + navHeight + 1)); } void mousePressed() { diff --git a/OpenBCI_GUI/W_AnalogRead.pde b/OpenBCI_GUI/W_AnalogRead.pde index 1b98ceeb9..d5e5c680f 100644 --- a/OpenBCI_GUI/W_AnalogRead.pde +++ b/OpenBCI_GUI/W_AnalogRead.pde @@ -84,7 +84,7 @@ class W_AnalogRead extends Widget { analogReadBars[i].adjustTimeAxis(w_timeSeries.getTSHorizScale().getValue()); } - createAnalogModeButton("analogModeButton", "Turn Analog Read On", (int)(x + 3), (int)(y + 3 - navHeight), 128, navHeight - 6, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); + createAnalogModeButton("analogModeButton", "Turn Analog Read On", (int)(x0 + 1), (int)(y0 + navHeight + 1), 128, navHeight - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); } public int getNumAnalogReads() { @@ -145,7 +145,7 @@ class W_AnalogRead extends Widget { analogReadBars[i].screenResized(int(ar_x), analogReadBarY, int(ar_w), analogReadBarHeight); //bar x, bar y, bar w, bar h } - analogModeButton.setPosition(x + 3, y + 3 - navHeight); + analogModeButton.setPosition((int)(x0 + 1), (int)(y0 + navHeight + 1)); } void mousePressed() { @@ -393,7 +393,7 @@ class AnalogReadBar{ pushStyle(); //draw plot - stroke(31,69,110, 50); + stroke(OPENBCI_BLUE_ALPHA50); fill(color(125,30,12,30)); rect(x + 36 + 4, y, w - 36 - 4, h); diff --git a/OpenBCI_GUI/W_CytonImpedance.pde b/OpenBCI_GUI/W_CytonImpedance.pde index e1fcea2b7..2ce8a65b1 100644 --- a/OpenBCI_GUI/W_CytonImpedance.pde +++ b/OpenBCI_GUI/W_CytonImpedance.pde @@ -99,8 +99,8 @@ class W_CytonImpedance extends Widget { //Init the electrode map and fill and create signal check buttons initCytonImpedanceMap(); - cytonResetAllChannels = createCytonResetChannelsButton("cytonResetAllChannels", "Reset Channels", (int)(x + padding_3), (int)(y + padding_3 - navHeight), 90, navHeight - 6, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); - cytonImpedanceMasterCheck = createCytonImpMasterCheckButton("cytonImpedanceMasterCheck", "Check All Channels", (int)(x + padding_3*2 + 90), (int)(y + padding_3 - navHeight), 120, navHeight - 6, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); + cytonResetAllChannels = createCytonResetChannelsButton("cytonResetAllChannels", "Reset Channels", (int)(x0 + 1), (int)(y0 + navHeight + 1), 90, navHeight - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); + cytonImpedanceMasterCheck = createCytonImpMasterCheckButton("cytonImpedanceMasterCheck", "Check All Channels", (int)(x0 + 1 + padding_3 + 90), (int)(y0 + navHeight + 1), 120, navHeight - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); errorThreshold = new SignalCheckThresholdUI(threshold_ui_cp5, "errorThreshold", x + tableWidth + padding, y + h - navH, thresholdTFWidth, thresholdTFHeight, SIGNAL_CHECK_RED, signalCheckMode); warningThreshold = new SignalCheckThresholdUI(threshold_ui_cp5, "warningThreshold", x + tableWidth + padding, y + h - navH/2, thresholdTFWidth, thresholdTFHeight, SIGNAL_CHECK_YELLOW, signalCheckMode); } @@ -192,8 +192,8 @@ class W_CytonImpedance extends Widget { imp_buttons_cp5.setGraphics(pApplet, 0, 0); threshold_ui_cp5.setGraphics(pApplet, 0, 0); - cytonResetAllChannels.setPosition((int)(x + padding_3), (int)(y + padding_3 - navHeight)); - cytonImpedanceMasterCheck.setPosition((int)(x + padding_3*2 + 90), (int)(y + padding_3 - navHeight)); + cytonResetAllChannels.setPosition((int)(x0 + 1), (int)(y0 + navHeight + 1)); + cytonImpedanceMasterCheck.setPosition((int)(x0 + 1 + padding_3 + 90), (int)(y0 + navHeight + 1)); resizeTable(); @@ -431,6 +431,7 @@ class W_CytonImpedance extends Widget { private Button createCytonImpMasterCheckButton(String name, String text, int _x, int _y, int _w, int _h, PFont _font, int _fontSize, color _bg, color _textColor) { final Button myButton = createButton(cp5_widget, name, text, _x, _y, _w, _h, _font, _fontSize, _bg, _textColor); myButton.setSwitch(true); + myButton.setBorderColor(OBJECT_BORDER_GREY); myButton.setVisible(signalCheckMode == CytonSignalCheckMode.IMPEDANCE); myButton.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { @@ -462,6 +463,7 @@ class W_CytonImpedance extends Widget { final Button myButton = createButton(cp5_widget, name, text, _x, _y, _w, _h, _font, _fontSize, _bg, _textColor); //myButton.setSwitch(true); myButton.setVisible(signalCheckMode == CytonSignalCheckMode.IMPEDANCE); + myButton.setBorderColor(OBJECT_BORDER_GREY); myButton.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { println("Cyton Impedance Check: User clicked reset all channel settings."); diff --git a/OpenBCI_GUI/W_DigitalRead.pde b/OpenBCI_GUI/W_DigitalRead.pde index e0276b5ac..6cd6af32f 100644 --- a/OpenBCI_GUI/W_DigitalRead.pde +++ b/OpenBCI_GUI/W_DigitalRead.pde @@ -74,7 +74,7 @@ class W_DigitalRead extends Widget { digitalReadDots[i] = tempDot; } - createDigitalModeButton("digitalModeButton", "Turn Digital Read On", (int)(x + 3), (int)(y + 3 - navHeight), 128, navHeight - 6, p5, 12, buttonsLightBlue, WHITE); + createDigitalModeButton("digitalModeButton", "Turn Digital Read On", (int)(x0 + 1), (int)(y0 + navHeight + 1), 128, navHeight - 3, p5, 12, buttonsLightBlue, WHITE); } public int getNumDigitalReads() { @@ -144,7 +144,7 @@ class W_DigitalRead extends Widget { } - digitalModeButton.setPosition((int)(x + 3), (int)(y + 3 - navHeight)); + digitalModeButton.setPosition((int)(x0 + 1), (int)(y0 + navHeight + 1)); } public void mousePressed() { diff --git a/OpenBCI_GUI/W_Networking.pde b/OpenBCI_GUI/W_Networking.pde index 4ab7816da..e48f71ff2 100644 --- a/OpenBCI_GUI/W_Networking.pde +++ b/OpenBCI_GUI/W_Networking.pde @@ -572,7 +572,7 @@ class W_Networking extends Widget { } void createGuideButton() { - guideButton = createButton(cp5_networking, "networkingGuideButton", "Networking Guide", x0 + 2, y0 + navH + 2, 125, navH - 6, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); + guideButton = createButton(cp5_networking, "networkingGuideButton", "Networking Guide", (int)(x0 + 1), (int)(y0 + navH + 1), 125, navH - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); guideButton.setBorderColor(OBJECT_BORDER_GREY); guideButton.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { @@ -584,7 +584,7 @@ class W_Networking extends Widget { } void createDataOutputsButton() { - dataOutputsButton = createButton(cp5_networking, "dataOutputsButton", "Data Outputs", x0 + 2*2 + guideButton.getWidth(), y0 + navH + 2, 100, navH - 6, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); + dataOutputsButton = createButton(cp5_networking, "dataOutputsButton", "Data Outputs", x0 + 1 + 3 + guideButton.getWidth(), y0 + navH + 1, 100, navH - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); dataOutputsButton.setBorderColor(OBJECT_BORDER_GREY); dataOutputsButton.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { @@ -600,7 +600,7 @@ class W_Networking extends Widget { ScrollableList scrollList = cp5_networking_dropdowns.addScrollableList(name) .setOpen(false) .setOutlineColor(OPENBCI_DARKBLUE) - .setColorBackground(color(31,69,110)) // text field bg color + .setColorBackground(OPENBCI_BLUE) // text field bg color .setColorValueLabel(color(255)) // text color .setColorCaptionLabel(color(255)) .setColorForeground(color(125)) // border color when not selected @@ -637,7 +637,7 @@ class W_Networking extends Widget { ScrollableList scrollList = cp5_networking_baudRate.addScrollableList(name) .setOpen(false) .setOutlineColor(OPENBCI_DARKBLUE) - .setColorBackground(color(31,69,110)) // text field bg color + .setColorBackground(OPENBCI_BLUE) // text field bg color .setColorValueLabel(color(255)) // text color .setColorCaptionLabel(color(255)) .setColorForeground(color(125)) // border color when not selected @@ -675,7 +675,7 @@ class W_Networking extends Widget { ScrollableList scrollList = cp5_networking_portName.addScrollableList(name) .setOpen(false) .setOutlineColor(OPENBCI_DARKBLUE) - .setColorBackground(color(31,69,110)) // text field bg color + .setColorBackground(OPENBCI_BLUE) // text field bg color .setColorValueLabel(color(255)) // text color .setColorCaptionLabel(color(255)) .setColorForeground(color(125)) // border color when not selected @@ -776,8 +776,8 @@ class W_Networking extends Widget { //reset the button positions using new x and y startButton.setPosition(x + w/2 - 70, y + h - 40 ); - guideButton.setPosition(x0 + 2, y0 + navH + 2); - dataOutputsButton.setPosition(x0 + 2*2 + guideButton.getWidth() , y0 + navH + 2); + guideButton.setPosition(x0 + 1, y0 + navH + 1); + dataOutputsButton.setPosition(x0 + 1 + 2 + guideButton.getWidth() , y0 + navH + 1); int dropdownsItemsToShow = int((this.h0 * datatypeDropdownScaling) / (this.navH - 4)); int dropdownHeight = (dropdownsItemsToShow) * (this.navH - 4); diff --git a/OpenBCI_GUI/W_Playback.pde b/OpenBCI_GUI/W_Playback.pde index abb8f858d..410b8e3f9 100644 --- a/OpenBCI_GUI/W_Playback.pde +++ b/OpenBCI_GUI/W_Playback.pde @@ -17,6 +17,7 @@ class W_playback extends Widget { MenuList playbackMenuList; //Used for spacing int padding = 10; + List cp5ElementsToCheck = new ArrayList(); private boolean menuHasUpdated = false; @@ -39,7 +40,7 @@ class W_playback extends Widget { menuHasUpdated = true; } //Lock the MenuList if Widget selector is open, otherwise update - if (cp5_widget.get(ScrollableList.class, "WidgetSelector").isOpen()) { + if (cp5_widget.get(ScrollableList.class, "WidgetSelector").isOpen() || topNav.getDropdownMenuIsOpen()) { if (!playbackMenuList.isLock()) { playbackMenuList.lock(); playbackMenuList.setUpdate(false); @@ -51,6 +52,7 @@ class W_playback extends Widget { } playbackMenuList.updateMenu(); } + lockElementsOnOverlapCheck(cp5ElementsToCheck); } void draw() { @@ -61,7 +63,7 @@ class W_playback extends Widget { fill(boxColor); stroke(boxStrokeColor); strokeWeight(1); - rect(x, y, w, h); + rect(x-1, y, w+1, h); //Add text if needed /* fill(OPENBCI_DARKBLUE); @@ -82,7 +84,7 @@ class W_playback extends Widget { cp5_playback.setGraphics(pApplet, 0, 0); //Resize and position cp5 objects within this widget - selectPlaybackFileButton.setPosition(x + w - selectPlaybackFileButton.getWidth() - padding, y - navHeight + 2); + selectPlaybackFileButton.setPosition(x + w - selectPlaybackFileButton.getWidth() - 2, y - navHeight + 2); playbackMenuList.setPosition(x + padding/2, y + 2); playbackMenuList.setSize(w - padding*2, h - padding*2); @@ -131,6 +133,7 @@ class W_playback extends Widget { } }); selectPlaybackFileButton.setDescription("Click to open a dialog box to select an OpenBCI playback file (.txt or .csv)."); + cp5ElementsToCheck.add((controlP5.Controller)selectPlaybackFileButton); } private void createPlaybackMenuList(ControlP5 _cp5, String name, int _x, int _y, int _w, int _h, PFont font) { diff --git a/OpenBCI_GUI/W_PulseSensor.pde b/OpenBCI_GUI/W_PulseSensor.pde index 1f9e90259..1185424c8 100644 --- a/OpenBCI_GUI/W_PulseSensor.pde +++ b/OpenBCI_GUI/W_PulseSensor.pde @@ -85,7 +85,7 @@ class W_PulseSensor extends Widget { setPulseWidgetVariables(); initializePulseFinderVariables(); - createAnalogModeButton("pulseSensorAnalogModeButton", "Turn Analog Read On", (int)(x + 3), (int)(y + 3 - navHeight), 128, navHeight - 6, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); + createAnalogModeButton("pulseSensorAnalogModeButton", "Turn Analog Read On", (int)(x0 + 1), (int)(y0 + navHeight + 1), 128, navHeight - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE); } void update(){ @@ -169,7 +169,7 @@ class W_PulseSensor extends Widget { super.screenResized(); //calls the parent screenResized() method of Widget (DON'T REMOVE) setPulseWidgetVariables(); - analogModeButton.setPosition((int)(x + 3), (int)(y + 3 - navHeight)); + analogModeButton.setPosition((int)(x0 + 1), (int)(y0 + navHeight + 1)); } void mousePressed(){ diff --git a/OpenBCI_GUI/W_TimeSeries.pde b/OpenBCI_GUI/W_TimeSeries.pde index b7b125de5..482010fe0 100644 --- a/OpenBCI_GUI/W_TimeSeries.pde +++ b/OpenBCI_GUI/W_TimeSeries.pde @@ -155,7 +155,7 @@ class W_timeSeries extends Widget { plotBottomWell = 45.0; //this appears to be an arbitrary vertical space adds GPlot leaves at bottom, I derived it through trial and error ts_padding = 10.0; ts_x = xF + ts_padding; - ts_y = yF + (ts_padding); + ts_y = yF + ts_padding; ts_w = wF - ts_padding*2; ts_h = hF - playbackWidgetHeight - plotBottomWell - (ts_padding*2); numChannelBars = nchan; //set number of channel bars = to current nchan of system (4, 8, or 16) @@ -171,8 +171,12 @@ class W_timeSeries extends Widget { pb_y = ts_y + ts_h + playbackWidgetHeight + (ts_padding * 3); pb_w = ts_w - ts_padding*4; pb_h = playbackWidgetHeight/2; + int _x = floor(xF) - 1; + int _y = int(ts_y + ts_h + playbackWidgetHeight + 5); + int _w = int(wF) + 1; + int _h = int(playbackWidgetHeight); //Make a new scrollbar - scrollbar = new PlaybackScrollbar(int(pb_x), int(pb_y), int(pb_w), int(pb_h)); + scrollbar = new PlaybackScrollbar(_x, _y, _w, _h, int(pb_x), int(pb_y), int(pb_w), int(pb_h)); } else { int td_h = 18; timeDisplay = new TimeDisplay(int(ts_x), int(ts_y + hF - td_h), int(ts_w), td_h); @@ -201,7 +205,7 @@ class W_timeSeries extends Widget { int h_hsc = channelBarHeight * numChannelBars; if (currentBoard instanceof ADS1299SettingsBoard) { - hwSettingsButton = createHSCButton("HardwareSettings", "Hardware Settings", (int)(x0 + 80), (int)(y + navHeight + 3), 120, navHeight - 6); + hwSettingsButton = createHSCButton("HardwareSettings", "Hardware Settings", (int)(x0 + 80), (int)(y0 + navHeight + 1), 120, navHeight - 3); cp5ElementsToCheck.add((controlP5.Controller)hwSettingsButton); adsSettingsController = new ADS1299SettingsController(_parent, tsChanSelect.activeChan, x_hsc, y_hsc, w_hsc, h_hsc, channelBarHeight); } @@ -263,11 +267,6 @@ class W_timeSeries extends Widget { //Display playback scrollbar, timeDisplay, or ADSSettingsController depending on data source if ((currentBoard instanceof FileBoard) && hasScrollbar) { //you will only ever see the playback widget in Playback Mode ... otherwise not visible - pushStyle(); - fill(GREY_20); - stroke(31,69,110); - rect(xF, ts_y + ts_h + playbackWidgetHeight + 5, wF, playbackWidgetHeight); - popStyle(); scrollbar.draw(); } else if (currentBoard instanceof ADS1299SettingsBoard) { //Hide time display when ADSSettingsController is open for compatible boards @@ -301,11 +300,15 @@ class W_timeSeries extends Widget { ////Resize the playback slider if using playback mode, or resize timeDisplay div at the bottom of timeSeries if((currentBoard instanceof FileBoard) && hasScrollbar) { + int _x = floor(xF) - 1; + int _y = int(ts_y + ts_h + playbackWidgetHeight + 5); + int _w = int(wF) + 1; + int _h = int(playbackWidgetHeight); pb_x = ts_x - ts_padding/2; pb_y = ts_y + ts_h + playbackWidgetHeight + (ts_padding*3); pb_w = ts_w - ts_padding*4; pb_h = playbackWidgetHeight/2; - scrollbar.screenResized(pb_x, pb_y, pb_w, pb_h); + scrollbar.screenResized(_x, _y, _w, _h, pb_x, pb_y, pb_w, pb_h); } else { int td_h = 18; timeDisplay.screenResized(int(ts_x), int(ts_y + hF - td_h), int(ts_w), td_h); @@ -328,7 +331,7 @@ class W_timeSeries extends Widget { } if (currentBoard instanceof ADS1299SettingsBoard) { - hwSettingsButton.setPosition(x0 + 80, (int)(y0 + navHeight + 3)); + hwSettingsButton.setPosition(x0 + 80, (int)(y0 + navHeight + 1)); } } @@ -529,7 +532,7 @@ class ChannelBar { plot.getXAxis().setAxisLabelText("Time (s)"); plot.getXAxis().getAxisLabel().setOffset(plotBottomWellH/2 + 5f); } - // plot.setBgColor(color(31,69,110)); + // plot.setBgColor(OPENBCI_BLUE); //Fill the GPlot with initial data nPoints = nPointsBasedOnDataSource(); @@ -647,7 +650,7 @@ class ChannelBar { //draw channel holder background pushStyle(); - stroke(31,69,110, 50); + stroke(OPENBCI_BLUE_ALPHA50); noFill(); rect(x,y,w,h); popStyle(); @@ -862,6 +865,7 @@ class ChannelBar { //========================== PLAYBACKSLIDER ========================== class PlaybackScrollbar { private final float ps_Padding = 50.0; //used to make room for skip to start button + private int x, y, w, h; private int swidth, sheight; // width and height of bar private float xpos, ypos; // x and y position of bar private float spos; // x position of slider @@ -879,7 +883,11 @@ class PlaybackScrollbar { private final DateFormat currentTimeFormatLong = new SimpleDateFormat("HH:mm:ss"); private final DateFormat timeStampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - PlaybackScrollbar (float xp, float yp, int sw, int sh) { + PlaybackScrollbar (int _x, int _y, int _w, int _h, float xp, float yp, int sw, int sh) { + x = _x; + y = _y; + w = _w; + h = _h; swidth = sw; sheight = sh; //float widthtoheight = sw - sh; @@ -902,7 +910,7 @@ class PlaybackScrollbar { } private void createSkipToStartButton(String name, String text, int _x, int _y, int _w, int _h) { - skipToStartButton = createButton(pbsb_cp5, name, text, _x, _y, _w, _h, 0, p5, 12, color(235), OPENBCI_DARKBLUE, BUTTON_HOVER, BUTTON_PRESSED, (Integer)null, 0); + skipToStartButton = createButton(pbsb_cp5, name, text, _x, _y, _w, _h, 0, p5, 12, GREY_235, OPENBCI_DARKBLUE, BUTTON_HOVER, BUTTON_PRESSED, (Integer)null, 0); PImage defaultImage = loadImage("skipToStart_default-30x26.png"); skipToStartButton.setImage(defaultImage); skipToStartButton.setForceDrawBackground(true); @@ -1019,9 +1027,13 @@ class PlaybackScrollbar { void draw() { pushStyle(); + fill(GREY_235); + stroke(OPENBCI_BLUE); + rect(x, y, w, h); + //draw the playback slider inside the playback sub-widget noStroke(); - fill(204); + fill(GREY_200); rect(xpos, ypos, swidth, sheight); //select color for playback indicator @@ -1046,11 +1058,15 @@ class PlaybackScrollbar { pbsb_cp5.draw(); } - void screenResized(float _x, float _y, float _w, float _h) { - swidth = int(_w); - sheight = int(_h); - xpos = _x + ps_Padding; //add lots of padding for use - ypos = _y - sheight/2; + void screenResized(int _x, int _y, int _w, int _h, float _pbx, float _pby, float _pbw, float _pbh) { + x = _x; + y = _y; + w = _w; + h = _h; + swidth = int(_pbw); + sheight = int(_pbh); + xpos = _pbx + ps_Padding; //add lots of padding for use + ypos = _pby - sheight/2; sposMin = xpos; sposMax = xpos + swidth - sheight/2; //update the position of the playback indicator us @@ -1059,8 +1075,8 @@ class PlaybackScrollbar { pbsb_cp5.setGraphics(ourApplet, 0, 0); skipToStartButton.setPosition( - int(_x) + int(skipToStart_diameter*.5), - int(_y) - int(skipToStart_diameter*.5) + int(_pbx) + int(skipToStart_diameter*.5), + int(_pby) - int(skipToStart_diameter*.5) ); }