Skip to content

Commit add319e

Browse files
committed
Refactor line spacing when creating textfields
1 parent b374fcc commit add319e

1 file changed

Lines changed: 38 additions & 33 deletions

File tree

OpenBCI_GUI/W_Networking.pde

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ class W_Networking extends Widget {
127127
settings.nwDataType3 = 0;
128128
settings.nwDataType4 = 0;
129129
settings.nwSerialPort = "None";
130-
settings.nwProtocolSave = protocolIndex; // save default protocol index, or 0, updates in the Protocol()
131-
// function
132-
130+
settings.nwProtocolSave = protocolIndex;
131+
133132
// Only show pulse data type when using Cyton in Live
134133
if (eegDataSource != DATASOURCE_CYTON) {
135134
dataTypes.remove("Pulse");
@@ -499,12 +498,15 @@ class W_Networking extends Widget {
499498
void createTextField(String name, String default_text) {
500499
cp5_networking.addTextfield(name).align(10, 100, 10, 100) // Alignment
501500
.setSize(120, 20) // Size of textfield
502-
.setFont(f2).setFocus(false) // Deselects textfield
503-
.setColor(OPENBCI_DARKBLUE).setColorBackground(color(255, 255, 255)) // text field bg color
501+
.setFont(f2)
502+
.setFocus(false) // Deselects textfield
503+
.setColor(OPENBCI_DARKBLUE)
504+
.setColorBackground(color(255, 255, 255)) // text field bg color
504505
.setColorValueLabel(OPENBCI_DARKBLUE) // text color
505506
.setColorForeground(OPENBCI_DARKBLUE) // border color when not selected
506507
.setColorActive(isSelected_color) // border color when selected
507-
.setColorCursor(OPENBCI_DARKBLUE).setText(default_text) // Default text in the field
508+
.setColorCursor(OPENBCI_DARKBLUE)
509+
.setText(default_text) // Default text in the field
508510
.setCaptionLabel("") // Remove caption label
509511
.setVisible(false) // Initially hidden
510512
.setAutoClear(true) // Autoclear
@@ -580,26 +582,27 @@ class W_Networking extends Widget {
580582
/* Creating DataType Dropdowns */
581583
void createDropdown(String name, List<String> _items) {
582584

583-
ScrollableList scrollList = cp5_networking_dropdowns.addScrollableList(name).setOpen(false)
584-
.setOutlineColor(OPENBCI_DARKBLUE).setColorBackground(OPENBCI_BLUE) // text field bg color
585+
ScrollableList scrollList = cp5_networking_dropdowns.addScrollableList(name)
586+
.setOpen(false)
587+
.setOutlineColor(OPENBCI_DARKBLUE)
588+
.setColorBackground(OPENBCI_BLUE) // text field bg color
585589
.setColorValueLabel(color(255)) // text color
586-
.setColorCaptionLabel(color(255)).setColorForeground(color(125)) // border color when not selected
590+
.setColorCaptionLabel(color(255))
591+
.setColorForeground(color(125)) // border color when not selected
587592
.setColorActive(BUTTON_PRESSED) // border color when selected
588593
// .setColorCursor(color(26,26,26))
589-
590594
.setSize(itemWidth, (_items.size() + 1) * (navH - 4))// + maxFreqList.size())
591595
.setBarHeight(navH - 4) // height of top/primary bar
592596
.setItemHeight(navH - 4) // height of all item/dropdown bars
593597
.addItems(_items) // used to be .addItems(maxFreqList)
594598
.setVisible(false);
595-
cp5_networking_dropdowns.getController(name).getCaptionLabel() // the caption label is the text object in the
596-
// primary bar
599+
cp5_networking_dropdowns.getController(name)
600+
.getCaptionLabel() // the caption label is the text object in the primary bar
597601
.toUpperCase(false) // DO NOT AUTOSET TO UPPERCASE!!!
598-
.setText("None").setFont(h4).setSize(14).getStyle() // need to grab style before affecting the
599-
// paddingTop
600-
.setPaddingTop(4);
601-
cp5_networking_dropdowns.getController(name).getValueLabel() // the value label is connected to the text objects
602-
// in the dropdown item bars
602+
.setText("None").setFont(h4).setSize(14)
603+
.getStyle().setPaddingTop(4); // need to grab style before affecting the paddingTop
604+
cp5_networking_dropdowns.getController(name)
605+
.getValueLabel() // the value label is connected to the text objects in the dropdown item bars
603606
.toUpperCase(false) // DO NOT AUTOSET TO UPPERCASE!!!
604607
.setText("None").setFont(h5).setSize(12) // set the font size of the item bars to 14pt
605608
.getStyle() // need to grab style before affecting the paddingTop
@@ -611,23 +614,23 @@ class W_Networking extends Widget {
611614
ScrollableList scrollList = cp5_networking_baudRate.addScrollableList(name).setOpen(false)
612615
.setOutlineColor(OPENBCI_DARKBLUE).setColorBackground(OPENBCI_BLUE) // text field bg color
613616
.setColorValueLabel(color(255)) // text color
614-
.setColorCaptionLabel(color(255)).setColorForeground(color(125)) // border color when not selected
617+
.setColorCaptionLabel(color(255))
618+
.setColorForeground(color(125)) // border color when not selected
615619
.setColorActive(BUTTON_PRESSED) // border color when selected
616620
// .setColorCursor(color(26,26,26))
617-
618621
.setSize(itemWidth, (_items.size() + 1) * (navH - 4))// + maxFreqList.size())
619622
.setBarHeight(navH - 4) // height of top/primary bar
620623
.setItemHeight(navH - 4) // height of all item/dropdown bars
621624
.addItems(_items) // used to be .addItems(maxFreqList)
622625
.setVisible(false);
623-
cp5_networking_baudRate.getController(name).getCaptionLabel() // the caption label is the text object in the
624-
// primary bar
626+
cp5_networking_baudRate.getController(name)
627+
.getCaptionLabel() // the caption label is the text object in the primary bar
625628
.toUpperCase(false) // DO NOT AUTOSET TO UPPERCASE!!!
626-
.setText(defaultBaud).setFont(h4).setSize(14).getStyle() // need to grab style before affecting the
627-
// paddingTop
629+
.setText(defaultBaud).setFont(h4).setSize(14)
630+
.getStyle() // need to grab style before affecting the paddingTop
628631
.setPaddingTop(4);
629-
cp5_networking_baudRate.getController(name).getValueLabel() // the value label is connected to the text objects
630-
// in the dropdown item bars
632+
cp5_networking_baudRate.getController(name)
633+
.getValueLabel() // the value label is connected to the text objects in the dropdown item bars
631634
.toUpperCase(false) // DO NOT AUTOSET TO UPPERCASE!!!
632635
.setText("None").setFont(h5).setSize(12) // set the font size of the item bars to 14pt
633636
.getStyle() // need to grab style before affecting the paddingTop
@@ -639,24 +642,26 @@ class W_Networking extends Widget {
639642
if (isEmpty)
640643
_items.add("None"); // Fix #642 and #637
641644
ScrollableList scrollList = cp5_networking_portName.addScrollableList(name).setOpen(false)
642-
.setOutlineColor(OPENBCI_DARKBLUE).setColorBackground(OPENBCI_BLUE) // text field bg color
645+
.setOutlineColor(OPENBCI_DARKBLUE)
646+
.setColorBackground(OPENBCI_BLUE) // text field bg color
643647
.setColorValueLabel(color(255)) // text color
644-
.setColorCaptionLabel(color(255)).setColorForeground(color(125)) // border color when not selected
648+
.setColorCaptionLabel(color(255))
649+
.setColorForeground(color(125)) // border color when not selected
645650
.setColorActive(BUTTON_PRESSED) // border color when selected
646651
// .setColorCursor(color(26,26,26))
647652
.setSize(itemWidth, (_items.size() + 1) * (navH - 4))// + maxFreqList.size())
648653
.setBarHeight(navH - 4) // height of top/primary bar
649654
.setItemHeight(navH - 4) // height of all item/dropdown bars
650655
.addItems(_items) // used to be .addItems(maxFreqList)
651656
.setVisible(false);
652-
cp5_networking_portName.getController(name).getCaptionLabel() // the caption label is the text object in the
653-
// primary bar
657+
cp5_networking_portName.getController(name)
658+
.getCaptionLabel() // the caption label is the text object in the primary bar
654659
.toUpperCase(false) // DO NOT AUTOSET TO UPPERCASE!!!
655-
.setText("None").setFont(h4).setSize(14).getStyle() // need to grab style before affecting the
656-
// paddingTop
660+
.setText("None").setFont(h4).setSize(14)
661+
.getStyle() // need to grab style before affecting the paddingTop
657662
.setPaddingTop(4);
658-
cp5_networking_portName.getController(name).getValueLabel() // the value label is connected to the text objects
659-
// in the dropdown item bars
663+
cp5_networking_portName.getController(name)
664+
.getValueLabel() // the value label is connected to the text objects in the dropdown item bars
660665
.toUpperCase(false) // DO NOT AUTOSET TO UPPERCASE!!!
661666
.setText("None").setFont(h5).setSize(12) // set the font size of the item bars to 14pt
662667
.getStyle() // need to grab style before affecting the paddingTop

0 commit comments

Comments
 (0)