diff --git a/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_MSVC.h b/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_MSVC.h index 4607c34c16..6ee13055d4 100644 --- a/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_MSVC.h +++ b/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_MSVC.h @@ -165,12 +165,10 @@ protected: StringArray searchPaths (config.getHeaderSearchPaths()); if (project.shouldAddVSTFolderToPath() && getVSTFolder().toString().isNotEmpty()) - searchPaths.add (RelativePath (getVSTFolder().toString(), RelativePath::projectFolder) - .rebased (project.getFile().getParentDirectory(), getTargetFolder(), RelativePath::buildTargetFolder) - .toWindowsStyle()); + searchPaths.add (rebaseFromProjectFolderToBuildTarget (RelativePath (getVSTFolder().toString(), RelativePath::projectFolder)).toWindowsStyle()); if (project.isAudioPlugin()) - searchPaths.add (juceWrapperFiles[0].getParentDirectory().toWindowsStyle()); + searchPaths.add (juceWrapperFolder.toWindowsStyle()); if (isRTAS()) { @@ -200,10 +198,9 @@ protected: "xplat/AVX/avx2/avx2sdk/inc" }; RelativePath sdkFolder (getRTASFolder().toString(), RelativePath::projectFolder); - sdkFolder = sdkFolder.rebased (project.getFile().getParentDirectory(), getTargetFolder(), RelativePath::buildTargetFolder); for (int i = 0; i < numElementsInArray (rtasIncludePaths); ++i) - searchPaths.add (sdkFolder.getChildFile (rtasIncludePaths[i]).toWindowsStyle()); + searchPaths.add (rebaseFromProjectFolderToBuildTarget (sdkFolder.getChildFile (rtasIncludePaths[i])).toWindowsStyle()); } return searchPaths; diff --git a/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_Make.h b/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_Make.h index 740dfc4336..8518a24370 100644 --- a/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_Make.h +++ b/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_Make.h @@ -96,6 +96,10 @@ public: if (shouldFileBeCompiledByDefault (juceWrapperFiles.getReference(i))) files.add (juceWrapperFiles.getReference(i)); + const Array vstFiles (getVSTFilesRequired()); + for (int i = 0; i < vstFiles.size(); i++) + files.add (vstFiles.getReference(i)); + MemoryOutputStream mo; writeMakefile (mo, files); @@ -151,6 +155,12 @@ private: headerPaths.insert (0, "/usr/include/freetype2"); headerPaths.insert (0, "/usr/include"); + if (project.shouldAddVSTFolderToPath() && getVSTFolder().toString().isNotEmpty()) + headerPaths.insert (0, rebaseFromProjectFolderToBuildTarget (RelativePath (getVSTFolder().toString(), RelativePath::projectFolder)).toUnixStyle()); + + if (isVST()) + headerPaths.insert (0, juceWrapperFolder.toUnixStyle()); + for (int i = 0; i < headerPaths.size(); ++i) out << " -I " << FileHelpers::unixStylePath (headerPaths[i]).quoted(); } @@ -229,6 +239,8 @@ private: if (project.isLibrary()) targetName = getLibbedFilename (targetName); + else if (isVST()) + targetName = targetName.upToLastOccurrenceOf (".", false, false) + ".so"; out << " TARGET := " << escapeSpaces (targetName) << newLine; diff --git a/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_XCode.h b/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_XCode.h index 6d546072a7..e8bde516bd 100644 --- a/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_XCode.h +++ b/extras/Jucer (experimental)/Source/Project/jucer_ProjectExport_XCode.h @@ -386,9 +386,7 @@ private: StringArray searchPaths (config.getHeaderSearchPaths()); if (project.shouldAddVSTFolderToPath() && getVSTFolder().toString().isNotEmpty()) - searchPaths.add (RelativePath (getVSTFolder().toString(), RelativePath::projectFolder) - .rebased (project.getFile().getParentDirectory(), getTargetFolder(), RelativePath::buildTargetFolder) - .toUnixStyle()); + searchPaths.add (rebaseFromProjectFolderToBuildTarget (RelativePath (getVSTFolder().toString(), RelativePath::projectFolder)).toUnixStyle()); if (project.isAudioPlugin()) { @@ -433,10 +431,9 @@ private: "xplat/AVX/avx2/avx2sdk/utils" }; RelativePath sdkFolder (getRTASFolder().toString(), RelativePath::projectFolder); - sdkFolder = sdkFolder.rebased (project.getFile().getParentDirectory(), getTargetFolder(), RelativePath::buildTargetFolder); for (int i = 0; i < numElementsInArray (rtasIncludePaths); ++i) - searchPaths.add (sdkFolder.getChildFile (rtasIncludePaths[i]).toUnixStyle()); + searchPaths.add (rebaseFromProjectFolderToBuildTarget (sdkFolder.getChildFile (rtasIncludePaths[i])).toUnixStyle()); } } diff --git a/extras/Jucer (experimental)/Source/Project/jucer_ProjectExporter.cpp b/extras/Jucer (experimental)/Source/Project/jucer_ProjectExporter.cpp index e8ffc113eb..434270a685 100644 --- a/extras/Jucer (experimental)/Source/Project/jucer_ProjectExporter.cpp +++ b/extras/Jucer (experimental)/Source/Project/jucer_ProjectExporter.cpp @@ -140,8 +140,12 @@ const String ProjectExporter::getIncludePathForFileInJuceFolder (const String& p const RelativePath ProjectExporter::getJucePathFromTargetFolder() const { - RelativePath juceFolder (getJuceFolder().toString(), RelativePath::projectFolder); - return juceFolder.rebased (project.getFile().getParentDirectory(), getTargetFolder(), RelativePath::buildTargetFolder); + return rebaseFromProjectFolderToBuildTarget (RelativePath (getJuceFolder().toString(), RelativePath::projectFolder)); +} + +const RelativePath ProjectExporter::rebaseFromProjectFolderToBuildTarget (const RelativePath& path) const +{ + return path.rebased (project.getFile().getParentDirectory(), getTargetFolder(), RelativePath::buildTargetFolder); } bool ProjectExporter::shouldFileBeCompiledByDefault (const RelativePath& file) const diff --git a/extras/Jucer (experimental)/Source/Project/jucer_ProjectExporter.h b/extras/Jucer (experimental)/Source/Project/jucer_ProjectExporter.h index 78f53a6be0..0a7eaa43ff 100644 --- a/extras/Jucer (experimental)/Source/Project/jucer_ProjectExporter.h +++ b/extras/Jucer (experimental)/Source/Project/jucer_ProjectExporter.h @@ -90,6 +90,7 @@ public: } Array juceWrapperFiles; + RelativePath juceWrapperFolder; protected: //============================================================================== @@ -112,6 +113,8 @@ protected: return name; } + const RelativePath rebaseFromProjectFolderToBuildTarget (const RelativePath& path) const; + private: ProjectExporter (const ProjectExporter&); ProjectExporter& operator= (const ProjectExporter&); diff --git a/extras/Jucer (experimental)/Source/Project/jucer_ProjectSaver.h b/extras/Jucer (experimental)/Source/Project/jucer_ProjectSaver.h index c20d5d4efd..83ca5ac789 100644 --- a/extras/Jucer (experimental)/Source/Project/jucer_ProjectSaver.h +++ b/extras/Jucer (experimental)/Source/Project/jucer_ProjectSaver.h @@ -483,6 +483,8 @@ private: if (targetFolder.createDirectory()) { + exporter->juceWrapperFolder = RelativePath (project.getWrapperFolder(), targetFolder, RelativePath::buildTargetFolder); + if (hasAppConfigFile) exporter->juceWrapperFiles.add (RelativePath (appConfigFile, targetFolder, RelativePath::buildTargetFolder)); diff --git a/extras/Jucer (experimental)/Source/Utility/jucer_CodeHelpers.cpp b/extras/Jucer (experimental)/Source/Utility/jucer_CodeHelpers.cpp index be0afcc5c3..fa5340be18 100644 --- a/extras/Jucer (experimental)/Source/Utility/jucer_CodeHelpers.cpp +++ b/extras/Jucer (experimental)/Source/Utility/jucer_CodeHelpers.cpp @@ -238,6 +238,29 @@ namespace CodeHelpers return s; } + const String alignFunctionCallParams (const String& call, const StringArray& parameters, const int maxLineLength) + { + String result, currentLine (call); + + for (int i = 0; i < parameters.size(); ++i) + { + if (currentLine.length() >= maxLineLength) + { + result += currentLine.trimEnd() + newLine; + currentLine = String::repeatedString (" ", call.length()) + parameters[i]; + } + else + { + currentLine += parameters[i]; + } + + if (i < parameters.size() - 1) + currentLine << ", "; + } + + return result + currentLine.trimEnd() + ")"; + } + const String colourToCode (const Colour& col) { const Colour colours[] = @@ -333,6 +356,14 @@ namespace CodeHelpers return "(float) (" + expression + ")"; } + const String castToInt (const String& expression) + { + if (expression.containsOnly ("0123456789.")) + return String ((int) expression.getFloatValue()); + + return "(int) (" + expression + ")"; + } + void writeDataAsCppLiteral (const MemoryBlock& mb, OutputStream& out) { const int maxCharsOnLine = 250; diff --git a/extras/Jucer (experimental)/Source/Utility/jucer_CodeHelpers.h b/extras/Jucer (experimental)/Source/Utility/jucer_CodeHelpers.h index 91965b815a..797389a2bf 100644 --- a/extras/Jucer (experimental)/Source/Utility/jucer_CodeHelpers.h +++ b/extras/Jucer (experimental)/Source/Utility/jucer_CodeHelpers.h @@ -44,7 +44,9 @@ namespace CodeHelpers const String colourToCode (const Colour& col); const String justificationToCode (const Justification& justification); const String castToFloat (const String& expression); + const String castToInt (const String& expression); const String fontToCode (const Font& font); + const String alignFunctionCallParams (const String& call, const StringArray& parameters, int maxLineLength); void writeDataAsCppLiteral (const MemoryBlock& data, OutputStream& out); diff --git a/extras/audio plugin host/Builds/Linux/Makefile b/extras/audio plugin host/Builds/Linux/Makefile index 0f53ccc4d0..83f884b755 100644 --- a/extras/audio plugin host/Builds/Linux/Makefile +++ b/extras/audio plugin host/Builds/Linux/Makefile @@ -17,12 +17,12 @@ ifeq ($(CONFIG),Debug) LIBDIR := build OBJDIR := build/intermediate/Debug OUTDIR := build - CPPFLAGS := $(DEPFLAGS) -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" + CPPFLAGS := $(DEPFLAGS) -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "~/SDKs/vstsdk2.4" -I "/usr/include" -I "/usr/include/freetype2" CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 CXXFLAGS += $(CFLAGS) LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L"/usr/X11R6/lib/" -L"../../../../../juce/bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound LDDEPS := - RESFLAGS := -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" + RESFLAGS := -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "~/SDKs/vstsdk2.4" -I "/usr/include" -I "/usr/include/freetype2" TARGET := Plugin\ Host BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH) endif @@ -32,12 +32,12 @@ ifeq ($(CONFIG),Release) LIBDIR := build OBJDIR := build/intermediate/Release OUTDIR := build - CPPFLAGS := $(DEPFLAGS) -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "LINUX=1" -D "NDEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" + CPPFLAGS := $(DEPFLAGS) -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "LINUX=1" -D "NDEBUG=1" -I "~/SDKs/vstsdk2.4" -I "/usr/include" -I "/usr/include/freetype2" CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -Os CXXFLAGS += $(CFLAGS) LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L"/usr/X11R6/lib/" -L"../../../../../juce/bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound LDDEPS := - RESFLAGS := -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "LINUX=1" -D "NDEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" + RESFLAGS := -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "LINUX=1" -D "NDEBUG=1" -I "~/SDKs/vstsdk2.4" -I "/usr/include" -I "/usr/include/freetype2" TARGET := Plugin\ Host BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH) endif diff --git a/extras/the jucer/build/linux/Jucer.make b/extras/the jucer/build/linux/Jucer.make index 4c1a2357bc..35a473b2a1 100644 --- a/extras/the jucer/build/linux/Jucer.make +++ b/extras/the jucer/build/linux/Jucer.make @@ -14,7 +14,7 @@ ifeq ($(CONFIG),Debug) OBJDIR := build/intermediate/Debug OUTDIR := build CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" - CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -D_DEBUG -ggdb + CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -march=native -D_DEBUG -ggdb CXXFLAGS += $(CFLAGS) LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -mwindows -L"/usr/X11R6/lib/" -L"../../../../bin" -lfreetype -lpthread -lX11 -lGL -lGLU -lXinerama -lasound LDDEPS := @@ -29,7 +29,7 @@ ifeq ($(CONFIG),Release) OBJDIR := build/intermediate/Release OUTDIR := build CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" - CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -O2 + CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -O2 -march=native CXXFLAGS += $(CFLAGS) LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -mwindows -s -L"/usr/X11R6/lib/" -L"../../../../bin" -lfreetype -lpthread -lX11 -lGL -lGLU -lXinerama -lasound LDDEPS := @@ -40,38 +40,38 @@ endif OBJECTS := \ $(OBJDIR)/BinaryData.o \ - $(OBJDIR)/jucer_Main.o \ $(OBJDIR)/juce_LibrarySource.o \ - $(OBJDIR)/jucer_ComponentLayoutEditor.o \ - $(OBJDIR)/jucer_ComponentLayoutPanel.o \ - $(OBJDIR)/jucer_ComponentOverlayComponent.o \ - $(OBJDIR)/jucer_EditingPanelBase.o \ - $(OBJDIR)/jucer_JucerDocumentHolder.o \ + $(OBJDIR)/jucer_Main.o \ $(OBJDIR)/jucer_MainWindow.o \ - $(OBJDIR)/jucer_PaintRoutineEditor.o \ - $(OBJDIR)/jucer_PaintRoutinePanel.o \ $(OBJDIR)/jucer_PrefsPanel.o \ - $(OBJDIR)/jucer_ResourceEditorPanel.o \ + $(OBJDIR)/jucer_PaintRoutinePanel.o \ $(OBJDIR)/jucer_SnapGridPainter.o \ $(OBJDIR)/jucer_TestComponent.o \ + $(OBJDIR)/jucer_EditingPanelBase.o \ + $(OBJDIR)/jucer_ResourceEditorPanel.o \ + $(OBJDIR)/jucer_ComponentOverlayComponent.o \ + $(OBJDIR)/jucer_JucerDocumentHolder.o \ + $(OBJDIR)/jucer_ComponentLayoutPanel.o \ + $(OBJDIR)/jucer_ComponentLayoutEditor.o \ + $(OBJDIR)/jucer_PaintRoutineEditor.o \ $(OBJDIR)/jucer_StoredSettings.o \ $(OBJDIR)/jucer_UtilityFunctions.o \ $(OBJDIR)/jucer_FilePropertyComponent.o \ $(OBJDIR)/jucer_FontPropertyComponent.o \ - $(OBJDIR)/jucer_ComponentLayout.o \ - $(OBJDIR)/jucer_BinaryResources.o \ $(OBJDIR)/jucer_ObjectTypes.o \ - $(OBJDIR)/jucer_PaintRoutine.o \ - $(OBJDIR)/jucer_GeneratedCode.o \ + $(OBJDIR)/jucer_ComponentLayout.o \ $(OBJDIR)/jucer_JucerDocument.o \ + $(OBJDIR)/jucer_BinaryResources.o \ + $(OBJDIR)/jucer_GeneratedCode.o \ + $(OBJDIR)/jucer_PaintRoutine.o \ $(OBJDIR)/jucer_ComponentTypeHandler.o \ $(OBJDIR)/jucer_ButtonDocument.o \ $(OBJDIR)/jucer_ComponentDocument.o \ - $(OBJDIR)/jucer_ColouredElement.o \ $(OBJDIR)/jucer_PaintElement.o \ + $(OBJDIR)/jucer_ColouredElement.o \ + $(OBJDIR)/jucer_StrokeType.o \ $(OBJDIR)/jucer_FillType.o \ $(OBJDIR)/jucer_PaintElementPath.o \ - $(OBJDIR)/jucer_StrokeType.o \ MKDIR_TYPE := msdos CMD := $(subst \,\\,$(ComSpec)$(COMSPEC)) @@ -118,37 +118,12 @@ $(OBJDIR)/BinaryData.o: ../../src/BinaryData.cpp @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" -$(OBJDIR)/jucer_Main.o: ../../src/jucer_Main.cpp - -@$(CMD_MKOBJDIR) - @echo $(notdir $<) - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - $(OBJDIR)/juce_LibrarySource.o: ../../src/juce_LibrarySource.cpp -@$(CMD_MKOBJDIR) @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" -$(OBJDIR)/jucer_ComponentLayoutEditor.o: ../../src/ui/jucer_ComponentLayoutEditor.cpp - -@$(CMD_MKOBJDIR) - @echo $(notdir $<) - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - -$(OBJDIR)/jucer_ComponentLayoutPanel.o: ../../src/ui/jucer_ComponentLayoutPanel.cpp - -@$(CMD_MKOBJDIR) - @echo $(notdir $<) - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - -$(OBJDIR)/jucer_ComponentOverlayComponent.o: ../../src/ui/jucer_ComponentOverlayComponent.cpp - -@$(CMD_MKOBJDIR) - @echo $(notdir $<) - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - -$(OBJDIR)/jucer_EditingPanelBase.o: ../../src/ui/jucer_EditingPanelBase.cpp - -@$(CMD_MKOBJDIR) - @echo $(notdir $<) - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - -$(OBJDIR)/jucer_JucerDocumentHolder.o: ../../src/ui/jucer_JucerDocumentHolder.cpp +$(OBJDIR)/jucer_Main.o: ../../src/jucer_Main.cpp -@$(CMD_MKOBJDIR) @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" @@ -158,22 +133,12 @@ $(OBJDIR)/jucer_MainWindow.o: ../../src/ui/jucer_MainWindow.cpp @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" -$(OBJDIR)/jucer_PaintRoutineEditor.o: ../../src/ui/jucer_PaintRoutineEditor.cpp - -@$(CMD_MKOBJDIR) - @echo $(notdir $<) - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - -$(OBJDIR)/jucer_PaintRoutinePanel.o: ../../src/ui/jucer_PaintRoutinePanel.cpp - -@$(CMD_MKOBJDIR) - @echo $(notdir $<) - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - $(OBJDIR)/jucer_PrefsPanel.o: ../../src/ui/jucer_PrefsPanel.cpp -@$(CMD_MKOBJDIR) @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" -$(OBJDIR)/jucer_ResourceEditorPanel.o: ../../src/ui/jucer_ResourceEditorPanel.cpp +$(OBJDIR)/jucer_PaintRoutinePanel.o: ../../src/ui/jucer_PaintRoutinePanel.cpp -@$(CMD_MKOBJDIR) @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" @@ -188,6 +153,41 @@ $(OBJDIR)/jucer_TestComponent.o: ../../src/ui/jucer_TestComponent.cpp @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" +$(OBJDIR)/jucer_EditingPanelBase.o: ../../src/ui/jucer_EditingPanelBase.cpp + -@$(CMD_MKOBJDIR) + @echo $(notdir $<) + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + +$(OBJDIR)/jucer_ResourceEditorPanel.o: ../../src/ui/jucer_ResourceEditorPanel.cpp + -@$(CMD_MKOBJDIR) + @echo $(notdir $<) + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + +$(OBJDIR)/jucer_ComponentOverlayComponent.o: ../../src/ui/jucer_ComponentOverlayComponent.cpp + -@$(CMD_MKOBJDIR) + @echo $(notdir $<) + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + +$(OBJDIR)/jucer_JucerDocumentHolder.o: ../../src/ui/jucer_JucerDocumentHolder.cpp + -@$(CMD_MKOBJDIR) + @echo $(notdir $<) + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + +$(OBJDIR)/jucer_ComponentLayoutPanel.o: ../../src/ui/jucer_ComponentLayoutPanel.cpp + -@$(CMD_MKOBJDIR) + @echo $(notdir $<) + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + +$(OBJDIR)/jucer_ComponentLayoutEditor.o: ../../src/ui/jucer_ComponentLayoutEditor.cpp + -@$(CMD_MKOBJDIR) + @echo $(notdir $<) + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + +$(OBJDIR)/jucer_PaintRoutineEditor.o: ../../src/ui/jucer_PaintRoutineEditor.cpp + -@$(CMD_MKOBJDIR) + @echo $(notdir $<) + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + $(OBJDIR)/jucer_StoredSettings.o: ../../src/utility/jucer_StoredSettings.cpp -@$(CMD_MKOBJDIR) @echo $(notdir $<) @@ -208,32 +208,32 @@ $(OBJDIR)/jucer_FontPropertyComponent.o: ../../src/properties/jucer_FontProperty @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" +$(OBJDIR)/jucer_ObjectTypes.o: ../../src/model/jucer_ObjectTypes.cpp + -@$(CMD_MKOBJDIR) + @echo $(notdir $<) + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + $(OBJDIR)/jucer_ComponentLayout.o: ../../src/model/jucer_ComponentLayout.cpp -@$(CMD_MKOBJDIR) @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" +$(OBJDIR)/jucer_JucerDocument.o: ../../src/model/jucer_JucerDocument.cpp + -@$(CMD_MKOBJDIR) + @echo $(notdir $<) + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + $(OBJDIR)/jucer_BinaryResources.o: ../../src/model/jucer_BinaryResources.cpp -@$(CMD_MKOBJDIR) @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" -$(OBJDIR)/jucer_ObjectTypes.o: ../../src/model/jucer_ObjectTypes.cpp - -@$(CMD_MKOBJDIR) - @echo $(notdir $<) - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - -$(OBJDIR)/jucer_PaintRoutine.o: ../../src/model/jucer_PaintRoutine.cpp - -@$(CMD_MKOBJDIR) - @echo $(notdir $<) - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - $(OBJDIR)/jucer_GeneratedCode.o: ../../src/model/jucer_GeneratedCode.cpp -@$(CMD_MKOBJDIR) @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" -$(OBJDIR)/jucer_JucerDocument.o: ../../src/model/jucer_JucerDocument.cpp +$(OBJDIR)/jucer_PaintRoutine.o: ../../src/model/jucer_PaintRoutine.cpp -@$(CMD_MKOBJDIR) @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" @@ -253,12 +253,17 @@ $(OBJDIR)/jucer_ComponentDocument.o: ../../src/model/documents/jucer_ComponentDo @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" +$(OBJDIR)/jucer_PaintElement.o: ../../src/model/paintelements/jucer_PaintElement.cpp + -@$(CMD_MKOBJDIR) + @echo $(notdir $<) + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + $(OBJDIR)/jucer_ColouredElement.o: ../../src/model/paintelements/jucer_ColouredElement.cpp -@$(CMD_MKOBJDIR) @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" -$(OBJDIR)/jucer_PaintElement.o: ../../src/model/paintelements/jucer_PaintElement.cpp +$(OBJDIR)/jucer_StrokeType.o: ../../src/model/paintelements/jucer_StrokeType.cpp -@$(CMD_MKOBJDIR) @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" @@ -273,10 +278,5 @@ $(OBJDIR)/jucer_PaintElementPath.o: ../../src/model/paintelements/jucer_PaintEle @echo $(notdir $<) @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" -$(OBJDIR)/jucer_StrokeType.o: ../../src/model/paintelements/jucer_StrokeType.cpp - -@$(CMD_MKOBJDIR) - @echo $(notdir $<) - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - -include $(OBJECTS:%.o=%.d) diff --git a/extras/the jucer/build/linux/jucer_premake.lua b/extras/the jucer/build/linux/jucer_premake.lua index 3caf9b3dfa..09ef281d4c 100644 --- a/extras/the jucer/build/linux/jucer_premake.lua +++ b/extras/the jucer/build/linux/jucer_premake.lua @@ -60,3 +60,5 @@ package.files = { matchfiles ( "../../src/model/paintelements/*.cpp" ) } + +package.buildoptions = { "-march=native" } \ No newline at end of file diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index e339682423..73891c17ce 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -4620,7 +4620,7 @@ public: Term* clone() const { return new Symbol (mainSymbol, member); } int getNumInputs() const { return 0; } Term* getInput (int) const { return 0; } - const String getFunctionName() const { return toString(); } + const String getSymbolName() const { return toString(); } const String toString() const { @@ -7846,6 +7846,138 @@ const File File::createTempFile (const String& fileNameEnding) return tempFile; } +#if JUCE_UNIT_TESTS + +class FileTests : public UnitTest +{ +public: + FileTests() : UnitTest ("Files") {} + + void runTest() + { + beginTest ("Reading"); + + const File home (File::getSpecialLocation (File::userHomeDirectory)); + const File temp (File::getSpecialLocation (File::tempDirectory)); + + expect (! File::nonexistent.exists()); + expect (home.isDirectory()); + expect (home.exists()); + expect (! home.existsAsFile()); + expect (File::getSpecialLocation (File::userDocumentsDirectory).isDirectory()); + expect (File::getSpecialLocation (File::userApplicationDataDirectory).isDirectory()); + expect (File::getSpecialLocation (File::currentExecutableFile).exists()); + expect (File::getSpecialLocation (File::currentApplicationFile).exists()); + expect (File::getSpecialLocation (File::invokedExecutableFile).exists()); + expect (home.getVolumeTotalSize() > 1024 * 1024); + expect (home.getBytesFreeOnVolume() > 0); + expect (! home.isHidden()); + expect (home.isOnHardDisk()); + expect (! home.isOnCDRomDrive()); + expect (File::getCurrentWorkingDirectory().exists()); + expect (home.setAsCurrentWorkingDirectory()); + expect (File::getCurrentWorkingDirectory() == home); + + { + Array roots; + File::findFileSystemRoots (roots); + expect (roots.size() > 0); + + for (int i = 0; i < roots.size(); ++i) + expect (roots[i].exists()); + } + + beginTest ("Writing"); + + File demoFolder (temp.getChildFile ("Juce UnitTests Temp Folder")); + expect (demoFolder.deleteRecursively()); + expect (demoFolder.createDirectory()); + expect (demoFolder.isDirectory()); + expect (demoFolder.getParentDirectory() == temp); + expect (temp.isDirectory()); + + { + Array files; + temp.findChildFiles (files, File::findFilesAndDirectories, false, "*"); + expect (files.contains (demoFolder)); + } + + { + Array files; + temp.findChildFiles (files, File::findDirectories, false, "*"); + expect (files.contains (demoFolder)); + } + + File tempFile (demoFolder.getNonexistentChildFile ("test", ".txt", false)); + + expect (tempFile.getFileExtension() == ".txt"); + expect (tempFile.hasFileExtension (".txt")); + expect (tempFile.hasFileExtension ("txt")); + expect (tempFile.withFileExtension ("xyz").hasFileExtension (".xyz")); + expect (tempFile.getSiblingFile ("foo").isAChildOf (temp)); + expect (tempFile.hasWriteAccess()); + + { + FileOutputStream fo (tempFile); + fo.write ("0123456789", 10); + } + + expect (tempFile.exists()); + expect (tempFile.getSize() == 10); + expect (std::abs (tempFile.getLastModificationTime().toMilliseconds() - Time::getCurrentTime().toMilliseconds()) < 3000); + expect (tempFile.loadFileAsString() == "0123456789"); + expect (! demoFolder.containsSubDirectories()); + + expect (demoFolder.getNumberOfChildFiles (File::findFiles) == 1); + expect (demoFolder.getNumberOfChildFiles (File::findFilesAndDirectories) == 1); + expect (demoFolder.getNumberOfChildFiles (File::findDirectories) == 0); + demoFolder.getNonexistentChildFile ("tempFolder", "", false).createDirectory(); + expect (demoFolder.getNumberOfChildFiles (File::findDirectories) == 1); + expect (demoFolder.getNumberOfChildFiles (File::findFilesAndDirectories) == 2); + expect (demoFolder.containsSubDirectories()); + + expect (tempFile.hasWriteAccess()); + tempFile.setReadOnly (true); + expect (! tempFile.hasWriteAccess()); + tempFile.setReadOnly (false); + expect (tempFile.hasWriteAccess()); + + Time t (Time::getCurrentTime()); + tempFile.setLastModificationTime (t); + Time t2 = tempFile.getLastModificationTime(); + expect (std::abs (t2.toMilliseconds() - t.toMilliseconds()) <= 1000); + + { + MemoryBlock mb; + tempFile.loadFileAsData (mb); + expect (mb.getSize() == 10); + expect (mb[0] == '0'); + } + + expect (tempFile.appendData ("abcdefghij", 10)); + expect (tempFile.getSize() == 20); + expect (tempFile.replaceWithData ("abcdefghij", 10)); + expect (tempFile.getSize() == 10); + + File tempFile2 (tempFile.getNonexistentSibling (false)); + expect (tempFile.copyFileTo (tempFile2)); + expect (tempFile2.exists()); + expect (tempFile2.hasIdenticalContentTo (tempFile)); + expect (tempFile.deleteFile()); + expect (! tempFile.exists()); + expect (tempFile2.moveFileTo (tempFile)); + expect (tempFile.exists()); + expect (! tempFile2.exists()); + + expect (demoFolder.deleteRecursively()); + expect (! demoFolder.exists()); + } +}; + +static FileTests fileUnitTests; + +#endif + END_JUCE_NAMESPACE /*** End of inlined file: juce_File.cpp ***/ @@ -92139,12 +92271,6 @@ void Path::addRectangle (const float x, const float y, data.elements [numElements++] = closeSubPathMarker; } -void Path::addRectangle (const Rectangle& rectangle) -{ - addRectangle ((float) rectangle.getX(), (float) rectangle.getY(), - (float) rectangle.getWidth(), (float) rectangle.getHeight()); -} - void Path::addRoundedRectangle (const float x, const float y, const float w, const float h, float csx, @@ -93243,32 +93369,12 @@ void Path::restoreFromString (const String& stringVersion) switch (marker) { - case 'm': - startNewSubPath (values[0], values[1]); - break; - - case 'l': - lineTo (values[0], values[1]); - break; - - case 'q': - quadraticTo (values[0], values[1], - values[2], values[3]); - break; - - case 'c': - cubicTo (values[0], values[1], - values[2], values[3], - values[4], values[5]); - break; - - case 'z': - closeSubPath(); - break; - - default: - jassertfalse; // illegal string format? - break; + case 'm': startNewSubPath (values[0], values[1]); break; + case 'l': lineTo (values[0], values[1]); break; + case 'q': quadraticTo (values[0], values[1], values[2], values[3]); break; + case 'c': cubicTo (values[0], values[1], values[2], values[3], values[4], values[5]); break; + case 'z': closeSubPath(); break; + default: jassertfalse; break; // illegal string format? } } } diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 52f96a6b5b..113a9285ba 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -64,7 +64,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 52 -#define JUCE_BUILDNUMBER 62 +#define JUCE_BUILDNUMBER 63 /** Current Juce version number. @@ -6619,7 +6619,7 @@ public: const Expression operator* (const Expression& other) const; /** Returns an expression which is a division operation of two existing expressions. */ const Expression operator/ (const Expression& other) const; - /** Returns an expression which is a negation operation of two existing expressions. */ + /** Returns an expression which performs a negation operation on an existing expression. */ const Expression operator-() const; /** Returns an Expression which is an identifier reference. */ @@ -20807,6 +20807,16 @@ public: if (h < 0) h = -h; } + /** Creates a Rectangle from a set of left, right, top, bottom coordinates. + The right and bottom values must be larger than the left and top ones, or the resulting + rectangle will have a negative size. + */ + static const Rectangle leftTopRightBottom (const ValueType left, const ValueType top, + const ValueType right, const ValueType bottom) throw() + { + return Rectangle (left, top, right - left, bottom - top); + } + Rectangle& operator= (const Rectangle& other) throw() { x = other.x; y = other.y; @@ -21847,7 +21857,12 @@ public: @see addRoundedRectangle, addTriangle */ - void addRectangle (const Rectangle& rectangle); + template + void addRectangle (const Rectangle& rectangle) + { + addRectangle (static_cast (rectangle.getX()), static_cast (rectangle.getY()), + static_cast (rectangle.getWidth()), static_cast (rectangle.getHeight())); + } /** Adds a rectangle with rounded corners to the path. diff --git a/src/containers/juce_Expression.cpp b/src/containers/juce_Expression.cpp index 54f7425dfa..72e2eceb1e 100644 --- a/src/containers/juce_Expression.cpp +++ b/src/containers/juce_Expression.cpp @@ -100,7 +100,7 @@ public: Term* clone() const { return new Symbol (mainSymbol, member); } int getNumInputs() const { return 0; } Term* getInput (int) const { return 0; } - const String getFunctionName() const { return toString(); } + const String getSymbolName() const { return toString(); } const String toString() const { diff --git a/src/containers/juce_Expression.h b/src/containers/juce_Expression.h index e573209636..01fa87ac52 100644 --- a/src/containers/juce_Expression.h +++ b/src/containers/juce_Expression.h @@ -82,7 +82,7 @@ public: const Expression operator* (const Expression& other) const; /** Returns an expression which is a division operation of two existing expressions. */ const Expression operator/ (const Expression& other) const; - /** Returns an expression which is a negation operation of two existing expressions. */ + /** Returns an expression which performs a negation operation on an existing expression. */ const Expression operator-() const; /** Returns an Expression which is an identifier reference. */ diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h index f7eaf874bb..f068e76114 100644 --- a/src/core/juce_StandardHeader.h +++ b/src/core/juce_StandardHeader.h @@ -33,7 +33,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 52 -#define JUCE_BUILDNUMBER 62 +#define JUCE_BUILDNUMBER 63 /** Current Juce version number. diff --git a/src/gui/graphics/geometry/juce_Path.cpp b/src/gui/graphics/geometry/juce_Path.cpp index f35cdd5a14..2307c210dd 100644 --- a/src/gui/graphics/geometry/juce_Path.cpp +++ b/src/gui/graphics/geometry/juce_Path.cpp @@ -397,12 +397,6 @@ void Path::addRectangle (const float x, const float y, data.elements [numElements++] = closeSubPathMarker; } -void Path::addRectangle (const Rectangle& rectangle) -{ - addRectangle ((float) rectangle.getX(), (float) rectangle.getY(), - (float) rectangle.getWidth(), (float) rectangle.getHeight()); -} - void Path::addRoundedRectangle (const float x, const float y, const float w, const float h, float csx, @@ -1508,32 +1502,12 @@ void Path::restoreFromString (const String& stringVersion) switch (marker) { - case 'm': - startNewSubPath (values[0], values[1]); - break; - - case 'l': - lineTo (values[0], values[1]); - break; - - case 'q': - quadraticTo (values[0], values[1], - values[2], values[3]); - break; - - case 'c': - cubicTo (values[0], values[1], - values[2], values[3], - values[4], values[5]); - break; - - case 'z': - closeSubPath(); - break; - - default: - jassertfalse; // illegal string format? - break; + case 'm': startNewSubPath (values[0], values[1]); break; + case 'l': lineTo (values[0], values[1]); break; + case 'q': quadraticTo (values[0], values[1], values[2], values[3]); break; + case 'c': cubicTo (values[0], values[1], values[2], values[3], values[4], values[5]); break; + case 'z': closeSubPath(); break; + default: jassertfalse; break; // illegal string format? } } } diff --git a/src/gui/graphics/geometry/juce_Path.h b/src/gui/graphics/geometry/juce_Path.h index 3612af289a..a16754f625 100644 --- a/src/gui/graphics/geometry/juce_Path.h +++ b/src/gui/graphics/geometry/juce_Path.h @@ -322,7 +322,12 @@ public: @see addRoundedRectangle, addTriangle */ - void addRectangle (const Rectangle& rectangle); + template + void addRectangle (const Rectangle& rectangle) + { + addRectangle (static_cast (rectangle.getX()), static_cast (rectangle.getY()), + static_cast (rectangle.getWidth()), static_cast (rectangle.getHeight())); + } /** Adds a rectangle with rounded corners to the path. diff --git a/src/gui/graphics/geometry/juce_Rectangle.h b/src/gui/graphics/geometry/juce_Rectangle.h index 7a5820e8ec..e9d9b3a98c 100644 --- a/src/gui/graphics/geometry/juce_Rectangle.h +++ b/src/gui/graphics/geometry/juce_Rectangle.h @@ -83,6 +83,16 @@ public: if (h < 0) h = -h; } + /** Creates a Rectangle from a set of left, right, top, bottom coordinates. + The right and bottom values must be larger than the left and top ones, or the resulting + rectangle will have a negative size. + */ + static const Rectangle leftTopRightBottom (const ValueType left, const ValueType top, + const ValueType right, const ValueType bottom) throw() + { + return Rectangle (left, top, right - left, bottom - top); + } + Rectangle& operator= (const Rectangle& other) throw() { x = other.x; y = other.y; diff --git a/src/io/files/juce_File.cpp b/src/io/files/juce_File.cpp index bb321af780..46fce40b6c 100644 --- a/src/io/files/juce_File.cpp +++ b/src/io/files/juce_File.cpp @@ -922,5 +922,139 @@ const File File::createTempFile (const String& fileNameEnding) return tempFile; } +#if JUCE_UNIT_TESTS + +#include "../../utilities/juce_UnitTest.h" +#include "../../core/juce_Random.h" + +class FileTests : public UnitTest +{ +public: + FileTests() : UnitTest ("Files") {} + + void runTest() + { + beginTest ("Reading"); + + const File home (File::getSpecialLocation (File::userHomeDirectory)); + const File temp (File::getSpecialLocation (File::tempDirectory)); + + expect (! File::nonexistent.exists()); + expect (home.isDirectory()); + expect (home.exists()); + expect (! home.existsAsFile()); + expect (File::getSpecialLocation (File::userDocumentsDirectory).isDirectory()); + expect (File::getSpecialLocation (File::userApplicationDataDirectory).isDirectory()); + expect (File::getSpecialLocation (File::currentExecutableFile).exists()); + expect (File::getSpecialLocation (File::currentApplicationFile).exists()); + expect (File::getSpecialLocation (File::invokedExecutableFile).exists()); + expect (home.getVolumeTotalSize() > 1024 * 1024); + expect (home.getBytesFreeOnVolume() > 0); + expect (! home.isHidden()); + expect (home.isOnHardDisk()); + expect (! home.isOnCDRomDrive()); + expect (File::getCurrentWorkingDirectory().exists()); + expect (home.setAsCurrentWorkingDirectory()); + expect (File::getCurrentWorkingDirectory() == home); + + { + Array roots; + File::findFileSystemRoots (roots); + expect (roots.size() > 0); + + for (int i = 0; i < roots.size(); ++i) + expect (roots[i].exists()); + } + + beginTest ("Writing"); + + File demoFolder (temp.getChildFile ("Juce UnitTests Temp Folder")); + expect (demoFolder.deleteRecursively()); + expect (demoFolder.createDirectory()); + expect (demoFolder.isDirectory()); + expect (demoFolder.getParentDirectory() == temp); + expect (temp.isDirectory()); + + { + Array files; + temp.findChildFiles (files, File::findFilesAndDirectories, false, "*"); + expect (files.contains (demoFolder)); + } + + { + Array files; + temp.findChildFiles (files, File::findDirectories, false, "*"); + expect (files.contains (demoFolder)); + } + + File tempFile (demoFolder.getNonexistentChildFile ("test", ".txt", false)); + + expect (tempFile.getFileExtension() == ".txt"); + expect (tempFile.hasFileExtension (".txt")); + expect (tempFile.hasFileExtension ("txt")); + expect (tempFile.withFileExtension ("xyz").hasFileExtension (".xyz")); + expect (tempFile.getSiblingFile ("foo").isAChildOf (temp)); + expect (tempFile.hasWriteAccess()); + + { + FileOutputStream fo (tempFile); + fo.write ("0123456789", 10); + } + + expect (tempFile.exists()); + expect (tempFile.getSize() == 10); + expect (std::abs (tempFile.getLastModificationTime().toMilliseconds() - Time::getCurrentTime().toMilliseconds()) < 3000); + expect (tempFile.loadFileAsString() == "0123456789"); + expect (! demoFolder.containsSubDirectories()); + + expect (demoFolder.getNumberOfChildFiles (File::findFiles) == 1); + expect (demoFolder.getNumberOfChildFiles (File::findFilesAndDirectories) == 1); + expect (demoFolder.getNumberOfChildFiles (File::findDirectories) == 0); + demoFolder.getNonexistentChildFile ("tempFolder", "", false).createDirectory(); + expect (demoFolder.getNumberOfChildFiles (File::findDirectories) == 1); + expect (demoFolder.getNumberOfChildFiles (File::findFilesAndDirectories) == 2); + expect (demoFolder.containsSubDirectories()); + + expect (tempFile.hasWriteAccess()); + tempFile.setReadOnly (true); + expect (! tempFile.hasWriteAccess()); + tempFile.setReadOnly (false); + expect (tempFile.hasWriteAccess()); + + Time t (Time::getCurrentTime()); + tempFile.setLastModificationTime (t); + Time t2 = tempFile.getLastModificationTime(); + expect (std::abs (t2.toMilliseconds() - t.toMilliseconds()) <= 1000); + + { + MemoryBlock mb; + tempFile.loadFileAsData (mb); + expect (mb.getSize() == 10); + expect (mb[0] == '0'); + } + + expect (tempFile.appendData ("abcdefghij", 10)); + expect (tempFile.getSize() == 20); + expect (tempFile.replaceWithData ("abcdefghij", 10)); + expect (tempFile.getSize() == 10); + + File tempFile2 (tempFile.getNonexistentSibling (false)); + expect (tempFile.copyFileTo (tempFile2)); + expect (tempFile2.exists()); + expect (tempFile2.hasIdenticalContentTo (tempFile)); + expect (tempFile.deleteFile()); + expect (! tempFile.exists()); + expect (tempFile2.moveFileTo (tempFile)); + expect (tempFile.exists()); + expect (! tempFile2.exists()); + + expect (demoFolder.deleteRecursively()); + expect (! demoFolder.exists()); + } +}; + +static FileTests fileUnitTests; + +#endif END_JUCE_NAMESPACE