/*
==============================================================================
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.4.4
------------------------------------------------------------------------------
The Projucer is part of the JUCE library.
Copyright (c) 2017 - ROLI Ltd.
==============================================================================
*/
//[Headers] You can add your own extra header files here...
#include "GuiVoice.h"
#include "GuiModVoice.h"
#include "GuiInfo.h"
#include "PluginProcessor.h"
//[/Headers]
#include "GuiMain.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]
//==============================================================================
GuiMain::GuiMain ()
{
//[Constructor_pre] You can add your own custom stuff here..
//[/Constructor_pre]
saveSoundTo.reset (new TextButton ("saveSoundTo"));
addAndMakeVisible (saveSoundTo.get());
saveSoundTo->setButtonText (TRANS("Save sound to"));
saveSoundTo->addListener (this);
saveSoundTo->setBounds (184, 7, 150, 24);
loadSound.reset (new TextButton ("loadSound"));
addAndMakeVisible (loadSound.get());
loadSound->setButtonText (TRANS("Load sound"));
loadSound->addListener (this);
loadSound->setBounds (24, 7, 150, 24);
saveSound.reset (new TextButton ("saveSound"));
addAndMakeVisible (saveSound.get());
saveSound->setButtonText (TRANS("Save sound"));
saveSound->addListener (this);
saveSound->setBounds (344, 7, 150, 24);
tabbedComponent.reset (new TabbedComponent (TabbedButtonBar::TabsAtTop));
addAndMakeVisible (tabbedComponent.get());
tabbedComponent->setTabBarDepth (30);
tabbedComponent->addTab (TRANS("Global"), Colours::lightgrey, new GuiSynth(), true);
tabbedComponent->addTab (TRANS("Voice 1"), Colours::lightgrey, new GuiVoice(), true);
tabbedComponent->addTab (TRANS("Mod. Voice 1"), Colours::lightgrey, new GuiModVoice(), true);
tabbedComponent->addTab (TRANS("Voice 2"), Colours::lightgrey, new GuiVoice(), true);
tabbedComponent->addTab (TRANS("Mod. voice 2"), Colours::lightgrey, new GuiModVoice(), true);
tabbedComponent->addTab (TRANS("Voice 3"), Colours::lightgrey, new GuiVoice(), true);
tabbedComponent->addTab (TRANS("Mod. voice 3"), Colours::lightgrey, new GuiModVoice(), true);
tabbedComponent->addTab (TRANS("Voice 4"), Colours::lightgrey, new GuiVoice(), true);
tabbedComponent->addTab (TRANS("Mod. voice 4"), Colours::lightgrey, new GuiModVoice(), true);
tabbedComponent->addTab (TRANS("Info"), Colours::lightgrey, new GuiInfo(), true);
tabbedComponent->setCurrentTabIndex (0);
tabbedComponent->setBounds (24, 40, 1240, 752);
label.reset (new Label ("new label",
TRANS("MOLOSS I")));
addAndMakeVisible (label.get());
label->setTooltip (TRANS("Multi Oscillator Linear Open Source Synthesizer"));
label->setFont (Font ("Elephant", 24.00f, Font::plain).withTypefaceStyle ("Regular"));
label->setJustificationType (Justification::centredLeft);
label->setEditable (false, false, false);
label->setColour (Label::textColourId, Colours::chartreuse);
label->setColour (TextEditor::textColourId, Colours::black);
label->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
label->setBounds (1000, 8, 120, 24);
initSound.reset (new TextButton ("initSound"));
addAndMakeVisible (initSound.get());
initSound->setButtonText (TRANS("Init sound"));
initSound->addListener (this);
initSound->setBounds (779, 7, 150, 24);
currentFile.reset (new ComboBox ("currentFile"));
addAndMakeVisible (currentFile.get());
currentFile->setTooltip (TRANS("List of loaded files"));
currentFile->setEditableText (false);
currentFile->setJustificationType (Justification::centredLeft);
currentFile->setTextWhenNothingSelected (String());
currentFile->setTextWhenNoChoicesAvailable (TRANS("<no file loaded>"));
currentFile->addListener (this);
currentFile->setBounds (512, 8, 248, 24);
buildLabel.reset (new Label ("buildLabel",
TRANS("label text")));
addAndMakeVisible (buildLabel.get());
buildLabel->setFont (Font (15.00f, Font::plain).withTypefaceStyle ("Regular"));
buildLabel->setJustificationType (Justification::centredLeft);
buildLabel->setEditable (false, false, false);
buildLabel->setColour (TextEditor::textColourId, Colours::black);
buildLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
buildLabel->setBounds (1000, 32, 128, 24);
cachedImage_moloss_icon_petit_png_1 = ImageCache::getFromMemory (moloss_icon_petit_png, moloss_icon_petit_pngSize);
//[UserPreSize]
//[/UserPreSize]
setSize (1280, 850);
//[Constructor] You can add your own custom stuff here..
GuiInfo* infoPt = static_cast<GuiInfo*>(tabbedComponent->getTabContentComponent(GuiInfo::INFO_TAB));
infoPt->setTabbedComponent(tabbedComponent.get());
buildLabel->setText(MOLOSS_VERSION,dontSendNotification);
//[/Constructor]
}
GuiMain::~GuiMain()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[/Destructor_pre]
saveSoundTo = nullptr;
loadSound = nullptr;
saveSound = nullptr;
tabbedComponent = nullptr;
label = nullptr;
initSound = nullptr;
currentFile = nullptr;
buildLabel = nullptr;
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void GuiMain::paint (Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here..
//[/UserPrePaint]
g.fillAll (Colour (0xff323e44));
{
int x = 1168, y = 0, width = 64, height = 64;
//[UserPaintCustomArguments] Customize the painting arguments here..
//[/UserPaintCustomArguments]
g.setColour (Colours::black);
g.drawImageWithin (cachedImage_moloss_icon_petit_png_1,
x, y, width, height,
RectanglePlacement::centred,
false);
}
//[UserPaint] Add your own custom painting code here..
//[/UserPaint]
}
void GuiMain::resized()
{
//[UserPreResize] Add your own custom resize code here..
//[/UserPreResize]
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
void GuiMain::buttonClicked (Button* buttonThatWasClicked)
{
//[UserbuttonClicked_Pre]
//[/UserbuttonClicked_Pre]
if (buttonThatWasClicked == saveSoundTo.get())
{
//[UserButtonCode_saveSoundTo] -- add your button handler code here..
mProcessor->saveToFile();
updateCurrentFileState();
//[/UserButtonCode_saveSoundTo]
}
else if (buttonThatWasClicked == loadSound.get())
{
//[UserButtonCode_loadSound] -- add your button handler code here..
mProcessor->loadFromFile();
updateCurrentFileState();
//[/UserButtonCode_loadSound]
}
else if (buttonThatWasClicked == saveSound.get())
{
//[UserButtonCode_saveSound] -- add your button handler code here..
mProcessor->saveToCurrentFile();
//[/UserButtonCode_saveSound]
}
else if (buttonThatWasClicked == initSound.get())
{
//[UserButtonCode_initSound] -- add your button handler code here..
mProcessor->resetSound();
updateCurrentFileState();
//[/UserButtonCode_initSound]
}
//[UserbuttonClicked_Post]
//[/UserbuttonClicked_Post]
}
void GuiMain::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
{
//[UsercomboBoxChanged_Pre]
//[/UsercomboBoxChanged_Pre]
if (comboBoxThatHasChanged == currentFile.get())
{
//[UserComboBoxCode_currentFile] -- add your combo box handling code here..
int id = currentFile->getSelectedId();
if(id>0)
mProcessor->setCurrentProgram(id-1);
//[/UserComboBoxCode_currentFile]
}
//[UsercomboBoxChanged_Post]
//[/UsercomboBoxChanged_Post]
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
void GuiMain::updateCurrentFileState()
{
saveSound->setEnabled(mProcessor->hasCurrentFile());
currentFile->setText(mProcessor->getCurrentFile(), dontSendNotification);
}
void GuiMain::updateCurrentFiles()
{
currentFile->clear();
if (mProcessor->hasCurrentFile())
currentFile->addItemList(mProcessor->getLoadedFilenames(),1);
updateCurrentFileState();
}
void GuiMain::updateActivity()
{
GuiSynth*gui = getGuiSynth();
if(gui != nullptr)
gui->repaint();
}
//[/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
<JUCER_COMPONENT documentType="Component" className="GuiMain" componentName=""
parentClasses="public Component" constructorParams="" variableInitialisers=""
snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330"
fixedSize="1" initialWidth="1280" initialHeight="850">
<BACKGROUND backgroundColour="ff323e44">
<IMAGE pos="1168 0 64 64" resource="moloss_icon_petit_png" opacity="1.0"
mode="1"/>
</BACKGROUND>
<TEXTBUTTON name="saveSoundTo" id="3c250c243fb1e3b7" memberName="saveSoundTo"
virtualName="" explicitFocusOrder="0" pos="184 7 150 24" buttonText="Save sound to"
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
<TEXTBUTTON name="loadSound" id="d4ab36e4834ba6e2" memberName="loadSound"
virtualName="" explicitFocusOrder="0" pos="24 7 150 24" buttonText="Load sound"
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
<TEXTBUTTON name="saveSound" id="f38fdc49135dcaaa" memberName="saveSound"
virtualName="" explicitFocusOrder="0" pos="344 7 150 24" buttonText="Save sound"
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
<TABBEDCOMPONENT name="new tabbed component" id="c41eaebc01444a6e" memberName="tabbedComponent"
virtualName="" explicitFocusOrder="0" pos="24 40 1240 752" orientation="top"
tabBarDepth="30" initialTab="0">
<TAB name="Global" colour="ffd3d3d3" useJucerComp="0" contentClassName="GuiSynth"
constructorParams="" jucerComponentFile=""/>
<TAB name="Voice 1" colour="ffd3d3d3" useJucerComp="0" contentClassName="GuiVoice"
constructorParams="" jucerComponentFile=""/>
<TAB name="Mod. Voice 1" colour="ffd3d3d3" useJucerComp="0" contentClassName="GuiModVoice"
constructorParams="" jucerComponentFile=""/>
<TAB name="Voice 2" colour="ffd3d3d3" useJucerComp="0" contentClassName="GuiVoice"
constructorParams="" jucerComponentFile=""/>
<TAB name="Mod. voice 2" colour="ffd3d3d3" useJucerComp="0" contentClassName="GuiModVoice"
constructorParams="" jucerComponentFile=""/>
<TAB name="Voice 3" colour="ffd3d3d3" useJucerComp="0" contentClassName="GuiVoice"
constructorParams="" jucerComponentFile=""/>
<TAB name="Mod. voice 3" colour="ffd3d3d3" useJucerComp="0" contentClassName="GuiModVoice"
constructorParams="" jucerComponentFile=""/>
<TAB name="Voice 4" colour="ffd3d3d3" useJucerComp="0" contentClassName="GuiVoice"
constructorParams="" jucerComponentFile=""/>
<TAB name="Mod. voice 4" colour="ffd3d3d3" useJucerComp="0" contentClassName="GuiModVoice"
constructorParams="" jucerComponentFile=""/>
<TAB name="Info" colour="ffd3d3d3" useJucerComp="0" contentClassName="GuiInfo"
constructorParams="" jucerComponentFile=""/>
</TABBEDCOMPONENT>
<LABEL name="new label" id="973cf2206438a2bf" memberName="label" virtualName=""
explicitFocusOrder="0" pos="1000 8 120 24" tooltip="Multi Oscillator Linear Open Source Synthesizer"
textCol="ff7fff00" edTextCol="ff000000" edBkgCol="0" labelText="MOLOSS I"
editableSingleClick="0" editableDoubleClick="0" focusDiscardsChanges="0"
fontname="Elephant" fontsize="24.0" kerning="0.0" bold="0" italic="0"
justification="33"/>
<TEXTBUTTON name="initSound" id="3e600c494c83c233" memberName="initSound"
virtualName="" explicitFocusOrder="0" pos="779 7 150 24" buttonText="Init sound"
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
<COMBOBOX name="currentFile" id="463cf2b78bfbb89d" memberName="currentFile"
virtualName="" explicitFocusOrder="0" pos="512 8 248 24" tooltip="List of loaded files"
editable="0" layout="33" items="" textWhenNonSelected="" textWhenNoItems="<no file loaded>"/>
<LABEL name="buildLabel" id="47ca094811e681e7" memberName="buildLabel"
virtualName="" explicitFocusOrder="0" pos="1000 32 128 24" edTextCol="ff000000"
edBkgCol="0" labelText="label text" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15.0"
kerning="0.0" bold="0" italic="0" justification="33"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
//==============================================================================
// Binary resources - be careful not to edit any of these sections!
// JUCER_RESOURCE: moloss_icon_petit_png, 942, "../moloss_icon_petit.png"
static const unsigned char resource_GuiMain_moloss_icon_petit_png[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,49,0,0,0,49,8,6,0,0,0,115,156,65,28,0,0,0,6,98,75,71,68,0,255,0,255,0,255,160,
189,167,147,0,0,0,9,112,72,89,115,0,0,46,35,0,0,46,35,1,120,165,63,118,0,0,0,7,116,73,77,69,7,227,8,26,17,58,15,251,34,53,25,0,0,0,29,105,84,88,116,67,111,109,109,101,110,116,0,0,0,0,0,67,114,101,97,116,
101,100,32,119,105,116,104,32,71,73,77,80,100,46,101,7,0,0,3,18,73,68,65,84,104,222,229,90,175,111,219,80,16,190,164,131,141,10,54,5,25,88,10,73,80,81,74,38,173,96,26,43,8,169,52,80,52,98,181,176,170,
250,71,84,213,96,180,240,129,72,33,5,97,209,42,57,160,160,69,70,53,153,84,80,100,37,32,90,224,42,13,172,231,158,47,239,249,215,157,179,181,61,201,74,108,63,159,191,239,190,123,239,221,123,73,13,246,142,
190,193,51,183,186,228,225,230,205,133,167,1,66,234,167,46,121,113,123,123,87,12,64,195,79,29,94,128,213,37,209,3,0,144,68,81,203,143,72,137,48,240,85,34,41,245,243,122,211,233,217,147,160,121,140,86,
38,159,181,252,136,148,192,60,150,230,179,134,31,213,116,202,27,69,173,73,82,157,132,227,118,42,109,159,102,181,34,181,19,230,49,74,223,222,222,133,229,34,2,0,128,251,187,219,68,219,168,219,27,100,41,
128,68,54,183,154,9,159,97,224,27,159,183,217,155,178,236,145,0,130,231,157,20,12,41,195,219,32,112,199,125,2,95,169,18,205,155,11,143,70,14,9,56,110,39,62,167,182,185,213,92,241,97,106,99,243,115,127,
119,155,91,141,194,233,132,68,240,197,89,128,41,176,180,118,212,95,17,2,133,73,208,188,230,4,108,81,230,159,38,181,120,191,42,66,160,116,159,48,141,44,60,202,28,48,18,201,242,203,7,8,245,33,150,166,19,
7,190,92,68,137,131,3,70,37,232,97,242,227,184,157,194,243,72,33,37,162,110,111,0,140,136,166,18,101,250,131,104,136,165,128,26,237,86,252,253,87,248,115,229,62,7,111,107,207,137,87,54,99,71,221,222,192,
150,183,59,167,39,208,104,183,18,32,57,248,70,187,5,59,167,39,106,42,136,148,176,25,2,188,62,59,143,163,140,4,108,224,255,139,218,9,193,94,159,157,175,144,49,157,99,59,74,82,98,106,74,32,160,31,95,14,
141,247,109,215,255,217,162,200,113,59,185,58,97,24,248,241,145,101,203,69,84,106,120,21,167,83,26,145,48,240,97,62,139,226,35,141,72,217,81,73,173,79,152,0,132,129,31,87,172,195,201,52,81,98,107,19,80,
27,98,211,128,124,254,244,33,119,0,202,14,177,234,187,29,84,5,211,122,66,107,175,74,60,58,153,202,15,83,89,241,254,227,126,229,42,136,148,48,165,85,154,10,105,106,72,8,136,211,41,173,4,201,107,82,2,175,
119,7,80,83,13,13,21,84,72,224,12,94,148,8,174,169,53,54,210,84,211,137,118,106,186,122,227,43,185,172,206,191,86,18,77,203,42,143,46,252,195,192,143,85,50,77,138,26,106,136,171,88,219,236,77,183,96,232,
57,157,79,164,35,155,156,196,184,239,205,55,158,30,127,251,46,185,241,53,159,37,163,142,231,180,2,78,180,25,247,61,216,59,90,223,100,55,58,62,240,70,151,87,43,32,121,100,105,21,203,213,227,215,70,151,
87,48,58,62,88,207,111,118,182,23,13,39,211,152,8,7,200,137,206,103,81,92,221,230,245,175,74,98,255,235,247,129,137,0,37,98,186,71,137,208,246,121,252,103,89,173,244,223,34,198,125,15,0,96,227,177,95,
12,39,211,149,178,155,130,52,221,195,107,15,15,191,255,94,44,217,39,106,226,255,118,60,146,161,132,108,96,169,197,192,5,224,245,72,88,8,113,82,9,208,10,192,171,35,145,70,74,17,116,229,155,103,85,69,251,
197,151,226,127,0,144,119,69,34,168,191,101,94,0,0,0,0,73,69,78,68,174,66,96,130,0,0};
const char* GuiMain::moloss_icon_petit_png = (const char*) resource_GuiMain_moloss_icon_petit_png;
const int GuiMain::moloss_icon_petit_pngSize = 942;
//[EndFile] You can add extra defines here...
//[/EndFile]