| 8 | #include "CtrlrInlineUtilitiesGUI.h" |
| 9 | |
| 10 | CtrlrEditor::CtrlrEditor (CtrlrProcessor *_ownerFilter, CtrlrManager &_owner) |
| 11 | : AudioProcessorEditor (_ownerFilter), ownerFilter(_ownerFilter), |
| 12 | owner(_owner), resizer(this, 0), |
| 13 | tempResult(Result::ok()), |
| 14 | menuHandlerCalled(false), |
| 15 | lastCommandInvocationMillis(0) |
| 16 | { |
| 17 | setColourScheme(gui::colourSchemeFromProperty(owner.getProperty(Ids::ctrlrColourScheme))); |
| 18 | LookAndFeel::setDefaultLookAndFeel(this); |
| 19 | Rectangle<int> editorRect; |
| 20 | // http://www.juce.com/forum/topic/applicationcommandmanager-menus-not-active-annoyance#new |
| 21 | owner.getCommandManager().setFirstCommandTarget (this); |
| 22 | |
| 23 | addAndMakeVisible (menuBar = new MenuBarComponent (this)); |
| 24 | // menuBarLookAndFeel = new CtrlrMenuBarLookAndFeel (*this); |
| 25 | |
| 26 | setApplicationCommandManagerToWatch (&owner.getCommandManager()); |
| 27 | |
| 28 | owner.getCommandManager().registerAllCommandsForTarget (this); |
| 29 | owner.getCommandManager().registerAllCommandsForTarget (JUCEApplication::getInstance()); |
| 30 | ScopedPointer <XmlElement> xml(XmlDocument::parse(owner.getProperty(Ids::ctrlrKeyboardMapping)).release()); |
| 31 | |
| 32 | if (xml) |
| 33 | { |
| 34 | owner.getCommandManager().getKeyMappings()->restoreFromXml (*xml); |
| 35 | } |
| 36 | |
| 37 | owner.setEditor (this); |
| 38 | |
| 39 | addAndMakeVisible (&owner.getCtrlrDocumentPanel()); |
| 40 | |
| 41 | if (!JUCEApplication::isStandaloneApp()) |
| 42 | { |
| 43 | if (owner.getInstanceMode() != InstanceSingleRestriced) |
| 44 | { |
| 45 | /* Restricted instances don't get to be resizable */ |
| 46 | addAndMakeVisible (&resizer); |
| 47 | resizer.setAlwaysOnTop (false); |
| 48 | resizer.grabKeyboardFocus(); |
| 49 | resizer.toFront (true); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | if (owner.getProperty (Ids::ctrlrEditorBounds).toString() != "") |
| 54 | { |
| 55 | if (owner.getInstanceMode() != InstanceSingle |
| 56 | && owner.getInstanceMode() != InstanceSingleRestriced) |
| 57 | { |
| 58 | editorRect = VAR2RECT(owner.getProperty (Ids::ctrlrEditorBounds)); |
| 59 | } |
| 60 | else if (owner.getActivePanel()) |
| 61 | { |
| 62 | editorRect = VAR2RECT(owner.getActivePanel()->getEditor()->getProperty(Ids::uiPanelCanvasRectangle)); |
| 63 | |
| 64 | if ((bool)owner.getActivePanel()->getEditor()->getProperty(Ids::uiPanelMenuBarVisible)) |
| 65 | editorRect.setHeight (editorRect.getHeight() + (int)owner.getProperty(Ids::ctrlrMenuBarHeight)); |
| 66 | else |
| 67 | editorRect.setHeight (editorRect.getHeight()); |
nothing calls this directly
no test coverage detected