/* ============================================================================== This is an automatically generated GUI class created by the Projucer! Be careful when adding custom code to these files, as only the code within the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded and re-saved. Created with Projucer version: 5.3.2 ------------------------------------------------------------------------------ The Projucer is part of the JUCE library. Copyright (c) 2017 - ROLI Ltd. ============================================================================== */ //[Headers] You can add your own extra header files here... #include "protoDebug.h" //[/Headers] #include "ControlWindow.h" //[MiscUserDefs] You can add your own user definitions and misc code here... //[/MiscUserDefs] //============================================================================== ControlWindow::ControlWindow () { //[Constructor_pre] You can add your own custom stuff here.. //[/Constructor_pre] startButton.reset (new ToggleButton ("startButton")); addAndMakeVisible (startButton.get()); startButton->setTooltip (TRANS("start stop audio loop")); startButton->setButtonText (TRANS("Do Something")); startButton->addListener (this); startButton->setColour (ToggleButton::textColourId, Colours::white); helloLabel.reset (new Label ("helloLabel", TRANS("Hello, ProtoWorld"))); addAndMakeVisible (helloLabel.get()); helloLabel->setFont (Font (18.00f, Font::plain).withTypefaceStyle ("Regular")); helloLabel->setJustificationType (Justification::centred); helloLabel->setEditable (false, false, false); helloLabel->setColour (Label::backgroundColourId, Colours::white); helloLabel->setColour (Label::textColourId, Colour (0xff1e2d75)); helloLabel->setColour (TextEditor::textColourId, Colours::black); helloLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); viewport.reset (new Viewport ("viewport")); addAndMakeVisible (viewport.get()); drawable1.reset (Drawable::createFromImageData (BinaryData::proteanWave_png, BinaryData::proteanWave_pngSize)); //[UserPreSize] //addAndMakeVisible(drawable1.get()); activity_icon = new IvoxActivityComponent(); activity_icon->SetBackgroundColour(Colour(0xff283f88)); viewport.get()->setViewedComponent(activity_icon); //[/UserPreSize] setSize (600, 400); //[Constructor] You can add your own custom stuff here.. //[/Constructor] } ControlWindow::~ControlWindow() { //[Destructor_pre]. You can add your own custom destruction code here.. //[/Destructor_pre] startButton = nullptr; helloLabel = nullptr; viewport = nullptr; drawable1 = nullptr; //[Destructor]. You can add your own custom destruction code here.. //[/Destructor] } //============================================================================== void ControlWindow::paint (Graphics& g) { //[UserPrePaint] Add your own custom painting code here.. //[/UserPrePaint] g.fillAll (Colour (0xff283f88)); { int x = 0, y = 0, width = proportionOfWidth (1.0000f), height = proportionOfHeight (0.2500f); //[UserPaintCustomArguments] Customize the painting arguments here.. //[/UserPaintCustomArguments] g.setColour (Colours::black); jassert (drawable1 != 0); if (drawable1 != 0) drawable1->drawWithin (g, Rectangle (x, y, width, height), RectanglePlacement::centred, 1.000f); } //[UserPaint] Add your own custom painting code here.. //[/UserPaint] } void ControlWindow::resized() { //[UserPreResize] Add your own custom resize code here.. //[/UserPreResize] startButton->setBounds (0, proportionOfHeight (0.2500f), 120, 32); helloLabel->setBounds (0 + 120, proportionOfHeight (0.2500f), getWidth() - 240, 40); viewport->setBounds ((0 + 120) + 0, proportionOfHeight (0.3994f), roundToInt ((getWidth() - 240) * 1.0000f), proportionOfHeight (0.5000f)); //[UserResized] Add your own custom resize handling here.. activity_icon->setSize(viewport->getWidth(), viewport->getHeight()); //[/UserResized] } void ControlWindow::buttonClicked (Button* buttonThatWasClicked) { //[UserbuttonClicked_Pre] //[/UserbuttonClicked_Pre] if (buttonThatWasClicked == startButton.get()) { IvoxActivityComponent::Status status = activity_icon->GetStatus(); if (status < IvoxActivityComponent::PLAY) activity_icon->SetStatus((IvoxActivityComponent::Status)(status + 1), true); else activity_icon->SetStatus(IvoxActivityComponent::DEAD); } else { //[UserButtonCode_startButton] -- add your button handler code here ... if (buttonThatWasClicked->getToggleState()) { activity_icon->SetStatus(IvoxActivityComponent::IDLE); } else { activity_icon->SetStatus(IvoxActivityComponent::DEAD); } //[/UserButtonCode_startButton] } //[UserbuttonClicked_Post] //[/UserbuttonClicked_Post] } //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... //[/MiscUserCode] //============================================================================== #if 0 /* -- Projucer information section -- This is where the Projucer stores the metadata that describe this GUI layout, so make changes in here at your peril! BEGIN_JUCER_METADATA END_JUCER_METADATA */ #endif //[EndFile] You can add extra defines here... //[/EndFile]