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.

142 lines
4.7KB

  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 __JUCE_FILTERGRAPHEDITOR_JUCEHEADER__
  19. #define __JUCE_FILTERGRAPHEDITOR_JUCEHEADER__
  20. #include "FilterGraph.h"
  21. class FilterComponent;
  22. class ConnectorComponent;
  23. class PinComponent;
  24. //==============================================================================
  25. /**
  26. A panel that displays and edits a FilterGraph.
  27. */
  28. class GraphEditorPanel : public Component,
  29. public ChangeListener
  30. {
  31. public:
  32. GraphEditorPanel (FilterGraph& graph);
  33. ~GraphEditorPanel();
  34. void paint (Graphics& g);
  35. void mouseDown (const MouseEvent& e);
  36. void createNewPlugin (const PluginDescription* desc, int x, int y);
  37. FilterComponent* getComponentForFilter (const uint32 filterID) const;
  38. ConnectorComponent* getComponentForConnection (const AudioProcessorGraph::Connection& conn) const;
  39. PinComponent* findPinAt (const int x, const int y) const;
  40. void resized();
  41. void changeListenerCallback (void*);
  42. void updateComponents();
  43. //==============================================================================
  44. void beginConnectorDrag (const uint32 sourceFilterID, const int sourceFilterChannel,
  45. const uint32 destFilterID, const int destFilterChannel,
  46. const MouseEvent& e);
  47. void dragConnector (const MouseEvent& e);
  48. void endDraggingConnector (const MouseEvent& e);
  49. //==============================================================================
  50. juce_UseDebuggingNewOperator
  51. private:
  52. FilterGraph& graph;
  53. ConnectorComponent* draggingConnector;
  54. GraphEditorPanel (const GraphEditorPanel&);
  55. const GraphEditorPanel& operator= (const GraphEditorPanel&);
  56. };
  57. //==============================================================================
  58. /**
  59. A panel that embeds a GraphEditorPanel with a midi keyboard at the bottom.
  60. It also manages the graph itself, and plays it.
  61. */
  62. class GraphDocumentComponent : public Component
  63. {
  64. public:
  65. //==============================================================================
  66. GraphDocumentComponent (AudioDeviceManager* deviceManager);
  67. ~GraphDocumentComponent();
  68. //==============================================================================
  69. void createNewPlugin (const PluginDescription* desc, int x, int y);
  70. //==============================================================================
  71. FilterGraph graph;
  72. //==============================================================================
  73. void resized();
  74. //==============================================================================
  75. juce_UseDebuggingNewOperator
  76. private:
  77. AudioDeviceManager* deviceManager;
  78. AudioProcessorPlayer graphPlayer;
  79. MidiKeyboardState keyState;
  80. GraphEditorPanel* graphPanel;
  81. Component* keyboardComp;
  82. Component* statusBar;
  83. };
  84. //==============================================================================
  85. /** A desktop window containing a plugin's UI.
  86. */
  87. class PluginWindow : public DocumentWindow
  88. {
  89. PluginWindow (Component* const uiComp,
  90. AudioProcessorGraph::Node* owner_,
  91. const bool isGeneric_);
  92. public:
  93. static PluginWindow* getWindowFor (AudioProcessorGraph::Node* node,
  94. bool useGenericView);
  95. static void closeCurrentlyOpenWindowsFor (const uint32 nodeId);
  96. static void closeAllCurrentlyOpenWindows();
  97. ~PluginWindow();
  98. void moved();
  99. void closeButtonPressed();
  100. private:
  101. AudioProcessorGraph::Node* owner;
  102. bool isGeneric;
  103. };
  104. #endif