andrewm@0: /* andrewm@0: ============================================================================== andrewm@0: andrewm@0: This is an automatically generated GUI class created by the Introjucer! andrewm@0: andrewm@0: Be careful when adding custom code to these files, as only the code within andrewm@0: the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded andrewm@0: and re-saved. andrewm@0: andrewm@0: Created with Introjucer version: 3.1.0 andrewm@0: andrewm@0: ------------------------------------------------------------------------------ andrewm@0: andrewm@0: The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions" andrewm@0: Copyright 2004-13 by Raw Material Software Ltd. andrewm@0: andrewm@0: ============================================================================== andrewm@0: */ andrewm@0: andrewm@0: //[Headers] You can add your own extra header files here... andrewm@50: #ifndef TOUCHKEYS_NO_GUI andrewm@0: //[/Headers] andrewm@0: andrewm@0: #include "TouchkeyControlMappingShortEditor.h" andrewm@0: andrewm@0: andrewm@0: //[MiscUserDefs] You can add your own user definitions and misc code here... andrewm@0: //[/MiscUserDefs] andrewm@0: andrewm@0: //============================================================================== andrewm@0: TouchkeyControlMappingShortEditor::TouchkeyControlMappingShortEditor (TouchkeyControlMappingFactory& factory) andrewm@0: : factory_(factory) andrewm@0: { andrewm@0: addAndMakeVisible (inputRangeLowEditor = new TextEditor ("range low text editor")); andrewm@0: inputRangeLowEditor->setMultiLine (false); andrewm@0: inputRangeLowEditor->setReturnKeyStartsNewLine (false); andrewm@0: inputRangeLowEditor->setReadOnly (false); andrewm@0: inputRangeLowEditor->setScrollbarsShown (true); andrewm@0: inputRangeLowEditor->setCaretVisible (true); andrewm@0: inputRangeLowEditor->setPopupMenuEnabled (true); andrewm@0: inputRangeLowEditor->setText (String::empty); andrewm@0: andrewm@0: addAndMakeVisible (rangeLabel = new Label ("range label", andrewm@0: "Input Range:")); andrewm@0: rangeLabel->setFont (Font (15.00f, Font::plain)); andrewm@0: rangeLabel->setJustificationType (Justification::centredLeft); andrewm@0: rangeLabel->setEditable (false, false, false); andrewm@0: rangeLabel->setColour (TextEditor::textColourId, Colours::black); andrewm@0: rangeLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@0: andrewm@0: addAndMakeVisible (controlLabel = new Label ("control label", andrewm@0: "Control:")); andrewm@0: controlLabel->setFont (Font (15.00f, Font::plain)); andrewm@0: controlLabel->setJustificationType (Justification::centredLeft); andrewm@0: controlLabel->setEditable (false, false, false); andrewm@0: controlLabel->setColour (TextEditor::textColourId, Colours::black); andrewm@0: controlLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@0: andrewm@0: addAndMakeVisible (controlComboBox = new ComboBox ("control combo box")); andrewm@0: controlComboBox->setEditableText (false); andrewm@0: controlComboBox->setJustificationType (Justification::centredLeft); andrewm@0: controlComboBox->setTextWhenNothingSelected (String::empty); andrewm@0: controlComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); andrewm@0: controlComboBox->addListener (this); andrewm@0: andrewm@0: addAndMakeVisible (controlLabel2 = new Label ("control label", andrewm@0: "Parameter:")); andrewm@0: controlLabel2->setFont (Font (15.00f, Font::plain)); andrewm@0: controlLabel2->setJustificationType (Justification::centredLeft); andrewm@0: controlLabel2->setEditable (false, false, false); andrewm@0: controlLabel2->setColour (TextEditor::textColourId, Colours::black); andrewm@0: controlLabel2->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@0: andrewm@0: addAndMakeVisible (parameterComboBox = new ComboBox ("parameter combo box")); andrewm@0: parameterComboBox->setEditableText (false); andrewm@0: parameterComboBox->setJustificationType (Justification::centredLeft); andrewm@0: parameterComboBox->setTextWhenNothingSelected (String::empty); andrewm@0: parameterComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); andrewm@0: parameterComboBox->addListener (this); andrewm@0: andrewm@0: addAndMakeVisible (controlLabel3 = new Label ("control label", andrewm@0: "Type:")); andrewm@0: controlLabel3->setFont (Font (15.00f, Font::plain)); andrewm@0: controlLabel3->setJustificationType (Justification::centredLeft); andrewm@0: controlLabel3->setEditable (false, false, false); andrewm@0: controlLabel3->setColour (TextEditor::textColourId, Colours::black); andrewm@0: controlLabel3->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@0: andrewm@0: addAndMakeVisible (typeComboBox = new ComboBox ("type combo box")); andrewm@0: typeComboBox->setEditableText (false); andrewm@0: typeComboBox->setJustificationType (Justification::centredLeft); andrewm@0: typeComboBox->setTextWhenNothingSelected (String::empty); andrewm@0: typeComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); andrewm@0: typeComboBox->addListener (this); andrewm@0: andrewm@0: addAndMakeVisible (inputRangeHighEditor = new TextEditor ("range hi text editor")); andrewm@0: inputRangeHighEditor->setMultiLine (false); andrewm@0: inputRangeHighEditor->setReturnKeyStartsNewLine (false); andrewm@0: inputRangeHighEditor->setReadOnly (false); andrewm@0: inputRangeHighEditor->setScrollbarsShown (true); andrewm@0: inputRangeHighEditor->setCaretVisible (true); andrewm@0: inputRangeHighEditor->setPopupMenuEnabled (true); andrewm@0: inputRangeHighEditor->setText (String::empty); andrewm@0: andrewm@0: addAndMakeVisible (rangeLabel2 = new Label ("range label", andrewm@0: "-")); andrewm@0: rangeLabel2->setFont (Font (15.00f, Font::plain)); andrewm@0: rangeLabel2->setJustificationType (Justification::centredLeft); andrewm@0: rangeLabel2->setEditable (false, false, false); andrewm@0: rangeLabel2->setColour (TextEditor::textColourId, Colours::black); andrewm@0: rangeLabel2->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@0: andrewm@0: andrewm@0: //[UserPreSize] andrewm@0: parameterComboBox->addItem("X Position", TouchkeyControlMapping::kInputParameterXPosition); andrewm@0: parameterComboBox->addItem("Y Position", TouchkeyControlMapping::kInputParameterYPosition); andrewm@0: parameterComboBox->addItem("Contact Area", TouchkeyControlMapping::kInputParameterTouchSize); andrewm@0: parameterComboBox->addItem("2-Finger Mean", TouchkeyControlMapping::kInputParameter2FingerMean); andrewm@0: parameterComboBox->addItem("2-Finger Distance", TouchkeyControlMapping::kInputParameter2FingerDistance); andrewm@0: andrewm@0: typeComboBox->addItem("Absolute", TouchkeyControlMapping::kTypeAbsolute); andrewm@0: typeComboBox->addItem("1st Touch Relative", TouchkeyControlMapping::kTypeFirstTouchRelative); andrewm@0: typeComboBox->addItem("Note Onset Relative", TouchkeyControlMapping::kTypeNoteOnsetRelative); andrewm@0: andrewm@32: controlComboBox->addItem("Pitch Wheel", MidiKeyboardSegment::kControlPitchWheel); andrewm@32: controlComboBox->addItem("Channel Pressure", MidiKeyboardSegment::kControlChannelAftertouch); andrewm@32: controlComboBox->addItem("Poly Aftertouch", MidiKeyboardSegment::kControlPolyphonicAftertouch); andrewm@0: for(int i = 1; i <= 119; i++) { andrewm@0: controlComboBox->addItem(String(i), i); andrewm@0: } andrewm@0: //[/UserPreSize] andrewm@0: andrewm@0: setSize (328, 71); andrewm@0: andrewm@0: andrewm@0: //[Constructor] You can add your own custom stuff here.. andrewm@0: inputRangeLowEditor->addListener(this); andrewm@0: inputRangeHighEditor->addListener(this); andrewm@0: //[/Constructor] andrewm@0: } andrewm@0: andrewm@0: TouchkeyControlMappingShortEditor::~TouchkeyControlMappingShortEditor() andrewm@0: { andrewm@0: //[Destructor_pre]. You can add your own custom destruction code here.. andrewm@0: //[/Destructor_pre] andrewm@0: andrewm@0: inputRangeLowEditor = nullptr; andrewm@0: rangeLabel = nullptr; andrewm@0: controlLabel = nullptr; andrewm@0: controlComboBox = nullptr; andrewm@0: controlLabel2 = nullptr; andrewm@0: parameterComboBox = nullptr; andrewm@0: controlLabel3 = nullptr; andrewm@0: typeComboBox = nullptr; andrewm@0: inputRangeHighEditor = nullptr; andrewm@0: rangeLabel2 = nullptr; andrewm@0: andrewm@0: andrewm@0: //[Destructor]. You can add your own custom destruction code here.. andrewm@0: //[/Destructor] andrewm@0: } andrewm@0: andrewm@0: //============================================================================== andrewm@0: void TouchkeyControlMappingShortEditor::paint (Graphics& g) andrewm@0: { andrewm@0: //[UserPrePaint] Add your own custom painting code here.. andrewm@0: //[/UserPrePaint] andrewm@0: andrewm@0: g.fillAll (Colours::white); andrewm@0: andrewm@0: //[UserPaint] Add your own custom painting code here.. andrewm@0: //[/UserPaint] andrewm@0: } andrewm@0: andrewm@0: void TouchkeyControlMappingShortEditor::resized() andrewm@0: { andrewm@0: inputRangeLowEditor->setBounds (80, 40, 40, 24); andrewm@0: rangeLabel->setBounds (0, 40, 80, 24); andrewm@0: controlLabel->setBounds (176, 8, 56, 24); andrewm@0: controlComboBox->setBounds (232, 8, 88, 24); andrewm@0: controlLabel2->setBounds (0, 8, 72, 24); andrewm@0: parameterComboBox->setBounds (72, 8, 104, 24); andrewm@0: controlLabel3->setBounds (184, 40, 56, 24); andrewm@0: typeComboBox->setBounds (232, 40, 88, 24); andrewm@0: inputRangeHighEditor->setBounds (136, 40, 40, 24); andrewm@0: rangeLabel2->setBounds (120, 40, 16, 24); andrewm@0: //[UserResized] Add your own custom resize handling here.. andrewm@0: //[/UserResized] andrewm@0: } andrewm@0: andrewm@0: void TouchkeyControlMappingShortEditor::comboBoxChanged (ComboBox* comboBoxThatHasChanged) andrewm@0: { andrewm@0: //[UsercomboBoxChanged_Pre] andrewm@0: //[/UsercomboBoxChanged_Pre] andrewm@0: andrewm@0: if (comboBoxThatHasChanged == controlComboBox) andrewm@0: { andrewm@0: //[UserComboBoxCode_controlComboBox] -- add your combo box handling code here.. andrewm@0: int controller = controlComboBox->getSelectedId(); andrewm@0: factory_.setController(controller); andrewm@0: //[/UserComboBoxCode_controlComboBox] andrewm@0: } andrewm@0: else if (comboBoxThatHasChanged == parameterComboBox) andrewm@0: { andrewm@0: //[UserComboBoxCode_parameterComboBox] -- add your combo box handling code here.. andrewm@0: int param = parameterComboBox->getSelectedId(); andrewm@0: factory_.setInputParameter(param); andrewm@0: //[/UserComboBoxCode_parameterComboBox] andrewm@0: } andrewm@0: else if (comboBoxThatHasChanged == typeComboBox) andrewm@0: { andrewm@0: //[UserComboBoxCode_typeComboBox] -- add your combo box handling code here.. andrewm@0: int type = typeComboBox->getSelectedId(); andrewm@0: factory_.setInputType(type); andrewm@0: //[/UserComboBoxCode_typeComboBox] andrewm@0: } andrewm@0: andrewm@0: //[UsercomboBoxChanged_Post] andrewm@0: //[/UsercomboBoxChanged_Post] andrewm@0: } andrewm@0: andrewm@0: andrewm@0: andrewm@0: //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... andrewm@0: andrewm@0: void TouchkeyControlMappingShortEditor::textEditorReturnKeyPressed(TextEditor &editor) andrewm@0: { andrewm@0: if(&editor == inputRangeLowEditor) { andrewm@0: float range = atof(inputRangeLowEditor->getText().toUTF8()); andrewm@0: factory_.setRangeInputMin(range); andrewm@0: factory_.setRangeInputCenter(range); andrewm@0: } andrewm@0: else if(&editor == inputRangeHighEditor) { andrewm@0: float range = atof(inputRangeHighEditor->getText().toUTF8()); andrewm@0: factory_.setRangeInputMax(range); andrewm@0: } andrewm@0: } andrewm@0: andrewm@0: void TouchkeyControlMappingShortEditor::textEditorEscapeKeyPressed(TextEditor &editor) andrewm@0: { andrewm@0: andrewm@0: } andrewm@0: andrewm@0: void TouchkeyControlMappingShortEditor::textEditorFocusLost(TextEditor &editor) andrewm@0: { andrewm@0: textEditorReturnKeyPressed(editor); andrewm@0: } andrewm@0: andrewm@0: void TouchkeyControlMappingShortEditor::synchronize() andrewm@0: { andrewm@0: // Update the editors to reflect the current status andrewm@0: if(!inputRangeLowEditor->hasKeyboardFocus(true)) { andrewm@0: float value = factory_.getRangeInputMin(); andrewm@0: char st[16]; andrewm@20: #ifdef _MSC_VER andrewm@20: _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); andrewm@20: #else andrewm@0: snprintf(st, 16, "%.2f", value); andrewm@20: #endif andrewm@0: inputRangeLowEditor->setText(st); andrewm@0: } andrewm@0: andrewm@0: if(!inputRangeHighEditor->hasKeyboardFocus(true)) { andrewm@0: float value = factory_.getRangeInputMax(); andrewm@0: char st[16]; andrewm@20: #ifdef _MSC_VER andrewm@20: _snprintf_s(st, 16, _TRUNCATE, "%.2f", value); andrewm@20: #else andrewm@0: snprintf(st, 16, "%.2f", value); andrewm@20: #endif andrewm@0: andrewm@0: inputRangeHighEditor->setText(st); andrewm@0: } andrewm@0: andrewm@0: parameterComboBox->setSelectedId(factory_.getInputParameter(), dontSendNotification); andrewm@0: typeComboBox->setSelectedId(factory_.getInputType(), dontSendNotification); andrewm@0: controlComboBox->setSelectedId(factory_.getController(), dontSendNotification); andrewm@0: } andrewm@0: //[/MiscUserCode] andrewm@0: andrewm@0: andrewm@0: //============================================================================== andrewm@0: #if 0 andrewm@0: /* -- Introjucer information section -- andrewm@0: andrewm@0: This is where the Introjucer stores the metadata that describe this GUI layout, so andrewm@0: make changes in here at your peril! andrewm@0: andrewm@0: BEGIN_JUCER_METADATA andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: andrewm@0: END_JUCER_METADATA andrewm@0: */ andrewm@0: #endif andrewm@0: andrewm@0: andrewm@0: //[EndFile] You can add extra defines here... andrewm@50: #endif // TOUCHKEYS_NO_GUI andrewm@0: //[/EndFile]