@@ -60,7 +60,7 @@ void ChannelButton::paintButton(Graphics &g, bool isMouseOver, bool isButtonDown
6060 g.setColour (Colour (0 ,0 ,0 ));
6161 g.fillRoundedRectangle (0 .0f , 0 .0f , getWidth (), getHeight (), 0.001 *getWidth ());
6262
63- if (isMouseOver)
63+ if (isMouseOver && parent-> isEditable () )
6464 {
6565 if (getToggleState ())
6666 g.setColour (parent->buttonColour .brighter ());
@@ -130,12 +130,12 @@ PopupChannelSelector::PopupChannelSelector(PopupChannelSelector::Listener* liste
130130 maxSelectable(-1 )
131131{
132132
133- int width = 368 ; // can use any multiples of 16 here for dynamic resizing
133+ width = 368 ; // can use any multiples of 16 here for dynamic resizing
134134
135- int nColumns = 16 ;
136- int nRows = nChannels / nColumns + (int )(!(nChannels % nColumns == 0 ));
137- int buttonSize = width / 16 ;
138- int height = buttonSize * nRows;
135+ nColumns = 16 ;
136+ nRows = nChannels / nColumns + (int )(!(nChannels % nColumns == 0 ));
137+ buttonSize = width / 16 ;
138+ height = buttonSize * nRows;
139139
140140 maxSelectable = (maxSelectable == -1 ) ? nChannels : maxSelectable;
141141 maxSelectable = (maxSelectable > nChannels) ? nChannels : maxSelectable;
@@ -209,6 +209,35 @@ PopupChannelSelector::PopupChannelSelector(PopupChannelSelector::Listener* liste
209209
210210}
211211
212+ void PopupChannelSelector::setEditable (bool editable)
213+ {
214+ this ->editable = editable;
215+
216+ if (editable)
217+ {
218+ for (auto * btn : selectButtons)
219+ btn->setVisible (true );
220+
221+ if (nChannels > 8 )
222+ rangeEditor->setVisible (true );
223+ }
224+ else
225+ {
226+ for (auto * btn : selectButtons)
227+ btn->setVisible (false );
228+
229+ if (nChannels > 8 )
230+ rangeEditor->setVisible (false );
231+ }
232+
233+ // Resize window
234+ if (editable)
235+ setSize (width, buttonSize * nRows + buttonSize);
236+ else
237+ setSize (width, height);
238+
239+ }
240+
212241void PopupChannelSelector::setMaximumSelectableChannels (int num)
213242{
214243 maxSelectable = num;
0 commit comments