ConfigGui.cpp 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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.1
  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 "Constants.h"
  15. //[/Headers]
  16. #include "ConfigGui.h"
  17. //[MiscUserDefs] You can add your own user definitions and misc code here...
  18. //[/MiscUserDefs]
  19. //==============================================================================
  20. ConfigGui::ConfigGui (ValueTree gui_store)
  21. : guiStore(gui_store)
  22. {
  23. //[Constructor_pre] You can add your own custom stuff here..
  24. //[/Constructor_pre]
  25. addAndMakeVisible (mixerGroup = new GroupComponent ("mixerGroup",
  26. TRANS("mixer")));
  27. mixerGroup->setTextLabelPosition (Justification::centredLeft);
  28. mixerGroup->setColour (GroupComponent::outlineColourId, Colours::grey);
  29. mixerGroup->setColour (GroupComponent::textColourId, Colours::white);
  30. addAndMakeVisible (chatGroup = new GroupComponent ("chatGroup",
  31. TRANS("chat")));
  32. chatGroup->setTextLabelPosition (Justification::centredLeft);
  33. chatGroup->setColour (GroupComponent::outlineColourId, Colours::grey);
  34. chatGroup->setColour (GroupComponent::textColourId, Colours::white);
  35. addAndMakeVisible (fontsizeLabel = new Label ("fontsizeLabel",
  36. TRANS("chat font size:")));
  37. fontsizeLabel->setFont (Font (15.00f, Font::plain));
  38. fontsizeLabel->setJustificationType (Justification::centredLeft);
  39. fontsizeLabel->setEditable (false, false, false);
  40. fontsizeLabel->setColour (Label::textColourId, Colours::white);
  41. fontsizeLabel->setColour (TextEditor::textColourId, Colours::black);
  42. fontsizeLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
  43. addAndMakeVisible (updateLabel = new Label ("updateLabel",
  44. TRANS("vu update speed:")));
  45. updateLabel->setFont (Font (15.00f, Font::plain));
  46. updateLabel->setJustificationType (Justification::centredLeft);
  47. updateLabel->setEditable (false, false, false);
  48. updateLabel->setColour (Label::textColourId, Colours::white);
  49. updateLabel->setColour (TextEditor::textColourId, Colours::black);
  50. updateLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
  51. addAndMakeVisible (updateComboBox = new ComboBox ("updateComboBox"));
  52. updateComboBox->setExplicitFocusOrder (2);
  53. updateComboBox->setEditableText (false);
  54. updateComboBox->setJustificationType (Justification::centredRight);
  55. updateComboBox->setTextWhenNothingSelected (String());
  56. updateComboBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
  57. updateComboBox->addListener (this);
  58. addAndMakeVisible (fontsizeComboBox = new ComboBox ("fontsizeComboBox"));
  59. fontsizeComboBox->setExplicitFocusOrder (1);
  60. fontsizeComboBox->setEditableText (false);
  61. fontsizeComboBox->setJustificationType (Justification::centredRight);
  62. fontsizeComboBox->setTextWhenNothingSelected (String());
  63. fontsizeComboBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
  64. fontsizeComboBox->addListener (this);
  65. //[UserPreSize]
  66. //[/UserPreSize]
  67. setSize (600, 400);
  68. //[Constructor] You can add your own custom stuff here..
  69. int font_size_n = int(this->guiStore[CONFIG::FONT_SIZE_ID ]) ;
  70. int gui_update_hipri_ivl_n = int(this->guiStore[CONFIG::UPDATE_IVL_ID]) ;
  71. this->fontsizeComboBox->addItemList(GUI::FONT_SIZES , 1) ;
  72. this->updateComboBox ->addItemList(GUI::UPDATE_IVLS , 1) ;
  73. this->fontsizeComboBox->setSelectedItemIndex(font_size_n ) ;
  74. this->updateComboBox ->setSelectedItemIndex(gui_update_hipri_ivl_n) ;
  75. //[/Constructor]
  76. }
  77. ConfigGui::~ConfigGui()
  78. {
  79. //[Destructor_pre]. You can add your own custom destruction code here..
  80. //[/Destructor_pre]
  81. mixerGroup = nullptr;
  82. chatGroup = nullptr;
  83. fontsizeLabel = nullptr;
  84. updateLabel = nullptr;
  85. updateComboBox = nullptr;
  86. fontsizeComboBox = nullptr;
  87. //[Destructor]. You can add your own custom destruction code here..
  88. //[/Destructor]
  89. }
  90. //==============================================================================
  91. void ConfigGui::paint (Graphics& g)
  92. {
  93. //[UserPrePaint] Add your own custom painting code here..
  94. //[/UserPrePaint]
  95. g.fillAll (Colour (0xff000020));
  96. //[UserPaint] Add your own custom painting code here..
  97. //[/UserPaint]
  98. }
  99. void ConfigGui::resized()
  100. {
  101. //[UserPreResize] Add your own custom resize code here..
  102. //[/UserPreResize]
  103. mixerGroup->setBounds (214, 100, 188, 48);
  104. chatGroup->setBounds (214, 38, 188, 48);
  105. fontsizeLabel->setBounds (222, 56, 96, 18);
  106. updateLabel->setBounds (222, 118, 96, 18);
  107. updateComboBox->setBounds (326, 118, 64, 18);
  108. fontsizeComboBox->setBounds (326, 56, 64, 18);
  109. //[UserResized] Add your own custom resize handling here..
  110. //[/UserResized]
  111. }
  112. void ConfigGui::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
  113. {
  114. //[UsercomboBoxChanged_Pre]
  115. int option_n = comboBoxThatHasChanged->getSelectedItemIndex() ;
  116. String option_text = comboBoxThatHasChanged->getText() ;
  117. Identifier key ;
  118. var value ;
  119. //[/UsercomboBoxChanged_Pre]
  120. if (comboBoxThatHasChanged == updateComboBox)
  121. {
  122. //[UserComboBoxCode_updateComboBox] -- add your combo box handling code here..
  123. key = CONFIG::UPDATE_IVL_ID ;
  124. value = var((~option_n) ? option_n : CONFIG::DEFAULT_UPDATE_IVL_N) ;
  125. this->updateComboBox->setSelectedItemIndex(option_n) ;
  126. //[/UserComboBoxCode_updateComboBox]
  127. }
  128. else if (comboBoxThatHasChanged == fontsizeComboBox)
  129. {
  130. //[UserComboBoxCode_fontsizeComboBox] -- add your combo box handling code here..
  131. key = CONFIG::FONT_SIZE_ID ;
  132. value = var((~option_n) ? option_n : 0) ;
  133. this->fontsizeComboBox->setSelectedItemIndex(option_n) ;
  134. //[/UserComboBoxCode_fontsizeComboBox]
  135. }
  136. //[UsercomboBoxChanged_Post]
  137. setConfig(key , value) ;
  138. //[/UsercomboBoxChanged_Post]
  139. }
  140. //[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
  141. void ConfigGui::setConfig(Identifier a_key , var a_value)
  142. {
  143. if (a_key.isValid()) this->guiStore.setProperty(a_key , a_value , nullptr) ;
  144. }
  145. //[/MiscUserCode]
  146. //==============================================================================
  147. #if 0
  148. /* -- Introjucer information section --
  149. This is where the Introjucer stores the metadata that describe this GUI layout, so
  150. make changes in here at your peril!
  151. BEGIN_JUCER_METADATA
  152. <JUCER_COMPONENT documentType="Component" className="ConfigGui" componentName=""
  153. parentClasses="public Component" constructorParams="ValueTree gui_store"
  154. variableInitialisers="guiStore(gui_store)" snapPixels="8" snapActive="1"
  155. snapShown="1" overlayOpacity="0.330" fixedSize="0" initialWidth="600"
  156. initialHeight="400">
  157. <BACKGROUND backgroundColour="ff000020"/>
  158. <GROUPCOMPONENT name="mixerGroup" id="5f4710d68a339cda" memberName="mixerGroup"
  159. virtualName="" explicitFocusOrder="0" pos="214 100 188 48" outlinecol="ff808080"
  160. textcol="ffffffff" title="mixer" textpos="33"/>
  161. <GROUPCOMPONENT name="chatGroup" id="35b859a43662c4ca" memberName="chatGroup"
  162. virtualName="" explicitFocusOrder="0" pos="214 38 188 48" outlinecol="ff808080"
  163. textcol="ffffffff" title="chat" textpos="33"/>
  164. <LABEL name="fontsizeLabel" id="5cb85d669129843" memberName="fontsizeLabel"
  165. virtualName="" explicitFocusOrder="0" pos="222 56 96 18" textCol="ffffffff"
  166. edTextCol="ff000000" edBkgCol="0" labelText="chat font size:"
  167. editableSingleClick="0" editableDoubleClick="0" focusDiscardsChanges="0"
  168. fontname="Default font" fontsize="15" bold="0" italic="0" justification="33"/>
  169. <LABEL name="updateLabel" id="116b9ce3acfaa0e6" memberName="updateLabel"
  170. virtualName="" explicitFocusOrder="0" pos="222 118 96 18" textCol="ffffffff"
  171. edTextCol="ff000000" edBkgCol="0" labelText="vu update speed:"
  172. editableSingleClick="0" editableDoubleClick="0" focusDiscardsChanges="0"
  173. fontname="Default font" fontsize="15" bold="0" italic="0" justification="33"/>
  174. <COMBOBOX name="updateComboBox" id="bef2196516ab5821" memberName="updateComboBox"
  175. virtualName="" explicitFocusOrder="2" pos="326 118 64 18" editable="0"
  176. layout="34" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
  177. <COMBOBOX name="fontsizeComboBox" id="128e0c382d0cdf83" memberName="fontsizeComboBox"
  178. virtualName="" explicitFocusOrder="1" pos="326 56 64 18" editable="0"
  179. layout="34" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
  180. </JUCER_COMPONENT>
  181. END_JUCER_METADATA
  182. */
  183. #endif
  184. //[EndFile] You can add extra defines here...
  185. //[/EndFile]