Skip to content

Commit

Permalink
Velocity curves developer mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hsstraub committed Dec 19, 2020
1 parent ade0191 commit cf8f080
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
45 changes: 38 additions & 7 deletions Source/CurvesArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

Expand Down Expand Up @@ -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]
Expand All @@ -84,6 +89,7 @@ CurvesArea::~CurvesArea()

labelWindowTitle = nullptr;
curvesTab = nullptr;
btnDeveloperMode = nullptr;


//[Destructor]. You can add your own custom destruction code here..
Expand Down Expand Up @@ -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...
Expand Down Expand Up @@ -155,11 +187,10 @@ BEGIN_JUCER_METADATA
orientation="top" tabBarDepth="30" initialTab="0">
<TAB name="Note Velocity" colour="ffd3d3d3" useJucerComp="0" contentClassName="NoteOnOffVelocityCurveDialog"
constructorParams="" jucerComponentFile=""/>
<TAB name="CC Fader" colour="ffd3d3d3" useJucerComp="0" contentClassName="FaderVelocityCurveDialog"
constructorParams="" jucerComponentFile=""/>
<TAB name="Aftertouch" colour="ffd3d3d3" useJucerComp="0" contentClassName="AftertouchVelocityCurveDialog"
constructorParams="" jucerComponentFile=""/>
</TABBEDCOMPONENT>
<TOGGLEBUTTON name="btnDeveloperMode" id="65b6469bf46b2a64" memberName="btnDeveloperMode"
virtualName="" explicitFocusOrder="0" pos="200 8 158 24" buttonText="Developer Mode"
connectedEdges="0" needsCallback="1" radioGroupId="0" state="0"/>
</JUCER_COMPONENT>

END_JUCER_METADATA
Expand Down
5 changes: 4 additions & 1 deletion Source/CurvesArea.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
//==============================================================================
Expand All @@ -57,6 +58,7 @@ class CurvesArea : public juce::Component

void paint (juce::Graphics& g) override;
void resized() override;
void buttonClicked (juce::Button* buttonThatWasClicked) override;



Expand All @@ -67,6 +69,7 @@ class CurvesArea : public juce::Component
//==============================================================================
std::unique_ptr<juce::Label> labelWindowTitle;
std::unique_ptr<CurvesTabComponent> curvesTab;
std::unique_ptr<juce::ToggleButton> btnDeveloperMode;


//==============================================================================
Expand Down

0 comments on commit cf8f080

Please sign in to comment.