| @@ -12,7 +12,7 @@ ifeq ($(CONFIG),Debug) | |||
| BINDIR := build | |||
| LIBDIR := build | |||
| OBJDIR := build/intermediate/Debug | |||
| OUTDIR := build | |||
| OUTDIR := ../../bin | |||
| CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I "/usr/include" -I "/usr/include/freetype2" | |||
| CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 | |||
| CXXFLAGS += $(CFLAGS) | |||
| @@ -27,7 +27,7 @@ ifeq ($(CONFIG),Release) | |||
| BINDIR := build | |||
| LIBDIR := build | |||
| OBJDIR := build/intermediate/Release | |||
| OUTDIR := build | |||
| OUTDIR := ../../bin | |||
| CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I "/usr/include" -I "/usr/include/freetype2" | |||
| CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -Os | |||
| CXXFLAGS += $(CFLAGS) | |||
| @@ -171,6 +171,7 @@ OBJECTS := \ | |||
| $(OBJDIR)/juce_ModifierKeys_eea16d64.o \ | |||
| $(OBJDIR)/juce_ComponentAnimator_ad5663d2.o \ | |||
| $(OBJDIR)/juce_ComponentBoundsConstrainer_a33c10ae.o \ | |||
| $(OBJDIR)/juce_ComponentBuilder_2aa6c5a.o \ | |||
| $(OBJDIR)/juce_ComponentMovementWatcher_cbb3e7cc.o \ | |||
| $(OBJDIR)/juce_GroupComponent_456e237a.o \ | |||
| $(OBJDIR)/juce_MultiDocumentPanel_50e05aac.o \ | |||
| @@ -1022,6 +1023,11 @@ $(OBJDIR)/juce_ComponentBoundsConstrainer_a33c10ae.o: ../../src/gui/components/l | |||
| @echo "Compiling juce_ComponentBoundsConstrainer.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/juce_ComponentBuilder_2aa6c5a.o: ../../src/gui/components/layout/juce_ComponentBuilder.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling juce_ComponentBuilder.cpp" | |||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||
| $(OBJDIR)/juce_ComponentMovementWatcher_cbb3e7cc.o: ../../src/gui/components/layout/juce_ComponentMovementWatcher.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| @echo "Compiling juce_ComponentMovementWatcher.cpp" | |||
| @@ -140,6 +140,7 @@ | |||
| 5FFFA4B8857D64FE36B4B125 = { isa = PBXBuildFile; fileRef = B1E8FF009812F29C2620E6BB; }; | |||
| 1D406F33F6B9FE7F92A71438 = { isa = PBXBuildFile; fileRef = 921B616E2229AEB6390D2B57; }; | |||
| 806FF2617B7CC21609927A11 = { isa = PBXBuildFile; fileRef = 07191E1A9805FA6E6F253FF6; }; | |||
| 9AA76460DA7D34CE6A69E2B1 = { isa = PBXBuildFile; fileRef = 45E5EE9E0173683D721FABDA; }; | |||
| 4E81BC4A50CF1883F529E152 = { isa = PBXBuildFile; fileRef = F8FCCCE06D31FEF697FCD80D; }; | |||
| 8FBB6BF0C5406E1BA481CFEF = { isa = PBXBuildFile; fileRef = A6AD7357F905309D1B461EB7; }; | |||
| F5F3F25D9F377128DC74D95B = { isa = PBXBuildFile; fileRef = FF046140CCF1EDB0DFF80178; }; | |||
| @@ -659,6 +660,8 @@ | |||
| FE1072B5FB77E8FEE1BEBDFE = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ComponentAnimator.h; path = ../../src/gui/components/layout/juce_ComponentAnimator.h; sourceTree = SOURCE_ROOT; }; | |||
| 07191E1A9805FA6E6F253FF6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ComponentBoundsConstrainer.cpp; path = ../../src/gui/components/layout/juce_ComponentBoundsConstrainer.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 2EC173A08676F6E592A7B347 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ComponentBoundsConstrainer.h; path = ../../src/gui/components/layout/juce_ComponentBoundsConstrainer.h; sourceTree = SOURCE_ROOT; }; | |||
| 45E5EE9E0173683D721FABDA = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ComponentBuilder.cpp; path = ../../src/gui/components/layout/juce_ComponentBuilder.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 2D3A362DD3833B9E70B10FD3 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ComponentBuilder.h; path = ../../src/gui/components/layout/juce_ComponentBuilder.h; sourceTree = SOURCE_ROOT; }; | |||
| F8FCCCE06D31FEF697FCD80D = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ComponentMovementWatcher.cpp; path = ../../src/gui/components/layout/juce_ComponentMovementWatcher.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 44CDA79090B115C3B62A2168 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ComponentMovementWatcher.h; path = ../../src/gui/components/layout/juce_ComponentMovementWatcher.h; sourceTree = SOURCE_ROOT; }; | |||
| A6AD7357F905309D1B461EB7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_GroupComponent.cpp; path = ../../src/gui/components/layout/juce_GroupComponent.cpp; sourceTree = SOURCE_ROOT; }; | |||
| @@ -1388,6 +1391,8 @@ | |||
| FE1072B5FB77E8FEE1BEBDFE, | |||
| 07191E1A9805FA6E6F253FF6, | |||
| 2EC173A08676F6E592A7B347, | |||
| 45E5EE9E0173683D721FABDA, | |||
| 2D3A362DD3833B9E70B10FD3, | |||
| F8FCCCE06D31FEF697FCD80D, | |||
| 44CDA79090B115C3B62A2168, | |||
| A6AD7357F905309D1B461EB7, | |||
| @@ -2069,6 +2074,7 @@ | |||
| 5FFFA4B8857D64FE36B4B125, | |||
| 1D406F33F6B9FE7F92A71438, | |||
| 806FF2617B7CC21609927A11, | |||
| 9AA76460DA7D34CE6A69E2B1, | |||
| 4E81BC4A50CF1883F529E152, | |||
| 8FBB6BF0C5406E1BA481CFEF, | |||
| F5F3F25D9F377128DC74D95B, | |||
| @@ -542,6 +542,8 @@ | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentAnimator.h"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentBoundsConstrainer.cpp"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentBoundsConstrainer.h"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentBuilder.cpp"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentBuilder.h"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentMovementWatcher.cpp"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentMovementWatcher.h"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_GroupComponent.cpp"/> | |||
| @@ -542,6 +542,8 @@ | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentAnimator.h"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentBoundsConstrainer.cpp"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentBoundsConstrainer.h"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentBuilder.cpp"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentBuilder.h"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentMovementWatcher.cpp"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentMovementWatcher.h"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_GroupComponent.cpp"/> | |||
| @@ -544,6 +544,8 @@ | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentAnimator.h"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentBoundsConstrainer.cpp"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentBoundsConstrainer.h"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentBuilder.cpp"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentBuilder.h"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentMovementWatcher.cpp"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_ComponentMovementWatcher.h"/> | |||
| <File RelativePath="..\..\src\gui\components\layout\juce_GroupComponent.cpp"/> | |||
| @@ -254,6 +254,7 @@ | |||
| <ClCompile Include="..\..\src\gui\components\keyboard\juce_ModifierKeys.cpp"/> | |||
| <ClCompile Include="..\..\src\gui\components\layout\juce_ComponentAnimator.cpp"/> | |||
| <ClCompile Include="..\..\src\gui\components\layout\juce_ComponentBoundsConstrainer.cpp"/> | |||
| <ClCompile Include="..\..\src\gui\components\layout\juce_ComponentBuilder.cpp"/> | |||
| <ClCompile Include="..\..\src\gui\components\layout\juce_ComponentMovementWatcher.cpp"/> | |||
| <ClCompile Include="..\..\src\gui\components\layout\juce_GroupComponent.cpp"/> | |||
| <ClCompile Include="..\..\src\gui\components\layout\juce_MultiDocumentPanel.cpp"/> | |||
| @@ -603,6 +604,7 @@ | |||
| <ClInclude Include="..\..\src\gui\components\keyboard\juce_TextInputTarget.h"/> | |||
| <ClInclude Include="..\..\src\gui\components\layout\juce_ComponentAnimator.h"/> | |||
| <ClInclude Include="..\..\src\gui\components\layout\juce_ComponentBoundsConstrainer.h"/> | |||
| <ClInclude Include="..\..\src\gui\components\layout\juce_ComponentBuilder.h"/> | |||
| <ClInclude Include="..\..\src\gui\components\layout\juce_ComponentMovementWatcher.h"/> | |||
| <ClInclude Include="..\..\src\gui\components\layout\juce_GroupComponent.h"/> | |||
| <ClInclude Include="..\..\src\gui\components\layout\juce_MultiDocumentPanel.h"/> | |||
| @@ -616,6 +616,9 @@ | |||
| <ClCompile Include="..\..\src\gui\components\layout\juce_ComponentBoundsConstrainer.cpp"> | |||
| <Filter>Juce\Source\gui\components\layout</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\src\gui\components\layout\juce_ComponentBuilder.cpp"> | |||
| <Filter>Juce\Source\gui\components\layout</Filter> | |||
| </ClCompile> | |||
| <ClCompile Include="..\..\src\gui\components\layout\juce_ComponentMovementWatcher.cpp"> | |||
| <Filter>Juce\Source\gui\components\layout</Filter> | |||
| </ClCompile> | |||
| @@ -1737,6 +1740,9 @@ | |||
| <ClInclude Include="..\..\src\gui\components\layout\juce_ComponentBoundsConstrainer.h"> | |||
| <Filter>Juce\Source\gui\components\layout</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\src\gui\components\layout\juce_ComponentBuilder.h"> | |||
| <Filter>Juce\Source\gui\components\layout</Filter> | |||
| </ClInclude> | |||
| <ClInclude Include="..\..\src\gui\components\layout\juce_ComponentMovementWatcher.h"> | |||
| <Filter>Juce\Source\gui\components\layout</Filter> | |||
| </ClInclude> | |||
| @@ -140,6 +140,7 @@ | |||
| 5FFFA4B8857D64FE36B4B125 = { isa = PBXBuildFile; fileRef = B1E8FF009812F29C2620E6BB; }; | |||
| 1D406F33F6B9FE7F92A71438 = { isa = PBXBuildFile; fileRef = 921B616E2229AEB6390D2B57; }; | |||
| 806FF2617B7CC21609927A11 = { isa = PBXBuildFile; fileRef = 07191E1A9805FA6E6F253FF6; }; | |||
| 9AA76460DA7D34CE6A69E2B1 = { isa = PBXBuildFile; fileRef = 45E5EE9E0173683D721FABDA; }; | |||
| 4E81BC4A50CF1883F529E152 = { isa = PBXBuildFile; fileRef = F8FCCCE06D31FEF697FCD80D; }; | |||
| 8FBB6BF0C5406E1BA481CFEF = { isa = PBXBuildFile; fileRef = A6AD7357F905309D1B461EB7; }; | |||
| F5F3F25D9F377128DC74D95B = { isa = PBXBuildFile; fileRef = FF046140CCF1EDB0DFF80178; }; | |||
| @@ -659,6 +660,8 @@ | |||
| FE1072B5FB77E8FEE1BEBDFE = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ComponentAnimator.h; path = ../../src/gui/components/layout/juce_ComponentAnimator.h; sourceTree = SOURCE_ROOT; }; | |||
| 07191E1A9805FA6E6F253FF6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ComponentBoundsConstrainer.cpp; path = ../../src/gui/components/layout/juce_ComponentBoundsConstrainer.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 2EC173A08676F6E592A7B347 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ComponentBoundsConstrainer.h; path = ../../src/gui/components/layout/juce_ComponentBoundsConstrainer.h; sourceTree = SOURCE_ROOT; }; | |||
| 45E5EE9E0173683D721FABDA = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ComponentBuilder.cpp; path = ../../src/gui/components/layout/juce_ComponentBuilder.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 2D3A362DD3833B9E70B10FD3 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ComponentBuilder.h; path = ../../src/gui/components/layout/juce_ComponentBuilder.h; sourceTree = SOURCE_ROOT; }; | |||
| F8FCCCE06D31FEF697FCD80D = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ComponentMovementWatcher.cpp; path = ../../src/gui/components/layout/juce_ComponentMovementWatcher.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 44CDA79090B115C3B62A2168 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ComponentMovementWatcher.h; path = ../../src/gui/components/layout/juce_ComponentMovementWatcher.h; sourceTree = SOURCE_ROOT; }; | |||
| A6AD7357F905309D1B461EB7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_GroupComponent.cpp; path = ../../src/gui/components/layout/juce_GroupComponent.cpp; sourceTree = SOURCE_ROOT; }; | |||
| @@ -1388,6 +1391,8 @@ | |||
| FE1072B5FB77E8FEE1BEBDFE, | |||
| 07191E1A9805FA6E6F253FF6, | |||
| 2EC173A08676F6E592A7B347, | |||
| 45E5EE9E0173683D721FABDA, | |||
| 2D3A362DD3833B9E70B10FD3, | |||
| F8FCCCE06D31FEF697FCD80D, | |||
| 44CDA79090B115C3B62A2168, | |||
| A6AD7357F905309D1B461EB7, | |||
| @@ -2069,6 +2074,7 @@ | |||
| 5FFFA4B8857D64FE36B4B125, | |||
| 1D406F33F6B9FE7F92A71438, | |||
| 806FF2617B7CC21609927A11, | |||
| 9AA76460DA7D34CE6A69E2B1, | |||
| 4E81BC4A50CF1883F529E152, | |||
| 8FBB6BF0C5406E1BA481CFEF, | |||
| F5F3F25D9F377128DC74D95B, | |||
| @@ -716,6 +716,10 @@ | |||
| resource="0" file="src/gui/components/layout/juce_ComponentBoundsConstrainer.cpp"/> | |||
| <FILE id="f7Kk9YmVd" name="juce_ComponentBoundsConstrainer.h" compile="0" | |||
| resource="0" file="src/gui/components/layout/juce_ComponentBoundsConstrainer.h"/> | |||
| <FILE id="0GeyNq1" name="juce_ComponentBuilder.cpp" compile="1" resource="0" | |||
| file="src/gui/components/layout/juce_ComponentBuilder.cpp"/> | |||
| <FILE id="VZuk8cB" name="juce_ComponentBuilder.h" compile="0" resource="0" | |||
| file="src/gui/components/layout/juce_ComponentBuilder.h"/> | |||
| <FILE id="nzIQyYlAT" name="juce_ComponentMovementWatcher.cpp" compile="1" | |||
| resource="0" file="src/gui/components/layout/juce_ComponentMovementWatcher.cpp"/> | |||
| <FILE id="S2Qpuktm9" name="juce_ComponentMovementWatcher.h" compile="0" | |||
| @@ -273,6 +273,7 @@ | |||
| #include "../src/gui/components/keyboard/juce_KeyPressMappingSet.cpp" | |||
| #include "../src/gui/components/keyboard/juce_ModifierKeys.cpp" | |||
| #include "../src/gui/components/layout/juce_ComponentAnimator.cpp" | |||
| #include "../src/gui/components/layout/juce_ComponentBuilder.cpp" | |||
| #include "../src/gui/components/layout/juce_ComponentBoundsConstrainer.cpp" | |||
| #include "../src/gui/components/layout/juce_ComponentMovementWatcher.cpp" | |||
| #include "../src/gui/components/layout/juce_GroupComponent.cpp" | |||
| @@ -33,6 +33,15 @@ | |||
| */ | |||
| //============================================================================== | |||
| /* This line is here just to help catch syntax errors caused by mistakes in other header | |||
| files that are included before juce.h. If you hit an error at this line, it must be some | |||
| kind of syntax problem in whatever code immediately precedes this header. | |||
| This also acts as a sanity-check in case you're trying to build with a C or obj-C compiler | |||
| rather than a proper C++ one. | |||
| */ | |||
| namespace JuceDummyNamespace {} | |||
| #define JUCE_PUBLIC_INCLUDES 1 | |||
| // (this includes things that need defining outside of the JUCE namespace) | |||
| @@ -50,6 +50,15 @@ | |||
| */ | |||
| /* This line is here just to help catch syntax errors caused by mistakes in other header | |||
| files that are included before juce.h. If you hit an error at this line, it must be some | |||
| kind of syntax problem in whatever code immediately precedes this header. | |||
| This also acts as a sanity-check in case you're trying to build with a C or obj-C compiler | |||
| rather than a proper C++ one. | |||
| */ | |||
| namespace JuceDummyNamespace {} | |||
| #define JUCE_PUBLIC_INCLUDES 1 | |||
| // (this includes things that need defining outside of the JUCE namespace) | |||
| @@ -64,7 +73,7 @@ | |||
| */ | |||
| #define JUCE_MAJOR_VERSION 1 | |||
| #define JUCE_MINOR_VERSION 53 | |||
| #define JUCE_BUILDNUMBER 1 | |||
| #define JUCE_BUILDNUMBER 2 | |||
| /** Current Juce version number. | |||
| @@ -623,15 +632,17 @@ | |||
| #endif | |||
| #ifndef DOXYGEN | |||
| BEGIN_JUCE_NAMESPACE | |||
| template <bool b> struct JuceStaticAssert; | |||
| template <> struct JuceStaticAssert <true> { static void dummy() {} }; | |||
| END_JUCE_NAMESPACE | |||
| #endif | |||
| /** A compile-time assertion macro. | |||
| If the expression parameter is false, the macro will cause a compile error. | |||
| */ | |||
| #define static_jassert(expression) JuceStaticAssert<expression>::dummy(); | |||
| #define static_jassert(expression) JUCE_NAMESPACE::JuceStaticAssert<expression>::dummy(); | |||
| /** This is a shorthand macro for declaring stubs for a class's copy constructor and | |||
| operator=. | |||
| @@ -26910,7 +26921,7 @@ public: | |||
| @see setName | |||
| */ | |||
| const String& getName() const throw() { return componentName_; } | |||
| const String& getName() const throw() { return componentName; } | |||
| /** Sets the name of this component. | |||
| @@ -27086,7 +27097,7 @@ public: | |||
| bounds will no longer be a direct reflection of the position at which it appears within | |||
| its parent, as the transform will be applied to its bounding box. | |||
| */ | |||
| inline int getX() const throw() { return bounds_.getX(); } | |||
| inline int getX() const throw() { return bounds.getX(); } | |||
| /** Returns the y coordinate of the top of this component. | |||
| This is a distance in pixels from the top edge of the component's parent. | |||
| @@ -27095,13 +27106,13 @@ public: | |||
| bounds will no longer be a direct reflection of the position at which it appears within | |||
| its parent, as the transform will be applied to its bounding box. | |||
| */ | |||
| inline int getY() const throw() { return bounds_.getY(); } | |||
| inline int getY() const throw() { return bounds.getY(); } | |||
| /** Returns the component's width in pixels. */ | |||
| inline int getWidth() const throw() { return bounds_.getWidth(); } | |||
| inline int getWidth() const throw() { return bounds.getWidth(); } | |||
| /** Returns the component's height in pixels. */ | |||
| inline int getHeight() const throw() { return bounds_.getHeight(); } | |||
| inline int getHeight() const throw() { return bounds.getHeight(); } | |||
| /** Returns the x coordinate of the component's right-hand edge. | |||
| This is a distance in pixels from the left edge of the component's parent. | |||
| @@ -27110,10 +27121,10 @@ public: | |||
| bounds will no longer be a direct reflection of the position at which it appears within | |||
| its parent, as the transform will be applied to its bounding box. | |||
| */ | |||
| int getRight() const throw() { return bounds_.getRight(); } | |||
| int getRight() const throw() { return bounds.getRight(); } | |||
| /** Returns the component's top-left position as a Point. */ | |||
| const Point<int> getPosition() const throw() { return bounds_.getPosition(); } | |||
| const Point<int> getPosition() const throw() { return bounds.getPosition(); } | |||
| /** Returns the y coordinate of the bottom edge of this component. | |||
| This is a distance in pixels from the top edge of the component's parent. | |||
| @@ -27122,7 +27133,7 @@ public: | |||
| bounds will no longer be a direct reflection of the position at which it appears within | |||
| its parent, as the transform will be applied to its bounding box. | |||
| */ | |||
| int getBottom() const throw() { return bounds_.getBottom(); } | |||
| int getBottom() const throw() { return bounds.getBottom(); } | |||
| /** Returns this component's bounding box. | |||
| The rectangle returned is relative to the top-left of the component's parent. | |||
| @@ -27131,7 +27142,7 @@ public: | |||
| bounds will no longer be a direct reflection of the position at which it appears within | |||
| its parent, as the transform will be applied to its bounding box. | |||
| */ | |||
| const Rectangle<int>& getBounds() const throw() { return bounds_; } | |||
| const Rectangle<int>& getBounds() const throw() { return bounds; } | |||
| /** Returns the component's bounds, relative to its own origin. | |||
| This is like getBounds(), but returns the rectangle in local coordinates, In practice, it'll | |||
| @@ -27510,7 +27521,7 @@ public: | |||
| If this is the highest-level component or hasn't yet been added to | |||
| a parent, this will return null. | |||
| */ | |||
| Component* getParentComponent() const throw() { return parentComponent_; } | |||
| Component* getParentComponent() const throw() { return parentComponent; } | |||
| /** Searches the parent components for a component of a specified class. | |||
| @@ -27524,14 +27535,14 @@ public: | |||
| TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const | |||
| { | |||
| (void) dummyParameter; | |||
| Component* p = parentComponent_; | |||
| Component* p = parentComponent; | |||
| while (p != 0) | |||
| { | |||
| TargetClass* target = dynamic_cast <TargetClass*> (p); | |||
| if (target != 0) | |||
| return target; | |||
| p = p->parentComponent_; | |||
| p = p->parentComponent; | |||
| } | |||
| return 0; | |||
| @@ -27820,7 +27831,7 @@ public: | |||
| @see setComponentEffect | |||
| */ | |||
| ImageEffectFilter* getComponentEffect() const throw() { return effect_; } | |||
| ImageEffectFilter* getComponentEffect() const throw() { return effect; } | |||
| /** Finds the appropriate look-and-feel to use for this component. | |||
| @@ -28851,7 +28862,7 @@ public: | |||
| WeakReference<Component> weakRef; | |||
| }; | |||
| /** A class to keep an eye on one or two components and check for them being deleted. | |||
| /** A class to keep an eye on a component and check for it being deleted. | |||
| This is designed for use with the ListenerList::callChecked() methods, to allow | |||
| the list iterator to stop cleanly if the component is deleted by a listener callback | |||
| @@ -28861,16 +28872,13 @@ public: | |||
| { | |||
| public: | |||
| /** Creates a checker that watches one component. */ | |||
| BailOutChecker (Component* component1); | |||
| /** Creates a checker that watches two components. */ | |||
| BailOutChecker (Component* component1, Component* component2); | |||
| BailOutChecker (Component* component); | |||
| /** Returns true if either of the two components have been deleted since this object was created. */ | |||
| bool shouldBailOut() const throw(); | |||
| private: | |||
| const WeakReference<Component> safePointer1, safePointer2; | |||
| const WeakReference<Component> safePointer; | |||
| JUCE_DECLARE_NON_COPYABLE (BailOutChecker); | |||
| }; | |||
| @@ -28890,28 +28898,27 @@ public: | |||
| private: | |||
| friend class ComponentPeer; | |||
| friend class InternalDragRepeater; | |||
| friend class MouseInputSource; | |||
| friend class MouseInputSourceInternal; | |||
| #ifndef DOXYGEN | |||
| static Component* currentlyFocusedComponent; | |||
| String componentName_, componentID; | |||
| Component* parentComponent_; | |||
| Rectangle<int> bounds_; | |||
| ScopedPointer <AffineTransform> affineTransform_; | |||
| Array <Component*> childComponentList_; | |||
| LookAndFeel* lookAndFeel_; | |||
| MouseCursor cursor_; | |||
| ImageEffectFilter* effect_; | |||
| Image bufferedImage_; | |||
| String componentName, componentID; | |||
| Component* parentComponent; | |||
| Rectangle<int> bounds; | |||
| ScopedPointer <AffineTransform> affineTransform; | |||
| Array <Component*> childComponentList; | |||
| LookAndFeel* lookAndFeel; | |||
| MouseCursor cursor; | |||
| ImageEffectFilter* effect; | |||
| Image bufferedImage; | |||
| class MouseListenerList; | |||
| friend class MouseListenerList; | |||
| friend class ScopedPointer <MouseListenerList>; | |||
| ScopedPointer <MouseListenerList> mouseListeners_; | |||
| ScopedPointer <Array <KeyListener*> > keyListeners_; | |||
| ScopedPointer <MouseListenerList> mouseListeners; | |||
| ScopedPointer <Array <KeyListener*> > keyListeners; | |||
| ListenerList <ComponentListener> componentListeners; | |||
| NamedValueSet properties; | |||
| @@ -28947,7 +28954,7 @@ private: | |||
| union | |||
| { | |||
| uint32 componentFlags_; | |||
| uint32 componentFlags; | |||
| ComponentFlags flags; | |||
| }; | |||
| @@ -45674,6 +45681,165 @@ public: | |||
| #endif // __JUCE_RELATIVECOORDINATE_JUCEHEADER__ | |||
| /*** End of inlined file: juce_RelativeCoordinate.h ***/ | |||
| /*** Start of inlined file: juce_ComponentBuilder.h ***/ | |||
| #ifndef __JUCE_COMPONENTBUILDER_JUCEHEADER__ | |||
| #define __JUCE_COMPONENTBUILDER_JUCEHEADER__ | |||
| /** | |||
| Loads and maintains a tree of Components from a ValueTree that represents them. | |||
| To allow the state of a tree of components to be saved as a ValueTree and re-loaded, | |||
| this class lets you register a set of type-handlers for the different components that | |||
| are involved, and then uses these types to re-create a set of components from its | |||
| stored state. | |||
| Essentially, to use this, you need to create a ComponentBuilder with your ValueTree, | |||
| then use registerTypeHandler() to give it a set of type handlers that can cope with | |||
| all the items in your tree. Then you can call getComponent() to build the component. | |||
| Once you've got the component you can either take it and delete the ComponentBuilder | |||
| object, or if you keep the ComponentBuilder around, it'll monitor any changes in the | |||
| ValueTree and automatically update the component to reflect these changes. | |||
| */ | |||
| class JUCE_API ComponentBuilder : public ValueTree::Listener | |||
| { | |||
| public: | |||
| /** | |||
| */ | |||
| explicit ComponentBuilder (const ValueTree& state); | |||
| /** Destructor. */ | |||
| ~ComponentBuilder(); | |||
| /** | |||
| */ | |||
| ValueTree& getState() throw() { return state; } | |||
| /** | |||
| */ | |||
| const ValueTree& getState() const throw() { return state; } | |||
| /** | |||
| */ | |||
| Component* getComponent(); | |||
| /** | |||
| */ | |||
| Component* getAndReleaseComponent(); | |||
| /** | |||
| */ | |||
| class JUCE_API TypeHandler | |||
| { | |||
| public: | |||
| /** | |||
| */ | |||
| explicit TypeHandler (const Identifier& valueTreeType); | |||
| /** Destructor. */ | |||
| virtual ~TypeHandler(); | |||
| /** | |||
| */ | |||
| const Identifier& getType() const throw() { return valueTreeType; } | |||
| /** | |||
| */ | |||
| virtual Component* addNewComponentFromState (const ValueTree& state, Component* parent) = 0; | |||
| /** | |||
| */ | |||
| virtual void updateComponentFromState (Component* component, const ValueTree& state) = 0; | |||
| /** | |||
| */ | |||
| ComponentBuilder* getBuilder() const throw(); | |||
| private: | |||
| friend class ComponentBuilder; | |||
| ComponentBuilder* builder; | |||
| const Identifier valueTreeType; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TypeHandler); | |||
| }; | |||
| /** | |||
| */ | |||
| void registerTypeHandler (TypeHandler* type); | |||
| /** | |||
| */ | |||
| TypeHandler* getHandlerForState (const ValueTree& state) const; | |||
| /** | |||
| */ | |||
| int getNumHandlers() const throw(); | |||
| /** | |||
| */ | |||
| TypeHandler* getHandler (int index) const throw(); | |||
| /** This class is used when loading Drawables that contain images, and retrieves | |||
| the image for a stored identifier. | |||
| @see Drawable::createFromValueTree | |||
| */ | |||
| class JUCE_API ImageProvider | |||
| { | |||
| public: | |||
| ImageProvider() {} | |||
| virtual ~ImageProvider() {} | |||
| /** Retrieves the image associated with this identifier, which could be any | |||
| kind of string, number, filename, etc. | |||
| The image that is returned will be owned by the caller, but it may come | |||
| from the ImageCache. | |||
| */ | |||
| virtual const Image getImageForIdentifier (const var& imageIdentifier) = 0; | |||
| /** Returns an identifier to be used to refer to a given image. | |||
| This is used when converting a drawable into a ValueTree, so if you're | |||
| only loading drawables, you can just return a var::null here. | |||
| */ | |||
| virtual const var getIdentifierForImage (const Image& image) = 0; | |||
| }; | |||
| /** */ | |||
| void setImageProvider (ImageProvider* newImageProvider) throw(); | |||
| /** */ | |||
| ImageProvider* getImageProvider() const throw(); | |||
| /** @internal */ | |||
| void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged, const Identifier& property); | |||
| /** @internal */ | |||
| void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged); | |||
| /** @internal */ | |||
| void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged); | |||
| /** | |||
| */ | |||
| void updateChildComponents (Component& parent, const ValueTree& children); | |||
| /** | |||
| */ | |||
| static const Identifier idProperty; | |||
| private: | |||
| ValueTree state; | |||
| OwnedArray <TypeHandler> types; | |||
| ScopedPointer<Component> component; | |||
| ImageProvider* imageProvider; | |||
| void updateComponent (const ValueTree& state); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ComponentBuilder); | |||
| }; | |||
| #endif // __JUCE_COMPONENTBUILDER_JUCEHEADER__ | |||
| /*** End of inlined file: juce_ComponentBuilder.h ***/ | |||
| class DrawableComposite; | |||
| /** | |||
| @@ -45793,54 +45959,20 @@ public: | |||
| */ | |||
| static Drawable* createFromSVG (const XmlElement& svgDocument); | |||
| /** This class is used when loading Drawables that contain images, and retrieves | |||
| the image for a stored identifier. | |||
| @see Drawable::createFromValueTree | |||
| */ | |||
| class JUCE_API ImageProvider | |||
| { | |||
| public: | |||
| ImageProvider() {} | |||
| virtual ~ImageProvider() {} | |||
| /** Retrieves the image associated with this identifier, which could be any | |||
| kind of string, number, filename, etc. | |||
| The image that is returned will be owned by the caller, but it may come | |||
| from the ImageCache. | |||
| */ | |||
| virtual const Image getImageForIdentifier (const var& imageIdentifier) = 0; | |||
| /** Returns an identifier to be used to refer to a given image. | |||
| This is used when converting a drawable into a ValueTree, so if you're | |||
| only loading drawables, you can just return a var::null here. | |||
| */ | |||
| virtual const var getIdentifierForImage (const Image& image) = 0; | |||
| }; | |||
| /** Tries to create a Drawable from a previously-saved ValueTree. | |||
| The ValueTree must have been created by the createValueTree() method. | |||
| If there are any images used within the drawable, you'll need to provide a valid | |||
| ImageProvider object that can be used to retrieve these images from whatever type | |||
| of identifier is used to represent them. | |||
| */ | |||
| static Drawable* createFromValueTree (const ValueTree& tree, ImageProvider* imageProvider); | |||
| /** Tries to refresh a Drawable from the same ValueTree that was used to create it. | |||
| @returns the damage rectangle that will need repainting due to any changes that were made. | |||
| */ | |||
| virtual void refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider) = 0; | |||
| static Drawable* createFromValueTree (const ValueTree& tree, ComponentBuilder::ImageProvider* imageProvider); | |||
| /** Creates a ValueTree to represent this Drawable. | |||
| The VarTree that is returned can be turned back into a Drawable with | |||
| createFromValueTree(). | |||
| If there are any images used in this drawable, you'll need to provide a valid | |||
| ImageProvider object that can be used to create storable representations of them. | |||
| The ValueTree that is returned can be turned back into a Drawable with createFromValueTree(). | |||
| If there are any images used in this drawable, you'll need to provide a valid ImageProvider | |||
| object that can be used to create storable representations of them. | |||
| */ | |||
| virtual const ValueTree createValueTree (ImageProvider* imageProvider) const = 0; | |||
| /** Returns the tag ID that is used for a ValueTree that stores this type of drawable. */ | |||
| virtual const Identifier getValueTreeType() const = 0; | |||
| virtual const ValueTree createValueTree (ComponentBuilder::ImageProvider* imageProvider) const = 0; | |||
| /** Returns the area that this drawble covers. | |||
| The result is expressed in this drawable's own coordinate space, and does not take | |||
| @@ -45858,19 +45990,18 @@ public: | |||
| ValueTree& getState() throw() { return state; } | |||
| const String getID() const; | |||
| void setID (const String& newID, UndoManager* undoManager); | |||
| static const Identifier idProperty; | |||
| void setID (const String& newID); | |||
| ValueTree state; | |||
| }; | |||
| static void registerDrawableTypes (ComponentBuilder& componentBuilder); | |||
| protected: | |||
| friend class DrawableComposite; | |||
| friend class DrawableShape; | |||
| /** @internal */ | |||
| static Drawable* createChildFromValueTree (DrawableComposite* parent, const ValueTree& tree, ImageProvider* imageProvider); | |||
| /** @internal */ | |||
| void transformContextToCorrectOrigin (Graphics& g); | |||
| /** @internal */ | |||
| @@ -51035,6 +51166,9 @@ public: | |||
| /** Refreshes the directory that's currently being listed. */ | |||
| void refresh(); | |||
| /** Changes the filter that's being used to sift the files. */ | |||
| void setFileFilter (const FileFilter* newFileFilter); | |||
| /** Returns a verb to describe what should happen when the file is accepted. | |||
| E.g. if browsing in "load file" mode, this will be "Open", if in "save file" | |||
| @@ -51089,7 +51223,10 @@ public: | |||
| FilePreviewComponent* getPreviewComponent() const throw(); | |||
| protected: | |||
| virtual const BigInteger getRoots (StringArray& rootNames, StringArray& rootPaths); | |||
| /** Returns a list of names and paths for the default places the user might want to look. | |||
| Use an empty string to indicate a section break. | |||
| */ | |||
| virtual void getRoots (StringArray& rootNames, StringArray& rootPaths); | |||
| private: | |||
| @@ -51593,6 +51730,15 @@ public: | |||
| int minimumWhenOffTheBottom, | |||
| int minimumWhenOffTheRight) throw(); | |||
| /** Returns the minimum distance the bounds can be off-screen. @see setMinimumOnscreenAmounts */ | |||
| int getMinimumWhenOffTheTop() const throw() { return minOffTop; } | |||
| /** Returns the minimum distance the bounds can be off-screen. @see setMinimumOnscreenAmounts */ | |||
| int getMinimumWhenOffTheLeft() const throw() { return minOffLeft; } | |||
| /** Returns the minimum distance the bounds can be off-screen. @see setMinimumOnscreenAmounts */ | |||
| int getMinimumWhenOffTheBottom() const throw() { return minOffBottom; } | |||
| /** Returns the minimum distance the bounds can be off-screen. @see setMinimumOnscreenAmounts */ | |||
| int getMinimumWhenOffTheRight() const throw() { return minOffRight; } | |||
| /** Specifies a width-to-height ratio that the resizer should always maintain. | |||
| If the value is 0, no aspect ratio is enforced. If it's non-zero, the width | |||
| @@ -52204,6 +52350,16 @@ public: | |||
| */ | |||
| void setContentComponentSize (int width, int height); | |||
| /** Returns the width of the frame to use around the window. | |||
| @see getContentComponentBorder | |||
| */ | |||
| virtual const BorderSize getBorderThickness(); | |||
| /** Returns the insets to use when positioning the content component. | |||
| @see getBorderThickness | |||
| */ | |||
| virtual const BorderSize getContentComponentBorder(); | |||
| /** A set of colour IDs to use to change the colour of various aspects of the window. | |||
| These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() | |||
| @@ -52241,18 +52397,6 @@ protected: | |||
| /** @internal */ | |||
| int getDesktopWindowStyleFlags() const; | |||
| /** Returns the width of the border to use around the window. | |||
| @see getContentComponentBorder | |||
| */ | |||
| virtual const BorderSize getBorderThickness(); | |||
| /** Returns the insets to use when positioning the content component. | |||
| @see getBorderThickness | |||
| */ | |||
| virtual const BorderSize getContentComponentBorder(); | |||
| #if JUCE_DEBUG | |||
| /** Overridden to warn people about adding components directly to this component | |||
| instead of using setContentComponent(). | |||
| @@ -53604,6 +53748,9 @@ private: | |||
| #endif | |||
| #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__ | |||
| #endif | |||
| #ifndef __JUCE_COMPONENTBUILDER_JUCEHEADER__ | |||
| #endif | |||
| #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__ | |||
| @@ -61217,74 +61364,6 @@ public: | |||
| /** Destructor. */ | |||
| ~DrawableComposite(); | |||
| /** Adds a new sub-drawable to this one. | |||
| This passes in a Drawable pointer for this object to look after. To add a copy | |||
| of a drawable, use the form of this method that takes a Drawable reference instead. | |||
| @param drawable the object to add - this will be deleted automatically | |||
| when no longer needed, so the caller mustn't keep any | |||
| pointers to it. | |||
| @param index where to insert it in the list of drawables. 0 is the back, | |||
| -1 is the front, or any value from 0 and getNumDrawables() | |||
| can be used | |||
| @see removeDrawable | |||
| */ | |||
| void insertDrawable (Drawable* drawable, int index = -1); | |||
| /** Adds a new sub-drawable to this one. | |||
| This takes a copy of a Drawable and adds it to this object. To pass in a Drawable | |||
| for this object to look after, use the form of this method that takes a Drawable | |||
| pointer instead. | |||
| @param drawable the object to add - an internal copy will be made of this object | |||
| @param index where to insert it in the list of drawables. 0 is the back, | |||
| -1 is the front, or any value from 0 and getNumDrawables() | |||
| can be used | |||
| @see removeDrawable | |||
| */ | |||
| void insertDrawable (const Drawable& drawable, int index = -1); | |||
| /** Deletes one of the Drawable objects. | |||
| @param index the index of the drawable to delete, between 0 | |||
| and (getNumDrawables() - 1). | |||
| @param deleteDrawable if this is true, the drawable that is removed will also | |||
| be deleted. If false, it'll just be removed. | |||
| @see insertDrawable, getNumDrawables | |||
| */ | |||
| void removeDrawable (int index, bool deleteDrawable = true); | |||
| /** Returns the number of drawables contained inside this one. | |||
| @see getDrawable | |||
| */ | |||
| int getNumDrawables() const throw(); | |||
| /** Returns one of the drawables that are contained in this one. | |||
| Each drawable also has a transform associated with it - you can use getDrawableTransform() | |||
| to find it. | |||
| The pointer returned is managed by this object and will be deleted when no longer | |||
| needed, so be careful what you do with it. | |||
| @see getNumDrawables | |||
| */ | |||
| Drawable* getDrawable (int index) const; | |||
| /** Looks for a child drawable with the specified name. */ | |||
| Drawable* getDrawableWithName (const String& name) const throw(); | |||
| /** Brings one of the Drawables to the front. | |||
| @param index the index of the drawable to move, between 0 | |||
| and (getNumDrawables() - 1). | |||
| @see insertDrawable, getNumDrawables | |||
| */ | |||
| void bringToFront (int index); | |||
| /** Sets the parallelogram that defines the target position of the content rectangle when the drawable is rendered. | |||
| @see setContentArea | |||
| */ | |||
| @@ -61349,14 +61428,12 @@ public: | |||
| /** @internal */ | |||
| Drawable* createCopy() const; | |||
| /** @internal */ | |||
| void refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider); | |||
| void refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder); | |||
| /** @internal */ | |||
| const ValueTree createValueTree (ImageProvider* imageProvider) const; | |||
| const ValueTree createValueTree (ComponentBuilder::ImageProvider* imageProvider) const; | |||
| /** @internal */ | |||
| static const Identifier valueTreeType; | |||
| /** @internal */ | |||
| const Identifier getValueTreeType() const { return valueTreeType; } | |||
| /** @internal */ | |||
| const Expression getSymbolValue (const String& symbol, const String& member) const; | |||
| /** @internal */ | |||
| const Rectangle<float> getDrawableBounds() const; | |||
| @@ -61375,13 +61452,8 @@ public: | |||
| public: | |||
| ValueTreeWrapper (const ValueTree& state); | |||
| int getNumDrawables() const; | |||
| ValueTree getDrawableState (int index) const; | |||
| ValueTree getDrawableWithId (const String& objectId, bool recursive) const; | |||
| int indexOfDrawable (const ValueTree& item) const; | |||
| void addDrawable (const ValueTree& newDrawableState, int index, UndoManager* undoManager); | |||
| void moveDrawableOrder (int currentIndex, int newIndex, UndoManager* undoManager); | |||
| void removeDrawable (const ValueTree& child, UndoManager* undoManager); | |||
| ValueTree getChildList() const; | |||
| ValueTree getChildListCreating (UndoManager* undoManager); | |||
| const RelativeParallelogram getBoundingBox() const; | |||
| void setBoundingBox (const RelativeParallelogram& newBounds, UndoManager* undoManager); | |||
| @@ -61403,8 +61475,6 @@ public: | |||
| private: | |||
| static const Identifier childGroupTag, markerGroupTagX, markerGroupTagY, markerTag; | |||
| ValueTree getChildList() const; | |||
| ValueTree getChildListCreating (UndoManager* undoManager); | |||
| ValueTree getMarkerList (bool xAxis) const; | |||
| ValueTree getMarkerListCreating (bool xAxis, UndoManager* undoManager); | |||
| }; | |||
| @@ -61492,13 +61562,11 @@ public: | |||
| /** @internal */ | |||
| const Rectangle<float> getDrawableBounds() const; | |||
| /** @internal */ | |||
| void refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider); | |||
| void refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder); | |||
| /** @internal */ | |||
| const ValueTree createValueTree (ImageProvider* imageProvider) const; | |||
| const ValueTree createValueTree (ComponentBuilder::ImageProvider* imageProvider) const; | |||
| /** @internal */ | |||
| static const Identifier valueTreeType; | |||
| /** @internal */ | |||
| const Identifier getValueTreeType() const { return valueTreeType; } | |||
| /** Internally-used class for wrapping a DrawableImage's state into a ValueTree. */ | |||
| class ValueTreeWrapper : public Drawable::ValueTreeWrapperBase | |||
| @@ -61615,18 +61683,18 @@ public: | |||
| FillAndStrokeState (const ValueTree& state); | |||
| const FillType getMainFill (Expression::EvaluationContext* nameFinder, | |||
| ImageProvider* imageProvider) const; | |||
| ComponentBuilder::ImageProvider* imageProvider) const; | |||
| ValueTree getMainFillState(); | |||
| void setMainFill (const FillType& newFill, const RelativePoint* gradientPoint1, | |||
| const RelativePoint* gradientPoint2, const RelativePoint* gradientPoint3, | |||
| ImageProvider* imageProvider, UndoManager* undoManager); | |||
| ComponentBuilder::ImageProvider* imageProvider, UndoManager* undoManager); | |||
| const FillType getStrokeFill (Expression::EvaluationContext* nameFinder, | |||
| ImageProvider* imageProvider) const; | |||
| ComponentBuilder::ImageProvider* imageProvider) const; | |||
| ValueTree getStrokeFillState(); | |||
| void setStrokeFill (const FillType& newFill, const RelativePoint* gradientPoint1, | |||
| const RelativePoint* gradientPoint2, const RelativePoint* gradientPoint3, | |||
| ImageProvider* imageProvider, UndoManager* undoManager); | |||
| ComponentBuilder::ImageProvider* imageProvider, UndoManager* undoManager); | |||
| const PathStrokeType getStrokeType() const; | |||
| void setStrokeType (const PathStrokeType& newStrokeType, UndoManager* undoManager); | |||
| @@ -61634,11 +61702,11 @@ public: | |||
| static const FillType readFillType (const ValueTree& v, RelativePoint* gradientPoint1, | |||
| RelativePoint* gradientPoint2, RelativePoint* gradientPoint3, | |||
| Expression::EvaluationContext* nameFinder, | |||
| ImageProvider* imageProvider); | |||
| ComponentBuilder::ImageProvider* imageProvider); | |||
| static void writeFillType (ValueTree& v, const FillType& fillType, | |||
| const RelativePoint* gradientPoint1, const RelativePoint* gradientPoint2, | |||
| const RelativePoint* gradientPoint3, ImageProvider* imageProvider, | |||
| const RelativePoint* gradientPoint3, ComponentBuilder::ImageProvider* imageProvider, | |||
| UndoManager* undoManager); | |||
| static const Identifier type, colour, colours, fill, stroke, path, jointStyle, capStyle, strokeWidth, | |||
| @@ -61668,10 +61736,10 @@ protected: | |||
| /** Updates the details from a FillAndStrokeState object, returning true if something changed. */ | |||
| bool refreshFillTypes (const FillAndStrokeState& newState, | |||
| Expression::EvaluationContext* nameFinder, | |||
| ImageProvider* imageProvider); | |||
| ComponentBuilder::ImageProvider* imageProvider); | |||
| /** Writes the stroke and fill details to a FillAndStrokeState object. */ | |||
| void writeTo (FillAndStrokeState& state, ImageProvider* imageProvider, UndoManager* undoManager) const; | |||
| void writeTo (FillAndStrokeState& state, ComponentBuilder::ImageProvider* imageProvider, UndoManager* undoManager) const; | |||
| PathStrokeType strokeType; | |||
| Path path, strokePath; | |||
| @@ -61717,13 +61785,11 @@ public: | |||
| /** @internal */ | |||
| Drawable* createCopy() const; | |||
| /** @internal */ | |||
| void refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider); | |||
| void refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder); | |||
| /** @internal */ | |||
| const ValueTree createValueTree (ImageProvider* imageProvider) const; | |||
| const ValueTree createValueTree (ComponentBuilder::ImageProvider* imageProvider) const; | |||
| /** @internal */ | |||
| static const Identifier valueTreeType; | |||
| /** @internal */ | |||
| const Identifier getValueTreeType() const { return valueTreeType; } | |||
| /** Internally-used class for wrapping a DrawablePath's state into a ValueTree. */ | |||
| class ValueTreeWrapper : public DrawableShape::FillAndStrokeState | |||
| @@ -61831,13 +61897,11 @@ public: | |||
| /** @internal */ | |||
| Drawable* createCopy() const; | |||
| /** @internal */ | |||
| void refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider); | |||
| void refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder); | |||
| /** @internal */ | |||
| const ValueTree createValueTree (ImageProvider* imageProvider) const; | |||
| const ValueTree createValueTree (ComponentBuilder::ImageProvider* imageProvider) const; | |||
| /** @internal */ | |||
| static const Identifier valueTreeType; | |||
| /** @internal */ | |||
| const Identifier getValueTreeType() const { return valueTreeType; } | |||
| /** Internally-used class for wrapping a DrawableRectangle's state into a ValueTree. */ | |||
| class ValueTreeWrapper : public DrawableShape::FillAndStrokeState | |||
| @@ -61940,14 +62004,12 @@ public: | |||
| /** @internal */ | |||
| Drawable* createCopy() const; | |||
| /** @internal */ | |||
| void refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider); | |||
| void refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder); | |||
| /** @internal */ | |||
| const ValueTree createValueTree (ImageProvider* imageProvider) const; | |||
| const ValueTree createValueTree (ComponentBuilder::ImageProvider* imageProvider) const; | |||
| /** @internal */ | |||
| static const Identifier valueTreeType; | |||
| /** @internal */ | |||
| const Identifier getValueTreeType() const { return valueTreeType; } | |||
| /** @internal */ | |||
| const Rectangle<float> getDrawableBounds() const; | |||
| /** Internally-used class for wrapping a DrawableText's state into a ValueTree. */ | |||
| @@ -145,15 +145,17 @@ | |||
| //============================================================================== | |||
| #ifndef DOXYGEN | |||
| BEGIN_JUCE_NAMESPACE | |||
| template <bool b> struct JuceStaticAssert; | |||
| template <> struct JuceStaticAssert <true> { static void dummy() {} }; | |||
| END_JUCE_NAMESPACE | |||
| #endif | |||
| /** A compile-time assertion macro. | |||
| If the expression parameter is false, the macro will cause a compile error. | |||
| */ | |||
| #define static_jassert(expression) JuceStaticAssert<expression>::dummy(); | |||
| #define static_jassert(expression) JUCE_NAMESPACE::JuceStaticAssert<expression>::dummy(); | |||
| /** This is a shorthand macro for declaring stubs for a class's copy constructor and | |||
| operator=. | |||
| @@ -33,7 +33,7 @@ | |||
| */ | |||
| #define JUCE_MAJOR_VERSION 1 | |||
| #define JUCE_MINOR_VERSION 53 | |||
| #define JUCE_BUILDNUMBER 1 | |||
| #define JUCE_BUILDNUMBER 2 | |||
| /** Current Juce version number. | |||
| @@ -103,14 +103,14 @@ FileBrowserComponent::FileBrowserComponent (int flags_, | |||
| currentPathBox.setEditableText (true); | |||
| StringArray rootNames, rootPaths; | |||
| const BigInteger separators (getRoots (rootNames, rootPaths)); | |||
| getRoots (rootNames, rootPaths); | |||
| for (int i = 0; i < rootNames.size(); ++i) | |||
| { | |||
| if (separators [i]) | |||
| if (rootNames[i].isEmpty()) | |||
| currentPathBox.addSeparator(); | |||
| currentPathBox.addItem (rootNames[i], i + 1); | |||
| else | |||
| currentPathBox.addItem (rootNames[i], i + 1); | |||
| } | |||
| currentPathBox.addSeparator(); | |||
| @@ -213,7 +213,8 @@ bool FileBrowserComponent::isDirectorySuitable (const File&) const | |||
| bool FileBrowserComponent::isFileOrDirSuitable (const File& f) const | |||
| { | |||
| if (f.isDirectory()) | |||
| return (flags & canSelectDirectories) != 0 && (fileFilter == 0 || fileFilter->isDirectorySuitable (f)); | |||
| return (flags & canSelectDirectories) != 0 | |||
| && (fileFilter == 0 || fileFilter->isDirectorySuitable (f)); | |||
| return (flags & canSelectFiles) != 0 && f.exists() | |||
| && (fileFilter == 0 || fileFilter->isFileSuitable (f)); | |||
| @@ -280,6 +281,15 @@ void FileBrowserComponent::refresh() | |||
| fileList->refresh(); | |||
| } | |||
| void FileBrowserComponent::setFileFilter (const FileFilter* const newFileFilter) | |||
| { | |||
| if (fileFilter != newFileFilter) | |||
| { | |||
| fileFilter = newFileFilter; | |||
| refresh(); | |||
| } | |||
| } | |||
| const String FileBrowserComponent::getActionVerb() const | |||
| { | |||
| return isSaveMode() ? TRANS("Save") : TRANS("Open"); | |||
| @@ -427,7 +437,6 @@ void FileBrowserComponent::buttonClicked (Button*) | |||
| goUp(); | |||
| } | |||
| void FileBrowserComponent::comboBoxChanged (ComboBox*) | |||
| { | |||
| const String newText (currentPathBox.getText().trim().unquoted()); | |||
| @@ -464,10 +473,8 @@ void FileBrowserComponent::comboBoxChanged (ComboBox*) | |||
| } | |||
| } | |||
| const BigInteger FileBrowserComponent::getRoots (StringArray& rootNames, StringArray& rootPaths) | |||
| void FileBrowserComponent::getRoots (StringArray& rootNames, StringArray& rootPaths) | |||
| { | |||
| BigInteger separators; | |||
| #if JUCE_WINDOWS | |||
| Array<File> roots; | |||
| File::findFileSystemRoots (roots); | |||
| @@ -497,7 +504,8 @@ const BigInteger FileBrowserComponent::getRoots (StringArray& rootNames, StringA | |||
| rootNames.add (name); | |||
| } | |||
| separators.setBit (rootPaths.size()); | |||
| rootPaths.add (String::empty); | |||
| rootNames.add (String::empty); | |||
| rootPaths.add (File::getSpecialLocation (File::userDocumentsDirectory).getFullPathName()); | |||
| rootNames.add ("Documents"); | |||
| @@ -513,7 +521,8 @@ const BigInteger FileBrowserComponent::getRoots (StringArray& rootNames, StringA | |||
| rootPaths.add (File::getSpecialLocation (File::userDesktopDirectory).getFullPathName()); | |||
| rootNames.add ("Desktop"); | |||
| separators.setBit (rootPaths.size()); | |||
| rootPaths.add (String::empty); | |||
| rootNames.add (String::empty); | |||
| Array <File> volumes; | |||
| File vol ("/Volumes"); | |||
| @@ -539,8 +548,6 @@ const BigInteger FileBrowserComponent::getRoots (StringArray& rootNames, StringA | |||
| rootPaths.add (File::getSpecialLocation (File::userDesktopDirectory).getFullPathName()); | |||
| rootNames.add ("Desktop"); | |||
| #endif | |||
| return separators; | |||
| } | |||
| @@ -29,7 +29,6 @@ | |||
| #include "juce_DirectoryContentsDisplayComponent.h" | |||
| #include "juce_FilePreviewComponent.h" | |||
| #include "../../../io/files/juce_File.h" | |||
| #include "../../../maths/juce_BigInteger.h" | |||
| #include "../controls/juce_TextEditor.h" | |||
| #include "../controls/juce_ComboBox.h" | |||
| #include "../buttons/juce_DrawableButton.h" | |||
| @@ -148,6 +147,9 @@ public: | |||
| /** Refreshes the directory that's currently being listed. */ | |||
| void refresh(); | |||
| /** Changes the filter that's being used to sift the files. */ | |||
| void setFileFilter (const FileFilter* newFileFilter); | |||
| /** Returns a verb to describe what should happen when the file is accepted. | |||
| E.g. if browsing in "load file" mode, this will be "Open", if in "save file" | |||
| @@ -205,7 +207,10 @@ public: | |||
| FilePreviewComponent* getPreviewComponent() const throw(); | |||
| protected: | |||
| virtual const BigInteger getRoots (StringArray& rootNames, StringArray& rootPaths); | |||
| /** Returns a list of names and paths for the default places the user might want to look. | |||
| Use an empty string to indicate a section break. | |||
| */ | |||
| virtual void getRoots (StringArray& rootNames, StringArray& rootPaths); | |||
| private: | |||
| //============================================================================== | |||
| @@ -97,7 +97,7 @@ public: | |||
| @see setName | |||
| */ | |||
| const String& getName() const throw() { return componentName_; } | |||
| const String& getName() const throw() { return componentName; } | |||
| /** Sets the name of this component. | |||
| @@ -277,7 +277,7 @@ public: | |||
| bounds will no longer be a direct reflection of the position at which it appears within | |||
| its parent, as the transform will be applied to its bounding box. | |||
| */ | |||
| inline int getX() const throw() { return bounds_.getX(); } | |||
| inline int getX() const throw() { return bounds.getX(); } | |||
| /** Returns the y coordinate of the top of this component. | |||
| This is a distance in pixels from the top edge of the component's parent. | |||
| @@ -286,13 +286,13 @@ public: | |||
| bounds will no longer be a direct reflection of the position at which it appears within | |||
| its parent, as the transform will be applied to its bounding box. | |||
| */ | |||
| inline int getY() const throw() { return bounds_.getY(); } | |||
| inline int getY() const throw() { return bounds.getY(); } | |||
| /** Returns the component's width in pixels. */ | |||
| inline int getWidth() const throw() { return bounds_.getWidth(); } | |||
| inline int getWidth() const throw() { return bounds.getWidth(); } | |||
| /** Returns the component's height in pixels. */ | |||
| inline int getHeight() const throw() { return bounds_.getHeight(); } | |||
| inline int getHeight() const throw() { return bounds.getHeight(); } | |||
| /** Returns the x coordinate of the component's right-hand edge. | |||
| This is a distance in pixels from the left edge of the component's parent. | |||
| @@ -301,10 +301,10 @@ public: | |||
| bounds will no longer be a direct reflection of the position at which it appears within | |||
| its parent, as the transform will be applied to its bounding box. | |||
| */ | |||
| int getRight() const throw() { return bounds_.getRight(); } | |||
| int getRight() const throw() { return bounds.getRight(); } | |||
| /** Returns the component's top-left position as a Point. */ | |||
| const Point<int> getPosition() const throw() { return bounds_.getPosition(); } | |||
| const Point<int> getPosition() const throw() { return bounds.getPosition(); } | |||
| /** Returns the y coordinate of the bottom edge of this component. | |||
| This is a distance in pixels from the top edge of the component's parent. | |||
| @@ -313,7 +313,7 @@ public: | |||
| bounds will no longer be a direct reflection of the position at which it appears within | |||
| its parent, as the transform will be applied to its bounding box. | |||
| */ | |||
| int getBottom() const throw() { return bounds_.getBottom(); } | |||
| int getBottom() const throw() { return bounds.getBottom(); } | |||
| /** Returns this component's bounding box. | |||
| The rectangle returned is relative to the top-left of the component's parent. | |||
| @@ -322,7 +322,7 @@ public: | |||
| bounds will no longer be a direct reflection of the position at which it appears within | |||
| its parent, as the transform will be applied to its bounding box. | |||
| */ | |||
| const Rectangle<int>& getBounds() const throw() { return bounds_; } | |||
| const Rectangle<int>& getBounds() const throw() { return bounds; } | |||
| /** Returns the component's bounds, relative to its own origin. | |||
| This is like getBounds(), but returns the rectangle in local coordinates, In practice, it'll | |||
| @@ -706,7 +706,7 @@ public: | |||
| If this is the highest-level component or hasn't yet been added to | |||
| a parent, this will return null. | |||
| */ | |||
| Component* getParentComponent() const throw() { return parentComponent_; } | |||
| Component* getParentComponent() const throw() { return parentComponent; } | |||
| /** Searches the parent components for a component of a specified class. | |||
| @@ -720,14 +720,14 @@ public: | |||
| TargetClass* findParentComponentOfClass (TargetClass* const dummyParameter = 0) const | |||
| { | |||
| (void) dummyParameter; | |||
| Component* p = parentComponent_; | |||
| Component* p = parentComponent; | |||
| while (p != 0) | |||
| { | |||
| TargetClass* target = dynamic_cast <TargetClass*> (p); | |||
| if (target != 0) | |||
| return target; | |||
| p = p->parentComponent_; | |||
| p = p->parentComponent; | |||
| } | |||
| return 0; | |||
| @@ -1022,7 +1022,7 @@ public: | |||
| @see setComponentEffect | |||
| */ | |||
| ImageEffectFilter* getComponentEffect() const throw() { return effect_; } | |||
| ImageEffectFilter* getComponentEffect() const throw() { return effect; } | |||
| //============================================================================== | |||
| /** Finds the appropriate look-and-feel to use for this component. | |||
| @@ -2078,7 +2078,7 @@ public: | |||
| }; | |||
| //============================================================================== | |||
| /** A class to keep an eye on one or two components and check for them being deleted. | |||
| /** A class to keep an eye on a component and check for it being deleted. | |||
| This is designed for use with the ListenerList::callChecked() methods, to allow | |||
| the list iterator to stop cleanly if the component is deleted by a listener callback | |||
| @@ -2088,16 +2088,13 @@ public: | |||
| { | |||
| public: | |||
| /** Creates a checker that watches one component. */ | |||
| BailOutChecker (Component* component1); | |||
| /** Creates a checker that watches two components. */ | |||
| BailOutChecker (Component* component1, Component* component2); | |||
| BailOutChecker (Component* component); | |||
| /** Returns true if either of the two components have been deleted since this object was created. */ | |||
| bool shouldBailOut() const throw(); | |||
| private: | |||
| const WeakReference<Component> safePointer1, safePointer2; | |||
| const WeakReference<Component> safePointer; | |||
| JUCE_DECLARE_NON_COPYABLE (BailOutChecker); | |||
| }; | |||
| @@ -2118,7 +2115,6 @@ public: | |||
| private: | |||
| //============================================================================== | |||
| friend class ComponentPeer; | |||
| friend class InternalDragRepeater; | |||
| friend class MouseInputSource; | |||
| friend class MouseInputSourceInternal; | |||
| @@ -2126,21 +2122,21 @@ private: | |||
| static Component* currentlyFocusedComponent; | |||
| //============================================================================== | |||
| String componentName_, componentID; | |||
| Component* parentComponent_; | |||
| Rectangle<int> bounds_; | |||
| ScopedPointer <AffineTransform> affineTransform_; | |||
| Array <Component*> childComponentList_; | |||
| LookAndFeel* lookAndFeel_; | |||
| MouseCursor cursor_; | |||
| ImageEffectFilter* effect_; | |||
| Image bufferedImage_; | |||
| String componentName, componentID; | |||
| Component* parentComponent; | |||
| Rectangle<int> bounds; | |||
| ScopedPointer <AffineTransform> affineTransform; | |||
| Array <Component*> childComponentList; | |||
| LookAndFeel* lookAndFeel; | |||
| MouseCursor cursor; | |||
| ImageEffectFilter* effect; | |||
| Image bufferedImage; | |||
| class MouseListenerList; | |||
| friend class MouseListenerList; | |||
| friend class ScopedPointer <MouseListenerList>; | |||
| ScopedPointer <MouseListenerList> mouseListeners_; | |||
| ScopedPointer <Array <KeyListener*> > keyListeners_; | |||
| ScopedPointer <MouseListenerList> mouseListeners; | |||
| ScopedPointer <Array <KeyListener*> > keyListeners; | |||
| ListenerList <ComponentListener> componentListeners; | |||
| NamedValueSet properties; | |||
| @@ -2176,7 +2172,7 @@ private: | |||
| union | |||
| { | |||
| uint32 componentFlags_; | |||
| uint32 componentFlags; | |||
| ComponentFlags flags; | |||
| }; | |||
| @@ -112,6 +112,16 @@ public: | |||
| int minimumWhenOffTheBottom, | |||
| int minimumWhenOffTheRight) throw(); | |||
| /** Returns the minimum distance the bounds can be off-screen. @see setMinimumOnscreenAmounts */ | |||
| int getMinimumWhenOffTheTop() const throw() { return minOffTop; } | |||
| /** Returns the minimum distance the bounds can be off-screen. @see setMinimumOnscreenAmounts */ | |||
| int getMinimumWhenOffTheLeft() const throw() { return minOffLeft; } | |||
| /** Returns the minimum distance the bounds can be off-screen. @see setMinimumOnscreenAmounts */ | |||
| int getMinimumWhenOffTheBottom() const throw() { return minOffBottom; } | |||
| /** Returns the minimum distance the bounds can be off-screen. @see setMinimumOnscreenAmounts */ | |||
| int getMinimumWhenOffTheRight() const throw() { return minOffRight; } | |||
| //============================================================================== | |||
| /** Specifies a width-to-height ratio that the resizer should always maintain. | |||
| @@ -0,0 +1,276 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #include "../../../core/juce_StandardHeader.h" | |||
| BEGIN_JUCE_NAMESPACE | |||
| #include "juce_ComponentBuilder.h" | |||
| //============================================================================= | |||
| namespace ComponentBuilderHelpers | |||
| { | |||
| const String getStateId (const ValueTree& state) | |||
| { | |||
| return state [ComponentBuilder::idProperty].toString(); | |||
| } | |||
| Component* findComponentWithID (OwnedArray<Component>& components, const String& compId) | |||
| { | |||
| jassert (compId.isNotEmpty()); | |||
| for (int i = components.size(); --i >= 0;) | |||
| { | |||
| Component* const c = components.getUnchecked (i); | |||
| if (c->getComponentID() == compId) | |||
| return components.removeAndReturn (i); | |||
| } | |||
| return 0; | |||
| } | |||
| Component* findComponentWithID (Component* const c, const String& compId) | |||
| { | |||
| jassert (compId.isNotEmpty()); | |||
| if (c->getComponentID() == compId) | |||
| return c; | |||
| for (int i = c->getNumChildComponents(); --i >= 0;) | |||
| { | |||
| Component* const child = findComponentWithID (c->getChildComponent (i), compId); | |||
| if (child != 0) | |||
| return child; | |||
| } | |||
| return 0; | |||
| } | |||
| Component* createNewComponent (ComponentBuilder::TypeHandler& type, | |||
| const ValueTree& state, Component* parent) | |||
| { | |||
| Component* const c = type.addNewComponentFromState (state, parent); | |||
| jassert (c != 0); | |||
| c->setComponentID (getStateId (state)); | |||
| return c; | |||
| } | |||
| } | |||
| //============================================================================= | |||
| const Identifier ComponentBuilder::idProperty ("id"); | |||
| ComponentBuilder::ComponentBuilder (const ValueTree& state_) | |||
| : state (state_) | |||
| { | |||
| state.addListener (this); | |||
| } | |||
| ComponentBuilder::~ComponentBuilder() | |||
| { | |||
| state.removeListener (this); | |||
| } | |||
| Component* ComponentBuilder::getComponent() | |||
| { | |||
| if (component == 0) | |||
| { | |||
| jassert (types.size() > 0); // You need to register all the necessary types before you can load a component! | |||
| TypeHandler* const type = getHandlerForState (state); | |||
| jassert (type != 0); // trying to create a component from an unknown type of ValueTree | |||
| if (type != 0) | |||
| component = ComponentBuilderHelpers::createNewComponent (*type, state, 0); | |||
| } | |||
| return component; | |||
| } | |||
| Component* ComponentBuilder::getAndReleaseComponent() | |||
| { | |||
| getComponent(); | |||
| return component.release(); | |||
| } | |||
| void ComponentBuilder::registerTypeHandler (ComponentBuilder::TypeHandler* const type) | |||
| { | |||
| jassert (type != 0); | |||
| // Don't try to move your types around! Once a type has been added to a builder, the | |||
| // builder owns it, and you should leave it alone! | |||
| jassert (type->builder == 0); | |||
| types.add (type); | |||
| type->builder = this; | |||
| } | |||
| ComponentBuilder::TypeHandler* ComponentBuilder::getHandlerForState (const ValueTree& s) const | |||
| { | |||
| const Identifier targetType (s.getType()); | |||
| for (int i = 0; i < types.size(); ++i) | |||
| { | |||
| TypeHandler* const t = types.getUnchecked(i); | |||
| if (t->getType() == targetType) | |||
| return t; | |||
| } | |||
| return 0; | |||
| } | |||
| int ComponentBuilder::getNumHandlers() const throw() | |||
| { | |||
| return types.size(); | |||
| } | |||
| ComponentBuilder::TypeHandler* ComponentBuilder::getHandler (const int index) const throw() | |||
| { | |||
| return types [index]; | |||
| } | |||
| void ComponentBuilder::updateComponent (const ValueTree& state) | |||
| { | |||
| using namespace ComponentBuilderHelpers; | |||
| if (component != 0) | |||
| { | |||
| const String compId (getStateId (state)); | |||
| if (compId.isEmpty() && state.getParent().isValid()) | |||
| { | |||
| // ..handle the case where a child of the actual state node has changed. | |||
| updateComponent (state.getParent()); | |||
| } | |||
| else | |||
| { | |||
| TypeHandler* const type = getHandlerForState (state); | |||
| if (type != 0) | |||
| { | |||
| Component* const changedComp = findComponentWithID (component, compId); | |||
| if (changedComp != 0) | |||
| type->updateComponentFromState (changedComp, state); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| void ComponentBuilder::setImageProvider (ImageProvider* newImageProvider) throw() | |||
| { | |||
| imageProvider = newImageProvider; | |||
| } | |||
| ComponentBuilder::ImageProvider* ComponentBuilder::getImageProvider() const throw() | |||
| { | |||
| return imageProvider; | |||
| } | |||
| void ComponentBuilder::valueTreePropertyChanged (ValueTree& tree, const Identifier&) | |||
| { | |||
| updateComponent (tree); | |||
| } | |||
| void ComponentBuilder::valueTreeChildrenChanged (ValueTree& tree) | |||
| { | |||
| updateComponent (tree); | |||
| } | |||
| void ComponentBuilder::valueTreeParentChanged (ValueTree& tree) | |||
| { | |||
| updateComponent (tree); | |||
| } | |||
| //============================================================================== | |||
| ComponentBuilder::TypeHandler::TypeHandler (const Identifier& valueTreeType_) | |||
| : builder (0), valueTreeType (valueTreeType_) | |||
| { | |||
| } | |||
| ComponentBuilder::TypeHandler::~TypeHandler() | |||
| { | |||
| } | |||
| ComponentBuilder* ComponentBuilder::TypeHandler::getBuilder() const throw() | |||
| { | |||
| // A type handler needs to be registered with a ComponentBuilder before using it! | |||
| jassert (builder != 0); | |||
| return builder; | |||
| } | |||
| void ComponentBuilder::updateChildComponents (Component& parent, const ValueTree& children) | |||
| { | |||
| using namespace ComponentBuilderHelpers; | |||
| const int numExistingChildComps = parent.getNumChildComponents(); | |||
| Array <Component*> componentsInOrder; | |||
| componentsInOrder.ensureStorageAllocated (numExistingChildComps); | |||
| { | |||
| OwnedArray<Component> existingComponents; | |||
| existingComponents.ensureStorageAllocated (numExistingChildComps); | |||
| int i; | |||
| for (i = 0; i < numExistingChildComps; ++i) | |||
| existingComponents.add (parent.getChildComponent (i)); | |||
| const int newNumChildren = children.getNumChildren(); | |||
| for (i = 0; i < newNumChildren; ++i) | |||
| { | |||
| const ValueTree childState (children.getChild (i)); | |||
| ComponentBuilder::TypeHandler* const type = getHandlerForState (childState); | |||
| jassert (type != 0); | |||
| if (type != 0) | |||
| { | |||
| Component* c = findComponentWithID (existingComponents, getStateId (childState)); | |||
| if (c == 0) | |||
| c = createNewComponent (*type, childState, &parent); | |||
| componentsInOrder.add (c); | |||
| } | |||
| } | |||
| // (remaining unused items in existingComponents get deleted here as it goes out of scope) | |||
| } | |||
| // Make sure the z-order is correct.. | |||
| if (componentsInOrder.size() > 0) | |||
| { | |||
| componentsInOrder.getLast()->toFront (false); | |||
| for (int i = componentsInOrder.size() - 1; --i >= 0;) | |||
| componentsInOrder.getUnchecked(i)->toBehind (componentsInOrder.getUnchecked (i + 1)); | |||
| } | |||
| } | |||
| END_JUCE_NAMESPACE | |||
| @@ -0,0 +1,190 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCE_COMPONENTBUILDER_JUCEHEADER__ | |||
| #define __JUCE_COMPONENTBUILDER_JUCEHEADER__ | |||
| #include "../../../containers/juce_ValueTree.h" | |||
| #include "../juce_Component.h" | |||
| //============================================================================== | |||
| /** | |||
| Loads and maintains a tree of Components from a ValueTree that represents them. | |||
| To allow the state of a tree of components to be saved as a ValueTree and re-loaded, | |||
| this class lets you register a set of type-handlers for the different components that | |||
| are involved, and then uses these types to re-create a set of components from its | |||
| stored state. | |||
| Essentially, to use this, you need to create a ComponentBuilder with your ValueTree, | |||
| then use registerTypeHandler() to give it a set of type handlers that can cope with | |||
| all the items in your tree. Then you can call getComponent() to build the component. | |||
| Once you've got the component you can either take it and delete the ComponentBuilder | |||
| object, or if you keep the ComponentBuilder around, it'll monitor any changes in the | |||
| ValueTree and automatically update the component to reflect these changes. | |||
| */ | |||
| class JUCE_API ComponentBuilder : public ValueTree::Listener | |||
| { | |||
| public: | |||
| /** | |||
| */ | |||
| explicit ComponentBuilder (const ValueTree& state); | |||
| /** Destructor. */ | |||
| ~ComponentBuilder(); | |||
| //============================================================================== | |||
| /** | |||
| */ | |||
| ValueTree& getState() throw() { return state; } | |||
| /** | |||
| */ | |||
| const ValueTree& getState() const throw() { return state; } | |||
| /** | |||
| */ | |||
| Component* getComponent(); | |||
| /** | |||
| */ | |||
| Component* getAndReleaseComponent(); | |||
| //============================================================================== | |||
| /** | |||
| */ | |||
| class JUCE_API TypeHandler | |||
| { | |||
| public: | |||
| /** | |||
| */ | |||
| explicit TypeHandler (const Identifier& valueTreeType); | |||
| /** Destructor. */ | |||
| virtual ~TypeHandler(); | |||
| /** | |||
| */ | |||
| const Identifier& getType() const throw() { return valueTreeType; } | |||
| /** | |||
| */ | |||
| virtual Component* addNewComponentFromState (const ValueTree& state, Component* parent) = 0; | |||
| /** | |||
| */ | |||
| virtual void updateComponentFromState (Component* component, const ValueTree& state) = 0; | |||
| /** | |||
| */ | |||
| ComponentBuilder* getBuilder() const throw(); | |||
| private: | |||
| friend class ComponentBuilder; | |||
| ComponentBuilder* builder; | |||
| const Identifier valueTreeType; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TypeHandler); | |||
| }; | |||
| /** | |||
| */ | |||
| void registerTypeHandler (TypeHandler* type); | |||
| /** | |||
| */ | |||
| TypeHandler* getHandlerForState (const ValueTree& state) const; | |||
| /** | |||
| */ | |||
| int getNumHandlers() const throw(); | |||
| /** | |||
| */ | |||
| TypeHandler* getHandler (int index) const throw(); | |||
| //============================================================================= | |||
| /** This class is used when loading Drawables that contain images, and retrieves | |||
| the image for a stored identifier. | |||
| @see Drawable::createFromValueTree | |||
| */ | |||
| class JUCE_API ImageProvider | |||
| { | |||
| public: | |||
| ImageProvider() {} | |||
| virtual ~ImageProvider() {} | |||
| /** Retrieves the image associated with this identifier, which could be any | |||
| kind of string, number, filename, etc. | |||
| The image that is returned will be owned by the caller, but it may come | |||
| from the ImageCache. | |||
| */ | |||
| virtual const Image getImageForIdentifier (const var& imageIdentifier) = 0; | |||
| /** Returns an identifier to be used to refer to a given image. | |||
| This is used when converting a drawable into a ValueTree, so if you're | |||
| only loading drawables, you can just return a var::null here. | |||
| */ | |||
| virtual const var getIdentifierForImage (const Image& image) = 0; | |||
| }; | |||
| /** */ | |||
| void setImageProvider (ImageProvider* newImageProvider) throw(); | |||
| /** */ | |||
| ImageProvider* getImageProvider() const throw(); | |||
| //============================================================================= | |||
| /** @internal */ | |||
| void valueTreePropertyChanged (ValueTree& treeWhosePropertyHasChanged, const Identifier& property); | |||
| /** @internal */ | |||
| void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged); | |||
| /** @internal */ | |||
| void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged); | |||
| /** | |||
| */ | |||
| void updateChildComponents (Component& parent, const ValueTree& children); | |||
| /** | |||
| */ | |||
| static const Identifier idProperty; | |||
| private: | |||
| //============================================================================= | |||
| ValueTree state; | |||
| OwnedArray <TypeHandler> types; | |||
| ScopedPointer<Component> component; | |||
| ImageProvider* imageProvider; | |||
| void updateComponent (const ValueTree& state); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ComponentBuilder); | |||
| }; | |||
| #endif // __JUCE_COMPONENTBUILDER_JUCEHEADER__ | |||
| @@ -2446,14 +2446,14 @@ Button* LookAndFeel::createTabBarExtrasButton() | |||
| dp.setFill (Colour (0x59000000)); | |||
| DrawableComposite normalImage; | |||
| normalImage.insertDrawable (ellipse); | |||
| normalImage.insertDrawable (dp); | |||
| normalImage.addAndMakeVisible (ellipse.createCopy()); | |||
| normalImage.addAndMakeVisible (dp.createCopy()); | |||
| dp.setFill (Colour (0xcc000000)); | |||
| DrawableComposite overImage; | |||
| overImage.insertDrawable (ellipse); | |||
| overImage.insertDrawable (dp); | |||
| overImage.addAndMakeVisible (ellipse.createCopy()); | |||
| overImage.addAndMakeVisible (dp.createCopy()); | |||
| DrawableButton* db = new DrawableButton ("tabs", DrawableButton::ImageFitted); | |||
| db->setImages (&normalImage, &overImage, 0); | |||
| @@ -175,17 +175,18 @@ bool ComponentPeer::handleKeyPress (const int keyCode, | |||
| while (target != 0) | |||
| { | |||
| const WeakReference<Component> deletionChecker (target); | |||
| const Array <KeyListener*>* const keyListeners = target->keyListeners; | |||
| if (target->keyListeners_ != 0) | |||
| if (keyListeners != 0) | |||
| { | |||
| for (int i = target->keyListeners_->size(); --i >= 0;) | |||
| for (int i = keyListeners->size(); --i >= 0;) | |||
| { | |||
| keyWasUsed = target->keyListeners_->getUnchecked(i)->keyPressed (keyInfo, target); | |||
| keyWasUsed = keyListeners->getUnchecked(i)->keyPressed (keyInfo, target); | |||
| if (keyWasUsed || deletionChecker == 0) | |||
| return keyWasUsed; | |||
| i = jmin (i, target->keyListeners_->size()); | |||
| i = jmin (i, keyListeners->size()); | |||
| } | |||
| } | |||
| @@ -202,7 +203,7 @@ bool ComponentPeer::handleKeyPress (const int keyCode, | |||
| break; | |||
| } | |||
| target = target->parentComponent_; | |||
| target = target->getParentComponent(); | |||
| } | |||
| return keyWasUsed; | |||
| @@ -235,20 +236,22 @@ bool ComponentPeer::handleKeyUpOrDown (const bool isKeyDown) | |||
| if (keyWasUsed || deletionChecker == 0) | |||
| break; | |||
| if (target->keyListeners_ != 0) | |||
| const Array <KeyListener*>* const keyListeners = target->keyListeners; | |||
| if (keyListeners != 0) | |||
| { | |||
| for (int i = target->keyListeners_->size(); --i >= 0;) | |||
| for (int i = keyListeners->size(); --i >= 0;) | |||
| { | |||
| keyWasUsed = target->keyListeners_->getUnchecked(i)->keyStateChanged (isKeyDown, target); | |||
| keyWasUsed = keyListeners->getUnchecked(i)->keyStateChanged (isKeyDown, target); | |||
| if (keyWasUsed || deletionChecker == 0) | |||
| return keyWasUsed; | |||
| i = jmin (i, target->keyListeners_->size()); | |||
| i = jmin (i, keyListeners->size()); | |||
| } | |||
| } | |||
| target = target->parentComponent_; | |||
| target = target->getParentComponent(); | |||
| } | |||
| return keyWasUsed; | |||
| @@ -313,7 +316,7 @@ void ComponentPeer::handleMovedOrResized() | |||
| if (wasMoved || wasResized) | |||
| { | |||
| component->bounds_ = newBounds; | |||
| component->bounds = newBounds; | |||
| if (wasResized) | |||
| component->repaint(); | |||
| @@ -268,6 +268,16 @@ public: | |||
| */ | |||
| void setContentComponentSize (int width, int height); | |||
| /** Returns the width of the frame to use around the window. | |||
| @see getContentComponentBorder | |||
| */ | |||
| virtual const BorderSize getBorderThickness(); | |||
| /** Returns the insets to use when positioning the content component. | |||
| @see getBorderThickness | |||
| */ | |||
| virtual const BorderSize getContentComponentBorder(); | |||
| //============================================================================== | |||
| /** A set of colour IDs to use to change the colour of various aspects of the window. | |||
| @@ -306,18 +316,6 @@ protected: | |||
| /** @internal */ | |||
| int getDesktopWindowStyleFlags() const; | |||
| /** Returns the width of the border to use around the window. | |||
| @see getContentComponentBorder | |||
| */ | |||
| virtual const BorderSize getBorderThickness(); | |||
| /** Returns the insets to use when positioning the content component. | |||
| @see getBorderThickness | |||
| */ | |||
| virtual const BorderSize getContentComponentBorder(); | |||
| #if JUCE_DEBUG | |||
| /** Overridden to warn people about adding components directly to this component | |||
| instead of using setContentComponent(). | |||
| @@ -176,37 +176,59 @@ Drawable* Drawable::createFromImageFile (const File& file) | |||
| } | |||
| //============================================================================== | |||
| Drawable* Drawable::createFromValueTree (const ValueTree& tree, ImageProvider* imageProvider) | |||
| Drawable* Drawable::createFromValueTree (const ValueTree& tree, ComponentBuilder::ImageProvider* imageProvider) | |||
| { | |||
| return createChildFromValueTree (0, tree, imageProvider); | |||
| ComponentBuilder builder (tree); | |||
| builder.setImageProvider (imageProvider); | |||
| registerDrawableTypes (builder); | |||
| Drawable* d = dynamic_cast<Drawable*> (builder.getComponent()); | |||
| if (d != 0) | |||
| return dynamic_cast<Drawable*> (builder.getAndReleaseComponent()); | |||
| return 0; | |||
| } | |||
| Drawable* Drawable::createChildFromValueTree (DrawableComposite* parent, const ValueTree& tree, ImageProvider* imageProvider) | |||
| //============================================================================== | |||
| template <class DrawableClass> | |||
| class DrawableTypeHandler : public ComponentBuilder::TypeHandler | |||
| { | |||
| const Identifier type (tree.getType()); | |||
| Drawable* d = 0; | |||
| if (type == DrawablePath::valueTreeType) d = new DrawablePath(); | |||
| else if (type == DrawableComposite::valueTreeType) d = new DrawableComposite(); | |||
| else if (type == DrawableRectangle::valueTreeType) d = new DrawableRectangle(); | |||
| else if (type == DrawableImage::valueTreeType) d = new DrawableImage(); | |||
| else if (type == DrawableText::valueTreeType) d = new DrawableText(); | |||
| public: | |||
| DrawableTypeHandler() | |||
| : ComponentBuilder::TypeHandler (DrawableClass::valueTreeType) | |||
| { | |||
| } | |||
| if (d != 0) | |||
| Component* addNewComponentFromState (const ValueTree& state, Component* parent) | |||
| { | |||
| DrawableClass* const d = new DrawableClass(); | |||
| if (parent != 0) | |||
| parent->insertDrawable (d); | |||
| parent->addAndMakeVisible (d); | |||
| d->refreshFromValueTree (tree, imageProvider); | |||
| updateComponentFromState (d, state); | |||
| return d; | |||
| } | |||
| return d; | |||
| } | |||
| void updateComponentFromState (Component* component, const ValueTree& state) | |||
| { | |||
| DrawableClass* const d = dynamic_cast <DrawableClass*> (component); | |||
| jassert (d != 0); | |||
| d->refreshFromValueTree (state, *this->getBuilder()); | |||
| } | |||
| }; | |||
| void Drawable::registerDrawableTypes (ComponentBuilder& builder) | |||
| { | |||
| builder.registerTypeHandler (new DrawableTypeHandler <DrawablePath>()); | |||
| builder.registerTypeHandler (new DrawableTypeHandler <DrawableComposite>()); | |||
| builder.registerTypeHandler (new DrawableTypeHandler <DrawableRectangle>()); | |||
| builder.registerTypeHandler (new DrawableTypeHandler <DrawableImage>()); | |||
| builder.registerTypeHandler (new DrawableTypeHandler <DrawableText>()); | |||
| } | |||
| //============================================================================== | |||
| const Identifier Drawable::ValueTreeWrapperBase::idProperty ("id"); | |||
| Drawable::ValueTreeWrapperBase::ValueTreeWrapperBase (const ValueTree& state_) | |||
| : state (state_) | |||
| { | |||
| @@ -218,15 +240,15 @@ Drawable::ValueTreeWrapperBase::~ValueTreeWrapperBase() | |||
| const String Drawable::ValueTreeWrapperBase::getID() const | |||
| { | |||
| return state [idProperty]; | |||
| return state [ComponentBuilder::idProperty]; | |||
| } | |||
| void Drawable::ValueTreeWrapperBase::setID (const String& newID, UndoManager* const undoManager) | |||
| void Drawable::ValueTreeWrapperBase::setID (const String& newID) | |||
| { | |||
| if (newID.isEmpty()) | |||
| state.removeProperty (idProperty, undoManager); | |||
| state.removeProperty (ComponentBuilder::idProperty, 0); | |||
| else | |||
| state.setProperty (idProperty, newID, undoManager); | |||
| state.setProperty (ComponentBuilder::idProperty, newID, 0); | |||
| } | |||
| @@ -30,6 +30,7 @@ | |||
| #include "../geometry/juce_RelativeCoordinate.h" | |||
| #include "../../../text/juce_XmlElement.h" | |||
| #include "../../../containers/juce_ValueTree.h" | |||
| #include "../../components/layout/juce_ComponentBuilder.h" | |||
| class DrawableComposite; | |||
| @@ -157,54 +158,20 @@ public: | |||
| static Drawable* createFromSVG (const XmlElement& svgDocument); | |||
| //============================================================================== | |||
| /** This class is used when loading Drawables that contain images, and retrieves | |||
| the image for a stored identifier. | |||
| @see Drawable::createFromValueTree | |||
| */ | |||
| class JUCE_API ImageProvider | |||
| { | |||
| public: | |||
| ImageProvider() {} | |||
| virtual ~ImageProvider() {} | |||
| /** Retrieves the image associated with this identifier, which could be any | |||
| kind of string, number, filename, etc. | |||
| The image that is returned will be owned by the caller, but it may come | |||
| from the ImageCache. | |||
| */ | |||
| virtual const Image getImageForIdentifier (const var& imageIdentifier) = 0; | |||
| /** Returns an identifier to be used to refer to a given image. | |||
| This is used when converting a drawable into a ValueTree, so if you're | |||
| only loading drawables, you can just return a var::null here. | |||
| */ | |||
| virtual const var getIdentifierForImage (const Image& image) = 0; | |||
| }; | |||
| /** Tries to create a Drawable from a previously-saved ValueTree. | |||
| The ValueTree must have been created by the createValueTree() method. | |||
| If there are any images used within the drawable, you'll need to provide a valid | |||
| ImageProvider object that can be used to retrieve these images from whatever type | |||
| of identifier is used to represent them. | |||
| */ | |||
| static Drawable* createFromValueTree (const ValueTree& tree, ImageProvider* imageProvider); | |||
| /** Tries to refresh a Drawable from the same ValueTree that was used to create it. | |||
| @returns the damage rectangle that will need repainting due to any changes that were made. | |||
| */ | |||
| virtual void refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider) = 0; | |||
| static Drawable* createFromValueTree (const ValueTree& tree, ComponentBuilder::ImageProvider* imageProvider); | |||
| /** Creates a ValueTree to represent this Drawable. | |||
| The VarTree that is returned can be turned back into a Drawable with | |||
| createFromValueTree(). | |||
| If there are any images used in this drawable, you'll need to provide a valid | |||
| ImageProvider object that can be used to create storable representations of them. | |||
| The ValueTree that is returned can be turned back into a Drawable with createFromValueTree(). | |||
| If there are any images used in this drawable, you'll need to provide a valid ImageProvider | |||
| object that can be used to create storable representations of them. | |||
| */ | |||
| virtual const ValueTree createValueTree (ImageProvider* imageProvider) const = 0; | |||
| /** Returns the tag ID that is used for a ValueTree that stores this type of drawable. */ | |||
| virtual const Identifier getValueTreeType() const = 0; | |||
| virtual const ValueTree createValueTree (ComponentBuilder::ImageProvider* imageProvider) const = 0; | |||
| /** Returns the area that this drawble covers. | |||
| The result is expressed in this drawable's own coordinate space, and does not take | |||
| @@ -223,19 +190,18 @@ public: | |||
| ValueTree& getState() throw() { return state; } | |||
| const String getID() const; | |||
| void setID (const String& newID, UndoManager* undoManager); | |||
| static const Identifier idProperty; | |||
| void setID (const String& newID); | |||
| ValueTree state; | |||
| }; | |||
| static void registerDrawableTypes (ComponentBuilder& componentBuilder); | |||
| protected: | |||
| //============================================================================== | |||
| friend class DrawableComposite; | |||
| friend class DrawableShape; | |||
| /** @internal */ | |||
| static Drawable* createChildFromValueTree (DrawableComposite* parent, const ValueTree& tree, ImageProvider* imageProvider); | |||
| /** @internal */ | |||
| void transformContextToCorrectOrigin (Graphics& g); | |||
| /** @internal */ | |||
| @@ -28,10 +28,6 @@ | |||
| BEGIN_JUCE_NAMESPACE | |||
| #include "juce_DrawableComposite.h" | |||
| #include "juce_DrawablePath.h" | |||
| #include "juce_DrawableImage.h" | |||
| #include "juce_DrawableText.h" | |||
| #include "../imaging/juce_Image.h" | |||
| //============================================================================== | |||
| @@ -49,8 +45,13 @@ DrawableComposite::DrawableComposite (const DrawableComposite& other) | |||
| : bounds (other.bounds), | |||
| updateBoundsReentrant (false) | |||
| { | |||
| for (int i = 0; i < other.getNumDrawables(); ++i) | |||
| insertDrawable (other.getDrawable(i)->createCopy()); | |||
| for (int i = 0; i < other.getNumChildComponents(); ++i) | |||
| { | |||
| const Drawable* const d = dynamic_cast <const Drawable*> (getChildComponent(i)); | |||
| if (d != 0) | |||
| addAndMakeVisible (d->createCopy()); | |||
| } | |||
| markersX.addCopiesOf (other.markersX); | |||
| markersY.addCopiesOf (other.markersY); | |||
| @@ -62,68 +63,17 @@ DrawableComposite::~DrawableComposite() | |||
| } | |||
| //============================================================================== | |||
| int DrawableComposite::getNumDrawables() const throw() | |||
| { | |||
| return getNumChildComponents(); | |||
| } | |||
| Drawable* DrawableComposite::getDrawable (int index) const | |||
| { | |||
| return dynamic_cast <Drawable*> (getChildComponent (index)); | |||
| } | |||
| void DrawableComposite::insertDrawable (Drawable* drawable, const int index) | |||
| { | |||
| if (drawable != 0) | |||
| addAndMakeVisible (drawable, index); | |||
| } | |||
| void DrawableComposite::insertDrawable (const Drawable& drawable, const int index) | |||
| { | |||
| insertDrawable (drawable.createCopy(), index); | |||
| } | |||
| void DrawableComposite::removeDrawable (const int index, const bool deleteDrawable) | |||
| { | |||
| Drawable* const d = getDrawable (index); | |||
| if (deleteDrawable) | |||
| delete d; | |||
| else | |||
| removeChildComponent (d); | |||
| } | |||
| Drawable* DrawableComposite::getDrawableWithName (const String& name) const throw() | |||
| { | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| if (getChildComponent(i)->getName() == name) | |||
| return getDrawable (i); | |||
| return 0; | |||
| } | |||
| void DrawableComposite::bringToFront (const int index) | |||
| { | |||
| Drawable* d = getDrawable (index); | |||
| if (d != 0) | |||
| d->toFront (false); | |||
| } | |||
| const Rectangle<float> DrawableComposite::getDrawableBounds() const | |||
| { | |||
| Rectangle<float> r; | |||
| for (int i = getNumDrawables(); --i >= 0;) | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| { | |||
| Drawable* const d = getDrawable(i); | |||
| const Drawable* const d = dynamic_cast <const Drawable*> (getChildComponent(i)); | |||
| if (d != 0) | |||
| { | |||
| if (d->isTransformed()) | |||
| r = r.getUnion (d->getDrawableBounds().transformed (d->getTransform())); | |||
| else | |||
| r = r.getUnion (d->getDrawableBounds()); | |||
| } | |||
| r = r.getUnion (d->isTransformed() ? d->getDrawableBounds().transformed (d->getTransform()) | |||
| : d->getDrawableBounds()); | |||
| } | |||
| return r; | |||
| @@ -131,9 +81,9 @@ const Rectangle<float> DrawableComposite::getDrawableBounds() const | |||
| void DrawableComposite::markerHasMoved() | |||
| { | |||
| for (int i = getNumDrawables(); --i >= 0;) | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| { | |||
| Drawable* const d = getDrawable(i); | |||
| Drawable* const d = dynamic_cast <Drawable*> (getChildComponent(i)); | |||
| if (d != 0) | |||
| d->markerHasMoved(); | |||
| @@ -383,69 +333,6 @@ ValueTree DrawableComposite::ValueTreeWrapper::getChildListCreating (UndoManager | |||
| return state.getOrCreateChildWithName (childGroupTag, undoManager); | |||
| } | |||
| int DrawableComposite::ValueTreeWrapper::getNumDrawables() const | |||
| { | |||
| return getChildList().getNumChildren(); | |||
| } | |||
| ValueTree DrawableComposite::ValueTreeWrapper::getDrawableState (int index) const | |||
| { | |||
| return getChildList().getChild (index); | |||
| } | |||
| ValueTree DrawableComposite::ValueTreeWrapper::getDrawableWithId (const String& objectId, bool recursive) const | |||
| { | |||
| if (getID() == objectId) | |||
| return state; | |||
| if (! recursive) | |||
| { | |||
| return getChildList().getChildWithProperty (idProperty, objectId); | |||
| } | |||
| else | |||
| { | |||
| const ValueTree childList (getChildList()); | |||
| for (int i = getNumDrawables(); --i >= 0;) | |||
| { | |||
| const ValueTree& child = childList.getChild (i); | |||
| if (child [Drawable::ValueTreeWrapperBase::idProperty] == objectId) | |||
| return child; | |||
| if (child.hasType (DrawableComposite::valueTreeType)) | |||
| { | |||
| ValueTree v (DrawableComposite::ValueTreeWrapper (child).getDrawableWithId (objectId, true)); | |||
| if (v.isValid()) | |||
| return v; | |||
| } | |||
| } | |||
| return ValueTree::invalid; | |||
| } | |||
| } | |||
| int DrawableComposite::ValueTreeWrapper::indexOfDrawable (const ValueTree& item) const | |||
| { | |||
| return getChildList().indexOf (item); | |||
| } | |||
| void DrawableComposite::ValueTreeWrapper::addDrawable (const ValueTree& newDrawableState, int index, UndoManager* undoManager) | |||
| { | |||
| getChildListCreating (undoManager).addChild (newDrawableState, index, undoManager); | |||
| } | |||
| void DrawableComposite::ValueTreeWrapper::moveDrawableOrder (int currentIndex, int newIndex, UndoManager* undoManager) | |||
| { | |||
| getChildListCreating (undoManager).moveChild (currentIndex, newIndex, undoManager); | |||
| } | |||
| void DrawableComposite::ValueTreeWrapper::removeDrawable (const ValueTree& child, UndoManager* undoManager) | |||
| { | |||
| getChildList().removeChild (child, undoManager); | |||
| } | |||
| const RelativeParallelogram DrawableComposite::ValueTreeWrapper::getBoundingBox() const | |||
| { | |||
| return RelativeParallelogram (state.getProperty (topLeft, "0, 0"), | |||
| @@ -551,10 +438,10 @@ void DrawableComposite::ValueTreeWrapper::removeMarker (bool xAxis, const ValueT | |||
| } | |||
| //============================================================================== | |||
| void DrawableComposite::refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider) | |||
| void DrawableComposite::refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder) | |||
| { | |||
| const ValueTreeWrapper wrapper (tree); | |||
| setName (wrapper.getID()); | |||
| setComponentID (wrapper.getID()); | |||
| const RelativeParallelogram newBounds (wrapper.getBoundingBox()); | |||
| if (bounds != newBounds) | |||
| @@ -594,50 +481,27 @@ void DrawableComposite::refreshFromValueTree (const ValueTree& tree, ImageProvid | |||
| *m = newMarker; | |||
| } | |||
| // Remove deleted drawables.. | |||
| for (i = getNumDrawables(); --i >= wrapper.getNumDrawables();) | |||
| delete getDrawable(i); | |||
| // Update drawables and add new ones.. | |||
| for (i = 0; i < wrapper.getNumDrawables(); ++i) | |||
| { | |||
| const ValueTree newDrawable (wrapper.getDrawableState (i)); | |||
| Drawable* d = getDrawable(i); | |||
| if (d != 0) | |||
| { | |||
| if (newDrawable.hasType (d->getValueTreeType())) | |||
| { | |||
| d->refreshFromValueTree (newDrawable, imageProvider); | |||
| } | |||
| else | |||
| { | |||
| delete d; | |||
| d = 0; | |||
| } | |||
| } | |||
| if (d == 0) | |||
| { | |||
| d = createChildFromValueTree (this, newDrawable, imageProvider); | |||
| addAndMakeVisible (d, i); | |||
| } | |||
| } | |||
| builder.updateChildComponents (*this, wrapper.getChildList()); | |||
| refreshTransformFromBounds(); | |||
| } | |||
| const ValueTree DrawableComposite::createValueTree (ImageProvider* imageProvider) const | |||
| const ValueTree DrawableComposite::createValueTree (ComponentBuilder::ImageProvider* imageProvider) const | |||
| { | |||
| ValueTree tree (valueTreeType); | |||
| ValueTreeWrapper v (tree); | |||
| v.setID (getName(), 0); | |||
| v.setID (getComponentID()); | |||
| v.setBoundingBox (bounds, 0); | |||
| ValueTree childList (v.getChildListCreating (0)); | |||
| int i; | |||
| for (i = 0; i < getNumDrawables(); ++i) | |||
| v.addDrawable (getDrawable(i)->createValueTree (imageProvider), -1, 0); | |||
| for (i = getNumChildComponents(); --i >= 0;) | |||
| { | |||
| const Drawable* const d = dynamic_cast <const Drawable*> (getChildComponent(i)); | |||
| childList.addChild (d->createValueTree (imageProvider), -1, 0); | |||
| } | |||
| for (i = 0; i < markersX.size(); ++i) | |||
| v.setMarker (true, *markersX.getUnchecked(i), 0); | |||
| @@ -49,75 +49,6 @@ public: | |||
| /** Destructor. */ | |||
| ~DrawableComposite(); | |||
| //============================================================================== | |||
| /** Adds a new sub-drawable to this one. | |||
| This passes in a Drawable pointer for this object to look after. To add a copy | |||
| of a drawable, use the form of this method that takes a Drawable reference instead. | |||
| @param drawable the object to add - this will be deleted automatically | |||
| when no longer needed, so the caller mustn't keep any | |||
| pointers to it. | |||
| @param index where to insert it in the list of drawables. 0 is the back, | |||
| -1 is the front, or any value from 0 and getNumDrawables() | |||
| can be used | |||
| @see removeDrawable | |||
| */ | |||
| void insertDrawable (Drawable* drawable, int index = -1); | |||
| /** Adds a new sub-drawable to this one. | |||
| This takes a copy of a Drawable and adds it to this object. To pass in a Drawable | |||
| for this object to look after, use the form of this method that takes a Drawable | |||
| pointer instead. | |||
| @param drawable the object to add - an internal copy will be made of this object | |||
| @param index where to insert it in the list of drawables. 0 is the back, | |||
| -1 is the front, or any value from 0 and getNumDrawables() | |||
| can be used | |||
| @see removeDrawable | |||
| */ | |||
| void insertDrawable (const Drawable& drawable, int index = -1); | |||
| /** Deletes one of the Drawable objects. | |||
| @param index the index of the drawable to delete, between 0 | |||
| and (getNumDrawables() - 1). | |||
| @param deleteDrawable if this is true, the drawable that is removed will also | |||
| be deleted. If false, it'll just be removed. | |||
| @see insertDrawable, getNumDrawables | |||
| */ | |||
| void removeDrawable (int index, bool deleteDrawable = true); | |||
| /** Returns the number of drawables contained inside this one. | |||
| @see getDrawable | |||
| */ | |||
| int getNumDrawables() const throw(); | |||
| /** Returns one of the drawables that are contained in this one. | |||
| Each drawable also has a transform associated with it - you can use getDrawableTransform() | |||
| to find it. | |||
| The pointer returned is managed by this object and will be deleted when no longer | |||
| needed, so be careful what you do with it. | |||
| @see getNumDrawables | |||
| */ | |||
| Drawable* getDrawable (int index) const; | |||
| /** Looks for a child drawable with the specified name. */ | |||
| Drawable* getDrawableWithName (const String& name) const throw(); | |||
| /** Brings one of the Drawables to the front. | |||
| @param index the index of the drawable to move, between 0 | |||
| and (getNumDrawables() - 1). | |||
| @see insertDrawable, getNumDrawables | |||
| */ | |||
| void bringToFront (int index); | |||
| //============================================================================== | |||
| /** Sets the parallelogram that defines the target position of the content rectangle when the drawable is rendered. | |||
| @see setContentArea | |||
| @@ -185,14 +116,12 @@ public: | |||
| /** @internal */ | |||
| Drawable* createCopy() const; | |||
| /** @internal */ | |||
| void refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider); | |||
| void refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder); | |||
| /** @internal */ | |||
| const ValueTree createValueTree (ImageProvider* imageProvider) const; | |||
| const ValueTree createValueTree (ComponentBuilder::ImageProvider* imageProvider) const; | |||
| /** @internal */ | |||
| static const Identifier valueTreeType; | |||
| /** @internal */ | |||
| const Identifier getValueTreeType() const { return valueTreeType; } | |||
| /** @internal */ | |||
| const Expression getSymbolValue (const String& symbol, const String& member) const; | |||
| /** @internal */ | |||
| const Rectangle<float> getDrawableBounds() const; | |||
| @@ -212,13 +141,8 @@ public: | |||
| public: | |||
| ValueTreeWrapper (const ValueTree& state); | |||
| int getNumDrawables() const; | |||
| ValueTree getDrawableState (int index) const; | |||
| ValueTree getDrawableWithId (const String& objectId, bool recursive) const; | |||
| int indexOfDrawable (const ValueTree& item) const; | |||
| void addDrawable (const ValueTree& newDrawableState, int index, UndoManager* undoManager); | |||
| void moveDrawableOrder (int currentIndex, int newIndex, UndoManager* undoManager); | |||
| void removeDrawable (const ValueTree& child, UndoManager* undoManager); | |||
| ValueTree getChildList() const; | |||
| ValueTree getChildListCreating (UndoManager* undoManager); | |||
| const RelativeParallelogram getBoundingBox() const; | |||
| void setBoundingBox (const RelativeParallelogram& newBounds, UndoManager* undoManager); | |||
| @@ -240,8 +164,6 @@ public: | |||
| private: | |||
| static const Identifier childGroupTag, markerGroupTagX, markerGroupTagY, markerTag; | |||
| ValueTree getChildList() const; | |||
| ValueTree getChildListCreating (UndoManager* undoManager); | |||
| ValueTree getMarkerList (bool xAxis) const; | |||
| ValueTree getMarkerListCreating (bool xAxis, UndoManager* undoManager); | |||
| }; | |||
| @@ -226,10 +226,10 @@ void DrawableImage::ValueTreeWrapper::setBoundingBox (const RelativeParallelogra | |||
| //============================================================================== | |||
| void DrawableImage::refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider) | |||
| void DrawableImage::refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder) | |||
| { | |||
| const ValueTreeWrapper controller (tree); | |||
| setName (controller.getID()); | |||
| setComponentID (controller.getID()); | |||
| const float newOpacity = controller.getOpacity(); | |||
| const Colour newOverlayColour (controller.getOverlayColour()); | |||
| @@ -237,10 +237,11 @@ void DrawableImage::refreshFromValueTree (const ValueTree& tree, ImageProvider* | |||
| Image newImage; | |||
| const var imageIdentifier (controller.getImageIdentifier()); | |||
| jassert (imageProvider != 0 || imageIdentifier.isVoid()); // if you're using images, you need to provide something that can load and save them! | |||
| if (imageProvider != 0) | |||
| newImage = imageProvider->getImageForIdentifier (imageIdentifier); | |||
| jassert (builder.getImageProvider() != 0 || imageIdentifier.isVoid()); // if you're using images, you need to provide something that can load and save them! | |||
| if (builder.getImageProvider() != 0) | |||
| newImage = builder.getImageProvider()->getImageForIdentifier (imageIdentifier); | |||
| const RelativeParallelogram newBounds (controller.getBoundingBox()); | |||
| @@ -259,12 +260,12 @@ void DrawableImage::refreshFromValueTree (const ValueTree& tree, ImageProvider* | |||
| } | |||
| } | |||
| const ValueTree DrawableImage::createValueTree (ImageProvider* imageProvider) const | |||
| const ValueTree DrawableImage::createValueTree (ComponentBuilder::ImageProvider* imageProvider) const | |||
| { | |||
| ValueTree tree (valueTreeType); | |||
| ValueTreeWrapper v (tree); | |||
| v.setID (getName(), 0); | |||
| v.setID (getComponentID()); | |||
| v.setOpacity (opacity, 0); | |||
| v.setOverlayColour (overlayColour, 0); | |||
| v.setBoundingBox (bounds, 0); | |||
| @@ -92,13 +92,11 @@ public: | |||
| /** @internal */ | |||
| const Rectangle<float> getDrawableBounds() const; | |||
| /** @internal */ | |||
| void refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider); | |||
| void refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder); | |||
| /** @internal */ | |||
| const ValueTree createValueTree (ImageProvider* imageProvider) const; | |||
| const ValueTree createValueTree (ComponentBuilder::ImageProvider* imageProvider) const; | |||
| /** @internal */ | |||
| static const Identifier valueTreeType; | |||
| /** @internal */ | |||
| const Identifier getValueTreeType() const { return valueTreeType; } | |||
| //============================================================================== | |||
| /** Internally-used class for wrapping a DrawableImage's state into a ValueTree. */ | |||
| @@ -440,12 +440,12 @@ void DrawablePath::ValueTreeWrapper::Element::removePoint (UndoManager* undoMana | |||
| } | |||
| //============================================================================== | |||
| void DrawablePath::refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider) | |||
| void DrawablePath::refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder) | |||
| { | |||
| ValueTreeWrapper v (tree); | |||
| setName (v.getID()); | |||
| setComponentID (v.getID()); | |||
| if (refreshFillTypes (v, getParent(), imageProvider)) | |||
| if (refreshFillTypes (v, getParent(), builder.getImageProvider())) | |||
| repaint(); | |||
| ScopedPointer<RelativePointPath> newRelativePath (new RelativePointPath (tree)); | |||
| @@ -467,12 +467,12 @@ void DrawablePath::refreshFromValueTree (const ValueTree& tree, ImageProvider* i | |||
| relativePath = newRelativePath; | |||
| } | |||
| const ValueTree DrawablePath::createValueTree (ImageProvider* imageProvider) const | |||
| const ValueTree DrawablePath::createValueTree (ComponentBuilder::ImageProvider* imageProvider) const | |||
| { | |||
| ValueTree tree (valueTreeType); | |||
| ValueTreeWrapper v (tree); | |||
| v.setID (getName(), 0); | |||
| v.setID (getComponentID()); | |||
| writeTo (v, imageProvider, 0); | |||
| if (relativePath != 0) | |||
| @@ -64,13 +64,11 @@ public: | |||
| /** @internal */ | |||
| Drawable* createCopy() const; | |||
| /** @internal */ | |||
| void refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider); | |||
| void refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder); | |||
| /** @internal */ | |||
| const ValueTree createValueTree (ImageProvider* imageProvider) const; | |||
| const ValueTree createValueTree (ComponentBuilder::ImageProvider* imageProvider) const; | |||
| /** @internal */ | |||
| static const Identifier valueTreeType; | |||
| /** @internal */ | |||
| const Identifier getValueTreeType() const { return valueTreeType; } | |||
| //============================================================================== | |||
| /** Internally-used class for wrapping a DrawablePath's state into a ValueTree. */ | |||
| @@ -143,12 +143,12 @@ Value DrawableRectangle::ValueTreeWrapper::getCornerSizeValue (UndoManager* undo | |||
| } | |||
| //============================================================================== | |||
| void DrawableRectangle::refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider) | |||
| void DrawableRectangle::refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder) | |||
| { | |||
| ValueTreeWrapper v (tree); | |||
| setName (v.getID()); | |||
| setComponentID (v.getID()); | |||
| if (refreshFillTypes (v, getParent(), imageProvider)) | |||
| if (refreshFillTypes (v, getParent(), builder.getImageProvider())) | |||
| repaint(); | |||
| RelativeParallelogram newBounds (v.getRectangle()); | |||
| @@ -166,12 +166,12 @@ void DrawableRectangle::refreshFromValueTree (const ValueTree& tree, ImageProvid | |||
| } | |||
| } | |||
| const ValueTree DrawableRectangle::createValueTree (ImageProvider* imageProvider) const | |||
| const ValueTree DrawableRectangle::createValueTree (ComponentBuilder::ImageProvider* imageProvider) const | |||
| { | |||
| ValueTree tree (valueTreeType); | |||
| ValueTreeWrapper v (tree); | |||
| v.setID (getName(), 0); | |||
| v.setID (getComponentID()); | |||
| writeTo (v, imageProvider, 0); | |||
| v.setRectangle (bounds, 0); | |||
| v.setCornerSize (cornerSize, 0); | |||
| @@ -64,13 +64,11 @@ public: | |||
| /** @internal */ | |||
| Drawable* createCopy() const; | |||
| /** @internal */ | |||
| void refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider); | |||
| void refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder); | |||
| /** @internal */ | |||
| const ValueTree createValueTree (ImageProvider* imageProvider) const; | |||
| const ValueTree createValueTree (ComponentBuilder::ImageProvider* imageProvider) const; | |||
| /** @internal */ | |||
| static const Identifier valueTreeType; | |||
| /** @internal */ | |||
| const Identifier getValueTreeType() const { return valueTreeType; } | |||
| //============================================================================== | |||
| /** Internally-used class for wrapping a DrawableRectangle's state into a ValueTree. */ | |||
| @@ -78,7 +78,7 @@ bool DrawableShape::isStrokeVisible() const throw() | |||
| bool DrawableShape::refreshFillTypes (const FillAndStrokeState& newState, | |||
| Expression::EvaluationContext* /*nameFinder*/, | |||
| ImageProvider* imageProvider) | |||
| ComponentBuilder::ImageProvider* imageProvider) | |||
| { | |||
| bool hasChanged = false; | |||
| @@ -105,7 +105,7 @@ bool DrawableShape::refreshFillTypes (const FillAndStrokeState& newState, | |||
| return hasChanged; | |||
| } | |||
| void DrawableShape::writeTo (FillAndStrokeState& state, ImageProvider* imageProvider, UndoManager* undoManager) const | |||
| void DrawableShape::writeTo (FillAndStrokeState& state, ComponentBuilder::ImageProvider* imageProvider, UndoManager* undoManager) const | |||
| { | |||
| state.setMainFill (mainFill, 0, 0, 0, imageProvider, undoManager); | |||
| state.setStrokeFill (strokeFill, 0, 0, 0, imageProvider, undoManager); | |||
| @@ -182,7 +182,7 @@ DrawableShape::FillAndStrokeState::FillAndStrokeState (const ValueTree& state_) | |||
| } | |||
| const FillType DrawableShape::FillAndStrokeState::getMainFill (Expression::EvaluationContext* nameFinder, | |||
| ImageProvider* imageProvider) const | |||
| ComponentBuilder::ImageProvider* imageProvider) const | |||
| { | |||
| return readFillType (state.getChildWithName (fill), 0, 0, 0, nameFinder, imageProvider); | |||
| } | |||
| @@ -198,14 +198,14 @@ ValueTree DrawableShape::FillAndStrokeState::getMainFillState() | |||
| } | |||
| void DrawableShape::FillAndStrokeState::setMainFill (const FillType& newFill, const RelativePoint* gp1, const RelativePoint* gp2, | |||
| const RelativePoint* gp3, ImageProvider* imageProvider, UndoManager* undoManager) | |||
| const RelativePoint* gp3, ComponentBuilder::ImageProvider* imageProvider, UndoManager* undoManager) | |||
| { | |||
| ValueTree v (state.getOrCreateChildWithName (fill, undoManager)); | |||
| writeFillType (v, newFill, gp1, gp2, gp3, imageProvider, undoManager); | |||
| } | |||
| const FillType DrawableShape::FillAndStrokeState::getStrokeFill (Expression::EvaluationContext* nameFinder, | |||
| ImageProvider* imageProvider) const | |||
| ComponentBuilder::ImageProvider* imageProvider) const | |||
| { | |||
| return readFillType (state.getChildWithName (stroke), 0, 0, 0, nameFinder, imageProvider); | |||
| } | |||
| @@ -221,7 +221,7 @@ ValueTree DrawableShape::FillAndStrokeState::getStrokeFillState() | |||
| } | |||
| void DrawableShape::FillAndStrokeState::setStrokeFill (const FillType& newFill, const RelativePoint* gp1, const RelativePoint* gp2, | |||
| const RelativePoint* gp3, ImageProvider* imageProvider, UndoManager* undoManager) | |||
| const RelativePoint* gp3, ComponentBuilder::ImageProvider* imageProvider, UndoManager* undoManager) | |||
| { | |||
| ValueTree v (state.getOrCreateChildWithName (stroke, undoManager)); | |||
| writeFillType (v, newFill, gp1, gp2, gp3, imageProvider, undoManager); | |||
| @@ -251,7 +251,7 @@ void DrawableShape::FillAndStrokeState::setStrokeType (const PathStrokeType& new | |||
| } | |||
| const FillType DrawableShape::FillAndStrokeState::readFillType (const ValueTree& v, RelativePoint* const gp1, RelativePoint* const gp2, RelativePoint* const gp3, | |||
| Expression::EvaluationContext* const nameFinder, ImageProvider* imageProvider) | |||
| Expression::EvaluationContext* const nameFinder, ComponentBuilder::ImageProvider* imageProvider) | |||
| { | |||
| const String newType (v[type].toString()); | |||
| @@ -326,7 +326,7 @@ namespace DrawableShapeHelpers | |||
| void DrawableShape::FillAndStrokeState::writeFillType (ValueTree& v, const FillType& fillType, | |||
| const RelativePoint* const gp1, const RelativePoint* const gp2, const RelativePoint* gp3, | |||
| ImageProvider* imageProvider, UndoManager* const undoManager) | |||
| ComponentBuilder::ImageProvider* imageProvider, UndoManager* const undoManager) | |||
| { | |||
| if (fillType.isColour()) | |||
| { | |||
| @@ -96,18 +96,18 @@ public: | |||
| FillAndStrokeState (const ValueTree& state); | |||
| const FillType getMainFill (Expression::EvaluationContext* nameFinder, | |||
| ImageProvider* imageProvider) const; | |||
| ComponentBuilder::ImageProvider* imageProvider) const; | |||
| ValueTree getMainFillState(); | |||
| void setMainFill (const FillType& newFill, const RelativePoint* gradientPoint1, | |||
| const RelativePoint* gradientPoint2, const RelativePoint* gradientPoint3, | |||
| ImageProvider* imageProvider, UndoManager* undoManager); | |||
| ComponentBuilder::ImageProvider* imageProvider, UndoManager* undoManager); | |||
| const FillType getStrokeFill (Expression::EvaluationContext* nameFinder, | |||
| ImageProvider* imageProvider) const; | |||
| ComponentBuilder::ImageProvider* imageProvider) const; | |||
| ValueTree getStrokeFillState(); | |||
| void setStrokeFill (const FillType& newFill, const RelativePoint* gradientPoint1, | |||
| const RelativePoint* gradientPoint2, const RelativePoint* gradientPoint3, | |||
| ImageProvider* imageProvider, UndoManager* undoManager); | |||
| ComponentBuilder::ImageProvider* imageProvider, UndoManager* undoManager); | |||
| const PathStrokeType getStrokeType() const; | |||
| void setStrokeType (const PathStrokeType& newStrokeType, UndoManager* undoManager); | |||
| @@ -115,11 +115,11 @@ public: | |||
| static const FillType readFillType (const ValueTree& v, RelativePoint* gradientPoint1, | |||
| RelativePoint* gradientPoint2, RelativePoint* gradientPoint3, | |||
| Expression::EvaluationContext* nameFinder, | |||
| ImageProvider* imageProvider); | |||
| ComponentBuilder::ImageProvider* imageProvider); | |||
| static void writeFillType (ValueTree& v, const FillType& fillType, | |||
| const RelativePoint* gradientPoint1, const RelativePoint* gradientPoint2, | |||
| const RelativePoint* gradientPoint3, ImageProvider* imageProvider, | |||
| const RelativePoint* gradientPoint3, ComponentBuilder::ImageProvider* imageProvider, | |||
| UndoManager* undoManager); | |||
| static const Identifier type, colour, colours, fill, stroke, path, jointStyle, capStyle, strokeWidth, | |||
| @@ -149,10 +149,10 @@ protected: | |||
| /** Updates the details from a FillAndStrokeState object, returning true if something changed. */ | |||
| bool refreshFillTypes (const FillAndStrokeState& newState, | |||
| Expression::EvaluationContext* nameFinder, | |||
| ImageProvider* imageProvider); | |||
| ComponentBuilder::ImageProvider* imageProvider); | |||
| /** Writes the stroke and fill details to a FillAndStrokeState object. */ | |||
| void writeTo (FillAndStrokeState& state, ImageProvider* imageProvider, UndoManager* undoManager) const; | |||
| void writeTo (FillAndStrokeState& state, ComponentBuilder::ImageProvider* imageProvider, UndoManager* undoManager) const; | |||
| //============================================================================== | |||
| @@ -239,10 +239,10 @@ void DrawableText::ValueTreeWrapper::setFontSizeControlPoint (const RelativePoin | |||
| } | |||
| //============================================================================== | |||
| void DrawableText::refreshFromValueTree (const ValueTree& tree, ImageProvider*) | |||
| void DrawableText::refreshFromValueTree (const ValueTree& tree, ComponentBuilder&) | |||
| { | |||
| ValueTreeWrapper v (tree); | |||
| setName (v.getID()); | |||
| setComponentID (v.getID()); | |||
| const RelativeParallelogram newBounds (v.getBoundingBox()); | |||
| const RelativePoint newFontPoint (v.getFontSizeControlPoint()); | |||
| @@ -264,12 +264,12 @@ void DrawableText::refreshFromValueTree (const ValueTree& tree, ImageProvider*) | |||
| } | |||
| } | |||
| const ValueTree DrawableText::createValueTree (ImageProvider*) const | |||
| const ValueTree DrawableText::createValueTree (ComponentBuilder::ImageProvider*) const | |||
| { | |||
| ValueTree tree (valueTreeType); | |||
| ValueTreeWrapper v (tree); | |||
| v.setID (getName(), 0); | |||
| v.setID (getComponentID()); | |||
| v.setText (text, 0); | |||
| v.setFont (font, 0); | |||
| v.setJustification (justification, 0); | |||
| @@ -91,14 +91,12 @@ public: | |||
| /** @internal */ | |||
| Drawable* createCopy() const; | |||
| /** @internal */ | |||
| void refreshFromValueTree (const ValueTree& tree, ImageProvider* imageProvider); | |||
| void refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder); | |||
| /** @internal */ | |||
| const ValueTree createValueTree (ImageProvider* imageProvider) const; | |||
| const ValueTree createValueTree (ComponentBuilder::ImageProvider* imageProvider) const; | |||
| /** @internal */ | |||
| static const Identifier valueTreeType; | |||
| /** @internal */ | |||
| const Identifier getValueTreeType() const { return valueTreeType; } | |||
| /** @internal */ | |||
| const Rectangle<float> getDrawableBounds() const; | |||
| //============================================================================== | |||
| @@ -161,7 +161,7 @@ private: | |||
| else if (e->hasTagName ("switch")) d = parseSwitch (*e); | |||
| else if (e->hasTagName ("style")) parseCSSStyle (*e); | |||
| parentDrawable->insertDrawable (d); | |||
| parentDrawable->addAndMakeVisible (d); | |||
| } | |||
| } | |||
| @@ -428,6 +428,9 @@ | |||
| #ifndef __JUCE_COMPONENTBOUNDSCONSTRAINER_JUCEHEADER__ | |||
| #include "gui/components/layout/juce_ComponentBoundsConstrainer.h" | |||
| #endif | |||
| #ifndef __JUCE_COMPONENTBUILDER_JUCEHEADER__ | |||
| #include "gui/components/layout/juce_ComponentBuilder.h" | |||
| #endif | |||
| #ifndef __JUCE_COMPONENTMOVEMENTWATCHER_JUCEHEADER__ | |||
| #include "gui/components/layout/juce_ComponentMovementWatcher.h" | |||
| #endif | |||
| @@ -54,8 +54,6 @@ extern bool juce_IsRunningInWine(); | |||
| #define AC_SRC_ALPHA 0x01 | |||
| #endif | |||
| static HPALETTE palette = 0; | |||
| static bool createPaletteIfNeeded = true; | |||
| static bool shouldDeactivateTitleBar = true; | |||
| #define WM_TRAYNOTIFY WM_USER + 100 | |||
| @@ -249,25 +247,6 @@ public: | |||
| hdd = DrawDibOpen(); | |||
| } | |||
| if (createPaletteIfNeeded) | |||
| { | |||
| HDC dc = GetDC (0); | |||
| const int n = GetDeviceCaps (dc, BITSPIXEL); | |||
| ReleaseDC (0, dc); | |||
| if (n <= 8) | |||
| palette = CreateHalftonePalette (dc); | |||
| createPaletteIfNeeded = false; | |||
| } | |||
| if (palette != 0) | |||
| { | |||
| SelectPalette (dc, palette, FALSE); | |||
| RealizePalette (dc); | |||
| SetStretchBltMode (dc, HALFTONE); | |||
| } | |||
| SetMapMode (dc, MM_TEXT); | |||
| if (transparent) | |||
| @@ -2201,13 +2180,8 @@ private: | |||
| case WM_SYNCPAINT: | |||
| return 0; | |||
| case WM_PALETTECHANGED: | |||
| InvalidateRect (h, 0, 0); | |||
| break; | |||
| case WM_DISPLAYCHANGE: | |||
| InvalidateRect (h, 0, 0); | |||
| createPaletteIfNeeded = true; | |||
| // intentional fall-through... | |||
| case WM_SETTINGCHANGE: // note the fall-through in the previous case! | |||
| doSettingChange(); | |||