| @@ -43,21 +43,12 @@ ifeq ($(CONFIG),Release) | |||
| endif | |||
| OBJECTS := \ | |||
| $(OBJDIR)/jucer_CodeGenerator_294a5b95.o \ | |||
| $(OBJDIR)/jucer_ComponentDocument_d2c1f367.o \ | |||
| $(OBJDIR)/jucer_ComponentTypeManager_21664b47.o \ | |||
| $(OBJDIR)/jucer_DrawableDocument_d699b7df.o \ | |||
| $(OBJDIR)/jucer_DrawableTypeHandler_5b2f1d76.o \ | |||
| $(OBJDIR)/jucer_NewFileWizard_6b466712.o \ | |||
| $(OBJDIR)/jucer_Project_60ace9e4.o \ | |||
| $(OBJDIR)/jucer_ProjectExporter_8b6a09e5.o \ | |||
| $(OBJDIR)/jucer_ProjectWizard_2f72feaf.o \ | |||
| $(OBJDIR)/jucer_ResourceFile_4a6c0189.o \ | |||
| $(OBJDIR)/jucer_SourceCodeEditor_39e7ba7a.o \ | |||
| $(OBJDIR)/jucer_ComponentEditor_bb50044d.o \ | |||
| $(OBJDIR)/jucer_ComponentViewer_c7a43a72.o \ | |||
| $(OBJDIR)/jucer_DrawableEditor_fdd9b221.o \ | |||
| $(OBJDIR)/jucer_EditorCanvas_26232846.o \ | |||
| $(OBJDIR)/jucer_DocumentEditorComponent_18f9dc69.o \ | |||
| $(OBJDIR)/jucer_JucerTreeViewBase_15bcb6cd.o \ | |||
| $(OBJDIR)/jucer_MainWindow_a480b21f.o \ | |||
| @@ -94,31 +85,6 @@ clean: | |||
| -@rm -rf $(OBJDIR)/* | |||
| -@rm -rf $(OBJDIR) | |||
| $(OBJDIR)/jucer_CodeGenerator_294a5b95.o: ../../Source/model/Component/jucer_CodeGenerator.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling jucer_CodeGenerator.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/jucer_ComponentDocument_d2c1f367.o: ../../Source/model/Component/jucer_ComponentDocument.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling jucer_ComponentDocument.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/jucer_ComponentTypeManager_21664b47.o: ../../Source/model/Component/Types/jucer_ComponentTypeManager.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling jucer_ComponentTypeManager.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/jucer_DrawableDocument_d699b7df.o: ../../Source/model/Drawable/jucer_DrawableDocument.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling jucer_DrawableDocument.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/jucer_DrawableTypeHandler_5b2f1d76.o: ../../Source/model/Drawable/jucer_DrawableTypeHandler.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling jucer_DrawableTypeHandler.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/jucer_NewFileWizard_6b466712.o: ../../Source/model/Project/jucer_NewFileWizard.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling jucer_NewFileWizard.cpp" | |||
| @@ -149,26 +115,6 @@ $(OBJDIR)/jucer_SourceCodeEditor_39e7ba7a.o: ../../Source/ui/Code\ Editor/jucer_ | |||
| @echo "Compiling jucer_SourceCodeEditor.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/jucer_ComponentEditor_bb50044d.o: ../../Source/ui/Component\ Editor/jucer_ComponentEditor.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling jucer_ComponentEditor.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/jucer_ComponentViewer_c7a43a72.o: ../../Source/ui/Component\ Editor/jucer_ComponentViewer.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling jucer_ComponentViewer.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/jucer_DrawableEditor_fdd9b221.o: ../../Source/ui/Drawable\ Editor/jucer_DrawableEditor.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling jucer_DrawableEditor.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/jucer_EditorCanvas_26232846.o: ../../Source/ui/Editor\ Base/jucer_EditorCanvas.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling jucer_EditorCanvas.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/jucer_DocumentEditorComponent_18f9dc69.o: ../../Source/ui/jucer_DocumentEditorComponent.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling jucer_DocumentEditorComponent.cpp" | |||
| @@ -17,21 +17,12 @@ | |||
| DBE3CE9482B19CF1AE700805 = { isa = PBXBuildFile; fileRef = 23CF69B4C644D1E6E61E5C82; }; | |||
| 93C9F3F27602A33DDC9C2250 = { isa = PBXBuildFile; fileRef = 2767E1D082874D301D5D5F43; }; | |||
| 2E6836738CE7EB452FDC7E9A = { isa = PBXBuildFile; fileRef = D9FB1A5365FEEB854A0FF7BF; }; | |||
| A7EB756F566FB773ABE3DFA9 = { isa = PBXBuildFile; fileRef = 1BCF8B6367CCC73AEEF03818; }; | |||
| 061C981D0E9FB70DE5A3D32C = { isa = PBXBuildFile; fileRef = 829C5DA65FB46B99756428C5; }; | |||
| FEDBCD721085272D356BBAEB = { isa = PBXBuildFile; fileRef = D08D9DB99315F76093CF6EE6; }; | |||
| 268807D7091702D29033CC27 = { isa = PBXBuildFile; fileRef = B1471E8698D193FBCF0DD13D; }; | |||
| 91CCD0421DDD432C1C4903D4 = { isa = PBXBuildFile; fileRef = 330A51CC68AED92F7F5BEC15; }; | |||
| 06838545183964D8C1E60530 = { isa = PBXBuildFile; fileRef = 9DCB32BBD7053ACCB598CE79; }; | |||
| 048D33BDE7413EFE05D09901 = { isa = PBXBuildFile; fileRef = 4179D4C7BF616A4A3C3E11CA; }; | |||
| 9DA1913A62297D7111E0A6C9 = { isa = PBXBuildFile; fileRef = 48A4236550741B9D05208C60; }; | |||
| 44C2E5705EEA4F01309D8960 = { isa = PBXBuildFile; fileRef = 9034F31FCBD5A2A297427537; }; | |||
| 7C9FFFC0B129F5C3FAEE13E9 = { isa = PBXBuildFile; fileRef = A6D148E4503AAD3DE6DDCD8B; }; | |||
| 33E1A095D656AF109DD54170 = { isa = PBXBuildFile; fileRef = 31F175F277299B3CEA857F96; }; | |||
| D706C3B5016318D85FE452C2 = { isa = PBXBuildFile; fileRef = 3263F4099F45D6FACD28F08D; }; | |||
| 872B76525D184228B4F69372 = { isa = PBXBuildFile; fileRef = 06F5D2DB198F068520732796; }; | |||
| E43D00B370F289420379B759 = { isa = PBXBuildFile; fileRef = 82F91CF84A296665177CB79A; }; | |||
| EFFCA85EFB4F06F1BEB9AB97 = { isa = PBXBuildFile; fileRef = 03E9C079FBBF727D50A2B678; }; | |||
| 944CE0EADAD951F48EC77071 = { isa = PBXBuildFile; fileRef = 3B2C45064E85B3B631D4F921; }; | |||
| 2417927E323BFE201D5985B9 = { isa = PBXBuildFile; fileRef = 3C60CAE9481EE0113C15A0B9; }; | |||
| A1CB18029E09A66E192D9A29 = { isa = PBXBuildFile; fileRef = 17F5B1F00F15DB37EA4A4AEA; }; | |||
| @@ -65,28 +56,6 @@ | |||
| D9FB1A5365FEEB854A0FF7BF = { isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = System/Library/Frameworks/QuickTime.framework; sourceTree = SDKROOT; }; | |||
| 12E1601866B3489844AFD645 = { isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Jucer.app; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
| F4C5CF1AA7EB9298043D89D3 = { isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Info.plist; sourceTree = SOURCE_ROOT; }; | |||
| 1BCF8B6367CCC73AEEF03818 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_CodeGenerator.cpp; path = ../../Source/model/Component/jucer_CodeGenerator.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 868978C505781890533E282C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_CodeGenerator.h; path = ../../Source/model/Component/jucer_CodeGenerator.h; sourceTree = SOURCE_ROOT; }; | |||
| 829C5DA65FB46B99756428C5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_ComponentDocument.cpp; path = ../../Source/model/Component/jucer_ComponentDocument.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 82F1014486AD8B0C3152FF91 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ComponentDocument.h; path = ../../Source/model/Component/jucer_ComponentDocument.h; sourceTree = SOURCE_ROOT; }; | |||
| 776686405B2531413AAA7281 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ComboBox.h; path = ../../Source/model/Component/Types/jucer_ComboBox.h; sourceTree = SOURCE_ROOT; }; | |||
| D08D9DB99315F76093CF6EE6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_ComponentTypeManager.cpp; path = ../../Source/model/Component/Types/jucer_ComponentTypeManager.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 03C51600B53B70BD0514254D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ComponentTypeManager.h; path = ../../Source/model/Component/Types/jucer_ComponentTypeManager.h; sourceTree = SOURCE_ROOT; }; | |||
| A8A4F96A0009D7FB79B210FC = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ComponentTypes.h; path = ../../Source/model/Component/Types/jucer_ComponentTypes.h; sourceTree = SOURCE_ROOT; }; | |||
| F05C6A0FF88238E712A23568 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_GenericComponent.h; path = ../../Source/model/Component/Types/jucer_GenericComponent.h; sourceTree = SOURCE_ROOT; }; | |||
| A424C2E4ADB30C62EB33215C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_GroupComponent.h; path = ../../Source/model/Component/Types/jucer_GroupComponent.h; sourceTree = SOURCE_ROOT; }; | |||
| 4C0233A3D179C9D367132655 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_JucerComponent.h; path = ../../Source/model/Component/Types/jucer_JucerComponent.h; sourceTree = SOURCE_ROOT; }; | |||
| CC648C0D7428D809C1EF603E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_Label.h; path = ../../Source/model/Component/Types/jucer_Label.h; sourceTree = SOURCE_ROOT; }; | |||
| 4CCA45827EB24DAC35225C8B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_Slider.h; path = ../../Source/model/Component/Types/jucer_Slider.h; sourceTree = SOURCE_ROOT; }; | |||
| 6891A060A1898C4EEE87C5F9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_TabbedComponent.h; path = ../../Source/model/Component/Types/jucer_TabbedComponent.h; sourceTree = SOURCE_ROOT; }; | |||
| 65BECAE9AB24EEDFBC637BF4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_TextButton.h; path = ../../Source/model/Component/Types/jucer_TextButton.h; sourceTree = SOURCE_ROOT; }; | |||
| 9FE1B72EAF687BC6D8447106 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_TextEditor.h; path = ../../Source/model/Component/Types/jucer_TextEditor.h; sourceTree = SOURCE_ROOT; }; | |||
| A3909FC517682D61645E63EF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ToggleButton.h; path = ../../Source/model/Component/Types/jucer_ToggleButton.h; sourceTree = SOURCE_ROOT; }; | |||
| E894E1F6D582678EE1F02763 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_Viewport.h; path = ../../Source/model/Component/Types/jucer_Viewport.h; sourceTree = SOURCE_ROOT; }; | |||
| B1471E8698D193FBCF0DD13D = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_DrawableDocument.cpp; path = ../../Source/model/Drawable/jucer_DrawableDocument.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 739F94CA6213B43D867AB0FD = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_DrawableDocument.h; path = ../../Source/model/Drawable/jucer_DrawableDocument.h; sourceTree = SOURCE_ROOT; }; | |||
| 330A51CC68AED92F7F5BEC15 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_DrawableTypeHandler.cpp; path = ../../Source/model/Drawable/jucer_DrawableTypeHandler.cpp; sourceTree = SOURCE_ROOT; }; | |||
| BDE8CD9273E1B0D0E500D283 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_DrawableTypeHandler.h; path = ../../Source/model/Drawable/jucer_DrawableTypeHandler.h; sourceTree = SOURCE_ROOT; }; | |||
| 9DCB32BBD7053ACCB598CE79 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_NewFileWizard.cpp; path = ../../Source/model/Project/jucer_NewFileWizard.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 201DF0B7B4AA3E03B1AA5144 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_NewFileWizard.h; path = ../../Source/model/Project/jucer_NewFileWizard.h; sourceTree = SOURCE_ROOT; }; | |||
| 4179D4C7BF616A4A3C3E11CA = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_Project.cpp; path = ../../Source/model/Project/jucer_Project.cpp; sourceTree = SOURCE_ROOT; }; | |||
| @@ -103,23 +72,6 @@ | |||
| 5923DFBB741171B1D6EA62F4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ResourceFile.h; path = ../../Source/model/Project/jucer_ResourceFile.h; sourceTree = SOURCE_ROOT; }; | |||
| 31F175F277299B3CEA857F96 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_SourceCodeEditor.cpp; path = "../../Source/ui/Code Editor/jucer_SourceCodeEditor.cpp"; sourceTree = SOURCE_ROOT; }; | |||
| B85B1F0F8634A2D7DC1F8809 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_SourceCodeEditor.h; path = "../../Source/ui/Code Editor/jucer_SourceCodeEditor.h"; sourceTree = SOURCE_ROOT; }; | |||
| 3263F4099F45D6FACD28F08D = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_ComponentEditor.cpp; path = "../../Source/ui/Component Editor/jucer_ComponentEditor.cpp"; sourceTree = SOURCE_ROOT; }; | |||
| 16328135EAE8536A5E2AB454 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ComponentEditor.h; path = "../../Source/ui/Component Editor/jucer_ComponentEditor.h"; sourceTree = SOURCE_ROOT; }; | |||
| 3B77C7A8D9A2386088D75CFE = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ComponentEditorCanvas.h; path = "../../Source/ui/Component Editor/jucer_ComponentEditorCanvas.h"; sourceTree = SOURCE_ROOT; }; | |||
| 7CB154C3682F8C786134A6F3 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ComponentEditorCodeView.h; path = "../../Source/ui/Component Editor/jucer_ComponentEditorCodeView.h"; sourceTree = SOURCE_ROOT; }; | |||
| B5F5AD9FC53F60610C71367C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ComponentEditorToolbar.h; path = "../../Source/ui/Component Editor/jucer_ComponentEditorToolbar.h"; sourceTree = SOURCE_ROOT; }; | |||
| 8CB73D6F1D0FFC4B379D1240 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ComponentEditorTreeView.h; path = "../../Source/ui/Component Editor/jucer_ComponentEditorTreeView.h"; sourceTree = SOURCE_ROOT; }; | |||
| 06F5D2DB198F068520732796 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_ComponentViewer.cpp; path = "../../Source/ui/Component Editor/jucer_ComponentViewer.cpp"; sourceTree = SOURCE_ROOT; }; | |||
| 1309F36592198D9DC738FDE6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ComponentViewer.h; path = "../../Source/ui/Component Editor/jucer_ComponentViewer.h"; sourceTree = SOURCE_ROOT; }; | |||
| 82F91CF84A296665177CB79A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_DrawableEditor.cpp; path = "../../Source/ui/Drawable Editor/jucer_DrawableEditor.cpp"; sourceTree = SOURCE_ROOT; }; | |||
| D1776C5F3E6BB7E8C698BAD6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_DrawableEditor.h; path = "../../Source/ui/Drawable Editor/jucer_DrawableEditor.h"; sourceTree = SOURCE_ROOT; }; | |||
| B19F19A0ED7386FAA7DD854E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_DrawableEditorCanvas.h; path = "../../Source/ui/Drawable Editor/jucer_DrawableEditorCanvas.h"; sourceTree = SOURCE_ROOT; }; | |||
| F93FC34AEC400642196A0238 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_DrawableEditorToolbar.h; path = "../../Source/ui/Drawable Editor/jucer_DrawableEditorToolbar.h"; sourceTree = SOURCE_ROOT; }; | |||
| F195C9668F12CC21CD2708AA = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_DrawableEditorTreeView.h; path = "../../Source/ui/Drawable Editor/jucer_DrawableEditorTreeView.h"; sourceTree = SOURCE_ROOT; }; | |||
| 03E9C079FBBF727D50A2B678 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_EditorCanvas.cpp; path = "../../Source/ui/Editor Base/jucer_EditorCanvas.cpp"; sourceTree = SOURCE_ROOT; }; | |||
| E84D46270BBB219BED0446F7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_EditorCanvas.h; path = "../../Source/ui/Editor Base/jucer_EditorCanvas.h"; sourceTree = SOURCE_ROOT; }; | |||
| BF1C973255F7BFD3965016AE = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_EditorDragOperation.h; path = "../../Source/ui/Editor Base/jucer_EditorDragOperation.h"; sourceTree = SOURCE_ROOT; }; | |||
| 064C5F11CA954DAEFA7ACD3A = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_EditorPanel.h; path = "../../Source/ui/Editor Base/jucer_EditorPanel.h"; sourceTree = SOURCE_ROOT; }; | |||
| E6BB0D9B515B50E418D98B9C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_CommandIDs.h; path = ../../Source/ui/jucer_CommandIDs.h; sourceTree = SOURCE_ROOT; }; | |||
| 3B2C45064E85B3B631D4F921 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_DocumentEditorComponent.cpp; path = ../../Source/ui/jucer_DocumentEditorComponent.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 156F72179BBFCD0D9804C266 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_DocumentEditorComponent.h; path = ../../Source/ui/jucer_DocumentEditorComponent.h; sourceTree = SOURCE_ROOT; }; | |||
| @@ -143,21 +95,18 @@ | |||
| 119004FCF601190AC8929BBD = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_TreeViewTypes.h; path = "../../Source/ui/Project Editor/jucer_TreeViewTypes.h"; sourceTree = SOURCE_ROOT; }; | |||
| 78E0309CB6D5E7E80B5BED7D = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_CodeHelpers.cpp; path = ../../Source/utility/jucer_CodeHelpers.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 9C58E022906C193862372BC1 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_CodeHelpers.h; path = ../../Source/utility/jucer_CodeHelpers.h; sourceTree = SOURCE_ROOT; }; | |||
| F09B64E34443A4030EA1DA30 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ColourPropertyComponent.h; path = ../../Source/utility/jucer_ColourPropertyComponent.h; sourceTree = SOURCE_ROOT; }; | |||
| 9736236B5C4D6A16FC7E03AC = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_Colours.h; path = ../../Source/utility/jucer_Colours.h; sourceTree = SOURCE_ROOT; }; | |||
| CC9A3046B8B9FCDFE2092F51 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_CoordinatePropertyComponent.h; path = ../../Source/utility/jucer_CoordinatePropertyComponent.h; sourceTree = SOURCE_ROOT; }; | |||
| 5533704F0D30A9C62058FEC7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_FileHelpers.cpp; path = ../../Source/utility/jucer_FileHelpers.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 27E71DE11448E4D6721D5508 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_FileHelpers.h; path = ../../Source/utility/jucer_FileHelpers.h; sourceTree = SOURCE_ROOT; }; | |||
| BE9E52ADB12C9D4F783AFE42 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_FillTypePropertyComponent.h; path = ../../Source/utility/jucer_FillTypePropertyComponent.h; sourceTree = SOURCE_ROOT; }; | |||
| BB7B42859CABFB8385039712 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_FontPropertyComponent.h; path = ../../Source/utility/jucer_FontPropertyComponent.h; sourceTree = SOURCE_ROOT; }; | |||
| 848F9EFCBB691000A4B32346 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_MarkerListBase.h; path = ../../Source/utility/jucer_MarkerListBase.h; sourceTree = SOURCE_ROOT; }; | |||
| 49A1C43070A68985C25F34C7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_MiscUtilities.cpp; path = ../../Source/utility/jucer_MiscUtilities.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 2B2A6FCA85F56682698864EC = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_MiscUtilities.h; path = ../../Source/utility/jucer_MiscUtilities.h; sourceTree = SOURCE_ROOT; }; | |||
| 9E6DBB6CE79ED8F4C72BAEE1 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_PresetIDs.h; path = ../../Source/utility/jucer_PresetIDs.h; sourceTree = SOURCE_ROOT; }; | |||
| F99858EE1CD3B23057B8BEBD = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_RelativePath.h; path = ../../Source/utility/jucer_RelativePath.h; sourceTree = SOURCE_ROOT; }; | |||
| 7A1CD936BD306A6E0BEFB046 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_StoredSettings.cpp; path = ../../Source/utility/jucer_StoredSettings.cpp; sourceTree = SOURCE_ROOT; }; | |||
| E99413C9561A66310DAD5EEB = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_StoredSettings.h; path = ../../Source/utility/jucer_StoredSettings.h; sourceTree = SOURCE_ROOT; }; | |||
| 7530E3F9877E4F322CD81801 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_TickIterator.h; path = ../../Source/utility/jucer_TickIterator.h; sourceTree = SOURCE_ROOT; }; | |||
| C693F6EF4381328D5F5891CF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ValueSourceHelpers.h; path = ../../Source/utility/jucer_ValueSourceHelpers.h; sourceTree = SOURCE_ROOT; }; | |||
| 532637EC12F1DC4B2EACCC38 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_Application.h; path = ../../Source/jucer_Application.h; sourceTree = SOURCE_ROOT; }; | |||
| BFC668863418EE80443FAA44 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_CommonHeaders.h; path = ../../Source/jucer_CommonHeaders.h; sourceTree = SOURCE_ROOT; }; | |||
| 0CA0CCCEBFA0AC8C577FC915 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_Headers.h; path = ../../Source/jucer_Headers.h; sourceTree = SOURCE_ROOT; }; | |||
| 0DC331A7B856F30AD266A3E6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_Main.cpp; path = ../../Source/jucer_Main.cpp; sourceTree = SOURCE_ROOT; }; | |||
| E50666EA86CAD5FB338A8756 = { isa = PBXFileReference; lastKnownFileType = image.png; name = brushed_aluminium.png; path = ../../Source/templates/brushed_aluminium.png; sourceTree = SOURCE_ROOT; }; | |||
| @@ -166,8 +115,6 @@ | |||
| 1C52B91B15DF56E0A37F3EEE = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_AudioPluginEditorTemplate.h; path = ../../Source/templates/jucer_AudioPluginEditorTemplate.h; sourceTree = SOURCE_ROOT; }; | |||
| 4D62A4E094921086FBB82248 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_AudioPluginFilterTemplate.cpp; path = ../../Source/templates/jucer_AudioPluginFilterTemplate.cpp; sourceTree = SOURCE_ROOT; }; | |||
| C2AE936214AC10DC4FABAC2F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_AudioPluginFilterTemplate.h; path = ../../Source/templates/jucer_AudioPluginFilterTemplate.h; sourceTree = SOURCE_ROOT; }; | |||
| AC0E488751C4C402D9D84B93 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_ComponentTemplate.cpp; path = ../../Source/templates/jucer_ComponentTemplate.cpp; sourceTree = SOURCE_ROOT; }; | |||
| B2FB0FD53553DB371FD1C748 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jucer_ComponentTemplate.h; path = ../../Source/templates/jucer_ComponentTemplate.h; sourceTree = SOURCE_ROOT; }; | |||
| 061B86C84B0D279F1EABBBE2 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_MainConsoleAppTemplate.cpp; path = ../../Source/templates/jucer_MainConsoleAppTemplate.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 1EC5B7483B37A4163CA19549 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_MainTemplate.cpp; path = ../../Source/templates/jucer_MainTemplate.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 4A80C6415DB1C1CB47DBE23F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = jucer_NewCppFileTemplate.cpp; path = ../../Source/templates/jucer_NewCppFileTemplate.cpp; sourceTree = SOURCE_ROOT; }; | |||
| @@ -183,32 +130,6 @@ | |||
| DD6476FF0F8BE833CD54C01F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = JuceLibraryCode2.mm; path = ../../JuceLibraryCode/JuceLibraryCode2.mm; sourceTree = SOURCE_ROOT; }; | |||
| 268B4FFB1C675B679138545F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = JuceLibraryCode3.mm; path = ../../JuceLibraryCode/JuceLibraryCode3.mm; sourceTree = SOURCE_ROOT; }; | |||
| 60A217F62952DE8A752BD79F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = JuceLibraryCode4.mm; path = ../../JuceLibraryCode/JuceLibraryCode4.mm; sourceTree = SOURCE_ROOT; }; | |||
| 7C95A5CDB1B24D227D92749E = { isa = PBXGroup; children = ( | |||
| 776686405B2531413AAA7281, | |||
| D08D9DB99315F76093CF6EE6, | |||
| 03C51600B53B70BD0514254D, | |||
| A8A4F96A0009D7FB79B210FC, | |||
| F05C6A0FF88238E712A23568, | |||
| A424C2E4ADB30C62EB33215C, | |||
| 4C0233A3D179C9D367132655, | |||
| CC648C0D7428D809C1EF603E, | |||
| 4CCA45827EB24DAC35225C8B, | |||
| 6891A060A1898C4EEE87C5F9, | |||
| 65BECAE9AB24EEDFBC637BF4, | |||
| 9FE1B72EAF687BC6D8447106, | |||
| A3909FC517682D61645E63EF, | |||
| E894E1F6D582678EE1F02763 ); name = Types; sourceTree = "<group>"; }; | |||
| E874A7599C1FEEE538F2DFF2 = { isa = PBXGroup; children = ( | |||
| 1BCF8B6367CCC73AEEF03818, | |||
| 868978C505781890533E282C, | |||
| 829C5DA65FB46B99756428C5, | |||
| 82F1014486AD8B0C3152FF91, | |||
| 7C95A5CDB1B24D227D92749E ); name = Component; sourceTree = "<group>"; }; | |||
| E70E3BE796E91EA86CFE10FE = { isa = PBXGroup; children = ( | |||
| B1471E8698D193FBCF0DD13D, | |||
| 739F94CA6213B43D867AB0FD, | |||
| 330A51CC68AED92F7F5BEC15, | |||
| BDE8CD9273E1B0D0E500D283 ); name = Drawable; sourceTree = "<group>"; }; | |||
| ADA17383E5554BCDF567AACC = { isa = PBXGroup; children = ( | |||
| 9DCB32BBD7053ACCB598CE79, | |||
| 201DF0B7B4AA3E03B1AA5144, | |||
| @@ -225,32 +146,10 @@ | |||
| A6D148E4503AAD3DE6DDCD8B, | |||
| 5923DFBB741171B1D6EA62F4 ); name = Project; sourceTree = "<group>"; }; | |||
| BF6238C9155879B9A9C47213 = { isa = PBXGroup; children = ( | |||
| E874A7599C1FEEE538F2DFF2, | |||
| E70E3BE796E91EA86CFE10FE, | |||
| ADA17383E5554BCDF567AACC ); name = Model; sourceTree = "<group>"; }; | |||
| 336D07CB9ED81D2A985A8543 = { isa = PBXGroup; children = ( | |||
| 31F175F277299B3CEA857F96, | |||
| B85B1F0F8634A2D7DC1F8809 ); name = "Code Editor"; sourceTree = "<group>"; }; | |||
| 3A0BE83502CB509D623C2C07 = { isa = PBXGroup; children = ( | |||
| 3263F4099F45D6FACD28F08D, | |||
| 16328135EAE8536A5E2AB454, | |||
| 3B77C7A8D9A2386088D75CFE, | |||
| 7CB154C3682F8C786134A6F3, | |||
| B5F5AD9FC53F60610C71367C, | |||
| 8CB73D6F1D0FFC4B379D1240, | |||
| 06F5D2DB198F068520732796, | |||
| 1309F36592198D9DC738FDE6 ); name = "Component Editor"; sourceTree = "<group>"; }; | |||
| E6053BD673F80E900DDA3593 = { isa = PBXGroup; children = ( | |||
| 82F91CF84A296665177CB79A, | |||
| D1776C5F3E6BB7E8C698BAD6, | |||
| B19F19A0ED7386FAA7DD854E, | |||
| F93FC34AEC400642196A0238, | |||
| F195C9668F12CC21CD2708AA ); name = "Drawable Editor"; sourceTree = "<group>"; }; | |||
| F4B31EE979DF2BE5AA276EAF = { isa = PBXGroup; children = ( | |||
| 03E9C079FBBF727D50A2B678, | |||
| E84D46270BBB219BED0446F7, | |||
| BF1C973255F7BFD3965016AE, | |||
| 064C5F11CA954DAEFA7ACD3A ); name = "Editor Base"; sourceTree = "<group>"; }; | |||
| 73551B9BCDF3BAC06FECEAF8 = { isa = PBXGroup; children = ( | |||
| 63C3715BB513E5F84B1159AB, | |||
| 9605019A62439E2D81587677, | |||
| @@ -266,9 +165,6 @@ | |||
| 119004FCF601190AC8929BBD ); name = "Project Editor"; sourceTree = "<group>"; }; | |||
| 63A4428C116D97D7C5C05DC8 = { isa = PBXGroup; children = ( | |||
| 336D07CB9ED81D2A985A8543, | |||
| 3A0BE83502CB509D623C2C07, | |||
| E6053BD673F80E900DDA3593, | |||
| F4B31EE979DF2BE5AA276EAF, | |||
| E6BB0D9B515B50E418D98B9C, | |||
| 3B2C45064E85B3B631D4F921, | |||
| 156F72179BBFCD0D9804C266, | |||
| @@ -282,22 +178,19 @@ | |||
| 14B5B6D3D07644058F0F526F = { isa = PBXGroup; children = ( | |||
| 78E0309CB6D5E7E80B5BED7D, | |||
| 9C58E022906C193862372BC1, | |||
| F09B64E34443A4030EA1DA30, | |||
| 9736236B5C4D6A16FC7E03AC, | |||
| CC9A3046B8B9FCDFE2092F51, | |||
| 5533704F0D30A9C62058FEC7, | |||
| 27E71DE11448E4D6721D5508, | |||
| BE9E52ADB12C9D4F783AFE42, | |||
| BB7B42859CABFB8385039712, | |||
| 848F9EFCBB691000A4B32346, | |||
| 49A1C43070A68985C25F34C7, | |||
| 2B2A6FCA85F56682698864EC, | |||
| 9E6DBB6CE79ED8F4C72BAEE1, | |||
| F99858EE1CD3B23057B8BEBD, | |||
| 7A1CD936BD306A6E0BEFB046, | |||
| E99413C9561A66310DAD5EEB, | |||
| 7530E3F9877E4F322CD81801, | |||
| C693F6EF4381328D5F5891CF ); name = Utility; sourceTree = "<group>"; }; | |||
| FAFBE12D4C5798FC1BB3A4BA = { isa = PBXGroup; children = ( | |||
| 532637EC12F1DC4B2EACCC38, | |||
| BFC668863418EE80443FAA44, | |||
| 0CA0CCCEBFA0AC8C577FC915, | |||
| 0DC331A7B856F30AD266A3E6 ); name = Main; sourceTree = "<group>"; }; | |||
| A3AA50DFBB048C92A2213BC1 = { isa = PBXGroup; children = ( | |||
| @@ -307,8 +200,6 @@ | |||
| 1C52B91B15DF56E0A37F3EEE, | |||
| 4D62A4E094921086FBB82248, | |||
| C2AE936214AC10DC4FABAC2F, | |||
| AC0E488751C4C402D9D84B93, | |||
| B2FB0FD53553DB371FD1C748, | |||
| 061B86C84B0D279F1EABBBE2, | |||
| 1EC5B7483B37A4163CA19549, | |||
| 4A80C6415DB1C1CB47DBE23F, | |||
| @@ -417,21 +308,12 @@ | |||
| 673FACB8969ADED17ACEFF7C ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; | |||
| 87CCE4CB1FAB40B6F21DEACE = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; | |||
| 5362E03ADF975A126C1F2F7B = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( | |||
| A7EB756F566FB773ABE3DFA9, | |||
| 061C981D0E9FB70DE5A3D32C, | |||
| FEDBCD721085272D356BBAEB, | |||
| 268807D7091702D29033CC27, | |||
| 91CCD0421DDD432C1C4903D4, | |||
| 06838545183964D8C1E60530, | |||
| 048D33BDE7413EFE05D09901, | |||
| 9DA1913A62297D7111E0A6C9, | |||
| 44C2E5705EEA4F01309D8960, | |||
| 7C9FFFC0B129F5C3FAEE13E9, | |||
| 33E1A095D656AF109DD54170, | |||
| D706C3B5016318D85FE452C2, | |||
| 872B76525D184228B4F69372, | |||
| E43D00B370F289420379B759, | |||
| EFFCA85EFB4F06F1BEB9AB97, | |||
| 944CE0EADAD951F48EC77071, | |||
| 2417927E323BFE201D5985B9, | |||
| A1CB18029E09A66E192D9A29, | |||
| @@ -129,34 +129,6 @@ | |||
| <Files> | |||
| <Filter Name="The Jucer"> | |||
| <Filter Name="Model"> | |||
| <Filter Name="Component"> | |||
| <File RelativePath="..\..\Source\model\Component\jucer_CodeGenerator.cpp"/> | |||
| <File RelativePath="..\..\Source\model\Component\jucer_CodeGenerator.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\jucer_ComponentDocument.cpp"/> | |||
| <File RelativePath="..\..\Source\model\Component\jucer_ComponentDocument.h"/> | |||
| <Filter Name="Types"> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_ComboBox.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_ComponentTypeManager.cpp"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_ComponentTypeManager.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_ComponentTypes.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_GenericComponent.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_GroupComponent.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_JucerComponent.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_Label.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_Slider.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_TabbedComponent.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_TextButton.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_TextEditor.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_ToggleButton.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_Viewport.h"/> | |||
| </Filter> | |||
| </Filter> | |||
| <Filter Name="Drawable"> | |||
| <File RelativePath="..\..\Source\model\Drawable\jucer_DrawableDocument.cpp"/> | |||
| <File RelativePath="..\..\Source\model\Drawable\jucer_DrawableDocument.h"/> | |||
| <File RelativePath="..\..\Source\model\Drawable\jucer_DrawableTypeHandler.cpp"/> | |||
| <File RelativePath="..\..\Source\model\Drawable\jucer_DrawableTypeHandler.h"/> | |||
| </Filter> | |||
| <Filter Name="Project"> | |||
| <File RelativePath="..\..\Source\model\Project\jucer_NewFileWizard.cpp"/> | |||
| <File RelativePath="..\..\Source\model\Project\jucer_NewFileWizard.h"/> | |||
| @@ -179,29 +151,6 @@ | |||
| <File RelativePath="..\..\Source\ui\Code Editor\jucer_SourceCodeEditor.cpp"/> | |||
| <File RelativePath="..\..\Source\ui\Code Editor\jucer_SourceCodeEditor.h"/> | |||
| </Filter> | |||
| <Filter Name="Component Editor"> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentEditor.cpp"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentEditor.h"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentEditorCanvas.h"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentEditorCodeView.h"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentEditorToolbar.h"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentEditorTreeView.h"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentViewer.cpp"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentViewer.h"/> | |||
| </Filter> | |||
| <Filter Name="Drawable Editor"> | |||
| <File RelativePath="..\..\Source\ui\Drawable Editor\jucer_DrawableEditor.cpp"/> | |||
| <File RelativePath="..\..\Source\ui\Drawable Editor\jucer_DrawableEditor.h"/> | |||
| <File RelativePath="..\..\Source\ui\Drawable Editor\jucer_DrawableEditorCanvas.h"/> | |||
| <File RelativePath="..\..\Source\ui\Drawable Editor\jucer_DrawableEditorToolbar.h"/> | |||
| <File RelativePath="..\..\Source\ui\Drawable Editor\jucer_DrawableEditorTreeView.h"/> | |||
| </Filter> | |||
| <Filter Name="Editor Base"> | |||
| <File RelativePath="..\..\Source\ui\Editor Base\jucer_EditorCanvas.cpp"/> | |||
| <File RelativePath="..\..\Source\ui\Editor Base\jucer_EditorCanvas.h"/> | |||
| <File RelativePath="..\..\Source\ui\Editor Base\jucer_EditorDragOperation.h"/> | |||
| <File RelativePath="..\..\Source\ui\Editor Base\jucer_EditorPanel.h"/> | |||
| </Filter> | |||
| <File RelativePath="..\..\Source\ui\jucer_CommandIDs.h"/> | |||
| <File RelativePath="..\..\Source\ui\jucer_DocumentEditorComponent.cpp"/> | |||
| <File RelativePath="..\..\Source\ui\jucer_DocumentEditorComponent.h"/> | |||
| @@ -229,23 +178,20 @@ | |||
| <Filter Name="Utility"> | |||
| <File RelativePath="..\..\Source\utility\jucer_CodeHelpers.cpp"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_CodeHelpers.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_ColourPropertyComponent.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_Colours.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_CoordinatePropertyComponent.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_FileHelpers.cpp"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_FileHelpers.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_FillTypePropertyComponent.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_FontPropertyComponent.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_MarkerListBase.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_MiscUtilities.cpp"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_MiscUtilities.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_PresetIDs.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_RelativePath.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_StoredSettings.cpp"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_StoredSettings.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_TickIterator.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_ValueSourceHelpers.h"/> | |||
| </Filter> | |||
| <Filter Name="Main"> | |||
| <File RelativePath="..\..\Source\jucer_Application.h"/> | |||
| <File RelativePath="..\..\Source\jucer_CommonHeaders.h"/> | |||
| <File RelativePath="..\..\Source\jucer_Headers.h"/> | |||
| <File RelativePath="..\..\Source\jucer_Main.cpp"/> | |||
| </Filter> | |||
| @@ -310,26 +256,6 @@ | |||
| <Tool Name="VCCLCompilerTool"/> | |||
| </FileConfiguration> | |||
| </File> | |||
| <File RelativePath="..\..\Source\templates\jucer_ComponentTemplate.cpp"> | |||
| <FileConfiguration Name="Debug|Win32" | |||
| ExcludedFromBuild="true"> | |||
| <Tool Name="VCCLCompilerTool"/> | |||
| </FileConfiguration> | |||
| <FileConfiguration Name="Release|Win32" | |||
| ExcludedFromBuild="true"> | |||
| <Tool Name="VCCLCompilerTool"/> | |||
| </FileConfiguration> | |||
| </File> | |||
| <File RelativePath="..\..\Source\templates\jucer_ComponentTemplate.h"> | |||
| <FileConfiguration Name="Debug|Win32" | |||
| ExcludedFromBuild="true"> | |||
| <Tool Name="VCCLCompilerTool"/> | |||
| </FileConfiguration> | |||
| <FileConfiguration Name="Release|Win32" | |||
| ExcludedFromBuild="true"> | |||
| <Tool Name="VCCLCompilerTool"/> | |||
| </FileConfiguration> | |||
| </File> | |||
| <File RelativePath="..\..\Source\templates\jucer_MainConsoleAppTemplate.cpp"> | |||
| <FileConfiguration Name="Debug|Win32" | |||
| ExcludedFromBuild="true"> | |||
| @@ -129,34 +129,6 @@ | |||
| <Files> | |||
| <Filter Name="The Jucer"> | |||
| <Filter Name="Model"> | |||
| <Filter Name="Component"> | |||
| <File RelativePath="..\..\Source\model\Component\jucer_CodeGenerator.cpp"/> | |||
| <File RelativePath="..\..\Source\model\Component\jucer_CodeGenerator.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\jucer_ComponentDocument.cpp"/> | |||
| <File RelativePath="..\..\Source\model\Component\jucer_ComponentDocument.h"/> | |||
| <Filter Name="Types"> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_ComboBox.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_ComponentTypeManager.cpp"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_ComponentTypeManager.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_ComponentTypes.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_GenericComponent.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_GroupComponent.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_JucerComponent.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_Label.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_Slider.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_TabbedComponent.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_TextButton.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_TextEditor.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_ToggleButton.h"/> | |||
| <File RelativePath="..\..\Source\model\Component\Types\jucer_Viewport.h"/> | |||
| </Filter> | |||
| </Filter> | |||
| <Filter Name="Drawable"> | |||
| <File RelativePath="..\..\Source\model\Drawable\jucer_DrawableDocument.cpp"/> | |||
| <File RelativePath="..\..\Source\model\Drawable\jucer_DrawableDocument.h"/> | |||
| <File RelativePath="..\..\Source\model\Drawable\jucer_DrawableTypeHandler.cpp"/> | |||
| <File RelativePath="..\..\Source\model\Drawable\jucer_DrawableTypeHandler.h"/> | |||
| </Filter> | |||
| <Filter Name="Project"> | |||
| <File RelativePath="..\..\Source\model\Project\jucer_NewFileWizard.cpp"/> | |||
| <File RelativePath="..\..\Source\model\Project\jucer_NewFileWizard.h"/> | |||
| @@ -179,29 +151,6 @@ | |||
| <File RelativePath="..\..\Source\ui\Code Editor\jucer_SourceCodeEditor.cpp"/> | |||
| <File RelativePath="..\..\Source\ui\Code Editor\jucer_SourceCodeEditor.h"/> | |||
| </Filter> | |||
| <Filter Name="Component Editor"> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentEditor.cpp"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentEditor.h"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentEditorCanvas.h"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentEditorCodeView.h"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentEditorToolbar.h"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentEditorTreeView.h"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentViewer.cpp"/> | |||
| <File RelativePath="..\..\Source\ui\Component Editor\jucer_ComponentViewer.h"/> | |||
| </Filter> | |||
| <Filter Name="Drawable Editor"> | |||
| <File RelativePath="..\..\Source\ui\Drawable Editor\jucer_DrawableEditor.cpp"/> | |||
| <File RelativePath="..\..\Source\ui\Drawable Editor\jucer_DrawableEditor.h"/> | |||
| <File RelativePath="..\..\Source\ui\Drawable Editor\jucer_DrawableEditorCanvas.h"/> | |||
| <File RelativePath="..\..\Source\ui\Drawable Editor\jucer_DrawableEditorToolbar.h"/> | |||
| <File RelativePath="..\..\Source\ui\Drawable Editor\jucer_DrawableEditorTreeView.h"/> | |||
| </Filter> | |||
| <Filter Name="Editor Base"> | |||
| <File RelativePath="..\..\Source\ui\Editor Base\jucer_EditorCanvas.cpp"/> | |||
| <File RelativePath="..\..\Source\ui\Editor Base\jucer_EditorCanvas.h"/> | |||
| <File RelativePath="..\..\Source\ui\Editor Base\jucer_EditorDragOperation.h"/> | |||
| <File RelativePath="..\..\Source\ui\Editor Base\jucer_EditorPanel.h"/> | |||
| </Filter> | |||
| <File RelativePath="..\..\Source\ui\jucer_CommandIDs.h"/> | |||
| <File RelativePath="..\..\Source\ui\jucer_DocumentEditorComponent.cpp"/> | |||
| <File RelativePath="..\..\Source\ui\jucer_DocumentEditorComponent.h"/> | |||
| @@ -229,23 +178,20 @@ | |||
| <Filter Name="Utility"> | |||
| <File RelativePath="..\..\Source\utility\jucer_CodeHelpers.cpp"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_CodeHelpers.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_ColourPropertyComponent.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_Colours.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_CoordinatePropertyComponent.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_FileHelpers.cpp"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_FileHelpers.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_FillTypePropertyComponent.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_FontPropertyComponent.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_MarkerListBase.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_MiscUtilities.cpp"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_MiscUtilities.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_PresetIDs.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_RelativePath.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_StoredSettings.cpp"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_StoredSettings.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_TickIterator.h"/> | |||
| <File RelativePath="..\..\Source\utility\jucer_ValueSourceHelpers.h"/> | |||
| </Filter> | |||
| <Filter Name="Main"> | |||
| <File RelativePath="..\..\Source\jucer_Application.h"/> | |||
| <File RelativePath="..\..\Source\jucer_CommonHeaders.h"/> | |||
| <File RelativePath="..\..\Source\jucer_Headers.h"/> | |||
| <File RelativePath="..\..\Source\jucer_Main.cpp"/> | |||
| </Filter> | |||
| @@ -310,26 +256,6 @@ | |||
| <Tool Name="VCCLCompilerTool"/> | |||
| </FileConfiguration> | |||
| </File> | |||
| <File RelativePath="..\..\Source\templates\jucer_ComponentTemplate.cpp"> | |||
| <FileConfiguration Name="Debug|Win32" | |||
| ExcludedFromBuild="true"> | |||
| <Tool Name="VCCLCompilerTool"/> | |||
| </FileConfiguration> | |||
| <FileConfiguration Name="Release|Win32" | |||
| ExcludedFromBuild="true"> | |||
| <Tool Name="VCCLCompilerTool"/> | |||
| </FileConfiguration> | |||
| </File> | |||
| <File RelativePath="..\..\Source\templates\jucer_ComponentTemplate.h"> | |||
| <FileConfiguration Name="Debug|Win32" | |||
| ExcludedFromBuild="true"> | |||
| <Tool Name="VCCLCompilerTool"/> | |||
| </FileConfiguration> | |||
| <FileConfiguration Name="Release|Win32" | |||
| ExcludedFromBuild="true"> | |||
| <Tool Name="VCCLCompilerTool"/> | |||
| </FileConfiguration> | |||
| </File> | |||
| <File RelativePath="..\..\Source\templates\jucer_MainConsoleAppTemplate.cpp"> | |||
| <FileConfiguration Name="Debug|Win32" | |||
| ExcludedFromBuild="true"> | |||
| @@ -122,21 +122,12 @@ | |||
| </Bscmake> | |||
| </ItemDefinitionGroup> | |||
| <ItemGroup> | |||
| <ClCompile Include="..\..\Source\model\Component\jucer_CodeGenerator.cpp"/> | |||
| <ClCompile Include="..\..\Source\model\Component\jucer_ComponentDocument.cpp"/> | |||
| <ClCompile Include="..\..\Source\model\Component\Types\jucer_ComponentTypeManager.cpp"/> | |||
| <ClCompile Include="..\..\Source\model\Drawable\jucer_DrawableDocument.cpp"/> | |||
| <ClCompile Include="..\..\Source\model\Drawable\jucer_DrawableTypeHandler.cpp"/> | |||
| <ClCompile Include="..\..\Source\model\Project\jucer_NewFileWizard.cpp"/> | |||
| <ClCompile Include="..\..\Source\model\Project\jucer_Project.cpp"/> | |||
| <ClCompile Include="..\..\Source\model\Project\jucer_ProjectExporter.cpp"/> | |||
| <ClCompile Include="..\..\Source\model\Project\jucer_ProjectWizard.cpp"/> | |||
| <ClCompile Include="..\..\Source\model\Project\jucer_ResourceFile.cpp"/> | |||
| <ClCompile Include="..\..\Source\ui\Code Editor\jucer_SourceCodeEditor.cpp"/> | |||
| <ClCompile Include="..\..\Source\ui\Component Editor\jucer_ComponentEditor.cpp"/> | |||
| <ClCompile Include="..\..\Source\ui\Component Editor\jucer_ComponentViewer.cpp"/> | |||
| <ClCompile Include="..\..\Source\ui\Drawable Editor\jucer_DrawableEditor.cpp"/> | |||
| <ClCompile Include="..\..\Source\ui\Editor Base\jucer_EditorCanvas.cpp"/> | |||
| <ClCompile Include="..\..\Source\ui\jucer_DocumentEditorComponent.cpp"/> | |||
| <ClCompile Include="..\..\Source\ui\jucer_JucerTreeViewBase.cpp"/> | |||
| <ClCompile Include="..\..\Source\ui\jucer_MainWindow.cpp"/> | |||
| @@ -159,23 +150,6 @@ | |||
| <ClCompile Include="..\..\JuceLibraryCode\JuceLibraryCode4.cpp"/> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ClInclude Include="..\..\Source\model\Component\jucer_CodeGenerator.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\jucer_ComponentDocument.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_ComboBox.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_ComponentTypeManager.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_ComponentTypes.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_GenericComponent.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_GroupComponent.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_JucerComponent.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_Label.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_Slider.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_TabbedComponent.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_TextButton.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_TextEditor.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_ToggleButton.h"/> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_Viewport.h"/> | |||
| <ClInclude Include="..\..\Source\model\Drawable\jucer_DrawableDocument.h"/> | |||
| <ClInclude Include="..\..\Source\model\Drawable\jucer_DrawableTypeHandler.h"/> | |||
| <ClInclude Include="..\..\Source\model\Project\jucer_NewFileWizard.h"/> | |||
| <ClInclude Include="..\..\Source\model\Project\jucer_Project.h"/> | |||
| <ClInclude Include="..\..\Source\model\Project\jucer_ProjectExporter.h"/> | |||
| @@ -186,19 +160,6 @@ | |||
| <ClInclude Include="..\..\Source\model\Project\jucer_ProjectWizard.h"/> | |||
| <ClInclude Include="..\..\Source\model\Project\jucer_ResourceFile.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Code Editor\jucer_SourceCodeEditor.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Component Editor\jucer_ComponentEditor.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Component Editor\jucer_ComponentEditorCanvas.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Component Editor\jucer_ComponentEditorCodeView.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Component Editor\jucer_ComponentEditorToolbar.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Component Editor\jucer_ComponentEditorTreeView.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Component Editor\jucer_ComponentViewer.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Drawable Editor\jucer_DrawableEditor.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Drawable Editor\jucer_DrawableEditorCanvas.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Drawable Editor\jucer_DrawableEditorToolbar.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Drawable Editor\jucer_DrawableEditorTreeView.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Editor Base\jucer_EditorCanvas.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Editor Base\jucer_EditorDragOperation.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Editor Base\jucer_EditorPanel.h"/> | |||
| <ClInclude Include="..\..\Source\ui\jucer_CommandIDs.h"/> | |||
| <ClInclude Include="..\..\Source\ui\jucer_DocumentEditorComponent.h"/> | |||
| <ClInclude Include="..\..\Source\ui\jucer_JucerTreeViewBase.h"/> | |||
| @@ -211,22 +172,18 @@ | |||
| <ClInclude Include="..\..\Source\ui\Project Editor\jucer_ProjectTreeViewBase.h"/> | |||
| <ClInclude Include="..\..\Source\ui\Project Editor\jucer_TreeViewTypes.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_CodeHelpers.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_ColourPropertyComponent.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_Colours.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_CoordinatePropertyComponent.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_FileHelpers.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_FillTypePropertyComponent.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_FontPropertyComponent.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_MarkerListBase.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_MiscUtilities.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_PresetIDs.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_RelativePath.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_StoredSettings.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_TickIterator.h"/> | |||
| <ClInclude Include="..\..\Source\utility\jucer_ValueSourceHelpers.h"/> | |||
| <ClInclude Include="..\..\Source\jucer_Application.h"/> | |||
| <ClInclude Include="..\..\Source\jucer_CommonHeaders.h"/> | |||
| <ClInclude Include="..\..\Source\jucer_Headers.h"/> | |||
| <ClInclude Include="..\..\Source\templates\jucer_AudioPluginEditorTemplate.h"/> | |||
| <ClInclude Include="..\..\Source\templates\jucer_AudioPluginFilterTemplate.h"/> | |||
| <ClInclude Include="..\..\Source\templates\jucer_ComponentTemplate.h"/> | |||
| <ClInclude Include="..\..\Source\templates\jucer_NewCppFileTemplate.h"/> | |||
| <ClInclude Include="..\..\Source\templates\jucer_WindowTemplate.h"/> | |||
| <ClInclude Include="..\..\JuceLibraryCode\AppConfig.h"/> | |||
| @@ -8,15 +8,6 @@ | |||
| <Filter Include="The Jucer\Model"> | |||
| <UniqueIdentifier>{A5344922-0D8B-B045-F28C-FED2183BC2C7}</UniqueIdentifier> | |||
| </Filter> | |||
| <Filter Include="The Jucer\Model\Component"> | |||
| <UniqueIdentifier>{BB130AC7-0080-F6A3-9A33-66D8D081545C}</UniqueIdentifier> | |||
| </Filter> | |||
| <Filter Include="The Jucer\Model\Component\Types"> | |||
| <UniqueIdentifier>{373D0BD7-814C-7145-4C25-6D9C9E6D1D5D}</UniqueIdentifier> | |||
| </Filter> | |||
| <Filter Include="The Jucer\Model\Drawable"> | |||
| <UniqueIdentifier>{7C9CA237-B750-662B-7DF8-5FD8FCAF4E3C}</UniqueIdentifier> | |||
| </Filter> | |||
| <Filter Include="The Jucer\Model\Project"> | |||
| <UniqueIdentifier>{F9D69347-AF9F-BE13-7C53-9C497443E5AE}</UniqueIdentifier> | |||
| </Filter> | |||
| @@ -26,15 +17,6 @@ | |||
| <Filter Include="The Jucer\UI\Code Editor"> | |||
| <UniqueIdentifier>{F4F08AA9-6601-8093-5779-F29289064327}</UniqueIdentifier> | |||
| </Filter> | |||
| <Filter Include="The Jucer\UI\Component Editor"> | |||
| <UniqueIdentifier>{F476DB92-615F-54AF-2D4B-35031423FB68}</UniqueIdentifier> | |||
| </Filter> | |||
| <Filter Include="The Jucer\UI\Drawable Editor"> | |||
| <UniqueIdentifier>{37D72050-852A-B36C-3674-277B759737F1}</UniqueIdentifier> | |||
| </Filter> | |||
| <Filter Include="The Jucer\UI\Editor Base"> | |||
| <UniqueIdentifier>{04730C9B-9F60-192C-2577-97984C6BC024}</UniqueIdentifier> | |||
| </Filter> | |||
| <Filter Include="The Jucer\UI\Project Editor"> | |||
| <UniqueIdentifier>{B34892C3-DBB0-4445-A3A2-FF5FB798F25B}</UniqueIdentifier> | |||
| </Filter> | |||
| @@ -52,21 +34,6 @@ | |||
| </Filter> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ClCompile Include="..\..\Source\model\Component\jucer_CodeGenerator.cpp"> | |||
| <Filter>The Jucer\Model\Component</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\Source\model\Component\jucer_ComponentDocument.cpp"> | |||
| <Filter>The Jucer\Model\Component</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\Source\model\Component\Types\jucer_ComponentTypeManager.cpp"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\Source\model\Drawable\jucer_DrawableDocument.cpp"> | |||
| <Filter>The Jucer\Model\Drawable</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\Source\model\Drawable\jucer_DrawableTypeHandler.cpp"> | |||
| <Filter>The Jucer\Model\Drawable</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\Source\model\Project\jucer_NewFileWizard.cpp"> | |||
| <Filter>The Jucer\Model\Project</Filter> | |||
| </ClCompile> | |||
| @@ -85,18 +52,6 @@ | |||
| <ClCompile Include="..\..\Source\ui\Code Editor\jucer_SourceCodeEditor.cpp"> | |||
| <Filter>The Jucer\UI\Code Editor</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\Source\ui\Component Editor\jucer_ComponentEditor.cpp"> | |||
| <Filter>The Jucer\UI\Component Editor</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\Source\ui\Component Editor\jucer_ComponentViewer.cpp"> | |||
| <Filter>The Jucer\UI\Component Editor</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\Source\ui\Drawable Editor\jucer_DrawableEditor.cpp"> | |||
| <Filter>The Jucer\UI\Drawable Editor</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\Source\ui\Editor Base\jucer_EditorCanvas.cpp"> | |||
| <Filter>The Jucer\UI\Editor Base</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\Source\ui\jucer_DocumentEditorComponent.cpp"> | |||
| <Filter>The Jucer\UI</Filter> | |||
| </ClCompile> | |||
| @@ -154,9 +109,6 @@ | |||
| <ClCompile Include="..\..\Source\templates\jucer_AudioPluginFilterTemplate.cpp"> | |||
| <Filter>The Jucer\Resources</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\Source\templates\jucer_ComponentTemplate.cpp"> | |||
| <Filter>The Jucer\Resources</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\Source\templates\jucer_MainConsoleAppTemplate.cpp"> | |||
| <Filter>The Jucer\Resources</Filter> | |||
| </ClCompile> | |||
| @@ -189,57 +141,6 @@ | |||
| </ClCompile> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ClInclude Include="..\..\Source\model\Component\jucer_CodeGenerator.h"> | |||
| <Filter>The Jucer\Model\Component</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\jucer_ComponentDocument.h"> | |||
| <Filter>The Jucer\Model\Component</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_ComboBox.h"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_ComponentTypeManager.h"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_ComponentTypes.h"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_GenericComponent.h"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_GroupComponent.h"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_JucerComponent.h"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_Label.h"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_Slider.h"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_TabbedComponent.h"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_TextButton.h"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_TextEditor.h"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_ToggleButton.h"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Component\Types\jucer_Viewport.h"> | |||
| <Filter>The Jucer\Model\Component\Types</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Drawable\jucer_DrawableDocument.h"> | |||
| <Filter>The Jucer\Model\Drawable</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Drawable\jucer_DrawableTypeHandler.h"> | |||
| <Filter>The Jucer\Model\Drawable</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\model\Project\jucer_NewFileWizard.h"> | |||
| <Filter>The Jucer\Model\Project</Filter> | |||
| </ClInclude> | |||
| @@ -270,45 +171,6 @@ | |||
| <ClInclude Include="..\..\Source\ui\Code Editor\jucer_SourceCodeEditor.h"> | |||
| <Filter>The Jucer\UI\Code Editor</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\Component Editor\jucer_ComponentEditor.h"> | |||
| <Filter>The Jucer\UI\Component Editor</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\Component Editor\jucer_ComponentEditorCanvas.h"> | |||
| <Filter>The Jucer\UI\Component Editor</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\Component Editor\jucer_ComponentEditorCodeView.h"> | |||
| <Filter>The Jucer\UI\Component Editor</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\Component Editor\jucer_ComponentEditorToolbar.h"> | |||
| <Filter>The Jucer\UI\Component Editor</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\Component Editor\jucer_ComponentEditorTreeView.h"> | |||
| <Filter>The Jucer\UI\Component Editor</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\Component Editor\jucer_ComponentViewer.h"> | |||
| <Filter>The Jucer\UI\Component Editor</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\Drawable Editor\jucer_DrawableEditor.h"> | |||
| <Filter>The Jucer\UI\Drawable Editor</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\Drawable Editor\jucer_DrawableEditorCanvas.h"> | |||
| <Filter>The Jucer\UI\Drawable Editor</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\Drawable Editor\jucer_DrawableEditorToolbar.h"> | |||
| <Filter>The Jucer\UI\Drawable Editor</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\Drawable Editor\jucer_DrawableEditorTreeView.h"> | |||
| <Filter>The Jucer\UI\Drawable Editor</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\Editor Base\jucer_EditorCanvas.h"> | |||
| <Filter>The Jucer\UI\Editor Base</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\Editor Base\jucer_EditorDragOperation.h"> | |||
| <Filter>The Jucer\UI\Editor Base</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\Editor Base\jucer_EditorPanel.h"> | |||
| <Filter>The Jucer\UI\Editor Base</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\ui\jucer_CommandIDs.h"> | |||
| <Filter>The Jucer\UI</Filter> | |||
| </ClInclude> | |||
| @@ -345,28 +207,16 @@ | |||
| <ClInclude Include="..\..\Source\utility\jucer_CodeHelpers.h"> | |||
| <Filter>The Jucer\Utility</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\utility\jucer_ColourPropertyComponent.h"> | |||
| <Filter>The Jucer\Utility</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\utility\jucer_Colours.h"> | |||
| <Filter>The Jucer\Utility</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\utility\jucer_CoordinatePropertyComponent.h"> | |||
| <Filter>The Jucer\Utility</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\utility\jucer_FileHelpers.h"> | |||
| <Filter>The Jucer\Utility</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\utility\jucer_FillTypePropertyComponent.h"> | |||
| <Filter>The Jucer\Utility</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\utility\jucer_FontPropertyComponent.h"> | |||
| <Filter>The Jucer\Utility</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\utility\jucer_MarkerListBase.h"> | |||
| <ClInclude Include="..\..\Source\utility\jucer_MiscUtilities.h"> | |||
| <Filter>The Jucer\Utility</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\utility\jucer_MiscUtilities.h"> | |||
| <ClInclude Include="..\..\Source\utility\jucer_PresetIDs.h"> | |||
| <Filter>The Jucer\Utility</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\utility\jucer_RelativePath.h"> | |||
| @@ -375,12 +225,15 @@ | |||
| <ClInclude Include="..\..\Source\utility\jucer_StoredSettings.h"> | |||
| <Filter>The Jucer\Utility</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\utility\jucer_TickIterator.h"> | |||
| <Filter>The Jucer\Utility</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\utility\jucer_ValueSourceHelpers.h"> | |||
| <Filter>The Jucer\Utility</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\jucer_Application.h"> | |||
| <Filter>The Jucer\Main</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\jucer_CommonHeaders.h"> | |||
| <Filter>The Jucer\Main</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\jucer_Headers.h"> | |||
| <Filter>The Jucer\Main</Filter> | |||
| </ClInclude> | |||
| @@ -390,9 +243,6 @@ | |||
| <ClInclude Include="..\..\Source\templates\jucer_AudioPluginFilterTemplate.h"> | |||
| <Filter>The Jucer\Resources</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\templates\jucer_ComponentTemplate.h"> | |||
| <Filter>The Jucer\Resources</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\Source\templates\jucer_NewCppFileTemplate.h"> | |||
| <Filter>The Jucer\Resources</Filter> | |||
| </ClInclude> | |||
| @@ -23,8 +23,6 @@ const char* BinaryData::getNamedResource (const char* resourceNameUTF8, int& num | |||
| case 0x4d0721bf: numBytes = BinaryData::jucer_AudioPluginEditorTemplate_hSize; return BinaryData::jucer_AudioPluginEditorTemplate_h; | |||
| case 0x51b49ac5: numBytes = BinaryData::jucer_AudioPluginFilterTemplate_cppSize; return BinaryData::jucer_AudioPluginFilterTemplate_cpp; | |||
| case 0x488afa0a: numBytes = BinaryData::jucer_AudioPluginFilterTemplate_hSize; return BinaryData::jucer_AudioPluginFilterTemplate_h; | |||
| case 0xabad7041: numBytes = BinaryData::jucer_ComponentTemplate_cppSize; return BinaryData::jucer_ComponentTemplate_cpp; | |||
| case 0xfc72fe86: numBytes = BinaryData::jucer_ComponentTemplate_hSize; return BinaryData::jucer_ComponentTemplate_h; | |||
| case 0x8905395b: numBytes = BinaryData::jucer_MainConsoleAppTemplate_cppSize; return BinaryData::jucer_MainConsoleAppTemplate_cpp; | |||
| case 0x7a0186b1: numBytes = BinaryData::jucer_MainTemplate_cppSize; return BinaryData::jucer_MainTemplate_cpp; | |||
| case 0x02a2a077: numBytes = BinaryData::jucer_NewCppFileTemplate_cppSize; return BinaryData::jucer_NewCppFileTemplate_cpp; | |||
| @@ -631,151 +629,6 @@ static const unsigned char temp_a7c425dd[] = | |||
| const char* BinaryData::jucer_AudioPluginFilterTemplate_h = (const char*) temp_a7c425dd; | |||
| //================== jucer_ComponentTemplate.cpp ================== | |||
| static const unsigned char temp_73015554[] = | |||
| "/*\r\n" | |||
| " ==============================================================================\r\n" | |||
| "\r\n" | |||
| " This is an automatically generated file created by the Jucer!\r\n" | |||
| "\r\n" | |||
| " Be careful when adding custom code to these files, as only the code within\r\n" | |||
| " the \"//[xyz]\" and \"//[/xyz]\" sections will be retained when the file is loaded\r\n" | |||
| " and re-saved.\r\n" | |||
| "\r\n" | |||
| " Created for JUCE version: %%juceVersion%%\r\n" | |||
| "\r\n" | |||
| " ------------------------------------------------------------------------------\r\n" | |||
| "\r\n" | |||
| " JUCE and the Jucer are copyright 2004-10 by Raw Material Software ltd.\r\n" | |||
| "\r\n" | |||
| " ==============================================================================\r\n" | |||
| "*/\r\n" | |||
| "\r\n" | |||
| "//[CppHeaders] You can add your own extra header files here...\r\n" | |||
| "//[/CppHeaders]\r\n" | |||
| "\r\n" | |||
| "%%includeFilesCPP%%\r\n" | |||
| "\r\n" | |||
| "//[MiscUserDefs] You can add your own user definitions and misc code here...\r\n" | |||
| "//[/MiscUserDefs]\r\n" | |||
| "\r\n" | |||
| "extern const unsigned char %%className%%_ComponentStateData[];\r\n" | |||
| "\r\n" | |||
| "//==============================================================================\r\n" | |||
| "%%className%%::%%className%% (%%constructorParams%%)\r\n" | |||
| "%%initialisers%%{\r\n" | |||
| " componentState = ValueTree::readFromData (%%className%%_ComponentStateData, %%statedatasize%%);\r\n" | |||
| " jassert (componentState.isValid());\r\n" | |||
| " const ValueTree componentStateList (componentState.getChildByName (\"COMPONENTS\"));\r\n" | |||
| "\r\n" | |||
| " %%constructor%%\r\n" | |||
| "\r\n" | |||
| " //[Constructor] You can add your own custom stuff here..\r\n" | |||
| " //[/Constructor]\r\n" | |||
| "}\r\n" | |||
| "\r\n" | |||
| "%%className%%::~%%className%%()\r\n" | |||
| "{\r\n" | |||
| " //[Destructor_pre]. You can add your own custom destruction code here..\r\n" | |||
| " //[/Destructor_pre]\r\n" | |||
| "\r\n" | |||
| " %%destructor%%\r\n" | |||
| "\r\n" | |||
| " //[Destructor]. You can add your own custom destruction code here..\r\n" | |||
| " //[/Destructor]\r\n" | |||
| "}\r\n" | |||
| "\r\n" | |||
| "//==============================================================================\r\n" | |||
| "%%methodDefinitions%%\r\n" | |||
| "\r\n" | |||
| "//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...\r\n" | |||
| "//[/MiscUserCode]\r\n" | |||
| "\r\n" | |||
| "%%staticMemberDefinitions%%\r\n" | |||
| "\r\n" | |||
| "//==============================================================================\r\n" | |||
| "//======================= Jucer Information Section ==========================\r\n" | |||
| "//==============================================================================\r\n" | |||
| "#if 0\r\n" | |||
| "/* This section stores the Jucer's metadata - edit it at your own risk!\r\n" | |||
| "\r\n" | |||
| "%%metadata%%\r\n" | |||
| "*/\r\n" | |||
| "#endif\r\n"; | |||
| const char* BinaryData::jucer_ComponentTemplate_cpp = (const char*) temp_73015554; | |||
| //================== jucer_ComponentTemplate.h ================== | |||
| static const unsigned char temp_b930c59[] = | |||
| "/*\r\n" | |||
| " ==============================================================================\r\n" | |||
| "\r\n" | |||
| " This is an automatically generated file created by the Jucer!\r\n" | |||
| "\r\n" | |||
| " Be careful when adding custom code to these files, as only the code within\r\n" | |||
| " the \"//[xyz]\" and \"//[/xyz]\" sections will be retained when the file is loaded\r\n" | |||
| " and re-saved.\r\n" | |||
| "\r\n" | |||
| " Created for JUCE version: %%juceVersion%%\r\n" | |||
| "\r\n" | |||
| " ------------------------------------------------------------------------------\r\n" | |||
| "\r\n" | |||
| " JUCE and the Jucer are copyright 2004-10 by Raw Material Software ltd.\r\n" | |||
| "\r\n" | |||
| " ==============================================================================\r\n" | |||
| "*/\r\n" | |||
| "\r\n" | |||
| "#ifndef %%headerGuard%%\r\n" | |||
| "#define %%headerGuard%%\r\n" | |||
| "\r\n" | |||
| "//[Headers] -- You can add your own extra header files here --\r\n" | |||
| "%%defaultJuceInclude%%\r\n" | |||
| "//[/Headers]\r\n" | |||
| "\r\n" | |||
| "%%includeFilesH%%\r\n" | |||
| "\r\n" | |||
| "//==============================================================================\r\n" | |||
| "/**\r\n" | |||
| " //[Comments]\r\n" | |||
| " An auto-generated component, created by the Jucer.\r\n" | |||
| "\r\n" | |||
| " Describe your class and how it works here!\r\n" | |||
| " //[/Comments]\r\n" | |||
| "*/\r\n" | |||
| "%%classDeclaration%%\r\n" | |||
| "{\r\n" | |||
| "public:\r\n" | |||
| " //==============================================================================\r\n" | |||
| " %%className%% (%%constructorParams%%);\r\n" | |||
| " ~%%className%%();\r\n" | |||
| "\r\n" | |||
| " //==============================================================================\r\n" | |||
| " //[UserMethods] -- You can add your own custom methods in this section.\r\n" | |||
| " //[/UserMethods]\r\n" | |||
| "\r\n" | |||
| " %%publicMemberDeclarations%%\r\n" | |||
| "\r\n" | |||
| " //==============================================================================\r\n" | |||
| " juce_UseDebuggingNewOperator\r\n" | |||
| "\r\n" | |||
| "private:\r\n" | |||
| " //[UserVariables] -- You can add your own custom variables in this section.\r\n" | |||
| " //[/UserVariables]\r\n" | |||
| "\r\n" | |||
| " //==============================================================================\r\n" | |||
| " %%privateMemberDeclarations%%\r\n" | |||
| "\r\n" | |||
| " //==============================================================================\r\n" | |||
| " // (prevent copy constructor and operator= being generated..)\r\n" | |||
| " %%className%% (const %%className%%&);\r\n" | |||
| " %%className%%& operator= (const %%className%%&);\r\n" | |||
| "};\r\n" | |||
| "\r\n" | |||
| "\r\n" | |||
| "#endif // %%headerGuard%%\r\n"; | |||
| const char* BinaryData::jucer_ComponentTemplate_h = (const char*) temp_b930c59; | |||
| //================== jucer_MainConsoleAppTemplate.cpp ================== | |||
| static const unsigned char temp_a4c7812a[] = | |||
| "/*\r\n" | |||
| @@ -25,12 +25,6 @@ namespace BinaryData | |||
| extern const char* jucer_AudioPluginFilterTemplate_h; | |||
| const int jucer_AudioPluginFilterTemplate_hSize = 2353; | |||
| extern const char* jucer_ComponentTemplate_cpp; | |||
| const int jucer_ComponentTemplate_cppSize = 2274; | |||
| extern const char* jucer_ComponentTemplate_h; | |||
| const int jucer_ComponentTemplate_hSize = 2239; | |||
| extern const char* jucer_MainConsoleAppTemplate_cpp; | |||
| const int jucer_MainConsoleAppTemplate_cppSize = 749; | |||
| @@ -29,56 +29,6 @@ | |||
| </CONFIGURATIONS> | |||
| <MAINGROUP name="The Jucer" id="NhrJq66R"> | |||
| <GROUP id="EmpOiUg6" name="Model"> | |||
| <GROUP id="r9Z0VgmVt" name="Component"> | |||
| <FILE id="cAfGal6GQ" name="jucer_CodeGenerator.cpp" compile="1" resource="0" | |||
| file="Source/model/Component/jucer_CodeGenerator.cpp"/> | |||
| <FILE id="Qibg2oEYn" name="jucer_CodeGenerator.h" compile="0" resource="0" | |||
| file="Source/model/Component/jucer_CodeGenerator.h"/> | |||
| <FILE id="9RinhqJ0h" name="jucer_ComponentDocument.cpp" compile="1" | |||
| resource="0" file="Source/model/Component/jucer_ComponentDocument.cpp"/> | |||
| <FILE id="1i1F8pBgt" name="jucer_ComponentDocument.h" compile="0" resource="0" | |||
| file="Source/model/Component/jucer_ComponentDocument.h"/> | |||
| <GROUP id="fX4b21TeV" name="Types"> | |||
| <FILE id="Vy9PjpAR5" name="jucer_ComboBox.h" compile="0" resource="0" | |||
| file="Source/model/Component/Types/jucer_ComboBox.h"/> | |||
| <FILE id="ReDOix8hj" name="jucer_ComponentTypeManager.cpp" compile="1" | |||
| resource="0" file="Source/model/Component/Types/jucer_ComponentTypeManager.cpp"/> | |||
| <FILE id="u1zS2mcPU" name="jucer_ComponentTypeManager.h" compile="0" | |||
| resource="0" file="Source/model/Component/Types/jucer_ComponentTypeManager.h"/> | |||
| <FILE id="qqDkB89pF" name="jucer_ComponentTypes.h" compile="0" resource="0" | |||
| file="Source/model/Component/Types/jucer_ComponentTypes.h"/> | |||
| <FILE id="oiNs8GZo" name="jucer_GenericComponent.h" compile="0" resource="0" | |||
| file="Source/model/Component/Types/jucer_GenericComponent.h"/> | |||
| <FILE id="lmrNPax3E" name="jucer_GroupComponent.h" compile="0" resource="0" | |||
| file="Source/model/Component/Types/jucer_GroupComponent.h"/> | |||
| <FILE id="fUXMrXWsn" name="jucer_JucerComponent.h" compile="0" resource="0" | |||
| file="Source/model/Component/Types/jucer_JucerComponent.h"/> | |||
| <FILE id="FpznvfhuR" name="jucer_Label.h" compile="0" resource="0" | |||
| file="Source/model/Component/Types/jucer_Label.h"/> | |||
| <FILE id="UN9mKr0Ex" name="jucer_Slider.h" compile="0" resource="0" | |||
| file="Source/model/Component/Types/jucer_Slider.h"/> | |||
| <FILE id="QxRfjFUjL" name="jucer_TabbedComponent.h" compile="0" resource="0" | |||
| file="Source/model/Component/Types/jucer_TabbedComponent.h"/> | |||
| <FILE id="Cb8vXkAtU" name="jucer_TextButton.h" compile="0" resource="0" | |||
| file="Source/model/Component/Types/jucer_TextButton.h"/> | |||
| <FILE id="Rc1C9l1Lk" name="jucer_TextEditor.h" compile="0" resource="0" | |||
| file="Source/model/Component/Types/jucer_TextEditor.h"/> | |||
| <FILE id="BwDu2gfjb" name="jucer_ToggleButton.h" compile="0" resource="0" | |||
| file="Source/model/Component/Types/jucer_ToggleButton.h"/> | |||
| <FILE id="FEcXNQqY" name="jucer_Viewport.h" compile="0" resource="0" | |||
| file="Source/model/Component/Types/jucer_Viewport.h"/> | |||
| </GROUP> | |||
| </GROUP> | |||
| <GROUP id="HpUkRSarI" name="Drawable"> | |||
| <FILE id="ncwNLhJd" name="jucer_DrawableDocument.cpp" compile="1" resource="0" | |||
| file="Source/model/Drawable/jucer_DrawableDocument.cpp"/> | |||
| <FILE id="qMcrWuCal" name="jucer_DrawableDocument.h" compile="0" resource="0" | |||
| file="Source/model/Drawable/jucer_DrawableDocument.h"/> | |||
| <FILE id="9y0VHaD" name="jucer_DrawableTypeHandler.cpp" compile="1" | |||
| resource="0" file="Source/model/Drawable/jucer_DrawableTypeHandler.cpp"/> | |||
| <FILE id="tGjXOXiR9" name="jucer_DrawableTypeHandler.h" compile="0" | |||
| resource="0" file="Source/model/Drawable/jucer_DrawableTypeHandler.h"/> | |||
| </GROUP> | |||
| <GROUP id="na25KSPIj" name="Project"> | |||
| <FILE id="jqL1mb9xp" name="jucer_NewFileWizard.cpp" compile="1" resource="0" | |||
| file="Source/model/Project/jucer_NewFileWizard.cpp"/> | |||
| @@ -117,46 +67,6 @@ | |||
| <FILE id="aZC2eXVL" name="jucer_SourceCodeEditor.h" compile="0" resource="0" | |||
| file="Source/ui/Code Editor/jucer_SourceCodeEditor.h"/> | |||
| </GROUP> | |||
| <GROUP id="d2joUoRvF" name="Component Editor"> | |||
| <FILE id="Q48V5uBKu" name="jucer_ComponentEditor.cpp" compile="1" resource="0" | |||
| file="Source/ui/Component Editor/jucer_ComponentEditor.cpp"/> | |||
| <FILE id="B1zNCvltV" name="jucer_ComponentEditor.h" compile="0" resource="0" | |||
| file="Source/ui/Component Editor/jucer_ComponentEditor.h"/> | |||
| <FILE id="PYpzAE3jK" name="jucer_ComponentEditorCanvas.h" compile="0" | |||
| resource="0" file="Source/ui/Component Editor/jucer_ComponentEditorCanvas.h"/> | |||
| <FILE id="pqP7rsm8g" name="jucer_ComponentEditorCodeView.h" compile="0" | |||
| resource="0" file="Source/ui/Component Editor/jucer_ComponentEditorCodeView.h"/> | |||
| <FILE id="oUOqiYNk0" name="jucer_ComponentEditorToolbar.h" compile="0" | |||
| resource="0" file="Source/ui/Component Editor/jucer_ComponentEditorToolbar.h"/> | |||
| <FILE id="B9QzpSD6c" name="jucer_ComponentEditorTreeView.h" compile="0" | |||
| resource="0" file="Source/ui/Component Editor/jucer_ComponentEditorTreeView.h"/> | |||
| <FILE id="OUefpLz58" name="jucer_ComponentViewer.cpp" compile="1" resource="0" | |||
| file="Source/ui/Component Editor/jucer_ComponentViewer.cpp"/> | |||
| <FILE id="nTJT0X7O" name="jucer_ComponentViewer.h" compile="0" resource="0" | |||
| file="Source/ui/Component Editor/jucer_ComponentViewer.h"/> | |||
| </GROUP> | |||
| <GROUP id="VLkoRqu1c" name="Drawable Editor"> | |||
| <FILE id="0eWoa5Ttv" name="jucer_DrawableEditor.cpp" compile="1" resource="0" | |||
| file="Source/ui/Drawable Editor/jucer_DrawableEditor.cpp"/> | |||
| <FILE id="66AHRmzWg" name="jucer_DrawableEditor.h" compile="0" resource="0" | |||
| file="Source/ui/Drawable Editor/jucer_DrawableEditor.h"/> | |||
| <FILE id="fl8nLMRQB" name="jucer_DrawableEditorCanvas.h" compile="0" | |||
| resource="0" file="Source/ui/Drawable Editor/jucer_DrawableEditorCanvas.h"/> | |||
| <FILE id="NzwakrI5" name="jucer_DrawableEditorToolbar.h" compile="0" | |||
| resource="0" file="Source/ui/Drawable Editor/jucer_DrawableEditorToolbar.h"/> | |||
| <FILE id="ORcbUPiNo" name="jucer_DrawableEditorTreeView.h" compile="0" | |||
| resource="0" file="Source/ui/Drawable Editor/jucer_DrawableEditorTreeView.h"/> | |||
| </GROUP> | |||
| <GROUP id="DC6B03UF" name="Editor Base"> | |||
| <FILE id="am9MUoCGw" name="jucer_EditorCanvas.cpp" compile="1" resource="0" | |||
| file="Source/ui/Editor Base/jucer_EditorCanvas.cpp"/> | |||
| <FILE id="3JNJWgTRC" name="jucer_EditorCanvas.h" compile="0" resource="0" | |||
| file="Source/ui/Editor Base/jucer_EditorCanvas.h"/> | |||
| <FILE id="0Pma8CXyT" name="jucer_EditorDragOperation.h" compile="0" | |||
| resource="0" file="Source/ui/Editor Base/jucer_EditorDragOperation.h"/> | |||
| <FILE id="zmldA8b" name="jucer_EditorPanel.h" compile="0" resource="0" | |||
| file="Source/ui/Editor Base/jucer_EditorPanel.h"/> | |||
| </GROUP> | |||
| <FILE id="uuKrNBIAS" name="jucer_CommandIDs.h" compile="0" resource="0" | |||
| file="Source/ui/jucer_CommandIDs.h"/> | |||
| <FILE id="p410VfaaI" name="jucer_DocumentEditorComponent.cpp" compile="1" | |||
| @@ -207,38 +117,32 @@ | |||
| file="Source/utility/jucer_CodeHelpers.cpp"/> | |||
| <FILE id="L5cAZdBjr" name="jucer_CodeHelpers.h" compile="0" resource="0" | |||
| file="Source/utility/jucer_CodeHelpers.h"/> | |||
| <FILE id="hmWl0ODQe" name="jucer_ColourPropertyComponent.h" compile="0" | |||
| resource="0" file="Source/utility/jucer_ColourPropertyComponent.h"/> | |||
| <FILE id="bjibbvm3S" name="jucer_Colours.h" compile="0" resource="0" | |||
| file="Source/utility/jucer_Colours.h"/> | |||
| <FILE id="DDCunFHcy" name="jucer_CoordinatePropertyComponent.h" compile="0" | |||
| resource="0" file="Source/utility/jucer_CoordinatePropertyComponent.h"/> | |||
| <FILE id="WlEYep7NN" name="jucer_FileHelpers.cpp" compile="1" resource="0" | |||
| file="Source/utility/jucer_FileHelpers.cpp"/> | |||
| <FILE id="4paLQmzFf" name="jucer_FileHelpers.h" compile="0" resource="0" | |||
| file="Source/utility/jucer_FileHelpers.h"/> | |||
| <FILE id="e22s8D7" name="jucer_FillTypePropertyComponent.h" compile="0" | |||
| resource="0" file="Source/utility/jucer_FillTypePropertyComponent.h"/> | |||
| <FILE id="NKAki4f" name="jucer_FontPropertyComponent.h" compile="0" | |||
| resource="0" file="Source/utility/jucer_FontPropertyComponent.h"/> | |||
| <FILE id="ZYrHhSqnP" name="jucer_MarkerListBase.h" compile="0" resource="0" | |||
| file="Source/utility/jucer_MarkerListBase.h"/> | |||
| <FILE id="4RGcC516Z" name="jucer_MiscUtilities.cpp" compile="1" resource="0" | |||
| file="Source/utility/jucer_MiscUtilities.cpp"/> | |||
| <FILE id="kNy0Xya3H" name="jucer_MiscUtilities.h" compile="0" resource="0" | |||
| file="Source/utility/jucer_MiscUtilities.h"/> | |||
| <FILE id="EHsA3FM" name="jucer_PresetIDs.h" compile="0" resource="0" | |||
| file="Source/utility/jucer_PresetIDs.h"/> | |||
| <FILE id="nMKxowe0" name="jucer_RelativePath.h" compile="0" resource="0" | |||
| file="Source/utility/jucer_RelativePath.h"/> | |||
| <FILE id="gb8kYJDkJ" name="jucer_StoredSettings.cpp" compile="1" resource="0" | |||
| file="Source/utility/jucer_StoredSettings.cpp"/> | |||
| <FILE id="v3HgXpLOM" name="jucer_StoredSettings.h" compile="0" resource="0" | |||
| file="Source/utility/jucer_StoredSettings.h"/> | |||
| <FILE id="Ihan8wumM" name="jucer_TickIterator.h" compile="0" resource="0" | |||
| file="Source/utility/jucer_TickIterator.h"/> | |||
| <FILE id="0uDzmAAml" name="jucer_ValueSourceHelpers.h" compile="0" | |||
| resource="0" file="Source/utility/jucer_ValueSourceHelpers.h"/> | |||
| </GROUP> | |||
| <GROUP id="A1dyCqqMO" name="Main"> | |||
| <FILE id="SvK1d8C" name="jucer_Application.h" compile="0" resource="0" | |||
| file="Source/jucer_Application.h"/> | |||
| <FILE id="UXOWGM7" name="jucer_CommonHeaders.h" compile="0" resource="0" | |||
| file="Source/jucer_CommonHeaders.h"/> | |||
| <FILE id="bUx7JL9VV" name="jucer_Headers.h" compile="0" resource="0" | |||
| file="Source/jucer_Headers.h"/> | |||
| <FILE id="IOacTGF1" name="jucer_Main.cpp" compile="1" resource="0" | |||
| @@ -257,10 +161,6 @@ | |||
| resource="1" file="Source/templates/jucer_AudioPluginFilterTemplate.cpp"/> | |||
| <FILE id="R0cR4dCe" name="jucer_AudioPluginFilterTemplate.h" compile="0" | |||
| resource="1" file="Source/templates/jucer_AudioPluginFilterTemplate.h"/> | |||
| <FILE id="KU4AroVSu" name="jucer_ComponentTemplate.cpp" compile="0" | |||
| resource="1" file="Source/templates/jucer_ComponentTemplate.cpp"/> | |||
| <FILE id="HiDPozmU" name="jucer_ComponentTemplate.h" compile="0" resource="1" | |||
| file="Source/templates/jucer_ComponentTemplate.h"/> | |||
| <FILE id="pMNQAeUWK" name="jucer_MainConsoleAppTemplate.cpp" compile="0" | |||
| resource="1" file="Source/templates/jucer_MainConsoleAppTemplate.cpp"/> | |||
| <FILE id="IB8HRkRP1" name="jucer_MainTemplate.cpp" compile="0" resource="1" | |||
| @@ -0,0 +1,126 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_APPLICATION_H_6595C2A8__ | |||
| #define __JUCER_APPLICATION_H_6595C2A8__ | |||
| #include "jucer_Headers.h" | |||
| #include "ui/jucer_MainWindow.h" | |||
| ApplicationCommandManager* commandManager = 0; | |||
| //============================================================================== | |||
| class JucerApplication : public JUCEApplication | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| JucerApplication() {} | |||
| ~JucerApplication() {} | |||
| //============================================================================== | |||
| void initialise (const String& commandLine) | |||
| { | |||
| /* Running a command-line of the form "Jucer --resave foobar.jucer" will try to load that | |||
| jucer file and re-export all of its projects. | |||
| */ | |||
| if (commandLine.startsWithIgnoreCase ("-resave ") || commandLine.startsWithIgnoreCase ("--resave ")) | |||
| { | |||
| Project::resaveJucerFile (File::getCurrentWorkingDirectory() | |||
| .getChildFile (commandLine.fromFirstOccurrenceOf (" ", false, false).unquoted())); | |||
| quit(); | |||
| return; | |||
| } | |||
| commandManager = new ApplicationCommandManager(); | |||
| commandManager->registerAllCommandsForTarget (this); | |||
| theMainWindow = new MainWindow(); | |||
| doExtraInitialisation(); | |||
| ImageCache::setCacheTimeout (30 * 1000); | |||
| if (commandLine.trim().isNotEmpty() && ! commandLine.trim().startsWithChar ('-')) | |||
| anotherInstanceStarted (commandLine); | |||
| theMainWindow->reloadLastProject(); | |||
| theMainWindow->getLookAndFeel().setColour (ColourSelector::backgroundColourId, Colours::transparentBlack); | |||
| } | |||
| void shutdown() | |||
| { | |||
| theMainWindow = 0; | |||
| OpenDocumentManager::deleteInstance(); | |||
| deleteAndZero (commandManager); | |||
| } | |||
| //============================================================================== | |||
| void systemRequestedQuit() | |||
| { | |||
| if (theMainWindow == 0 || theMainWindow->closeCurrentProject()) | |||
| { | |||
| theMainWindow = 0; | |||
| StoredSettings::deleteInstance(); | |||
| quit(); | |||
| } | |||
| } | |||
| //============================================================================== | |||
| const String getApplicationName() | |||
| { | |||
| return "The Jucer V" + getApplicationVersion(); | |||
| } | |||
| const String getApplicationVersion() | |||
| { | |||
| return ProjectInfo::versionString; | |||
| } | |||
| bool moreThanOneInstanceAllowed() | |||
| { | |||
| #ifndef JUCE_LINUX | |||
| return false; | |||
| #else | |||
| return true; //xxx should be false but doesn't work on linux.. | |||
| #endif | |||
| } | |||
| void anotherInstanceStarted (const String& commandLine) | |||
| { | |||
| if (theMainWindow != 0) | |||
| theMainWindow->openFile (commandLine.unquoted()); | |||
| } | |||
| virtual void doExtraInitialisation() {} | |||
| private: | |||
| ScopedPointer <MainWindow> theMainWindow; | |||
| }; | |||
| #endif // __JUCER_APPLICATION_H_6595C2A8__ | |||
| @@ -23,14 +23,31 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "jucer_TextButton.h" | |||
| #include "jucer_ToggleButton.h" | |||
| #include "jucer_TextEditor.h" | |||
| #include "jucer_Label.h" | |||
| #include "jucer_ComboBox.h" | |||
| #include "jucer_Slider.h" | |||
| #include "jucer_GroupComponent.h" | |||
| #include "jucer_Viewport.h" | |||
| #include "jucer_TabbedComponent.h" | |||
| #include "jucer_JucerComponent.h" | |||
| #include "jucer_GenericComponent.h" | |||
| #ifndef __JUCER_COMMONINCLUDES_H__ | |||
| #define __JUCER_COMMONINCLUDES_H__ | |||
| #include "utility/jucer_StoredSettings.h" | |||
| #include "utility/jucer_MiscUtilities.h" | |||
| #include "utility/jucer_CodeHelpers.h" | |||
| #include "utility/jucer_FileHelpers.h" | |||
| #include "utility/jucer_RelativePath.h" | |||
| #include "utility/jucer_ValueSourceHelpers.h" | |||
| #include "utility/jucer_PresetIDs.h" | |||
| #include "ui/jucer_CommandIDs.h" | |||
| //============================================================================== | |||
| extern ApplicationCommandManager* commandManager; | |||
| //============================================================================== | |||
| static const char* const newLine = "\r\n"; | |||
| const char* const projectItemDragType = "Project Items"; | |||
| const char* const drawableItemDragType = "Drawable Items"; | |||
| const char* const componentItemDragType = "Components"; | |||
| const char* const sourceFileExtensions = "cpp;mm;m;c;h;hpp"; | |||
| const char* const headerFileExtensions = "h;hpp"; | |||
| #endif | |||
| @@ -28,115 +28,11 @@ | |||
| #ifdef _MSC_VER | |||
| #pragma warning (disable: 4100 4505) | |||
| #define DONT_LIST_JUCE_AUTOLINKEDLIBS 1 | |||
| #endif | |||
| //============================================================================== | |||
| #include "../JuceLibraryCode/JuceHeader.h" | |||
| #include "utility/jucer_StoredSettings.h" | |||
| #include "utility/jucer_MiscUtilities.h" | |||
| #include "utility/jucer_CodeHelpers.h" | |||
| #include "utility/jucer_FileHelpers.h" | |||
| #include "utility/jucer_RelativePath.h" | |||
| #include "utility/jucer_ValueSourceHelpers.h" | |||
| #include "ui/jucer_CommandIDs.h" | |||
| #include "jucer_CommonHeaders.h" | |||
| //============================================================================== | |||
| extern ApplicationCommandManager* commandManager; | |||
| //============================================================================== | |||
| static const char* const newLine = "\r\n"; | |||
| const char* const projectItemDragType = "Project Items"; | |||
| const char* const drawableItemDragType = "Drawable Items"; | |||
| const char* const componentItemDragType = "Components"; | |||
| const char* const textFileExtensions = "cpp;h;hpp;mm;m;c;txt;xml;plist;rtf;html;htm;php;py;rb;cs"; | |||
| const char* const sourceFileExtensions = "cpp;mm;m;c;h;hpp"; | |||
| const char* const headerFileExtensions = "h;hpp"; | |||
| const int numSwatchColours = 24; | |||
| const int snapSizes[] = { 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32 }; | |||
| const float snapDistance = 8.0f; | |||
| static const Colour alignmentMarkerColour (0x77ff0000); | |||
| static const Colour resizableBorderColour (0x7066aaff); | |||
| // Handy list of static Identifiers.. | |||
| namespace Ids | |||
| { | |||
| #define DECLARE_ID(name) const Identifier name (#name) | |||
| DECLARE_ID (text); | |||
| DECLARE_ID (name); | |||
| DECLARE_ID (file); | |||
| DECLARE_ID (font); | |||
| DECLARE_ID (mode); | |||
| DECLARE_ID (type); | |||
| DECLARE_ID (version); | |||
| DECLARE_ID (position); | |||
| DECLARE_ID (source); | |||
| DECLARE_ID (readOnly); | |||
| DECLARE_ID (editMode); | |||
| DECLARE_ID (justification); | |||
| DECLARE_ID (items); | |||
| DECLARE_ID (editable); | |||
| DECLARE_ID (textJustification); | |||
| DECLARE_ID (unselectedText); | |||
| DECLARE_ID (noItemsText); | |||
| DECLARE_ID (min); | |||
| DECLARE_ID (max); | |||
| DECLARE_ID (width); | |||
| DECLARE_ID (height); | |||
| DECLARE_ID (background); | |||
| DECLARE_ID (interval); | |||
| DECLARE_ID (textBoxPos); | |||
| DECLARE_ID (textBoxWidth); | |||
| DECLARE_ID (textBoxHeight); | |||
| DECLARE_ID (skew); | |||
| DECLARE_ID (scrollBarV); | |||
| DECLARE_ID (scrollBarH); | |||
| DECLARE_ID (scrollbarWidth); | |||
| DECLARE_ID (initialState); | |||
| DECLARE_ID (scrollbarsShown); | |||
| DECLARE_ID (caretVisible); | |||
| DECLARE_ID (popupMenuEnabled); | |||
| DECLARE_ID (radioGroup); | |||
| DECLARE_ID (connectedLeft); | |||
| DECLARE_ID (connectedRight); | |||
| DECLARE_ID (connectedTop); | |||
| DECLARE_ID (connectedBottom); | |||
| DECLARE_ID (juceFolder); | |||
| DECLARE_ID (targetFolder); | |||
| DECLARE_ID (vstFolder); | |||
| DECLARE_ID (rtasFolder); | |||
| DECLARE_ID (auFolder); | |||
| DECLARE_ID (extraCompilerFlags); | |||
| DECLARE_ID (extraLinkerFlags); | |||
| DECLARE_ID (extraDefs); | |||
| DECLARE_ID (libraryName_Debug); | |||
| DECLARE_ID (libraryName_Release); | |||
| DECLARE_ID (libraryType); | |||
| DECLARE_ID (isDebug); | |||
| DECLARE_ID (targetName); | |||
| DECLARE_ID (binaryPath); | |||
| DECLARE_ID (optimisation); | |||
| DECLARE_ID (defines); | |||
| DECLARE_ID (headerPath); | |||
| DECLARE_ID (osxSDK); | |||
| DECLARE_ID (osxCompatibility); | |||
| DECLARE_ID (jucerVersion); | |||
| DECLARE_ID (projectType); | |||
| DECLARE_ID (juceLinkage); | |||
| DECLARE_ID (buildVST); | |||
| DECLARE_ID (bundleIdentifier); | |||
| DECLARE_ID (compile); | |||
| DECLARE_ID (resource); | |||
| DECLARE_ID (className); | |||
| DECLARE_ID (classDesc); | |||
| DECLARE_ID (controlPoint); | |||
| const Identifier class_ ("class"); | |||
| const Identifier id_ ("id"); | |||
| } | |||
| #endif // __JUCER_HEADERS_JUCEHEADER__ | |||
| @@ -23,136 +23,6 @@ | |||
| ============================================================================== | |||
| */ | |||
| #include "jucer_Headers.h" | |||
| #include "ui/jucer_MainWindow.h" | |||
| ApplicationCommandManager* commandManager = 0; | |||
| //============================================================================== | |||
| class JucerApplication : public JUCEApplication | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| JucerApplication() | |||
| { | |||
| } | |||
| ~JucerApplication() | |||
| { | |||
| } | |||
| //============================================================================== | |||
| void initialise (const String& commandLine) | |||
| { | |||
| /* Running a command-line of the form "Jucer --resave foobar.jucer" will try to load that | |||
| jucer file and re-export all of its projects. | |||
| */ | |||
| if (commandLine.startsWithIgnoreCase ("-resave ") || commandLine.startsWithIgnoreCase ("--resave ")) | |||
| { | |||
| resaveJucerFile (File::getCurrentWorkingDirectory() | |||
| .getChildFile (commandLine.fromFirstOccurrenceOf (" ", false, false).unquoted())); | |||
| quit(); | |||
| return; | |||
| } | |||
| commandManager = new ApplicationCommandManager(); | |||
| theMainWindow = new MainWindow(); | |||
| theMainWindow->setVisible (true); | |||
| ImageCache::setCacheTimeout (30 * 1000); | |||
| if (commandLine.trim().isNotEmpty() | |||
| && ! commandLine.trim().startsWithChar ('-')) | |||
| anotherInstanceStarted (commandLine); | |||
| theMainWindow->reloadLastProject(); | |||
| theMainWindow->getLookAndFeel().setColour (ColourSelector::backgroundColourId, Colours::transparentBlack); | |||
| } | |||
| void shutdown() | |||
| { | |||
| theMainWindow = 0; | |||
| OpenDocumentManager::deleteInstance(); | |||
| deleteAndZero (commandManager); | |||
| } | |||
| //============================================================================== | |||
| void systemRequestedQuit() | |||
| { | |||
| if (theMainWindow == 0 || theMainWindow->closeCurrentProject()) | |||
| { | |||
| theMainWindow = 0; | |||
| StoredSettings::deleteInstance(); | |||
| quit(); | |||
| } | |||
| } | |||
| //============================================================================== | |||
| const String getApplicationName() | |||
| { | |||
| return "The Jucer V" + getApplicationVersion(); | |||
| } | |||
| const String getApplicationVersion() | |||
| { | |||
| return ProjectInfo::versionString; | |||
| } | |||
| bool moreThanOneInstanceAllowed() | |||
| { | |||
| #ifndef JUCE_LINUX | |||
| return false; | |||
| #else | |||
| return true; //xxx should be false but doesn't work on linux.. | |||
| #endif | |||
| } | |||
| void anotherInstanceStarted (const String& commandLine) | |||
| { | |||
| if (theMainWindow != 0) | |||
| theMainWindow->openFile (commandLine.unquoted()); | |||
| } | |||
| private: | |||
| ScopedPointer <MainWindow> theMainWindow; | |||
| void resaveJucerFile (const File& file) | |||
| { | |||
| if (! file.exists()) | |||
| { | |||
| std::cout << "The file " << file.getFullPathName() << " doesn't exist!" << std::endl; | |||
| return; | |||
| } | |||
| if (! file.hasFileExtension (Project::projectFileExtension)) | |||
| { | |||
| std::cout << file.getFullPathName() << " isn't a valid jucer project file!" << std::endl; | |||
| return; | |||
| } | |||
| ScopedPointer <Project> newDoc (new Project (file)); | |||
| if (! newDoc->loadFrom (file, true)) | |||
| { | |||
| std::cout << "Failed to load the project file: " << file.getFullPathName() << std::endl; | |||
| return; | |||
| } | |||
| std::cout << "The Jucer - Re-saving file: " << file.getFullPathName() << std::endl; | |||
| String error (newDoc->saveDocument (file)); | |||
| if (error.isNotEmpty()) | |||
| { | |||
| std::cout << "Error when writing project: " << error << std::endl; | |||
| return; | |||
| } | |||
| } | |||
| }; | |||
| #include "jucer_Application.h" | |||
| START_JUCE_APPLICATION(JucerApplication) | |||
| @@ -1,134 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifdef ADD_TO_LIST | |||
| ADD_TO_LIST (ComboBoxHandler); | |||
| #else | |||
| #include "../jucer_ComponentDocument.h" | |||
| //============================================================================== | |||
| class ComboBoxHandler : public ComponentTypeHelper<ComboBox> | |||
| { | |||
| public: | |||
| ComboBoxHandler() : ComponentTypeHelper<ComboBox> ("ComboBox", "ComboBox", "COMBOBOX", "comboBox") | |||
| { | |||
| addEditableColour (ComboBox::backgroundColourId, "Background", "backgroundColour"); | |||
| addEditableColour (ComboBox::textColourId, "Text", "textColour"); | |||
| addEditableColour (ComboBox::outlineColourId, "Outline", "outlineColour"); | |||
| addEditableColour (ComboBox::buttonColourId, "Button", "buttonColour"); | |||
| addEditableColour (ComboBox::arrowColourId, "Arrow", "arrowColour"); | |||
| } | |||
| ~ComboBoxHandler() {} | |||
| Component* createComponent() { return new ComboBox(); } | |||
| const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 180, 24); } | |||
| void initialiseNew (ComponentTypeInstance& item) | |||
| { | |||
| item.set (Ids::items, "Item 1\nItem 2"); | |||
| item.set (Ids::editable, false); | |||
| item.set (Ids::textJustification, (int) Justification::centredLeft); | |||
| item.set (Ids::unselectedText, ""); | |||
| item.set (Ids::noItemsText, "(No Choices)"); | |||
| } | |||
| void updateItems (ComboBox* comp, const String& itemString) | |||
| { | |||
| StringArray items; | |||
| items.addLines (itemString); | |||
| items.removeEmptyStrings (true); | |||
| StringArray existingItems; | |||
| for (int i = 0; i < comp->getNumItems(); ++i) | |||
| existingItems.add (comp->getItemText (i)); | |||
| if (existingItems != items) | |||
| { | |||
| comp->clear(); | |||
| for (int i = 0; i < items.size(); ++i) | |||
| comp->addItem (items[i], i + 1); | |||
| } | |||
| } | |||
| void update (ComponentTypeInstance& item, ComboBox* comp) | |||
| { | |||
| updateItems (comp, item [Ids::items]); | |||
| comp->setEditableText (item [Ids::editable]); | |||
| comp->setJustificationType ((int) item [Ids::textJustification]); | |||
| comp->setTextWhenNothingSelected (item [Ids::unselectedText].toString()); | |||
| comp->setTextWhenNoChoicesAvailable (item [Ids::noItemsText].toString()); | |||
| } | |||
| void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) | |||
| { | |||
| item.addTooltipProperty (props); | |||
| item.addFocusOrderProperty (props); | |||
| props.add (new TextPropertyComponent (item.getValue (Ids::items), "Items", 16384, true)); | |||
| props.getLast()->setTooltip ("A list of items to use to initialise the ComboBox"); | |||
| props.add (new BooleanPropertyComponent (item.getValue (Ids::editable), "Editable", "Text is editable")); | |||
| item.addJustificationProperty (props, "Text Position", item.getValue (Ids::textJustification), false); | |||
| props.add (new TextPropertyComponent (item.getValue (Ids::unselectedText), "Text when none selected", 512, false)); | |||
| props.add (new TextPropertyComponent (item.getValue (Ids::noItemsText), "Text when no items", 512, false)); | |||
| addEditableColourProperties (item, props); | |||
| } | |||
| void createCode (ComponentTypeInstance& item, CodeGenerator& code) | |||
| { | |||
| ComboBox defaultBox; | |||
| code.constructorCode | |||
| << item.createConstructorStatement (String::empty) | |||
| << item.getMemberName() << "->setEditableText (" << CodeHelpers::boolLiteral (item [Ids::editable]) << ");" << newLine; | |||
| Justification justification ((int) item [Ids::textJustification]); | |||
| if (justification.getFlags() != 0 && justification != defaultBox.getJustificationType()) | |||
| code.constructorCode << item.getMemberName() << "->setJustificationType (" << CodeHelpers::justificationToCode (justification) << ");" << newLine; | |||
| if (item [Ids::unselectedText].toString() != defaultBox.getTextWhenNothingSelected()) | |||
| code.constructorCode << item.getMemberName() << "->setTextWhenNothingSelected (" | |||
| << CodeHelpers::stringLiteral (item [Ids::unselectedText]) << ");" << newLine; | |||
| if (item [Ids::noItemsText].toString() != defaultBox.getTextWhenNoChoicesAvailable()) | |||
| code.constructorCode << item.getMemberName() << "->setTextWhenNoChoicesAvailable (" | |||
| << CodeHelpers::stringLiteral (item [Ids::noItemsText]) << ");" << newLine; | |||
| StringArray items; | |||
| items.addLines (item [Ids::items]); | |||
| items.removeEmptyStrings (true); | |||
| for (int i = 0; i < items.size(); ++i) | |||
| code.constructorCode << item.getMemberName() << "->addItem (" << CodeHelpers::stringLiteral (items[i]) << ");" << newLine; | |||
| } | |||
| }; | |||
| #endif | |||
| @@ -1,414 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #include "jucer_ComponentTypeManager.h" | |||
| #include "jucer_ComponentTypes.h" | |||
| #include "../../../utility/jucer_CoordinatePropertyComponent.h" | |||
| #include "../../../utility/jucer_FontPropertyComponent.h" | |||
| //============================================================================== | |||
| class ComponentBoundsEditor : public CoordinatePropertyComponent | |||
| { | |||
| public: | |||
| enum Type | |||
| { | |||
| left, top, right, bottom | |||
| }; | |||
| //============================================================================== | |||
| ComponentBoundsEditor (ComponentDocument& document_, const String& name, Type type_, | |||
| const ValueTree& compState_, const Value& coordValue_) | |||
| : CoordinatePropertyComponent (&document_, name, | |||
| Value (new CoordExtractor (coordValue_, type_)), | |||
| type_ == left || type_ == right), | |||
| document (document_), | |||
| type (type_), | |||
| compState (compState_) | |||
| { | |||
| } | |||
| ~ComponentBoundsEditor() | |||
| { | |||
| } | |||
| //============================================================================== | |||
| class CoordExtractor : public Value::ValueSource, | |||
| public Value::Listener | |||
| { | |||
| public: | |||
| CoordExtractor (const Value& sourceValue_, Type type_) | |||
| : sourceValue (sourceValue_), type (type_) | |||
| { | |||
| sourceValue.addListener (this); | |||
| } | |||
| ~CoordExtractor() {} | |||
| const var getValue() const | |||
| { | |||
| RelativeRectangle r (sourceValue.toString()); | |||
| return getCoord (r).toString(); | |||
| } | |||
| void setValue (const var& newValue) | |||
| { | |||
| RelativeRectangle r (sourceValue.toString()); | |||
| RelativeCoordinate& coord = getCoord (r); | |||
| coord = RelativeCoordinate (newValue.toString(), type == left || type == right); | |||
| const String newVal (r.toString()); | |||
| if (sourceValue != newVal) | |||
| sourceValue = newVal; | |||
| } | |||
| void valueChanged (Value&) | |||
| { | |||
| sendChangeMessage (true); | |||
| } | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| protected: | |||
| Value sourceValue; | |||
| Type type; | |||
| static RelativeCoordinate& getCoordForType (const Type type, RelativeRectangle& r) | |||
| { | |||
| switch (type) | |||
| { | |||
| case left: return r.left; | |||
| case right: return r.right; | |||
| case top: return r.top; | |||
| case bottom: return r.bottom; | |||
| default: jassertfalse; break; | |||
| } | |||
| return r.left; | |||
| } | |||
| RelativeCoordinate& getCoord (RelativeRectangle& r) const | |||
| { | |||
| return getCoordForType (type, r); | |||
| } | |||
| CoordExtractor (const CoordExtractor&); | |||
| const CoordExtractor& operator= (const CoordExtractor&); | |||
| }; | |||
| const String pickMarker (TextButton* button, const String& currentMarker, bool isAnchor1) | |||
| { | |||
| RelativeCoordinate coord (getCoordinate()); | |||
| PopupMenu m; | |||
| document.addComponentMarkerMenuItems (compState, getTypeName(), coord, m, isAnchor1, type == left || type == right); | |||
| const int r = m.showAt (button); | |||
| if (r > 0) | |||
| return document.getChosenMarkerMenuItem (compState, coord, r, type == left || type == right); | |||
| return String::empty; | |||
| } | |||
| private: | |||
| ComponentDocument& document; | |||
| Type type; | |||
| ValueTree compState; | |||
| const String getTypeName() const | |||
| { | |||
| switch (type) | |||
| { | |||
| case left: return RelativeCoordinate::Strings::left; | |||
| case right: return RelativeCoordinate::Strings::right; | |||
| case top: return RelativeCoordinate::Strings::top; | |||
| case bottom: return RelativeCoordinate::Strings::bottom; | |||
| default: jassertfalse; break; | |||
| } | |||
| return String::empty; | |||
| } | |||
| }; | |||
| //============================================================================== | |||
| ComponentTypeManager::ComponentTypeManager() | |||
| { | |||
| #define ADD_TO_LIST(HandlerType) handlers.add (new HandlerType()); | |||
| #include "jucer_ComponentTypes.h" | |||
| #undef ADD_TO_LIST | |||
| } | |||
| ComponentTypeManager::~ComponentTypeManager() | |||
| { | |||
| } | |||
| Component* ComponentTypeManager::createFromStoredType (ComponentDocument& document, const ValueTree& value) | |||
| { | |||
| ComponentTypeHandler* handler = getHandlerFor (value.getType()); | |||
| if (handler == 0) | |||
| return 0; | |||
| Component* c = handler->createComponent(); | |||
| if (c != 0) | |||
| { | |||
| ComponentTypeInstance item (document, value); | |||
| handler->updateComponent (item, c); | |||
| } | |||
| return c; | |||
| } | |||
| ComponentTypeHandler* ComponentTypeManager::getHandlerFor (const Identifier& type) | |||
| { | |||
| for (int i = handlers.size(); --i >= 0;) | |||
| if (handlers.getUnchecked(i)->getValueTreeType() == type) | |||
| return handlers.getUnchecked(i); | |||
| return 0; | |||
| } | |||
| const StringArray ComponentTypeManager::getDisplayNames() const | |||
| { | |||
| StringArray s; | |||
| for (int i = 0; i < handlers.size(); ++i) | |||
| s.add (handlers.getUnchecked(i)->getDisplayName()); | |||
| return s; | |||
| } | |||
| juce_ImplementSingleton_SingleThreaded (ComponentTypeManager); | |||
| //============================================================================== | |||
| ComponentTypeHandler::ComponentTypeHandler (const String& displayName_, const String& className_, | |||
| const Identifier& valueTreeType_, const String& memberNameRoot_) | |||
| : displayName (displayName_), className (className_), valueTreeType (valueTreeType_), | |||
| memberNameRoot (memberNameRoot_) | |||
| { | |||
| } | |||
| ComponentTypeHandler::~ComponentTypeHandler() | |||
| { | |||
| } | |||
| //============================================================================== | |||
| class CompMemberNameValueSource : public Value::ValueSource, | |||
| public Value::Listener | |||
| { | |||
| public: | |||
| CompMemberNameValueSource (ComponentTypeInstance& item_) | |||
| : sourceValue (item_.getValue (ComponentDocument::memberNameProperty)), | |||
| item (item_) | |||
| { | |||
| sourceValue.addListener (this); | |||
| } | |||
| ~CompMemberNameValueSource() {} | |||
| void valueChanged (Value&) { sendChangeMessage (true); } | |||
| const var getValue() const { return sourceValue.toString(); } | |||
| void setValue (const var& newValue) | |||
| { | |||
| if (newValue == sourceValue) | |||
| return; | |||
| const String name (item.getDocument().getNonexistentMemberName (newValue)); | |||
| if (sourceValue != name) | |||
| { | |||
| item.getDocument().renameAnchor (sourceValue.toString(), name); | |||
| sourceValue = name; | |||
| } | |||
| } | |||
| private: | |||
| Value sourceValue; | |||
| ComponentTypeInstance item; | |||
| CompMemberNameValueSource (const CompMemberNameValueSource&); | |||
| const CompMemberNameValueSource& operator= (const CompMemberNameValueSource&); | |||
| }; | |||
| //============================================================================== | |||
| ComponentTypeInstance::ComponentTypeInstance (ComponentDocument& document_, const ValueTree& state_) | |||
| : document (document_), state (state_) | |||
| { | |||
| } | |||
| Value ComponentTypeInstance::getValue (const Identifier& name) const | |||
| { | |||
| return state.getPropertyAsValue (name, document.getUndoManager()); | |||
| } | |||
| void ComponentTypeInstance::set (const Identifier& name, const var& value) | |||
| { | |||
| state.setProperty (name, value, 0); | |||
| } | |||
| ComponentTypeHandler* ComponentTypeInstance::getHandler() const | |||
| { | |||
| ComponentTypeHandler* const handler = ComponentTypeManager::getInstance()->getHandlerFor (state.getType()); | |||
| jassert (handler != 0); | |||
| return handler; | |||
| } | |||
| void ComponentTypeInstance::updateComponent (Component* comp) | |||
| { | |||
| getHandler()->updateComponent (*this, comp); | |||
| } | |||
| void ComponentTypeInstance::createProperties (Array <PropertyComponent*>& props) | |||
| { | |||
| getHandler()->createPropertyEditors (*this, props); | |||
| } | |||
| void ComponentTypeInstance::createCode (CodeGenerator& code) | |||
| { | |||
| code.addPrivateMember (getHandler()->getClassName (*this) + "*", getMemberName()); | |||
| code.memberInitialisers.add (getMemberName() + " (0)"); | |||
| getHandler()->createCode (*this, code); | |||
| } | |||
| //============================================================================== | |||
| void ComponentTypeInstance::initialiseNewItemBasics() | |||
| { | |||
| ComponentTypeHandler* handler = getHandler(); | |||
| set (ComponentDocument::compNameProperty, String::empty); | |||
| set (ComponentDocument::memberNameProperty, document.getNonexistentMemberName (handler->getMemberNameRoot())); | |||
| Rectangle<int> bounds (handler->getDefaultSize()); | |||
| int cw = document.getCanvasWidth().getValue(); | |||
| int ch = document.getCanvasHeight().getValue(); | |||
| bounds.setPosition (Random::getSystemRandom().nextInt (cw / 3) + cw / 4, | |||
| Random::getSystemRandom().nextInt (ch / 3) + ch / 4); | |||
| set (ComponentDocument::compBoundsProperty, RelativeRectangle (bounds.toFloat(), getMemberName()).toString()); | |||
| } | |||
| void ComponentTypeInstance::updateComponentBasics (Component* comp) | |||
| { | |||
| RelativeRectangle pos (state [ComponentDocument::compBoundsProperty].toString()); | |||
| comp->setBounds (pos.resolve (&document).getSmallestIntegerContainer()); | |||
| //comp->setName (state [ComponentDocument::compNameProperty]); | |||
| comp->setExplicitFocusOrder (state [ComponentDocument::compFocusOrderProperty]); | |||
| SettableTooltipClient* tooltipClient = dynamic_cast <SettableTooltipClient*> (comp); | |||
| if (tooltipClient != 0) | |||
| tooltipClient->setTooltip (state [ComponentDocument::compTooltipProperty]); | |||
| } | |||
| void ComponentTypeInstance::addMemberNameProperty (Array <PropertyComponent*>& props) | |||
| { | |||
| props.add (new TextPropertyComponent (Value (new CompMemberNameValueSource (*this)), | |||
| "Member Name", 256, false)); | |||
| } | |||
| void ComponentTypeInstance::addBoundsProperties (Array <PropertyComponent*>& props) | |||
| { | |||
| const Value bounds (getValue (ComponentDocument::compBoundsProperty)); | |||
| props.add (new ComponentBoundsEditor (document, "Left", ComponentBoundsEditor::left, state, bounds)); | |||
| props.add (new ComponentBoundsEditor (document, "Right", ComponentBoundsEditor::right, state, bounds)); | |||
| props.add (new ComponentBoundsEditor (document, "Top", ComponentBoundsEditor::top, state, bounds)); | |||
| props.add (new ComponentBoundsEditor (document, "Bottom", ComponentBoundsEditor::bottom, state, bounds)); | |||
| } | |||
| void ComponentTypeInstance::addTooltipProperty (Array <PropertyComponent*>& props) | |||
| { | |||
| props.add (new TextPropertyComponent (getValue (ComponentDocument::compTooltipProperty), | |||
| "Tooltip", 4096, false)); | |||
| } | |||
| void ComponentTypeInstance::addFocusOrderProperty (Array <PropertyComponent*>& props) | |||
| { | |||
| props.add (new TextPropertyComponent (Value (new NumericValueSource<int> (getValue (ComponentDocument::compFocusOrderProperty))), | |||
| "Focus Order", 10, false)); | |||
| } | |||
| void ComponentTypeInstance::addColourProperty (Array <PropertyComponent*>& props, int colourId, const String& name, const Identifier& propertyName) | |||
| { | |||
| props.add (new ColourPropertyComponent (document.getUndoManager(), name, getValue (propertyName), | |||
| LookAndFeel::getDefaultLookAndFeel().findColour (colourId), true)); | |||
| } | |||
| void ComponentTypeInstance::addFontProperties (Array <PropertyComponent*>& props, const Identifier& name) | |||
| { | |||
| Value v (getValue (name)); | |||
| props.add (FontNameValueSource::createProperty ("Font", v)); | |||
| props.add (FontSizeValueSource::createProperty ("Font Size", v)); | |||
| props.add (FontStyleValueSource::createProperty ("Font Style", v)); | |||
| } | |||
| //============================================================================== | |||
| void ComponentTypeInstance::addJustificationProperty (Array <PropertyComponent*>& props, const String& name, const Value& value, bool onlyHorizontal) | |||
| { | |||
| StringArray strings; | |||
| if (onlyHorizontal) | |||
| { | |||
| const char* const layouts[] = { "Left", "Centred", "Right", 0 }; | |||
| const var justifications[] = { (int) Justification::left, (int) Justification::centred, (int) Justification::right, 0 }; | |||
| props.add (new ChoicePropertyComponent (value, name, StringArray (layouts), Array<var> (justifications))); | |||
| } | |||
| else | |||
| { | |||
| const char* const layouts[] = { "Centred", "Centred-left", "Centred-right", "Centred-top", "Centred-bottom", "Top-left", | |||
| "Top-right", "Bottom-left", "Bottom-right", 0 }; | |||
| const var justifications[] = { (int) Justification::centred, (int) Justification::centredLeft, (int) Justification::centredRight, | |||
| (int) Justification::centredTop, (int) Justification::centredBottom, (int) Justification::topLeft, | |||
| (int) Justification::topRight, (int) Justification::bottomLeft, (int) Justification::bottomRight, var() }; | |||
| props.add (new ChoicePropertyComponent (value, name, StringArray (layouts), Array<var> (justifications))); | |||
| } | |||
| } | |||
| //============================================================================== | |||
| const String ComponentTypeInstance::createConstructorStatement (const String& params) | |||
| { | |||
| String s; | |||
| s << "addAndMakeVisible (" << getMemberName() | |||
| << " = new " << getHandler()->getClassName (*this); | |||
| if (params.isEmpty()) | |||
| s << "());" << newLine; | |||
| else | |||
| { | |||
| s << " ("; | |||
| s << CodeHelpers::indent (params.trim(), s.length(), false) << "));" << newLine; | |||
| } | |||
| // s << getMemberName() << "->updateStateFrom (componentStateList.getChild (" | |||
| // << document.getComponentGroup().indexOf (state) << ");" << newLine; | |||
| return s; | |||
| } | |||
| @@ -1,235 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_COMPONENTTYPEMANAGER_H_734EBF1__ | |||
| #define __JUCER_COMPONENTTYPEMANAGER_H_734EBF1__ | |||
| #include "../../../jucer_Headers.h" | |||
| #include "../jucer_ComponentDocument.h" | |||
| #include "../../../utility/jucer_ColourPropertyComponent.h" | |||
| class ComponentTypeHandler; | |||
| //============================================================================== | |||
| /** Temporary wrapper around a document and a component's ValueTree, providing lots of useful | |||
| functions that can be performed on the component. | |||
| */ | |||
| class ComponentTypeInstance | |||
| { | |||
| public: | |||
| ComponentTypeInstance (ComponentDocument& document_, const ValueTree& state_); | |||
| //============================================================================== | |||
| ComponentDocument& getDocument() throw() { return document; } | |||
| ValueTree& getState() throw() { return state; } | |||
| Value getValue (const Identifier& name) const; | |||
| void set (const Identifier& name, const var& value); | |||
| const var operator[] (const Identifier& name) const { return state [name] ;} | |||
| const String getMemberName() const { return state [ComponentDocument::memberNameProperty]; } | |||
| const String getComponentName() const { return state [ComponentDocument::compNameProperty]; } | |||
| //============================================================================== | |||
| void initialiseNewItemBasics(); | |||
| void updateComponentBasics (Component* comp); | |||
| void addMemberNameProperty (Array <PropertyComponent*>& props); | |||
| void addBoundsProperties (Array <PropertyComponent*>& props); | |||
| void addTooltipProperty (Array <PropertyComponent*>& props); | |||
| void addFocusOrderProperty (Array <PropertyComponent*>& props); | |||
| void addColourProperty (Array <PropertyComponent*>& props, int colourId, const String& name, const Identifier& propertyName); | |||
| void addFontProperties (Array <PropertyComponent*>& props, const Identifier& name); | |||
| void addJustificationProperty (Array <PropertyComponent*>& props, const String& name, const Value& value, bool onlyHorizontal); | |||
| //============================================================================== | |||
| const String createConstructorStatement (const String& params); | |||
| //============================================================================== | |||
| ComponentTypeHandler* getHandler() const; | |||
| void updateComponent (Component* comp); | |||
| void createProperties (Array <PropertyComponent*>& props); | |||
| void createCode (CodeGenerator& code); | |||
| private: | |||
| //============================================================================== | |||
| ComponentDocument& document; | |||
| ValueTree state; | |||
| ComponentTypeInstance& operator= (const ComponentTypeInstance&); | |||
| }; | |||
| //============================================================================== | |||
| class ComponentTypeHandler | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| ComponentTypeHandler (const String& displayName_, const String& className_, | |||
| const Identifier& valueTreeType_, const String& memberNameRoot_); | |||
| virtual ~ComponentTypeHandler(); | |||
| const String& getDisplayName() const { return displayName; } | |||
| const Identifier& getValueTreeType() const { return valueTreeType; } | |||
| const String& getMemberNameRoot() const { return memberNameRoot; } | |||
| virtual Component* createComponent() = 0; | |||
| virtual const Rectangle<int> getDefaultSize() = 0; | |||
| virtual void initialiseNewItem (ComponentTypeInstance& item) = 0; | |||
| virtual void updateComponent (ComponentTypeInstance& item, Component* comp) = 0; | |||
| virtual void createPropertyEditors (ComponentTypeInstance& item, Array <PropertyComponent*>& props) = 0; | |||
| virtual void itemDoubleClicked (const MouseEvent& e, ComponentTypeInstance& item) = 0; | |||
| virtual void createCode (ComponentTypeInstance& item, CodeGenerator& code) = 0; | |||
| virtual const String getClassName (ComponentTypeInstance& item) const { return className; } | |||
| protected: | |||
| //============================================================================== | |||
| const String displayName, className, memberNameRoot; | |||
| const Identifier valueTreeType; | |||
| private: | |||
| ComponentTypeHandler (const ComponentTypeHandler&); | |||
| ComponentTypeHandler& operator= (const ComponentTypeHandler&); | |||
| }; | |||
| //============================================================================== | |||
| class ComponentTypeManager : public DeletedAtShutdown | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| ComponentTypeManager(); | |||
| ~ComponentTypeManager(); | |||
| juce_DeclareSingleton_SingleThreaded_Minimal (ComponentTypeManager); | |||
| //============================================================================== | |||
| Component* createFromStoredType (ComponentDocument& document, const ValueTree& value); | |||
| int getNumHandlers() const { return handlers.size(); } | |||
| ComponentTypeHandler* getHandler (const int index) const { return handlers[index]; } | |||
| ComponentTypeHandler* getHandlerFor (const Identifier& type); | |||
| const StringArray getDisplayNames() const; | |||
| private: | |||
| //============================================================================== | |||
| OwnedArray <ComponentTypeHandler> handlers; | |||
| }; | |||
| //============================================================================== | |||
| template <class ComponentClass> | |||
| class ComponentTypeHelper : public ComponentTypeHandler | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| ComponentTypeHelper (const String& displayName_, const String& className_, const String& xmlTag_, const String& memberNameRoot_) | |||
| : ComponentTypeHandler (displayName_, className_, xmlTag_, memberNameRoot_) | |||
| { | |||
| } | |||
| virtual void initialiseNew (ComponentTypeInstance& item) = 0; | |||
| virtual void update (ComponentTypeInstance& item, ComponentClass* comp) = 0; | |||
| virtual void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) = 0; | |||
| void initialiseNewItem (ComponentTypeInstance& item) | |||
| { | |||
| item.initialiseNewItemBasics(); | |||
| initialiseNew (item); | |||
| } | |||
| void updateComponent (ComponentTypeInstance& item, Component* comp) | |||
| { | |||
| item.updateComponentBasics (comp); | |||
| ComponentClass* const c = dynamic_cast <ComponentClass*> (comp); | |||
| jassert (c != 0); | |||
| updateComponentColours (item, c); | |||
| update (item, c); | |||
| } | |||
| void createPropertyEditors (ComponentTypeInstance& item, Array <PropertyComponent*>& props) | |||
| { | |||
| item.addMemberNameProperty (props); | |||
| item.addBoundsProperties (props); | |||
| createProperties (item, props); | |||
| } | |||
| void itemDoubleClicked (const MouseEvent&, ComponentTypeInstance&) | |||
| { | |||
| } | |||
| protected: | |||
| //============================================================================== | |||
| struct EditableColour | |||
| { | |||
| int colourId; | |||
| String name; | |||
| Identifier propertyName; | |||
| }; | |||
| Array <EditableColour> editableColours; | |||
| void addEditableColour (int colourId, const String& displayName, const Identifier& propertyName) | |||
| { | |||
| EditableColour ec; | |||
| ec.colourId = colourId; | |||
| ec.name = displayName; | |||
| ec.propertyName = propertyName; | |||
| editableColours.add (ec); | |||
| } | |||
| void addEditableColourProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) | |||
| { | |||
| for (int i = 0; i < editableColours.size(); ++i) | |||
| { | |||
| const EditableColour& ec = editableColours.getReference(i); | |||
| item.addColourProperty (props, ec.colourId, ec.name, ec.propertyName); | |||
| } | |||
| } | |||
| void updateComponentColours (ComponentTypeInstance& item, Component* component) | |||
| { | |||
| for (int i = 0; i < editableColours.size(); ++i) | |||
| { | |||
| const EditableColour& ec = editableColours.getReference(i); | |||
| const String colour (item.getState() [ec.propertyName].toString()); | |||
| if (colour.isNotEmpty()) | |||
| component->setColour (ec.colourId, Colour::fromString (colour)); | |||
| else | |||
| component->removeColour (ec.colourId); | |||
| } | |||
| } | |||
| }; | |||
| #endif // __JUCER_COMPONENTTYPEMANAGER_H_734EBF1__ | |||
| @@ -1,99 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifdef ADD_TO_LIST | |||
| ADD_TO_LIST (GenericComponentHandler); | |||
| #else | |||
| #include "../jucer_ComponentDocument.h" | |||
| //============================================================================== | |||
| class GenericComponentHandler : public ComponentTypeHelper<Component> | |||
| { | |||
| public: | |||
| GenericComponentHandler() : ComponentTypeHelper<Component> ("Generic Component", "Component", "COMPONENT", "component") {} | |||
| ~GenericComponentHandler() {} | |||
| //============================================================================== | |||
| class PlaceholderComp : public Component | |||
| { | |||
| public: | |||
| PlaceholderComp() | |||
| { | |||
| } | |||
| void setDetails (const String& memberName, const String& className) | |||
| { | |||
| const String name (memberName + " (" + className + ")"); | |||
| if (name != getName()) | |||
| { | |||
| setName (name); | |||
| repaint(); | |||
| } | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| drawComponentPlaceholder (g, getWidth(), getHeight(), getName()); | |||
| } | |||
| }; | |||
| //============================================================================== | |||
| Component* createComponent() { return new PlaceholderComp(); } | |||
| const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 180, 24); } | |||
| void initialiseNew (ComponentTypeInstance& item) | |||
| { | |||
| item.set (Ids::class_, "Component"); | |||
| } | |||
| void update (ComponentTypeInstance& item, Component* comp) | |||
| { | |||
| static_cast<PlaceholderComp*> (comp)->setDetails (item [ComponentDocument::memberNameProperty], | |||
| item [Ids::class_]); | |||
| } | |||
| void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) | |||
| { | |||
| item.addFocusOrderProperty (props); | |||
| props.add (new TextPropertyComponent (item.getValue (Ids::class_), "Class", 256, false)); | |||
| props.getLast()->setTooltip ("The class that this component is an instance of."); | |||
| } | |||
| const String getClassName (ComponentTypeInstance& item) const | |||
| { | |||
| return item [Ids::class_]; | |||
| } | |||
| void createCode (ComponentTypeInstance& item, CodeGenerator& code) | |||
| { | |||
| code.constructorCode << item.createConstructorStatement (String::empty); | |||
| } | |||
| }; | |||
| #endif | |||
| @@ -1,78 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifdef ADD_TO_LIST | |||
| ADD_TO_LIST (GroupComponentHandler); | |||
| #else | |||
| #include "../jucer_ComponentDocument.h" | |||
| //============================================================================== | |||
| class GroupComponentHandler : public ComponentTypeHelper<GroupComponent> | |||
| { | |||
| public: | |||
| GroupComponentHandler() : ComponentTypeHelper<GroupComponent> ("GroupComponent", "GroupComponent", "GROUPCOMPONENT", "group") | |||
| { | |||
| addEditableColour (GroupComponent::outlineColourId, "Outline", "outlineColour"); | |||
| addEditableColour (GroupComponent::textColourId, "Text Colour", "textColour"); | |||
| } | |||
| ~GroupComponentHandler() {} | |||
| Component* createComponent() { return new GroupComponent(); } | |||
| const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 200, 200); } | |||
| void initialiseNew (ComponentTypeInstance& item) | |||
| { | |||
| item.set (Ids::text, "Group"); | |||
| item.set (Ids::justification, (int) Justification::left); | |||
| } | |||
| void update (ComponentTypeInstance& item, GroupComponent* comp) | |||
| { | |||
| comp->setText (item [Ids::text].toString()); | |||
| comp->setTextLabelPosition ((int) item [Ids::justification]); | |||
| } | |||
| void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) | |||
| { | |||
| item.addTooltipProperty (props); | |||
| item.addFocusOrderProperty (props); | |||
| props.add (new TextPropertyComponent (item.getValue (Ids::text), "Label", 512, false)); | |||
| props.getLast()->setTooltip ("The group's display name."); | |||
| item.addJustificationProperty (props, "Text Position", item.getValue (Ids::justification), true); | |||
| addEditableColourProperties (item, props); | |||
| } | |||
| void createCode (ComponentTypeInstance& item, CodeGenerator& code) | |||
| { | |||
| code.constructorCode << item.createConstructorStatement (String::empty); | |||
| } | |||
| }; | |||
| #endif | |||
| @@ -1,194 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifdef ADD_TO_LIST | |||
| ADD_TO_LIST (JucerComponentHandler); | |||
| #else | |||
| #include "../jucer_ComponentDocument.h" | |||
| #include "../../../ui/jucer_OpenDocumentManager.h" | |||
| #include "../../../ui/Project Editor/jucer_ProjectContentComponent.h" | |||
| //============================================================================== | |||
| class JucerComponent : public Component | |||
| { | |||
| public: | |||
| JucerComponent() | |||
| { | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| if (comp == 0) | |||
| drawComponentPlaceholder (g, getWidth(), getHeight(), "(Not a valid Jucer component)"); | |||
| } | |||
| void resized() | |||
| { | |||
| if (comp != 0) | |||
| comp->setBounds (getLocalBounds()); | |||
| } | |||
| void setJucerComp (ComponentTypeInstance& item, const String& newProjectId) | |||
| { | |||
| if (projectId != newProjectId) | |||
| { | |||
| projectId = newProjectId; | |||
| comp = 0; | |||
| if (newProjectId.isNotEmpty()) | |||
| { | |||
| const File file (getDocumentFile (item, projectId)); | |||
| if (file.exists()) | |||
| { | |||
| OpenDocumentManager::Document* doc = OpenDocumentManager::getInstance()->getDocumentForFile (item.getDocument().getProject(), file); | |||
| if (doc != 0) | |||
| { | |||
| addAndMakeVisible (comp = doc->createViewer()); | |||
| resized(); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| static const File getDocumentFile (ComponentTypeInstance& item, const String projectItemId) | |||
| { | |||
| if (projectItemId.isNotEmpty()) | |||
| { | |||
| Project* project = item.getDocument().getProject(); | |||
| if (project != 0) | |||
| { | |||
| Project::Item item (project->getMainGroup().findItemWithID (projectItemId)); | |||
| if (item.isValid()) | |||
| return item.getFile(); | |||
| } | |||
| } | |||
| return File::nonexistent; | |||
| } | |||
| private: | |||
| String projectId; | |||
| ScopedPointer<Component> comp; | |||
| }; | |||
| //============================================================================== | |||
| class JucerComponentHandler : public ComponentTypeHelper<JucerComponent> | |||
| { | |||
| public: | |||
| JucerComponentHandler() : ComponentTypeHelper<JucerComponent> ("Jucer Component", "Component", "JUCERCOMPONENT", "jucerComp") {} | |||
| ~JucerComponentHandler() {} | |||
| //============================================================================== | |||
| Component* createComponent() { return new JucerComponent(); } | |||
| const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 150, 150); } | |||
| void initialiseNew (ComponentTypeInstance& item) | |||
| { | |||
| } | |||
| void update (ComponentTypeInstance& item, JucerComponent* comp) | |||
| { | |||
| comp->setJucerComp (item, item [Ids::source].toString()); | |||
| } | |||
| void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) | |||
| { | |||
| StringArray names; | |||
| Array<var> ids; | |||
| names.add ("<none>"); | |||
| ids.add (var::null); | |||
| names.add (String::empty); | |||
| ids.add (var::null); | |||
| { | |||
| Array <Project::Item> comps; | |||
| findAllComponentDocumentsInProject (item, comps); | |||
| for (int i = 0; i < comps.size(); ++i) | |||
| { | |||
| if (comps.getReference(i).getFile() != item.getDocument().getCppFile()) | |||
| { | |||
| names.add (comps.getReference(i).getName().toString()); | |||
| ids.add (comps.getReference(i).getID()); | |||
| } | |||
| } | |||
| } | |||
| props.add (new ChoicePropertyComponent (item.getValue (Ids::source), "Source", names, ids)); | |||
| item.addFocusOrderProperty (props); | |||
| } | |||
| void itemDoubleClicked (const MouseEvent& e, ComponentTypeInstance& item) | |||
| { | |||
| ProjectContentComponent* pcc = e.originalComponent->findParentComponentOfClass ((ProjectContentComponent*) 0); | |||
| if (pcc != 0) | |||
| pcc->showEditorForFile (JucerComponent::getDocumentFile (item, item [Ids::source].toString())); | |||
| } | |||
| const String getClassName (ComponentTypeInstance& item) const | |||
| { | |||
| return "xxx"; | |||
| } | |||
| void createCode (ComponentTypeInstance& item, CodeGenerator& code) | |||
| { | |||
| code.constructorCode << item.createConstructorStatement (String::empty); | |||
| } | |||
| //============================================================================== | |||
| static void findAllComponentDocumentsInProject (ComponentTypeInstance& item, Array <Project::Item>& comps) | |||
| { | |||
| Project* project = item.getDocument().getProject(); | |||
| if (project != 0) | |||
| findAllComponentDocumentsInProjectItem (project->getMainGroup(), comps); | |||
| } | |||
| static void findAllComponentDocumentsInProjectItem (const Project::Item& item, Array <Project::Item>& comps) | |||
| { | |||
| if (item.isGroup()) | |||
| { | |||
| const int num = item.getNumChildren(); | |||
| for (int i = 0; i < num; ++i) | |||
| findAllComponentDocumentsInProjectItem (item.getChild (i), comps); | |||
| } | |||
| else if (item.isFile()) | |||
| { | |||
| if (ComponentDocument::isComponentFile (item.getFile())) | |||
| comps.add (item); | |||
| } | |||
| } | |||
| }; | |||
| #endif | |||
| @@ -1,103 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifdef ADD_TO_LIST | |||
| ADD_TO_LIST (LabelHandler); | |||
| #else | |||
| #include "../jucer_ComponentDocument.h" | |||
| //============================================================================== | |||
| class LabelHandler : public ComponentTypeHelper<Label> | |||
| { | |||
| public: | |||
| LabelHandler() : ComponentTypeHelper<Label> ("Label", "Label", "LABEL", "label") | |||
| { | |||
| addEditableColour (Label::backgroundColourId, "Background", "backgroundColour"); | |||
| addEditableColour (Label::textColourId, "Text Colour", "textColour"); | |||
| addEditableColour (Label::outlineColourId, "Outline Colour", "outlineColour"); | |||
| } | |||
| ~LabelHandler() {} | |||
| Component* createComponent() { return new Label(); } | |||
| const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 180, 24); } | |||
| void initialiseNew (ComponentTypeInstance& item) | |||
| { | |||
| item.set (Ids::text, "New Label"); | |||
| item.set (Ids::font, Font (14.0f).toString()); | |||
| item.set (Ids::editMode, 1); | |||
| item.set (Ids::justification, (int) Justification::centredLeft); | |||
| } | |||
| void update (ComponentTypeInstance& item, Label* comp) | |||
| { | |||
| comp->setText (item [Ids::text].toString(), false); | |||
| comp->setFont (Font::fromString (item [Ids::font])); | |||
| int editMode = (int) item [Ids::editMode]; | |||
| comp->setEditable (editMode == 2, editMode == 3, false); | |||
| comp->setJustificationType ((int) item [Ids::justification]); | |||
| } | |||
| void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) | |||
| { | |||
| item.addTooltipProperty (props); | |||
| item.addFocusOrderProperty (props); | |||
| props.add (new TextPropertyComponent (item.getValue (Ids::text), "Text", 16384, true)); | |||
| props.getLast()->setTooltip ("The label's text."); | |||
| item.addJustificationProperty (props, "Layout", item.getValue (Ids::justification), false); | |||
| const char* const editModes[] = { "Read-only", "Edit on Single-Click", "Edit on Double-Click", 0 }; | |||
| const int values[] = { 1, 2, 3, 0 }; | |||
| props.add (new ChoicePropertyComponent (item.getValue (Ids::editMode), "Edit Mode", StringArray (editModes), Array<var> (values))); | |||
| item.addFontProperties (props, Ids::font); | |||
| addEditableColourProperties (item, props); | |||
| } | |||
| void createCode (ComponentTypeInstance& item, CodeGenerator& code) | |||
| { | |||
| int editMode = (int) item [Ids::editMode]; | |||
| code.constructorCode | |||
| << item.createConstructorStatement (String::empty) | |||
| << item.getMemberName() << "->setText (" << CodeHelpers::stringLiteral (item [Ids::text]) << ");" << newLine | |||
| << item.getMemberName() << "->setFont (" << CodeHelpers::fontToCode (Font::fromString (item [Ids::font])) << ");" << newLine | |||
| << item.getMemberName() << "->setEditable (" << CodeHelpers::boolLiteral (editMode == 2) | |||
| << ", " << CodeHelpers::boolLiteral (editMode == 3) << ", false);" << newLine; | |||
| Justification justification ((int) item [Ids::justification]); | |||
| if (justification.getFlags() != 0) | |||
| code.constructorCode << item.getMemberName() << "->setJustificationType (" | |||
| << CodeHelpers::justificationToCode (justification) << ");" << newLine; | |||
| } | |||
| }; | |||
| #endif | |||
| @@ -1,163 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifdef ADD_TO_LIST | |||
| ADD_TO_LIST (SliderHandler); | |||
| #else | |||
| #include "../jucer_ComponentDocument.h" | |||
| //============================================================================== | |||
| class SliderHandler : public ComponentTypeHelper<Slider> | |||
| { | |||
| public: | |||
| SliderHandler() : ComponentTypeHelper<Slider> ("Slider", "Slider", "SLIDER", "slider") | |||
| { | |||
| addEditableColour (Slider::backgroundColourId, "Background", "backgroundColour"); | |||
| addEditableColour (Slider::thumbColourId, "Thumb", "thumbColour"); | |||
| addEditableColour (Slider::trackColourId, "Track", "trackColour"); | |||
| addEditableColour (Slider::rotarySliderFillColourId, "Rotary Fill", "rotaryFillColour"); | |||
| addEditableColour (Slider::rotarySliderOutlineColourId, "Rotary Outline", "rotaryOutlineColour"); | |||
| addEditableColour (Slider::textBoxTextColourId, "Text", "textColour"); | |||
| addEditableColour (Slider::textBoxBackgroundColourId, "Text Background", "textBackgroundColour"); | |||
| addEditableColour (Slider::textBoxHighlightColourId, "Text Highlight", "textHighlightColour"); | |||
| addEditableColour (Slider::textBoxOutlineColourId, "Textbox Outline", "textboxOutlineColour"); | |||
| } | |||
| ~SliderHandler() {} | |||
| Component* createComponent() { return new Slider(); } | |||
| const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 200, 24); } | |||
| void initialiseNew (ComponentTypeInstance& item) | |||
| { | |||
| item.set (Ids::type, Slider::LinearHorizontal); | |||
| item.set (Ids::min, 0); | |||
| item.set (Ids::max, 100); | |||
| item.set (Ids::interval, 1); | |||
| item.set (Ids::textBoxPos, 2); | |||
| item.set (Ids::editable, true); | |||
| item.set (Ids::textBoxWidth, 80); | |||
| item.set (Ids::textBoxHeight, 20); | |||
| item.set (Ids::skew, 1); | |||
| } | |||
| void update (ComponentTypeInstance& item, Slider* comp) | |||
| { | |||
| comp->setRange ((double) item [Ids::min], (double) item [Ids::max], (double) item [Ids::interval]); | |||
| comp->setSliderStyle ((Slider::SliderStyle) (int) item [Ids::type]); | |||
| comp->setTextBoxStyle ((Slider::TextEntryBoxPosition) (int) item [Ids::textBoxPos], | |||
| ! (bool) item [Ids::editable], | |||
| (int) item [Ids::textBoxWidth], (int) item [Ids::textBoxHeight]); | |||
| comp->setSkewFactor ((double) item [Ids::skew]); | |||
| } | |||
| void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) | |||
| { | |||
| item.addTooltipProperty (props); | |||
| item.addFocusOrderProperty (props); | |||
| props.add (new TextPropertyComponent (Value (new NumericValueSource<double> (item.getValue (Ids::min))), "Minimum", 16, false)); | |||
| props.add (new TextPropertyComponent (Value (new NumericValueSource<double> (item.getValue (Ids::max))), "Maximum", 16, false)); | |||
| props.add (new TextPropertyComponent (Value (new NumericValueSource<double> (item.getValue (Ids::interval))), "Interval", 16, false)); | |||
| const char* const types[] = { "LinearHorizontal", "LinearVertical", "LinearBar", "Rotary", "RotaryHorizontalDrag", "RotaryVerticalDrag", | |||
| "IncDecButtons", "TwoValueHorizontal", "TwoValueVertical", "ThreeValueHorizontal", "ThreeValueVertical", 0 }; | |||
| const int typeValues[] = { (int) Slider::LinearHorizontal, (int) Slider::LinearVertical, (int) Slider::LinearBar, (int) Slider::Rotary, | |||
| (int) Slider::RotaryHorizontalDrag, (int) Slider::RotaryVerticalDrag, (int) Slider::IncDecButtons, (int) Slider::TwoValueHorizontal, | |||
| (int) Slider::TwoValueVertical, (int) Slider::ThreeValueHorizontal, (int) Slider::ThreeValueVertical }; | |||
| props.add (new ChoicePropertyComponent (item.getValue (Ids::type), "Type", StringArray (types), Array<var> (typeValues, numElementsInArray (typeValues)))); | |||
| const char* const textBoxPositions[] = { "NoTextBox", "TextBoxLeft", "TextBoxRight", "TextBoxAbove", "TextBoxBelow", 0 }; | |||
| const int positionValues[] = { (int) Slider::NoTextBox, (int) Slider::TextBoxLeft, (int) Slider::TextBoxRight, (int) Slider::TextBoxAbove, (int) Slider::TextBoxBelow }; | |||
| props.add (new ChoicePropertyComponent (item.getValue (Ids::textBoxPos), "Text Box", StringArray (textBoxPositions), Array<var> (positionValues, numElementsInArray (positionValues)))); | |||
| props.add (new BooleanPropertyComponent (item.getValue (Ids::editable), "Editable", "Value can be edited")); | |||
| props.add (new TextPropertyComponent (Value (new NumericValueSource<int> (item.getValue (Ids::textBoxWidth))), "Text Box Width", 8, false)); | |||
| props.add (new TextPropertyComponent (Value (new NumericValueSource<int> (item.getValue (Ids::textBoxHeight))), "Text Box Height", 8, false)); | |||
| props.add (new TextPropertyComponent (Value (new NumericValueSource<double> (item.getValue (Ids::skew))), "Skew Factor", 16, false)); | |||
| addEditableColourProperties (item, props); | |||
| } | |||
| static const char* sliderTypeString (int type) throw() | |||
| { | |||
| switch (type) | |||
| { | |||
| case Slider::LinearHorizontal: return "LinearHorizontal"; | |||
| case Slider::LinearVertical: return "LinearVertical"; | |||
| case Slider::LinearBar: return "LinearBar"; | |||
| case Slider::Rotary: return "Rotary"; | |||
| case Slider::RotaryHorizontalDrag: return "RotaryHorizontalDrag"; | |||
| case Slider::RotaryVerticalDrag: return "RotaryVerticalDrag"; | |||
| case Slider::IncDecButtons: return "IncDecButtons"; | |||
| case Slider::TwoValueHorizontal: return "TwoValueHorizontal"; | |||
| case Slider::TwoValueVertical: return "TwoValueVertical"; | |||
| case Slider::ThreeValueHorizontal: return "ThreeValueHorizontal"; | |||
| case Slider::ThreeValueVertical: return "ThreeValueVertical"; | |||
| default: jassertfalse; break; | |||
| } | |||
| return ""; | |||
| } | |||
| static const char* sliderTextBoxString (int type) throw() | |||
| { | |||
| switch (type) | |||
| { | |||
| case Slider::NoTextBox: return "NoTextBox"; | |||
| case Slider::TextBoxLeft: return "TextBoxLeft"; | |||
| case Slider::TextBoxRight: return "TextBoxRight"; | |||
| case Slider::TextBoxAbove: return "TextBoxAbove"; | |||
| case Slider::TextBoxBelow: return "TextBoxBelow"; | |||
| default: jassertfalse; break; | |||
| } | |||
| return ""; | |||
| } | |||
| void createCode (ComponentTypeInstance& item, CodeGenerator& code) | |||
| { | |||
| code.constructorCode | |||
| << item.createConstructorStatement (CodeHelpers::stringLiteral (item.getComponentName())) | |||
| << item.getMemberName() << "->setRange (" << CodeHelpers::doubleLiteral (item [Ids::min]) | |||
| << ", " << CodeHelpers::doubleLiteral (item [Ids::max]) | |||
| << ", " << CodeHelpers::doubleLiteral (item [Ids::interval]) | |||
| << ");" << newLine | |||
| << item.getMemberName() << "->setSliderStyle (Slider::" << sliderTypeString ((int) item [Ids::type]) << ");" << newLine | |||
| << item.getMemberName() << "->setTextBoxStyle (Slider::" << sliderTextBoxString ((int) item [Ids::type]) | |||
| << ", " << CodeHelpers::boolLiteral (! (bool) item [Ids::editable]) | |||
| << ", " << String ((int) item [Ids::textBoxWidth]) | |||
| << ", " << String ((int) item [Ids::textBoxHeight]) | |||
| << ");" << newLine; | |||
| double skew = (double) item [Ids::skew]; | |||
| if (skew != 1.0 && skew != 0) | |||
| code.constructorCode << item.getMemberName() << "->setSkewFactor (" << CodeHelpers::doubleLiteral (skew) << ");" << newLine; | |||
| } | |||
| }; | |||
| #endif | |||
| @@ -1,67 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifdef ADD_TO_LIST | |||
| ADD_TO_LIST (TabbedComponentHandler); | |||
| #else | |||
| #include "../jucer_ComponentDocument.h" | |||
| //============================================================================== | |||
| class TabbedComponentHandler : public ComponentTypeHelper<TabbedComponent> | |||
| { | |||
| public: | |||
| TabbedComponentHandler() : ComponentTypeHelper<TabbedComponent> ("TabbedComponent", "TabbedComponent", "TABBEDCOMPONENT", "tabbedComponent") | |||
| { | |||
| addEditableColour (TabbedComponent::backgroundColourId, "Background", "backgroundColour"); | |||
| addEditableColour (TabbedComponent::outlineColourId, "Outline", "outlineColour"); | |||
| } | |||
| ~TabbedComponentHandler() {} | |||
| Component* createComponent() { return new TabbedComponent (TabbedButtonBar::TabsAtTop); } | |||
| const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 300, 200); } | |||
| void initialiseNew (ComponentTypeInstance& item) | |||
| { | |||
| } | |||
| void update (ComponentTypeInstance& item, TabbedComponent* comp) | |||
| { | |||
| } | |||
| void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) | |||
| { | |||
| addEditableColourProperties (item, props); | |||
| } | |||
| void createCode (ComponentTypeInstance& item, CodeGenerator& code) | |||
| { | |||
| code.constructorCode << item.createConstructorStatement ("TabbedButtonBar::TabsAtTop"); | |||
| } | |||
| }; | |||
| #endif | |||
| @@ -1,109 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifdef ADD_TO_LIST | |||
| ADD_TO_LIST (TextButtonHandler); | |||
| #else | |||
| #include "../jucer_ComponentDocument.h" | |||
| //============================================================================== | |||
| class TextButtonHandler : public ComponentTypeHelper<TextButton> | |||
| { | |||
| public: | |||
| TextButtonHandler() : ComponentTypeHelper<TextButton> ("TextButton", "TextButton", "TEXTBUTTON", "textButton") | |||
| { | |||
| addEditableColour (TextButton::buttonColourId, "Background", "backgroundColour"); | |||
| addEditableColour (TextButton::textColourOffId, "Text Colour", "textColour"); | |||
| } | |||
| ~TextButtonHandler() {} | |||
| Component* createComponent() { return new TextButton(); } | |||
| const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 150, 24); } | |||
| void initialiseNew (ComponentTypeInstance& item) | |||
| { | |||
| item.set (Ids::text, "New Button"); | |||
| item.set (Ids::radioGroup, 0); | |||
| item.set (Ids::connectedLeft, false); | |||
| item.set (Ids::connectedRight, false); | |||
| item.set (Ids::connectedTop, false); | |||
| item.set (Ids::connectedBottom, false); | |||
| } | |||
| static int getConnectedFlags (ComponentTypeInstance& item) | |||
| { | |||
| int connected = 0; | |||
| if (item [Ids::connectedLeft]) connected |= TextButton::ConnectedOnLeft; | |||
| if (item [Ids::connectedRight]) connected |= TextButton::ConnectedOnRight; | |||
| if (item [Ids::connectedTop]) connected |= TextButton::ConnectedOnTop; | |||
| if (item [Ids::connectedBottom]) connected |= TextButton::ConnectedOnBottom; | |||
| return connected; | |||
| } | |||
| void update (ComponentTypeInstance& item, TextButton* comp) | |||
| { | |||
| comp->setButtonText (item [Ids::text].toString()); | |||
| comp->setRadioGroupId (item [Ids::radioGroup]); | |||
| comp->setConnectedEdges (getConnectedFlags (item)); | |||
| } | |||
| void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) | |||
| { | |||
| item.addTooltipProperty (props); | |||
| item.addFocusOrderProperty (props); | |||
| props.add (new TextPropertyComponent (item.getValue (Ids::text), "Button Text", 1024, false)); | |||
| props.getLast()->setTooltip ("The button's text."); | |||
| props.add (new TextPropertyComponent (Value (new NumericValueSource<int> (item.getValue (Ids::radioGroup))), "Radio Group", 8, false)); | |||
| props.getLast()->setTooltip ("The radio group that this button is a member of."); | |||
| props.add (new BooleanPropertyComponent (item.getValue (Ids::connectedLeft), "Connected left", "Connected")); | |||
| props.add (new BooleanPropertyComponent (item.getValue (Ids::connectedRight), "Connected right", "Connected")); | |||
| props.add (new BooleanPropertyComponent (item.getValue (Ids::connectedTop), "Connected top", "Connected")); | |||
| props.add (new BooleanPropertyComponent (item.getValue (Ids::connectedBottom), "Connected bottom", "Connected")); | |||
| addEditableColourProperties (item, props); | |||
| } | |||
| void createCode (ComponentTypeInstance& item, CodeGenerator& code) | |||
| { | |||
| code.constructorCode | |||
| << item.createConstructorStatement (String::empty) | |||
| << item.getMemberName() << "->setButtonText (" << CodeHelpers::stringLiteral (item [Ids::text]) << ");" << newLine; | |||
| if ((int) item [Ids::radioGroup] != 0) | |||
| code.constructorCode << item.getMemberName() << "->setRadioGroupId (" << String ((int) item [Ids::radioGroup]) << ");" << newLine; | |||
| if (getConnectedFlags (item) != 0) | |||
| code.constructorCode << item.getMemberName() << "->setConnectedEdges (" << String (getConnectedFlags (item)) << ");" << newLine; | |||
| } | |||
| }; | |||
| #endif | |||
| @@ -1,140 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifdef ADD_TO_LIST | |||
| ADD_TO_LIST (TextEditorHandler); | |||
| #else | |||
| #include "../jucer_ComponentDocument.h" | |||
| //============================================================================== | |||
| class TextEditorHandler : public ComponentTypeHelper<TextEditor> | |||
| { | |||
| public: | |||
| TextEditorHandler() : ComponentTypeHelper<TextEditor> ("TextEditor", "TextEditor", "TEXTEDITOR", "textEditor") | |||
| { | |||
| addEditableColour (TextEditor::backgroundColourId, "Background", "backgroundColour"); | |||
| addEditableColour (TextEditor::textColourId, "Text", "textColour"); | |||
| addEditableColour (TextEditor::highlightColourId, "Highlight", "highlightColour"); | |||
| addEditableColour (TextEditor::highlightedTextColourId, "Highlighted Text", "highlightedTextColour"); | |||
| addEditableColour (TextEditor::caretColourId, "Caret", "caretColour"); | |||
| addEditableColour (TextEditor::outlineColourId, "Outline", "outlineColour"); | |||
| addEditableColour (TextEditor::focusedOutlineColourId, "Outline (focused)", "focusedOutlineColour"); | |||
| addEditableColour (TextEditor::shadowColourId, "Shadow", "shadowColour"); | |||
| } | |||
| ~TextEditorHandler() {} | |||
| Component* createComponent() { return new TextEditor(); } | |||
| const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 180, 24); } | |||
| void initialiseNew (ComponentTypeInstance& item) | |||
| { | |||
| TextEditor defaultComp; | |||
| item.set (Ids::text, "Text Editor Content"); | |||
| item.set (Ids::readOnly, false); | |||
| item.set (Ids::scrollbarsShown, true); | |||
| item.set (Ids::caretVisible, true); | |||
| item.set (Ids::popupMenuEnabled, true); | |||
| item.set (Ids::mode, 1); | |||
| item.set (Ids::font, defaultComp.getFont().toString()); | |||
| } | |||
| void update (ComponentTypeInstance& item, TextEditor* comp) | |||
| { | |||
| comp->setReadOnly (item [Ids::readOnly]); | |||
| comp->setScrollbarsShown (item [Ids::scrollbarsShown]); | |||
| comp->setCaretVisible (item [Ids::caretVisible]); | |||
| comp->setPopupMenuEnabled (item [Ids::popupMenuEnabled]); | |||
| int mode = item [Ids::mode]; | |||
| comp->setMultiLine (mode > 1, true); | |||
| comp->setReturnKeyStartsNewLine (mode != 3); | |||
| const Font font (Font::fromString (item [Ids::font])); | |||
| if (comp->getFont() != font) | |||
| comp->applyFontToAllText (font); | |||
| comp->setText (item [Ids::text].toString()); | |||
| } | |||
| void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) | |||
| { | |||
| item.addTooltipProperty (props); | |||
| item.addFocusOrderProperty (props); | |||
| props.add (new TextPropertyComponent (item.getValue (Ids::text), "Text", 16384, true)); | |||
| props.getLast()->setTooltip ("The editor's initial content."); | |||
| const char* const modes[] = { "Single-Line", "Multi-Line (Return key starts new line)", "Multi-Line (Return key disabled)", 0 }; | |||
| const int values[] = { 1, 2, 3, 0 }; | |||
| props.add (new ChoicePropertyComponent (item.getValue (Ids::mode), "Mode", StringArray (modes), Array<var> (values))); | |||
| props.add (new BooleanPropertyComponent (item.getValue (Ids::readOnly), "Read-Only", "Read-Only")); | |||
| props.add (new BooleanPropertyComponent (item.getValue (Ids::scrollbarsShown), "Scrollbars", "Scrollbars Shown")); | |||
| props.add (new BooleanPropertyComponent (item.getValue (Ids::caretVisible), "Caret", "Caret Visible")); | |||
| props.add (new BooleanPropertyComponent (item.getValue (Ids::popupMenuEnabled), "Popup Menu", "Popup Menu Enabled")); | |||
| item.addFontProperties (props, Ids::font); | |||
| addEditableColourProperties (item, props); | |||
| } | |||
| void createCode (ComponentTypeInstance& item, CodeGenerator& code) | |||
| { | |||
| TextEditor defaultComp; | |||
| code.constructorCode | |||
| << item.createConstructorStatement (String::empty); | |||
| if (defaultComp.isReadOnly() != (bool) item [Ids::readOnly]) | |||
| code.constructorCode << item.getMemberName() << "->setReadOnly (" << CodeHelpers::boolLiteral (item [Ids::readOnly]) << ");" << newLine; | |||
| if (defaultComp.areScrollbarsShown() != (bool) item [Ids::scrollbarsShown]) | |||
| code.constructorCode << item.getMemberName() << "->setScrollbarsShown (" << CodeHelpers::boolLiteral (item [Ids::scrollbarsShown]) << ");" << newLine; | |||
| if (defaultComp.isCaretVisible() != (bool) item [Ids::caretVisible]) | |||
| code.constructorCode << item.getMemberName() << "->setCaretVisible (" << CodeHelpers::boolLiteral (item [Ids::caretVisible]) << ");" << newLine; | |||
| if (defaultComp.isPopupMenuEnabled() != (bool) item [Ids::popupMenuEnabled]) | |||
| code.constructorCode << item.getMemberName() << "->setPopupMenuEnabled (" << CodeHelpers::boolLiteral (item [Ids::popupMenuEnabled]) << ");" << newLine; | |||
| int mode = item [Ids::mode]; | |||
| if (defaultComp.isMultiLine() != (mode > 1)) | |||
| code.constructorCode << item.getMemberName() << "->setMultiLine (" << CodeHelpers::boolLiteral (mode > 1) << ", true);" << newLine; | |||
| if (defaultComp.getReturnKeyStartsNewLine() != (mode != 3)) | |||
| code.constructorCode << item.getMemberName() << "->setReturnKeyStartsNewLine (" << CodeHelpers::boolLiteral (mode != 3) << ");" << newLine; | |||
| const Font font (Font::fromString (item [Ids::font])); | |||
| if (font != defaultComp.getFont()) | |||
| code.constructorCode << item.getMemberName() << "->setFont (" << CodeHelpers::fontToCode (font) << ");" << newLine; | |||
| code.constructorCode << item.getMemberName() << "->setText (" << CodeHelpers::stringLiteral (item [Ids::text]) << ");" << newLine; | |||
| } | |||
| }; | |||
| #endif | |||
| @@ -1,78 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifdef ADD_TO_LIST | |||
| ADD_TO_LIST (ToggleButtonHandler); | |||
| #else | |||
| #include "../jucer_ComponentDocument.h" | |||
| //============================================================================== | |||
| class ToggleButtonHandler : public ComponentTypeHelper<ToggleButton> | |||
| { | |||
| public: | |||
| ToggleButtonHandler() : ComponentTypeHelper<ToggleButton> ("ToggleButton", "ToggleButton", "TOGGLEBUTTON", "toggleButton") | |||
| { | |||
| addEditableColour (ToggleButton::textColourId, "Text Colour", "textColour"); | |||
| } | |||
| ~ToggleButtonHandler() {} | |||
| Component* createComponent() { return new ToggleButton(); } | |||
| const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 180, 24); } | |||
| void initialiseNew (ComponentTypeInstance& item) | |||
| { | |||
| item.set (Ids::text, "New Toggle Button"); | |||
| item.set (Ids::initialState, false); | |||
| } | |||
| void update (ComponentTypeInstance& item, ToggleButton* comp) | |||
| { | |||
| comp->setButtonText (item [Ids::text].toString()); | |||
| comp->setToggleState (item [Ids::initialState], false); | |||
| } | |||
| void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) | |||
| { | |||
| item.addTooltipProperty (props); | |||
| item.addFocusOrderProperty (props); | |||
| props.add (new TextPropertyComponent (item.getValue (Ids::text), "Button Text", 1024, false)); | |||
| props.getLast()->setTooltip ("The button's text."); | |||
| props.add (new BooleanPropertyComponent (item.getValue (Ids::initialState), "Initial State", "Enabled initially")); | |||
| addEditableColourProperties (item, props); | |||
| } | |||
| void createCode (ComponentTypeInstance& item, CodeGenerator& code) | |||
| { | |||
| code.constructorCode += item.createConstructorStatement (String::empty); | |||
| } | |||
| }; | |||
| #endif | |||
| @@ -1,91 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifdef ADD_TO_LIST | |||
| ADD_TO_LIST (ViewportHandler); | |||
| #else | |||
| #include "../jucer_ComponentDocument.h" | |||
| //============================================================================== | |||
| class ViewportHandler : public ComponentTypeHelper<Viewport> | |||
| { | |||
| public: | |||
| ViewportHandler() : ComponentTypeHelper<Viewport> ("Viewport", "Viewport", "VIEWPORT", "viewport") {} | |||
| ~ViewportHandler() {} | |||
| class DemoContentComponent : public Component | |||
| { | |||
| public: | |||
| DemoContentComponent() { setSize (1000, 1000); } | |||
| ~DemoContentComponent() {} | |||
| void paint (Graphics& g) | |||
| { | |||
| g.fillCheckerBoard (0, 0, getWidth(), getHeight(), 40, 40, | |||
| Colours::grey.withAlpha (0.7f), | |||
| Colours::white.withAlpha (0.7f)); | |||
| } | |||
| }; | |||
| Component* createComponent() | |||
| { | |||
| Viewport* v = new Viewport(); | |||
| v->setViewedComponent (new DemoContentComponent()); | |||
| return v; | |||
| } | |||
| const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 300, 200); } | |||
| void initialiseNew (ComponentTypeInstance& item) | |||
| { | |||
| item.set (Ids::scrollBarV, true); | |||
| item.set (Ids::scrollBarH, true); | |||
| item.set (Ids::scrollbarWidth, 18); | |||
| } | |||
| void update (ComponentTypeInstance& item, Viewport* comp) | |||
| { | |||
| comp->setScrollBarsShown (item [Ids::scrollBarV], item [Ids::scrollBarH]); | |||
| comp->setScrollBarThickness (item [Ids::scrollbarWidth]); | |||
| } | |||
| void createProperties (ComponentTypeInstance& item, Array <PropertyComponent*>& props) | |||
| { | |||
| props.add (new BooleanPropertyComponent (item.getValue (Ids::scrollBarV), "Scrollbar V", "Vertical scrollbar shown")); | |||
| props.add (new BooleanPropertyComponent (item.getValue (Ids::scrollBarH), "Scrollbar H", "Horizontal scrollbar shown")); | |||
| props.add (new SliderPropertyComponent (item.getValue (Ids::scrollbarWidth), "Scrollbar Thickness", 3, 40, 1)); | |||
| addEditableColourProperties (item, props); | |||
| } | |||
| void createCode (ComponentTypeInstance& item, CodeGenerator& code) | |||
| { | |||
| code.constructorCode << item.createConstructorStatement (CodeHelpers::stringLiteral (item.getComponentName())); | |||
| } | |||
| }; | |||
| #endif | |||
| @@ -1,539 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #include "jucer_CodeGenerator.h" | |||
| //============================================================================== | |||
| CodeGenerator::CodeGenerator() | |||
| { | |||
| } | |||
| CodeGenerator::~CodeGenerator() | |||
| { | |||
| } | |||
| int CodeGenerator::getUniqueSuffix() | |||
| { | |||
| return ++suffix; | |||
| } | |||
| //============================================================================== | |||
| void CodeGenerator::addPrivateMember (const String& type, const String& name) | |||
| { | |||
| privateMemberDeclarations << type << " " << name << ";" << newLine; | |||
| } | |||
| //============================================================================== | |||
| String& CodeGenerator::getCallbackCode (const String& requiredParentClass, | |||
| const String& returnType, | |||
| const String& prototype, | |||
| const bool hasPrePostUserSections) | |||
| { | |||
| String parentClass (requiredParentClass); | |||
| if (parentClass.isNotEmpty() | |||
| && ! (parentClass.startsWith ("public ") | |||
| || parentClass.startsWith ("private ") | |||
| || parentClass.startsWith ("protected "))) | |||
| { | |||
| parentClass = "public " + parentClass; | |||
| } | |||
| for (int i = callbacks.size(); --i >= 0;) | |||
| { | |||
| CallbackMethod* const cm = callbacks.getUnchecked(i); | |||
| if (cm->requiredParentClass == parentClass | |||
| && cm->returnType == returnType | |||
| && cm->prototype == prototype) | |||
| return cm->content; | |||
| } | |||
| CallbackMethod* const cm = new CallbackMethod(); | |||
| callbacks.add (cm); | |||
| cm->requiredParentClass = parentClass; | |||
| cm->returnType = returnType; | |||
| cm->prototype = prototype; | |||
| cm->hasPrePostUserSections = hasPrePostUserSections; | |||
| return cm->content; | |||
| } | |||
| void CodeGenerator::removeCallback (const String& returnType, const String& prototype) | |||
| { | |||
| for (int i = callbacks.size(); --i >= 0;) | |||
| { | |||
| CallbackMethod* const cm = callbacks.getUnchecked(i); | |||
| if (cm->returnType == returnType && cm->prototype == prototype) | |||
| callbacks.remove (i); | |||
| } | |||
| } | |||
| const StringArray CodeGenerator::getExtraParentClasses() const | |||
| { | |||
| StringArray s; | |||
| for (int i = 0; i < callbacks.size(); ++i) | |||
| { | |||
| CallbackMethod* const cm = callbacks.getUnchecked(i); | |||
| s.add (cm->requiredParentClass); | |||
| } | |||
| return s; | |||
| } | |||
| const String CodeGenerator::getCallbackDeclarations() const | |||
| { | |||
| String s; | |||
| for (int i = 0; i < callbacks.size(); ++i) | |||
| { | |||
| CallbackMethod* const cm = callbacks.getUnchecked(i); | |||
| s << cm->returnType << " " << cm->prototype << ";" << newLine; | |||
| } | |||
| return s; | |||
| } | |||
| const String CodeGenerator::getCallbackDefinitions() const | |||
| { | |||
| String s; | |||
| for (int i = 0; i < callbacks.size(); ++i) | |||
| { | |||
| CallbackMethod* const cm = callbacks.getUnchecked(i); | |||
| const String userCodeBlockName ("User" + CodeHelpers::makeValidIdentifier (cm->prototype.upToFirstOccurrenceOf ("(", false, false), | |||
| true, true, false).trim()); | |||
| if (userCodeBlockName.isNotEmpty() && cm->hasPrePostUserSections) | |||
| { | |||
| s << cm->returnType << " " << className << "::" << cm->prototype | |||
| << newLine | |||
| << "{" << newLine | |||
| << " //[" << userCodeBlockName << "_Pre]" << newLine | |||
| << " //[/" << userCodeBlockName | |||
| << "_Pre]" << newLine << newLine | |||
| << " " << CodeHelpers::indent (cm->content.trim(), 4, false) << newLine | |||
| << newLine | |||
| << " //[" << userCodeBlockName << "_Post]" << newLine | |||
| << " //[/" << userCodeBlockName << "_Post]" << newLine | |||
| << "}" << newLine | |||
| << newLine; | |||
| } | |||
| else | |||
| { | |||
| s << cm->returnType << " " << className << "::" << cm->prototype << newLine | |||
| << "{" << newLine | |||
| << " " << CodeHelpers::indent (cm->content.trim(), 4, false) << newLine | |||
| << "}" << newLine | |||
| << newLine; | |||
| } | |||
| } | |||
| return s; | |||
| } | |||
| //============================================================================== | |||
| const String CodeGenerator::getClassDeclaration() const | |||
| { | |||
| StringArray parentClassLines; | |||
| parentClassLines.addTokens (parentClasses, ",", String::empty); | |||
| parentClassLines.addArray (getExtraParentClasses()); | |||
| parentClassLines.trim(); | |||
| parentClassLines.removeEmptyStrings(); | |||
| parentClassLines.removeDuplicates (false); | |||
| if (parentClassLines.contains ("public Button", false)) | |||
| parentClassLines.removeString ("public Component", false); | |||
| String r; | |||
| r << "class " << className << " : "; | |||
| r << parentClassLines.joinIntoString ("," + String (newLine) + String::repeatedString (" ", r.length())); | |||
| return r; | |||
| } | |||
| const String CodeGenerator::getInitialiserList() const | |||
| { | |||
| String s; | |||
| StringArray inits (memberInitialisers); | |||
| if (parentClassInitialiser.isNotEmpty()) | |||
| inits.insert (0, parentClassInitialiser); | |||
| inits.trim(); | |||
| inits.removeEmptyStrings(); | |||
| inits.removeDuplicates (false); | |||
| if (inits.size() > 0) | |||
| { | |||
| s << " : "; | |||
| for (int i = 0; i < inits.size(); ++i) | |||
| { | |||
| String init (inits[i]); | |||
| while (init.endsWithChar (',')) | |||
| init = init.dropLastCharacters (1); | |||
| s << init; | |||
| if (i < inits.size() - 1) | |||
| s << "," << newLine << " "; | |||
| else | |||
| s << newLine; | |||
| } | |||
| } | |||
| return s; | |||
| } | |||
| static const String getIncludeFileCode (StringArray files) | |||
| { | |||
| files.trim(); | |||
| files.removeEmptyStrings(); | |||
| files.removeDuplicates (false); | |||
| String s; | |||
| for (int i = 0; i < files.size(); ++i) | |||
| s << "#include \"" << files[i] << "\"" << newLine; | |||
| return s; | |||
| } | |||
| //============================================================================== | |||
| static void replaceTemplate (String& text, const String& itemName, const String& value, bool indent = true) | |||
| { | |||
| for (;;) | |||
| { | |||
| const int index = text.indexOf ("%%" + itemName + "%%"); | |||
| if (index < 0) | |||
| break; | |||
| int indentLevel = 0; | |||
| if (indent) | |||
| { | |||
| for (int i = index; --i >= 0;) | |||
| { | |||
| if (text[i] == '\n') | |||
| break; | |||
| ++indentLevel; | |||
| } | |||
| } | |||
| text = text.replaceSection (index, itemName.length() + 4, CodeHelpers::indent (value, indentLevel, false)); | |||
| } | |||
| } | |||
| //============================================================================== | |||
| void CodeGenerator::applyToCode (String& code, const File& targetFile, | |||
| bool isForPreview, Project* project) const | |||
| { | |||
| replaceTemplate (code, "juceVersion", SystemStats::getJUCEVersion()); | |||
| replaceTemplate (code, "headerGuard", CodeHelpers::makeHeaderGuardName (targetFile)); | |||
| replaceTemplate (code, "className", className); | |||
| replaceTemplate (code, "constructorParams", constructorParams); | |||
| replaceTemplate (code, "initialisers", getInitialiserList()); | |||
| replaceTemplate (code, "classDeclaration", getClassDeclaration()); | |||
| replaceTemplate (code, "privateMemberDeclarations", privateMemberDeclarations); | |||
| replaceTemplate (code, "publicMemberDeclarations", getCallbackDeclarations() + newLine + publicMemberDeclarations); | |||
| replaceTemplate (code, "methodDefinitions", getCallbackDefinitions()); | |||
| if (project != 0) | |||
| replaceTemplate (code, "defaultJuceInclude", CodeHelpers::createIncludeStatement (project->getAppIncludeFile(), targetFile)); | |||
| else | |||
| replaceTemplate (code, "defaultJuceInclude", "#include \"juce_amalgamated.h\""); | |||
| replaceTemplate (code, "includeFilesH", getIncludeFileCode (includeFilesH)); | |||
| replaceTemplate (code, "includeFilesCPP", getIncludeFileCode (includeFilesCPP)); | |||
| replaceTemplate (code, "constructor", constructorCode); | |||
| replaceTemplate (code, "destructor", destructorCode); | |||
| if (! isForPreview) | |||
| { | |||
| replaceTemplate (code, "metadata", jucerMetadata); | |||
| replaceTemplate (code, "staticMemberDefinitions", staticMemberDefinitions); | |||
| } | |||
| else | |||
| { | |||
| replaceTemplate (code, "metadata", " << Metadata isn't shown in the code preview >>" + String (newLine)); | |||
| replaceTemplate (code, "staticMemberDefinitions", "// Static member declarations and resources would go here... (these aren't shown in the code preview)"); | |||
| } | |||
| /*{ | |||
| MemoryOutputStream compDataCpp; | |||
| CodeHelpers::writeDataAsCppLiteral (componentStateData, compDataCpp); | |||
| replaceTemplate (code, "statedata", compDataCpp.toUTF8(), false); | |||
| replaceTemplate (code, "statedatasize", String ((int) componentStateData.getSize())); | |||
| }*/ | |||
| } | |||
| //============================================================================== | |||
| CodeGenerator::CustomCodeList::Iterator::Iterator (const String& documentText, CustomCodeList& customCode_) | |||
| : customCode (customCode_), i (0), codeDocument (0) | |||
| { | |||
| lines.addLines (documentText); | |||
| } | |||
| CodeGenerator::CustomCodeList::Iterator::~Iterator() | |||
| { | |||
| } | |||
| bool CodeGenerator::CustomCodeList::Iterator::next() | |||
| { | |||
| textBefore = String::empty; | |||
| textAfter = String::empty; | |||
| while (i < lines.size()) | |||
| { | |||
| textBefore += lines[i] + "\n"; | |||
| if (lines[i].trimStart().startsWith ("//[")) | |||
| { | |||
| String tag (lines[i].trimStart().substring (3)); | |||
| tag = tag.upToFirstOccurrenceOf ("]", false, false).trim(); | |||
| if (! (tag.isEmpty() || tag.startsWithChar ('/'))) | |||
| { | |||
| const int endLine = indexOfLineStartingWith (lines, "//[/" + tag + "]", i + 1); | |||
| if (endLine > i) | |||
| { | |||
| sectionName = tag; | |||
| codeDocument = customCode.getDocumentFor (tag, true); | |||
| i = endLine; | |||
| bool isLastTag = true; | |||
| for (int j = i + 1; j < lines.size(); ++j) | |||
| { | |||
| if (lines[j].trimStart().startsWith ("//[")) | |||
| { | |||
| isLastTag = false; | |||
| break; | |||
| } | |||
| } | |||
| if (isLastTag) | |||
| { | |||
| textAfter = lines.joinIntoString (newLine, i, lines.size() - i); | |||
| i = lines.size(); | |||
| } | |||
| return true; | |||
| } | |||
| } | |||
| } | |||
| ++i; | |||
| } | |||
| return false; | |||
| } | |||
| //============================================================================== | |||
| CodeGenerator::CustomCodeList::CustomCodeList() | |||
| { | |||
| } | |||
| CodeGenerator::CustomCodeList::~CustomCodeList() | |||
| { | |||
| } | |||
| void CodeGenerator::CustomCodeList::reloadFrom (const String& fileContent) | |||
| { | |||
| StringArray newNames; | |||
| ReferenceCountedArray<CodeDocumentRef> newContent; | |||
| StringArray lines; | |||
| lines.addLines (fileContent); | |||
| for (int i = 0; i < lines.size(); ++i) | |||
| { | |||
| if (lines[i].trimStart().startsWith ("//[")) | |||
| { | |||
| String tag (lines[i].trimStart().substring (3)); | |||
| tag = tag.upToFirstOccurrenceOf ("]", false, false).trim(); | |||
| jassert (! (tag.isEmpty() || tag.startsWithChar ('/'))); | |||
| if (! (tag.isEmpty() || tag.startsWithChar ('/'))) | |||
| { | |||
| const int endLine = indexOfLineStartingWith (lines, "//[/" + tag + "]", i + 1); | |||
| if (endLine > i) | |||
| { | |||
| String content (lines.joinIntoString (newLine, i + 1, endLine - i - 1)); | |||
| newNames.add (tag); | |||
| CodeDocumentRef::Ptr doc (getDocumentFor (tag, false)); | |||
| if (doc == 0) | |||
| { | |||
| doc = new CodeDocumentRef(); | |||
| doc->getDocument().replaceAllContent (content); | |||
| doc->getDocument().clearUndoHistory(); | |||
| doc->getDocument().setSavePoint(); | |||
| } | |||
| newContent.add (doc); | |||
| i = endLine; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| sectionNames = newNames; | |||
| sectionContent = newContent; | |||
| sendSynchronousChangeMessage (this); | |||
| } | |||
| void CodeGenerator::CustomCodeList::applyTo (String& fileContent) const | |||
| { | |||
| StringArray lines; | |||
| lines.addLines (fileContent); | |||
| for (int i = 0; i < lines.size(); ++i) | |||
| { | |||
| if (lines[i].trimStart().startsWith ("//[")) | |||
| { | |||
| String tag (lines[i].trimStart().substring (3)); | |||
| tag = tag.upToFirstOccurrenceOf ("]", false, false); | |||
| jassert (! tag.startsWithChar ('/')); | |||
| if (! tag.startsWithChar ('/')) | |||
| { | |||
| const int endLine = indexOfLineStartingWith (lines, "//[/" + tag + "]", i + 1); | |||
| if (endLine > i) | |||
| { | |||
| StringArray sourceLines; | |||
| sourceLines.addLines (getSectionContent (tag)); | |||
| if (sourceLines.size() > 0) | |||
| { | |||
| lines.removeRange (i + 1, endLine - i - 1); | |||
| for (int j = 0; j < sourceLines.size(); ++j) | |||
| lines.insert (++i, sourceLines [j].trimEnd()); | |||
| ++i; | |||
| } | |||
| else | |||
| { | |||
| i = endLine; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| lines.set (i, lines[i].trimEnd()); | |||
| } | |||
| if (lines[lines.size() - 1].isNotEmpty()) | |||
| lines.add (String::empty); | |||
| fileContent = lines.joinIntoString (newLine); | |||
| } | |||
| bool CodeGenerator::CustomCodeList::needsSaving() const | |||
| { | |||
| for (int i = sectionContent.size(); --i >= 0;) | |||
| if (sectionContent.getUnchecked(i)->getDocument().hasChangedSinceSavePoint()) | |||
| return true; | |||
| return false; | |||
| } | |||
| int CodeGenerator::CustomCodeList::getNumSections() const | |||
| { | |||
| return sectionNames.size(); | |||
| } | |||
| const String CodeGenerator::CustomCodeList::getSectionName (int index) const | |||
| { | |||
| return sectionNames [index]; | |||
| } | |||
| const CodeGenerator::CustomCodeList::CodeDocumentRef::Ptr CodeGenerator::CustomCodeList::getDocument (int index) const | |||
| { | |||
| return sectionContent [index]; | |||
| } | |||
| const CodeGenerator::CustomCodeList::CodeDocumentRef::Ptr CodeGenerator::CustomCodeList::getDocumentFor (const String& sectionName, bool createIfNotFound) | |||
| { | |||
| const int index = sectionNames.indexOf (sectionName); | |||
| if (index >= 0) | |||
| return sectionContent [index]; | |||
| if (createIfNotFound) | |||
| { | |||
| sectionNames.add (sectionName); | |||
| const CodeDocumentRef::Ptr doc (new CodeDocumentRef()); | |||
| sectionContent.add (doc); | |||
| return doc; | |||
| } | |||
| return 0; | |||
| } | |||
| const String CodeGenerator::CustomCodeList::getSectionContent (const String& sectionName) const | |||
| { | |||
| const int index = sectionNames.indexOf (sectionName); | |||
| if (index >= 0) | |||
| return sectionContent[index]->getDocument().getAllContent(); | |||
| return String::empty; | |||
| } | |||
| void CodeGenerator::CustomCodeList::removeSection (const String& sectionName) | |||
| { | |||
| const int index = sectionNames.indexOf (sectionName); | |||
| if (index >= 0) | |||
| { | |||
| sectionNames.remove (index); | |||
| sectionContent.remove (index); | |||
| } | |||
| } | |||
| @@ -1,159 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_CODEGENERATOR_H_F79AEF58__ | |||
| #define __JUCER_CODEGENERATOR_H_F79AEF58__ | |||
| #include "../../jucer_Headers.h" | |||
| #include "../Project/jucer_Project.h" | |||
| //============================================================================== | |||
| class CodeGenerator | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| CodeGenerator(); | |||
| ~CodeGenerator(); | |||
| //============================================================================== | |||
| String className; | |||
| String parentClassInitialiser; // optional parent class initialiser to go before the items in the initialisers list | |||
| StringArray memberInitialisers; | |||
| String parentClasses; | |||
| String constructorParams; | |||
| String privateMemberDeclarations; | |||
| String publicMemberDeclarations; | |||
| StringArray includeFilesH, includeFilesCPP; | |||
| String constructorCode; | |||
| String destructorCode; | |||
| String staticMemberDefinitions; | |||
| String jucerMetadata; | |||
| MemoryBlock componentStateData; | |||
| struct CallbackMethod | |||
| { | |||
| String requiredParentClass, returnType, prototype, content; | |||
| bool hasPrePostUserSections; | |||
| }; | |||
| OwnedArray<CallbackMethod> callbacks; | |||
| void addPrivateMember (const String& type, const String& name); | |||
| String& getCallbackCode (const String& requiredParentClass, | |||
| const String& returnType, | |||
| const String& prototype, | |||
| const bool hasPrePostUserSections); | |||
| void removeCallback (const String& returnType, const String& prototype); | |||
| const String getCallbackDeclarations() const; | |||
| const String getCallbackDefinitions() const; | |||
| const StringArray getExtraParentClasses() const; | |||
| int getUniqueSuffix(); | |||
| //============================================================================== | |||
| // An object to load and store all the user-defined bits of code as documents. | |||
| class CustomCodeList : public ChangeBroadcaster | |||
| { | |||
| public: | |||
| CustomCodeList(); | |||
| ~CustomCodeList(); | |||
| void reloadFrom (const String& fileContent); | |||
| void applyTo (String& fileContent) const; | |||
| bool needsSaving() const; | |||
| //============================================================================== | |||
| // Ref-counted wrapper for a code document.. | |||
| class CodeDocumentRef : public ReferenceCountedObject | |||
| { | |||
| public: | |||
| CodeDocumentRef() {} | |||
| CodeDocument& getDocument() throw() { return doc; } | |||
| typedef ReferenceCountedObjectPtr<CodeDocumentRef> Ptr; | |||
| private: | |||
| CodeDocument doc; | |||
| CodeDocumentRef (const CodeDocumentRef&); | |||
| CodeDocumentRef& operator= (const CodeDocumentRef&); | |||
| }; | |||
| //============================================================================== | |||
| int getNumSections() const; | |||
| const String getSectionName (int index) const; | |||
| const CodeDocumentRef::Ptr getDocument (int index) const; | |||
| const CodeDocumentRef::Ptr getDocumentFor (const String& sectionName, bool createIfNotFound); | |||
| const String getSectionContent (const String& sectionName) const; | |||
| void removeSection (const String& sectionName); | |||
| class Iterator | |||
| { | |||
| public: | |||
| Iterator (const String& documentText, CustomCodeList& customCode); | |||
| ~Iterator(); | |||
| bool next(); | |||
| String textBefore, textAfter, sectionName; | |||
| CodeDocumentRef::Ptr codeDocument; | |||
| private: | |||
| CustomCodeList& customCode; | |||
| StringArray lines; | |||
| int i; | |||
| Iterator (const Iterator&); | |||
| Iterator& operator= (const Iterator&); | |||
| }; | |||
| private: | |||
| StringArray sectionNames; | |||
| ReferenceCountedArray <CodeDocumentRef> sectionContent; | |||
| }; | |||
| //============================================================================== | |||
| void applyToCode (String& codeTemplate, const File& targetFile, | |||
| bool isForPreview, Project* project) const; | |||
| private: | |||
| //============================================================================== | |||
| const String getClassDeclaration() const; | |||
| const String getInitialiserList() const; | |||
| int suffix; | |||
| CodeGenerator (const CodeGenerator&); | |||
| CodeGenerator& operator= (const CodeGenerator&); | |||
| }; | |||
| #endif // __JUCER_CODEGENERATOR_H_F79AEF58__ | |||
| @@ -1,862 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #include "jucer_ComponentDocument.h" | |||
| #include "Types/jucer_ComponentTypeManager.h" | |||
| #include "../../utility/jucer_CoordinatePropertyComponent.h" | |||
| //============================================================================== | |||
| static const Identifier componentDocumentTag ("COMPONENT"); | |||
| static const Identifier componentGroupTag ("COMPONENTS"); | |||
| static const Identifier markersGroupXTag ("MARKERS_X"); | |||
| static const Identifier markersGroupYTag ("MARKERS_Y"); | |||
| static const char* const metadataTagStart = "JUCER_" "COMPONENT_METADATA_START"; // written like this to avoid thinking this file is a component! | |||
| static const char* const metadataTagEnd = "JUCER_" "COMPONENT_METADATA_END"; | |||
| const Identifier ComponentDocument::idProperty ("id"); | |||
| const Identifier ComponentDocument::compBoundsProperty ("position"); | |||
| const Identifier ComponentDocument::memberNameProperty ("memberName"); | |||
| const Identifier ComponentDocument::compNameProperty ("name"); | |||
| const Identifier ComponentDocument::compTooltipProperty ("tooltip"); | |||
| const Identifier ComponentDocument::compFocusOrderProperty ("focusOrder"); | |||
| const Identifier ComponentDocument::jucerIDProperty ("jucerID"); | |||
| //============================================================================== | |||
| ComponentDocument::ComponentDocument (Project* project_, const File& cppFile_) | |||
| : project (project_), | |||
| cppFile (cppFile_), | |||
| root (componentDocumentTag), | |||
| changedSinceSaved (false), | |||
| usingTemporaryCanvasSize (false) | |||
| { | |||
| checkRootObject(); | |||
| root.addListener (this); | |||
| } | |||
| ComponentDocument::ComponentDocument (const ComponentDocument& other) | |||
| : project (other.project), | |||
| cppFile (other.cppFile), | |||
| root (other.root), | |||
| changedSinceSaved (false) | |||
| { | |||
| checkRootObject(); | |||
| root.addListener (this); | |||
| } | |||
| ComponentDocument::~ComponentDocument() | |||
| { | |||
| root.removeListener (this); | |||
| } | |||
| void ComponentDocument::beginNewTransaction() | |||
| { | |||
| undoManager.beginNewTransaction(); | |||
| } | |||
| void ComponentDocument::changed() | |||
| { | |||
| changedSinceSaved = true; | |||
| } | |||
| void ComponentDocument::valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged, const Identifier& property) | |||
| { | |||
| changed(); | |||
| } | |||
| void ComponentDocument::valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) | |||
| { | |||
| changed(); | |||
| } | |||
| void ComponentDocument::valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) | |||
| { | |||
| changed(); | |||
| } | |||
| bool ComponentDocument::isComponentFile (const File& file) | |||
| { | |||
| if (! file.hasFileExtension (".cpp")) | |||
| return false; | |||
| InputStream* in = file.createInputStream(); | |||
| if (in != 0) | |||
| { | |||
| BufferedInputStream buf (in, 8192, true); | |||
| while (! buf.isExhausted()) | |||
| if (buf.readNextLine().contains (metadataTagStart)) | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| const String ComponentDocument::getCppTemplate() const { return String (BinaryData::jucer_ComponentTemplate_cpp); } | |||
| const String ComponentDocument::getHeaderTemplate() const { return String (BinaryData::jucer_ComponentTemplate_h); } | |||
| const String ComponentDocument::getCppContent() | |||
| { | |||
| MemoryOutputStream cpp, header; | |||
| writeCode (cpp, header); | |||
| return cpp.toUTF8(); | |||
| } | |||
| const String ComponentDocument::getHeaderContent() | |||
| { | |||
| MemoryOutputStream cpp, header; | |||
| writeCode (cpp, header); | |||
| return header.toUTF8(); | |||
| } | |||
| void ComponentDocument::writeCode (OutputStream& cpp, OutputStream& header) | |||
| { | |||
| CodeGenerator codeGen; | |||
| codeGen.className = getClassName().toString(); | |||
| codeGen.parentClasses = "public Component"; | |||
| { | |||
| MemoryOutputStream stateStream (1024, 1024, &codeGen.componentStateData); | |||
| root.writeToStream (stateStream); | |||
| } | |||
| for (int i = 0; i < getNumComponents(); ++i) | |||
| { | |||
| ComponentTypeInstance item (*this, getComponent (i)); | |||
| item.createCode (codeGen); | |||
| } | |||
| { | |||
| MemoryOutputStream metaData; | |||
| writeMetadata (metaData); | |||
| codeGen.jucerMetadata = metaData.toUTF8(); | |||
| } | |||
| { | |||
| String code (getCppTemplate()); | |||
| String oldContent; | |||
| codeGen.applyToCode (code, cppFile, false, project); | |||
| customCode.applyTo (code); | |||
| cpp << code; | |||
| } | |||
| { | |||
| String code (getHeaderTemplate()); | |||
| String oldContent; | |||
| codeGen.applyToCode (code, cppFile.withFileExtension (".h"), false, project); | |||
| customCode.applyTo (code); | |||
| header << code; | |||
| } | |||
| } | |||
| void ComponentDocument::writeMetadata (OutputStream& out) | |||
| { | |||
| out << metadataTagStart << newLine << newLine; | |||
| ScopedPointer<XmlElement> xml (root.createXml()); | |||
| jassert (xml != 0); | |||
| if (xml != 0) | |||
| xml->writeToStream (out, String::empty, false, false); | |||
| out << newLine << metadataTagEnd; | |||
| } | |||
| bool ComponentDocument::save() | |||
| { | |||
| MemoryOutputStream cpp, header; | |||
| writeCode (cpp, header); | |||
| bool savedOk = FileHelpers::overwriteFileWithNewDataIfDifferent (cppFile, cpp) | |||
| && FileHelpers::overwriteFileWithNewDataIfDifferent (cppFile.withFileExtension (".h"), header); | |||
| if (savedOk) | |||
| changedSinceSaved = false; | |||
| return savedOk; | |||
| } | |||
| bool ComponentDocument::reload() | |||
| { | |||
| String xmlString; | |||
| bool hadMetaDataTags = false; | |||
| { | |||
| InputStream* in = cppFile.createInputStream(); | |||
| if (in == 0) | |||
| return false; | |||
| BufferedInputStream buf (in, 8192, true); | |||
| String::Concatenator xml (xmlString); | |||
| while (! buf.isExhausted()) | |||
| { | |||
| String line (buf.readNextLine()); | |||
| if (line.contains (metadataTagStart)) | |||
| { | |||
| while (! buf.isExhausted()) | |||
| { | |||
| line = buf.readNextLine(); | |||
| if (line.contains (metadataTagEnd)) | |||
| { | |||
| hadMetaDataTags = true; | |||
| break; | |||
| } | |||
| xml.append (line); | |||
| xml.append (newLine); | |||
| } | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| XmlDocument doc (xmlString); | |||
| ScopedPointer<XmlElement> xml (doc.getDocumentElement()); | |||
| if (xml == 0 && hadMetaDataTags) | |||
| xml = new XmlElement (componentDocumentTag.toString()); | |||
| if (xml != 0 && xml->hasTagName (componentDocumentTag.toString())) | |||
| { | |||
| ValueTree newTree (ValueTree::fromXml (*xml)); | |||
| if (newTree.isValid()) | |||
| { | |||
| root = newTree; | |||
| markersX = 0; | |||
| markersY = 0; | |||
| checkRootObject(); | |||
| customCode.reloadFrom (cppFile.loadFileAsString()); | |||
| root.addChild (ValueTree ("dummy"), 0, 0); | |||
| root.removeChild (root.getChildWithName("dummy"), 0); | |||
| undoManager.clearUndoHistory(); | |||
| changedSinceSaved = false; | |||
| return true; | |||
| } | |||
| } | |||
| return false; | |||
| } | |||
| bool ComponentDocument::hasChangedSinceLastSave() | |||
| { | |||
| return changedSinceSaved || customCode.needsSaving(); | |||
| } | |||
| void ComponentDocument::createSubTreeIfNotThere (const Identifier& name) | |||
| { | |||
| if (! root.getChildWithName (name).isValid()) | |||
| root.addChild (ValueTree (name), -1, 0); | |||
| } | |||
| void ComponentDocument::checkRootObject() | |||
| { | |||
| jassert (root.hasType (componentDocumentTag)); | |||
| if (root [idProperty].toString().isEmpty()) | |||
| root.setProperty (idProperty, createAlphaNumericUID(), 0); | |||
| createSubTreeIfNotThere (componentGroupTag); | |||
| createSubTreeIfNotThere (markersGroupXTag); | |||
| createSubTreeIfNotThere (markersGroupYTag); | |||
| if (markersX == 0) | |||
| markersX = new MarkerList (*this, true); | |||
| if (markersY == 0) | |||
| markersY = new MarkerList (*this, false); | |||
| if (getClassName().toString().isEmpty()) | |||
| getClassName() = "NewComponent"; | |||
| if ((int) getCanvasWidth().getValue() <= 0) | |||
| getCanvasWidth() = 640; | |||
| if ((int) getCanvasHeight().getValue() <= 0) | |||
| getCanvasHeight() = 480; | |||
| if (! root.hasProperty (Ids::background)) | |||
| getBackgroundColour() = Colours::white.toString(); | |||
| } | |||
| void ComponentDocument::setUsingTemporaryCanvasSize (bool b) | |||
| { | |||
| tempCanvasWidth = root.getProperty (Ids::width); | |||
| tempCanvasHeight = root.getProperty (Ids::height); | |||
| usingTemporaryCanvasSize = b; | |||
| } | |||
| Value ComponentDocument::getCanvasWidth() const | |||
| { | |||
| return usingTemporaryCanvasSize ? tempCanvasWidth : getRootValueNonUndoable (Ids::width); | |||
| } | |||
| Value ComponentDocument::getCanvasHeight() const | |||
| { | |||
| return usingTemporaryCanvasSize ? tempCanvasHeight : getRootValueNonUndoable (Ids::height); | |||
| } | |||
| Value ComponentDocument::getBackgroundColour() const | |||
| { | |||
| return getRootValueUndoable (Ids::background); | |||
| } | |||
| //============================================================================== | |||
| const int menuItemOffset = 0x63451fa4; | |||
| void ComponentDocument::addNewComponentMenuItems (PopupMenu& menu) const | |||
| { | |||
| const StringArray displayNames (ComponentTypeManager::getInstance()->getDisplayNames()); | |||
| for (int i = 0; i < displayNames.size(); ++i) | |||
| menu.addItem (i + menuItemOffset, "New " + displayNames[i]); | |||
| } | |||
| const ValueTree ComponentDocument::performNewComponentMenuItem (int menuResultCode) | |||
| { | |||
| const StringArray displayNames (ComponentTypeManager::getInstance()->getDisplayNames()); | |||
| if (menuResultCode >= menuItemOffset && menuResultCode < menuItemOffset + displayNames.size()) | |||
| { | |||
| ComponentTypeHandler* handler = ComponentTypeManager::getInstance()->getHandler (menuResultCode - menuItemOffset); | |||
| jassert (handler != 0); | |||
| if (handler != 0) | |||
| { | |||
| ValueTree state (handler->getValueTreeType()); | |||
| state.setProperty (idProperty, createAlphaNumericUID(), 0); | |||
| ComponentTypeInstance comp (*this, state); | |||
| handler->initialiseNewItem (comp); | |||
| getComponentGroup().addChild (state, -1, getUndoManager()); | |||
| return state; | |||
| } | |||
| } | |||
| return ValueTree::invalid; | |||
| } | |||
| void ComponentDocument::componentDoubleClicked (const MouseEvent& e, const ValueTree& state) | |||
| { | |||
| ComponentTypeInstance item (*this, state); | |||
| item.getHandler()->itemDoubleClicked (e, item); | |||
| } | |||
| void ComponentDocument::updateComponentsIn (Component* compHolder) | |||
| { | |||
| int i; | |||
| for (i = compHolder->getNumChildComponents(); --i >= 0;) | |||
| { | |||
| Component* c = compHolder->getChildComponent (i); | |||
| if (! containsComponent (c)) | |||
| delete c; | |||
| } | |||
| Array <Component*> componentsInOrder; | |||
| const int num = getNumComponents(); | |||
| for (i = 0; i < num; ++i) | |||
| { | |||
| const ValueTree v (getComponent (i)); | |||
| Component* c = findComponentForState (compHolder, v); | |||
| if (c == 0) | |||
| compHolder->addAndMakeVisible (c = createComponent (i)); | |||
| else | |||
| updateComponent (c); | |||
| componentsInOrder.add (c); | |||
| } | |||
| // Make sure the z-order is correct.. | |||
| if (num > 0) | |||
| { | |||
| componentsInOrder.getLast()->toFront (false); | |||
| for (i = num - 1; --i >= 0;) | |||
| componentsInOrder.getUnchecked(i)->toBehind (componentsInOrder.getUnchecked (i + 1)); | |||
| } | |||
| } | |||
| //============================================================================== | |||
| ValueTree ComponentDocument::getComponentGroup() const | |||
| { | |||
| return root.getChildWithName (componentGroupTag); | |||
| } | |||
| int ComponentDocument::getNumComponents() const | |||
| { | |||
| return getComponentGroup().getNumChildren(); | |||
| } | |||
| const ValueTree ComponentDocument::getComponent (int index) const | |||
| { | |||
| return getComponentGroup().getChild (index); | |||
| } | |||
| const ValueTree ComponentDocument::getComponentWithMemberName (const String& name) const | |||
| { | |||
| return getComponentGroup().getChildWithProperty (memberNameProperty, name); | |||
| } | |||
| const ValueTree ComponentDocument::getComponentWithID (const String& uid) const | |||
| { | |||
| return getComponentGroup().getChildWithProperty (idProperty, uid); | |||
| } | |||
| Component* ComponentDocument::createComponent (int index) | |||
| { | |||
| const ValueTree v (getComponentGroup().getChild (index)); | |||
| if (v.isValid()) | |||
| { | |||
| Component* c = ComponentTypeManager::getInstance()->createFromStoredType (*this, v); | |||
| c->getProperties().set (jucerIDProperty, v[idProperty]); | |||
| jassert (getJucerIDFor (c).isNotEmpty()); | |||
| return c; | |||
| } | |||
| return 0; | |||
| } | |||
| //============================================================================== | |||
| const RelativeCoordinate ComponentDocument::findNamedCoordinate (const String& objectName, const String& edge) const | |||
| { | |||
| if (objectName == RelativeCoordinate::Strings::parent) | |||
| { | |||
| if (edge == RelativeCoordinate::Strings::right) return RelativeCoordinate ((double) getCanvasWidth().getValue(), true); | |||
| if (edge == RelativeCoordinate::Strings::bottom) return RelativeCoordinate ((double) getCanvasHeight().getValue(), false); | |||
| } | |||
| if (objectName.isNotEmpty() && edge.isNotEmpty()) | |||
| { | |||
| const ValueTree comp (getComponentWithMemberName (objectName)); | |||
| if (comp.isValid()) | |||
| { | |||
| const RelativeRectangle coords (getCoordsFor (comp)); | |||
| if (edge == RelativeCoordinate::Strings::left) return coords.left; | |||
| if (edge == RelativeCoordinate::Strings::right) return coords.right; | |||
| if (edge == RelativeCoordinate::Strings::top) return coords.top; | |||
| if (edge == RelativeCoordinate::Strings::bottom) return coords.bottom; | |||
| } | |||
| } | |||
| { | |||
| const ValueTree marker (getMarkerListX().getMarkerNamed (objectName)); | |||
| if (marker.isValid()) | |||
| return getMarkerListX().getCoordinate (marker); | |||
| } | |||
| { | |||
| const ValueTree marker (getMarkerListY().getMarkerNamed (objectName)); | |||
| if (marker.isValid()) | |||
| return getMarkerListY().getCoordinate (marker); | |||
| } | |||
| return RelativeCoordinate(); | |||
| } | |||
| const RelativeRectangle ComponentDocument::getCoordsFor (const ValueTree& state) const | |||
| { | |||
| return RelativeRectangle (state [compBoundsProperty]); | |||
| } | |||
| void ComponentDocument::setCoordsFor (ValueTree& state, const RelativeRectangle& pr) | |||
| { | |||
| const String newBoundsString (pr.toString()); | |||
| if (state[compBoundsProperty] != newBoundsString) | |||
| state.setProperty (compBoundsProperty, newBoundsString, getUndoManager()); | |||
| } | |||
| const String ComponentDocument::getNonexistentMemberName (String name) | |||
| { | |||
| String n (CodeHelpers::makeValidIdentifier (name, false, true, false)); | |||
| int suffix = 2; | |||
| while (markersX->getMarkerNamed (n).isValid() || markersY->getMarkerNamed (n).isValid() | |||
| || getComponentWithMemberName (n).isValid()) | |||
| n = n.trimCharactersAtEnd ("0123456789") + String (suffix++); | |||
| return n; | |||
| } | |||
| void ComponentDocument::renameAnchor (const String& oldName, const String& newName) | |||
| { | |||
| int i; | |||
| for (i = getNumComponents(); --i >= 0;) | |||
| { | |||
| ValueTree v (getComponent(i)); | |||
| RelativeRectangle coords (getCoordsFor (v)); | |||
| coords.renameAnchorIfUsed (oldName, newName, this); | |||
| setCoordsFor (v, coords); | |||
| } | |||
| markersX->renameAnchorInMarkers (oldName, newName); | |||
| markersY->renameAnchorInMarkers (oldName, newName); | |||
| } | |||
| void ComponentDocument::addMarkerMenuItem (int i, const RelativeCoordinate& coord, | |||
| const String& objectName, const String& edge, PopupMenu& menu, | |||
| bool isAnchor1, const String& fullCoordName) | |||
| { | |||
| RelativeCoordinate requestedCoord (findNamedCoordinate (objectName, edge)); | |||
| String name (objectName); | |||
| if (edge.isNotEmpty()) | |||
| name << '.' << edge; | |||
| menu.addItem (i, name, | |||
| ! (name == fullCoordName || requestedCoord.references (fullCoordName, this)), | |||
| name == (isAnchor1 ? coord.getAnchorName1() : coord.getAnchorName2())); | |||
| } | |||
| void ComponentDocument::addComponentMarkerMenuItems (const ValueTree& componentState, const String& coordName, | |||
| RelativeCoordinate& coord, PopupMenu& menu, bool isAnchor1, bool isHorizontal) | |||
| { | |||
| const String componentName (componentState [memberNameProperty].toString()); | |||
| const String fullCoordName (componentName + "." + coordName); | |||
| if (isHorizontal) | |||
| { | |||
| addMarkerMenuItem (1, coord, RelativeCoordinate::Strings::parent, RelativeCoordinate::Strings::left, menu, isAnchor1, fullCoordName); | |||
| addMarkerMenuItem (2, coord, RelativeCoordinate::Strings::parent, RelativeCoordinate::Strings::right, menu, isAnchor1, fullCoordName); | |||
| menu.addSeparator(); | |||
| addMarkerMenuItem (3, coord, componentName, RelativeCoordinate::Strings::left, menu, isAnchor1, fullCoordName); | |||
| addMarkerMenuItem (4, coord, componentName, RelativeCoordinate::Strings::right, menu, isAnchor1, fullCoordName); | |||
| } | |||
| else | |||
| { | |||
| addMarkerMenuItem (1, coord, RelativeCoordinate::Strings::parent, RelativeCoordinate::Strings::top, menu, isAnchor1, fullCoordName); | |||
| addMarkerMenuItem (2, coord, RelativeCoordinate::Strings::parent, RelativeCoordinate::Strings::bottom, menu, isAnchor1, fullCoordName); | |||
| menu.addSeparator(); | |||
| addMarkerMenuItem (3, coord, componentName, RelativeCoordinate::Strings::top, menu, isAnchor1, fullCoordName); | |||
| addMarkerMenuItem (4, coord, componentName, RelativeCoordinate::Strings::bottom, menu, isAnchor1, fullCoordName); | |||
| } | |||
| menu.addSeparator(); | |||
| const MarkerList& markerList = getMarkerList (isHorizontal); | |||
| int i; | |||
| for (i = 0; i < markerList.size(); ++i) | |||
| addMarkerMenuItem (100 + i, coord, markerList.getName (markerList.getMarker (i)), String::empty, menu, isAnchor1, fullCoordName); | |||
| menu.addSeparator(); | |||
| for (i = 0; i < getNumComponents(); ++i) | |||
| { | |||
| const String compName (getComponent (i) [memberNameProperty].toString()); | |||
| if (compName != componentName) | |||
| { | |||
| if (isHorizontal) | |||
| { | |||
| addMarkerMenuItem (10000 + i * 4, coord, compName, RelativeCoordinate::Strings::left, menu, isAnchor1, fullCoordName); | |||
| addMarkerMenuItem (10001 + i * 4, coord, compName, RelativeCoordinate::Strings::right, menu, isAnchor1, fullCoordName); | |||
| } | |||
| else | |||
| { | |||
| addMarkerMenuItem (10002 + i * 4, coord, compName, RelativeCoordinate::Strings::top, menu, isAnchor1, fullCoordName); | |||
| addMarkerMenuItem (10003 + i * 4, coord, compName, RelativeCoordinate::Strings::bottom, menu, isAnchor1, fullCoordName); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| const String ComponentDocument::getChosenMarkerMenuItem (const ValueTree& componentState, RelativeCoordinate& coord, int i, bool isHorizontal) const | |||
| { | |||
| const String componentName (componentState [memberNameProperty].toString()); | |||
| if (i == 1) return isHorizontal ? RelativeCoordinate::Strings::parentLeft : RelativeCoordinate::Strings::parentTop; | |||
| if (i == 2) return isHorizontal ? RelativeCoordinate::Strings::parentRight : RelativeCoordinate::Strings::parentBottom; | |||
| if (i == 3) return componentName + (isHorizontal ? ".left" : ".top"); | |||
| if (i == 4) return componentName + (isHorizontal ? ".right" : ".bottom"); | |||
| const MarkerList& markerList = getMarkerList (isHorizontal); | |||
| if (i >= 100 && i < 10000) | |||
| return markerList.getName (markerList.getMarker (i - 100)); | |||
| if (i >= 10000) | |||
| { | |||
| const String compName (getComponent ((i - 10000) / 4) [memberNameProperty].toString()); | |||
| switch (i & 3) | |||
| { | |||
| case 0: return compName + ".left"; | |||
| case 1: return compName + ".right"; | |||
| case 2: return compName + ".top"; | |||
| case 3: return compName + ".bottom"; | |||
| default: break; | |||
| } | |||
| } | |||
| jassertfalse; | |||
| return String::empty; | |||
| } | |||
| void ComponentDocument::updateComponent (Component* comp) | |||
| { | |||
| const ValueTree v (getComponentState (comp)); | |||
| if (v.isValid()) | |||
| { | |||
| ComponentTypeInstance item (*this, v); | |||
| item.updateComponent (comp); | |||
| } | |||
| } | |||
| bool ComponentDocument::containsComponent (Component* comp) const | |||
| { | |||
| const ValueTree comps (getComponentGroup()); | |||
| for (int i = 0; i < comps.getNumChildren(); ++i) | |||
| if (isStateForComponent (comps.getChild(i), comp)) | |||
| return true; | |||
| return false; | |||
| } | |||
| const ValueTree ComponentDocument::getComponentState (Component* comp) const | |||
| { | |||
| jassert (comp != 0); | |||
| return getComponentGroup().getChildWithProperty (idProperty, getJucerIDFor (comp)); | |||
| } | |||
| Component* ComponentDocument::findComponentForState (Component* compHolder, const ValueTree& state) | |||
| { | |||
| const String compId (state [idProperty].toString()); | |||
| for (int i = compHolder->getNumChildComponents(); --i >= 0;) | |||
| { | |||
| Component* const c = compHolder->getChildComponent (i); | |||
| if (getJucerIDFor (c) == compId) | |||
| return c; | |||
| } | |||
| return 0; | |||
| } | |||
| bool ComponentDocument::isStateForComponent (const ValueTree& storedState, Component* comp) const | |||
| { | |||
| jassert (comp != 0); | |||
| jassert (! storedState [idProperty].isVoid()); | |||
| return storedState [idProperty] == getJucerIDFor (comp); | |||
| } | |||
| void ComponentDocument::removeComponent (const ValueTree& state) | |||
| { | |||
| jassert (state.isAChildOf (getComponentGroup())); | |||
| renameAnchor (state [memberNameProperty], String::empty); | |||
| getComponentGroup().removeChild (state, getUndoManager()); | |||
| } | |||
| //============================================================================== | |||
| ComponentDocument::MarkerList::MarkerList (ComponentDocument& document_, const bool isX_) | |||
| : MarkerListBase (isX_), | |||
| document (document_), | |||
| group (document_.getRoot().getChildWithName (isX_ ? markersGroupXTag : markersGroupYTag)) | |||
| { | |||
| jassert (group.isValid()); | |||
| jassert (group.isAChildOf (document_.getRoot())); | |||
| } | |||
| UndoManager* ComponentDocument::MarkerList::getUndoManager() const | |||
| { | |||
| return document.getUndoManager(); | |||
| } | |||
| const String ComponentDocument::MarkerList::getNonexistentMarkerName (const String& name) | |||
| { | |||
| return document.getNonexistentMemberName (name); | |||
| } | |||
| void ComponentDocument::MarkerList::renameAnchor (const String& oldName, const String& newName) | |||
| { | |||
| document.renameAnchor (oldName, newName); | |||
| } | |||
| void ComponentDocument::MarkerList::createMarker (const String& name, double position) | |||
| { | |||
| ValueTree marker (getMarkerTag()); | |||
| marker.setProperty (getMarkerNameProperty(), name, 0); | |||
| marker.setProperty (getMarkerPosProperty(), RelativeCoordinate (position, isX).toString(), 0); | |||
| marker.setProperty (Ids::id_, createAlphaNumericUID(), 0); | |||
| group.addChild (marker, -1, getUndoManager()); | |||
| } | |||
| void ComponentDocument::MarkerList::deleteMarker (ValueTree& markerState) | |||
| { | |||
| renameAnchor (getName (markerState), String::empty); | |||
| group.removeChild (markerState, getUndoManager()); | |||
| } | |||
| const RelativeCoordinate ComponentDocument::MarkerList::findNamedCoordinate (const String& objectName, const String& edge) const | |||
| { | |||
| if (objectName == RelativeCoordinate::Strings::parent) | |||
| { | |||
| if (edge == RelativeCoordinate::Strings::right) return RelativeCoordinate ((double) document.getCanvasWidth().getValue(), true); | |||
| if (edge == RelativeCoordinate::Strings::bottom) return RelativeCoordinate ((double) document.getCanvasHeight().getValue(), false); | |||
| } | |||
| const ValueTree marker (getMarkerNamed (objectName)); | |||
| if (marker.isValid()) | |||
| return getCoordinate (marker); | |||
| return RelativeCoordinate(); | |||
| } | |||
| void ComponentDocument::MarkerList::addMarkerMenuItems (const ValueTree& markerState, const RelativeCoordinate& coord, PopupMenu& menu, bool isAnchor1) | |||
| { | |||
| const String fullCoordName (getName (markerState)); | |||
| if (isX) | |||
| { | |||
| document.addMarkerMenuItem (1, coord, RelativeCoordinate::Strings::parent, RelativeCoordinate::Strings::left, menu, isAnchor1, fullCoordName); | |||
| document.addMarkerMenuItem (2, coord, RelativeCoordinate::Strings::parent, RelativeCoordinate::Strings::right, menu, isAnchor1, fullCoordName); | |||
| } | |||
| else | |||
| { | |||
| document.addMarkerMenuItem (1, coord, RelativeCoordinate::Strings::parent, RelativeCoordinate::Strings::top, menu, isAnchor1, fullCoordName); | |||
| document.addMarkerMenuItem (2, coord, RelativeCoordinate::Strings::parent, RelativeCoordinate::Strings::bottom, menu, isAnchor1, fullCoordName); | |||
| } | |||
| menu.addSeparator(); | |||
| for (int i = 0; i < size(); ++i) | |||
| document.addMarkerMenuItem (100 + i, coord, getName (getMarker (i)), | |||
| String::empty, menu, isAnchor1, fullCoordName); | |||
| } | |||
| const String ComponentDocument::MarkerList::getChosenMarkerMenuItem (const RelativeCoordinate& coord, int i) const | |||
| { | |||
| if (i == 1) return isX ? "parent.left" : "parent.top"; | |||
| if (i == 2) return isX ? "parent.right" : "parent.bottom"; | |||
| if (i >= 100 && i < 10000) | |||
| return getName (getMarker (i - 100)); | |||
| jassertfalse; | |||
| return String::empty; | |||
| } | |||
| //============================================================================== | |||
| bool ComponentDocument::MarkerList::createProperties (Array <PropertyComponent*>& props, const String& itemId) | |||
| { | |||
| ValueTree marker (group.getChildWithProperty (idProperty, itemId)); | |||
| if (marker.isValid()) | |||
| { | |||
| props.add (new TextPropertyComponent (Value (new MarkerListBase::MarkerNameValueSource (this, getNameAsValue (marker))), | |||
| "Marker Name", 256, false)); | |||
| props.add (new MarkerListBase::PositionPropertyComponent (*this, "Position", marker, | |||
| marker.getPropertyAsValue (getMarkerPosProperty(), document.getUndoManager()))); | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| //============================================================================== | |||
| bool ComponentDocument::createItemProperties (Array <PropertyComponent*>& props, const String& itemId) | |||
| { | |||
| ValueTree comp (getComponentWithID (itemId)); | |||
| if (comp.isValid()) | |||
| { | |||
| ComponentTypeInstance item (*this, comp); | |||
| item.createProperties (props); | |||
| return true; | |||
| } | |||
| if (markersX->createProperties (props, itemId) | |||
| || markersY->createProperties (props, itemId)) | |||
| return true; | |||
| return false; | |||
| } | |||
| void ComponentDocument::createItemProperties (Array <PropertyComponent*>& props, const StringArray& selectedItemIds) | |||
| { | |||
| if (selectedItemIds.size() != 1) | |||
| return; //xxx | |||
| for (int i = 0; i < selectedItemIds.size(); ++i) | |||
| createItemProperties (props, selectedItemIds[i]); | |||
| } | |||
| //============================================================================== | |||
| UndoManager* ComponentDocument::getUndoManager() const | |||
| { | |||
| return &undoManager; | |||
| } | |||
| //============================================================================== | |||
| const String ComponentDocument::getJucerIDFor (Component* c) | |||
| { | |||
| if (c == 0) | |||
| { | |||
| jassertfalse; | |||
| return String::empty; | |||
| } | |||
| jassert (c->getProperties().contains (jucerIDProperty)); | |||
| return c->getProperties() [jucerIDProperty]; | |||
| } | |||
| //============================================================================== | |||
| void ComponentDocument::createClassProperties (Array <PropertyComponent*>& props) | |||
| { | |||
| props.add (new TextPropertyComponent (getClassName(), "Class Name", 256, false)); | |||
| props.getLast()->setTooltip ("The C++ class name for the component class."); | |||
| props.add (new TextPropertyComponent (getClassDescription(), "Description", 512, false)); | |||
| props.getLast()->setTooltip ("A freeform description of the component."); | |||
| props.add (new SliderPropertyComponent (getCanvasWidth(), "Initial Width", 1.0, 8192.0, 1.0)); | |||
| props.getLast()->setTooltip ("The initial width of the component when it is created."); | |||
| props.add (new SliderPropertyComponent (getCanvasHeight(), "Initial Height", 1.0, 8192.0, 1.0)); | |||
| props.getLast()->setTooltip ("The initial height of the component when it is created."); | |||
| } | |||
| @@ -1,207 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_COMPONENTDOCUMENT_JUCEHEADER__ | |||
| #define __JUCER_COMPONENTDOCUMENT_JUCEHEADER__ | |||
| #include "../../jucer_Headers.h" | |||
| #include "../Project/jucer_Project.h" | |||
| #include "../../utility/jucer_MarkerListBase.h" | |||
| #include "jucer_CodeGenerator.h" | |||
| //============================================================================== | |||
| class ComponentDocument : public ValueTree::Listener, | |||
| public RelativeCoordinate::NamedCoordinateFinder | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| ComponentDocument (Project* project, const File& cppFile); | |||
| ComponentDocument (const ComponentDocument& other); | |||
| ~ComponentDocument(); | |||
| static bool isComponentFile (const File& file); | |||
| bool save(); | |||
| bool reload(); | |||
| bool hasChangedSinceLastSave(); | |||
| void changed(); | |||
| Project* getProject() const { return project; } | |||
| const File getCppFile() const { return cppFile; } | |||
| void cppFileHasMoved (const File& newFile) { cppFile = newFile; } | |||
| //============================================================================== | |||
| const String getUniqueId() const { return root [idProperty]; } | |||
| Value getClassName() const { return getRootValueNonUndoable (Ids::className); } | |||
| Value getClassDescription() const { return getRootValueNonUndoable (Ids::classDesc); } | |||
| void setUsingTemporaryCanvasSize (bool b); | |||
| Value getCanvasWidth() const; | |||
| Value getCanvasHeight() const; | |||
| Value getBackgroundColour() const; | |||
| void createClassProperties (Array <PropertyComponent*>& props); | |||
| const String getNonexistentMemberName (String suggestedName); | |||
| //============================================================================== | |||
| int getNumComponents() const; | |||
| const ValueTree getComponent (int index) const; | |||
| const ValueTree getComponentWithMemberName (const String& name) const; | |||
| const ValueTree getComponentWithID (const String& uid) const; | |||
| Component* createComponent (int index); | |||
| void updateComponent (Component* comp); | |||
| bool containsComponent (Component* comp) const; | |||
| const ValueTree getComponentState (Component* comp) const; | |||
| bool isStateForComponent (const ValueTree& storedState, Component* comp) const; | |||
| void removeComponent (const ValueTree& state); | |||
| const RelativeRectangle getCoordsFor (const ValueTree& componentState) const; | |||
| void setCoordsFor (ValueTree& componentState, const RelativeRectangle& newSize); | |||
| void renameAnchor (const String& oldName, const String& newName); | |||
| // for RelativeCoordinate::Resolver: | |||
| const RelativeCoordinate findNamedCoordinate (const String& objectName, const String& edge) const; | |||
| void addComponentMarkerMenuItems (const ValueTree& componentState, const String& coordName, | |||
| RelativeCoordinate& coord, PopupMenu& menu, bool isAnchor1, bool isHorizontal); | |||
| const String getChosenMarkerMenuItem (const ValueTree& componentState, RelativeCoordinate& coord, int itemId, bool isHorizontal) const; | |||
| void addNewComponentMenuItems (PopupMenu& menu) const; | |||
| const ValueTree performNewComponentMenuItem (int menuResultCode); | |||
| void componentDoubleClicked (const MouseEvent& e, const ValueTree& state); | |||
| void updateComponentsIn (Component* compHolder); | |||
| Component* findComponentForState (Component* parentComp, const ValueTree& state); | |||
| //============================================================================== | |||
| class MarkerList : public MarkerListBase | |||
| { | |||
| public: | |||
| MarkerList (ComponentDocument& document, bool isX); | |||
| const RelativeCoordinate findNamedCoordinate (const String& objectName, const String& edge) const; | |||
| bool createProperties (Array <PropertyComponent*>& props, const String& itemId); | |||
| void addMarkerMenuItems (const ValueTree& markerState, const RelativeCoordinate& coord, PopupMenu& menu, bool isAnchor1); | |||
| const String getChosenMarkerMenuItem (const RelativeCoordinate& coord, int itemId) const; | |||
| UndoManager* getUndoManager() const; | |||
| void renameAnchor (const String& oldName, const String& newName); | |||
| const String getNonexistentMarkerName (const String& name); | |||
| const String getId (const ValueTree& markerState) { return markerState [Ids::id_]; } | |||
| int size() const { return group.getNumChildren(); } | |||
| ValueTree getMarker (int index) const { return group.getChild (index); } | |||
| ValueTree getMarkerNamed (const String& name) const { return group.getChildWithProperty (getMarkerNameProperty(), name); } | |||
| bool contains (const ValueTree& markerState) const { return markerState.isAChildOf (group); } | |||
| bool isSpecialMarker (const ValueTree& markerState) const { return false; } | |||
| void createMarker (const String& name, double position); | |||
| void deleteMarker (ValueTree& markerState); | |||
| ComponentDocument& getDocument() throw() { return document; } | |||
| ValueTree& getGroup() { return group; } | |||
| private: | |||
| ComponentDocument& document; | |||
| ValueTree group; | |||
| MarkerList (const MarkerList&); | |||
| MarkerList& operator= (const MarkerList&); | |||
| }; | |||
| MarkerList& getMarkerListX() const { return *markersX; } | |||
| MarkerList& getMarkerListY() const { return *markersY; } | |||
| MarkerList& getMarkerList (bool isX) const { return isX ? *markersX : *markersY; } | |||
| //============================================================================== | |||
| void createItemProperties (Array <PropertyComponent*>& props, const StringArray& selectedItemIds); | |||
| //============================================================================== | |||
| void beginDrag (const Array<Component*>& items, const MouseEvent& e, | |||
| Component* parentForOverlays, const ResizableBorderComponent::Zone& zone); | |||
| void continueDrag (const MouseEvent& e); | |||
| void endDrag (const MouseEvent& e); | |||
| //============================================================================== | |||
| CodeGenerator::CustomCodeList& getCustomCodeList() throw() { return customCode; } | |||
| const String getCppTemplate() const; | |||
| const String getHeaderTemplate() const; | |||
| const String getCppContent(); | |||
| const String getHeaderContent(); | |||
| //============================================================================== | |||
| ValueTree& getRoot() { return root; } | |||
| ValueTree getComponentGroup() const; | |||
| UndoManager* getUndoManager() const; | |||
| void beginNewTransaction(); | |||
| void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged, const Identifier& property); | |||
| void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged); | |||
| void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged); | |||
| static const Identifier idProperty; | |||
| static const Identifier compBoundsProperty; | |||
| static const Identifier memberNameProperty; | |||
| static const Identifier compNameProperty; | |||
| static const Identifier compTooltipProperty; | |||
| static const Identifier compFocusOrderProperty; | |||
| static const Identifier jucerIDProperty; | |||
| static const String getJucerIDFor (Component* c); | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| //============================================================================== | |||
| Project* project; | |||
| File cppFile; | |||
| ValueTree root; | |||
| ScopedPointer<MarkerList> markersX, markersY; | |||
| CodeGenerator::CustomCodeList customCode; | |||
| mutable UndoManager undoManager; | |||
| bool changedSinceSaved, usingTemporaryCanvasSize; | |||
| Value tempCanvasWidth, tempCanvasHeight; | |||
| void checkRootObject(); | |||
| void createSubTreeIfNotThere (const Identifier& name); | |||
| void addMarkerMenuItem (int i, const RelativeCoordinate& coord, const String& objectName, const String& edge, | |||
| PopupMenu& menu, bool isAnchor1, const String& fullCoordName); | |||
| Value getRootValueUndoable (const Identifier& name) const { return root.getPropertyAsValue (name, getUndoManager()); } | |||
| Value getRootValueNonUndoable (const Identifier& name) const { return root.getPropertyAsValue (name, 0); } | |||
| void writeCode (OutputStream& cpp, OutputStream& header); | |||
| void writeMetadata (OutputStream& out); | |||
| bool createItemProperties (Array <PropertyComponent*>& props, const String& itemId); | |||
| }; | |||
| #endif // __JUCER_COMPONENTDOCUMENT_JUCEHEADER__ | |||
| @@ -1,617 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #include "jucer_DrawableDocument.h" | |||
| #include "jucer_DrawableTypeHandler.h" | |||
| //============================================================================== | |||
| namespace Tags | |||
| { | |||
| const Identifier drawableTag ("DRAWABLE"); | |||
| const Identifier markersGroupXTag ("MARKERS_X"); | |||
| const Identifier markersGroupYTag ("MARKERS_Y"); | |||
| } | |||
| //============================================================================== | |||
| DrawableDocument::DrawableDocument (Project* project_) | |||
| : project (project_), | |||
| root (Tags::drawableTag), | |||
| saveAsXml (true), | |||
| needsSaving (false) | |||
| { | |||
| DrawableComposite dc; | |||
| root.addChild (dc.createValueTree (0), -1, 0); | |||
| setName ("Drawable"); | |||
| checkRootObject(); | |||
| root.addListener (this); | |||
| } | |||
| DrawableDocument::~DrawableDocument() | |||
| { | |||
| root.removeListener (this); | |||
| } | |||
| void DrawableDocument::recursivelyUpdateIDs (Drawable::ValueTreeWrapperBase& d, StringArray& recentlyUsedIdCache) | |||
| { | |||
| if (d.getID().isEmpty()) | |||
| d.setID (createUniqueID (d.getState().getType().toString().toLowerCase() + "1", recentlyUsedIdCache), 0); | |||
| if (d.getState().getType() == DrawableComposite::valueTreeType) | |||
| { | |||
| const DrawableComposite::ValueTreeWrapper composite (d.getState()); | |||
| for (int i = 0; i < composite.getNumDrawables(); ++i) | |||
| { | |||
| Drawable::ValueTreeWrapperBase child (composite.getDrawableState (i)); | |||
| recursivelyUpdateIDs (child, recentlyUsedIdCache); | |||
| } | |||
| } | |||
| } | |||
| void DrawableDocument::checkRootObject() | |||
| { | |||
| if (! root.hasProperty (Ids::id_)) | |||
| root.setProperty (Ids::id_, createAlphaNumericUID(), 0); | |||
| if (markersX == 0) | |||
| markersX = new MarkerList (*this, true); | |||
| if (markersY == 0) | |||
| markersY = new MarkerList (*this, false); | |||
| DrawableComposite::ValueTreeWrapper rootObject (getRootDrawableNode()); | |||
| StringArray idCache; | |||
| recursivelyUpdateIDs (rootObject, idCache); | |||
| if (rootObject.getNumMarkers (true) < 2 || rootObject.getNumMarkers (false) < 2) | |||
| rootObject.setContentArea (RelativeRectangle ("0, 0, 100, 100"), 0); | |||
| } | |||
| const String DrawableDocument::getUniqueId() const | |||
| { | |||
| return root [Ids::id_]; | |||
| } | |||
| //============================================================================== | |||
| void DrawableDocument::setName (const String& name) | |||
| { | |||
| root.setProperty (Ids::name, name, getUndoManager()); | |||
| } | |||
| const String DrawableDocument::getName() const | |||
| { | |||
| return root [Ids::name]; | |||
| } | |||
| bool DrawableDocument::hasChangedSinceLastSave() const | |||
| { | |||
| return needsSaving; | |||
| } | |||
| bool DrawableDocument::reload (const File& drawableFile) | |||
| { | |||
| ScopedPointer <InputStream> stream (drawableFile.createInputStream()); | |||
| if (stream != 0 && load (*stream)) | |||
| { | |||
| checkRootObject(); | |||
| undoManager.clearUndoHistory(); | |||
| needsSaving = false; | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| bool DrawableDocument::save (const File& drawableFile) | |||
| { | |||
| TemporaryFile tempFile (drawableFile); | |||
| ScopedPointer <OutputStream> out (tempFile.getFile().createOutputStream()); | |||
| if (out == 0) | |||
| return false; | |||
| save (*out); | |||
| needsSaving = ! tempFile.overwriteTargetFileWithTemporary(); | |||
| return ! needsSaving; | |||
| } | |||
| void DrawableDocument::save (OutputStream& output) | |||
| { | |||
| if (saveAsXml) | |||
| { | |||
| ScopedPointer <XmlElement> xml (root.createXml()); | |||
| jassert (xml != 0); | |||
| if (xml != 0) | |||
| xml->writeToStream (output, String::empty, false, false); | |||
| } | |||
| else | |||
| { | |||
| root.writeToStream (output); | |||
| } | |||
| } | |||
| bool DrawableDocument::load (InputStream& input) | |||
| { | |||
| int64 originalPos = input.getPosition(); | |||
| ValueTree loadedTree; | |||
| XmlDocument xmlDoc (input.readEntireStreamAsString()); | |||
| ScopedPointer <XmlElement> xml (xmlDoc.getDocumentElement()); | |||
| if (xml != 0) | |||
| { | |||
| loadedTree = ValueTree::fromXml (*xml); | |||
| } | |||
| else | |||
| { | |||
| input.setPosition (originalPos); | |||
| loadedTree = ValueTree::readFromStream (input); | |||
| } | |||
| if (loadedTree.hasType (Tags::drawableTag)) | |||
| { | |||
| root.removeListener (this); | |||
| root = loadedTree; | |||
| root.addListener (this); | |||
| markersX = 0; | |||
| markersY = 0; | |||
| valueTreeParentChanged (loadedTree); | |||
| needsSaving = false; | |||
| undoManager.clearUndoHistory(); | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| void DrawableDocument::changed() | |||
| { | |||
| needsSaving = true; | |||
| } | |||
| DrawableComposite::ValueTreeWrapper DrawableDocument::getRootDrawableNode() const | |||
| { | |||
| return DrawableComposite::ValueTreeWrapper (root.getChild (0)); | |||
| } | |||
| ValueTree DrawableDocument::findDrawableState (const String& objectId, bool recursive) const | |||
| { | |||
| return getRootDrawableNode().getDrawableWithId (objectId, recursive); | |||
| } | |||
| const String DrawableDocument::createUniqueID (const String& name, StringArray& recentlyUsedIdCache) const | |||
| { | |||
| String n (CodeHelpers::makeValidIdentifier (name, false, true, false)); | |||
| int suffix = 2; | |||
| int cacheIndex = -1; | |||
| const String withoutNumbers (n.trimCharactersAtEnd ("0123456789")); | |||
| for (int i = 0; i < recentlyUsedIdCache.size(); ++i) | |||
| { | |||
| if (recentlyUsedIdCache[i].startsWith (withoutNumbers)) | |||
| { | |||
| cacheIndex = i; | |||
| suffix = jmax (suffix, recentlyUsedIdCache[i].substring (withoutNumbers.length()).getIntValue() + 1); | |||
| n = withoutNumbers + String (suffix++); | |||
| break; | |||
| } | |||
| } | |||
| while (markersX->getMarkerNamed (n).isValid() || markersY->getMarkerNamed (n).isValid() | |||
| || findDrawableState (n, true).isValid()) | |||
| n = withoutNumbers + String (suffix++); | |||
| if (cacheIndex >= 0) | |||
| recentlyUsedIdCache.set (cacheIndex, n); | |||
| else | |||
| recentlyUsedIdCache.add (n); | |||
| return n; | |||
| } | |||
| bool DrawableDocument::createItemProperties (Array <PropertyComponent*>& props, const String& itemId) | |||
| { | |||
| ValueTree drawable (findDrawableState (itemId.upToFirstOccurrenceOf ("/", false, false), false)); | |||
| if (drawable.isValid()) | |||
| { | |||
| DrawableTypeInstance item (*this, drawable); | |||
| if (itemId.containsChar ('/')) | |||
| { | |||
| OwnedArray <ControlPoint> points; | |||
| item.getAllControlPoints (points); | |||
| for (int i = 0; i < points.size(); ++i) | |||
| if (points.getUnchecked(i)->getID() == itemId) | |||
| points.getUnchecked(i)->createProperties (*this, props); | |||
| } | |||
| else | |||
| { | |||
| item.createProperties (props); | |||
| } | |||
| return true; | |||
| } | |||
| if (markersX->createProperties (props, itemId) | |||
| || markersY->createProperties (props, itemId)) | |||
| return true; | |||
| return false; | |||
| } | |||
| void DrawableDocument::createItemProperties (Array <PropertyComponent*>& props, const StringArray& selectedItemIds) | |||
| { | |||
| if (selectedItemIds.size() != 1) | |||
| return; //xxx | |||
| for (int i = 0; i < selectedItemIds.size(); ++i) | |||
| createItemProperties (props, selectedItemIds[i]); | |||
| } | |||
| //============================================================================== | |||
| const int menuItemOffset = 0x63451fa4; | |||
| void DrawableDocument::addNewItemMenuItems (PopupMenu& menu) const | |||
| { | |||
| const StringArray newItems (DrawableTypeManager::getInstance()->getNewItemList()); | |||
| for (int i = 0; i < newItems.size(); ++i) | |||
| menu.addItem (i + menuItemOffset, newItems[i]); | |||
| } | |||
| const ValueTree DrawableDocument::performNewItemMenuItem (int menuResultCode) | |||
| { | |||
| const StringArray newItems (DrawableTypeManager::getInstance()->getNewItemList()); | |||
| int index = menuResultCode - menuItemOffset; | |||
| if (index >= 0 && index < newItems.size()) | |||
| { | |||
| ValueTree state (DrawableTypeManager::getInstance() | |||
| ->createNewItem (index, *this, | |||
| Point<float> (Random::getSystemRandom().nextFloat() * 100.0f + 100.0f, | |||
| Random::getSystemRandom().nextFloat() * 100.0f + 100.0f))); | |||
| Drawable::ValueTreeWrapperBase wrapper (state); | |||
| StringArray idCache; | |||
| recursivelyUpdateIDs (wrapper, idCache); | |||
| getRootDrawableNode().addDrawable (state, -1, getUndoManager()); | |||
| return state; | |||
| } | |||
| return ValueTree::invalid; | |||
| } | |||
| const ValueTree DrawableDocument::insertSVG (const File& file, const Point<float>& position) | |||
| { | |||
| ScopedPointer<Drawable> d (Drawable::createFromImageFile (file)); | |||
| DrawableComposite* dc = dynamic_cast <DrawableComposite*> (static_cast <Drawable*> (d)); | |||
| if (dc != 0) | |||
| { | |||
| ValueTree state (dc->createValueTree (this)); | |||
| if (state.isValid()) | |||
| { | |||
| Drawable::ValueTreeWrapperBase wrapper (state); | |||
| getRootDrawableNode().addDrawable (state, -1, getUndoManager()); | |||
| StringArray idCache; | |||
| recursivelyUpdateIDs (wrapper, idCache); | |||
| return state; | |||
| } | |||
| } | |||
| return ValueTree::invalid; | |||
| } | |||
| //============================================================================== | |||
| const Image DrawableDocument::getImageForIdentifier (const var& imageIdentifier) | |||
| { | |||
| const String s (imageIdentifier.toString()); | |||
| if (s.startsWithIgnoreCase ("id:")) | |||
| { | |||
| jassert (project != 0); | |||
| if (project != 0) | |||
| { | |||
| Project::Item item (project->getMainGroup().findItemWithID (s.substring (3).trim())); | |||
| if (item.isValid()) | |||
| { | |||
| Image im (ImageCache::getFromFile (item.getFile())); | |||
| if (im.isValid()) | |||
| { | |||
| im.setTag (imageIdentifier); | |||
| return im; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| static Image dummy; | |||
| if (dummy.isNull()) | |||
| { | |||
| dummy = Image (Image::ARGB, 128, 128, true); | |||
| Graphics g (dummy); | |||
| g.fillAll (Colours::khaki.withAlpha (0.51f)); | |||
| g.setColour (Colours::grey); | |||
| g.drawRect (0, 0, 128, 128); | |||
| for (int i = -128; i < 128; i += 16) | |||
| g.drawLine ((float) i, 0.0f, i + 128.0f, 128.0f); | |||
| g.setColour (Colours::darkgrey); | |||
| g.drawRect (0, 0, 128, 128); | |||
| g.setFont (16.0f, Font::bold); | |||
| g.drawText ("(Image Missing)", 0, 0, 128, 128, Justification::centred, false); | |||
| } | |||
| return dummy; | |||
| } | |||
| const var DrawableDocument::getIdentifierForImage (const Image& image) | |||
| { | |||
| return image.getTag(); | |||
| } | |||
| //============================================================================== | |||
| void DrawableDocument::valueTreePropertyChanged (ValueTree& tree, const Identifier& name) | |||
| { | |||
| changed(); | |||
| } | |||
| void DrawableDocument::valueTreeChildrenChanged (ValueTree& tree) | |||
| { | |||
| changed(); | |||
| } | |||
| void DrawableDocument::valueTreeParentChanged (ValueTree& tree) | |||
| { | |||
| changed(); | |||
| } | |||
| //============================================================================== | |||
| const RelativeCoordinate DrawableDocument::findNamedCoordinate (const String& objectName, const String& edge) const | |||
| { | |||
| if (objectName == "parent") | |||
| { | |||
| jassert (edge != "right" && edge != "bottom"); // drawables don't have a canvas size.. | |||
| } | |||
| if (objectName.isNotEmpty() && edge.isNotEmpty()) | |||
| { | |||
| } | |||
| { | |||
| const ValueTree marker (getMarkerListX().getMarkerNamed (objectName)); | |||
| if (marker.isValid()) | |||
| return getMarkerListX().getCoordinate (marker); | |||
| } | |||
| { | |||
| const ValueTree marker (getMarkerListY().getMarkerNamed (objectName)); | |||
| if (marker.isValid()) | |||
| return getMarkerListY().getCoordinate (marker); | |||
| } | |||
| return RelativeCoordinate(); | |||
| } | |||
| //============================================================================== | |||
| DrawableDocument::MarkerList::MarkerList (DrawableDocument& document_, bool isX_) | |||
| : MarkerListBase (isX_), | |||
| document (document_), | |||
| object (document_.getRootDrawableNode()) | |||
| { | |||
| } | |||
| const String DrawableDocument::MarkerList::getId (const ValueTree& markerState) | |||
| { | |||
| return markerState [DrawableComposite::ValueTreeWrapper::nameProperty]; | |||
| } | |||
| int DrawableDocument::MarkerList::size() const | |||
| { | |||
| return object.getNumMarkers (isX); | |||
| } | |||
| ValueTree DrawableDocument::MarkerList::getMarker (int index) const | |||
| { | |||
| return object.getMarkerState (isX, index); | |||
| } | |||
| ValueTree DrawableDocument::MarkerList::getMarkerNamed (const String& name) const | |||
| { | |||
| return object.getMarkerState (isX, name); | |||
| } | |||
| bool DrawableDocument::MarkerList::contains (const ValueTree& markerState) const | |||
| { | |||
| return object.containsMarker (isX, markerState); | |||
| } | |||
| void DrawableDocument::MarkerList::createMarker (const String& name, double position) | |||
| { | |||
| object.setMarker (isX, DrawableComposite::Marker (name, RelativeCoordinate (position, isX)), | |||
| getUndoManager()); | |||
| } | |||
| void DrawableDocument::MarkerList::deleteMarker (ValueTree& markerState) | |||
| { | |||
| object.removeMarker (isX, markerState, getUndoManager()); | |||
| } | |||
| bool DrawableDocument::MarkerList::isSpecialMarker (const ValueTree& markerState) const | |||
| { | |||
| const String name (markerState [DrawableComposite::ValueTreeWrapper::nameProperty].toString()); | |||
| return name == DrawableComposite::contentLeftMarkerName | |||
| || name == DrawableComposite::contentRightMarkerName | |||
| || name == DrawableComposite::contentTopMarkerName | |||
| || name == DrawableComposite::contentBottomMarkerName; | |||
| } | |||
| const RelativeCoordinate DrawableDocument::MarkerList::findNamedCoordinate (const String& objectName, const String& edge) const | |||
| { | |||
| if (objectName == "parent") | |||
| { | |||
| jassert (edge != "right" && edge != "bottom"); // drawables don't have a canvas size.. | |||
| } | |||
| const ValueTree marker (getMarkerNamed (objectName)); | |||
| if (marker.isValid()) | |||
| return getCoordinate (marker); | |||
| return RelativeCoordinate(); | |||
| } | |||
| bool DrawableDocument::MarkerList::createProperties (Array <PropertyComponent*>& props, const String& itemId) | |||
| { | |||
| ValueTree marker (getMarkerNamed (itemId)); | |||
| if (marker.isValid()) | |||
| { | |||
| const String markerName (marker [DrawableComposite::ValueTreeWrapper::nameProperty].toString()); | |||
| TextPropertyComponent* nameProp = new TextPropertyComponent (Value (new MarkerListBase::MarkerNameValueSource (this, marker.getPropertyAsValue (DrawableComposite::ValueTreeWrapper::nameProperty, getUndoManager()))), | |||
| "Marker Name", 256, false); | |||
| nameProp->setEnabled (markerName != DrawableComposite::contentLeftMarkerName | |||
| && markerName != DrawableComposite::contentRightMarkerName | |||
| && markerName != DrawableComposite::contentTopMarkerName | |||
| && markerName != DrawableComposite::contentBottomMarkerName); | |||
| props.add (nameProp); | |||
| props.add (new MarkerListBase::PositionPropertyComponent (*this, "Position", marker, | |||
| marker.getPropertyAsValue (DrawableComposite::ValueTreeWrapper::posProperty, getUndoManager()))); | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| void DrawableDocument::MarkerList::addMarkerMenuItem (int i, const RelativeCoordinate& coord, const String& name, const String& edge, PopupMenu& menu, | |||
| bool isAnchor1, const String& fullCoordName) | |||
| { | |||
| RelativeCoordinate requestedCoord (findNamedCoordinate (name, edge)); | |||
| menu.addItem (i, edge.isEmpty() ? name : (name + "." + edge), | |||
| ! (name == fullCoordName || (fullCoordName.isNotEmpty() && requestedCoord.references (fullCoordName, this))), | |||
| name == (isAnchor1 ? coord.getAnchorName1() : coord.getAnchorName2())); | |||
| } | |||
| void DrawableDocument::MarkerList::addMarkerMenuItems (const ValueTree& markerState, const RelativeCoordinate& coord, PopupMenu& menu, bool isAnchor1) | |||
| { | |||
| const String fullCoordName (getName (markerState)); | |||
| if (isHorizontal()) | |||
| addMarkerMenuItem (1, coord, "parent", "left", menu, isAnchor1, fullCoordName); | |||
| else | |||
| addMarkerMenuItem (1, coord, "parent", "top", menu, isAnchor1, fullCoordName); | |||
| menu.addSeparator(); | |||
| for (int i = 0; i < size(); ++i) | |||
| addMarkerMenuItem (100 + i, coord, getName (getMarker (i)), | |||
| String::empty, menu, isAnchor1, fullCoordName); | |||
| } | |||
| const String DrawableDocument::MarkerList::getChosenMarkerMenuItem (const RelativeCoordinate& coord, int i) const | |||
| { | |||
| if (i == 1) return isHorizontal() ? "parent.left" : "parent.top"; | |||
| if (i >= 100 && i < 10000) | |||
| return getName (getMarker (i - 100)); | |||
| jassertfalse; | |||
| return String::empty; | |||
| } | |||
| UndoManager* DrawableDocument::MarkerList::getUndoManager() const | |||
| { | |||
| return document.getUndoManager(); | |||
| } | |||
| const String DrawableDocument::MarkerList::getNonexistentMarkerName (const String& name) | |||
| { | |||
| return document.getNonexistentMarkerName (name); | |||
| } | |||
| const String DrawableDocument::getNonexistentMarkerName (const String& name) | |||
| { | |||
| String n (CodeHelpers::makeValidIdentifier (name, false, true, false)); | |||
| int suffix = 2; | |||
| while (markersX->getMarkerNamed (n).isValid() || markersY->getMarkerNamed (n).isValid()) | |||
| n = n.trimCharactersAtEnd ("0123456789") + String (suffix++); | |||
| return n; | |||
| } | |||
| void DrawableDocument::MarkerList::renameAnchor (const String& oldName, const String& newName) | |||
| { | |||
| document.renameAnchor (oldName, newName); | |||
| } | |||
| void DrawableDocument::renameAnchor (const String& oldName, const String& newName) | |||
| { | |||
| markersX->renameAnchorInMarkers (oldName, newName); | |||
| markersY->renameAnchorInMarkers (oldName, newName); | |||
| DrawableComposite::ValueTreeWrapper root (getRootDrawableNode()); | |||
| DrawableTypeInstance rootItem (*this, root.getState()); | |||
| for (int i = root.getNumDrawables(); --i >= 0;) | |||
| { | |||
| DrawableTypeInstance item (*this, root.getDrawableState(i)); | |||
| OwnedArray <ControlPoint> points; | |||
| item.getAllControlPoints (points); | |||
| for (int j = points.size(); --j >= 0;) | |||
| { | |||
| const RelativePoint oldPoint (points.getUnchecked(j)->getPosition()); | |||
| RelativePoint newPoint (oldPoint); | |||
| newPoint.renameAnchorIfUsed (oldName, newName, &rootItem); | |||
| if (newPoint != oldPoint) | |||
| points.getUnchecked(j)->setPosition (newPoint, getUndoManager()); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,141 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_DRAWABLEDOCUMENT_JUCEHEADER__ | |||
| #define __JUCER_DRAWABLEDOCUMENT_JUCEHEADER__ | |||
| #include "../../jucer_Headers.h" | |||
| #include "../Project/jucer_Project.h" | |||
| #include "../../utility/jucer_MarkerListBase.h" | |||
| //============================================================================== | |||
| class DrawableDocument : public ValueTree::Listener, | |||
| public Drawable::ImageProvider | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| DrawableDocument (Project* project); | |||
| ~DrawableDocument(); | |||
| //============================================================================== | |||
| void setName (const String& name); | |||
| const String getName() const; | |||
| bool reload (const File& drawableFile); | |||
| bool save (const File& drawableFile); | |||
| bool hasChangedSinceLastSave() const; | |||
| void changed(); | |||
| Project* getProject() const throw() { return project; } | |||
| const String getUniqueId() const; | |||
| ValueTree& getRoot() { return root; } | |||
| DrawableComposite::ValueTreeWrapper getRootDrawableNode() const; | |||
| ValueTree findDrawableState (const String& objectId, bool recursive) const; | |||
| const String createUniqueID (const String& suggestion, StringArray& recentlyUsedIdCache) const; | |||
| void createItemProperties (Array <PropertyComponent*>& props, const StringArray& selectedItemIds); | |||
| void addNewItemMenuItems (PopupMenu& menu) const; | |||
| const ValueTree performNewItemMenuItem (int menuResultCode); | |||
| const ValueTree insertSVG (const File& file, const Point<float>& position); | |||
| //============================================================================== | |||
| class MarkerList : public MarkerListBase | |||
| { | |||
| public: | |||
| MarkerList (DrawableDocument& document, bool isX); | |||
| ~MarkerList() {} | |||
| const RelativeCoordinate findNamedCoordinate (const String& objectName, const String& edge) const; | |||
| bool createProperties (Array <PropertyComponent*>& props, const String& itemId); | |||
| void addMarkerMenuItems (const ValueTree& markerState, const RelativeCoordinate& coord, PopupMenu& menu, bool isAnchor1); | |||
| const String getChosenMarkerMenuItem (const RelativeCoordinate& coord, int itemId) const; | |||
| UndoManager* getUndoManager() const; | |||
| const String getNonexistentMarkerName (const String& name); | |||
| void renameAnchor (const String& oldName, const String& newName); | |||
| const String getId (const ValueTree& markerState); | |||
| int size() const; | |||
| ValueTree getMarker (int index) const; | |||
| ValueTree getMarkerNamed (const String& name) const; | |||
| bool contains (const ValueTree& markerState) const; | |||
| void createMarker (const String& name, double position); | |||
| void deleteMarker (ValueTree& markerState); | |||
| bool isSpecialMarker (const ValueTree& markerState) const; | |||
| private: | |||
| DrawableDocument& document; | |||
| DrawableComposite::ValueTreeWrapper object; | |||
| void addMarkerMenuItem (int i, const RelativeCoordinate& coord, const String& objectName, const String& edge, | |||
| PopupMenu& menu, bool isAnchor1, const String& fullCoordName); | |||
| MarkerList (const MarkerList&); | |||
| MarkerList& operator= (const MarkerList&); | |||
| }; | |||
| MarkerList& getMarkerListX() const { return *markersX; } | |||
| MarkerList& getMarkerListY() const { return *markersY; } | |||
| MarkerList& getMarkerList (bool isX) const { return isX ? *markersX : *markersY; } | |||
| const String getNonexistentMarkerName (const String& name); | |||
| void renameAnchor (const String& oldName, const String& newName); | |||
| const Image getImageForIdentifier (const var& imageIdentifier); | |||
| const var getIdentifierForImage (const Image& image); | |||
| //============================================================================== | |||
| void valueTreePropertyChanged (ValueTree& tree, const Identifier& name); | |||
| void valueTreeChildrenChanged (ValueTree& tree); | |||
| void valueTreeParentChanged (ValueTree& tree); | |||
| //============================================================================== | |||
| UndoManager* getUndoManager() const throw() { return &undoManager; } | |||
| private: | |||
| Project* project; | |||
| ValueTree root; | |||
| ScopedPointer<MarkerList> markersX, markersY; | |||
| mutable UndoManager undoManager; | |||
| bool saveAsXml, needsSaving; | |||
| void checkRootObject(); | |||
| void recursivelyUpdateIDs (Drawable::ValueTreeWrapperBase& d, StringArray& recentlyUsedIdCache); | |||
| Value getRootValueUndoable (const Identifier& name) const { return root.getPropertyAsValue (name, getUndoManager()); } | |||
| Value getRootValueNonUndoable (const Identifier& name) const { return root.getPropertyAsValue (name, 0); } | |||
| void save (OutputStream& output); | |||
| bool load (InputStream& input); | |||
| bool createItemProperties (Array <PropertyComponent*>& props, const String& itemId); | |||
| const RelativeCoordinate findNamedCoordinate (const String& objectName, const String& edge) const; | |||
| }; | |||
| #endif // __JUCER_DRAWABLEDOCUMENT_JUCEHEADER__ | |||
| @@ -1,189 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_DRAWABLETYPEHANDLER_H_7FB02E2F__ | |||
| #define __JUCER_DRAWABLETYPEHANDLER_H_7FB02E2F__ | |||
| #include "jucer_DrawableDocument.h" | |||
| #include "../../utility/jucer_FillTypePropertyComponent.h" | |||
| #include "../../ui/Editor Base/jucer_EditorCanvas.h" | |||
| class DrawableTypeHandler; | |||
| //============================================================================== | |||
| class ControlPoint | |||
| { | |||
| public: | |||
| ControlPoint (const String& pointID_) : pointID (pointID_) {} | |||
| virtual ~ControlPoint() {} | |||
| const String& getID() const throw() { return pointID; } | |||
| virtual const RelativePoint getPosition() = 0; | |||
| virtual void setPosition (const RelativePoint& newPoint, UndoManager* undoManager) = 0; | |||
| virtual bool hasLine() = 0; | |||
| virtual RelativePoint getEndOfLine() = 0; | |||
| virtual const Value getPositionValue (UndoManager* undoManager) = 0; | |||
| virtual void createProperties (DrawableDocument& document, Array <PropertyComponent*>& props) = 0; | |||
| private: | |||
| const String pointID; | |||
| ControlPoint (const ControlPoint&); | |||
| ControlPoint& operator= (const ControlPoint&); | |||
| }; | |||
| //============================================================================== | |||
| class DrawableTypeInstance : public RelativeCoordinate::NamedCoordinateFinder | |||
| { | |||
| public: | |||
| DrawableTypeInstance (DrawableDocument& document_, const ValueTree& state_); | |||
| //============================================================================== | |||
| DrawableDocument& getDocument() throw() { return document; } | |||
| UndoManager* getUndoManager() throw() { return document.getUndoManager(); } | |||
| Project* getProject() { return document.getProject(); } | |||
| ValueTree& getState() throw() { return state; } | |||
| const String getID() const { return Drawable::ValueTreeWrapperBase (state).getID(); } | |||
| Value getValue (const Identifier& name) const; | |||
| void createProperties (Array <PropertyComponent*>& props); | |||
| const Rectangle<float> getBounds(); | |||
| void setBounds (Drawable* drawable, const Rectangle<float>& newBounds); | |||
| void applyTransform (Drawable* drawable, const AffineTransform& transform); | |||
| void getAllControlPoints (OwnedArray <ControlPoint>& points); | |||
| void getVisibleControlPoints (OwnedArray <ControlPoint>& points, const EditorCanvasBase::SelectedItems& selection); | |||
| const RelativeCoordinate findNamedCoordinate (const String& objectName, const String& edge) const; | |||
| //============================================================================== | |||
| DrawableTypeHandler* getHandler() const; | |||
| private: | |||
| //============================================================================== | |||
| DrawableDocument& document; | |||
| ValueTree state; | |||
| DrawableTypeInstance& operator= (const DrawableTypeInstance&); | |||
| }; | |||
| //============================================================================== | |||
| class DrawableTypeHandler | |||
| { | |||
| public: | |||
| DrawableTypeHandler (const String& displayName_, const Identifier& valueTreeType_) | |||
| : displayName (displayName_), valueTreeType (valueTreeType_) | |||
| { | |||
| } | |||
| virtual ~DrawableTypeHandler() {} | |||
| virtual void createPropertyEditors (DrawableTypeInstance& item, Array <PropertyComponent*>& props) = 0; | |||
| virtual void itemDoubleClicked (const MouseEvent& e, DrawableTypeInstance& item) = 0; | |||
| virtual void getAllControlPoints (DrawableTypeInstance& item, OwnedArray <ControlPoint>& points) = 0; | |||
| virtual void getVisibleControlPoints (DrawableTypeInstance& item, OwnedArray <ControlPoint>& points, const EditorCanvasBase::SelectedItems& selection) = 0; | |||
| const String& getDisplayName() const { return displayName; } | |||
| const Identifier& getValueTreeType() const { return valueTreeType; } | |||
| void setBounds (DrawableTypeInstance& item, Drawable* drawable, Rectangle<float> newBounds) | |||
| { | |||
| const Rectangle<float> oldBounds (drawable->getBounds()); | |||
| if (oldBounds.isEmpty()) | |||
| return; | |||
| newBounds.setSize (jmax (1.0f, newBounds.getWidth()), | |||
| jmax (1.0f, newBounds.getHeight())); | |||
| const double tolerance = 0.001; | |||
| double xScale = newBounds.getWidth() / (double) oldBounds.getWidth(); | |||
| double yScale = newBounds.getHeight() / (double) oldBounds.getHeight(); | |||
| if (std::abs (xScale - 1.0) < tolerance) xScale = 1.0; | |||
| if (std::abs (yScale - 1.0) < tolerance) yScale = 1.0; | |||
| if (xScale == 1.0 && yScale == 1.0 | |||
| && std::abs (newBounds.getX() - oldBounds.getX()) < tolerance | |||
| && std::abs (newBounds.getY() - oldBounds.getY()) < tolerance) | |||
| return; | |||
| const double xOffset = newBounds.getX() - xScale * oldBounds.getX(); | |||
| const double yOffset = newBounds.getY() - yScale * oldBounds.getY(); | |||
| OwnedArray<ControlPoint> points; | |||
| getAllControlPoints (item, points); | |||
| RelativeCoordinate::NamedCoordinateFinder* const nameFinder = drawable->getParent(); | |||
| UndoManager* undoManager = item.getDocument().getUndoManager(); | |||
| for (int i = 0; i < points.size(); ++i) | |||
| { | |||
| ControlPoint* cp = points.getUnchecked(i); | |||
| RelativePoint point (cp->getPosition()); | |||
| const Point<float> p (point.resolve (nameFinder)); | |||
| point.moveToAbsolute (Point<float> ((float) (xOffset + xScale * p.getX()), | |||
| (float) (yOffset + yScale * p.getY())), nameFinder); | |||
| cp->setPosition (point, undoManager); | |||
| } | |||
| } | |||
| private: | |||
| const String displayName; | |||
| const Identifier valueTreeType; | |||
| DrawableTypeHandler& operator= (const DrawableTypeHandler&); | |||
| }; | |||
| //============================================================================== | |||
| class DrawableTypeManager : public DeletedAtShutdown | |||
| { | |||
| public: | |||
| DrawableTypeManager(); | |||
| ~DrawableTypeManager(); | |||
| juce_DeclareSingleton_SingleThreaded_Minimal (DrawableTypeManager); | |||
| //============================================================================== | |||
| int getNumHandlers() const { return handlers.size(); } | |||
| DrawableTypeHandler* getHandler (const int index) const { return handlers [index]; } | |||
| DrawableTypeHandler* getHandlerFor (const Identifier& type); | |||
| const StringArray getNewItemList(); | |||
| const ValueTree createNewItem (const int index, DrawableDocument& document, const Point<float>& approxPosition); | |||
| private: | |||
| OwnedArray <DrawableTypeHandler> handlers; | |||
| }; | |||
| #endif // __JUCER_DRAWABLETYPEHANDLER_H_7FB02E2F__ | |||
| @@ -24,8 +24,6 @@ | |||
| */ | |||
| #include "jucer_NewFileWizard.h" | |||
| #include "../Drawable/jucer_DrawableDocument.h" | |||
| #include "../Component/jucer_ComponentDocument.h" | |||
| //============================================================================== | |||
| @@ -41,7 +39,7 @@ static bool fillInNewCppFileTemplate (const File& file, const Project::Item& ite | |||
| } | |||
| //============================================================================== | |||
| class NewCppFileWizard : public NewFileWizard | |||
| class NewCppFileWizard : public NewFileWizard::Type | |||
| { | |||
| public: | |||
| NewCppFileWizard() {} | |||
| @@ -64,7 +62,7 @@ public: | |||
| }; | |||
| //============================================================================== | |||
| class NewHeaderFileWizard : public NewFileWizard | |||
| class NewHeaderFileWizard : public NewFileWizard::Type | |||
| { | |||
| public: | |||
| NewHeaderFileWizard() {} | |||
| @@ -86,123 +84,58 @@ public: | |||
| } | |||
| }; | |||
| //============================================================================== | |||
| class NewComponentWizard : public NewFileWizard | |||
| { | |||
| public: | |||
| NewComponentWizard() {} | |||
| ~NewComponentWizard() {} | |||
| const String getName() { return "Component"; } | |||
| void createNewFile (Project::Item parent) | |||
| { | |||
| File cppFile = askUserToChooseNewFile ("Component.cpp", "*.cpp", parent); | |||
| if (cppFile != File::nonexistent) | |||
| { | |||
| File header (cppFile.withFileExtension (".h")); | |||
| if (header.exists()) | |||
| { | |||
| if (! AlertWindow::showOkCancelBox (AlertWindow::WarningIcon, "Create New Component", | |||
| "The file " + header.getFileName() + " already exists...\n\nDo you want to overwrite it?", | |||
| "Overwrite", "Cancel")) | |||
| return; | |||
| } | |||
| ComponentDocument doc (&parent.getProject(), cppFile); | |||
| if (doc.save()) | |||
| { | |||
| parent.addFile (header, 0); | |||
| parent.addFile (cppFile, 0); | |||
| } | |||
| else | |||
| { | |||
| showFailedToWriteMessage (cppFile); | |||
| } | |||
| } | |||
| } | |||
| }; | |||
| //============================================================================== | |||
| class NewDrawableWizard : public NewFileWizard | |||
| void NewFileWizard::Type::showFailedToWriteMessage (const File& file) | |||
| { | |||
| public: | |||
| NewDrawableWizard() {} | |||
| ~NewDrawableWizard() {} | |||
| const String getName() { return "Drawable"; } | |||
| void createNewFile (Project::Item parent) | |||
| { | |||
| File newFile = askUserToChooseNewFile ("New Drawable.drawable", "*.drawable", parent); | |||
| if (newFile != File::nonexistent) | |||
| { | |||
| DrawableDocument newDrawable (&(parent.getProject())); | |||
| if (newDrawable.save (newFile)) | |||
| parent.addFile (newFile, 0); | |||
| else | |||
| showFailedToWriteMessage (newFile); | |||
| } | |||
| } | |||
| }; | |||
| AlertWindow::showMessageBox (AlertWindow::WarningIcon, | |||
| "Failed to Create File!", | |||
| "Couldn't write to the file: " + file.getFullPathName()); | |||
| } | |||
| //============================================================================== | |||
| const StringArray NewFileWizard::getWizards() | |||
| const File NewFileWizard::Type::askUserToChooseNewFile (const String& suggestedFilename, const String& wildcard, | |||
| const Project::Item& projectGroupToAddTo) | |||
| { | |||
| StringArray s; | |||
| FileChooser fc ("Select File to Create", | |||
| projectGroupToAddTo.determineGroupFolder() | |||
| .getChildFile (suggestedFilename) | |||
| .getNonexistentSibling(), | |||
| wildcard); | |||
| for (int i = 0; i < getNumWizards(); ++i) | |||
| { | |||
| ScopedPointer <NewFileWizard> wiz (createWizard (i)); | |||
| s.add (wiz->getName()); | |||
| } | |||
| if (fc.browseForFileToSave (true)) | |||
| return fc.getResult(); | |||
| return s; | |||
| return File::nonexistent; | |||
| } | |||
| int NewFileWizard::getNumWizards() | |||
| //============================================================================== | |||
| NewFileWizard::NewFileWizard() | |||
| { | |||
| return 2; | |||
| registerWizard (new NewCppFileWizard()); | |||
| registerWizard (new NewHeaderFileWizard()); | |||
| } | |||
| NewFileWizard* NewFileWizard::createWizard (int index) | |||
| NewFileWizard::~NewFileWizard() | |||
| { | |||
| switch (index) | |||
| { | |||
| case 0: return new NewCppFileWizard(); | |||
| case 1: return new NewHeaderFileWizard(); | |||
| case 2: return new NewComponentWizard(); | |||
| case 3: return new NewDrawableWizard(); | |||
| default: jassertfalse; break; | |||
| } | |||
| return 0; | |||
| clearSingletonInstance(); | |||
| } | |||
| juce_ImplementSingleton_SingleThreaded (NewFileWizard) | |||
| static const int menuBaseID = 0x12d83f0; | |||
| void NewFileWizard::addWizardsToMenu (PopupMenu& m) | |||
| void NewFileWizard::addWizardsToMenu (PopupMenu& m) const | |||
| { | |||
| for (int i = 0; i < getNumWizards(); ++i) | |||
| { | |||
| ScopedPointer <NewFileWizard> wiz (createWizard (i)); | |||
| m.addItem (menuBaseID + i, "Add New " + wiz->getName() + "..."); | |||
| } | |||
| for (int i = 0; i < wizards.size(); ++i) | |||
| m.addItem (menuBaseID + i, "Add New " + wizards.getUnchecked(i)->getName() + "..."); | |||
| } | |||
| bool NewFileWizard::runWizardFromMenu (int chosenMenuItemID, const Project::Item& projectGroupToAddTo) | |||
| bool NewFileWizard::runWizardFromMenu (int chosenMenuItemID, const Project::Item& projectGroupToAddTo) const | |||
| { | |||
| int index = chosenMenuItemID - menuBaseID; | |||
| Type* wiz = wizards [chosenMenuItemID - menuBaseID]; | |||
| if (index >= 0 && index < getNumWizards()) | |||
| if (wiz != 0) | |||
| { | |||
| ScopedPointer <NewFileWizard> wiz (createWizard (index)); | |||
| wiz->createNewFile (projectGroupToAddTo); | |||
| return true; | |||
| } | |||
| @@ -210,24 +143,7 @@ bool NewFileWizard::runWizardFromMenu (int chosenMenuItemID, const Project::Item | |||
| return false; | |||
| } | |||
| void NewFileWizard::showFailedToWriteMessage (const File& file) | |||
| void NewFileWizard::registerWizard (Type* newWizard) | |||
| { | |||
| AlertWindow::showMessageBox (AlertWindow::WarningIcon, | |||
| "Failed to Create File!", | |||
| "Couldn't write to the file: " + file.getFullPathName()); | |||
| } | |||
| const File NewFileWizard::askUserToChooseNewFile (const String& suggestedFilename, const String& wildcard, | |||
| const Project::Item& projectGroupToAddTo) | |||
| { | |||
| FileChooser fc ("Select File to Create", | |||
| projectGroupToAddTo.determineGroupFolder() | |||
| .getChildFile (suggestedFilename) | |||
| .getNonexistentSibling(), | |||
| wildcard); | |||
| if (fc.browseForFileToSave (true)) | |||
| return fc.getResult(); | |||
| return File::nonexistent; | |||
| wizards.add (newWizard); | |||
| } | |||
| @@ -31,31 +31,42 @@ | |||
| //============================================================================== | |||
| class NewFileWizard | |||
| class NewFileWizard : public DeletedAtShutdown | |||
| { | |||
| public: | |||
| virtual ~NewFileWizard() {} | |||
| //============================================================================== | |||
| static const StringArray getWizards(); | |||
| static int getNumWizards(); | |||
| static NewFileWizard* createWizard (int index); | |||
| NewFileWizard(); | |||
| ~NewFileWizard(); | |||
| static void addWizardsToMenu (PopupMenu& m); | |||
| static bool runWizardFromMenu (int chosenMenuItemID, const Project::Item& projectGroupToAddTo); | |||
| juce_DeclareSingleton_SingleThreaded_Minimal (NewFileWizard); | |||
| //============================================================================== | |||
| virtual const String getName() = 0; | |||
| virtual void createNewFile (Project::Item projectGroupToAddTo) = 0; | |||
| class Type | |||
| { | |||
| public: | |||
| Type() {} | |||
| virtual ~Type() {} | |||
| //============================================================================== | |||
| virtual const String getName() = 0; | |||
| virtual void createNewFile (Project::Item projectGroupToAddTo) = 0; | |||
| protected: | |||
| //============================================================================== | |||
| const File askUserToChooseNewFile (const String& suggestedFilename, const String& wildcard, | |||
| const Project::Item& projectGroupToAddTo); | |||
| void showFailedToWriteMessage (const File& file); | |||
| }; | |||
| protected: | |||
| //============================================================================== | |||
| NewFileWizard() {} | |||
| void addWizardsToMenu (PopupMenu& m) const; | |||
| bool runWizardFromMenu (int chosenMenuItemID, const Project::Item& projectGroupToAddTo) const; | |||
| const File askUserToChooseNewFile (const String& suggestedFilename, const String& wildcard, | |||
| const Project::Item& projectGroupToAddTo); | |||
| void registerWizard (Type* newWizard); | |||
| void showFailedToWriteMessage (const File& file); | |||
| private: | |||
| OwnedArray <Type> wizards; | |||
| }; | |||
| @@ -999,3 +999,36 @@ const String Project::getFileTemplate (const String& templateName) | |||
| return String::fromUTF8 (data, dataSize); | |||
| } | |||
| //============================================================================== | |||
| void Project::resaveJucerFile (const File& file) | |||
| { | |||
| if (! file.exists()) | |||
| { | |||
| std::cout << "The file " << file.getFullPathName() << " doesn't exist!" << std::endl; | |||
| return; | |||
| } | |||
| if (! file.hasFileExtension (Project::projectFileExtension)) | |||
| { | |||
| std::cout << file.getFullPathName() << " isn't a valid jucer project file!" << std::endl; | |||
| return; | |||
| } | |||
| Project newDoc (file); | |||
| if (! newDoc.loadFrom (file, true)) | |||
| { | |||
| std::cout << "Failed to load the project file: " << file.getFullPathName() << std::endl; | |||
| return; | |||
| } | |||
| std::cout << "The Jucer - Re-saving file: " << file.getFullPathName() << std::endl; | |||
| String error (newDoc.saveDocument (file)); | |||
| if (error.isNotEmpty()) | |||
| { | |||
| std::cout << "Error when writing project: " << error << std::endl; | |||
| return; | |||
| } | |||
| } | |||
| @@ -298,6 +298,8 @@ public: | |||
| //============================================================================== | |||
| static const char* projectFileExtension; | |||
| static void resaveJucerFile (const File& file); | |||
| private: | |||
| ValueTree projectRoot; | |||
| static File lastDocumentOpened; | |||
| @@ -1213,7 +1213,7 @@ protected: | |||
| jassertfalse; | |||
| } | |||
| } | |||
| else if (file.hasFileExtension ("h")) | |||
| else if (file.hasFileExtension (headerFileExtensions)) | |||
| { | |||
| headers.createNewChildElement ("ClInclude")->setAttribute ("Include", file.toWindowsStyle()); | |||
| } | |||
| @@ -1239,7 +1239,7 @@ protected: | |||
| { | |||
| const RelativePath path (projectItem.getFile(), getTargetFolder(), RelativePath::buildTargetFolder); | |||
| if (path.hasFileExtension ("h") || (path.hasFileExtension ("cpp;c") && projectItem.shouldBeCompiled())) | |||
| if (path.hasFileExtension (headerFileExtensions) || (path.hasFileExtension ("cpp;c") && projectItem.shouldBeCompiled())) | |||
| addFileToCompile (path, cpps, headers, false, false); | |||
| } | |||
| } | |||
| @@ -1257,7 +1257,7 @@ protected: | |||
| { | |||
| XmlElement* e; | |||
| if (file.hasFileExtension ("h")) | |||
| if (file.hasFileExtension (headerFileExtensions)) | |||
| e = headers.createNewChildElement ("ClInclude"); | |||
| else | |||
| e = cpps.createNewChildElement ("ClCompile"); | |||
| @@ -650,7 +650,7 @@ private: | |||
| if (file.hasFileExtension (".cpp")) return "sourcecode.cpp.cpp"; | |||
| else if (file.hasFileExtension (".mm")) return "sourcecode.cpp.objcpp"; | |||
| else if (file.hasFileExtension (".m")) return "sourcecode.c.objc"; | |||
| else if (file.hasFileExtension (".h;.hpp")) return "sourcecode.c.h"; | |||
| else if (file.hasFileExtension (headerFileExtensions)) return "sourcecode.c.h"; | |||
| else if (file.hasFileExtension (".framework")) return "wrapper.framework"; | |||
| else if (file.hasFileExtension (".jpeg;.jpg")) return "image.jpeg"; | |||
| else if (file.hasFileExtension ("png;gif")) return "image" + file.getFileExtension(); | |||
| @@ -1,69 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This is an automatically generated file created by the Jucer! | |||
| Be careful when adding custom code to these files, as only the code within | |||
| the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded | |||
| and re-saved. | |||
| Created for JUCE version: %%juceVersion%% | |||
| ------------------------------------------------------------------------------ | |||
| JUCE and the Jucer are copyright 2004-10 by Raw Material Software ltd. | |||
| ============================================================================== | |||
| */ | |||
| //[CppHeaders] You can add your own extra header files here... | |||
| //[/CppHeaders] | |||
| %%includeFilesCPP%% | |||
| //[MiscUserDefs] You can add your own user definitions and misc code here... | |||
| //[/MiscUserDefs] | |||
| extern const unsigned char %%className%%_ComponentStateData[]; | |||
| //============================================================================== | |||
| %%className%%::%%className%% (%%constructorParams%%) | |||
| %%initialisers%%{ | |||
| componentState = ValueTree::readFromData (%%className%%_ComponentStateData, %%statedatasize%%); | |||
| jassert (componentState.isValid()); | |||
| const ValueTree componentStateList (componentState.getChildByName ("COMPONENTS")); | |||
| %%constructor%% | |||
| //[Constructor] You can add your own custom stuff here.. | |||
| //[/Constructor] | |||
| } | |||
| %%className%%::~%%className%%() | |||
| { | |||
| //[Destructor_pre]. You can add your own custom destruction code here.. | |||
| //[/Destructor_pre] | |||
| %%destructor%% | |||
| //[Destructor]. You can add your own custom destruction code here.. | |||
| //[/Destructor] | |||
| } | |||
| //============================================================================== | |||
| %%methodDefinitions%% | |||
| //[MiscUserCode] You can add your own definitions of your custom methods or any other code here... | |||
| //[/MiscUserCode] | |||
| %%staticMemberDefinitions%% | |||
| //============================================================================== | |||
| //======================= Jucer Information Section ========================== | |||
| //============================================================================== | |||
| #if 0 | |||
| /* This section stores the Jucer's metadata - edit it at your own risk! | |||
| %%metadata%% | |||
| */ | |||
| #endif | |||
| @@ -1,66 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This is an automatically generated file created by the Jucer! | |||
| Be careful when adding custom code to these files, as only the code within | |||
| the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded | |||
| and re-saved. | |||
| Created for JUCE version: %%juceVersion%% | |||
| ------------------------------------------------------------------------------ | |||
| JUCE and the Jucer are copyright 2004-10 by Raw Material Software ltd. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef %%headerGuard%% | |||
| #define %%headerGuard%% | |||
| //[Headers] -- You can add your own extra header files here -- | |||
| %%defaultJuceInclude%% | |||
| //[/Headers] | |||
| %%includeFilesH%% | |||
| //============================================================================== | |||
| /** | |||
| //[Comments] | |||
| An auto-generated component, created by the Jucer. | |||
| Describe your class and how it works here! | |||
| //[/Comments] | |||
| */ | |||
| %%classDeclaration%% | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| %%className%% (%%constructorParams%%); | |||
| ~%%className%%(); | |||
| //============================================================================== | |||
| //[UserMethods] -- You can add your own custom methods in this section. | |||
| //[/UserMethods] | |||
| %%publicMemberDeclarations%% | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| //[UserVariables] -- You can add your own custom variables in this section. | |||
| //[/UserVariables] | |||
| //============================================================================== | |||
| %%privateMemberDeclarations%% | |||
| //============================================================================== | |||
| // (prevent copy constructor and operator= being generated..) | |||
| %%className%% (const %%className%%&); | |||
| %%className%%& operator= (const %%className%%&); | |||
| }; | |||
| #endif // %%headerGuard%% | |||
| @@ -57,7 +57,7 @@ void SourceCodeEditor::resized() | |||
| bool SourceCodeEditor::isTextFile (const File& file) | |||
| { | |||
| return file.hasFileExtension (textFileExtensions); | |||
| return file.hasFileExtension ("cpp;h;hpp;mm;m;c;txt;xml;plist;rtf;html;htm;php;py;rb;cs"); | |||
| } | |||
| bool SourceCodeEditor::isCppFile (const File& file) | |||
| @@ -1,410 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #include "../../jucer_Headers.h" | |||
| #include "../../model/Component/jucer_ComponentDocument.h" | |||
| #include "../jucer_JucerTreeViewBase.h" | |||
| #include "../Editor Base/jucer_EditorPanel.h" | |||
| #include "../Editor Base/jucer_EditorDragOperation.h" | |||
| #include "jucer_ComponentEditor.h" | |||
| #include "jucer_ComponentEditorCanvas.h" | |||
| #include "jucer_ComponentEditorTreeView.h" | |||
| #include "jucer_ComponentEditorCodeView.h" | |||
| #include "jucer_ComponentEditorToolbar.h" | |||
| //============================================================================== | |||
| class ComponentEditor::ClassInfoHolder : public Component | |||
| { | |||
| public: | |||
| ClassInfoHolder (ComponentEditor& editor_) | |||
| : editor (editor_) | |||
| { | |||
| addAndMakeVisible (panel = new PropertyPanelWithTooltips()); | |||
| Array <PropertyComponent*> props; | |||
| editor.getDocument().createClassProperties (props); | |||
| panel->getPanel()->addSection ("Component Properties", props, true); | |||
| } | |||
| ~ClassInfoHolder() | |||
| { | |||
| deleteAllChildren(); | |||
| } | |||
| void resized() | |||
| { | |||
| panel->setBounds (getLocalBounds()); | |||
| } | |||
| private: | |||
| ComponentEditor& editor; | |||
| PropertyPanelWithTooltips* panel; | |||
| }; | |||
| //============================================================================== | |||
| class ComponentEditor::LayoutEditorHolder : public EditorPanelBase | |||
| { | |||
| public: | |||
| LayoutEditorHolder (ComponentEditor& editor_) | |||
| : toolbarFactory (editor_), | |||
| editor (editor_) | |||
| { | |||
| } | |||
| ~LayoutEditorHolder() | |||
| { | |||
| shutdown(); | |||
| } | |||
| void createCanvas() | |||
| { | |||
| initialise (new ComponentEditorCanvas (editor), toolbarFactory, | |||
| new ComponentEditorTreeView::Root (editor)); | |||
| } | |||
| SelectedItemSet<String>& getSelection() | |||
| { | |||
| return editor.getSelection(); | |||
| } | |||
| void getSelectedItemProperties (Array<PropertyComponent*>& props) | |||
| { | |||
| editor.getDocument().createItemProperties (props, editor.getSelectedIds()); | |||
| } | |||
| private: | |||
| ComponentEditorToolbarFactory toolbarFactory; | |||
| ComponentEditor& editor; | |||
| }; | |||
| //============================================================================== | |||
| class ComponentEditor::BackgroundEditorHolder : public Component | |||
| { | |||
| public: | |||
| BackgroundEditorHolder (ComponentEditor& editor_) | |||
| : editor (editor_) | |||
| { | |||
| } | |||
| ~BackgroundEditorHolder() | |||
| { | |||
| } | |||
| private: | |||
| ComponentEditor& editor; | |||
| }; | |||
| //============================================================================== | |||
| ComponentEditor::ComponentEditor (OpenDocumentManager::Document* document_, | |||
| Project* project_, ComponentDocument* componentDocument_) | |||
| : DocumentEditorComponent (document_), | |||
| project (project_), | |||
| componentDocument (componentDocument_), | |||
| classInfoHolder (0), | |||
| layoutEditorHolder (0), | |||
| backgroundEditorHolder (0), | |||
| codeEditorHolder (0) | |||
| { | |||
| setOpaque (true); | |||
| if (componentDocument != 0) | |||
| { | |||
| classInfoHolder = new ClassInfoHolder (*this); | |||
| layoutEditorHolder = new LayoutEditorHolder (*this); | |||
| backgroundEditorHolder = new BackgroundEditorHolder (*this); | |||
| codeEditorHolder = new CodeEditorHolder (*this); | |||
| layoutEditorHolder->createCanvas(); | |||
| } | |||
| addAndMakeVisible (tabs = new TabbedComponent (TabbedButtonBar::TabsAtRight)); | |||
| tabs->setTabBarDepth (22); | |||
| tabs->setOutline (0); | |||
| tabs->addTab ("Class Settings", Colour::greyLevel (0.88f), classInfoHolder, true); | |||
| tabs->addTab ("Components", Colours::white, layoutEditorHolder, true); | |||
| tabs->addTab ("Background", Colours::white, backgroundEditorHolder, true); | |||
| tabs->addTab ("Source Code", Colours::white, codeEditorHolder, true); | |||
| tabs->setCurrentTabIndex (1); | |||
| } | |||
| ComponentEditor::~ComponentEditor() | |||
| { | |||
| deleteAllChildren(); | |||
| } | |||
| void ComponentEditor::paint (Graphics& g) | |||
| { | |||
| g.fillAll (Colours::white); | |||
| } | |||
| void ComponentEditor::resized() | |||
| { | |||
| tabs->setBounds (getLocalBounds()); | |||
| } | |||
| const StringArray ComponentEditor::getSelectedIds() const | |||
| { | |||
| StringArray ids; | |||
| const int num = selection.getNumSelected(); | |||
| for (int i = 0; i < num; ++i) | |||
| ids.add (selection.getSelectedItem(i)); | |||
| return ids; | |||
| } | |||
| void ComponentEditor::deleteSelection() | |||
| { | |||
| const StringArray ids (getSelectedIds()); | |||
| getSelection().deselectAll(); | |||
| getDocument().beginNewTransaction(); | |||
| for (int i = ids.size(); --i >= 0;) | |||
| { | |||
| const ValueTree comp (getDocument().getComponentWithID (ids[i])); | |||
| if (comp.isValid()) | |||
| getDocument().removeComponent (comp); | |||
| } | |||
| getDocument().beginNewTransaction(); | |||
| } | |||
| void ComponentEditor::deselectNonComponents() | |||
| { | |||
| EditorCanvasBase::SelectedItems& sel = getSelection(); | |||
| for (int i = sel.getNumSelected(); --i >= 0;) | |||
| if (! getDocument().getComponentWithID (sel.getSelectedItem (i)).isValid()) | |||
| sel.deselect (sel.getSelectedItem (i)); | |||
| } | |||
| void ComponentEditor::selectionToFront() | |||
| { | |||
| getDocument().beginNewTransaction(); | |||
| int index = 0; | |||
| for (int i = getDocument().getNumComponents(); --i >= 0;) | |||
| { | |||
| const ValueTree comp (getDocument().getComponent (index)); | |||
| if (comp.isValid() && getSelection().isSelected (comp [ComponentDocument::idProperty])) | |||
| { | |||
| ValueTree parent (comp.getParent()); | |||
| parent.moveChild (parent.indexOf (comp), -1, getDocument().getUndoManager()); | |||
| } | |||
| else | |||
| { | |||
| ++index; | |||
| } | |||
| } | |||
| getDocument().beginNewTransaction(); | |||
| } | |||
| void ComponentEditor::selectionToBack() | |||
| { | |||
| getDocument().beginNewTransaction(); | |||
| int index = getDocument().getNumComponents() - 1; | |||
| for (int i = getDocument().getNumComponents(); --i >= 0;) | |||
| { | |||
| const ValueTree comp (getDocument().getComponent (index)); | |||
| if (comp.isValid() && getSelection().isSelected (comp [ComponentDocument::idProperty])) | |||
| { | |||
| ValueTree parent (comp.getParent()); | |||
| parent.moveChild (parent.indexOf (comp), 0, getDocument().getUndoManager()); | |||
| } | |||
| else | |||
| { | |||
| --index; | |||
| } | |||
| } | |||
| getDocument().beginNewTransaction(); | |||
| } | |||
| //============================================================================== | |||
| void ComponentEditor::showNewComponentMenu (Component* componentToAttachTo) | |||
| { | |||
| PopupMenu m; | |||
| getDocument().addNewComponentMenuItems (m); | |||
| const int r = m.showAt (componentToAttachTo); | |||
| const ValueTree newComp (getDocument().performNewComponentMenuItem (r)); | |||
| if (newComp.isValid()) | |||
| getSelection().selectOnly (newComp [ComponentDocument::idProperty]); | |||
| } | |||
| //============================================================================== | |||
| void ComponentEditor::test() | |||
| { | |||
| ScopedPointer<Component> testComp (document->createViewer()); | |||
| TooltipWindow tooltipWindow; | |||
| DialogWindow::showModalDialog ("Testing: " + getDocument().getClassName().toString(), | |||
| testComp, this, Colours::lightgrey, true, true); | |||
| } | |||
| //============================================================================== | |||
| void ComponentEditor::getAllCommands (Array <CommandID>& commands) | |||
| { | |||
| DocumentEditorComponent::getAllCommands (commands); | |||
| const CommandID ids[] = { CommandIDs::undo, | |||
| CommandIDs::redo, | |||
| CommandIDs::toFront, | |||
| CommandIDs::toBack, | |||
| CommandIDs::test, | |||
| CommandIDs::showOrHideProperties, | |||
| CommandIDs::showOrHideTree, | |||
| CommandIDs::showOrHideMarkers, | |||
| CommandIDs::toggleSnapping, | |||
| StandardApplicationCommandIDs::del }; | |||
| commands.addArray (ids, numElementsInArray (ids)); | |||
| } | |||
| void ComponentEditor::getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) | |||
| { | |||
| result.setActive (document != 0); | |||
| switch (commandID) | |||
| { | |||
| case CommandIDs::undo: | |||
| result.setInfo ("Undo", "Undoes the last change", CommandCategories::general, 0); | |||
| result.defaultKeypresses.add (KeyPress ('z', ModifierKeys::commandModifier, 0)); | |||
| break; | |||
| case CommandIDs::redo: | |||
| result.setInfo ("Redo", "Redoes the last change", CommandCategories::general, 0); | |||
| result.defaultKeypresses.add (KeyPress ('z', ModifierKeys::shiftModifier | ModifierKeys::commandModifier, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('y', ModifierKeys::commandModifier, 0)); | |||
| break; | |||
| case CommandIDs::toFront: | |||
| result.setInfo ("Bring to Front", "Brings the selected items to the front", CommandCategories::editing, 0); | |||
| break; | |||
| case CommandIDs::toBack: | |||
| result.setInfo ("Send to Back", "Moves the selected items to the back", CommandCategories::editing, 0); | |||
| break; | |||
| case CommandIDs::test: | |||
| result.setInfo ("Test", "Test the current component", CommandCategories::editing, 0); | |||
| result.defaultKeypresses.add (KeyPress ('t', ModifierKeys::commandModifier, 0)); | |||
| break; | |||
| case CommandIDs::showOrHideProperties: | |||
| result.setInfo ("Show/Hide Tree", "Shows or hides the component tree view", CommandCategories::editing, 0); | |||
| result.setTicked (layoutEditorHolder != 0 && layoutEditorHolder->arePropertiesVisible()); | |||
| break; | |||
| case CommandIDs::showOrHideTree: | |||
| result.setInfo ("Show/Hide Properties", "Shows or hides the component properties panel", CommandCategories::editing, 0); | |||
| result.setTicked (layoutEditorHolder != 0 && layoutEditorHolder->isTreeVisible()); | |||
| break; | |||
| case CommandIDs::showOrHideMarkers: | |||
| result.setInfo ("Show/Hide Markers", "Shows or hides the markers", CommandCategories::editing, 0); | |||
| result.setTicked (layoutEditorHolder != 0 && layoutEditorHolder->areMarkersVisible()); | |||
| break; | |||
| case CommandIDs::toggleSnapping: | |||
| result.setInfo ("Toggle snapping", "Turns object snapping on or off", CommandCategories::editing, 0); | |||
| result.setTicked (layoutEditorHolder != 0 && layoutEditorHolder->isSnappingEnabled()); | |||
| break; | |||
| case StandardApplicationCommandIDs::del: | |||
| result.setInfo ("Delete", String::empty, CommandCategories::general, 0); | |||
| result.defaultKeypresses.add (KeyPress (KeyPress::deleteKey, 0, 0)); | |||
| result.defaultKeypresses.add (KeyPress (KeyPress::backspaceKey, 0, 0)); | |||
| break; | |||
| default: | |||
| DocumentEditorComponent::getCommandInfo (commandID, result); | |||
| break; | |||
| } | |||
| } | |||
| bool ComponentEditor::perform (const InvocationInfo& info) | |||
| { | |||
| switch (info.commandID) | |||
| { | |||
| case CommandIDs::undo: | |||
| getDocument().getUndoManager()->beginNewTransaction(); | |||
| getDocument().getUndoManager()->undo(); | |||
| return true; | |||
| case CommandIDs::redo: | |||
| getDocument().getUndoManager()->beginNewTransaction(); | |||
| getDocument().getUndoManager()->redo(); | |||
| return true; | |||
| case CommandIDs::toFront: | |||
| selectionToFront(); | |||
| return true; | |||
| case CommandIDs::toBack: | |||
| selectionToBack(); | |||
| return true; | |||
| case CommandIDs::test: | |||
| test(); | |||
| return true; | |||
| case CommandIDs::showOrHideProperties: | |||
| layoutEditorHolder->showOrHideProperties(); | |||
| return true; | |||
| case CommandIDs::showOrHideTree: | |||
| layoutEditorHolder->showOrHideTree(); | |||
| return true; | |||
| case CommandIDs::showOrHideMarkers: | |||
| layoutEditorHolder->showOrHideMarkers(); | |||
| return true; | |||
| case CommandIDs::toggleSnapping: | |||
| layoutEditorHolder->toggleSnapping(); | |||
| return true; | |||
| case StandardApplicationCommandIDs::del: | |||
| deleteSelection(); | |||
| return true; | |||
| default: | |||
| break; | |||
| } | |||
| return DocumentEditorComponent::perform (info); | |||
| } | |||
| @@ -1,91 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCE_COMPONENTEDITOR_H_6CAE6B7E__ | |||
| #define __JUCE_COMPONENTEDITOR_H_6CAE6B7E__ | |||
| #include "../jucer_DocumentEditorComponent.h" | |||
| #include "../../model/Component/jucer_ComponentDocument.h" | |||
| #include "../Editor Base/jucer_EditorCanvas.h" | |||
| //============================================================================== | |||
| /** | |||
| */ | |||
| class ComponentEditor : public DocumentEditorComponent | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| ComponentEditor (OpenDocumentManager::Document* document, | |||
| Project* project, | |||
| ComponentDocument* componentDocument); | |||
| ~ComponentEditor(); | |||
| //============================================================================== | |||
| void getAllCommands (Array <CommandID>& commands); | |||
| void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result); | |||
| bool perform (const InvocationInfo& info); | |||
| void paint (Graphics& g); | |||
| void resized(); | |||
| //============================================================================== | |||
| ComponentDocument& getDocument() const { return *componentDocument; } | |||
| const StringArray getSelectedIds() const; | |||
| void deleteSelection(); | |||
| void deselectNonComponents(); | |||
| void selectionToFront(); | |||
| void selectionToBack(); | |||
| void showNewComponentMenu (Component* componentToAttachTo); | |||
| //============================================================================== | |||
| void test(); | |||
| EditorCanvasBase::SelectedItems& getSelection() { return selection; } | |||
| private: | |||
| class ClassInfoHolder; | |||
| class LayoutEditorHolder; | |||
| class BackgroundEditorHolder; | |||
| class CodeEditorHolder; | |||
| Project* project; | |||
| ComponentDocument* componentDocument; | |||
| EditorCanvasBase::SelectedItems selection; | |||
| TabbedComponent* tabs; | |||
| ClassInfoHolder* classInfoHolder; | |||
| LayoutEditorHolder* layoutEditorHolder; | |||
| BackgroundEditorHolder* backgroundEditorHolder; | |||
| CodeEditorHolder* codeEditorHolder; | |||
| ComponentEditor (const ComponentEditor&); | |||
| ComponentEditor& operator= (const ComponentEditor&); | |||
| }; | |||
| #endif // __JUCE_COMPONENTEDITOR_H_6CAE6B7E__ | |||
| @@ -1,364 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_COMPONENTEDITORCANVAS_H_37C33B56__ | |||
| #define __JUCER_COMPONENTEDITORCANVAS_H_37C33B56__ | |||
| //============================================================================== | |||
| class ComponentEditorCanvas : public EditorCanvasBase, | |||
| public Timer | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| ComponentEditorCanvas (ComponentEditor& editor_) | |||
| : editor (editor_) | |||
| { | |||
| background = ImageCache::getFromMemory (BinaryData::brushed_aluminium_png, BinaryData::brushed_aluminium_pngSize); | |||
| initialise(); | |||
| getDocument().getRoot().addListener (this); | |||
| } | |||
| ~ComponentEditorCanvas() | |||
| { | |||
| getDocument().getRoot().removeListener (this); | |||
| shutdown(); | |||
| } | |||
| ComponentEditor& getEditor() { return editor; } | |||
| ComponentDocument& getDocument() { return editor.getDocument(); } | |||
| void timerCallback() | |||
| { | |||
| stopTimer(); | |||
| if (! Component::isMouseButtonDownAnywhere()) | |||
| getDocument().beginNewTransaction(); | |||
| } | |||
| Component* createComponentHolder() | |||
| { | |||
| return new ComponentHolder (getDocument().getBackgroundColour()); | |||
| } | |||
| void documentChanged() | |||
| { | |||
| getDocument().updateComponentsIn (getComponentHolder()); | |||
| startTimer (500); | |||
| } | |||
| void fillBackground (Graphics& g) | |||
| { | |||
| g.setTiledImageFill (background, 0, 0, 1.0f); | |||
| g.fillAll(); | |||
| } | |||
| const Rectangle<int> getCanvasBounds() | |||
| { | |||
| return Rectangle<int> (0, 0, getDocument().getCanvasWidth().getValue(), | |||
| getDocument().getCanvasHeight().getValue()); | |||
| } | |||
| void setCanvasBounds (const Rectangle<int>& newBounds) | |||
| { | |||
| jassert (newBounds.getPosition().isOrigin()); | |||
| getDocument().getCanvasWidth() = newBounds.getWidth(); | |||
| getDocument().getCanvasHeight() = newBounds.getHeight(); | |||
| } | |||
| bool canResizeCanvas() const { return true; } | |||
| ComponentDocument::MarkerList& getMarkerList (bool isX) | |||
| { | |||
| return getDocument().getMarkerList (isX); | |||
| } | |||
| double limitMarkerPosition (double pos) | |||
| { | |||
| return jmax (0.0, pos); | |||
| } | |||
| const SelectedItems::ItemType findObjectIdAt (const Point<int>& position) | |||
| { | |||
| for (int i = getComponentHolder()->getNumChildComponents(); --i >= 0;) | |||
| { | |||
| Component* const c = getComponentHolder()->getChildComponent(i); | |||
| if (c->getBounds().contains (position)) | |||
| return ComponentDocument::getJucerIDFor (c); | |||
| } | |||
| return String::empty; | |||
| } | |||
| void showPopupMenu (bool isClickOnSelectedObject) | |||
| { | |||
| if (isClickOnSelectedObject) | |||
| { | |||
| PopupMenu m; | |||
| m.addCommandItem (commandManager, CommandIDs::toFront); | |||
| m.addCommandItem (commandManager, CommandIDs::toBack); | |||
| m.addSeparator(); | |||
| m.addCommandItem (commandManager, StandardApplicationCommandIDs::del); | |||
| const int r = m.show(); | |||
| (void) r; | |||
| } | |||
| else | |||
| { | |||
| editor.showNewComponentMenu (0); | |||
| } | |||
| } | |||
| void objectDoubleClicked (const MouseEvent& e, const ValueTree& state) | |||
| { | |||
| getDocument().componentDoubleClicked (e, state); | |||
| } | |||
| const ValueTree getObjectState (const String& objectId) | |||
| { | |||
| return getDocument().getComponentWithID (objectId); | |||
| } | |||
| const Rectangle<int> getObjectPosition (const ValueTree& state) | |||
| { | |||
| return getDocument().getCoordsFor (state).resolve (&getDocument()).getSmallestIntegerContainer(); | |||
| } | |||
| bool hasSizeGuides() const { return true; } | |||
| RelativeRectangle getObjectCoords (const ValueTree& state) | |||
| { | |||
| return getDocument().getCoordsFor (state); | |||
| } | |||
| void updateControlPointComponents (Component* parent, OwnedArray<OverlayItemComponent>& existingComps) | |||
| { | |||
| } | |||
| SelectedItems& getSelection() | |||
| { | |||
| return editor.getSelection(); | |||
| } | |||
| void deselectNonDraggableObjects() | |||
| { | |||
| editor.deselectNonComponents(); | |||
| } | |||
| void findLassoItemsInArea (Array <SelectedItems::ItemType>& itemsFound, const Rectangle<int>& area) | |||
| { | |||
| for (int i = getComponentHolder()->getNumChildComponents(); --i >= 0;) | |||
| { | |||
| Component* c = getComponentHolder()->getChildComponent(i); | |||
| if (c->getBounds().intersects (area)) | |||
| itemsFound.add (ComponentDocument::getJucerIDFor (c)); | |||
| } | |||
| } | |||
| //============================================================================== | |||
| class DragOperation : public EditorDragOperation | |||
| { | |||
| public: | |||
| DragOperation (ComponentEditorCanvas* canvas_, | |||
| const Point<int>& mousePos, | |||
| Component* snapGuideParentComp_, | |||
| const ResizableBorderComponent::Zone& zone_) | |||
| : EditorDragOperation (canvas_, mousePos, snapGuideParentComp_, zone_, false) | |||
| { | |||
| } | |||
| ~DragOperation() | |||
| { | |||
| } | |||
| protected: | |||
| ComponentDocument& getDocument() throw() { return static_cast <ComponentEditorCanvas*> (canvas)->getDocument(); } | |||
| void getSnapPointsX (Array<float>& points, bool includeCentre) | |||
| { | |||
| const float width = getDocument().getCanvasWidth().getValue(); | |||
| points.add (0.0f); | |||
| points.add (width); | |||
| if (includeCentre) | |||
| points.add (width / 2.0f); | |||
| } | |||
| void getSnapPointsY (Array<float>& points, bool includeCentre) | |||
| { | |||
| const float height = getDocument().getCanvasHeight().getValue(); | |||
| points.add (0.0f); | |||
| points.add (height); | |||
| if (includeCentre) | |||
| points.add (height / 2.0f); | |||
| } | |||
| int getCanvasWidth() { return getDocument().getCanvasWidth().getValue(); } | |||
| int getCanvasHeight() { return getDocument().getCanvasHeight().getValue(); } | |||
| UndoManager& getUndoManager() { return *getDocument().getUndoManager(); } | |||
| void getObjectDependencies (const ValueTree& state, Array<ValueTree>& deps) | |||
| { | |||
| ComponentDocument& doc = getDocument(); | |||
| RelativeRectangle pr (doc.getCoordsFor (state)); | |||
| StringArray anchors; | |||
| anchors.addIfNotAlreadyThere (pr.left.getAnchorName1()); | |||
| anchors.addIfNotAlreadyThere (pr.left.getAnchorName2()); | |||
| anchors.addIfNotAlreadyThere (pr.top.getAnchorName1()); | |||
| anchors.addIfNotAlreadyThere (pr.top.getAnchorName2()); | |||
| anchors.addIfNotAlreadyThere (pr.right.getAnchorName1()); | |||
| anchors.addIfNotAlreadyThere (pr.right.getAnchorName2()); | |||
| anchors.addIfNotAlreadyThere (pr.bottom.getAnchorName1()); | |||
| anchors.addIfNotAlreadyThere (pr.bottom.getAnchorName2()); | |||
| for (int i = 0; i < anchors.size(); ++i) | |||
| { | |||
| const String anchor (anchors[i]); | |||
| if (anchor.isNotEmpty() && ! anchor.startsWith ("parent.")) | |||
| { | |||
| const ValueTree v (doc.getComponentWithMemberName (anchor.upToFirstOccurrenceOf (".", false, false))); | |||
| if (v.isValid()) | |||
| deps.add (v); | |||
| } | |||
| } | |||
| } | |||
| const Rectangle<float> getObjectPosition (const ValueTree& state) | |||
| { | |||
| ComponentDocument& doc = getDocument(); | |||
| return doc.getCoordsFor (state).resolve (&doc); | |||
| } | |||
| void setObjectPosition (ValueTree& state, const Rectangle<float>& newBounds) | |||
| { | |||
| ComponentDocument& doc = getDocument(); | |||
| RelativeRectangle pr (doc.getCoordsFor (state)); | |||
| pr.moveToAbsolute (newBounds, &doc); | |||
| doc.setCoordsFor (state, pr); | |||
| } | |||
| float getMarkerPosition (const ValueTree& marker, bool isX) | |||
| { | |||
| ComponentDocument& doc = getDocument(); | |||
| return (float) doc.getMarkerList (isX).getCoordinate (marker).resolve (&doc); | |||
| } | |||
| void transformObject (ValueTree& state, const AffineTransform& transform) | |||
| { | |||
| } | |||
| }; | |||
| bool canRotate() const { return false; } | |||
| DragOperation* createDragOperation (const Point<int>& mouseDownPos, Component* snapGuideParentComponent, | |||
| const ResizableBorderComponent::Zone& zone, bool isRotating) | |||
| { | |||
| DragOperation* d = new DragOperation (this, mouseDownPos, snapGuideParentComponent, zone); | |||
| Array<ValueTree> selected, unselected; | |||
| for (int i = getDocument().getNumComponents(); --i >= 0;) | |||
| { | |||
| const ValueTree v (getDocument().getComponent (i)); | |||
| if (editor.getSelection().isSelected (v [ComponentDocument::idProperty])) | |||
| selected.add (v); | |||
| else | |||
| unselected.add (v); | |||
| } | |||
| d->initialise (selected, unselected); | |||
| return d; | |||
| } | |||
| UndoManager& getUndoManager() | |||
| { | |||
| return *getDocument().getUndoManager(); | |||
| } | |||
| private: | |||
| //============================================================================== | |||
| ComponentEditor& editor; | |||
| Image background; | |||
| class ComponentHolder : public Component, | |||
| public Value::Listener | |||
| { | |||
| public: | |||
| ComponentHolder (const Value& backgroundColour_) | |||
| : backgroundColour (backgroundColour_) | |||
| { | |||
| setOpaque (true); | |||
| updateColour(); | |||
| backgroundColour.addListener (this); | |||
| } | |||
| ~ComponentHolder() | |||
| { | |||
| deleteAllChildren(); | |||
| } | |||
| void updateColour() | |||
| { | |||
| Colour newColour (Colours::white); | |||
| if (backgroundColour.toString().isNotEmpty()) | |||
| newColour = Colour::fromString (backgroundColour.toString()); | |||
| if (newColour != colour) | |||
| { | |||
| colour = newColour; | |||
| repaint(); | |||
| } | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| if (colour.isOpaque()) | |||
| g.fillAll (colour); | |||
| else | |||
| g.fillCheckerBoard (0, 0, getWidth(), getHeight(), 24, 24, | |||
| Colour (0xffeeeeee).overlaidWith (colour), | |||
| Colour (0xffffffff).overlaidWith (colour)); | |||
| } | |||
| void valueChanged (Value&) | |||
| { | |||
| updateColour(); | |||
| } | |||
| private: | |||
| Value backgroundColour; | |||
| Colour colour; | |||
| }; | |||
| }; | |||
| #endif // __JUCER_COMPONENTEDITORCANVAS_H_37C33B56__ | |||
| @@ -1,236 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_COMPONENTEDITORCODEVIEW_H_CA5124B0__ | |||
| #define __JUCER_COMPONENTEDITORCODEVIEW_H_CA5124B0__ | |||
| //============================================================================== | |||
| class ComponentEditor::CodeEditorHolder : public Component, | |||
| public ButtonListener | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| CodeEditorHolder (ComponentEditor& editor_) | |||
| : editor (editor_), switchFileButton (String::empty), showingHeader (true) | |||
| { | |||
| addAndMakeVisible (&viewport); | |||
| viewport.setScrollBarsShown (true, false); | |||
| addAndMakeVisible (&switchFileButton); | |||
| buttonClicked (0); | |||
| switchFileButton.addButtonListener (this); | |||
| } | |||
| ~CodeEditorHolder() | |||
| { | |||
| } | |||
| void resized() | |||
| { | |||
| viewport.setBounds (getLocalBounds()); | |||
| int visWidth = viewport.getMaximumVisibleWidth(); | |||
| ContentHolder* ch = dynamic_cast <ContentHolder*> (viewport.getViewedComponent()); | |||
| if (ch != 0) | |||
| { | |||
| ch->updateSize (visWidth); | |||
| if (viewport.getMaximumVisibleWidth() != visWidth) | |||
| ch->updateSize (viewport.getMaximumVisibleWidth()); | |||
| } | |||
| switchFileButton.setBounds (getWidth() - 150, 4, 120, 20); | |||
| } | |||
| void refreshContent() | |||
| { | |||
| viewport.setViewedComponent (new ContentHolder (editor.getDocument(), showingHeader)); | |||
| resized(); | |||
| switchFileButton.setButtonText (showingHeader ? "Show CPP file" : "Show header file"); | |||
| } | |||
| void buttonClicked (Button*) | |||
| { | |||
| showingHeader = ! showingHeader; | |||
| refreshContent(); | |||
| } | |||
| void parentHierarchyChanged() | |||
| { | |||
| if (getParentComponent() != 0) | |||
| refreshContent(); | |||
| else | |||
| viewport.setViewedComponent (0); | |||
| } | |||
| private: | |||
| enum { updateCommandId = 0x23427fa1 }; | |||
| //============================================================================== | |||
| class EditorHolder : public Component, | |||
| public CodeDocument::Listener | |||
| { | |||
| public: | |||
| EditorHolder (const CodeGenerator::CustomCodeList::CodeDocumentRef::Ptr doc, | |||
| const String& textBefore, const String& textAfter) | |||
| : document (doc), cppTokeniser(), codeEditor (doc->getDocument(), &cppTokeniser) | |||
| { | |||
| linesBefore.addLines (textBefore); | |||
| linesAfter.addLines (textAfter); | |||
| addAndMakeVisible (&codeEditor); | |||
| doc->getDocument().addListener (this); | |||
| } | |||
| ~EditorHolder() | |||
| { | |||
| document->getDocument().removeListener (this); | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| g.setFont (codeEditor.getFont()); | |||
| g.setColour (Colours::darkgrey); | |||
| const int fontHeight = codeEditor.getLineHeight(); | |||
| const int fontAscent = (int) codeEditor.getFont().getAscent(); | |||
| const int textX = 5; | |||
| int i; | |||
| for (i = 0; i < linesBefore.size(); ++i) | |||
| g.drawSingleLineText (linesBefore[i], textX, i * fontHeight + fontAscent); | |||
| for (i = 0; i < linesAfter.size(); ++i) | |||
| g.drawSingleLineText (linesAfter[i], textX, codeEditor.getBottom() + i * fontHeight + fontAscent); | |||
| } | |||
| void updateSize (int width) | |||
| { | |||
| const int fontHeight = codeEditor.getLineHeight(); | |||
| codeEditor.setBounds (0, fontHeight * linesBefore.size() + 1, | |||
| width, 2 + codeEditor.getScrollbarThickness() | |||
| + fontHeight * jlimit (1, 50, document->getDocument().getNumLines())); | |||
| setSize (width, (linesBefore.size() + linesAfter.size()) * fontHeight + codeEditor.getHeight()); | |||
| } | |||
| void codeDocumentChanged (const CodeDocument::Position&, const CodeDocument::Position&) | |||
| { | |||
| int oldHeight = getHeight(); | |||
| updateSize (getWidth()); | |||
| if (getHeight() != oldHeight) | |||
| getParentComponent()->handleCommandMessage (updateCommandId); | |||
| } | |||
| private: | |||
| const CodeGenerator::CustomCodeList::CodeDocumentRef::Ptr document; | |||
| CPlusPlusCodeTokeniser cppTokeniser; | |||
| CodeEditorComponent codeEditor; | |||
| StringArray linesBefore, linesAfter; | |||
| }; | |||
| //============================================================================== | |||
| class ContentHolder : public Component, | |||
| public ChangeListener | |||
| { | |||
| public: | |||
| ContentHolder (ComponentDocument& document_, bool isHeader_) | |||
| : document (document_), isHeader (isHeader_) | |||
| { | |||
| setOpaque (true); | |||
| document.getCustomCodeList().addChangeListener (this); | |||
| changeListenerCallback (0); | |||
| } | |||
| ~ContentHolder() | |||
| { | |||
| document.getCustomCodeList().removeChangeListener (this); | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| g.fillAll (Colours::lightgrey); | |||
| } | |||
| void updateSize (int width) | |||
| { | |||
| int y = 2; | |||
| for (int i = 0; i < editors.size(); ++i) | |||
| { | |||
| EditorHolder* const ed = editors.getUnchecked(i); | |||
| ed->updateSize (width - 8); | |||
| ed->setTopLeftPosition (4, y + 1); | |||
| y = ed->getBottom() + 1; | |||
| } | |||
| setSize (width, y + 2); | |||
| } | |||
| void changeListenerCallback (void*) | |||
| { | |||
| editors.clear(); | |||
| CodeGenerator::CustomCodeList::Iterator iter (isHeader ? document.getHeaderContent() | |||
| : document.getCppContent(), | |||
| document.getCustomCodeList()); | |||
| while (iter.next()) | |||
| { | |||
| EditorHolder* ed = new EditorHolder (iter.codeDocument, iter.textBefore, iter.textAfter); | |||
| editors.add (ed); | |||
| addAndMakeVisible (ed); | |||
| } | |||
| updateSize (getWidth()); | |||
| } | |||
| void handleCommandMessage (int commandId) | |||
| { | |||
| if (commandId == updateCommandId) | |||
| updateSize (getWidth()); | |||
| else | |||
| Component::handleCommandMessage (commandId); | |||
| } | |||
| private: | |||
| OwnedArray <EditorHolder> editors; | |||
| ComponentDocument& document; | |||
| bool isHeader; | |||
| }; | |||
| //============================================================================== | |||
| ComponentEditor& editor; | |||
| Viewport viewport; | |||
| TextButton switchFileButton; | |||
| bool showingHeader; | |||
| }; | |||
| #endif // __JUCER_COMPONENTEDITORCODEVIEW_H_CA5124B0__ | |||
| @@ -1,152 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_COMPONENTEDITORTOOLBAR_H_6B5CA931__ | |||
| #define __JUCER_COMPONENTEDITORTOOLBAR_H_6B5CA931__ | |||
| #include "../../utility/jucer_ColourPropertyComponent.h" | |||
| //============================================================================== | |||
| class ComponentEditorToolbarFactory : public ToolbarItemFactory | |||
| { | |||
| public: | |||
| ComponentEditorToolbarFactory (ComponentEditor& editor_) | |||
| : editor (editor_) | |||
| { | |||
| } | |||
| ~ComponentEditorToolbarFactory() | |||
| { | |||
| } | |||
| //============================================================================== | |||
| enum ToolbarItemIds | |||
| { | |||
| createComponent = 1, | |||
| changeBackground, | |||
| showInfo, | |||
| showTree, | |||
| showOrHideMarkers, | |||
| toggleSnapping | |||
| }; | |||
| void getAllToolbarItemIds (Array <int>& ids) | |||
| { | |||
| ids.add (createComponent); | |||
| ids.add (changeBackground); | |||
| ids.add (showInfo); | |||
| ids.add (showTree); | |||
| ids.add (showOrHideMarkers); | |||
| ids.add (toggleSnapping); | |||
| ids.add (separatorBarId); | |||
| ids.add (spacerId); | |||
| ids.add (flexibleSpacerId); | |||
| } | |||
| void getDefaultItemSet (Array <int>& ids) | |||
| { | |||
| ids.add (spacerId); | |||
| ids.add (createComponent); | |||
| ids.add (changeBackground); | |||
| ids.add (flexibleSpacerId); | |||
| ids.add (showOrHideMarkers); | |||
| ids.add (toggleSnapping); | |||
| ids.add (flexibleSpacerId); | |||
| ids.add (showTree); | |||
| ids.add (showInfo); | |||
| ids.add (spacerId); | |||
| } | |||
| ToolbarItemComponent* createItem (int itemId) | |||
| { | |||
| String name; | |||
| int commandId = 0; | |||
| switch (itemId) | |||
| { | |||
| case createComponent: return new NewComponentToolbarButton (editor, itemId); | |||
| case changeBackground: return new BackgroundColourToolbarButton (editor, itemId); | |||
| case showInfo: name = "info"; commandId = CommandIDs::showOrHideProperties; break; | |||
| case showTree: name = "tree"; commandId = CommandIDs::showOrHideTree; break; | |||
| case showOrHideMarkers: name = "markers"; commandId = CommandIDs::showOrHideMarkers; break; | |||
| case toggleSnapping: name = "snap"; commandId = CommandIDs::toggleSnapping; break; | |||
| default: jassertfalse; return 0; | |||
| } | |||
| JucerToolbarButton* b = new JucerToolbarButton (itemId, name); | |||
| b->setCommandToTrigger (commandManager, commandId, true); | |||
| return b; | |||
| } | |||
| //============================================================================== | |||
| class NewComponentToolbarButton : public JucerToolbarButton | |||
| { | |||
| public: | |||
| NewComponentToolbarButton (ComponentEditor& editor_, int itemId_) | |||
| : JucerToolbarButton (itemId_, "create..."), editor (editor_) | |||
| { | |||
| setTriggeredOnMouseDown (true); | |||
| } | |||
| void clicked() | |||
| { | |||
| editor.showNewComponentMenu (this); | |||
| } | |||
| private: | |||
| ComponentEditor& editor; | |||
| }; | |||
| //============================================================================== | |||
| class BackgroundColourToolbarButton : public JucerToolbarButton | |||
| { | |||
| public: | |||
| BackgroundColourToolbarButton (ComponentEditor& editor_, int itemId_) | |||
| : JucerToolbarButton (itemId_, "background"), editor (editor_) | |||
| { | |||
| setTriggeredOnMouseDown (true); | |||
| } | |||
| void clicked() | |||
| { | |||
| editor.getDocument().getUndoManager()->beginNewTransaction(); | |||
| PopupColourSelector::showAt (this, editor.getDocument().getBackgroundColour(), Colours::white, true); | |||
| } | |||
| private: | |||
| ComponentEditor& editor; | |||
| }; | |||
| private: | |||
| ComponentEditor& editor; | |||
| ComponentEditorToolbarFactory (const ComponentEditorToolbarFactory&); | |||
| ComponentEditorToolbarFactory& operator= (const ComponentEditorToolbarFactory&); | |||
| }; | |||
| #endif // __JUCER_COMPONENTEDITORTOOLBAR_H_6B5CA931__ | |||
| @@ -1,396 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCE_COMPONENTEDITORTREEVIEW_H_F3B95A41__ | |||
| #define __JUCE_COMPONENTEDITORTREEVIEW_H_F3B95A41__ | |||
| //============================================================================== | |||
| namespace ComponentEditorTreeView | |||
| { | |||
| //============================================================================== | |||
| class Base : public JucerTreeViewBase, | |||
| public ValueTree::Listener, | |||
| public ChangeListener | |||
| { | |||
| public: | |||
| Base (ComponentEditor& editor_) | |||
| : editor (editor_) | |||
| { | |||
| editor.getSelection().addChangeListener (this); | |||
| } | |||
| ~Base() | |||
| { | |||
| editor.getSelection().removeChangeListener (this); | |||
| } | |||
| //============================================================================== | |||
| void valueTreePropertyChanged (ValueTree& tree, const Identifier& property) {} | |||
| void valueTreeParentChanged (ValueTree& tree) {} | |||
| void valueTreeChildrenChanged (ValueTree& tree) {} | |||
| const String getUniqueName() const | |||
| { | |||
| jassert (getItemId().isNotEmpty()); | |||
| return getItemId(); | |||
| } | |||
| //============================================================================== | |||
| void itemOpennessChanged (bool isNowOpen) | |||
| { | |||
| if (isNowOpen) | |||
| refreshSubItems(); | |||
| } | |||
| virtual void refreshSubItems() = 0; | |||
| virtual const String getItemId() const = 0; | |||
| void setName (const String& newName) {} | |||
| void itemClicked (const MouseEvent& e) {} | |||
| void itemDoubleClicked (const MouseEvent& e) {} | |||
| void itemSelectionChanged (bool isNowSelected) | |||
| { | |||
| if (isNowSelected) | |||
| editor.getSelection().addToSelection (getItemId()); | |||
| else | |||
| editor.getSelection().deselect (getItemId()); | |||
| } | |||
| void changeListenerCallback (void*) { updateSelectionState(); } | |||
| void updateSelectionState() | |||
| { | |||
| setSelected (editor.getSelection().isSelected (getItemId()), false); | |||
| } | |||
| bool isMissing() { return false; } | |||
| const String getTooltip() { return String::empty; } | |||
| protected: | |||
| ComponentEditor& editor; | |||
| }; | |||
| static const String getDragIdFor (ComponentEditor& editor) | |||
| { | |||
| return componentItemDragType + editor.getDocument().getUniqueId(); | |||
| } | |||
| //============================================================================== | |||
| class ComponentItem : public Base | |||
| { | |||
| public: | |||
| ComponentItem (ComponentEditor& editor_, const ValueTree& componentState_) | |||
| : Base (editor_), componentState (componentState_) | |||
| { | |||
| componentState.addListener (this); | |||
| updateSelectionState(); | |||
| } | |||
| ~ComponentItem() | |||
| { | |||
| componentState.removeListener (this); | |||
| } | |||
| //============================================================================== | |||
| const String getItemId() const { return componentState [ComponentDocument::idProperty]; } | |||
| bool mightContainSubItems() { return false; } | |||
| void refreshSubItems() {} | |||
| const String getDisplayName() const { return getRenamingName(); } | |||
| const String getRenamingName() const { return componentState [ComponentDocument::memberNameProperty]; } | |||
| const Image getIcon() const { return LookAndFeel::getDefaultLookAndFeel().getDefaultDocumentFileImage(); } | |||
| const String getDragSourceDescription() { return getDragIdFor (editor); } | |||
| void valueTreePropertyChanged (ValueTree& tree, const Identifier& property) | |||
| { | |||
| if (property == ComponentDocument::memberNameProperty) | |||
| repaintItem(); | |||
| } | |||
| ValueTree componentState; | |||
| }; | |||
| //============================================================================== | |||
| class ComponentList : public Base | |||
| { | |||
| public: | |||
| ComponentList (ComponentEditor& editor_) | |||
| : Base (editor_), componentTree (editor.getDocument().getComponentGroup()) | |||
| { | |||
| componentTree.addListener (this); | |||
| } | |||
| ~ComponentList() | |||
| { | |||
| componentTree.removeListener (this); | |||
| } | |||
| //============================================================================== | |||
| const String getItemId() const { return "components"; } | |||
| bool mightContainSubItems() { return true; } | |||
| void valueTreeChildrenChanged (ValueTree& tree) | |||
| { | |||
| if (tree == componentTree) | |||
| refreshSubItems(); | |||
| } | |||
| void refreshSubItems() | |||
| { | |||
| ScopedPointer <XmlElement> oldOpenness (getOpennessState()); | |||
| clearSubItems(); | |||
| ComponentDocument& doc = editor.getDocument(); | |||
| const int num = doc.getNumComponents(); | |||
| for (int i = 0; i < num; ++i) | |||
| addSubItem (new ComponentItem (editor, doc.getComponent (i))); | |||
| if (oldOpenness != 0) | |||
| restoreOpennessState (*oldOpenness); | |||
| } | |||
| const String getDisplayName() const { return getRenamingName(); } | |||
| const String getRenamingName() const { return "Components"; } | |||
| const Image getIcon() const { return LookAndFeel::getDefaultLookAndFeel().getDefaultFolderImage(); } | |||
| const String getDragSourceDescription() { return String::empty; } | |||
| bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent) | |||
| { | |||
| return sourceDescription == getDragIdFor (editor) | |||
| && editor.getSelection().getNumSelected() > 0; | |||
| } | |||
| void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex) | |||
| { | |||
| if (editor.getSelection().getNumSelected() > 0) | |||
| { | |||
| TreeView* tree = getOwnerView(); | |||
| const ScopedPointer <XmlElement> oldOpenness (tree->getOpennessState (false)); | |||
| Array <ValueTree> selectedComps; | |||
| // scan the source tree rather than look at the selection manager, because it might | |||
| // be from a different editor, and the order needs to be correct. | |||
| getAllSelectedNodesInTree (sourceComponent, selectedComps); | |||
| insertItems (selectedComps, insertIndex); | |||
| if (oldOpenness != 0) | |||
| tree->restoreOpennessState (*oldOpenness); | |||
| } | |||
| } | |||
| static void getAllSelectedNodesInTree (Component* componentInTree, Array<ValueTree>& selectedComps) | |||
| { | |||
| TreeView* tree = dynamic_cast <TreeView*> (componentInTree); | |||
| if (tree == 0) | |||
| tree = componentInTree->findParentComponentOfClass ((TreeView*) 0); | |||
| if (tree != 0) | |||
| { | |||
| const int numSelected = tree->getNumSelectedItems(); | |||
| for (int i = 0; i < numSelected; ++i) | |||
| { | |||
| const ComponentItem* const item = dynamic_cast <ComponentItem*> (tree->getSelectedItem (i)); | |||
| if (item != 0) | |||
| selectedComps.add (item->componentState); | |||
| } | |||
| } | |||
| } | |||
| void insertItems (Array <ValueTree>& comps, int insertIndex) | |||
| { | |||
| int i; | |||
| for (i = comps.size(); --i >= 0;) | |||
| if (componentTree == comps.getReference(i) || componentTree.isAChildOf (comps.getReference(i))) // Check for recursion. | |||
| return; | |||
| // Don't include any nodes that are children of other selected nodes.. | |||
| for (i = comps.size(); --i >= 0;) | |||
| { | |||
| const ValueTree& n = comps.getReference(i); | |||
| for (int j = comps.size(); --j >= 0;) | |||
| { | |||
| if (j != i && n.isAChildOf (comps.getReference(j))) | |||
| { | |||
| comps.remove (i); | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| // Remove and re-insert them one at a time.. | |||
| for (i = 0; i < comps.size(); ++i) | |||
| { | |||
| ValueTree& n = comps.getReference(i); | |||
| if (n.getParent() == componentTree && componentTree.indexOf (n) < insertIndex) | |||
| --insertIndex; | |||
| if (n.getParent() == componentTree) | |||
| { | |||
| n.getParent().moveChild (componentTree.indexOf (n), insertIndex++, editor.getDocument().getUndoManager()); | |||
| } | |||
| else | |||
| { | |||
| n.getParent().removeChild (n, editor.getDocument().getUndoManager()); | |||
| componentTree.addChild (n, insertIndex++, editor.getDocument().getUndoManager()); | |||
| } | |||
| } | |||
| } | |||
| private: | |||
| ValueTree componentTree; | |||
| }; | |||
| //============================================================================== | |||
| class MarkerItem : public Base | |||
| { | |||
| public: | |||
| MarkerItem (ComponentEditor& editor_, const ValueTree& markerState_) | |||
| : Base (editor_), markerState (markerState_) | |||
| { | |||
| markerState.addListener (this); | |||
| updateSelectionState(); | |||
| } | |||
| ~MarkerItem() | |||
| { | |||
| markerState.removeListener (this); | |||
| } | |||
| //============================================================================== | |||
| const String getItemId() const { return markerState [Ids::id_]; } | |||
| bool mightContainSubItems() { return false; } | |||
| void refreshSubItems() {} | |||
| const String getDisplayName() const { return getRenamingName(); } | |||
| const String getRenamingName() const { return markerState [MarkerListBase::getMarkerNameProperty()]; } | |||
| const Image getIcon() const { return LookAndFeel::getDefaultLookAndFeel().getDefaultDocumentFileImage(); } | |||
| const String getDragSourceDescription() { return String::empty; } | |||
| void valueTreePropertyChanged (ValueTree& tree, const Identifier& property) | |||
| { | |||
| if (property == MarkerListBase::getMarkerNameProperty()) | |||
| repaintItem(); | |||
| } | |||
| private: | |||
| ValueTree markerState; | |||
| }; | |||
| //============================================================================== | |||
| class MarkerList : public Base | |||
| { | |||
| public: | |||
| MarkerList (ComponentEditor& editor_, bool isX_) | |||
| : Base (editor_), markerList (editor_.getDocument().getMarkerList (isX_).getGroup()), isX (isX_) | |||
| { | |||
| markerList.addListener (this); | |||
| } | |||
| ~MarkerList() | |||
| { | |||
| markerList.removeListener (this); | |||
| } | |||
| //============================================================================== | |||
| const String getItemId() const { return isX ? "markersX" : "markersY"; } | |||
| bool mightContainSubItems() { return true; } | |||
| void valueTreeChildrenChanged (ValueTree&) | |||
| { | |||
| refreshSubItems(); | |||
| } | |||
| void refreshSubItems() | |||
| { | |||
| ScopedPointer <XmlElement> oldOpenness (getOpennessState()); | |||
| clearSubItems(); | |||
| ComponentDocument::MarkerList& markers = editor.getDocument().getMarkerList (isX); | |||
| const int num = markers.size(); | |||
| for (int i = 0; i < num; ++i) | |||
| addSubItem (new MarkerItem (editor, markers.getMarker (i))); | |||
| if (oldOpenness != 0) | |||
| restoreOpennessState (*oldOpenness); | |||
| } | |||
| const String getDisplayName() const { return getRenamingName(); } | |||
| const String getRenamingName() const { return isX ? "Markers (X-axis)" : "Markers (Y-axis)"; } | |||
| const Image getIcon() const { return LookAndFeel::getDefaultLookAndFeel().getDefaultFolderImage(); } | |||
| const String getDragSourceDescription() { return String::empty; } | |||
| private: | |||
| ValueTree markerList; | |||
| bool isX; | |||
| }; | |||
| //============================================================================== | |||
| class Root : public Base | |||
| { | |||
| public: | |||
| Root (ComponentEditor& editor_) : Base (editor_) {} | |||
| ~Root() {} | |||
| //============================================================================== | |||
| const String getItemId() const { return "root"; } | |||
| bool mightContainSubItems() { return true; } | |||
| void refreshSubItems() | |||
| { | |||
| ScopedPointer <XmlElement> oldOpenness (getOpennessState()); | |||
| clearSubItems(); | |||
| addSubItem (new ComponentList (editor)); | |||
| addSubItem (new MarkerList (editor, true)); | |||
| addSubItem (new MarkerList (editor, false)); | |||
| if (oldOpenness != 0) | |||
| restoreOpennessState (*oldOpenness); | |||
| } | |||
| const String getDisplayName() const { return getRenamingName(); } | |||
| const String getRenamingName() const { return editor.getDocument().getClassName().toString(); } | |||
| const Image getIcon() const { return LookAndFeel::getDefaultLookAndFeel().getDefaultFolderImage(); } | |||
| const String getDragSourceDescription() { return String::empty; } | |||
| }; | |||
| } | |||
| #endif // __JUCE_COMPONENTEDITORTREEVIEW_H_F3B95A41__ | |||
| @@ -1,143 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #include "../../jucer_Headers.h" | |||
| #include "jucer_ComponentViewer.h" | |||
| //============================================================================== | |||
| ComponentViewer::ComponentViewer (OpenDocumentManager::Document* document_, Project* project_, ComponentDocument* componentDocument_) | |||
| : document (document_), project (project_), componentDocument (componentDocument_) | |||
| { | |||
| OpenDocumentManager::getInstance()->addListener (this); | |||
| documentRoot = componentDocument->getRoot(); | |||
| documentRoot.addListener (this); | |||
| handleAsyncUpdate(); | |||
| } | |||
| ComponentViewer::~ComponentViewer() | |||
| { | |||
| OpenDocumentManager::getInstance()->removeListener (this); | |||
| deleteAllChildren(); | |||
| } | |||
| void ComponentViewer::documentAboutToClose (OpenDocumentManager::Document* closingDoc) | |||
| { | |||
| if (document == closingDoc) | |||
| { | |||
| componentDocument = 0; | |||
| document = 0; | |||
| layoutManager = 0; | |||
| documentRoot = ValueTree::invalid; | |||
| triggerAsyncUpdate(); | |||
| handleUpdateNowIfNeeded(); | |||
| // xxx | |||
| } | |||
| } | |||
| void ComponentViewer::paint (Graphics& g) | |||
| { | |||
| if (componentDocument == 0) | |||
| drawComponentPlaceholder (g, getWidth(), getHeight(), "(Not a valid Jucer component)"); | |||
| else | |||
| g.fillAll (background); | |||
| } | |||
| void ComponentViewer::handleAsyncUpdate() | |||
| { | |||
| deleteAllChildren(); | |||
| layoutManager = 0; | |||
| background = Colours::transparentBlack; | |||
| if (componentDocument != 0) | |||
| { | |||
| background = Colour::fromString (componentDocument->getBackgroundColour().toString()); | |||
| if (layoutManager == 0) | |||
| layoutManager = new RelativeRectangleLayoutManager (this); | |||
| int i; | |||
| for (i = getNumChildComponents(); --i >= 0;) | |||
| { | |||
| Component* c = getChildComponent (i); | |||
| if (! componentDocument->containsComponent (c)) | |||
| delete c; | |||
| } | |||
| { | |||
| Array <Component*> componentsInOrder; | |||
| const int num = componentDocument->getNumComponents(); | |||
| for (i = 0; i < num; ++i) | |||
| { | |||
| const ValueTree v (componentDocument->getComponent (i)); | |||
| Component* c = componentDocument->findComponentForState (this, v); | |||
| if (c == 0) | |||
| addAndMakeVisible (c = componentDocument->createComponent (i)); | |||
| else | |||
| componentDocument->updateComponent (c); | |||
| componentsInOrder.add (c); | |||
| layoutManager->setComponentBounds (c, v [ComponentDocument::memberNameProperty], | |||
| componentDocument->getCoordsFor (v)); | |||
| } | |||
| // Make sure the z-order is correct.. | |||
| if (num > 0) | |||
| { | |||
| componentsInOrder.getLast()->toFront (false); | |||
| for (i = num - 1; --i >= 0;) | |||
| componentsInOrder.getUnchecked(i)->toBehind (componentsInOrder.getUnchecked (i + 1)); | |||
| } | |||
| } | |||
| setSize (componentDocument->getCanvasWidth().getValue(), | |||
| componentDocument->getCanvasHeight().getValue()); | |||
| for (i = 0; i < componentDocument->getMarkerListX().size(); ++i) | |||
| { | |||
| const ValueTree marker (componentDocument->getMarkerListX().getMarker (i)); | |||
| layoutManager->setMarker (componentDocument->getMarkerListX().getName (marker), | |||
| componentDocument->getMarkerListX().getCoordinate (marker)); | |||
| } | |||
| for (i = 0; i < componentDocument->getMarkerListY().size(); ++i) | |||
| { | |||
| const ValueTree marker (componentDocument->getMarkerListY().getMarker (i)); | |||
| layoutManager->setMarker (componentDocument->getMarkerListY().getName (marker), | |||
| componentDocument->getMarkerListY().getCoordinate (marker)); | |||
| } | |||
| } | |||
| repaint(); | |||
| } | |||
| @@ -1,73 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_COMPONENTVIEWER_H_56080E43__ | |||
| #define __JUCER_COMPONENTVIEWER_H_56080E43__ | |||
| #include "../jucer_DocumentEditorComponent.h" | |||
| #include "../../model/Component/jucer_ComponentDocument.h" | |||
| //============================================================================== | |||
| /** | |||
| */ | |||
| class ComponentViewer : public Component, | |||
| public OpenDocumentManager::DocumentCloseListener, | |||
| public AsyncUpdater, | |||
| public ValueTree::Listener | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| ComponentViewer (OpenDocumentManager::Document* document, Project* project, | |||
| ComponentDocument* componentDocument); | |||
| ~ComponentViewer(); | |||
| //============================================================================== | |||
| void paint (Graphics& g); | |||
| void documentAboutToClose (OpenDocumentManager::Document* closingDoc); | |||
| void valueTreePropertyChanged (ValueTree&, const Identifier&) { triggerAsyncUpdate(); } | |||
| void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) { triggerAsyncUpdate(); } | |||
| void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) {} | |||
| void handleAsyncUpdate(); | |||
| private: | |||
| //============================================================================== | |||
| Project* project; | |||
| OpenDocumentManager::Document* document; | |||
| ComponentDocument* componentDocument; | |||
| ValueTree documentRoot; | |||
| ScopedPointer<RelativeRectangleLayoutManager> layoutManager; | |||
| Colour background; | |||
| ComponentViewer (const ComponentViewer&); | |||
| ComponentViewer& operator= (const ComponentViewer&); | |||
| }; | |||
| #endif // __JUCER_COMPONENTVIEWER_H_56080E43__ | |||
| @@ -1,305 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #include "../../jucer_Headers.h" | |||
| #include "../../model/Drawable/jucer_DrawableDocument.h" | |||
| #include "../jucer_JucerTreeViewBase.h" | |||
| #include "../Editor Base/jucer_EditorPanel.h" | |||
| #include "../Editor Base/jucer_EditorCanvas.h" | |||
| #include "../Editor Base/jucer_EditorDragOperation.h" | |||
| #include "jucer_DrawableEditor.h" | |||
| #include "jucer_DrawableEditorCanvas.h" | |||
| #include "jucer_DrawableEditorTreeView.h" | |||
| #include "jucer_DrawableEditorToolbar.h" | |||
| //============================================================================== | |||
| class DrawableEditor::Panel : public EditorPanelBase | |||
| { | |||
| public: | |||
| Panel (DrawableEditor& editor_) | |||
| : toolbarFactory (editor_), | |||
| editor (editor_) | |||
| { | |||
| } | |||
| ~Panel() | |||
| { | |||
| shutdown(); | |||
| } | |||
| void createCanvas() | |||
| { | |||
| initialise (new DrawableEditorCanvas (editor), toolbarFactory, | |||
| new DrawableTreeViewItem (editor, editor.getDocument().getRootDrawableNode().getState())); | |||
| } | |||
| SelectedItemSet<String>& getSelection() | |||
| { | |||
| return editor.getSelection(); | |||
| } | |||
| void getSelectedItemProperties (Array<PropertyComponent*>& props) | |||
| { | |||
| editor.getDocument().createItemProperties (props, editor.getSelectedIds()); | |||
| } | |||
| private: | |||
| DrawableEditorToolbarFactory toolbarFactory; | |||
| DrawableEditor& editor; | |||
| }; | |||
| //============================================================================== | |||
| DrawableEditor::DrawableEditor (OpenDocumentManager::Document* document_, | |||
| Project* project_, | |||
| DrawableDocument* drawableDocument_) | |||
| : DocumentEditorComponent (document_), | |||
| project (project_), | |||
| drawableDocument (drawableDocument_) | |||
| { | |||
| jassert (drawableDocument_ != 0); | |||
| setOpaque (true); | |||
| addAndMakeVisible (panel = new Panel (*this)); | |||
| panel->createCanvas(); | |||
| } | |||
| DrawableEditor::~DrawableEditor() | |||
| { | |||
| deleteAllChildren(); | |||
| } | |||
| void DrawableEditor::paint (Graphics& g) | |||
| { | |||
| g.fillAll (Colours::white); | |||
| } | |||
| void DrawableEditor::resized() | |||
| { | |||
| panel->setBounds (getLocalBounds()); | |||
| } | |||
| //============================================================================== | |||
| const StringArray DrawableEditor::getSelectedIds() const | |||
| { | |||
| StringArray ids; | |||
| const int num = selection.getNumSelected(); | |||
| for (int i = 0; i < num; ++i) | |||
| ids.add (selection.getSelectedItem(i)); | |||
| return ids; | |||
| } | |||
| void DrawableEditor::deleteSelection() | |||
| { | |||
| getUndoManager()->beginNewTransaction(); | |||
| DrawableComposite::ValueTreeWrapper root (getDocument().getRootDrawableNode()); | |||
| const StringArray ids (getSelectedIds()); | |||
| for (int i = ids.size(); --i >= 0;) | |||
| { | |||
| const ValueTree v (root.getDrawableWithId (ids[i], false)); | |||
| root.removeDrawable (v, getUndoManager()); | |||
| } | |||
| getUndoManager()->beginNewTransaction(); | |||
| } | |||
| void DrawableEditor::selectionToFront() | |||
| { | |||
| getUndoManager()->beginNewTransaction(); | |||
| DrawableComposite::ValueTreeWrapper root (getDocument().getRootDrawableNode()); | |||
| int index = 0; | |||
| for (int i = root.getNumDrawables(); --i >= 0;) | |||
| { | |||
| const Drawable::ValueTreeWrapperBase d (root.getDrawableState (index)); | |||
| if (getSelection().isSelected (d.getID())) | |||
| root.moveDrawableOrder (index, -1, getUndoManager()); | |||
| else | |||
| ++index; | |||
| } | |||
| getUndoManager()->beginNewTransaction(); | |||
| } | |||
| void DrawableEditor::selectionToBack() | |||
| { | |||
| getUndoManager()->beginNewTransaction(); | |||
| DrawableComposite::ValueTreeWrapper root (getDocument().getRootDrawableNode()); | |||
| int index = root.getNumDrawables() - 1; | |||
| for (int i = root.getNumDrawables(); --i >= 0;) | |||
| { | |||
| const Drawable::ValueTreeWrapperBase d (root.getDrawableState (index)); | |||
| if (getSelection().isSelected (d.getID())) | |||
| root.moveDrawableOrder (index, 0, getUndoManager()); | |||
| else | |||
| --index; | |||
| } | |||
| getUndoManager()->beginNewTransaction(); | |||
| } | |||
| void DrawableEditor::showNewShapeMenu (Component* componentToAttachTo) | |||
| { | |||
| PopupMenu m; | |||
| getDocument().addNewItemMenuItems (m); | |||
| const int r = m.showAt (componentToAttachTo); | |||
| ValueTree newItem (getDocument().performNewItemMenuItem (r)); | |||
| if (newItem.isValid()) | |||
| getSelection().selectOnly (Drawable::ValueTreeWrapperBase (newItem).getID()); | |||
| } | |||
| //============================================================================== | |||
| void DrawableEditor::getAllCommands (Array <CommandID>& commands) | |||
| { | |||
| DocumentEditorComponent::getAllCommands (commands); | |||
| const CommandID ids[] = { CommandIDs::undo, | |||
| CommandIDs::redo, | |||
| CommandIDs::toFront, | |||
| CommandIDs::toBack, | |||
| CommandIDs::showOrHideProperties, | |||
| CommandIDs::showOrHideTree, | |||
| CommandIDs::showOrHideMarkers, | |||
| CommandIDs::toggleSnapping, | |||
| StandardApplicationCommandIDs::del }; | |||
| commands.addArray (ids, numElementsInArray (ids)); | |||
| } | |||
| void DrawableEditor::getCommandInfo (CommandID commandID, ApplicationCommandInfo& result) | |||
| { | |||
| result.setActive (document != 0); | |||
| switch (commandID) | |||
| { | |||
| case CommandIDs::undo: | |||
| result.setInfo ("Undo", "Undoes the last change", CommandCategories::general, 0); | |||
| result.defaultKeypresses.add (KeyPress ('z', ModifierKeys::commandModifier, 0)); | |||
| break; | |||
| case CommandIDs::redo: | |||
| result.setInfo ("Redo", "Redoes the last change", CommandCategories::general, 0); | |||
| result.defaultKeypresses.add (KeyPress ('z', ModifierKeys::shiftModifier | ModifierKeys::commandModifier, 0)); | |||
| result.defaultKeypresses.add (KeyPress ('y', ModifierKeys::commandModifier, 0)); | |||
| break; | |||
| case CommandIDs::toFront: | |||
| result.setInfo ("Bring to Front", "Brings the selected items to the front", CommandCategories::editing, 0); | |||
| break; | |||
| case CommandIDs::toBack: | |||
| result.setInfo ("Send to Back", "Moves the selected items to the back", CommandCategories::editing, 0); | |||
| break; | |||
| case CommandIDs::showOrHideProperties: | |||
| result.setInfo ("Show/Hide Tree", "Shows or hides the component tree view", CommandCategories::editing, 0); | |||
| result.setTicked (panel != 0 && panel->arePropertiesVisible()); | |||
| break; | |||
| case CommandIDs::showOrHideTree: | |||
| result.setInfo ("Show/Hide Properties", "Shows or hides the component properties panel", CommandCategories::editing, 0); | |||
| result.setTicked (panel != 0 && panel->isTreeVisible()); | |||
| break; | |||
| case CommandIDs::showOrHideMarkers: | |||
| result.setInfo ("Show/Hide Markers", "Shows or hides the markers", CommandCategories::editing, 0); | |||
| result.setTicked (panel != 0 && panel->areMarkersVisible()); | |||
| break; | |||
| case CommandIDs::toggleSnapping: | |||
| result.setInfo ("Toggle snapping", "Turns object snapping on or off", CommandCategories::editing, 0); | |||
| result.setTicked (panel != 0 && panel->isSnappingEnabled()); | |||
| break; | |||
| case StandardApplicationCommandIDs::del: | |||
| result.setInfo ("Delete", String::empty, CommandCategories::general, 0); | |||
| result.defaultKeypresses.add (KeyPress (KeyPress::deleteKey, 0, 0)); | |||
| result.defaultKeypresses.add (KeyPress (KeyPress::backspaceKey, 0, 0)); | |||
| break; | |||
| default: | |||
| DocumentEditorComponent::getCommandInfo (commandID, result); | |||
| break; | |||
| } | |||
| } | |||
| bool DrawableEditor::perform (const InvocationInfo& info) | |||
| { | |||
| switch (info.commandID) | |||
| { | |||
| case CommandIDs::undo: | |||
| getUndoManager()->beginNewTransaction(); | |||
| getUndoManager()->undo(); | |||
| return true; | |||
| case CommandIDs::redo: | |||
| getUndoManager()->beginNewTransaction(); | |||
| getUndoManager()->redo(); | |||
| return true; | |||
| case CommandIDs::toFront: | |||
| selectionToFront(); | |||
| return true; | |||
| case CommandIDs::toBack: | |||
| selectionToBack(); | |||
| return true; | |||
| case CommandIDs::showOrHideProperties: | |||
| panel->showOrHideProperties(); | |||
| return true; | |||
| case CommandIDs::showOrHideTree: | |||
| panel->showOrHideTree(); | |||
| return true; | |||
| case CommandIDs::showOrHideMarkers: | |||
| panel->showOrHideMarkers(); | |||
| return true; | |||
| case CommandIDs::toggleSnapping: | |||
| panel->toggleSnapping(); | |||
| return true; | |||
| case StandardApplicationCommandIDs::del: | |||
| deleteSelection(); | |||
| return true; | |||
| default: | |||
| break; | |||
| } | |||
| return DocumentEditorComponent::perform (info); | |||
| } | |||
| @@ -1,80 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_DRAWABLEEDITOR_JUCEHEADER__ | |||
| #define __JUCER_DRAWABLEEDITOR_JUCEHEADER__ | |||
| #include "../jucer_DocumentEditorComponent.h" | |||
| #include "../Editor Base/jucer_EditorCanvas.h" | |||
| class DrawableEditorCanvas; | |||
| //============================================================================== | |||
| /** | |||
| */ | |||
| class DrawableEditor : public DocumentEditorComponent | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| DrawableEditor (OpenDocumentManager::Document* document, | |||
| Project* project, DrawableDocument* drawableDocument); | |||
| ~DrawableEditor(); | |||
| //============================================================================== | |||
| void getAllCommands (Array <CommandID>& commands); | |||
| void getCommandInfo (CommandID commandID, ApplicationCommandInfo& result); | |||
| bool perform (const InvocationInfo& info); | |||
| void paint (Graphics& g); | |||
| void resized(); | |||
| //============================================================================== | |||
| const StringArray getSelectedIds() const; | |||
| void deleteSelection(); | |||
| void selectionToFront(); | |||
| void selectionToBack(); | |||
| void showNewShapeMenu (Component* componentToAttachTo); | |||
| //============================================================================== | |||
| DrawableDocument& getDocument() const { return *drawableDocument; } | |||
| UndoManager* getUndoManager() const { return getDocument().getUndoManager(); } | |||
| EditorCanvasBase::SelectedItems& getSelection() { return selection; } | |||
| class Panel; | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| Project* project; | |||
| DrawableDocument* drawableDocument; | |||
| EditorCanvasBase::SelectedItems selection; | |||
| Panel* panel; | |||
| }; | |||
| #endif // __JUCER_DRAWABLEEDITOR_JUCEHEADER__ | |||
| @@ -1,768 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_DRAWABLEOBJECTCOMPONENT_JUCEHEADER__ | |||
| #define __JUCER_DRAWABLEOBJECTCOMPONENT_JUCEHEADER__ | |||
| #include "jucer_DrawableEditor.h" | |||
| #include "../../model/Drawable/jucer_DrawableTypeHandler.h" | |||
| //============================================================================== | |||
| class DrawableEditorCanvas : public EditorCanvasBase, | |||
| public FileDragAndDropTarget, | |||
| public Timer | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| DrawableEditorCanvas (DrawableEditor& editor_) | |||
| : editor (editor_), | |||
| backgroundColour (Colour::greyLevel (0.95f)), | |||
| contentAreaColour (Colours::white) | |||
| { | |||
| initialise(); | |||
| getDocument().getRoot().addListener (this); | |||
| } | |||
| ~DrawableEditorCanvas() | |||
| { | |||
| getDocument().getRoot().removeListener (this); | |||
| shutdown(); | |||
| } | |||
| //============================================================================== | |||
| UndoManager& getUndoManager() throw() { return *getDocument().getUndoManager(); } | |||
| DrawableEditor& getEditor() throw() { return editor; } | |||
| DrawableDocument& getDocument() throw() { return editor.getDocument(); } | |||
| Component* createComponentHolder() | |||
| { | |||
| return new DrawableComponent (this); | |||
| } | |||
| void documentChanged() | |||
| { | |||
| DrawableDocument& doc = getDocument(); | |||
| if (drawable == 0) | |||
| { | |||
| Drawable* newDrawable = Drawable::createFromValueTree (doc.getRootDrawableNode().getState(), &doc); | |||
| drawable = dynamic_cast <DrawableComposite*> (newDrawable); | |||
| drawable->resetBoundingBoxToContentArea(); | |||
| jassert (drawable != 0); | |||
| getComponentHolder()->repaint(); | |||
| } | |||
| else | |||
| { | |||
| doc.getRootDrawableNode().resetBoundingBoxToContentArea (0); | |||
| const Rectangle<float> damage (drawable->refreshFromValueTree (doc.getRootDrawableNode().getState(), &doc)); | |||
| getComponentHolder()->repaint (objectSpaceToScreenSpace (damage.getSmallestIntegerContainer())); | |||
| } | |||
| startTimer (500); | |||
| } | |||
| void fillBackground (Graphics& g) | |||
| { | |||
| g.fillAll (backgroundColour); | |||
| } | |||
| const Rectangle<int> getCanvasBounds() | |||
| { | |||
| return drawable->getBounds().getSmallestIntegerContainer(); | |||
| } | |||
| void setCanvasBounds (const Rectangle<int>& newBounds) {} | |||
| bool canResizeCanvas() const { return false; } | |||
| const Rectangle<float> getContentArea() const | |||
| { | |||
| return drawable->getContentArea().resolve (drawable->getParent()); | |||
| } | |||
| //============================================================================== | |||
| const ValueTree getObjectState (const String& objectId) | |||
| { | |||
| return getDocument().findDrawableState (objectId, false); | |||
| } | |||
| const SelectedItems::ItemType findObjectIdAt (const Point<int>& position) | |||
| { | |||
| if (drawable != 0) | |||
| { | |||
| for (int i = drawable->getNumDrawables(); --i >= 0;) | |||
| { | |||
| Drawable* d = drawable->getDrawable (i); | |||
| if (d->hitTest ((float) position.getX(), (float) position.getY())) | |||
| return d->getName(); | |||
| } | |||
| } | |||
| return String::empty; | |||
| } | |||
| void showPopupMenu (bool isClickOnSelectedObject) | |||
| { | |||
| PopupMenu m; | |||
| if (isClickOnSelectedObject) | |||
| { | |||
| m.addCommandItem (commandManager, CommandIDs::toFront); | |||
| m.addCommandItem (commandManager, CommandIDs::toBack); | |||
| m.addSeparator(); | |||
| m.addCommandItem (commandManager, StandardApplicationCommandIDs::del); | |||
| const int r = m.show(); | |||
| (void) r; | |||
| } | |||
| else | |||
| { | |||
| editor.showNewShapeMenu (0); | |||
| } | |||
| } | |||
| void objectDoubleClicked (const MouseEvent& e, const ValueTree& state) | |||
| { | |||
| if (state.hasType (DrawablePath::valueTreeType) | |||
| || state.hasType (DrawableImage::valueTreeType) | |||
| || state.hasType (DrawableText::valueTreeType) | |||
| || state.hasType (DrawableComposite::valueTreeType)) | |||
| { | |||
| enableControlPointMode (state); | |||
| } | |||
| else if (state.hasType (DrawableComposite::valueTreeType)) | |||
| { | |||
| // xxx | |||
| } | |||
| } | |||
| bool hasSizeGuides() const { return false; } | |||
| void getObjectPositionDependencies (const ValueTree& state, Array<ValueTree>& deps) | |||
| { | |||
| DrawableDocument& doc = getDocument(); | |||
| DrawableTypeInstance item (doc, state); | |||
| OwnedArray <ControlPoint> points; | |||
| item.getAllControlPoints (points); | |||
| StringArray anchors; | |||
| for (int i = 0; i < points.size(); ++i) | |||
| { | |||
| const RelativePoint p (points.getUnchecked(i)->getPosition()); | |||
| anchors.addIfNotAlreadyThere (p.x.getAnchorName1()); | |||
| anchors.addIfNotAlreadyThere (p.x.getAnchorName2()); | |||
| anchors.addIfNotAlreadyThere (p.y.getAnchorName1()); | |||
| anchors.addIfNotAlreadyThere (p.y.getAnchorName2()); | |||
| } | |||
| for (int i = 0; i < anchors.size(); ++i) | |||
| { | |||
| const String anchor (anchors[i]); | |||
| if (anchor.isNotEmpty() && ! anchor.startsWith ("parent.")) | |||
| { | |||
| const ValueTree v (doc.findDrawableState (anchor.upToFirstOccurrenceOf (".", false, false), false)); | |||
| if (v.isValid()) | |||
| deps.add (v); | |||
| } | |||
| } | |||
| } | |||
| const Rectangle<float> getObjectPositionFloat (const ValueTree& state) | |||
| { | |||
| if (drawable != 0) | |||
| { | |||
| Drawable* d = drawable->getDrawableWithName (Drawable::ValueTreeWrapperBase (state).getID()); | |||
| if (d != 0) | |||
| return d->getBounds(); | |||
| } | |||
| return Rectangle<float>(); | |||
| } | |||
| void setObjectPositionFloat (const ValueTree& state, const Rectangle<float>& newPos) | |||
| { | |||
| if (drawable != 0) | |||
| { | |||
| Drawable* d = drawable->getDrawableWithName (Drawable::ValueTreeWrapperBase (state).getID()); | |||
| if (d != 0) | |||
| { | |||
| d->refreshFromValueTree (state, &getDocument()); | |||
| DrawableTypeInstance di (getDocument(), state); | |||
| di.setBounds (d, newPos); | |||
| } | |||
| } | |||
| } | |||
| const Rectangle<int> getObjectPosition (const ValueTree& state) | |||
| { | |||
| return getObjectPositionFloat (state).getSmallestIntegerContainer(); | |||
| } | |||
| void transformObject (ValueTree& state, const AffineTransform& transform) | |||
| { | |||
| if (drawable != 0) | |||
| { | |||
| Drawable* d = drawable->getDrawableWithName (Drawable::ValueTreeWrapperBase (state).getID()); | |||
| if (d != 0) | |||
| { | |||
| d->refreshFromValueTree (state, &getDocument()); | |||
| DrawableTypeInstance di (getDocument(), state); | |||
| di.applyTransform (d, transform); | |||
| } | |||
| } | |||
| } | |||
| RelativeRectangle getObjectCoords (const ValueTree& state) | |||
| { | |||
| return RelativeRectangle(); | |||
| } | |||
| //============================================================================== | |||
| class ControlPointComponent : public OverlayItemComponent | |||
| { | |||
| public: | |||
| ControlPointComponent (DrawableEditorCanvas* canvas, const ValueTree& drawableState_, int controlPointNum_) | |||
| : OverlayItemComponent (canvas), drawableState (drawableState_), | |||
| controlPointNum (controlPointNum_), isDragging (false), mouseDownResult (false), selected (false), | |||
| sizeNormal (7), sizeOver (11) | |||
| { | |||
| setRepaintsOnMouseActivity (true); | |||
| } | |||
| ~ControlPointComponent() | |||
| { | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| Rectangle<int> r (getLocalBounds()); | |||
| if (! isMouseOverOrDragging()) | |||
| r = r.reduced ((sizeOver - sizeNormal) / 2, (sizeOver - sizeNormal) / 2); | |||
| g.setColour (Colour (selected ? 0xaaaaaaaa : 0xaa333333)); | |||
| g.drawRect (r); | |||
| g.setColour (Colour (selected ? 0xaa000000 : 0x99ffffff)); | |||
| g.fillRect (r.reduced (1, 1)); | |||
| } | |||
| bool hitTest (int x, int y) | |||
| { | |||
| if (isMouseOverOrDragging()) | |||
| return true; | |||
| return getLocalBounds().reduced ((sizeOver - sizeNormal) / 2, (sizeOver - sizeNormal) / 2).contains (x, y); | |||
| } | |||
| void mouseDown (const MouseEvent& e) | |||
| { | |||
| isDragging = false; | |||
| if (e.mods.isPopupMenu()) | |||
| { | |||
| canvas->showPopupMenu (true); | |||
| } | |||
| else | |||
| { | |||
| mouseDownResult = canvas->getSelection().addToSelectionOnMouseDown (selectionId, e.mods); | |||
| } | |||
| } | |||
| void mouseDrag (const MouseEvent& e) | |||
| { | |||
| if (! (isDragging || e.mouseWasClicked() || e.mods.isPopupMenu())) | |||
| { | |||
| canvas->getSelection().addToSelectionOnMouseUp (selectionId, e.mods, true, mouseDownResult); | |||
| isDragging = true; | |||
| canvas->beginDrag (e.withNewPosition (e.getMouseDownPosition()).getEventRelativeTo (getParentComponent()), | |||
| ResizableBorderComponent::Zone (ResizableBorderComponent::Zone::centre), false, Point<float>()); | |||
| } | |||
| if (isDragging) | |||
| { | |||
| canvas->continueDrag (e.getEventRelativeTo (getParentComponent())); | |||
| autoScrollForMouseEvent (e); | |||
| } | |||
| } | |||
| void mouseUp (const MouseEvent& e) | |||
| { | |||
| if (! e.mods.isPopupMenu()) | |||
| { | |||
| if (isDragging) | |||
| canvas->endDrag (e.getEventRelativeTo (getParentComponent())); | |||
| else | |||
| canvas->getSelection().addToSelectionOnMouseUp (selectionId, e.mods, false, mouseDownResult); | |||
| } | |||
| } | |||
| void mouseDoubleClick (const MouseEvent& e) | |||
| { | |||
| } | |||
| class LineComponent : public OverlayItemComponent | |||
| { | |||
| public: | |||
| LineComponent (EditorCanvasBase* canvas) | |||
| : OverlayItemComponent (canvas) | |||
| {} | |||
| ~LineComponent() {} | |||
| void setLine (const Line<float>& newLine) | |||
| { | |||
| if (line != newLine) | |||
| { | |||
| line = newLine; | |||
| setBoundsInTargetSpace (Rectangle<float> (line.getStart(), line.getEnd()) | |||
| .getSmallestIntegerContainer().expanded (2, 2)); | |||
| repaint(); | |||
| } | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| g.setColour (Colours::black.withAlpha (0.6f)); | |||
| g.drawLine (Line<float> (pointToLocalSpace (line.getStart()), | |||
| pointToLocalSpace (line.getEnd())), 1.0f); | |||
| } | |||
| bool hitTest (int, int) | |||
| { | |||
| return false; | |||
| } | |||
| private: | |||
| Line<float> line; | |||
| }; | |||
| void updatePosition (ControlPoint& point, RelativeCoordinate::NamedCoordinateFinder* nameFinder) | |||
| { | |||
| selectionId = point.getID(); | |||
| const Point<float> p (point.getPosition().resolve (nameFinder)); | |||
| setBoundsInTargetSpace (Rectangle<int> (roundToInt (p.getX()) - sizeOver / 2, | |||
| roundToInt (p.getY()) - sizeOver / 2, | |||
| sizeOver, sizeOver)); | |||
| const bool nowSelected = canvas->getSelection().isSelected (selectionId); | |||
| if (selected != nowSelected) | |||
| { | |||
| selected = nowSelected; | |||
| repaint(); | |||
| } | |||
| if (point.hasLine()) | |||
| { | |||
| if (line == 0) | |||
| { | |||
| line = new LineComponent (canvas); | |||
| getParentComponent()->addAndMakeVisible (line, 0); | |||
| } | |||
| line->setLine (Line<float> (p, point.getEndOfLine().resolve (nameFinder))); | |||
| } | |||
| else | |||
| { | |||
| line = 0; | |||
| } | |||
| } | |||
| private: | |||
| ValueTree drawableState; | |||
| int controlPointNum; | |||
| bool isDragging, mouseDownResult, selected; | |||
| String selectionId; | |||
| ScopedPointer <LineComponent> line; | |||
| const int sizeNormal, sizeOver; | |||
| }; | |||
| void updateControlPointComponents (Component* parent, OwnedArray<OverlayItemComponent>& comps) | |||
| { | |||
| if (drawable == 0) | |||
| { | |||
| comps.clear(); | |||
| return; | |||
| } | |||
| DrawableTypeInstance item (getDocument(), controlPointEditingTarget); | |||
| OwnedArray <ControlPoint> points; | |||
| item.getVisibleControlPoints (points, getSelection()); | |||
| Drawable* d = drawable->getDrawableWithName (Drawable::ValueTreeWrapperBase (controlPointEditingTarget).getID()); | |||
| DrawableComposite* parentDrawable = d->getParent(); | |||
| comps.removeRange (points.size(), comps.size()); | |||
| BigInteger requiredIndexes; | |||
| requiredIndexes.setRange (0, points.size(), true); | |||
| for (int i = 0; i < points.size(); ++i) | |||
| { | |||
| ControlPointComponent* c = dynamic_cast <ControlPointComponent*> (comps[i]); | |||
| if (c == 0) | |||
| { | |||
| c = new ControlPointComponent (this, controlPointEditingTarget, i); | |||
| comps.set (i, c); | |||
| parent->addAndMakeVisible (c); | |||
| } | |||
| c->updatePosition (*points.getUnchecked(i), parentDrawable); | |||
| } | |||
| } | |||
| //============================================================================== | |||
| MarkerListBase& getMarkerList (bool isX) | |||
| { | |||
| return getDocument().getMarkerList (isX); | |||
| } | |||
| double limitMarkerPosition (double pos) | |||
| { | |||
| return pos; | |||
| } | |||
| //============================================================================== | |||
| SelectedItems& getSelection() | |||
| { | |||
| return editor.getSelection(); | |||
| } | |||
| void deselectNonDraggableObjects() | |||
| { | |||
| } | |||
| void findLassoItemsInArea (Array <SelectedItems::ItemType>& itemsFound, const Rectangle<int>& area) | |||
| { | |||
| const Rectangle<float> floatArea (area.toFloat()); | |||
| if (drawable != 0) | |||
| { | |||
| if (isControlPointMode()) | |||
| { | |||
| DrawableTypeInstance item (getDocument(), controlPointEditingTarget); | |||
| OwnedArray <ControlPoint> points; | |||
| item.getVisibleControlPoints (points, getSelection()); | |||
| const Rectangle<float> floatArea (area.toFloat()); | |||
| for (int i = 0; i < points.size(); ++i) | |||
| { | |||
| const Point<float> p (points.getUnchecked(i)->getPosition().resolve (drawable)); | |||
| if (floatArea.contains (p)) | |||
| itemsFound.add (points.getUnchecked(i)->getID()); | |||
| } | |||
| } | |||
| else | |||
| { | |||
| for (int i = drawable->getNumDrawables(); --i >= 0;) | |||
| { | |||
| Drawable* d = drawable->getDrawable (i); | |||
| if (d->getBounds().intersects (floatArea)) | |||
| itemsFound.add (d->getName()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| bool isControlPointId (const String& itemId) | |||
| { | |||
| return itemId.containsChar ('/'); | |||
| } | |||
| //============================================================================== | |||
| class ObjectDragOperation : public EditorDragOperation | |||
| { | |||
| public: | |||
| ObjectDragOperation (DrawableEditorCanvas* canvas_, const Point<int>& mousePos, | |||
| Component* snapGuideParentComp_, const ResizableBorderComponent::Zone& zone_, bool isRotating) | |||
| : EditorDragOperation (canvas_, mousePos, snapGuideParentComp_, zone_, isRotating), | |||
| drawableCanvas (canvas_) | |||
| { | |||
| } | |||
| ~ObjectDragOperation() {} | |||
| protected: | |||
| DrawableDocument& getDocument() throw() { return drawableCanvas->getDocument(); } | |||
| void getSnapPointsX (Array<float>& points, bool /*includeCentre*/) { points.add (0.0f); } | |||
| void getSnapPointsY (Array<float>& points, bool /*includeCentre*/) { points.add (0.0f); } | |||
| UndoManager& getUndoManager() { return *getDocument().getUndoManager(); } | |||
| void getObjectDependencies (const ValueTree& state, Array<ValueTree>& deps) | |||
| { | |||
| drawableCanvas->getObjectPositionDependencies (state, deps); | |||
| } | |||
| const Rectangle<float> getObjectPosition (const ValueTree& state) | |||
| { | |||
| return drawableCanvas->getObjectPositionFloat (state); | |||
| } | |||
| void setObjectPosition (ValueTree& state, const Rectangle<float>& newBounds) | |||
| { | |||
| drawableCanvas->setObjectPositionFloat (state, newBounds); | |||
| } | |||
| void transformObject (ValueTree& state, const AffineTransform& transform) | |||
| { | |||
| drawableCanvas->transformObject (state, transform); | |||
| } | |||
| float getMarkerPosition (const ValueTree& marker, bool isX) | |||
| { | |||
| return 0; | |||
| } | |||
| private: | |||
| DrawableEditorCanvas* drawableCanvas; | |||
| }; | |||
| //============================================================================== | |||
| class ControlPointDragOperation : public EditorDragOperation | |||
| { | |||
| public: | |||
| ControlPointDragOperation (DrawableEditorCanvas* canvas_, | |||
| const DrawableTypeInstance& drawableItem_, | |||
| DrawableComposite* drawable_, | |||
| const Point<int>& mousePos, | |||
| Component* snapGuideParentComp_, | |||
| const ResizableBorderComponent::Zone& zone_) | |||
| : EditorDragOperation (canvas_, mousePos, snapGuideParentComp_, zone_, false), | |||
| drawableCanvas (canvas_), drawableItem (drawableItem_), drawable (drawable_) | |||
| { | |||
| drawableItem.getVisibleControlPoints (points, canvas_->getSelection()); | |||
| } | |||
| ~ControlPointDragOperation() {} | |||
| OwnedArray <ControlPoint> points; | |||
| protected: | |||
| DrawableDocument& getDocument() throw() { return drawableCanvas->getDocument(); } | |||
| void getSnapPointsX (Array<float>& points, bool /*includeCentre*/) { points.add (0.0f); } | |||
| void getSnapPointsY (Array<float>& points, bool /*includeCentre*/) { points.add (0.0f); } | |||
| UndoManager& getUndoManager() { return *getDocument().getUndoManager(); } | |||
| void getObjectDependencies (const ValueTree& state, Array<ValueTree>& deps) | |||
| { | |||
| drawableCanvas->getObjectPositionDependencies (drawableItem.getState(), deps); | |||
| } | |||
| const Rectangle<float> getObjectPosition (const ValueTree& state) | |||
| { | |||
| int index = state [Ids::id_]; | |||
| ControlPoint* cp = points[index]; | |||
| if (cp == 0) | |||
| return Rectangle<float>(); | |||
| Point<float> p (cp->getPosition().resolve (drawable)); | |||
| return Rectangle<float> (p, p); | |||
| } | |||
| void setObjectPosition (ValueTree& state, const Rectangle<float>& newBounds) | |||
| { | |||
| int index = state [Ids::id_]; | |||
| ControlPoint* cp = points[index]; | |||
| if (cp != 0) | |||
| { | |||
| RelativePoint p (cp->getPosition()); | |||
| p.moveToAbsolute (newBounds.getPosition(), drawable); | |||
| cp->setPosition (p, getDocument().getUndoManager()); | |||
| } | |||
| } | |||
| void transformObject (ValueTree& state, const AffineTransform& transform) | |||
| { | |||
| } | |||
| float getMarkerPosition (const ValueTree& marker, bool isX) | |||
| { | |||
| return 0; | |||
| } | |||
| private: | |||
| DrawableEditorCanvas* drawableCanvas; | |||
| DrawableTypeInstance drawableItem; | |||
| DrawableComposite* drawable; | |||
| }; | |||
| //============================================================================== | |||
| bool canRotate() const { return true; } | |||
| DragOperation* createDragOperation (const Point<int>& mouseDownPos, Component* snapGuideParentComponent, | |||
| const ResizableBorderComponent::Zone& zone, bool isRotating) | |||
| { | |||
| Array<ValueTree> selected, unselected; | |||
| EditorDragOperation* drag = 0; | |||
| if (isControlPointMode()) | |||
| { | |||
| DrawableTypeInstance item (getDocument(), controlPointEditingTarget); | |||
| ControlPointDragOperation* cpd = new ControlPointDragOperation (this, item, drawable, mouseDownPos, snapGuideParentComponent, zone); | |||
| drag = cpd; | |||
| for (int i = 0; i < cpd->points.size(); ++i) | |||
| { | |||
| const String pointId (cpd->points.getUnchecked(i)->getID()); | |||
| ValueTree v (Ids::controlPoint); | |||
| v.setProperty (Ids::id_, i, 0); | |||
| if (editor.getSelection().isSelected (pointId)) | |||
| selected.add (v); | |||
| else | |||
| unselected.add (v); | |||
| } | |||
| } | |||
| else | |||
| { | |||
| DrawableComposite::ValueTreeWrapper mainGroup (getDocument().getRootDrawableNode()); | |||
| drag = new ObjectDragOperation (this, mouseDownPos, snapGuideParentComponent, zone, isRotating); | |||
| for (int i = mainGroup.getNumDrawables(); --i >= 0;) | |||
| { | |||
| const ValueTree v (mainGroup.getDrawableState (i)); | |||
| if (editor.getSelection().isSelected (v[Drawable::ValueTreeWrapperBase::idProperty])) | |||
| selected.add (v); | |||
| else | |||
| unselected.add (v); | |||
| } | |||
| } | |||
| drag->initialise (selected, unselected); | |||
| return drag; | |||
| } | |||
| void timerCallback() | |||
| { | |||
| stopTimer(); | |||
| if (! Component::isMouseButtonDownAnywhere()) | |||
| getUndoManager().beginNewTransaction(); | |||
| } | |||
| //============================================================================== | |||
| bool isInterestedInFileDrag (const StringArray& files) | |||
| { | |||
| for (int i = files.size(); --i >= 0;) | |||
| if (File (files[i]).hasFileExtension ("svg;jpg;jpeg;gif;png")) | |||
| return true; | |||
| return false; | |||
| } | |||
| void filesDropped (const StringArray& files, int x, int y) | |||
| { | |||
| for (int i = files.size(); --i >= 0;) | |||
| { | |||
| const File f (files[i]); | |||
| if (f.hasFileExtension ("svg")) | |||
| { | |||
| ValueTree newItem (getDocument().insertSVG (f, screenSpaceToObjectSpace (Point<int> (x, y).toFloat()))); | |||
| if (newItem.isValid()) | |||
| getSelection().selectOnly (Drawable::ValueTreeWrapperBase (newItem).getID()); | |||
| } | |||
| else if (f.hasFileExtension ("jpg;jpeg;gif;png")) | |||
| { | |||
| AlertWindow::showMessageBox (AlertWindow::NoIcon, | |||
| "Images", | |||
| "To add an image, first add it to the project, and then insert it into the drawable"); | |||
| } | |||
| } | |||
| } | |||
| //============================================================================== | |||
| class DrawableComponent : public Component | |||
| { | |||
| public: | |||
| DrawableComponent (DrawableEditorCanvas* canvas_) | |||
| : canvas (canvas_) | |||
| { | |||
| } | |||
| ~DrawableComponent() | |||
| { | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| // do not call canvas->handleUpdateNowIfNeeded() here! It resizes the component while we're painting it! | |||
| const Point<int> origin (canvas->getScale().origin); | |||
| g.setOrigin (origin.getX(), origin.getY()); | |||
| g.setColour (canvas->contentAreaColour); | |||
| g.fillRect (canvas->getContentArea().getSmallestIntegerContainer()); | |||
| /* if (origin.getX() > 0) | |||
| { | |||
| g.setColour (Colour::greyLevel (0.87f)); | |||
| g.drawVerticalLine (0, -10000.0f, 10000.0f); | |||
| } | |||
| if (origin.getY() > 0) | |||
| { | |||
| g.setColour (Colour::greyLevel (0.87f)); | |||
| g.drawHorizontalLine (0, -10000.0f, 10000.0f); | |||
| } | |||
| */ | |||
| canvas->drawable->draw (g, 1.0f); | |||
| } | |||
| private: | |||
| DrawableEditorCanvas* canvas; | |||
| DrawableEditor& getEditor() const { return canvas->getEditor(); } | |||
| }; | |||
| ScopedPointer<DrawableComposite> drawable; | |||
| Colour backgroundColour, contentAreaColour; | |||
| private: | |||
| //============================================================================== | |||
| DrawableEditor& editor; | |||
| }; | |||
| #endif // __JUCER_DRAWABLEOBJECTCOMPONENT_JUCEHEADER__ | |||
| @@ -1,126 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_DRAWABLEEDITORTOOLBAR_H_65D23CDD__ | |||
| #define __JUCER_DRAWABLEEDITORTOOLBAR_H_65D23CDD__ | |||
| //============================================================================== | |||
| class DrawableEditorToolbarFactory : public ToolbarItemFactory | |||
| { | |||
| public: | |||
| DrawableEditorToolbarFactory (DrawableEditor& editor_) | |||
| : editor (editor_) | |||
| { | |||
| } | |||
| ~DrawableEditorToolbarFactory() | |||
| { | |||
| } | |||
| //============================================================================== | |||
| enum ToolbarItemIds | |||
| { | |||
| createShape = 1, | |||
| showInfo, | |||
| showTree, | |||
| showOrHideMarkers, | |||
| toggleSnapping | |||
| }; | |||
| void getAllToolbarItemIds (Array <int>& ids) | |||
| { | |||
| ids.add (createShape); | |||
| ids.add (showInfo); | |||
| ids.add (showTree); | |||
| ids.add (showOrHideMarkers); | |||
| ids.add (toggleSnapping); | |||
| ids.add (separatorBarId); | |||
| ids.add (spacerId); | |||
| ids.add (flexibleSpacerId); | |||
| } | |||
| void getDefaultItemSet (Array <int>& ids) | |||
| { | |||
| ids.add (spacerId); | |||
| ids.add (createShape); | |||
| ids.add (flexibleSpacerId); | |||
| ids.add (showOrHideMarkers); | |||
| ids.add (toggleSnapping); | |||
| ids.add (flexibleSpacerId); | |||
| ids.add (showTree); | |||
| ids.add (showInfo); | |||
| ids.add (spacerId); | |||
| } | |||
| ToolbarItemComponent* createItem (int itemId) | |||
| { | |||
| String name; | |||
| int commandId = 0; | |||
| switch (itemId) | |||
| { | |||
| case createShape: return new NewShapeToolbarButton (editor, itemId); | |||
| case showInfo: name = "info"; commandId = CommandIDs::showOrHideProperties; break; | |||
| case showTree: name = "tree"; commandId = CommandIDs::showOrHideTree; break; | |||
| case showOrHideMarkers: name = "markers"; commandId = CommandIDs::showOrHideMarkers; break; | |||
| case toggleSnapping: name = "snap"; commandId = CommandIDs::toggleSnapping; break; | |||
| default: jassertfalse; return 0; | |||
| } | |||
| JucerToolbarButton* b = new JucerToolbarButton (itemId, name); | |||
| b->setCommandToTrigger (commandManager, commandId, true); | |||
| return b; | |||
| } | |||
| //============================================================================== | |||
| class NewShapeToolbarButton : public JucerToolbarButton | |||
| { | |||
| public: | |||
| NewShapeToolbarButton (DrawableEditor& editor_, int itemId_) | |||
| : JucerToolbarButton (itemId_, "create..."), editor (editor_) | |||
| { | |||
| setTriggeredOnMouseDown (true); | |||
| } | |||
| void clicked() | |||
| { | |||
| editor.showNewShapeMenu (this); | |||
| } | |||
| private: | |||
| DrawableEditor& editor; | |||
| }; | |||
| private: | |||
| DrawableEditor& editor; | |||
| DrawableEditorToolbarFactory (const DrawableEditorToolbarFactory&); | |||
| DrawableEditorToolbarFactory& operator= (const DrawableEditorToolbarFactory&); | |||
| }; | |||
| #endif // __JUCER_DRAWABLEEDITORTOOLBAR_H_65D23CDD__ | |||
| @@ -1,306 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_DRAWABLETREEVIEWITEM_JUCEHEADER__ | |||
| #define __JUCER_DRAWABLETREEVIEWITEM_JUCEHEADER__ | |||
| //============================================================================== | |||
| /** | |||
| */ | |||
| class DrawableTreeViewItem : public JucerTreeViewBase, | |||
| public ValueTree::Listener, | |||
| public ChangeListener, | |||
| public AsyncUpdater | |||
| { | |||
| public: | |||
| DrawableTreeViewItem (DrawableEditor& editor_, const ValueTree& drawableRoot) | |||
| : editor (editor_), node (drawableRoot), typeName (drawableRoot.getType().toString()) | |||
| { | |||
| node.getState().addListener (this); | |||
| editor.getSelection().addChangeListener (this); | |||
| } | |||
| ~DrawableTreeViewItem() | |||
| { | |||
| editor.getSelection().removeChangeListener (this); | |||
| node.getState().removeListener (this); | |||
| } | |||
| //============================================================================== | |||
| void valueTreePropertyChanged (ValueTree& tree, const Identifier& property) | |||
| { | |||
| if (property == Drawable::ValueTreeWrapperBase::idProperty) | |||
| repaintItem(); | |||
| } | |||
| void valueTreeChildrenChanged (ValueTree& tree) | |||
| { | |||
| if (tree == node.getState() || tree.isAChildOf (node.getState())) | |||
| triggerAsyncUpdate(); | |||
| } | |||
| void valueTreeParentChanged (ValueTree& tree) | |||
| { | |||
| } | |||
| void handleAsyncUpdate() | |||
| { | |||
| refreshSubItems(); | |||
| } | |||
| //============================================================================== | |||
| // TreeViewItem stuff.. | |||
| bool mightContainSubItems() | |||
| { | |||
| return node.getState().getType() == DrawableComposite::valueTreeType; | |||
| } | |||
| const String getUniqueName() const | |||
| { | |||
| jassert (node.getID().isNotEmpty()); | |||
| return node.getID(); | |||
| } | |||
| void itemOpennessChanged (bool isNowOpen) | |||
| { | |||
| if (isNowOpen) | |||
| refreshSubItems(); | |||
| } | |||
| void refreshSubItems() | |||
| { | |||
| if (node.getState().getType() == DrawableComposite::valueTreeType) | |||
| { | |||
| ScopedPointer <XmlElement> oldOpenness (getOpennessState()); | |||
| clearSubItems(); | |||
| DrawableComposite::ValueTreeWrapper composite (node.getState()); | |||
| for (int i = 0; i < composite.getNumDrawables(); ++i) | |||
| { | |||
| ValueTree subNode (composite.getDrawableState (i)); | |||
| DrawableTreeViewItem* const item = new DrawableTreeViewItem (editor, subNode); | |||
| addSubItem (item); | |||
| } | |||
| if (oldOpenness != 0) | |||
| restoreOpennessState (*oldOpenness); | |||
| editor.getSelection().changed(); | |||
| } | |||
| } | |||
| const String getDisplayName() const | |||
| { | |||
| const String name (getRenamingName()); | |||
| return typeName + (name.isEmpty() ? String::empty | |||
| : (" \"" + name + "\"")); | |||
| } | |||
| const String getRenamingName() const | |||
| { | |||
| return node.getID(); | |||
| } | |||
| void setName (const String& newName) | |||
| { | |||
| } | |||
| bool isMissing() { return false; } | |||
| const Image getIcon() const | |||
| { | |||
| return LookAndFeel::getDefaultLookAndFeel().getDefaultDocumentFileImage(); | |||
| } | |||
| void itemClicked (const MouseEvent& e) | |||
| { | |||
| } | |||
| void itemDoubleClicked (const MouseEvent& e) | |||
| { | |||
| } | |||
| void itemSelectionChanged (bool isNowSelected) | |||
| { | |||
| const String objectId (node.getID()); | |||
| if (isNowSelected) | |||
| editor.getSelection().addToSelection (objectId); | |||
| else | |||
| editor.getSelection().deselect (objectId); | |||
| } | |||
| void changeListenerCallback (void*) | |||
| { | |||
| setSelected (editor.getSelection().isSelected (node.getID()), false); | |||
| } | |||
| const String getTooltip() | |||
| { | |||
| return String::empty; | |||
| } | |||
| static const String getDragIdFor (DrawableEditor& editor) | |||
| { | |||
| return drawableItemDragType + editor.getDocument().getUniqueId(); | |||
| } | |||
| const String getDragSourceDescription() | |||
| { | |||
| return getDragIdFor (editor); | |||
| } | |||
| //============================================================================== | |||
| // Drag-and-drop stuff.. | |||
| bool isInterestedInFileDrag (const StringArray& files) | |||
| { | |||
| return false; | |||
| } | |||
| void filesDropped (const StringArray& files, int insertIndex) | |||
| { | |||
| } | |||
| bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent) | |||
| { | |||
| return node.getState().getType() == DrawableComposite::valueTreeType | |||
| && sourceDescription == getDragIdFor (editor) | |||
| && editor.getSelection().getNumSelected() > 0; | |||
| } | |||
| void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex) | |||
| { | |||
| if (editor.getSelection().getNumSelected() > 0) | |||
| { | |||
| TreeView* tree = getOwnerView(); | |||
| const ScopedPointer <XmlElement> oldOpenness (tree->getOpennessState (false)); | |||
| Array <ValueTree> selectedComps; | |||
| // scan the source tree rather than look at the selection manager, because it might | |||
| // be from a different editor, and the order needs to be correct. | |||
| getAllSelectedNodesInTree (sourceComponent, selectedComps); | |||
| insertItems (selectedComps, insertIndex); | |||
| if (oldOpenness != 0) | |||
| tree->restoreOpennessState (*oldOpenness); | |||
| } | |||
| } | |||
| static void getAllSelectedNodesInTree (Component* componentInTree, Array<ValueTree>& selectedItems) | |||
| { | |||
| TreeView* tree = dynamic_cast <TreeView*> (componentInTree); | |||
| if (tree == 0) | |||
| tree = componentInTree->findParentComponentOfClass ((TreeView*) 0); | |||
| if (tree != 0) | |||
| { | |||
| const int numSelected = tree->getNumSelectedItems(); | |||
| for (int i = 0; i < numSelected; ++i) | |||
| { | |||
| DrawableTreeViewItem* const item = dynamic_cast <DrawableTreeViewItem*> (tree->getSelectedItem (i)); | |||
| if (item != 0) | |||
| selectedItems.add (item->node.getState()); | |||
| } | |||
| } | |||
| } | |||
| void insertItems (Array <ValueTree>& items, int insertIndex) | |||
| { | |||
| DrawableComposite::ValueTreeWrapper composite (node.getState()); | |||
| int i; | |||
| for (i = items.size(); --i >= 0;) | |||
| if (node.getState() == items.getReference(i) || composite.getState().isAChildOf (items.getReference(i))) // Check for recursion. | |||
| return; | |||
| // Don't include any nodes that are children of other selected nodes.. | |||
| for (i = items.size(); --i >= 0;) | |||
| { | |||
| const ValueTree& n = items.getReference(i); | |||
| for (int j = items.size(); --j >= 0;) | |||
| { | |||
| if (j != i && n.isAChildOf (items.getReference(j))) | |||
| { | |||
| items.remove (i); | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| // Remove and re-insert them one at a time.. | |||
| for (i = 0; i < items.size(); ++i) | |||
| { | |||
| ValueTree& n = items.getReference(i); | |||
| int index = composite.indexOfDrawable (n); | |||
| if (index >= 0 && index < insertIndex) | |||
| --insertIndex; | |||
| if (index >= 0) | |||
| { | |||
| composite.moveDrawableOrder (index, insertIndex++, editor.getDocument().getUndoManager()); | |||
| } | |||
| else | |||
| { | |||
| n.getParent().removeChild (n, editor.getDocument().getUndoManager()); | |||
| composite.addDrawable (n, insertIndex++, editor.getDocument().getUndoManager()); | |||
| } | |||
| } | |||
| } | |||
| //============================================================================== | |||
| void showRenameBox() | |||
| { | |||
| } | |||
| // Text editor listener for renaming.. | |||
| void textEditorTextChanged (TextEditor& textEditor) {} | |||
| void textEditorReturnKeyPressed (TextEditor& textEditor) { textEditor.exitModalState (1); } | |||
| void textEditorEscapeKeyPressed (TextEditor& textEditor) { textEditor.exitModalState (0); } | |||
| void textEditorFocusLost (TextEditor& textEditor) { textEditor.exitModalState (0); } | |||
| //============================================================================== | |||
| DrawableEditor& editor; | |||
| Drawable::ValueTreeWrapperBase node; | |||
| private: | |||
| String typeName; | |||
| DrawableEditor* getEditor() const | |||
| { | |||
| return getOwnerView()->findParentComponentOfClass ((DrawableEditor*) 0); | |||
| } | |||
| }; | |||
| #endif // __JUCER_DRAWABLETREEVIEWITEM_JUCEHEADER__ | |||
| @@ -1,902 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #include "../../jucer_Headers.h" | |||
| #include "../../utility/jucer_TickIterator.h" | |||
| #include "jucer_EditorCanvas.h" | |||
| #include "jucer_EditorPanel.h" | |||
| //============================================================================== | |||
| class EditorCanvasBase::ResizeFrame : public EditorCanvasBase::OverlayItemComponent | |||
| { | |||
| public: | |||
| ResizeFrame (EditorCanvasBase* canvas_, const String& objectId_, const ValueTree& objectState_) | |||
| : OverlayItemComponent (canvas_), | |||
| objectState (objectState_), | |||
| objectId (objectId_), | |||
| borderThickness (4), | |||
| isDragging (false), | |||
| isRotating (false), | |||
| canRotate (canvas_->canRotate()) | |||
| { | |||
| jassert (objectState.isValid()); | |||
| } | |||
| ~ResizeFrame() | |||
| { | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| if (! canvas->isRotating()) | |||
| { | |||
| g.setColour (resizableBorderColour); | |||
| g.drawRect (0, 0, getWidth(), getHeight(), borderThickness); | |||
| g.fillRect (rotateArea); | |||
| } | |||
| } | |||
| void mouseEnter (const MouseEvent& e) { updateDragZone (e.getPosition()); } | |||
| void mouseExit (const MouseEvent& e) { updateDragZone (e.getPosition()); } | |||
| void mouseMove (const MouseEvent& e) { updateDragZone (e.getPosition()); } | |||
| void mouseDown (const MouseEvent& e) | |||
| { | |||
| updateDragZone (e.getPosition()); | |||
| isDragging = false; | |||
| if (e.mods.isPopupMenu()) | |||
| { | |||
| canvas->showPopupMenu (true); | |||
| } | |||
| } | |||
| void mouseDrag (const MouseEvent& e) | |||
| { | |||
| if (! (isDragging || e.mods.isPopupMenu() || e.mouseWasClicked())) | |||
| { | |||
| isDragging = true; | |||
| bool isRotating = rotateArea.contains (e.getMouseDownPosition()); | |||
| canvas->beginDrag (e.withNewPosition (e.getMouseDownPosition()), | |||
| dragZone, isRotating, canvas->getObjectPosition (objectState).getCentre().toFloat()); | |||
| if (! isRotating) | |||
| canvas->showSizeGuides(); | |||
| repaint(); | |||
| } | |||
| if (isDragging) | |||
| { | |||
| canvas->continueDrag (e); | |||
| autoScrollForMouseEvent (e); | |||
| } | |||
| } | |||
| void mouseUp (const MouseEvent& e) | |||
| { | |||
| if (isDragging || isRotating) | |||
| { | |||
| isRotating = false; | |||
| canvas->hideSizeGuides(); | |||
| canvas->endDrag (e); | |||
| updateDragZone (e.getPosition()); | |||
| repaint(); | |||
| } | |||
| } | |||
| void mouseDoubleClick (const MouseEvent& e) | |||
| { | |||
| canvas->objectDoubleClicked (e, objectState); | |||
| } | |||
| bool hitTest (int x, int y) | |||
| { | |||
| if (ModifierKeys::getCurrentModifiers().isAnyModifierKeyDown()) | |||
| return rotateArea.contains (x, y) || ! getCentreArea().contains (x, y); | |||
| return true; | |||
| } | |||
| bool updatePosition() | |||
| { | |||
| if (! objectState.getParent().isValid()) | |||
| return false; | |||
| const Rectangle<int> bounds (canvas->getObjectPosition (objectState)); | |||
| setBoundsInTargetSpace (bounds.expanded (borderThickness, borderThickness)); | |||
| if (canRotate) | |||
| rotateArea = Rectangle<int> (2, 2, 10, 10); | |||
| int i; | |||
| for (i = sizeGuides.size(); --i >= 0;) | |||
| { | |||
| sizeGuides.getUnchecked(i)->setVisible (isVisible()); | |||
| sizeGuides.getUnchecked(i)->updatePosition (bounds); | |||
| } | |||
| return true; | |||
| } | |||
| const String& getTargetObjectID() const { return objectId; } | |||
| //============================================================================== | |||
| class SizeGuideComponent : public OverlayItemComponent, | |||
| public ComponentListener | |||
| { | |||
| public: | |||
| enum Type { left, right, top, bottom }; | |||
| //============================================================================== | |||
| SizeGuideComponent (EditorCanvasBase* canvas_, const ValueTree& state_, Type type_) | |||
| : OverlayItemComponent (canvas_), state (state_), type (type_) | |||
| { | |||
| setAlwaysOnTop (true); | |||
| canvas->addAndMakeVisible (this); | |||
| setInterceptsMouseClicks (false, false); | |||
| } | |||
| //============================================================================== | |||
| void paint (Graphics& g) | |||
| { | |||
| const float dashes[] = { 4.0f, 3.0f }; | |||
| g.setColour (resizableBorderColour); | |||
| g.drawDashedLine (0.5f, 0.5f, getWidth() - 0.5f, getHeight() - 0.5f, dashes, 2, 1.0f); | |||
| } | |||
| //============================================================================== | |||
| void updatePosition (const Rectangle<int>& bounds) | |||
| { | |||
| RelativeRectangle coords (canvas->getObjectCoords (state)); | |||
| RelativeCoordinate coord; | |||
| Rectangle<int> r; | |||
| switch (type) | |||
| { | |||
| case left: coord = coords.left; r.setBounds (bounds.getX(), 0, 1, bounds.getY()); break; | |||
| case right: coord = coords.right; r.setBounds (bounds.getRight(), 0, 1, bounds.getY()); break; | |||
| case top: coord = coords.top; r.setBounds (0, bounds.getY(), bounds.getX(), 1); break; | |||
| case bottom: coord = coords.bottom; r.setBounds (0, bounds.getBottom(), bounds.getX(), 1); break; | |||
| default: jassertfalse; break; | |||
| } | |||
| setBoundsInTargetSpace (r); | |||
| label.update (getParentComponent(), coord.toString(), Colours::darkgrey, getX(), getY(), type != left, type != top); | |||
| } | |||
| private: | |||
| ValueTree state; | |||
| Type type; | |||
| FloatingLabelComponent label; | |||
| }; | |||
| void showSizeGuides() | |||
| { | |||
| if (sizeGuides.size() == 0 && canvas->hasSizeGuides()) | |||
| { | |||
| sizeGuides.add (new SizeGuideComponent (canvas, objectState, SizeGuideComponent::left)); | |||
| sizeGuides.add (new SizeGuideComponent (canvas, objectState, SizeGuideComponent::right)); | |||
| sizeGuides.add (new SizeGuideComponent (canvas, objectState, SizeGuideComponent::top)); | |||
| sizeGuides.add (new SizeGuideComponent (canvas, objectState, SizeGuideComponent::bottom)); | |||
| } | |||
| } | |||
| void hideSizeGuides() | |||
| { | |||
| sizeGuides.clear(); | |||
| } | |||
| private: | |||
| ValueTree objectState; | |||
| String objectId; | |||
| ResizableBorderComponent::Zone dragZone; | |||
| const int borderThickness; | |||
| OwnedArray <SizeGuideComponent> sizeGuides; | |||
| Rectangle<int> rotateArea; | |||
| bool isDragging, canRotate, isRotating; | |||
| const Rectangle<int> getCentreArea() const | |||
| { | |||
| return getLocalBounds().reduced (borderThickness, borderThickness); | |||
| } | |||
| void updateDragZone (const Point<int>& p) | |||
| { | |||
| ResizableBorderComponent::Zone newZone | |||
| = ResizableBorderComponent::Zone::fromPositionOnBorder (getLocalBounds(), | |||
| BorderSize (borderThickness), p); | |||
| if (dragZone != newZone) | |||
| { | |||
| dragZone = newZone; | |||
| setMouseCursor (newZone.getMouseCursor()); | |||
| } | |||
| } | |||
| }; | |||
| //============================================================================== | |||
| class EditorCanvasBase::OverlayComponent : public Component, | |||
| public LassoSource <SelectedItems::ItemType>, | |||
| public ChangeListener | |||
| { | |||
| public: | |||
| OverlayComponent (EditorCanvasBase* canvas_) | |||
| : canvas (canvas_) | |||
| { | |||
| setWantsKeyboardFocus (true); | |||
| getSelection().addChangeListener (this); | |||
| } | |||
| ~OverlayComponent() | |||
| { | |||
| getSelection().removeChangeListener (this); | |||
| lasso = 0; | |||
| resizers.clear(); | |||
| controlPoints.clear(); | |||
| deleteAllChildren(); | |||
| } | |||
| //============================================================================== | |||
| void mouseDown (const MouseEvent& e) | |||
| { | |||
| lasso = 0; | |||
| mouseDownCompUID = SelectedItems::ItemType(); | |||
| isDraggingClickedComp = false; | |||
| const MouseEvent e2 (e.getEventRelativeTo (canvas->getComponentHolder())); | |||
| const SelectedItems::ItemType underMouse (canvas->findObjectIdAt (canvas->screenSpaceToObjectSpace (e2.getPosition()))); | |||
| if (e.mods.isPopupMenu()) | |||
| { | |||
| if (underMouse.isNotEmpty() && ! getSelection().isSelected (underMouse)) | |||
| { | |||
| canvas->enableResizingMode(); | |||
| getSelection().selectOnly (underMouse); | |||
| } | |||
| canvas->showPopupMenu (underMouse.isNotEmpty()); | |||
| } | |||
| else | |||
| { | |||
| if (underMouse.isEmpty() || e.mods.isAltDown()) | |||
| { | |||
| canvas->deselectNonDraggableObjects(); | |||
| addAndMakeVisible (lasso = new LassoComponent <SelectedItems::ItemType>()); | |||
| lasso->beginLasso (e, this); | |||
| } | |||
| else | |||
| { | |||
| mouseDownCompUID = underMouse; | |||
| canvas->deselectNonDraggableObjects(); | |||
| canvas->enableResizingMode(); | |||
| mouseDownResult = getSelection().addToSelectionOnMouseDown (mouseDownCompUID, e.mods); | |||
| updateResizeFrames(); | |||
| hideSizeGuides(); | |||
| showSizeGuides(); | |||
| } | |||
| } | |||
| } | |||
| void mouseDrag (const MouseEvent& e) | |||
| { | |||
| if (lasso != 0) | |||
| { | |||
| lasso->dragLasso (e); | |||
| } | |||
| else | |||
| { | |||
| if ((! isDraggingClickedComp) | |||
| && mouseDownCompUID.isNotEmpty() | |||
| && (! e.mouseWasClicked()) | |||
| && (! e.mods.isPopupMenu()) | |||
| && e.getDistanceFromDragStart() > 7) // whenever this drag occurs, it's selecting the object | |||
| // and beginning a drag, so allow for more wobble than | |||
| // when when dragging an already-selected object | |||
| { | |||
| isDraggingClickedComp = true; | |||
| canvas->enableResizingMode(); | |||
| getSelection().addToSelectionOnMouseUp (mouseDownCompUID, e.mods, true, mouseDownResult); | |||
| canvas->beginDrag (e.withNewPosition (e.getMouseDownPosition()), | |||
| ResizableBorderComponent::Zone (ResizableBorderComponent::Zone::centre), | |||
| false, Point<float>()); | |||
| } | |||
| if (isDraggingClickedComp) | |||
| { | |||
| canvas->continueDrag (e); | |||
| showSizeGuides(); | |||
| } | |||
| } | |||
| autoScrollForMouseEvent (e); | |||
| } | |||
| void mouseUp (const MouseEvent& e) | |||
| { | |||
| hideSizeGuides(); | |||
| if (lasso != 0) | |||
| { | |||
| lasso->endLasso(); | |||
| lasso = 0; | |||
| if (e.mouseWasClicked()) | |||
| getSelection().deselectAll(); | |||
| } | |||
| else if (! e.mods.isPopupMenu()) | |||
| { | |||
| if (! isDraggingClickedComp) | |||
| getSelection().addToSelectionOnMouseUp (mouseDownCompUID, e.mods, ! e.mouseWasClicked(), mouseDownResult); | |||
| } | |||
| canvas->endDrag (e); | |||
| } | |||
| void mouseDoubleClick (const MouseEvent& e) | |||
| { | |||
| const MouseEvent e2 (e.getEventRelativeTo (canvas->getComponentHolder())); | |||
| const SelectedItems::ItemType underMouse (canvas->findObjectIdAt (canvas->screenSpaceToObjectSpace (e2.getPosition()))); | |||
| if (underMouse.isNotEmpty()) | |||
| { | |||
| const ValueTree state (canvas->getObjectState (underMouse)); | |||
| canvas->objectDoubleClicked (e2, state); | |||
| } | |||
| } | |||
| void findLassoItemsInArea (Array <SelectedItems::ItemType>& itemsFound, const Rectangle<int>& area) | |||
| { | |||
| const Rectangle<int> sourceArea (area + relativePositionToOtherComponent (canvas->getComponentHolder(), Point<int>())); | |||
| canvas->findLassoItemsInArea (itemsFound, canvas->screenSpaceToObjectSpace (sourceArea)); | |||
| } | |||
| SelectedItems& getSelection() { return canvas->getSelection(); } | |||
| SelectedItems& getLassoSelection() { return getSelection(); } | |||
| void changeListenerCallback (void*) | |||
| { | |||
| update(); | |||
| } | |||
| void modifierKeysChanged (const ModifierKeys&) | |||
| { | |||
| Desktop::getInstance().getMainMouseSource().triggerFakeMove(); | |||
| } | |||
| void showSizeGuides() | |||
| { | |||
| if (canvas->hasSizeGuides()) | |||
| { | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| { | |||
| ResizeFrame* resizer = dynamic_cast <ResizeFrame*> (getChildComponent(i)); | |||
| if (resizer != 0) | |||
| resizer->showSizeGuides(); | |||
| } | |||
| } | |||
| } | |||
| void hideSizeGuides() | |||
| { | |||
| if (canvas->hasSizeGuides()) | |||
| { | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| { | |||
| ResizeFrame* resizer = dynamic_cast <ResizeFrame*> (getChildComponent(i)); | |||
| if (resizer != 0) | |||
| resizer->hideSizeGuides(); | |||
| } | |||
| } | |||
| } | |||
| void update() | |||
| { | |||
| updateResizeFrames(); | |||
| updateControlPoints(); | |||
| } | |||
| private: | |||
| //============================================================================== | |||
| EditorCanvasBase* canvas; | |||
| ScopedPointer <LassoComponent <SelectedItems::ItemType> > lasso; | |||
| bool mouseDownResult, isDraggingClickedComp; | |||
| SelectedItems::ItemType mouseDownCompUID; | |||
| OwnedArray <ResizeFrame> resizers; | |||
| OwnedArray <OverlayItemComponent> controlPoints; | |||
| void updateResizeFrames() | |||
| { | |||
| if (! canvas->isResizingMode()) | |||
| { | |||
| resizers.clear(); | |||
| return; | |||
| } | |||
| SelectedItems& selection = getSelection(); | |||
| StringArray requiredIds; | |||
| const int num = selection.getNumSelected(); | |||
| int i; | |||
| for (i = 0; i < num; ++i) | |||
| requiredIds.add (selection.getSelectedItem(i)); | |||
| for (i = resizers.size(); --i >= 0;) | |||
| { | |||
| ResizeFrame* resizer = resizers.getUnchecked(i); | |||
| const int index = requiredIds.indexOf (resizer->getTargetObjectID()); | |||
| if (index >= 0) | |||
| { | |||
| if (resizer->updatePosition()) | |||
| { | |||
| requiredIds.remove (index); | |||
| } | |||
| else | |||
| { | |||
| resizers.remove (i); | |||
| canvas->getSelection().deselect (requiredIds[i]); | |||
| } | |||
| } | |||
| else | |||
| { | |||
| resizers.remove (i); | |||
| } | |||
| } | |||
| for (i = requiredIds.size(); --i >= 0;) | |||
| { | |||
| const ValueTree state (canvas->getObjectState (requiredIds[i])); | |||
| if (state.isValid()) // (the id may be a marker) | |||
| { | |||
| ResizeFrame* frame = new ResizeFrame (canvas, requiredIds[i], state); | |||
| resizers.add (frame); | |||
| addAndMakeVisible (frame); | |||
| frame->updatePosition(); | |||
| } | |||
| } | |||
| } | |||
| void updateControlPoints() | |||
| { | |||
| if (! canvas->isControlPointMode()) | |||
| { | |||
| controlPoints.clear(); | |||
| return; | |||
| } | |||
| canvas->updateControlPointComponents (this, controlPoints); | |||
| } | |||
| }; | |||
| //============================================================================== | |||
| class EditorCanvasBase::DocumentResizeFrame : public Component | |||
| { | |||
| public: | |||
| DocumentResizeFrame (EditorCanvasBase* canvas_) | |||
| : canvas (canvas_), resizerThickness (4) | |||
| { | |||
| } | |||
| ~DocumentResizeFrame() | |||
| { | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| const Rectangle<int> content (getContentArea()); | |||
| g.setColour (Colour::greyLevel (0.1f).withAlpha (0.3f)); | |||
| g.drawRect (content.expanded (1, 1), 1); | |||
| const int bottomGap = getHeight() - content.getBottom(); | |||
| g.setFont (bottomGap - 5.0f); | |||
| g.setColour (Colour::greyLevel (0.9f)); | |||
| g.drawText (String (content.getWidth()) + " x " + String (content.getHeight()), | |||
| 0, 0, jmax (content.getRight(), jmin (60, getWidth())), getHeight(), Justification::bottomRight, false); | |||
| } | |||
| void mouseMove (const MouseEvent& e) | |||
| { | |||
| updateDragZone (e.getPosition()); | |||
| } | |||
| void mouseDown (const MouseEvent& e) | |||
| { | |||
| updateDragZone (e.getPosition()); | |||
| dragStartBounds = canvas->getCanvasBounds(); | |||
| canvas->showSizeGuides(); | |||
| } | |||
| void mouseDrag (const MouseEvent& e) | |||
| { | |||
| Rectangle<int> newBounds (dragStartBounds); | |||
| if (dragZone.isDraggingRightEdge()) | |||
| newBounds.setWidth (jmax (1, newBounds.getWidth() + e.getDistanceFromDragStartX())); | |||
| if (dragZone.isDraggingBottomEdge()) | |||
| newBounds.setHeight (jmax (1, newBounds.getHeight() + e.getDistanceFromDragStartY())); | |||
| canvas->setCanvasBounds (newBounds); | |||
| } | |||
| void mouseUp (const MouseEvent& e) | |||
| { | |||
| canvas->hideSizeGuides(); | |||
| updateDragZone (e.getPosition()); | |||
| } | |||
| void updateDragZone (const Point<int>& p) | |||
| { | |||
| ResizableBorderComponent::Zone newZone | |||
| = ResizableBorderComponent::Zone::fromPositionOnBorder (getContentArea().expanded (resizerThickness, resizerThickness), | |||
| BorderSize (0, 0, resizerThickness, resizerThickness), p); | |||
| if (dragZone != newZone) | |||
| { | |||
| dragZone = newZone; | |||
| setMouseCursor (newZone.getMouseCursor()); | |||
| } | |||
| } | |||
| bool hitTest (int x, int y) | |||
| { | |||
| if (! canvas->canResizeCanvas()) | |||
| return false; | |||
| const Rectangle<int> content (getContentArea()); | |||
| return (x >= content.getRight() || y >= content.getBottom()) | |||
| && (! content.contains (x, y)) | |||
| && content.expanded (resizerThickness, resizerThickness).contains (x, y); | |||
| } | |||
| private: | |||
| EditorCanvasBase* canvas; | |||
| ResizableBorderComponent::Zone dragZone; | |||
| Rectangle<int> dragStartBounds; | |||
| const int resizerThickness; | |||
| const Rectangle<int> getContentArea() const { return canvas->getContentArea(); } | |||
| }; | |||
| //============================================================================== | |||
| EditorCanvasBase::EditorCanvasBase() | |||
| : border (8, 8, 14, 14) | |||
| { | |||
| //setOpaque (true); | |||
| trimCanvasTimer.owner = this; | |||
| addChildComponent (&spacebarDragOverlay); | |||
| } | |||
| EditorCanvasBase::~EditorCanvasBase() | |||
| { | |||
| jassert (overlay == 0); | |||
| } | |||
| void EditorCanvasBase::initialise() | |||
| { | |||
| addAndMakeVisible (componentHolder = createComponentHolder()); | |||
| addAndMakeVisible (overlay = new OverlayComponent (this)); | |||
| if (canResizeCanvas()) | |||
| overlay->addAndMakeVisible (resizeFrame = new DocumentResizeFrame (this)); | |||
| handleAsyncUpdate(); | |||
| } | |||
| void EditorCanvasBase::shutdown() | |||
| { | |||
| dragger = 0; | |||
| resizeFrame = 0; | |||
| overlay = 0; | |||
| componentHolder = 0; | |||
| } | |||
| EditorPanelBase* EditorCanvasBase::getPanel() const | |||
| { | |||
| return findParentComponentOfClass ((EditorPanelBase*) 0); | |||
| } | |||
| const Point<int> EditorCanvasBase::screenSpaceToObjectSpace (const Point<int>& p) const | |||
| { | |||
| return p - scale.origin; | |||
| } | |||
| const Point<int> EditorCanvasBase::objectSpaceToScreenSpace (const Point<int>& p) const | |||
| { | |||
| return p + scale.origin; | |||
| } | |||
| const Point<float> EditorCanvasBase::screenSpaceToObjectSpace (const Point<float>& p) const | |||
| { | |||
| return p - scale.origin.toFloat(); | |||
| } | |||
| const Point<float> EditorCanvasBase::objectSpaceToScreenSpace (const Point<float>& p) const | |||
| { | |||
| return p + scale.origin.toFloat(); | |||
| } | |||
| const Rectangle<int> EditorCanvasBase::screenSpaceToObjectSpace (const Rectangle<int>& r) const | |||
| { | |||
| return r - scale.origin; | |||
| } | |||
| const Rectangle<int> EditorCanvasBase::objectSpaceToScreenSpace (const Rectangle<int>& r) const | |||
| { | |||
| return r + scale.origin; | |||
| } | |||
| void EditorCanvasBase::enableResizingMode() | |||
| { | |||
| enableControlPointMode (ValueTree::invalid); | |||
| } | |||
| void EditorCanvasBase::enableControlPointMode (const ValueTree& objectToEdit) | |||
| { | |||
| if (controlPointEditingTarget != objectToEdit) | |||
| { | |||
| controlPointEditingTarget = objectToEdit; | |||
| getSelection().deselectAll(); | |||
| overlay->update(); | |||
| } | |||
| } | |||
| bool EditorCanvasBase::isRotating() const | |||
| { | |||
| return dragger != 0 && dragger->isRotating(); | |||
| } | |||
| //============================================================================== | |||
| void EditorCanvasBase::paint (Graphics& g) | |||
| { | |||
| } | |||
| bool EditorCanvasBase::keyStateChanged (bool) | |||
| { | |||
| return spacebarDragOverlay.updateVisibility(); | |||
| } | |||
| bool EditorCanvasBase::keyPressed (const KeyPress& key) | |||
| { | |||
| return key.isKeyCode (KeyPress::spaceKey); // required to consume the spacebar events and avoid a warning beep | |||
| } | |||
| void EditorCanvasBase::setScale (const Scale& newScale) | |||
| { | |||
| jassertfalse; | |||
| } | |||
| const Rectangle<int> EditorCanvasBase::getContentArea() const | |||
| { | |||
| return border.subtractedFrom (getLocalBounds()); | |||
| } | |||
| //============================================================================== | |||
| void EditorCanvasBase::handleAsyncUpdate() | |||
| { | |||
| documentChanged(); | |||
| updateCanvasArea (false, false); | |||
| EditorPanelBase* panel = getPanel(); | |||
| if (panel != 0) | |||
| panel->updateRulers(); // also updates markers | |||
| overlay->update(); | |||
| } | |||
| void EditorCanvasBase::updateCanvasArea (bool trimIfPossible, bool updateOverlay) | |||
| { | |||
| const Rectangle<int> canvasBounds (getCanvasBounds()); | |||
| if (lastCanvasBounds != canvasBounds || trimIfPossible) | |||
| { | |||
| lastCanvasBounds = canvasBounds; | |||
| if (! canResizeCanvas()) | |||
| { | |||
| Rectangle<int> bounds (getBounds()); | |||
| const Point<int> originInParent (scale.origin + componentHolder->getPosition() + bounds.getPosition()); | |||
| bounds = border.addedTo (canvasBounds) + originInParent; | |||
| if (getParentComponent() != 0) | |||
| bounds = bounds.getUnion (getParentComponent()->getLocalBounds()); | |||
| const Point<int> newOrigin (originInParent - bounds.getPosition() - componentHolder->getPosition()); | |||
| if (scale.origin != newOrigin) | |||
| { | |||
| repaint(); | |||
| scale.origin = newOrigin; | |||
| } | |||
| if (getBounds() != bounds) | |||
| { | |||
| setBounds (bounds); | |||
| if (updateOverlay) | |||
| overlay->update(); | |||
| } | |||
| } | |||
| else if (getWidth() != canvasBounds.getWidth() || getHeight() != canvasBounds.getHeight()) | |||
| { | |||
| setBounds (canvasBounds); | |||
| } | |||
| } | |||
| } | |||
| void EditorCanvasBase::TrimCanvasTimer::timerCallback() | |||
| { | |||
| if (! isMouseButtonDownAnywhere()) | |||
| { | |||
| stopTimer(); | |||
| owner->updateCanvasArea (true, true); | |||
| } | |||
| } | |||
| void EditorCanvasBase::moved() | |||
| { | |||
| trimCanvasTimer.startTimer (500); | |||
| } | |||
| void EditorCanvasBase::resized() | |||
| { | |||
| componentHolder->setBounds (getContentArea()); | |||
| overlay->setBounds (getLocalBounds()); | |||
| if (resizeFrame != 0) | |||
| resizeFrame->setBounds (getLocalBounds()); | |||
| spacebarDragOverlay.setBounds (getLocalBounds()); | |||
| trimCanvasTimer.startTimer (500); | |||
| } | |||
| //============================================================================== | |||
| void EditorCanvasBase::showSizeGuides() { overlay->showSizeGuides(); } | |||
| void EditorCanvasBase::hideSizeGuides() { overlay->hideSizeGuides(); } | |||
| //============================================================================== | |||
| void EditorCanvasBase::beginDrag (const MouseEvent& e, const ResizableBorderComponent::Zone& zone, | |||
| bool isRotating, const Point<float>& rotationCentre) | |||
| { | |||
| dragger = createDragOperation (screenSpaceToObjectSpace (e.getEventRelativeTo (overlay).getPosition()), overlay, zone, isRotating); | |||
| dragger->setRotationCentre (rotationCentre); | |||
| repaint(); | |||
| } | |||
| void EditorCanvasBase::continueDrag (const MouseEvent& e) | |||
| { | |||
| MouseEvent e2 (e.getEventRelativeTo (overlay)); | |||
| if (dragger != 0) | |||
| dragger->drag (e2, screenSpaceToObjectSpace (e2.getPosition())); | |||
| } | |||
| void EditorCanvasBase::endDrag (const MouseEvent& e) | |||
| { | |||
| if (dragger != 0) | |||
| { | |||
| MouseEvent e2 (e.getEventRelativeTo (overlay)); | |||
| dragger->drag (e2, screenSpaceToObjectSpace (e2.getPosition())); | |||
| dragger = 0; | |||
| getUndoManager().beginNewTransaction(); | |||
| repaint(); | |||
| } | |||
| } | |||
| //============================================================================== | |||
| EditorCanvasBase::OverlayItemComponent::OverlayItemComponent (EditorCanvasBase* canvas_) | |||
| : canvas (canvas_) | |||
| { | |||
| } | |||
| EditorCanvasBase::OverlayItemComponent::~OverlayItemComponent() | |||
| { | |||
| } | |||
| void EditorCanvasBase::OverlayItemComponent::setBoundsInTargetSpace (const Rectangle<int>& r) | |||
| { | |||
| setBounds (canvas->objectSpaceToScreenSpace (r) | |||
| + canvas->getComponentHolder()->relativePositionToOtherComponent (getParentComponent(), Point<int>())); | |||
| } | |||
| const Point<float> EditorCanvasBase::OverlayItemComponent::pointToLocalSpace (const Point<float>& p) const | |||
| { | |||
| return canvas->objectSpaceToScreenSpace (p) | |||
| + (canvas->getComponentHolder()->relativePositionToOtherComponent (getParentComponent(), Point<int>()) | |||
| - getPosition()).toFloat(); | |||
| } | |||
| //============================================================================== | |||
| EditorCanvasBase::SpacebarDragOverlay::SpacebarDragOverlay() | |||
| { | |||
| setAlwaysOnTop (true); | |||
| setMouseCursor (MouseCursor::DraggingHandCursor); | |||
| } | |||
| EditorCanvasBase::SpacebarDragOverlay::~SpacebarDragOverlay() | |||
| { | |||
| } | |||
| bool EditorCanvasBase::SpacebarDragOverlay::updateVisibility() | |||
| { | |||
| bool isSpaceDown = KeyPress::isKeyCurrentlyDown (KeyPress::spaceKey); | |||
| if (isSpaceDown == isVisible()) | |||
| return false; | |||
| setVisible (isSpaceDown); | |||
| return true; | |||
| } | |||
| void EditorCanvasBase::SpacebarDragOverlay::paint (Graphics&) | |||
| { | |||
| } | |||
| void EditorCanvasBase::SpacebarDragOverlay::mouseMove (const MouseEvent& e) | |||
| { | |||
| updateVisibility(); | |||
| } | |||
| void EditorCanvasBase::SpacebarDragOverlay::mouseDown (const MouseEvent& e) | |||
| { | |||
| Viewport* vp = findParentComponentOfClass ((Viewport*) 0); | |||
| if (vp != 0) | |||
| dragStart = vp->getViewPosition(); | |||
| } | |||
| void EditorCanvasBase::SpacebarDragOverlay::mouseDrag (const MouseEvent& e) | |||
| { | |||
| Viewport* vp = findParentComponentOfClass ((Viewport*) 0); | |||
| if (vp != 0) | |||
| vp->setViewPosition (dragStart - Point<int> (e.getDistanceFromDragStartX(), | |||
| e.getDistanceFromDragStartY())); | |||
| } | |||
| void EditorCanvasBase::SpacebarDragOverlay::modifierKeysChanged (const ModifierKeys& modifiers) | |||
| { | |||
| } | |||
| //============================================================================== | |||
| EditorCanvasBase::Scale::Scale() | |||
| : scale (1.0) | |||
| { | |||
| } | |||
| @@ -1,220 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_EDITORCANVAS_H_EF886D17__ | |||
| #define __JUCER_EDITORCANVAS_H_EF886D17__ | |||
| #include "../../utility/jucer_MarkerListBase.h" | |||
| class EditorPanelBase; | |||
| //============================================================================== | |||
| class EditorCanvasBase : public Component, | |||
| public ValueTree::Listener, | |||
| public AsyncUpdater | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| EditorCanvasBase(); | |||
| ~EditorCanvasBase(); | |||
| void initialise(); | |||
| void shutdown(); | |||
| //============================================================================== | |||
| typedef SelectedItemSet<String> SelectedItems; | |||
| //============================================================================== | |||
| void paint (Graphics& g); | |||
| void resized(); | |||
| void moved(); | |||
| bool keyStateChanged (bool isKeyDown); | |||
| bool keyPressed (const KeyPress& key); | |||
| const Rectangle<int> getContentArea() const; | |||
| //============================================================================== | |||
| void valueTreePropertyChanged (ValueTree&, const Identifier&) { triggerAsyncUpdate(); } | |||
| void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) { triggerAsyncUpdate(); } | |||
| void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) {} | |||
| //============================================================================== | |||
| void showSizeGuides(); | |||
| void hideSizeGuides(); | |||
| struct Scale | |||
| { | |||
| Scale(); | |||
| Point<int> origin; | |||
| double scale; | |||
| }; | |||
| const Scale& getScale() const throw() { return scale; } | |||
| void setScale (const Scale& newScale); | |||
| //============================================================================== | |||
| virtual UndoManager& getUndoManager() = 0; | |||
| virtual void documentChanged() = 0; | |||
| virtual Component* createComponentHolder() = 0; | |||
| virtual void fillBackground (Graphics& g) = 0; | |||
| virtual const Rectangle<int> getCanvasBounds() = 0; | |||
| virtual void setCanvasBounds (const Rectangle<int>& newBounds) = 0; | |||
| virtual bool canResizeCanvas() const = 0; | |||
| virtual const SelectedItems::ItemType findObjectIdAt (const Point<int>& position) = 0; | |||
| virtual void showPopupMenu (bool isClickOnSelectedObject) = 0; | |||
| virtual void objectDoubleClicked (const MouseEvent& e, const ValueTree& state) = 0; | |||
| virtual const ValueTree getObjectState (const String& objectId) = 0; | |||
| virtual RelativeRectangle getObjectCoords (const ValueTree& state) = 0; | |||
| virtual const Rectangle<int> getObjectPosition (const ValueTree& state) = 0; | |||
| virtual bool hasSizeGuides() const = 0; | |||
| virtual MarkerListBase& getMarkerList (bool isX) = 0; | |||
| virtual double limitMarkerPosition (double pos) = 0; | |||
| virtual SelectedItems& getSelection() = 0; | |||
| virtual void deselectNonDraggableObjects() = 0; | |||
| virtual void findLassoItemsInArea (Array <SelectedItems::ItemType>& itemsFound, const Rectangle<int>& area) = 0; | |||
| //============================================================================== | |||
| class DragOperation | |||
| { | |||
| public: | |||
| DragOperation() {} | |||
| virtual ~DragOperation() {} | |||
| virtual void drag (const MouseEvent& e, const Point<int>& newPos) = 0; | |||
| virtual void setRotationCentre (const Point<float>& rotationCentre) = 0; | |||
| virtual bool isRotating() const = 0; | |||
| }; | |||
| virtual DragOperation* createDragOperation (const Point<int>& mouseDownPos, | |||
| Component* snapGuideParentComponent, | |||
| const ResizableBorderComponent::Zone& zone, | |||
| bool isRotating) = 0; | |||
| virtual bool canRotate() const = 0; | |||
| void beginDrag (const MouseEvent& e, const ResizableBorderComponent::Zone& zone, | |||
| bool isRotating, const Point<float>& rotationCentre); | |||
| void continueDrag (const MouseEvent& e); | |||
| void endDrag (const MouseEvent& e); | |||
| void enableResizingMode(); | |||
| void enableControlPointMode (const ValueTree& objectToEdit); | |||
| bool isResizingMode() const { return ! isControlPointMode(); } | |||
| bool isControlPointMode() const { return controlPointEditingTarget.isValid(); } | |||
| bool isRotating() const; | |||
| //============================================================================== | |||
| Component* getComponentHolder() const { return componentHolder; } | |||
| EditorPanelBase* getPanel() const; | |||
| const Point<int> screenSpaceToObjectSpace (const Point<int>& p) const; | |||
| const Point<float> screenSpaceToObjectSpace (const Point<float>& p) const; | |||
| const Point<int> objectSpaceToScreenSpace (const Point<int>& p) const; | |||
| const Point<float> objectSpaceToScreenSpace (const Point<float>& p) const; | |||
| const Rectangle<int> screenSpaceToObjectSpace (const Rectangle<int>& r) const; | |||
| const Rectangle<int> objectSpaceToScreenSpace (const Rectangle<int>& r) const; | |||
| //============================================================================== | |||
| class OverlayItemComponent : public Component | |||
| { | |||
| public: | |||
| OverlayItemComponent (EditorCanvasBase* canvas_); | |||
| ~OverlayItemComponent(); | |||
| void setBoundsInTargetSpace (const Rectangle<int>& r); | |||
| const Point<float> pointToLocalSpace (const Point<float>& p) const; | |||
| protected: | |||
| EditorCanvasBase* canvas; | |||
| }; | |||
| //============================================================================== | |||
| virtual void updateControlPointComponents (Component* parent, | |||
| OwnedArray<OverlayItemComponent>& existingComps) = 0; | |||
| protected: | |||
| //============================================================================== | |||
| const BorderSize border; | |||
| Scale scale; | |||
| ValueTree controlPointEditingTarget; | |||
| Rectangle<int> lastCanvasBounds; | |||
| friend class OverlayItemComponent; | |||
| class ResizeFrame; | |||
| class MarkerComponent; | |||
| class DocumentResizeFrame; | |||
| class OverlayComponent; | |||
| class SpacebarDragOverlay : public Component | |||
| { | |||
| public: | |||
| SpacebarDragOverlay(); | |||
| ~SpacebarDragOverlay(); | |||
| bool updateVisibility(); | |||
| void paint (Graphics&); | |||
| void mouseMove (const MouseEvent& e); | |||
| void mouseDown (const MouseEvent& e); | |||
| void mouseDrag (const MouseEvent& e); | |||
| void modifierKeysChanged (const ModifierKeys& modifiers); | |||
| private: | |||
| Point<int> dragStart; | |||
| }; | |||
| //============================================================================== | |||
| ScopedPointer<Component> componentHolder; | |||
| ScopedPointer<OverlayComponent> overlay; | |||
| ScopedPointer<DocumentResizeFrame> resizeFrame; | |||
| SpacebarDragOverlay spacebarDragOverlay; | |||
| ScopedPointer<DragOperation> dragger; | |||
| class TrimCanvasTimer : public Timer | |||
| { | |||
| public: | |||
| TrimCanvasTimer() {} | |||
| ~TrimCanvasTimer() {} | |||
| void timerCallback(); | |||
| EditorCanvasBase* owner; | |||
| }; | |||
| friend class TrimCanvasTimer; | |||
| TrimCanvasTimer trimCanvasTimer; | |||
| void handleAsyncUpdate(); | |||
| void updateCanvasArea (bool trimIfPossible, bool updateOverlay); | |||
| }; | |||
| #endif // __JUCER_EDITORCANVAS_H_EF886D17__ | |||
| @@ -1,414 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_EDITORDRAGOPERATION_H_720CD068__ | |||
| #define __JUCER_EDITORDRAGOPERATION_H_720CD068__ | |||
| #include "jucer_EditorCanvas.h" | |||
| //============================================================================== | |||
| class EditorDragOperation : public EditorCanvasBase::DragOperation | |||
| { | |||
| public: | |||
| EditorDragOperation (EditorCanvasBase* canvas_, const Point<int>& mousePos, | |||
| Component* snapGuideParentComp_, const ResizableBorderComponent::Zone& zone_, | |||
| bool rotating_) | |||
| : canvas (canvas_), | |||
| snapGuideParentComp (snapGuideParentComp_), | |||
| zone (zone_), | |||
| mouseDownPos (mousePos), | |||
| rotating (rotating_) | |||
| { | |||
| } | |||
| ~EditorDragOperation() | |||
| { | |||
| } | |||
| void initialise (const Array<ValueTree>& objects, | |||
| const Array<ValueTree>& objectsToSnapTo) | |||
| { | |||
| int i; | |||
| for (i = 0; i < objects.size(); ++i) | |||
| addObjectToList (objects.getReference(i), objects); | |||
| for (i = 0; i < updateList.size(); ++i) | |||
| { | |||
| const Rectangle<float> floatPos (getObjectPosition (updateList.getReference(i))); | |||
| originalPositions.add (floatPos); | |||
| if (zone.isDraggingWholeObject() || zone.isDraggingLeftEdge()) | |||
| verticalSnapPositions.add (SnapLine (floatPos.getX(), floatPos.getY(), floatPos.getBottom())); | |||
| if (zone.isDraggingWholeObject() || (zone.isDraggingLeftEdge() && zone.isDraggingRightEdge())) | |||
| verticalSnapPositions.add (SnapLine ((float) (int) floatPos.getCentreX(), floatPos.getY(), floatPos.getBottom())); | |||
| if (zone.isDraggingWholeObject() || zone.isDraggingRightEdge()) | |||
| verticalSnapPositions.add (SnapLine (floatPos.getRight(), floatPos.getY(), floatPos.getBottom())); | |||
| if (zone.isDraggingWholeObject() || zone.isDraggingTopEdge()) | |||
| horizontalSnapPositions.add (SnapLine (floatPos.getY(), floatPos.getX(), floatPos.getRight())); | |||
| if (zone.isDraggingWholeObject() || (zone.isDraggingTopEdge() && zone.isDraggingBottomEdge())) | |||
| horizontalSnapPositions.add (SnapLine ((float) (int) floatPos.getCentreY(), floatPos.getX(), floatPos.getRight())); | |||
| if (zone.isDraggingWholeObject() || zone.isDraggingBottomEdge()) | |||
| horizontalSnapPositions.add (SnapLine (floatPos.getBottom(), floatPos.getX(), floatPos.getRight())); | |||
| } | |||
| if (isDraggingLeftRight()) | |||
| { | |||
| const float y1 = -100.0f, y2 = 10000.0f; | |||
| { | |||
| Array<float> points; | |||
| getSnapPointsX (points, zone.isDraggingWholeObject() || (zone.isDraggingLeftEdge() && zone.isDraggingRightEdge())); | |||
| for (int i = 0; i < points.size(); ++i) | |||
| verticalSnapTargets.add (SnapLine (points[i], y1, y2)); | |||
| } | |||
| MarkerListBase& markers = canvas->getMarkerList (true); | |||
| for (int i = markers.size(); --i >= 0;) | |||
| verticalSnapTargets.add (SnapLine (getMarkerPosition (markers.getMarker(i), true), y1, y2)); | |||
| } | |||
| if (isDraggingUpDown()) | |||
| { | |||
| const float x1 = -100.0f, x2 = 10000.0f; | |||
| { | |||
| Array<float> points; | |||
| getSnapPointsY (points, zone.isDraggingWholeObject() || (zone.isDraggingTopEdge() && zone.isDraggingBottomEdge())); | |||
| for (int i = 0; i < points.size(); ++i) | |||
| horizontalSnapTargets.add (SnapLine (points[i], x1, x2)); | |||
| } | |||
| MarkerListBase& markers = canvas->getMarkerList (false); | |||
| for (int i = markers.size(); --i >= 0;) | |||
| horizontalSnapTargets.add (SnapLine (getMarkerPosition (markers.getMarker(i), false), x1, x2)); | |||
| } | |||
| for (i = 0; i < objectsToSnapTo.size(); ++i) | |||
| { | |||
| const Rectangle<float> floatPos (getObjectPosition (objectsToSnapTo.getReference (i))); | |||
| if (isDraggingLeftRight()) | |||
| { | |||
| verticalSnapTargets.add (SnapLine (floatPos.getX(), floatPos.getY(), floatPos.getBottom())); | |||
| verticalSnapTargets.add (SnapLine (floatPos.getRight(), floatPos.getY(), floatPos.getBottom())); | |||
| } | |||
| if (zone.isDraggingWholeObject() || (zone.isDraggingLeftEdge() && zone.isDraggingRightEdge())) | |||
| verticalSnapTargets.add (SnapLine ((float) (int) floatPos.getCentreX(), floatPos.getY(), floatPos.getBottom())); | |||
| if (isDraggingUpDown()) | |||
| { | |||
| horizontalSnapTargets.add (SnapLine (floatPos.getY(), floatPos.getX(), floatPos.getRight())); | |||
| horizontalSnapTargets.add (SnapLine (floatPos.getBottom(), floatPos.getX(), floatPos.getRight())); | |||
| } | |||
| if (zone.isDraggingWholeObject() || (zone.isDraggingTopEdge() && zone.isDraggingBottomEdge())) | |||
| horizontalSnapTargets.add (SnapLine ((float) (int) floatPos.getCentreY(), floatPos.getX(), floatPos.getRight())); | |||
| } | |||
| mergeSnapLines (verticalSnapTargets); | |||
| mergeSnapLines (horizontalSnapTargets); | |||
| getUndoManager().beginNewTransaction(); | |||
| } | |||
| void setRotationCentre (const Point<float>& rotationCentre) | |||
| { | |||
| centre = rotationCentre; | |||
| } | |||
| bool isRotating() const | |||
| { | |||
| return rotating; | |||
| } | |||
| //============================================================================== | |||
| struct SnapLine | |||
| { | |||
| SnapLine() : position (0), start (0), end (0) {} | |||
| SnapLine (const float position_, const float start_, const float end_) | |||
| : position (position_), start (start_), end (end_) | |||
| {} | |||
| float position, start, end; | |||
| }; | |||
| //============================================================================== | |||
| class AlignmentHintComponent : public EditorCanvasBase::OverlayItemComponent | |||
| { | |||
| public: | |||
| AlignmentHintComponent (EditorCanvasBase* canvas_, const SnapLine& line_, bool isVertical_, Component* parent) | |||
| : OverlayItemComponent (canvas_), line (line_), isVertical (isVertical_) | |||
| { | |||
| const int extraEndLength = 5; | |||
| setAlwaysOnTop (true); | |||
| parent->addAndMakeVisible (this); | |||
| if (isVertical) | |||
| setBoundsInTargetSpace (Rectangle<int> (roundToInt (line.position), roundToInt (line.start) - extraEndLength, | |||
| 1, roundToInt (line.end - line.start) + extraEndLength * 2)); | |||
| else | |||
| setBoundsInTargetSpace (Rectangle<int> (roundToInt (line.start) - extraEndLength, roundToInt (line.position), | |||
| roundToInt (line.end - line.start) + extraEndLength * 2, 1)); | |||
| } | |||
| bool updatePosition() | |||
| { | |||
| return true; | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| g.fillAll (alignmentMarkerColour); | |||
| } | |||
| private: | |||
| const SnapLine line; | |||
| const bool isVertical; | |||
| AlignmentHintComponent (const AlignmentHintComponent&); | |||
| AlignmentHintComponent& operator= (const AlignmentHintComponent&); | |||
| }; | |||
| //============================================================================== | |||
| void drag (const MouseEvent& e, const Point<int>& newPos) | |||
| { | |||
| getUndoManager().undoCurrentTransactionOnly(); | |||
| if (rotating) | |||
| { | |||
| const float angle = centre.getAngleToPoint (mouseDownPos.toFloat()) - centre.getAngleToPoint (newPos.toFloat()); | |||
| const AffineTransform transform (AffineTransform::rotation (angle, centre.getX(), centre.getY())); | |||
| for (int i = 0; i < updateList.size(); ++i) | |||
| transformObject (updateList.getReference(i), transform); | |||
| } | |||
| else | |||
| { | |||
| // (can't use getOffsetFromDragStart() because of auto-scrolling) | |||
| Point<int> distance (newPos - mouseDownPos); | |||
| if (! isDraggingLeftRight()) | |||
| distance = distance.withX (0); | |||
| if (! isDraggingUpDown()) | |||
| distance = distance.withY (0); | |||
| snapGuides.clear(); | |||
| if (canvas->getPanel()->isSnappingEnabled() != (e.mods.isCommandDown() || e.mods.isCtrlDown())) | |||
| { | |||
| performSnap (verticalSnapTargets, getVerticalSnapPositions (distance), true, distance); | |||
| performSnap (horizontalSnapTargets, getHorizontalSnapPositions (distance), false, distance); | |||
| } | |||
| for (int i = 0; i < updateList.size(); ++i) | |||
| dragItem (updateList.getReference(i), distance, originalPositions.getReference(i)); | |||
| } | |||
| canvas->handleUpdateNowIfNeeded(); | |||
| } | |||
| protected: | |||
| //============================================================================== | |||
| virtual void getSnapPointsX (Array<float>& points, bool includeCentre) = 0; | |||
| virtual void getSnapPointsY (Array<float>& points, bool includeCentre) = 0; | |||
| virtual float getMarkerPosition (const ValueTree& marker, bool isX) = 0; | |||
| virtual void getObjectDependencies (const ValueTree& state, Array<ValueTree>& deps) = 0; | |||
| virtual const Rectangle<float> getObjectPosition (const ValueTree& state) = 0; | |||
| virtual void setObjectPosition (ValueTree& state, const Rectangle<float>& newBounds) = 0; | |||
| virtual void transformObject (ValueTree& state, const AffineTransform& transform) = 0; | |||
| virtual UndoManager& getUndoManager() = 0; | |||
| EditorCanvasBase* canvas; | |||
| private: | |||
| //============================================================================== | |||
| Array <ValueTree> updateList; | |||
| Array <Rectangle<float> > originalPositions; | |||
| Array <SnapLine> verticalSnapPositions, horizontalSnapPositions; | |||
| Array <SnapLine> verticalSnapTargets, horizontalSnapTargets; | |||
| const ResizableBorderComponent::Zone zone; | |||
| OwnedArray<Component> snapGuides; | |||
| Component* snapGuideParentComp; | |||
| Point<int> mouseDownPos; | |||
| Point<float> centre; | |||
| bool rotating; | |||
| void dragItem (ValueTree& v, const Point<int>& distance, const Rectangle<float>& originalPos) | |||
| { | |||
| const Rectangle<float> newBounds (zone.resizeRectangleBy (originalPos, Point<float> ((float) distance.getX(), | |||
| (float) distance.getY()))); | |||
| setObjectPosition (v, newBounds); | |||
| } | |||
| void getCompleteDependencyList (const ValueTree& object, Array <ValueTree>& deps, const Array<ValueTree>& activeObjects) | |||
| { | |||
| Array <ValueTree> d; | |||
| getObjectDependencies (object, d); | |||
| for (int i = 0; i < d.size(); ++i) | |||
| { | |||
| const ValueTree& dep = d.getReference(i); | |||
| if (activeObjects.contains (dep) && ! deps.contains (dep)) | |||
| { | |||
| deps.add (dep); | |||
| getCompleteDependencyList (dep, deps, activeObjects); | |||
| } | |||
| } | |||
| } | |||
| void addObjectToList (const ValueTree& object, const Array<ValueTree>& activeObjects) | |||
| { | |||
| Array <ValueTree> deps; | |||
| getCompleteDependencyList (object, deps, activeObjects); | |||
| int lastIndexInList = updateList.indexOf (object); | |||
| int i; | |||
| for (i = lastIndexInList; --i >= 0;) | |||
| deps.removeValue (updateList.getReference(i)); | |||
| if (deps.size() > 0 || lastIndexInList < 0) | |||
| { | |||
| for (i = 0; i < deps.size(); ++i) | |||
| if (! updateList.contains (deps.getReference(i))) | |||
| updateList.add (deps.getReference(i)); | |||
| updateList.add (object); | |||
| } | |||
| } | |||
| static void mergeSnapLines (Array <SnapLine>& lines) | |||
| { | |||
| for (int i = lines.size(); --i > 0;) | |||
| { | |||
| SnapLine& s1 = lines.getReference(i); | |||
| for (int j = i; --j >= 0;) | |||
| { | |||
| SnapLine& s2 = lines.getReference(j); | |||
| if (s1.position == s2.position) | |||
| { | |||
| s2.start = jmin (s1.start, s2.start); | |||
| s2.end = jmax (s1.end, s2.end); | |||
| lines.remove (i); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| void performSnap (const Array<SnapLine>& targets, const Array<SnapLine>& sources, bool isVertical, Point<int>& distance) | |||
| { | |||
| if (targets.size() == 0 || sources.size() == 0) | |||
| return; | |||
| float best = std::numeric_limits<float>::max(); | |||
| float absBest = fabsf (best); | |||
| Array <SnapLine> lines; | |||
| for (int i = 0; i < targets.size(); ++i) | |||
| { | |||
| const SnapLine& target = targets.getReference(i); | |||
| for (int j = 0; j < sources.size(); ++j) | |||
| { | |||
| const SnapLine& source = sources.getReference(j); | |||
| const float diff = target.position - source.position; | |||
| const float absDiff = fabsf (diff); | |||
| if (absDiff <= absBest) | |||
| { | |||
| if (absDiff < absBest) | |||
| { | |||
| absBest = absDiff; | |||
| best = diff; | |||
| lines.clearQuick(); | |||
| } | |||
| lines.add (SnapLine (target.position, jmin (target.start, source.start), jmax (target.end, source.end))); | |||
| } | |||
| } | |||
| } | |||
| jassert (absBest < std::numeric_limits<float>::max()); | |||
| if (absBest < snapDistance) | |||
| { | |||
| distance += isVertical ? Point<int> (roundToInt (best), 0) : Point<int> (0, roundToInt (best)); | |||
| for (int i = lines.size(); --i >= 0;) | |||
| snapGuides.add (new AlignmentHintComponent (canvas, lines.getReference(i), isVertical, snapGuideParentComp)); | |||
| } | |||
| } | |||
| const Array<SnapLine> getVerticalSnapPositions (const Point<int>& distance) const | |||
| { | |||
| Array<SnapLine> p (verticalSnapPositions); | |||
| for (int i = p.size(); --i >= 0;) | |||
| { | |||
| SnapLine& s = p.getReference(i); | |||
| s.position += distance.getX(); | |||
| s.start += distance.getY(); | |||
| s.end += distance.getY(); | |||
| } | |||
| return p; | |||
| } | |||
| const Array<SnapLine> getHorizontalSnapPositions (const Point<int>& distance) const | |||
| { | |||
| Array<SnapLine> p (horizontalSnapPositions); | |||
| for (int i = p.size(); --i >= 0;) | |||
| { | |||
| SnapLine& s = p.getReference(i); | |||
| s.position += distance.getY(); | |||
| s.start += distance.getX(); | |||
| s.end += distance.getX(); | |||
| } | |||
| return p; | |||
| } | |||
| bool isDraggingLeftRight() const { return zone.isDraggingWholeObject() || zone.isDraggingLeftEdge() || zone.isDraggingRightEdge(); } | |||
| bool isDraggingUpDown() const { return zone.isDraggingWholeObject() || zone.isDraggingTopEdge() || zone.isDraggingBottomEdge(); } | |||
| EditorDragOperation (const EditorDragOperation&); | |||
| EditorDragOperation& operator= (const EditorDragOperation&); | |||
| }; | |||
| #endif // __JUCER_EDITORDRAGOPERATION_H_720CD068__ | |||
| @@ -1,699 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_EDITORPANEL_H_8E192A99__ | |||
| #define __JUCER_EDITORPANEL_H_8E192A99__ | |||
| #include "../../utility/jucer_TickIterator.h" | |||
| #include "jucer_EditorCanvas.h" | |||
| //============================================================================== | |||
| class EditorPanelBase : public Component | |||
| { | |||
| public: | |||
| EditorPanelBase() | |||
| : rulerX (true), rulerY (false), markersVisible (true), snappingEnabled (true), canvas (0) | |||
| { | |||
| setOpaque (true); | |||
| background = ImageCache::getFromMemory (BinaryData::brushed_aluminium_png, BinaryData::brushed_aluminium_pngSize); | |||
| addAndMakeVisible (&toolbar); | |||
| toolbar.setStyle (Toolbar::textOnly); | |||
| addAndMakeVisible (&viewport); | |||
| addAndMakeVisible (&rulerX); | |||
| addAndMakeVisible (&rulerY); | |||
| addAndMakeVisible (&tooltipBar); | |||
| addChildComponent (&tree); | |||
| tree.setRootItemVisible (true); | |||
| tree.setMultiSelectEnabled (true); | |||
| tree.setDefaultOpenness (true); | |||
| tree.setColour (TreeView::backgroundColourId, Colour::greyLevel (0.92f)); | |||
| tree.setIndentSize (15); | |||
| } | |||
| ~EditorPanelBase() | |||
| { | |||
| jassert (infoPanel == 0); // remember to call shutdown() | |||
| } | |||
| void initialise (EditorCanvasBase* canvas_, ToolbarItemFactory& toolbarFactory, TreeViewItem* treeRootItem) | |||
| { | |||
| canvas = canvas_; | |||
| toolbar.addDefaultItems (toolbarFactory); | |||
| viewport.setViewedComponent (canvas); | |||
| addAndMakeVisible (infoPanel = new InfoPanel (this)); | |||
| tree.setRootItem (treeRootItem); | |||
| resized(); | |||
| } | |||
| void shutdown() | |||
| { | |||
| tree.deleteRootItem(); | |||
| infoPanel = 0; | |||
| } | |||
| //============================================================================== | |||
| void showOrHideProperties() | |||
| { | |||
| infoPanel->setVisible (! infoPanel->isVisible()); | |||
| resized(); | |||
| } | |||
| bool arePropertiesVisible() const { return infoPanel->isVisible(); } | |||
| void showOrHideTree() | |||
| { | |||
| tree.setVisible (! tree.isVisible()); | |||
| resized(); | |||
| } | |||
| bool isTreeVisible() const { return tree.isVisible(); } | |||
| void showOrHideMarkers() | |||
| { | |||
| markersVisible = ! markersVisible; | |||
| commandManager->commandStatusChanged(); | |||
| } | |||
| bool areMarkersVisible() const { return markersVisible; } | |||
| void toggleSnapping() | |||
| { | |||
| snappingEnabled = ! snappingEnabled; | |||
| commandManager->commandStatusChanged(); | |||
| } | |||
| bool isSnappingEnabled() const { return snappingEnabled; } | |||
| //============================================================================== | |||
| virtual SelectedItemSet<String>& getSelection() = 0; | |||
| virtual void getSelectedItemProperties (Array<PropertyComponent*>& newComps) = 0; | |||
| static int getRulerThickness() throw() { return 16; } | |||
| void paint (Graphics& g) | |||
| { | |||
| g.setTiledImageFill (background, 0, 0, 1.0f); | |||
| g.fillAll(); | |||
| } | |||
| void resized() | |||
| { | |||
| Rectangle<int> area (getLocalBounds()); | |||
| toolbar.setBounds (area.removeFromTop (22)); | |||
| if (infoPanel != 0 && infoPanel->isVisible()) | |||
| { | |||
| Rectangle<int> panel (area.removeFromRight (200)); | |||
| tooltipBar.setBounds (panel.removeFromBottom (30)); | |||
| infoPanel->setBounds (panel); | |||
| } | |||
| else | |||
| { | |||
| tooltipBar.setBounds (area.removeFromBottom (18)); | |||
| } | |||
| if (tree.isVisible()) | |||
| tree.setBounds (area.removeFromLeft (200)); | |||
| Rectangle<int> ry (area.removeFromLeft (getRulerThickness())); | |||
| ry.removeFromTop (getRulerThickness()); | |||
| rulerY.setBounds (ry); | |||
| rulerX.setBounds (area.removeFromTop (getRulerThickness())); | |||
| viewport.setBounds (area); | |||
| updateRulers(); | |||
| } | |||
| void updateRulers() | |||
| { | |||
| if (canvas != 0) | |||
| { | |||
| rulerX.update (canvas->getScale(), canvas->getComponentHolder()); | |||
| rulerY.update (canvas->getScale(), canvas->getComponentHolder()); | |||
| } | |||
| updateMarkers(); | |||
| } | |||
| void updateMarkers() | |||
| { | |||
| if (canvas != 0) | |||
| { | |||
| const int vw = viewport.getMaximumVisibleWidth(); | |||
| const int vh = viewport.getMaximumVisibleHeight(); | |||
| rulerX.updateMarkers (canvas->getMarkerList (true), canvas, vw, vh); | |||
| rulerY.updateMarkers (canvas->getMarkerList (false), canvas, vw, vh); | |||
| } | |||
| } | |||
| private: | |||
| //============================================================================== | |||
| class InfoPanel : public Component, | |||
| public ChangeListener | |||
| { | |||
| public: | |||
| InfoPanel (EditorPanelBase* owner_) | |||
| : owner (owner_) | |||
| { | |||
| setOpaque (true); | |||
| addAndMakeVisible (props = new PropertyPanel()); | |||
| owner->getSelection().addChangeListener (this); | |||
| } | |||
| ~InfoPanel() | |||
| { | |||
| owner->getSelection().removeChangeListener (this); | |||
| props->clear(); | |||
| deleteAllChildren(); | |||
| } | |||
| void changeListenerCallback (void*) | |||
| { | |||
| Array <PropertyComponent*> newComps; | |||
| owner->getSelectedItemProperties (newComps); | |||
| props->clear(); | |||
| props->addProperties (newComps); | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| g.fillAll (Colour::greyLevel (0.92f)); | |||
| } | |||
| void resized() | |||
| { | |||
| props->setSize (getWidth(), getHeight()); | |||
| } | |||
| private: | |||
| EditorPanelBase* owner; | |||
| PropertyPanel* props; | |||
| }; | |||
| //============================================================================== | |||
| class RulerComponent : public Component | |||
| { | |||
| public: | |||
| RulerComponent (const bool isX_) | |||
| : isX (isX_), range (0.0, 100.0), canvas (0) | |||
| { | |||
| } | |||
| ~RulerComponent() | |||
| { | |||
| } | |||
| void update (const EditorCanvasBase::Scale& scale, Component* contentHolder) | |||
| { | |||
| const Point<int> origin (contentHolder->relativePositionToOtherComponent (this, scale.origin)); | |||
| const double start = isX ? origin.getX() : origin.getY(); | |||
| const Range<double> newRange (-start * scale.scale, | |||
| ((isX ? getWidth() : getHeight()) - start) * scale.scale); | |||
| if (range != newRange) | |||
| { | |||
| range = newRange; | |||
| repaint(); | |||
| } | |||
| } | |||
| void updateMarkers (MarkerListBase& markerList, EditorCanvasBase* canvas_, | |||
| const int viewportWidth, const int viewportHeight) | |||
| { | |||
| canvas = canvas_; | |||
| const int num = markerList.size(); | |||
| Array<ValueTree> requiredMarkers; | |||
| requiredMarkers.ensureStorageAllocated (num); | |||
| int i; | |||
| for (i = 0; i < num; ++i) | |||
| requiredMarkers.add (markerList.getMarker (i)); | |||
| for (i = markers.size(); --i >= 0;) | |||
| { | |||
| MarkerComponent* marker = markers.getUnchecked (i); | |||
| const int index = requiredMarkers.indexOf (marker->marker); | |||
| if (index >= 0) | |||
| { | |||
| marker->updatePosition (viewportWidth, viewportHeight); | |||
| requiredMarkers.removeValue (marker->marker); | |||
| } | |||
| else | |||
| { | |||
| if (marker->isMouseButtonDown()) | |||
| marker->setBounds (-1, -1, 1, 1); | |||
| else | |||
| markers.remove (i); | |||
| } | |||
| } | |||
| for (i = requiredMarkers.size(); --i >= 0;) | |||
| { | |||
| MarkerComponent* marker = new MarkerComponent (*this, canvas, requiredMarkers.getReference(i), | |||
| markerList.isSpecialMarker (requiredMarkers.getReference(i)), isX); | |||
| markers.add (marker); | |||
| getParentComponent()->addAndMakeVisible (marker); | |||
| marker->updatePosition (viewportWidth, viewportHeight); | |||
| } | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| g.setFont (10.0f); | |||
| g.setColour (Colour::greyLevel (0.9f)); | |||
| TickIterator ticks (range.getStart(), range.getEnd(), range.getLength() / (isX ? getWidth() : getHeight()), | |||
| 10, isX ? 50 : 80); | |||
| float pos, tickLength; | |||
| String label; | |||
| while (ticks.getNextTick (pos, tickLength, label)) | |||
| { | |||
| if (pos > 0) | |||
| { | |||
| if (isX) | |||
| { | |||
| g.drawVerticalLine ((int) pos, getHeight() - tickLength * getHeight(), (float) getHeight()); | |||
| g.drawSingleLineText (label, (int) pos + 2, getHeight() - 6); | |||
| } | |||
| else | |||
| { | |||
| g.drawHorizontalLine ((int) pos, getWidth() - tickLength * getWidth(), (float) getWidth()); | |||
| g.drawTextAsPath (label, AffineTransform::rotation (float_Pi / -2.0f) | |||
| .translated (getWidth() - 6.0f, pos - 2.0f)); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| void mouseDoubleClick (const MouseEvent& e) | |||
| { | |||
| if (isX) | |||
| canvas->getMarkerList (true).createMarker (canvas->getMarkerList (true).getNonexistentMarkerName ("Marker"), | |||
| xToPosition (e.x)); | |||
| else | |||
| canvas->getMarkerList (false).createMarker (canvas->getMarkerList (false).getNonexistentMarkerName ("Marker"), | |||
| xToPosition (e.y)); | |||
| } | |||
| double xToPosition (const int x) const | |||
| { | |||
| return range.getStart() + x * range.getLength() / (isX ? getWidth() : getHeight()); | |||
| } | |||
| int positionToX (const double position) const | |||
| { | |||
| const float proportion = (float) ((position - range.getStart()) / range.getLength()); | |||
| return isX ? proportionOfWidth (proportion) : proportionOfHeight (proportion); | |||
| } | |||
| //============================================================================== | |||
| class MarkerComponent : public Component, | |||
| public ChangeListener | |||
| { | |||
| public: | |||
| MarkerComponent (RulerComponent& ruler_, EditorCanvasBase* const canvas_, | |||
| const ValueTree& marker_, bool isSpecial_, bool isX_) | |||
| : ruler (ruler_), canvas (canvas_), marker (marker_), isX (isX_), headSize (getRulerThickness() - 2), | |||
| isDragging (false), isSpecial (isSpecial_), isSelected (false) | |||
| { | |||
| updateSelectionState(); | |||
| canvas->getSelection().addChangeListener (this); | |||
| } | |||
| ~MarkerComponent() | |||
| { | |||
| canvas->getSelection().removeChangeListener (this); | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| if (isSelected || isMouseOverOrDragging()) | |||
| { | |||
| g.setColour (Colours::white.withAlpha (0.5f)); | |||
| g.strokePath (path, PathStrokeType (isSelected ? 2.5f : 1.5f)); | |||
| } | |||
| Colour c (isSpecial ? Colours::darkgreen : Colours::darkgrey); | |||
| if (isSelected) | |||
| c = c.overlaidWith (Colours::red.withAlpha (0.5f)); | |||
| g.setColour (c.withAlpha (isMouseOverOrDragging() ? 0.95f : 0.6f)); | |||
| g.fillPath (path); | |||
| } | |||
| void updatePosition (const int viewportWidth, const int viewportHeight) | |||
| { | |||
| RelativeCoordinate coord (getMarkerList().getCoordinate (marker)); | |||
| const double pos = coord.resolve (&getMarkerList()); | |||
| if (! ruler.range.contains (pos)) | |||
| { | |||
| setVisible (false); | |||
| } | |||
| else | |||
| { | |||
| setVisible (true); | |||
| Point<int> anchorPoint; | |||
| if (isX) | |||
| anchorPoint.setXY (ruler.positionToX (pos), ruler.getHeight()); | |||
| else | |||
| anchorPoint.setXY (ruler.getWidth(), ruler.positionToX (pos)); | |||
| Component* const parent = getParentComponent(); | |||
| anchorPoint = ruler.relativePositionToOtherComponent (parent, anchorPoint); | |||
| const int width = 8; | |||
| if (isX) | |||
| setBounds (anchorPoint.getX() - width, anchorPoint.getY() - headSize, width * 2, viewportHeight + headSize); | |||
| else | |||
| setBounds (anchorPoint.getX() - headSize, anchorPoint.getY() - width, viewportWidth + headSize, width * 2); | |||
| } | |||
| labelText = "name: " + getMarkerList().getName (marker) + "\nposition: " + coord.toString(); | |||
| updateLabel(); | |||
| } | |||
| void updateLabel() | |||
| { | |||
| if (isMouseOverOrDragging() && isVisible() && (getWidth() > 1 || getHeight() > 1)) | |||
| label.update (getParentComponent(), labelText, Colours::darkgreen, | |||
| isX ? getBounds().getCentreX() : getX() + headSize, | |||
| isX ? getY() + headSize : getBounds().getCentreY(), true, true); | |||
| else | |||
| label.remove(); | |||
| } | |||
| bool hitTest (int x, int y) | |||
| { | |||
| return (isX ? y : x) < headSize; | |||
| } | |||
| void resized() | |||
| { | |||
| const float lineThickness = 1.0f; | |||
| path.clear(); | |||
| if (isX) | |||
| { | |||
| float w = getWidth() / 2.0f; | |||
| const float centre = w + 0.5f; | |||
| w -= 2.0f; | |||
| path.startNewSubPath (centre - w, 1.0f); | |||
| path.lineTo (centre + w, 1.0f); | |||
| path.lineTo (centre + lineThickness / 2.0f, headSize); | |||
| path.lineTo (centre + lineThickness / 2.0f, (float) getHeight()); | |||
| path.lineTo (centre - lineThickness / 2.0f, (float) getHeight()); | |||
| path.lineTo (centre - lineThickness / 2.0f, headSize); | |||
| path.closeSubPath(); | |||
| } | |||
| else | |||
| { | |||
| float w = getHeight() / 2.0f; | |||
| const float centre = w + 0.5f; | |||
| w -= 2.0f; | |||
| path.startNewSubPath (1.0f, centre + w); | |||
| path.lineTo (1.0f, centre - w); | |||
| path.lineTo (headSize, centre - lineThickness / 2.0f); | |||
| path.lineTo ((float) getWidth(), centre - lineThickness / 2.0f); | |||
| path.lineTo ((float) getWidth(), centre + lineThickness / 2.0f); | |||
| path.lineTo (headSize, centre + lineThickness / 2.0f); | |||
| path.closeSubPath(); | |||
| } | |||
| updateLabel(); | |||
| } | |||
| void mouseDown (const MouseEvent& e) | |||
| { | |||
| mouseDownPos = e.getMouseDownPosition(); | |||
| toFront (false); | |||
| updateLabel(); | |||
| canvas->getSelection().selectOnly (getMarkerList().getId (marker)); | |||
| if (e.mods.isPopupMenu()) | |||
| { | |||
| isDragging = false; | |||
| } | |||
| else | |||
| { | |||
| isDragging = true; | |||
| canvas->getUndoManager().beginNewTransaction(); | |||
| } | |||
| } | |||
| void mouseDrag (const MouseEvent& e) | |||
| { | |||
| if (isDragging) | |||
| { | |||
| autoScrollForMouseEvent (e.getEventRelativeTo (canvas), isX, ! isX); | |||
| canvas->getUndoManager().undoCurrentTransactionOnly(); | |||
| Rectangle<int> axis; | |||
| if (isX) | |||
| axis.setBounds (0, 0, getParentWidth(), headSize); | |||
| else | |||
| axis.setBounds (0, 0, headSize, getParentHeight()); | |||
| if (axis.expanded (isX ? 500 : 30, isX ? 30 : 500).contains (e.x, e.y)) | |||
| { | |||
| RelativeCoordinate coord (getMarkerList().getCoordinate (marker)); | |||
| MouseEvent rulerEvent (e.getEventRelativeTo (&ruler)); | |||
| int rulerPos = isX ? (rulerEvent.x + getWidth() / 2 - mouseDownPos.getX()) | |||
| : (rulerEvent.y + getHeight() / 2 - mouseDownPos.getY()); | |||
| coord.moveToAbsolute (canvas->limitMarkerPosition (ruler.xToPosition (rulerPos)), &getMarkerList()); | |||
| getMarkerList().setCoordinate (marker, coord); | |||
| canvas->handleUpdateNowIfNeeded(); | |||
| } | |||
| else | |||
| { | |||
| getMarkerList().deleteMarker (marker); | |||
| } | |||
| } | |||
| } | |||
| void mouseUp (const MouseEvent& e) | |||
| { | |||
| canvas->getUndoManager().beginNewTransaction(); | |||
| updateLabel(); | |||
| } | |||
| void mouseEnter (const MouseEvent& e) | |||
| { | |||
| updateLabel(); | |||
| repaint(); | |||
| } | |||
| void mouseExit (const MouseEvent& e) | |||
| { | |||
| updateLabel(); | |||
| repaint(); | |||
| } | |||
| void updateSelectionState() | |||
| { | |||
| bool nowSelected = canvas->getSelection().isSelected (getMarkerList().getId (marker)); | |||
| if (isSelected != nowSelected) | |||
| { | |||
| isSelected = nowSelected; | |||
| repaint(); | |||
| } | |||
| } | |||
| void changeListenerCallback (void*) | |||
| { | |||
| updateSelectionState(); | |||
| } | |||
| MarkerListBase& getMarkerList() { return canvas->getMarkerList (isX); } | |||
| ValueTree marker; | |||
| const bool isX; | |||
| private: | |||
| RulerComponent& ruler; | |||
| EditorCanvasBase* canvas; | |||
| const int headSize; | |||
| Path path; | |||
| bool isSpecial, isDragging, isSelected; | |||
| FloatingLabelComponent label; | |||
| String labelText; | |||
| Point<int> mouseDownPos; | |||
| }; | |||
| Range<double> range; | |||
| private: | |||
| const bool isX; | |||
| OwnedArray <MarkerComponent> markers; | |||
| EditorCanvasBase* canvas; | |||
| }; | |||
| //============================================================================== | |||
| class CanvasViewport : public Viewport | |||
| { | |||
| public: | |||
| CanvasViewport() | |||
| : canvas (0) | |||
| { | |||
| setOpaque (true); | |||
| } | |||
| ~CanvasViewport() | |||
| { | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| if (canvas == 0) | |||
| canvas = dynamic_cast <EditorCanvasBase*> (getViewedComponent()); | |||
| if (canvas != 0) | |||
| canvas->fillBackground (g); | |||
| } | |||
| void paintOverChildren (Graphics& g) | |||
| { | |||
| drawRecessedShadows (g, getMaximumVisibleWidth(), getMaximumVisibleHeight(), 14); | |||
| } | |||
| void visibleAreaChanged (int, int , int, int) | |||
| { | |||
| EditorPanelBase* p = dynamic_cast <EditorPanelBase*> (getParentComponent()); | |||
| if (p != 0) | |||
| p->updateRulers(); | |||
| } | |||
| private: | |||
| EditorCanvasBase* canvas; | |||
| }; | |||
| //============================================================================== | |||
| class TooltipBar : public Component, | |||
| public Timer | |||
| { | |||
| public: | |||
| TooltipBar() | |||
| : lastComp (0) | |||
| { | |||
| label.setColour (Label::textColourId, Colour::greyLevel (0.15f)); | |||
| label.setColour (Label::backgroundColourId, Colour::greyLevel (0.75f)); | |||
| label.setFont (Font (13.0f)); | |||
| label.setJustificationType (Justification::centredLeft); | |||
| addAndMakeVisible (&label); | |||
| } | |||
| ~TooltipBar() | |||
| { | |||
| } | |||
| void timerCallback() | |||
| { | |||
| Component* const newComp = Desktop::getInstance().getMainMouseSource().getComponentUnderMouse(); | |||
| if (newComp != lastComp) | |||
| { | |||
| lastComp = newComp; | |||
| label.setText (findTip (newComp), false); | |||
| } | |||
| } | |||
| void resized() | |||
| { | |||
| label.setBounds (getLocalBounds()); | |||
| } | |||
| void visibilityChanged() | |||
| { | |||
| if (isVisible()) | |||
| startTimer (150); | |||
| else | |||
| stopTimer(); | |||
| } | |||
| private: | |||
| Label label; | |||
| Component* lastComp; | |||
| const String findTip (Component* c) | |||
| { | |||
| while (c != 0 && c != this) | |||
| { | |||
| TooltipClient* const tc = dynamic_cast <TooltipClient*> (c); | |||
| if (tc != 0) | |||
| { | |||
| const String tip (tc->getTooltip()); | |||
| if (tip.isNotEmpty()) | |||
| return tip; | |||
| } | |||
| c = c->getParentComponent(); | |||
| } | |||
| return String::empty; | |||
| } | |||
| TooltipBar (const TooltipBar&); | |||
| TooltipBar& operator= (const TooltipBar&); | |||
| }; | |||
| //============================================================================== | |||
| Toolbar toolbar; | |||
| CanvasViewport viewport; | |||
| RulerComponent rulerX, rulerY; | |||
| ScopedPointer<InfoPanel> infoPanel; | |||
| TreeView tree; | |||
| TooltipBar tooltipBar; | |||
| EditorCanvasBase* canvas; | |||
| bool markersVisible, snappingEnabled; | |||
| Image background; | |||
| }; | |||
| #endif // __JUCER_EDITORPANEL_H_8E192A99__ | |||
| @@ -26,7 +26,6 @@ | |||
| #include "jucer_ProjectContentComponent.h" | |||
| #include "../jucer_MainWindow.h" | |||
| #include "../Code Editor/jucer_SourceCodeEditor.h" | |||
| #include "../Drawable Editor/jucer_DrawableEditor.h" | |||
| #include "jucer_ProjectInformationComponent.h" | |||
| #include "jucer_TreeViewTypes.h" | |||
| #include "../../model/Project/jucer_ProjectExporter.h" | |||
| @@ -49,7 +48,7 @@ ProjectContentComponent::~ProjectContentComponent() | |||
| { | |||
| setProject (0); | |||
| contentView = 0; | |||
| deleteAllChildren(); | |||
| jassert (getNumChildComponents() == 0); | |||
| } | |||
| void ProjectContentComponent::paint (Graphics& g) | |||
| @@ -81,7 +80,6 @@ void ProjectContentComponent::setProject (Project* newProject) | |||
| projectTree = 0; | |||
| contentView = 0; | |||
| resizerBar = 0; | |||
| deleteAllChildren(); | |||
| project = newProject; | |||
| @@ -69,12 +69,12 @@ public: | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| TreeView* projectTree; | |||
| ScopedPointer<TreeView> projectTree; | |||
| Project* project; | |||
| ScopedPointer <Component> contentView; | |||
| OpenDocumentManager::Document* currentDocument; | |||
| StretchableLayoutResizerBar* resizerBar; | |||
| ScopedPointer<StretchableLayoutResizerBar> resizerBar; | |||
| void updateMainWindowTitle(); | |||
| }; | |||
| @@ -138,7 +138,7 @@ void GroupTreeViewItem::addCreateFileMenuItems (PopupMenu& m) | |||
| m.addItem (1002, "Add Existing Files..."); | |||
| m.addSeparator(); | |||
| NewFileWizard::addWizardsToMenu (m); | |||
| NewFileWizard::getInstance()->addWizardsToMenu (m); | |||
| } | |||
| void GroupTreeViewItem::processCreateFileMenuItem (int menuID) | |||
| @@ -149,7 +149,7 @@ void GroupTreeViewItem::processCreateFileMenuItem (int menuID) | |||
| case 1002: browseToAddExistingFiles(); break; | |||
| default: | |||
| NewFileWizard::runWizardFromMenu (menuID, item); | |||
| NewFileWizard::getInstance()->runWizardFromMenu (menuID, item); | |||
| break; | |||
| } | |||
| } | |||
| @@ -172,9 +172,9 @@ const String SourceFileTreeViewItem::getDisplayName() const | |||
| static const File findCorrespondingHeaderOrCpp (const File& f) | |||
| { | |||
| if (f.hasFileExtension (".cpp")) | |||
| if (f.hasFileExtension ("cpp;c;mm;m")) | |||
| return f.withFileExtension (".h"); | |||
| else if (f.hasFileExtension (".h")) | |||
| else if (f.hasFileExtension (headerFileExtensions)) | |||
| return f.withFileExtension (".cpp"); | |||
| return File::nonexistent; | |||
| @@ -57,7 +57,6 @@ MainWindow::MainWindow() | |||
| // Register all the app commands.. | |||
| { | |||
| commandManager->registerAllCommandsForTarget (JUCEApplication::getInstance()); | |||
| commandManager->registerAllCommandsForTarget (this); | |||
| // use a temporary one of these to harvest its commands.. | |||
| @@ -66,9 +65,6 @@ MainWindow::MainWindow() | |||
| DocumentEditorComponent dec (0); | |||
| commandManager->registerAllCommandsForTarget (&dec); | |||
| ComponentEditor compEd (0, 0, 0); | |||
| commandManager->registerAllCommandsForTarget (&compEd); | |||
| } | |||
| commandManager->getKeyMappings()->resetToDefaultMappings(); | |||
| @@ -84,6 +80,8 @@ MainWindow::MainWindow() | |||
| setWantsKeyboardFocus (false); | |||
| //getPeer()->setCurrentRenderingEngine (0); | |||
| setVisible (true); | |||
| } | |||
| MainWindow::~MainWindow() | |||
| @@ -27,7 +27,7 @@ | |||
| #define __JUCER_MAINWINDOW_JUCEHEADER__ | |||
| #include "Project Editor/jucer_ProjectContentComponent.h" | |||
| #include "Component Editor/jucer_ComponentEditor.h" | |||
| //============================================================================== | |||
| /** | |||
| @@ -25,16 +25,14 @@ | |||
| #include "jucer_OpenDocumentManager.h" | |||
| #include "Code Editor/jucer_SourceCodeEditor.h" | |||
| #include "Drawable Editor/jucer_DrawableEditor.h" | |||
| #include "Project Editor/jucer_ItemPreviewComponent.h" | |||
| #include "Component Editor/jucer_ComponentEditor.h" | |||
| #include "Component Editor/jucer_ComponentViewer.h" | |||
| //============================================================================== | |||
| class SourceCodeDocument : public OpenDocumentManager::Document | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| SourceCodeDocument (const File& file_) | |||
| : modDetector (file_) | |||
| { | |||
| @@ -46,6 +44,18 @@ public: | |||
| { | |||
| } | |||
| //============================================================================== | |||
| class Type : public OpenDocumentManager::DocumentType | |||
| { | |||
| public: | |||
| Type() {} | |||
| ~Type() {} | |||
| bool canOpenFile (const File& file) { return SourceCodeEditor::isTextFile (file); } | |||
| Document* openFile (Project*, const File& file) { return new SourceCodeDocument (file); } | |||
| }; | |||
| //============================================================================== | |||
| bool loadedOk() const { return true; } | |||
| bool isForFile (const File& file) const { return modDetector.getFile() == file; } | |||
| bool isForNode (const ValueTree& node) const { return false; } | |||
| @@ -100,162 +110,6 @@ private: | |||
| CPlusPlusCodeTokeniser cppTokeniser; | |||
| }; | |||
| //============================================================================== | |||
| class ComponentDocumentType : public OpenDocumentManager::Document | |||
| { | |||
| public: | |||
| ComponentDocumentType (Project* project_, const File& file_) | |||
| : project (project_), | |||
| modDetector (file_) | |||
| { | |||
| reloadFromFile(); | |||
| } | |||
| ~ComponentDocumentType() | |||
| { | |||
| componentDoc = 0; | |||
| } | |||
| static bool isComponentFile (const File& file) { return ComponentDocument::isComponentFile (file); } | |||
| bool loadedOk() const { return componentDoc != 0; } | |||
| bool isForFile (const File& file) const { return modDetector.getFile() == file; } | |||
| bool isForNode (const ValueTree& node) const { return false; } | |||
| bool refersToProject (Project& p) const { return project == &p; } | |||
| const String getType() const { return "Jucer Component"; } | |||
| const String getName() const { return modDetector.getFile().getFileName(); } | |||
| bool needsSaving() const { return componentDoc != 0 && componentDoc->hasChangedSinceLastSave(); } | |||
| bool hasFileBeenModifiedExternally() { return modDetector.hasBeenModified(); } | |||
| void fileHasBeenRenamed (const File& newFile) | |||
| { | |||
| if (componentDoc != 0) | |||
| componentDoc->cppFileHasMoved (newFile); | |||
| modDetector.fileHasBeenRenamed (newFile); | |||
| } | |||
| void reloadFromFile() | |||
| { | |||
| modDetector.updateHash(); | |||
| if (componentDoc == 0) | |||
| componentDoc = new ComponentDocument (project, modDetector.getFile()); | |||
| if (! componentDoc->reload()) | |||
| componentDoc = 0; | |||
| } | |||
| bool save() | |||
| { | |||
| if (componentDoc->save()) | |||
| { | |||
| modDetector.updateHash(); | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| Component* createEditor() | |||
| { | |||
| if (componentDoc == 0) | |||
| { | |||
| jassertfalse; | |||
| return 0; | |||
| } | |||
| return new ComponentEditor (this, project, componentDoc); | |||
| } | |||
| Component* createViewer() | |||
| { | |||
| if (componentDoc == 0) | |||
| { | |||
| jassertfalse; | |||
| return 0; | |||
| } | |||
| return new ComponentViewer (this, project, componentDoc); | |||
| } | |||
| private: | |||
| Project* project; | |||
| FileModificationDetector modDetector; | |||
| ScopedPointer <ComponentDocument> componentDoc; | |||
| }; | |||
| //============================================================================== | |||
| class DrawableDocumentType : public OpenDocumentManager::Document | |||
| { | |||
| public: | |||
| DrawableDocumentType (Project* project_, const File& file_) | |||
| : project (project_), | |||
| modDetector (file_) | |||
| { | |||
| reloadFromFile(); | |||
| } | |||
| ~DrawableDocumentType() | |||
| { | |||
| drawableDoc = 0; | |||
| } | |||
| static bool isDrawableFile (const File& file) { return file.hasFileExtension (".drawable"); } | |||
| bool loadedOk() const { return drawableDoc != 0; } | |||
| bool isForFile (const File& file) const { return modDetector.getFile() == file; } | |||
| bool isForNode (const ValueTree& node) const { return false; } | |||
| bool refersToProject (Project& p) const { return project == &p; } | |||
| const String getType() const { return "Drawable"; } | |||
| const String getName() const { return modDetector.getFile().getFileName(); } | |||
| bool needsSaving() const { return drawableDoc != 0 && drawableDoc->hasChangedSinceLastSave(); } | |||
| bool hasFileBeenModifiedExternally() { return modDetector.hasBeenModified(); } | |||
| void fileHasBeenRenamed (const File& newFile) { modDetector.fileHasBeenRenamed (newFile); } | |||
| void reloadFromFile() | |||
| { | |||
| modDetector.updateHash(); | |||
| if (drawableDoc == 0) | |||
| drawableDoc = new DrawableDocument (project); | |||
| if (! drawableDoc->reload (modDetector.getFile())) | |||
| drawableDoc = 0; | |||
| } | |||
| bool save() | |||
| { | |||
| if (drawableDoc->save (modDetector.getFile())) | |||
| { | |||
| modDetector.updateHash(); | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| Component* createEditor() | |||
| { | |||
| jassert (drawableDoc != 0); | |||
| if (drawableDoc == 0) | |||
| return 0; | |||
| return new DrawableEditor (this, project, drawableDoc); | |||
| } | |||
| Component* createViewer() | |||
| { | |||
| return createEditor(); //xxx | |||
| } | |||
| private: | |||
| Project* project; | |||
| FileModificationDetector modDetector; | |||
| ScopedPointer <DrawableDocument> drawableDoc; | |||
| }; | |||
| //============================================================================== | |||
| class UnknownDocument : public OpenDocumentManager::Document | |||
| { | |||
| @@ -268,6 +122,18 @@ public: | |||
| ~UnknownDocument() {} | |||
| //============================================================================== | |||
| class Type : public OpenDocumentManager::DocumentType | |||
| { | |||
| public: | |||
| Type() {} | |||
| ~Type() {} | |||
| bool canOpenFile (const File& file) { return true; } | |||
| Document* openFile (Project* project, const File& file) { return new UnknownDocument (project, file); } | |||
| }; | |||
| //============================================================================== | |||
| bool loadedOk() const { return true; } | |||
| bool isForFile (const File& file_) const { return file == file_; } | |||
| bool isForNode (const ValueTree& node_) const { return false; } | |||
| @@ -303,6 +169,8 @@ private: | |||
| //============================================================================== | |||
| OpenDocumentManager::OpenDocumentManager() | |||
| { | |||
| registerType (new UnknownDocument::Type()); | |||
| registerType (new SourceCodeDocument::Type()); | |||
| } | |||
| OpenDocumentManager::~OpenDocumentManager() | |||
| @@ -312,6 +180,12 @@ OpenDocumentManager::~OpenDocumentManager() | |||
| juce_ImplementSingleton_SingleThreaded (OpenDocumentManager); | |||
| //============================================================================== | |||
| void OpenDocumentManager::registerType (DocumentType* type) | |||
| { | |||
| types.add (type); | |||
| } | |||
| //============================================================================== | |||
| void OpenDocumentManager::addListener (DocumentCloseListener* listener) | |||
| { | |||
| @@ -326,8 +200,11 @@ void OpenDocumentManager::removeListener (DocumentCloseListener* listener) | |||
| //============================================================================== | |||
| bool OpenDocumentManager::canOpenFile (const File& file) | |||
| { | |||
| return DrawableDocumentType::isDrawableFile (file) | |||
| || SourceCodeEditor::isTextFile (file); | |||
| for (int i = types.size(); --i >= 0;) | |||
| if (types.getUnchecked(i)->canOpenFile (file)) | |||
| return true; | |||
| return false; | |||
| } | |||
| OpenDocumentManager::Document* OpenDocumentManager::getDocumentForFile (Project* project, const File& file) | |||
| @@ -338,16 +215,20 @@ OpenDocumentManager::Document* OpenDocumentManager::getDocumentForFile (Project* | |||
| Document* d = 0; | |||
| if (ComponentDocumentType::isComponentFile (file)) | |||
| d = new ComponentDocumentType (project, file); | |||
| else if (DrawableDocumentType::isDrawableFile (file)) | |||
| d = new DrawableDocumentType (project, file); | |||
| else if (SourceCodeEditor::isTextFile (file)) | |||
| d = new SourceCodeDocument (file); | |||
| else | |||
| d = new UnknownDocument (project, file); | |||
| for (int i = types.size(); --i >= 0 && d == 0;) | |||
| { | |||
| if (types.getUnchecked(i)->canOpenFile (file)) | |||
| { | |||
| d = types.getUnchecked(i)->openFile (project, file); | |||
| jassert (d != 0); | |||
| } | |||
| } | |||
| jassert (d != 0); | |||
| if (d != 0) | |||
| documents.add (d); | |||
| documents.add (d); | |||
| commandManager->commandStatusChanged(); | |||
| return d; | |||
| } | |||
| @@ -27,7 +27,6 @@ | |||
| #define __JUCER_OPENDOCUMENTMANAGER_JUCEHEADER__ | |||
| #include "../model/Project/jucer_Project.h" | |||
| #include "../model/Drawable/jucer_DrawableDocument.h" | |||
| //============================================================================== | |||
| @@ -95,10 +94,24 @@ public: | |||
| void addListener (DocumentCloseListener* listener); | |||
| void removeListener (DocumentCloseListener* listener); | |||
| //============================================================================== | |||
| class DocumentType | |||
| { | |||
| public: | |||
| DocumentType() {} | |||
| virtual ~DocumentType() {} | |||
| virtual bool canOpenFile (const File& file) = 0; | |||
| virtual Document* openFile (Project* project, const File& file) = 0; | |||
| }; | |||
| void registerType (DocumentType* type); | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| OwnedArray <DocumentType> types; | |||
| OwnedArray <Document> documents; | |||
| Array <DocumentCloseListener*> listeners; | |||
| }; | |||
| @@ -1,252 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_COLOUREDITORCOMPONENT_JUCEHEADER__ | |||
| #define __JUCER_COLOUREDITORCOMPONENT_JUCEHEADER__ | |||
| //============================================================================== | |||
| class PopupColourSelector : public Component, | |||
| public ChangeListener, | |||
| public Value::Listener, | |||
| public ButtonListener | |||
| { | |||
| public: | |||
| PopupColourSelector (const Value& colourValue_, | |||
| const Colour& defaultColour_, | |||
| const bool canResetToDefault) | |||
| : defaultButton ("Reset to Default"), | |||
| colourValue (colourValue_), | |||
| defaultColour (defaultColour_) | |||
| { | |||
| addAndMakeVisible (&selector); | |||
| selector.setName ("Colour"); | |||
| selector.setCurrentColour (getColour()); | |||
| selector.addChangeListener (this); | |||
| if (canResetToDefault) | |||
| { | |||
| addAndMakeVisible (&defaultButton); | |||
| defaultButton.addButtonListener (this); | |||
| } | |||
| colourValue.addListener (this); | |||
| } | |||
| ~PopupColourSelector() | |||
| { | |||
| } | |||
| static void showAt (Component* targetComp, const Value& colourValue, | |||
| const Colour& defaultColour, const bool canResetToDefault) | |||
| { | |||
| PopupColourSelector colourSelector (colourValue, defaultColour, canResetToDefault); | |||
| colourSelector.setSize (300, 400); | |||
| CallOutBox c (colourSelector, *targetComp, 0 /*targetComp->getTopLevelComponent()*/); | |||
| c.runModalLoop(); | |||
| } | |||
| void resized() | |||
| { | |||
| if (defaultButton.isVisible()) | |||
| { | |||
| selector.setBounds (0, 0, getWidth(), getHeight() - 30); | |||
| defaultButton.changeWidthToFitText (22); | |||
| defaultButton.setTopLeftPosition (10, getHeight() - 26); | |||
| } | |||
| else | |||
| { | |||
| selector.setBounds (0, 0, getWidth(), getHeight()); | |||
| } | |||
| } | |||
| const Colour getColour() const | |||
| { | |||
| if (colourValue.toString().isEmpty()) | |||
| return defaultColour; | |||
| return Colour::fromString (colourValue.toString()); | |||
| } | |||
| void setColour (const Colour& newColour) | |||
| { | |||
| if (getColour() != newColour) | |||
| { | |||
| if (newColour == defaultColour && defaultButton.isVisible()) | |||
| colourValue = var::null; | |||
| else | |||
| colourValue = newColour.toDisplayString (true); | |||
| } | |||
| } | |||
| void buttonClicked (Button*) | |||
| { | |||
| setColour (defaultColour); | |||
| selector.setCurrentColour (defaultColour); | |||
| } | |||
| void changeListenerCallback (void* source) | |||
| { | |||
| if (selector.getCurrentColour() != getColour()) | |||
| setColour (selector.getCurrentColour()); | |||
| } | |||
| void valueChanged (Value&) | |||
| { | |||
| selector.setCurrentColour (getColour()); | |||
| } | |||
| private: | |||
| StoredSettings::ColourSelectorWithSwatches selector; | |||
| TextButton defaultButton; | |||
| Value colourValue; | |||
| Colour defaultColour; | |||
| }; | |||
| //============================================================================== | |||
| /** | |||
| A component that shows a colour swatch with hex ARGB value, and which pops up | |||
| a colour selector when you click it. | |||
| */ | |||
| class ColourEditorComponent : public Component, | |||
| public Value::Listener | |||
| { | |||
| public: | |||
| ColourEditorComponent (UndoManager* undoManager_, const Value& colourValue_, | |||
| const Colour& defaultColour_, const bool canResetToDefault_) | |||
| : undoManager (undoManager_), colourValue (colourValue_), defaultColour (defaultColour_), | |||
| canResetToDefault (canResetToDefault_) | |||
| { | |||
| colourValue.addListener (this); | |||
| } | |||
| ~ColourEditorComponent() | |||
| { | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| const Colour colour (getColour()); | |||
| g.fillAll (Colours::grey); | |||
| g.fillCheckerBoard (2, 2, getWidth() - 4, getHeight() - 4, | |||
| 10, 10, | |||
| Colour (0xffdddddd).overlaidWith (colour), | |||
| Colour (0xffffffff).overlaidWith (colour)); | |||
| g.setColour (Colours::white.overlaidWith (colour).contrasting()); | |||
| g.setFont (getHeight() * 0.6f, Font::bold); | |||
| g.drawFittedText (colour.toDisplayString (true), | |||
| 2, 1, getWidth() - 4, getHeight() - 1, | |||
| Justification::centred, 1); | |||
| } | |||
| const Colour getColour() const | |||
| { | |||
| if (colourValue.toString().isEmpty()) | |||
| return defaultColour; | |||
| return Colour::fromString (colourValue.toString()); | |||
| } | |||
| void setColour (const Colour& newColour) | |||
| { | |||
| if (getColour() != newColour) | |||
| { | |||
| if (newColour == defaultColour && canResetToDefault) | |||
| colourValue = var::null; | |||
| else | |||
| colourValue = newColour.toDisplayString (true); | |||
| } | |||
| } | |||
| void resetToDefault() | |||
| { | |||
| setColour (defaultColour); | |||
| } | |||
| void refresh() | |||
| { | |||
| const Colour col (getColour()); | |||
| if (col != lastColour) | |||
| { | |||
| lastColour = col; | |||
| repaint(); | |||
| } | |||
| } | |||
| void mouseDown (const MouseEvent& e) | |||
| { | |||
| undoManager->beginNewTransaction(); | |||
| PopupColourSelector::showAt (this, colourValue, defaultColour, canResetToDefault); | |||
| } | |||
| void valueChanged (Value&) | |||
| { | |||
| refresh(); | |||
| } | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| UndoManager* undoManager; | |||
| Value colourValue; | |||
| Colour lastColour; | |||
| const Colour defaultColour; | |||
| const bool canResetToDefault; | |||
| }; | |||
| //============================================================================== | |||
| class ColourPropertyComponent : public PropertyComponent | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| ColourPropertyComponent (UndoManager* undoManager, const String& name, const Value& colour, | |||
| const Colour& defaultColour, bool canResetToDefault) | |||
| : PropertyComponent (name), | |||
| colourEditor (undoManager, colour, defaultColour, canResetToDefault) | |||
| { | |||
| addAndMakeVisible (&colourEditor); | |||
| } | |||
| ~ColourPropertyComponent() | |||
| { | |||
| } | |||
| void resized() | |||
| { | |||
| colourEditor.setBounds (getLookAndFeel().getPropertyComponentContentPosition (*this)); | |||
| } | |||
| void refresh() {} | |||
| protected: | |||
| ColourEditorComponent colourEditor; | |||
| }; | |||
| #endif // __JUCER_COLOUREDITORCOMPONENT_JUCEHEADER__ | |||
| @@ -1,205 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_COORDINATEPROPERTYCOMPONENT_H_1128AA3D__ | |||
| #define __JUCER_COORDINATEPROPERTYCOMPONENT_H_1128AA3D__ | |||
| //============================================================================== | |||
| class CoordinatePropertyComponent : public PropertyComponent, | |||
| public ButtonListener, | |||
| public Value::Listener | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| CoordinatePropertyComponent (RelativeCoordinate::NamedCoordinateFinder* nameSource_, const String& name, | |||
| const Value& coordValue_, bool isHorizontal_) | |||
| : PropertyComponent (name, 40), nameSource (nameSource_), | |||
| coordValue (coordValue_), | |||
| textValue (Value (new CoordEditableValueSource (coordValue_, isHorizontal_))), | |||
| isHorizontal (isHorizontal_) | |||
| { | |||
| addAndMakeVisible (label = new Label (String::empty, String::empty)); | |||
| label->setEditable (true, true, false); | |||
| label->setColour (Label::backgroundColourId, Colours::white); | |||
| label->setColour (Label::outlineColourId, findColour (ComboBox::outlineColourId)); | |||
| label->getTextValue().referTo (textValue); | |||
| addAndMakeVisible (proportionButton = new TextButton ("%")); | |||
| proportionButton->addButtonListener (this); | |||
| addAndMakeVisible (anchorButton1 = new TextButton (String::empty)); | |||
| anchorButton1->setConnectedEdges (Button::ConnectedOnLeft | Button::ConnectedOnTop | Button::ConnectedOnRight | Button::ConnectedOnBottom); | |||
| anchorButton1->setTriggeredOnMouseDown (true); | |||
| anchorButton1->addButtonListener (this); | |||
| addAndMakeVisible (anchorButton2 = new TextButton (String::empty)); | |||
| anchorButton2->setConnectedEdges (Button::ConnectedOnLeft | Button::ConnectedOnTop | Button::ConnectedOnRight | Button::ConnectedOnBottom); | |||
| anchorButton2->setTriggeredOnMouseDown (true); | |||
| anchorButton2->addButtonListener (this); | |||
| coordValue.addListener (this); | |||
| valueChanged (coordValue); | |||
| } | |||
| ~CoordinatePropertyComponent() | |||
| { | |||
| coordValue.removeListener (this); | |||
| deleteAllChildren(); | |||
| } | |||
| void resized() | |||
| { | |||
| const Rectangle<int> r (getLookAndFeel().getPropertyComponentContentPosition (*this)); | |||
| label->setBounds (r.getX(), r.getY(), r.getWidth() / 2, r.getHeight() / 2); | |||
| proportionButton->setBounds (r.getX() + r.getWidth() / 2, r.getY(), | |||
| r.getWidth() / 2, r.getHeight() / 2); | |||
| if (anchorButton2->isVisible()) | |||
| { | |||
| anchorButton1->setBounds (r.getX(), r.getY() + r.getHeight() / 2, r.getWidth() / 2, r.getHeight() / 2); | |||
| anchorButton2->setBounds (r.getX() + r.getWidth() / 2, r.getY() + r.getHeight() / 2, r.getWidth() / 2, r.getHeight() / 2); | |||
| } | |||
| else | |||
| { | |||
| anchorButton1->setBounds (r.getX(), r.getY() + r.getHeight() / 2, r.getWidth(), r.getHeight() / 2); | |||
| } | |||
| } | |||
| void refresh() {} | |||
| void buttonClicked (Button* button) | |||
| { | |||
| RelativeCoordinate coord (getCoordinate()); | |||
| if (button == proportionButton) | |||
| { | |||
| coord.toggleProportionality (nameSource, isHorizontal); | |||
| coordValue = coord.toString(); | |||
| } | |||
| else if (button == anchorButton1) | |||
| { | |||
| const String marker (pickMarker (anchorButton1, coord.getAnchorName1(), true)); | |||
| if (marker.isNotEmpty()) | |||
| { | |||
| coord.changeAnchor1 (marker, nameSource); | |||
| coordValue = coord.toString(); | |||
| } | |||
| } | |||
| else if (button == anchorButton2) | |||
| { | |||
| const String marker (pickMarker (anchorButton2, coord.getAnchorName2(), false)); | |||
| if (marker.isNotEmpty()) | |||
| { | |||
| coord.changeAnchor2 (marker, nameSource); | |||
| coordValue = coord.toString(); | |||
| } | |||
| } | |||
| } | |||
| void valueChanged (Value&) | |||
| { | |||
| RelativeCoordinate coord (getCoordinate()); | |||
| anchorButton1->setButtonText (coord.getAnchorName1()); | |||
| anchorButton2->setVisible (coord.isProportional()); | |||
| anchorButton2->setButtonText (coord.getAnchorName2()); | |||
| resized(); | |||
| } | |||
| const RelativeCoordinate getCoordinate() const | |||
| { | |||
| return RelativeCoordinate (coordValue.toString(), isHorizontal); | |||
| } | |||
| virtual const String pickMarker (TextButton* button, const String& currentMarker, bool isAnchor1) = 0; | |||
| protected: | |||
| RelativeCoordinate::NamedCoordinateFinder* nameSource; | |||
| Value coordValue, textValue; | |||
| Label* label; | |||
| TextButton* proportionButton; | |||
| TextButton* anchorButton1; | |||
| TextButton* anchorButton2; | |||
| bool isHorizontal; | |||
| //============================================================================== | |||
| class CoordEditableValueSource : public Value::ValueSource, | |||
| public Value::Listener | |||
| { | |||
| public: | |||
| CoordEditableValueSource (const Value& sourceValue_, bool isHorizontal_) | |||
| : sourceValue (sourceValue_), isHorizontal (isHorizontal_) | |||
| { | |||
| sourceValue.addListener (this); | |||
| } | |||
| ~CoordEditableValueSource() {} | |||
| const var getValue() const | |||
| { | |||
| RelativeCoordinate coord (sourceValue.toString(), isHorizontal); | |||
| if (coord.isProportional()) | |||
| return String (coord.getEditableNumber()) + "%"; | |||
| return coord.getEditableNumber(); | |||
| } | |||
| void setValue (const var& newValue) | |||
| { | |||
| RelativeCoordinate coord (sourceValue.toString(), isHorizontal); | |||
| coord.setEditableNumber ((double) newValue); | |||
| const String newVal (coord.toString()); | |||
| if (sourceValue != newVal) | |||
| sourceValue = newVal; | |||
| } | |||
| void valueChanged (Value&) | |||
| { | |||
| sendChangeMessage (true); | |||
| } | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| protected: | |||
| Value sourceValue; | |||
| bool isHorizontal; | |||
| CoordEditableValueSource (const CoordEditableValueSource&); | |||
| const CoordEditableValueSource& operator= (const CoordEditableValueSource&); | |||
| }; | |||
| }; | |||
| #endif // __JUCER_COORDINATEPROPERTYCOMPONENT_H_1128AA3D__ | |||
| @@ -1,705 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_FILLTYPEPROPERTYCOMPONENT_H_88CF1300__ | |||
| #define __JUCER_FILLTYPEPROPERTYCOMPONENT_H_88CF1300__ | |||
| #include "../model/Project/jucer_Project.h" | |||
| class FillTypeEditorComponent; | |||
| //============================================================================== | |||
| class PopupFillSelector : public Component, | |||
| public ChangeListener, | |||
| public ValueTree::Listener, | |||
| public ButtonListener, | |||
| public AsyncUpdater | |||
| { | |||
| public: | |||
| PopupFillSelector (const ValueTree& fillState_, const ColourGradient& defaultGradient_, | |||
| Drawable::ImageProvider* imageProvider_, Project* project, UndoManager* undoManager_) | |||
| : gradientPicker (defaultGradient_), | |||
| defaultGradient (defaultGradient_), | |||
| tilePicker (imageProvider_, project), | |||
| fillState (fillState_), | |||
| imageProvider (imageProvider_), | |||
| undoManager (undoManager_) | |||
| { | |||
| colourButton.setButtonText ("Colour"); | |||
| colourButton.setConnectedEdges (TextButton::ConnectedOnRight); | |||
| gradientButton.setButtonText ("Gradient"); | |||
| gradientButton.setConnectedEdges (TextButton::ConnectedOnRight | TextButton::ConnectedOnLeft); | |||
| imageButton.setButtonText ("Image"); | |||
| imageButton.setConnectedEdges (TextButton::ConnectedOnLeft); | |||
| addAndMakeVisible (&colourButton); | |||
| addAndMakeVisible (&gradientButton); | |||
| addAndMakeVisible (&imageButton); | |||
| addChildComponent (&colourPicker); | |||
| colourPicker.setSize (300, 410); | |||
| colourPicker.setCurrentColour (Colours::green); | |||
| colourPicker.setName ("Colour"); | |||
| colourPicker.addChangeListener (this); | |||
| addChildComponent (&gradientPicker); | |||
| gradientPicker.setSize (300, 500); | |||
| gradientPicker.addChangeListener (this); | |||
| addChildComponent (&tilePicker); | |||
| tilePicker.setSize (300, 170); | |||
| tilePicker.addChangeListener (this); | |||
| fillState.addListener (this); | |||
| colourButton.setRadioGroupId (123); | |||
| gradientButton.setRadioGroupId (123); | |||
| imageButton.setRadioGroupId (123); | |||
| colourButton.addButtonListener (this); | |||
| gradientButton.addButtonListener (this); | |||
| imageButton.addButtonListener (this); | |||
| setSize (300, 200); | |||
| refresh(); | |||
| } | |||
| ~PopupFillSelector() | |||
| { | |||
| colourButton.removeButtonListener (this); | |||
| gradientButton.removeButtonListener (this); | |||
| imageButton.removeButtonListener (this); | |||
| } | |||
| void resized() | |||
| { | |||
| const int y = 2, w = 80, h = 22; | |||
| gradientButton.setBounds (getWidth() / 2 - w / 2, y, w, h); | |||
| colourButton.setBounds (gradientButton.getX() - w, y, w, h); | |||
| imageButton.setBounds (gradientButton.getRight(), y, w, h); | |||
| colourPicker.setTopLeftPosition (2, y + h + 4); | |||
| gradientPicker.setTopLeftPosition (2, y + h + 4); | |||
| tilePicker.setTopLeftPosition (2, y + h + 4); | |||
| } | |||
| void buttonClicked (Button* b) | |||
| { | |||
| RelativePoint gp1, gp2; | |||
| FillType currentFill (readFillType (&gp1, &gp2)); | |||
| if (b == &colourButton) | |||
| { | |||
| if (! currentFill.isColour()) | |||
| setFillType (colourPicker.getCurrentColour()); | |||
| } | |||
| else if (b == &gradientButton) | |||
| { | |||
| if (! currentFill.isGradient()) | |||
| { | |||
| // Use a cunning trick to make the wrapper dig out the earlier gradient settings, if there are any.. | |||
| FillType newFill (defaultGradient); | |||
| ValueTree temp ("dummy"); | |||
| Drawable::ValueTreeWrapperBase::writeFillType (temp, newFill, 0, 0, 0, 0); | |||
| fillState.setProperty (Drawable::ValueTreeWrapperBase::type, temp [Drawable::ValueTreeWrapperBase::type], undoManager); | |||
| newFill = readFillType (&gp1, &gp2); | |||
| if (newFill.gradient->getNumColours() <= 1) | |||
| { | |||
| newFill = FillType (defaultGradient); | |||
| Drawable::ValueTreeWrapperBase::writeFillType (fillState, newFill, 0, 0, imageProvider, undoManager); | |||
| } | |||
| else | |||
| { | |||
| Drawable::ValueTreeWrapperBase::writeFillType (fillState, newFill, &gp1, &gp2, imageProvider, undoManager); | |||
| } | |||
| refresh(); | |||
| } | |||
| } | |||
| else if (b == &imageButton) | |||
| { | |||
| if (! currentFill.isTiledImage()) | |||
| setFillType (FillType (StoredSettings::getInstance()->getFallbackImage(), | |||
| AffineTransform::identity)); | |||
| } | |||
| } | |||
| const FillType readFillType (RelativePoint* gp1, RelativePoint* gp2) const | |||
| { | |||
| return Drawable::ValueTreeWrapperBase::readFillType (fillState, gp1, gp2, 0, imageProvider); | |||
| } | |||
| void setFillType (const FillType& newFill) | |||
| { | |||
| RelativePoint gp1, gp2; | |||
| FillType currentFill (readFillType (&gp1, &gp2)); | |||
| if (currentFill != newFill) | |||
| { | |||
| if (undoManager != 0) | |||
| undoManager->undoCurrentTransactionOnly(); | |||
| Drawable::ValueTreeWrapperBase::writeFillType (fillState, newFill, &gp1, &gp2, imageProvider, undoManager); | |||
| refresh(); | |||
| } | |||
| } | |||
| void changeListenerCallback (void*) | |||
| { | |||
| const FillType currentFill (readFillType (0, 0)); | |||
| if (currentFill.isColour()) | |||
| setFillType (colourPicker.getCurrentColour()); | |||
| else if (currentFill.isGradient()) | |||
| setFillType (gradientPicker.getGradient()); | |||
| else if (currentFill.isTiledImage()) | |||
| setFillType (tilePicker.getFill()); | |||
| } | |||
| void refresh() | |||
| { | |||
| FillType newFill (readFillType (0, 0)); | |||
| colourPicker.setVisible (newFill.isColour()); | |||
| gradientPicker.setVisible (newFill.isGradient()); | |||
| tilePicker.setVisible (newFill.isTiledImage()); | |||
| if (newFill.isColour()) | |||
| { | |||
| setSize (getWidth(), colourPicker.getBottom() + 4); | |||
| colourButton.setToggleState (true, false); | |||
| colourPicker.setCurrentColour (newFill.colour); | |||
| } | |||
| else if (newFill.isGradient()) | |||
| { | |||
| setSize (getWidth(), gradientPicker.getBottom() + 4); | |||
| if (newFill.gradient->getNumColours() <= 1) | |||
| { | |||
| newFill = FillType (defaultGradient); | |||
| Drawable::ValueTreeWrapperBase::writeFillType (fillState, newFill, 0, 0, imageProvider, undoManager); | |||
| } | |||
| gradientButton.setToggleState (true, false); | |||
| gradientPicker.setGradient (*newFill.gradient); | |||
| } | |||
| else | |||
| { | |||
| setSize (getWidth(), tilePicker.getBottom() + 4); | |||
| tilePicker.setFill (newFill); | |||
| imageButton.setToggleState (true, false); | |||
| } | |||
| } | |||
| void handleAsyncUpdate() { refresh(); } | |||
| void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged, const Identifier& property) { triggerAsyncUpdate(); } | |||
| void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) { triggerAsyncUpdate(); } | |||
| void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) {} | |||
| private: | |||
| //============================================================================== | |||
| class GradientDesigner : public Component, | |||
| public ChangeBroadcaster, | |||
| public ChangeListener, | |||
| public ButtonListener | |||
| { | |||
| public: | |||
| GradientDesigner (const ColourGradient& gradient_) | |||
| : gradient (gradient_), | |||
| selectedPoint (-1), | |||
| dragging (false), | |||
| draggingNewPoint (false), | |||
| draggingPos (0) | |||
| { | |||
| addChildComponent (&colourPicker); | |||
| linearButton.setButtonText ("Linear"); | |||
| linearButton.setRadioGroupId (321); | |||
| linearButton.setConnectedEdges (TextButton::ConnectedOnRight | TextButton::ConnectedOnLeft); | |||
| radialButton.setButtonText ("Radial"); | |||
| radialButton.setRadioGroupId (321); | |||
| radialButton.setConnectedEdges (TextButton::ConnectedOnRight | TextButton::ConnectedOnLeft); | |||
| addAndMakeVisible (&linearButton); | |||
| addAndMakeVisible (&radialButton); | |||
| linearButton.addButtonListener (this); | |||
| radialButton.addButtonListener (this); | |||
| colourPicker.addChangeListener (this); | |||
| } | |||
| ~GradientDesigner() | |||
| { | |||
| } | |||
| void paint (Graphics& g) | |||
| { | |||
| g.fillAll (getLookAndFeel().findColour (ColourSelector::backgroundColourId)); | |||
| g.fillCheckerBoard (previewArea.getX(), previewArea.getY(), | |||
| previewArea.getWidth(), previewArea.getHeight(), 10, 10, | |||
| Colour (0xffdddddd), Colour (0xffffffff)); | |||
| FillType f (gradient); | |||
| f.gradient->point1.setXY ((float) previewArea.getX(), (float) previewArea.getCentreY()); | |||
| f.gradient->point2.setXY ((float) previewArea.getRight(), (float) previewArea.getCentreY()); | |||
| g.setFillType (f); | |||
| g.fillRect (previewArea); | |||
| Path marker; | |||
| const float headSize = 4.5f; | |||
| marker.addLineSegment (Line<float> (0.0f, -2.0f, 0.0f, previewArea.getHeight() + 2.0f), 1.5f); | |||
| marker.addTriangle (0.0f, 1.0f, -headSize, -headSize, headSize, -headSize); | |||
| for (int i = 0; i < gradient.getNumColours(); ++i) | |||
| { | |||
| const double pos = gradient.getColourPosition (i); | |||
| const Colour col (gradient.getColour (i)); | |||
| const AffineTransform t (AffineTransform::translation (previewArea.getX() + 0.5f + (float) (previewArea.getWidth() * pos), | |||
| (float) previewArea.getY())); | |||
| g.setColour (Colours::black.withAlpha (0.8f)); | |||
| g.strokePath (marker, PathStrokeType (i == selectedPoint ? 2.0f : 1.5f), t); | |||
| g.setColour (i == selectedPoint ? Colours::lightblue : Colours::white); | |||
| g.fillPath (marker, t); | |||
| } | |||
| } | |||
| void resized() | |||
| { | |||
| previewArea.setBounds (7, 35, getWidth() - 14, 24); | |||
| const int w = 60; | |||
| linearButton.setBounds (getWidth() / 2 - w, 2, w, 20); | |||
| radialButton.setBounds (getWidth() / 2, 2, w, 20); | |||
| colourPicker.setBounds (0, previewArea.getBottom() + 16, | |||
| getWidth(), getHeight() - previewArea.getBottom() - 16); | |||
| } | |||
| void mouseDown (const MouseEvent& e) | |||
| { | |||
| dragging = false; | |||
| draggingNewPoint = false; | |||
| int point = getPointAt (e.x); | |||
| if (point >= 0) | |||
| setSelectedPoint (point); | |||
| } | |||
| void mouseDrag (const MouseEvent& e) | |||
| { | |||
| if ((! dragging) && ! e.mouseWasClicked()) | |||
| { | |||
| preDragGradient = gradient; | |||
| const int mouseDownPoint = getPointAt (e.getMouseDownX()); | |||
| if (mouseDownPoint >= 0) | |||
| { | |||
| if (mouseDownPoint > 0 && mouseDownPoint < gradient.getNumColours() - 1) | |||
| { | |||
| dragging = true; | |||
| draggingNewPoint = false; | |||
| draggingColour = gradient.getColour (mouseDownPoint); | |||
| preDragGradient.removeColour (mouseDownPoint); | |||
| selectedPoint = -1; | |||
| } | |||
| } | |||
| else | |||
| { | |||
| dragging = true; | |||
| draggingNewPoint = true; | |||
| selectedPoint = -1; | |||
| } | |||
| } | |||
| if (dragging) | |||
| { | |||
| draggingPos = jlimit (0.001, 0.999, (e.x - previewArea.getX()) / (double) previewArea.getWidth()); | |||
| gradient = preDragGradient; | |||
| if (previewArea.expanded (6, 6).contains (e.x, e.y)) | |||
| { | |||
| if (draggingNewPoint) | |||
| draggingColour = preDragGradient.getColourAtPosition (draggingPos); | |||
| selectedPoint = gradient.addColour (draggingPos, draggingColour); | |||
| updatePicker(); | |||
| } | |||
| else | |||
| { | |||
| selectedPoint = -1; | |||
| } | |||
| sendChangeMessage (this); | |||
| repaint (previewArea.expanded (30, 30)); | |||
| } | |||
| } | |||
| void mouseUp (const MouseEvent& e) | |||
| { | |||
| dragging = false; | |||
| } | |||
| const ColourGradient& getGradient() const throw() { return gradient; } | |||
| void setGradient (const ColourGradient& newGradient) | |||
| { | |||
| if (newGradient != gradient || selectedPoint < 0) | |||
| { | |||
| jassert (newGradient.getNumColours() > 1); | |||
| gradient = newGradient; | |||
| if (selectedPoint < 0) | |||
| selectedPoint = 0; | |||
| linearButton.setToggleState (! gradient.isRadial, false); | |||
| radialButton.setToggleState (gradient.isRadial, false); | |||
| updatePicker(); | |||
| sendChangeMessage (this); | |||
| repaint(); | |||
| } | |||
| } | |||
| void setSelectedPoint (int newIndex) | |||
| { | |||
| if (selectedPoint != newIndex) | |||
| { | |||
| selectedPoint = newIndex; | |||
| updatePicker(); | |||
| repaint(); | |||
| } | |||
| } | |||
| void changeListenerCallback (void*) | |||
| { | |||
| if (selectedPoint >= 0 && (! dragging) && gradient.getColour (selectedPoint) != colourPicker.getCurrentColour()) | |||
| { | |||
| gradient.setColour (selectedPoint, colourPicker.getCurrentColour()); | |||
| repaint (previewArea); | |||
| sendChangeMessage (this); | |||
| } | |||
| } | |||
| void buttonClicked (Button* b) | |||
| { | |||
| ColourGradient g (gradient); | |||
| g.isRadial = (b == &radialButton); | |||
| setGradient (g); | |||
| } | |||
| private: | |||
| StoredSettings::ColourSelectorWithSwatches colourPicker; | |||
| ColourGradient gradient; | |||
| int selectedPoint; | |||
| bool dragging, draggingNewPoint; | |||
| double draggingPos; | |||
| Colour draggingColour; | |||
| ColourGradient preDragGradient; | |||
| Rectangle<int> previewArea; | |||
| TextButton linearButton, radialButton; | |||
| void updatePicker() | |||
| { | |||
| colourPicker.setVisible (selectedPoint >= 0); | |||
| if (selectedPoint >= 0) | |||
| colourPicker.setCurrentColour (gradient.getColour (selectedPoint)); | |||
| } | |||
| int getPointAt (const int x) const | |||
| { | |||
| int best = -1; | |||
| double bestDiff = 6; | |||
| for (int i = gradient.getNumColours(); --i >= 0;) | |||
| { | |||
| const double pos = previewArea.getX() + previewArea.getWidth() * gradient.getColourPosition (i); | |||
| const double diff = std::abs (pos - x); | |||
| if (diff < bestDiff) | |||
| { | |||
| bestDiff = diff; | |||
| best = i; | |||
| } | |||
| } | |||
| return best; | |||
| } | |||
| }; | |||
| //============================================================================== | |||
| class TiledFillDesigner : public Component, | |||
| public ChangeBroadcaster, | |||
| public ComboBoxListener, | |||
| public SliderListener | |||
| { | |||
| public: | |||
| TiledFillDesigner (Drawable::ImageProvider* imageProvider_, Project* project_) | |||
| : imageProvider (imageProvider_), project (project_) | |||
| { | |||
| addAndMakeVisible (&imageBox); | |||
| addAndMakeVisible (&opacitySlider); | |||
| opacitySlider.setRange (0.0, 1.0, 0.001); | |||
| sliderLabel.setText ("Opacity:", false); | |||
| sliderLabel.setColour (Label::textColourId, Colours::white); | |||
| sliderLabel.attachToComponent (&opacitySlider, false); | |||
| OwnedArray<Project::Item> images; | |||
| project->findAllImageItems (images); | |||
| for (int i = 0; i < images.size(); ++i) | |||
| imageBox.addItem (images.getUnchecked(i)->getName().toString(), i + 1); | |||
| imageBox.setTextWhenNothingSelected ("Select an image..."); | |||
| opacitySlider.addListener (this); | |||
| imageBox.addListener (this); | |||
| } | |||
| ~TiledFillDesigner() | |||
| { | |||
| } | |||
| const FillType getFill() const | |||
| { | |||
| return fill; | |||
| } | |||
| void setFill (const FillType& newFill) | |||
| { | |||
| if (fill != newFill) | |||
| { | |||
| fill = newFill; | |||
| OwnedArray<Project::Item> images; | |||
| project->findAllImageItems (images); | |||
| const String currentID (imageProvider->getIdentifierForImage (fill.image).toString()); | |||
| int idToSelect = -1; | |||
| for (int i = 0; i < images.size(); ++i) | |||
| { | |||
| if (images.getUnchecked(i)->getImageFileID() == currentID) | |||
| { | |||
| idToSelect = i + 1; | |||
| break; | |||
| } | |||
| } | |||
| imageBox.setSelectedId (idToSelect, true); | |||
| opacitySlider.setValue (fill.getOpacity(), false, false); | |||
| } | |||
| } | |||
| void resized() | |||
| { | |||
| imageBox.setBounds (20, 10, getWidth() - 40, 22); | |||
| opacitySlider.setBounds (20, 60, getWidth() - 40, 22); | |||
| } | |||
| void sliderValueChanged (Slider* slider) | |||
| { | |||
| if (opacitySlider.getValue() != fill.getOpacity()) | |||
| { | |||
| FillType f (fill); | |||
| f.setOpacity ((float) opacitySlider.getValue()); | |||
| setFill (f); | |||
| sendChangeMessage (this); | |||
| } | |||
| } | |||
| void comboBoxChanged (ComboBox* comboBoxThatHasChanged) | |||
| { | |||
| OwnedArray<Project::Item> images; | |||
| project->findAllImageItems (images); | |||
| Project::Item* item = images [imageBox.getSelectedId() - 1]; | |||
| if (item != 0) | |||
| { | |||
| Image im (imageProvider->getImageForIdentifier (item->getImageFileID())); | |||
| if (im.isValid() && im != fill.image) | |||
| { | |||
| FillType f (fill); | |||
| f.image = im; | |||
| setFill (f); | |||
| sendChangeMessage (this); | |||
| } | |||
| } | |||
| } | |||
| private: | |||
| FillType fill; | |||
| Drawable::ImageProvider* imageProvider; | |||
| Project* project; | |||
| ComboBox imageBox; | |||
| Slider opacitySlider; | |||
| Label sliderLabel; | |||
| }; | |||
| //============================================================================== | |||
| FillTypeEditorComponent* owner; | |||
| StoredSettings::ColourSelectorWithSwatches colourPicker; | |||
| GradientDesigner gradientPicker; | |||
| TiledFillDesigner tilePicker; | |||
| ColourGradient defaultGradient; | |||
| ValueTree fillState; | |||
| Drawable::ImageProvider* imageProvider; | |||
| UndoManager* undoManager; | |||
| TextButton colourButton, gradientButton, imageButton; | |||
| }; | |||
| //============================================================================== | |||
| /** | |||
| A component that shows a fill type swatch, and pops up a editor panel | |||
| when you click it. | |||
| */ | |||
| class FillTypeEditorComponent : public Component, | |||
| public ValueTree::Listener | |||
| { | |||
| public: | |||
| FillTypeEditorComponent (const ValueTree& fillState_, Drawable::ImageProvider* imageProvider_, | |||
| Project* project_, UndoManager* undoManager_) | |||
| : fillState (fillState_), undoManager (undoManager_), | |||
| imageProvider (imageProvider_), project (project_) | |||
| { | |||
| fillState.addListener (this); | |||
| refresh(); | |||
| } | |||
| ~FillTypeEditorComponent() | |||
| { | |||
| } | |||
| const ColourGradient getDefaultGradient() const; | |||
| void paint (Graphics& g) | |||
| { | |||
| g.setColour (Colours::grey); | |||
| g.drawRect (0, 0, getWidth(), getHeight(), 2); | |||
| g.fillCheckerBoard (2, 2, getWidth() - 4, getHeight() - 4, 10, 10, | |||
| Colour (0xffdddddd), Colour (0xffffffff)); | |||
| FillType f (fillType); | |||
| if (f.gradient != 0) | |||
| { | |||
| f.gradient->point1.setXY (2.0f, getHeight() / 2.0f); | |||
| f.gradient->point2.setXY (getWidth() - 2.0f, getHeight() / 2.0f); | |||
| } | |||
| g.setFillType (f); | |||
| g.fillRect (2, 2, getWidth() - 4, getHeight() - 4); | |||
| if (fillType.isColour()) | |||
| { | |||
| g.setColour (Colours::white.overlaidWith (fillType.colour).contrasting()); | |||
| g.setFont (getHeight() * 0.6f, Font::bold); | |||
| g.drawFittedText (fillType.colour.toDisplayString (true), | |||
| 2, 1, getWidth() - 4, getHeight() - 1, | |||
| Justification::centred, 1); | |||
| } | |||
| } | |||
| void refresh() | |||
| { | |||
| const FillType newFill (Drawable::ValueTreeWrapperBase::readFillType (fillState, 0, 0, 0, imageProvider)); | |||
| if (newFill != fillType) | |||
| { | |||
| fillType = newFill; | |||
| repaint(); | |||
| } | |||
| } | |||
| void mouseDown (const MouseEvent& e) | |||
| { | |||
| undoManager->beginNewTransaction(); | |||
| PopupFillSelector popup (fillState, getDefaultGradient(), imageProvider, project, undoManager); | |||
| CallOutBox c (popup, *this, 0 /*getTopLevelComponent()*/); | |||
| c.runModalLoop(); | |||
| } | |||
| void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged, const Identifier& property) { refresh(); } | |||
| void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) { refresh(); } | |||
| void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) {} | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| ValueTree fillState; | |||
| Drawable::ImageProvider* imageProvider; | |||
| UndoManager* undoManager; | |||
| Project* project; | |||
| FillType fillType; | |||
| }; | |||
| //============================================================================== | |||
| class FillTypePropertyComponent : public PropertyComponent | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| FillTypePropertyComponent (UndoManager* undoManager, const String& name, const ValueTree& fill, | |||
| Drawable::ImageProvider* imageProvider, Project* project) | |||
| : PropertyComponent (name), | |||
| editor (fill, imageProvider, project, undoManager) | |||
| { | |||
| jassert (fill.isValid()); | |||
| addAndMakeVisible (&editor); | |||
| } | |||
| ~FillTypePropertyComponent() | |||
| { | |||
| } | |||
| void resized() | |||
| { | |||
| editor.setBounds (getLookAndFeel().getPropertyComponentContentPosition (*this)); | |||
| } | |||
| virtual const ColourGradient getDefaultGradient() = 0; | |||
| void refresh() {} | |||
| protected: | |||
| FillTypeEditorComponent editor; | |||
| }; | |||
| #endif // __JUCER_FILLTYPEPROPERTYCOMPONENT_H_88CF1300__ | |||
| @@ -1,163 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_FONTPROPERTYCOMPONENT_H_930624E__ | |||
| #define __JUCER_FONTPROPERTYCOMPONENT_H_930624E__ | |||
| //============================================================================== | |||
| class FontNameValueSource : public Value::ValueSource, | |||
| public Value::Listener | |||
| { | |||
| public: | |||
| FontNameValueSource (const Value& source) | |||
| : sourceValue (source) | |||
| { | |||
| sourceValue.addListener (this); | |||
| } | |||
| ~FontNameValueSource() {} | |||
| void valueChanged (Value&) { sendChangeMessage (true); } | |||
| const var getValue() const | |||
| { | |||
| return Font::fromString (sourceValue.toString()).getTypefaceName(); | |||
| } | |||
| void setValue (const var& newValue) | |||
| { | |||
| Font font (Font::fromString (sourceValue.toString())); | |||
| font.setTypefaceName (newValue.toString()); | |||
| sourceValue = font.toString(); | |||
| } | |||
| static ChoicePropertyComponent* createProperty (const String& title, const Value& value) | |||
| { | |||
| StringArray fontNames; | |||
| fontNames.add (Font::getDefaultSansSerifFontName()); | |||
| fontNames.add (Font::getDefaultSerifFontName()); | |||
| fontNames.add (Font::getDefaultMonospacedFontName()); | |||
| fontNames.add (String::empty); | |||
| fontNames.addArray (StoredSettings::getInstance()->getFontNames()); | |||
| Array<var> values; | |||
| for (int i = 0; i < fontNames.size(); ++i) | |||
| values.add (fontNames[i]); | |||
| return new ChoicePropertyComponent (Value (new FontNameValueSource (value)), title, fontNames, values); | |||
| } | |||
| private: | |||
| Value sourceValue; | |||
| }; | |||
| //============================================================================== | |||
| class FontSizeValueSource : public Value::ValueSource, | |||
| public Value::Listener | |||
| { | |||
| public: | |||
| FontSizeValueSource (const Value& source) | |||
| : sourceValue (source) | |||
| { | |||
| sourceValue.addListener (this); | |||
| } | |||
| ~FontSizeValueSource() {} | |||
| void valueChanged (Value&) { sendChangeMessage (true); } | |||
| const var getValue() const | |||
| { | |||
| return Font::fromString (sourceValue.toString()).getHeight(); | |||
| } | |||
| void setValue (const var& newValue) | |||
| { | |||
| Font font (Font::fromString (sourceValue.toString())); | |||
| font.setHeight (newValue); | |||
| sourceValue = font.toString(); | |||
| } | |||
| static PropertyComponent* createProperty (const String& title, const Value& value) | |||
| { | |||
| return new SliderPropertyComponent (Value (new FontSizeValueSource (value)), title, 1.0, 150.0, 0.1, 0.5); | |||
| } | |||
| private: | |||
| Value sourceValue; | |||
| }; | |||
| //============================================================================== | |||
| class FontStyleValueSource : public Value::ValueSource, | |||
| public Value::Listener | |||
| { | |||
| public: | |||
| FontStyleValueSource (const Value& source) | |||
| : sourceValue (source) | |||
| { | |||
| sourceValue.addListener (this); | |||
| } | |||
| ~FontStyleValueSource() {} | |||
| void valueChanged (Value&) { sendChangeMessage (true); } | |||
| const var getValue() const | |||
| { | |||
| const Font f (Font::fromString (sourceValue.toString())); | |||
| if (f.isBold() && f.isItalic()) return getStyles() [3]; | |||
| if (f.isBold()) return getStyles() [1]; | |||
| if (f.isItalic()) return getStyles() [2]; | |||
| return getStyles() [0]; | |||
| } | |||
| void setValue (const var& newValue) | |||
| { | |||
| Font font (Font::fromString (sourceValue.toString())); | |||
| font.setBold (newValue.toString().containsIgnoreCase ("Bold")); | |||
| font.setItalic (newValue.toString().containsIgnoreCase ("Italic")); | |||
| sourceValue = font.toString(); | |||
| } | |||
| static PropertyComponent* createProperty (const String& title, const Value& value) | |||
| { | |||
| return new ChoicePropertyComponent (Value (new FontStyleValueSource (value)), title, StringArray (getStyles()), Array<var> (getStyles())); | |||
| } | |||
| static const char* const* getStyles() | |||
| { | |||
| static const char* const fontStyles[] = { "Normal", "Bold", "Italic", "Bold + Italic", 0 }; | |||
| return fontStyles; | |||
| } | |||
| private: | |||
| Value sourceValue; | |||
| }; | |||
| #endif // __JUCER_FONTPROPERTYCOMPONENT_H_930624E__ | |||
| @@ -1,166 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_MARKERLISTBASE_H_E0091A88__ | |||
| #define __JUCER_MARKERLISTBASE_H_E0091A88__ | |||
| #include "jucer_CoordinatePropertyComponent.h" | |||
| //============================================================================== | |||
| class MarkerListBase : public RelativeCoordinate::NamedCoordinateFinder | |||
| { | |||
| public: | |||
| MarkerListBase (bool isX_) : isX (isX_) {} | |||
| virtual ~MarkerListBase() {} | |||
| bool isHorizontal() const { return isX; } | |||
| virtual const String getId (const ValueTree& markerState) = 0; | |||
| virtual int size() const = 0; | |||
| virtual ValueTree getMarker (int index) const = 0; | |||
| virtual ValueTree getMarkerNamed (const String& name) const = 0; | |||
| virtual bool contains (const ValueTree& markerState) const = 0; | |||
| virtual bool isSpecialMarker (const ValueTree& markerState) const = 0; | |||
| const String getName (const ValueTree& markerState) const { return markerState [getMarkerNameProperty()].toString(); } | |||
| Value getNameAsValue (const ValueTree& markerState) const { return markerState.getPropertyAsValue (getMarkerNameProperty(), getUndoManager()); } | |||
| const RelativeCoordinate getCoordinate (const ValueTree& markerState) const { return RelativeCoordinate (markerState [getMarkerPosProperty()].toString(), isX); } | |||
| void setCoordinate (ValueTree& markerState, const RelativeCoordinate& newCoord) { markerState.setProperty (getMarkerPosProperty(), newCoord.toString(), getUndoManager()); } | |||
| void renameAnchorInMarkers (const String& oldName, const String& newName) | |||
| { | |||
| for (int i = size(); --i >= 0;) | |||
| { | |||
| ValueTree v (getMarker (i)); | |||
| RelativeCoordinate coord (getCoordinate (v)); | |||
| coord.renameAnchorIfUsed (oldName, newName, this); | |||
| setCoordinate (v, coord); | |||
| } | |||
| } | |||
| virtual void createMarker (const String& name, double position) = 0; | |||
| virtual void deleteMarker (ValueTree& markerState) = 0; | |||
| //============================================================================== | |||
| virtual UndoManager* getUndoManager() const = 0; | |||
| virtual const String getNonexistentMarkerName (const String& name) = 0; | |||
| virtual void renameAnchor (const String& oldName, const String& newName) = 0; | |||
| virtual void addMarkerMenuItems (const ValueTree& markerState, const RelativeCoordinate& coord, PopupMenu& menu, bool isAnchor1) = 0; | |||
| virtual const String getChosenMarkerMenuItem (const RelativeCoordinate& coord, int itemId) const = 0; | |||
| //============================================================================== | |||
| static const Identifier getMarkerTag() { static Identifier i ("MARKER"); return i; } | |||
| static const Identifier getMarkerNameProperty() { return Ids::name; } | |||
| static const Identifier getMarkerPosProperty() { return Ids::position; } | |||
| //============================================================================== | |||
| class MarkerNameValueSource : public Value::ValueSource, | |||
| public Value::Listener | |||
| { | |||
| public: | |||
| MarkerNameValueSource (MarkerListBase* markerList_, const Value& value) | |||
| : sourceValue (value), | |||
| markerList (markerList_) | |||
| { | |||
| sourceValue.addListener (this); | |||
| } | |||
| ~MarkerNameValueSource() {} | |||
| void valueChanged (Value&) { sendChangeMessage (true); } | |||
| const var getValue() const { return sourceValue.toString(); } | |||
| void setValue (const var& newValue) | |||
| { | |||
| if (newValue == sourceValue) | |||
| return; | |||
| const String name (markerList->getNonexistentMarkerName (newValue)); | |||
| if (sourceValue != name) | |||
| { | |||
| markerList->renameAnchor (sourceValue.toString(), name); | |||
| sourceValue = name; | |||
| } | |||
| } | |||
| private: | |||
| Value sourceValue; | |||
| MarkerListBase* markerList; | |||
| MarkerNameValueSource (const MarkerNameValueSource&); | |||
| const MarkerNameValueSource& operator= (const MarkerNameValueSource&); | |||
| }; | |||
| //============================================================================== | |||
| class PositionPropertyComponent : public CoordinatePropertyComponent | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| PositionPropertyComponent (MarkerListBase& markerList_, | |||
| const String& name, const ValueTree& markerState_, | |||
| const Value& coordValue_) | |||
| : CoordinatePropertyComponent (&markerList_, name, coordValue_, markerList_.isHorizontal()), | |||
| markerList (markerList_), | |||
| markerState (markerState_) | |||
| { | |||
| } | |||
| ~PositionPropertyComponent() | |||
| { | |||
| } | |||
| const String pickMarker (TextButton* button, const String& currentMarker, bool isAnchor1) | |||
| { | |||
| RelativeCoordinate coord (getCoordinate()); | |||
| PopupMenu m; | |||
| markerList.addMarkerMenuItems (markerState, coord, m, isAnchor1); | |||
| const int r = m.showAt (button); | |||
| if (r > 0) | |||
| return markerList.getChosenMarkerMenuItem (coord, r); | |||
| return String::empty; | |||
| } | |||
| private: | |||
| MarkerListBase& markerList; | |||
| ValueTree markerState; | |||
| }; | |||
| //============================================================================== | |||
| protected: | |||
| const bool isX; | |||
| private: | |||
| MarkerListBase (const MarkerListBase&); | |||
| MarkerListBase& operator= (const MarkerListBase&); | |||
| }; | |||
| #endif // __JUCER_MARKERLISTBASE_H_E0091A88__ | |||
| @@ -24,7 +24,6 @@ | |||
| */ | |||
| #include "../jucer_Headers.h" | |||
| #include "jucer_FillTypePropertyComponent.h" | |||
| //============================================================================== | |||
| @@ -404,11 +403,3 @@ RelativeRectangleLayoutManager::ComponentPosition::ComponentPosition (Component* | |||
| : component (component_), name (name_), coords (coords_) | |||
| { | |||
| } | |||
| //============================================================================== | |||
| const ColourGradient FillTypeEditorComponent::getDefaultGradient() const | |||
| { | |||
| FillTypePropertyComponent* p = dynamic_cast <FillTypePropertyComponent*> (getParentComponent()); | |||
| jassert (p != 0); | |||
| return p->getDefaultGradient(); | |||
| } | |||
| @@ -0,0 +1,109 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_PRESETIDS_H_40E9E82E__ | |||
| #define __JUCER_PRESETIDS_H_40E9E82E__ | |||
| // Handy list of static Identifiers.. | |||
| namespace Ids | |||
| { | |||
| #define DECLARE_ID(name) const Identifier name (#name) | |||
| DECLARE_ID (text); | |||
| DECLARE_ID (name); | |||
| DECLARE_ID (file); | |||
| DECLARE_ID (font); | |||
| DECLARE_ID (mode); | |||
| DECLARE_ID (type); | |||
| DECLARE_ID (version); | |||
| DECLARE_ID (position); | |||
| DECLARE_ID (source); | |||
| DECLARE_ID (readOnly); | |||
| DECLARE_ID (editMode); | |||
| DECLARE_ID (justification); | |||
| DECLARE_ID (items); | |||
| DECLARE_ID (editable); | |||
| DECLARE_ID (textJustification); | |||
| DECLARE_ID (unselectedText); | |||
| DECLARE_ID (noItemsText); | |||
| DECLARE_ID (min); | |||
| DECLARE_ID (max); | |||
| DECLARE_ID (width); | |||
| DECLARE_ID (height); | |||
| DECLARE_ID (background); | |||
| DECLARE_ID (interval); | |||
| DECLARE_ID (textBoxPos); | |||
| DECLARE_ID (textBoxWidth); | |||
| DECLARE_ID (textBoxHeight); | |||
| DECLARE_ID (skew); | |||
| DECLARE_ID (scrollBarV); | |||
| DECLARE_ID (scrollBarH); | |||
| DECLARE_ID (scrollbarWidth); | |||
| DECLARE_ID (initialState); | |||
| DECLARE_ID (scrollbarsShown); | |||
| DECLARE_ID (caretVisible); | |||
| DECLARE_ID (popupMenuEnabled); | |||
| DECLARE_ID (radioGroup); | |||
| DECLARE_ID (connectedLeft); | |||
| DECLARE_ID (connectedRight); | |||
| DECLARE_ID (connectedTop); | |||
| DECLARE_ID (connectedBottom); | |||
| DECLARE_ID (juceFolder); | |||
| DECLARE_ID (targetFolder); | |||
| DECLARE_ID (vstFolder); | |||
| DECLARE_ID (rtasFolder); | |||
| DECLARE_ID (auFolder); | |||
| DECLARE_ID (extraCompilerFlags); | |||
| DECLARE_ID (extraLinkerFlags); | |||
| DECLARE_ID (extraDefs); | |||
| DECLARE_ID (libraryName_Debug); | |||
| DECLARE_ID (libraryName_Release); | |||
| DECLARE_ID (libraryType); | |||
| DECLARE_ID (isDebug); | |||
| DECLARE_ID (targetName); | |||
| DECLARE_ID (binaryPath); | |||
| DECLARE_ID (optimisation); | |||
| DECLARE_ID (defines); | |||
| DECLARE_ID (headerPath); | |||
| DECLARE_ID (osxSDK); | |||
| DECLARE_ID (osxCompatibility); | |||
| DECLARE_ID (jucerVersion); | |||
| DECLARE_ID (projectType); | |||
| DECLARE_ID (juceLinkage); | |||
| DECLARE_ID (buildVST); | |||
| DECLARE_ID (bundleIdentifier); | |||
| DECLARE_ID (compile); | |||
| DECLARE_ID (resource); | |||
| DECLARE_ID (className); | |||
| DECLARE_ID (classDesc); | |||
| DECLARE_ID (controlPoint); | |||
| const Identifier class_ ("class"); | |||
| const Identifier id_ ("id"); | |||
| #undef DECLARE_ID | |||
| } | |||
| #endif // __JUCER_PRESETIDS_H_40E9E82E__ | |||
| @@ -92,6 +92,8 @@ void StoredSettings::flush() | |||
| #undef COL | |||
| const int numSwatchColours = 24; | |||
| for (int i = 0; i < numSwatchColours; ++i) | |||
| { | |||
| Colour defaultCol (colours [2 + i]); | |||
| @@ -1,148 +0,0 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCER_TICKITERATOR_H_8D744D8A__ | |||
| #define __JUCER_TICKITERATOR_H_8D744D8A__ | |||
| //============================================================================== | |||
| class TickIterator | |||
| { | |||
| public: | |||
| TickIterator (const double startValue_, const double endValue_, const double valuePerPixel_, | |||
| int minPixelsPerTick, int minWidthForLabels) | |||
| : startValue (startValue_), | |||
| endValue (endValue_), | |||
| valuePerPixel (valuePerPixel_) | |||
| { | |||
| tickLevelIndex = findLevelIndexForValue (valuePerPixel * minPixelsPerTick); | |||
| labelLevelIndex = findLevelIndexForValue (valuePerPixel * minWidthForLabels); | |||
| tickPosition = pixelsToValue (-minWidthForLabels); | |||
| tickPosition = snapValueDown (tickPosition, tickLevelIndex); | |||
| } | |||
| bool getNextTick (float& pixelX, float& tickLength, String& label) | |||
| { | |||
| const double tickUnits = getTickSizes() [tickLevelIndex]; | |||
| tickPosition += tickUnits; | |||
| const int totalLevels = getNumTickSizes(); | |||
| int highestIndex = tickLevelIndex; | |||
| while (++highestIndex < totalLevels) | |||
| { | |||
| const double ticksAtThisLevel = tickPosition / getTickSizes() [highestIndex]; | |||
| if (fabs (ticksAtThisLevel - floor (ticksAtThisLevel + 0.5)) > 0.000001) | |||
| break; | |||
| } | |||
| --highestIndex; | |||
| if (highestIndex >= labelLevelIndex) | |||
| label = getDescriptionOfValue (tickPosition, labelLevelIndex); | |||
| else | |||
| label = String::empty; | |||
| tickLength = (highestIndex + 1 - tickLevelIndex) / (float) (totalLevels + 1 - tickLevelIndex); | |||
| pixelX = valueToPixels (tickPosition); | |||
| return tickPosition < endValue; | |||
| } | |||
| private: | |||
| double tickPosition; | |||
| int tickLevelIndex, labelLevelIndex; | |||
| const double startValue, endValue, valuePerPixel; | |||
| static int getNumTickSizes() | |||
| { | |||
| return 10; | |||
| } | |||
| static const double* getTickSizes() | |||
| { | |||
| static const double tickSizes[] = { 1.0, 2.0, 5.0, | |||
| 10.0, 20.0, 50.0, | |||
| 100.0, 200.0, 500.0, 1000.0 }; | |||
| return tickSizes; | |||
| } | |||
| int findLevelIndexForValue (const double value) const | |||
| { | |||
| int i; | |||
| for (i = 0; i < getNumTickSizes(); ++i) | |||
| if (getTickSizes() [i] >= value) | |||
| break; | |||
| return i; | |||
| } | |||
| double pixelsToValue (int pixels) const | |||
| { | |||
| return startValue + pixels * valuePerPixel; | |||
| } | |||
| float valueToPixels (double value) const | |||
| { | |||
| return (float) ((value - startValue) / valuePerPixel); | |||
| } | |||
| static double snapValueToNearest (const double t, const int valueLevelIndex) | |||
| { | |||
| const double unitsPerInterval = getTickSizes() [valueLevelIndex]; | |||
| return unitsPerInterval * floor (t / unitsPerInterval + 0.5); | |||
| } | |||
| static double snapValueDown (const double t, const int valueLevelIndex) | |||
| { | |||
| const double unitsPerInterval = getTickSizes() [valueLevelIndex]; | |||
| return unitsPerInterval * floor (t / unitsPerInterval); | |||
| } | |||
| static inline int roundDoubleToInt (const double value) | |||
| { | |||
| union { int asInt[2]; double asDouble; } n; | |||
| n.asDouble = value + 6755399441055744.0; | |||
| #if TARGET_RT_BIG_ENDIAN | |||
| return n.asInt [1]; | |||
| #else | |||
| return n.asInt [0]; | |||
| #endif | |||
| } | |||
| static const String getDescriptionOfValue (const double value, const int valueLevelIndex) | |||
| { | |||
| return String (roundToInt (value)); | |||
| } | |||
| TickIterator (const TickIterator&); | |||
| TickIterator& operator= (const TickIterator&); | |||
| }; | |||
| #endif // __JUCER_TICKITERATOR_H_8D744D8A__ | |||
| @@ -203,6 +203,7 @@ bool JUCEApplication::initialiseApp (String& commandLine) | |||
| if (! appLock->enter(0)) | |||
| { | |||
| appLock = 0; | |||
| MessageManager::broadcastMessage (getApplicationName() + "/" + commandLineParameters); | |||
| delete appInstance; | |||