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.

104 lines
3.2KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-10 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. #include "../../jucer_Headers.h"
  19. #include "../../model/Drawable/jucer_DrawableDocument.h"
  20. #include "../jucer_JucerTreeViewBase.h"
  21. #include "../Editor Base/jucer_EditorDragOperation.h"
  22. #include "../Editor Base/jucer_EditorPanel.h"
  23. #include "../Editor Base/jucer_EditorCanvas.h"
  24. #include "jucer_DrawableEditor.h"
  25. #include "jucer_DrawableEditorCanvas.h"
  26. #include "jucer_DrawableEditorTreeView.h"
  27. #include "jucer_DrawableEditorToolbar.h"
  28. //==============================================================================
  29. class DrawableEditor::Panel : public EditorPanelBase
  30. {
  31. public:
  32. Panel (DrawableEditor& editor_)
  33. : toolbarFactory (editor_),
  34. editor (editor_)
  35. {
  36. }
  37. ~Panel()
  38. {
  39. shutdown();
  40. }
  41. void createCanvas()
  42. {
  43. initialise (new DrawableEditorCanvas (editor), toolbarFactory,
  44. DrawableTreeViewItem::createItemForNode (editor, editor.getDocument().getRootDrawableNode()));
  45. }
  46. SelectedItemSet<String>& getSelection()
  47. {
  48. return editor.getSelection();
  49. }
  50. void getSelectedItemProperties (Array<PropertyComponent*>& newComps)
  51. {
  52. //editor.getSelectedItemProperties (newComps);
  53. }
  54. private:
  55. DrawableEditorToolbarFactory toolbarFactory;
  56. DrawableEditor& editor;
  57. };
  58. //==============================================================================
  59. DrawableEditor::DrawableEditor (OpenDocumentManager::Document* document,
  60. Project* project_,
  61. DrawableDocument* drawableDocument_)
  62. : DocumentEditorComponent (document),
  63. project (project_),
  64. drawableDocument (drawableDocument_)
  65. {
  66. jassert (drawableDocument_ != 0);
  67. setOpaque (true);
  68. addAndMakeVisible (panel = new Panel (*this));
  69. panel->createCanvas();
  70. }
  71. DrawableEditor::~DrawableEditor()
  72. {
  73. deleteAllChildren();
  74. }
  75. void DrawableEditor::paint (Graphics& g)
  76. {
  77. g.fillAll (Colours::white);
  78. }
  79. void DrawableEditor::resized()
  80. {
  81. panel->setBounds (getLocalBounds());
  82. }