diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Source/GUI/KeyboardZoneComponent.h	Mon Nov 11 18:19:35 2013 +0000
@@ -0,0 +1,156 @@
+/*
+  ==============================================================================
+
+  This is an automatically generated GUI class created by the Introjucer!
+
+  Be careful when adding custom code to these files, as only the code within
+  the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
+  and re-saved.
+
+  Created with Introjucer version: 3.1.0
+
+  ------------------------------------------------------------------------------
+
+  The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
+  Copyright 2004-13 by Raw Material Software Ltd.
+
+  ==============================================================================
+*/
+
+#ifndef __JUCE_HEADER_E3CF42F64919BE28__
+#define __JUCE_HEADER_E3CF42F64919BE28__
+
+//[Headers]     -- You can add your own extra header files here --
+#include "JuceHeader.h"
+#include "MappingListComponent.h"
+#include "../MainApplicationController.h"
+#include "../TouchKeys/MidiKeyboardSegment.h"
+//[/Headers]
+
+
+
+//==============================================================================
+/**
+                                                                    //[Comments]
+    An auto-generated component, created by the Introjucer.
+
+    Describe your class and how it works here!
+                                                                    //[/Comments]
+*/
+class KeyboardZoneComponent  : public Component,
+                               public TextEditor::Listener,
+                               public ComboBoxListener,
+                               public ButtonListener
+{
+public:
+    //==============================================================================
+    KeyboardZoneComponent ();
+    ~KeyboardZoneComponent();
+
+    //==============================================================================
+    //[UserMethods]     -- You can add your own custom methods in this section.
+    void setMainApplicationController(MainApplicationController *controller) {
+        // Attach the user interface to the controller and vice-versa
+        controller_ = controller;
+        mappingListComponent->setMainApplicationController(controller_);
+        if(controller_ != 0) {
+            // Update the controls to reflect the current state
+            updateOutputDeviceList();
+            synchronize(true);
+        }
+    }
+
+    void setKeyboardSegment(MidiKeyboardSegment *segment) {
+        keyboardSegment_ = segment;
+        mappingListComponent->setKeyboardSegment(keyboardSegment_);
+        if(controller_ != 0) {
+            // Update the controls to reflect the current state
+            updateOutputDeviceList();
+            synchronize(true);
+        }
+    }
+
+    MidiKeyboardSegment* keyboardSegment() {
+        return keyboardSegment_;
+    }
+
+    // TextEditor listener methods
+    void textEditorTextChanged(TextEditor &editor) {}
+    void textEditorReturnKeyPressed(TextEditor &editor);
+    void textEditorEscapeKeyPressed(TextEditor &editor);
+    void textEditorFocusLost(TextEditor &editor);
+
+    // Synchronize UI state to match underlying state of the back end
+    void synchronize(bool forceUpdates = false);
+
+    // Update the range of the keyboard segment
+    void updateSegmentRange();
+
+    static void staticMappingChosenCallback(int result, KeyboardZoneComponent* component) {
+        if (result != 0 && component != 0)
+            component->mappingChosenCallback(result);
+    }
+    void mappingChosenCallback(int result);
+    //[/UserMethods]
+
+    void paint (Graphics& g);
+    void resized();
+    void comboBoxChanged (ComboBox* comboBoxThatHasChanged);
+    void buttonClicked (Button* buttonThatWasClicked);
+
+
+
+private:
+    //[UserVariables]   -- You can add your own custom variables in this section.
+
+    enum {
+        // Offsets between Juce UI IDs and positions in vector
+        kMidiOutputDeviceComboBoxOffset = 3,
+        kMidiOutputModeComboBoxOffset = 1
+    };
+
+    // Update list of MIDI output devices
+    void updateOutputDeviceList();
+
+    // Create popup menu for mapping list
+    void createMappingListPopup();
+
+    MainApplicationController *controller_; // Pointer to the main application controller
+    MidiKeyboardSegment *keyboardSegment_;  // Pointer to the segment this component controls
+    std::vector<int> midiOutputDeviceIDs_;
+    int lastSelectedMidiOutputID_;
+    //[/UserVariables]
+
+    //==============================================================================
+    ScopedPointer<GroupComponent> midiOutputGroupComponent;
+    ScopedPointer<ComboBox> midiOutputDeviceComboBox;
+    ScopedPointer<Label> label4;
+    ScopedPointer<Label> label5;
+    ScopedPointer<ComboBox> midiOutputModeComboBox;
+    ScopedPointer<ToggleButton> midiOutputVoiceStealingButton;
+    ScopedPointer<Label> label2;
+    ScopedPointer<TextEditor> midiOutputChannelLowEditor;
+    ScopedPointer<TextEditor> midiOutputChannelHighEditor;
+    ScopedPointer<Label> label3;
+    ScopedPointer<GroupComponent> midiOutputGroupComponent2;
+    ScopedPointer<Label> label7;
+    ScopedPointer<ComboBox> rangeLowComboBox;
+    ScopedPointer<ComboBox> rangeHighComboBox;
+    ScopedPointer<ToggleButton> useAftertouchButton;
+    ScopedPointer<ToggleButton> usePitchWheelButton;
+    ScopedPointer<ToggleButton> useControllersButton;
+    ScopedPointer<Label> label6;
+    ScopedPointer<TextEditor> midiOutputTransposeEditor;
+    ScopedPointer<MappingListComponent> mappingListComponent;
+    ScopedPointer<Label> label8;
+    ScopedPointer<TextButton> addMappingButton;
+
+
+    //==============================================================================
+    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (KeyboardZoneComponent)
+};
+
+//[EndFile] You can add extra defines here...
+//[/EndFile]
+
+#endif   // __JUCE_HEADER_E3CF42F64919BE28__