text
stringlengths
0
2.2M
if (isPlusMinusButton)
{
textButton->setEnabled (columnId == plusButtonColumnId ? canAddColumn : canRemoveColumn);
}
else
{
textButton->setRadioGroupId (1, NotificationType::dontSendNotification);
textButton->setClickingTogglesState (true);
auto busColour = Colours::green.withRotatedHue (static_cast<float> (columnId) / 5.0f);
textButton->setColour (TextButton::buttonColourId, busColour);
textButton->setColour (TextButton::buttonOnColourId, busColour.withMultipliedBrightness (2.0f));
}
textButton->addListener (this);
return textButton;
}
//==============================================================================
String getButtonName (int columnId)
{
if (columnId == plusButtonColumnId) return "+";
if (columnId == minusButtonColumnId) return "-";
return String (columnId);
}
void buttonClicked (Button* btn) override
{
auto text = btn->getButtonText();
if (text == "+") listener.addColumn();
if (text == "-") listener.removeColumn();
}
void buttonStateChanged (Button* btn) override
{
auto text = btn->getButtonText();
if (text == "+" || text == "-")
return;
if (btn->getToggleState())
listener.columnSelected (text.getIntValue());
}
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NumberedBoxes)
};
//==============================================================================
class IOConfigurationWindow::InputOutputConfig : public Component,
private Button::Listener,
private NumberedBoxes::Listener
{
public:
InputOutputConfig (IOConfigurationWindow& parent, bool direction)
: owner (parent),
ioTitle ("ioLabel", direction ? "Input Configuration" : "Output Configuration"),
ioBuses (*this, false, false),
isInput (direction)
{
ioTitle.setFont (ioTitle.getFont().withStyle (Font::bold));
nameLabel.setFont (nameLabel.getFont().withStyle (Font::bold));
layoutLabel.setFont (layoutLabel.getFont().withStyle (Font::bold));
enabledToggle.setClickingTogglesState (true);
enabledToggle.addListener (this);
addAndMakeVisible (layoutLabel);
addAndMakeVisible (layouts);
addAndMakeVisible (enabledToggle);
addAndMakeVisible (ioTitle);
addAndMakeVisible (nameLabel);
addAndMakeVisible (name);
addAndMakeVisible (ioBuses);
updateBusButtons();
updateBusLayout();
}
void paint (Graphics& g) override
{
g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
}
void resized() override
{
auto r = getLocalBounds().reduced (10);
ioTitle.setBounds (r.removeFromTop (14));
r.reduce (10, 0);
r.removeFromTop (16);
ioBuses.setBounds (r.removeFromTop (60));
{
auto label = r.removeFromTop (24);
nameLabel.setBounds (label.removeFromLeft (100));
enabledToggle.setBounds (label.removeFromRight (80));