From 3283f2224a052739a8514a0f30fb1fd56a1ce14c Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 4 Jun 2020 14:52:29 +0100 Subject: [PATCH] Projucer: Added new start page window --- extras/Projucer/Builds/LinuxMakefile/Makefile | 30 +- .../MacOSX/Projucer.xcodeproj/project.pbxproj | 259 ++++----- .../VisualStudio2015/Projucer_App.vcxproj | 31 +- .../Projucer_App.vcxproj.filters | 91 ++-- .../VisualStudio2017/Projucer_App.vcxproj | 31 +- .../Projucer_App.vcxproj.filters | 91 ++-- .../VisualStudio2019/Projucer_App.vcxproj | 31 +- .../Projucer_App.vcxproj.filters | 91 ++-- extras/Projucer/CMakeLists.txt | 8 +- .../Projucer/JuceLibraryCode/BinaryData.cpp | 260 +++------ extras/Projucer/JuceLibraryCode/BinaryData.h | 39 +- extras/Projucer/Projucer.jucer | 66 +-- .../StartPage/jucer_ContentComponents.h | 305 +++++++++++ .../StartPage/jucer_NewProjectTemplates.h | 244 +++++++++ .../StartPage/jucer_NewProjectWizard.cpp | 270 ++++++++++ .../StartPage/jucer_NewProjectWizard.h} | 11 +- .../StartPage/jucer_StartPageComponent.cpp | 263 +++++++++ .../StartPage}/jucer_StartPageComponent.h | 35 +- .../StartPage/jucer_StartPageTreeHolder.h | 167 ++++++ .../Windows/jucer_PIPCreatorWindowComponent.h | 19 +- .../Source/Application/jucer_Application.cpp | 34 +- .../Source/Application/jucer_Application.h | 7 +- .../Source/Application/jucer_MainWindow.cpp | 167 ++---- .../Source/Application/jucer_MainWindow.h | 10 +- .../jucer_AnimatedComponentSimpleTemplate.h | 4 +- .../jucer_AnimatedComponentTemplate.h | 4 +- .../jucer_AudioComponentSimpleTemplate.h | 2 +- .../Templates/jucer_AudioComponentTemplate.h | 2 +- .../jucer_AudioPluginEditorTemplate.cpp | 2 +- .../jucer_AudioPluginEditorTemplate.h | 4 +- .../jucer_AudioPluginFilterTemplate.h | 2 +- .../jucer_ContentCompSimpleTemplate.h | 4 +- .../Templates/jucer_ContentCompTemplate.h | 4 +- .../Templates/jucer_InlineComponentTemplate.h | 4 +- .../Templates/jucer_MainTemplate_NoWindow.cpp | 2 +- .../jucer_MainTemplate_SimpleWindow.cpp | 104 ---- .../Templates/jucer_MainTemplate_Window.cpp | 2 +- .../Templates/jucer_NewComponentTemplate.h | 4 +- .../jucer_NewInlineComponentTemplate.h | 4 +- .../jucer_OpenGLComponentSimpleTemplate.h | 4 +- .../Templates/jucer_OpenGLComponentTemplate.h | 4 +- .../jucer_PIPAudioProcessorTemplate.h | 2 +- .../jucer_DocumentEditorComponent.h | 6 +- .../Components/jucer_GroupComponentHandler.h | 12 +- .../Components/jucer_ImageButtonHandler.h | 14 +- .../Components/jucer_JucerComponentHandler.h | 12 +- .../Components/jucer_LabelHandler.h | 60 +-- .../Components/jucer_TabbedComponentHandler.h | 30 +- .../Components/jucer_ViewportHandler.h | 23 +- .../jucer_ElementSiblingComponent.h | 8 +- .../PaintElements/jucer_PaintElement.h | 19 +- .../PaintElements/jucer_PaintElementPath.cpp | 24 +- .../jucer_PaintElementRoundedRectangle.h | 12 +- .../PaintElements/jucer_PaintElementText.h | 48 +- .../jucer_ColourPropertyComponent.h | 18 +- .../Properties/jucer_FilePropertyComponent.h | 8 +- .../UI/jucer_ComponentLayoutEditor.h | 7 +- .../UI/jucer_ComponentLayoutPanel.h | 16 +- .../UI/jucer_ComponentOverlayComponent.h | 22 +- .../UI/jucer_JucerDocumentEditor.cpp | 4 +- .../UI/jucer_JucerDocumentEditor.h | 5 +- .../UI/jucer_PaintRoutineEditor.h | 4 +- .../UI/jucer_PaintRoutinePanel.cpp | 16 +- .../ComponentEditor/jucer_JucerDocument.cpp | 2 +- .../UI/Sidebar/jucer_ExporterTreeItems.h | 6 +- .../Project/UI/Sidebar/jucer_FileTreeItems.h | 24 +- .../UI/Sidebar/jucer_ModuleTreeItems.h | 4 +- .../Project/UI/Sidebar/jucer_TreeItemTypes.h | 2 +- .../Project/UI/jucer_HeaderComponent.cpp | 18 +- .../UI/jucer_ModulesInformationComponent.h | 4 +- .../UI/jucer_ProjectContentComponent.cpp | 47 +- .../UI/jucer_ProjectMessagesComponent.h | 9 +- .../Projucer/Source/Project/jucer_Project.cpp | 33 +- .../Projucer/Source/Project/jucer_Project.h | 23 +- .../jucer_ProjectExport_Android.h | 27 +- .../ProjectSaving/jucer_ProjectExport_CLion.h | 28 +- .../jucer_ProjectExport_CodeBlocks.h | 44 +- .../ProjectSaving/jucer_ProjectExport_MSVC.h | 30 +- .../ProjectSaving/jucer_ProjectExport_Make.h | 10 +- .../ProjectSaving/jucer_ProjectExport_Xcode.h | 28 +- .../ProjectSaving/jucer_ProjectExporter.cpp | 293 +++++----- .../ProjectSaving/jucer_ProjectExporter.h | 78 +-- .../ProjectSaving/jucer_ProjectSaver.cpp | 6 +- .../Source/Settings/jucer_StoredSettings.h | 2 +- .../Utility/Helpers/jucer_MiscUtilities.cpp | 69 ++- .../Utility/Helpers/jucer_MiscUtilities.h | 8 +- .../Helpers}/jucer_NewFileWizard.cpp | 23 +- .../Helpers}/jucer_NewFileWizard.h | 2 +- .../Helpers/jucer_ValueWithDefaultWrapper.h | 66 +++ .../Utility/PIPs/jucer_PIPGenerator.cpp | 35 +- .../Source/Utility/PIPs/jucer_PIPGenerator.h | 6 +- .../jucer_ColourPropertyComponent.h | 9 +- .../Source/Wizards/jucer_NewProjectWizard.h | 197 ------- .../Wizards/jucer_NewProjectWizardClasses.cpp | 82 --- .../Wizards/jucer_NewProjectWizardComponent.h | 505 ------------------ .../Wizards/jucer_ProjectWizard_Animated.h | 112 ---- .../Wizards/jucer_ProjectWizard_AudioApp.h | 121 ----- .../Wizards/jucer_ProjectWizard_AudioPlugin.h | 105 ---- .../Wizards/jucer_ProjectWizard_Blank.h | 42 -- .../Wizards/jucer_ProjectWizard_Console.h | 81 --- .../Source/Wizards/jucer_ProjectWizard_DLL.h | 42 -- .../Wizards/jucer_ProjectWizard_GUIApp.h | 123 ----- .../jucer_ProjectWizard_StaticLibrary.h | 42 -- .../Wizards/jucer_ProjectWizard_openGL.h | 112 ---- .../jucer_TemplateThumbnailsComponent.h | 250 --------- .../juce_MultiChoicePropertyComponent.cpp | 58 +- .../juce_MultiChoicePropertyComponent.h | 15 +- 107 files changed, 2466 insertions(+), 3443 deletions(-) create mode 100644 extras/Projucer/Source/Application/StartPage/jucer_ContentComponents.h create mode 100644 extras/Projucer/Source/Application/StartPage/jucer_NewProjectTemplates.h create mode 100644 extras/Projucer/Source/Application/StartPage/jucer_NewProjectWizard.cpp rename extras/Projucer/Source/{Wizards/jucer_NewProjectWizardClasses.h => Application/StartPage/jucer_NewProjectWizard.h} (53%) create mode 100644 extras/Projucer/Source/Application/StartPage/jucer_StartPageComponent.cpp rename extras/Projucer/Source/{Wizards => Application/StartPage}/jucer_StartPageComponent.h (53%) create mode 100644 extras/Projucer/Source/Application/StartPage/jucer_StartPageTreeHolder.h delete mode 100644 extras/Projucer/Source/BinaryData/Templates/jucer_MainTemplate_SimpleWindow.cpp rename extras/Projucer/Source/{Wizards => Utility/Helpers}/jucer_NewFileWizard.cpp (88%) rename extras/Projucer/Source/{Wizards => Utility/Helpers}/jucer_NewFileWizard.h (95%) create mode 100644 extras/Projucer/Source/Utility/Helpers/jucer_ValueWithDefaultWrapper.h delete mode 100644 extras/Projucer/Source/Wizards/jucer_NewProjectWizard.h delete mode 100644 extras/Projucer/Source/Wizards/jucer_NewProjectWizardClasses.cpp delete mode 100644 extras/Projucer/Source/Wizards/jucer_NewProjectWizardComponent.h delete mode 100644 extras/Projucer/Source/Wizards/jucer_ProjectWizard_Animated.h delete mode 100644 extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioApp.h delete mode 100644 extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioPlugin.h delete mode 100644 extras/Projucer/Source/Wizards/jucer_ProjectWizard_Blank.h delete mode 100644 extras/Projucer/Source/Wizards/jucer_ProjectWizard_Console.h delete mode 100644 extras/Projucer/Source/Wizards/jucer_ProjectWizard_DLL.h delete mode 100644 extras/Projucer/Source/Wizards/jucer_ProjectWizard_GUIApp.h delete mode 100644 extras/Projucer/Source/Wizards/jucer_ProjectWizard_StaticLibrary.h delete mode 100644 extras/Projucer/Source/Wizards/jucer_ProjectWizard_openGL.h delete mode 100644 extras/Projucer/Source/Wizards/jucer_TemplateThumbnailsComponent.h diff --git a/extras/Projucer/Builds/LinuxMakefile/Makefile b/extras/Projucer/Builds/LinuxMakefile/Makefile index 41d2002475..556fd00c93 100644 --- a/extras/Projucer/Builds/LinuxMakefile/Makefile +++ b/extras/Projucer/Builds/LinuxMakefile/Makefile @@ -68,6 +68,8 @@ ifeq ($(CONFIG),Release) endif OBJECTS_APP := \ + $(JUCE_OBJDIR)/jucer_NewProjectWizard_7817a7e4.o \ + $(JUCE_OBJDIR)/jucer_StartPageComponent_de6b22ec.o \ $(JUCE_OBJDIR)/jucer_AutoUpdater_ca658dc2.o \ $(JUCE_OBJDIR)/jucer_CommandLine_f35de107.o \ $(JUCE_OBJDIR)/jucer_Main_f8488f5b.o \ @@ -111,14 +113,13 @@ OBJECTS_APP := \ $(JUCE_OBJDIR)/jucer_CodeHelpers_1e797672.o \ $(JUCE_OBJDIR)/jucer_FileHelpers_54f12f83.o \ $(JUCE_OBJDIR)/jucer_MiscUtilities_31fc8dd8.o \ + $(JUCE_OBJDIR)/jucer_NewFileWizard_b233dda1.o \ $(JUCE_OBJDIR)/jucer_VersionInfo_46f3ed40.o \ $(JUCE_OBJDIR)/jucer_PIPGenerator_fd3402c7.o \ $(JUCE_OBJDIR)/jucer_Icons_d02d18f1.o \ $(JUCE_OBJDIR)/jucer_JucerTreeViewBase_9b9f2ff0.o \ $(JUCE_OBJDIR)/jucer_ProjucerLookAndFeel_3b20291d.o \ $(JUCE_OBJDIR)/jucer_SlidingPanelComponent_4e7dc07e.o \ - $(JUCE_OBJDIR)/jucer_NewFileWizard_fac97f47.o \ - $(JUCE_OBJDIR)/jucer_NewProjectWizardClasses_891f6fa2.o \ $(JUCE_OBJDIR)/BinaryData_ce4232d4.o \ $(JUCE_OBJDIR)/include_juce_build_tools_f5069398.o \ $(JUCE_OBJDIR)/include_juce_core_f26d17db.o \ @@ -142,6 +143,16 @@ $(JUCE_OUTDIR)/$(JUCE_TARGET_APP) : $(OBJECTS_APP) $(RESOURCES) -$(V_AT)mkdir -p $(JUCE_OUTDIR) $(V_AT)$(CXX) -o $(JUCE_OUTDIR)/$(JUCE_TARGET_APP) $(OBJECTS_APP) $(JUCE_LDFLAGS) $(JUCE_LDFLAGS_APP) $(RESOURCES) $(TARGET_ARCH) +$(JUCE_OBJDIR)/jucer_NewProjectWizard_7817a7e4.o: ../../Source/Application/StartPage/jucer_NewProjectWizard.cpp + -$(V_AT)mkdir -p $(JUCE_OBJDIR) + @echo "Compiling jucer_NewProjectWizard.cpp" + $(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" + +$(JUCE_OBJDIR)/jucer_StartPageComponent_de6b22ec.o: ../../Source/Application/StartPage/jucer_StartPageComponent.cpp + -$(V_AT)mkdir -p $(JUCE_OBJDIR) + @echo "Compiling jucer_StartPageComponent.cpp" + $(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" + $(JUCE_OBJDIR)/jucer_AutoUpdater_ca658dc2.o: ../../Source/Application/jucer_AutoUpdater.cpp -$(V_AT)mkdir -p $(JUCE_OBJDIR) @echo "Compiling jucer_AutoUpdater.cpp" @@ -357,6 +368,11 @@ $(JUCE_OBJDIR)/jucer_MiscUtilities_31fc8dd8.o: ../../Source/Utility/Helpers/juce @echo "Compiling jucer_MiscUtilities.cpp" $(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" +$(JUCE_OBJDIR)/jucer_NewFileWizard_b233dda1.o: ../../Source/Utility/Helpers/jucer_NewFileWizard.cpp + -$(V_AT)mkdir -p $(JUCE_OBJDIR) + @echo "Compiling jucer_NewFileWizard.cpp" + $(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" + $(JUCE_OBJDIR)/jucer_VersionInfo_46f3ed40.o: ../../Source/Utility/Helpers/jucer_VersionInfo.cpp -$(V_AT)mkdir -p $(JUCE_OBJDIR) @echo "Compiling jucer_VersionInfo.cpp" @@ -387,16 +403,6 @@ $(JUCE_OBJDIR)/jucer_SlidingPanelComponent_4e7dc07e.o: ../../Source/Utility/UI/j @echo "Compiling jucer_SlidingPanelComponent.cpp" $(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" -$(JUCE_OBJDIR)/jucer_NewFileWizard_fac97f47.o: ../../Source/Wizards/jucer_NewFileWizard.cpp - -$(V_AT)mkdir -p $(JUCE_OBJDIR) - @echo "Compiling jucer_NewFileWizard.cpp" - $(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" - -$(JUCE_OBJDIR)/jucer_NewProjectWizardClasses_891f6fa2.o: ../../Source/Wizards/jucer_NewProjectWizardClasses.cpp - -$(V_AT)mkdir -p $(JUCE_OBJDIR) - @echo "Compiling jucer_NewProjectWizardClasses.cpp" - $(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<" - $(JUCE_OBJDIR)/BinaryData_ce4232d4.o: ../../JuceLibraryCode/BinaryData.cpp -$(V_AT)mkdir -p $(JUCE_OBJDIR) @echo "Compiling BinaryData.cpp" diff --git a/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj b/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj index edea1928d4..05ee8f32c7 100644 --- a/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj +++ b/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj @@ -77,6 +77,14 @@ isa = PBXBuildFile; fileRef = 951128CA33CCDEF570436B1C; }; + 0A89E8E0E99C3B5B2B38F2E6 = { + isa = PBXBuildFile; + fileRef = C2835F16963B34839FC36220; + }; + 908B7D4FB180F53405DA8EF9 = { + isa = PBXBuildFile; + fileRef = 82C18723A3D0E39BBD8F0F6E; + }; 6DD9DA1677A6CF789CDAB478 = { isa = PBXBuildFile; fileRef = 0D4D508C638BC74943B9976D; @@ -249,6 +257,10 @@ isa = PBXBuildFile; fileRef = 486E8D02DAD2A0BF54A901C0; }; + 4581B3A9A0D92FC01D4149EF = { + isa = PBXBuildFile; + fileRef = E4532338917106FA0B61A429; + }; 44AD0D81A65C5EAE3BE588FD = { isa = PBXBuildFile; fileRef = FF3A6A384D536E1AEF47CD54; @@ -273,14 +285,6 @@ isa = PBXBuildFile; fileRef = 0CECD562059DFD7FBFB37E3C; }; - 518DD443B6F17A5AFD707263 = { - isa = PBXBuildFile; - fileRef = A69024A225F2AC31F17B1314; - }; - B7EBA1A83575F48CD08140B9 = { - isa = PBXBuildFile; - fileRef = 4B083E951ECB62217C46CB01; - }; 3C5267E06A897B0DC0F7EA50 = { isa = PBXBuildFile; fileRef = 472F9A90F685220D730EBF6C; @@ -394,13 +398,6 @@ path = "../../Source/ComponentEditor/Components/jucer_ViewportHandler.h"; sourceTree = "SOURCE_ROOT"; }; - 05D67B5A8D64947C067C0945 = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_ProjectWizard_GUIApp.h"; - path = "../../Source/Wizards/jucer_ProjectWizard_GUIApp.h"; - sourceTree = "SOURCE_ROOT"; - }; 0640E34282A97BF73CC8F1EB = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -415,13 +412,6 @@ path = "../../Source/BinaryData/Templates/jucer_AudioPluginFilterTemplate.cpp"; sourceTree = "SOURCE_ROOT"; }; - 087CB3A961CD3C7434D660A4 = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_NewProjectWizard.h"; - path = "../../Source/Wizards/jucer_NewProjectWizard.h"; - sourceTree = "SOURCE_ROOT"; - }; 09DE066936CF037E9709ADB1 = { isa = PBXFileReference; explicitFileType = wrapper.application; @@ -464,13 +454,6 @@ path = "../../Source/ComponentEditor/UI/jucer_ResourceEditorPanel.cpp"; sourceTree = "SOURCE_ROOT"; }; - 0F01067432AC314EAC213C1C = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_ProjectWizard_Blank.h"; - path = "../../Source/Wizards/jucer_ProjectWizard_Blank.h"; - sourceTree = "SOURCE_ROOT"; - }; 0F8C000E5FF4A2DAC1FEF8EB = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; @@ -478,13 +461,6 @@ path = "../../Source/Utility/UI/jucer_ProjucerLookAndFeel.cpp"; sourceTree = "SOURCE_ROOT"; }; - 11DC04468BC6023671017EBF = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_NewFileWizard.h"; - path = "../../Source/Wizards/jucer_NewFileWizard.h"; - sourceTree = "SOURCE_ROOT"; - }; 11DEED05110D3D1D02FCFFB6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -576,6 +552,13 @@ path = "../../Source/Project/UI/Sidebar/jucer_ProjectTab.h"; sourceTree = "SOURCE_ROOT"; }; + 1D7D2E563E8491643C9F2748 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = "jucer_StartPageComponent.h"; + path = "../../Source/Application/StartPage/jucer_StartPageComponent.h"; + sourceTree = "SOURCE_ROOT"; + }; 1DCA18E935A35D29D2D9B6A0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; @@ -590,6 +573,13 @@ path = "../../JuceLibraryCode/include_juce_data_structures.mm"; sourceTree = "SOURCE_ROOT"; }; + 1F0E279DB49BBF49D81C6D0D = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = "jucer_NewProjectTemplates.h"; + path = "../../Source/Application/StartPage/jucer_NewProjectTemplates.h"; + sourceTree = "SOURCE_ROOT"; + }; 20075A86A4D0E8A5B973D9DB = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -632,6 +622,13 @@ path = ../../../Build/CMake/RecentFilesMenuTemplate.nib; sourceTree = "SOURCE_ROOT"; }; + 234251407CD1A499D8A816BB = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = "jucer_ValueWithDefaultWrapper.h"; + path = "../../Source/Utility/Helpers/jucer_ValueWithDefaultWrapper.h"; + sourceTree = "SOURCE_ROOT"; + }; 23A8DE16C0CDB8EED18B008B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -814,13 +811,6 @@ path = "../../Source/LiveBuildEngine/UI/jucer_ErrorListComponent.h"; sourceTree = "SOURCE_ROOT"; }; - 3C95FA2AA91EBA19ADDD5C29 = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_ProjectWizard_Animated.h"; - path = "../../Source/Wizards/jucer_ProjectWizard_Animated.h"; - sourceTree = "SOURCE_ROOT"; - }; 3D36F0CEB84B27BD02FC461A = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -912,13 +902,6 @@ path = ../../../Build/CMake/PIPComponent.cpp.in; sourceTree = "SOURCE_ROOT"; }; - 471C7B0A8B92320AF0C80839 = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_ProjectWizard_StaticLibrary.h"; - path = "../../Source/Wizards/jucer_ProjectWizard_StaticLibrary.h"; - sourceTree = "SOURCE_ROOT"; - }; 472F9A90F685220D730EBF6C = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; @@ -940,11 +923,11 @@ path = "../../Source/Project/UI/Sidebar/jucer_FileTreeItems.h"; sourceTree = "SOURCE_ROOT"; }; - 4A4EBDAD8D098F72CE053235 = { + 497E1F5F0894B87461734963 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; - name = "jucer_ProjectWizard_AudioPlugin.h"; - path = "../../Source/Wizards/jucer_ProjectWizard_AudioPlugin.h"; + name = "jucer_StartPageTreeHolder.h"; + path = "../../Source/Application/StartPage/jucer_StartPageTreeHolder.h"; sourceTree = "SOURCE_ROOT"; }; 4AE469CD40BDAD634135785E = { @@ -961,13 +944,6 @@ path = "../../Source/ComponentEditor/PaintElements/jucer_PaintElementPath.cpp"; sourceTree = "SOURCE_ROOT"; }; - 4B083E951ECB62217C46CB01 = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.cpp.cpp; - name = "jucer_NewProjectWizardClasses.cpp"; - path = "../../Source/Wizards/jucer_NewProjectWizardClasses.cpp"; - sourceTree = "SOURCE_ROOT"; - }; 4D5F0CA8D1273144681A1D48 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; @@ -1052,6 +1028,13 @@ path = "../../Source/CodeEditor/jucer_DocumentEditorComponent.h"; sourceTree = "SOURCE_ROOT"; }; + 52E30AD23A8BE69D5766AF6D = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = "jucer_NewFileWizard.h"; + path = "../../Source/Utility/Helpers/jucer_NewFileWizard.h"; + sourceTree = "SOURCE_ROOT"; + }; 5432B7B9B2CF2EAEC8B66D5C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -1304,13 +1287,6 @@ path = "../../Source/ComponentEditor/Components/jucer_GroupComponentHandler.h"; sourceTree = "SOURCE_ROOT"; }; - 714267352CE5C4357ADBC231 = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_StartPageComponent.h"; - path = "../../Source/Wizards/jucer_StartPageComponent.h"; - sourceTree = "SOURCE_ROOT"; - }; 719B56C8587863D7AE9B69C6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -1416,6 +1392,13 @@ path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; + 82C18723A3D0E39BBD8F0F6E = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = "jucer_StartPageComponent.cpp"; + path = "../../Source/Application/StartPage/jucer_StartPageComponent.cpp"; + sourceTree = "SOURCE_ROOT"; + }; 8336A43CE1C3C26D7C7B53D8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; @@ -1465,20 +1448,6 @@ path = "../../Source/CodeEditor/jucer_LiveBuildCodeEditor.h"; sourceTree = "SOURCE_ROOT"; }; - 8A825FDDC00DD253F44D2C3A = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_ProjectWizard_AudioApp.h"; - path = "../../Source/Wizards/jucer_ProjectWizard_AudioApp.h"; - sourceTree = "SOURCE_ROOT"; - }; - 8BD8E9DA627D6EF9BA10FB9E = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_NewProjectWizardComponent.h"; - path = "../../Source/Wizards/jucer_NewProjectWizardComponent.h"; - sourceTree = "SOURCE_ROOT"; - }; 8C52A3DDA62A746AA7A68535 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; @@ -1612,13 +1581,6 @@ 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; @@ -1647,13 +1609,6 @@ path = ../../Source/BinaryData/gradle/LICENSE; 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"; - }; 9A3B8BBDA8E144A3DF6B9349 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -1752,13 +1707,6 @@ path = "../../Source/LiveBuildEngine/jucer_CompileEngineSettings.h"; sourceTree = "SOURCE_ROOT"; }; - A085174413736ACC8D7D42A2 = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_ProjectWizard_openGL.h"; - path = "../../Source/Wizards/jucer_ProjectWizard_openGL.h"; - sourceTree = "SOURCE_ROOT"; - }; A0BBBFBA13A1308B3CD725D5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -1787,13 +1735,6 @@ path = "../../Source/ComponentEditor/Components/jucer_TreeViewHandler.h"; sourceTree = "SOURCE_ROOT"; }; - A44A774EFC020D3D046A9249 = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_ProjectWizard_Console.h"; - path = "../../Source/Wizards/jucer_ProjectWizard_Console.h"; - sourceTree = "SOURCE_ROOT"; - }; A49503B646A7BD2BEEFC5CBD = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -1815,20 +1756,6 @@ path = "../../Source/BinaryData/Templates/jucer_MainConsoleAppTemplate.cpp"; sourceTree = "SOURCE_ROOT"; }; - A69024A225F2AC31F17B1314 = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.cpp.cpp; - name = "jucer_NewFileWizard.cpp"; - path = "../../Source/Wizards/jucer_NewFileWizard.cpp"; - sourceTree = "SOURCE_ROOT"; - }; - A6C4AE13FB409DE414094CFA = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_RelativePath.h"; - path = "../../Source/Utility/Helpers/jucer_RelativePath.h"; - sourceTree = "SOURCE_ROOT"; - }; A978DFE87D9BB5EFE5B3DAAC = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -1850,6 +1777,13 @@ path = "../../../../modules/juce_cryptography"; sourceTree = "SOURCE_ROOT"; }; + AAF90697C0F171EFC3984A5D = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = "jucer_ContentComponents.h"; + path = "../../Source/Application/StartPage/jucer_ContentComponents.h"; + sourceTree = "SOURCE_ROOT"; + }; ADA538034910F52FDD2DC88D = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; @@ -2018,13 +1952,6 @@ path = "../../Source/Project/jucer_Project.h"; sourceTree = "SOURCE_ROOT"; }; - C09BBB58CA45B66D693E8C31 = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_TemplateThumbnailsComponent.h"; - path = "../../Source/Wizards/jucer_TemplateThumbnailsComponent.h"; - sourceTree = "SOURCE_ROOT"; - }; C16F9F479A3A5F6DAD7647A2 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -2039,11 +1966,11 @@ path = "../../Source/ComponentEditor/jucer_PaintRoutine.cpp"; sourceTree = "SOURCE_ROOT"; }; - C2990A8D054BC230E7C637C3 = { + C2835F16963B34839FC36220 = { isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = "jucer_NewProjectWizardClasses.h"; - path = "../../Source/Wizards/jucer_NewProjectWizardClasses.h"; + lastKnownFileType = sourcecode.cpp.cpp; + name = "jucer_NewProjectWizard.cpp"; + path = "../../Source/Application/StartPage/jucer_NewProjectWizard.cpp"; sourceTree = "SOURCE_ROOT"; }; C3BB9F92B02B06D04A73794C = { @@ -2354,6 +2281,13 @@ path = "../../Source/Project/UI/Sidebar/jucer_ProjectTreeItemBase.h"; sourceTree = "SOURCE_ROOT"; }; + E4532338917106FA0B61A429 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = "jucer_NewFileWizard.cpp"; + path = "../../Source/Utility/Helpers/jucer_NewFileWizard.cpp"; + sourceTree = "SOURCE_ROOT"; + }; E468FDB5504C5D9315B2D04F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -2571,6 +2505,13 @@ path = "../../Source/ComponentEditor/Properties/jucer_ComponentColourProperty.h"; sourceTree = "SOURCE_ROOT"; }; + FD7885911A317D73E98D49B3 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = "jucer_NewProjectWizard.h"; + path = "../../Source/Application/StartPage/jucer_NewProjectWizard.h"; + sourceTree = "SOURCE_ROOT"; + }; FDABEE6B64546586368A4729 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -2606,6 +2547,20 @@ path = "../../Source/ComponentEditor/UI/jucer_PaintRoutinePanel.cpp"; sourceTree = "SOURCE_ROOT"; }; + A734ACA659C8B85D24B27673 = { + isa = PBXGroup; + children = ( + AAF90697C0F171EFC3984A5D, + 1F0E279DB49BBF49D81C6D0D, + C2835F16963B34839FC36220, + FD7885911A317D73E98D49B3, + 82C18723A3D0E39BBD8F0F6E, + 1D7D2E563E8491643C9F2748, + 497E1F5F0894B87461734963, + ); + name = StartPage; + sourceTree = ""; + }; 9D43579A76E23FBCE6B36333 = { isa = PBXGroup; children = ( @@ -2635,6 +2590,7 @@ BC67FD952A6F210A11A1ECB8 = { isa = PBXGroup; children = ( + A734ACA659C8B85D24B27673, 9D43579A76E23FBCE6B36333, EB1D55A76652399EB81CC1F0, 7CA44FF0BA319517C6E39651, @@ -2712,7 +2668,6 @@ 32C4B61AD995877956B7FA66, A66F17E7472E5C19AFE98E46, F159C1B99ACF1D91E12D978E, - 97A847B59EE04483E8850E4B, A160AEF56553A658E6EA6A8E, 8336A43CE1C3C26D7C7B53D8, C7245390C6C44E89F7526CFC, @@ -3028,10 +2983,12 @@ E186BC01A1B1529937A46485, 486E8D02DAD2A0BF54A901C0, 983CFBA01CA8811F30FA7F4C, + E4532338917106FA0B61A429, + 52E30AD23A8BE69D5766AF6D, 58F1FF52E887887A93E84FC2, - A6C4AE13FB409DE414094CFA, 6FD8DBC0FF42C87D8BEE2452, 00515BA4EC5A7D4DC078ED37, + 234251407CD1A499D8A816BB, FF3A6A384D536E1AEF47CD54, C16F9F479A3A5F6DAD7647A2, ); @@ -3085,30 +3042,6 @@ name = Utility; sourceTree = ""; }; - 73BAA89A783BBDD79AA27964 = { - isa = PBXGroup; - children = ( - A69024A225F2AC31F17B1314, - 11DC04468BC6023671017EBF, - 087CB3A961CD3C7434D660A4, - 4B083E951ECB62217C46CB01, - C2990A8D054BC230E7C637C3, - 8BD8E9DA627D6EF9BA10FB9E, - 3C95FA2AA91EBA19ADDD5C29, - 8A825FDDC00DD253F44D2C3A, - 4A4EBDAD8D098F72CE053235, - 0F01067432AC314EAC213C1C, - A44A774EFC020D3D046A9249, - 9992E6950C64322A11E39ADF, - 05D67B5A8D64947C067C0945, - A085174413736ACC8D7D42A2, - 471C7B0A8B92320AF0C80839, - 714267352CE5C4357ADBC231, - C09BBB58CA45B66D693E8C31, - ); - name = Wizards; - sourceTree = ""; - }; D3109994DA6AD871BE85C4E2 = { isa = PBXGroup; children = ( @@ -3121,7 +3054,6 @@ 4DCC5D64BBE8DE85360A3D57, EC535A977A1A114BC5DAE7B3, 2B1F885AA027E1A76A1C32E3, - 73BAA89A783BBDD79AA27964, ); name = Projucer; sourceTree = ""; @@ -3468,6 +3400,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 0A89E8E0E99C3B5B2B38F2E6, + 908B7D4FB180F53405DA8EF9, 6DD9DA1677A6CF789CDAB478, 954A036F5DDB375DB23FFB3E, 95B44E6C74B1DED31DBE37EB, @@ -3511,14 +3445,13 @@ 8BE478303CDF061B72F219E2, BF913199032B4CE970E82AA3, 25EF9B3FECB4C9F0F522DCAA, + 4581B3A9A0D92FC01D4149EF, 44AD0D81A65C5EAE3BE588FD, 638C7247B6DBA67EFE46E124, D0E26EB54B0087C8BE3D541E, 468548FB21D264DC12321327, 6ECB2F11D2F593FACCCF99DB, 95F56FB44C669F93AE77E465, - 518DD443B6F17A5AFD707263, - B7EBA1A83575F48CD08140B9, 3C5267E06A897B0DC0F7EA50, 4C743A3DA8682EEE89BDBD28, 5DD883699B85E4C492CAD065, diff --git a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj index 3bc83332ab..9ae1ed7e8d 100644 --- a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj @@ -140,6 +140,8 @@ + + true @@ -171,9 +173,6 @@ true - - true - true @@ -228,14 +227,13 @@ + - - true @@ -1486,6 +1484,11 @@ + + + + + @@ -1645,10 +1648,11 @@ + - + @@ -1660,21 +1664,6 @@ - - - - - - - - - - - - - - - diff --git a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters index f5f78ed704..d6b9c568e0 100644 --- a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters @@ -2,6 +2,9 @@ + + {1E1D2D75-0ADA-6E9E-105F-2F87632B55AF} + {DA27985D-8427-CE70-CA06-EAF7009CCC60} @@ -83,9 +86,6 @@ {F77CA057-8DE4-E076-7EB6-D2646794864B} - - {4BBA3556-B2A1-3008-8BE1-F82DE6666552} - {7DBEF27C-2AFE-DA02-1DBF-E80FAAC99EA7} @@ -316,6 +316,12 @@ + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + Projucer\Application @@ -355,9 +361,6 @@ Projucer\BinaryData\Templates - - Projucer\BinaryData\Templates - Projucer\BinaryData\Templates @@ -490,6 +493,9 @@ Projucer\Utility\Helpers + + Projucer\Utility\Helpers + Projucer\Utility\Helpers @@ -508,12 +514,6 @@ Projucer\Utility\UI - - Projucer\Wizards - - - Projucer\Wizards - JUCE Modules\juce_build_tools\utils @@ -1866,6 +1866,21 @@ + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + Projucer\Application\UserAccount @@ -2343,10 +2358,10 @@ Projucer\Utility\Helpers - + Projucer\Utility\Helpers - + Projucer\Utility\Helpers @@ -2355,6 +2370,9 @@ Projucer\Utility\Helpers + + Projucer\Utility\Helpers + Projucer\Utility\Helpers @@ -2388,51 +2406,6 @@ Projucer\Utility\UI - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - JUCE Modules\juce_build_tools\utils diff --git a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj index b861f033d5..8c15cf0743 100644 --- a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj @@ -140,6 +140,8 @@ + + true @@ -171,9 +173,6 @@ true - - true - true @@ -228,14 +227,13 @@ + - - true @@ -1486,6 +1484,11 @@ + + + + + @@ -1645,10 +1648,11 @@ + - + @@ -1660,21 +1664,6 @@ - - - - - - - - - - - - - - - diff --git a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters index 92e7b79ad6..7c453d662f 100644 --- a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters @@ -2,6 +2,9 @@ + + {1E1D2D75-0ADA-6E9E-105F-2F87632B55AF} + {DA27985D-8427-CE70-CA06-EAF7009CCC60} @@ -83,9 +86,6 @@ {F77CA057-8DE4-E076-7EB6-D2646794864B} - - {4BBA3556-B2A1-3008-8BE1-F82DE6666552} - {7DBEF27C-2AFE-DA02-1DBF-E80FAAC99EA7} @@ -316,6 +316,12 @@ + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + Projucer\Application @@ -355,9 +361,6 @@ Projucer\BinaryData\Templates - - Projucer\BinaryData\Templates - Projucer\BinaryData\Templates @@ -490,6 +493,9 @@ Projucer\Utility\Helpers + + Projucer\Utility\Helpers + Projucer\Utility\Helpers @@ -508,12 +514,6 @@ Projucer\Utility\UI - - Projucer\Wizards - - - Projucer\Wizards - JUCE Modules\juce_build_tools\utils @@ -1866,6 +1866,21 @@ + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + Projucer\Application\UserAccount @@ -2343,10 +2358,10 @@ Projucer\Utility\Helpers - + Projucer\Utility\Helpers - + Projucer\Utility\Helpers @@ -2355,6 +2370,9 @@ Projucer\Utility\Helpers + + Projucer\Utility\Helpers + Projucer\Utility\Helpers @@ -2388,51 +2406,6 @@ Projucer\Utility\UI - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - JUCE Modules\juce_build_tools\utils diff --git a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj index bca3289aa1..71f8fe2936 100644 --- a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj @@ -140,6 +140,8 @@ + + true @@ -171,9 +173,6 @@ true - - true - true @@ -228,14 +227,13 @@ + - - true @@ -1486,6 +1484,11 @@ + + + + + @@ -1645,10 +1648,11 @@ + - + @@ -1660,21 +1664,6 @@ - - - - - - - - - - - - - - - diff --git a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters index 3df5574f89..d492ec4ef0 100644 --- a/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2019/Projucer_App.vcxproj.filters @@ -2,6 +2,9 @@ + + {1E1D2D75-0ADA-6E9E-105F-2F87632B55AF} + {DA27985D-8427-CE70-CA06-EAF7009CCC60} @@ -83,9 +86,6 @@ {F77CA057-8DE4-E076-7EB6-D2646794864B} - - {4BBA3556-B2A1-3008-8BE1-F82DE6666552} - {7DBEF27C-2AFE-DA02-1DBF-E80FAAC99EA7} @@ -316,6 +316,12 @@ + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + Projucer\Application @@ -355,9 +361,6 @@ Projucer\BinaryData\Templates - - Projucer\BinaryData\Templates - Projucer\BinaryData\Templates @@ -490,6 +493,9 @@ Projucer\Utility\Helpers + + Projucer\Utility\Helpers + Projucer\Utility\Helpers @@ -508,12 +514,6 @@ Projucer\Utility\UI - - Projucer\Wizards - - - Projucer\Wizards - JUCE Modules\juce_build_tools\utils @@ -1866,6 +1866,21 @@ + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + + + Projucer\Application\StartPage + Projucer\Application\UserAccount @@ -2343,10 +2358,10 @@ Projucer\Utility\Helpers - + Projucer\Utility\Helpers - + Projucer\Utility\Helpers @@ -2355,6 +2370,9 @@ Projucer\Utility\Helpers + + Projucer\Utility\Helpers + Projucer\Utility\Helpers @@ -2388,51 +2406,6 @@ Projucer\Utility\UI - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - - - Projucer\Wizards - JUCE Modules\juce_build_tools\utils diff --git a/extras/Projucer/CMakeLists.txt b/extras/Projucer/CMakeLists.txt index d733ad21bd..9b8d9f1ba7 100644 --- a/extras/Projucer/CMakeLists.txt +++ b/extras/Projucer/CMakeLists.txt @@ -32,6 +32,8 @@ target_sources(Projucer PRIVATE Source/Application/jucer_CommandLine.cpp Source/Application/jucer_Main.cpp Source/Application/jucer_MainWindow.cpp + Source/Application/StartPage/jucer_StartPageComponent.cpp + Source/Application/StartPage/jucer_NewProjectWizard.cpp Source/CodeEditor/jucer_DocumentEditorComponent.cpp Source/CodeEditor/jucer_OpenDocumentManager.cpp Source/CodeEditor/jucer_SourceCodeEditor.cpp @@ -71,14 +73,13 @@ target_sources(Projucer PRIVATE Source/Utility/Helpers/jucer_CodeHelpers.cpp Source/Utility/Helpers/jucer_FileHelpers.cpp Source/Utility/Helpers/jucer_MiscUtilities.cpp + Source/Utility/Helpers/jucer_NewFileWizard.cpp Source/Utility/Helpers/jucer_VersionInfo.cpp Source/Utility/PIPs/jucer_PIPGenerator.cpp Source/Utility/UI/jucer_Icons.cpp Source/Utility/UI/jucer_JucerTreeViewBase.cpp Source/Utility/UI/jucer_ProjucerLookAndFeel.cpp - Source/Utility/UI/jucer_SlidingPanelComponent.cpp - Source/Wizards/jucer_NewFileWizard.cpp - Source/Wizards/jucer_NewProjectWizardClasses.cpp) + Source/Utility/UI/jucer_SlidingPanelComponent.cpp) target_compile_definitions(Projucer PRIVATE JUCE_ALLOW_STATIC_NULL_VARIABLES=0 @@ -127,7 +128,6 @@ juce_add_binary_data(ProjucerData SOURCES Source/BinaryData/Templates/jucer_InlineComponentTemplate.h Source/BinaryData/Templates/jucer_MainConsoleAppTemplate.cpp Source/BinaryData/Templates/jucer_MainTemplate_NoWindow.cpp - Source/BinaryData/Templates/jucer_MainTemplate_SimpleWindow.cpp Source/BinaryData/Templates/jucer_MainTemplate_Window.cpp Source/BinaryData/Templates/jucer_NewComponentTemplate.cpp Source/BinaryData/Templates/jucer_NewComponentTemplate.h diff --git a/extras/Projucer/JuceLibraryCode/BinaryData.cpp b/extras/Projucer/JuceLibraryCode/BinaryData.cpp index d986074afb..a671202b6e 100644 --- a/extras/Projucer/JuceLibraryCode/BinaryData.cpp +++ b/extras/Projucer/JuceLibraryCode/BinaryData.cpp @@ -5762,7 +5762,7 @@ static const unsigned char temp_binary_data_30[] = " This component lives inside our window, and this is where you should put all\r\n" " your controls and content.\r\n" "*/\r\n" -"class %%content_component_class%% : public juce::AnimatedAppComponent\r\n" +"class %%content_component_class%% : public juce::AnimatedAppComponent\r\n" "{\r\n" "public:\r\n" " //==============================================================================\r\n" @@ -5774,7 +5774,7 @@ static const unsigned char temp_binary_data_30[] = " setFramesPerSecond (60); // This sets the frequency of the update calls.\r\n" " }\r\n" "\r\n" -" ~%%content_component_class%%()\r\n" +" ~%%content_component_class%%() override\r\n" " {\r\n" " }\r\n" "\r\n" @@ -5865,12 +5865,12 @@ static const unsigned char temp_binary_data_32[] = " This component lives inside our window, and this is where you should put all\r\n" " your controls and content.\r\n" "*/\r\n" -"class %%content_component_class%% : public juce::AnimatedAppComponent\r\n" +"class %%content_component_class%% : public juce::AnimatedAppComponent\r\n" "{\r\n" "public:\r\n" " //==============================================================================\r\n" " %%content_component_class%%();\r\n" -" ~%%content_component_class%%();\r\n" +" ~%%content_component_class%%() override;\r\n" "\r\n" " //==============================================================================\r\n" " void update() override;\r\n" @@ -5900,7 +5900,7 @@ static const unsigned char temp_binary_data_33[] = " This component lives inside our window, and this is where you should put all\r\n" " your controls and content.\r\n" "*/\r\n" -"class %%content_component_class%% : public juce::AudioAppComponent\r\n" +"class %%content_component_class%% : public juce::AudioAppComponent\r\n" "{\r\n" "public:\r\n" " //==============================================================================\r\n" @@ -6079,7 +6079,7 @@ static const unsigned char temp_binary_data_35[] = " This component lives inside our window, and this is where you should put all\r\n" " your controls and content.\r\n" "*/\r\n" -"class %%content_component_class%% : public juce::AudioAppComponent\r\n" +"class %%content_component_class%% : public juce::AudioAppComponent\r\n" "{\r\n" "public:\r\n" " //==============================================================================\r\n" @@ -6119,7 +6119,7 @@ static const unsigned char temp_binary_data_36[] = "\r\n" "//==============================================================================\r\n" "%%editor_class_name%%::%%editor_class_name%% (%%filter_class_name%%& p)\r\n" -" : AudioProcessorEditor (&p), processor (p)\r\n" +" : AudioProcessorEditor (&p), audioProcessor (p)\r\n" "{\r\n" " // Make sure that before the constructor has finished, you've set the\r\n" " // editor's size to whatever you need it to be.\r\n" @@ -6170,7 +6170,7 @@ static const unsigned char temp_binary_data_37[] = "{\r\n" "public:\r\n" " %%editor_class_name%% (%%filter_class_name%%&);\r\n" -" ~%%editor_class_name%%();\r\n" +" ~%%editor_class_name%%() override;\r\n" "\r\n" " //==============================================================================\r\n" " void paint (juce::Graphics&) override;\r\n" @@ -6179,7 +6179,7 @@ static const unsigned char temp_binary_data_37[] = "private:\r\n" " // This reference is provided as a quick way for your editor to\r\n" " // access the processor object that created it.\r\n" -" %%filter_class_name%%& processor;\r\n" +" %%filter_class_name%%& audioProcessor;\r\n" "\r\n" " JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (%%editor_class_name%%)\r\n" "};\r\n"; @@ -6401,7 +6401,7 @@ static const unsigned char temp_binary_data_39[] = "public:\r\n" " //==============================================================================\r\n" " %%filter_class_name%%();\r\n" -" ~%%filter_class_name%%();\r\n" +" ~%%filter_class_name%%() override;\r\n" "\r\n" " //==============================================================================\r\n" " void prepareToPlay (double sampleRate, int samplesPerBlock) override;\r\n" @@ -6599,7 +6599,7 @@ static const unsigned char temp_binary_data_42[] = " This component lives inside our window, and this is where you should put all\r\n" " your controls and content.\r\n" "*/\r\n" -"class %%content_component_class%% : public juce::Component\r\n" +"class %%content_component_class%% : public juce::Component\r\n" "{\r\n" "public:\r\n" " //==============================================================================\r\n" @@ -6608,7 +6608,7 @@ static const unsigned char temp_binary_data_42[] = " setSize (600, 400);\r\n" " }\r\n" "\r\n" -" ~%%content_component_class%%()\r\n" +" ~%%content_component_class%%() override\r\n" " {\r\n" " }\r\n" "\r\n" @@ -6686,12 +6686,12 @@ static const unsigned char temp_binary_data_44[] = " This component lives inside our window, and this is where you should put all\r\n" " your controls and content.\r\n" "*/\r\n" -"class %%content_component_class%% : public juce::Component\r\n" +"class %%content_component_class%% : public juce::Component\r\n" "{\r\n" "public:\r\n" " //==============================================================================\r\n" " %%content_component_class%%();\r\n" -" ~%%content_component_class%%();\r\n" +" ~%%content_component_class%%() override;\r\n" "\r\n" " //==============================================================================\r\n" " void paint (juce::Graphics&) override;\r\n" @@ -6710,7 +6710,7 @@ const char* jucer_ContentCompTemplate_h = (const char*) temp_binary_data_44; //================== jucer_InlineComponentTemplate.h ================== static const unsigned char temp_binary_data_45[] = "//==============================================================================\r\n" -"class %%component_class%% : public juce::Component\r\n" +"class %%component_class%% : public juce::Component\r\n" "{\r\n" "public:\r\n" " %%component_class%%()\r\n" @@ -6720,7 +6720,7 @@ static const unsigned char temp_binary_data_45[] = "\r\n" " }\r\n" "\r\n" -" ~%%component_class%%()\r\n" +" ~%%component_class%%() override\r\n" " {\r\n" " }\r\n" "\r\n" @@ -6797,7 +6797,7 @@ static const unsigned char temp_binary_data_47[] = "\r\n" " const juce::String getApplicationName() override { return ProjectInfo::projectName; }\r\n" " const juce::String getApplicationVersion() override { return ProjectInfo::versionString; }\r\n" -" bool moreThanOneInstanceAllowed() override { return %%allow_more_than_one_instance%%; }\r\n" +" bool moreThanOneInstanceAllowed() override { return true; }\r\n" "\r\n" " //==============================================================================\r\n" " void initialise (const juce::String& commandLine) override\r\n" @@ -6832,117 +6832,8 @@ static const unsigned char temp_binary_data_47[] = const char* jucer_MainTemplate_NoWindow_cpp = (const char*) temp_binary_data_47; -//================== jucer_MainTemplate_SimpleWindow.cpp ================== -static const unsigned char temp_binary_data_48[] = -"/*\r\n" -" ==============================================================================\r\n" -"\r\n" -" This file contains the basic startup code for a JUCE application.\r\n" -"\r\n" -" ==============================================================================\r\n" -"*/\r\n" -"\r\n" -"%%app_headers%%\r\n" -"\r\n" -"//==============================================================================\r\n" -"class %%app_class_name%% : public juce::JUCEApplication\r\n" -"{\r\n" -"public:\r\n" -" //==============================================================================\r\n" -" %%app_class_name%%() {}\r\n" -"\r\n" -" const juce::String getApplicationName() override { return ProjectInfo::projectName; }\r\n" -" const juce::String getApplicationVersion() override { return ProjectInfo::versionString; }\r\n" -" bool moreThanOneInstanceAllowed() override { return %%allow_more_than_one_instance%%; }\r\n" -"\r\n" -" //==============================================================================\r\n" -" void initialise (const juce::String& commandLine) override\r\n" -" {\r\n" -" // This method is where you should put your application's initialisation code..\r\n" -"\r\n" -" mainWindow.reset (new MainWindow (getApplicationName()));\r\n" -" }\r\n" -"\r\n" -" void shutdown() override\r\n" -" {\r\n" -" // Add your application's shutdown code here..\r\n" -"\r\n" -" mainWindow = nullptr; // (deletes our window)\r\n" -" }\r\n" -"\r\n" -" //==============================================================================\r\n" -" void systemRequestedQuit() override\r\n" -" {\r\n" -" // This is called when the app is being asked to quit: you can ignore this\r\n" -" // request and let the app carry on running, or call quit() to allow the app to close.\r\n" -" quit();\r\n" -" }\r\n" -"\r\n" -" void anotherInstanceStarted (const juce::String& commandLine) override\r\n" -" {\r\n" -" // When another instance of the app is launched while this one is running,\r\n" -" // this method is invoked, and the commandLine parameter tells you what\r\n" -" // the other instance's command-line arguments were.\r\n" -" }\r\n" -"\r\n" -" //==============================================================================\r\n" -" /*\r\n" -" This class implements the desktop window that contains an instance of\r\n" -" our %%content_component_class%% class.\r\n" -" */\r\n" -" class MainWindow : public juce::DocumentWindow\r\n" -" {\r\n" -" public:\r\n" -" MainWindow (juce::String name)\r\n" -" : DocumentWindow (name,\r\n" -" juce::Desktop::getInstance().getDefaultLookAndFeel()\r\n" -" .findColour (juce::ResizableWindow::backgroundColourId),\r\n" -" DocumentWindow::allButtons)\r\n" -" {\r\n" -" setUsingNativeTitleBar (true);\r\n" -" setContentOwned (new %%content_component_class%%(), true);\r\n" -"\r\n" -" #if JUCE_IOS || JUCE_ANDROID\r\n" -" setFullScreen (true);\r\n" -" #else\r\n" -" setResizable (true, true);\r\n" -" centreWithSize (getWidth(), getHeight());\r\n" -" #endif\r\n" -"\r\n" -" setVisible (true);\r\n" -" }\r\n" -"\r\n" -" void closeButtonPressed() override\r\n" -" {\r\n" -" // This is called when the user tries to close this window. Here, we'll just\r\n" -" // ask the app to quit when this happens, but you can change this to do\r\n" -" // whatever you need.\r\n" -" juce::JUCEApplication::getInstance()->systemRequestedQuit();\r\n" -" }\r\n" -"\r\n" -" /* Note: Be careful if you override any DocumentWindow methods - the base\r\n" -" class uses a lot of them, so by overriding you might break its functionality.\r\n" -" It's best to do all your work in your content component instead, but if\r\n" -" you really have to override any DocumentWindow methods, make sure your\r\n" -" subclass also calls the superclass's method.\r\n" -" */\r\n" -"\r\n" -" private:\r\n" -" JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow)\r\n" -" };\r\n" -"\r\n" -"private:\r\n" -" std::unique_ptr mainWindow;\r\n" -"};\r\n" -"\r\n" -"//==============================================================================\r\n" -"// This macro generates the main() routine that launches the app.\r\n" -"START_JUCE_APPLICATION (%%app_class_name%%)\r\n"; - -const char* jucer_MainTemplate_SimpleWindow_cpp = (const char*) temp_binary_data_48; - //================== jucer_MainTemplate_Window.cpp ================== -static const unsigned char temp_binary_data_49[] = +static const unsigned char temp_binary_data_48[] = "/*\r\n" " ==============================================================================\r\n" "\r\n" @@ -6962,7 +6853,7 @@ static const unsigned char temp_binary_data_49[] = "\r\n" " const juce::String getApplicationName() override { return ProjectInfo::projectName; }\r\n" " const juce::String getApplicationVersion() override { return ProjectInfo::versionString; }\r\n" -" bool moreThanOneInstanceAllowed() override { return %%allow_more_than_one_instance%%; }\r\n" +" bool moreThanOneInstanceAllowed() override { return true; }\r\n" "\r\n" " //==============================================================================\r\n" " void initialise (const juce::String& commandLine) override\r\n" @@ -7048,10 +6939,10 @@ static const unsigned char temp_binary_data_49[] = "// This macro generates the main() routine that launches the app.\r\n" "START_JUCE_APPLICATION (%%app_class_name%%)\r\n"; -const char* jucer_MainTemplate_Window_cpp = (const char*) temp_binary_data_49; +const char* jucer_MainTemplate_Window_cpp = (const char*) temp_binary_data_48; //================== jucer_NewComponentTemplate.cpp ================== -static const unsigned char temp_binary_data_50[] = +static const unsigned char temp_binary_data_49[] = "/*\r\n" " ==============================================================================\r\n" "\r\n" @@ -7104,10 +6995,10 @@ static const unsigned char temp_binary_data_50[] = "\r\n" "}\r\n"; -const char* jucer_NewComponentTemplate_cpp = (const char*) temp_binary_data_50; +const char* jucer_NewComponentTemplate_cpp = (const char*) temp_binary_data_49; //================== jucer_NewComponentTemplate.h ================== -static const unsigned char temp_binary_data_51[] = +static const unsigned char temp_binary_data_50[] = "/*\r\n" " ==============================================================================\r\n" "\r\n" @@ -7125,11 +7016,11 @@ static const unsigned char temp_binary_data_51[] = "//==============================================================================\r\n" "/*\r\n" "*/\r\n" -"class %%component_class%% : public juce::Component\r\n" +"class %%component_class%% : public juce::Component\r\n" "{\r\n" "public:\r\n" " %%component_class%%();\r\n" -" ~%%component_class%%();\r\n" +" ~%%component_class%%() override;\r\n" "\r\n" " void paint (juce::Graphics&) override;\r\n" " void resized() override;\r\n" @@ -7138,10 +7029,10 @@ static const unsigned char temp_binary_data_51[] = " JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (%%component_class%%)\r\n" "};\r\n"; -const char* jucer_NewComponentTemplate_h = (const char*) temp_binary_data_51; +const char* jucer_NewComponentTemplate_h = (const char*) temp_binary_data_50; //================== jucer_NewCppFileTemplate.cpp ================== -static const unsigned char temp_binary_data_52[] = +static const unsigned char temp_binary_data_51[] = "/*\r\n" " ==============================================================================\r\n" "\r\n" @@ -7154,10 +7045,10 @@ static const unsigned char temp_binary_data_52[] = "\r\n" "%%include_corresponding_header%%\r\n"; -const char* jucer_NewCppFileTemplate_cpp = (const char*) temp_binary_data_52; +const char* jucer_NewCppFileTemplate_cpp = (const char*) temp_binary_data_51; //================== jucer_NewCppFileTemplate.h ================== -static const unsigned char temp_binary_data_53[] = +static const unsigned char temp_binary_data_52[] = "/*\r\n" " ==============================================================================\r\n" "\r\n" @@ -7170,10 +7061,10 @@ static const unsigned char temp_binary_data_53[] = "\r\n" "#pragma once\r\n"; -const char* jucer_NewCppFileTemplate_h = (const char*) temp_binary_data_53; +const char* jucer_NewCppFileTemplate_h = (const char*) temp_binary_data_52; //================== jucer_NewInlineComponentTemplate.h ================== -static const unsigned char temp_binary_data_54[] = +static const unsigned char temp_binary_data_53[] = "/*\r\n" " ==============================================================================\r\n" "\r\n" @@ -7191,7 +7082,7 @@ static const unsigned char temp_binary_data_54[] = "//==============================================================================\r\n" "/*\r\n" "*/\r\n" -"class %%component_class%% : public juce::Component\r\n" +"class %%component_class%% : public juce::Component\r\n" "{\r\n" "public:\r\n" " %%component_class%%()\r\n" @@ -7201,7 +7092,7 @@ static const unsigned char temp_binary_data_54[] = "\r\n" " }\r\n" "\r\n" -" ~%%component_class%%()\r\n" +" ~%%component_class%%() override\r\n" " {\r\n" " }\r\n" "\r\n" @@ -7236,10 +7127,10 @@ static const unsigned char temp_binary_data_54[] = " JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (%%component_class%%)\r\n" "};\r\n"; -const char* jucer_NewInlineComponentTemplate_h = (const char*) temp_binary_data_54; +const char* jucer_NewInlineComponentTemplate_h = (const char*) temp_binary_data_53; //================== jucer_OpenGLComponentSimpleTemplate.h ================== -static const unsigned char temp_binary_data_55[] = +static const unsigned char temp_binary_data_54[] = "#pragma once\r\n" "\r\n" "%%include_juce%%\r\n" @@ -7249,7 +7140,7 @@ static const unsigned char temp_binary_data_55[] = " This component lives inside our window, and this is where you should put all\r\n" " your controls and content.\r\n" "*/\r\n" -"class %%content_component_class%% : public juce::OpenGLAppComponent\r\n" +"class %%content_component_class%% : public juce::OpenGLAppComponent\r\n" "{\r\n" "public:\r\n" " //==============================================================================\r\n" @@ -7260,7 +7151,7 @@ static const unsigned char temp_binary_data_55[] = " setSize (800, 600);\r\n" " }\r\n" "\r\n" -" ~%%content_component_class%%()\r\n" +" ~%%content_component_class%%() override\r\n" " {\r\n" " // This shuts down the GL system and stops the rendering calls.\r\n" " shutdownOpenGL();\r\n" @@ -7308,10 +7199,10 @@ static const unsigned char temp_binary_data_55[] = " JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (%%content_component_class%%)\r\n" "};\r\n"; -const char* jucer_OpenGLComponentSimpleTemplate_h = (const char*) temp_binary_data_55; +const char* jucer_OpenGLComponentSimpleTemplate_h = (const char*) temp_binary_data_54; //================== jucer_OpenGLComponentTemplate.cpp ================== -static const unsigned char temp_binary_data_56[] = +static const unsigned char temp_binary_data_55[] = "%%include_corresponding_header%%\r\n" "\r\n" "//==============================================================================\r\n" @@ -7361,10 +7252,10 @@ static const unsigned char temp_binary_data_56[] = " // update their positions.\r\n" "}\r\n"; -const char* jucer_OpenGLComponentTemplate_cpp = (const char*) temp_binary_data_56; +const char* jucer_OpenGLComponentTemplate_cpp = (const char*) temp_binary_data_55; //================== jucer_OpenGLComponentTemplate.h ================== -static const unsigned char temp_binary_data_57[] = +static const unsigned char temp_binary_data_56[] = "#pragma once\r\n" "\r\n" "%%include_juce%%\r\n" @@ -7374,12 +7265,12 @@ static const unsigned char temp_binary_data_57[] = " This component lives inside our window, and this is where you should put all\r\n" " your controls and content.\r\n" "*/\r\n" -"class %%content_component_class%% : public juce::OpenGLAppComponent\r\n" +"class %%content_component_class%% : public juce::OpenGLAppComponent\r\n" "{\r\n" "public:\r\n" " //==============================================================================\r\n" " %%content_component_class%%();\r\n" -" ~%%content_component_class%%();\r\n" +" ~%%content_component_class%%() override;\r\n" "\r\n" " //==============================================================================\r\n" " void initialise() override;\r\n" @@ -7398,10 +7289,10 @@ static const unsigned char temp_binary_data_57[] = " JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (%%content_component_class%%)\r\n" "};\r\n"; -const char* jucer_OpenGLComponentTemplate_h = (const char*) temp_binary_data_57; +const char* jucer_OpenGLComponentTemplate_h = (const char*) temp_binary_data_56; //================== jucer_PIPAudioProcessorTemplate.h ================== -static const unsigned char temp_binary_data_58[] = +static const unsigned char temp_binary_data_57[] = "class %%class_name%% : public juce::AudioProcessor\r\n" "{\r\n" "public:\r\n" @@ -7412,7 +7303,7 @@ static const unsigned char temp_binary_data_58[] = " {\r\n" " }\r\n" "\r\n" -" ~%%class_name%%()\r\n" +" ~%%class_name%%() override\r\n" " {\r\n" " }\r\n" "\r\n" @@ -7510,10 +7401,10 @@ static const unsigned char temp_binary_data_58[] = " JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (%%class_name%%)\r\n" "};\r\n"; -const char* jucer_PIPAudioProcessorTemplate_h = (const char*) temp_binary_data_58; +const char* jucer_PIPAudioProcessorTemplate_h = (const char*) temp_binary_data_57; //================== jucer_PIPTemplate.h ================== -static const unsigned char temp_binary_data_59[] = +static const unsigned char temp_binary_data_58[] = "/*******************************************************************************\r\n" " The block below describes the properties of this PIP. A PIP is a short snippet\r\n" " of code that can be read by the Projucer and used to generate a JUCE project.\r\n" @@ -7532,10 +7423,10 @@ static const unsigned char temp_binary_data_59[] = "//==============================================================================\r\n" "%%pip_code%%\r\n"; -const char* jucer_PIPTemplate_h = (const char*) temp_binary_data_59; +const char* jucer_PIPTemplate_h = (const char*) temp_binary_data_58; //================== colourscheme_dark.xml ================== -static const unsigned char temp_binary_data_60[] = +static const unsigned char temp_binary_data_59[] = "\r\n" "\r\n" "\r\n" @@ -7560,10 +7451,10 @@ static const unsigned char temp_binary_data_60[] = " \r\n" "\r\n"; -const char* colourscheme_dark_xml = (const char*) temp_binary_data_60; +const char* colourscheme_dark_xml = (const char*) temp_binary_data_59; //================== colourscheme_light.xml ================== -static const unsigned char temp_binary_data_61[] = +static const unsigned char temp_binary_data_60[] = "\r\n" "\r\n" "\r\n" @@ -7588,16 +7479,16 @@ static const unsigned char temp_binary_data_61[] = " \r\n" "\r\n"; -const char* colourscheme_light_xml = (const char*) temp_binary_data_61; +const char* colourscheme_light_xml = (const char*) temp_binary_data_60; //================== nothingtoseehere.txt ================== -static const unsigned char temp_binary_data_62[] = +static const unsigned char temp_binary_data_61[] = "VUEtMTk3NTkzMTgtNA=="; -const char* nothingtoseehere_txt = (const char*) temp_binary_data_62; +const char* nothingtoseehere_txt = (const char*) temp_binary_data_61; //================== projucer_EULA.txt ================== -static const unsigned char temp_binary_data_63[] = +static const unsigned char temp_binary_data_62[] = "\r\n" "IMPORTANT NOTICE: PLEASE READ CAREFULLY BEFORE INSTALLING THE SOFTWARE:\r\n" "\r\n" @@ -7761,7 +7652,7 @@ static const unsigned char temp_binary_data_63[] = "\r\n" "10.6. Please note that this License, its subject matter and its formation, are governed by English law. You and we both agree to that the courts of England and Wales will have exclusive jurisdiction.\r\n"; -const char* projucer_EULA_txt = (const char*) temp_binary_data_63; +const char* projucer_EULA_txt = (const char*) temp_binary_data_62; const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) @@ -7804,35 +7695,34 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) case 0x52a8dfdf: numBytes = 1859; return wizard_Openfile_svg; case 0x58e2ae48: numBytes = 4551; return wizard_OpenGL_svg; case 0xb1da6f9e: numBytes = 7488; return wizard_StaticLibrary_svg; - case 0xd11e6d35: numBytes = 1890; return jucer_AnimatedComponentSimpleTemplate_h; + case 0xd11e6d35: numBytes = 1898; return jucer_AnimatedComponentSimpleTemplate_h; case 0x6cf2645e: numBytes = 1362; return jucer_AnimatedComponentTemplate_cpp; - case 0x97b055e3: numBytes = 1000; return jucer_AnimatedComponentTemplate_h; - case 0xfb6f6d96: numBytes = 3555; return jucer_AudioComponentSimpleTemplate_h; + case 0x97b055e3: numBytes = 1008; return jucer_AnimatedComponentTemplate_h; + case 0xfb6f6d96: numBytes = 3554; return jucer_AudioComponentSimpleTemplate_h; case 0xafccbd3f: numBytes = 2941; return jucer_AudioComponentTemplate_cpp; - case 0x915d7304: numBytes = 1188; return jucer_AudioComponentTemplate_h; - case 0x27c5a93a: numBytes = 1350; return jucer_AudioPluginEditorTemplate_cpp; - case 0x4d0721bf: numBytes = 959; return jucer_AudioPluginEditorTemplate_h; + case 0x915d7304: numBytes = 1187; return jucer_AudioComponentTemplate_h; + case 0x27c5a93a: numBytes = 1355; return jucer_AudioPluginEditorTemplate_cpp; + case 0x4d0721bf: numBytes = 973; return jucer_AudioPluginEditorTemplate_h; case 0x51b49ac5: numBytes = 6090; return jucer_AudioPluginFilterTemplate_cpp; - case 0x488afa0a: numBytes = 2290; return jucer_AudioPluginFilterTemplate_h; + case 0x488afa0a: numBytes = 2299; return jucer_AudioPluginFilterTemplate_h; case 0xabad7041: numBytes = 2147; return jucer_ComponentTemplate_cpp; case 0xfc72fe86: numBytes = 2065; return jucer_ComponentTemplate_h; - case 0x1657b643: numBytes = 1516; return jucer_ContentCompSimpleTemplate_h; + case 0x1657b643: numBytes = 1524; return jucer_ContentCompSimpleTemplate_h; case 0x0b66646c: numBytes = 1007; return jucer_ContentCompTemplate_cpp; - case 0x6fa10171: numBytes = 870; return jucer_ContentCompTemplate_h; - case 0x28d496ad: numBytes = 1269; return jucer_InlineComponentTemplate_h; + case 0x6fa10171: numBytes = 878; return jucer_ContentCompTemplate_h; + case 0x28d496ad: numBytes = 1276; return jucer_InlineComponentTemplate_h; case 0x8905395b: numBytes = 443; return jucer_MainConsoleAppTemplate_cpp; - case 0x5e5ea047: numBytes = 2027; return jucer_MainTemplate_NoWindow_cpp; - case 0xda2391f8: numBytes = 4115; return jucer_MainTemplate_SimpleWindow_cpp; - case 0x400bc026: numBytes = 4109; return jucer_MainTemplate_Window_cpp; + case 0x5e5ea047: numBytes = 1999; return jucer_MainTemplate_NoWindow_cpp; + case 0x400bc026: numBytes = 4081; return jucer_MainTemplate_Window_cpp; case 0xf4842835: numBytes = 1521; return jucer_NewComponentTemplate_cpp; - case 0xe7bf237a: numBytes = 658; return jucer_NewComponentTemplate_h; + case 0xe7bf237a: numBytes = 665; return jucer_NewComponentTemplate_h; case 0x02a2a077: numBytes = 278; return jucer_NewCppFileTemplate_cpp; case 0x0842c43c: numBytes = 258; return jucer_NewCppFileTemplate_h; - case 0x36e634a1: numBytes = 1712; return jucer_NewInlineComponentTemplate_h; - case 0x6bdeb129: numBytes = 1979; return jucer_OpenGLComponentSimpleTemplate_h; + case 0x36e634a1: numBytes = 1719; return jucer_NewInlineComponentTemplate_h; + case 0x6bdeb129: numBytes = 1987; return jucer_OpenGLComponentSimpleTemplate_h; case 0x7fbac252: numBytes = 1470; return jucer_OpenGLComponentTemplate_cpp; - case 0x491fa0d7: numBytes = 1062; return jucer_OpenGLComponentTemplate_h; - case 0xbc050edc: numBytes = 5046; return jucer_PIPAudioProcessorTemplate_h; + case 0x491fa0d7: numBytes = 1070; return jucer_OpenGLComponentTemplate_h; + case 0xbc050edc: numBytes = 5055; return jucer_PIPAudioProcessorTemplate_h; case 0x0b16e320: numBytes = 517; return jucer_PIPTemplate_h; case 0x763d39dc: numBytes = 1050; return colourscheme_dark_xml; case 0xe8b08520: numBytes = 1050; return colourscheme_light_xml; @@ -7895,7 +7785,6 @@ const char* namedResourceList[] = "jucer_InlineComponentTemplate_h", "jucer_MainConsoleAppTemplate_cpp", "jucer_MainTemplate_NoWindow_cpp", - "jucer_MainTemplate_SimpleWindow_cpp", "jucer_MainTemplate_Window_cpp", "jucer_NewComponentTemplate_cpp", "jucer_NewComponentTemplate_h", @@ -7963,7 +7852,6 @@ const char* originalFilenames[] = "jucer_InlineComponentTemplate.h", "jucer_MainConsoleAppTemplate.cpp", "jucer_MainTemplate_NoWindow.cpp", - "jucer_MainTemplate_SimpleWindow.cpp", "jucer_MainTemplate_Window.cpp", "jucer_NewComponentTemplate.cpp", "jucer_NewComponentTemplate.h", diff --git a/extras/Projucer/JuceLibraryCode/BinaryData.h b/extras/Projucer/JuceLibraryCode/BinaryData.h index 655ed56e83..3dd8b0ef67 100644 --- a/extras/Projucer/JuceLibraryCode/BinaryData.h +++ b/extras/Projucer/JuceLibraryCode/BinaryData.h @@ -99,34 +99,34 @@ namespace BinaryData const int wizard_StaticLibrary_svgSize = 7488; extern const char* jucer_AnimatedComponentSimpleTemplate_h; - const int jucer_AnimatedComponentSimpleTemplate_hSize = 1890; + const int jucer_AnimatedComponentSimpleTemplate_hSize = 1898; extern const char* jucer_AnimatedComponentTemplate_cpp; const int jucer_AnimatedComponentTemplate_cppSize = 1362; extern const char* jucer_AnimatedComponentTemplate_h; - const int jucer_AnimatedComponentTemplate_hSize = 1000; + const int jucer_AnimatedComponentTemplate_hSize = 1008; extern const char* jucer_AudioComponentSimpleTemplate_h; - const int jucer_AudioComponentSimpleTemplate_hSize = 3555; + const int jucer_AudioComponentSimpleTemplate_hSize = 3554; extern const char* jucer_AudioComponentTemplate_cpp; const int jucer_AudioComponentTemplate_cppSize = 2941; extern const char* jucer_AudioComponentTemplate_h; - const int jucer_AudioComponentTemplate_hSize = 1188; + const int jucer_AudioComponentTemplate_hSize = 1187; extern const char* jucer_AudioPluginEditorTemplate_cpp; - const int jucer_AudioPluginEditorTemplate_cppSize = 1350; + const int jucer_AudioPluginEditorTemplate_cppSize = 1355; extern const char* jucer_AudioPluginEditorTemplate_h; - const int jucer_AudioPluginEditorTemplate_hSize = 959; + const int jucer_AudioPluginEditorTemplate_hSize = 973; extern const char* jucer_AudioPluginFilterTemplate_cpp; const int jucer_AudioPluginFilterTemplate_cppSize = 6090; extern const char* jucer_AudioPluginFilterTemplate_h; - const int jucer_AudioPluginFilterTemplate_hSize = 2290; + const int jucer_AudioPluginFilterTemplate_hSize = 2299; extern const char* jucer_ComponentTemplate_cpp; const int jucer_ComponentTemplate_cppSize = 2147; @@ -135,34 +135,31 @@ namespace BinaryData const int jucer_ComponentTemplate_hSize = 2065; extern const char* jucer_ContentCompSimpleTemplate_h; - const int jucer_ContentCompSimpleTemplate_hSize = 1516; + const int jucer_ContentCompSimpleTemplate_hSize = 1524; extern const char* jucer_ContentCompTemplate_cpp; const int jucer_ContentCompTemplate_cppSize = 1007; extern const char* jucer_ContentCompTemplate_h; - const int jucer_ContentCompTemplate_hSize = 870; + const int jucer_ContentCompTemplate_hSize = 878; extern const char* jucer_InlineComponentTemplate_h; - const int jucer_InlineComponentTemplate_hSize = 1269; + const int jucer_InlineComponentTemplate_hSize = 1276; extern const char* jucer_MainConsoleAppTemplate_cpp; const int jucer_MainConsoleAppTemplate_cppSize = 443; extern const char* jucer_MainTemplate_NoWindow_cpp; - const int jucer_MainTemplate_NoWindow_cppSize = 2027; - - extern const char* jucer_MainTemplate_SimpleWindow_cpp; - const int jucer_MainTemplate_SimpleWindow_cppSize = 4115; + const int jucer_MainTemplate_NoWindow_cppSize = 1999; extern const char* jucer_MainTemplate_Window_cpp; - const int jucer_MainTemplate_Window_cppSize = 4109; + const int jucer_MainTemplate_Window_cppSize = 4081; extern const char* jucer_NewComponentTemplate_cpp; const int jucer_NewComponentTemplate_cppSize = 1521; extern const char* jucer_NewComponentTemplate_h; - const int jucer_NewComponentTemplate_hSize = 658; + const int jucer_NewComponentTemplate_hSize = 665; extern const char* jucer_NewCppFileTemplate_cpp; const int jucer_NewCppFileTemplate_cppSize = 278; @@ -171,19 +168,19 @@ namespace BinaryData const int jucer_NewCppFileTemplate_hSize = 258; extern const char* jucer_NewInlineComponentTemplate_h; - const int jucer_NewInlineComponentTemplate_hSize = 1712; + const int jucer_NewInlineComponentTemplate_hSize = 1719; extern const char* jucer_OpenGLComponentSimpleTemplate_h; - const int jucer_OpenGLComponentSimpleTemplate_hSize = 1979; + const int jucer_OpenGLComponentSimpleTemplate_hSize = 1987; extern const char* jucer_OpenGLComponentTemplate_cpp; const int jucer_OpenGLComponentTemplate_cppSize = 1470; extern const char* jucer_OpenGLComponentTemplate_h; - const int jucer_OpenGLComponentTemplate_hSize = 1062; + const int jucer_OpenGLComponentTemplate_hSize = 1070; extern const char* jucer_PIPAudioProcessorTemplate_h; - const int jucer_PIPAudioProcessorTemplate_hSize = 5046; + const int jucer_PIPAudioProcessorTemplate_hSize = 5055; extern const char* jucer_PIPTemplate_h; const int jucer_PIPTemplate_hSize = 517; @@ -201,7 +198,7 @@ namespace BinaryData const int projucer_EULA_txtSize = 14361; // Number of elements in the namedResourceList and originalFileNames arrays. - const int namedResourceListSize = 64; + const int namedResourceListSize = 63; // Points to the start of a list of resource names. extern const char* namedResourceList[]; diff --git a/extras/Projucer/Projucer.jucer b/extras/Projucer/Projucer.jucer index c1771c5ded..b9b9a99e5a 100644 --- a/extras/Projucer/Projucer.jucer +++ b/extras/Projucer/Projucer.jucer @@ -3,8 +3,8 @@ + companyName="Raw Material Software Limited" companyCopyright="Raw Material Software Limited" + cppLanguageStandard="11" useAppConfig="0" addUsingNamespaceToJuceHeader="1"> + + + + + + + + + @@ -247,8 +263,6 @@ resource="1" file="Source/BinaryData/Templates/jucer_MainConsoleAppTemplate.cpp"/> - + + - + - - - - - - - - - - - - - - - - - - - drawWithin (g, iconBounds.toFloat(), RectanglePlacement::centred, 1.0f); + } + +private: + static std::unique_ptr makeIcon (const char* iconSvgData) + { + if (auto svg = XmlDocument::parse (iconSvgData)) + return Drawable::createFromSVG (*svg); + + return {}; + } + + Label nameLabel, descriptionLabel; + + Rectangle iconBounds; + std::unique_ptr icon; + + //============================================================================== + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ItemHeader) +}; + +//============================================================================== +class TemplateComponent : public Component +{ +public: + TemplateComponent (const NewProjectTemplates::ProjectTemplate& temp, + std::function)>&& createdCallback) + : projectTemplate (temp), + projectCreatedCallback (std::move (createdCallback)), + header (projectTemplate.displayName, projectTemplate.description, projectTemplate.icon) + { + createProjectButton.onClick = [this] + { + FileChooser fc ("Save Project", NewProjectWizard::getLastWizardFolder()); + + if (fc.browseForDirectory()) + { + auto dir = fc.getResult(); + + if (auto project = NewProjectWizard::createNewProject (projectTemplate, + dir.getChildFile (projectNameValue.get().toString()), + projectNameValue.get(), + modulesValue.get(), + exportersValue.get(), + fileOptionsValue.get(), + modulePathValue.getCurrentValue(), + modulePathValue.getWrappedValueWithDefault().isUsingDefault())) + { + projectCreatedCallback (std::move (project)); + getAppSettings().lastWizardFolder = dir; + } + } + }; + + addAndMakeVisible (createProjectButton); + addAndMakeVisible (header); + + modulePathValue.init ({ settingsTree, Ids::defaultJuceModulePath, nullptr }, + getAppSettings().getStoredPath (Ids::defaultJuceModulePath, TargetOS::getThisOS()), + TargetOS::getThisOS()); + + panel.addProperties (buildPropertyList()); + addAndMakeVisible (panel); + } + + void resized() override + { + auto bounds = getLocalBounds().reduced (10); + + header.setBounds (bounds.removeFromTop (150)); + createProjectButton.setBounds (bounds.removeFromBottom (30).removeFromRight (150)); + bounds.removeFromBottom (5); + + panel.setBounds (bounds); + } + + void paint (Graphics& g) override + { + g.fillAll (findColour (secondaryBackgroundColourId)); + } + +private: + NewProjectTemplates::ProjectTemplate projectTemplate; + + std::function)> projectCreatedCallback; + + ItemHeader header; + TextButton createProjectButton { "Create Project..." }; + + ValueTree settingsTree { "NewProjectSettings" }; + + ValueWithDefault projectNameValue { settingsTree, Ids::name, nullptr, "NewProject" }, + modulesValue { settingsTree, Ids::dependencies_, nullptr, projectTemplate.requiredModules, "," }, + exportersValue { settingsTree, Ids::exporters, nullptr, StringArray (ProjectExporter::getCurrentPlatformExporterTypeInfo().identifier.toString()), "," }, + fileOptionsValue { settingsTree, Ids::file, nullptr, NewProjectTemplates::getVarForFileOption (projectTemplate.defaultFileOption) }; + + ValueWithDefaultWrapper modulePathValue; + + PropertyPanel panel; + + //============================================================================== + PropertyComponent* createProjectNamePropertyComponent() + { + return new TextPropertyComponent (projectNameValue, "Project Name", 1024, false); + } + + PropertyComponent* createModulesPropertyComponent() + { + Array moduleVars; + var requiredModules; + + for (auto& m : getJUCEModules()) + { + moduleVars.add (m); + + if (projectTemplate.requiredModules.contains (m)) + requiredModules.append (m); + } + + modulesValue = requiredModules; + + return new MultiChoicePropertyComponent (modulesValue, "Modules", + getJUCEModules(), moduleVars); + } + + PropertyComponent* createModulePathPropertyComponent() + { + return new FilePathPropertyComponent (modulePathValue.getWrappedValueWithDefault(), "Path to Modules", true); + } + + PropertyComponent* createExportersPropertyValue() + { + Array exporterVars; + StringArray exporterNames; + + for (auto& exporterTypeInfo : ProjectExporter::getExporterTypeInfos()) + { + exporterVars.add (exporterTypeInfo.identifier.toString()); + exporterNames.add (exporterTypeInfo.displayName); + } + + return new MultiChoicePropertyComponent (exportersValue, "Exporters", exporterNames, exporterVars); + } + + PropertyComponent* createFileCreationOptionsPropertyComponent() + { + Array optionVars; + StringArray optionStrings; + + for (auto& opt : projectTemplate.fileOptionsAndFiles) + { + optionVars.add (NewProjectTemplates::getVarForFileOption (opt.first)); + optionStrings.add (NewProjectTemplates::getStringForFileOption (opt.first)); + } + + return new ChoicePropertyComponent (fileOptionsValue, "File Creation Options", optionStrings, optionVars); + } + + Array buildPropertyList() + { + PropertyListBuilder builder; + + builder.add (createProjectNamePropertyComponent()); + builder.add (createModulesPropertyComponent()); + builder.add (createModulePathPropertyComponent()); + builder.add (createExportersPropertyValue()); + + if (! projectTemplate.fileOptionsAndFiles.empty()) + builder.add (createFileCreationOptionsPropertyComponent()); + + return builder.components; + } + + //============================================================================== + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TemplateComponent) +}; + +//============================================================================== +class ExampleComponent : public Component +{ +public: + ExampleComponent (const File& f, std::function selectedCallback) + : exampleFile (f), + metadata (parseJUCEHeaderMetadata (exampleFile)), + exampleSelectedCallback (std::move (selectedCallback)), + header (metadata[Ids::name].toString(), metadata[Ids::description].toString(), BinaryData::background_logo_svg), + codeViewer (doc, &cppTokeniser) + { + addAndMakeVisible (header); + + openExampleButton.onClick = [this] { exampleSelectedCallback (exampleFile); }; + addAndMakeVisible (openExampleButton); + + setupCodeViewer(); + addAndMakeVisible (codeViewer); + } + + void paint (Graphics& g) override + { + g.fillAll (findColour (secondaryBackgroundColourId)); + } + + void resized() override + { + auto bounds = getLocalBounds().reduced (10); + + header.setBounds (bounds.removeFromTop (125)); + openExampleButton.setBounds (bounds.removeFromBottom (30).removeFromRight (150)); + codeViewer.setBounds (bounds); + } + +private: + void setupCodeViewer() + { + auto fileString = exampleFile.loadFileAsString(); + + doc.replaceAllContent (fileString); + + codeViewer.setScrollbarThickness (6); + codeViewer.setReadOnly (true); + getAppSettings().appearance.applyToCodeEditor (codeViewer); + + codeViewer.scrollToLine (findBestLineToScrollToForClass (StringArray::fromLines (fileString), + metadata[Ids::name].toString(), + metadata[Ids::type] == "AudioProcessor")); + } + + //============================================================================== + File exampleFile; + var metadata; + + std::function exampleSelectedCallback; + + ItemHeader header; + + CPlusPlusCodeTokeniser cppTokeniser; + CodeDocument doc; + CodeEditorComponent codeViewer; + + TextButton openExampleButton { "Open Example..." }; + + //============================================================================== + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ExampleComponent) +}; diff --git a/extras/Projucer/Source/Application/StartPage/jucer_NewProjectTemplates.h b/extras/Projucer/Source/Application/StartPage/jucer_NewProjectTemplates.h new file mode 100644 index 0000000000..83394f9ea4 --- /dev/null +++ b/extras/Projucer/Source/Application/StartPage/jucer_NewProjectTemplates.h @@ -0,0 +1,244 @@ +/* + ============================================================================== + + This file is part of the JUCE 6 technical preview. + Copyright (c) 2020 - Raw Material Software Limited + + You may use this code under the terms of the GPL v3 + (see www.gnu.org/licenses). + + For this technical preview, this file is not subject to commercial licensing. + + 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 "../../Utility/Helpers/jucer_MiscUtilities.h" + +//============================================================================== +namespace NewProjectTemplates +{ + enum class ProjectCategory + { + application, + plugin, + library + }; + + inline String getProjectCategoryString (ProjectCategory category) + { + if (category == ProjectCategory::application) return "Application"; + if (category == ProjectCategory::plugin) return "Plug-In"; + if (category == ProjectCategory::library) return "Library"; + + jassertfalse; + return "Unknown"; + } + + enum class FileCreationOptions + { + noFiles, + main, + header, + headerAndCpp, + processorAndEditor + }; + + using FilenameAndContent = std::pair; + using OptionAndFilenameAndContent = std::pair>; + using OptionsAndFiles = std::vector; + + struct ProjectTemplate + { + ProjectCategory category; + String displayName, description, projectTypeString; + + const char* icon; + StringArray requiredModules; + OptionsAndFiles fileOptionsAndFiles; + FileCreationOptions defaultFileOption; + + std::vector getFilesForOption (FileCreationOptions option) const + { + auto iter = std::find_if (fileOptionsAndFiles.begin(), fileOptionsAndFiles.end(), + [option] (const OptionAndFilenameAndContent& opt) { return opt.first == option; }); + + if (iter != fileOptionsAndFiles.end()) + return iter->second; + + return {}; + } + }; + + inline bool isApplication (const ProjectTemplate& t) noexcept { return t.category == ProjectCategory::application; } + inline bool isPlugin (const ProjectTemplate& t) noexcept { return t.category == ProjectCategory::plugin; } + inline bool isLibrary (const ProjectTemplate& t) noexcept { return t.category == ProjectCategory::library; } + + //============================================================================== + inline var getVarForFileOption (FileCreationOptions opt) + { + if (opt == FileCreationOptions::noFiles) return "none"; + if (opt == FileCreationOptions::main) return "main"; + if (opt == FileCreationOptions::header) return "header"; + if (opt == FileCreationOptions::headerAndCpp) return "headercpp"; + if (opt == FileCreationOptions::processorAndEditor) return "processoreditor"; + + jassertfalse; + return {}; + } + + inline FileCreationOptions getFileOptionForVar (var opt) + { + if (opt == "none") return FileCreationOptions::noFiles; + if (opt == "main") return FileCreationOptions::main; + if (opt == "header") return FileCreationOptions::header; + if (opt == "headercpp") return FileCreationOptions::headerAndCpp; + if (opt == "processoreditor") return FileCreationOptions::processorAndEditor; + + jassertfalse; + return {}; + } + + inline String getStringForFileOption (FileCreationOptions opt) + { + if (opt == FileCreationOptions::noFiles) return "No Files"; + if (opt == FileCreationOptions::main) return "Main.cpp"; + if (opt == FileCreationOptions::header) return "Main.cpp + .h"; + if (opt == FileCreationOptions::headerAndCpp) return "Main.cpp + .h/.cpp "; + if (opt == FileCreationOptions::processorAndEditor) return "Processor and Editor"; + + jassertfalse; + return {}; + } + + //============================================================================== + template + inline StringArray addAndReturn (StringArray arr, Strings... strings) + { + arr.addArray ({ strings... }); + return arr; + } + + inline std::vector getAllTemplates() + { + return + { + { ProjectCategory::application, + "Blank", "Creates a blank JUCE GUI application.", + build_tools::ProjectType_GUIApp::getTypeName(), + BinaryData::wizard_GUI_svg, + getModulesRequiredForComponent(), + {}, + FileCreationOptions::noFiles + }, + + { ProjectCategory::application, + "GUI", "Creates a blank JUCE GUI application with a single window component.", + build_tools::ProjectType_GUIApp::getTypeName(), + BinaryData::wizard_GUI_svg, + getModulesRequiredForComponent(), + { + { FileCreationOptions::noFiles, {} }, + { FileCreationOptions::main, { { "Main.cpp", "jucer_MainTemplate_NoWindow_cpp" } } }, + { FileCreationOptions::header, { { "Main.cpp", "jucer_MainTemplate_Window_cpp" }, + { "MainComponent.h", "jucer_ContentCompSimpleTemplate_h" } } }, + { FileCreationOptions::headerAndCpp, { { "Main.cpp", "jucer_MainTemplate_Window_cpp" }, + { "MainComponent.h", "jucer_ContentCompTemplate_h" }, + { "MainComponent.cpp", "jucer_ContentCompTemplate_cpp" } } } + }, + FileCreationOptions::headerAndCpp }, + + { ProjectCategory::application, + "Audio", "Creates a blank JUCE GUI application with a single window component and audio and MIDI in/out functions.", + build_tools::ProjectType_GUIApp::getTypeName(), + BinaryData::wizard_AudioApp_svg, + addAndReturn (getModulesRequiredForComponent(), "juce_audio_basics", "juce_audio_devices", "juce_audio_formats", + "juce_audio_processors", "juce_audio_utils", "juce_gui_extra"), + { + { FileCreationOptions::header, { { "Main.cpp", "jucer_MainTemplate_Window_cpp" }, + { "MainComponent.h", "jucer_AudioComponentSimpleTemplate_h" } } }, + { FileCreationOptions::headerAndCpp, { { "Main.cpp", "jucer_MainTemplate_Window_cpp" }, + { "MainComponent.h", "jucer_AudioComponentTemplate_h" }, + { "MainComponent.cpp", "jucer_AudioComponentTemplate_cpp" } } } + }, + FileCreationOptions::headerAndCpp }, + + { ProjectCategory::application, + "Console", "Creates a command-line application without GUI support.", + build_tools::ProjectType_ConsoleApp::getTypeName(), + BinaryData::wizard_ConsoleApp_svg, + getModulesRequiredForConsole(), + { + { FileCreationOptions::noFiles, {} }, + { FileCreationOptions::main, { { "Main.cpp", "jucer_MainConsoleAppTemplate_cpp" } } } + }, + FileCreationOptions::main }, + + { ProjectCategory::application, + "Animated", "Creates a JUCE GUI application which draws an animated graphical display.", + build_tools::ProjectType_GUIApp::getTypeName(), + BinaryData::wizard_AnimatedApp_svg, + addAndReturn (getModulesRequiredForComponent(), "juce_gui_extra"), + { + { FileCreationOptions::header, { { "Main.cpp", "jucer_MainTemplate_Window_cpp" }, + { "MainComponent.h", "jucer_AudioComponentSimpleTemplate_h" } } }, + { FileCreationOptions::headerAndCpp, { { "Main.cpp", "jucer_MainTemplate_Window_cpp" }, + { "MainComponent.h", "jucer_AnimatedComponentTemplate_h" }, + { "MainComponent.cpp", "jucer_AnimatedComponentTemplate_cpp" } } } + }, + FileCreationOptions::headerAndCpp }, + + { ProjectCategory::application, + "OpenGL", "Creates a blank JUCE application with a single window component. " + "This component supports openGL drawing features including 3D model import and GLSL shaders.", + build_tools::ProjectType_GUIApp::getTypeName(), + BinaryData::wizard_OpenGL_svg, + addAndReturn (getModulesRequiredForComponent(), "juce_gui_extra", "juce_opengl"), + { + { FileCreationOptions::header, { { "Main.cpp", "jucer_MainTemplate_Window_cpp" }, + { "MainComponent.h", "jucer_AudioComponentSimpleTemplate_h" } } }, + { FileCreationOptions::headerAndCpp, { { "Main.cpp", "jucer_MainTemplate_Window_cpp" }, + { "MainComponent.h", "jucer_OpenGLComponentTemplate_h" }, + { "MainComponent.cpp", "jucer_OpenGLComponentTemplate_cpp" } } } + }, + FileCreationOptions::headerAndCpp }, + + { ProjectCategory::plugin, + "Basic", "Creates an audio plug-in with a single window GUI and audio/MIDI IO functions.", + build_tools::ProjectType_AudioPlugin::getTypeName(), + BinaryData::wizard_AudioPlugin_svg, + getModulesRequiredForAudioProcessor(), + { + { FileCreationOptions::processorAndEditor, { { "PluginProcessor.cpp", "jucer_AudioPluginFilterTemplate_cpp" }, + { "PluginProcessor.h", "jucer_AudioPluginFilterTemplate_h" }, + { "PluginEditor.cpp", "jucer_AudioPluginEditorTemplate_cpp" }, + { "PluginEditor.h", "jucer_AudioPluginEditorTemplate_h" } } } + }, + FileCreationOptions::processorAndEditor + }, + + { ProjectCategory::library, + "Static Library", "Creates a static library.", + build_tools::ProjectType_StaticLibrary::getTypeName(), + BinaryData::wizard_StaticLibrary_svg, + getModulesRequiredForConsole(), + {}, + FileCreationOptions::noFiles + }, + + { ProjectCategory::library, + "Dynamic Library", "Creates a dynamic library.", + build_tools::ProjectType_DLL::getTypeName(), + BinaryData::wizard_DLL_svg, + getModulesRequiredForConsole(), + {}, + FileCreationOptions::noFiles + } + }; + } +} diff --git a/extras/Projucer/Source/Application/StartPage/jucer_NewProjectWizard.cpp b/extras/Projucer/Source/Application/StartPage/jucer_NewProjectWizard.cpp new file mode 100644 index 0000000000..d5c6e54acc --- /dev/null +++ b/extras/Projucer/Source/Application/StartPage/jucer_NewProjectWizard.cpp @@ -0,0 +1,270 @@ +/* + ============================================================================== + + This file is part of the JUCE 6 technical preview. + Copyright (c) 2020 - Raw Material Software Limited + + You may use this code under the terms of the GPL v3 + (see www.gnu.org/licenses). + + For this technical preview, this file is not subject to commercial licensing. + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +#include "../jucer_Headers.h" +#include "../jucer_Application.h" +#include "../../ProjectSaving/jucer_ProjectExporter.h" + +#include "jucer_NewProjectWizard.h" + +//============================================================================== +static String getFileTemplate (const String& templateName) +{ + int dataSize = 0; + + if (auto* data = BinaryData::getNamedResource (templateName.toUTF8(), dataSize)) + return String::fromUTF8 (data, dataSize); + + jassertfalse; + return {}; +} + +static String getJuceHeaderInclude() +{ + return CodeHelpers::createIncludePathIncludeStatement (Project::getJuceSourceHFilename()); +} + +static String getContentComponentName() +{ + return "MainComponent"; +} + +using Opts = NewProjectTemplates::FileCreationOptions; + +static bool shouldCreateHeaderFile (Opts opts) noexcept { return opts == Opts::header || opts == Opts::headerAndCpp; } +static bool shouldCreateCppFile (Opts opts) noexcept { return opts == Opts::headerAndCpp; } + +static void doBasicProjectSetup (Project& project, const NewProjectTemplates::ProjectTemplate& projectTemplate, const String& name) +{ + project.setTitle (name); + project.setProjectType (projectTemplate.projectTypeString); + project.getMainGroup().addNewSubGroup ("Source", 0); + + project.getConfigFlag ("JUCE_STRICT_REFCOUNTEDPOINTER") = true; + project.getProjectValue (Ids::useAppConfig) = false; + project.getProjectValue (Ids::addUsingNamespaceToJuceHeader) = false; + + if (! ProjucerApplication::getApp().getLicenseController().getCurrentState().isPaidOrGPL()) + project.getProjectValue (Ids::displaySplashScreen) = true; + + if (NewProjectTemplates::isPlugin (projectTemplate)) + project.getConfigFlag ("JUCE_VST3_CAN_REPLACE_VST2") = 0; +} + +static std::map getSharedFileTokenReplacements() +{ + return { { "%%app_headers%%", getJuceHeaderInclude() } }; +} + +static std::map getApplicationFileTokenReplacements (const String& name, + NewProjectTemplates::FileCreationOptions fileOptions, + const File& sourceFolder) +{ + auto tokenReplacements = getSharedFileTokenReplacements(); + + tokenReplacements.insert ({ "%%app_class_name%%", + build_tools::makeValidIdentifier (name + "Application", false, true, false) }); + tokenReplacements.insert ({ "%%content_component_class%%", + getContentComponentName() }); + tokenReplacements.insert ({ "%%include_juce%%", + getJuceHeaderInclude() }); + + if (shouldCreateHeaderFile (fileOptions)) + tokenReplacements["%%app_headers%%"] << newLine + << CodeHelpers::createIncludeStatement (sourceFolder.getChildFile ("MainComponent.h"), + sourceFolder.getChildFile ("Main.cpp")); + + if (shouldCreateCppFile (fileOptions)) + tokenReplacements.insert ({ "%%include_corresponding_header%%", + CodeHelpers::createIncludeStatement (sourceFolder.getChildFile ("MainComponent.h"), + sourceFolder.getChildFile ("MainComponent.cpp")) }); + + return tokenReplacements; +} + +static std::map getPluginFileTokenReplacements (const String& name, + const File& sourceFolder) +{ + auto tokenReplacements = getSharedFileTokenReplacements(); + + auto processorCppFile = sourceFolder.getChildFile ("PluginProcessor.cpp"); + auto processorHFile = processorCppFile.withFileExtension (".h"); + auto editorCppFile = sourceFolder.getChildFile ("PluginEditor.cpp"); + auto editorHFile = editorCppFile.withFileExtension (".h"); + + auto processorHInclude = CodeHelpers::createIncludeStatement (processorHFile, processorCppFile); + auto editorHInclude = CodeHelpers::createIncludeStatement (editorHFile, processorCppFile); + + auto processorClassName = build_tools::makeValidIdentifier (name, true, true, false) + "AudioProcessor"; + processorClassName = processorClassName.substring (0, 1).toUpperCase() + processorClassName.substring (1); + auto editorClassName = processorClassName + "Editor"; + + tokenReplacements.insert ({"%%filter_headers%%", processorHInclude + newLine + editorHInclude }); + tokenReplacements.insert ({"%%filter_class_name%%", processorClassName }); + tokenReplacements.insert ({"%%editor_class_name%%", editorClassName }); + tokenReplacements.insert ({"%%editor_cpp_headers%%", processorHInclude + newLine + editorHInclude }); + tokenReplacements.insert ({"%%editor_headers%%", getJuceHeaderInclude() + newLine + processorHInclude }); + + return tokenReplacements; +} + +static bool addFiles (Project& project, const NewProjectTemplates::ProjectTemplate& projectTemplate, + const String& name, var fileOptionsVar, StringArray& failedFiles) +{ + auto sourceFolder = project.getFile().getSiblingFile ("Source"); + + if (! sourceFolder.createDirectory()) + { + failedFiles.add (sourceFolder.getFullPathName()); + return false; + } + + auto fileOptions = NewProjectTemplates::getFileOptionForVar (fileOptionsVar); + + if (fileOptions == Opts::noFiles) + return true; + + auto tokenReplacements = [&]() -> std::map + { + if (NewProjectTemplates::isApplication (projectTemplate)) + return getApplicationFileTokenReplacements (name, fileOptions, sourceFolder); + + if (NewProjectTemplates::isPlugin (projectTemplate)) + return getPluginFileTokenReplacements (name, sourceFolder); + + jassertfalse; + return {}; + }(); + + auto sourceGroup = project.getMainGroup().getOrCreateSubGroup ("Source"); + + for (auto& files : projectTemplate.getFilesForOption (fileOptions)) + { + auto file = sourceFolder.getChildFile (files.first); + auto fileContent = getFileTemplate (files.second); + + for (auto& tokenReplacement : tokenReplacements) + fileContent = fileContent.replace (tokenReplacement.first, tokenReplacement.second, false); + + if (! build_tools::overwriteFileWithNewDataIfDifferent (file, fileContent)) + { + failedFiles.add (file.getFullPathName()); + return false; + } + + sourceGroup.addFileAtIndex (file, -1, (file.hasFileExtension (sourceFileExtensions))); + } + + return true; +} + +static void addModules (Project& project, Array modules, const String& modulePath, bool useGlobalPath) +{ + AvailableModulesList list; + list.scanPaths ({ modulePath }); + + for (auto& mod : list.getAllModules()) + if (modules.contains (mod.first)) + project.getEnabledModules().addModule (mod.second, false, useGlobalPath); +} + +static void addExporters (Project& project, Array exporters) +{ + for (auto exporter : exporters) + project.addNewExporter (exporter.toString()); + + for (Project::ExporterIterator exporter (project); exporter.next();) + for (ProjectExporter::ConfigIterator config (*exporter); config.next();) + config->getValue (Ids::targetName) = project.getProjectFilenameRootString(); +} + +//============================================================================== +File NewProjectWizard::getLastWizardFolder() +{ + if (getAppSettings().lastWizardFolder.isDirectory()) + return getAppSettings().lastWizardFolder; + + #if JUCE_WINDOWS + static File lastFolderFallback (File::getSpecialLocation (File::userDocumentsDirectory)); + #else + static File lastFolderFallback (File::getSpecialLocation (File::userHomeDirectory)); + #endif + + return lastFolderFallback; +} + +std::unique_ptr NewProjectWizard::createNewProject (const NewProjectTemplates::ProjectTemplate& projectTemplate, + const File& targetFolder, const String& name, var modules, var exporters, var fileOptions, + const String& modulePath, bool useGlobalModulePath) +{ + StringArray failedFiles; + + if (! targetFolder.exists()) + { + if (! targetFolder.createDirectory()) + failedFiles.add (targetFolder.getFullPathName()); + } + else if (FileHelpers::containsAnyNonHiddenFiles (targetFolder)) + { + if (! AlertWindow::showOkCancelBox (AlertWindow::InfoIcon, + TRANS("New JUCE Project"), + TRANS("You chose the folder:\n\nXFLDRX\n\n").replace ("XFLDRX", targetFolder.getFullPathName()) + + TRANS("This folder isn't empty - are you sure you want to create the project there?") + + "\n\n" + + TRANS("Any existing files with the same names may be overwritten by the new files."))) + { + return nullptr; + } + } + + auto project = std::make_unique (targetFolder.getChildFile (File::createLegalFileName (name)) + .withFileExtension (Project::projectFileExtension)); + + if (failedFiles.isEmpty()) + { + doBasicProjectSetup (*project, projectTemplate, name); + + if (addFiles (*project, projectTemplate, name, fileOptions, failedFiles)) + { + addExporters (*project, *exporters.getArray()); + addModules (*project, *modules.getArray(), modulePath, useGlobalModulePath); + + if (project->save (false, true) == FileBasedDocument::savedOk) + { + project->setChangedFlag (false); + project->loadFrom (project->getFile(), true); + } + else + { + failedFiles.add (project->getFile().getFullPathName()); + } + } + } + + if (! failedFiles.isEmpty()) + { + AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, + TRANS("Errors in Creating Project!"), + TRANS("The following files couldn't be written:") + + "\n\n" + + failedFiles.joinIntoString ("\n", 0, 10)); + return nullptr; + } + + return project; +} diff --git a/extras/Projucer/Source/Wizards/jucer_NewProjectWizardClasses.h b/extras/Projucer/Source/Application/StartPage/jucer_NewProjectWizard.h similarity index 53% rename from extras/Projucer/Source/Wizards/jucer_NewProjectWizardClasses.h rename to extras/Projucer/Source/Application/StartPage/jucer_NewProjectWizard.h index 5edde2c72b..6b3ccedba8 100644 --- a/extras/Projucer/Source/Wizards/jucer_NewProjectWizardClasses.h +++ b/extras/Projucer/Source/Application/StartPage/jucer_NewProjectWizard.h @@ -18,5 +18,14 @@ #pragma once +#include "jucer_NewProjectTemplates.h" -Component* createNewProjectWizardComponent(); +//============================================================================== +namespace NewProjectWizard +{ + File getLastWizardFolder(); + + std::unique_ptr createNewProject (const NewProjectTemplates::ProjectTemplate& projectTemplate, + const File& targetFolder, const String& name, var modules, var exporters, var fileOptions, + const String& modulePath, bool useGlobalModulePath); +} diff --git a/extras/Projucer/Source/Application/StartPage/jucer_StartPageComponent.cpp b/extras/Projucer/Source/Application/StartPage/jucer_StartPageComponent.cpp new file mode 100644 index 0000000000..84b274f8e2 --- /dev/null +++ b/extras/Projucer/Source/Application/StartPage/jucer_StartPageComponent.cpp @@ -0,0 +1,263 @@ +/* + ============================================================================== + + This file is part of the JUCE 6 technical preview. + Copyright (c) 2020 - Raw Material Software Limited + + You may use this code under the terms of the GPL v3 + (see www.gnu.org/licenses). + + For this technical preview, this file is not subject to commercial licensing. + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +#include "../jucer_Headers.h" +#include "../jucer_Application.h" + +#include "jucer_StartPageComponent.h" +#include "jucer_StartPageTreeHolder.h" +#include "jucer_NewProjectTemplates.h" +#include "jucer_ContentComponents.h" + +//============================================================================== +struct ContentComponent : public Component +{ + void resized() override + { + if (content != nullptr) + content->setBounds (getLocalBounds()); + } + + void setContent (std::unique_ptr&& newContent) + { + if (content.get() != newContent.get()) + { + content = std::move (newContent); + addAndMakeVisible (content.get()); + resized(); + } + } + +private: + std::unique_ptr content; + + //============================================================================== + JUCE_LEAK_DETECTOR (ContentComponent) +}; + +//============================================================================== +static File findExampleFile (int dirIndex, int index) +{ + auto dir = ProjucerApplication::getSortedExampleDirectories()[dirIndex]; + return ProjucerApplication::getSortedExampleFilesInDirectory (dir)[index]; +} + +static std::unique_ptr createExampleProjectsTab (ContentComponent& content, std::function cb) +{ + StringArray exampleCategories; + std::vector examples; + + for (auto& dir : ProjucerApplication::getSortedExampleDirectories()) + { + exampleCategories.add (dir.getFileName()); + + StringArray ex; + for (auto& f : ProjucerApplication::getSortedExampleFilesInDirectory (dir)) + ex.add (f.getFileNameWithoutExtension()); + + examples.push_back (ex); + } + + if (exampleCategories.isEmpty()) + return nullptr; + + auto selectedCallback = [&, cb] (int category, int index) mutable + { + content.setContent (std::make_unique (findExampleFile (category, index), cb)); + }; + + return std::make_unique (exampleCategories, + examples, + std::move (selectedCallback), + StartPageTreeHolder::Open::no); +} + +//============================================================================== +static StringArray getAllTemplateCategoryStrings() +{ + StringArray categories; + + for (auto& t : NewProjectTemplates::getAllTemplates()) + categories.addIfNotAlreadyThere (NewProjectTemplates::getProjectCategoryString (t.category)); + + return categories; +} + +static std::vector getTemplatesInCategory (const String& category) +{ + std::vector templates; + + for (auto& t : NewProjectTemplates::getAllTemplates()) + if (NewProjectTemplates::getProjectCategoryString (t.category) == category) + templates.push_back (t); + + return templates; +} + +static StringArray getAllTemplateNamesForCategory (const String& category) +{ + StringArray types; + + for (auto& t : getTemplatesInCategory (category)) + types.add (t.displayName); + + return types; +} + +static std::unique_ptr createProjectTemplatesTab (ContentComponent& content, + std::function&&)>&& cb) +{ + auto categories = getAllTemplateCategoryStrings(); + + std::vector templateNames; + + for (auto& c : categories) + templateNames.push_back (getAllTemplateNamesForCategory (c)); + + auto selectedCallback = [&, cb] (int category, int index) + { + auto categoryString = getAllTemplateCategoryStrings()[category]; + auto templates = getTemplatesInCategory (categoryString); + + content.setContent (std::make_unique (templates[(size_t) index], std::move (cb))); + }; + + auto holder = std::make_unique (categories, + templateNames, + std::move (selectedCallback), + StartPageTreeHolder::Open::yes); + holder->setSelectedItem (categories[0], 1); + + return std::move (holder); +} + +//============================================================================== +struct ProjectTemplatesAndExamples : public TabbedComponent +{ + ProjectTemplatesAndExamples (ContentComponent& c, + std::function&&)>&& newProjectCb, + std::function&& exampleCb) + : TabbedComponent (TabbedButtonBar::Orientation::TabsAtTop), + content (c), + exampleSelectedCallback (std::move (exampleCb)) + { + addTab ("New Project", Colours::transparentBlack, createProjectTemplatesTab (content, std::move (newProjectCb)).release(), true); + refreshExamplesTab(); + } + + void refreshExamplesTab() + { + auto wasOpen = (getCurrentTabIndex() == 1); + + removeTab (1); + + auto exampleTabs = createExampleProjectsTab (content, exampleSelectedCallback); + + addTab ("Open Example", Colours::transparentBlack, exampleTabs == nullptr ? new SetJUCEPathComponent (*this) + : exampleTabs.release(), + true); + + if (wasOpen) + setCurrentTabIndex (1); + } + +private: + //============================================================================== + struct SetJUCEPathComponent : public Component, + private ChangeListener + { + explicit SetJUCEPathComponent (ProjectTemplatesAndExamples& o) + : owner (o) + { + getGlobalProperties().addChangeListener (this); + + setPathButton.setButtonText ("Set path to JUCE..."); + setPathButton.onClick = [] { ProjucerApplication::getApp().showPathsWindow (true); }; + + addAndMakeVisible (setPathButton); + } + + ~SetJUCEPathComponent() override + { + getGlobalProperties().removeChangeListener (this); + } + + void paint (Graphics& g) override + { + g.fillAll (findColour (secondaryBackgroundColourId)); + } + + void resized() override + { + auto bounds = getLocalBounds().reduced (5); + bounds.removeFromTop (25); + + setPathButton.setBounds (bounds.removeFromTop (25)); + } + + private: + void changeListenerCallback (ChangeBroadcaster*) override + { + if (isValidJUCEExamplesDirectory (ProjucerApplication::getJUCEExamplesDirectoryPathFromGlobal())) + owner.refreshExamplesTab(); + } + + ProjectTemplatesAndExamples& owner; + TextButton setPathButton; + }; + + ContentComponent& content; + std::function exampleSelectedCallback; +}; + +//============================================================================== +StartPageComponent::StartPageComponent (std::function&&)>&& newProjectCb, + std::function&& exampleCb) + : content (std::make_unique()), + tabs (std::make_unique (*content, std::move (newProjectCb), std::move (exampleCb))) +{ + tabs->setOutline (0); + addAndMakeVisible (*tabs); + + addAndMakeVisible (openExistingButton); + openExistingButton.setCommandToTrigger (&ProjucerApplication::getCommandManager(), CommandIDs::open, true); + + addAndMakeVisible (*content); + + setSize (900, 600); +} + +void StartPageComponent::paint (Graphics& g) +{ + g.fillAll (findColour (backgroundColourId)); +} + +void StartPageComponent::resized() +{ + auto bounds = getLocalBounds().reduced (10); + + auto tabBounds = bounds.removeFromLeft (bounds.getWidth() / 3); + + openExistingButton.setBounds (tabBounds.removeFromBottom (30).reduced (10, 0)); + tabBounds.removeFromBottom (5); + + tabs->setBounds (tabBounds); + bounds.removeFromLeft (10); + + content->setBounds (bounds); +} diff --git a/extras/Projucer/Source/Wizards/jucer_StartPageComponent.h b/extras/Projucer/Source/Application/StartPage/jucer_StartPageComponent.h similarity index 53% rename from extras/Projucer/Source/Wizards/jucer_StartPageComponent.h rename to extras/Projucer/Source/Application/StartPage/jucer_StartPageComponent.h index 080f5018bf..4961f1b9f7 100644 --- a/extras/Projucer/Source/Wizards/jucer_StartPageComponent.h +++ b/extras/Projucer/Source/Application/StartPage/jucer_StartPageComponent.h @@ -18,35 +18,26 @@ #pragma once +struct ContentComponent; +struct ProjectTemplatesAndExamples; //============================================================================== -class StartPageComponent : public Component +class StartPageComponent : public Component { public: - StartPageComponent() - { - setSize (900, 650); + StartPageComponent (std::function&&)>&& newProjectCb, + std::function&& exampleCb); - WizardComp* projectWizard = new WizardComp(); - - panel.addTab ("Create New Project", new TemplateTileBrowser (projectWizard), true); - panel.addTab ("New Project Options", projectWizard, true); - - addAndMakeVisible (panel); - } - - void paint (Graphics& g) override - { - g.fillAll (findColour (backgroundColourId)); - } - - void resized() override - { - panel.setBounds (getLocalBounds()); - } + void paint (Graphics& g) override; + void resized() override; private: - SlidingPanelComponent panel; + //============================================================================== + std::unique_ptr content; + std::unique_ptr tabs; + + TextButton openExistingButton { "Open Existing Project..." }; + //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StartPageComponent) }; diff --git a/extras/Projucer/Source/Application/StartPage/jucer_StartPageTreeHolder.h b/extras/Projucer/Source/Application/StartPage/jucer_StartPageTreeHolder.h new file mode 100644 index 0000000000..dde9be8a3f --- /dev/null +++ b/extras/Projucer/Source/Application/StartPage/jucer_StartPageTreeHolder.h @@ -0,0 +1,167 @@ +/* + ============================================================================== + + This file is part of the JUCE 6 technical preview. + Copyright (c) 2020 - Raw Material Software Limited + + You may use this code under the terms of the GPL v3 + (see www.gnu.org/licenses). + + For this technical preview, this file is not subject to commercial licensing. + + 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 + +//============================================================================== +class StartPageTreeHolder : public Component +{ +public: + enum class Open { no, yes }; + + StartPageTreeHolder (const StringArray& headerNames, const std::vector& itemNames, + std::function&& selectedCallback, Open shouldBeOpen) + : headers (headerNames), + items (itemNames), + itemSelectedCallback (std::move (selectedCallback)) + { + jassert (headers.size() == (int) items.size()); + + tree.setRootItem (new TreeRootItem (*this)); + tree.setRootItemVisible (false); + tree.setIndentSize (15); + tree.setDefaultOpenness (shouldBeOpen == Open::yes); + + addAndMakeVisible (tree); + } + + ~StartPageTreeHolder() override + { + tree.deleteRootItem(); + } + + void paint (Graphics& g) override + { + g.fillAll (findColour (secondaryBackgroundColourId)); + } + + void resized() override + { + tree.setBounds (getLocalBounds()); + } + + void setSelectedItem (const String& category, int index) + { + auto* root = tree.getRootItem(); + + for (int i = root->getNumSubItems(); --i >=0;) + { + if (auto* item = root->getSubItem (i)) + { + if (item->getUniqueName() == category) + item->getSubItem (index)->setSelected (true, true); + } + } + } + +private: + //============================================================================== + class TreeSubItem : public TreeViewItem + { + public: + TreeSubItem (StartPageTreeHolder& o, const String& n, const StringArray& subItems) + : owner (o), name (n), isHeader (subItems.size() > 0) + { + for (auto& s : subItems) + addSubItem (new TreeSubItem (owner, s, {})); + } + + bool mightContainSubItems() override { return isHeader; } + bool canBeSelected() const override { return ! isHeader; } + + int getItemWidth() const override { return -1; } + int getItemHeight() const override { return 25; } + + String getUniqueName() const override { return name; } + + void paintOpenCloseButton (Graphics& g, const Rectangle& area, Colour, bool isMouseOver) override + { + g.setColour (getOwnerView()->findColour (isSelected() ? defaultHighlightedTextColourId + : treeIconColourId)); + + TreeViewItem::paintOpenCloseButton (g, area, getOwnerView()->findColour (defaultIconColourId), isMouseOver); + } + + void paintItem (Graphics& g, int w, int h) override + { + Rectangle bounds (w, h); + + auto shouldBeHighlighted = isSelected(); + + if (shouldBeHighlighted) + { + g.setColour (getOwnerView()->findColour (defaultHighlightColourId)); + g.fillRect (bounds); + } + + g.setColour (shouldBeHighlighted ? getOwnerView()->findColour (defaultHighlightedTextColourId) + : getOwnerView()->findColour (defaultTextColourId)); + + g.drawFittedText (name, bounds.reduced (5).withTrimmedLeft (10), Justification::centredLeft, 1); + } + + void itemClicked (const MouseEvent&) override + { + if (isSelected()) + itemSelectionChanged (true); + } + + void itemSelectionChanged (bool isNowSelected) override + { + jassert (! isHeader); + + if (isNowSelected) + owner.itemSelectedCallback (getParentItem()->getIndexInParent(), getIndexInParent()); + } + + private: + StartPageTreeHolder& owner; + String name; + bool isHeader = false; + + //============================================================================== + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TreeSubItem) + }; + + struct TreeRootItem : public TreeViewItem + { + explicit TreeRootItem (StartPageTreeHolder& o) + : owner (o) + { + for (int i = 0; i < owner.headers.size(); ++i) + addSubItem (new TreeSubItem (owner, owner.headers[i], owner.items[(size_t) i])); + } + + bool mightContainSubItems() override { return ! owner.headers.isEmpty();} + + StartPageTreeHolder& owner; + + //============================================================================== + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TreeRootItem) + }; + + //============================================================================== + TreeView tree; + StringArray headers; + std::vector items; + + std::function itemSelectedCallback; + + //============================================================================== + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StartPageTreeHolder) +}; diff --git a/extras/Projucer/Source/Application/Windows/jucer_PIPCreatorWindowComponent.h b/extras/Projucer/Source/Application/Windows/jucer_PIPCreatorWindowComponent.h index b7f8c3fe77..c37e17bbb3 100644 --- a/extras/Projucer/Source/Application/Windows/jucer_PIPCreatorWindowComponent.h +++ b/extras/Projucer/Source/Application/Windows/jucer_PIPCreatorWindowComponent.h @@ -140,11 +140,15 @@ private: { Array exporterVars; - for (auto& e : ProjectExporter::getExporterValueTreeNames()) - exporterVars.add (e.toLowerCase()); + StringArray exporterNames; - builder.add (new MultiChoicePropertyComponent (exportersValue, "Exporters", - ProjectExporter::getExporterNames(), exporterVars), + for (auto& exporterTypeInfo : ProjectExporter::getExporterTypeInfos()) + { + exporterVars.add (exporterTypeInfo.identifier.toString()); + exporterNames.add (exporterTypeInfo.displayName); + } + + builder.add (new MultiChoicePropertyComponent (exportersValue, "Exporters", exporterNames, exporterVars), "The exporters that should be added to your project."); } @@ -169,9 +173,9 @@ private: } //============================================================================== - void valueTreePropertyChanged (ValueTree&, const Identifier& id) override + void valueTreePropertyChanged (ValueTree&, const Identifier& identifier) override { - if (id == Ids::type) + if (identifier == Ids::type) { auto type = typeValue.get().toString(); @@ -308,8 +312,7 @@ private: websiteValue { pipTree, Ids::website, nullptr }, descriptionValue { pipTree, Ids::description, nullptr }, dependenciesValue { pipTree, Ids::dependencies_, nullptr, getModulesRequiredForComponent(), "," }, - exportersValue { pipTree, Ids::exporters, nullptr, - StringArray (ProjectExporter::getValueTreeNameForExporter (ProjectExporter::getCurrentPlatformExporterName()).toLowerCase()), "," }, + exportersValue { pipTree, Ids::exporters, nullptr, StringArray (ProjectExporter::getCurrentPlatformExporterTypeInfo().identifier.toString()), "," }, moduleFlagsValue { pipTree, Ids::moduleFlags, nullptr, "JUCE_STRICT_REFCOUNTEDPOINTER=1" }, definesValue { pipTree, Ids::defines, nullptr }, typeValue { pipTree, Ids::type, nullptr, "Component" }, diff --git a/extras/Projucer/Source/Application/jucer_Application.cpp b/extras/Projucer/Source/Application/jucer_Application.cpp index 4e48dfff9e..c07749b5f5 100644 --- a/extras/Projucer/Source/Application/jucer_Application.cpp +++ b/extras/Projucer/Source/Application/jucer_Application.cpp @@ -621,7 +621,7 @@ PopupMenu ProjucerApplication::createExamplesPopupMenu() noexcept #endif //============================================================================== -static File getJUCEExamplesDirectoryPathFromGlobal() +File ProjucerApplication::getJUCEExamplesDirectoryPathFromGlobal() noexcept { auto globalPath = File::createFileWithoutCheckingPath (getAppSettings().getStoredPath (Ids::jucePath, TargetOS::getThisOS()).get().toString() .replace ("~", File::getSpecialLocation (File::userHomeDirectory).getFullPathName())); @@ -659,7 +659,7 @@ Array ProjucerApplication::getSortedExampleDirectories() noexcept return exampleDirectories; } -Array ProjucerApplication::getSortedExampleFilesInDirectory (const File& directory) const noexcept +Array ProjucerApplication::getSortedExampleFilesInDirectory (const File& directory) noexcept { Array exampleFiles; @@ -671,26 +671,6 @@ Array ProjucerApplication::getSortedExampleFilesInDirectory (const File& d return exampleFiles; } -bool ProjucerApplication::findWindowAndOpenPIP (const File& pip) -{ - auto* window = mainWindowList.getFrontmostWindow(); - bool shouldCloseWindow = false; - - if (window == nullptr) - { - window = mainWindowList.getOrCreateEmptyWindow(); - shouldCloseWindow = true; - } - - if (window->tryToOpenPIP (pip)) - return true; - - if (shouldCloseWindow) - mainWindowList.closeWindow (window); - - return false; -} - void ProjucerApplication::findAndLaunchExample (int selectedIndex) { File example; @@ -711,7 +691,7 @@ void ProjucerApplication::findAndLaunchExample (int selectedIndex) // example doesn't exist? jassert (example != File()); - findWindowAndOpenPIP (example); + mainWindowList.openFile (example); } //============================================================================== @@ -731,7 +711,7 @@ static String getPlatformSpecificFileExtension() static File getPlatformSpecificProjectFolder() { - auto examplesDir = getJUCEExamplesDirectoryPathFromGlobal(); + auto examplesDir = ProjucerApplication::getJUCEExamplesDirectoryPathFromGlobal(); if (examplesDir == File()) return {}; @@ -1165,7 +1145,8 @@ void ProjucerApplication::createNewProject() void ProjucerApplication::createNewProjectFromClipboard() { auto tempFile = File::getSpecialLocation (File::SpecialLocationType::tempDirectory).getChildFile ("PIPs").getChildFile ("Clipboard") - .getChildFile ("PIPFile_" + String (std::abs (Random::getSystemRandom().nextInt())) + ".h"); + .getChildFile ("PIPFile_" + String (std::abs (Random::getSystemRandom().nextInt())) + ".h") + .getNonexistentSibling(); if (tempFile.existsAsFile()) tempFile.deleteFile(); @@ -1173,10 +1154,11 @@ void ProjucerApplication::createNewProjectFromClipboard() tempFile.create(); tempFile.appendText (SystemClipboard::getTextFromClipboard()); - if (! findWindowAndOpenPIP (tempFile)) + if (! mainWindowList.openFile (tempFile)) { AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "Error", "Couldn't create project from clipboard contents."); tempFile.deleteFile(); + mainWindowList.closeWindow (mainWindowList.windows.getLast()); } } diff --git a/extras/Projucer/Source/Application/jucer_Application.h b/extras/Projucer/Source/Application/jucer_Application.h index 1bb05ae1ea..5282093836 100644 --- a/extras/Projucer/Source/Application/jucer_Application.h +++ b/extras/Projucer/Source/Application/jucer_Application.h @@ -82,6 +82,10 @@ public: bool shouldPromptUserAboutIncorrectJUCEPath() const; void setShouldPromptUserAboutIncorrectJUCEPath (bool shouldPrompt); + static File getJUCEExamplesDirectoryPathFromGlobal() noexcept; + static Array getSortedExampleDirectories() noexcept; + static Array getSortedExampleFilesInDirectory (const File&) noexcept; + //============================================================================== ProjucerLookAndFeel lookAndFeel; @@ -131,9 +135,6 @@ private: void handleMainMenuCommand (int menuItemID); PopupMenu createExamplesPopupMenu() noexcept; - Array getSortedExampleDirectories() noexcept; - Array getSortedExampleFilesInDirectory (const File&) const noexcept; - bool findWindowAndOpenPIP (const File&); void findAndLaunchExample (int); void checkIfGlobalJUCEPathHasChanged(); diff --git a/extras/Projucer/Source/Application/jucer_MainWindow.cpp b/extras/Projucer/Source/Application/jucer_MainWindow.cpp index 141ffdf0d6..23f01648d6 100644 --- a/extras/Projucer/Source/Application/jucer_MainWindow.cpp +++ b/extras/Projucer/Source/Application/jucer_MainWindow.cpp @@ -19,7 +19,7 @@ #include "../Application/jucer_Headers.h" #include "jucer_Application.h" #include "jucer_MainWindow.h" -#include "../Wizards/jucer_NewProjectWizardClasses.h" +#include "StartPage/jucer_StartPageComponent.h" #include "../Utility/UI/jucer_JucerTreeViewBase.h" #include "../ProjectSaving/jucer_ProjectSaver.h" #include "UserAccount/jucer_LoginFormComponent.h" @@ -177,7 +177,7 @@ void MainWindow::createProjectContentCompIfNeeded() } } -void MainWindow::setTitleBarIcon() +void MainWindow::updateTitleBarIcon() { if (auto* peer = getPeer()) { @@ -198,7 +198,7 @@ void MainWindow::makeVisible() setVisible (true); addToDesktop(); restoreWindowPosition(); - setTitleBarIcon(); + updateTitleBarIcon(); getContentComponent()->grabKeyboardFocus(); } @@ -270,9 +270,7 @@ void MainWindow::setProject (std::unique_ptr newProject) } projectNameValue.referTo (currentProject != nullptr ? currentProject->getProjectValue (Ids::name) : Value()); - - if (auto* peer = getPeer()) - peer->setRepresentedFile (currentProject != nullptr ? currentProject->getFile() : File()); + initialiseProjectWindow(); ProjucerApplication::getCommandManager().commandStatusChanged(); } @@ -299,8 +297,6 @@ bool MainWindow::canOpenFile (const File& file) const bool MainWindow::openFile (const File& file) { - createProjectContentCompIfNeeded(); - if (file.hasFileExtension (Project::projectFileExtension)) { auto newDoc = std::make_unique (file); @@ -311,7 +307,9 @@ bool MainWindow::openFile (const File& file) setProject (std::move (newDoc)); currentProject->setChangedFlag (false); + createProjectContentCompIfNeeded(); getProjectContentComponent()->reloadLastOpenDocuments(); + currentProject->updateDeprecatedProjectSettingsInteractively(); return true; @@ -319,16 +317,18 @@ bool MainWindow::openFile (const File& file) } else if (file.exists()) { + if (isPIPFile (file) && openPIP ({ file })) + return true; + + createProjectContentCompIfNeeded(); return getProjectContentComponent()->showEditorForFile (file, true); } return false; } -bool MainWindow::tryToOpenPIP (const File& pipFile) +bool MainWindow::openPIP (PIPGenerator generator) { - PIPGenerator generator (pipFile); - if (! generator.hasValidPIP()) return false; @@ -343,7 +343,6 @@ bool MainWindow::tryToOpenPIP (const File& pipFile) return false; } - if (! generator.createMainCpp()) { AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, @@ -353,110 +352,43 @@ bool MainWindow::tryToOpenPIP (const File& pipFile) return false; } - if (! ProjucerApplication::getApp().mainWindowList.openFile (generator.getJucerFile())) - return false; - - openPIP (generator); - return true; -} - -static bool isDivider (const String& line) -{ - auto afterIndent = line.trim(); - - if (afterIndent.startsWith ("//") && afterIndent.length() > 20) + if (! openFile (generator.getJucerFile())) { - afterIndent = afterIndent.substring (2); + AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, + "PIP Error.", + "Failed to open .jucer file."); - if (afterIndent.containsOnly ("=") - || afterIndent.containsOnly ("/") - || afterIndent.containsOnly ("-")) - { - return true; - } + return false; } - return false; + setupTemporaryPIPProject (generator); + return true; } -static bool isEndOfCommentBlock (const String& line) +void MainWindow::setupTemporaryPIPProject (PIPGenerator& generator) { - if (line.contains ("*/")) - return true; + jassert (currentProject != nullptr); - return false; -} - -static int getIndexOfCommentBlockStart (const StringArray& lines, int blockEndIndex) -{ - for (int i = blockEndIndex; i >= 0; --i) - { - if (lines[i].contains ("/*")) - return i; - } + currentProject->setTemporaryDirectory (generator.getOutputDirectory()); - return 0; -} + ProjectSaver liveBuildSaver (*currentProject); + liveBuildSaver.saveContentNeededForLiveBuild(); -static int findBestLineToScrollTo (StringArray lines, StringRef className) -{ - for (auto line : lines) + if (auto* pcc = getProjectContentComponent()) { - if (line.contains ("struct " + className) || line.contains ("class " + className)) - { - auto index = lines.indexOf (line); - - if (isDivider (lines[index - 1])) - return index - 1; - - if (isEndOfCommentBlock (lines[index - 1])) - { - auto blockStartIndex = getIndexOfCommentBlockStart (lines, index - 1); - - if (blockStartIndex > 0 && isDivider (lines [blockStartIndex - 1])) - return blockStartIndex - 1; - - return blockStartIndex; - } - - return lines.indexOf (line); - } - } + pcc->invokeDirectly (CommandIDs::toggleBuildEnabled, true); + pcc->invokeDirectly (CommandIDs::buildNow, true); + pcc->invokeDirectly (CommandIDs::toggleContinuousBuild, true); - return 0; -} + auto fileToDisplay = generator.getPIPFile(); -void MainWindow::openPIP (PIPGenerator& generator) -{ - if (auto* window = ProjucerApplication::getApp().mainWindowList.getMainWindowForFile (generator.getJucerFile())) - { - if (auto* project = window->getProject()) + if (fileToDisplay != File()) { - project->setTemporaryDirectory (generator.getOutputDirectory()); - - ProjectSaver liveBuildSaver (*project); - liveBuildSaver.saveContentNeededForLiveBuild(); + pcc->showEditorForFile (fileToDisplay, true); - if (auto* pcc = window->getProjectContentComponent()) - { - pcc->invokeDirectly (CommandIDs::toggleBuildEnabled, true); - pcc->invokeDirectly (CommandIDs::buildNow, true); - pcc->invokeDirectly (CommandIDs::toggleContinuousBuild, true); - - auto fileToDisplay = generator.getPIPFile(); - - if (fileToDisplay != File()) - { - pcc->showEditorForFile (fileToDisplay, true); - - if (auto* sourceCodeEditor = dynamic_cast (pcc->getEditorComponent())) - { - sourceCodeEditor->editor->scrollToLine (findBestLineToScrollTo (StringArray::fromLines (fileToDisplay.loadFileAsString()), - generator.getMainClassName())); - } - } - - } + if (auto* sourceCodeEditor = dynamic_cast (pcc->getEditorComponent())) + sourceCodeEditor->editor->scrollToLine (findBestLineToScrollToForClass (StringArray::fromLines (fileToDisplay.loadFileAsString()), + generator.getMainClassName(), currentProject->getProjectType().isAudioPlugin())); } } } @@ -476,10 +408,7 @@ void MainWindow::filesDropped (const StringArray& filenames, int /*mouseX*/, int { const File f (filename); - if (tryToOpenPIP (f)) - continue; - - if (! isPIPFile (f) && (canOpenFile (f) && openFile (f))) + if (canOpenFile (f) && openFile (f)) break; } } @@ -526,16 +455,26 @@ void MainWindow::activeWindowStatusChanged() ProjucerApplication::getApp().openDocumentManager.reloadModifiedFiles(); } +void MainWindow::initialiseProjectWindow() +{ + setResizable (true, false); + updateTitleBarIcon(); +} + void MainWindow::showStartPage() { jassert (currentProject == nullptr); - setContentOwned (createNewProjectWizardComponent(), true); + setContentOwned (new StartPageComponent ([this] (std::unique_ptr&& newProject) { setProject (std::move (newProject)); }, + [this] (const File& exampleFile) { openFile (exampleFile); }), + true); - centreWithSize (900, 630); - setVisible (true); + setResizable (false, false); + setName ("New Project"); addToDesktop(); + centreWithSize (getContentComponent()->getWidth(), getContentComponent()->getHeight()); + setVisible (true); getContentComponent()->grabKeyboardFocus(); } @@ -710,6 +649,9 @@ void MainWindowList::openDocument (OpenDocumentManager::Document* doc, bool grab bool MainWindowList::openFile (const File& file, bool openInBackground) { + if (! file.exists()) + return false; + for (auto* w : windows) { if (w->getProject() != nullptr && w->getProject()->getFile() == file) @@ -729,6 +671,7 @@ bool MainWindowList::openFile (const File& file, bool openInBackground) if (w->openFile (file)) { w->makeVisible(); + w->setResizable (true, false); checkWindowBounds (*w); if (openInBackground && previousFrontWindow != nullptr) @@ -741,13 +684,7 @@ bool MainWindowList::openFile (const File& file, bool openInBackground) return false; } - if (getFrontmostWindow()->tryToOpenPIP (file)) - return true; - - if (! isPIPFile (file) && file.exists()) - return getFrontmostWindow()->openFile (file); - - return false; + return getFrontmostWindow()->openFile (file); } MainWindow* MainWindowList::createNewMainWindow() diff --git a/extras/Projucer/Source/Application/jucer_MainWindow.h b/extras/Projucer/Source/Application/jucer_MainWindow.h index 3977c7dfbf..54db17a86c 100644 --- a/extras/Projucer/Source/Application/jucer_MainWindow.h +++ b/extras/Projucer/Source/Application/jucer_MainWindow.h @@ -51,10 +51,9 @@ public: void setProject (std::unique_ptr newProject); Project* getProject() const { return currentProject.get(); } - bool tryToOpenPIP (const File& f); - void makeVisible(); void restoreWindowPosition(); + void updateTitleBarIcon(); bool closeCurrentProject (OpenDocumentManager::SaveIfNeeded askToSave); void moveProject (File newProjectFile, OpenInIDE openInIDE); @@ -84,8 +83,11 @@ private: static const char* getProjectWindowPosName() { return "projectWindowPos"; } void createProjectContentCompIfNeeded(); - void setTitleBarIcon(); - void openPIP (PIPGenerator&); + + bool openPIP (PIPGenerator); + void setupTemporaryPIPProject (PIPGenerator&); + + void initialiseProjectWindow(); std::unique_ptr currentProject; Value projectNameValue; diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_AnimatedComponentSimpleTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_AnimatedComponentSimpleTemplate.h index a16d15a974..850c24decd 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_AnimatedComponentSimpleTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_AnimatedComponentSimpleTemplate.h @@ -7,7 +7,7 @@ This component lives inside our window, and this is where you should put all your controls and content. */ -class %%content_component_class%% : public juce::AnimatedAppComponent +class %%content_component_class%% : public juce::AnimatedAppComponent { public: //============================================================================== @@ -19,7 +19,7 @@ public: setFramesPerSecond (60); // This sets the frequency of the update calls. } - ~%%content_component_class%%() + ~%%content_component_class%%() override { } diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_AnimatedComponentTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_AnimatedComponentTemplate.h index a9b4cc33d4..fb2d9b5f52 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_AnimatedComponentTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_AnimatedComponentTemplate.h @@ -7,12 +7,12 @@ This component lives inside our window, and this is where you should put all your controls and content. */ -class %%content_component_class%% : public juce::AnimatedAppComponent +class %%content_component_class%% : public juce::AnimatedAppComponent { public: //============================================================================== %%content_component_class%%(); - ~%%content_component_class%%(); + ~%%content_component_class%%() override; //============================================================================== void update() override; diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_AudioComponentSimpleTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_AudioComponentSimpleTemplate.h index c835bc81ce..690be702a0 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_AudioComponentSimpleTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_AudioComponentSimpleTemplate.h @@ -7,7 +7,7 @@ This component lives inside our window, and this is where you should put all your controls and content. */ -class %%content_component_class%% : public juce::AudioAppComponent +class %%content_component_class%% : public juce::AudioAppComponent { public: //============================================================================== diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_AudioComponentTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_AudioComponentTemplate.h index b8d64cdc44..1d78d85e77 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_AudioComponentTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_AudioComponentTemplate.h @@ -7,7 +7,7 @@ This component lives inside our window, and this is where you should put all your controls and content. */ -class %%content_component_class%% : public juce::AudioAppComponent +class %%content_component_class%% : public juce::AudioAppComponent { public: //============================================================================== diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_AudioPluginEditorTemplate.cpp b/extras/Projucer/Source/BinaryData/Templates/jucer_AudioPluginEditorTemplate.cpp index 3fe504de82..e68c0a7ee3 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_AudioPluginEditorTemplate.cpp +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_AudioPluginEditorTemplate.cpp @@ -10,7 +10,7 @@ //============================================================================== %%editor_class_name%%::%%editor_class_name%% (%%filter_class_name%%& p) - : AudioProcessorEditor (&p), processor (p) + : AudioProcessorEditor (&p), audioProcessor (p) { // Make sure that before the constructor has finished, you've set the // editor's size to whatever you need it to be. diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_AudioPluginEditorTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_AudioPluginEditorTemplate.h index c23f3d8752..7a3f4ef70c 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_AudioPluginEditorTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_AudioPluginEditorTemplate.h @@ -17,7 +17,7 @@ class %%editor_class_name%% : public juce::AudioProcessorEditor { public: %%editor_class_name%% (%%filter_class_name%%&); - ~%%editor_class_name%%(); + ~%%editor_class_name%%() override; //============================================================================== void paint (juce::Graphics&) override; @@ -26,7 +26,7 @@ public: private: // This reference is provided as a quick way for your editor to // access the processor object that created it. - %%filter_class_name%%& processor; + %%filter_class_name%%& audioProcessor; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (%%editor_class_name%%) }; diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_AudioPluginFilterTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_AudioPluginFilterTemplate.h index 7198924ffa..bfc4dc9536 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_AudioPluginFilterTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_AudioPluginFilterTemplate.h @@ -18,7 +18,7 @@ class %%filter_class_name%% : public juce::AudioProcessor public: //============================================================================== %%filter_class_name%%(); - ~%%filter_class_name%%(); + ~%%filter_class_name%%() override; //============================================================================== void prepareToPlay (double sampleRate, int samplesPerBlock) override; diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_ContentCompSimpleTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_ContentCompSimpleTemplate.h index a7514aa114..696efd7bb1 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_ContentCompSimpleTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_ContentCompSimpleTemplate.h @@ -7,7 +7,7 @@ This component lives inside our window, and this is where you should put all your controls and content. */ -class %%content_component_class%% : public juce::Component +class %%content_component_class%% : public juce::Component { public: //============================================================================== @@ -16,7 +16,7 @@ public: setSize (600, 400); } - ~%%content_component_class%%() + ~%%content_component_class%%() override { } diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_ContentCompTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_ContentCompTemplate.h index 732ca2333c..00c56636a6 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_ContentCompTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_ContentCompTemplate.h @@ -7,12 +7,12 @@ This component lives inside our window, and this is where you should put all your controls and content. */ -class %%content_component_class%% : public juce::Component +class %%content_component_class%% : public juce::Component { public: //============================================================================== %%content_component_class%%(); - ~%%content_component_class%%(); + ~%%content_component_class%%() override; //============================================================================== void paint (juce::Graphics&) override; diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_InlineComponentTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_InlineComponentTemplate.h index 9844a3b6bb..51476373d9 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_InlineComponentTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_InlineComponentTemplate.h @@ -1,5 +1,5 @@ //============================================================================== -class %%component_class%% : public juce::Component +class %%component_class%% : public juce::Component { public: %%component_class%%() @@ -9,7 +9,7 @@ public: } - ~%%component_class%%() + ~%%component_class%%() override { } diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_MainTemplate_NoWindow.cpp b/extras/Projucer/Source/BinaryData/Templates/jucer_MainTemplate_NoWindow.cpp index bc8b804101..2deaf61ae0 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_MainTemplate_NoWindow.cpp +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_MainTemplate_NoWindow.cpp @@ -17,7 +17,7 @@ public: const juce::String getApplicationName() override { return ProjectInfo::projectName; } const juce::String getApplicationVersion() override { return ProjectInfo::versionString; } - bool moreThanOneInstanceAllowed() override { return %%allow_more_than_one_instance%%; } + bool moreThanOneInstanceAllowed() override { return true; } //============================================================================== void initialise (const juce::String& commandLine) override diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_MainTemplate_SimpleWindow.cpp b/extras/Projucer/Source/BinaryData/Templates/jucer_MainTemplate_SimpleWindow.cpp deleted file mode 100644 index 8e199ab876..0000000000 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_MainTemplate_SimpleWindow.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - ============================================================================== - - This file contains the basic startup code for a JUCE application. - - ============================================================================== -*/ - -%%app_headers%% - -//============================================================================== -class %%app_class_name%% : public juce::JUCEApplication -{ -public: - //============================================================================== - %%app_class_name%%() {} - - const juce::String getApplicationName() override { return ProjectInfo::projectName; } - const juce::String getApplicationVersion() override { return ProjectInfo::versionString; } - bool moreThanOneInstanceAllowed() override { return %%allow_more_than_one_instance%%; } - - //============================================================================== - void initialise (const juce::String& commandLine) override - { - // This method is where you should put your application's initialisation code.. - - mainWindow.reset (new MainWindow (getApplicationName())); - } - - void shutdown() override - { - // Add your application's shutdown code here.. - - mainWindow = nullptr; // (deletes our window) - } - - //============================================================================== - void systemRequestedQuit() override - { - // This is called when the app is being asked to quit: you can ignore this - // request and let the app carry on running, or call quit() to allow the app to close. - quit(); - } - - void anotherInstanceStarted (const juce::String& commandLine) override - { - // When another instance of the app is launched while this one is running, - // this method is invoked, and the commandLine parameter tells you what - // the other instance's command-line arguments were. - } - - //============================================================================== - /* - This class implements the desktop window that contains an instance of - our %%content_component_class%% class. - */ - class MainWindow : public juce::DocumentWindow - { - public: - MainWindow (juce::String name) - : DocumentWindow (name, - juce::Desktop::getInstance().getDefaultLookAndFeel() - .findColour (juce::ResizableWindow::backgroundColourId), - DocumentWindow::allButtons) - { - setUsingNativeTitleBar (true); - setContentOwned (new %%content_component_class%%(), true); - - #if JUCE_IOS || JUCE_ANDROID - setFullScreen (true); - #else - setResizable (true, true); - centreWithSize (getWidth(), getHeight()); - #endif - - setVisible (true); - } - - void closeButtonPressed() override - { - // This is called when the user tries to close this window. Here, we'll just - // ask the app to quit when this happens, but you can change this to do - // whatever you need. - juce::JUCEApplication::getInstance()->systemRequestedQuit(); - } - - /* Note: Be careful if you override any DocumentWindow methods - the base - class uses a lot of them, so by overriding you might break its functionality. - It's best to do all your work in your content component instead, but if - you really have to override any DocumentWindow methods, make sure your - subclass also calls the superclass's method. - */ - - private: - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow) - }; - -private: - std::unique_ptr mainWindow; -}; - -//============================================================================== -// This macro generates the main() routine that launches the app. -START_JUCE_APPLICATION (%%app_class_name%%) diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_MainTemplate_Window.cpp b/extras/Projucer/Source/BinaryData/Templates/jucer_MainTemplate_Window.cpp index a1d2913f73..f4f2fd6729 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_MainTemplate_Window.cpp +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_MainTemplate_Window.cpp @@ -17,7 +17,7 @@ public: const juce::String getApplicationName() override { return ProjectInfo::projectName; } const juce::String getApplicationVersion() override { return ProjectInfo::versionString; } - bool moreThanOneInstanceAllowed() override { return %%allow_more_than_one_instance%%; } + bool moreThanOneInstanceAllowed() override { return true; } //============================================================================== void initialise (const juce::String& commandLine) override diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_NewComponentTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_NewComponentTemplate.h index a858488f42..d86709b53a 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_NewComponentTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_NewComponentTemplate.h @@ -15,11 +15,11 @@ //============================================================================== /* */ -class %%component_class%% : public juce::Component +class %%component_class%% : public juce::Component { public: %%component_class%%(); - ~%%component_class%%(); + ~%%component_class%%() override; void paint (juce::Graphics&) override; void resized() override; diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_NewInlineComponentTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_NewInlineComponentTemplate.h index b00ad5adb7..b6dc046d17 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_NewInlineComponentTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_NewInlineComponentTemplate.h @@ -15,7 +15,7 @@ //============================================================================== /* */ -class %%component_class%% : public juce::Component +class %%component_class%% : public juce::Component { public: %%component_class%%() @@ -25,7 +25,7 @@ public: } - ~%%component_class%%() + ~%%component_class%%() override { } diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_OpenGLComponentSimpleTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_OpenGLComponentSimpleTemplate.h index 03b37b966d..0c8c4e8f9e 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_OpenGLComponentSimpleTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_OpenGLComponentSimpleTemplate.h @@ -7,7 +7,7 @@ This component lives inside our window, and this is where you should put all your controls and content. */ -class %%content_component_class%% : public juce::OpenGLAppComponent +class %%content_component_class%% : public juce::OpenGLAppComponent { public: //============================================================================== @@ -18,7 +18,7 @@ public: setSize (800, 600); } - ~%%content_component_class%%() + ~%%content_component_class%%() override { // This shuts down the GL system and stops the rendering calls. shutdownOpenGL(); diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_OpenGLComponentTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_OpenGLComponentTemplate.h index 3ed743d915..6686dd5956 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_OpenGLComponentTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_OpenGLComponentTemplate.h @@ -7,12 +7,12 @@ This component lives inside our window, and this is where you should put all your controls and content. */ -class %%content_component_class%% : public juce::OpenGLAppComponent +class %%content_component_class%% : public juce::OpenGLAppComponent { public: //============================================================================== %%content_component_class%%(); - ~%%content_component_class%%(); + ~%%content_component_class%%() override; //============================================================================== void initialise() override; diff --git a/extras/Projucer/Source/BinaryData/Templates/jucer_PIPAudioProcessorTemplate.h b/extras/Projucer/Source/BinaryData/Templates/jucer_PIPAudioProcessorTemplate.h index 4674214d97..ddbc54687e 100644 --- a/extras/Projucer/Source/BinaryData/Templates/jucer_PIPAudioProcessorTemplate.h +++ b/extras/Projucer/Source/BinaryData/Templates/jucer_PIPAudioProcessorTemplate.h @@ -8,7 +8,7 @@ public: { } - ~%%class_name%%() + ~%%class_name%%() override { } diff --git a/extras/Projucer/Source/CodeEditor/jucer_DocumentEditorComponent.h b/extras/Projucer/Source/CodeEditor/jucer_DocumentEditorComponent.h index cc8318a1af..57fa8dbfa1 100644 --- a/extras/Projucer/Source/CodeEditor/jucer_DocumentEditorComponent.h +++ b/extras/Projucer/Source/CodeEditor/jucer_DocumentEditorComponent.h @@ -22,7 +22,7 @@ //============================================================================== class DocumentEditorComponent : public Component, - public OpenDocumentManager::DocumentCloseListener + private OpenDocumentManager::DocumentCloseListener { public: //============================================================================== @@ -31,8 +31,6 @@ public: OpenDocumentManager::Document* getDocument() const { return document; } - bool documentAboutToClose (OpenDocumentManager::Document*) override; - protected: OpenDocumentManager::Document* document; bool lastEditedState = false; @@ -40,5 +38,7 @@ protected: void setEditedState (bool hasBeenEdited); private: + bool documentAboutToClose (OpenDocumentManager::Document*) override; + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DocumentEditorComponent) }; diff --git a/extras/Projucer/Source/ComponentEditor/Components/jucer_GroupComponentHandler.h b/extras/Projucer/Source/ComponentEditor/Components/jucer_GroupComponentHandler.h index dc3bcbc459..997e48bb89 100644 --- a/extras/Projucer/Source/ComponentEditor/Components/jucer_GroupComponentHandler.h +++ b/extras/Projucer/Source/ComponentEditor/Components/jucer_GroupComponentHandler.h @@ -165,7 +165,7 @@ private: //============================================================================== class GroupJustificationProperty : public JustificationProperty, - public ChangeListener + private ChangeListener { public: GroupJustificationProperty (GroupComponent* const group_, JucerDocument& doc) @@ -176,25 +176,25 @@ private: document.addChangeListener (this); } - ~GroupJustificationProperty() + ~GroupJustificationProperty() override { document.removeChangeListener (this); } - void setJustification (Justification newJustification) + void setJustification (Justification newJustification) override { document.perform (new GroupJustifyChangeAction (group, *document.getComponentLayout(), newJustification), "Change text label position"); } - Justification getJustification() const + Justification getJustification() const override { return group->getTextLabelPosition(); } - void changeListenerCallback (ChangeBroadcaster*) { refresh(); } - private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } + GroupComponent* const group; JucerDocument& document; diff --git a/extras/Projucer/Source/ComponentEditor/Components/jucer_ImageButtonHandler.h b/extras/Projucer/Source/ComponentEditor/Components/jucer_ImageButtonHandler.h index a6fe28696f..3db23534f3 100644 --- a/extras/Projucer/Source/ComponentEditor/Components/jucer_ImageButtonHandler.h +++ b/extras/Projucer/Source/ComponentEditor/Components/jucer_ImageButtonHandler.h @@ -457,7 +457,7 @@ public: } class ImageButtonColourProperty : public JucerColourPropertyComponent, - public ChangeListener + private ChangeListener { public: ImageButtonColourProperty (ComponentLayout& layout_, ImageButton* const owner_, @@ -470,29 +470,29 @@ public: layout_.getDocument()->addChangeListener (this); } - ~ImageButtonColourProperty() + ~ImageButtonColourProperty() override { layout.getDocument()->removeChangeListener (this); } - void setColour (Colour newColour) + void setColour (Colour newColour) override { setImageColour (layout, owner, role, newColour, true); } - Colour getColour() const + Colour getColour() const override { return getImageColour (owner, role); } - void resetToDefault() {} + void resetToDefault() override {} - void changeListenerCallback (ChangeBroadcaster*) + private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } - private: ImageButton* const owner; ComponentLayout& layout; const ImageRole role; diff --git a/extras/Projucer/Source/ComponentEditor/Components/jucer_JucerComponentHandler.h b/extras/Projucer/Source/ComponentEditor/Components/jucer_JucerComponentHandler.h index c7ad4500fb..054e851a2f 100644 --- a/extras/Projucer/Source/ComponentEditor/Components/jucer_JucerComponentHandler.h +++ b/extras/Projucer/Source/ComponentEditor/Components/jucer_JucerComponentHandler.h @@ -152,7 +152,7 @@ public: private: //============================================================================== class JucerCompFileProperty : public FilePropertyComponent, - public ChangeListener + private ChangeListener { public: JucerCompFileProperty (TestComponent* const comp, JucerDocument& doc) @@ -163,29 +163,29 @@ private: document.addChangeListener (this); } - ~JucerCompFileProperty() + ~JucerCompFileProperty() override { document.removeChangeListener (this); } - void setFile (const File& newFile) + void setFile (const File& newFile) override { setJucerComponentFile (document, component, newFile.getRelativePathFrom (document.getCppFile().getParentDirectory()) .replaceCharacter ('\\', '/')); } - File getFile() const + File getFile() const override { return component->findFile(); } - void changeListenerCallback (ChangeBroadcaster*) + private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } - private: TestComponent* const component; JucerDocument& document; }; diff --git a/extras/Projucer/Source/ComponentEditor/Components/jucer_LabelHandler.h b/extras/Projucer/Source/ComponentEditor/Components/jucer_LabelHandler.h index 0557a436d1..6304919ef6 100644 --- a/extras/Projucer/Source/ComponentEditor/Components/jucer_LabelHandler.h +++ b/extras/Projucer/Source/ComponentEditor/Components/jucer_LabelHandler.h @@ -368,7 +368,7 @@ private: //============================================================================== class LabelJustificationProperty : public JustificationProperty, - public ChangeListener + private ChangeListener { public: LabelJustificationProperty (Label* const label_, JucerDocument& doc) @@ -379,25 +379,25 @@ private: document.addChangeListener (this); } - ~LabelJustificationProperty() + ~LabelJustificationProperty() override { document.removeChangeListener (this); } - void setJustification (Justification newJustification) + void setJustification (Justification newJustification) override { document.perform (new LabelJustifyChangeAction (label, *document.getComponentLayout(), newJustification), "Change Label justification"); } - Justification getJustification() const + Justification getJustification() const override { return label->getJustificationType(); } - void changeListenerCallback (ChangeBroadcaster*) { refresh(); } - private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } + Label* const label; JucerDocument& document; @@ -433,7 +433,7 @@ private: //============================================================================== class FontNameProperty : public FontPropertyComponent, - public ChangeListener + private ChangeListener { public: FontNameProperty (Label* const label_, JucerDocument& doc) @@ -444,25 +444,25 @@ private: document.addChangeListener (this); } - ~FontNameProperty() + ~FontNameProperty() override { document.removeChangeListener (this); } - void setTypefaceName (const String& newFontName) + void setTypefaceName (const String& newFontName) override { document.perform (new FontNameChangeAction (label, *document.getComponentLayout(), newFontName), "Change Label typeface"); } - String getTypefaceName() const + String getTypefaceName() const override { return label->getProperties().getWithDefault ("typefaceName", FontPropertyComponent::getDefaultFont()); } - void changeListenerCallback (ChangeBroadcaster*) { refresh(); } - private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } + Label* const label; JucerDocument& document; @@ -500,7 +500,7 @@ private: //============================================================================== class FontSizeProperty : public SliderPropertyComponent, - public ChangeListener + private ChangeListener { public: FontSizeProperty (Label* const label_, JucerDocument& doc) @@ -511,12 +511,12 @@ private: document.addChangeListener (this); } - ~FontSizeProperty() + ~FontSizeProperty() override { document.removeChangeListener (this); } - void setValue (double newValue) + void setValue (double newValue) override { document.getUndoManager().undoCurrentTransactionOnly(); @@ -524,14 +524,14 @@ private: "Change Label font size"); } - double getValue() const + double getValue() const override { return label->getFont().getHeight(); } - void changeListenerCallback (ChangeBroadcaster*) { refresh(); } - private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } + Label* const label; JucerDocument& document; @@ -571,7 +571,7 @@ private: //============================================================================== class FontStyleProperty : public ChoicePropertyComponent, - public ChangeListener + private ChangeListener { public: FontStyleProperty (Label* const label_, JucerDocument& doc) @@ -584,7 +584,7 @@ private: updateStylesList (label->getFont()); } - ~FontStyleProperty() + ~FontStyleProperty() override { document.removeChangeListener (this); } @@ -611,7 +611,7 @@ private: refresh(); } - void setIndex (int newIndex) + void setIndex (int newIndex) override { Font f (label->getFont()); @@ -632,7 +632,7 @@ private: "Change Label font style"); } - int getIndex() const + int getIndex() const override { auto f = label->getFont(); @@ -652,12 +652,12 @@ private: return typefaceIndex; } - void changeListenerCallback (ChangeBroadcaster*) + private: + void changeListenerCallback (ChangeBroadcaster*) override { updateStylesList (label->getFont()); } - private: Label* const label; JucerDocument& document; @@ -693,7 +693,7 @@ private: //============================================================================== class FontKerningProperty : public SliderPropertyComponent, - public ChangeListener + private ChangeListener { public: FontKerningProperty (Label* const label_, JucerDocument& doc) @@ -704,12 +704,12 @@ private: document.addChangeListener (this); } - ~FontKerningProperty() + ~FontKerningProperty() override { document.removeChangeListener (this); } - void setValue (double newValue) + void setValue (double newValue) override { document.getUndoManager().undoCurrentTransactionOnly(); @@ -717,17 +717,17 @@ private: "Change Label font kerning"); } - double getValue() const + double getValue() const override { return label->getFont().getExtraKerningFactor(); } - void changeListenerCallback (ChangeBroadcaster*) + private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } - private: Label* const label; JucerDocument& document; diff --git a/extras/Projucer/Source/ComponentEditor/Components/jucer_TabbedComponentHandler.h b/extras/Projucer/Source/ComponentEditor/Components/jucer_TabbedComponentHandler.h index 3006285bb1..3251bd29be 100644 --- a/extras/Projucer/Source/ComponentEditor/Components/jucer_TabbedComponentHandler.h +++ b/extras/Projucer/Source/ComponentEditor/Components/jucer_TabbedComponentHandler.h @@ -523,7 +523,7 @@ private: //============================================================================== class TabDepthProperty : public SliderPropertyComponent, - public ChangeListener + private ChangeListener { public: TabDepthProperty (TabbedComponent* comp, JucerDocument& doc) @@ -534,12 +534,12 @@ private: document.addChangeListener (this); } - ~TabDepthProperty() + ~TabDepthProperty() override { document.removeChangeListener (this); } - void setValue (double newValue) + void setValue (double newValue) override { document.getUndoManager().undoCurrentTransactionOnly(); @@ -547,20 +547,20 @@ private: "Change TabComponent tab depth"); } - double getValue() const + double getValue() const override { return component->getTabBarDepth(); } - void changeListenerCallback (ChangeBroadcaster*) - { - refresh(); - } - TabbedComponent* const component; JucerDocument& document; private: + void changeListenerCallback (ChangeBroadcaster*) override + { + refresh(); + } + class TabDepthChangeAction : public ComponentUndoableAction { public: @@ -917,7 +917,7 @@ private: //============================================================================== class TabJucerFileProperty : public FilePropertyComponent, - public ChangeListener + private ChangeListener { public: TabJucerFileProperty (TabbedComponent* const comp, JucerDocument& doc, const int tabIndex_) @@ -929,13 +929,13 @@ private: document.addChangeListener (this); } - ~TabJucerFileProperty() + ~TabJucerFileProperty() override { document.removeChangeListener (this); } //============================================================================== - void setFile (const File& newFile) + void setFile (const File& newFile) override { document.perform (new JucerCompFileChangeAction (component, *document.getComponentLayout(), tabIndex, newFile.getRelativePathFrom (document.getCppFile().getParentDirectory()) @@ -943,14 +943,14 @@ private: "Change tab component file"); } - File getFile() const + File getFile() const override { return document.getCppFile().getSiblingFile (getTabJucerFile (component, tabIndex)); } - void changeListenerCallback (ChangeBroadcaster*) { refresh(); } - private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } + TabbedComponent* const component; JucerDocument& document; int tabIndex; diff --git a/extras/Projucer/Source/ComponentEditor/Components/jucer_ViewportHandler.h b/extras/Projucer/Source/ComponentEditor/Components/jucer_ViewportHandler.h index 403aad96c7..3a25be9df2 100644 --- a/extras/Projucer/Source/ComponentEditor/Components/jucer_ViewportHandler.h +++ b/extras/Projucer/Source/ComponentEditor/Components/jucer_ViewportHandler.h @@ -351,7 +351,7 @@ private: //============================================================================== class ViewportScrollbarSizeProperty : public SliderPropertyComponent, - public ChangeListener + private ChangeListener { public: ViewportScrollbarSizeProperty (Viewport* comp, JucerDocument& doc) @@ -362,12 +362,12 @@ private: document.addChangeListener (this); } - ~ViewportScrollbarSizeProperty() + ~ViewportScrollbarSizeProperty() override { document.removeChangeListener (this); } - void setValue (double newValue) + void setValue (double newValue) override { document.getUndoManager().undoCurrentTransactionOnly(); @@ -375,12 +375,13 @@ private: "Change Viewport scrollbar size"); } - double getValue() const + double getValue() const override { return component->getScrollBarThickness(); } - void changeListenerCallback (ChangeBroadcaster*) + private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } @@ -477,7 +478,7 @@ private: //============================================================================== class ViewportJucerFileProperty : public FilePropertyComponent, - public ChangeListener + private ChangeListener { public: ViewportJucerFileProperty (Viewport* const comp, JucerDocument& doc) @@ -488,12 +489,12 @@ private: document.addChangeListener (this); } - ~ViewportJucerFileProperty() + ~ViewportJucerFileProperty() override { document.removeChangeListener (this); } - void setFile (const File& newFile) + void setFile (const File& newFile) override { document.perform (new JucerCompFileChangeAction (component, *document.getComponentLayout(), newFile.getRelativePathFrom (document.getCppFile().getParentDirectory()) @@ -501,7 +502,7 @@ private: "Change Projucer component file"); } - File getFile() const + File getFile() const override { auto filename = getViewportJucerComponentFile (component); @@ -511,12 +512,12 @@ private: return document.getCppFile().getSiblingFile (filename); } - void changeListenerCallback (ChangeBroadcaster*) + private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } - private: Viewport* const component; JucerDocument& document; diff --git a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_ElementSiblingComponent.h b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_ElementSiblingComponent.h index f79314485b..ce1af7cbdc 100644 --- a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_ElementSiblingComponent.h +++ b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_ElementSiblingComponent.h @@ -18,7 +18,6 @@ #pragma once - //============================================================================== class ElementSiblingComponent : public Component, public ChangeListener @@ -32,19 +31,18 @@ public: owner->getDocument()->addChangeListener (this); } - ~ElementSiblingComponent() + ~ElementSiblingComponent() override { owner->getDocument()->removeChangeListener (this); } virtual void updatePosition() = 0; - -protected: - void changeListenerCallback (ChangeBroadcaster*) + void changeListenerCallback (ChangeBroadcaster*) override { updatePosition(); } +protected: PaintElement* const owner; }; diff --git a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElement.h b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElement.h index 7f7ae597f7..89d8f00b26 100644 --- a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElement.h +++ b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElement.h @@ -31,8 +31,8 @@ class ElementSiblingComponent; */ class PaintElement : public Component, - public ChangeListener, - public ComponentBoundsConstrainer + public ComponentBoundsConstrainer, + private ChangeListener { public: //============================================================================== @@ -131,7 +131,7 @@ private: //============================================================================== template -class ElementListener : public ChangeListener +class ElementListener : private ChangeListener { public: ElementListener (ElementType* e) @@ -141,7 +141,7 @@ public: broadcaster.addChangeListener (this); } - ~ElementListener() + ~ElementListener() override { jassert (propToRefresh != nullptr); broadcaster.removeChangeListener (this); @@ -152,16 +152,17 @@ public: propToRefresh = &pc; } - void changeListenerCallback (ChangeBroadcaster*) + mutable Component::SafePointer owner; + ChangeBroadcaster& broadcaster; + PropertyComponent* propToRefresh; + +private: + void changeListenerCallback (ChangeBroadcaster*) override { jassert (propToRefresh != nullptr); if (propToRefresh != nullptr && owner != nullptr) propToRefresh->refresh(); } - mutable Component::SafePointer owner; - ChangeBroadcaster& broadcaster; - PropertyComponent* propToRefresh; - JUCE_DECLARE_NON_COPYABLE (ElementListener) }; diff --git a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementPath.cpp b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementPath.cpp index 4725b3afdd..c59b42c4ce 100644 --- a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementPath.cpp +++ b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementPath.cpp @@ -91,7 +91,7 @@ private: //============================================================================== class PathWindingModeProperty : public ChoicePropertyComponent, - public ChangeListener + private ChangeListener { public: explicit PathWindingModeProperty (PaintElementPath* const owner_) @@ -104,17 +104,17 @@ public: owner->getDocument()->addChangeListener (this); } - ~PathWindingModeProperty() + ~PathWindingModeProperty() override { owner->getDocument()->removeChangeListener (this); } - void setIndex (int newIndex) { owner->setNonZeroWinding (newIndex == 0, true); } - int getIndex() const { return owner->isNonZeroWinding() ? 0 : 1; } - - void changeListenerCallback (ChangeBroadcaster*) { refresh(); } + void setIndex (int newIndex) override { owner->setNonZeroWinding (newIndex == 0, true); } + int getIndex() const override { return owner->isNonZeroWinding() ? 0 : 1; } private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } + PaintElementPath* const owner; }; @@ -1174,7 +1174,7 @@ void PaintElementPath::setPoint (int index, int pointNumber, const RelativePosit //============================================================================== class PathPointTypeProperty : public ChoicePropertyComponent, - public ChangeListener + private ChangeListener { public: PathPointTypeProperty (PaintElementPath* const owner_, @@ -1191,12 +1191,12 @@ public: owner->getDocument()->addChangeListener (this); } - ~PathPointTypeProperty() + ~PathPointTypeProperty() override { owner->getDocument()->removeChangeListener (this); } - void setIndex (int newIndex) + void setIndex (int newIndex) override { Path::Iterator::PathElementType type = Path::Iterator::startNewSubPath; @@ -1213,7 +1213,7 @@ public: owner->getPoint (index)->changePointType (type, area, true); } - int getIndex() const + int getIndex() const override { const PathPoint* const p = owner->getPoint (index); jassert (p != nullptr); @@ -1231,12 +1231,12 @@ public: return 0; } - void changeListenerCallback (ChangeBroadcaster*) +private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } -private: PaintElementPath* const owner; const int index; }; diff --git a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementRoundedRectangle.h b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementRoundedRectangle.h index a8ba193b30..d92d2bda5a 100644 --- a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementRoundedRectangle.h +++ b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementRoundedRectangle.h @@ -204,7 +204,7 @@ private: //============================================================================== class CornerSizeProperty : public SliderPropertyComponent, - public ChangeListener + private juce::ChangeListener { public: CornerSizeProperty (PaintElementRoundedRectangle* const owner_) @@ -214,23 +214,23 @@ private: owner->getDocument()->addChangeListener (this); } - ~CornerSizeProperty() + ~CornerSizeProperty() override { owner->getDocument()->removeChangeListener (this); } - void setValue (double newValue) + void setValue (double newValue) override { owner->getDocument()->getUndoManager().undoCurrentTransactionOnly(); owner->setCornerSize (newValue, true); } - double getValue() const { return owner->getCornerSize(); } - - void changeListenerCallback (ChangeBroadcaster*) { refresh(); } + double getValue() const override { return owner->getCornerSize(); } private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } + PaintElementRoundedRectangle* const owner; }; diff --git a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementText.h b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementText.h index c4d30992be..1ed7d96a3c 100644 --- a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementText.h +++ b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementText.h @@ -387,7 +387,7 @@ private: //============================================================================== class TextProperty : public TextPropertyComponent, - public ChangeListener + private juce::ChangeListener { public: TextProperty (PaintElementText* const e) @@ -405,15 +405,15 @@ private: void setText (const String& newText) override { element->setText (newText, true); } String getText() const override { return element->getText(); } + private: void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } - private: PaintElementText* const element; }; //============================================================================== class FontNameProperty : public FontPropertyComponent, - public ChangeListener + private juce::ChangeListener { public: FontNameProperty (PaintElementText* const e) @@ -431,15 +431,15 @@ private: void setTypefaceName (const String& newFontName) { element->setTypefaceName (newFontName, true); } String getTypefaceName() const { return element->getTypefaceName(); } + private: void changeListenerCallback (ChangeBroadcaster*) { refresh(); } - private: PaintElementText* const element; }; //============================================================================== class FontStyleProperty : public ChoicePropertyComponent, - public ChangeListener + private juce::ChangeListener { public: FontStyleProperty (PaintElementText* const e) @@ -518,18 +518,18 @@ private: return typefaceIndex; } + private: void changeListenerCallback (ChangeBroadcaster*) { updateStylesList (element->getTypefaceName()); } - private: PaintElementText* const element; }; //============================================================================== class FontSizeProperty : public SliderPropertyComponent, - public ChangeListener + private juce::ChangeListener { public: FontSizeProperty (PaintElementText* const e) @@ -539,12 +539,12 @@ private: element->getDocument()->addChangeListener (this); } - ~FontSizeProperty() + ~FontSizeProperty() override { element->getDocument()->removeChangeListener (this); } - void setValue (double newValue) + void setValue (double newValue) override { element->getDocument()->getUndoManager().undoCurrentTransactionOnly(); @@ -554,20 +554,20 @@ private: element->setFont (f, true); } - double getValue() const + double getValue() const override { return element->getFont().getHeight(); } - void changeListenerCallback (ChangeBroadcaster*) { refresh(); } - private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } + PaintElementText* const element; }; //============================================================================== class FontKerningProperty : public SliderPropertyComponent, - public ChangeListener + private juce::ChangeListener { public: FontKerningProperty (PaintElementText* const e) @@ -577,12 +577,12 @@ private: element->getDocument()->addChangeListener (this); } - ~FontKerningProperty() + ~FontKerningProperty() override { element->getDocument()->removeChangeListener (this); } - void setValue (double newValue) + void setValue (double newValue) override { element->getDocument()->getUndoManager().undoCurrentTransactionOnly(); @@ -592,23 +592,23 @@ private: element->setFont (f, true); } - double getValue() const + double getValue() const override { return element->getFont().getExtraKerningFactor(); } - void changeListenerCallback (ChangeBroadcaster*) + private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } - private: PaintElementText* const element; }; //============================================================================== class TextJustificationProperty : public JustificationProperty, - public ChangeListener + private juce::ChangeListener { public: TextJustificationProperty (PaintElementText* const e) @@ -618,24 +618,24 @@ private: element->getDocument()->addChangeListener (this); } - ~TextJustificationProperty() + ~TextJustificationProperty() override { element->getDocument()->removeChangeListener (this); } - void setJustification (Justification newJustification) + void setJustification (Justification newJustification) override { element->setJustification (newJustification, true); } - Justification getJustification() const + Justification getJustification() const override { return element->getJustification(); } - void changeListenerCallback (ChangeBroadcaster*) { refresh(); } - private: + void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } + PaintElementText* const element; }; diff --git a/extras/Projucer/Source/ComponentEditor/Properties/jucer_ColourPropertyComponent.h b/extras/Projucer/Source/ComponentEditor/Properties/jucer_ColourPropertyComponent.h index 604fbc9b6b..8962d2d369 100644 --- a/extras/Projucer/Source/ComponentEditor/Properties/jucer_ColourPropertyComponent.h +++ b/extras/Projucer/Source/ComponentEditor/Properties/jucer_ColourPropertyComponent.h @@ -41,7 +41,7 @@ public: } class ColourEditorComponent : public Component, - public ChangeListener + private ChangeListener { public: ColourEditorComponent (const bool canReset) @@ -86,14 +86,6 @@ public: getScreenBounds(), nullptr); } - void changeListenerCallback (ChangeBroadcaster* source) override - { - const ColourSelector* const cs = (const ColourSelector*) source; - - if (cs->getCurrentColour() != getColour()) - setColour (cs->getCurrentColour()); - } - class ColourSelectorComp : public Component { public: @@ -166,6 +158,14 @@ public: }; private: + void changeListenerCallback (ChangeBroadcaster* source) override + { + const ColourSelector* const cs = (const ColourSelector*) source; + + if (cs->getCurrentColour() != getColour()) + setColour (cs->getCurrentColour()); + } + Colour colour; bool canResetToDefault; }; diff --git a/extras/Projucer/Source/ComponentEditor/Properties/jucer_FilePropertyComponent.h b/extras/Projucer/Source/ComponentEditor/Properties/jucer_FilePropertyComponent.h index 8ca0d1a7fd..eb7dccf1de 100644 --- a/extras/Projucer/Source/ComponentEditor/Properties/jucer_FilePropertyComponent.h +++ b/extras/Projucer/Source/ComponentEditor/Properties/jucer_FilePropertyComponent.h @@ -21,7 +21,7 @@ //============================================================================== class FilePropertyComponent : public PropertyComponent, - public FilenameComponentListener + private FilenameComponentListener { public: FilePropertyComponent (const String& name, @@ -40,17 +40,17 @@ public: virtual void setFile (const File& newFile) = 0; virtual File getFile() const = 0; - void refresh() + void refresh() override { filenameComp.setCurrentFile (getFile(), false); } - void filenameComponentChanged (FilenameComponent*) +private: + void filenameComponentChanged (FilenameComponent*) override { if (getFile() != filenameComp.getCurrentFile()) setFile (filenameComp.getCurrentFile()); } -private: FilenameComponent filenameComp; }; diff --git a/extras/Projucer/Source/ComponentEditor/UI/jucer_ComponentLayoutEditor.h b/extras/Projucer/Source/ComponentEditor/UI/jucer_ComponentLayoutEditor.h index cfd0f41eaf..1c8718ed81 100644 --- a/extras/Projucer/Source/ComponentEditor/UI/jucer_ComponentLayoutEditor.h +++ b/extras/Projucer/Source/ComponentEditor/UI/jucer_ComponentLayoutEditor.h @@ -24,10 +24,10 @@ //============================================================================== class ComponentLayoutEditor : public Component, - public ChangeListener, public FileDragAndDropTarget, public DragAndDropTarget, - public LassoSource + public LassoSource, + private ChangeListener { public: //============================================================================== @@ -38,7 +38,6 @@ public: void paint (Graphics&) override; void resized() override; void visibilityChanged() override; - void changeListenerCallback (ChangeBroadcaster*) override; void mouseDown (const MouseEvent&) override; void mouseDrag (const MouseEvent&) override; @@ -68,6 +67,8 @@ public: Image createComponentLayerSnapshot() const; private: + void changeListenerCallback (ChangeBroadcaster*) override; + JucerDocument& document; ComponentLayout& layout; Component* subCompHolder; diff --git a/extras/Projucer/Source/ComponentEditor/UI/jucer_ComponentLayoutPanel.h b/extras/Projucer/Source/ComponentEditor/UI/jucer_ComponentLayoutPanel.h index 78697711b9..559fe1a61d 100644 --- a/extras/Projucer/Source/ComponentEditor/UI/jucer_ComponentLayoutPanel.h +++ b/extras/Projucer/Source/ComponentEditor/UI/jucer_ComponentLayoutPanel.h @@ -58,7 +58,7 @@ public: private: class LayoutPropsPanel : public Component, - public ChangeListener + private ChangeListener { public: LayoutPropsPanel (JucerDocument& doc, ComponentLayout& l) @@ -68,22 +68,17 @@ private: addAndMakeVisible (propsPanel); } - ~LayoutPropsPanel() + ~LayoutPropsPanel() override { layout.getSelectedSet().removeChangeListener (this); clear(); } - void resized() + void resized() override { propsPanel.setBounds (4, 4, getWidth() - 8, getHeight() - 8); } - void changeListenerCallback (ChangeBroadcaster*) - { - updateList(); - } - void clear() { propsPanel.clear(); @@ -104,6 +99,11 @@ private: } private: + void changeListenerCallback (ChangeBroadcaster*) override + { + updateList(); + } + JucerDocument& document; ComponentLayout& layout; PropertyPanel propsPanel; diff --git a/extras/Projucer/Source/ComponentEditor/UI/jucer_ComponentOverlayComponent.h b/extras/Projucer/Source/ComponentEditor/UI/jucer_ComponentOverlayComponent.h index 97a6a56186..e59e00d0c3 100644 --- a/extras/Projucer/Source/ComponentEditor/UI/jucer_ComponentOverlayComponent.h +++ b/extras/Projucer/Source/ComponentEditor/UI/jucer_ComponentOverlayComponent.h @@ -22,9 +22,9 @@ //============================================================================== class ComponentOverlayComponent : public Component, - public ComponentListener, - public ChangeListener, - public ComponentBoundsConstrainer + private ComponentBoundsConstrainer, + private ComponentListener, + private ChangeListener { public: //============================================================================== @@ -44,15 +44,16 @@ public: void mouseDrag (const MouseEvent&) override; void mouseUp (const MouseEvent&) override; - void componentMovedOrResized (Component&, bool wasMoved, bool wasResized) override; + void updateBoundsToMatchTarget(); - void changeListenerCallback (ChangeBroadcaster*) override; + //============================================================================== + Component::SafePointer target; + const int borderThickness; +private: void resizeStart() override; void resizeEnd() override; - void updateBoundsToMatchTarget(); - void checkBounds (Rectangle& bounds, const Rectangle& previousBounds, const Rectangle& limits, @@ -63,11 +64,10 @@ public: void applyBoundsToComponent (Component&, Rectangle) override; - //============================================================================== - Component::SafePointer target; - const int borderThickness; + void componentMovedOrResized (Component&, bool wasMoved, bool wasResized) override; + + void changeListenerCallback (ChangeBroadcaster*) override; -private: std::unique_ptr border; ComponentLayout& layout; diff --git a/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp b/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp index 7bed489ec6..b701fd37f8 100644 --- a/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp +++ b/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp @@ -32,7 +32,7 @@ //============================================================================== class ExtraMethodsList : public PropertyComponent, public ListBoxModel, - public ChangeListener + private ChangeListener { public: ExtraMethodsList (JucerDocument& doc) @@ -112,12 +112,12 @@ public: listBox->repaint(); } +private: void changeListenerCallback (ChangeBroadcaster*) override { refresh(); } -private: JucerDocument& document; std::unique_ptr listBox; diff --git a/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.h b/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.h index f3defb89e1..efc99a2e79 100644 --- a/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.h +++ b/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.h @@ -26,7 +26,7 @@ //============================================================================== class JucerDocumentEditor : public Component, public ApplicationCommandTarget, - public ChangeListener + private ChangeListener { public: //============================================================================== @@ -49,7 +49,6 @@ public: //============================================================================== void paint (Graphics& g) override; void resized() override; - void changeListenerCallback (ChangeBroadcaster*) override; bool keyPressed (const KeyPress&) override; //============================================================================== @@ -61,6 +60,8 @@ public: static JucerDocumentEditor* getActiveDocumentHolder(); private: + void changeListenerCallback (ChangeBroadcaster*) override; + std::unique_ptr document; ComponentLayoutPanel* compLayoutPanel = nullptr; diff --git a/extras/Projucer/Source/ComponentEditor/UI/jucer_PaintRoutineEditor.h b/extras/Projucer/Source/ComponentEditor/UI/jucer_PaintRoutineEditor.h index 8284eaddf1..7468d1dc77 100644 --- a/extras/Projucer/Source/ComponentEditor/UI/jucer_PaintRoutineEditor.h +++ b/extras/Projucer/Source/ComponentEditor/UI/jucer_PaintRoutineEditor.h @@ -25,9 +25,9 @@ class JucerDocumentEditor; //============================================================================== class PaintRoutineEditor : public Component, - public ChangeListener, public LassoSource , - public FileDragAndDropTarget + public FileDragAndDropTarget, + private ChangeListener { public: //============================================================================== diff --git a/extras/Projucer/Source/ComponentEditor/UI/jucer_PaintRoutinePanel.cpp b/extras/Projucer/Source/ComponentEditor/UI/jucer_PaintRoutinePanel.cpp index 078c42a98f..2f56cda2cb 100644 --- a/extras/Projucer/Source/ComponentEditor/UI/jucer_PaintRoutinePanel.cpp +++ b/extras/Projucer/Source/ComponentEditor/UI/jucer_PaintRoutinePanel.cpp @@ -61,7 +61,7 @@ protected: //============================================================================== class GraphicsPropsPanel : public Component, - public ChangeListener + private ChangeListener { public: GraphicsPropsPanel (PaintRoutine& paintRoutine_, @@ -75,7 +75,7 @@ public: addAndMakeVisible (propsPanel = new PropertyPanel()); } - ~GraphicsPropsPanel() + ~GraphicsPropsPanel() override { paintRoutine.getSelectedPoints().removeChangeListener (this); paintRoutine.getSelectedElements().removeChangeListener (this); @@ -84,16 +84,11 @@ public: deleteAllChildren(); } - void resized() + void resized() override { propsPanel->setBounds (4, 4, getWidth() - 8, getHeight() - 8); } - void changeListenerCallback (ChangeBroadcaster*) - { - updateList(); - } - void clear() { propsPanel->clear(); @@ -145,6 +140,11 @@ public: } private: + void changeListenerCallback (ChangeBroadcaster*) override + { + updateList(); + } + PaintRoutine& paintRoutine; JucerDocument* document; diff --git a/extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp b/extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp index 578185183c..04fce1ccc4 100644 --- a/extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp +++ b/extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp @@ -18,7 +18,7 @@ #include "../Application/jucer_Headers.h" #include "../Application/jucer_Application.h" -#include "../Wizards/jucer_NewFileWizard.h" +#include "../Utility/Helpers/jucer_NewFileWizard.h" #include "jucer_JucerDocument.h" #include "jucer_ObjectTypes.h" #include "UI/jucer_JucerDocumentEditor.h" diff --git a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ExporterTreeItems.h b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ExporterTreeItems.h index 4bdf85380e..715d82681e 100644 --- a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ExporterTreeItems.h +++ b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ExporterTreeItems.h @@ -39,7 +39,7 @@ public: bool mightContainSubItems() override { return exporter->getNumConfigurations() > 0; } String getUniqueName() const override { return "exporter_" + String (exporterIndex); } String getRenamingName() const override { return getDisplayName(); } - String getDisplayName() const override { return exporter->getName(); } + String getDisplayName() const override { return exporter->getUniqueName(); } void setName (const String&) override {} bool isMissing() const override { return false; } String getTooltip() override { return getDisplayName(); } @@ -172,7 +172,7 @@ private: struct SettingsComp : public Component { SettingsComp (ProjectExporter& exp) - : group (exp.getName(), + : group (exp.getUniqueName(), ExporterItem::getIconForExporter (&exp), exp.getDescription()) { @@ -269,7 +269,7 @@ private: { public: SettingsComp (ProjectExporter::BuildConfiguration& conf) - : group (conf.exporter.getName() + " - " + conf.getName(), Icon (getIcons().config, Colours::transparentBlack)) + : group (conf.exporter.getUniqueName() + " - " + conf.getName(), Icon (getIcons().config, Colours::transparentBlack)) { addAndMakeVisible (group); diff --git a/extras/Projucer/Source/Project/UI/Sidebar/jucer_FileTreeItems.h b/extras/Projucer/Source/Project/UI/Sidebar/jucer_FileTreeItems.h index 37cad9724c..2945c03b75 100644 --- a/extras/Projucer/Source/Project/UI/Sidebar/jucer_FileTreeItems.h +++ b/extras/Projucer/Source/Project/UI/Sidebar/jucer_FileTreeItems.h @@ -21,7 +21,7 @@ //============================================================================== class FileTreeItemBase : public JucerTreeViewBase, - public ValueTree::Listener + private ValueTree::Listener { public: FileTreeItemBase (const Project::Item& projectItem) @@ -227,17 +227,6 @@ public: return nullptr; } - //============================================================================== - void valueTreePropertyChanged (ValueTree& tree, const Identifier&) override - { - if (tree == item.state) - repaintItem(); - } - - void valueTreeChildAdded (ValueTree& parentTree, ValueTree&) override { treeChildrenChanged (parentTree); } - void valueTreeChildRemoved (ValueTree& parentTree, ValueTree&, int) override { treeChildrenChanged (parentTree); } - void valueTreeChildOrderChanged (ValueTree& parentTree, int, int) override { treeChildrenChanged (parentTree); } - //============================================================================== bool mightContainSubItems() override { return item.getNumChildren() > 0; } String getUniqueName() const override { jassert (item.getID().isNotEmpty()); return item.getID(); } @@ -340,6 +329,17 @@ public: Project::Item item; protected: + //============================================================================== + void valueTreePropertyChanged (ValueTree& tree, const Identifier&) override + { + if (tree == item.state) + repaintItem(); + } + + void valueTreeChildAdded (ValueTree& parentTree, ValueTree&) override { treeChildrenChanged (parentTree); } + void valueTreeChildRemoved (ValueTree& parentTree, ValueTree&, int) override { treeChildrenChanged (parentTree); } + void valueTreeChildOrderChanged (ValueTree& parentTree, int, int) override { treeChildrenChanged (parentTree); } + bool isFileMissing; virtual FileTreeItemBase* createSubItem (const Project::Item& node) = 0; diff --git a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h index 99fe710f27..0ed580f6ab 100644 --- a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h +++ b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ModuleTreeItems.h @@ -158,7 +158,7 @@ private: exporterModulePathValues.add (defaultValue.getPropertyAsValue()); auto pathComponent = std::make_unique (defaultValue, - "Path for " + exporter->getName().quoted(), + "Path for " + exporter->getUniqueName().quoted(), true, exporter->getTargetOSForExporter() == TargetOS::getThisOS(), "*", @@ -168,7 +168,7 @@ private: props.add (pathComponent.release(), "A path to the folder that contains the " + moduleID + " module when compiling the " - + exporter->getName().quoted() + " target. " + + exporter->getUniqueName().quoted() + " target. " "This can be an absolute path, or relative to the jucer project folder, but it " "must be valid on the filesystem of the target machine that will be performing this build. If this " "is empty then the global path will be used."); diff --git a/extras/Projucer/Source/Project/UI/Sidebar/jucer_TreeItemTypes.h b/extras/Projucer/Source/Project/UI/Sidebar/jucer_TreeItemTypes.h index f293a6d6dd..474c4afacd 100644 --- a/extras/Projucer/Source/Project/UI/Sidebar/jucer_TreeItemTypes.h +++ b/extras/Projucer/Source/Project/UI/Sidebar/jucer_TreeItemTypes.h @@ -21,7 +21,7 @@ #include "../../../ProjectSaving/jucer_ProjectExporter.h" #include "../../../Application/Windows/jucer_TranslationToolWindowComponent.h" #include "../../../Utility/UI/jucer_JucerTreeViewBase.h" -#include "../../../Wizards/jucer_NewFileWizard.h" +#include "../../../Utility/Helpers/jucer_NewFileWizard.h" #include "../jucer_ContentViewComponents.h" #include "../jucer_FileGroupInformationComponent.h" #include "../jucer_ModulesInformationComponent.h" diff --git a/extras/Projucer/Source/Project/UI/jucer_HeaderComponent.cpp b/extras/Projucer/Source/Project/UI/jucer_HeaderComponent.cpp index 8d79bcd575..5c41c22e94 100644 --- a/extras/Projucer/Source/Project/UI/jucer_HeaderComponent.cpp +++ b/extras/Projucer/Source/Project/UI/jucer_HeaderComponent.cpp @@ -157,12 +157,14 @@ void HeaderComponent::updateExporters() int i = 0; for (Project::ExporterIterator exporter (*project); exporter.next(); ++i) { - exporterBox.addItem (exporter->getName(), i + 1); + auto exporterName = exporter->getUniqueName(); - if (selectedExporter != nullptr && exporter->getName() == selectedExporter->getName()) + exporterBox.addItem (exporterName, i + 1); + + if (selectedExporter != nullptr && exporterName == selectedExporter->getUniqueName()) exporterBox.setSelectedId (i + 1); - if (exporter->getName().contains (ProjectExporter::getCurrentPlatformExporterName()) && preferredExporterIndex == -1) + if (exporterName.contains (ProjectExporter::getCurrentPlatformExporterTypeInfo().displayName) && preferredExporterIndex == -1) preferredExporterIndex = i; } @@ -209,7 +211,7 @@ bool HeaderComponent::canCurrentExporterLaunchProject() const if (auto selectedExporter = getSelectedExporter()) { for (Project::ExporterIterator exporter (*project); exporter.next();) - if (exporter->canLaunchProject() && exporter->getName() == selectedExporter->getName()) + if (exporter->canLaunchProject() && exporter->getUniqueName() == selectedExporter->getUniqueName()) return true; } } @@ -305,13 +307,13 @@ void HeaderComponent::updateExporterButton() { if (auto selectedExporter = getSelectedExporter()) { - auto selectedName = selectedExporter->getName(); + auto selectedName = selectedExporter->getUniqueName(); - for (auto info : ProjectExporter::getExporterTypes()) + for (auto info : ProjectExporter::getExporterTypeInfos()) { - if (selectedName.contains (info.name)) + if (selectedName.contains (info.displayName)) { - saveAndOpenInIDEButton.setImage (info.getIcon()); + saveAndOpenInIDEButton.setImage (info.icon); saveAndOpenInIDEButton.repaint(); saveAndOpenInIDEButton.setEnabled (canCurrentExporterLaunchProject()); } diff --git a/extras/Projucer/Source/Project/UI/jucer_ModulesInformationComponent.h b/extras/Projucer/Source/Project/UI/jucer_ModulesInformationComponent.h index dccdc5f8bd..1b8a426ae6 100644 --- a/extras/Projucer/Source/Project/UI/jucer_ModulesInformationComponent.h +++ b/extras/Projucer/Source/Project/UI/jucer_ModulesInformationComponent.h @@ -298,7 +298,7 @@ private: modulePathClipboard.clear(); for (Project::ExporterIterator exporter (project); exporter.next();) - modulePathClipboard[exporter->getName()] = exporter->getPathForModuleValue (moduleToCopy).get(); + modulePathClipboard[exporter->getUniqueName()] = exporter->getPathForModuleValue (moduleToCopy).get(); list.repaint(); })); @@ -313,7 +313,7 @@ private: auto modID = project.getEnabledModules().getModuleID (rowNumber); for (Project::ExporterIterator exporter (project); exporter.next();) - exporter->getPathForModuleValue (modID) = modulePathClipboard[exporter->getName()]; + exporter->getPathForModuleValue (modID) = modulePathClipboard[exporter->getUniqueName()]; } list.repaint(); diff --git a/extras/Projucer/Source/Project/UI/jucer_ProjectContentComponent.cpp b/extras/Projucer/Source/Project/UI/jucer_ProjectContentComponent.cpp index d1d4002399..59ca2417ed 100644 --- a/extras/Projucer/Source/Project/UI/jucer_ProjectContentComponent.cpp +++ b/extras/Projucer/Source/Project/UI/jucer_ProjectContentComponent.cpp @@ -570,7 +570,7 @@ void ProjectContentComponent::showProjectSettings() void ProjectContentComponent::showCurrentExporterSettings() { if (auto selected = headerComponent.getSelectedExporter()) - showExporterSettings (selected->getName()); + showExporterSettings (selected->getUniqueName()); } void ProjectContentComponent::showExporterSettings (const String& exporterName) @@ -638,7 +638,7 @@ StringArray ProjectContentComponent::getExportersWhichCanLaunch() const if (project != nullptr) for (Project::ExporterIterator exporter (*project); exporter.next();) if (exporter->canLaunchProject()) - s.add (exporter->getName()); + s.add (exporter->getUniqueName()); return s; } @@ -650,20 +650,6 @@ void ProjectContentComponent::openInSelectedIDE (bool saveFirst) project->openProjectInIDE (*selectedExporter, saveFirst); } -static void newExporterMenuCallback (int result, ProjectContentComponent* comp) -{ - if (comp != nullptr && result > 0) - { - if (auto* p = comp->getProject()) - { - auto exporterName= ProjectExporter::getExporterNames() [result - 1]; - - if (exporterName.isNotEmpty()) - p->addNewExporter (exporterName); - } - } -} - void ProjectContentComponent::showNewExporterMenu() { if (project != nullptr) @@ -672,17 +658,34 @@ void ProjectContentComponent::showNewExporterMenu() menu.addSectionHeader ("Create a new export target:"); - auto exporters = ProjectExporter::getExporterTypes(); + SafePointer safeThis (this); - for (int i = 0; i < exporters.size(); ++i) + for (auto& exporterInfo : ProjectExporter::getExporterTypeInfos()) { - auto& type = exporters.getReference(i); + PopupMenu::Item item; + + item.itemID = -1; + item.text = exporterInfo.displayName; + + item.image = [exporterInfo] + { + auto drawableImage = std::make_unique(); + drawableImage->setImage (exporterInfo.icon); + + return drawableImage; + }(); + + item.action = [safeThis, exporterInfo] + { + if (safeThis != nullptr) + if (auto* p = safeThis->getProject()) + p->addNewExporter (exporterInfo.identifier); + }; - menu.addItem (i + 1, type.name, true, false, type.getIcon()); + menu.addItem (item); } - menu.showMenuAsync (PopupMenu::Options(), - ModalCallbackFunction::forComponent (newExporterMenuCallback, this)); + menu.showMenuAsync ({}); } } diff --git a/extras/Projucer/Source/Project/UI/jucer_ProjectMessagesComponent.h b/extras/Projucer/Source/Project/UI/jucer_ProjectMessagesComponent.h index ddd8158780..d0745963f5 100644 --- a/extras/Projucer/Source/Project/UI/jucer_ProjectMessagesComponent.h +++ b/extras/Projucer/Source/Project/UI/jucer_ProjectMessagesComponent.h @@ -470,7 +470,7 @@ public: private: //============================================================================== struct MessageCountComponent : public Component, - public ValueTree::Listener + private ValueTree::Listener { MessageCountComponent (ProjectMessagesComponent& o, Path pathToUse) : owner (o), @@ -500,15 +500,16 @@ private: updateNumMessages(); } - void valueTreeChildAdded (ValueTree&, ValueTree&) override { updateNumMessages(); } - void valueTreeChildRemoved (ValueTree&, ValueTree&, int) override { updateNumMessages(); } - void updateNumMessages() { numMessages = messagesTree.getNumChildren(); repaint(); } + private: + void valueTreeChildAdded (ValueTree&, ValueTree&) override { updateNumMessages(); } + void valueTreeChildRemoved (ValueTree&, ValueTree&, int) override { updateNumMessages(); } + ProjectMessagesComponent& owner; ValueTree messagesTree; diff --git a/extras/Projucer/Source/Project/jucer_Project.cpp b/extras/Projucer/Source/Project/jucer_Project.cpp index 72c42d19d3..5276933e11 100644 --- a/extras/Projucer/Source/Project/jucer_Project.cpp +++ b/extras/Projucer/Source/Project/jucer_Project.cpp @@ -693,7 +693,7 @@ Result Project::openProjectInIDE (ProjectExporter& exporterToOpen, bool saveFirs { for (ExporterIterator exporter (*this); exporter.next();) { - if (exporter->canLaunchProject() && exporter->getName() == exporterToOpen.getName()) + if (exporter->canLaunchProject() && exporter->getUniqueName() == exporterToOpen.getUniqueName()) { if (isTemporaryProject()) { @@ -2375,18 +2375,18 @@ int Project::getNumExporters() return getExporters().getNumChildren(); } -ProjectExporter* Project::createExporter (int index) +std::unique_ptr Project::createExporter (int index) { jassert (index >= 0 && index < getNumExporters()); - return ProjectExporter::createExporter (*this, getExporters().getChild (index)); + return ProjectExporter::createExporterFromSettings (*this, getExporters().getChild (index)); } -void Project::addNewExporter (const String& exporterName) +void Project::addNewExporter (const Identifier& exporterIdentifier) { - std::unique_ptr exp (ProjectExporter::createNewExporter (*this, exporterName)); + std::unique_ptr exp (ProjectExporter::createNewExporter (*this, exporterIdentifier)); exp->getTargetLocationValue() = exp->getTargetLocationString() - + getUniqueTargetFolderSuffixForExporter (exp->getName(), exp->getTargetLocationString()); + + getUniqueTargetFolderSuffixForExporter (exporterIdentifier, exp->getTargetLocationString()); auto exportersTree = getExporters(); exportersTree.appendChild (exp->settings, getUndoManagerFor (exportersTree)); @@ -2394,21 +2394,20 @@ void Project::addNewExporter (const String& exporterName) void Project::createExporterForCurrentPlatform() { - addNewExporter (ProjectExporter::getCurrentPlatformExporterName()); + addNewExporter (ProjectExporter::getCurrentPlatformExporterTypeInfo().identifier); } -String Project::getUniqueTargetFolderSuffixForExporter (const String& exporterName, const String& base) +String Project::getUniqueTargetFolderSuffixForExporter (const Identifier& exporterIdentifier, const String& base) { StringArray buildFolders; auto exportersTree = getExporters(); - auto type = ProjectExporter::getValueTreeNameForExporter (exporterName); for (int i = 0; i < exportersTree.getNumChildren(); ++i) { auto exporterNode = exportersTree.getChild (i); - if (exporterNode.getType() == Identifier (type)) + if (exporterNode.getType() == exporterIdentifier) buildFolders.add (exporterNode.getProperty ("targetFolder").toString()); } @@ -2430,18 +2429,6 @@ String Project::getUniqueTargetFolderSuffixForExporter (const String& exporterNa } //============================================================================== -String Project::getFileTemplate (const String& templateName) -{ - int dataSize; - - if (auto* data = BinaryData::getNamedResource (templateName.toUTF8(), dataSize)) - return String::fromUTF8 (data, dataSize); - - jassertfalse; - return {}; - -} - StringPairArray Project::getAppConfigDefs() { StringPairArray result; @@ -2598,7 +2585,7 @@ bool Project::ExporterIterator::next() if (++index >= project.getNumExporters()) return false; - exporter.reset (project.createExporter (index)); + exporter = project.createExporter (index); if (exporter == nullptr) { diff --git a/extras/Projucer/Source/Project/jucer_Project.h b/extras/Projucer/Source/Project/jucer_Project.h index f8dce5404f..b8f0203a84 100644 --- a/extras/Projucer/Source/Project/jucer_Project.h +++ b/extras/Projucer/Source/Project/jucer_Project.h @@ -104,7 +104,7 @@ namespace ProjectMessages //============================================================================== class Project : public FileBasedDocument, - public ValueTree::Listener, + private ValueTree::Listener, private LicenseController::LicenseStateListener, private ChangeListener, private AvailableModulesList::Listener @@ -416,8 +416,8 @@ public: //============================================================================== ValueTree getExporters(); int getNumExporters(); - ProjectExporter* createExporter (int index); - void addNewExporter (const String& exporterName); + std::unique_ptr createExporter (int index); + void addNewExporter (const Identifier& exporterIdentifier); void createExporterForCurrentPlatform(); struct ExporterIterator @@ -456,18 +456,9 @@ public: std::pair getModuleWithID (const String&); - //============================================================================== - String getFileTemplate (const String& templateName); - //============================================================================== PropertiesFile& getStoredProperties() const; - //============================================================================== - void valueTreePropertyChanged (ValueTree&, const Identifier&) override; - void valueTreeChildAdded (ValueTree&, ValueTree&) override; - void valueTreeChildRemoved (ValueTree&, ValueTree&, int) override; - void valueTreeChildOrderChanged (ValueTree&, int, int) override; - //============================================================================== UndoManager* getUndoManagerFor (const ValueTree&) const { return nullptr; } UndoManager* getUndoManager() const { return nullptr; } @@ -480,7 +471,7 @@ public: void writeProjectFile(); //============================================================================== - String getUniqueTargetFolderSuffixForExporter (const String& exporterName, const String& baseTargetFolder); + String getUniqueTargetFolderSuffixForExporter (const Identifier& exporterIdentifier, const String& baseTargetFolder); //============================================================================== bool isCurrentlySaving() const noexcept { return isSaving; } @@ -505,6 +496,12 @@ public: bool isSaveAndExportDisabled() const; private: + //============================================================================== + void valueTreePropertyChanged (ValueTree&, const Identifier&) override; + void valueTreeChildAdded (ValueTree&, ValueTree&) override; + void valueTreeChildRemoved (ValueTree&, ValueTree&, int) override; + void valueTreeChildOrderChanged (ValueTree&, int, int) override; + //============================================================================== struct ProjectFileModificationPoller : private Timer { diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h index 1d21ae2014..87c7b1c3d1 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h @@ -63,17 +63,19 @@ public: createOtherExporterProperties (props); } - static const char* getName() { return "Android"; } - static const char* getValueTreeTypeName() { return "ANDROIDSTUDIO"; } - static const char* getDefaultActivityClass() { return "com.rmsl.juce.JuceActivity"; } - static const char* getDefaultApplicationClass() { return "com.rmsl.juce.JuceApp"; } + static String getDisplayName() { return "Android"; } + static String getValueTreeTypeName() { return "ANDROIDSTUDIO"; } + static String getTargetFolderName() { return "Android"; } + + static const char* getDefaultActivityClass() { return "com.rmsl.juce.JuceActivity"; } + static const char* getDefaultApplicationClass() { return "com.rmsl.juce.JuceApp"; } static AndroidProjectExporter* createForSettings (Project& projectToUse, const ValueTree& settingsToUse) { if (settingsToUse.hasType (getValueTreeTypeName())) return new AndroidProjectExporter (projectToUse, settingsToUse); - return nullptr; + return {}; } //============================================================================== @@ -127,9 +129,8 @@ public: androidPluginVersion (settings, Ids::androidPluginVersion, getUndoManager(), "3.5.3"), AndroidExecutable (getAppSettings().getStoredPath (Ids::androidStudioExePath, TargetOS::getThisOS()).get().toString()) { - name = getName(); - - targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderForExporter (getValueTreeTypeName())); + name = getDisplayName(); + targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderName()); } //============================================================================== @@ -1871,13 +1872,3 @@ private: JUCE_DECLARE_NON_COPYABLE (AndroidProjectExporter) }; - -inline ProjectExporter* createAndroidExporter (Project& p, const ValueTree& t) -{ - return new AndroidProjectExporter (p, t); -} - -inline ProjectExporter* createAndroidExporterForSetting (Project& p, const ValueTree& t) -{ - return AndroidProjectExporter::createForSettings (p, t); -} diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h index 68048ff30b..4fed3ddaf5 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CLion.h @@ -46,8 +46,9 @@ protected: public: //============================================================================== - static const char* getName() { return "CLion (beta)"; } - static const char* getValueTreeTypeName() { return "CLION"; } + static String getDisplayName() { return "CLion (beta)"; } + static String getValueTreeTypeName() { return "CLION"; } + static String getTargetFolderName() { return "CLion"; } static CLionProjectExporter* createForSettings (Project& projectToUse, const ValueTree& settingsToUse) { @@ -67,9 +68,8 @@ public: //============================================================================== CLionProjectExporter (Project& p, const ValueTree& t) : ProjectExporter (p, t) { - name = getName(); - - targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderForExporter (getValueTreeTypeName())); + name = getDisplayName(); + targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderName()); } //============================================================================== @@ -98,11 +98,11 @@ public: bool canLaunchProject() override { #if JUCE_MAC - static Identifier exporterName ("XCODE_MAC"); + static Identifier exporterName (XcodeProjectExporter::getValueTreeTypeNameMac()); #elif JUCE_WINDOWS - static Identifier exporterName ("CODEBLOCKS_WINDOWS"); + static Identifier exporterName (CodeBlocksProjectExporter::getValueTreeTypeNameWindows()); #elif JUCE_LINUX - static Identifier exporterName ("LINUX_MAKE"); + static Identifier exporterName (MakefileProjectExporter::getValueTreeTypeName()); #else static Identifier exporterName; #endif @@ -122,19 +122,19 @@ public: { String description; - description << "The " << getName() << " exporter produces a single CMakeLists.txt file with " + description << "The " << getDisplayName() << " exporter produces a single CMakeLists.txt file with " << "multiple platform dependent sections, where the configuration for each section " << "is inherited from other exporters added to this project." << newLine << newLine << "The exporters which provide the CLion configuration for the corresponding platform are:" << newLine << newLine; - for (auto& exporterName : getExporterNames()) + for (auto& exporterInfo : getExporterTypeInfos()) { - std::unique_ptr exporter (createNewExporter (getProject(), exporterName)); + std::unique_ptr exporter (createNewExporter (getProject(), exporterInfo.identifier)); if (isExporterSupported (*exporter)) - description << exporter->getName() << newLine; + description << exporterInfo.displayName << newLine; } description << newLine @@ -151,7 +151,7 @@ public: { for (Project::ExporterIterator exporter (getProject()); exporter.next();) if (isExporterSupported (*exporter)) - properties.add (new BooleanPropertyComponent (getExporterEnabledValue (*exporter), "Import settings from exporter", exporter->getName()), + properties.add (new BooleanPropertyComponent (getExporterEnabledValue (*exporter), "Import settings from exporter", exporter->getUniqueName()), "If this is enabled then settings from the corresponding exporter will " "be used in the generated CMakeLists.txt"); } @@ -195,7 +195,7 @@ public: out.setNewLineString ("\n"); out << "###############################################################################" << newLine - << "# " << exporter->getName() << newLine + << "# " << exporter->getUniqueName() << newLine << "###############################################################################" << newLine << newLine; diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h index 96660a2302..dd3b1432bd 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_CodeBlocks.h @@ -31,39 +31,24 @@ public: }; //============================================================================== - static const char* getNameWindows() noexcept { return "Code::Blocks (Windows)"; } - static const char* getNameLinux() noexcept { return "Code::Blocks (Linux)"; } + static String getDisplayNameWindows() { return "Code::Blocks (Windows)"; } + static String getDisplayNameLinux() { return "Code::Blocks (Linux)"; } - static const char* getName (CodeBlocksOS os) noexcept - { - if (os == windowsTarget) return getNameWindows(); - if (os == linuxTarget) return getNameLinux(); - - // currently no other OSes supported by Codeblocks exporter! - jassertfalse; - return "Code::Blocks (Unknown OS)"; - } + static String getValueTreeTypeNameWindows() { return "CODEBLOCKS_WINDOWS"; } + static String getValueTreeTypeNameLinux() { return "CODEBLOCKS_LINUX"; } - //============================================================================== - static const char* getValueTreeTypeName (CodeBlocksOS os) - { - if (os == windowsTarget) return "CODEBLOCKS_WINDOWS"; - if (os == linuxTarget) return "CODEBLOCKS_LINUX"; - - // currently no other OSes supported by Codeblocks exporter! - jassertfalse; - return "CODEBLOCKS_UNKNOWN_OS"; - } + static String getTargetFolderNameWindows() { return "CodeBlocksWindows"; } + static String getTargetFolderNameLinux() { return "CodeBlocksLinux"; } //============================================================================== static CodeBlocksProjectExporter* createForSettings (Project& projectToUse, const ValueTree& settingsToUse) { // this will also import legacy jucer files where CodeBlocks only worked for Windows, // had valueTreetTypeName "CODEBLOCKS", and there was no OS distinction - if (settingsToUse.hasType (getValueTreeTypeName (windowsTarget)) || settingsToUse.hasType ("CODEBLOCKS")) + if (settingsToUse.hasType (getValueTreeTypeNameWindows()) || settingsToUse.hasType ("CODEBLOCKS")) return new CodeBlocksProjectExporter (projectToUse, settingsToUse, windowsTarget); - if (settingsToUse.hasType (getValueTreeTypeName (linuxTarget))) + if (settingsToUse.hasType (getValueTreeTypeNameLinux())) return new CodeBlocksProjectExporter (projectToUse, settingsToUse, linuxTarget); return nullptr; @@ -73,12 +58,17 @@ public: CodeBlocksProjectExporter (Project& p, const ValueTree& t, CodeBlocksOS codeBlocksOs) : ProjectExporter (p, t), os (codeBlocksOs) { - name = getName (os); - - targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderForExporter (getValueTreeTypeName (os))); - if (isWindows()) + { + name = getDisplayNameWindows(); + targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderNameWindows()); targetPlatformValue.referTo (settings, Ids::codeBlocksWindowsTarget, getUndoManager()); + } + else + { + name = getDisplayNameLinux(); + targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderNameLinux()); + } } //============================================================================== diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h index 6c8bc58d29..d46794be10 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h @@ -1615,16 +1615,18 @@ class MSVCProjectExporterVC2015 : public MSVCProjectExporterBase { public: MSVCProjectExporterVC2015 (Project& p, const ValueTree& t) - : MSVCProjectExporterBase (p, t, getTargetFolderForExporter (getValueTreeTypeName())) + : MSVCProjectExporterBase (p, t, getTargetFolderName()) { - name = getName(); + name = getDisplayName(); targetPlatformVersion.setDefault (getDefaultWindowsTargetPlatformVersion()); platformToolsetValue.setDefault (getDefaultToolset()); } - static const char* getName() { return "Visual Studio 2015"; } - static const char* getValueTreeTypeName() { return "VS2015"; } + static String getDisplayName() { return "Visual Studio 2015"; } + static String getValueTreeTypeName() { return "VS2015"; } + static String getTargetFolderName() { return "VisualStudio2015"; } + int getVisualStudioVersion() const override { return 14; } String getSolutionComment() const override { return "# Visual Studio 2015"; } String getToolsVersion() const override { return "14.0"; } @@ -1660,16 +1662,18 @@ class MSVCProjectExporterVC2017 : public MSVCProjectExporterBase { public: MSVCProjectExporterVC2017 (Project& p, const ValueTree& t) - : MSVCProjectExporterBase (p, t, getTargetFolderForExporter (getValueTreeTypeName())) + : MSVCProjectExporterBase (p, t, getTargetFolderName()) { - name = getName(); + name = getDisplayName(); targetPlatformVersion.setDefault (getDefaultWindowsTargetPlatformVersion()); platformToolsetValue.setDefault (getDefaultToolset()); } - static const char* getName() { return "Visual Studio 2017"; } - static const char* getValueTreeTypeName() { return "VS2017"; } + static String getDisplayName() { return "Visual Studio 2017"; } + static String getValueTreeTypeName() { return "VS2017"; } + static String getTargetFolderName() { return "VisualStudio2017"; } + int getVisualStudioVersion() const override { return 15; } String getSolutionComment() const override { return "# Visual Studio 2017"; } String getToolsVersion() const override { return "15.0"; } @@ -1705,16 +1709,18 @@ class MSVCProjectExporterVC2019 : public MSVCProjectExporterBase { public: MSVCProjectExporterVC2019 (Project& p, const ValueTree& t) - : MSVCProjectExporterBase (p, t, getTargetFolderForExporter (getValueTreeTypeName())) + : MSVCProjectExporterBase (p, t, getTargetFolderName()) { - name = getName(); + name = getDisplayName(); targetPlatformVersion.setDefault (getDefaultWindowsTargetPlatformVersion()); platformToolsetValue.setDefault (getDefaultToolset()); } - static const char* getName() { return "Visual Studio 2019"; } - static const char* getValueTreeTypeName() { return "VS2019"; } + static String getDisplayName() { return "Visual Studio 2019"; } + static String getValueTreeTypeName() { return "VS2019"; } + static String getTargetFolderName() { return "VisualStudio2019"; } + int getVisualStudioVersion() const override { return 16; } String getSolutionComment() const override { return "# Visual Studio 2019"; } String getToolsVersion() const override { return "16.0"; } diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h index 49606e1b35..b6293cdd60 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Make.h @@ -368,8 +368,9 @@ public: }; //============================================================================== - static const char* getNameLinux() { return "Linux Makefile"; } - static const char* getValueTreeTypeName() { return "LINUX_MAKE"; } + static String getDisplayName() { return "Linux Makefile"; } + static String getValueTreeTypeName() { return "LINUX_MAKE"; } + static String getTargetFolderName() { return "LinuxMakefile"; } String getExtraPkgConfigString() const { return extraPkgConfigValue.get(); } @@ -386,9 +387,8 @@ public: : ProjectExporter (p, t), extraPkgConfigValue (settings, Ids::linuxExtraPkgConfig, getUndoManager()) { - name = getNameLinux(); - - targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderForExporter (getValueTreeTypeName())); + name = getDisplayName(); + targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderName()); } //============================================================================== diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h index 8299089f0d..89f1548b4c 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h @@ -69,9 +69,14 @@ class XcodeProjectExporter : public ProjectExporter { public: //============================================================================== - static const char* getNameMac() { return "Xcode (MacOSX)"; } - static const char* getNameiOS() { return "Xcode (iOS)"; } - static const char* getValueTreeTypeName (bool iOS) { return iOS ? "XCODE_IPHONE" : "XCODE_MAC"; } + static String getDisplayNameMac() { return "Xcode (MacOSX)"; } + static String getDisplayNameiOS() { return "Xcode (iOS)"; } + + static String getTargetFolderNameMac() { return "MacOSX"; } + static String getTargetFolderNameiOS() { return "iOS"; } + + static String getValueTreeTypeNameMac() { return "XCODE_MAC"; } + static String getValueTreeTypeNameiOS() { return "XCODE_IPHONE"; } //============================================================================== XcodeProjectExporter (Project& p, const ValueTree& t, const bool isIOS) @@ -129,15 +134,22 @@ public: customLaunchStoryboardValue (settings, Ids::customLaunchStoryboard, getUndoManager()), exporterBundleIdentifierValue (settings, Ids::bundleIdentifier, getUndoManager()) { - name = iOS ? getNameiOS() : getNameMac(); - - targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderForExporter (getValueTreeTypeName (isIOS))); + if (iOS) + { + name = getDisplayNameiOS(); + targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderNameiOS()); + } + else + { + name = getDisplayNameMac(); + targetLocationValue.setDefault (getDefaultBuildsRootFolder() + getTargetFolderNameMac()); + } } static XcodeProjectExporter* createForSettings (Project& projectToUse, const ValueTree& settingsToUse) { - if (settingsToUse.hasType (getValueTreeTypeName (false))) return new XcodeProjectExporter (projectToUse, settingsToUse, false); - if (settingsToUse.hasType (getValueTreeTypeName (true))) return new XcodeProjectExporter (projectToUse, settingsToUse, true); + if (settingsToUse.hasType (getValueTreeTypeNameMac())) return new XcodeProjectExporter (projectToUse, settingsToUse, false); + if (settingsToUse.hasType (getValueTreeTypeNameiOS())) return new XcodeProjectExporter (projectToUse, settingsToUse, true); return nullptr; } diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp index b00431226f..33f658c351 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.cpp @@ -31,202 +31,152 @@ #include "../Utility/UI/PropertyComponents/jucer_FilePathPropertyComponent.h" //============================================================================== -static void addType (Array& list, - const char* name, const void* iconData, int iconDataSize) +std::vector ProjectExporter::getExporterTypeInfos() { - ProjectExporter::ExporterTypeInfo type = { name, iconData, iconDataSize }; - list.add (type); -} - -Array ProjectExporter::getExporterTypes() -{ - Array types; - - addType (types, XcodeProjectExporter::getNameMac(), BinaryData::export_xcode_svg, BinaryData::export_xcode_svgSize); - addType (types, XcodeProjectExporter::getNameiOS(), BinaryData::export_xcode_svg, BinaryData::export_xcode_svgSize); - addType (types, MSVCProjectExporterVC2019::getName(), BinaryData::export_visualStudio_svg, BinaryData::export_visualStudio_svgSize); - addType (types, MSVCProjectExporterVC2017::getName(), BinaryData::export_visualStudio_svg, BinaryData::export_visualStudio_svgSize); - addType (types, MSVCProjectExporterVC2015::getName(), BinaryData::export_visualStudio_svg, BinaryData::export_visualStudio_svgSize); - addType (types, MakefileProjectExporter::getNameLinux(), BinaryData::export_linux_svg, BinaryData::export_linux_svgSize); - addType (types, AndroidProjectExporter::getName(), BinaryData::export_android_svg, BinaryData::export_android_svgSize); - addType (types, CodeBlocksProjectExporter::getNameWindows(), BinaryData::export_codeBlocks_svg, BinaryData::export_codeBlocks_svgSize); - addType (types, CodeBlocksProjectExporter::getNameLinux(), BinaryData::export_codeBlocks_svg, BinaryData::export_codeBlocks_svgSize); - addType (types, CLionProjectExporter::getName(), BinaryData::export_clion_svg, BinaryData::export_clion_svgSize); - - return types; -} - -ProjectExporter* ProjectExporter::createNewExporter (Project& project, const int index) -{ - ProjectExporter* exp = nullptr; - - switch (index) + auto createIcon = [](const void* iconData, size_t iconDataSize) { - case 0: exp = new XcodeProjectExporter (project, ValueTree (XcodeProjectExporter ::getValueTreeTypeName (false)), false); break; - case 1: exp = new XcodeProjectExporter (project, ValueTree (XcodeProjectExporter ::getValueTreeTypeName (true)), true); break; - case 2: exp = new MSVCProjectExporterVC2019 (project, ValueTree (MSVCProjectExporterVC2019 ::getValueTreeTypeName())); break; - case 3: exp = new MSVCProjectExporterVC2017 (project, ValueTree (MSVCProjectExporterVC2017 ::getValueTreeTypeName())); break; - case 4: exp = new MSVCProjectExporterVC2015 (project, ValueTree (MSVCProjectExporterVC2015 ::getValueTreeTypeName())); break; - case 5: exp = new MakefileProjectExporter (project, ValueTree (MakefileProjectExporter ::getValueTreeTypeName())); break; - case 6: exp = new AndroidProjectExporter (project, ValueTree (AndroidProjectExporter ::getValueTreeTypeName())); break; - case 7: exp = new CodeBlocksProjectExporter (project, ValueTree (CodeBlocksProjectExporter ::getValueTreeTypeName (CodeBlocksProjectExporter::windowsTarget)), CodeBlocksProjectExporter::windowsTarget); break; - case 8: exp = new CodeBlocksProjectExporter (project, ValueTree (CodeBlocksProjectExporter ::getValueTreeTypeName (CodeBlocksProjectExporter::linuxTarget)), CodeBlocksProjectExporter::linuxTarget); break; - case 9: exp = new CLionProjectExporter (project, ValueTree (CLionProjectExporter ::getValueTreeTypeName())); break; - default: break; - } - - exp->createDefaultConfigs(); - exp->createDefaultModulePaths(); + Image image (Image::ARGB, 200, 200, true); + Graphics g (image); - return exp; -} + std::unique_ptr svgDrawable (Drawable::createFromImageData (iconData, iconDataSize)); -StringArray ProjectExporter::getExporterNames() -{ - StringArray s; + svgDrawable->drawWithin (g, image.getBounds().toFloat(), RectanglePlacement::fillDestination, 1.0f); - for (auto& e : getExporterTypes()) - s.add (e.name); + return image; + }; - return s; -} + using namespace BinaryData; -StringArray ProjectExporter::getExporterValueTreeNames() -{ - StringArray s; - - for (auto& n : getExporterNames()) - s.add (getValueTreeNameForExporter (n)); + static std::vector infos + { + { XcodeProjectExporter::getValueTreeTypeNameMac(), + XcodeProjectExporter::getDisplayNameMac(), + XcodeProjectExporter::getTargetFolderNameMac(), + createIcon (export_xcode_svg, (size_t) export_xcode_svgSize) }, + { XcodeProjectExporter::getValueTreeTypeNameiOS(), + XcodeProjectExporter::getDisplayNameiOS(), + XcodeProjectExporter::getTargetFolderNameiOS(), + createIcon (export_xcode_svg, (size_t) export_xcode_svgSize) }, + + { MSVCProjectExporterVC2019::getValueTreeTypeName(), + MSVCProjectExporterVC2019::getDisplayName(), + MSVCProjectExporterVC2019::getTargetFolderName(), + createIcon (export_visualStudio_svg, export_visualStudio_svgSize) }, + { MSVCProjectExporterVC2017::getValueTreeTypeName(), + MSVCProjectExporterVC2017::getDisplayName(), + MSVCProjectExporterVC2017::getTargetFolderName(), + createIcon (export_visualStudio_svg, export_visualStudio_svgSize) }, + { MSVCProjectExporterVC2015::getValueTreeTypeName(), + MSVCProjectExporterVC2015::getDisplayName(), + MSVCProjectExporterVC2015::getTargetFolderName(), + createIcon (export_visualStudio_svg, export_visualStudio_svgSize) }, + + { MakefileProjectExporter::getValueTreeTypeName(), + MakefileProjectExporter::getDisplayName(), + MakefileProjectExporter::getTargetFolderName(), + createIcon (export_linux_svg, export_linux_svgSize) }, + + { AndroidProjectExporter::getValueTreeTypeName(), + AndroidProjectExporter::getDisplayName(), + AndroidProjectExporter::getTargetFolderName(), + createIcon (export_android_svg, export_android_svgSize) }, + + { CodeBlocksProjectExporter::getValueTreeTypeNameWindows(), + CodeBlocksProjectExporter::getDisplayNameWindows(), + CodeBlocksProjectExporter::getTargetFolderNameWindows(), + createIcon (export_codeBlocks_svg, export_codeBlocks_svgSize) }, + { CodeBlocksProjectExporter::getValueTreeTypeNameLinux(), + CodeBlocksProjectExporter::getDisplayNameLinux(), + CodeBlocksProjectExporter::getTargetFolderNameLinux(), + createIcon (export_codeBlocks_svg, export_codeBlocks_svgSize) }, + + { CLionProjectExporter::getValueTreeTypeName(), + CLionProjectExporter::getDisplayName(), + CLionProjectExporter::getTargetFolderName(), + createIcon (export_clion_svg, export_clion_svgSize) } + }; - return s; + return infos; } -String ProjectExporter::getValueTreeNameForExporter (const String& exporterName) +ProjectExporter::ExporterTypeInfo ProjectExporter::getTypeInfoForExporter (const Identifier& exporterIdentifier) { - if (exporterName == XcodeProjectExporter::getNameMac()) - return XcodeProjectExporter::getValueTreeTypeName (false); - - if (exporterName == XcodeProjectExporter::getNameiOS()) - return XcodeProjectExporter::getValueTreeTypeName (true); + auto typeInfos = getExporterTypeInfos(); - if (exporterName == MSVCProjectExporterVC2019::getName()) - return MSVCProjectExporterVC2019::getValueTreeTypeName(); - - if (exporterName == MSVCProjectExporterVC2017::getName()) - return MSVCProjectExporterVC2017::getValueTreeTypeName(); - - if (exporterName == MSVCProjectExporterVC2015::getName()) - return MSVCProjectExporterVC2015::getValueTreeTypeName(); - - if (exporterName == MakefileProjectExporter::getNameLinux()) - return MakefileProjectExporter::getValueTreeTypeName(); - - if (exporterName == AndroidProjectExporter::getName()) - return AndroidProjectExporter::getValueTreeTypeName(); - - if (exporterName == CodeBlocksProjectExporter::getNameLinux()) - return CodeBlocksProjectExporter::getValueTreeTypeName (CodeBlocksProjectExporter::CodeBlocksOS::linuxTarget); + auto predicate = [exporterIdentifier] (const ProjectExporter::ExporterTypeInfo& info) + { + return info.identifier == exporterIdentifier; + }; - if (exporterName == CodeBlocksProjectExporter::getNameWindows()) - return CodeBlocksProjectExporter::getValueTreeTypeName (CodeBlocksProjectExporter::CodeBlocksOS::windowsTarget); + auto iter = std::find_if (typeInfos.begin(), typeInfos.end(), + std::move (predicate)); - if (exporterName == CLionProjectExporter::getName()) - return CLionProjectExporter::getValueTreeTypeName(); + if (iter != typeInfos.end()) + return *iter; return {}; } -String ProjectExporter::getTargetFolderForExporter (const String& exporterValueTreeName) +ProjectExporter::ExporterTypeInfo ProjectExporter::getCurrentPlatformExporterTypeInfo() { - if (exporterValueTreeName == "XCODE_MAC") return "MacOSX"; - if (exporterValueTreeName == "XCODE_IPHONE") return "iOS"; - if (exporterValueTreeName == "VS2019") return "VisualStudio2019"; - if (exporterValueTreeName == "VS2017") return "VisualStudio2017"; - if (exporterValueTreeName == "VS2015") return "VisualStudio2015"; - if (exporterValueTreeName == "LINUX_MAKE") return "LinuxMakefile"; - if (exporterValueTreeName == "ANDROIDSTUDIO") return "Android"; - if (exporterValueTreeName == "CODEBLOCKS_WINDOWS") return "CodeBlocksWindows"; - if (exporterValueTreeName == "CODEBLOCKS_LINUX") return "CodeBlocksLinux"; - if (exporterValueTreeName == "CLION") return "CLion"; - - return {}; + #if JUCE_MAC + return ProjectExporter::getTypeInfoForExporter (XcodeProjectExporter::getValueTreeTypeNameMac()); + #elif JUCE_WINDOWS + return ProjectExporter::getTypeInfoForExporter (MSVCProjectExporterVC2019::getValueTreeTypeName()); + #elif JUCE_LINUX + return ProjectExporter::getTypeInfoForExporter (MakefileProjectExporter::getValueTreeTypeName()); + #else + #error "unknown platform!" + #endif } -StringArray ProjectExporter::getAllDefaultBuildsFolders() +std::unique_ptr ProjectExporter::createNewExporter (Project& project, const Identifier& exporterIdentifier) { - StringArray folders; + auto exporter = createExporterFromSettings (project, ValueTree (exporterIdentifier)); + jassert (exporter != nullptr); - folders.add (getDefaultBuildsRootFolder() + "iOS"); - folders.add (getDefaultBuildsRootFolder() + "MacOSX"); - folders.add (getDefaultBuildsRootFolder() + "VisualStudio2019"); - folders.add (getDefaultBuildsRootFolder() + "VisualStudio2017"); - folders.add (getDefaultBuildsRootFolder() + "VisualStudio2015"); - folders.add (getDefaultBuildsRootFolder() + "LinuxMakefile"); - folders.add (getDefaultBuildsRootFolder() + "CodeBlocksWindows"); - folders.add (getDefaultBuildsRootFolder() + "CodeBlocksLinux"); - folders.add (getDefaultBuildsRootFolder() + "Android"); - folders.add (getDefaultBuildsRootFolder() + "CLion"); + exporter->createDefaultConfigs(); + exporter->createDefaultModulePaths(); - return folders; + return exporter; } -String ProjectExporter::getCurrentPlatformExporterName() +std::unique_ptr ProjectExporter::createExporterFromSettings (Project& project, const ValueTree& settings) { - #if JUCE_MAC - return XcodeProjectExporter::getNameMac(); - #elif JUCE_WINDOWS - return MSVCProjectExporterVC2019::getName(); - #elif JUCE_LINUX - return MakefileProjectExporter::getNameLinux(); - #else - #error // huh? - #endif -} + std::unique_ptr exporter; -ProjectExporter* ProjectExporter::createNewExporter (Project& project, const String& name) -{ - return createNewExporter (project, getExporterNames().indexOf (name)); -} - -ProjectExporter* ProjectExporter::createExporter (Project& project, const ValueTree& settings) -{ - ProjectExporter* exp = MSVCProjectExporterVC2019 ::createForSettings (project, settings); - if (exp == nullptr) exp = MSVCProjectExporterVC2017 ::createForSettings (project, settings); - if (exp == nullptr) exp = MSVCProjectExporterVC2015 ::createForSettings (project, settings); - if (exp == nullptr) exp = XcodeProjectExporter ::createForSettings (project, settings); - if (exp == nullptr) exp = MakefileProjectExporter ::createForSettings (project, settings); - if (exp == nullptr) exp = AndroidProjectExporter ::createForSettings (project, settings); - if (exp == nullptr) exp = CodeBlocksProjectExporter ::createForSettings (project, settings); - if (exp == nullptr) exp = CLionProjectExporter ::createForSettings (project, settings); + exporter.reset (XcodeProjectExporter::createForSettings (project, settings)); + if (exporter == nullptr) exporter.reset (MSVCProjectExporterVC2019::createForSettings (project, settings)); + if (exporter == nullptr) exporter.reset (MSVCProjectExporterVC2017::createForSettings (project, settings)); + if (exporter == nullptr) exporter.reset (MSVCProjectExporterVC2015::createForSettings (project, settings)); + if (exporter == nullptr) exporter.reset (MakefileProjectExporter::createForSettings (project, settings)); + if (exporter == nullptr) exporter.reset (AndroidProjectExporter::createForSettings (project, settings)); + if (exporter == nullptr) exporter.reset (CodeBlocksProjectExporter::createForSettings (project, settings)); + if (exporter == nullptr) exporter.reset (CLionProjectExporter::createForSettings (project, settings)); - jassert (exp != nullptr); - return exp; + jassert (exporter != nullptr); + return exporter; } bool ProjectExporter::canProjectBeLaunched (Project* project) { if (project != nullptr) { - const char* types[] = + static Identifier types[] { - #if JUCE_MAC - XcodeProjectExporter::getValueTreeTypeName (false), - XcodeProjectExporter::getValueTreeTypeName (true), - #elif JUCE_WINDOWS - MSVCProjectExporterVC2019::getValueTreeTypeName(), - MSVCProjectExporterVC2017::getValueTreeTypeName(), - MSVCProjectExporterVC2015::getValueTreeTypeName(), - #elif JUCE_LINUX - // (this doesn't currently launch.. not really sure what it would do on linux) - //MakefileProjectExporter::getValueTreeTypeName(), - #endif - AndroidProjectExporter::getValueTreeTypeName(), - - nullptr + #if JUCE_MAC + XcodeProjectExporter::getValueTreeTypeNameMac(), + XcodeProjectExporter::getValueTreeTypeNameiOS(), + #elif JUCE_WINDOWS + MSVCProjectExporterVC2019::getValueTreeTypeName(), + MSVCProjectExporterVC2017::getValueTreeTypeName(), + MSVCProjectExporterVC2015::getValueTreeTypeName(), + #endif + AndroidProjectExporter::getValueTreeTypeName() }; - for (const char** type = types; *type != nullptr; ++type) - if (project->getExporters().getChildWithName (*type).isValid()) + for (auto& exporterIdentifier : types) + if (project->getExporters().getChildWithName (exporterIdentifier).isValid()) return true; } @@ -255,14 +205,23 @@ ProjectExporter::ProjectExporter (Project& p, const ValueTree& state) updateCompilerFlagValues(); } -ProjectExporter::~ProjectExporter() +String ProjectExporter::getUniqueName() const { -} + auto targetLocationString = getTargetLocationString(); + auto defaultBuildsRootFolder = getDefaultBuildsRootFolder(); -String ProjectExporter::getName() const -{ - if (! getAllDefaultBuildsFolders().contains (getTargetLocationString())) - return name + " - " + getTargetLocationString(); + auto typeInfos = getExporterTypeInfos(); + + auto predicate = [targetLocationString, defaultBuildsRootFolder] (const ProjectExporter::ExporterTypeInfo& info) + { + return defaultBuildsRootFolder + info.targetFolder == targetLocationString; + }; + + auto iter = std::find_if (typeInfos.begin(), typeInfos.end(), + std::move (predicate)); + + if (iter == typeInfos.end()) + return name + " - " + targetLocationString; return name; } @@ -302,7 +261,7 @@ void ProjectExporter::createPropertyEditors (PropertyListBuilder& props) if ((shouldBuildTargetType (build_tools::ProjectType::Target::VSTPlugIn) && project.shouldBuildVST()) || (project.isVSTPluginHost() && supportsTargetType (build_tools::ProjectType::Target::VSTPlugIn))) { - props.add (new FilePathPropertyComponent (vstLegacyPathValueWrapper.wrappedValue, "VST (Legacy) SDK Folder", true, + props.add (new FilePathPropertyComponent (vstLegacyPathValueWrapper.getWrappedValueWithDefault(), "VST (Legacy) SDK Folder", true, getTargetOSForExporter() == TargetOS::getThisOS(), "*", project.getProjectFolder()), "If you're building a VST plug-in or host, you can use this field to override the global VST (Legacy) SDK path with a project-specific path. " "This can be an absolute path, or a path relative to the Projucer project file."); @@ -310,14 +269,14 @@ void ProjectExporter::createPropertyEditors (PropertyListBuilder& props) if (shouldBuildTargetType (build_tools::ProjectType::Target::AAXPlugIn) && project.shouldBuildAAX()) { - props.add (new FilePathPropertyComponent (aaxPathValueWrapper.wrappedValue, "AAX SDK Folder", true, + props.add (new FilePathPropertyComponent (aaxPathValueWrapper.getWrappedValueWithDefault(), "AAX SDK Folder", true, getTargetOSForExporter() == TargetOS::getThisOS(), "*", project.getProjectFolder()), "If you're building an AAX plug-in, this must be the folder containing the AAX SDK. This can be an absolute path, or a path relative to the Projucer project file."); } if (shouldBuildTargetType (build_tools::ProjectType::Target::RTASPlugIn) && project.shouldBuildRTAS()) { - props.add (new FilePathPropertyComponent (rtasPathValueWrapper.wrappedValue, "RTAS SDK Folder", true, + props.add (new FilePathPropertyComponent (rtasPathValueWrapper.getWrappedValueWithDefault(), "RTAS SDK Folder", true, getTargetOSForExporter() == TargetOS::getThisOS(), "*", project.getProjectFolder()), "If you're building an RTAS plug-in, this must be the folder containing the RTAS SDK. This can be an absolute path, or a path relative to the Projucer project file."); } diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h index fe9d786be1..4bdef75559 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExporter.h @@ -20,6 +20,8 @@ #include "../Project/jucer_Project.h" #include "../Utility/UI/PropertyComponents/jucer_PropertyComponentsWithEnablement.h" +#include "../Utility/Helpers/jucer_ValueWithDefaultWrapper.h" +#include "../Project/Modules/jucer_Modules.h" class ProjectSaver; @@ -28,40 +30,26 @@ class ProjectExporter : private Value::Listener { public: ProjectExporter (Project&, const ValueTree& settings); - virtual ~ProjectExporter() override; + virtual ~ProjectExporter() override = default; + //============================================================================== struct ExporterTypeInfo { - String name; - const void* iconData; - int iconDataSize; - - Image getIcon() const - { - Image image (Image::ARGB, 200, 200, true); - Graphics g (image); - - std::unique_ptr svgDrawable (Drawable::createFromImageData (iconData, (size_t) iconDataSize)); - - svgDrawable->drawWithin (g, image.getBounds().toFloat(), RectanglePlacement::fillDestination, 1.0f); + Identifier identifier; + String displayName; + String targetFolder; - return image; - } + Image icon; }; - static StringArray getExporterNames(); - static StringArray getExporterValueTreeNames(); - static Array getExporterTypes(); - static String getValueTreeNameForExporter (const String& exporterName); - static String getTargetFolderForExporter (const String& exporterValueTreeName); - static StringArray getAllDefaultBuildsFolders(); + static std::vector getExporterTypeInfos(); + static ExporterTypeInfo getTypeInfoForExporter (const Identifier& exporterIdentifier); + static ExporterTypeInfo getCurrentPlatformExporterTypeInfo(); - static ProjectExporter* createNewExporter (Project&, const int index); - static ProjectExporter* createNewExporter (Project&, const String& name); - static ProjectExporter* createExporter (Project&, const ValueTree& settings); - static bool canProjectBeLaunched (Project*); + static std::unique_ptr createNewExporter (Project&, const Identifier& exporterIdentifier); + static std::unique_ptr createExporterFromSettings (Project&, const ValueTree& settings); - static String getCurrentPlatformExporterName(); + static bool canProjectBeLaunched (Project*); //============================================================================== // capabilities of exporter @@ -125,7 +113,7 @@ public: } //============================================================================== - String getName() const; + String getUniqueName() const; File getTargetFolder() const; Project& getProject() noexcept { return project; } @@ -146,9 +134,9 @@ public: bool shouldUseGNUExtensions() const { return gnuExtensionsValue.get(); } - String getVSTLegacyPathString() const { return vstLegacyPathValueWrapper.wrappedValue.get(); } - String getAAXPathString() const { return aaxPathValueWrapper.wrappedValue.get(); } - String getRTASPathString() const { return rtasPathValueWrapper.wrappedValue.get(); } + String getVSTLegacyPathString() const { return vstLegacyPathValueWrapper.getCurrentValue(); } + String getAAXPathString() const { return aaxPathValueWrapper.getCurrentValue(); } + String getRTASPathString() const { return rtasPathValueWrapper.getCurrentValue(); } // NB: this is the path to the parent "modules" folder that contains the named module, not the // module folder itself. @@ -355,36 +343,6 @@ protected: const File projectFolder; //============================================================================== - // Wraps a ValueWithDefault object that has a default which depends on a global value. - // Used for the VST, RTAS and AAX project-specific path options. - struct ValueWithDefaultWrapper : public Value::Listener - { - void init (const ValueWithDefault& vwd, ValueWithDefault global, TargetOS::OS targetOS) - { - wrappedValue = vwd; - globalValue = global.getPropertyAsValue(); - globalIdentifier = global.getPropertyID(); - os = targetOS; - - if (wrappedValue.get() == var()) - wrappedValue.resetToDefault(); - - globalValue.addListener (this); - valueChanged (globalValue); - } - - void valueChanged (Value&) override - { - wrappedValue.setDefault (getAppSettings().getStoredPath (globalIdentifier, os).get()); - } - - ValueWithDefault wrappedValue; - Value globalValue; - - Identifier globalIdentifier; - TargetOS::OS os; - }; - ValueWithDefaultWrapper vstLegacyPathValueWrapper, rtasPathValueWrapper, aaxPathValueWrapper; ValueWithDefault targetLocationValue, extraCompilerFlagsValue, extraLinkerFlagsValue, externalLibrariesValue, diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp b/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp index c37d0ed479..75228b76c6 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp @@ -697,7 +697,7 @@ void ProjectSaver::writeProjects (const OwnedArray& modules, Proj { for (Project::ExporterIterator exp (project); exp.next();) { - if (specifiedExporterToSave != nullptr && exp->getName() != specifiedExporterToSave->getName()) + if (specifiedExporterToSave != nullptr && exp->getUniqueName() != specifiedExporterToSave->getUniqueName()) continue; exporters.push_back (std::move (exp.exporter)); @@ -754,7 +754,7 @@ void ProjectSaver::writeProjects (const OwnedArray& modules, Proj for (auto& exporter : exporters) clionExporter->writeCMakeListsExporterSection (exporter.get()); - std::cout << "Finished saving: " << clionExporter->getName() << std::endl; + std::cout << "Finished saving: " << clionExporter->getUniqueName() << std::endl; } } @@ -806,7 +806,7 @@ void ProjectSaver::saveExporter (ProjectExporter& exporter, const OwnedArray 20) + { + afterIndent = afterIndent.substring (5); + + if (afterIndent.containsOnly ("=") + || afterIndent.containsOnly ("/") + || afterIndent.containsOnly ("-")) + { + return true; + } + } + + return false; +} + +int getIndexOfCommentBlockStart (const StringArray& lines, int endIndex) +{ + auto endLine = lines[endIndex]; + + if (endLine.contains ("*/")) + { + for (int i = endIndex; i >= 0; --i) + if (lines[i].contains ("/*")) + return i; + } + + if (endLine.trim().startsWith ("//") && ! isDivider (endLine)) + { + for (int i = endIndex; i >= 0; --i) + if (! lines[i].startsWith ("//") || isDivider (lines[i])) + return i + 1; + } + + return -1; +} + +int findBestLineToScrollToForClass (StringArray lines, StringRef className, bool isPlugin) +{ + for (auto line : lines) + { + if (line.contains ("struct " + className) || line.contains ("class " + className) + || (isPlugin && line.contains ("public AudioProcessor") && ! line.contains ("AudioProcessorEditor"))) + { + auto index = lines.indexOf (line); + + auto commentBlockStartIndex = getIndexOfCommentBlockStart (lines, index - 1); + + if (commentBlockStartIndex != -1) + index = commentBlockStartIndex; + + if (isDivider (lines[index - 1])) + index -= 1; + + return index; + } + } + + return 0; +} + +//============================================================================== +var parseJUCEHeaderMetadata (const StringArray& lines) { auto* o = new DynamicObject(); var result (o); @@ -373,7 +438,7 @@ static var parseJUCEHeaderMetadata (const StringArray& lines) return result; } -static String parseMetadataItem (const StringArray& lines, int& index) +String parseMetadataItem (const StringArray& lines, int& index) { String result = lines[index++]; diff --git a/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.h b/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.h index 6e047f6d4b..f201e5e6f2 100644 --- a/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.h +++ b/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.h @@ -55,6 +55,7 @@ StringArray getModulesRequiredForComponent() noexcept; StringArray getModulesRequiredForAudioProcessor() noexcept; bool isPIPFile (const File&) noexcept; +int findBestLineToScrollToForClass (StringArray, StringRef, bool isPlugin = false); bool isValidJUCEExamplesDirectory (const File&) noexcept; @@ -105,7 +106,7 @@ struct PropertyListBuilder // A ValueSource which takes an input source, and forwards any changes in it. // This class is a handy way to create sources which re-map a value. class ValueSourceFilter : public Value::ValueSource, - public Value::Listener + private Value::Listener { public: ValueSourceFilter (const Value& source) : sourceValue (source) @@ -113,10 +114,11 @@ public: sourceValue.addListener (this); } - void valueChanged (Value&) override { sendChangeMessage (true); } - protected: Value sourceValue; +private: + void valueChanged (Value&) override { sendChangeMessage (true); } + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ValueSourceFilter) }; diff --git a/extras/Projucer/Source/Wizards/jucer_NewFileWizard.cpp b/extras/Projucer/Source/Utility/Helpers/jucer_NewFileWizard.cpp similarity index 88% rename from extras/Projucer/Source/Wizards/jucer_NewFileWizard.cpp rename to extras/Projucer/Source/Utility/Helpers/jucer_NewFileWizard.cpp index 609a945112..2ed8ea8a57 100644 --- a/extras/Projucer/Source/Wizards/jucer_NewFileWizard.cpp +++ b/extras/Projucer/Source/Utility/Helpers/jucer_NewFileWizard.cpp @@ -16,7 +16,7 @@ ============================================================================== */ -#include "../Application/jucer_Headers.h" +#include "../../Application/jucer_Headers.h" #include "jucer_NewFileWizard.h" //============================================================================== @@ -24,12 +24,21 @@ namespace { static String fillInBasicTemplateFields (const File& file, const Project::Item& item, const char* templateName) { - return replaceLineFeeds (item.project.getFileTemplate (templateName) - .replace ("%%filename%%", file.getFileName(), false) - .replace ("%%date%%", Time::getCurrentTime().toString (true, true, true), false) - .replace ("%%author%%", SystemStats::getFullUserName(), false) - .replace ("%%include_corresponding_header%%", CodeHelpers::createIncludeStatement (file.withFileExtension (".h"), file)), - item.project.getProjectLineFeed()); + int dataSize; + + if (auto* data = BinaryData::getNamedResource (templateName, dataSize)) + { + auto fileTemplate = String::fromUTF8 (data, dataSize); + + return replaceLineFeeds (fileTemplate.replace ("%%filename%%", file.getFileName(), false) + .replace ("%%date%%", Time::getCurrentTime().toString (true, true, true), false) + .replace ("%%author%%", SystemStats::getFullUserName(), false) + .replace ("%%include_corresponding_header%%", CodeHelpers::createIncludeStatement (file.withFileExtension (".h"), file)), + item.project.getProjectLineFeed()); + } + + jassertfalse; + return {}; } static bool fillInNewCppFileTemplate (const File& file, const Project::Item& item, const char* templateName) diff --git a/extras/Projucer/Source/Wizards/jucer_NewFileWizard.h b/extras/Projucer/Source/Utility/Helpers/jucer_NewFileWizard.h similarity index 95% rename from extras/Projucer/Source/Wizards/jucer_NewFileWizard.h rename to extras/Projucer/Source/Utility/Helpers/jucer_NewFileWizard.h index 0b7cd93b10..2211f2e4e1 100644 --- a/extras/Projucer/Source/Wizards/jucer_NewFileWizard.h +++ b/extras/Projucer/Source/Utility/Helpers/jucer_NewFileWizard.h @@ -18,7 +18,7 @@ #pragma once -#include "../Project/jucer_Project.h" +#include "../../Project/jucer_Project.h" //============================================================================== class NewFileWizard diff --git a/extras/Projucer/Source/Utility/Helpers/jucer_ValueWithDefaultWrapper.h b/extras/Projucer/Source/Utility/Helpers/jucer_ValueWithDefaultWrapper.h new file mode 100644 index 0000000000..4b91889094 --- /dev/null +++ b/extras/Projucer/Source/Utility/Helpers/jucer_ValueWithDefaultWrapper.h @@ -0,0 +1,66 @@ +/* + ============================================================================== + + This file is part of the JUCE 6 technical preview. + Copyright (c) 2020 - Raw Material Software Limited + + You may use this code under the terms of the GPL v3 + (see www.gnu.org/licenses). + + For this technical preview, this file is not subject to commercial licensing. + + 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 + + +//============================================================================== +/** + Wraps a ValueWithDefault object that has a default which depends on a global value. +*/ +class ValueWithDefaultWrapper : private Value::Listener +{ +public: + ValueWithDefaultWrapper() = default; + + void init (const ValueWithDefault& vwd, ValueWithDefault global, TargetOS::OS targetOS) + { + wrappedValue = vwd; + globalValue = global.getPropertyAsValue(); + globalIdentifier = global.getPropertyID(); + os = targetOS; + + if (wrappedValue.get() == var()) + wrappedValue.resetToDefault(); + + globalValue.addListener (this); + valueChanged (globalValue); + } + + ValueWithDefault& getWrappedValueWithDefault() + { + return wrappedValue; + } + + var getCurrentValue() const + { + return wrappedValue.get(); + } + +private: + void valueChanged (Value&) override + { + wrappedValue.setDefault (getAppSettings().getStoredPath (globalIdentifier, os).get()); + } + + ValueWithDefault wrappedValue; + Value globalValue; + + Identifier globalIdentifier; + TargetOS::OS os; +}; diff --git a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp index 43c6f5d96d..8271e59513 100644 --- a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp +++ b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp @@ -18,6 +18,8 @@ #include "../../Application/jucer_Headers.h" #include "../../ProjectSaving/jucer_ProjectExporter.h" +#include "../../ProjectSaving/jucer_ProjectExport_Xcode.h" +#include "../../ProjectSaving/jucer_ProjectExport_Android.h" #include "jucer_PIPGenerator.h" //============================================================================== @@ -67,15 +69,16 @@ static bool isJUCEExample (const File& pipFile) return false; } -static bool isValidExporterName (StringRef exporterName) +static bool isValidExporterIdentifier (const Identifier& exporterIdentifier) { - return ProjectExporter::getExporterValueTreeNames().contains (exporterName, true); + return ProjectExporter::getTypeInfoForExporter (exporterIdentifier).identifier.toString().isNotEmpty(); } -static bool exporterRequiresExampleAssets (const String& exporterName, const String& projectName) +static bool exporterRequiresExampleAssets (const Identifier& exporterIdentifier, const String& projectName) { - return (exporterName == "XCODE_IPHONE" || exporterName == "ANDROIDSTUDIO") - || (exporterName == "XCODE_MAC" && projectName == "AUv3SynthPlugin"); + return (exporterIdentifier.toString() == XcodeProjectExporter::getValueTreeTypeNameiOS() + || exporterIdentifier.toString() == AndroidProjectExporter::getValueTreeTypeName()) + || (exporterIdentifier.toString() == XcodeProjectExporter::getValueTreeTypeNameMac() && projectName == "AUv3SynthPlugin"); } //============================================================================== @@ -99,7 +102,7 @@ PIPGenerator::PIPGenerator (const File& pip, const File& output, const File& juc auto isClipboard = (pip.getParentDirectory().getFileName() == "Clipboard" && pip.getParentDirectory().getParentDirectory().getFileName() == "PIPs"); - outputDirectory = outputDirectory.getChildFile (metadata[Ids::name].toString()); + outputDirectory = outputDirectory.getChildFile (metadata[Ids::name].toString()).getNonexistentSibling(); useLocalCopy = metadata[Ids::useLocalCopy].toString().trim().getIntValue() == 1 || isClipboard; if (userModulesPath != File()) @@ -225,13 +228,13 @@ ValueTree PIPGenerator::createBuildConfigChild (bool isDebug) return child; } -ValueTree PIPGenerator::createExporterChild (const String& exporterName) +ValueTree PIPGenerator::createExporterChild (const Identifier& exporterIdentifier) { - ValueTree exporter (exporterName); + ValueTree exporter (exporterIdentifier); - exporter.setProperty (Ids::targetFolder, "Builds/" + ProjectExporter::getTargetFolderForExporter (exporterName), nullptr); + exporter.setProperty (Ids::targetFolder, "Builds/" + ProjectExporter::getTypeInfoForExporter (exporterIdentifier).targetFolder, nullptr); - if (isJUCEExample (pipFile) && exporterRequiresExampleAssets (exporterName, metadata[Ids::name])) + if (isJUCEExample (pipFile) && exporterRequiresExampleAssets (exporterIdentifier, metadata[Ids::name])) { auto examplesDir = getExamplesDirectory(); @@ -239,8 +242,8 @@ ValueTree PIPGenerator::createExporterChild (const String& exporterName) { auto assetsDirectoryPath = examplesDir.getChildFile ("Assets").getFullPathName(); - exporter.setProperty (exporterName == "ANDROIDSTUDIO" ? Ids::androidExtraAssetsFolder - : Ids::customXcodeResourceFolders, + exporter.setProperty (exporterIdentifier.toString() == AndroidProjectExporter::getValueTreeTypeName() ? Ids::androidExtraAssetsFolder + : Ids::customXcodeResourceFolders, assetsDirectoryPath, nullptr); } else @@ -295,7 +298,7 @@ void PIPGenerator::addExporters (ValueTree& jucerTree) { e = e.trim().toUpperCase(); - if (isValidExporterName (e)) + if (isValidExporterIdentifier (e)) exportersTree.addChild (createExporterChild (e), -1, nullptr); } @@ -366,15 +369,15 @@ Result PIPGenerator::setProjectSettings (ValueTree& jucerTree) if (type == "Console") { - jucerTree.setProperty (Ids::projectType, "consoleapp", nullptr); + jucerTree.setProperty (Ids::projectType, build_tools::ProjectType_ConsoleApp::getTypeName(), nullptr); } else if (type == "Component") { - jucerTree.setProperty (Ids::projectType, "guiapp", nullptr); + jucerTree.setProperty (Ids::projectType, build_tools::ProjectType_GUIApp::getTypeName(), nullptr); } else if (type == "AudioProcessor") { - jucerTree.setProperty (Ids::projectType, "audioplug", nullptr); + jucerTree.setProperty (Ids::projectType, build_tools::ProjectType_AudioPlugin::getTypeName(), nullptr); jucerTree.setProperty (Ids::pluginAUIsSandboxSafe, "1", nullptr); setPropertyIfNotEmpty (Ids::pluginManufacturer, metadata[Ids::vendor]); diff --git a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h index 9c44fe5788..42bf2938da 100644 --- a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h +++ b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h @@ -30,8 +30,8 @@ public: //============================================================================== bool hasValidPIP() const noexcept { return ! metadata[Ids::name].toString().isEmpty(); } - File getJucerFile() noexcept { return outputDirectory.getChildFile (metadata[Ids::name].toString() + ".jucer"); } - File getPIPFile() noexcept { return useLocalCopy ? outputDirectory.getChildFile ("Source").getChildFile (pipFile.getFileName()) : pipFile; } + File getJucerFile() const noexcept { return outputDirectory.getChildFile (metadata[Ids::name].toString() + ".jucer"); } + File getPIPFile() const noexcept { return useLocalCopy ? outputDirectory.getChildFile ("Source").getChildFile (pipFile.getFileName()) : pipFile; } String getMainClassName() const noexcept { return metadata[Ids::mainClass]; } @@ -48,7 +48,7 @@ private: ValueTree createModulePathChild (const String& moduleID); ValueTree createBuildConfigChild (bool isDebug); - ValueTree createExporterChild (const String& exporterName); + ValueTree createExporterChild (const Identifier& exporterIdentifier); ValueTree createModuleChild (const String& moduleID); void addExporters (ValueTree& jucerTree); diff --git a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_ColourPropertyComponent.h b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_ColourPropertyComponent.h index fda43e13e1..e3d2279eb1 100644 --- a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_ColourPropertyComponent.h +++ b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_ColourPropertyComponent.h @@ -43,7 +43,7 @@ private: a colour selector when you click it. */ struct ColourEditorComponent : public Component, - public Value::Listener + private Value::Listener { ColourEditorComponent (UndoManager* um, const Value& colour, Colour defaultCol, const bool canReset) @@ -115,6 +115,7 @@ private: getScreenBounds(), nullptr); } + private: void valueChanged (Value&) override { refresh(); @@ -131,8 +132,8 @@ private: //============================================================================== struct PopupColourSelector : public Component, - public ChangeListener, - public Value::Listener + private ChangeListener, + private Value::Listener { PopupColourSelector (const Value& colour, Colour defaultCol, @@ -193,6 +194,7 @@ private: } } + private: void changeListenerCallback (ChangeBroadcaster*) override { if (selector.getCurrentColour() != getColour()) @@ -204,7 +206,6 @@ private: selector.setCurrentColour (getColour()); } - private: StoredSettings::ColourSelectorWithSwatches selector; TextButton defaultButton; Value colourValue; diff --git a/extras/Projucer/Source/Wizards/jucer_NewProjectWizard.h b/extras/Projucer/Source/Wizards/jucer_NewProjectWizard.h deleted file mode 100644 index 97c859d0c9..0000000000 --- a/extras/Projucer/Source/Wizards/jucer_NewProjectWizard.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE 6 technical preview. - Copyright (c) 2020 - Raw Material Software Limited - - You may use this code under the terms of the GPL v3 - (see www.gnu.org/licenses). - - For this technical preview, this file is not subject to commercial licensing. - - 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 "../Utility/Helpers/jucer_PresetIDs.h" - -//============================================================================== -static void setExecutableNameForAllTargets (Project& project, const String& exeName) -{ - for (Project::ExporterIterator exporter (project); exporter.next();) - for (ProjectExporter::ConfigIterator config (*exporter); config.next();) - config->getValue (Ids::targetName) = exeName; -} - -static Project::Item createSourceGroup (Project& project) -{ - return project.getMainGroup().addNewSubGroup ("Source", 0); -} - -static File& getLastWizardFolder() -{ - if (getAppSettings().lastWizardFolder.isDirectory()) - return getAppSettings().lastWizardFolder; - - #if JUCE_WINDOWS - static File lastFolderFallback (File::getSpecialLocation (File::userDocumentsDirectory)); - #else - static File lastFolderFallback (File::getSpecialLocation (File::userHomeDirectory)); - #endif - - return lastFolderFallback; -} - -//============================================================================== -struct NewProjectWizard -{ - NewProjectWizard() {} - virtual ~NewProjectWizard() {} - - //============================================================================== - virtual String getName() const = 0; - virtual String getDescription() const = 0; - virtual const char* getIcon() const = 0; - - virtual StringArray getFileCreationOptions() { return {}; } - virtual Result processResultsFromSetupItems (WizardComp&) { return Result::ok(); } - - virtual bool initialiseProject (Project& project) = 0; - - virtual StringArray getDefaultModules() - { - return - { - "juce_audio_basics", - "juce_audio_devices", - "juce_audio_formats", - "juce_audio_processors", - "juce_core", - "juce_cryptography", - "juce_data_structures", - "juce_events", - "juce_graphics", - "juce_gui_basics", - "juce_gui_extra", - "juce_opengl", - }; - } - - String appTitle; - File targetFolder, projectFile, modulesFolder; - WizardComp* ownerWizardComp; - StringArray failedFiles; - - bool selectJuceFolder() - { - return ModulesFolderPathBox::selectJuceFolder (modulesFolder); - } - - //============================================================================== - Project* runWizard (WizardComp& wc, - const String& projectName, - const File& target, - bool useGlobalPath) - { - ownerWizardComp = &wc; - appTitle = projectName; - targetFolder = target; - - if (! targetFolder.exists()) - { - if (! targetFolder.createDirectory()) - failedFiles.add (targetFolder.getFullPathName()); - } - else if (FileHelpers::containsAnyNonHiddenFiles (targetFolder)) - { - if (! AlertWindow::showOkCancelBox (AlertWindow::InfoIcon, - TRANS("New JUCE Project"), - TRANS("You chose the folder:\n\nXFLDRX\n\n").replace ("XFLDRX", targetFolder.getFullPathName()) - + TRANS("This folder isn't empty - are you sure you want to create the project there?") - + "\n\n" - + TRANS("Any existing files with the same names may be overwritten by the new files."))) - return nullptr; - } - - projectFile = targetFolder.getChildFile (File::createLegalFileName (appTitle)) - .withFileExtension (Project::projectFileExtension); - - auto project = std::make_unique (projectFile); - - if (failedFiles.size() == 0) - { - project->setTitle (appTitle); - - if (! initialiseProject (*project)) - return nullptr; - - project->getConfigFlag ("JUCE_STRICT_REFCOUNTEDPOINTER") = true; - project->getProjectValue (Ids::useAppConfig) = false; - project->getProjectValue (Ids::addUsingNamespaceToJuceHeader) = false; - - if (! ProjucerApplication::getApp().getLicenseController().getCurrentState().isPaidOrGPL()) - project->getProjectValue (Ids::displaySplashScreen) = true; - - addExporters (*project, wc); - addDefaultModules (*project, useGlobalPath); - - if (project->save (false, true) != FileBasedDocument::savedOk) - return nullptr; - - project->setChangedFlag (false); - } - - if (failedFiles.size() > 0) - { - AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, - TRANS("Errors in Creating Project!"), - TRANS("The following files couldn't be written:") - + "\n\n" - + failedFiles.joinIntoString ("\n", 0, 10)); - return nullptr; - } - - return project.release(); - } - - //============================================================================== - File getSourceFilesFolder() const - { - return projectFile.getSiblingFile ("Source"); - } - - void createSourceFolder() - { - if (! getSourceFilesFolder().createDirectory()) - failedFiles.add (getSourceFilesFolder().getFullPathName()); - } - - void addDefaultModules (Project& project, bool useGlobalPath) - { - auto defaultModules = getDefaultModules(); - - AvailableModulesList list; - list.scanPaths ({ modulesFolder }); - - for (auto& mod : list.getAllModules()) - if (defaultModules.contains (mod.first)) - project.getEnabledModules().addModule (mod.second, false, useGlobalPath); - } - - void addExporters (Project& project, WizardComp& wizardComp) - { - StringArray types (wizardComp.platformTargets.getSelectedPlatforms()); - - for (int i = 0; i < types.size(); ++i) - project.addNewExporter (types[i]); - - if (project.getNumExporters() == 0) - project.createExporterForCurrentPlatform(); - } -}; diff --git a/extras/Projucer/Source/Wizards/jucer_NewProjectWizardClasses.cpp b/extras/Projucer/Source/Wizards/jucer_NewProjectWizardClasses.cpp deleted file mode 100644 index 0a5d235d7f..0000000000 --- a/extras/Projucer/Source/Wizards/jucer_NewProjectWizardClasses.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE 6 technical preview. - Copyright (c) 2020 - Raw Material Software Limited - - You may use this code under the terms of the GPL v3 - (see www.gnu.org/licenses). - - For this technical preview, this file is not subject to commercial licensing. - - 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_NewProjectWizardClasses.h" -#include "../ProjectSaving/jucer_ProjectExporter.h" -#include "../Utility/UI/jucer_SlidingPanelComponent.h" - -struct NewProjectWizardClasses -{ - class WizardComp; - #include "jucer_NewProjectWizard.h" - - #include "jucer_ProjectWizard_GUIApp.h" - #include "jucer_ProjectWizard_Console.h" - #include "jucer_ProjectWizard_AudioPlugin.h" - #include "jucer_ProjectWizard_StaticLibrary.h" - #include "jucer_ProjectWizard_DLL.h" - #include "jucer_ProjectWizard_openGL.h" - #include "jucer_ProjectWizard_Animated.h" - #include "jucer_ProjectWizard_AudioApp.h" - #include "jucer_ProjectWizard_Blank.h" - - #include "jucer_NewProjectWizardComponent.h" - #include "jucer_TemplateThumbnailsComponent.h" - #include "jucer_StartPageComponent.h" - - //============================================================================== - static int getNumWizards() noexcept - { - return 9; - } - - static std::unique_ptr createWizardType (int index) - { - switch (index) - { - case 0: return std::unique_ptr (new NewProjectWizardClasses::GUIAppWizard()); - case 1: return std::unique_ptr (new NewProjectWizardClasses::AnimatedAppWizard()); - case 2: return std::unique_ptr (new NewProjectWizardClasses::OpenGLAppWizard()); - case 3: return std::unique_ptr (new NewProjectWizardClasses::ConsoleAppWizard()); - case 4: return std::unique_ptr (new NewProjectWizardClasses::AudioAppWizard()); - case 5: return std::unique_ptr (new NewProjectWizardClasses::AudioPluginAppWizard()); - case 6: return std::unique_ptr (new NewProjectWizardClasses::StaticLibraryWizard()); - case 7: return std::unique_ptr (new NewProjectWizardClasses::DynamicLibraryWizard()); - case 8: return std::unique_ptr (new NewProjectWizardClasses::BlankAppWizard()); - default: jassertfalse; break; - } - - return {}; - } - - static StringArray getWizardNames() - { - StringArray s; - - for (int i = 0; i < getNumWizards(); ++i) - s.add (createWizardType (i)->getName()); - - return s; - } -}; - -Component* createNewProjectWizardComponent() -{ - return new NewProjectWizardClasses::StartPageComponent(); -} diff --git a/extras/Projucer/Source/Wizards/jucer_NewProjectWizardComponent.h b/extras/Projucer/Source/Wizards/jucer_NewProjectWizardComponent.h deleted file mode 100644 index ac74ed2e9e..0000000000 --- a/extras/Projucer/Source/Wizards/jucer_NewProjectWizardComponent.h +++ /dev/null @@ -1,505 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE 6 technical preview. - Copyright (c) 2020 - Raw Material Software Limited - - You may use this code under the terms of the GPL v3 - (see www.gnu.org/licenses). - - For this technical preview, this file is not subject to commercial licensing. - - 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 - - -//============================================================================== -class ModulesFolderPathBox : public Component -{ -public: - ModulesFolderPathBox (String initialFileOrDirectory) - : currentPathBox ("currentPathBox"), - openFolderButton (TRANS("...")), - modulesLabel (String(), TRANS("Modules Folder") + ":"), - useGlobalPathsToggle ("Use global module path") - { - if (initialFileOrDirectory.isEmpty()) - initialFileOrDirectory = getAppSettings().getStoredPath (Ids::defaultJuceModulePath, TargetOS::getThisOS()).get().toString(); - - setModulesFolder (initialFileOrDirectory); - - addAndMakeVisible (currentPathBox); - currentPathBox.setEditableText (true); - currentPathBox.onChange = [this] { setModulesFolder (File::getCurrentWorkingDirectory() - .getChildFile (currentPathBox.getText())); }; - - addAndMakeVisible (openFolderButton); - openFolderButton.setTooltip (TRANS ("Select JUCE modules folder")); - openFolderButton.onClick = [this] { selectJuceFolder(); }; - - addAndMakeVisible (modulesLabel); - modulesLabel.attachToComponent (¤tPathBox, true); - - auto updateEnablement = [this] - { - isUsingGlobalPaths = useGlobalPathsToggle.getToggleState(); - - currentPathBox.setEnabled (! isUsingGlobalPaths); - openFolderButton.setEnabled (! isUsingGlobalPaths); - modulesLabel.setEnabled (! isUsingGlobalPaths); - }; - - addAndMakeVisible (useGlobalPathsToggle); - useGlobalPathsToggle.setToggleState (true, sendNotification); - useGlobalPathsToggle.onClick = [updateEnablement] { updateEnablement(); }; - - updateEnablement(); - } - - void resized() override - { - auto b = getLocalBounds(); - - auto topSlice = b.removeFromTop (b.getHeight() / 2); - - openFolderButton.setBounds (topSlice.removeFromRight (30)); - modulesLabel.setBounds (topSlice.removeFromLeft (110)); - currentPathBox.setBounds (topSlice); - - b.removeFromTop (5); - useGlobalPathsToggle.setBounds (b.translated (20, 0)); - } - - static bool selectJuceFolder (File& result) - { - for (;;) - { - FileChooser fc ("Select your JUCE modules folder...", - { getAppSettings().getStoredPath (Ids::defaultJuceModulePath, TargetOS::getThisOS()).get().toString() }, - "*"); - - if (! fc.browseForDirectory()) - return false; - - if (isJUCEModulesFolder (fc.getResult())) - { - result = fc.getResult(); - return true; - } - - AlertWindow::showMessageBox (AlertWindow::WarningIcon, - "Not a valid JUCE modules folder!", - "Please select the folder containing your juce_* modules!\n\n" - "This is required so that the new project can be given some essential core modules."); - } - } - - void selectJuceFolder() - { - File result; - - if (selectJuceFolder (result)) - setModulesFolder (result); - } - - void setModulesFolder (const File& newFolder) - { - if (modulesFolder != newFolder) - { - modulesFolder = newFolder; - currentPathBox.setText (modulesFolder.getFullPathName(), dontSendNotification); - } - } - - File modulesFolder; - bool isUsingGlobalPaths = true; - -private: - ComboBox currentPathBox; - TextButton openFolderButton; - Label modulesLabel; - ToggleButton useGlobalPathsToggle; -}; - - -/** The target platforms chooser for the chosen template. */ -class PlatformTargetsComp : public Component, - private ListBoxModel -{ -public: - PlatformTargetsComp() - { - setOpaque (false); - - const Array types (ProjectExporter::getExporterTypes()); - - for (auto& type : types) - { - platforms.add (new PlatformType { type.getIcon(), type.name }); - addAndMakeVisible (toggles.add (new ToggleButton (String()))); - } - - listBox.setRowHeight (30); - listBox.setModel (this); - listBox.setOpaque (false); - listBox.setMultipleSelectionEnabled (true); - listBox.setClickingTogglesRowSelection (true); - listBox.setColour (ListBox::backgroundColourId, Colours::transparentBlack); - addAndMakeVisible (listBox); - - selectDefaultExporterIfNoneSelected(); - } - - StringArray getSelectedPlatforms() const - { - StringArray list; - - for (int i = 0; i < platforms.size(); ++i) - if (listBox.isRowSelected (i)) - list.add (platforms.getUnchecked(i)->name); - - return list; - } - - void selectDefaultExporterIfNoneSelected() - { - if (listBox.getNumSelectedRows() == 0) - { - for (int i = platforms.size(); --i >= 0;) - { - if (platforms.getUnchecked(i)->name == ProjectExporter::getCurrentPlatformExporterName()) - { - listBox.selectRow (i); - break; - } - } - } - } - - void resized() override - { - listBox.setBounds (getLocalBounds()); - } - - int getNumRows() override - { - return platforms.size(); - } - - void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected) override - { - ignoreUnused (width); - - if (auto* platform = platforms[rowNumber]) - { - auto bounds = getLocalBounds().withHeight (height).withTrimmedBottom (1); - g.setColour (findColour (rowNumber % 2 == 0 ? widgetBackgroundColourId - : secondaryWidgetBackgroundColourId)); - g.fillRect (bounds); - - bounds.removeFromLeft (10); - - auto toggleBounds = bounds.removeFromLeft (height); - drawToggle (g, toggleBounds, rowIsSelected); - - auto iconBounds = bounds.removeFromLeft (height).reduced (5); - - g.drawImageWithin (platform->icon, iconBounds.getX(), iconBounds.getY(), iconBounds.getWidth(), - iconBounds.getHeight(), RectanglePlacement::fillDestination); - - bounds.removeFromLeft (10); - g.setColour (findColour (widgetTextColourId)); - g.drawFittedText (platform->name, bounds, Justification::centredLeft, 1); - } - } - - void selectedRowsChanged (int) override - { - selectDefaultExporterIfNoneSelected(); - } - -private: - struct PlatformType - { - Image icon; - String name; - }; - - void drawToggle (Graphics& g, Rectangle bounds, bool isToggled) - { - auto sideLength = jmin (bounds.getWidth(), bounds.getHeight()); - - bounds = bounds.withSizeKeepingCentre (sideLength, sideLength).reduced (4); - - g.setColour (findColour (ToggleButton::tickDisabledColourId)); - g.drawRoundedRectangle (bounds.toFloat(), 2.0f, 1.0f); - - if (isToggled) - { - g.setColour (findColour (ToggleButton::tickColourId)); - const auto tick = getTickShape (0.75f); - g.fillPath (tick, tick.getTransformToScaleToFit (bounds.reduced (4, 5).toFloat(), false)); - } - } - - Path getTickShape (float height) - { - static const unsigned char pathData[] = { 110,109,32,210,202,64,126,183,148,64,108,39,244,247,64,245,76,124,64,108,178,131,27,65,246,76,252,64,108,175,242,4,65,246,76,252, - 64,108,236,5,68,65,0,0,160,180,108,240,150,90,65,21,136,52,63,108,48,59,16,65,0,0,32,65,108,32,210,202,64,126,183,148,64, 99,101,0,0 }; - - Path path; - path.loadPathFromData (pathData, sizeof (pathData)); - path.scaleToFit (0, 0, height * 2.0f, height, true); - - return path; - } - - ListBox listBox; - OwnedArray platforms; - OwnedArray toggles; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PlatformTargetsComp) -}; - - - -//============================================================================== -/** - The Component for project creation. - Features a file browser to select project destination and - a list box of platform targets to generate. -*/ -class WizardComp : public Component, - private FileBrowserListener -{ -public: - WizardComp() - : platformTargets(), - projectName (TRANS("Project name")), - modulesPathBox (getAppSettings().getStoredPath (Ids::defaultJuceModulePath, TargetOS::getThisOS()).get().toString()) - { - setOpaque (false); - - addChildAndSetID (&projectName, "projectName"); - projectName.setText ("NewProject"); - nameLabel.attachToComponent (&projectName, true); - projectName.onTextChange = [this] - { - updateCreateButton(); - fileBrowser.setFileName (File::createLegalFileName (projectName.getText())); - }; - - addChildAndSetID (&projectType, "projectType"); - projectType.addItemList (getWizardNames(), 1); - projectType.setSelectedId (1, dontSendNotification); - typeLabel.attachToComponent (&projectType, true); - projectType.onChange = [this] { updateFileCreationTypes(); }; - - addChildAndSetID (&fileOutline, "fileOutline"); - fileOutline.setColour (GroupComponent::outlineColourId, Colours::black.withAlpha (0.2f)); - fileOutline.setTextLabelPosition (Justification::centred); - - addChildAndSetID (&targetsOutline, "targetsOutline"); - targetsOutline.setColour (GroupComponent::outlineColourId, Colours::black.withAlpha (0.2f)); - targetsOutline.setTextLabelPosition (Justification::centred); - - addChildAndSetID (&platformTargets, "platformTargets"); - - addChildAndSetID (&fileBrowser, "fileBrowser"); - fileBrowser.setFilenameBoxLabel ("Folder:"); - fileBrowser.setFileName (File::createLegalFileName (projectName.getText())); - fileBrowser.addListener (this); - - addChildAndSetID (&createButton, "createButton"); - createButton.onClick = [this] { createProject(); }; - - addChildAndSetID (&cancelButton, "cancelButton"); - cancelButton.addShortcut (KeyPress (KeyPress::escapeKey)); - cancelButton.onClick = [this] { returnToTemplatesPage(); }; - - addChildAndSetID (&modulesPathBox, "modulesPathBox"); - - addChildAndSetID (&filesToCreate, "filesToCreate"); - filesToCreateLabel.attachToComponent (&filesToCreate, true); - - updateFileCreationTypes(); - updateCreateButton(); - - lookAndFeelChanged(); - } - - void paint (Graphics& g) override - { - g.fillAll (findColour (backgroundColourId)); - } - - void resized() override - { - auto r = getLocalBounds(); - - auto left = r.removeFromLeft (getWidth() / 2).reduced (15); - auto right = r.reduced (15); - - projectName.setBounds (left.removeFromTop (22).withTrimmedLeft (120)); - left.removeFromTop (20); - projectType.setBounds (left.removeFromTop (22).withTrimmedLeft (120)); - left.removeFromTop (20); - fileOutline.setBounds (left); - fileBrowser.setBounds (left.reduced (25)); - - auto buttons = right.removeFromBottom (30); - right.removeFromBottom (10); - createButton.setBounds (buttons.removeFromRight (130)); - buttons.removeFromRight (10); - cancelButton.setBounds (buttons.removeFromRight (130)); - - filesToCreate.setBounds (right.removeFromTop (22).withTrimmedLeft (150)); - right.removeFromTop (20); - modulesPathBox.setBounds (right.removeFromTop (50)); - right.removeFromTop (20); - - targetsOutline.setBounds (right); - platformTargets.setBounds (right.reduced (25)); - } - - void returnToTemplatesPage() - { - if (auto* parent = findParentComponentOfClass()) - { - if (parent->getNumTabs() > 0) - parent->goToTab (parent->getCurrentTabIndex() - 1); - } - else - { - jassertfalse; - } - } - - void createProject() - { - auto* mw = Component::findParentComponentOfClass(); - jassert (mw != nullptr); - - std::unique_ptr wizard = createWizard(); - - if (wizard != nullptr) - { - Result result (wizard->processResultsFromSetupItems (*this)); - - if (result.failed()) - { - AlertWindow::showMessageBox (AlertWindow::WarningIcon, - TRANS("Create Project"), - result.getErrorMessage()); - return; - } - - - wizard->modulesFolder = modulesPathBox.isUsingGlobalPaths ? File (getAppSettings().getStoredPath (Ids::defaultJuceModulePath, TargetOS::getThisOS()).get().toString()) - : modulesPathBox.modulesFolder; - - if (! isJUCEModulesFolder (wizard->modulesFolder)) - { - if (modulesPathBox.isUsingGlobalPaths) - AlertWindow::showMessageBox (AlertWindow::AlertIconType::WarningIcon, "Invalid Global Path", - "Your global JUCE module search path is invalid. Please select the folder containing your JUCE modules " - "to set as the default path."); - - if (! wizard->selectJuceFolder()) - return; - - if (modulesPathBox.isUsingGlobalPaths) - { - getAppSettings().getStoredPath (Ids::defaultJuceModulePath, TargetOS::getThisOS()).setValue (wizard->modulesFolder.getFullPathName(), nullptr); - ProjucerApplication::getApp().rescanJUCEPathModules(); - } - } - - auto projectDir = fileBrowser.getSelectedFile (0); - std::unique_ptr project (wizard->runWizard (*this, projectName.getText(), projectDir, modulesPathBox.isUsingGlobalPaths)); - - if (project != nullptr) - { - mw->openFile (project->getFile()); - getAppSettings().lastWizardFolder = projectDir.getParentDirectory(); - } - } - } - - void updateFileCreationTypes() - { - StringArray items; - - std::unique_ptr wizard = createWizard(); - - if (wizard != nullptr) - items = wizard->getFileCreationOptions(); - - filesToCreate.clear(); - filesToCreate.addItemList (items, 1); - filesToCreate.setSelectedId (1, dontSendNotification); - } - - void selectionChanged() override {} - - void fileClicked (const File&, const MouseEvent&) override {} - void fileDoubleClicked (const File&) override {} - - void browserRootChanged (const File&) override - { - fileBrowser.setFileName (File::createLegalFileName (projectName.getText())); - } - - int getFileCreationComboID() const - { - return filesToCreate.getSelectedItemIndex(); - } - - ComboBox projectType, filesToCreate; - PlatformTargetsComp platformTargets; - -private: - TextEditor projectName; - - Label nameLabel { {}, TRANS("Project Name") + ":" }; - Label typeLabel { {}, TRANS("Project Type") + ":" }; - Label filesToCreateLabel { {}, TRANS("Files to Auto-Generate") + ":" }; - - FileBrowserComponent fileBrowser { FileBrowserComponent::saveMode - | FileBrowserComponent::canSelectDirectories - | FileBrowserComponent::doNotClearFileNameOnRootChange, - NewProjectWizardClasses::getLastWizardFolder(), nullptr, nullptr }; - - GroupComponent fileOutline { {}, TRANS("Project Folder") + ":" }; - GroupComponent targetsOutline { {}, TRANS("Target Platforms") + ":" }; - - TextButton createButton { TRANS("Create") + "..." }; - TextButton cancelButton { TRANS("Cancel") }; - ModulesFolderPathBox modulesPathBox; - - std::unique_ptr createWizard() - { - return createWizardType (projectType.getSelectedItemIndex()); - } - - void updateCreateButton() - { - createButton.setEnabled (projectName.getText().trim().isNotEmpty()); - } - - void lookAndFeelChanged() override - { - projectName.setColour (TextEditor::backgroundColourId, findColour (backgroundColourId)); - projectName.setColour (TextEditor::textColourId, findColour (defaultTextColourId)); - projectName.setColour (TextEditor::outlineColourId, findColour (defaultTextColourId)); - projectName.applyFontToAllText (projectName.getFont()); - - fileBrowser.resized(); - } -}; diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Animated.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Animated.h deleted file mode 100644 index 1711eb3eed..0000000000 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Animated.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE 6 technical preview. - Copyright (c) 2020 - Raw Material Software Limited - - You may use this code under the terms of the GPL v3 - (see www.gnu.org/licenses). - - For this technical preview, this file is not subject to commercial licensing. - - 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 - - -//============================================================================== -struct AnimatedAppWizard : public NewProjectWizard -{ - AnimatedAppWizard() {} - - String getName() const override { return TRANS("Animated Application"); } - String getDescription() const override { return TRANS("Creates an application which draws an animated graphical display."); } - const char* getIcon() const override { return BinaryData::wizard_AnimatedApp_svg; } - - StringArray getFileCreationOptions() override - { - return { "Create header and implementation files", - "Create header file only" }; - } - - Result processResultsFromSetupItems (WizardComp& setupComp) override - { - createCppFile = false; - - switch (setupComp.getFileCreationComboID()) - { - case 0: createCppFile = true; break; - case 1: break; - default: jassertfalse; break; - } - - return Result::ok(); - } - - bool initialiseProject (Project& project) override - { - createSourceFolder(); - - File mainCppFile = getSourceFilesFolder().getChildFile ("Main.cpp"); - File contentCompCpp = getSourceFilesFolder().getChildFile ("MainComponent.cpp"); - File contentCompH = contentCompCpp.withFileExtension (".h"); - String contentCompName = "MainComponent"; - - project.setProjectType (build_tools::ProjectType_GUIApp::getTypeName()); - - Project::Item sourceGroup (createSourceGroup (project)); - - setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle)); - - auto juceHeaderInclude = CodeHelpers::createIncludePathIncludeStatement (Project::getJuceSourceHFilename()); - auto appHeaders = juceHeaderInclude + newLine + CodeHelpers::createIncludeStatement (contentCompH, mainCppFile); - - // create main window - String windowH = project.getFileTemplate (createCppFile ? "jucer_AnimatedComponentTemplate_h" - : "jucer_AnimatedComponentSimpleTemplate_h") - .replace ("%%include_juce%%", juceHeaderInclude) - .replace ("%%content_component_class%%", contentCompName, false); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (contentCompH, windowH)) - failedFiles.add (contentCompH.getFullPathName()); - - sourceGroup.addFileAtIndex (contentCompH, -1, false); - - if (createCppFile) - { - String windowCpp = project.getFileTemplate ("jucer_AnimatedComponentTemplate_cpp") - .replace ("%%include_juce%%", juceHeaderInclude) - .replace ("%%include_corresponding_header%%", CodeHelpers::createIncludeStatement (contentCompH, contentCompCpp), false) - .replace ("%%content_component_class%%", contentCompName, false); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (contentCompCpp, windowCpp)) - failedFiles.add (contentCompCpp.getFullPathName()); - - sourceGroup.addFileAtIndex (contentCompCpp, -1, true); - } - - // create main cpp - String mainCpp = project.getFileTemplate ("jucer_MainTemplate_SimpleWindow_cpp") - .replace ("%%app_headers%%", appHeaders, false) - .replace ("%%app_class_name%%", build_tools::makeValidIdentifier (appTitle + "Application", false, true, false), false) - .replace ("%%content_component_class%%", contentCompName, false) - .replace ("%%allow_more_than_one_instance%%", "true", false); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (mainCppFile, mainCpp)) - failedFiles.add (mainCppFile.getFullPathName()); - - sourceGroup.addFileAtIndex (mainCppFile,-1, true); - - return true; - } - -private: - bool createCppFile; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AnimatedAppWizard) -}; diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioApp.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioApp.h deleted file mode 100644 index e10d8d55f2..0000000000 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioApp.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE 6 technical preview. - Copyright (c) 2020 - Raw Material Software Limited - - You may use this code under the terms of the GPL v3 - (see www.gnu.org/licenses). - - For this technical preview, this file is not subject to commercial licensing. - - 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 - - -//============================================================================== -struct AudioAppWizard : public NewProjectWizard -{ - AudioAppWizard() {} - - String getName() const override { return TRANS("Audio Application"); } - String getDescription() const override { return TRANS("Creates a JUCE application with a single window component and audio and MIDI in/out functions."); } - const char* getIcon() const override { return BinaryData::wizard_AudioApp_svg; } - - StringArray getFileCreationOptions() override - { - return { "Create header and implementation files", - "Create header file only" }; - } - - Result processResultsFromSetupItems (WizardComp& setupComp) override - { - createCppFile = false; - - switch (setupComp.getFileCreationComboID()) - { - case 0: createCppFile = true; break; - case 1: break; - default: jassertfalse; break; - } - - return Result::ok(); - } - - bool initialiseProject (Project& project) override - { - createSourceFolder(); - - File mainCppFile = getSourceFilesFolder().getChildFile ("Main.cpp"); - File contentCompCpp = getSourceFilesFolder().getChildFile ("MainComponent.cpp"); - File contentCompH = contentCompCpp.withFileExtension (".h"); - String contentCompName = "MainComponent"; - - project.setProjectType (build_tools::ProjectType_GUIApp::getTypeName()); - - Project::Item sourceGroup (createSourceGroup (project)); - - setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle)); - - auto juceHeaderInclude = CodeHelpers::createIncludePathIncludeStatement (Project::getJuceSourceHFilename()); - auto appHeaders = juceHeaderInclude + newLine + CodeHelpers::createIncludeStatement (contentCompH, mainCppFile); - - // create main window - String windowH = project.getFileTemplate (createCppFile ? "jucer_AudioComponentTemplate_h" - : "jucer_AudioComponentSimpleTemplate_h") - .replace ("%%include_juce%%", juceHeaderInclude) - .replace ("%%content_component_class%%", contentCompName, false); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (contentCompH, windowH)) - failedFiles.add (contentCompH.getFullPathName()); - - sourceGroup.addFileAtIndex (contentCompH, -1, false); - - if (createCppFile) - { - String windowCpp = project.getFileTemplate ("jucer_AudioComponentTemplate_cpp") - .replace ("%%include_juce%%", juceHeaderInclude) - .replace ("%%include_corresponding_header%%", CodeHelpers::createIncludeStatement (contentCompH, contentCompCpp), false) - .replace ("%%content_component_class%%", contentCompName, false); - - - - if (!build_tools::overwriteFileWithNewDataIfDifferent (contentCompCpp, windowCpp)) - failedFiles.add (contentCompCpp.getFullPathName()); - - sourceGroup.addFileAtIndex (contentCompCpp, -1, true); - } - - // create main cpp - String mainCpp = project.getFileTemplate ("jucer_MainTemplate_SimpleWindow_cpp") - .replace ("%%app_headers%%", appHeaders, false) - .replace ("%%app_class_name%%", build_tools::makeValidIdentifier (appTitle + "Application", false, true, false), false) - .replace ("%%content_component_class%%", contentCompName, false) - .replace ("%%allow_more_than_one_instance%%", "true", false); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (mainCppFile, mainCpp)) - failedFiles.add (mainCppFile.getFullPathName()); - - sourceGroup.addFileAtIndex (mainCppFile, -1, true); - - return true; - } - - StringArray getDefaultModules() override - { - StringArray s (NewProjectWizard::getDefaultModules()); - s.addIfNotAlreadyThere ("juce_audio_utils"); - return s; - } - -private: - bool createCppFile; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioAppWizard) -}; diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioPlugin.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioPlugin.h deleted file mode 100644 index 6b49bb798d..0000000000 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_AudioPlugin.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE 6 technical preview. - Copyright (c) 2020 - Raw Material Software Limited - - You may use this code under the terms of the GPL v3 - (see www.gnu.org/licenses). - - For this technical preview, this file is not subject to commercial licensing. - - 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 - - -//============================================================================== -struct AudioPluginAppWizard : public NewProjectWizard -{ - AudioPluginAppWizard() {} - - String getName() const override { return TRANS("Audio Plug-In"); } - String getDescription() const override { return TRANS("Creates a VST/AU/RTAS/AAX audio plug-in. This template features a single window GUI and Audio/MIDI IO functions."); } - const char* getIcon() const override { return BinaryData::wizard_AudioPlugin_svg; } - - StringArray getDefaultModules() override - { - StringArray s (NewProjectWizard::getDefaultModules()); - s.add ("juce_audio_plugin_client"); - s.add ("juce_audio_utils"); - - return s; - } - - bool initialiseProject (Project& project) override - { - createSourceFolder(); - - String filterClassName = build_tools::makeValidIdentifier (appTitle, true, true, false) + "AudioProcessor"; - filterClassName = filterClassName.substring (0, 1).toUpperCase() + filterClassName.substring (1); - String editorClassName = filterClassName + "Editor"; - - File filterCppFile = getSourceFilesFolder().getChildFile ("PluginProcessor.cpp"); - File filterHFile = filterCppFile.withFileExtension (".h"); - File editorCppFile = getSourceFilesFolder().getChildFile ("PluginEditor.cpp"); - File editorHFile = editorCppFile.withFileExtension (".h"); - - project.setProjectType (build_tools::ProjectType_AudioPlugin::getTypeName()); - - setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle)); - - auto juceHeaderInclude = CodeHelpers::createIncludePathIncludeStatement (Project::getJuceSourceHFilename()); - - String filterCpp = project.getFileTemplate ("jucer_AudioPluginFilterTemplate_cpp") - .replace ("%%filter_headers%%", CodeHelpers::createIncludeStatement (filterHFile, filterCppFile) - + newLine + CodeHelpers::createIncludeStatement (editorHFile, filterCppFile), false) - .replace ("%%filter_class_name%%", filterClassName, false) - .replace ("%%editor_class_name%%", editorClassName, false); - - String filterH = project.getFileTemplate ("jucer_AudioPluginFilterTemplate_h") - .replace ("%%app_headers%%", juceHeaderInclude, false) - .replace ("%%filter_class_name%%", filterClassName, false); - - String editorCpp = project.getFileTemplate ("jucer_AudioPluginEditorTemplate_cpp") - .replace ("%%editor_cpp_headers%%", CodeHelpers::createIncludeStatement (filterHFile, filterCppFile) - + newLine + CodeHelpers::createIncludeStatement (editorHFile, filterCppFile), false) - .replace ("%%filter_class_name%%", filterClassName, false) - .replace ("%%editor_class_name%%", editorClassName, false); - - String editorH = project.getFileTemplate ("jucer_AudioPluginEditorTemplate_h") - .replace ("%%editor_headers%%", juceHeaderInclude + newLine + CodeHelpers::createIncludeStatement (filterHFile, filterCppFile), false) - .replace ("%%filter_class_name%%", filterClassName, false) - .replace ("%%editor_class_name%%", editorClassName, false); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (filterCppFile, filterCpp)) - failedFiles.add (filterCppFile.getFullPathName()); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (filterHFile, filterH)) - failedFiles.add (filterHFile.getFullPathName()); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (editorCppFile, editorCpp)) - failedFiles.add (editorCppFile.getFullPathName()); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (editorHFile, editorH)) - failedFiles.add (editorHFile.getFullPathName()); - - Project::Item sourceGroup (createSourceGroup (project)); - - sourceGroup.addFileAtIndex (filterCppFile, -1, true); - sourceGroup.addFileAtIndex (filterHFile, -1, false); - sourceGroup.addFileAtIndex (editorCppFile, -1, true); - sourceGroup.addFileAtIndex (editorHFile, -1, false); - - project.getConfigFlag ("JUCE_VST3_CAN_REPLACE_VST2") = 0; - - return true; - } - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioPluginAppWizard) -}; diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Blank.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Blank.h deleted file mode 100644 index 4fe406b117..0000000000 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Blank.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE 6 technical preview. - Copyright (c) 2020 - Raw Material Software Limited - - You may use this code under the terms of the GPL v3 - (see www.gnu.org/licenses). - - For this technical preview, this file is not subject to commercial licensing. - - 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 - - -//============================================================================== -struct BlankAppWizard : public NewProjectWizard -{ - BlankAppWizard() {} - - String getName() const override { return TRANS("Empty Application"); } - String getDescription() const override { return TRANS("Creates a blank JUCE GUI application."); } - const char* getIcon() const override { return BinaryData::wizard_GUI_svg; } - - bool initialiseProject (Project& project) override - { - createSourceFolder(); - project.setProjectType (build_tools::ProjectType_GUIApp::getTypeName()); - Project::Item sourceGroup (createSourceGroup (project)); - setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle)); - - return true; - } - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BlankAppWizard) -}; diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Console.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Console.h deleted file mode 100644 index 1174638ffd..0000000000 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_Console.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE 6 technical preview. - Copyright (c) 2020 - Raw Material Software Limited - - You may use this code under the terms of the GPL v3 - (see www.gnu.org/licenses). - - For this technical preview, this file is not subject to commercial licensing. - - 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 - - -//============================================================================== -struct ConsoleAppWizard : public NewProjectWizard -{ - ConsoleAppWizard() {} - - String getName() const override { return TRANS("Console Application"); } - String getDescription() const override { return TRANS("Creates a command-line application without GUI support."); } - const char* getIcon() const override { return BinaryData::wizard_ConsoleApp_svg; } - - StringArray getFileCreationOptions() override - { - return { "Create a Main.cpp file", - "Don't create any files" }; - } - - Result processResultsFromSetupItems (WizardComp& setupComp) override - { - createMainCpp = false; - - switch (setupComp.getFileCreationComboID()) - { - case 0: createMainCpp = true; break; - case 1: break; - default: jassertfalse; break; - } - - return Result::ok(); - } - - bool initialiseProject (Project& project) override - { - createSourceFolder(); - - project.setProjectType (build_tools::ProjectType_ConsoleApp::getTypeName()); - - Project::Item sourceGroup (createSourceGroup (project)); - - setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle)); - - if (createMainCpp) - { - File mainCppFile = getSourceFilesFolder().getChildFile ("Main.cpp"); - - String mainCpp = project.getFileTemplate ("jucer_MainConsoleAppTemplate_cpp") - .replace ("%%app_headers%%", CodeHelpers::createIncludePathIncludeStatement (Project::getJuceSourceHFilename()), false); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (mainCppFile, mainCpp)) - failedFiles.add (mainCppFile.getFullPathName()); - - sourceGroup.addFileAtIndex (mainCppFile, -1, true); - } - - return true; - } - -private: - bool createMainCpp; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ConsoleAppWizard) -}; diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_DLL.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_DLL.h deleted file mode 100644 index 528346aefc..0000000000 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_DLL.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE 6 technical preview. - Copyright (c) 2020 - Raw Material Software Limited - - You may use this code under the terms of the GPL v3 - (see www.gnu.org/licenses). - - For this technical preview, this file is not subject to commercial licensing. - - 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 - - -//============================================================================== -struct DynamicLibraryWizard : public NewProjectWizard -{ - DynamicLibraryWizard() {} - - String getName() const override { return TRANS("Dynamic Library"); } - String getDescription() const override { return TRANS("Creates a Dynamic Library template with support for all JUCE features."); } - const char* getIcon() const override { return BinaryData::wizard_DLL_svg; } - - bool initialiseProject (Project& project) override - { - createSourceFolder(); - project.setProjectType (build_tools::ProjectType_DLL::getTypeName()); - createSourceGroup (project); - setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle)); - - return true; - } - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DynamicLibraryWizard) -}; diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_GUIApp.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_GUIApp.h deleted file mode 100644 index ac7a878418..0000000000 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_GUIApp.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE 6 technical preview. - Copyright (c) 2020 - Raw Material Software Limited - - You may use this code under the terms of the GPL v3 - (see www.gnu.org/licenses). - - For this technical preview, this file is not subject to commercial licensing. - - 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 - - -//============================================================================== -struct GUIAppWizard : public NewProjectWizard -{ - GUIAppWizard() {} - - String getName() const override { return TRANS("GUI Application"); } - String getDescription() const override { return TRANS("Creates a blank JUCE application with a single window component."); } - const char* getIcon() const override { return BinaryData::wizard_GUI_svg; } - - StringArray getFileCreationOptions() override - { - return { "Create a Main.cpp file with header and implementation files", - "Create a Main.cpp file with header file only", - "Create a Main.cpp file only", - "Don't create any files" }; - } - - Result processResultsFromSetupItems (WizardComp& setupComp) override - { - createMainCpp = createWindow = createCppFile = false; - - switch (setupComp.getFileCreationComboID()) - { - case 0: createMainCpp = createWindow = createCppFile = true; break; - case 1: createMainCpp = createWindow = true; break; - case 2: createMainCpp = true; break; - case 3: break; - default: jassertfalse; break; - } - - return Result::ok(); - } - - bool initialiseProject (Project& project) override - { - createSourceFolder(); - - File mainCppFile = getSourceFilesFolder().getChildFile ("Main.cpp"); - File contentCompCpp = getSourceFilesFolder().getChildFile ("MainComponent.cpp"); - File contentCompH = contentCompCpp.withFileExtension (".h"); - String contentCompName = "MainComponent"; - - project.setProjectType (build_tools::ProjectType_GUIApp::getTypeName()); - - Project::Item sourceGroup (createSourceGroup (project)); - - setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle)); - - auto juceHeaderInclude = CodeHelpers::createIncludePathIncludeStatement (Project::getJuceSourceHFilename()); - auto appHeaders = juceHeaderInclude; - - if (createWindow) - { - appHeaders << newLine << CodeHelpers::createIncludeStatement (contentCompH, mainCppFile); - - String windowH = project.getFileTemplate (createCppFile ? "jucer_ContentCompTemplate_h" - : "jucer_ContentCompSimpleTemplate_h") - .replace ("%%include_juce%%", juceHeaderInclude) - .replace ("%%content_component_class%%", contentCompName, false); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (contentCompH, windowH)) - failedFiles.add (contentCompH.getFullPathName()); - - sourceGroup.addFileAtIndex (contentCompH, -1, false); - - if (createCppFile) - { - String windowCpp = project.getFileTemplate ("jucer_ContentCompTemplate_cpp") - .replace ("%%include_juce%%", juceHeaderInclude) - .replace ("%%include_corresponding_header%%", CodeHelpers::createIncludeStatement (contentCompH, contentCompCpp), false) - .replace ("%%content_component_class%%", contentCompName, false); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (contentCompCpp, windowCpp)) - failedFiles.add (contentCompCpp.getFullPathName()); - - sourceGroup.addFileAtIndex (contentCompCpp, -1, true); - } - } - - if (createMainCpp) - { - String mainCpp = project.getFileTemplate (createWindow ? "jucer_MainTemplate_Window_cpp" - : "jucer_MainTemplate_NoWindow_cpp") - .replace ("%%app_headers%%", appHeaders, false) - .replace ("%%app_class_name%%", build_tools::makeValidIdentifier (appTitle + "Application", false, true, false), false) - .replace ("%%content_component_class%%", contentCompName, false) - .replace ("%%allow_more_than_one_instance%%", "true", false); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (mainCppFile, mainCpp)) - failedFiles.add (mainCppFile.getFullPathName()); - - sourceGroup.addFileAtIndex (mainCppFile, -1, true); - } - - return true; - } - -private: - bool createMainCpp, createWindow, createCppFile; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GUIAppWizard) -}; diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_StaticLibrary.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_StaticLibrary.h deleted file mode 100644 index 38b0aead12..0000000000 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_StaticLibrary.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE 6 technical preview. - Copyright (c) 2020 - Raw Material Software Limited - - You may use this code under the terms of the GPL v3 - (see www.gnu.org/licenses). - - For this technical preview, this file is not subject to commercial licensing. - - 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 - - -//============================================================================== -struct StaticLibraryWizard : public NewProjectWizard -{ - StaticLibraryWizard() {} - - String getName() const override { return TRANS("Static Library"); } - String getDescription() const override { return TRANS("Creates a static library."); } - const char* getIcon() const override { return BinaryData::wizard_StaticLibrary_svg; } - - bool initialiseProject (Project& project) override - { - createSourceFolder(); - project.setProjectType (build_tools::ProjectType_StaticLibrary::getTypeName()); - createSourceGroup (project); - setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle)); - - return true; - } - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StaticLibraryWizard) -}; diff --git a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_openGL.h b/extras/Projucer/Source/Wizards/jucer_ProjectWizard_openGL.h deleted file mode 100644 index c4fc59246c..0000000000 --- a/extras/Projucer/Source/Wizards/jucer_ProjectWizard_openGL.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE 6 technical preview. - Copyright (c) 2020 - Raw Material Software Limited - - You may use this code under the terms of the GPL v3 - (see www.gnu.org/licenses). - - For this technical preview, this file is not subject to commercial licensing. - - 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 - - -//============================================================================== -struct OpenGLAppWizard : public NewProjectWizard -{ - OpenGLAppWizard() {} - - String getName() const override { return TRANS("OpenGL Application"); } - String getDescription() const override { return TRANS("Creates a blank JUCE application with a single window component. This component supports openGL drawing features including 3D model import and GLSL shaders."); } - const char* getIcon() const override { return BinaryData::wizard_OpenGL_svg; } - - StringArray getFileCreationOptions() override - { - return { "Create header and implementation files", - "Create header file only" }; - } - - Result processResultsFromSetupItems (WizardComp& setupComp) override - { - createCppFile = false; - - switch (setupComp.getFileCreationComboID()) - { - case 0: createCppFile = true; break; - case 1: break; - default: jassertfalse; break; - } - - return Result::ok(); - } - - bool initialiseProject (Project& project) override - { - createSourceFolder(); - - File mainCppFile = getSourceFilesFolder().getChildFile ("Main.cpp"); - File contentCompCpp = getSourceFilesFolder().getChildFile ("MainComponent.cpp"); - File contentCompH = contentCompCpp.withFileExtension (".h"); - String contentCompName = "MainComponent"; - - project.setProjectType (build_tools::ProjectType_GUIApp::getTypeName()); - - Project::Item sourceGroup (createSourceGroup (project)); - - setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle)); - - auto juceHeaderInclude = CodeHelpers::createIncludePathIncludeStatement (Project::getJuceSourceHFilename()); - auto appHeaders = juceHeaderInclude + newLine + CodeHelpers::createIncludeStatement (contentCompH, mainCppFile); - - // create main window - String windowH = project.getFileTemplate (createCppFile ? "jucer_OpenGLComponentTemplate_h" - : "jucer_OpenGLComponentSimpleTemplate_h") - .replace ("%%include_juce%%", juceHeaderInclude) - .replace ("%%content_component_class%%", contentCompName, false); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (contentCompH, windowH)) - failedFiles.add (contentCompH.getFullPathName()); - - sourceGroup.addFileAtIndex (contentCompH, -1, false); - - if (createCppFile) - { - String windowCpp = project.getFileTemplate ("jucer_OpenGLComponentTemplate_cpp") - .replace ("%%include_juce%%", juceHeaderInclude) - .replace ("%%include_corresponding_header%%", CodeHelpers::createIncludeStatement (contentCompH, contentCompCpp), false) - .replace ("%%content_component_class%%", contentCompName, false); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (contentCompCpp, windowCpp)) - failedFiles.add (contentCompCpp.getFullPathName()); - - sourceGroup.addFileAtIndex (contentCompCpp, -1, true); - } - - // create main cpp - String mainCpp = project.getFileTemplate ("jucer_MainTemplate_SimpleWindow_cpp") - .replace ("%%app_headers%%", appHeaders, false) - .replace ("%%app_class_name%%", build_tools::makeValidIdentifier (appTitle + "Application", false, true, false), false) - .replace ("%%content_component_class%%", contentCompName, false) - .replace ("%%allow_more_than_one_instance%%", "true", false); - - if (!build_tools::overwriteFileWithNewDataIfDifferent (mainCppFile, mainCpp)) - failedFiles.add (mainCppFile.getFullPathName()); - - sourceGroup.addFileAtIndex (mainCppFile, -1, true); - - return true; - } - -private: - bool createCppFile; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpenGLAppWizard) -}; diff --git a/extras/Projucer/Source/Wizards/jucer_TemplateThumbnailsComponent.h b/extras/Projucer/Source/Wizards/jucer_TemplateThumbnailsComponent.h deleted file mode 100644 index 878ddc3be2..0000000000 --- a/extras/Projucer/Source/Wizards/jucer_TemplateThumbnailsComponent.h +++ /dev/null @@ -1,250 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE 6 technical preview. - Copyright (c) 2020 - Raw Material Software Limited - - You may use this code under the terms of the GPL v3 - (see www.gnu.org/licenses). - - For this technical preview, this file is not subject to commercial licensing. - - 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 - - -//============================================================================== -/** - Template option tile button. - The drawable button object class for the tile icons and buttons in the TemplateTileBrowser -*/ -class TemplateOptionButton : public DrawableButton -{ -public: - TemplateOptionButton (const String& buttonName, ButtonStyle buttonStyle, const char* thumbSvg) - : DrawableButton (buttonName, buttonStyle) - { - // svg for thumbnail icon - auto svg = parseXML (thumbSvg); - jassert (svg != nullptr); - thumb = Drawable::createFromSVG (*svg); - - // svg for thumbnail background highlight - auto backSvg = parseXML (BinaryData::wizard_Highlight_svg); - jassert (backSvg != nullptr); - hoverBackground = Drawable::createFromSVG (*backSvg); - - name = buttonName; - - description = ""; - } - - void paintButton (Graphics& g, bool isMouseOverButton, bool /*isButtonDown*/) override - { - const Rectangle r (getLocalBounds().toFloat()); - const Colour buttonColour (0xffA35E93); - - if (isMouseOverButton) - { - if (getStyle() == ImageFitted) - { - hoverBackground->drawWithin (g, r, RectanglePlacement::centred, 1.0); - thumb->drawWithin (g, r, RectanglePlacement::centred, 1.0); - } - else - { - g.setColour (buttonColour.withAlpha (0.3f)); - g.fillRoundedRectangle (r.reduced (2.0f, 2.0f), 10.0f); - g.setColour (buttonColour); - g.drawRoundedRectangle (r.reduced (2.0f, 2.0f), 10.0f, 2.0f); - } - } - else - { - if (getStyle() == ImageFitted) - { - thumb->drawWithin (g, r, RectanglePlacement::centred, 1.0); - } - else - { - g.setColour (buttonColour); - g.drawRoundedRectangle (r.reduced (2.0f, 2.0f), 10.0f, 2.0f); - } - } - - Rectangle textTarget; - - // center the text for the text buttons or position the text in the image buttons - if (getStyle() != ImageFitted) - { - textTarget = getLocalBounds().toFloat(); - } - else - { - textTarget = RectanglePlacement (RectanglePlacement::centred).appliedTo (thumb->getDrawableBounds(), r); - textTarget = textTarget.removeFromBottom (textTarget.getHeight() * 0.3f); - } - - g.setColour (findColour (defaultTextColourId)); - g.drawText (name, textTarget, Justification::centred, true); - } - - void resized() override - { - thumb->setBoundsToFit (getLocalBounds(), Justification::centred, false); - } - - void setDescription (String descript) noexcept - { - description = descript; - } - - String getDescription() const noexcept - { - return description; - } - -private: - using DrawableButton::clicked; - - std::unique_ptr thumb, hoverBackground; - String name, description; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TemplateOptionButton) -}; - - - -//============================================================================== -/** - Project Template Component for front page. - Features multiple icon buttons to select the type of project template -*/ -class TemplateTileBrowser : public Component -{ -public: - TemplateTileBrowser (WizardComp* projectWizard) - { - const int numWizardButtons = getNumWizards() - 1; // ( - 1 because the last one is blank) - - for (int i = 0; i < numWizardButtons; ++i) - { - auto wizard = createWizardType (i); - - TemplateOptionButton* b = new TemplateOptionButton (wizard->getName(), - TemplateOptionButton::ImageFitted, - wizard->getIcon()); - optionButtons.add (b); - addAndMakeVisible (b); - b->setDescription (wizard->getDescription()); - b->onClick = [this, b] { showWizardButton (b); }; - b->onStateChange = [this] { repaint(); }; - } - - // Handle Open Project button functionality - ApplicationCommandManager& commandManager = ProjucerApplication::getCommandManager(); - - addAndMakeVisible (blankProjectButton); - addAndMakeVisible (openProjectButton); - addAndMakeVisible (browseDemosButton); - addAndMakeVisible (viewTutorialsButton); - - blankProjectButton.onClick = [this] { createBlankProject(); }; - openProjectButton.setCommandToTrigger (&commandManager, CommandIDs::open, true); - browseDemosButton.setCommandToTrigger (&commandManager, CommandIDs::launchDemoRunner, true); - viewTutorialsButton.setCommandToTrigger (&commandManager, CommandIDs::showTutorials, true); - - newProjectWizard = projectWizard; - } - - void paint (Graphics& g) override - { - g.setColour (findColour (contentHeaderBackgroundColourId)); - g.fillRect (getLocalBounds().removeFromTop (60)); - - g.setColour (Colours::white); - g.setFont (20.0f); - g.drawText ("Create New Project", 0, 0, getWidth(), 60, Justification::centred, true); - - auto descriptionBox = (getLocalBounds().reduced (30).removeFromBottom (50)); - - g.setColour (findColour (defaultTextColourId)); - g.setFont (15.0f); - - for (int i = 0; i < optionButtons.size(); ++i) - if (optionButtons.getUnchecked(i)->isOver()) - g.drawFittedText (optionButtons.getUnchecked(i)->getDescription(), descriptionBox, Justification::centredBottom, 5, 1.0f); - } - - void resized() override - { - auto bounds = getLocalBounds().reduced (40, 0); - bounds.removeFromTop (60); - - { - auto optionBounds = bounds.removeFromTop (roundToInt (bounds.getHeight() * 0.65f)); - - auto topSlice = optionBounds.removeFromTop (optionBounds.getHeight() / 2).reduced (0, 10); - auto bottomSlice = optionBounds.reduced (0, 10); - - const int numHorizontal = 4; - - for (int i = 0; i < optionButtons.size(); ++i) - { - auto& sliceToUse = (i < numHorizontal ? topSlice : bottomSlice); - - optionButtons.getUnchecked (i)->setBounds (sliceToUse.removeFromLeft (sliceToUse.getWidth() / (4 - (i % 4))).reduced (10, 0)); - } - } - - bounds.removeFromTop (20); - auto topButtonBounds = bounds.removeFromTop (50); - - openProjectButton.setBounds (topButtonBounds.reduced (80, 0)); - - bounds.removeFromTop (10); - auto bottomButtonBounds = bounds.removeFromTop (35); - - blankProjectButton.setBounds (bottomButtonBounds.removeFromLeft (bottomButtonBounds.getWidth() / 3).reduced (10, 0)); - browseDemosButton.setBounds (bottomButtonBounds.removeFromLeft (bottomButtonBounds.getWidth() / 2).reduced (10, 0)); - viewTutorialsButton.setBounds (bottomButtonBounds.removeFromLeft (bottomButtonBounds.getWidth()).reduced (10, 0)); - } - - void showWizard (const String& name) - { - newProjectWizard->projectType.setText (name); - - if (SlidingPanelComponent* parent = findParentComponentOfClass()) - parent->goToTab (1); - else - jassertfalse; - } - - void createBlankProject() - { - showWizard (BlankAppWizard().getName()); - } - -private: - OwnedArray optionButtons; - NewProjectWizardClasses::WizardComp* newProjectWizard; - - TemplateOptionButton blankProjectButton { "Create Blank Project", TemplateOptionButton::ImageOnButtonBackground, BinaryData::wizard_Openfile_svg }, - openProjectButton { "Open Existing Project", TemplateOptionButton::ImageOnButtonBackground, BinaryData::wizard_Openfile_svg }, - browseDemosButton { "Browse JUCE Demos", TemplateOptionButton::ImageOnButtonBackground, BinaryData::wizard_Openfile_svg }, - viewTutorialsButton { "View JUCE Tutorials", TemplateOptionButton::ImageOnButtonBackground, BinaryData::wizard_Openfile_svg }; - - void showWizardButton (Button* b) - { - if (dynamic_cast (b) != nullptr) - showWizard (b->getButtonText()); - } - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TemplateTileBrowser) -}; diff --git a/modules/juce_gui_basics/properties/juce_MultiChoicePropertyComponent.cpp b/modules/juce_gui_basics/properties/juce_MultiChoicePropertyComponent.cpp index 716f60141d..a3ca932c9e 100644 --- a/modules/juce_gui_basics/properties/juce_MultiChoicePropertyComponent.cpp +++ b/modules/juce_gui_basics/properties/juce_MultiChoicePropertyComponent.cpp @@ -200,32 +200,43 @@ private: }; //============================================================================== +int MultiChoicePropertyComponent::getTotalButtonsHeight (int numButtons) +{ + return numButtons * buttonHeight + 1; +} + MultiChoicePropertyComponent::MultiChoicePropertyComponent (const String& propertyName, const StringArray& choices, const Array& correspondingValues) - : PropertyComponent (propertyName, 70) +: PropertyComponent (propertyName, jmin (getTotalButtonsHeight (choices.size()), collapsedHeight)) { // The array of corresponding values must contain one value for each of the items in // the choices array! jassert (choices.size() == correspondingValues.size()); - ignoreUnused (correspondingValues); for (auto choice : choices) addAndMakeVisible (choiceButtons.add (new ToggleButton (choice))); - maxHeight = (choiceButtons.size() * 25) + 20; - + if (preferredHeight >= collapsedHeight) { - Path expandShape; - expandShape.addTriangle ({ 0, 0 }, { 5, 10 }, { 10, 0}); - expandButton.setShape (expandShape, true, true, false); + expandable = true; + maxHeight = getTotalButtonsHeight (choiceButtons.size()) + expandAreaHeight; } - expandButton.onClick = [this] { setExpanded (! expanded); }; - addAndMakeVisible (expandButton); + if (isExpandable()) + { + { + Path expandShape; + expandShape.addTriangle ({ 0, 0 }, { 5, 10 }, { 10, 0}); + expandButton.setShape (expandShape, true, true, false); + } + + expandButton.onClick = [this] { setExpanded (! expanded); }; + addAndMakeVisible (expandButton); - lookAndFeelChanged(); + lookAndFeelChanged(); + } } MultiChoicePropertyComponent::MultiChoicePropertyComponent (const Value& valueToControl, @@ -276,11 +287,11 @@ void MultiChoicePropertyComponent::paint (Graphics& g) g.setColour (findColour (TextEditor::backgroundColourId)); g.fillRect (getLookAndFeel().getPropertyComponentContentPosition (*this)); - if (! expanded) + if (isExpandable() && ! isExpanded()) { g.setColour (findColour (TextEditor::backgroundColourId).contrasting().withAlpha (0.4f)); g.drawFittedText ("+ " + String (numHidden) + " more", getLookAndFeel().getPropertyComponentContentPosition (*this) - .removeFromBottom (20).withTrimmedLeft (10), + .removeFromBottom (expandAreaHeight).withTrimmedLeft (10), Justification::centredLeft, 1); } @@ -291,20 +302,23 @@ void MultiChoicePropertyComponent::resized() { auto bounds = getLookAndFeel().getPropertyComponentContentPosition (*this); - bounds.removeFromBottom (5); + if (isExpandable()) + { + bounds.removeFromBottom (5); - auto buttonSlice = bounds.removeFromBottom (10); - expandButton.setSize (10, 10); - expandButton.setCentrePosition (buttonSlice.getCentre()); + auto buttonSlice = bounds.removeFromBottom (10); + expandButton.setSize (10, 10); + expandButton.setCentrePosition (buttonSlice.getCentre()); + } numHidden = 0; for (auto* b : choiceButtons) { - if (bounds.getHeight() >= 25) + if (bounds.getHeight() >= buttonHeight) { b->setVisible (true); - b->setBounds (bounds.removeFromTop (25).reduced (5, 2)); + b->setBounds (bounds.removeFromTop (buttonHeight).reduced (5, 2)); } else { @@ -314,13 +328,13 @@ void MultiChoicePropertyComponent::resized() } } -void MultiChoicePropertyComponent::setExpanded (bool isExpanded) noexcept +void MultiChoicePropertyComponent::setExpanded (bool shouldBeExpanded) noexcept { - if (expanded == isExpanded) + if (! isExpandable() || (isExpanded() == shouldBeExpanded)) return; - expanded = isExpanded; - preferredHeight = expanded ? maxHeight : 70; + expanded = shouldBeExpanded; + preferredHeight = expanded ? maxHeight : collapsedHeight; if (auto* propertyPanel = findParentComponentOfClass()) propertyPanel->resized(); diff --git a/modules/juce_gui_basics/properties/juce_MultiChoicePropertyComponent.h b/modules/juce_gui_basics/properties/juce_MultiChoicePropertyComponent.h index 03e7efb883..c9e2f55777 100644 --- a/modules/juce_gui_basics/properties/juce_MultiChoicePropertyComponent.h +++ b/modules/juce_gui_basics/properties/juce_MultiChoicePropertyComponent.h @@ -80,7 +80,10 @@ public: /** Returns true if the list of options is expanded. */ bool isExpanded() const noexcept { return expanded; } - /** Expands or shrinks the list of options. + /** Returns true if the list of options has been truncated and can be expanded. */ + bool isExpandable() const noexcept { return expandable; } + + /** Expands or shrinks the list of options if they are not all visible. N.B. This will just set the preferredHeight value of the PropertyComponent and attempt to call PropertyPanel::resized(), so if you are not displaying this object in a PropertyPanel @@ -107,14 +110,18 @@ private: class MultiChoiceRemapperSourceWithDefault; //============================================================================== + static int getTotalButtonsHeight (int); void lookAndFeelChanged() override; //============================================================================== WeakReference valueWithDefault; - int maxHeight = 0; - int numHidden = 0; - bool expanded = false; + static constexpr int collapsedHeight = 125; + static constexpr int buttonHeight = 25; + static constexpr int expandAreaHeight = 20; + + int maxHeight = 0, numHidden = 0; + bool expandable = false, expanded = false; OwnedArray choiceButtons; ShapeButton expandButton { "Expand", Colours::transparentBlack, Colours::transparentBlack, Colours::transparentBlack };