annotate Source/GUI/KeyboardZoneComponent.h @ 0:3580ffe87dc8

First commit of TouchKeys public pre-release.
author Andrew McPherson <andrewm@eecs.qmul.ac.uk>
date Mon, 11 Nov 2013 18:19:35 +0000
parents
children 0bcbe28a25a2
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@0 24 #include "JuceHeader.h"
andrewm@0 25 #include "MappingListComponent.h"
andrewm@0 26 #include "../MainApplicationController.h"
andrewm@0 27 #include "../TouchKeys/MidiKeyboardSegment.h"
andrewm@0 28 //[/Headers]
andrewm@0 29
andrewm@0 30
andrewm@0 31
andrewm@0 32 //==============================================================================
andrewm@0 33 /**
andrewm@0 34 //[Comments]
andrewm@0 35 An auto-generated component, created by the Introjucer.
andrewm@0 36
andrewm@0 37 Describe your class and how it works here!
andrewm@0 38 //[/Comments]
andrewm@0 39 */
andrewm@0 40 class KeyboardZoneComponent : public Component,
andrewm@0 41 public TextEditor::Listener,
andrewm@0 42 public ComboBoxListener,
andrewm@0 43 public ButtonListener
andrewm@0 44 {
andrewm@0 45 public:
andrewm@0 46 //==============================================================================
andrewm@0 47 KeyboardZoneComponent ();
andrewm@0 48 ~KeyboardZoneComponent();
andrewm@0 49
andrewm@0 50 //==============================================================================
andrewm@0 51 //[UserMethods] -- You can add your own custom methods in this section.
andrewm@0 52 void setMainApplicationController(MainApplicationController *controller) {
andrewm@0 53 // Attach the user interface to the controller and vice-versa
andrewm@0 54 controller_ = controller;
andrewm@0 55 mappingListComponent->setMainApplicationController(controller_);
andrewm@0 56 if(controller_ != 0) {
andrewm@0 57 // Update the controls to reflect the current state
andrewm@0 58 updateOutputDeviceList();
andrewm@0 59 synchronize(true);
andrewm@0 60 }
andrewm@0 61 }
andrewm@0 62
andrewm@0 63 void setKeyboardSegment(MidiKeyboardSegment *segment) {
andrewm@0 64 keyboardSegment_ = segment;
andrewm@0 65 mappingListComponent->setKeyboardSegment(keyboardSegment_);
andrewm@0 66 if(controller_ != 0) {
andrewm@0 67 // Update the controls to reflect the current state
andrewm@0 68 updateOutputDeviceList();
andrewm@0 69 synchronize(true);
andrewm@0 70 }
andrewm@0 71 }
andrewm@0 72
andrewm@0 73 MidiKeyboardSegment* keyboardSegment() {
andrewm@0 74 return keyboardSegment_;
andrewm@0 75 }
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@0 94 //[/UserMethods]
andrewm@0 95
andrewm@0 96 void paint (Graphics& g);
andrewm@0 97 void resized();
andrewm@0 98 void comboBoxChanged (ComboBox* comboBoxThatHasChanged);
andrewm@0 99 void buttonClicked (Button* buttonThatWasClicked);
andrewm@0 100
andrewm@0 101
andrewm@0 102
andrewm@0 103 private:
andrewm@0 104 //[UserVariables] -- You can add your own custom variables in this section.
andrewm@0 105
andrewm@0 106 enum {
andrewm@0 107 // Offsets between Juce UI IDs and positions in vector
andrewm@0 108 kMidiOutputDeviceComboBoxOffset = 3,
andrewm@0 109 kMidiOutputModeComboBoxOffset = 1
andrewm@0 110 };
andrewm@0 111
andrewm@0 112 // Update list of MIDI output devices
andrewm@0 113 void updateOutputDeviceList();
andrewm@0 114
andrewm@0 115 // Create popup menu for mapping list
andrewm@0 116 void createMappingListPopup();
andrewm@0 117
andrewm@0 118 MainApplicationController *controller_; // Pointer to the main application controller
andrewm@0 119 MidiKeyboardSegment *keyboardSegment_; // Pointer to the segment this component controls
andrewm@0 120 std::vector<int> midiOutputDeviceIDs_;
andrewm@0 121 int lastSelectedMidiOutputID_;
andrewm@0 122 //[/UserVariables]
andrewm@0 123
andrewm@0 124 //==============================================================================
andrewm@0 125 ScopedPointer<GroupComponent> midiOutputGroupComponent;
andrewm@0 126 ScopedPointer<ComboBox> midiOutputDeviceComboBox;
andrewm@0 127 ScopedPointer<Label> label4;
andrewm@0 128 ScopedPointer<Label> label5;
andrewm@0 129 ScopedPointer<ComboBox> midiOutputModeComboBox;
andrewm@0 130 ScopedPointer<ToggleButton> midiOutputVoiceStealingButton;
andrewm@0 131 ScopedPointer<Label> label2;
andrewm@0 132 ScopedPointer<TextEditor> midiOutputChannelLowEditor;
andrewm@0 133 ScopedPointer<TextEditor> midiOutputChannelHighEditor;
andrewm@0 134 ScopedPointer<Label> label3;
andrewm@0 135 ScopedPointer<GroupComponent> midiOutputGroupComponent2;
andrewm@0 136 ScopedPointer<Label> label7;
andrewm@0 137 ScopedPointer<ComboBox> rangeLowComboBox;
andrewm@0 138 ScopedPointer<ComboBox> rangeHighComboBox;
andrewm@0 139 ScopedPointer<ToggleButton> useAftertouchButton;
andrewm@0 140 ScopedPointer<ToggleButton> usePitchWheelButton;
andrewm@0 141 ScopedPointer<ToggleButton> useControllersButton;
andrewm@0 142 ScopedPointer<Label> label6;
andrewm@0 143 ScopedPointer<TextEditor> midiOutputTransposeEditor;
andrewm@0 144 ScopedPointer<MappingListComponent> mappingListComponent;
andrewm@0 145 ScopedPointer<Label> label8;
andrewm@0 146 ScopedPointer<TextButton> addMappingButton;
andrewm@0 147
andrewm@0 148
andrewm@0 149 //==============================================================================
andrewm@0 150 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (KeyboardZoneComponent)
andrewm@0 151 };
andrewm@0 152
andrewm@0 153 //[EndFile] You can add extra defines here...
andrewm@0 154 //[/EndFile]
andrewm@0 155
andrewm@0 156 #endif // __JUCE_HEADER_E3CF42F64919BE28__