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.

124 lines
4.6KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-9 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCER_COMPONENTEDITORCANVAS_H_37C33B56__
  19. #define __JUCER_COMPONENTEDITORCANVAS_H_37C33B56__
  20. #include "../../model/jucer_ComponentDocument.h"
  21. #include "../jucer_DocumentEditorComponent.h"
  22. class ComponentEditor;
  23. //==============================================================================
  24. class ComponentEditorCanvas : public Component,
  25. public ValueTree::Listener,
  26. public Timer
  27. {
  28. public:
  29. //==============================================================================
  30. ComponentEditorCanvas (ComponentEditor& editor_);
  31. ~ComponentEditorCanvas();
  32. //==============================================================================
  33. ComponentEditor& getEditor();
  34. ComponentDocument& getDocument();
  35. typedef SelectedItemSet<uint32> SelectedItems;
  36. SelectedItems& getSelection();
  37. class ComponentHolder;
  38. ComponentHolder* getComponentHolder() const;
  39. //==============================================================================
  40. void timerCallback();
  41. void paint (Graphics& g);
  42. void resized();
  43. void updateComponents();
  44. const Rectangle<int> getContentArea() const;
  45. void drawXAxis (Graphics& g, const Rectangle<int>& r);
  46. void drawYAxis (Graphics& g, const Rectangle<int>& r);
  47. //==============================================================================
  48. void valueTreePropertyChanged (ValueTree&, const var::identifier&) { updateComponents(); }
  49. void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) { updateComponents(); }
  50. void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) {}
  51. //==============================================================================
  52. void getSelectedItemProperties (Array <PropertyComponent*>& props);
  53. void deleteSelection();
  54. void selectionToFront();
  55. void selectionToBack();
  56. //==============================================================================
  57. void showSizeGuides();
  58. void hideSizeGuides();
  59. //==============================================================================
  60. class DragOperation;
  61. void beginDrag (const MouseEvent& e, const ResizableBorderComponent::Zone& zone);
  62. void continueDrag (const MouseEvent& e);
  63. void endDrag (const MouseEvent& e);
  64. private:
  65. ComponentEditor& editor;
  66. const BorderSize border;
  67. ScopedPointer <DragOperation> dragger;
  68. //==============================================================================
  69. class OverlayItemComponent : public Component
  70. {
  71. public:
  72. OverlayItemComponent (ComponentEditorCanvas& canvas_);
  73. void setBoundsInTargetSpace (const Rectangle<int>& r);
  74. ComponentDocument& getDocument() { return canvas.getDocument(); }
  75. protected:
  76. ComponentEditorCanvas& canvas;
  77. };
  78. friend class OverlayItemComponent;
  79. class ComponentResizeFrame;
  80. class MarkerComponent;
  81. class WholeComponentResizer;
  82. class OverlayComponent;
  83. //==============================================================================
  84. ComponentHolder* componentHolder;
  85. OverlayComponent* overlay;
  86. WholeComponentResizer* resizeFrame;
  87. SelectedItems selection;
  88. Component* getComponentForUID (const uint32 uid) const;
  89. const Array<Component*> getSelectedComps() const;
  90. const Array<Component*> getUnselectedComps() const;
  91. };
  92. #endif // __JUCER_COMPONENTEDITORCANVAS_H_37C33B56__