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.

91 lines
3.2KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 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_PAINTROUTINEEDITOR_JUCEHEADER__
  19. #define __JUCER_PAINTROUTINEEDITOR_JUCEHEADER__
  20. #include "../jucer_JucerDocument.h"
  21. #include "../jucer_PaintRoutine.h"
  22. #include "jucer_SnapGridPainter.h"
  23. class JucerDocumentEditor;
  24. //==============================================================================
  25. /**
  26. */
  27. class PaintRoutineEditor : public Component,
  28. public ChangeListener,
  29. public LassoSource <PaintElement*>,
  30. public FileDragAndDropTarget
  31. {
  32. public:
  33. //==============================================================================
  34. PaintRoutineEditor (PaintRoutine& graphics,
  35. JucerDocument& document,
  36. JucerDocumentEditor* const docHolder);
  37. ~PaintRoutineEditor();
  38. //==============================================================================
  39. void paint (Graphics& g);
  40. void paintOverChildren (Graphics& g);
  41. void resized();
  42. void changeListenerCallback (ChangeBroadcaster*);
  43. void mouseDown (const MouseEvent& e);
  44. void mouseDrag (const MouseEvent& e);
  45. void mouseUp (const MouseEvent& e);
  46. void visibilityChanged();
  47. void findLassoItemsInArea (Array <PaintElement*>& results, const Rectangle<int>& area);
  48. SelectedItemSet <PaintElement*>& getLassoSelection();
  49. bool isInterestedInFileDrag (const StringArray& files);
  50. void filesDropped (const StringArray& filenames, int x, int y);
  51. Rectangle<int> getComponentArea() const;
  52. //==============================================================================
  53. void refreshAllElements();
  54. private:
  55. PaintRoutine& graphics;
  56. JucerDocument& document;
  57. JucerDocumentEditor* const documentHolder;
  58. LassoComponent <PaintElement*> lassoComp;
  59. SnapGridPainter grid;
  60. Image componentOverlay;
  61. float componentOverlayOpacity;
  62. Colour currentBackgroundColour;
  63. void removeAllElementComps();
  64. void updateComponentOverlay();
  65. void updateChildBounds();
  66. };
  67. #endif // __JUCER_PAINTROUTINEEDITOR_JUCEHEADER__