Skip to content

Commit d751015

Browse files
committed
Update UI and UX for popup windows across GUI
1 parent daf8a2d commit d751015

5 files changed

Lines changed: 185 additions & 164 deletions

File tree

OpenBCI_GUI/ConsoleLog.pde

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,13 @@ static class ConsoleWindow extends PApplet implements Runnable {
6060

6161
logApplet = this;
6262

63-
surface.setAlwaysOnTop(true);
63+
surface.setAlwaysOnTop(false);
6464
surface.setResizable(true);
6565

66+
Frame frame = ( (PSurfaceAWT.SmoothCanvas) ((PSurfaceAWT)surface).getNative()).getFrame();
67+
frame.toFront();
68+
frame.requestFocus();
69+
6670
clipboardCopy = new ClipHelper();
6771
cp5 = new ControlP5(this);
6872
PFont textAreaFont = createFont("Arial", 12, true);

OpenBCI_GUI/EmgSettingsUI.pde

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class EmgSettingsUI extends PApplet implements Runnable {
1313

1414
private ControlP5 emgCp5;
1515
private int x, y, w, h;
16-
private final int HEADER_PADDING = 22;
16+
private final int HEADER_HEIGHT = 55;
1717
private final int FOOTER_PADDING = 80;
1818
private final int PADDING_3 = 3;
1919
private final int PADDING_12 = 12;
@@ -32,6 +32,10 @@ class EmgSettingsUI extends PApplet implements Runnable {
3232
private int footerObjY = 0;
3333
private int[] footerObjX = new int[NUM_FOOTER_OBJECTS];
3434

35+
private final color HEADER_COLOR = OPENBCI_BLUE;
36+
private final color BACKGROUND_COLOR = GREY_235;
37+
private final color LABEL_COLOR = WHITE;
38+
3539
private final int defaultWidth = 600;
3640
private final int defaultHeight = 600;
3741

@@ -79,7 +83,7 @@ class EmgSettingsUI extends PApplet implements Runnable {
7983
x = 0;
8084
y = 0;
8185
w = defaultWidth;
82-
h = HEADER_PADDING + (channelCount * ROW_HEIGHT) + FOOTER_PADDING;
86+
h = HEADER_HEIGHT + (channelCount * ROW_HEIGHT) + FOOTER_PADDING;
8387
}
8488

8589
@Override
@@ -96,6 +100,10 @@ class EmgSettingsUI extends PApplet implements Runnable {
96100
surface.setAlwaysOnTop(false);
97101
surface.setResizable(false);
98102

103+
Frame frame = ( (PSurfaceAWT.SmoothCanvas) ((PSurfaceAWT)surface).getNative()).getFrame();
104+
frame.toFront();
105+
frame.requestFocus();
106+
99107
//Instantiate local cp5 for this box. This allows extra control of drawing cp5 elements specifically inside this class.
100108
emgCp5 = new ControlP5(ourApplet);
101109
emgCp5.setGraphics(ourApplet, 0,0);
@@ -109,6 +117,11 @@ class EmgSettingsUI extends PApplet implements Runnable {
109117
clear();
110118
scene();
111119

120+
// Draw header
121+
noStroke();
122+
fill(HEADER_COLOR);
123+
rect(0, 0, width, HEADER_HEIGHT);
124+
112125
emgSettingsValues = dataProcessing.emgSettings.values;
113126

114127
checkIfSessionWasClosed();
@@ -139,7 +152,7 @@ class EmgSettingsUI extends PApplet implements Runnable {
139152

140153
int colWidth = (width / NUM_COLUMNS);
141154
int colOffset = colWidth / 2;
142-
int labelY = y + HEADER_PADDING / 2;
155+
int labelY = y + HEADER_HEIGHT / 2;
143156
channelColumnLabel.setPosition(x + colOffset, labelY);
144157
smoothLabel.setPosition(x + colOffset + colWidth, labelY);
145158
uvLimitLabel.setPosition(x + colOffset + colWidth*2, labelY);
@@ -153,10 +166,7 @@ class EmgSettingsUI extends PApplet implements Runnable {
153166

154167
private void scene() {
155168
// Draw background
156-
background(OPENBCI_DARKBLUE);
157-
stroke(204);
158-
fill(238);
159-
rect(0, 0, width, height);
169+
background(BACKGROUND_COLOR);
160170
}
161171

162172
@Override
@@ -231,7 +241,7 @@ class EmgSettingsUI extends PApplet implements Runnable {
231241

232242
for (int i = 0; i < channelCount; i++) {
233243
int dropdownX = x + DROPDOWN_SPACER * 2 + dropdownWidth;
234-
dropdownYPositions[i] = HEADER_PADDING + int(y + ((ROW_HEIGHT) * i) + (((ROW_HEIGHT) - DROPDOWN_HEIGHT) / 2));
244+
dropdownYPositions[i] = HEADER_HEIGHT + int(y + ((ROW_HEIGHT) * i) + (((ROW_HEIGHT) - DROPDOWN_HEIGHT) / 2));
235245
final int buttonXIncrement = DROPDOWN_SPACER + dropdownWidth;
236246

237247
smoothLists[i].setPosition(dropdownX, dropdownYPositions[i]);
@@ -277,17 +287,17 @@ class EmgSettingsUI extends PApplet implements Runnable {
277287

278288
//Create column labels
279289
color labelBG = color(255,255,255,0);
280-
color labelTxt = OPENBCI_DARKBLUE;
290+
color labelTxt = WHITE;
281291
int colWidth = (w / NUM_COLUMNS);
282292
int colOffset = colWidth / 2;
283-
int labelY = y + HEADER_PADDING / 2;
284-
channelColumnLabel = new TextBox("Channel", x + colOffset, labelY, labelTxt, labelBG, 12, h5, CENTER, TOP);
285-
smoothLabel = new TextBox("Smooth", x + colOffset + colWidth, labelY, labelTxt, labelBG, 12, h5, CENTER, TOP);
286-
uvLimitLabel = new TextBox("uV Limit", x + colOffset + colWidth*2, labelY, labelTxt, labelBG, 12, h5, CENTER, TOP);
287-
creepIncLabel = new TextBox("Creep +", x + colOffset + colWidth*3, labelY, labelTxt, labelBG, 12, h5, CENTER, TOP);
288-
creepDecLabel = new TextBox("Creep -", x + colOffset + colWidth*4, labelY, labelTxt, labelBG, 12, h5, CENTER, TOP);
289-
minDeltaUvLabel = new TextBox("Min \u0394uV", x + colOffset + colWidth*5, labelY, labelTxt, labelBG, 12, h5, CENTER, TOP);
290-
lowLimitLabel = new TextBox("Low Limit", x + colOffset + colWidth*6, labelY, labelTxt, labelBG, 12, h5, CENTER, TOP);
293+
int labelY = y + HEADER_HEIGHT / 2;
294+
channelColumnLabel = new TextBox("Channel", x + colOffset, labelY, labelTxt, labelBG, 12, h3, CENTER, TOP);
295+
smoothLabel = new TextBox("Smooth", x + colOffset + colWidth, labelY, labelTxt, labelBG, 12, h3, CENTER, TOP);
296+
uvLimitLabel = new TextBox("uV Limit", x + colOffset + colWidth*2, labelY, labelTxt, labelBG, 12, h3, CENTER, TOP);
297+
creepIncLabel = new TextBox("Creep +", x + colOffset + colWidth*3, labelY, labelTxt, labelBG, 12, h3, CENTER, TOP);
298+
creepDecLabel = new TextBox("Creep -", x + colOffset + colWidth*4, labelY, labelTxt, labelBG, 12, h3, CENTER, TOP);
299+
minDeltaUvLabel = new TextBox("Min \u0394uV", x + colOffset + colWidth*5, labelY, labelTxt, labelBG, 12, h3, CENTER, TOP);
300+
lowLimitLabel = new TextBox("Low Limit", x + colOffset + colWidth*6, labelY, labelTxt, labelBG, 12, h3, CENTER, TOP);
291301

292302
createAllDropdowns();
293303
}

OpenBCI_GUI/FilterUI.pde

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class FilterUIPopup extends PApplet implements Runnable {
3737

3838
private color headerColor = OPENBCI_BLUE;
3939
private color buttonColor = OPENBCI_BLUE;
40+
private color backgroundColor = GREY_235;
4041

4142
private ControlP5 cp5;
4243

@@ -135,6 +136,10 @@ class FilterUIPopup extends PApplet implements Runnable {
135136
surface.setAlwaysOnTop(false);
136137
surface.setResizable(false);
137138

139+
Frame frame = ( (PSurfaceAWT.SmoothCanvas) ((PSurfaceAWT)surface).getNative()).getFrame();
140+
frame.toFront();
141+
frame.requestFocus();
142+
138143
cp5 = new ControlP5(this);
139144
cp5.setGraphics(this, 0, 0);
140145
cp5.setAutoDraw(false);
@@ -169,10 +174,7 @@ class FilterUIPopup extends PApplet implements Runnable {
169174
pushStyle();
170175

171176
// Draw background
172-
background(OPENBCI_DARKBLUE);
173-
stroke(204);
174-
fill(238);
175-
rect(0, 0, width, height);
177+
background(backgroundColor);
176178

177179
// Draw visual feedback that a channel was modified
178180
// When a user interacts with an object for a channel, it will highlight blue and fade out

OpenBCI_GUI/OpenBCI_GUI.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ void drawStartupError() {
10301030
pushStyle();
10311031
background(OPENBCI_DARKBLUE);
10321032
stroke(204);
1033-
fill(238);
1033+
fill(GREY_235);
10341034
rect((width - w)/2, (height - h)/2, w, h);
10351035
noStroke();
10361036
fill(217, 4, 4);

0 commit comments

Comments
 (0)