You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

261 lines
11KB

  1. /*
  2. ==============================================================================
  3. This is an automatically generated GUI class created by the Introjucer!
  4. Be careful when adding custom code to these files, as only the code within
  5. the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
  6. and re-saved.
  7. Created with Introjucer version: 3.1.0
  8. ------------------------------------------------------------------------------
  9. The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
  10. Copyright 2004-13 by Raw Material Software Ltd.
  11. ==============================================================================
  12. */
  13. //[Headers] You can add your own extra header files here...
  14. //[/Headers]
  15. #include "MainLayout.h"
  16. //[MiscUserDefs] You can add your own user definitions and misc code here...
  17. #include "PluginProcessor.h"
  18. //[/MiscUserDefs]
  19. //==============================================================================
  20. MainLayout::MainLayout (AdmvAudioProcessor* plugin)
  21. {
  22. addAndMakeVisible (mGonioScaleValue = new Slider ("Gonio Scale Value"));
  23. mGonioScaleValue->setRange (-72, 0, 0);
  24. mGonioScaleValue->setSliderStyle (Slider::LinearVertical);
  25. mGonioScaleValue->setTextBoxStyle (Slider::NoTextBox, true, 80, 20);
  26. mGonioScaleValue->addListener (this);
  27. addAndMakeVisible (mSpectroMagnitudeScale = new Slider ("Spectrum Magnitude Scale"));
  28. mSpectroMagnitudeScale->setRange (-72, 0, 0);
  29. mSpectroMagnitudeScale->setSliderStyle (Slider::TwoValueVertical);
  30. mSpectroMagnitudeScale->setTextBoxStyle (Slider::NoTextBox, false, 80, 20);
  31. mSpectroMagnitudeScale->addListener (this);
  32. addAndMakeVisible (mGonioPlaceholder = new Label ("Goniometer",
  33. TRANS("Goniometer\n")));
  34. mGonioPlaceholder->setFont (Font (15.00f, Font::plain));
  35. mGonioPlaceholder->setJustificationType (Justification::centred);
  36. mGonioPlaceholder->setEditable (false, false, false);
  37. mGonioPlaceholder->setColour (Label::backgroundColourId, Colours::cadetblue);
  38. mGonioPlaceholder->setColour (TextEditor::textColourId, Colours::black);
  39. mGonioPlaceholder->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
  40. addAndMakeVisible (mSpectroPlaceholder = new Label ("Spectrometer",
  41. TRANS("Spectrometer\n")));
  42. mSpectroPlaceholder->setFont (Font (15.00f, Font::plain));
  43. mSpectroPlaceholder->setJustificationType (Justification::centred);
  44. mSpectroPlaceholder->setEditable (false, false, false);
  45. mSpectroPlaceholder->setColour (Label::backgroundColourId, Colours::grey);
  46. mSpectroPlaceholder->setColour (TextEditor::textColourId, Colours::black);
  47. mSpectroPlaceholder->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
  48. addAndMakeVisible (mSpectroFreqScale = new Slider ("Spectrum Frequency Scale"));
  49. mSpectroFreqScale->setRange (20, 30000, 0);
  50. mSpectroFreqScale->setSliderStyle (Slider::TwoValueHorizontal);
  51. mSpectroFreqScale->setTextBoxStyle (Slider::NoTextBox, false, 80, 20);
  52. mSpectroFreqScale->addListener (this);
  53. addAndMakeVisible (mAboutButton = new TextButton ("about button"));
  54. mAboutButton->setTooltip (TRANS("Help"));
  55. mAboutButton->setButtonText (TRANS("?"));
  56. mAboutButton->addListener (this);
  57. addAndMakeVisible (mOptionsBtn = new TextButton ("options button"));
  58. mOptionsBtn->setButtonText (TRANS("Options"));
  59. mOptionsBtn->addListener (this);
  60. //[UserPreSize]
  61. mParentProcessor = plugin;
  62. // This hack unsets label colours assigned by Introjucer, as there is no way to avoid these colors automatic generation
  63. for (int i = 0; i < getNumChildComponents(); ++i)
  64. {
  65. Component* comp = getChildComponent(i);
  66. Label* label = NULL;
  67. label = dynamic_cast<Label*>(comp);
  68. if (label != NULL)
  69. {
  70. label->removeColour(TextEditor::textColourId);
  71. label->removeColour(TextEditor::backgroundColourId);
  72. }
  73. }
  74. mOptionsBtn->setVisible(true);
  75. //[/UserPreSize]
  76. setSize (991, 415);
  77. //[Constructor] You can add your own custom stuff here..
  78. //[/Constructor]
  79. }
  80. MainLayout::~MainLayout()
  81. {
  82. //[Destructor_pre]. You can add your own custom destruction code here..
  83. //[/Destructor_pre]
  84. mGonioScaleValue = nullptr;
  85. mSpectroMagnitudeScale = nullptr;
  86. mGonioPlaceholder = nullptr;
  87. mSpectroPlaceholder = nullptr;
  88. mSpectroFreqScale = nullptr;
  89. mAboutButton = nullptr;
  90. mOptionsBtn = nullptr;
  91. //[Destructor]. You can add your own custom destruction code here..
  92. //[/Destructor]
  93. }
  94. //==============================================================================
  95. void MainLayout::paint (Graphics& g)
  96. {
  97. //[UserPrePaint] Add your own custom painting code here..
  98. //[/UserPrePaint]
  99. g.fillAll (Colour (0xff1e1e1e));
  100. //[UserPaint] Add your own custom painting code here..
  101. g.fillAll(LookAndFeel::getDefaultLookAndFeel().findColour(TomatlLookAndFeel::defaultBackground));
  102. //[/UserPaint]
  103. }
  104. void MainLayout::resized()
  105. {
  106. mGonioScaleValue->setBounds (351, 9, 32, 342);
  107. mSpectroMagnitudeScale->setBounds (955, 9, 32, 342);
  108. mGonioPlaceholder->setBounds (9, 9, 342, 342);
  109. mSpectroPlaceholder->setBounds (383, 9, 568, 342);
  110. mSpectroFreqScale->setBounds (383, 355, 568, 24);
  111. mAboutButton->setBounds (960, 384, 24, 24);
  112. mOptionsBtn->setBounds (864, 384, 86, 24);
  113. //[UserResized] Add your own custom resize handling here..
  114. mSpectroFreqScale->setRange(0, 100); // simple percentage here, all scaling is handling by the client
  115. mSpectroMagnitudeScale->setRange(0, 100);
  116. //[/UserResized]
  117. }
  118. void MainLayout::sliderValueChanged (Slider* sliderThatWasMoved)
  119. {
  120. //[UsersliderValueChanged_Pre]
  121. //[/UsersliderValueChanged_Pre]
  122. if (sliderThatWasMoved == mGonioScaleValue)
  123. {
  124. //[UserSliderCode_mGonioScaleValue] -- add your slider handling code here..
  125. mParentProcessor->setManualGonioScaleValue(TOMATL_FROM_DB(sliderThatWasMoved->getValue()));
  126. //[/UserSliderCode_mGonioScaleValue]
  127. }
  128. else if (sliderThatWasMoved == mSpectroMagnitudeScale)
  129. {
  130. //[UserSliderCode_mSpectroMagnitudeScale] -- add your slider handling code here..
  131. mParentProcessor->setSpectroMagnitudeScale(std::pair<double, double>(sliderThatWasMoved->getMinValue(), sliderThatWasMoved->getMaxValue()));
  132. //[/UserSliderCode_mSpectroMagnitudeScale]
  133. }
  134. else if (sliderThatWasMoved == mSpectroFreqScale)
  135. {
  136. //[UserSliderCode_mSpectroFreqScale] -- add your slider handling code here..
  137. mParentProcessor->setSpectroFrequencyScale(std::pair<double, double>(sliderThatWasMoved->getMinValue(), sliderThatWasMoved->getMaxValue()));
  138. //[/UserSliderCode_mSpectroFreqScale]
  139. }
  140. //[UsersliderValueChanged_Post]
  141. //[/UsersliderValueChanged_Post]
  142. }
  143. void MainLayout::buttonClicked (Button* buttonThatWasClicked)
  144. {
  145. //[UserbuttonClicked_Pre]
  146. //[/UserbuttonClicked_Pre]
  147. if (buttonThatWasClicked == mAboutButton)
  148. {
  149. //[UserButtonCode_mAboutButton] -- add your button handler code here..
  150. showAboutDialog();
  151. //[/UserButtonCode_mAboutButton]
  152. }
  153. else if (buttonThatWasClicked == mOptionsBtn)
  154. {
  155. //[UserButtonCode_mOptionsBtn] -- add your button handler code here..
  156. showPreferencesDialog();
  157. //[/UserButtonCode_mOptionsBtn]
  158. }
  159. //[UserbuttonClicked_Post]
  160. //[/UserbuttonClicked_Post]
  161. }
  162. //[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
  163. //[/MiscUserCode]
  164. //==============================================================================
  165. #if 0
  166. /* -- Introjucer information section --
  167. This is where the Introjucer stores the metadata that describe this GUI layout, so
  168. make changes in here at your peril!
  169. BEGIN_JUCER_METADATA
  170. <JUCER_COMPONENT documentType="Component" className="MainLayout" componentName=""
  171. parentClasses="public Component" constructorParams="AdmvAudioProcessor* plugin"
  172. variableInitialisers="" snapPixels="8" snapActive="1" snapShown="1"
  173. overlayOpacity="0.330" fixedSize="1" initialWidth="991" initialHeight="415">
  174. <BACKGROUND backgroundColour="ff1e1e1e"/>
  175. <SLIDER name="Gonio Scale Value" id="759c99b88517019b" memberName="mGonioScaleValue"
  176. virtualName="" explicitFocusOrder="0" pos="351 9 32 342" min="-72"
  177. max="0" int="0" style="LinearVertical" textBoxPos="NoTextBox"
  178. textBoxEditable="0" textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
  179. <SLIDER name="Spectrum Magnitude Scale" id="c469fe133993978c" memberName="mSpectroMagnitudeScale"
  180. virtualName="" explicitFocusOrder="0" pos="955 9 32 342" min="-72"
  181. max="0" int="0" style="TwoValueVertical" textBoxPos="NoTextBox"
  182. textBoxEditable="1" textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
  183. <LABEL name="Goniometer" id="cc50c59b667e6fe0" memberName="mGonioPlaceholder"
  184. virtualName="" explicitFocusOrder="0" pos="9 9 342 342" bkgCol="ff5f9ea0"
  185. edTextCol="ff000000" edBkgCol="0" labelText="Goniometer&#10;"
  186. editableSingleClick="0" editableDoubleClick="0" focusDiscardsChanges="0"
  187. fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
  188. <LABEL name="Spectrometer" id="ec29c7cd27f78cb9" memberName="mSpectroPlaceholder"
  189. virtualName="" explicitFocusOrder="0" pos="383 9 568 342" bkgCol="ff808080"
  190. edTextCol="ff000000" edBkgCol="0" labelText="Spectrometer&#10;"
  191. editableSingleClick="0" editableDoubleClick="0" focusDiscardsChanges="0"
  192. fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
  193. <SLIDER name="Spectrum Frequency Scale" id="fea54c0326f58da2" memberName="mSpectroFreqScale"
  194. virtualName="" explicitFocusOrder="0" pos="383 355 568 24" min="20"
  195. max="30000" int="0" style="TwoValueHorizontal" textBoxPos="NoTextBox"
  196. textBoxEditable="1" textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
  197. <TEXTBUTTON name="about button" id="268c0f6cf9c85fec" memberName="mAboutButton"
  198. virtualName="" explicitFocusOrder="0" pos="960 384 24 24" tooltip="Help"
  199. buttonText="?" connectedEdges="0" needsCallback="1" radioGroupId="0"/>
  200. <TEXTBUTTON name="options button" id="a11b265cc1198ab6" memberName="mOptionsBtn"
  201. virtualName="" explicitFocusOrder="0" pos="864 384 86 24" buttonText="Options"
  202. connectedEdges="0" needsCallback="1" radioGroupId="0"/>
  203. </JUCER_COMPONENT>
  204. END_JUCER_METADATA
  205. */
  206. #endif
  207. //[EndFile] You can add extra defines here...
  208. //[/EndFile]