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.

97 lines
3.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software 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. #ifndef __JUCER_JUCERDOCUMENTEDITOR_JUCEHEADER__
  18. #define __JUCER_JUCERDOCUMENTEDITOR_JUCEHEADER__
  19. #include "../jucer_JucerDocument.h"
  20. #include "jucer_ComponentLayoutEditor.h"
  21. #include "jucer_PaintRoutineEditor.h"
  22. #include "jucer_ComponentLayoutPanel.h"
  23. //==============================================================================
  24. /**
  25. */
  26. class JucerDocumentEditor : public Component,
  27. public ApplicationCommandTarget,
  28. public ChangeListener
  29. {
  30. public:
  31. //==============================================================================
  32. JucerDocumentEditor (JucerDocument* const document);
  33. ~JucerDocumentEditor();
  34. JucerDocument* getDocument() const noexcept { return document; }
  35. void refreshPropertiesPanel() const;
  36. void updateTabs();
  37. void showLayout();
  38. void showGraphics (PaintRoutine* routine);
  39. void setViewportToLastPos (Viewport* vp, EditingPanelBase& editor);
  40. void storeLastViewportPos (Viewport* vp, EditingPanelBase& editor);
  41. Image createComponentLayerSnapshot() const;
  42. //==============================================================================
  43. void paint (Graphics& g);
  44. void resized();
  45. void changeListenerCallback (ChangeBroadcaster*);
  46. bool keyPressed (const KeyPress&);
  47. //==============================================================================
  48. ApplicationCommandTarget* getNextCommandTarget();
  49. void getAllCommands (Array <CommandID>&);
  50. void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result);
  51. bool perform (const InvocationInfo&);
  52. static JucerDocumentEditor* getActiveDocumentHolder();
  53. private:
  54. ScopedPointer<JucerDocument> document;
  55. TabbedComponent tabbedComponent;
  56. ComponentLayoutPanel* compLayoutPanel;
  57. bool isSomethingSelected() const;
  58. int lastViewportX, lastViewportY;
  59. double currentZoomLevel;
  60. // only non-zero if a layout tab is selected
  61. ComponentLayout* getCurrentLayout() const;
  62. // only non-zero if a graphics tab is selected
  63. PaintRoutine* getCurrentPaintRoutine() const;
  64. void setZoom (double scale);
  65. double getZoom() const;
  66. void addElement (const int index);
  67. void addComponent (const int index);
  68. };
  69. #endif // __JUCER_JUCERDOCUMENTEDITOR_JUCEHEADER__