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.

86 lines
2.9KB

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