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.

99 lines
3.4KB

  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_DRAWABLEEDITOR_JUCEHEADER__
  19. #define __JUCER_DRAWABLEEDITOR_JUCEHEADER__
  20. #include "../jucer_DocumentEditorComponent.h"
  21. class DrawableObjectComponent;
  22. //==============================================================================
  23. /**
  24. */
  25. class DrawableEditor : public DocumentEditorComponent
  26. {
  27. public:
  28. //==============================================================================
  29. DrawableEditor (OpenDocumentManager::Document* document,
  30. Project* project,
  31. DrawableDocument* drawableDocument);
  32. ~DrawableEditor();
  33. void paint (Graphics& g);
  34. void resized();
  35. DrawableDocument& getDocument() const { return *drawableDocument; }
  36. static int64 getHashForNode (const ValueTree& node);
  37. //==============================================================================
  38. class Canvas : public Component,
  39. public LassoSource <int64>
  40. {
  41. public:
  42. Canvas (DrawableEditor& editor_);
  43. ~Canvas();
  44. void createRootObject();
  45. const Point<int> getOrigin() const throw() { return origin; }
  46. void paint (Graphics& g);
  47. void mouseDown (const MouseEvent& e);
  48. void mouseDrag (const MouseEvent& e);
  49. void mouseUp (const MouseEvent& e);
  50. void childBoundsChanged (Component* child);
  51. void updateSize();
  52. void findLassoItemsInArea (Array <int64>& itemsFound, int x, int y, int width, int height);
  53. SelectedItemSet <int64>& getLassoSelection();
  54. private:
  55. DrawableEditor& editor;
  56. ScopedPointer <DrawableObjectComponent> rootObject;
  57. ScopedPointer <LassoComponent <int64> > lasso;
  58. BorderSize border;
  59. Point<int> origin;
  60. };
  61. Canvas* getCanvas() const { return static_cast <Canvas*> (viewport->getViewedComponent()); }
  62. SelectedItemSet <int64> selectedItems;
  63. //==============================================================================
  64. juce_UseDebuggingNewOperator
  65. private:
  66. friend class Canvas;
  67. Project* project;
  68. DrawableDocument* drawableDocument;
  69. Viewport* viewport;
  70. Component* rightHandPanel;
  71. };
  72. #endif // __JUCER_DRAWABLEEDITOR_JUCEHEADER__