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: #ifndef __JUCE_HEADER_E3CF42F64919BE28__ andrewm@0: #define __JUCE_HEADER_E3CF42F64919BE28__ andrewm@0: andrewm@0: //[Headers] -- You can add your own extra header files here -- andrewm@50: #ifndef TOUCHKEYS_NO_GUI andrewm@50: andrewm@0: #include "JuceHeader.h" andrewm@0: #include "MappingListComponent.h" andrewm@0: #include "../MainApplicationController.h" andrewm@0: #include "../TouchKeys/MidiKeyboardSegment.h" andrewm@0: //[/Headers] andrewm@0: andrewm@0: andrewm@0: andrewm@0: //============================================================================== andrewm@0: /** andrewm@0: //[Comments] andrewm@0: An auto-generated component, created by the Introjucer. andrewm@0: andrewm@0: Describe your class and how it works here! andrewm@0: //[/Comments] andrewm@0: */ andrewm@0: class KeyboardZoneComponent : public Component, andrewm@0: public TextEditor::Listener, andrewm@0: public ComboBoxListener, andrewm@0: public ButtonListener andrewm@0: { andrewm@0: public: andrewm@0: //============================================================================== andrewm@0: KeyboardZoneComponent (); andrewm@0: ~KeyboardZoneComponent(); andrewm@0: andrewm@0: //============================================================================== andrewm@0: //[UserMethods] -- You can add your own custom methods in this section. andrewm@0: void setMainApplicationController(MainApplicationController *controller) { andrewm@0: // Attach the user interface to the controller and vice-versa andrewm@0: controller_ = controller; andrewm@0: mappingListComponent->setMainApplicationController(controller_); andrewm@0: if(controller_ != 0) { andrewm@0: synchronize(true); andrewm@0: } andrewm@0: } andrewm@0: andrewm@37: void setKeyboardSegment(MidiKeyboardSegment *segment, int zone) { andrewm@0: keyboardSegment_ = segment; andrewm@37: keyboardZone_ = zone; andrewm@0: mappingListComponent->setKeyboardSegment(keyboardSegment_); andrewm@0: if(controller_ != 0) { andrewm@0: synchronize(true); andrewm@0: } andrewm@0: } andrewm@0: andrewm@0: MidiKeyboardSegment* keyboardSegment() { andrewm@0: return keyboardSegment_; andrewm@0: } andrewm@37: int keyboardZone() { return keyboardZone_; } andrewm@0: andrewm@0: // TextEditor listener methods andrewm@0: void textEditorTextChanged(TextEditor &editor) {} andrewm@0: void textEditorReturnKeyPressed(TextEditor &editor); andrewm@0: void textEditorEscapeKeyPressed(TextEditor &editor); andrewm@0: void textEditorFocusLost(TextEditor &editor); andrewm@0: andrewm@0: // Synchronize UI state to match underlying state of the back end andrewm@0: void synchronize(bool forceUpdates = false); andrewm@0: andrewm@0: // Update the range of the keyboard segment andrewm@0: void updateSegmentRange(); andrewm@0: andrewm@0: static void staticMappingChosenCallback(int result, KeyboardZoneComponent* component) { andrewm@0: if (result != 0 && component != 0) andrewm@0: component->mappingChosenCallback(result); andrewm@0: } andrewm@0: void mappingChosenCallback(int result); andrewm@8: andrewm@5: static void staticKeyboardControllerChosenCallback(int result, KeyboardZoneComponent* component) { andrewm@5: if (result != 0 && component != 0) andrewm@5: component->keyboardControllerChosenCallback(result); andrewm@5: } andrewm@5: void keyboardControllerChosenCallback(int result); andrewm@0: //[/UserMethods] andrewm@0: andrewm@0: void paint (Graphics& g); andrewm@0: void resized(); andrewm@0: void comboBoxChanged (ComboBox* comboBoxThatHasChanged); andrewm@0: void buttonClicked (Button* buttonThatWasClicked); andrewm@0: andrewm@0: andrewm@0: andrewm@0: private: andrewm@0: //[UserVariables] -- You can add your own custom variables in this section. andrewm@0: andrewm@0: enum { andrewm@39: kInvalidMidiOutputId = -100 andrewm@39: }; andrewm@39: andrewm@39: enum { andrewm@0: // Offsets between Juce UI IDs and positions in vector andrewm@0: kMidiOutputDeviceComboBoxOffset = 3, andrewm@0: kMidiOutputModeComboBoxOffset = 1 andrewm@0: }; andrewm@8: andrewm@5: enum { andrewm@5: // Special commands for keyboard controller popup button andrewm@8: kKeyboardControllerRetransmitOthers = 2000, andrewm@53: kKeyboardControllerSendPitchWheelRange, andrewm@53: kKeyboardControllerRetransmitPedals andrewm@5: }; andrewm@0: andrewm@0: // Update list of MIDI output devices andrewm@0: void updateOutputDeviceList(); andrewm@0: andrewm@0: // Create popup menu for mapping list andrewm@0: void createMappingListPopup(); andrewm@0: andrewm@5: // Create popup menu for keyboard controller retransmission andrewm@5: void createKeyboardControllerPopup(); andrewm@8: andrewm@0: MainApplicationController *controller_; // Pointer to the main application controller andrewm@0: MidiKeyboardSegment *keyboardSegment_; // Pointer to the segment this component controls andrewm@37: int keyboardZone_; // Which zone this corresponds to (for UI sync purposes) andrewm@0: std::vector midiOutputDeviceIDs_; andrewm@0: int lastSelectedMidiOutputID_; andrewm@0: //[/UserVariables] andrewm@0: andrewm@0: //============================================================================== andrewm@5: ScopedPointer mappingListComponent; andrewm@0: ScopedPointer midiOutputGroupComponent; andrewm@0: ScopedPointer midiOutputDeviceComboBox; andrewm@0: ScopedPointer