andrewm@41: /* andrewm@41: ============================================================================== andrewm@41: andrewm@41: This is an automatically generated GUI class created by the Introjucer! andrewm@41: andrewm@41: Be careful when adding custom code to these files, as only the code within andrewm@41: the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded andrewm@41: and re-saved. andrewm@41: andrewm@41: Created with Introjucer version: 3.1.0 andrewm@41: andrewm@41: ------------------------------------------------------------------------------ andrewm@41: andrewm@41: The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" andrewm@41: Copyright 2004-13 by Raw Material Software Ltd. andrewm@41: andrewm@41: ============================================================================== andrewm@41: */ andrewm@41: andrewm@41: //[Headers] You can add your own extra header files here... andrewm@50: #ifndef TOUCHKEYS_NO_GUI andrewm@41: //[/Headers] andrewm@41: andrewm@41: #include "TouchkeyControlMappingExtendedEditor.h" andrewm@41: andrewm@41: andrewm@41: //[MiscUserDefs] You can add your own user definitions and misc code here... andrewm@41: //[/MiscUserDefs] andrewm@41: andrewm@41: //============================================================================== andrewm@41: TouchkeyControlMappingExtendedEditor::TouchkeyControlMappingExtendedEditor (TouchkeyControlMappingFactory& factory) andrewm@45: : factory_(factory), typeWasAbsolute_(false) andrewm@41: { andrewm@41: addAndMakeVisible (inputRangeLowEditor = new TextEditor ("range low text editor")); andrewm@41: inputRangeLowEditor->setMultiLine (false); andrewm@41: inputRangeLowEditor->setReturnKeyStartsNewLine (false); andrewm@41: inputRangeLowEditor->setReadOnly (false); andrewm@41: inputRangeLowEditor->setScrollbarsShown (true); andrewm@41: inputRangeLowEditor->setCaretVisible (true); andrewm@41: inputRangeLowEditor->setPopupMenuEnabled (true); andrewm@41: inputRangeLowEditor->setText (String::empty); andrewm@41: andrewm@41: addAndMakeVisible (rangeLabel = new Label ("range label", andrewm@41: "Input Range:")); andrewm@41: rangeLabel->setFont (Font (15.00f, Font::plain)); andrewm@41: rangeLabel->setJustificationType (Justification::centredLeft); andrewm@41: rangeLabel->setEditable (false, false, false); andrewm@41: rangeLabel->setColour (TextEditor::textColourId, Colours::black); andrewm@41: rangeLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@41: andrewm@41: addAndMakeVisible (controlLabel = new Label ("control label", andrewm@41: "To Control:")); andrewm@41: controlLabel->setFont (Font (15.00f, Font::plain)); andrewm@41: controlLabel->setJustificationType (Justification::centredRight); andrewm@41: controlLabel->setEditable (false, false, false); andrewm@41: controlLabel->setColour (TextEditor::textColourId, Colours::black); andrewm@41: controlLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@41: andrewm@41: addAndMakeVisible (controlComboBox = new ComboBox ("control combo box")); andrewm@41: controlComboBox->setEditableText (false); andrewm@41: controlComboBox->setJustificationType (Justification::centredLeft); andrewm@41: controlComboBox->setTextWhenNothingSelected (String::empty); andrewm@41: controlComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); andrewm@41: controlComboBox->addListener (this); andrewm@41: andrewm@41: addAndMakeVisible (controlLabel2 = new Label ("control label", andrewm@41: "Parameter:")); andrewm@41: controlLabel2->setFont (Font (15.00f, Font::plain)); andrewm@41: controlLabel2->setJustificationType (Justification::centredLeft); andrewm@41: controlLabel2->setEditable (false, false, false); andrewm@41: controlLabel2->setColour (TextEditor::textColourId, Colours::black); andrewm@41: controlLabel2->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@41: andrewm@41: addAndMakeVisible (parameterComboBox = new ComboBox ("parameter combo box")); andrewm@41: parameterComboBox->setEditableText (false); andrewm@41: parameterComboBox->setJustificationType (Justification::centredLeft); andrewm@41: parameterComboBox->setTextWhenNothingSelected (String::empty); andrewm@41: parameterComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); andrewm@41: parameterComboBox->addListener (this); andrewm@41: andrewm@41: addAndMakeVisible (controlLabel3 = new Label ("control label", andrewm@41: "Type:")); andrewm@41: controlLabel3->setFont (Font (15.00f, Font::plain)); andrewm@41: controlLabel3->setJustificationType (Justification::centredRight); andrewm@41: controlLabel3->setEditable (false, false, false); andrewm@41: controlLabel3->setColour (TextEditor::textColourId, Colours::black); andrewm@41: controlLabel3->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@41: andrewm@41: addAndMakeVisible (typeComboBox = new ComboBox ("type combo box")); andrewm@41: typeComboBox->setEditableText (false); andrewm@41: typeComboBox->setJustificationType (Justification::centredLeft); andrewm@41: typeComboBox->setTextWhenNothingSelected (String::empty); andrewm@41: typeComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); andrewm@41: typeComboBox->addListener (this); andrewm@41: andrewm@41: addAndMakeVisible (inputRangeHighEditor = new TextEditor ("range hi text editor")); andrewm@41: inputRangeHighEditor->setMultiLine (false); andrewm@41: inputRangeHighEditor->setReturnKeyStartsNewLine (false); andrewm@41: inputRangeHighEditor->setReadOnly (false); andrewm@41: inputRangeHighEditor->setScrollbarsShown (true); andrewm@41: inputRangeHighEditor->setCaretVisible (true); andrewm@41: inputRangeHighEditor->setPopupMenuEnabled (true); andrewm@41: inputRangeHighEditor->setText (String::empty); andrewm@41: andrewm@41: addAndMakeVisible (rangeLabel2 = new Label ("range label", andrewm@41: "-")); andrewm@41: rangeLabel2->setFont (Font (15.00f, Font::plain)); andrewm@41: rangeLabel2->setJustificationType (Justification::centredLeft); andrewm@41: rangeLabel2->setEditable (false, false, false); andrewm@41: rangeLabel2->setColour (TextEditor::textColourId, Colours::black); andrewm@41: rangeLabel2->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@41: andrewm@41: addAndMakeVisible (rangeLabel3 = new Label ("range label", andrewm@41: "Output Range:")); andrewm@41: rangeLabel3->setFont (Font (15.00f, Font::plain)); andrewm@41: rangeLabel3->setJustificationType (Justification::centredLeft); andrewm@41: rangeLabel3->setEditable (false, false, false); andrewm@41: rangeLabel3->setColour (TextEditor::textColourId, Colours::black); andrewm@41: rangeLabel3->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@41: andrewm@41: addAndMakeVisible (outputRangeLowEditor = new TextEditor ("output range low text editor")); andrewm@41: outputRangeLowEditor->setMultiLine (false); andrewm@41: outputRangeLowEditor->setReturnKeyStartsNewLine (false); andrewm@41: outputRangeLowEditor->setReadOnly (false); andrewm@41: outputRangeLowEditor->setScrollbarsShown (true); andrewm@41: outputRangeLowEditor->setCaretVisible (true); andrewm@41: outputRangeLowEditor->setPopupMenuEnabled (true); andrewm@41: outputRangeLowEditor->setText (String::empty); andrewm@41: andrewm@41: addAndMakeVisible (outputRangeHighEditor = new TextEditor ("output range hi text editor")); andrewm@41: outputRangeHighEditor->setMultiLine (false); andrewm@41: outputRangeHighEditor->setReturnKeyStartsNewLine (false); andrewm@41: outputRangeHighEditor->setReadOnly (false); andrewm@41: outputRangeHighEditor->setScrollbarsShown (true); andrewm@41: outputRangeHighEditor->setCaretVisible (true); andrewm@41: outputRangeHighEditor->setPopupMenuEnabled (true); andrewm@41: outputRangeHighEditor->setText (String::empty); andrewm@41: andrewm@41: addAndMakeVisible (rangeLabel4 = new Label ("range label", andrewm@41: "-")); andrewm@41: rangeLabel4->setFont (Font (15.00f, Font::plain)); andrewm@41: rangeLabel4->setJustificationType (Justification::centredLeft); andrewm@41: rangeLabel4->setEditable (false, false, false); andrewm@41: rangeLabel4->setColour (TextEditor::textColourId, Colours::black); andrewm@41: rangeLabel4->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@41: andrewm@41: addAndMakeVisible (controlLabel4 = new Label ("control label", andrewm@41: "Direction:")); andrewm@41: controlLabel4->setFont (Font (15.00f, Font::plain)); andrewm@41: controlLabel4->setJustificationType (Justification::centredRight); andrewm@41: controlLabel4->setEditable (false, false, false); andrewm@41: controlLabel4->setColour (TextEditor::textColourId, Colours::black); andrewm@41: controlLabel4->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@41: andrewm@41: addAndMakeVisible (directionComboBox = new ComboBox ("direction combo box")); andrewm@41: directionComboBox->setEditableText (false); andrewm@41: directionComboBox->setJustificationType (Justification::centredLeft); andrewm@41: directionComboBox->setTextWhenNothingSelected (String::empty); andrewm@41: directionComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); andrewm@41: directionComboBox->addListener (this); andrewm@41: andrewm@41: addAndMakeVisible (titleLabel = new Label ("title label", andrewm@41: "Control Mapping (Zone N, #M)")); andrewm@41: titleLabel->setFont (Font (15.00f, Font::bold)); andrewm@41: titleLabel->setJustificationType (Justification::centredLeft); andrewm@41: titleLabel->setEditable (false, false, false); andrewm@41: titleLabel->setColour (TextEditor::textColourId, Colours::black); andrewm@41: titleLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@41: andrewm@41: addAndMakeVisible (rangeLabel5 = new Label ("range label", andrewm@41: "Threshold:")); andrewm@41: rangeLabel5->setFont (Font (15.00f, Font::plain)); andrewm@41: rangeLabel5->setJustificationType (Justification::centredLeft); andrewm@41: rangeLabel5->setEditable (false, false, false); andrewm@41: rangeLabel5->setColour (TextEditor::textColourId, Colours::black); andrewm@41: rangeLabel5->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@41: andrewm@41: addAndMakeVisible (thresholdEditor = new TextEditor ("threshold text editor")); andrewm@41: thresholdEditor->setMultiLine (false); andrewm@41: thresholdEditor->setReturnKeyStartsNewLine (false); andrewm@41: thresholdEditor->setReadOnly (false); andrewm@41: thresholdEditor->setScrollbarsShown (true); andrewm@41: thresholdEditor->setCaretVisible (true); andrewm@41: thresholdEditor->setPopupMenuEnabled (true); andrewm@41: thresholdEditor->setText (String::empty); andrewm@41: andrewm@41: addAndMakeVisible (cc14BitButton = new ToggleButton ("new toggle button")); andrewm@41: cc14BitButton->setButtonText ("Use 14-bit CC"); andrewm@41: cc14BitButton->addListener (this); andrewm@41: andrewm@41: addAndMakeVisible (ignore2FingersButton = new ToggleButton ("ignore 2 fingers toggle button")); andrewm@41: ignore2FingersButton->setButtonText ("Ignore 2 Fingers"); andrewm@41: ignore2FingersButton->addListener (this); andrewm@41: andrewm@41: addAndMakeVisible (ignore3FingersButton = new ToggleButton ("ignore 3 fingers toggle button")); andrewm@41: ignore3FingersButton->setButtonText ("Ignore 3 Fingers"); andrewm@41: ignore3FingersButton->addListener (this); andrewm@41: andrewm@41: addAndMakeVisible (controlLabel6 = new Label ("control label", andrewm@41: "Out of Range:")); andrewm@41: controlLabel6->setFont (Font (15.00f, Font::plain)); andrewm@41: controlLabel6->setJustificationType (Justification::centredRight); andrewm@41: controlLabel6->setEditable (false, false, false); andrewm@41: controlLabel6->setColour (TextEditor::textColourId, Colours::black); andrewm@41: controlLabel6->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@41: andrewm@41: addAndMakeVisible (outOfRangeComboBox = new ComboBox ("out of range combo box")); andrewm@41: outOfRangeComboBox->setEditableText (false); andrewm@41: outOfRangeComboBox->setJustificationType (Justification::centredLeft); andrewm@41: outOfRangeComboBox->setTextWhenNothingSelected (String::empty); andrewm@41: outOfRangeComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); andrewm@41: outOfRangeComboBox->addListener (this); andrewm@41: andrewm@41: addAndMakeVisible (rangeLabel6 = new Label ("range label", andrewm@41: "Default Output:")); andrewm@41: rangeLabel6->setFont (Font (15.00f, Font::plain)); andrewm@41: rangeLabel6->setJustificationType (Justification::centredLeft); andrewm@41: rangeLabel6->setEditable (false, false, false); andrewm@41: rangeLabel6->setColour (TextEditor::textColourId, Colours::black); andrewm@41: rangeLabel6->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@41: andrewm@41: addAndMakeVisible (outputDefaultEditor = new TextEditor ("output default text editor")); andrewm@41: outputDefaultEditor->setMultiLine (false); andrewm@41: outputDefaultEditor->setReturnKeyStartsNewLine (false); andrewm@41: outputDefaultEditor->setReadOnly (false); andrewm@41: outputDefaultEditor->setScrollbarsShown (true); andrewm@41: outputDefaultEditor->setCaretVisible (true); andrewm@41: outputDefaultEditor->setPopupMenuEnabled (true); andrewm@41: outputDefaultEditor->setText (String::empty); andrewm@41: andrewm@41: andrewm@41: //[UserPreSize] andrewm@41: parameterComboBox->addItem("X Position", TouchkeyControlMapping::kInputParameterXPosition); andrewm@41: parameterComboBox->addItem("Y Position", TouchkeyControlMapping::kInputParameterYPosition); andrewm@41: parameterComboBox->addItem("Contact Area", TouchkeyControlMapping::kInputParameterTouchSize); andrewm@41: parameterComboBox->addItem("2-Finger Mean", TouchkeyControlMapping::kInputParameter2FingerMean); andrewm@41: parameterComboBox->addItem("2-Finger Distance", TouchkeyControlMapping::kInputParameter2FingerDistance); andrewm@41: andrewm@41: typeComboBox->addItem("Absolute", TouchkeyControlMapping::kTypeAbsolute); andrewm@41: typeComboBox->addItem("1st Touch Relative", TouchkeyControlMapping::kTypeFirstTouchRelative); andrewm@41: typeComboBox->addItem("Note Onset Relative", TouchkeyControlMapping::kTypeNoteOnsetRelative); andrewm@41: andrewm@41: controlComboBox->addItem("Pitch Wheel", MidiKeyboardSegment::kControlPitchWheel); andrewm@41: controlComboBox->addItem("Channel Pressure", MidiKeyboardSegment::kControlChannelAftertouch); andrewm@41: controlComboBox->addItem("Poly Aftertouch", MidiKeyboardSegment::kControlPolyphonicAftertouch); andrewm@41: for(int i = 1; i <= 119; i++) { andrewm@41: controlComboBox->addItem(String(i), i); andrewm@41: } andrewm@41: andrewm@41: directionComboBox->addItem("Normal", TouchkeyControlMapping::kDirectionPositive); andrewm@41: directionComboBox->addItem("Reverse", TouchkeyControlMapping::kDirectionNegative); andrewm@41: directionComboBox->addItem("Always Positive", TouchkeyControlMapping::kDirectionBoth); andrewm@41: andrewm@41: outOfRangeComboBox->addItem("Ignore", OscMidiConverter::kOutOfRangeIgnore); andrewm@41: outOfRangeComboBox->addItem("Clip", OscMidiConverter::kOutOfRangeClip); andrewm@41: outOfRangeComboBox->addItem("Extrapolate", OscMidiConverter::kOutOfRangeExtrapolate); andrewm@41: //[/UserPreSize] andrewm@41: andrewm@41: setSize (448, 248); andrewm@41: andrewm@41: andrewm@41: //[Constructor] You can add your own custom stuff here.. andrewm@41: inputRangeLowEditor->addListener(this); andrewm@41: inputRangeHighEditor->addListener(this); andrewm@41: outputRangeLowEditor->addListener(this); andrewm@41: outputRangeHighEditor->addListener(this); andrewm@41: outputDefaultEditor->addListener(this); andrewm@41: thresholdEditor->addListener(this); andrewm@41: //[/Constructor] andrewm@41: } andrewm@41: andrewm@41: TouchkeyControlMappingExtendedEditor::~TouchkeyControlMappingExtendedEditor() andrewm@41: { andrewm@41: //[Destructor_pre]. You can add your own custom destruction code here.. andrewm@41: //[/Destructor_pre] andrewm@41: andrewm@41: inputRangeLowEditor = nullptr; andrewm@41: rangeLabel = nullptr; andrewm@41: controlLabel = nullptr; andrewm@41: controlComboBox = nullptr; andrewm@41: controlLabel2 = nullptr; andrewm@41: parameterComboBox = nullptr; andrewm@41: controlLabel3 = nullptr; andrewm@41: typeComboBox = nullptr; andrewm@41: inputRangeHighEditor = nullptr; andrewm@41: rangeLabel2 = nullptr; andrewm@41: rangeLabel3 = nullptr; andrewm@41: outputRangeLowEditor = nullptr; andrewm@41: outputRangeHighEditor = nullptr; andrewm@41: rangeLabel4 = nullptr; andrewm@41: controlLabel4 = nullptr; andrewm@41: directionComboBox = nullptr; andrewm@41: titleLabel = nullptr; andrewm@41: rangeLabel5 = nullptr; andrewm@41: thresholdEditor = nullptr; andrewm@41: cc14BitButton = nullptr; andrewm@41: ignore2FingersButton = nullptr; andrewm@41: ignore3FingersButton = nullptr; andrewm@41: controlLabel6 = nullptr; andrewm@41: outOfRangeComboBox = nullptr; andrewm@41: rangeLabel6 = nullptr; andrewm@41: outputDefaultEditor = nullptr; andrewm@41: andrewm@41: andrewm@41: //[Destructor]. You can add your own custom destruction code here.. andrewm@41: //[/Destructor] andrewm@41: } andrewm@41: andrewm@41: //============================================================================== andrewm@41: void TouchkeyControlMappingExtendedEditor::paint (Graphics& g) andrewm@41: { andrewm@41: //[UserPrePaint] Add your own custom painting code here.. andrewm@41: //[/UserPrePaint] andrewm@41: andrewm@41: g.fillAll (Colour (0xffd2d2d2)); andrewm@41: andrewm@41: //[UserPaint] Add your own custom painting code here.. andrewm@41: //[/UserPaint] andrewm@41: } andrewm@41: andrewm@41: void TouchkeyControlMappingExtendedEditor::resized() andrewm@41: { andrewm@41: inputRangeLowEditor->setBounds (112, 72, 56, 24); andrewm@41: rangeLabel->setBounds (8, 72, 104, 24); andrewm@41: controlLabel->setBounds (256, 40, 64, 24); andrewm@41: controlComboBox->setBounds (320, 40, 112, 24); andrewm@41: controlLabel2->setBounds (8, 40, 72, 24); andrewm@41: parameterComboBox->setBounds (80, 40, 160, 24); andrewm@41: controlLabel3->setBounds (264, 104, 56, 24); andrewm@41: typeComboBox->setBounds (320, 104, 112, 24); andrewm@41: inputRangeHighEditor->setBounds (184, 72, 56, 24); andrewm@41: rangeLabel2->setBounds (168, 72, 16, 24); andrewm@41: rangeLabel3->setBounds (8, 104, 96, 24); andrewm@41: outputRangeLowEditor->setBounds (112, 104, 56, 24); andrewm@41: outputRangeHighEditor->setBounds (184, 104, 56, 24); andrewm@41: rangeLabel4->setBounds (168, 104, 16, 24); andrewm@41: controlLabel4->setBounds (248, 136, 72, 24); andrewm@41: directionComboBox->setBounds (320, 136, 112, 24); andrewm@41: titleLabel->setBounds (8, 8, 424, 24); andrewm@41: rangeLabel5->setBounds (8, 168, 72, 24); andrewm@41: thresholdEditor->setBounds (112, 168, 56, 24); andrewm@41: cc14BitButton->setBounds (320, 72, 112, 24); andrewm@41: ignore2FingersButton->setBounds (8, 192, 128, 24); andrewm@41: ignore3FingersButton->setBounds (8, 216, 128, 24); andrewm@41: controlLabel6->setBounds (216, 168, 104, 24); andrewm@41: outOfRangeComboBox->setBounds (320, 168, 112, 24); andrewm@41: rangeLabel6->setBounds (8, 136, 96, 24); andrewm@41: outputDefaultEditor->setBounds (112, 136, 56, 24); andrewm@41: //[UserResized] Add your own custom resize handling here.. andrewm@41: //[/UserResized] andrewm@41: } andrewm@41: andrewm@41: void TouchkeyControlMappingExtendedEditor::comboBoxChanged (ComboBox* comboBoxThatHasChanged) andrewm@41: { andrewm@41: //[UsercomboBoxChanged_Pre] andrewm@41: //[/UsercomboBoxChanged_Pre] andrewm@41: andrewm@41: if (comboBoxThatHasChanged == controlComboBox) andrewm@41: { andrewm@41: //[UserComboBoxCode_controlComboBox] -- add your combo box handling code here.. andrewm@41: int controller = controlComboBox->getSelectedId(); andrewm@41: factory_.setController(controller); andrewm@41: //[/UserComboBoxCode_controlComboBox] andrewm@41: } andrewm@41: else if (comboBoxThatHasChanged == parameterComboBox) andrewm@41: { andrewm@41: //[UserComboBoxCode_parameterComboBox] -- add your combo box handling code here.. andrewm@41: int param = parameterComboBox->getSelectedId(); andrewm@41: factory_.setInputParameter(param); andrewm@41: //[/UserComboBoxCode_parameterComboBox] andrewm@41: } andrewm@41: else if (comboBoxThatHasChanged == typeComboBox) andrewm@41: { andrewm@41: //[UserComboBoxCode_typeComboBox] -- add your combo box handling code here.. andrewm@41: int type = typeComboBox->getSelectedId(); andrewm@41: factory_.setInputType(type); andrewm@41: //[/UserComboBoxCode_typeComboBox] andrewm@41: } andrewm@41: else if (comboBoxThatHasChanged == directionComboBox) andrewm@41: { andrewm@41: //[UserComboBoxCode_directionComboBox] -- add your combo box handling code here.. andrewm@41: int direction = directionComboBox->getSelectedId(); andrewm@41: factory_.setDirection(direction); andrewm@41: //[/UserComboBoxCode_directionComboBox] andrewm@41: } andrewm@41: else if (comboBoxThatHasChanged == outOfRangeComboBox) andrewm@41: { andrewm@41: //[UserComboBoxCode_outOfRangeComboBox] -- add your combo box handling code here.. andrewm@41: int behavior = outOfRangeComboBox->getSelectedId(); andrewm@41: factory_.setOutOfRangeBehavior(behavior); andrewm@41: //[/UserComboBoxCode_outOfRangeComboBox] andrewm@41: } andrewm@41: andrewm@41: //[UsercomboBoxChanged_Post] andrewm@41: //[/UsercomboBoxChanged_Post] andrewm@41: } andrewm@41: andrewm@41: void TouchkeyControlMappingExtendedEditor::buttonClicked (Button* buttonThatWasClicked) andrewm@41: { andrewm@41: //[UserbuttonClicked_Pre] andrewm@41: //[/UserbuttonClicked_Pre] andrewm@41: andrewm@41: if (buttonThatWasClicked == cc14BitButton) andrewm@41: { andrewm@41: //[UserButtonCode_cc14BitButton] -- add your button handler code here.. andrewm@41: factory_.setUses14BitControl(cc14BitButton->getToggleState()); andrewm@41: //[/UserButtonCode_cc14BitButton] andrewm@41: } andrewm@41: else if (buttonThatWasClicked == ignore2FingersButton) andrewm@41: { andrewm@41: //[UserButtonCode_ignore2FingersButton] -- add your button handler code here.. andrewm@41: factory_.setIgnoresTwoFingers(ignore2FingersButton->getToggleState()); andrewm@41: //[/UserButtonCode_ignore2FingersButton] andrewm@41: } andrewm@41: else if (buttonThatWasClicked == ignore3FingersButton) andrewm@41: { andrewm@41: //[UserButtonCode_ignore3FingersButton] -- add your button handler code here.. andrewm@41: factory_.setIgnoresThreeFingers(ignore3FingersButton->getToggleState()); andrewm@41: //[/UserButtonCode_ignore3FingersButton] andrewm@41: } andrewm@41: andrewm@41: //[UserbuttonClicked_Post] andrewm@41: //[/UserbuttonClicked_Post] andrewm@41: } andrewm@41: andrewm@41: andrewm@41: andrewm@41: //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... andrewm@41: andrewm@41: void TouchkeyControlMappingExtendedEditor::textEditorReturnKeyPressed(TextEditor &editor) andrewm@41: { andrewm@41: if(&editor == inputRangeLowEditor) { andrewm@41: float range = atof(inputRangeLowEditor->getText().toUTF8()); andrewm@41: factory_.setRangeInputMin(range); andrewm@41: factory_.setRangeInputCenter(range); andrewm@41: } andrewm@41: else if(&editor == inputRangeHighEditor) { andrewm@41: float range = atof(inputRangeHighEditor->getText().toUTF8()); andrewm@41: factory_.setRangeInputMax(range); andrewm@41: } andrewm@41: else if(&editor == outputRangeLowEditor) { andrewm@41: float range = atof(outputRangeLowEditor->getText().toUTF8()); andrewm@41: factory_.setRangeOutputMin(range); andrewm@41: } andrewm@41: else if(&editor == outputRangeHighEditor) { andrewm@41: float range = atof(outputRangeHighEditor->getText().toUTF8()); andrewm@41: factory_.setRangeOutputMax(range); andrewm@41: } andrewm@41: else if(&editor == outputDefaultEditor) { andrewm@41: float range = atof(outputDefaultEditor->getText().toUTF8()); andrewm@41: factory_.setRangeOutputDefault(range); andrewm@41: } andrewm@41: else if(&editor == thresholdEditor) { andrewm@41: float thresh = atof(thresholdEditor->getText().toUTF8()); andrewm@41: factory_.setThreshold(thresh); andrewm@41: } andrewm@41: } andrewm@41: andrewm@41: void TouchkeyControlMappingExtendedEditor::textEditorEscapeKeyPressed(TextEditor &editor) andrewm@41: { andrewm@41: andrewm@41: } andrewm@41: andrewm@41: void TouchkeyControlMappingExtendedEditor::textEditorFocusLost(TextEditor &editor) andrewm@41: { andrewm@41: textEditorReturnKeyPressed(editor); andrewm@41: } andrewm@41: andrewm@41: void TouchkeyControlMappingExtendedEditor::synchronize() andrewm@41: { andrewm@41: // Set the title label andrewm@41: titleLabel->setText(getDescriptionHelper("Control Mapping"), dontSendNotification); andrewm@41: andrewm@41: // Update the editors to reflect the current status andrewm@41: if(!inputRangeLowEditor->hasKeyboardFocus(true)) { andrewm@41: float value = factory_.getRangeInputMin(); andrewm@41: char st[16]; andrewm@41: #ifdef _MSC_VER andrewm@41: _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); andrewm@41: #else andrewm@41: snprintf(st, 16, "%.2f", value); andrewm@41: #endif andrewm@41: inputRangeLowEditor->setText(st); andrewm@41: } andrewm@41: andrewm@41: if(!inputRangeHighEditor->hasKeyboardFocus(true)) { andrewm@41: float value = factory_.getRangeInputMax(); andrewm@41: char st[16]; andrewm@41: #ifdef _MSC_VER andrewm@41: _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); andrewm@41: #else andrewm@41: snprintf(st, 16, "%.2f", value); andrewm@41: #endif andrewm@41: andrewm@41: inputRangeHighEditor->setText(st); andrewm@41: } andrewm@41: andrewm@41: if(!outputRangeLowEditor->hasKeyboardFocus(true)) { andrewm@41: float value = factory_.getRangeOutputMin(); andrewm@41: char st[16]; andrewm@41: #ifdef _MSC_VER andrewm@41: _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); andrewm@41: #else andrewm@41: snprintf(st, 16, "%.2f", value); andrewm@41: #endif andrewm@41: andrewm@41: outputRangeLowEditor->setText(st); andrewm@41: } andrewm@41: andrewm@41: if(!outputRangeHighEditor->hasKeyboardFocus(true)) { andrewm@41: float value = factory_.getRangeOutputMax(); andrewm@41: char st[16]; andrewm@41: #ifdef _MSC_VER andrewm@41: _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); andrewm@41: #else andrewm@41: snprintf(st, 16, "%.2f", value); andrewm@41: #endif andrewm@41: andrewm@41: outputRangeHighEditor->setText(st); andrewm@41: } andrewm@41: andrewm@41: if(!outputDefaultEditor->hasKeyboardFocus(true)) { andrewm@41: float value = factory_.getRangeOutputDefault(); andrewm@41: char st[16]; andrewm@41: #ifdef _MSC_VER andrewm@41: _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); andrewm@41: #else andrewm@41: snprintf(st, 16, "%.2f", value); andrewm@41: #endif andrewm@41: andrewm@41: outputDefaultEditor->setText(st); andrewm@41: } andrewm@41: andrewm@41: if(factory_.getInputType() == TouchkeyControlMapping::kTypeFirstTouchRelative andrewm@41: || factory_.getInputType() == TouchkeyControlMapping::kTypeNoteOnsetRelative) { andrewm@41: thresholdEditor->setEnabled(true); andrewm@41: if(!thresholdEditor->hasKeyboardFocus(true)) { andrewm@41: float value = factory_.getThreshold(); andrewm@41: char st[16]; andrewm@41: #ifdef _MSC_VER andrewm@41: _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); andrewm@41: #else andrewm@41: snprintf(st, 16, "%.2f", value); andrewm@41: #endif andrewm@41: andrewm@41: thresholdEditor->setText(st); andrewm@41: } andrewm@41: andrewm@41: if(typeWasAbsolute_) { andrewm@41: // Add all three direction items andrewm@41: directionComboBox->clear(); andrewm@41: directionComboBox->addItem("Normal", TouchkeyControlMapping::kDirectionPositive); andrewm@41: directionComboBox->addItem("Reverse", TouchkeyControlMapping::kDirectionNegative); andrewm@41: directionComboBox->addItem("Always Positive", TouchkeyControlMapping::kDirectionBoth); andrewm@41: } andrewm@41: andrewm@41: typeWasAbsolute_ = false; andrewm@41: } andrewm@41: else { andrewm@41: thresholdEditor->setEnabled(false); andrewm@41: thresholdEditor->setText("", false); andrewm@41: andrewm@41: if(!typeWasAbsolute_) { andrewm@41: // Add only one direction item andrewm@41: directionComboBox->clear(); andrewm@41: directionComboBox->addItem("Normal", TouchkeyControlMapping::kDirectionPositive); andrewm@41: } andrewm@41: andrewm@41: typeWasAbsolute_ = true; andrewm@41: } andrewm@41: andrewm@41: if(factory_.getController() == MidiKeyboardSegment::kControlPitchWheel) { andrewm@41: cc14BitButton->setEnabled(false); andrewm@41: cc14BitButton->setToggleState(true, dontSendNotification); andrewm@41: } andrewm@41: else if(factory_.getController() == MidiKeyboardSegment::kControlPolyphonicAftertouch || andrewm@41: factory_.getController() == MidiKeyboardSegment::kControlChannelAftertouch) { andrewm@41: cc14BitButton->setEnabled(false); andrewm@41: cc14BitButton->setToggleState(false, dontSendNotification); andrewm@41: } andrewm@41: else { andrewm@41: cc14BitButton->setEnabled(true); andrewm@41: cc14BitButton->setToggleState(factory_.getUses14BitControl(), dontSendNotification); andrewm@41: } andrewm@41: ignore2FingersButton->setToggleState(factory_.getIgnoresTwoFingers(), dontSendNotification); andrewm@41: ignore3FingersButton->setToggleState(factory_.getIgnoresThreeFingers(), dontSendNotification); andrewm@41: andrewm@41: parameterComboBox->setSelectedId(factory_.getInputParameter(), dontSendNotification); andrewm@41: typeComboBox->setSelectedId(factory_.getInputType(), dontSendNotification); andrewm@41: controlComboBox->setSelectedId(factory_.getController(), dontSendNotification); andrewm@41: directionComboBox->setSelectedId(factory_.getDirection(), dontSendNotification); andrewm@41: outOfRangeComboBox->setSelectedId(factory_.getOutOfRangeBehavior(), dontSendNotification); andrewm@41: } andrewm@41: andrewm@41: // Return a human-readable description of this mapping for the window andrewm@41: String TouchkeyControlMappingExtendedEditor::getDescription() { andrewm@41: return getDescriptionHelper("Control"); andrewm@41: } andrewm@41: andrewm@41: // Return a human-readable description of this mapping for the window andrewm@41: String TouchkeyControlMappingExtendedEditor::getDescriptionHelper(String baseName) { andrewm@41: String desc = baseName; andrewm@41: andrewm@41: desc += " (Zone "; andrewm@41: andrewm@41: int zone = factory_.segment().outputPort(); andrewm@41: desc += zone; andrewm@41: desc += ", #"; andrewm@41: andrewm@41: int mappingNumber = factory_.segment().indexOfMappingFactory(&factory_); andrewm@41: desc += mappingNumber; andrewm@41: desc += ")"; andrewm@41: andrewm@41: return desc; andrewm@41: } andrewm@41: andrewm@41: //[/MiscUserCode] andrewm@41: andrewm@41: andrewm@41: //============================================================================== andrewm@41: #if 0 andrewm@41: /* -- Introjucer information section -- andrewm@41: andrewm@41: This is where the Introjucer stores the metadata that describe this GUI layout, so andrewm@41: make changes in here at your peril! andrewm@41: andrewm@41: BEGIN_JUCER_METADATA andrewm@41: andrewm@41: andrewm@41: andrewm@41: andrewm@41: andrewm@41: andrewm@41: END_JUCER_METADATA andrewm@41: */ andrewm@41: #endif andrewm@41: andrewm@41: andrewm@41: //[EndFile] You can add extra defines here... andrewm@50: #endif // TOUCHKEYS_NO_GUI andrewm@41: //[/EndFile]