The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
3.1KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #pragma once
  18. #include "../jucer_JucerDocument.h"
  19. #include "jucer_ComponentLayoutEditor.h"
  20. #include "jucer_PaintRoutineEditor.h"
  21. #include "jucer_ComponentLayoutPanel.h"
  22. //==============================================================================
  23. /**
  24. */
  25. class JucerDocumentEditor : public Component,
  26. public ApplicationCommandTarget,
  27. public ChangeListener
  28. {
  29. public:
  30. //==============================================================================
  31. JucerDocumentEditor (JucerDocument* const document);
  32. ~JucerDocumentEditor();
  33. JucerDocument* getDocument() const noexcept { return document; }
  34. void refreshPropertiesPanel() const;
  35. void updateTabs();
  36. void showLayout();
  37. void showGraphics (PaintRoutine* routine);
  38. void setViewportToLastPos (Viewport* vp, EditingPanelBase& editor);
  39. void storeLastViewportPos (Viewport* vp, EditingPanelBase& editor);
  40. Image createComponentLayerSnapshot() const;
  41. //==============================================================================
  42. void paint (Graphics& g);
  43. void resized();
  44. void changeListenerCallback (ChangeBroadcaster*);
  45. bool keyPressed (const KeyPress&);
  46. //==============================================================================
  47. ApplicationCommandTarget* getNextCommandTarget();
  48. void getAllCommands (Array <CommandID>&);
  49. void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result);
  50. bool perform (const InvocationInfo&);
  51. static JucerDocumentEditor* getActiveDocumentHolder();
  52. private:
  53. ScopedPointer<JucerDocument> document;
  54. TabbedComponent tabbedComponent;
  55. ComponentLayoutPanel* compLayoutPanel;
  56. bool isSomethingSelected() const;
  57. int lastViewportX, lastViewportY;
  58. double currentZoomLevel;
  59. // only non-zero if a layout tab is selected
  60. ComponentLayout* getCurrentLayout() const;
  61. // only non-zero if a graphics tab is selected
  62. PaintRoutine* getCurrentPaintRoutine() const;
  63. void setZoom (double scale);
  64. double getZoom() const;
  65. void addElement (const int index);
  66. void addComponent (const int index);
  67. };