Skip to content

Commit

Permalink
Merge branch development-juce8 into testing-juce8
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaldoshi committed Jan 29, 2025
2 parents 9306529 + ab2f3b3 commit 9944d35
Show file tree
Hide file tree
Showing 19 changed files with 157 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,13 @@ void ComboBox::lookAndFeelChanged()
//==============================================================================
bool ComboBox::keyPressed (const KeyPress& key)
{
if (key == KeyPress::upKey || key == KeyPress::leftKey)
if (key == KeyPress::upKey)
{
nudgeSelectedItem (-1);
return true;
}

if (key == KeyPress::downKey || key == KeyPress::rightKey)
if (key == KeyPress::downKey)
{
nudgeSelectedItem (1);
return true;
Expand Down
2 changes: 0 additions & 2 deletions Plugins/LfpViewer/LfpDisplayCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,6 @@ LfpDisplaySplitter::LfpDisplaySplitter (LfpDisplayNode* node,

lfpDisplay->options = options.get();

timescale->setTimebase (timebase);

viewport->setViewedComponent (lfpDisplay.get(), false);
viewport->setScrollBarsShown (true, false);

Expand Down
4 changes: 3 additions & 1 deletion Plugins/LfpViewer/LfpDisplayOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ LfpDisplayOptions::LfpDisplayOptions (LfpDisplayCanvas* canvas_, LfpDisplaySplit
timebaseSelectionLabel->setFont (labelFont);
mainOptions->addAndMakeVisible (timebaseSelectionLabel.get());

setTimebaseAndSelectionText (selectedTimebaseValue.getFloatValue());

// Channel height
spreads.add ("6");
spreads.add ("10");
Expand Down Expand Up @@ -1533,7 +1535,7 @@ void LfpDisplayOptions::loadParameters (XmlElement* xml)
String rangeString = xmlNode->getStringAttribute ("Range");
ranges.addTokens (rangeString, ",", "\"");

setSelectedType( (ContinuousChannel::Type) xmlNode->getIntAttribute ("selectedChannelType", ContinuousChannel::Type::ELECTRODE));
setSelectedType ((ContinuousChannel::Type) xmlNode->getIntAttribute ("selectedChannelType", ContinuousChannel::Type::ELECTRODE));

selectedVoltageRangeValues[0] = ranges[0];
selectedVoltageRangeValues[1] = ranges[1];
Expand Down
78 changes: 43 additions & 35 deletions Plugins/SpikeDetector/PopupConfigurationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ ThresholdSelectorCustomComponent::~ThresholdSelectorCustomComponent()

void ThresholdSelectorCustomComponent::mouseDown (const MouseEvent& event)
{
if (channel == nullptr)
if (channel == nullptr || ! channel->isValid())
return;

auto* popupComponent = new PopupThresholdComponent (table,
Expand Down Expand Up @@ -334,7 +334,9 @@ void ThresholdSelectorCustomComponent::paint (Graphics& g)

thresholdString = thresholdString.substring (0, thresholdString.length() - 1);

g.setColour (findColour (ThemeColours::defaultText));
float alpha = getParentComponent()->isEnabled() ? 1.0f : 0.5f;

g.setColour (findColour (ThemeColours::defaultText).withAlpha (alpha));
g.setFont (FontOptions ("Inter", "Regular", 14.0f));
g.drawFittedText (thresholdString, 4, 0, getWidth() - 8, getHeight(), Justification::centredLeft, 1, 0.75f);
}
Expand Down Expand Up @@ -380,7 +382,7 @@ void ChannelSelectorCustomComponent::showAsPopup()

void ChannelSelectorCustomComponent::mouseDown (const juce::MouseEvent& event)
{
if (acquisitionIsActive)
if (acquisitionIsActive || ! getParentComponent()->isEnabled())
return;

showAsPopup();
Expand Down Expand Up @@ -449,7 +451,7 @@ void WaveformSelectorCustomComponent::setRowAndColumn (const int newRow, const i

void DeleteButtonCustomComponent::mouseDown (const juce::MouseEvent& event)
{
if (acquisitionIsActive)
if (acquisitionIsActive || ! getParentComponent()->isEnabled())
return;

table->deleteSelectedRows (row);
Expand All @@ -460,7 +462,7 @@ void DeleteButtonCustomComponent::paint (Graphics& g)
int width = getWidth();
int height = getHeight();

if (acquisitionIsActive)
if (acquisitionIsActive || ! getParentComponent()->isEnabled())
{
g.setColour (Colours::grey);
}
Expand All @@ -471,7 +473,7 @@ void DeleteButtonCustomComponent::paint (Graphics& g)

g.fillEllipse (7, 7, width - 14, height - 14);
g.setColour (Colours::white);
g.fillRect (9, (height / 2) - 2, width - 19, 3);
g.fillRect (9, (height / 2) - 1, width - 19, 2);
}

void DeleteButtonCustomComponent::setRowAndColumn (const int newRow, const int newColumn)
Expand Down Expand Up @@ -758,6 +760,15 @@ void SpikeDetectorTableModel::update (Array<SpikeChannel*> spikeChannels_)

table->updateContent();

if (spikeChannels.size() > 0 && ! spikeChannels[0]->isValid())
{
table->setEnabled (false);
}
else
{
table->setEnabled (true);
}

waveformComponents.clear();
thresholdComponents.clear();

Expand All @@ -781,33 +792,23 @@ void SpikeDetectorTableModel::paintRowBackground (Graphics& g, int rowNumber, in
if (rowNumber >= spikeChannels.size())
return;

if (rowIsSelected)
{
if (rowNumber % 2 == 0)
g.fillAll (owner->findColour (ThemeColours::componentBackground));
else
g.fillAll (owner->findColour (ThemeColours::componentBackground).darker (0.25f));

g.setColour (owner->findColour (ThemeColours::highlightedFill));
g.drawRoundedRectangle (2, 2, width - 4, height - 4, 5, 2);

return;
}
Colour rowColour;

if (spikeChannels[rowNumber]->isValid())
{
if (rowNumber % 2 == 0)
g.fillAll (owner->findColour (ThemeColours::componentBackground));
else
g.fillAll (owner->findColour (ThemeColours::componentBackground).darker (0.25f));

return;
}
rowColour = owner->findColour (ThemeColours::componentBackground);
else
rowColour = Colour (90, 50, 50);

if (rowNumber % 2 == 0)
g.fillAll (Colour (90, 50, 50));
g.fillAll (rowColour);
else
g.fillAll (Colour (60, 30, 30));
g.fillAll (rowColour.darker (0.25f));

if (rowIsSelected)
{
g.setColour (owner->findColour (ThemeColours::highlightedFill));
g.drawRoundedRectangle (2, 2, width - 4, height - 4, 5, 2);
}
}

void SpikeDetectorTableModel::paintCell (Graphics& g, int rowNumber, int columnId, int width, int height, bool rowIsSelected)
Expand Down Expand Up @@ -1055,8 +1056,14 @@ PopupConfigurationWindow::PopupConfigurationWindow (SpikeDetectorEditor* editor_
addAndMakeVisible (viewport.get());
update (spikeChannels);

auto stream = editor->getProcessor()->getDataStream (editor->getCurrentStream());
popupTitle = String(stream->getSourceNodeId()) + " " + stream->getSourceNodeName() + " - " + stream->getName();
if (auto stream = editor->getProcessor()->getDataStream (editor->getCurrentStream()))
{
popupTitle = String (stream->getSourceNodeId()) + " " + stream->getSourceNodeName() + " - " + stream->getName();
}
else
{
popupTitle = "No streams available";
}
}

void PopupConfigurationWindow::scrollBarMoved (ScrollBar* scrollBar, double newRangeStart)
Expand Down Expand Up @@ -1128,12 +1135,13 @@ void PopupConfigurationWindow::paint (Graphics& g)
bool PopupConfigurationWindow::keyPressed (const KeyPress& key)
{
// Popup component handles globally reserved undo/redo keys
PopupComponent::keyPressed (key);

// Pressing 'a' key adds a new spike channel
if (key.getTextCharacter() == 'a')
if (! PopupComponent::keyPressed (key))
{
editor->addSpikeChannels (this, spikeChannelGenerator->getSelectedType(), 1);
// Pressing 'a' key adds a new spike channel
if (key.getTextCharacter() == 'a')
{
editor->addSpikeChannels (this, spikeChannelGenerator->getSelectedType(), 1);
}
}

return true;
Expand Down
9 changes: 9 additions & 0 deletions Plugins/SpikeDetector/PopupConfigurationWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ class ChannelSelectorCustomComponent : public PopupChannelSelector::Listener,
channels->setNextValue (newArray);
}

/** Get the number of channels */
int getChannelCount() override
{
return channels->getChannelCount();
}

/** Sets row and column */
void setRowAndColumn (const int newRow, const int newColumn);

Expand Down Expand Up @@ -409,6 +415,9 @@ class SpikeChannelGenerator : public Component,
/** Responds to changes in the PopupChannelSelector*/
void channelStateChanged (Array<int> selectedChannels);

/** Get the number of channels */
int getChannelCount() { return channelCount; }

/** Responds to button clicks*/
void buttonClicked (Button* button);

Expand Down
32 changes: 17 additions & 15 deletions Plugins/SpikeDetector/SpikeDetectorEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,32 +80,34 @@ void SpikeDetectorEditor::addSpikeChannels (PopupConfigurationWindow* window, Sp
{
SpikeDetector* processor = (SpikeDetector*) getProcessor();

DataStream* stream = processor->getDataStream (getCurrentStream());

int nextAvailableChannel = processor->getNextAvailableChannelForStream (stream->getStreamId());
if (auto stream = processor->getDataStream (getCurrentStream()))
{
int nextAvailableChannel = processor->getNextAvailableChannelForStream (stream->getStreamId());

AddSpikeChannels* action = new AddSpikeChannels (processor, stream, type, count, startChannels, nextAvailableChannel);
AddSpikeChannels* action = new AddSpikeChannels (processor, stream, type, count, startChannels, nextAvailableChannel);

CoreServices::getUndoManager()->beginNewTransaction ("Disabled during acquisition");
CoreServices::getUndoManager()->perform ((UndoableAction*) action);
CoreServices::getUndoManager()->beginNewTransaction ("Disabled during acquisition");
CoreServices::getUndoManager()->perform ((UndoableAction*) action);

if (window != nullptr)
window->update (processor->getSpikeChannelsForStream (getCurrentStream()));
if (window != nullptr)
window->update (processor->getSpikeChannelsForStream (getCurrentStream()));
}
}

void SpikeDetectorEditor::removeSpikeChannels (PopupConfigurationWindow* window, Array<SpikeChannel*> spikeChannelsToRemove, Array<int> indeces)
{
SpikeDetector* processor = (SpikeDetector*) getProcessor();

DataStream* stream = processor->getDataStream (getCurrentStream());

RemoveSpikeChannels* action = new RemoveSpikeChannels (processor, stream, spikeChannelsToRemove, indeces);
if (auto stream = processor->getDataStream (getCurrentStream()))
{
RemoveSpikeChannels* action = new RemoveSpikeChannels (processor, stream, spikeChannelsToRemove, indeces);

CoreServices::getUndoManager()->beginNewTransaction ("Disabled during acquisition");
CoreServices::getUndoManager()->perform ((UndoableAction*) action);
CoreServices::getUndoManager()->beginNewTransaction ("Disabled during acquisition");
CoreServices::getUndoManager()->perform ((UndoableAction*) action);

if (window != nullptr)
window->update (processor->getSpikeChannelsForStream (getCurrentStream()));
if (window != nullptr)
window->update (processor->getSpikeChannelsForStream (getCurrentStream()));
}
}

int SpikeDetectorEditor::getNumChannelsForCurrentStream()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Open Ephys Plugin GUI
Upstream-Name: Open Ephys GUI
Source: https://github.com/open-ephys/plugin-GUI/

Files: *
Copyright: 2022 Open Ephys <[email protected]>
Copyright: 2025 Open Ephys <[email protected]>
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
4 changes: 2 additions & 2 deletions Resources/Installers/Windows/windows_installer_script.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AppId=Open Ephys
AppName=Open Ephys GUI
AppVersion=1.0.0-alpha.2
AppVerName=Open Ephys GUI 1.0.0-alpha.2
AppCopyright=Copyright (C) 2010-2024, Open Ephys & Contributors
AppCopyright=Copyright (C) 2010-2025, Open Ephys & Contributors
AppPublisher=open-ephys.org
AppPublisherURL=https://open-ephys.org/gui
DefaultDirName={autopf}\Open Ephys
Expand Down Expand Up @@ -220,7 +220,7 @@ function InitializeSetup: Boolean;
begin
// https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist
if not IsMsiProductInstalled('{36F68A90-239C-34DF-B58C-64B30153CE35}', PackVersionComponents(14, 40, 33810, 0)) then begin
if not IsMsiProductInstalled('{36F68A90-239C-34DF-B58C-64B30153CE35}', PackVersionComponents(14, 42, 34433, 0)) then begin
Dependency_Add('vcredist2022_x64.exe',
'/passive /norestart',
'Visual C++ 2015-2022 Redistributable (x64)',
Expand Down
6 changes: 6 additions & 0 deletions Source/Processors/Editors/PopupChannelSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ void PopupChannelSelector::paint (Graphics& g)

void PopupChannelSelector::updatePopup()
{
if (nChannels != listener->getChannelCount())
{
findParentComponentOfClass<CallOutBox>()->exitModalState (0);
return;
}

Array<int> selectedChannels = listener->getSelectedChannels();
for (auto* btn : channelButtons)
{
Expand Down
1 change: 1 addition & 0 deletions Source/Processors/Editors/PopupChannelSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class PLUGIN_API PopupChannelSelector : public PopupComponent,
virtual ~Listener() {}
virtual Array<int> getSelectedChannels() = 0;
virtual void channelStateChanged (Array<int> selectedChannels) = 0;
virtual int getChannelCount() = 0;
};

/** Constructor */
Expand Down
7 changes: 5 additions & 2 deletions Source/Processors/GenericProcessor/GenericProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ void GenericProcessor::addTtlLineParameter (
}

void GenericProcessor::parameterChangeRequest (Parameter* param)
{
{
currentParameter = param;

setParameter (-1, 0.0f);
Expand Down Expand Up @@ -1622,7 +1622,10 @@ const SpikeChannel* GenericProcessor::getSpikeChannel (uint16 processorId, uint1

DataStream* GenericProcessor::getDataStream (uint16 streamId) const
{
return dataStreamMap.at (streamId);
if (dataStreamMap.find (streamId) != dataStreamMap.end())
return dataStreamMap.at (streamId);
else
return nullptr;
}

DataStream* GenericProcessor::getDataStream (String streamKey) const
Expand Down
Loading

0 comments on commit 9944d35

Please sign in to comment.