@@ -80,6 +80,8 @@ OBJECTS_APP := \ | |||
$(JUCE_OBJDIR)/jucer_ComponentDocument_1d8c1063.o \ | |||
$(JUCE_OBJDIR)/jucer_ColouredElement_acb45c39.o \ | |||
$(JUCE_OBJDIR)/jucer_PaintElement_db652060.o \ | |||
$(JUCE_OBJDIR)/jucer_PaintElementGroup_256346c9.o \ | |||
$(JUCE_OBJDIR)/jucer_PaintElementImage_49702ba5.o \ | |||
$(JUCE_OBJDIR)/jucer_PaintElementPath_d1b280a5.o \ | |||
$(JUCE_OBJDIR)/jucer_ComponentLayoutEditor_4fc44b8d.o \ | |||
$(JUCE_OBJDIR)/jucer_ComponentOverlayComponent_5e028963.o \ | |||
@@ -110,6 +112,7 @@ OBJECTS_APP := \ | |||
$(JUCE_OBJDIR)/jucer_FileHelpers_54f12f83.o \ | |||
$(JUCE_OBJDIR)/jucer_MiscUtilities_31fc8dd8.o \ | |||
$(JUCE_OBJDIR)/jucer_DependencyPathPropertyComponent_5d68c773.o \ | |||
$(JUCE_OBJDIR)/jucer_TextWithDefaultPropertyComponentWithEnablement_537a85b0.o \ | |||
$(JUCE_OBJDIR)/jucer_Icons_d02d18f1.o \ | |||
$(JUCE_OBJDIR)/jucer_JucerTreeViewBase_9b9f2ff0.o \ | |||
$(JUCE_OBJDIR)/jucer_ProjucerLookAndFeel_3b20291d.o \ | |||
@@ -196,6 +199,16 @@ $(JUCE_OBJDIR)/jucer_PaintElement_db652060.o: ../../Source/ComponentEditor/Paint | |||
@echo "Compiling jucer_PaintElement.cpp" | |||
$(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" | |||
$(JUCE_OBJDIR)/jucer_PaintElementGroup_256346c9.o: ../../Source/ComponentEditor/PaintElements/jucer_PaintElementGroup.cpp | |||
-$(V_AT)mkdir -p $(JUCE_OBJDIR) | |||
@echo "Compiling jucer_PaintElementGroup.cpp" | |||
$(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" | |||
$(JUCE_OBJDIR)/jucer_PaintElementImage_49702ba5.o: ../../Source/ComponentEditor/PaintElements/jucer_PaintElementImage.cpp | |||
-$(V_AT)mkdir -p $(JUCE_OBJDIR) | |||
@echo "Compiling jucer_PaintElementImage.cpp" | |||
$(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" | |||
$(JUCE_OBJDIR)/jucer_PaintElementPath_d1b280a5.o: ../../Source/ComponentEditor/PaintElements/jucer_PaintElementPath.cpp | |||
-$(V_AT)mkdir -p $(JUCE_OBJDIR) | |||
@echo "Compiling jucer_PaintElementPath.cpp" | |||
@@ -346,6 +359,11 @@ $(JUCE_OBJDIR)/jucer_DependencyPathPropertyComponent_5d68c773.o: ../../Source/Ut | |||
@echo "Compiling jucer_DependencyPathPropertyComponent.cpp" | |||
$(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" | |||
$(JUCE_OBJDIR)/jucer_TextWithDefaultPropertyComponentWithEnablement_537a85b0.o: ../../Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.cpp | |||
-$(V_AT)mkdir -p $(JUCE_OBJDIR) | |||
@echo "Compiling jucer_TextWithDefaultPropertyComponentWithEnablement.cpp" | |||
$(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" | |||
$(JUCE_OBJDIR)/jucer_Icons_d02d18f1.o: ../../Source/Utility/UI/jucer_Icons.cpp | |||
-$(V_AT)mkdir -p $(JUCE_OBJDIR) | |||
@echo "Compiling jucer_Icons.cpp" | |||
@@ -36,6 +36,8 @@ | |||
6EAAAAB0C2B2DA259B26D63C = {isa = PBXBuildFile; fileRef = 1DCA18E935A35D29D2D9B6A0; }; | |||
4C0F95265A230E5A8717A0A9 = {isa = PBXBuildFile; fileRef = D6390A40B3279E0E626C78D3; }; | |||
FFA8B18CDF2D2AA500698A96 = {isa = PBXBuildFile; fileRef = 512D80BE12634967A085A1DC; }; | |||
EE26A1C2DAAB609362F407EA = {isa = PBXBuildFile; fileRef = 988F5C1E40DED02D8B064253; }; | |||
4FAAB649E846BA2764C02ACE = {isa = PBXBuildFile; fileRef = 72ED72174F9DBD0ABD8AFCED; }; | |||
7D750EF5FCE1E1A461D435BE = {isa = PBXBuildFile; fileRef = 4AE72953E3B3DF06D3B9BA86; }; | |||
537ABF1DB09DDBD1542A2B0C = {isa = PBXBuildFile; fileRef = EF25A29A2194FC107B40F65F; }; | |||
290F2CD930097091B8DB122E = {isa = PBXBuildFile; fileRef = 00E6B87A43453B51850550E1; }; | |||
@@ -66,6 +68,7 @@ | |||
BF913199032B4CE970E82AA3 = {isa = PBXBuildFile; fileRef = B403AF75EAF361ED74EE476E; }; | |||
25EF9B3FECB4C9F0F522DCAA = {isa = PBXBuildFile; fileRef = 486E8D02DAD2A0BF54A901C0; }; | |||
2BEC1197D981951D8A897F01 = {isa = PBXBuildFile; fileRef = D859E9EA11A71BD6E85DC649; }; | |||
0CB5951330922218F72FC2C2 = {isa = PBXBuildFile; fileRef = B2EE6D7D91DF84E71DE91B39; }; | |||
D0E26EB54B0087C8BE3D541E = {isa = PBXBuildFile; fileRef = 846B2A670C5A19DE0039E11A; }; | |||
468548FB21D264DC12321327 = {isa = PBXBuildFile; fileRef = 4D5F0CA8D1273144681A1D48; }; | |||
6ECB2F11D2F593FACCCF99DB = {isa = PBXBuildFile; fileRef = 0F8C000E5FF4A2DAC1FEF8EB; }; | |||
@@ -214,6 +217,7 @@ | |||
719B56C8587863D7AE9B69C6 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_RelativePositionedRectangle.h"; path = "../../Source/ComponentEditor/UI/jucer_RelativePositionedRectangle.h"; sourceTree = "SOURCE_ROOT"; }; | |||
7211101FFA28400ADBB1D47A = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_Module.h"; path = "../../Source/Project/jucer_Module.h"; sourceTree = "SOURCE_ROOT"; }; | |||
728FE25157E9874D50BBECB2 = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; | |||
72ED72174F9DBD0ABD8AFCED = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_PaintElementImage.cpp"; path = "../../Source/ComponentEditor/PaintElements/jucer_PaintElementImage.cpp"; sourceTree = "SOURCE_ROOT"; }; | |||
73DE14CEAD25D3445457013E = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_SliderHandler.h"; path = "../../Source/ComponentEditor/Components/jucer_SliderHandler.h"; sourceTree = "SOURCE_ROOT"; }; | |||
75BE2887C6F324B818D80A21 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_SnapGridPainter.h"; path = "../../Source/ComponentEditor/UI/jucer_SnapGridPainter.h"; sourceTree = "SOURCE_ROOT"; }; | |||
7687A1374C60A025BDBE98DE = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_PointComponent.h"; path = "../../Source/ComponentEditor/PaintElements/jucer_PointComponent.h"; sourceTree = "SOURCE_ROOT"; }; | |||
@@ -227,6 +231,7 @@ | |||
7F0A5319912991615FC57945 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ColourPropertyComponent.h"; path = "../../Source/ComponentEditor/Properties/jucer_ColourPropertyComponent.h"; sourceTree = "SOURCE_ROOT"; }; | |||
807049CA2D5B6DE18EA078F2 = {isa = PBXFileReference; lastKnownFileType = file.svg; name = "export_android.svg"; path = "../../Source/BinaryData/Icons/export_android.svg"; sourceTree = "SOURCE_ROOT"; }; | |||
80D62B907248523E6943298B = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; | |||
816153F27E83EBA694EAA9F0 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_TextWithDefaultPropertyComponentWithEnablement.h"; path = "../../Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.h"; sourceTree = "SOURCE_ROOT"; }; | |||
8336A43CE1C3C26D7C7B53D8 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_NewComponentTemplate.cpp"; path = "../../Source/BinaryData/Templates/jucer_NewComponentTemplate.cpp"; sourceTree = "SOURCE_ROOT"; }; | |||
842427CFE565F3FCE5B99174 = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DiscRecording.framework; path = System/Library/Frameworks/DiscRecording.framework; sourceTree = SDKROOT; }; | |||
846B2A670C5A19DE0039E11A = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_Icons.cpp"; path = "../../Source/Utility/UI/jucer_Icons.cpp"; sourceTree = "SOURCE_ROOT"; }; | |||
@@ -258,6 +263,7 @@ | |||
95EAB6EC9B724538B93910D4 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_TabComponents.h"; path = "../../Source/Project/UI/Sidebar/jucer_TabComponents.h"; sourceTree = "SOURCE_ROOT"; }; | |||
97A847B59EE04483E8850E4B = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_MainTemplate_SimpleWindow.cpp"; path = "../../Source/BinaryData/Templates/jucer_MainTemplate_SimpleWindow.cpp"; sourceTree = "SOURCE_ROOT"; }; | |||
983CFBA01CA8811F30FA7F4C = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_MiscUtilities.h"; path = "../../Source/Utility/Helpers/jucer_MiscUtilities.h"; sourceTree = "SOURCE_ROOT"; }; | |||
988F5C1E40DED02D8B064253 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_PaintElementGroup.cpp"; path = "../../Source/ComponentEditor/PaintElements/jucer_PaintElementGroup.cpp"; sourceTree = "SOURCE_ROOT"; }; | |||
98E6D61BFF7D85F0E00F0FBF = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_LicenseWebview.h"; path = "../../Source/Licenses/jucer_LicenseWebview.h"; sourceTree = "SOURCE_ROOT"; }; | |||
9914F905BFCFBE5F76619670 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ColouredElement.h"; path = "../../Source/ComponentEditor/PaintElements/jucer_ColouredElement.h"; sourceTree = "SOURCE_ROOT"; }; | |||
9992E6950C64322A11E39ADF = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ProjectWizard_DLL.h"; path = "../../Source/Wizards/jucer_ProjectWizard_DLL.h"; sourceTree = "SOURCE_ROOT"; }; | |||
@@ -292,6 +298,7 @@ | |||
B1C2F8ED14BF914CD1882708 = {isa = PBXFileReference; lastKnownFileType = file.svg; name = "wizard_Openfile.svg"; path = "../../Source/BinaryData/Icons/wizard_Openfile.svg"; sourceTree = "SOURCE_ROOT"; }; | |||
B24E3F34C3C4EE54A60C35CC = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_LiveCodeBuilderDLL.h"; path = "../../Source/LiveBuildEngine/jucer_LiveCodeBuilderDLL.h"; sourceTree = "SOURCE_ROOT"; }; | |||
B2CB95B3F44C3CC5735051A3 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_JustificationProperty.h"; path = "../../Source/ComponentEditor/Properties/jucer_JustificationProperty.h"; sourceTree = "SOURCE_ROOT"; }; | |||
B2EE6D7D91DF84E71DE91B39 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_TextWithDefaultPropertyComponentWithEnablement.cpp"; path = "../../Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.cpp"; sourceTree = "SOURCE_ROOT"; }; | |||
B3528C08B84CBC950252EA69 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ModulesInformationComponent.h"; path = "../../Source/Project/UI/jucer_ModulesInformationComponent.h"; sourceTree = "SOURCE_ROOT"; }; | |||
B403AF75EAF361ED74EE476E = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_FileHelpers.cpp"; path = "../../Source/Utility/Helpers/jucer_FileHelpers.cpp"; sourceTree = "SOURCE_ROOT"; }; | |||
B6F2905330EA5C560D527209 = {isa = PBXFileReference; lastKnownFileType = file; name = "juce_graphics"; path = "../../../../modules/juce_graphics"; sourceTree = "SOURCE_ROOT"; }; | |||
@@ -506,7 +513,9 @@ | |||
512D80BE12634967A085A1DC, | |||
4AE469CD40BDAD634135785E, | |||
F073B54B36D845915CD6D2C1, | |||
988F5C1E40DED02D8B064253, | |||
BCB6C87E3992930674E54D16, | |||
72ED72174F9DBD0ABD8AFCED, | |||
7031E8CB6D4D84BD980A0BD0, | |||
4AE72953E3B3DF06D3B9BA86, | |||
DA4D0CC5149F7C0FBDAF34A2, | |||
@@ -654,7 +663,9 @@ | |||
D859E9EA11A71BD6E85DC649, | |||
F8F94093A0963D86BD27A95D, | |||
E367FC2BDAF5EBA48D767FBB, | |||
25EC5A11CA56CAF4468C4D9C, ); name = PropertyComponents; sourceTree = "<group>"; }; | |||
25EC5A11CA56CAF4468C4D9C, | |||
B2EE6D7D91DF84E71DE91B39, | |||
816153F27E83EBA694EAA9F0, ); name = PropertyComponents; sourceTree = "<group>"; }; | |||
DD068F16F341D15E150CE6F1 = {isa = PBXGroup; children = ( | |||
15F56361B9CF3E0BE705E64D, | |||
169DD91232C070C4D6470B31, | |||
@@ -913,6 +924,8 @@ | |||
6EAAAAB0C2B2DA259B26D63C, | |||
4C0F95265A230E5A8717A0A9, | |||
FFA8B18CDF2D2AA500698A96, | |||
EE26A1C2DAAB609362F407EA, | |||
4FAAB649E846BA2764C02ACE, | |||
7D750EF5FCE1E1A461D435BE, | |||
537ABF1DB09DDBD1542A2B0C, | |||
290F2CD930097091B8DB122E, | |||
@@ -943,6 +956,7 @@ | |||
BF913199032B4CE970E82AA3, | |||
25EF9B3FECB4C9F0F522DCAA, | |||
2BEC1197D981951D8A897F01, | |||
0CB5951330922218F72FC2C2, | |||
D0E26EB54B0087C8BE3D541E, | |||
468548FB21D264DC12321327, | |||
6ECB2F11D2F593FACCCF99DB, | |||
@@ -201,6 +201,8 @@ | |||
<ClCompile Include="..\..\Source\ComponentEditor\Documents\jucer_ComponentDocument.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_ColouredElement.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElement.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementGroup.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementImage.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementPath.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\UI\jucer_ComponentLayoutEditor.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\UI\jucer_ComponentOverlayComponent.cpp"/> | |||
@@ -234,6 +236,7 @@ | |||
<ClCompile Include="..\..\Source\Utility\Helpers\jucer_FileHelpers.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\Helpers\jucer_MiscUtilities.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\PropertyComponents\jucer_DependencyPathPropertyComponent.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponentWithEnablement.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\jucer_Icons.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\jucer_JucerTreeViewBase.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\jucer_ProjucerLookAndFeel.cpp"/> | |||
@@ -1548,6 +1551,7 @@ | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_DependencyPathPropertyComponent.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_FilePathPropertyComponent.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponent.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponentWithEnablement.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\jucer_IconButton.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\jucer_Icons.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\jucer_JucerTreeViewBase.h"/> | |||
@@ -373,6 +373,12 @@ | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElement.cpp"> | |||
<Filter>Projucer\ComponentEditor\PaintElements</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementGroup.cpp"> | |||
<Filter>Projucer\ComponentEditor\PaintElements</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementImage.cpp"> | |||
<Filter>Projucer\ComponentEditor\PaintElements</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementPath.cpp"> | |||
<Filter>Projucer\ComponentEditor\PaintElements</Filter> | |||
</ClCompile> | |||
@@ -466,6 +472,9 @@ | |||
<ClCompile Include="..\..\Source\Utility\UI\PropertyComponents\jucer_DependencyPathPropertyComponent.cpp"> | |||
<Filter>Projucer\Utility\UI\PropertyComponents</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponentWithEnablement.cpp"> | |||
<Filter>Projucer\Utility\UI\PropertyComponents</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\Utility\UI\jucer_Icons.cpp"> | |||
<Filter>Projucer\Utility\UI</Filter> | |||
</ClCompile> | |||
@@ -2193,6 +2202,9 @@ | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponent.h"> | |||
<Filter>Projucer\Utility\UI\PropertyComponents</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponentWithEnablement.h"> | |||
<Filter>Projucer\Utility\UI\PropertyComponents</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\..\Source\Utility\UI\jucer_IconButton.h"> | |||
<Filter>Projucer\Utility\UI</Filter> | |||
</ClInclude> | |||
@@ -201,6 +201,8 @@ | |||
<ClCompile Include="..\..\Source\ComponentEditor\Documents\jucer_ComponentDocument.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_ColouredElement.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElement.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementGroup.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementImage.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementPath.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\UI\jucer_ComponentLayoutEditor.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\UI\jucer_ComponentOverlayComponent.cpp"/> | |||
@@ -234,6 +236,7 @@ | |||
<ClCompile Include="..\..\Source\Utility\Helpers\jucer_FileHelpers.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\Helpers\jucer_MiscUtilities.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\PropertyComponents\jucer_DependencyPathPropertyComponent.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponentWithEnablement.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\jucer_Icons.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\jucer_JucerTreeViewBase.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\jucer_ProjucerLookAndFeel.cpp"/> | |||
@@ -1548,6 +1551,7 @@ | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_DependencyPathPropertyComponent.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_FilePathPropertyComponent.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponent.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponentWithEnablement.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\jucer_IconButton.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\jucer_Icons.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\jucer_JucerTreeViewBase.h"/> | |||
@@ -373,6 +373,12 @@ | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElement.cpp"> | |||
<Filter>Projucer\ComponentEditor\PaintElements</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementGroup.cpp"> | |||
<Filter>Projucer\ComponentEditor\PaintElements</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementImage.cpp"> | |||
<Filter>Projucer\ComponentEditor\PaintElements</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementPath.cpp"> | |||
<Filter>Projucer\ComponentEditor\PaintElements</Filter> | |||
</ClCompile> | |||
@@ -466,6 +472,9 @@ | |||
<ClCompile Include="..\..\Source\Utility\UI\PropertyComponents\jucer_DependencyPathPropertyComponent.cpp"> | |||
<Filter>Projucer\Utility\UI\PropertyComponents</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponentWithEnablement.cpp"> | |||
<Filter>Projucer\Utility\UI\PropertyComponents</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\Utility\UI\jucer_Icons.cpp"> | |||
<Filter>Projucer\Utility\UI</Filter> | |||
</ClCompile> | |||
@@ -2193,6 +2202,9 @@ | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponent.h"> | |||
<Filter>Projucer\Utility\UI\PropertyComponents</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponentWithEnablement.h"> | |||
<Filter>Projucer\Utility\UI\PropertyComponents</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\..\Source\Utility\UI\jucer_IconButton.h"> | |||
<Filter>Projucer\Utility\UI</Filter> | |||
</ClInclude> | |||
@@ -201,6 +201,8 @@ | |||
<ClCompile Include="..\..\Source\ComponentEditor\Documents\jucer_ComponentDocument.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_ColouredElement.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElement.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementGroup.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementImage.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementPath.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\UI\jucer_ComponentLayoutEditor.cpp"/> | |||
<ClCompile Include="..\..\Source\ComponentEditor\UI\jucer_ComponentOverlayComponent.cpp"/> | |||
@@ -234,6 +236,7 @@ | |||
<ClCompile Include="..\..\Source\Utility\Helpers\jucer_FileHelpers.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\Helpers\jucer_MiscUtilities.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\PropertyComponents\jucer_DependencyPathPropertyComponent.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponentWithEnablement.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\jucer_Icons.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\jucer_JucerTreeViewBase.cpp"/> | |||
<ClCompile Include="..\..\Source\Utility\UI\jucer_ProjucerLookAndFeel.cpp"/> | |||
@@ -1548,6 +1551,7 @@ | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_DependencyPathPropertyComponent.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_FilePathPropertyComponent.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponent.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponentWithEnablement.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\jucer_IconButton.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\jucer_Icons.h"/> | |||
<ClInclude Include="..\..\Source\Utility\UI\jucer_JucerTreeViewBase.h"/> | |||
@@ -373,6 +373,12 @@ | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElement.cpp"> | |||
<Filter>Projucer\ComponentEditor\PaintElements</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementGroup.cpp"> | |||
<Filter>Projucer\ComponentEditor\PaintElements</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementImage.cpp"> | |||
<Filter>Projucer\ComponentEditor\PaintElements</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\ComponentEditor\PaintElements\jucer_PaintElementPath.cpp"> | |||
<Filter>Projucer\ComponentEditor\PaintElements</Filter> | |||
</ClCompile> | |||
@@ -466,6 +472,9 @@ | |||
<ClCompile Include="..\..\Source\Utility\UI\PropertyComponents\jucer_DependencyPathPropertyComponent.cpp"> | |||
<Filter>Projucer\Utility\UI\PropertyComponents</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponentWithEnablement.cpp"> | |||
<Filter>Projucer\Utility\UI\PropertyComponents</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\..\Source\Utility\UI\jucer_Icons.cpp"> | |||
<Filter>Projucer\Utility\UI</Filter> | |||
</ClCompile> | |||
@@ -2193,6 +2202,9 @@ | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponent.h"> | |||
<Filter>Projucer\Utility\UI\PropertyComponents</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\..\Source\Utility\UI\PropertyComponents\jucer_TextWithDefaultPropertyComponentWithEnablement.h"> | |||
<Filter>Projucer\Utility\UI\PropertyComponents</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\..\Source\Utility\UI\jucer_IconButton.h"> | |||
<Filter>Projucer\Utility\UI</Filter> | |||
</ClInclude> | |||
@@ -344,8 +344,12 @@ | |||
file="Source/ComponentEditor/PaintElements/jucer_PaintElement.h"/> | |||
<FILE id="XIdWSH" name="jucer_PaintElementEllipse.h" compile="0" resource="0" | |||
file="Source/ComponentEditor/PaintElements/jucer_PaintElementEllipse.h"/> | |||
<FILE id="wfQP9E" name="jucer_PaintElementGroup.cpp" compile="1" resource="0" | |||
file="Source/ComponentEditor/PaintElements/jucer_PaintElementGroup.cpp"/> | |||
<FILE id="BvqsF8" name="jucer_PaintElementGroup.h" compile="0" resource="0" | |||
file="Source/ComponentEditor/PaintElements/jucer_PaintElementGroup.h"/> | |||
<FILE id="IwLSAV" name="jucer_PaintElementImage.cpp" compile="1" resource="0" | |||
file="Source/ComponentEditor/PaintElements/jucer_PaintElementImage.cpp"/> | |||
<FILE id="wYJFrA" name="jucer_PaintElementImage.h" compile="0" resource="0" | |||
file="Source/ComponentEditor/PaintElements/jucer_PaintElementImage.h"/> | |||
<FILE id="fVo9WQ" name="jucer_PaintElementPath.cpp" compile="1" resource="0" | |||
@@ -624,6 +628,10 @@ | |||
resource="0" file="Source/Utility/UI/PropertyComponents/jucer_FilePathPropertyComponent.h"/> | |||
<FILE id="gptc0E" name="jucer_TextWithDefaultPropertyComponent.h" compile="0" | |||
resource="0" file="Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponent.h"/> | |||
<FILE id="szzNXP" name="jucer_TextWithDefaultPropertyComponentWithEnablement.cpp" | |||
compile="1" resource="0" file="Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.cpp"/> | |||
<FILE id="JTFOwY" name="jucer_TextWithDefaultPropertyComponentWithEnablement.h" | |||
compile="0" resource="0" file="Source/Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.h"/> | |||
</GROUP> | |||
<FILE id="VQCK4C" name="jucer_IconButton.h" compile="0" resource="0" | |||
file="Source/Utility/UI/jucer_IconButton.h"/> | |||
@@ -0,0 +1,228 @@ | |||
/* | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
By using JUCE, you agree to the terms of both the JUCE 5 End-User License | |||
Agreement and JUCE 5 Privacy Policy (both updated and effective as of the | |||
27th April 2017). | |||
End User License Agreement: www.juce.com/juce-5-licence | |||
Privacy Policy: www.juce.com/juce-5-privacy-policy | |||
Or: You may also use this code under the terms of the GPL v3 (see | |||
www.gnu.org/licenses). | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#include "../../Application/jucer_Headers.h" | |||
#include "jucer_PaintElementGroup.h" | |||
PaintElementGroup::PaintElementGroup (PaintRoutine* pr) | |||
: PaintElement (pr, "Group") | |||
{ | |||
} | |||
PaintElementGroup::~PaintElementGroup() {} | |||
void PaintElementGroup::ungroup (const bool undoable) | |||
{ | |||
getOwner()->getSelectedElements().deselectAll(); | |||
getOwner()->getSelectedPoints().deselectAll(); | |||
const int index = getOwner()->indexOfElement (this); | |||
for (int i = 0; i < subElements.size(); ++i) | |||
{ | |||
ScopedPointer<XmlElement> xml (subElements.getUnchecked(i)->createXml()); | |||
PaintElement* newOne = getOwner()->addElementFromXml (*xml, index, undoable); | |||
getOwner()->getSelectedElements().addToSelection (newOne); | |||
} | |||
getOwner()->removeElement (this, undoable); | |||
} | |||
void PaintElementGroup::groupSelected (PaintRoutine* const routine) | |||
{ | |||
if (routine->getSelectedElements().getNumSelected() > 1) | |||
{ | |||
PaintElementGroup* newGroup = new PaintElementGroup (routine); | |||
int frontIndex = -1; | |||
for (int i = 0; i < routine->getNumElements(); ++i) | |||
{ | |||
if (routine->getSelectedElements().isSelected (routine->getElement (i))) | |||
{ | |||
ScopedPointer<XmlElement> xml (routine->getElement(i)->createXml()); | |||
if (PaintElement* newOne = ObjectTypes::createElementForXml (xml, routine)) | |||
newGroup->subElements.add (newOne); | |||
if (i > frontIndex) | |||
frontIndex = i; | |||
} | |||
} | |||
routine->deleteSelected(); | |||
PaintElement* const g = routine->addNewElement (newGroup, frontIndex, true); | |||
routine->getSelectedElements().selectOnly (g); | |||
} | |||
} | |||
int PaintElementGroup::getNumElements() const noexcept { return subElements.size(); } | |||
PaintElement* PaintElementGroup::getElement (const int index) const noexcept { return subElements [index]; } | |||
int PaintElementGroup::indexOfElement (const PaintElement* element) const noexcept { return subElements.indexOf (element); } | |||
bool PaintElementGroup::containsElement (const PaintElement* element) const | |||
{ | |||
if (subElements.contains (element)) | |||
return true; | |||
for (int i = subElements.size(); --i >= 0;) | |||
if (PaintElementGroup* pg = dynamic_cast<PaintElementGroup*> (subElements.getUnchecked(i))) | |||
if (pg->containsElement (element)) | |||
return true; | |||
return false; | |||
} | |||
//============================================================================== | |||
void PaintElementGroup::setInitialBounds (int /*parentWidth*/, int /*parentHeight*/) | |||
{ | |||
} | |||
Rectangle<int> PaintElementGroup::getCurrentBounds (const Rectangle<int>& parentArea) const | |||
{ | |||
Rectangle<int> r; | |||
if (subElements.size() > 0) | |||
{ | |||
r = subElements.getUnchecked(0)->getCurrentBounds (parentArea); | |||
for (int i = 1; i < subElements.size(); ++i) | |||
r = r.getUnion (subElements.getUnchecked(i)->getCurrentBounds (parentArea)); | |||
} | |||
return r; | |||
} | |||
void PaintElementGroup::setCurrentBounds (const Rectangle<int>& b, const Rectangle<int>& parentArea, const bool undoable) | |||
{ | |||
Rectangle<int> newBounds (b); | |||
newBounds.setSize (jmax (1, newBounds.getWidth()), | |||
jmax (1, newBounds.getHeight())); | |||
const Rectangle<int> current (getCurrentBounds (parentArea)); | |||
if (newBounds != current) | |||
{ | |||
const int dx = newBounds.getX() - current.getX(); | |||
const int dy = newBounds.getY() - current.getY(); | |||
const double scaleStartX = current.getX(); | |||
const double scaleStartY = current.getY(); | |||
const double scaleX = newBounds.getWidth() / (double) current.getWidth(); | |||
const double scaleY = newBounds.getHeight() / (double) current.getHeight(); | |||
for (int i = 0; i < subElements.size(); ++i) | |||
{ | |||
PaintElement* const e = subElements.getUnchecked(i); | |||
Rectangle<int> pos (e->getCurrentBounds (parentArea)); | |||
const int newX = roundToInt ((pos.getX() - scaleStartX) * scaleX + scaleStartX + dx); | |||
const int newY = roundToInt ((pos.getY() - scaleStartY) * scaleY + scaleStartY + dy); | |||
pos.setBounds (newX, newY, | |||
roundToInt ((pos.getRight() - scaleStartX) * scaleX + scaleStartX + dx) - newX, | |||
roundToInt ((pos.getBottom() - scaleStartY) * scaleY + scaleStartY + dy) - newY); | |||
e->setCurrentBounds (pos, parentArea, undoable); | |||
} | |||
} | |||
} | |||
//============================================================================== | |||
void PaintElementGroup::draw (Graphics& g, const ComponentLayout* layout, const Rectangle<int>& parentArea) | |||
{ | |||
for (int i = 0; i < subElements.size(); ++i) | |||
subElements.getUnchecked(i)->draw (g, layout, parentArea); | |||
} | |||
void PaintElementGroup::getEditableProperties (Array<PropertyComponent*>& props, bool multipleSelected) | |||
{ | |||
if (! multipleSelected) | |||
props.add (new UngroupProperty (this)); | |||
} | |||
void PaintElementGroup::fillInGeneratedCode (GeneratedCode& code, String& paintMethodCode) | |||
{ | |||
for (int i = 0; i < subElements.size(); ++i) | |||
subElements.getUnchecked(i)->fillInGeneratedCode (code, paintMethodCode); | |||
} | |||
const char* PaintElementGroup::getTagName() noexcept { return "GROUP"; } | |||
XmlElement* PaintElementGroup::createXml() const | |||
{ | |||
XmlElement* e = new XmlElement (getTagName()); | |||
for (int i = 0; i < subElements.size(); ++i) | |||
{ | |||
XmlElement* const sub = subElements.getUnchecked(i)->createXml(); | |||
e->addChildElement (sub); | |||
} | |||
return e; | |||
} | |||
bool PaintElementGroup::loadFromXml (const XmlElement& xml) | |||
{ | |||
if (xml.hasTagName (getTagName())) | |||
{ | |||
forEachXmlChildElement (xml, e) | |||
if (PaintElement* const pe = ObjectTypes::createElementForXml (e, owner)) | |||
subElements.add (pe); | |||
return true; | |||
} | |||
jassertfalse; | |||
return false; | |||
} | |||
void PaintElementGroup::applyCustomPaintSnippets (StringArray& snippets) | |||
{ | |||
for (auto* e : subElements) | |||
e->applyCustomPaintSnippets (snippets); | |||
} | |||
PaintElementGroup::UngroupProperty::UngroupProperty (PaintElementGroup* const e) | |||
: ButtonPropertyComponent ("ungroup", false), | |||
element (e) | |||
{ | |||
} | |||
void PaintElementGroup::UngroupProperty::buttonClicked() | |||
{ | |||
element->ungroup (true); | |||
} | |||
String PaintElementGroup::UngroupProperty::getButtonText() const | |||
{ | |||
return "Ungroup"; | |||
} |
@@ -33,208 +33,50 @@ | |||
class PaintElementGroup : public PaintElement | |||
{ | |||
public: | |||
PaintElementGroup (PaintRoutine* pr) | |||
: PaintElement (pr, "Group") | |||
{ | |||
} | |||
void ungroup (const bool undoable) | |||
{ | |||
getOwner()->getSelectedElements().deselectAll(); | |||
getOwner()->getSelectedPoints().deselectAll(); | |||
const int index = getOwner()->indexOfElement (this); | |||
for (int i = 0; i < subElements.size(); ++i) | |||
{ | |||
ScopedPointer<XmlElement> xml (subElements.getUnchecked(i)->createXml()); | |||
PaintElement* newOne = getOwner()->addElementFromXml (*xml, index, undoable); | |||
getOwner()->getSelectedElements().addToSelection (newOne); | |||
} | |||
getOwner()->removeElement (this, undoable); | |||
} | |||
static void groupSelected (PaintRoutine* const routine) | |||
{ | |||
if (routine->getSelectedElements().getNumSelected() > 1) | |||
{ | |||
PaintElementGroup* newGroup = new PaintElementGroup (routine); | |||
int frontIndex = -1; | |||
for (int i = 0; i < routine->getNumElements(); ++i) | |||
{ | |||
if (routine->getSelectedElements().isSelected (routine->getElement (i))) | |||
{ | |||
ScopedPointer<XmlElement> xml (routine->getElement(i)->createXml()); | |||
PaintElementGroup (PaintRoutine*); | |||
if (PaintElement* newOne = ObjectTypes::createElementForXml (xml, routine)) | |||
newGroup->subElements.add (newOne); | |||
~PaintElementGroup(); | |||
if (i > frontIndex) | |||
frontIndex = i; | |||
} | |||
} | |||
void ungroup (const bool); | |||
routine->deleteSelected(); | |||
static void groupSelected (PaintRoutine* const); | |||
PaintElement* const g = routine->addNewElement (newGroup, frontIndex, true); | |||
routine->getSelectedElements().selectOnly (g); | |||
} | |||
} | |||
int getNumElements() const noexcept; | |||
int getNumElements() const noexcept { return subElements.size(); } | |||
PaintElement* getElement (const int index) const noexcept; | |||
int indexOfElement (const PaintElement* element) const noexcept; | |||
PaintElement* getElement (const int index) const noexcept { return subElements [index]; } | |||
int indexOfElement (const PaintElement* element) const noexcept { return subElements.indexOf (element); } | |||
bool containsElement (const PaintElement* element) const | |||
{ | |||
if (subElements.contains (element)) | |||
return true; | |||
for (int i = subElements.size(); --i >= 0;) | |||
if (PaintElementGroup* pg = dynamic_cast<PaintElementGroup*> (subElements.getUnchecked(i))) | |||
if (pg->containsElement (element)) | |||
return true; | |||
return false; | |||
} | |||
bool containsElement (const PaintElement* element) const; | |||
//============================================================================== | |||
void setInitialBounds (int /*parentWidth*/, int /*parentHeight*/) override | |||
{ | |||
} | |||
Rectangle<int> getCurrentBounds (const Rectangle<int>& parentArea) const override | |||
{ | |||
Rectangle<int> r; | |||
if (subElements.size() > 0) | |||
{ | |||
r = subElements.getUnchecked(0)->getCurrentBounds (parentArea); | |||
for (int i = 1; i < subElements.size(); ++i) | |||
r = r.getUnion (subElements.getUnchecked(i)->getCurrentBounds (parentArea)); | |||
} | |||
return r; | |||
} | |||
void setCurrentBounds (const Rectangle<int>& b, const Rectangle<int>& parentArea, const bool undoable) override | |||
{ | |||
Rectangle<int> newBounds (b); | |||
newBounds.setSize (jmax (1, newBounds.getWidth()), | |||
jmax (1, newBounds.getHeight())); | |||
const Rectangle<int> current (getCurrentBounds (parentArea)); | |||
if (newBounds != current) | |||
{ | |||
const int dx = newBounds.getX() - current.getX(); | |||
const int dy = newBounds.getY() - current.getY(); | |||
const double scaleStartX = current.getX(); | |||
const double scaleStartY = current.getY(); | |||
const double scaleX = newBounds.getWidth() / (double) current.getWidth(); | |||
const double scaleY = newBounds.getHeight() / (double) current.getHeight(); | |||
for (int i = 0; i < subElements.size(); ++i) | |||
{ | |||
PaintElement* const e = subElements.getUnchecked(i); | |||
Rectangle<int> pos (e->getCurrentBounds (parentArea)); | |||
const int newX = roundToInt ((pos.getX() - scaleStartX) * scaleX + scaleStartX + dx); | |||
const int newY = roundToInt ((pos.getY() - scaleStartY) * scaleY + scaleStartY + dy); | |||
pos.setBounds (newX, newY, | |||
roundToInt ((pos.getRight() - scaleStartX) * scaleX + scaleStartX + dx) - newX, | |||
roundToInt ((pos.getBottom() - scaleStartY) * scaleY + scaleStartY + dy) - newY); | |||
e->setCurrentBounds (pos, parentArea, undoable); | |||
} | |||
} | |||
} | |||
void setInitialBounds (int, int) override; | |||
Rectangle<int> getCurrentBounds (const Rectangle<int>&) const override; | |||
void setCurrentBounds (const Rectangle<int>&, const Rectangle<int>&, const bool) override; | |||
//============================================================================== | |||
void draw (Graphics& g, const ComponentLayout* layout, const Rectangle<int>& parentArea) override | |||
{ | |||
for (int i = 0; i < subElements.size(); ++i) | |||
subElements.getUnchecked(i)->draw (g, layout, parentArea); | |||
} | |||
void draw (Graphics&, const ComponentLayout*, const Rectangle<int>&) override; | |||
void getEditableProperties (Array<PropertyComponent*>& props, bool multipleSelected) override | |||
{ | |||
if (! multipleSelected) | |||
props.add (new UngroupProperty (this)); | |||
} | |||
void fillInGeneratedCode (GeneratedCode& code, String& paintMethodCode) override | |||
{ | |||
for (int i = 0; i < subElements.size(); ++i) | |||
subElements.getUnchecked(i)->fillInGeneratedCode (code, paintMethodCode); | |||
} | |||
static const char* getTagName() noexcept { return "GROUP"; } | |||
XmlElement* createXml() const override | |||
{ | |||
XmlElement* e = new XmlElement (getTagName()); | |||
void getEditableProperties (Array<PropertyComponent*>&, bool) override; | |||
for (int i = 0; i < subElements.size(); ++i) | |||
{ | |||
XmlElement* const sub = subElements.getUnchecked(i)->createXml(); | |||
e->addChildElement (sub); | |||
} | |||
void fillInGeneratedCode (GeneratedCode&, String&) override; | |||
return e; | |||
} | |||
static const char* getTagName() noexcept; | |||
bool loadFromXml (const XmlElement& xml) override | |||
{ | |||
if (xml.hasTagName (getTagName())) | |||
{ | |||
forEachXmlChildElement (xml, e) | |||
if (PaintElement* const pe = ObjectTypes::createElementForXml (e, owner)) | |||
subElements.add (pe); | |||
XmlElement* createXml() const override; | |||
return true; | |||
} | |||
bool loadFromXml (const XmlElement&) override; | |||
jassertfalse; | |||
return false; | |||
} | |||
void applyCustomPaintSnippets (StringArray& snippets) override | |||
{ | |||
for (auto* e : subElements) | |||
e->applyCustomPaintSnippets (snippets); | |||
} | |||
void applyCustomPaintSnippets (StringArray&) override; | |||
private: | |||
OwnedArray<PaintElement> subElements; | |||
struct UngroupProperty : public ButtonPropertyComponent | |||
struct UngroupProperty : public ButtonPropertyComponent | |||
{ | |||
UngroupProperty (PaintElementGroup* const e) | |||
: ButtonPropertyComponent ("ungroup", false), | |||
element (e) | |||
{ | |||
} | |||
void buttonClicked() | |||
{ | |||
element->ungroup (true); | |||
} | |||
String getButtonText() const | |||
{ | |||
return "Ungroup"; | |||
} | |||
UngroupProperty (PaintElementGroup* const); | |||
void buttonClicked(); | |||
String getButtonText() const; | |||
PaintElementGroup* element; | |||
}; | |||
@@ -0,0 +1,430 @@ | |||
/* | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
By using JUCE, you agree to the terms of both the JUCE 5 End-User License | |||
Agreement and JUCE 5 Privacy Policy (both updated and effective as of the | |||
27th April 2017). | |||
End User License Agreement: www.juce.com/juce-5-licence | |||
Privacy Policy: www.juce.com/juce-5-privacy-policy | |||
Or: You may also use this code under the terms of the GPL v3 (see | |||
www.gnu.org/licenses). | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#include "../../Application/jucer_Headers.h" | |||
#include "jucer_PaintElementImage.h" | |||
PaintElementImage::PaintElementImage (PaintRoutine* pr) | |||
: PaintElement (pr, "Image"), | |||
opacity (1.0), | |||
mode (stretched) | |||
{ | |||
} | |||
PaintElementImage::~PaintElementImage() {} | |||
const Drawable* PaintElementImage::getDrawable() | |||
{ | |||
if (JucerDocument* const document = getDocument()) | |||
return document->getResources().getDrawable (resourceName); | |||
return nullptr; | |||
} | |||
void PaintElementImage::draw (Graphics& g, const ComponentLayout* layout, const Rectangle<int>& parentArea) | |||
{ | |||
const Rectangle<int> r (position.getRectangle (parentArea, layout)); | |||
if (const Drawable* const image = getDrawable()) | |||
{ | |||
image->drawWithin (g, r.toFloat(), | |||
mode == stretched ? RectanglePlacement::stretchToFit | |||
: (mode == proportionalReducingOnly ? (RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize) | |||
: RectanglePlacement::centred), | |||
(float) opacity); | |||
} | |||
else | |||
{ | |||
g.setColour (Colours::grey.withAlpha (0.5f)); | |||
g.fillRect (r); | |||
g.setColour (Colours::black); | |||
g.drawText ("(image missing)", | |||
r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
Justification::centred, true); | |||
} | |||
} | |||
//============================================================================== | |||
void PaintElementImage::getEditableProperties (Array <PropertyComponent*>& props, bool multipleSelected) | |||
{ | |||
PaintElement::getEditableProperties (props, multipleSelected); | |||
props.add (new ImageElementResourceProperty (this)); | |||
props.add (new StretchModeProperty (this)); | |||
props.add (new OpacityProperty (this)); | |||
props.add (new ResetSizeProperty (this)); | |||
} | |||
void PaintElementImage::fillInGeneratedCode (GeneratedCode& code, String& paintMethodCode) | |||
{ | |||
if (opacity > 0) | |||
{ | |||
String x, y, w, h, r; | |||
positionToCode (position, getDocument()->getComponentLayout(), x, y, w, h); | |||
r << "{\n" | |||
<< " int x = " << x << ", y = " << y << ", width = " << w << ", height = " << h << ";\n" | |||
<< " //[UserPaintCustomArguments] Customize the painting arguments here..\n" | |||
<< customPaintCode | |||
<< " //[/UserPaintCustomArguments]\n"; | |||
if (dynamic_cast<const DrawableImage*> (getDrawable()) != 0) | |||
{ | |||
const String imageVariable ("cachedImage_" + resourceName.replace ("::", "_") + "_" + String (code.getUniqueSuffix())); | |||
code.addImageResourceLoader (imageVariable, resourceName); | |||
if (opacity >= 254.0 / 255.0) | |||
r << " g.setColour (Colours::black);\n"; | |||
else | |||
r << " g.setColour (Colours::black.withAlpha (" << CodeHelpers::floatLiteral (opacity, 3) << "));\n"; | |||
if (mode == stretched) | |||
{ | |||
r << " g.drawImage (" << imageVariable << ",\n" | |||
<< " x, y, width, height,\n" | |||
<< " 0, 0, " << imageVariable << ".getWidth(), " << imageVariable << ".getHeight());\n"; | |||
} | |||
else | |||
{ | |||
r << " g.drawImageWithin (" << imageVariable << ",\n" | |||
<< " x, y, width, height,\n" | |||
<< " "; | |||
if (mode == proportionalReducingOnly) | |||
r << "RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize"; | |||
else | |||
r << "RectanglePlacement::centred"; | |||
r << ",\n" | |||
<< " false);\n"; | |||
} | |||
} | |||
else | |||
{ | |||
if (resourceName.isNotEmpty()) | |||
{ | |||
const String imageVariable ("drawable" + String (code.getUniqueSuffix())); | |||
code.privateMemberDeclarations | |||
<< "ScopedPointer<Drawable> " << imageVariable << ";\n"; | |||
code.constructorCode | |||
<< imageVariable << " = Drawable::createFromImageData (" | |||
<< resourceName << ", " << resourceName << "Size);\n"; | |||
code.destructorCode | |||
<< imageVariable << " = nullptr;\n"; | |||
if (opacity >= 254.0 / 255.0) | |||
r << " g.setColour (Colours::black);\n"; | |||
else | |||
r << " g.setColour (Colours::black.withAlpha (" << CodeHelpers::floatLiteral (opacity, 3) << "));\n"; | |||
r << " jassert (" << imageVariable << " != 0);\n" | |||
<< " if (" << imageVariable << " != 0)\n" | |||
<< " " << imageVariable << "->drawWithin (g, Rectangle<float> (x, y, width, height),\n" | |||
<< " " << String::repeatedString (" ", imageVariable.length() + 18) | |||
<< (mode == stretched ? "RectanglePlacement::stretchToFit" | |||
: (mode == proportionalReducingOnly ? "RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize" | |||
: "RectanglePlacement::centred")) | |||
<< ", " << CodeHelpers::floatLiteral (opacity, 3) << ");\n"; | |||
} | |||
} | |||
r << "}\n\n"; | |||
paintMethodCode += r; | |||
} | |||
} | |||
void PaintElementImage::applyCustomPaintSnippets (StringArray& snippets) | |||
{ | |||
customPaintCode.clear(); | |||
if (! snippets.isEmpty() && opacity > 0) | |||
{ | |||
customPaintCode = snippets[0]; | |||
snippets.remove (0); | |||
} | |||
} | |||
//============================================================================== | |||
PaintElementImage::SetResourceAction::SetResourceAction (PaintElementImage* const element, const String& newResource_) | |||
: PaintElementUndoableAction <PaintElementImage> (element), | |||
newResource (newResource_) | |||
{ | |||
oldResource = element->getResource(); | |||
} | |||
bool PaintElementImage::SetResourceAction::perform() | |||
{ | |||
showCorrectTab(); | |||
getElement()->setResource (newResource, false); | |||
return true; | |||
} | |||
bool PaintElementImage::SetResourceAction::undo() | |||
{ | |||
showCorrectTab(); | |||
getElement()->setResource (oldResource, false); | |||
return true; | |||
} | |||
void PaintElementImage::setResource (const String& newName, const bool undoable) | |||
{ | |||
if (resourceName != newName) | |||
{ | |||
if (undoable) | |||
{ | |||
perform (new SetResourceAction (this, newName), | |||
"Change image resource"); | |||
} | |||
else | |||
{ | |||
resourceName = newName; | |||
changed(); | |||
} | |||
} | |||
repaint(); | |||
} | |||
String PaintElementImage::getResource() const | |||
{ | |||
return resourceName; | |||
} | |||
//============================================================================== | |||
PaintElementImage::SetOpacityAction::SetOpacityAction (PaintElementImage* const element, const double newOpacity_) | |||
: PaintElementUndoableAction <PaintElementImage> (element), | |||
newOpacity (newOpacity_) | |||
{ | |||
oldOpacity = element->getOpacity(); | |||
} | |||
bool PaintElementImage::SetOpacityAction::perform() | |||
{ | |||
showCorrectTab(); | |||
getElement()->setOpacity (newOpacity, false); | |||
return true; | |||
} | |||
bool PaintElementImage::SetOpacityAction::undo() | |||
{ | |||
showCorrectTab(); | |||
getElement()->setOpacity (oldOpacity, false); | |||
return true; | |||
} | |||
void PaintElementImage::setOpacity (double newOpacity, const bool undoable) | |||
{ | |||
newOpacity = jlimit (0.0, 1.0, newOpacity); | |||
if (opacity != newOpacity) | |||
{ | |||
if (undoable) | |||
{ | |||
perform (new SetOpacityAction (this, newOpacity), | |||
"Change image opacity"); | |||
} | |||
else | |||
{ | |||
opacity = newOpacity; | |||
changed(); | |||
} | |||
} | |||
} | |||
double PaintElementImage::getOpacity() const noexcept { return opacity; } | |||
//============================================================================== | |||
const char* PaintElementImage::getTagName() noexcept { return "IMAGE"; } | |||
void PaintElementImage::resetToImageSize() | |||
{ | |||
if (const Drawable* const image = getDrawable()) | |||
{ | |||
if (PaintRoutineEditor* ed = dynamic_cast<PaintRoutineEditor*> (getParentComponent())) | |||
{ | |||
const Rectangle<int> parentArea (ed->getComponentArea()); | |||
Rectangle<int> r (getCurrentBounds (parentArea)); | |||
Rectangle<float> b (image->getDrawableBounds()); | |||
r.setSize ((int) (b.getWidth() + 0.999f), | |||
(int) (b.getHeight() + 0.999f)); | |||
setCurrentBounds (r, parentArea, true); | |||
} | |||
} | |||
} | |||
//============================================================================== | |||
PaintElementImage::SetStretchModeAction::SetStretchModeAction (PaintElementImage* const element, const StretchMode newValue_) | |||
: PaintElementUndoableAction <PaintElementImage> (element), | |||
newValue (newValue_) | |||
{ | |||
oldValue = element->getStretchMode(); | |||
} | |||
bool PaintElementImage::SetStretchModeAction::perform() | |||
{ | |||
showCorrectTab(); | |||
getElement()->setStretchMode (newValue, false); | |||
return true; | |||
} | |||
bool PaintElementImage::SetStretchModeAction::undo() | |||
{ | |||
showCorrectTab(); | |||
getElement()->setStretchMode (oldValue, false); | |||
return true; | |||
} | |||
PaintElementImage::StretchMode PaintElementImage::getStretchMode() const noexcept { return mode; } | |||
void PaintElementImage::setStretchMode (const StretchMode newMode, const bool undoable) | |||
{ | |||
if (mode != newMode) | |||
{ | |||
if (undoable) | |||
{ | |||
perform (new SetStretchModeAction (this, newMode), | |||
"Change image mode"); | |||
} | |||
else | |||
{ | |||
mode = newMode; | |||
changed(); | |||
} | |||
} | |||
} | |||
//============================================================================== | |||
XmlElement* PaintElementImage::createXml() const | |||
{ | |||
XmlElement* e = new XmlElement (getTagName()); | |||
position.applyToXml (*e); | |||
e->setAttribute ("resource", resourceName); | |||
e->setAttribute ("opacity", opacity); | |||
e->setAttribute ("mode", (int) mode); | |||
return e; | |||
} | |||
bool PaintElementImage::loadFromXml (const XmlElement& xml) | |||
{ | |||
if (xml.hasTagName (getTagName())) | |||
{ | |||
position.restoreFromXml (xml, position); | |||
resourceName = xml.getStringAttribute ("resource", String()); | |||
opacity = xml.getDoubleAttribute ("opacity", 1.0); | |||
mode = (StretchMode) xml.getIntAttribute ("mode", (int) stretched); | |||
repaint(); | |||
return true; | |||
} | |||
jassertfalse; | |||
return false; | |||
} | |||
//============================================================================== | |||
PaintElementImage::ImageElementResourceProperty::ImageElementResourceProperty (PaintElementImage* const e) | |||
: ImageResourceProperty <PaintElementImage> (e, "image source") | |||
{ | |||
} | |||
void PaintElementImage::ImageElementResourceProperty::setResource (const String& newName) | |||
{ | |||
if (element != nullptr) | |||
element->setResource (newName, true); | |||
} | |||
String PaintElementImage::ImageElementResourceProperty::getResource() const | |||
{ | |||
if (element != nullptr) | |||
return element->getResource(); | |||
return {}; | |||
} | |||
//============================================================================== | |||
PaintElementImage::OpacityProperty::OpacityProperty (PaintElementImage* const e) | |||
: SliderPropertyComponent ("opacity", 0.0, 1.0, 0.001), | |||
listener (e) | |||
{ | |||
listener.setPropertyToRefresh (*this); | |||
} | |||
void PaintElementImage::OpacityProperty::setValue (double newValue) | |||
{ | |||
listener.owner->getDocument()->getUndoManager().undoCurrentTransactionOnly(); | |||
listener.owner->setOpacity (newValue, true); | |||
} | |||
double PaintElementImage::OpacityProperty::getValue() const | |||
{ | |||
return listener.owner->getOpacity(); | |||
} | |||
PaintElementImage::StretchModeProperty::StretchModeProperty (PaintElementImage* const e) | |||
: ChoicePropertyComponent ("stretch mode"), | |||
listener (e) | |||
{ | |||
listener.setPropertyToRefresh (*this); | |||
choices.add ("Stretched to fit"); | |||
choices.add ("Maintain aspect ratio"); | |||
choices.add ("Maintain aspect ratio, only reduce in size"); | |||
} | |||
void PaintElementImage::StretchModeProperty::setIndex (int newIndex) | |||
{ | |||
listener.owner->setStretchMode ((StretchMode) newIndex, true); | |||
} | |||
int PaintElementImage::StretchModeProperty::getIndex() const | |||
{ | |||
return (int) listener.owner->getStretchMode(); | |||
} | |||
PaintElementImage::ResetSizeProperty::ResetSizeProperty (PaintElementImage* const e) | |||
: ButtonPropertyComponent ("reset", false), | |||
element (e) | |||
{ | |||
} | |||
void PaintElementImage::ResetSizeProperty::buttonClicked() | |||
{ | |||
element->resetToImageSize(); | |||
} | |||
String PaintElementImage::ResetSizeProperty::getButtonText() const { return "reset to image size"; } |
@@ -26,7 +26,7 @@ | |||
#pragma once | |||
#include "../jucer_PaintRoutine.h" | |||
#include "jucer_ColouredElement.h" | |||
#include "../Properties/jucer_FilePropertyComponent.h" | |||
#include "jucer_ImageResourceProperty.h" | |||
#include "jucer_PaintElementUndoableAction.h" | |||
@@ -35,12 +35,8 @@ | |||
class PaintElementImage : public PaintElement | |||
{ | |||
public: | |||
PaintElementImage (PaintRoutine* pr) | |||
: PaintElement (pr, "Image"), | |||
opacity (1.0), | |||
mode (stretched) | |||
{ | |||
} | |||
PaintElementImage (PaintRoutine*); | |||
~PaintElementImage(); | |||
enum StretchMode | |||
{ | |||
@@ -49,345 +45,73 @@ public: | |||
proportionalReducingOnly = 2 | |||
}; | |||
const Drawable* getDrawable() | |||
{ | |||
if (JucerDocument* const document = getDocument()) | |||
return document->getResources().getDrawable (resourceName); | |||
return nullptr; | |||
} | |||
void draw (Graphics& g, const ComponentLayout* layout, const Rectangle<int>& parentArea) override | |||
{ | |||
const Rectangle<int> r (position.getRectangle (parentArea, layout)); | |||
if (const Drawable* const image = getDrawable()) | |||
{ | |||
image->drawWithin (g, r.toFloat(), | |||
mode == stretched ? RectanglePlacement::stretchToFit | |||
: (mode == proportionalReducingOnly ? (RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize) | |||
: RectanglePlacement::centred), | |||
(float) opacity); | |||
} | |||
else | |||
{ | |||
g.setColour (Colours::grey.withAlpha (0.5f)); | |||
g.fillRect (r); | |||
g.setColour (Colours::black); | |||
g.drawText ("(image missing)", | |||
r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
Justification::centred, true); | |||
} | |||
} | |||
const Drawable* getDrawable(); | |||
void draw (Graphics&, const ComponentLayout*, const Rectangle<int>&) override; | |||
//============================================================================== | |||
void getEditableProperties (Array <PropertyComponent*>& props, bool multipleSelected) override | |||
{ | |||
PaintElement::getEditableProperties (props, multipleSelected); | |||
props.add (new ImageElementResourceProperty (this)); | |||
props.add (new StretchModeProperty (this)); | |||
props.add (new OpacityProperty (this)); | |||
props.add (new ResetSizeProperty (this)); | |||
} | |||
void fillInGeneratedCode (GeneratedCode& code, String& paintMethodCode) override | |||
{ | |||
if (opacity > 0) | |||
{ | |||
String x, y, w, h, r; | |||
positionToCode (position, getDocument()->getComponentLayout(), x, y, w, h); | |||
r << "{\n" | |||
<< " int x = " << x << ", y = " << y << ", width = " << w << ", height = " << h << ";\n" | |||
<< " //[UserPaintCustomArguments] Customize the painting arguments here..\n" | |||
<< customPaintCode | |||
<< " //[/UserPaintCustomArguments]\n"; | |||
if (dynamic_cast<const DrawableImage*> (getDrawable()) != 0) | |||
{ | |||
const String imageVariable ("cachedImage_" + resourceName.replace ("::", "_") + "_" + String (code.getUniqueSuffix())); | |||
code.addImageResourceLoader (imageVariable, resourceName); | |||
if (opacity >= 254.0 / 255.0) | |||
r << " g.setColour (Colours::black);\n"; | |||
else | |||
r << " g.setColour (Colours::black.withAlpha (" << CodeHelpers::floatLiteral (opacity, 3) << "));\n"; | |||
if (mode == stretched) | |||
{ | |||
r << " g.drawImage (" << imageVariable << ",\n" | |||
<< " x, y, width, height,\n" | |||
<< " 0, 0, " << imageVariable << ".getWidth(), " << imageVariable << ".getHeight());\n"; | |||
} | |||
else | |||
{ | |||
r << " g.drawImageWithin (" << imageVariable << ",\n" | |||
<< " x, y, width, height,\n" | |||
<< " "; | |||
if (mode == proportionalReducingOnly) | |||
r << "RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize"; | |||
else | |||
r << "RectanglePlacement::centred"; | |||
r << ",\n" | |||
<< " false);\n"; | |||
} | |||
} | |||
else | |||
{ | |||
if (resourceName.isNotEmpty()) | |||
{ | |||
const String imageVariable ("drawable" + String (code.getUniqueSuffix())); | |||
code.privateMemberDeclarations | |||
<< "ScopedPointer<Drawable> " << imageVariable << ";\n"; | |||
code.constructorCode | |||
<< imageVariable << " = Drawable::createFromImageData (" | |||
<< resourceName << ", " << resourceName << "Size);\n"; | |||
code.destructorCode | |||
<< imageVariable << " = nullptr;\n"; | |||
if (opacity >= 254.0 / 255.0) | |||
r << " g.setColour (Colours::black);\n"; | |||
else | |||
r << " g.setColour (Colours::black.withAlpha (" << CodeHelpers::floatLiteral (opacity, 3) << "));\n"; | |||
r << " jassert (" << imageVariable << " != 0);\n" | |||
<< " if (" << imageVariable << " != 0)\n" | |||
<< " " << imageVariable << "->drawWithin (g, Rectangle<float> (x, y, width, height),\n" | |||
<< " " << String::repeatedString (" ", imageVariable.length() + 18) | |||
<< (mode == stretched ? "RectanglePlacement::stretchToFit" | |||
: (mode == proportionalReducingOnly ? "RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize" | |||
: "RectanglePlacement::centred")) | |||
<< ", " << CodeHelpers::floatLiteral (opacity, 3) << ");\n"; | |||
} | |||
} | |||
r << "}\n\n"; | |||
paintMethodCode += r; | |||
} | |||
} | |||
void applyCustomPaintSnippets (StringArray& snippets) override | |||
{ | |||
customPaintCode.clear(); | |||
if (! snippets.isEmpty() && opacity > 0) | |||
{ | |||
customPaintCode = snippets[0]; | |||
snippets.remove (0); | |||
} | |||
} | |||
void getEditableProperties (Array <PropertyComponent*>&, bool) override; | |||
void fillInGeneratedCode (GeneratedCode&, String&) override; | |||
void applyCustomPaintSnippets (StringArray& snippets) override; | |||
//============================================================================== | |||
class SetResourceAction : public PaintElementUndoableAction <PaintElementImage> | |||
{ | |||
public: | |||
SetResourceAction (PaintElementImage* const element, const String& newResource_) | |||
: PaintElementUndoableAction <PaintElementImage> (element), | |||
newResource (newResource_) | |||
{ | |||
oldResource = element->getResource(); | |||
} | |||
bool perform() | |||
{ | |||
showCorrectTab(); | |||
getElement()->setResource (newResource, false); | |||
return true; | |||
} | |||
bool undo() | |||
{ | |||
showCorrectTab(); | |||
getElement()->setResource (oldResource, false); | |||
return true; | |||
} | |||
SetResourceAction (PaintElementImage* const, const String&); | |||
bool perform(); | |||
bool undo(); | |||
private: | |||
String newResource, oldResource; | |||
}; | |||
void setResource (const String& newName, const bool undoable) | |||
{ | |||
if (resourceName != newName) | |||
{ | |||
if (undoable) | |||
{ | |||
perform (new SetResourceAction (this, newName), | |||
"Change image resource"); | |||
} | |||
else | |||
{ | |||
resourceName = newName; | |||
changed(); | |||
} | |||
} | |||
repaint(); | |||
} | |||
String getResource() const | |||
{ | |||
return resourceName; | |||
} | |||
void setResource (const String&, const bool); | |||
String getResource() const; | |||
//============================================================================== | |||
class SetOpacityAction : public PaintElementUndoableAction <PaintElementImage> | |||
{ | |||
public: | |||
SetOpacityAction (PaintElementImage* const element, const double newOpacity_) | |||
: PaintElementUndoableAction <PaintElementImage> (element), | |||
newOpacity (newOpacity_) | |||
{ | |||
oldOpacity = element->getOpacity(); | |||
} | |||
bool perform() | |||
{ | |||
showCorrectTab(); | |||
getElement()->setOpacity (newOpacity, false); | |||
return true; | |||
} | |||
bool undo() | |||
{ | |||
showCorrectTab(); | |||
getElement()->setOpacity (oldOpacity, false); | |||
return true; | |||
} | |||
SetOpacityAction (PaintElementImage* const, const double); | |||
bool perform(); | |||
bool undo(); | |||
private: | |||
double newOpacity, oldOpacity; | |||
}; | |||
void setOpacity (double newOpacity, const bool undoable) | |||
{ | |||
newOpacity = jlimit (0.0, 1.0, newOpacity); | |||
if (opacity != newOpacity) | |||
{ | |||
if (undoable) | |||
{ | |||
perform (new SetOpacityAction (this, newOpacity), | |||
"Change image opacity"); | |||
} | |||
else | |||
{ | |||
opacity = newOpacity; | |||
changed(); | |||
} | |||
} | |||
} | |||
double getOpacity() const noexcept { return opacity; } | |||
void setOpacity (double, const bool); | |||
double getOpacity() const noexcept; | |||
//============================================================================== | |||
static const char* getTagName() noexcept { return "IMAGE"; } | |||
void resetToImageSize() | |||
{ | |||
if (const Drawable* const image = getDrawable()) | |||
{ | |||
if (PaintRoutineEditor* ed = dynamic_cast<PaintRoutineEditor*> (getParentComponent())) | |||
{ | |||
const Rectangle<int> parentArea (ed->getComponentArea()); | |||
Rectangle<int> r (getCurrentBounds (parentArea)); | |||
Rectangle<float> b (image->getDrawableBounds()); | |||
static const char* getTagName() noexcept; | |||
r.setSize ((int) (b.getWidth() + 0.999f), | |||
(int) (b.getHeight() + 0.999f)); | |||
setCurrentBounds (r, parentArea, true); | |||
} | |||
} | |||
} | |||
void resetToImageSize(); | |||
//============================================================================== | |||
class SetStretchModeAction : public PaintElementUndoableAction <PaintElementImage> | |||
class SetStretchModeAction : public PaintElementUndoableAction <PaintElementImage> | |||
{ | |||
public: | |||
SetStretchModeAction (PaintElementImage* const element, const StretchMode newValue_) | |||
: PaintElementUndoableAction <PaintElementImage> (element), | |||
newValue (newValue_) | |||
{ | |||
oldValue = element->getStretchMode(); | |||
} | |||
bool perform() | |||
{ | |||
showCorrectTab(); | |||
getElement()->setStretchMode (newValue, false); | |||
return true; | |||
} | |||
bool undo() | |||
{ | |||
showCorrectTab(); | |||
getElement()->setStretchMode (oldValue, false); | |||
return true; | |||
} | |||
SetStretchModeAction (PaintElementImage* const, const StretchMode); | |||
bool perform(); | |||
bool undo(); | |||
private: | |||
StretchMode newValue, oldValue; | |||
}; | |||
StretchMode getStretchMode() const noexcept { return mode; } | |||
StretchMode getStretchMode() const noexcept; | |||
void setStretchMode (const StretchMode newMode, const bool undoable) | |||
{ | |||
if (mode != newMode) | |||
{ | |||
if (undoable) | |||
{ | |||
perform (new SetStretchModeAction (this, newMode), | |||
"Change image mode"); | |||
} | |||
else | |||
{ | |||
mode = newMode; | |||
changed(); | |||
} | |||
} | |||
} | |||
void setStretchMode (const StretchMode, const bool); | |||
//============================================================================== | |||
XmlElement* createXml() const override | |||
{ | |||
XmlElement* e = new XmlElement (getTagName()); | |||
position.applyToXml (*e); | |||
e->setAttribute ("resource", resourceName); | |||
e->setAttribute ("opacity", opacity); | |||
e->setAttribute ("mode", (int) mode); | |||
XmlElement* createXml() const override; | |||
return e; | |||
} | |||
bool loadFromXml (const XmlElement& xml) override | |||
{ | |||
if (xml.hasTagName (getTagName())) | |||
{ | |||
position.restoreFromXml (xml, position); | |||
resourceName = xml.getStringAttribute ("resource", String()); | |||
opacity = xml.getDoubleAttribute ("opacity", 1.0); | |||
mode = (StretchMode) xml.getIntAttribute ("mode", (int) stretched); | |||
repaint(); | |||
return true; | |||
} | |||
jassertfalse; | |||
return false; | |||
} | |||
bool loadFromXml (const XmlElement&) override; | |||
private: | |||
String resourceName; | |||
@@ -396,77 +120,34 @@ private: | |||
String customPaintCode; | |||
//============================================================================== | |||
class ImageElementResourceProperty : public ImageResourceProperty <PaintElementImage> | |||
class ImageElementResourceProperty : public ImageResourceProperty <PaintElementImage> | |||
{ | |||
public: | |||
ImageElementResourceProperty (PaintElementImage* const e) | |||
: ImageResourceProperty <PaintElementImage> (e, "image source") | |||
{ | |||
} | |||
void setResource (const String& newName) | |||
{ | |||
if (element != nullptr) | |||
element->setResource (newName, true); | |||
} | |||
String getResource() const | |||
{ | |||
if (element != nullptr) | |||
return element->getResource(); | |||
return {}; | |||
} | |||
ImageElementResourceProperty (PaintElementImage* const); | |||
void setResource (const String&); | |||
String getResource() const; | |||
}; | |||
//============================================================================== | |||
class OpacityProperty : public SliderPropertyComponent | |||
class OpacityProperty : public SliderPropertyComponent | |||
{ | |||
public: | |||
OpacityProperty (PaintElementImage* const e) | |||
: SliderPropertyComponent ("opacity", 0.0, 1.0, 0.001), | |||
listener (e) | |||
{ | |||
listener.setPropertyToRefresh (*this); | |||
} | |||
void setValue (double newValue) | |||
{ | |||
listener.owner->getDocument()->getUndoManager().undoCurrentTransactionOnly(); | |||
listener.owner->setOpacity (newValue, true); | |||
} | |||
double getValue() const | |||
{ | |||
return listener.owner->getOpacity(); | |||
} | |||
OpacityProperty (PaintElementImage* const); | |||
void setValue (double); | |||
double getValue() const; | |||
ElementListener<PaintElementImage> listener; | |||
}; | |||
class StretchModeProperty : public ChoicePropertyComponent | |||
class StretchModeProperty : public ChoicePropertyComponent | |||
{ | |||
public: | |||
StretchModeProperty (PaintElementImage* const e) | |||
: ChoicePropertyComponent ("stretch mode"), | |||
listener (e) | |||
{ | |||
listener.setPropertyToRefresh (*this); | |||
choices.add ("Stretched to fit"); | |||
choices.add ("Maintain aspect ratio"); | |||
choices.add ("Maintain aspect ratio, only reduce in size"); | |||
} | |||
void setIndex (int newIndex) | |||
{ | |||
listener.owner->setStretchMode ((StretchMode) newIndex, true); | |||
} | |||
int getIndex() const | |||
{ | |||
return (int) listener.owner->getStretchMode(); | |||
} | |||
StretchModeProperty (PaintElementImage* const); | |||
void setIndex (int); | |||
int getIndex() const; | |||
ElementListener<PaintElementImage> listener; | |||
}; | |||
@@ -474,18 +155,10 @@ private: | |||
class ResetSizeProperty : public ButtonPropertyComponent | |||
{ | |||
public: | |||
ResetSizeProperty (PaintElementImage* const e) | |||
: ButtonPropertyComponent ("reset", false), | |||
element (e) | |||
{ | |||
} | |||
void buttonClicked() | |||
{ | |||
element->resetToImageSize(); | |||
} | |||
String getButtonText() const { return "reset to image size"; } | |||
ResetSizeProperty (PaintElementImage* const); | |||
void buttonClicked(); | |||
String getButtonText() const; | |||
private: | |||
PaintElementImage* const element; | |||
@@ -365,6 +365,7 @@ public: | |||
props.add (new TextWithDefaultPropertyComponentWithEnablement (aaxBinaryLocation, getPluginBinaryCopyStepEnabledValue(), | |||
"AAX Binary Location", 1024), | |||
"The folder in which the compiled AAX binary should be placed."); | |||
} | |||
void initialisePluginCachedValues() | |||
@@ -29,6 +29,7 @@ | |||
#include "../Project/jucer_Project.h" | |||
#include "../Utility/UI/PropertyComponents/jucer_DependencyPathPropertyComponent.h" | |||
#include "../Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponent.h" | |||
#include "../Utility/UI/PropertyComponents/jucer_TextWithDefaultPropertyComponentWithEnablement.h" | |||
class ProjectSaver; | |||
@@ -419,7 +419,7 @@ private: | |||
<< "#ifndef JUCE_REPORT_APP_USAGE" << newLine | |||
<< " #define JUCE_REPORT_APP_USAGE " << (project.shouldReportAppUsage().getValue() ? "1" : "0") << newLine | |||
<< "#endif" << newLine << newLine | |||
<< "#endif" << newLine | |||
<< newLine | |||
<< "// END SECTION A" << newLine | |||
<< newLine | |||
@@ -226,6 +226,9 @@ void StoredSettings::saveSwatchColours() | |||
props.setValue ("swatchColour" + String (i), swatchColours.getReference(i).toString()); | |||
} | |||
StoredSettings::ColourSelectorWithSwatches::ColourSelectorWithSwatches() {} | |||
StoredSettings::ColourSelectorWithSwatches::~ColourSelectorWithSwatches() {} | |||
int StoredSettings::ColourSelectorWithSwatches::getNumSwatches() const | |||
{ | |||
return getAppSettings().swatchColours.size(); | |||
@@ -30,7 +30,7 @@ | |||
#include "jucer_AppearanceSettings.h" | |||
//============================================================================== | |||
class StoredSettings : public ValueTree::Listener | |||
class StoredSettings : public ValueTree::Listener | |||
{ | |||
public: | |||
StoredSettings(); | |||
@@ -51,9 +51,10 @@ public: | |||
//============================================================================== | |||
Array<Colour> swatchColours; | |||
struct ColourSelectorWithSwatches : public ColourSelector | |||
struct ColourSelectorWithSwatches : public ColourSelector | |||
{ | |||
ColourSelectorWithSwatches() {} | |||
ColourSelectorWithSwatches(); | |||
~ColourSelectorWithSwatches(); | |||
int getNumSwatches() const override; | |||
Colour getSwatchColour (int index) const override; | |||
@@ -284,3 +284,47 @@ Colour DependencyFilePathPropertyComponent::getTextColourToDisplay() const | |||
return isValidPath ? findColour (widgetTextColourId).withMultipliedAlpha (alpha) | |||
: Colours::red.withMultipliedAlpha (alpha); | |||
} | |||
//============================================================================== | |||
TextPropertyComponentWithEnablement::TextPropertyComponentWithEnablement (const Value& valueToControl, const Value& valueToListenTo, | |||
const String& propertyName, int maxNumChars, bool isMultiLine) | |||
: TextPropertyComponent (valueToControl, propertyName, maxNumChars, isMultiLine), | |||
value (valueToListenTo) | |||
{ | |||
value.addListener (this); | |||
setEnabled (value.getValue()); | |||
} | |||
TextPropertyComponentWithEnablement::~TextPropertyComponentWithEnablement() | |||
{ | |||
value.removeListener (this); | |||
} | |||
void TextPropertyComponentWithEnablement::valueChanged (Value& v) | |||
{ | |||
setEnabled (v.getValue()); | |||
} | |||
//============================================================================== | |||
ChoicePropertyComponentWithEnablement::ChoicePropertyComponentWithEnablement (const Value& valueToControl, | |||
const Value& valueToListenTo, | |||
const String& propertyName, | |||
const StringArray& choices, | |||
const Array<var>& correspondingValues) | |||
: ChoicePropertyComponent (valueToControl, propertyName, | |||
choices, correspondingValues), | |||
value (valueToListenTo) | |||
{ | |||
value.addListener (this); | |||
setEnabled (value.getValue()); | |||
} | |||
ChoicePropertyComponentWithEnablement::~ChoicePropertyComponentWithEnablement() | |||
{ | |||
value.removeListener (this); | |||
} | |||
void ChoicePropertyComponentWithEnablement::valueChanged (Value& v) | |||
{ | |||
setEnabled (v.getValue()); | |||
} |
@@ -251,27 +251,14 @@ class TextPropertyComponentWithEnablement : public TextPropertyComponent, | |||
private Value::Listener | |||
{ | |||
public: | |||
TextPropertyComponentWithEnablement (const Value& valueToControl, const Value& valueToListenTo, | |||
const String& propertyName, int maxNumChars, bool isMultiLine) | |||
: TextPropertyComponent (valueToControl, propertyName, maxNumChars, isMultiLine), | |||
value (valueToListenTo) | |||
{ | |||
value.addListener (this); | |||
setEnabled (value.getValue()); | |||
} | |||
TextPropertyComponentWithEnablement (const Value&, const Value&, const String&, int, bool); | |||
~TextPropertyComponentWithEnablement() | |||
{ | |||
value.removeListener (this); | |||
} | |||
~TextPropertyComponentWithEnablement(); | |||
private: | |||
Value value; | |||
void valueChanged (Value& v) override | |||
{ | |||
setEnabled (v.getValue()); | |||
} | |||
void valueChanged (Value& v) override; | |||
}; | |||
//============================================================================== | |||
@@ -279,29 +266,13 @@ class ChoicePropertyComponentWithEnablement : public ChoicePropertyComponent, | |||
private Value::Listener | |||
{ | |||
public: | |||
ChoicePropertyComponentWithEnablement (const Value& valueToControl, | |||
const Value& valueToListenTo, | |||
const String& propertyName, | |||
const StringArray& choices, | |||
const Array<var>& correspondingValues) | |||
: ChoicePropertyComponent (valueToControl, propertyName, | |||
choices, correspondingValues), | |||
value (valueToListenTo) | |||
{ | |||
value.addListener (this); | |||
setEnabled (value.getValue()); | |||
} | |||
ChoicePropertyComponentWithEnablement (const Value&, const Value&, const String&, | |||
const StringArray&, const Array<var>&); | |||
~ChoicePropertyComponentWithEnablement() | |||
{ | |||
value.removeListener (this); | |||
} | |||
~ChoicePropertyComponentWithEnablement(); | |||
private: | |||
Value value; | |||
void valueChanged (Value& v) override | |||
{ | |||
setEnabled (v.getValue()); | |||
} | |||
void valueChanged (Value& v) override; | |||
}; |
@@ -169,34 +169,3 @@ private: | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TextWithDefaultPropertyComponent) | |||
}; | |||
//============================================================================== | |||
class TextWithDefaultPropertyComponentWithEnablement : public TextWithDefaultPropertyComponent<String>, | |||
private Value::Listener | |||
{ | |||
public: | |||
TextWithDefaultPropertyComponentWithEnablement (CachedValue<String>& valueToControl, | |||
const Value& valueToListenTo, | |||
const String& propertyName, | |||
int maxNumChars) | |||
: TextWithDefaultPropertyComponent<String> (valueToControl, propertyName, maxNumChars), | |||
value (valueToListenTo) | |||
{ | |||
value.addListener (this); | |||
setEnabled (value.getValue()); | |||
} | |||
~TextWithDefaultPropertyComponentWithEnablement() | |||
{ | |||
value.removeListener (this); | |||
} | |||
private: | |||
Value value; | |||
void valueChanged (Value& v) override | |||
{ | |||
setEnabled (v.getValue()); | |||
} | |||
}; |
@@ -0,0 +1,50 @@ | |||
/* | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
By using JUCE, you agree to the terms of both the JUCE 5 End-User License | |||
Agreement and JUCE 5 Privacy Policy (both updated and effective as of the | |||
27th April 2017). | |||
End User License Agreement: www.juce.com/juce-5-licence | |||
Privacy Policy: www.juce.com/juce-5-privacy-policy | |||
Or: You may also use this code under the terms of the GPL v3 (see | |||
www.gnu.org/licenses). | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#include "../../../Application/jucer_Headers.h" | |||
#include "jucer_TextWithDefaultPropertyComponentWithEnablement.h" | |||
TextWithDefaultPropertyComponentWithEnablement::TextWithDefaultPropertyComponentWithEnablement (CachedValue<String>& valueToControl, | |||
const Value& valueToListenTo, | |||
const String& propertyName, | |||
int maxNumChars) | |||
: TextWithDefaultPropertyComponent<String> (valueToControl, propertyName, maxNumChars), | |||
value (valueToListenTo) | |||
{ | |||
value.addListener (this); | |||
setEnabled (value.getValue()); | |||
} | |||
TextWithDefaultPropertyComponentWithEnablement::~TextWithDefaultPropertyComponentWithEnablement() | |||
{ | |||
value.removeListener (this); | |||
} | |||
void TextWithDefaultPropertyComponentWithEnablement::valueChanged (Value& v) | |||
{ | |||
setEnabled (v.getValue()); | |||
} |
@@ -0,0 +1,44 @@ | |||
/* | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2017 - ROLI Ltd. | |||
JUCE is an open source library subject to commercial or open-source | |||
licensing. | |||
By using JUCE, you agree to the terms of both the JUCE 5 End-User License | |||
Agreement and JUCE 5 Privacy Policy (both updated and effective as of the | |||
27th April 2017). | |||
End User License Agreement: www.juce.com/juce-5-licence | |||
Privacy Policy: www.juce.com/juce-5-privacy-policy | |||
Or: You may also use this code under the terms of the GPL v3 (see | |||
www.gnu.org/licenses). | |||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||
DISCLAIMED. | |||
============================================================================== | |||
*/ | |||
#pragma once | |||
#include "jucer_TextWithDefaultPropertyComponent.h" | |||
class TextWithDefaultPropertyComponentWithEnablement : public TextWithDefaultPropertyComponent<String>, | |||
private Value::Listener | |||
{ | |||
public: | |||
TextWithDefaultPropertyComponentWithEnablement (CachedValue<String>&, const Value&, | |||
const String&, int); | |||
~TextWithDefaultPropertyComponentWithEnablement(); | |||
private: | |||
Value value; | |||
void valueChanged (Value&) override; | |||
}; |
@@ -34,6 +34,8 @@ ProjucerLookAndFeel::ProjucerLookAndFeel() | |||
setupColours(); | |||
} | |||
ProjucerLookAndFeel::~ProjucerLookAndFeel() {} | |||
void ProjucerLookAndFeel::drawTabButton (TabBarButton& button, Graphics& g, bool isMouseOver, bool isMouseDown) | |||
{ | |||
const auto area = button.getActiveArea(); | |||
@@ -32,6 +32,7 @@ class ProjucerLookAndFeel : public LookAndFeel_V4 | |||
{ | |||
public: | |||
ProjucerLookAndFeel(); | |||
~ProjucerLookAndFeel(); | |||
void drawTabButton (TabBarButton& button, Graphics&, bool isMouseOver, bool isMouseDown) override; | |||
int getTabButtonBestWidth (TabBarButton&, int tabDepth) override; | |||