diff --git a/Source/CurvesArea.cpp b/Source/CurvesArea.cpp index 3b8b0b48..05c6833d 100644 --- a/Source/CurvesArea.cpp +++ b/Source/CurvesArea.cpp @@ -28,7 +28,7 @@ //[MiscUserDefs] You can add your own user definitions and misc code here... CurvesArea::CurvesTabComponent::CurvesTabComponent(TabbedButtonBar::Orientation orientation) - : TabbedComponent::TabbedComponent(orientation) + : TabbedComponent::TabbedComponent(orientation) { } @@ -60,12 +60,17 @@ CurvesArea::CurvesArea () addAndMakeVisible (curvesTab.get()); curvesTab->setTabBarDepth (30); curvesTab->addTab (TRANS("Note Velocity"), juce::Colours::lightgrey, new NoteOnOffVelocityCurveDialog(), true); - curvesTab->addTab (TRANS("CC Fader"), juce::Colours::lightgrey, new FaderVelocityCurveDialog(), true); - curvesTab->addTab (TRANS("Aftertouch"), juce::Colours::lightgrey, new AftertouchVelocityCurveDialog(), true); curvesTab->setCurrentTabIndex (0); curvesTab->setBounds (8, 40, 464, 200); + btnDeveloperMode.reset (new juce::ToggleButton ("btnDeveloperMode")); + addAndMakeVisible (btnDeveloperMode.get()); + btnDeveloperMode->setButtonText (TRANS("Developer Mode")); + btnDeveloperMode->addListener (this); + + btnDeveloperMode->setBounds (200, 8, 158, 24); + //[UserPreSize] //[/UserPreSize] @@ -84,6 +89,7 @@ CurvesArea::~CurvesArea() labelWindowTitle = nullptr; curvesTab = nullptr; + btnDeveloperMode = nullptr; //[Destructor]. You can add your own custom destruction code here.. @@ -119,6 +125,32 @@ void CurvesArea::resized() //[/UserResized] } +void CurvesArea::buttonClicked (juce::Button* buttonThatWasClicked) +{ + //[UserbuttonClicked_Pre] + //[/UserbuttonClicked_Pre] + + if (buttonThatWasClicked == btnDeveloperMode.get()) + { + //[UserButtonCode_btnDeveloperMode] -- add your button handler code here.. + if (btnDeveloperMode->getToggleState()) + { + curvesTab->addTab(TRANS("CC Fader"), juce::Colours::lightgrey, new FaderVelocityCurveDialog(), true); + curvesTab->addTab(TRANS("Aftertouch"), juce::Colours::lightgrey, new AftertouchVelocityCurveDialog(), true); + } + else + { + curvesTab->setCurrentTabIndex(0); + curvesTab->removeTab(2); + curvesTab->removeTab(1); + } + //[/UserButtonCode_btnDeveloperMode] + } + + //[UserbuttonClicked_Post] + //[/UserbuttonClicked_Post] +} + //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... @@ -155,11 +187,10 @@ BEGIN_JUCER_METADATA orientation="top" tabBarDepth="30" initialTab="0"> - - + END_JUCER_METADATA diff --git a/Source/CurvesArea.h b/Source/CurvesArea.h index 2467d0e0..2dfda022 100644 --- a/Source/CurvesArea.h +++ b/Source/CurvesArea.h @@ -35,7 +35,8 @@ Describe your class and how it works here! //[/Comments] */ -class CurvesArea : public juce::Component +class CurvesArea : public juce::Component, + public juce::Button::Listener { public: //============================================================================== @@ -57,6 +58,7 @@ class CurvesArea : public juce::Component void paint (juce::Graphics& g) override; void resized() override; + void buttonClicked (juce::Button* buttonThatWasClicked) override; @@ -67,6 +69,7 @@ class CurvesArea : public juce::Component //============================================================================== std::unique_ptr labelWindowTitle; std::unique_ptr curvesTab; + std::unique_ptr btnDeveloperMode; //==============================================================================