Skip to content

Commit a614023

Browse files
authored
Merge pull request #127 from open-ephys-plugins/issue-125
Update Editor elements
2 parents 4a966d7 + a4c741c commit a614023

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

Source/OnixSourceEditor.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ OnixSourceEditor::OnixSourceEditor(GenericProcessor* parentNode, OnixSource* sou
5151
addAndMakeVisible(blockReadSizeValue.get());
5252

5353
portStatusA = std::make_unique<DrawableRectangle>();
54-
portStatusA->setRectangle(Rectangle<float>(memoryUsage->getRight() + 4, memoryUsage->getY(), 10, 10));
54+
portStatusA->setRectangle(Rectangle<float>(memoryUsage->getRight() + 4, memoryUsage->getY() + 3, 10, 10));
5555
portStatusA->setCornerSize(Point<float>(5, 5));
5656
portStatusA->setFill(fillDisconnected);
5757
portStatusA->setStrokeFill(statusIndicatorStrokeColor);
5858
portStatusA->setStrokeThickness(statusIndicatorStrokeThickness);
5959
addAndMakeVisible(portStatusA.get());
6060

6161
portLabelA = std::make_unique<Label>("portLabelA", "Port A:");
62-
portLabelA->setBounds(portStatusA->getRight(), portStatusA->getY(), 60, 16);
62+
portLabelA->setBounds(portStatusA->getRight(), portStatusA->getY(), 60, 14);
6363
portLabelA->setFont(fontOptionTitle);
6464
addAndMakeVisible(portLabelA.get());
6565

@@ -93,20 +93,21 @@ OnixSourceEditor::OnixSourceEditor(GenericProcessor* parentNode, OnixSource* sou
9393
addAndMakeVisible(lastVoltageSetA.get());
9494

9595
portStatusB = std::make_unique<DrawableRectangle>();
96-
portStatusB->setRectangle(Rectangle<float>(portStatusA->getX(), portVoltageOverrideLabelA->getBottom() + 3, 10, 10));
96+
auto rect = portStatusA->getRectangle();
97+
portStatusB->setRectangle(Rectangle<float>(rect.topLeft.getX(), portVoltageValueA->getBottom() + 9, rect.getWidth(), rect.getHeight()));
9798
portStatusB->setCornerSize(portStatusA->getCornerSize());
9899
portStatusB->setFill(portStatusA->getFill());
99100
portStatusB->setStrokeFill(portStatusA->getStrokeFill());
100101
portStatusB->setStrokeThickness(statusIndicatorStrokeThickness);
101102
addAndMakeVisible(portStatusB.get());
102103

103104
portLabelB = std::make_unique<Label>("portLabelB", "Port B:");
104-
portLabelB->setBounds(portStatusB->getRight(), portStatusB->getY(), portLabelA->getWidth(), portLabelA->getHeight());
105+
portLabelB->setBounds(portLabelA->getX(), portStatusB->getY(), portLabelA->getWidth(), portLabelA->getHeight());
105106
portLabelB->setFont(fontOptionTitle);
106107
addAndMakeVisible(portLabelB.get());
107108

108109
headstageComboBoxB = std::make_unique<ComboBox>("headstageComboBoxB");
109-
headstageComboBoxB->setBounds(portLabelB->getRight(), portLabelB->getY(), headstageComboBoxA->getWidth(), portLabelB->getHeight());
110+
headstageComboBoxB->setBounds(headstageComboBoxA->getX(), portLabelB->getY(), headstageComboBoxA->getWidth(), headstageComboBoxA->getHeight());
110111
headstageComboBoxB->addListener(this);
111112
headstageComboBoxB->setTooltip("Select the headstage connected to port B.");
112113
addHeadstageComboBoxOptions(headstageComboBoxB.get());
@@ -134,25 +135,25 @@ OnixSourceEditor::OnixSourceEditor(GenericProcessor* parentNode, OnixSource* sou
134135
lastVoltageSetB->setTooltip("Records the last voltage set for Port B. Useful for displaying what the automated voltage discovery algorithm settled on.");
135136
addAndMakeVisible(lastVoltageSetB.get());
136137

137-
liboniVersionLabel = std::make_unique<Label>("liboniVersion", "liboni: v" + Onix1::getVersion());
138-
liboniVersionLabel->setFont(fontOptionRegular);
139-
liboniVersionLabel->setBounds(portLabelB->getX() + 5, portVoltageOverrideLabelB->getBottom() + 5, 95, 22);
140-
liboniVersionLabel->setEnabled(false);
141-
liboniVersionLabel->setTooltip("Displays the liboni version.");
142-
addAndMakeVisible(liboniVersionLabel.get());
143-
144-
const int connectWidth = 70;
145-
146138
connectButton = std::make_unique<UtilityButton>("CONNECT");
147139
connectButton->setFont(fontOptionRegular);
148-
connectButton->setBounds(headstageComboBoxB->getRight() - connectWidth, liboniVersionLabel->getY(), connectWidth, 18);
140+
connectButton->setBounds(portLabelB->getX(), blockReadSizeValue->getY() - 4, 70, 18);
149141
connectButton->setRadius(3.0f);
150142
connectButton->setClickingTogglesState(true);
151143
connectButton->setToggleState(false, dontSendNotification);
152144
connectButton->setTooltip("Press to connect or disconnect from Onix hardware");
153145
connectButton->addListener(this);
154146
addAndMakeVisible(connectButton.get());
155147

148+
const int liboniWidth = 90;
149+
150+
liboniVersionLabel = std::make_unique<Label>("liboniVersion", "liboni: v" + Onix1::getVersion());
151+
liboniVersionLabel->setFont(fontOptionRegular);
152+
liboniVersionLabel->setBounds(desiredWidth - liboniWidth, blockReadSizeValue->getY(), liboniWidth, connectButton->getHeight());
153+
liboniVersionLabel->setEnabled(false);
154+
liboniVersionLabel->setTooltip("Displays the liboni version.");
155+
addAndMakeVisible(liboniVersionLabel.get());
156+
156157
blankEditor = std::make_unique<Label>("Blank editor", "Context could not be initialized. Ensure no other programs are running that hold an ONI context, and then delete/insert the plugin.");
157158
blankEditor->setBounds(2, 22, desiredWidth + 10, 107);
158159
blankEditor->setAlwaysOnTop(true);

0 commit comments

Comments
 (0)