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.

77 lines
2.6KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. #pragma once
  14. #include "../jucer_JucerDocument.h"
  15. #include "../jucer_PaintRoutine.h"
  16. #include "jucer_SnapGridPainter.h"
  17. class JucerDocumentEditor;
  18. //==============================================================================
  19. class PaintRoutineEditor : public Component,
  20. public ChangeListener,
  21. public LassoSource <PaintElement*>,
  22. public FileDragAndDropTarget
  23. {
  24. public:
  25. //==============================================================================
  26. PaintRoutineEditor (PaintRoutine& graphics,
  27. JucerDocument& document,
  28. JucerDocumentEditor* const docHolder);
  29. ~PaintRoutineEditor();
  30. //==============================================================================
  31. void paint (Graphics& g);
  32. void paintOverChildren (Graphics& g);
  33. void resized();
  34. void changeListenerCallback (ChangeBroadcaster*);
  35. void mouseDown (const MouseEvent& e);
  36. void mouseDrag (const MouseEvent& e);
  37. void mouseUp (const MouseEvent& e);
  38. void visibilityChanged();
  39. void findLassoItemsInArea (Array <PaintElement*>& results, const Rectangle<int>& area);
  40. SelectedItemSet <PaintElement*>& getLassoSelection();
  41. bool isInterestedInFileDrag (const StringArray& files);
  42. void filesDropped (const StringArray& filenames, int x, int y);
  43. Rectangle<int> getComponentArea() const;
  44. //==============================================================================
  45. void refreshAllElements();
  46. private:
  47. PaintRoutine& graphics;
  48. JucerDocument& document;
  49. JucerDocumentEditor* const documentHolder;
  50. LassoComponent <PaintElement*> lassoComp;
  51. SnapGridPainter grid;
  52. Image componentOverlay;
  53. float componentOverlayOpacity;
  54. Colour currentBackgroundColour;
  55. void removeAllElementComps();
  56. void updateComponentOverlay();
  57. void updateChildBounds();
  58. };