Mercurial > hg > touchkeys
comparison Source/Mappings/Control/TouchkeyControlMappingExtendedEditor.cpp @ 41:85577160a0d4
Many changes: implement global application preferences on devices etc.; extended editor window support with Control mapping features for now
author | Andrew McPherson <andrewm@eecs.qmul.ac.uk> |
---|---|
date | Sat, 21 Jun 2014 23:32:33 +0100 |
parents | |
children | 518027b4a3eb |
comparison
equal
deleted
inserted
replaced
40:50e4859d9769 | 41:85577160a0d4 |
---|---|
1 /* | |
2 ============================================================================== | |
3 | |
4 This is an automatically generated GUI class created by the Introjucer! | |
5 | |
6 Be careful when adding custom code to these files, as only the code within | |
7 the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded | |
8 and re-saved. | |
9 | |
10 Created with Introjucer version: 3.1.0 | |
11 | |
12 ------------------------------------------------------------------------------ | |
13 | |
14 The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" | |
15 Copyright 2004-13 by Raw Material Software Ltd. | |
16 | |
17 ============================================================================== | |
18 */ | |
19 | |
20 //[Headers] You can add your own extra header files here... | |
21 //[/Headers] | |
22 | |
23 #include "TouchkeyControlMappingExtendedEditor.h" | |
24 | |
25 | |
26 //[MiscUserDefs] You can add your own user definitions and misc code here... | |
27 //[/MiscUserDefs] | |
28 | |
29 //============================================================================== | |
30 TouchkeyControlMappingExtendedEditor::TouchkeyControlMappingExtendedEditor (TouchkeyControlMappingFactory& factory) | |
31 : factory_(factory) | |
32 { | |
33 addAndMakeVisible (inputRangeLowEditor = new TextEditor ("range low text editor")); | |
34 inputRangeLowEditor->setMultiLine (false); | |
35 inputRangeLowEditor->setReturnKeyStartsNewLine (false); | |
36 inputRangeLowEditor->setReadOnly (false); | |
37 inputRangeLowEditor->setScrollbarsShown (true); | |
38 inputRangeLowEditor->setCaretVisible (true); | |
39 inputRangeLowEditor->setPopupMenuEnabled (true); | |
40 inputRangeLowEditor->setText (String::empty); | |
41 | |
42 addAndMakeVisible (rangeLabel = new Label ("range label", | |
43 "Input Range:")); | |
44 rangeLabel->setFont (Font (15.00f, Font::plain)); | |
45 rangeLabel->setJustificationType (Justification::centredLeft); | |
46 rangeLabel->setEditable (false, false, false); | |
47 rangeLabel->setColour (TextEditor::textColourId, Colours::black); | |
48 rangeLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); | |
49 | |
50 addAndMakeVisible (controlLabel = new Label ("control label", | |
51 "To Control:")); | |
52 controlLabel->setFont (Font (15.00f, Font::plain)); | |
53 controlLabel->setJustificationType (Justification::centredRight); | |
54 controlLabel->setEditable (false, false, false); | |
55 controlLabel->setColour (TextEditor::textColourId, Colours::black); | |
56 controlLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); | |
57 | |
58 addAndMakeVisible (controlComboBox = new ComboBox ("control combo box")); | |
59 controlComboBox->setEditableText (false); | |
60 controlComboBox->setJustificationType (Justification::centredLeft); | |
61 controlComboBox->setTextWhenNothingSelected (String::empty); | |
62 controlComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); | |
63 controlComboBox->addListener (this); | |
64 | |
65 addAndMakeVisible (controlLabel2 = new Label ("control label", | |
66 "Parameter:")); | |
67 controlLabel2->setFont (Font (15.00f, Font::plain)); | |
68 controlLabel2->setJustificationType (Justification::centredLeft); | |
69 controlLabel2->setEditable (false, false, false); | |
70 controlLabel2->setColour (TextEditor::textColourId, Colours::black); | |
71 controlLabel2->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); | |
72 | |
73 addAndMakeVisible (parameterComboBox = new ComboBox ("parameter combo box")); | |
74 parameterComboBox->setEditableText (false); | |
75 parameterComboBox->setJustificationType (Justification::centredLeft); | |
76 parameterComboBox->setTextWhenNothingSelected (String::empty); | |
77 parameterComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); | |
78 parameterComboBox->addListener (this); | |
79 | |
80 addAndMakeVisible (controlLabel3 = new Label ("control label", | |
81 "Type:")); | |
82 controlLabel3->setFont (Font (15.00f, Font::plain)); | |
83 controlLabel3->setJustificationType (Justification::centredRight); | |
84 controlLabel3->setEditable (false, false, false); | |
85 controlLabel3->setColour (TextEditor::textColourId, Colours::black); | |
86 controlLabel3->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); | |
87 | |
88 addAndMakeVisible (typeComboBox = new ComboBox ("type combo box")); | |
89 typeComboBox->setEditableText (false); | |
90 typeComboBox->setJustificationType (Justification::centredLeft); | |
91 typeComboBox->setTextWhenNothingSelected (String::empty); | |
92 typeComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); | |
93 typeComboBox->addListener (this); | |
94 | |
95 addAndMakeVisible (inputRangeHighEditor = new TextEditor ("range hi text editor")); | |
96 inputRangeHighEditor->setMultiLine (false); | |
97 inputRangeHighEditor->setReturnKeyStartsNewLine (false); | |
98 inputRangeHighEditor->setReadOnly (false); | |
99 inputRangeHighEditor->setScrollbarsShown (true); | |
100 inputRangeHighEditor->setCaretVisible (true); | |
101 inputRangeHighEditor->setPopupMenuEnabled (true); | |
102 inputRangeHighEditor->setText (String::empty); | |
103 | |
104 addAndMakeVisible (rangeLabel2 = new Label ("range label", | |
105 "-")); | |
106 rangeLabel2->setFont (Font (15.00f, Font::plain)); | |
107 rangeLabel2->setJustificationType (Justification::centredLeft); | |
108 rangeLabel2->setEditable (false, false, false); | |
109 rangeLabel2->setColour (TextEditor::textColourId, Colours::black); | |
110 rangeLabel2->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); | |
111 | |
112 addAndMakeVisible (rangeLabel3 = new Label ("range label", | |
113 "Output Range:")); | |
114 rangeLabel3->setFont (Font (15.00f, Font::plain)); | |
115 rangeLabel3->setJustificationType (Justification::centredLeft); | |
116 rangeLabel3->setEditable (false, false, false); | |
117 rangeLabel3->setColour (TextEditor::textColourId, Colours::black); | |
118 rangeLabel3->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); | |
119 | |
120 addAndMakeVisible (outputRangeLowEditor = new TextEditor ("output range low text editor")); | |
121 outputRangeLowEditor->setMultiLine (false); | |
122 outputRangeLowEditor->setReturnKeyStartsNewLine (false); | |
123 outputRangeLowEditor->setReadOnly (false); | |
124 outputRangeLowEditor->setScrollbarsShown (true); | |
125 outputRangeLowEditor->setCaretVisible (true); | |
126 outputRangeLowEditor->setPopupMenuEnabled (true); | |
127 outputRangeLowEditor->setText (String::empty); | |
128 | |
129 addAndMakeVisible (outputRangeHighEditor = new TextEditor ("output range hi text editor")); | |
130 outputRangeHighEditor->setMultiLine (false); | |
131 outputRangeHighEditor->setReturnKeyStartsNewLine (false); | |
132 outputRangeHighEditor->setReadOnly (false); | |
133 outputRangeHighEditor->setScrollbarsShown (true); | |
134 outputRangeHighEditor->setCaretVisible (true); | |
135 outputRangeHighEditor->setPopupMenuEnabled (true); | |
136 outputRangeHighEditor->setText (String::empty); | |
137 | |
138 addAndMakeVisible (rangeLabel4 = new Label ("range label", | |
139 "-")); | |
140 rangeLabel4->setFont (Font (15.00f, Font::plain)); | |
141 rangeLabel4->setJustificationType (Justification::centredLeft); | |
142 rangeLabel4->setEditable (false, false, false); | |
143 rangeLabel4->setColour (TextEditor::textColourId, Colours::black); | |
144 rangeLabel4->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); | |
145 | |
146 addAndMakeVisible (controlLabel4 = new Label ("control label", | |
147 "Direction:")); | |
148 controlLabel4->setFont (Font (15.00f, Font::plain)); | |
149 controlLabel4->setJustificationType (Justification::centredRight); | |
150 controlLabel4->setEditable (false, false, false); | |
151 controlLabel4->setColour (TextEditor::textColourId, Colours::black); | |
152 controlLabel4->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); | |
153 | |
154 addAndMakeVisible (directionComboBox = new ComboBox ("direction combo box")); | |
155 directionComboBox->setEditableText (false); | |
156 directionComboBox->setJustificationType (Justification::centredLeft); | |
157 directionComboBox->setTextWhenNothingSelected (String::empty); | |
158 directionComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); | |
159 directionComboBox->addListener (this); | |
160 | |
161 addAndMakeVisible (titleLabel = new Label ("title label", | |
162 "Control Mapping (Zone N, #M)")); | |
163 titleLabel->setFont (Font (15.00f, Font::bold)); | |
164 titleLabel->setJustificationType (Justification::centredLeft); | |
165 titleLabel->setEditable (false, false, false); | |
166 titleLabel->setColour (TextEditor::textColourId, Colours::black); | |
167 titleLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); | |
168 | |
169 addAndMakeVisible (rangeLabel5 = new Label ("range label", | |
170 "Threshold:")); | |
171 rangeLabel5->setFont (Font (15.00f, Font::plain)); | |
172 rangeLabel5->setJustificationType (Justification::centredLeft); | |
173 rangeLabel5->setEditable (false, false, false); | |
174 rangeLabel5->setColour (TextEditor::textColourId, Colours::black); | |
175 rangeLabel5->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); | |
176 | |
177 addAndMakeVisible (thresholdEditor = new TextEditor ("threshold text editor")); | |
178 thresholdEditor->setMultiLine (false); | |
179 thresholdEditor->setReturnKeyStartsNewLine (false); | |
180 thresholdEditor->setReadOnly (false); | |
181 thresholdEditor->setScrollbarsShown (true); | |
182 thresholdEditor->setCaretVisible (true); | |
183 thresholdEditor->setPopupMenuEnabled (true); | |
184 thresholdEditor->setText (String::empty); | |
185 | |
186 addAndMakeVisible (cc14BitButton = new ToggleButton ("new toggle button")); | |
187 cc14BitButton->setButtonText ("Use 14-bit CC"); | |
188 cc14BitButton->addListener (this); | |
189 | |
190 addAndMakeVisible (ignore2FingersButton = new ToggleButton ("ignore 2 fingers toggle button")); | |
191 ignore2FingersButton->setButtonText ("Ignore 2 Fingers"); | |
192 ignore2FingersButton->addListener (this); | |
193 | |
194 addAndMakeVisible (ignore3FingersButton = new ToggleButton ("ignore 3 fingers toggle button")); | |
195 ignore3FingersButton->setButtonText ("Ignore 3 Fingers"); | |
196 ignore3FingersButton->addListener (this); | |
197 | |
198 addAndMakeVisible (controlLabel6 = new Label ("control label", | |
199 "Out of Range:")); | |
200 controlLabel6->setFont (Font (15.00f, Font::plain)); | |
201 controlLabel6->setJustificationType (Justification::centredRight); | |
202 controlLabel6->setEditable (false, false, false); | |
203 controlLabel6->setColour (TextEditor::textColourId, Colours::black); | |
204 controlLabel6->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); | |
205 | |
206 addAndMakeVisible (outOfRangeComboBox = new ComboBox ("out of range combo box")); | |
207 outOfRangeComboBox->setEditableText (false); | |
208 outOfRangeComboBox->setJustificationType (Justification::centredLeft); | |
209 outOfRangeComboBox->setTextWhenNothingSelected (String::empty); | |
210 outOfRangeComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); | |
211 outOfRangeComboBox->addListener (this); | |
212 | |
213 addAndMakeVisible (rangeLabel6 = new Label ("range label", | |
214 "Default Output:")); | |
215 rangeLabel6->setFont (Font (15.00f, Font::plain)); | |
216 rangeLabel6->setJustificationType (Justification::centredLeft); | |
217 rangeLabel6->setEditable (false, false, false); | |
218 rangeLabel6->setColour (TextEditor::textColourId, Colours::black); | |
219 rangeLabel6->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); | |
220 | |
221 addAndMakeVisible (outputDefaultEditor = new TextEditor ("output default text editor")); | |
222 outputDefaultEditor->setMultiLine (false); | |
223 outputDefaultEditor->setReturnKeyStartsNewLine (false); | |
224 outputDefaultEditor->setReadOnly (false); | |
225 outputDefaultEditor->setScrollbarsShown (true); | |
226 outputDefaultEditor->setCaretVisible (true); | |
227 outputDefaultEditor->setPopupMenuEnabled (true); | |
228 outputDefaultEditor->setText (String::empty); | |
229 | |
230 | |
231 //[UserPreSize] | |
232 parameterComboBox->addItem("X Position", TouchkeyControlMapping::kInputParameterXPosition); | |
233 parameterComboBox->addItem("Y Position", TouchkeyControlMapping::kInputParameterYPosition); | |
234 parameterComboBox->addItem("Contact Area", TouchkeyControlMapping::kInputParameterTouchSize); | |
235 parameterComboBox->addItem("2-Finger Mean", TouchkeyControlMapping::kInputParameter2FingerMean); | |
236 parameterComboBox->addItem("2-Finger Distance", TouchkeyControlMapping::kInputParameter2FingerDistance); | |
237 | |
238 typeComboBox->addItem("Absolute", TouchkeyControlMapping::kTypeAbsolute); | |
239 typeComboBox->addItem("1st Touch Relative", TouchkeyControlMapping::kTypeFirstTouchRelative); | |
240 typeComboBox->addItem("Note Onset Relative", TouchkeyControlMapping::kTypeNoteOnsetRelative); | |
241 | |
242 controlComboBox->addItem("Pitch Wheel", MidiKeyboardSegment::kControlPitchWheel); | |
243 controlComboBox->addItem("Channel Pressure", MidiKeyboardSegment::kControlChannelAftertouch); | |
244 controlComboBox->addItem("Poly Aftertouch", MidiKeyboardSegment::kControlPolyphonicAftertouch); | |
245 for(int i = 1; i <= 119; i++) { | |
246 controlComboBox->addItem(String(i), i); | |
247 } | |
248 | |
249 directionComboBox->addItem("Normal", TouchkeyControlMapping::kDirectionPositive); | |
250 directionComboBox->addItem("Reverse", TouchkeyControlMapping::kDirectionNegative); | |
251 directionComboBox->addItem("Always Positive", TouchkeyControlMapping::kDirectionBoth); | |
252 | |
253 outOfRangeComboBox->addItem("Ignore", OscMidiConverter::kOutOfRangeIgnore); | |
254 outOfRangeComboBox->addItem("Clip", OscMidiConverter::kOutOfRangeClip); | |
255 outOfRangeComboBox->addItem("Extrapolate", OscMidiConverter::kOutOfRangeExtrapolate); | |
256 //[/UserPreSize] | |
257 | |
258 setSize (448, 248); | |
259 | |
260 | |
261 //[Constructor] You can add your own custom stuff here.. | |
262 inputRangeLowEditor->addListener(this); | |
263 inputRangeHighEditor->addListener(this); | |
264 outputRangeLowEditor->addListener(this); | |
265 outputRangeHighEditor->addListener(this); | |
266 outputDefaultEditor->addListener(this); | |
267 thresholdEditor->addListener(this); | |
268 //[/Constructor] | |
269 } | |
270 | |
271 TouchkeyControlMappingExtendedEditor::~TouchkeyControlMappingExtendedEditor() | |
272 { | |
273 //[Destructor_pre]. You can add your own custom destruction code here.. | |
274 //[/Destructor_pre] | |
275 | |
276 inputRangeLowEditor = nullptr; | |
277 rangeLabel = nullptr; | |
278 controlLabel = nullptr; | |
279 controlComboBox = nullptr; | |
280 controlLabel2 = nullptr; | |
281 parameterComboBox = nullptr; | |
282 controlLabel3 = nullptr; | |
283 typeComboBox = nullptr; | |
284 inputRangeHighEditor = nullptr; | |
285 rangeLabel2 = nullptr; | |
286 rangeLabel3 = nullptr; | |
287 outputRangeLowEditor = nullptr; | |
288 outputRangeHighEditor = nullptr; | |
289 rangeLabel4 = nullptr; | |
290 controlLabel4 = nullptr; | |
291 directionComboBox = nullptr; | |
292 titleLabel = nullptr; | |
293 rangeLabel5 = nullptr; | |
294 thresholdEditor = nullptr; | |
295 cc14BitButton = nullptr; | |
296 ignore2FingersButton = nullptr; | |
297 ignore3FingersButton = nullptr; | |
298 controlLabel6 = nullptr; | |
299 outOfRangeComboBox = nullptr; | |
300 rangeLabel6 = nullptr; | |
301 outputDefaultEditor = nullptr; | |
302 | |
303 | |
304 //[Destructor]. You can add your own custom destruction code here.. | |
305 //[/Destructor] | |
306 } | |
307 | |
308 //============================================================================== | |
309 void TouchkeyControlMappingExtendedEditor::paint (Graphics& g) | |
310 { | |
311 //[UserPrePaint] Add your own custom painting code here.. | |
312 //[/UserPrePaint] | |
313 | |
314 g.fillAll (Colour (0xffd2d2d2)); | |
315 | |
316 //[UserPaint] Add your own custom painting code here.. | |
317 //[/UserPaint] | |
318 } | |
319 | |
320 void TouchkeyControlMappingExtendedEditor::resized() | |
321 { | |
322 inputRangeLowEditor->setBounds (112, 72, 56, 24); | |
323 rangeLabel->setBounds (8, 72, 104, 24); | |
324 controlLabel->setBounds (256, 40, 64, 24); | |
325 controlComboBox->setBounds (320, 40, 112, 24); | |
326 controlLabel2->setBounds (8, 40, 72, 24); | |
327 parameterComboBox->setBounds (80, 40, 160, 24); | |
328 controlLabel3->setBounds (264, 104, 56, 24); | |
329 typeComboBox->setBounds (320, 104, 112, 24); | |
330 inputRangeHighEditor->setBounds (184, 72, 56, 24); | |
331 rangeLabel2->setBounds (168, 72, 16, 24); | |
332 rangeLabel3->setBounds (8, 104, 96, 24); | |
333 outputRangeLowEditor->setBounds (112, 104, 56, 24); | |
334 outputRangeHighEditor->setBounds (184, 104, 56, 24); | |
335 rangeLabel4->setBounds (168, 104, 16, 24); | |
336 controlLabel4->setBounds (248, 136, 72, 24); | |
337 directionComboBox->setBounds (320, 136, 112, 24); | |
338 titleLabel->setBounds (8, 8, 424, 24); | |
339 rangeLabel5->setBounds (8, 168, 72, 24); | |
340 thresholdEditor->setBounds (112, 168, 56, 24); | |
341 cc14BitButton->setBounds (320, 72, 112, 24); | |
342 ignore2FingersButton->setBounds (8, 192, 128, 24); | |
343 ignore3FingersButton->setBounds (8, 216, 128, 24); | |
344 controlLabel6->setBounds (216, 168, 104, 24); | |
345 outOfRangeComboBox->setBounds (320, 168, 112, 24); | |
346 rangeLabel6->setBounds (8, 136, 96, 24); | |
347 outputDefaultEditor->setBounds (112, 136, 56, 24); | |
348 //[UserResized] Add your own custom resize handling here.. | |
349 //[/UserResized] | |
350 } | |
351 | |
352 void TouchkeyControlMappingExtendedEditor::comboBoxChanged (ComboBox* comboBoxThatHasChanged) | |
353 { | |
354 //[UsercomboBoxChanged_Pre] | |
355 //[/UsercomboBoxChanged_Pre] | |
356 | |
357 if (comboBoxThatHasChanged == controlComboBox) | |
358 { | |
359 //[UserComboBoxCode_controlComboBox] -- add your combo box handling code here.. | |
360 int controller = controlComboBox->getSelectedId(); | |
361 factory_.setController(controller); | |
362 //[/UserComboBoxCode_controlComboBox] | |
363 } | |
364 else if (comboBoxThatHasChanged == parameterComboBox) | |
365 { | |
366 //[UserComboBoxCode_parameterComboBox] -- add your combo box handling code here.. | |
367 int param = parameterComboBox->getSelectedId(); | |
368 factory_.setInputParameter(param); | |
369 //[/UserComboBoxCode_parameterComboBox] | |
370 } | |
371 else if (comboBoxThatHasChanged == typeComboBox) | |
372 { | |
373 //[UserComboBoxCode_typeComboBox] -- add your combo box handling code here.. | |
374 int type = typeComboBox->getSelectedId(); | |
375 factory_.setInputType(type); | |
376 //[/UserComboBoxCode_typeComboBox] | |
377 } | |
378 else if (comboBoxThatHasChanged == directionComboBox) | |
379 { | |
380 //[UserComboBoxCode_directionComboBox] -- add your combo box handling code here.. | |
381 int direction = directionComboBox->getSelectedId(); | |
382 factory_.setDirection(direction); | |
383 //[/UserComboBoxCode_directionComboBox] | |
384 } | |
385 else if (comboBoxThatHasChanged == outOfRangeComboBox) | |
386 { | |
387 //[UserComboBoxCode_outOfRangeComboBox] -- add your combo box handling code here.. | |
388 int behavior = outOfRangeComboBox->getSelectedId(); | |
389 factory_.setOutOfRangeBehavior(behavior); | |
390 //[/UserComboBoxCode_outOfRangeComboBox] | |
391 } | |
392 | |
393 //[UsercomboBoxChanged_Post] | |
394 //[/UsercomboBoxChanged_Post] | |
395 } | |
396 | |
397 void TouchkeyControlMappingExtendedEditor::buttonClicked (Button* buttonThatWasClicked) | |
398 { | |
399 //[UserbuttonClicked_Pre] | |
400 //[/UserbuttonClicked_Pre] | |
401 | |
402 if (buttonThatWasClicked == cc14BitButton) | |
403 { | |
404 //[UserButtonCode_cc14BitButton] -- add your button handler code here.. | |
405 factory_.setUses14BitControl(cc14BitButton->getToggleState()); | |
406 //[/UserButtonCode_cc14BitButton] | |
407 } | |
408 else if (buttonThatWasClicked == ignore2FingersButton) | |
409 { | |
410 //[UserButtonCode_ignore2FingersButton] -- add your button handler code here.. | |
411 factory_.setIgnoresTwoFingers(ignore2FingersButton->getToggleState()); | |
412 //[/UserButtonCode_ignore2FingersButton] | |
413 } | |
414 else if (buttonThatWasClicked == ignore3FingersButton) | |
415 { | |
416 //[UserButtonCode_ignore3FingersButton] -- add your button handler code here.. | |
417 factory_.setIgnoresThreeFingers(ignore3FingersButton->getToggleState()); | |
418 //[/UserButtonCode_ignore3FingersButton] | |
419 } | |
420 | |
421 //[UserbuttonClicked_Post] | |
422 //[/UserbuttonClicked_Post] | |
423 } | |
424 | |
425 | |
426 | |
427 //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... | |
428 | |
429 void TouchkeyControlMappingExtendedEditor::textEditorReturnKeyPressed(TextEditor &editor) | |
430 { | |
431 if(&editor == inputRangeLowEditor) { | |
432 float range = atof(inputRangeLowEditor->getText().toUTF8()); | |
433 factory_.setRangeInputMin(range); | |
434 factory_.setRangeInputCenter(range); | |
435 } | |
436 else if(&editor == inputRangeHighEditor) { | |
437 float range = atof(inputRangeHighEditor->getText().toUTF8()); | |
438 factory_.setRangeInputMax(range); | |
439 } | |
440 else if(&editor == outputRangeLowEditor) { | |
441 float range = atof(outputRangeLowEditor->getText().toUTF8()); | |
442 factory_.setRangeOutputMin(range); | |
443 } | |
444 else if(&editor == outputRangeHighEditor) { | |
445 float range = atof(outputRangeHighEditor->getText().toUTF8()); | |
446 factory_.setRangeOutputMax(range); | |
447 } | |
448 else if(&editor == outputDefaultEditor) { | |
449 float range = atof(outputDefaultEditor->getText().toUTF8()); | |
450 factory_.setRangeOutputDefault(range); | |
451 } | |
452 else if(&editor == thresholdEditor) { | |
453 float thresh = atof(thresholdEditor->getText().toUTF8()); | |
454 factory_.setThreshold(thresh); | |
455 } | |
456 } | |
457 | |
458 void TouchkeyControlMappingExtendedEditor::textEditorEscapeKeyPressed(TextEditor &editor) | |
459 { | |
460 | |
461 } | |
462 | |
463 void TouchkeyControlMappingExtendedEditor::textEditorFocusLost(TextEditor &editor) | |
464 { | |
465 textEditorReturnKeyPressed(editor); | |
466 } | |
467 | |
468 void TouchkeyControlMappingExtendedEditor::synchronize() | |
469 { | |
470 // Set the title label | |
471 titleLabel->setText(getDescriptionHelper("Control Mapping"), dontSendNotification); | |
472 | |
473 // Update the editors to reflect the current status | |
474 if(!inputRangeLowEditor->hasKeyboardFocus(true)) { | |
475 float value = factory_.getRangeInputMin(); | |
476 char st[16]; | |
477 #ifdef _MSC_VER | |
478 _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); | |
479 #else | |
480 snprintf(st, 16, "%.2f", value); | |
481 #endif | |
482 inputRangeLowEditor->setText(st); | |
483 } | |
484 | |
485 if(!inputRangeHighEditor->hasKeyboardFocus(true)) { | |
486 float value = factory_.getRangeInputMax(); | |
487 char st[16]; | |
488 #ifdef _MSC_VER | |
489 _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); | |
490 #else | |
491 snprintf(st, 16, "%.2f", value); | |
492 #endif | |
493 | |
494 inputRangeHighEditor->setText(st); | |
495 } | |
496 | |
497 if(!outputRangeLowEditor->hasKeyboardFocus(true)) { | |
498 float value = factory_.getRangeOutputMin(); | |
499 char st[16]; | |
500 #ifdef _MSC_VER | |
501 _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); | |
502 #else | |
503 snprintf(st, 16, "%.2f", value); | |
504 #endif | |
505 | |
506 outputRangeLowEditor->setText(st); | |
507 } | |
508 | |
509 if(!outputRangeHighEditor->hasKeyboardFocus(true)) { | |
510 float value = factory_.getRangeOutputMax(); | |
511 char st[16]; | |
512 #ifdef _MSC_VER | |
513 _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); | |
514 #else | |
515 snprintf(st, 16, "%.2f", value); | |
516 #endif | |
517 | |
518 outputRangeHighEditor->setText(st); | |
519 } | |
520 | |
521 if(!outputDefaultEditor->hasKeyboardFocus(true)) { | |
522 float value = factory_.getRangeOutputDefault(); | |
523 char st[16]; | |
524 #ifdef _MSC_VER | |
525 _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); | |
526 #else | |
527 snprintf(st, 16, "%.2f", value); | |
528 #endif | |
529 | |
530 outputDefaultEditor->setText(st); | |
531 } | |
532 | |
533 if(factory_.getInputType() == TouchkeyControlMapping::kTypeFirstTouchRelative | |
534 || factory_.getInputType() == TouchkeyControlMapping::kTypeNoteOnsetRelative) { | |
535 thresholdEditor->setEnabled(true); | |
536 if(!thresholdEditor->hasKeyboardFocus(true)) { | |
537 float value = factory_.getThreshold(); | |
538 char st[16]; | |
539 #ifdef _MSC_VER | |
540 _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); | |
541 #else | |
542 snprintf(st, 16, "%.2f", value); | |
543 #endif | |
544 | |
545 thresholdEditor->setText(st); | |
546 } | |
547 | |
548 if(typeWasAbsolute_) { | |
549 // Add all three direction items | |
550 directionComboBox->clear(); | |
551 directionComboBox->addItem("Normal", TouchkeyControlMapping::kDirectionPositive); | |
552 directionComboBox->addItem("Reverse", TouchkeyControlMapping::kDirectionNegative); | |
553 directionComboBox->addItem("Always Positive", TouchkeyControlMapping::kDirectionBoth); | |
554 } | |
555 | |
556 typeWasAbsolute_ = false; | |
557 } | |
558 else { | |
559 thresholdEditor->setEnabled(false); | |
560 thresholdEditor->setText("", false); | |
561 | |
562 if(!typeWasAbsolute_) { | |
563 // Add only one direction item | |
564 directionComboBox->clear(); | |
565 directionComboBox->addItem("Normal", TouchkeyControlMapping::kDirectionPositive); | |
566 } | |
567 | |
568 typeWasAbsolute_ = true; | |
569 } | |
570 | |
571 if(factory_.getController() == MidiKeyboardSegment::kControlPitchWheel) { | |
572 cc14BitButton->setEnabled(false); | |
573 cc14BitButton->setToggleState(true, dontSendNotification); | |
574 } | |
575 else if(factory_.getController() == MidiKeyboardSegment::kControlPolyphonicAftertouch || | |
576 factory_.getController() == MidiKeyboardSegment::kControlChannelAftertouch) { | |
577 cc14BitButton->setEnabled(false); | |
578 cc14BitButton->setToggleState(false, dontSendNotification); | |
579 } | |
580 else { | |
581 cc14BitButton->setEnabled(true); | |
582 cc14BitButton->setToggleState(factory_.getUses14BitControl(), dontSendNotification); | |
583 } | |
584 ignore2FingersButton->setToggleState(factory_.getIgnoresTwoFingers(), dontSendNotification); | |
585 ignore3FingersButton->setToggleState(factory_.getIgnoresThreeFingers(), dontSendNotification); | |
586 | |
587 parameterComboBox->setSelectedId(factory_.getInputParameter(), dontSendNotification); | |
588 typeComboBox->setSelectedId(factory_.getInputType(), dontSendNotification); | |
589 controlComboBox->setSelectedId(factory_.getController(), dontSendNotification); | |
590 directionComboBox->setSelectedId(factory_.getDirection(), dontSendNotification); | |
591 outOfRangeComboBox->setSelectedId(factory_.getOutOfRangeBehavior(), dontSendNotification); | |
592 } | |
593 | |
594 // Return a human-readable description of this mapping for the window | |
595 String TouchkeyControlMappingExtendedEditor::getDescription() { | |
596 return getDescriptionHelper("Control"); | |
597 } | |
598 | |
599 // Return a human-readable description of this mapping for the window | |
600 String TouchkeyControlMappingExtendedEditor::getDescriptionHelper(String baseName) { | |
601 String desc = baseName; | |
602 | |
603 desc += " (Zone "; | |
604 | |
605 int zone = factory_.segment().outputPort(); | |
606 desc += zone; | |
607 desc += ", #"; | |
608 | |
609 int mappingNumber = factory_.segment().indexOfMappingFactory(&factory_); | |
610 desc += mappingNumber; | |
611 desc += ")"; | |
612 | |
613 return desc; | |
614 } | |
615 | |
616 //[/MiscUserCode] | |
617 | |
618 | |
619 //============================================================================== | |
620 #if 0 | |
621 /* -- Introjucer information section -- | |
622 | |
623 This is where the Introjucer stores the metadata that describe this GUI layout, so | |
624 make changes in here at your peril! | |
625 | |
626 BEGIN_JUCER_METADATA | |
627 | |
628 <JUCER_COMPONENT documentType="Component" className="TouchkeyControlMappingExtendedEditor" | |
629 componentName="" parentClasses="public MappingEditorComponent, public TextEditor::Listener" | |
630 constructorParams="TouchkeyControlMappingFactory& factory" | |
631 variableInitialisers="factory_(factory)" snapPixels="8" snapActive="1" | |
632 snapShown="1" overlayOpacity="0.330" fixedSize="1" initialWidth="448" | |
633 initialHeight="248"> | |
634 <BACKGROUND backgroundColour="ffd2d2d2"/> | |
635 <TEXTEDITOR name="range low text editor" id="db0f62c03a58af03" memberName="inputRangeLowEditor" | |
636 virtualName="" explicitFocusOrder="0" pos="112 72 56 24" initialText="" | |
637 multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1" | |
638 caret="1" popupmenu="1"/> | |
639 <LABEL name="range label" id="1ca2d422f4c37b7f" memberName="rangeLabel" | |
640 virtualName="" explicitFocusOrder="0" pos="8 72 104 24" edTextCol="ff000000" | |
641 edBkgCol="0" labelText="Input Range:" editableSingleClick="0" | |
642 editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font" | |
643 fontsize="15" bold="0" italic="0" justification="33"/> | |
644 <LABEL name="control label" id="f953b12999632418" memberName="controlLabel" | |
645 virtualName="" explicitFocusOrder="0" pos="256 40 64 24" edTextCol="ff000000" | |
646 edBkgCol="0" labelText="To Control:" editableSingleClick="0" | |
647 editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font" | |
648 fontsize="15" bold="0" italic="0" justification="34"/> | |
649 <COMBOBOX name="control combo box" id="f1c84bb5fd2730fb" memberName="controlComboBox" | |
650 virtualName="" explicitFocusOrder="0" pos="320 40 112 24" editable="0" | |
651 layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/> | |
652 <LABEL name="control label" id="5ef7c1b78fdcf616" memberName="controlLabel2" | |
653 virtualName="" explicitFocusOrder="0" pos="8 40 72 24" edTextCol="ff000000" | |
654 edBkgCol="0" labelText="Parameter:" editableSingleClick="0" editableDoubleClick="0" | |
655 focusDiscardsChanges="0" fontname="Default font" fontsize="15" | |
656 bold="0" italic="0" justification="33"/> | |
657 <COMBOBOX name="parameter combo box" id="f12f6f6e31042be1" memberName="parameterComboBox" | |
658 virtualName="" explicitFocusOrder="0" pos="80 40 160 24" editable="0" | |
659 layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/> | |
660 <LABEL name="control label" id="9ded92e82db31777" memberName="controlLabel3" | |
661 virtualName="" explicitFocusOrder="0" pos="264 104 56 24" edTextCol="ff000000" | |
662 edBkgCol="0" labelText="Type:" editableSingleClick="0" editableDoubleClick="0" | |
663 focusDiscardsChanges="0" fontname="Default font" fontsize="15" | |
664 bold="0" italic="0" justification="34"/> | |
665 <COMBOBOX name="type combo box" id="82d38054016f6c4f" memberName="typeComboBox" | |
666 virtualName="" explicitFocusOrder="0" pos="320 104 112 24" editable="0" | |
667 layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/> | |
668 <TEXTEDITOR name="range hi text editor" id="c34ac3e87db289d1" memberName="inputRangeHighEditor" | |
669 virtualName="" explicitFocusOrder="0" pos="184 72 56 24" initialText="" | |
670 multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1" | |
671 caret="1" popupmenu="1"/> | |
672 <LABEL name="range label" id="19e0ad80306cc4c0" memberName="rangeLabel2" | |
673 virtualName="" explicitFocusOrder="0" pos="168 72 16 24" edTextCol="ff000000" | |
674 edBkgCol="0" labelText="-" editableSingleClick="0" editableDoubleClick="0" | |
675 focusDiscardsChanges="0" fontname="Default font" fontsize="15" | |
676 bold="0" italic="0" justification="33"/> | |
677 <LABEL name="range label" id="24ab2fe34fec697f" memberName="rangeLabel3" | |
678 virtualName="" explicitFocusOrder="0" pos="8 104 96 24" edTextCol="ff000000" | |
679 edBkgCol="0" labelText="Output Range:" editableSingleClick="0" | |
680 editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font" | |
681 fontsize="15" bold="0" italic="0" justification="33"/> | |
682 <TEXTEDITOR name="output range low text editor" id="15865c99a3cac858" memberName="outputRangeLowEditor" | |
683 virtualName="" explicitFocusOrder="0" pos="112 104 56 24" initialText="" | |
684 multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1" | |
685 caret="1" popupmenu="1"/> | |
686 <TEXTEDITOR name="output range hi text editor" id="6f3a73d113c72696" memberName="outputRangeHighEditor" | |
687 virtualName="" explicitFocusOrder="0" pos="184 104 56 24" initialText="" | |
688 multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1" | |
689 caret="1" popupmenu="1"/> | |
690 <LABEL name="range label" id="a86c42d542ee8780" memberName="rangeLabel4" | |
691 virtualName="" explicitFocusOrder="0" pos="168 104 16 24" edTextCol="ff000000" | |
692 edBkgCol="0" labelText="-" editableSingleClick="0" editableDoubleClick="0" | |
693 focusDiscardsChanges="0" fontname="Default font" fontsize="15" | |
694 bold="0" italic="0" justification="33"/> | |
695 <LABEL name="control label" id="ff30dace0846c523" memberName="controlLabel4" | |
696 virtualName="" explicitFocusOrder="0" pos="248 136 72 24" edTextCol="ff000000" | |
697 edBkgCol="0" labelText="Direction:" editableSingleClick="0" editableDoubleClick="0" | |
698 focusDiscardsChanges="0" fontname="Default font" fontsize="15" | |
699 bold="0" italic="0" justification="34"/> | |
700 <COMBOBOX name="direction combo box" id="c46a92a83dfb204b" memberName="directionComboBox" | |
701 virtualName="" explicitFocusOrder="0" pos="320 136 112 24" editable="0" | |
702 layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/> | |
703 <LABEL name="title label" id="2346b62ce034bea2" memberName="titleLabel" | |
704 virtualName="" explicitFocusOrder="0" pos="8 8 424 24" edTextCol="ff000000" | |
705 edBkgCol="0" labelText="Control Mapping (Zone N, #M)" editableSingleClick="0" | |
706 editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font" | |
707 fontsize="15" bold="1" italic="0" justification="33"/> | |
708 <LABEL name="range label" id="41edb21ea9cb0304" memberName="rangeLabel5" | |
709 virtualName="" explicitFocusOrder="0" pos="8 168 72 24" edTextCol="ff000000" | |
710 edBkgCol="0" labelText="Threshold:" editableSingleClick="0" editableDoubleClick="0" | |
711 focusDiscardsChanges="0" fontname="Default font" fontsize="15" | |
712 bold="0" italic="0" justification="33"/> | |
713 <TEXTEDITOR name="threshold text editor" id="48a7ef0bf62a7fe6" memberName="thresholdEditor" | |
714 virtualName="" explicitFocusOrder="0" pos="112 168 56 24" initialText="" | |
715 multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1" | |
716 caret="1" popupmenu="1"/> | |
717 <TOGGLEBUTTON name="new toggle button" id="f75c92be72563883" memberName="cc14BitButton" | |
718 virtualName="" explicitFocusOrder="0" pos="320 72 112 24" buttonText="Use 14-bit CC" | |
719 connectedEdges="0" needsCallback="1" radioGroupId="0" state="0"/> | |
720 <TOGGLEBUTTON name="ignore 2 fingers toggle button" id="ec82d35a4bbc6688" memberName="ignore2FingersButton" | |
721 virtualName="" explicitFocusOrder="0" pos="8 192 128 24" buttonText="Ignore 2 Fingers" | |
722 connectedEdges="0" needsCallback="1" radioGroupId="0" state="0"/> | |
723 <TOGGLEBUTTON name="ignore 3 fingers toggle button" id="9b08149fc48c8b0" memberName="ignore3FingersButton" | |
724 virtualName="" explicitFocusOrder="0" pos="8 216 128 24" buttonText="Ignore 3 Fingers" | |
725 connectedEdges="0" needsCallback="1" radioGroupId="0" state="0"/> | |
726 <LABEL name="control label" id="668b66775f7ab754" memberName="controlLabel6" | |
727 virtualName="" explicitFocusOrder="0" pos="216 168 104 24" edTextCol="ff000000" | |
728 edBkgCol="0" labelText="Out of Range:" editableSingleClick="0" | |
729 editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font" | |
730 fontsize="15" bold="0" italic="0" justification="34"/> | |
731 <COMBOBOX name="out of range combo box" id="6c7a92d782955f43" memberName="outOfRangeComboBox" | |
732 virtualName="" explicitFocusOrder="0" pos="320 168 112 24" editable="0" | |
733 layout="33" items="" textWhenNonSelected="" textWhenNoItems="(no choices)"/> | |
734 <LABEL name="range label" id="6f03f49baf05157b" memberName="rangeLabel6" | |
735 virtualName="" explicitFocusOrder="0" pos="8 136 96 24" edTextCol="ff000000" | |
736 edBkgCol="0" labelText="Default Output:" editableSingleClick="0" | |
737 editableDoubleClick="0" focusDiscardsChanges="0" fontname="Default font" | |
738 fontsize="15" bold="0" italic="0" justification="33"/> | |
739 <TEXTEDITOR name="output default text editor" id="403f9ffcb91633fd" memberName="outputDefaultEditor" | |
740 virtualName="" explicitFocusOrder="0" pos="112 136 56 24" initialText="" | |
741 multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1" | |
742 caret="1" popupmenu="1"/> | |
743 </JUCER_COMPONENT> | |
744 | |
745 END_JUCER_METADATA | |
746 */ | |
747 #endif | |
748 | |
749 | |
750 //[EndFile] You can add extra defines here... | |
751 //[/EndFile] |