Skip to content
Merged
Show file tree
Hide file tree
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
21 changes: 21 additions & 0 deletions Source/OnixSourceEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,12 @@ void OnixSourceEditor::comboBoxChanged(ComboBox* cb)

void OnixSourceEditor::updateComboBox(ComboBox* cb)
{
if (canvas == nullptr)
{
Onix1::showWarningMessageBoxAsync("Missing Canvas", missingCanvasErrorMessage);
return;
}

bool isPortA = cb == headstageComboBoxA.get();

PortName currentPort = isPortA ? PortName::PortA : PortName::PortB;
Expand All @@ -432,6 +438,7 @@ void OnixSourceEditor::updateComboBox(ComboBox* cb)
std::string headstage = isPortA ? headstageComboBoxA->getText().toStdString() : headstageComboBoxB->getText().toStdString();

source->updateDiscoveryParameters(currentPort, PortController::getHeadstageDiscoveryParameters(headstage));

canvas->addHub(headstage, PortController::getPortOffset(currentPort));

if (headstage == NEUROPIXELSV2E_HEADSTAGE_NAME || headstage == NEUROPIXELSV1E_HEADSTAGE_NAME)
Expand Down Expand Up @@ -631,6 +638,12 @@ void OnixSourceEditor::setComboBoxSelection(ComboBox* comboBox, std::string head

void OnixSourceEditor::refreshComboBoxSelection()
{
if (canvas == nullptr)
{
Onix1::showWarningMessageBoxAsync("Missing Canvas", missingCanvasErrorMessage);
return;
}

Array<CustomTabComponent*> hubTabs = canvas->getHubTabs();

bool resetPortA = true, resetPortB = true;
Expand All @@ -657,6 +670,12 @@ void OnixSourceEditor::refreshComboBoxSelection()

OnixDeviceMap OnixSourceEditor::createTabMapFromCanvas()
{
if (canvas == nullptr)
{
Onix1::showWarningMessageBoxAsync("Missing Canvas", missingCanvasErrorMessage);
return OnixDeviceMap{};
}

return canvas->getSelectedDevices(canvas->settingsInterfaces);
}

Expand All @@ -675,6 +694,8 @@ void OnixSourceEditor::saveVisualizerEditorParameters(XmlElement* xml)

void OnixSourceEditor::loadVisualizerEditorParameters(XmlElement* xml)
{
checkForCanvas();

LOGD("Loading OnixSourceEditor settings.");

if (xml->hasAttribute("headstagePortA"))
Expand Down
2 changes: 2 additions & 0 deletions Source/OnixSourceEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ namespace OnixSourcePlugin

static constexpr int DefaultBlockReadSize = 4096;

static constexpr char* missingCanvasErrorMessage = "The canvas for this plugin could not be found. Some functionality may not work as expected, and you may not be able to acquire or record data. Try removing and replacing the plugin.";

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OnixSourceEditor);
};
}
Loading