diff --git a/Source/Processors/Editors/PopupChannelSelector.cpp b/Source/Processors/Editors/PopupChannelSelector.cpp index ce7c6ed87..c8279a509 100644 --- a/Source/Processors/Editors/PopupChannelSelector.cpp +++ b/Source/Processors/Editors/PopupChannelSelector.cpp @@ -116,8 +116,8 @@ RangeEditor::RangeEditor (const String& name, const Font& font) : TextEditor (na setFont (font); } -PopupChannelSelector::PopupChannelSelector (Component* parent, PopupChannelSelector::Listener* listener_, std::vector channelStates, Array channelNames, const String& title) - : PopupComponent (parent), listener (listener_), nChannels (int (channelStates.size())), mouseDragged (false), startDragCoords (0, 0), shiftKeyDown (false), firstButtonSelectedState (false), isDragging (false), editable (true), maxSelectable (-1) +PopupChannelSelector::PopupChannelSelector (Component* parent, PopupChannelSelector::Listener* listener_, std::vector channelStates, Array channelNames, const String& title_) + : PopupComponent (parent), listener (listener_), nChannels (int (channelStates.size())), mouseDragged (false), startDragCoords (0, 0), shiftKeyDown (false), firstButtonSelectedState (false), isDragging (false), editable (true), maxSelectable (-1), title (title_) { int nColumns; @@ -154,14 +154,16 @@ PopupChannelSelector::PopupChannelSelector (Component* parent, PopupChannelSelec auto contentComponent = std::make_unique(); - if (channelNames.isEmpty()) + if (channelNames.isEmpty() || channelNames.size() != nChannels) { + channelNames.clear(); for (int i = 0; i < nChannels; i++) { channelNames.add ("CH" + String (i + 1)); } } + // Create buttons for each channel. Use actual channel names as tooltips. for (int i = 0; i < nRows; i++) { for (int j = 0; j < nColumns; j++) @@ -212,6 +214,7 @@ PopupChannelSelector::PopupChannelSelector (Component* parent, PopupChannelSelec // Add Range Editor rangeEditor = std::make_unique ("Range", FontOptions (12.0f)); + rangeEditor->setInputRestrictions (0, "0123456789:"); rangeEditor->setBounds (0.75 * width, height, 0.25 * width, width / nColumns); rangeEditor->addListener (this); contentComponent->addAndMakeVisible (rangeEditor.get()); @@ -240,13 +243,7 @@ PopupChannelSelector::PopupChannelSelector (Component* parent, PopupChannelSelec if (title.isNotEmpty()) { - titleLabel = std::make_unique