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.

385 lines
19KB

  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. #include "TomatlLookAndFeel.h"
  15. #include <limits>
  16. //[/Headers]
  17. #include "PreferencesLayout.h"
  18. //[MiscUserDefs] You can add your own user definitions and misc code here...
  19. //[/MiscUserDefs]
  20. //==============================================================================
  21. PreferencesLayout::PreferencesLayout (AdmvAudioProcessor* plugin)
  22. : mParentProcessor(plugin)
  23. {
  24. addAndMakeVisible (mSpectroGroup = new GroupComponent ("new group",
  25. TRANS("Spectrometer")));
  26. addAndMakeVisible (mGenericGroup = new GroupComponent ("new group",
  27. TRANS("Generic")));
  28. addAndMakeVisible (mGonioGroup = new GroupComponent ("gonio group",
  29. TRANS("Goniometer")));
  30. addAndMakeVisible (mGoniometerScaleModeBox = new ComboBox ("goniometer scale mode"));
  31. mGoniometerScaleModeBox->setEditableText (false);
  32. mGoniometerScaleModeBox->setJustificationType (Justification::centredLeft);
  33. mGoniometerScaleModeBox->setTextWhenNothingSelected (String());
  34. mGoniometerScaleModeBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
  35. mGoniometerScaleModeBox->addItem (TRANS("Auto"), 1);
  36. mGoniometerScaleModeBox->addItem (TRANS("Manual"), 2);
  37. mGoniometerScaleModeBox->addListener (this);
  38. addAndMakeVisible (mSpectroReleaseSlider = new Slider ("spectro release slider"));
  39. mSpectroReleaseSlider->setRange (0, 1000, 0);
  40. mSpectroReleaseSlider->setSliderStyle (Slider::LinearHorizontal);
  41. mSpectroReleaseSlider->setTextBoxStyle (Slider::NoTextBox, false, 80, 20);
  42. mSpectroReleaseSlider->addListener (this);
  43. addAndMakeVisible (mSpectroReleaseLabel = new Label ("spectro release label",
  44. TRANS("label text")));
  45. mSpectroReleaseLabel->setFont (Font (15.00f, Font::plain));
  46. mSpectroReleaseLabel->setJustificationType (Justification::centredLeft);
  47. mSpectroReleaseLabel->setEditable (false, false, false);
  48. mSpectroReleaseLabel->setColour (TextEditor::textColourId, Colours::black);
  49. mSpectroReleaseLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
  50. addAndMakeVisible (mSpectrumFillModeBox = new ComboBox ("spectrum fill mode box"));
  51. mSpectrumFillModeBox->setEditableText (false);
  52. mSpectrumFillModeBox->setJustificationType (Justification::centredLeft);
  53. mSpectrumFillModeBox->setTextWhenNothingSelected (String());
  54. mSpectrumFillModeBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
  55. mSpectrumFillModeBox->addItem (TRANS("Semi-transparent"), 1);
  56. mSpectrumFillModeBox->addItem (TRANS("None"), 2);
  57. mSpectrumFillModeBox->addListener (this);
  58. addAndMakeVisible (mOutputModeBox = new ComboBox ("output mode box"));
  59. mOutputModeBox->setEditableText (false);
  60. mOutputModeBox->setJustificationType (Justification::centredLeft);
  61. mOutputModeBox->setTextWhenNothingSelected (String());
  62. mOutputModeBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
  63. mOutputModeBox->addItem (TRANS("No change"), 1);
  64. mOutputModeBox->addItem (TRANS("Mute all"), 2);
  65. mOutputModeBox->addListener (this);
  66. addAndMakeVisible (mGonioScaleReleaseSlider = new Slider ("goniometer scale release"));
  67. mGonioScaleReleaseSlider->setRange (0, 1000, 0);
  68. mGonioScaleReleaseSlider->setSliderStyle (Slider::LinearHorizontal);
  69. mGonioScaleReleaseSlider->setTextBoxStyle (Slider::NoTextBox, false, 80, 20);
  70. mGonioScaleReleaseSlider->addListener (this);
  71. addAndMakeVisible (mGonioScaleReleaseLabel = new Label ("goniometer scale release label",
  72. TRANS("label text")));
  73. mGonioScaleReleaseLabel->setFont (Font (15.00f, Font::plain));
  74. mGonioScaleReleaseLabel->setJustificationType (Justification::centredLeft);
  75. mGonioScaleReleaseLabel->setEditable (false, false, false);
  76. mGonioScaleReleaseLabel->setColour (TextEditor::textColourId, Colours::black);
  77. mGonioScaleReleaseLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
  78. addAndMakeVisible (mGonioOptionLabel1 = new Label ("new label",
  79. TRANS("Scale mode:")));
  80. mGonioOptionLabel1->setFont (Font (15.00f, Font::plain));
  81. mGonioOptionLabel1->setJustificationType (Justification::centredLeft);
  82. mGonioOptionLabel1->setEditable (false, false, false);
  83. mGonioOptionLabel1->setColour (TextEditor::textColourId, Colours::black);
  84. mGonioOptionLabel1->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
  85. addAndMakeVisible (mGonioOptionLabel2 = new Label ("new label",
  86. TRANS("Auto-scale release (ms):")));
  87. mGonioOptionLabel2->setFont (Font (15.00f, Font::plain));
  88. mGonioOptionLabel2->setJustificationType (Justification::centredLeft);
  89. mGonioOptionLabel2->setEditable (false, false, false);
  90. mGonioOptionLabel2->setColour (TextEditor::textColourId, Colours::black);
  91. mGonioOptionLabel2->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
  92. addAndMakeVisible (mSpectroOptionLabel1 = new Label ("new label",
  93. TRANS("Spectrum fill:")));
  94. mSpectroOptionLabel1->setFont (Font (15.00f, Font::plain));
  95. mSpectroOptionLabel1->setJustificationType (Justification::centredLeft);
  96. mSpectroOptionLabel1->setEditable (false, false, false);
  97. mSpectroOptionLabel1->setColour (TextEditor::textColourId, Colours::black);
  98. mSpectroOptionLabel1->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
  99. addAndMakeVisible (mSpectroOptionLabel2 = new Label ("new label",
  100. TRANS("Spectrum release speed (ms):")));
  101. mSpectroOptionLabel2->setFont (Font (15.00f, Font::plain));
  102. mSpectroOptionLabel2->setJustificationType (Justification::centredLeft);
  103. mSpectroOptionLabel2->setEditable (false, false, false);
  104. mSpectroOptionLabel2->setColour (TextEditor::textColourId, Colours::black);
  105. mSpectroOptionLabel2->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
  106. addAndMakeVisible (mGenericOptionLabel1 = new Label ("new label",
  107. TRANS("Audio output:")));
  108. mGenericOptionLabel1->setFont (Font (15.00f, Font::plain));
  109. mGenericOptionLabel1->setJustificationType (Justification::centredLeft);
  110. mGenericOptionLabel1->setEditable (false, false, false);
  111. mGenericOptionLabel1->setColour (TextEditor::textColourId, Colours::black);
  112. mGenericOptionLabel1->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
  113. //[UserPreSize]
  114. mSpectroReleaseBounds.mLow = 50;
  115. mSpectroReleaseBounds.mHigh = 10000;
  116. mGonioScaleReleaseBounds.mLow = 50;
  117. mGonioScaleReleaseBounds.mHigh = 10000;
  118. mGoniometerScaleModeBox->setSelectedItemIndex(mParentProcessor->getState().mManualGoniometerScale ? 1 : 0);
  119. mSpectrumFillModeBox->setSelectedItemIndex(mParentProcessor->getState().mSpectrumFillMode == AdmvPluginState::spectrumFillNone ? 1 : 0);
  120. mOutputModeBox->setSelectedItemIndex(mParentProcessor->getState().mOutputMode == AdmvPluginState::outputMute ? 1 : 0);
  121. double spectroReleaseSpeed = mParentProcessor->getState().mSpectrometerReleaseSpeed;
  122. if (spectroReleaseSpeed != std::numeric_limits<double>::infinity())
  123. {
  124. mSpectroReleaseSlider->setValue(mSpectroReleaseScale.scale(mSpectroReleaseSlider->getMaximum(), mSpectroReleaseBounds, spectroReleaseSpeed));
  125. }
  126. else
  127. {
  128. mSpectroReleaseSlider->setValue(mSpectroReleaseSlider->getMaximum());
  129. }
  130. setSpectroReleaseLabelText(spectroReleaseSpeed);
  131. double gonioReleaseSpeed = mParentProcessor->getState().mGoniometerScaleAttackRelease.second;
  132. mGonioScaleReleaseSlider->setValue(mGonioScaleReleaseScale.scale(mGonioScaleReleaseSlider->getMaximum(), mGonioScaleReleaseBounds, gonioReleaseSpeed));
  133. mGonioScaleReleaseLabel->setText(juce::String((int)gonioReleaseSpeed), juce::dontSendNotification);
  134. //[/UserPreSize]
  135. setSize (528, 256);
  136. //[Constructor] You can add your own custom stuff here..
  137. //[/Constructor]
  138. }
  139. PreferencesLayout::~PreferencesLayout()
  140. {
  141. //[Destructor_pre]. You can add your own custom destruction code here..
  142. //[/Destructor_pre]
  143. mSpectroGroup = nullptr;
  144. mGenericGroup = nullptr;
  145. mGonioGroup = nullptr;
  146. mGoniometerScaleModeBox = nullptr;
  147. mSpectroReleaseSlider = nullptr;
  148. mSpectroReleaseLabel = nullptr;
  149. mSpectrumFillModeBox = nullptr;
  150. mOutputModeBox = nullptr;
  151. mGonioScaleReleaseSlider = nullptr;
  152. mGonioScaleReleaseLabel = nullptr;
  153. mGonioOptionLabel1 = nullptr;
  154. mGonioOptionLabel2 = nullptr;
  155. mSpectroOptionLabel1 = nullptr;
  156. mSpectroOptionLabel2 = nullptr;
  157. mGenericOptionLabel1 = nullptr;
  158. //[Destructor]. You can add your own custom destruction code here..
  159. //[/Destructor]
  160. }
  161. //==============================================================================
  162. void PreferencesLayout::paint (Graphics& g)
  163. {
  164. //[UserPrePaint] Add your own custom painting code here..
  165. //[/UserPrePaint]
  166. g.fillAll (Colours::white);
  167. //[UserPaint] Add your own custom painting code here..
  168. g.fillAll(LookAndFeel::getDefaultLookAndFeel().findColour(TomatlLookAndFeel::defaultBackground));
  169. //[/UserPaint]
  170. }
  171. void PreferencesLayout::resized()
  172. {
  173. mSpectroGroup->setBounds (0, 96, 528, 96);
  174. mGenericGroup->setBounds (0, 192, 528, 64);
  175. mGonioGroup->setBounds (0, 0, 528, 96);
  176. mGoniometerScaleModeBox->setBounds (264, 24, 150, 24);
  177. mSpectroReleaseSlider->setBounds (264, 152, 150, 24);
  178. mSpectroReleaseLabel->setBounds (416, 152, 88, 24);
  179. mSpectrumFillModeBox->setBounds (264, 120, 150, 24);
  180. mOutputModeBox->setBounds (264, 216, 150, 24);
  181. mGonioScaleReleaseSlider->setBounds (264, 56, 150, 24);
  182. mGonioScaleReleaseLabel->setBounds (416, 56, 72, 24);
  183. mGonioOptionLabel1->setBounds (16, 24, 168, 24);
  184. mGonioOptionLabel2->setBounds (16, 56, 239, 24);
  185. mSpectroOptionLabel1->setBounds (16, 120, 150, 24);
  186. mSpectroOptionLabel2->setBounds (16, 152, 207, 24);
  187. mGenericOptionLabel1->setBounds (16, 216, 150, 24);
  188. //[UserResized] Add your own custom resize handling here..
  189. //[/UserResized]
  190. }
  191. void PreferencesLayout::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
  192. {
  193. //[UsercomboBoxChanged_Pre]
  194. //[/UsercomboBoxChanged_Pre]
  195. if (comboBoxThatHasChanged == mGoniometerScaleModeBox)
  196. {
  197. //[UserComboBoxCode_mGoniometerScaleModeBox] -- add your combo box handling code here..
  198. mParentProcessor->setManualGonioScaleEnabled(comboBoxThatHasChanged->getSelectedItemIndex() == 1);
  199. //[/UserComboBoxCode_mGoniometerScaleModeBox]
  200. }
  201. else if (comboBoxThatHasChanged == mSpectrumFillModeBox)
  202. {
  203. //[UserComboBoxCode_mSpectrumFillModeBox] -- add your combo box handling code here..
  204. mParentProcessor->setSpectroFillMode(comboBoxThatHasChanged->getSelectedItemIndex() == 0 ? AdmvPluginState::spectrumFillWithTransparency : AdmvPluginState::spectrumFillNone);
  205. //[/UserComboBoxCode_mSpectrumFillModeBox]
  206. }
  207. else if (comboBoxThatHasChanged == mOutputModeBox)
  208. {
  209. //[UserComboBoxCode_mOutputModeBox] -- add your combo box handling code here..
  210. mParentProcessor->setOutputMode(comboBoxThatHasChanged->getSelectedItemIndex() == 0 ? AdmvPluginState::outputNoChange : AdmvPluginState::outputMute);
  211. //[/UserComboBoxCode_mOutputModeBox]
  212. }
  213. //[UsercomboBoxChanged_Post]
  214. //[/UsercomboBoxChanged_Post]
  215. }
  216. void PreferencesLayout::sliderValueChanged (Slider* sliderThatWasMoved)
  217. {
  218. //[UsersliderValueChanged_Pre]
  219. //[/UsersliderValueChanged_Pre]
  220. if (sliderThatWasMoved == mSpectroReleaseSlider)
  221. {
  222. //[UserSliderCode_mSpectroReleaseSlider] -- add your slider handling code here..
  223. auto releaseSpeed = mSpectroReleaseScale.unscale(sliderThatWasMoved->getMaximum(), mSpectroReleaseBounds, sliderThatWasMoved->getValue());
  224. mParentProcessor->setSpectroReleaseSpeed(releaseSpeed == mSpectroReleaseBounds.mHigh ? std::numeric_limits<double>::infinity() : releaseSpeed);
  225. setSpectroReleaseLabelText(releaseSpeed);
  226. //[/UserSliderCode_mSpectroReleaseSlider]
  227. }
  228. else if (sliderThatWasMoved == mGonioScaleReleaseSlider)
  229. {
  230. //[UserSliderCode_mGonioScaleReleaseSlider] -- add your slider handling code here..
  231. auto releaseSpeed = mGonioScaleReleaseScale.unscale(sliderThatWasMoved->getMaximum(), mGonioScaleReleaseBounds, sliderThatWasMoved->getValue());
  232. mParentProcessor->setManualGonioScaleRelease(releaseSpeed);
  233. mGonioScaleReleaseLabel->setText(juce::String((int)releaseSpeed), juce::dontSendNotification);
  234. //[/UserSliderCode_mGonioScaleReleaseSlider]
  235. }
  236. //[UsersliderValueChanged_Post]
  237. //[/UsersliderValueChanged_Post]
  238. }
  239. //[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
  240. //[/MiscUserCode]
  241. //==============================================================================
  242. #if 0
  243. /* -- Introjucer information section --
  244. This is where the Introjucer stores the metadata that describe this GUI layout, so
  245. make changes in here at your peril!
  246. BEGIN_JUCER_METADATA
  247. <JUCER_COMPONENT documentType="Component" className="PreferencesLayout" componentName=""
  248. parentClasses="public Component" constructorParams="AdmvAudioProcessor* plugin"
  249. variableInitialisers="mParentProcessor(plugin)" snapPixels="8"
  250. snapActive="1" snapShown="1" overlayOpacity="0.330" fixedSize="1"
  251. initialWidth="528" initialHeight="256">
  252. <BACKGROUND backgroundColour="ffffffff"/>
  253. <GROUPCOMPONENT name="new group" id="f24f8e0b8ec35751" memberName="mSpectroGroup"
  254. virtualName="" explicitFocusOrder="0" pos="0 96 528 96" title="Spectrometer"/>
  255. <GROUPCOMPONENT name="new group" id="3a93324f56884b80" memberName="mGenericGroup"
  256. virtualName="" explicitFocusOrder="0" pos="0 192 528 64" title="Generic"/>
  257. <GROUPCOMPONENT name="gonio group" id="29e358bd05278b4" memberName="mGonioGroup"
  258. virtualName="" explicitFocusOrder="0" pos="0 0 528 96" title="Goniometer"/>
  259. <COMBOBOX name="goniometer scale mode" id="a1dd39452c7f167b" memberName="mGoniometerScaleModeBox"
  260. virtualName="" explicitFocusOrder="0" pos="264 24 150 24" editable="0"
  261. layout="33" items="Auto&#10;Manual" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
  262. <SLIDER name="spectro release slider" id="80c6c9a19158f9fd" memberName="mSpectroReleaseSlider"
  263. virtualName="" explicitFocusOrder="0" pos="264 152 150 24" min="0"
  264. max="1000" int="0" style="LinearHorizontal" textBoxPos="NoTextBox"
  265. textBoxEditable="1" textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
  266. <LABEL name="spectro release label" id="cd214626a42882bc" memberName="mSpectroReleaseLabel"
  267. virtualName="" explicitFocusOrder="0" pos="416 152 88 24" edTextCol="ff000000"
  268. edBkgCol="0" labelText="label text" editableSingleClick="0" editableDoubleClick="0"
  269. focusDiscardsChanges="0" fontname="Default font" fontsize="15"
  270. bold="0" italic="0" justification="33"/>
  271. <COMBOBOX name="spectrum fill mode box" id="c3a176fc7e06cc2f" memberName="mSpectrumFillModeBox"
  272. virtualName="" explicitFocusOrder="0" pos="264 120 150 24" editable="0"
  273. layout="33" items="Semi-transparent&#10;None" textWhenNonSelected=""
  274. textWhenNoItems="(no choices)"/>
  275. <COMBOBOX name="output mode box" id="582acc21501a5672" memberName="mOutputModeBox"
  276. virtualName="" explicitFocusOrder="0" pos="264 216 150 24" editable="0"
  277. layout="33" items="No change&#10;Mute all" textWhenNonSelected=""
  278. textWhenNoItems="(no choices)"/>
  279. <SLIDER name="goniometer scale release" id="32283029e35fd491" memberName="mGonioScaleReleaseSlider"
  280. virtualName="" explicitFocusOrder="0" pos="264 56 150 24" min="0"
  281. max="1000" int="0" style="LinearHorizontal" textBoxPos="NoTextBox"
  282. textBoxEditable="1" textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
  283. <LABEL name="goniometer scale release label" id="1da2f804f295b7f4" memberName="mGonioScaleReleaseLabel"
  284. virtualName="" explicitFocusOrder="0" pos="416 56 72 24" edTextCol="ff000000"
  285. edBkgCol="0" labelText="label text" editableSingleClick="0" editableDoubleClick="0"
  286. focusDiscardsChanges="0" fontname="Default font" fontsize="15"
  287. bold="0" italic="0" justification="33"/>
  288. <LABEL name="new label" id="5e1d40a82f1005ba" memberName="mGonioOptionLabel1"
  289. virtualName="" explicitFocusOrder="0" pos="16 24 168 24" edTextCol="ff000000"
  290. edBkgCol="0" labelText="Scale mode:" editableSingleClick="0"
  291. editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
  292. fontsize="15" bold="0" italic="0" justification="33"/>
  293. <LABEL name="new label" id="5198253911601231" memberName="mGonioOptionLabel2"
  294. virtualName="" explicitFocusOrder="0" pos="16 56 239 24" edTextCol="ff000000"
  295. edBkgCol="0" labelText="Auto-scale release (ms):" editableSingleClick="0"
  296. editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
  297. fontsize="15" bold="0" italic="0" justification="33"/>
  298. <LABEL name="new label" id="d04b6c868f590aa8" memberName="mSpectroOptionLabel1"
  299. virtualName="" explicitFocusOrder="0" pos="16 120 150 24" edTextCol="ff000000"
  300. edBkgCol="0" labelText="Spectrum fill:" editableSingleClick="0"
  301. editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
  302. fontsize="15" bold="0" italic="0" justification="33"/>
  303. <LABEL name="new label" id="d45450f0081a7e37" memberName="mSpectroOptionLabel2"
  304. virtualName="" explicitFocusOrder="0" pos="16 152 207 24" edTextCol="ff000000"
  305. edBkgCol="0" labelText="Spectrum release speed (ms):" editableSingleClick="0"
  306. editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
  307. fontsize="15" bold="0" italic="0" justification="33"/>
  308. <LABEL name="new label" id="2619bcfb069a93ef" memberName="mGenericOptionLabel1"
  309. virtualName="" explicitFocusOrder="0" pos="16 216 150 24" edTextCol="ff000000"
  310. edBkgCol="0" labelText="Audio output:" editableSingleClick="0"
  311. editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font"
  312. fontsize="15" bold="0" italic="0" justification="33"/>
  313. </JUCER_COMPONENT>
  314. END_JUCER_METADATA
  315. */
  316. #endif
  317. //[EndFile] You can add extra defines here...
  318. //[/EndFile]