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

merge
author Andrew McPherson <andrewm@eecs.qmul.ac.uk>
date Fri, 23 Nov 2018 15:48:14 +0000
parents 114427cb39f0
children
rev   line source
andrewm@41 1 /*
andrewm@41 2 ==============================================================================
andrewm@41 3
andrewm@41 4 MappingExtendedEditorWindow.h
andrewm@41 5 Created: 18 Jun 2014 10:57:00am
andrewm@41 6 Author: Andrew McPherson
andrewm@41 7
andrewm@41 8 ==============================================================================
andrewm@41 9 */
andrewm@41 10
andrewm@41 11 #ifndef MAPPINGEXTENDEDEDITORWINDOW_H_INCLUDED
andrewm@41 12 #define MAPPINGEXTENDEDEDITORWINDOW_H_INCLUDED
andrewm@41 13
andrewm@50 14 #ifndef TOUCHKEYS_NO_GUI
andrewm@50 15
andrewm@41 16 #include "../../JuceLibraryCode/JuceHeader.h"
andrewm@41 17 #include "../TouchKeys/MidiKeyboardSegment.h"
andrewm@41 18 #include "../Mappings/MappingFactory.h"
andrewm@41 19 #include "MappingListComponent.h"
andrewm@41 20
andrewm@41 21 //==============================================================================
andrewm@41 22 /*
andrewm@41 23 */
andrewm@41 24 class MappingExtendedEditorWindow : public DocumentWindow
andrewm@41 25 {
andrewm@41 26 public:
andrewm@41 27 MappingExtendedEditorWindow(MappingListComponent& listComponent,
andrewm@41 28 MidiKeyboardSegment& segment, MappingFactory& factory)
andrewm@41 29 : DocumentWindow("", Colours::lightgrey, DocumentWindow::minimiseButton | DocumentWindow::closeButton),
andrewm@41 30 listComponent_(listComponent), segment_(segment), factory_(factory), editor_(0)
andrewm@41 31 {
andrewm@41 32 setUsingNativeTitleBar(true);
andrewm@41 33 setResizable(false, false);
andrewm@41 34
andrewm@41 35 if((segment_.indexOfMappingFactory(&factory_) >= 0) && factory_.hasExtendedEditor()) {
andrewm@41 36 editor_ = factory_.createExtendedEditor();
andrewm@41 37
andrewm@41 38 // Set properties
andrewm@41 39 setContentOwned(editor_, true);
andrewm@41 40
andrewm@41 41 // Start interface in sync
andrewm@41 42 editor_->synchronize();
andrewm@41 43 }
andrewm@41 44
andrewm@41 45 // Show window
andrewm@45 46 setTopLeftPosition(60,60);
andrewm@41 47 setVisible(true);
andrewm@41 48 }
andrewm@41 49
andrewm@41 50 ~MappingExtendedEditorWindow()
andrewm@41 51 {
andrewm@41 52 }
andrewm@41 53
andrewm@41 54 // Method used by Juce timer which we will use for periodic UI updates
andrewm@41 55 // from the underlying system state
andrewm@41 56 void synchronize() {
andrewm@41 57 if(editor_ == 0)
andrewm@41 58 return;
andrewm@41 59 editor_->synchronize();
andrewm@41 60 setName(editor_->getDescription());
andrewm@41 61 }
andrewm@41 62
andrewm@41 63 // Check whether this window still points to a valid mapping
andrewm@41 64 bool isValid() {
andrewm@41 65 if(segment_.indexOfMappingFactory(&factory_) < 0)
andrewm@41 66 return false;
andrewm@41 67 return true;
andrewm@41 68 }
andrewm@41 69
andrewm@41 70 // Return the factory associated with this window
andrewm@41 71 MappingFactory *factory() {
andrewm@41 72 return &factory_;
andrewm@41 73 }
andrewm@41 74
andrewm@41 75 void closeButtonPressed() {
andrewm@41 76 // Close the window and delete it
andrewm@41 77 listComponent_.closeExtendedEditorWindow(this);
andrewm@41 78 }
andrewm@41 79
andrewm@41 80 void resized() {
andrewm@41 81 // This method is where you should set the bounds of any child
andrewm@41 82 // components that your component contains..
andrewm@41 83 }
andrewm@41 84
andrewm@41 85 private:
andrewm@41 86 MappingListComponent& listComponent_;
andrewm@41 87 MidiKeyboardSegment& segment_;
andrewm@41 88 MappingFactory& factory_;
andrewm@41 89 MappingEditorComponent *editor_;
andrewm@41 90
andrewm@41 91 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MappingExtendedEditorWindow)
andrewm@41 92 };
andrewm@41 93
andrewm@50 94 #endif // TOUCHKEYS_NO_GUI
andrewm@41 95
andrewm@41 96 #endif // MAPPINGEXTENDEDEDITORWINDOW_H_INCLUDED