Skip to content

Commit

Permalink
Update PopupConfigurationWindow to add stream info title
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaldoshi committed Oct 18, 2024
1 parent 469bc34 commit 48bde98
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Plugins/SpikeDetector/PopupConfigurationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,9 @@ PopupConfigurationWindow::PopupConfigurationWindow (SpikeDetectorEditor* editor_

addAndMakeVisible (viewport.get());
update (spikeChannels);

auto stream = editor->getProcessor()->getDataStream (editor->getCurrentStream());
popupTitle = String(stream->getSourceNodeId()) + " " + stream->getSourceNodeName() + " - " + stream->getName();
}

void PopupConfigurationWindow::scrollBarMoved (ScrollBar* scrollBar, double newRangeStart)
Expand Down Expand Up @@ -1088,8 +1091,8 @@ void PopupConfigurationWindow::update (Array<SpikeChannel*> spikeChannels)
viewport->getVerticalScrollBar().setVisible (false);
}

setSize (540 + scrollBarWidth, (numRowsVisible + 1) * 30 + 10 + 40);
viewport->setBounds (5, 5, 530 + scrollBarWidth, (numRowsVisible + 1) * 30);
setSize (540 + scrollBarWidth, (numRowsVisible + 1) * 30 + 70);
viewport->setBounds (5, 25, 530 + scrollBarWidth, (numRowsVisible + 1) * 30);
electrodeTable->setBounds (0, 0, 530 + scrollBarWidth, (spikeChannels.size() + 1) * 30);

viewport->setViewPosition (0, scrollDistance);
Expand All @@ -1104,8 +1107,8 @@ void PopupConfigurationWindow::update (Array<SpikeChannel*> spikeChannels)
{
tableModel->update (spikeChannels);
electrodeTable->setVisible (false);
setSize (530, 45);
spikeChannelGenerator->setBounds (60, 8, 420, 30);
setSize (440, 65);
spikeChannelGenerator->setBounds (10, 28, 420, 30);
}
}

Expand All @@ -1115,6 +1118,13 @@ void PopupConfigurationWindow::updatePopup()
update (spikeDetector->getSpikeChannelsForStream (editor->getCurrentStream()));
}

void PopupConfigurationWindow::paint (Graphics& g)
{
g.setColour (findColour (ThemeColours::controlPanelText));
g.setFont (FontOptions ("Inter", "Regular", 15.0f));
g.drawFittedText (popupTitle, 10, 0, getWidth() - 20, 20, Justification::centredLeft, 1);
}

bool PopupConfigurationWindow::keyPressed (const KeyPress& key)
{
// Popup component handles globally reserved undo/redo keys
Expand Down
4 changes: 4 additions & 0 deletions Plugins/SpikeDetector/PopupConfigurationWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ class PopupConfigurationWindow : public PopupComponent,
/** Callback to update the popup */
void updatePopup() override;

void paint (Graphics& g) override;

/** Custom table header component (not currently used)*/
//std::unique_ptr<TableHeaderComponent> tableHeader;

Expand All @@ -475,6 +477,8 @@ class PopupConfigurationWindow : public PopupComponent,

std::unique_ptr<Viewport> viewport;

String popupTitle;

int scrollDistance = 0;

bool updating = false;
Expand Down

0 comments on commit 48bde98

Please sign in to comment.