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 //[/Headers]
|
andrewm@0
|
22
|
andrewm@0
|
23 #include "TouchkeyPitchBendMappingShortEditor.h"
|
andrewm@0
|
24
|
andrewm@0
|
25
|
andrewm@0
|
26 //[MiscUserDefs] You can add your own user definitions and misc code here...
|
andrewm@0
|
27 //[/MiscUserDefs]
|
andrewm@0
|
28
|
andrewm@0
|
29 //==============================================================================
|
andrewm@0
|
30 TouchkeyPitchBendMappingShortEditor::TouchkeyPitchBendMappingShortEditor (TouchkeyPitchBendMappingFactory& factory)
|
andrewm@0
|
31 : factory_(factory)
|
andrewm@0
|
32 {
|
andrewm@0
|
33 addAndMakeVisible (rangeEditor = new TextEditor ("range text editor"));
|
andrewm@0
|
34 rangeEditor->setMultiLine (false);
|
andrewm@0
|
35 rangeEditor->setReturnKeyStartsNewLine (false);
|
andrewm@0
|
36 rangeEditor->setReadOnly (false);
|
andrewm@0
|
37 rangeEditor->setScrollbarsShown (true);
|
andrewm@0
|
38 rangeEditor->setCaretVisible (true);
|
andrewm@0
|
39 rangeEditor->setPopupMenuEnabled (true);
|
andrewm@0
|
40 rangeEditor->setText (String::empty);
|
andrewm@0
|
41
|
andrewm@0
|
42 addAndMakeVisible (rangeLabel = new Label ("range label",
|
andrewm@0
|
43 "Range:"));
|
andrewm@0
|
44 rangeLabel->setFont (Font (15.00f, Font::plain));
|
andrewm@0
|
45 rangeLabel->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
46 rangeLabel->setEditable (false, false, false);
|
andrewm@0
|
47 rangeLabel->setColour (TextEditor::textColourId, Colours::black);
|
andrewm@0
|
48 rangeLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
andrewm@0
|
49
|
andrewm@0
|
50 addAndMakeVisible (thresholdEditor = new TextEditor ("threshold text editor"));
|
andrewm@0
|
51 thresholdEditor->setMultiLine (false);
|
andrewm@0
|
52 thresholdEditor->setReturnKeyStartsNewLine (false);
|
andrewm@0
|
53 thresholdEditor->setReadOnly (false);
|
andrewm@0
|
54 thresholdEditor->setScrollbarsShown (true);
|
andrewm@0
|
55 thresholdEditor->setCaretVisible (true);
|
andrewm@0
|
56 thresholdEditor->setPopupMenuEnabled (true);
|
andrewm@0
|
57 thresholdEditor->setText (String::empty);
|
andrewm@0
|
58
|
andrewm@0
|
59 addAndMakeVisible (thresholdLabel = new Label ("threshold label",
|
andrewm@0
|
60 "Threshold:"));
|
andrewm@0
|
61 thresholdLabel->setFont (Font (15.00f, Font::plain));
|
andrewm@0
|
62 thresholdLabel->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
63 thresholdLabel->setEditable (false, false, false);
|
andrewm@0
|
64 thresholdLabel->setColour (TextEditor::textColourId, Colours::black);
|
andrewm@0
|
65 thresholdLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
andrewm@0
|
66
|
andrewm@0
|
67 addAndMakeVisible (controlLabel = new Label ("control label",
|
andrewm@0
|
68 "Endpoints:"));
|
andrewm@0
|
69 controlLabel->setFont (Font (15.00f, Font::plain));
|
andrewm@0
|
70 controlLabel->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
71 controlLabel->setEditable (false, false, false);
|
andrewm@0
|
72 controlLabel->setColour (TextEditor::textColourId, Colours::black);
|
andrewm@0
|
73 controlLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
andrewm@0
|
74
|
andrewm@0
|
75 addAndMakeVisible (endpointsComboBox = new ComboBox ("control combo box"));
|
andrewm@0
|
76 endpointsComboBox->setEditableText (false);
|
andrewm@0
|
77 endpointsComboBox->setJustificationType (Justification::centredLeft);
|
andrewm@0
|
78 endpointsComboBox->setTextWhenNothingSelected (String::empty);
|
andrewm@0
|
79 endpointsComboBox->setTextWhenNoChoicesAvailable ("(no choices)");
|
andrewm@0
|
80 endpointsComboBox->addListener (this);
|
andrewm@0
|
81
|
andrewm@0
|
82
|
andrewm@0
|
83 //[UserPreSize]
|
andrewm@0
|
84 endpointsComboBox->addItem("Variable", TouchkeyPitchBendMapping::kPitchBendModeVariableEndpoints);
|
andrewm@0
|
85 endpointsComboBox->addItem("Fixed", TouchkeyPitchBendMapping::kPitchBendModeFixedEndpoints);
|
andrewm@0
|
86 //[/UserPreSize]
|
andrewm@0
|
87
|
andrewm@0
|
88 setSize (328, 71);
|
andrewm@0
|
89
|
andrewm@0
|
90
|
andrewm@0
|
91 //[Constructor] You can add your own custom stuff here..
|
andrewm@0
|
92 rangeEditor->addListener(this);
|
andrewm@0
|
93 thresholdEditor->addListener(this);
|
andrewm@0
|
94 //[/Constructor]
|
andrewm@0
|
95 }
|
andrewm@0
|
96
|
andrewm@0
|
97 TouchkeyPitchBendMappingShortEditor::~TouchkeyPitchBendMappingShortEditor()
|
andrewm@0
|
98 {
|
andrewm@0
|
99 //[Destructor_pre]. You can add your own custom destruction code here..
|
andrewm@0
|
100 //[/Destructor_pre]
|
andrewm@0
|
101
|
andrewm@0
|
102 rangeEditor = nullptr;
|
andrewm@0
|
103 rangeLabel = nullptr;
|
andrewm@0
|
104 thresholdEditor = nullptr;
|
andrewm@0
|
105 thresholdLabel = nullptr;
|
andrewm@0
|
106 controlLabel = nullptr;
|
andrewm@0
|
107 endpointsComboBox = nullptr;
|
andrewm@0
|
108
|
andrewm@0
|
109
|
andrewm@0
|
110 //[Destructor]. You can add your own custom destruction code here..
|
andrewm@0
|
111 //[/Destructor]
|
andrewm@0
|
112 }
|
andrewm@0
|
113
|
andrewm@0
|
114 //==============================================================================
|
andrewm@0
|
115 void TouchkeyPitchBendMappingShortEditor::paint (Graphics& g)
|
andrewm@0
|
116 {
|
andrewm@0
|
117 //[UserPrePaint] Add your own custom painting code here..
|
andrewm@0
|
118 //[/UserPrePaint]
|
andrewm@0
|
119
|
andrewm@0
|
120 g.fillAll (Colours::white);
|
andrewm@0
|
121
|
andrewm@0
|
122 //[UserPaint] Add your own custom painting code here..
|
andrewm@0
|
123 //[/UserPaint]
|
andrewm@0
|
124 }
|
andrewm@0
|
125
|
andrewm@0
|
126 void TouchkeyPitchBendMappingShortEditor::resized()
|
andrewm@0
|
127 {
|
andrewm@0
|
128 rangeEditor->setBounds (80, 8, 80, 24);
|
andrewm@0
|
129 rangeLabel->setBounds (8, 8, 56, 24);
|
andrewm@0
|
130 thresholdEditor->setBounds (240, 8, 80, 24);
|
andrewm@0
|
131 thresholdLabel->setBounds (168, 8, 72, 24);
|
andrewm@0
|
132 controlLabel->setBounds (8, 40, 72, 24);
|
andrewm@0
|
133 endpointsComboBox->setBounds (80, 40, 80, 24);
|
andrewm@0
|
134 //[UserResized] Add your own custom resize handling here..
|
andrewm@0
|
135 //[/UserResized]
|
andrewm@0
|
136 }
|
andrewm@0
|
137
|
andrewm@0
|
138 void TouchkeyPitchBendMappingShortEditor::comboBoxChanged (ComboBox* comboBoxThatHasChanged)
|
andrewm@0
|
139 {
|
andrewm@0
|
140 //[UsercomboBoxChanged_Pre]
|
andrewm@0
|
141 //[/UsercomboBoxChanged_Pre]
|
andrewm@0
|
142
|
andrewm@0
|
143 if (comboBoxThatHasChanged == endpointsComboBox)
|
andrewm@0
|
144 {
|
andrewm@0
|
145 //[UserComboBoxCode_endpointsComboBox] -- add your combo box handling code here..
|
andrewm@0
|
146 int control = endpointsComboBox->getSelectedId();
|
andrewm@0
|
147 if(control == TouchkeyPitchBendMapping::kPitchBendModeVariableEndpoints)
|
andrewm@0
|
148 factory_.setBendVariableEndpoints();
|
andrewm@0
|
149 else if(control == TouchkeyPitchBendMapping::kPitchBendModeFixedEndpoints)
|
andrewm@0
|
150 factory_.setBendFixedEndpoints(factory_.getBendThresholdKeyLength(), 0);
|
andrewm@0
|
151 //[/UserComboBoxCode_endpointsComboBox]
|
andrewm@0
|
152 }
|
andrewm@0
|
153
|
andrewm@0
|
154 //[UsercomboBoxChanged_Post]
|
andrewm@0
|
155 //[/UsercomboBoxChanged_Post]
|
andrewm@0
|
156 }
|
andrewm@0
|
157
|
andrewm@0
|
158
|
andrewm@0
|
159
|
andrewm@0
|
160 //[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
|
andrewm@0
|
161
|
andrewm@0
|
162 void TouchkeyPitchBendMappingShortEditor::textEditorReturnKeyPressed(TextEditor &editor)
|
andrewm@0
|
163 {
|
andrewm@0
|
164 if(&editor == rangeEditor) {
|
andrewm@0
|
165 float range = atof(rangeEditor->getText().toUTF8());
|
andrewm@0
|
166 factory_.setBendRange(range);
|
andrewm@0
|
167 }
|
andrewm@0
|
168 else if(&editor == thresholdEditor) {
|
andrewm@0
|
169 float threshold = atof(thresholdEditor->getText().toUTF8());
|
andrewm@0
|
170 factory_.setBendThresholdKeyLength(threshold);
|
andrewm@0
|
171 }
|
andrewm@0
|
172 }
|
andrewm@0
|
173
|
andrewm@0
|
174 void TouchkeyPitchBendMappingShortEditor::textEditorEscapeKeyPressed(TextEditor &editor)
|
andrewm@0
|
175 {
|
andrewm@0
|
176
|
andrewm@0
|
177 }
|
andrewm@0
|
178
|
andrewm@0
|
179 void TouchkeyPitchBendMappingShortEditor::textEditorFocusLost(TextEditor &editor)
|
andrewm@0
|
180 {
|
andrewm@0
|
181 textEditorReturnKeyPressed(editor);
|
andrewm@0
|
182 }
|
andrewm@0
|
183
|
andrewm@0
|
184 void TouchkeyPitchBendMappingShortEditor::synchronize()
|
andrewm@0
|
185 {
|
andrewm@0
|
186 // Update the editors to reflect the current status
|
andrewm@0
|
187 if(!rangeEditor->hasKeyboardFocus(true)) {
|
andrewm@0
|
188 float value = factory_.getBendRange();
|
andrewm@0
|
189 char st[16];
|
andrewm@20
|
190 #ifdef _MSC_VER
|
andrewm@20
|
191 _snprintf_s(st, 16, _TRUNCATE, "%.2f", value);
|
andrewm@20
|
192 #else
|
andrewm@0
|
193 snprintf(st, 16, "%.2f", value);
|
andrewm@20
|
194 #endif
|
andrewm@0
|
195
|
andrewm@0
|
196 rangeEditor->setText(st);
|
andrewm@0
|
197 }
|
andrewm@0
|
198
|
andrewm@0
|
199 if(!thresholdEditor->hasKeyboardFocus(true)) {
|
andrewm@0
|
200 float value = factory_.getBendThresholdKeyLength();
|
andrewm@0
|
201 char st[16];
|
andrewm@20
|
202 #ifdef _MSC_VER
|
andrewm@20
|
203 _snprintf_s(st, 16, _TRUNCATE, "%.2f", value);
|
andrewm@20
|
204 #else
|
andrewm@0
|
205 snprintf(st, 16, "%.2f", value);
|
andrewm@20
|
206 #endif
|
andrewm@0
|
207
|
andrewm@0
|
208 thresholdEditor->setText(st);
|
andrewm@0
|
209 }
|
andrewm@0
|
210
|
andrewm@0
|
211 endpointsComboBox->setSelectedId(factory_.getBendMode(), dontSendNotification);
|
andrewm@0
|
212 }
|
andrewm@0
|
213 //[/MiscUserCode]
|
andrewm@0
|
214
|
andrewm@0
|
215
|
andrewm@0
|
216 //==============================================================================
|
andrewm@0
|
217 #if 0
|
andrewm@0
|
218 /* -- Introjucer information section --
|
andrewm@0
|
219
|
andrewm@0
|
220 This is where the Introjucer stores the metadata that describe this GUI layout, so
|
andrewm@0
|
221 make changes in here at your peril!
|
andrewm@0
|
222
|
andrewm@0
|
223 BEGIN_JUCER_METADATA
|
andrewm@0
|
224
|
andrewm@0
|
225 <JUCER_COMPONENT documentType="Component" className="TouchkeyPitchBendMappingShortEditor"
|
andrewm@0
|
226 componentName="" parentClasses="public MappingEditorComponent, public TextEditor::Listener"
|
andrewm@0
|
227 constructorParams="TouchkeyPitchBendMappingFactory& factory"
|
andrewm@0
|
228 variableInitialisers="factory_(factory)" snapPixels="8" snapActive="1"
|
andrewm@0
|
229 snapShown="1" overlayOpacity="0.330000013" fixedSize="1" initialWidth="328"
|
andrewm@0
|
230 initialHeight="71">
|
andrewm@0
|
231 <BACKGROUND backgroundColour="ffffffff"/>
|
andrewm@0
|
232 <TEXTEDITOR name="range text editor" id="db0f62c03a58af03" memberName="rangeEditor"
|
andrewm@0
|
233 virtualName="" explicitFocusOrder="0" pos="80 8 80 24" initialText=""
|
andrewm@0
|
234 multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1"
|
andrewm@0
|
235 caret="1" popupmenu="1"/>
|
andrewm@0
|
236 <LABEL name="range label" id="1ca2d422f4c37b7f" memberName="rangeLabel"
|
andrewm@0
|
237 virtualName="" explicitFocusOrder="0" pos="8 8 56 24" edTextCol="ff000000"
|
andrewm@0
|
238 edBkgCol="0" labelText="Range:" editableSingleClick="0" editableDoubleClick="0"
|
andrewm@0
|
239 focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
andrewm@0
|
240 bold="0" italic="0" justification="33"/>
|
andrewm@0
|
241 <TEXTEDITOR name="threshold text editor" id="854a054d84eaf552" memberName="thresholdEditor"
|
andrewm@0
|
242 virtualName="" explicitFocusOrder="0" pos="240 8 80 24" initialText=""
|
andrewm@0
|
243 multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1"
|
andrewm@0
|
244 caret="1" popupmenu="1"/>
|
andrewm@0
|
245 <LABEL name="threshold label" id="864de4f55b5481ee" memberName="thresholdLabel"
|
andrewm@0
|
246 virtualName="" explicitFocusOrder="0" pos="168 8 72 24" edTextCol="ff000000"
|
andrewm@0
|
247 edBkgCol="0" labelText="Threshold:" editableSingleClick="0" editableDoubleClick="0"
|
andrewm@0
|
248 focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
andrewm@0
|
249 bold="0" italic="0" justification="33"/>
|
andrewm@0
|
250 <LABEL name="control label" id="f953b12999632418" memberName="controlLabel"
|
andrewm@0
|
251 virtualName="" explicitFocusOrder="0" pos="8 40 72 24" edTextCol="ff000000"
|
andrewm@0
|
252 edBkgCol="0" labelText="Endpoints:" editableSingleClick="0" editableDoubleClick="0"
|
andrewm@0
|
253 focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
andrewm@0
|
254 bold="0" italic="0" justification="33"/>
|
andrewm@0
|
255 <COMBOBOX name="control combo box" id="f1c84bb5fd2730fb" memberName="endpointsComboBox"
|
andrewm@0
|
256 virtualName="" explicitFocusOrder="0" pos="80 40 80 24" editable="0"
|
andrewm@0
|
257 layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/>
|
andrewm@0
|
258 </JUCER_COMPONENT>
|
andrewm@0
|
259
|
andrewm@0
|
260 END_JUCER_METADATA
|
andrewm@0
|
261 */
|
andrewm@0
|
262 #endif
|
andrewm@0
|
263
|
andrewm@0
|
264
|
andrewm@0
|
265 //[EndFile] You can add extra defines here...
|
andrewm@0
|
266 //[/EndFile]
|