andrewm@0
|
1 /*
|
andrewm@0
|
2 ==============================================================================
|
andrewm@0
|
3
|
andrewm@0
|
4 This is an automatically generated GUI class created by the Introjucer!
|
andrewm@0
|
5
|
andrewm@0
|
6 Be careful when adding custom code to these files, as only the code within
|
andrewm@0
|
7 the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
|
andrewm@0
|
8 and re-saved.
|
andrewm@0
|
9
|
andrewm@0
|
10 Created with Introjucer version: 3.1.0
|
andrewm@0
|
11
|
andrewm@0
|
12 ------------------------------------------------------------------------------
|
andrewm@0
|
13
|
andrewm@0
|
14 The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
|
andrewm@0
|
15 Copyright 2004-13 by Raw Material Software Ltd.
|
andrewm@0
|
16
|
andrewm@0
|
17 ==============================================================================
|
andrewm@0
|
18 */
|
andrewm@0
|
19
|
andrewm@0
|
20 //[Headers] You can add your own extra header files here...
|
andrewm@0
|
21 #include "PluginProcessor.h"
|
andrewm@0
|
22 //[/Headers]
|
andrewm@0
|
23
|
andrewm@0
|
24 #include "PluginEditor.h"
|
andrewm@0
|
25
|
andrewm@0
|
26
|
andrewm@0
|
27 //[MiscUserDefs] You can add your own user definitions and misc code here...
|
andrewm@0
|
28
|
andrewm@0
|
29 //LookAndFeelCustom* DistortionAudioProcessorEditor::customLookAndFeel = NULL;
|
andrewm@0
|
30
|
andrewm@0
|
31 //[/MiscUserDefs]
|
andrewm@0
|
32
|
andrewm@0
|
33 //==============================================================================
|
andrewm@0
|
34 DistortionAudioProcessorEditor::DistortionAudioProcessorEditor (DistortionAudioProcessor* ownerFilter)
|
andrewm@0
|
35 : AudioProcessorEditor (ownerFilter)
|
andrewm@0
|
36 {
|
andrewm@0
|
37 addAndMakeVisible (resetButton = new TextButton ("on off button"));
|
andrewm@0
|
38 resetButton->setButtonText (TRANS("RESET"));
|
andrewm@0
|
39 resetButton->addListener (this);
|
andrewm@0
|
40 resetButton->setColour (TextButton::buttonColourId, Colour (0xffad8585));
|
andrewm@0
|
41 resetButton->setColour (TextButton::buttonOnColourId, Colours::red);
|
andrewm@0
|
42
|
andrewm@0
|
43 addAndMakeVisible (gainSlider = new Slider ("new slider"));
|
andrewm@0
|
44 gainSlider->setRange (-24, 24, 0.01);
|
andrewm@0
|
45 gainSlider->setSliderStyle (Slider::RotaryHorizontalVerticalDrag);
|
andrewm@0
|
46 gainSlider->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 20);
|
andrewm@0
|
47 gainSlider->setColour (Slider::rotarySliderFillColourId, Colour (0x7fffffff));
|
andrewm@0
|
48 gainSlider->setColour (Slider::textBoxTextColourId, Colours::white);
|
andrewm@0
|
49 gainSlider->setColour (Slider::textBoxBackgroundColourId, Colour (0x00ffffff));
|
andrewm@0
|
50 gainSlider->setColour (Slider::textBoxOutlineColourId, Colour (0x00808080));
|
andrewm@0
|
51 gainSlider->addListener (this);
|
andrewm@0
|
52
|
andrewm@0
|
53 addAndMakeVisible (typeComboBox = new ComboBox ("new combo box"));
|
andrewm@0
|
54 typeComboBox->setEditableText (false);
|
andrewm@0
|
55 typeComboBox->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
56 typeComboBox->setTextWhenNothingSelected (String::empty);
|
andrewm@0
|
57 typeComboBox->setTextWhenNoChoicesAvailable (TRANS("(no choices)"));
|
andrewm@0
|
58 typeComboBox->addItem (TRANS("Hard clipping"), 1);
|
andrewm@0
|
59 typeComboBox->addItem (TRANS("Soft clipping (poly)"), 2);
|
andrewm@0
|
60 typeComboBox->addItem (TRANS("Soft clipping (exp)"), 3);
|
andrewm@0
|
61 typeComboBox->addItem (TRANS("Full-wave rectifier"), 4);
|
andrewm@0
|
62 typeComboBox->addItem (TRANS("Half-wave rectifier"), 5);
|
andrewm@0
|
63 typeComboBox->addListener (this);
|
andrewm@0
|
64
|
andrewm@0
|
65
|
andrewm@0
|
66 //[UserPreSize]
|
andrewm@0
|
67 addAndMakeVisible (resizer = new ResizableCornerComponent (this, &resizeLimits));
|
andrewm@0
|
68 resizeLimits.setSizeLimits (150, 150, 850, 290);
|
andrewm@0
|
69 //[/UserPreSize]
|
andrewm@0
|
70
|
andrewm@0
|
71 setSize (280, 320);
|
andrewm@0
|
72
|
andrewm@0
|
73
|
andrewm@0
|
74 //[Constructor] You can add your own custom stuff here..
|
andrewm@0
|
75
|
andrewm@0
|
76 UpdateInterfaceValues();
|
andrewm@0
|
77
|
andrewm@0
|
78 //************************************ SET LOOKANDFEEL **********************************
|
andrewm@0
|
79 // if( customLookAndFeel == NULL )
|
andrewm@0
|
80 // {
|
andrewm@0
|
81 // customLookAndFeel = new LookAndFeelCustom();
|
andrewm@0
|
82 // LookAndFeel::setDefaultLookAndFeel (/*&*/customLookAndFeel);
|
andrewm@0
|
83 // }
|
andrewm@0
|
84
|
andrewm@0
|
85 //***************************************************************************************
|
andrewm@0
|
86
|
andrewm@0
|
87 startTimer (50);
|
andrewm@0
|
88
|
andrewm@0
|
89 //[/Constructor]
|
andrewm@0
|
90 }
|
andrewm@0
|
91
|
andrewm@0
|
92 DistortionAudioProcessorEditor::~DistortionAudioProcessorEditor()
|
andrewm@0
|
93 {
|
andrewm@0
|
94 //[Destructor_pre]. You can add your own custom destruction code here..
|
andrewm@0
|
95 //[/Destructor_pre]
|
andrewm@0
|
96
|
andrewm@0
|
97 resetButton = nullptr;
|
andrewm@0
|
98 gainSlider = nullptr;
|
andrewm@0
|
99 typeComboBox = nullptr;
|
andrewm@0
|
100
|
andrewm@0
|
101
|
andrewm@0
|
102 //[Destructor]. You can add your own custom destruction code here..
|
andrewm@0
|
103
|
andrewm@0
|
104 //[/Destructor]
|
andrewm@0
|
105 }
|
andrewm@0
|
106
|
andrewm@0
|
107 //==============================================================================
|
andrewm@0
|
108 void DistortionAudioProcessorEditor::paint (Graphics& g)
|
andrewm@0
|
109 {
|
andrewm@0
|
110 //[UserPrePaint] Add your own custom painting code here..
|
andrewm@0
|
111 //[/UserPrePaint]
|
andrewm@0
|
112
|
andrewm@0
|
113 g.fillAll (Colour (0xff880909));
|
andrewm@0
|
114
|
andrewm@0
|
115 g.setColour (Colours::red);
|
andrewm@0
|
116 g.fillEllipse (96.0f, 158.0f, 88.0f, 88.0f);
|
andrewm@0
|
117
|
andrewm@0
|
118 g.setColour (Colour (0xff2c333b));
|
andrewm@0
|
119 g.fillEllipse (112.0f, 174.0f, 56.0f, 56.0f);
|
andrewm@0
|
120
|
andrewm@0
|
121 g.setColour (Colour (0xff650000));
|
andrewm@0
|
122 g.fillRoundedRectangle (54.0f, 6.0f, 175.0f, 37.0f, 10.000f);
|
andrewm@0
|
123
|
andrewm@0
|
124 g.setColour (Colours::white);
|
andrewm@0
|
125 g.setFont (Font (Font::getDefaultMonospacedFontName(), 22.30f, Font::bold));
|
andrewm@0
|
126 g.drawText (TRANS("distortion"),
|
andrewm@0
|
127 6, 13, 277, 24,
|
andrewm@0
|
128 Justification::centredTop, true);
|
andrewm@0
|
129
|
andrewm@0
|
130 g.setColour (Colours::white);
|
andrewm@0
|
131 g.setFont (Font (Font::getDefaultMonospacedFontName(), 15.00f, Font::plain));
|
andrewm@0
|
132 g.drawText (TRANS("GAIN"),
|
andrewm@0
|
133 3, 133, 275, 30,
|
andrewm@0
|
134 Justification::centred, true);
|
andrewm@0
|
135
|
andrewm@0
|
136 //[UserPaint] Add your own custom painting code here..
|
andrewm@0
|
137
|
andrewm@0
|
138 // Knob bounds
|
andrewm@0
|
139 g.setColour (Colours::white);
|
andrewm@0
|
140 g.setFont (Font (Font::getDefaultMonospacedFontName(), 11.00f, Font::plain));
|
andrewm@0
|
141 g.drawText (String(gainSlider->getMinimum()),
|
andrewm@0
|
142 59, 229, 54, 30,
|
andrewm@0
|
143 Justification::centredRight, true);
|
andrewm@0
|
144
|
andrewm@0
|
145 g.setColour (Colours::white);
|
andrewm@0
|
146 g.setFont (Font (Font::getDefaultMonospacedFontName(), 11.00f, Font::plain));
|
andrewm@0
|
147 g.drawText (String(gainSlider->getMaximum()),
|
andrewm@0
|
148 168, 229, 54, 30,
|
andrewm@0
|
149 Justification::centredLeft, true);
|
andrewm@0
|
150
|
andrewm@0
|
151 // Version number
|
andrewm@0
|
152 String str("v ");
|
andrewm@0
|
153 str.append(JucePlugin_VersionString, 4);
|
andrewm@0
|
154 g.setColour (Colours::white);
|
andrewm@0
|
155 g.setFont (Font (Font::getDefaultMonospacedFontName(), 11.00f, Font::plain));
|
andrewm@0
|
156 g.drawText (str,
|
andrewm@0
|
157 189, 37, 54, 30,
|
andrewm@0
|
158 Justification::centredLeft, true);
|
andrewm@0
|
159
|
andrewm@0
|
160 //[/UserPaint]
|
andrewm@0
|
161 }
|
andrewm@0
|
162
|
andrewm@0
|
163 void DistortionAudioProcessorEditor::resized()
|
andrewm@0
|
164 {
|
andrewm@0
|
165 resetButton->setBounds (236, 5, 39, 23);
|
andrewm@0
|
166 gainSlider->setBounds (58, 162, 164, 102);
|
andrewm@0
|
167 typeComboBox->setBounds (69, 77, 150, 24);
|
andrewm@0
|
168 //[UserResized] Add your own custom resize handling here..
|
andrewm@0
|
169 getProcessor()->_lastUIWidth = getWidth();
|
andrewm@0
|
170 getProcessor()->_lastUIHeight = getHeight();
|
andrewm@0
|
171 //[/UserResized]
|
andrewm@0
|
172 }
|
andrewm@0
|
173
|
andrewm@0
|
174 void DistortionAudioProcessorEditor::buttonClicked (Button* buttonThatWasClicked)
|
andrewm@0
|
175 {
|
andrewm@0
|
176 //[UserbuttonClicked_Pre]
|
andrewm@0
|
177 DistortionAudioProcessor* ourProcessor = getProcessor();
|
andrewm@0
|
178
|
andrewm@0
|
179 //[/UserbuttonClicked_Pre]
|
andrewm@0
|
180
|
andrewm@0
|
181 if (buttonThatWasClicked == resetButton)
|
andrewm@0
|
182 {
|
andrewm@0
|
183 //[UserButtonCode_resetButton] -- add your button handler code here..
|
andrewm@0
|
184 ourProcessor->Reset();
|
andrewm@0
|
185 //[/UserButtonCode_resetButton]
|
andrewm@0
|
186 }
|
andrewm@0
|
187
|
andrewm@0
|
188 //[UserbuttonClicked_Post]
|
andrewm@0
|
189 UpdateInterfaceValues();
|
andrewm@0
|
190 //[/UserbuttonClicked_Post]
|
andrewm@0
|
191 }
|
andrewm@0
|
192
|
andrewm@0
|
193 void DistortionAudioProcessorEditor::sliderValueChanged (Slider* sliderThatWasMoved)
|
andrewm@0
|
194 {
|
andrewm@0
|
195 //[UsersliderValueChanged_Pre]
|
andrewm@0
|
196 DistortionAudioProcessor* ourProcessor = getProcessor();
|
andrewm@0
|
197 //[/UsersliderValueChanged_Pre]
|
andrewm@0
|
198
|
andrewm@0
|
199 if (sliderThatWasMoved == gainSlider)
|
andrewm@0
|
200 {
|
andrewm@0
|
201 //[UserSliderCode_gainSlider] -- add your slider handling code here..
|
andrewm@0
|
202 ourProcessor->SetGainIndB(gainSlider->getValue());
|
andrewm@0
|
203 //[/UserSliderCode_gainSlider]
|
andrewm@0
|
204 }
|
andrewm@0
|
205
|
andrewm@0
|
206 //[UsersliderValueChanged_Post]
|
andrewm@0
|
207 //[/UsersliderValueChanged_Post]
|
andrewm@0
|
208 }
|
andrewm@0
|
209
|
andrewm@0
|
210 void DistortionAudioProcessorEditor::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
|
andrewm@0
|
211 {
|
andrewm@0
|
212 //[UsercomboBoxChanged_Pre]
|
andrewm@0
|
213 DistortionAudioProcessor* ourProcessor = getProcessor();
|
andrewm@0
|
214 //[/UsercomboBoxChanged_Pre]
|
andrewm@0
|
215
|
andrewm@0
|
216 if (comboBoxThatHasChanged == typeComboBox)
|
andrewm@0
|
217 {
|
andrewm@0
|
218 //[UserComboBoxCode_typeComboBox] -- add your combo box handling code here..
|
andrewm@0
|
219 ourProcessor->SetType((DistortionAudioProcessor::Types) typeComboBox->getSelectedItemIndex());
|
andrewm@0
|
220 //[/UserComboBoxCode_typeComboBox]
|
andrewm@0
|
221 }
|
andrewm@0
|
222
|
andrewm@0
|
223 //[UsercomboBoxChanged_Post]
|
andrewm@0
|
224 //[/UsercomboBoxChanged_Post]
|
andrewm@0
|
225 }
|
andrewm@0
|
226
|
andrewm@0
|
227
|
andrewm@0
|
228
|
andrewm@0
|
229 //[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
|
andrewm@0
|
230 void DistortionAudioProcessorEditor::SetComboBoxActivity(ComboBox * comboBox, bool active)
|
andrewm@0
|
231 {
|
andrewm@0
|
232 if (active){
|
andrewm@0
|
233 comboBox->setColour(ComboBox::backgroundColourId, Colours::white);
|
andrewm@0
|
234 }else{
|
andrewm@0
|
235 comboBox->setColour(ComboBox::backgroundColourId, Colours::grey);
|
andrewm@0
|
236 }
|
andrewm@0
|
237 }
|
andrewm@0
|
238
|
andrewm@0
|
239 void DistortionAudioProcessorEditor::SetSliderActivity(Slider * slider, bool active)
|
andrewm@0
|
240 {
|
andrewm@0
|
241 if (active){
|
andrewm@0
|
242 slider->setColour (Slider::rotarySliderFillColourId, Colour (0xffff5c00));
|
andrewm@0
|
243 slider->addListener (this);
|
andrewm@0
|
244 }else{
|
andrewm@0
|
245 slider->setColour (Slider::rotarySliderFillColourId, Colours::grey);
|
andrewm@0
|
246 slider->removeListener(this);
|
andrewm@0
|
247 }
|
andrewm@0
|
248 }
|
andrewm@0
|
249
|
andrewm@0
|
250 void DistortionAudioProcessorEditor::UpdateInterfaceValues()
|
andrewm@0
|
251 {
|
andrewm@0
|
252 DistortionAudioProcessor* ourProcessor = getProcessor();
|
andrewm@0
|
253
|
andrewm@0
|
254 // Update Sliders
|
andrewm@0
|
255 gainSlider ->setValue(ourProcessor->_gainIndB,dontSendNotification);
|
andrewm@0
|
256 typeComboBox->setItemEnabled((int) ourProcessor->GetType(), true);
|
andrewm@0
|
257 }
|
andrewm@0
|
258
|
andrewm@0
|
259 // This timer periodically checks whether any of the parameters have changed...
|
andrewm@0
|
260 void DistortionAudioProcessorEditor::timerCallback()
|
andrewm@0
|
261 {
|
andrewm@0
|
262 //DistortionAudioProcessor* ourProcessor = getProcessor();
|
andrewm@0
|
263
|
andrewm@0
|
264
|
andrewm@0
|
265 }
|
andrewm@0
|
266
|
andrewm@0
|
267 //[/MiscUserCode]
|
andrewm@0
|
268
|
andrewm@0
|
269
|
andrewm@0
|
270 //==============================================================================
|
andrewm@0
|
271 #if 0
|
andrewm@0
|
272 /* -- Introjucer information section --
|
andrewm@0
|
273
|
andrewm@0
|
274 This is where the Introjucer stores the metadata that describe this GUI layout, so
|
andrewm@0
|
275 make changes in here at your peril!
|
andrewm@0
|
276
|
andrewm@0
|
277 BEGIN_JUCER_METADATA
|
andrewm@0
|
278
|
andrewm@0
|
279 <JUCER_COMPONENT documentType="Component" className="DistortionAudioProcessorEditor"
|
andrewm@0
|
280 componentName="" parentClasses="public AudioProcessorEditor, public Timer"
|
andrewm@0
|
281 constructorParams="DistortionAudioProcessor* ownerFilter" variableInitialisers="AudioProcessorEditor (ownerFilter)"
|
andrewm@0
|
282 snapPixels="8" snapActive="0" snapShown="1" overlayOpacity="0.330"
|
andrewm@0
|
283 fixedSize="1" initialWidth="280" initialHeight="320">
|
andrewm@0
|
284 <BACKGROUND backgroundColour="ff880909">
|
andrewm@0
|
285 <ELLIPSE pos="96 158 88 88" fill="solid: ffff0000" hasStroke="0"/>
|
andrewm@0
|
286 <ELLIPSE pos="112 174 56 56" fill="solid: ff2c333b" hasStroke="0"/>
|
andrewm@0
|
287 <ROUNDRECT pos="54 6 175 37" cornerSize="10" fill="solid: ff650000" hasStroke="0"/>
|
andrewm@0
|
288 <TEXT pos="6 13 277 24" fill="solid: ffffffff" hasStroke="0" text="distortion"
|
andrewm@0
|
289 fontname="Default monospaced font" fontsize="22.300000000000000711"
|
andrewm@0
|
290 bold="1" italic="0" justification="12"/>
|
andrewm@0
|
291 <TEXT pos="3 133 275 30" fill="solid: ffffffff" hasStroke="0" text="GAIN"
|
andrewm@0
|
292 fontname="Default monospaced font" fontsize="15" bold="0" italic="0"
|
andrewm@0
|
293 justification="36"/>
|
andrewm@0
|
294 </BACKGROUND>
|
andrewm@0
|
295 <TEXTBUTTON name="on off button" id="85bb206557e8f33d" memberName="resetButton"
|
andrewm@0
|
296 virtualName="" explicitFocusOrder="0" pos="236 5 39 23" bgColOff="ffad8585"
|
andrewm@0
|
297 bgColOn="ffff0000" buttonText="RESET" connectedEdges="0" needsCallback="1"
|
andrewm@0
|
298 radioGroupId="0"/>
|
andrewm@0
|
299 <SLIDER name="new slider" id="b7cd5ae6d0a3bfc6" memberName="gainSlider"
|
andrewm@0
|
300 virtualName="" explicitFocusOrder="0" pos="58 162 164 102" rotarysliderfill="7fffffff"
|
andrewm@0
|
301 textboxtext="ffffffff" textboxbkgd="ffffff" textboxoutline="808080"
|
andrewm@0
|
302 min="-24" max="24" int="0.010000000000000000208" style="RotaryHorizontalVerticalDrag"
|
andrewm@0
|
303 textBoxPos="TextBoxBelow" textBoxEditable="1" textBoxWidth="40"
|
andrewm@0
|
304 textBoxHeight="20" skewFactor="1"/>
|
andrewm@0
|
305 <COMBOBOX name="new combo box" id="c80cc28cc68984e4" memberName="typeComboBox"
|
andrewm@0
|
306 virtualName="" explicitFocusOrder="0" pos="69 77 150 24" editable="0"
|
andrewm@0
|
307 layout="33" items="Hard clipping Soft clipping (poly) Soft clipping (exp) Full-wave rectifier Half-wave rectifier"
|
andrewm@0
|
308 textWhenNonSelected="" textWhenNoItems="(no choices)"/>
|
andrewm@0
|
309 </JUCER_COMPONENT>
|
andrewm@0
|
310
|
andrewm@0
|
311 END_JUCER_METADATA
|
andrewm@0
|
312 */
|
andrewm@0
|
313 #endif
|
andrewm@0
|
314
|
andrewm@0
|
315
|
andrewm@0
|
316 //[EndFile] You can add extra defines here...
|
andrewm@0
|
317 //[/EndFile]
|