Skip to content

Update Editor elements #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions Source/OnixSourceEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ OnixSourceEditor::OnixSourceEditor(GenericProcessor* parentNode, OnixSource* sou
addAndMakeVisible(blockReadSizeValue.get());

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

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

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

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

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

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

liboniVersionLabel = std::make_unique<Label>("liboniVersion", "liboni: v" + Onix1::getVersion());
liboniVersionLabel->setFont(fontOptionRegular);
liboniVersionLabel->setBounds(portLabelB->getX() + 5, portVoltageOverrideLabelB->getBottom() + 5, 95, 22);
liboniVersionLabel->setEnabled(false);
liboniVersionLabel->setTooltip("Displays the liboni version.");
addAndMakeVisible(liboniVersionLabel.get());

const int connectWidth = 70;

connectButton = std::make_unique<UtilityButton>("CONNECT");
connectButton->setFont(fontOptionRegular);
connectButton->setBounds(headstageComboBoxB->getRight() - connectWidth, liboniVersionLabel->getY(), connectWidth, 18);
connectButton->setBounds(portLabelB->getX(), blockReadSizeValue->getY() - 4, 70, 18);
connectButton->setRadius(3.0f);
connectButton->setClickingTogglesState(true);
connectButton->setToggleState(false, dontSendNotification);
connectButton->setTooltip("Press to connect or disconnect from Onix hardware");
connectButton->addListener(this);
addAndMakeVisible(connectButton.get());

const int liboniWidth = 90;

liboniVersionLabel = std::make_unique<Label>("liboniVersion", "liboni: v" + Onix1::getVersion());
liboniVersionLabel->setFont(fontOptionRegular);
liboniVersionLabel->setBounds(desiredWidth - liboniWidth, blockReadSizeValue->getY(), liboniWidth, connectButton->getHeight());
liboniVersionLabel->setEnabled(false);
liboniVersionLabel->setTooltip("Displays the liboni version.");
addAndMakeVisible(liboniVersionLabel.get());

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.");
blankEditor->setBounds(2, 22, desiredWidth + 10, 107);
blankEditor->setAlwaysOnTop(true);
Expand Down