annotate Source/GUI/KeyboardZoneComponent.h @ 56:b4a2d2ae43cf tip

merge
author Andrew McPherson <andrewm@eecs.qmul.ac.uk>
date Fri, 23 Nov 2018 15:48:14 +0000
parents ff5d65c69e73
children
rev   line source
andrewm@0 1 /*
andrewm@0 2 ==============================================================================
andrewm@0 3
andrewm@0 4 This is an automatically generated GUI class created by the Introjucer!
andrewm@0 5
andrewm@0 6 Be careful when adding custom code to these files, as only the code within
andrewm@0 7 the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
andrewm@0 8 and re-saved.
andrewm@0 9
andrewm@0 10 Created with Introjucer version: 3.1.0
andrewm@0 11
andrewm@0 12 ------------------------------------------------------------------------------
andrewm@0 13
andrewm@0 14 The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
andrewm@0 15 Copyright 2004-13 by Raw Material Software Ltd.
andrewm@0 16
andrewm@0 17 ==============================================================================
andrewm@0 18 */
andrewm@0 19
andrewm@0 20 #ifndef __JUCE_HEADER_E3CF42F64919BE28__
andrewm@0 21 #define __JUCE_HEADER_E3CF42F64919BE28__
andrewm@0 22
andrewm@0 23 //[Headers] -- You can add your own extra header files here --
andrewm@50 24 #ifndef TOUCHKEYS_NO_GUI
andrewm@50 25
andrewm@0 26 #include "JuceHeader.h"
andrewm@0 27 #include "MappingListComponent.h"
andrewm@0 28 #include "../MainApplicationController.h"
andrewm@0 29 #include "../TouchKeys/MidiKeyboardSegment.h"
andrewm@0 30 //[/Headers]
andrewm@0 31
andrewm@0 32
andrewm@0 33
andrewm@0 34 //==============================================================================
andrewm@0 35 /**
andrewm@0 36 //[Comments]
andrewm@0 37 An auto-generated component, created by the Introjucer.
andrewm@0 38
andrewm@0 39 Describe your class and how it works here!
andrewm@0 40 //[/Comments]
andrewm@0 41 */
andrewm@0 42 class KeyboardZoneComponent : public Component,
andrewm@0 43 public TextEditor::Listener,
andrewm@0 44 public ComboBoxListener,
andrewm@0 45 public ButtonListener
andrewm@0 46 {
andrewm@0 47 public:
andrewm@0 48 //==============================================================================
andrewm@0 49 KeyboardZoneComponent ();
andrewm@0 50 ~KeyboardZoneComponent();
andrewm@0 51
andrewm@0 52 //==============================================================================
andrewm@0 53 //[UserMethods] -- You can add your own custom methods in this section.
andrewm@0 54 void setMainApplicationController(MainApplicationController *controller) {
andrewm@0 55 // Attach the user interface to the controller and vice-versa
andrewm@0 56 controller_ = controller;
andrewm@0 57 mappingListComponent->setMainApplicationController(controller_);
andrewm@0 58 if(controller_ != 0) {
andrewm@0 59 synchronize(true);
andrewm@0 60 }
andrewm@0 61 }
andrewm@0 62
andrewm@37 63 void setKeyboardSegment(MidiKeyboardSegment *segment, int zone) {
andrewm@0 64 keyboardSegment_ = segment;
andrewm@37 65 keyboardZone_ = zone;
andrewm@0 66 mappingListComponent->setKeyboardSegment(keyboardSegment_);
andrewm@0 67 if(controller_ != 0) {
andrewm@0 68 synchronize(true);
andrewm@0 69 }
andrewm@0 70 }
andrewm@0 71
andrewm@0 72 MidiKeyboardSegment* keyboardSegment() {
andrewm@0 73 return keyboardSegment_;
andrewm@0 74 }
andrewm@37 75 int keyboardZone() { return keyboardZone_; }
andrewm@0 76
andrewm@0 77 // TextEditor listener methods
andrewm@0 78 void textEditorTextChanged(TextEditor &editor) {}
andrewm@0 79 void textEditorReturnKeyPressed(TextEditor &editor);
andrewm@0 80 void textEditorEscapeKeyPressed(TextEditor &editor);
andrewm@0 81 void textEditorFocusLost(TextEditor &editor);
andrewm@0 82
andrewm@0 83 // Synchronize UI state to match underlying state of the back end
andrewm@0 84 void synchronize(bool forceUpdates = false);
andrewm@0 85
andrewm@0 86 // Update the range of the keyboard segment
andrewm@0 87 void updateSegmentRange();
andrewm@0 88
andrewm@0 89 static void staticMappingChosenCallback(int result, KeyboardZoneComponent* component) {
andrewm@0 90 if (result != 0 && component != 0)
andrewm@0 91 component->mappingChosenCallback(result);
andrewm@0 92 }
andrewm@0 93 void mappingChosenCallback(int result);
andrewm@8 94
andrewm@5 95 static void staticKeyboardControllerChosenCallback(int result, KeyboardZoneComponent* component) {
andrewm@5 96 if (result != 0 && component != 0)
andrewm@5 97 component->keyboardControllerChosenCallback(result);
andrewm@5 98 }
andrewm@5 99 void keyboardControllerChosenCallback(int result);
andrewm@0 100 //[/UserMethods]
andrewm@0 101
andrewm@0 102 void paint (Graphics& g);
andrewm@0 103 void resized();
andrewm@0 104 void comboBoxChanged (ComboBox* comboBoxThatHasChanged);
andrewm@0 105 void buttonClicked (Button* buttonThatWasClicked);
andrewm@0 106
andrewm@0 107
andrewm@0 108
andrewm@0 109 private:
andrewm@0 110 //[UserVariables] -- You can add your own custom variables in this section.
andrewm@0 111
andrewm@0 112 enum {
andrewm@39 113 kInvalidMidiOutputId = -100
andrewm@39 114 };
andrewm@39 115
andrewm@39 116 enum {
andrewm@0 117 // Offsets between Juce UI IDs and positions in vector
andrewm@0 118 kMidiOutputDeviceComboBoxOffset = 3,
andrewm@0 119 kMidiOutputModeComboBoxOffset = 1
andrewm@0 120 };
andrewm@8 121
andrewm@5 122 enum {
andrewm@5 123 // Special commands for keyboard controller popup button
andrewm@8 124 kKeyboardControllerRetransmitOthers = 2000,
andrewm@53 125 kKeyboardControllerSendPitchWheelRange,
andrewm@53 126 kKeyboardControllerRetransmitPedals
andrewm@5 127 };
andrewm@0 128
andrewm@0 129 // Update list of MIDI output devices
andrewm@0 130 void updateOutputDeviceList();
andrewm@0 131
andrewm@0 132 // Create popup menu for mapping list
andrewm@0 133 void createMappingListPopup();
andrewm@0 134
andrewm@5 135 // Create popup menu for keyboard controller retransmission
andrewm@5 136 void createKeyboardControllerPopup();
andrewm@8 137
andrewm@0 138 MainApplicationController *controller_; // Pointer to the main application controller
andrewm@0 139 MidiKeyboardSegment *keyboardSegment_; // Pointer to the segment this component controls
andrewm@37 140 int keyboardZone_; // Which zone this corresponds to (for UI sync purposes)
andrewm@0 141 std::vector<int> midiOutputDeviceIDs_;
andrewm@0 142 int lastSelectedMidiOutputID_;
andrewm@0 143 //[/UserVariables]
andrewm@0 144
andrewm@0 145 //==============================================================================
andrewm@5 146 ScopedPointer<MappingListComponent> mappingListComponent;
andrewm@0 147 ScopedPointer<GroupComponent> midiOutputGroupComponent;
andrewm@0 148 ScopedPointer<ComboBox> midiOutputDeviceComboBox;
andrewm@0 149 ScopedPointer<Label> label4;
andrewm@0 150 ScopedPointer<Label> label5;
andrewm@0 151 ScopedPointer<ComboBox> midiOutputModeComboBox;
andrewm@0 152 ScopedPointer<ToggleButton> midiOutputVoiceStealingButton;
andrewm@0 153 ScopedPointer<Label> label2;
andrewm@0 154 ScopedPointer<TextEditor> midiOutputChannelLowEditor;
andrewm@0 155 ScopedPointer<TextEditor> midiOutputChannelHighEditor;
andrewm@0 156 ScopedPointer<Label> label3;
andrewm@0 157 ScopedPointer<GroupComponent> midiOutputGroupComponent2;
andrewm@0 158 ScopedPointer<Label> label7;
andrewm@0 159 ScopedPointer<ComboBox> rangeLowComboBox;
andrewm@0 160 ScopedPointer<ComboBox> rangeHighComboBox;
andrewm@0 161 ScopedPointer<Label> label6;
andrewm@0 162 ScopedPointer<TextEditor> midiOutputTransposeEditor;
andrewm@0 163 ScopedPointer<Label> label8;
andrewm@0 164 ScopedPointer<TextButton> addMappingButton;
andrewm@5 165 ScopedPointer<Label> label9;
andrewm@5 166 ScopedPointer<TextEditor> pitchWheelRangeEditor;
andrewm@5 167 ScopedPointer<TextButton> keyboardControllersButton;
andrewm@0 168
andrewm@0 169
andrewm@0 170 //==============================================================================
andrewm@0 171 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (KeyboardZoneComponent)
andrewm@0 172 };
andrewm@0 173
andrewm@0 174 //[EndFile] You can add extra defines here...
andrewm@50 175 #endif // TOUCHKEYS_NO_GUI
andrewm@0 176 //[/EndFile]
andrewm@0 177
andrewm@0 178 #endif // __JUCE_HEADER_E3CF42F64919BE28__