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 "TouchkeyPitchBendMappingShortEditor.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: TouchkeyPitchBendMappingShortEditor::TouchkeyPitchBendMappingShortEditor (TouchkeyPitchBendMappingFactory& factory) andrewm@0: : factory_(factory) andrewm@0: { andrewm@0: addAndMakeVisible (rangeEditor = new TextEditor ("range text editor")); andrewm@0: rangeEditor->setMultiLine (false); andrewm@0: rangeEditor->setReturnKeyStartsNewLine (false); andrewm@0: rangeEditor->setReadOnly (false); andrewm@0: rangeEditor->setScrollbarsShown (true); andrewm@0: rangeEditor->setCaretVisible (true); andrewm@0: rangeEditor->setPopupMenuEnabled (true); andrewm@0: rangeEditor->setText (String::empty); andrewm@0: andrewm@0: addAndMakeVisible (rangeLabel = new Label ("range label", andrewm@0: "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 (thresholdEditor = new TextEditor ("threshold text editor")); andrewm@0: thresholdEditor->setMultiLine (false); andrewm@0: thresholdEditor->setReturnKeyStartsNewLine (false); andrewm@0: thresholdEditor->setReadOnly (false); andrewm@0: thresholdEditor->setScrollbarsShown (true); andrewm@0: thresholdEditor->setCaretVisible (true); andrewm@0: thresholdEditor->setPopupMenuEnabled (true); andrewm@0: thresholdEditor->setText (String::empty); andrewm@0: andrewm@0: addAndMakeVisible (thresholdLabel = new Label ("threshold label", andrewm@0: "Threshold:")); andrewm@0: thresholdLabel->setFont (Font (15.00f, Font::plain)); andrewm@0: thresholdLabel->setJustificationType (Justification::centredLeft); andrewm@0: thresholdLabel->setEditable (false, false, false); andrewm@0: thresholdLabel->setColour (TextEditor::textColourId, Colours::black); andrewm@0: thresholdLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); andrewm@0: andrewm@0: addAndMakeVisible (controlLabel = new Label ("control label", andrewm@0: "Endpoints:")); 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 (endpointsComboBox = new ComboBox ("control combo box")); andrewm@0: endpointsComboBox->setEditableText (false); andrewm@0: endpointsComboBox->setJustificationType (Justification::centredLeft); andrewm@0: endpointsComboBox->setTextWhenNothingSelected (String::empty); andrewm@0: endpointsComboBox->setTextWhenNoChoicesAvailable ("(no choices)"); andrewm@0: endpointsComboBox->addListener (this); andrewm@0: andrewm@0: andrewm@0: //[UserPreSize] andrewm@0: endpointsComboBox->addItem("Variable", TouchkeyPitchBendMapping::kPitchBendModeVariableEndpoints); andrewm@0: endpointsComboBox->addItem("Fixed", TouchkeyPitchBendMapping::kPitchBendModeFixedEndpoints); 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: rangeEditor->addListener(this); andrewm@0: thresholdEditor->addListener(this); andrewm@0: //[/Constructor] andrewm@0: } andrewm@0: andrewm@0: TouchkeyPitchBendMappingShortEditor::~TouchkeyPitchBendMappingShortEditor() andrewm@0: { andrewm@0: //[Destructor_pre]. You can add your own custom destruction code here.. andrewm@0: //[/Destructor_pre] andrewm@0: andrewm@0: rangeEditor = nullptr; andrewm@0: rangeLabel = nullptr; andrewm@0: thresholdEditor = nullptr; andrewm@0: thresholdLabel = nullptr; andrewm@0: controlLabel = nullptr; andrewm@0: endpointsComboBox = 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 TouchkeyPitchBendMappingShortEditor::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 TouchkeyPitchBendMappingShortEditor::resized() andrewm@0: { andrewm@0: rangeEditor->setBounds (80, 8, 80, 24); andrewm@0: rangeLabel->setBounds (8, 8, 56, 24); andrewm@0: thresholdEditor->setBounds (240, 8, 80, 24); andrewm@0: thresholdLabel->setBounds (168, 8, 72, 24); andrewm@0: controlLabel->setBounds (8, 40, 72, 24); andrewm@0: endpointsComboBox->setBounds (80, 40, 80, 24); andrewm@0: //[UserResized] Add your own custom resize handling here.. andrewm@0: //[/UserResized] andrewm@0: } andrewm@0: andrewm@0: void TouchkeyPitchBendMappingShortEditor::comboBoxChanged (ComboBox* comboBoxThatHasChanged) andrewm@0: { andrewm@0: //[UsercomboBoxChanged_Pre] andrewm@0: //[/UsercomboBoxChanged_Pre] andrewm@0: andrewm@0: if (comboBoxThatHasChanged == endpointsComboBox) andrewm@0: { andrewm@0: //[UserComboBoxCode_endpointsComboBox] -- add your combo box handling code here.. andrewm@0: int control = endpointsComboBox->getSelectedId(); andrewm@0: if(control == TouchkeyPitchBendMapping::kPitchBendModeVariableEndpoints) andrewm@0: factory_.setBendVariableEndpoints(); andrewm@0: else if(control == TouchkeyPitchBendMapping::kPitchBendModeFixedEndpoints) andrewm@0: factory_.setBendFixedEndpoints(factory_.getBendThresholdKeyLength(), 0); andrewm@0: //[/UserComboBoxCode_endpointsComboBox] 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 TouchkeyPitchBendMappingShortEditor::textEditorReturnKeyPressed(TextEditor &editor) andrewm@0: { andrewm@0: if(&editor == rangeEditor) { andrewm@0: float range = atof(rangeEditor->getText().toUTF8()); andrewm@0: factory_.setBendRange(range); andrewm@0: } andrewm@0: else if(&editor == thresholdEditor) { andrewm@0: float threshold = atof(thresholdEditor->getText().toUTF8()); andrewm@0: factory_.setBendThresholdKeyLength(threshold); andrewm@0: } andrewm@0: } andrewm@0: andrewm@0: void TouchkeyPitchBendMappingShortEditor::textEditorEscapeKeyPressed(TextEditor &editor) andrewm@0: { andrewm@0: andrewm@0: } andrewm@0: andrewm@0: void TouchkeyPitchBendMappingShortEditor::textEditorFocusLost(TextEditor &editor) andrewm@0: { andrewm@0: textEditorReturnKeyPressed(editor); andrewm@0: } andrewm@0: andrewm@0: void TouchkeyPitchBendMappingShortEditor::synchronize() andrewm@0: { andrewm@0: // Update the editors to reflect the current status andrewm@0: if(!rangeEditor->hasKeyboardFocus(true)) { andrewm@0: float value = factory_.getBendRange(); 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: rangeEditor->setText(st); andrewm@0: } andrewm@0: andrewm@0: if(!thresholdEditor->hasKeyboardFocus(true)) { andrewm@0: float value = factory_.getBendThresholdKeyLength(); 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: thresholdEditor->setText(st); andrewm@0: } andrewm@0: andrewm@0: endpointsComboBox->setSelectedId(factory_.getBendMode(), 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]