mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Removed the PositionedRectangle class (this has been superseded by the RelativeRectangle class. If you still need PositionedRectangle in your code, just grab a copy of the class from the last revision and put it directly into your codebase). Changed the BorderSize class to be templated like Point, Line, Rectangle, etc - if you've used a BorderSize anywhere, just replace "BorderSize" with "BorderSize<int>" to get it compiling again. Updated Graphics::drawDashedLine to take a Line object.
This commit is contained in:
parent
837f4c8d81
commit
e7f4dac9f9
54 changed files with 914 additions and 1808 deletions
|
|
@ -253,11 +253,9 @@ OBJECTS := \
|
|||
$(OBJDIR)/juce_TextLayout_d18f700e.o \
|
||||
$(OBJDIR)/juce_Typeface_34b3026e.o \
|
||||
$(OBJDIR)/juce_AffineTransform_4a320188.o \
|
||||
$(OBJDIR)/juce_BorderSize_bf140c3c.o \
|
||||
$(OBJDIR)/juce_Path_dcdd4594.o \
|
||||
$(OBJDIR)/juce_PathIterator_4e116c22.o \
|
||||
$(OBJDIR)/juce_PathStrokeType_506dcb86.o \
|
||||
$(OBJDIR)/juce_PositionedRectangle_1b6e8982.o \
|
||||
$(OBJDIR)/juce_RectangleList_b6ae7ee8.o \
|
||||
$(OBJDIR)/juce_GIFLoader_61887b90.o \
|
||||
$(OBJDIR)/juce_JPEGLoader_412d2ccc.o \
|
||||
|
|
@ -1437,11 +1435,6 @@ $(OBJDIR)/juce_AffineTransform_4a320188.o: ../../src/gui/graphics/geometry/juce_
|
|||
@echo "Compiling juce_AffineTransform.cpp"
|
||||
@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
|
||||
|
||||
$(OBJDIR)/juce_BorderSize_bf140c3c.o: ../../src/gui/graphics/geometry/juce_BorderSize.cpp
|
||||
-@mkdir -p $(OBJDIR)
|
||||
@echo "Compiling juce_BorderSize.cpp"
|
||||
@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
|
||||
|
||||
$(OBJDIR)/juce_Path_dcdd4594.o: ../../src/gui/graphics/geometry/juce_Path.cpp
|
||||
-@mkdir -p $(OBJDIR)
|
||||
@echo "Compiling juce_Path.cpp"
|
||||
|
|
@ -1457,11 +1450,6 @@ $(OBJDIR)/juce_PathStrokeType_506dcb86.o: ../../src/gui/graphics/geometry/juce_P
|
|||
@echo "Compiling juce_PathStrokeType.cpp"
|
||||
@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
|
||||
|
||||
$(OBJDIR)/juce_PositionedRectangle_1b6e8982.o: ../../src/gui/graphics/geometry/juce_PositionedRectangle.cpp
|
||||
-@mkdir -p $(OBJDIR)
|
||||
@echo "Compiling juce_PositionedRectangle.cpp"
|
||||
@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
|
||||
|
||||
$(OBJDIR)/juce_RectangleList_b6ae7ee8.o: ../../src/gui/graphics/geometry/juce_RectangleList.cpp
|
||||
-@mkdir -p $(OBJDIR)
|
||||
@echo "Compiling juce_RectangleList.cpp"
|
||||
|
|
|
|||
|
|
@ -222,11 +222,9 @@
|
|||
803FFCA3DAC0C004A80143B4 = { isa = PBXBuildFile; fileRef = 91CB423DBC5F3CBEDD9CF2EF; };
|
||||
F0556B3AD9D388177E26B90D = { isa = PBXBuildFile; fileRef = AF66A9951377E2D04C54CADD; };
|
||||
0558FFF11AED944C6B3E5FB5 = { isa = PBXBuildFile; fileRef = 2ED8CC539A9D9BE611F67A9A; };
|
||||
11109DE27B3E3E3863360113 = { isa = PBXBuildFile; fileRef = 4B550E0887AA76BBAF8BA5BF; };
|
||||
CF73FAC91E319C464F07C966 = { isa = PBXBuildFile; fileRef = 29BC53FEE9BC27F44534C909; };
|
||||
B6D3EDA0F2E3516F3922F23F = { isa = PBXBuildFile; fileRef = 312F208B501E0D7764C6B613; };
|
||||
E7C9FAA5F8A4AEDAD8A8CC1D = { isa = PBXBuildFile; fileRef = 9D3F1BAB1D48DDECB9F35916; };
|
||||
DC4BB8AFC054ECD4141B47CC = { isa = PBXBuildFile; fileRef = 11D8021D49B895410A836486; };
|
||||
084C9F2D4F78134CB1EFE676 = { isa = PBXBuildFile; fileRef = 1B170F70AF8AA0A39074F671; };
|
||||
4DAD08CD3A688747C9CA237B = { isa = PBXBuildFile; fileRef = 0F1C5770B363EF7DF64A876A; };
|
||||
60FE8BFA252E3EF2D60B77AD = { isa = PBXBuildFile; fileRef = 6619D27E74F623B1E8CE8F71; };
|
||||
|
|
@ -839,7 +837,6 @@
|
|||
932024E0F2A2CC22B7657691 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Typeface.h; path = ../../src/gui/graphics/fonts/juce_Typeface.h; sourceTree = SOURCE_ROOT; };
|
||||
2ED8CC539A9D9BE611F67A9A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_AffineTransform.cpp; path = ../../src/gui/graphics/geometry/juce_AffineTransform.cpp; sourceTree = SOURCE_ROOT; };
|
||||
5CD42FFF9F1A509D117BD0CB = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_AffineTransform.h; path = ../../src/gui/graphics/geometry/juce_AffineTransform.h; sourceTree = SOURCE_ROOT; };
|
||||
4B550E0887AA76BBAF8BA5BF = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_BorderSize.cpp; path = ../../src/gui/graphics/geometry/juce_BorderSize.cpp; sourceTree = SOURCE_ROOT; };
|
||||
C18F342C087F69D141B3FAF5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_BorderSize.h; path = ../../src/gui/graphics/geometry/juce_BorderSize.h; sourceTree = SOURCE_ROOT; };
|
||||
4011751B9EFCA7B9345D7D7C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Line.h; path = ../../src/gui/graphics/geometry/juce_Line.h; sourceTree = SOURCE_ROOT; };
|
||||
29BC53FEE9BC27F44534C909 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_Path.cpp; path = ../../src/gui/graphics/geometry/juce_Path.cpp; sourceTree = SOURCE_ROOT; };
|
||||
|
|
@ -849,8 +846,6 @@
|
|||
9D3F1BAB1D48DDECB9F35916 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_PathStrokeType.cpp; path = ../../src/gui/graphics/geometry/juce_PathStrokeType.cpp; sourceTree = SOURCE_ROOT; };
|
||||
C2700BB57B9EED7BFE975564 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PathStrokeType.h; path = ../../src/gui/graphics/geometry/juce_PathStrokeType.h; sourceTree = SOURCE_ROOT; };
|
||||
132E3C38B4F0C6229EDF7000 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Point.h; path = ../../src/gui/graphics/geometry/juce_Point.h; sourceTree = SOURCE_ROOT; };
|
||||
11D8021D49B895410A836486 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_PositionedRectangle.cpp; path = ../../src/gui/graphics/geometry/juce_PositionedRectangle.cpp; sourceTree = SOURCE_ROOT; };
|
||||
469347B6414F2CE9DCEEA386 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PositionedRectangle.h; path = ../../src/gui/graphics/geometry/juce_PositionedRectangle.h; sourceTree = SOURCE_ROOT; };
|
||||
F8C44FF03700F6140950F373 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Rectangle.h; path = ../../src/gui/graphics/geometry/juce_Rectangle.h; sourceTree = SOURCE_ROOT; };
|
||||
1B170F70AF8AA0A39074F671 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_RectangleList.cpp; path = ../../src/gui/graphics/geometry/juce_RectangleList.cpp; sourceTree = SOURCE_ROOT; };
|
||||
8B7D7435287A20CB2D8E3704 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_RectangleList.h; path = ../../src/gui/graphics/geometry/juce_RectangleList.h; sourceTree = SOURCE_ROOT; };
|
||||
|
|
@ -1613,7 +1608,6 @@
|
|||
BF4679D9201C5AAE6751536B = { isa = PBXGroup; children = (
|
||||
2ED8CC539A9D9BE611F67A9A,
|
||||
5CD42FFF9F1A509D117BD0CB,
|
||||
4B550E0887AA76BBAF8BA5BF,
|
||||
C18F342C087F69D141B3FAF5,
|
||||
4011751B9EFCA7B9345D7D7C,
|
||||
29BC53FEE9BC27F44534C909,
|
||||
|
|
@ -1623,8 +1617,6 @@
|
|||
9D3F1BAB1D48DDECB9F35916,
|
||||
C2700BB57B9EED7BFE975564,
|
||||
132E3C38B4F0C6229EDF7000,
|
||||
11D8021D49B895410A836486,
|
||||
469347B6414F2CE9DCEEA386,
|
||||
F8C44FF03700F6140950F373,
|
||||
1B170F70AF8AA0A39074F671,
|
||||
8B7D7435287A20CB2D8E3704 ); name = geometry; sourceTree = "<group>"; };
|
||||
|
|
@ -2178,11 +2170,9 @@
|
|||
803FFCA3DAC0C004A80143B4,
|
||||
F0556B3AD9D388177E26B90D,
|
||||
0558FFF11AED944C6B3E5FB5,
|
||||
11109DE27B3E3E3863360113,
|
||||
CF73FAC91E319C464F07C966,
|
||||
B6D3EDA0F2E3516F3922F23F,
|
||||
E7C9FAA5F8A4AEDAD8A8CC1D,
|
||||
DC4BB8AFC054ECD4141B47CC,
|
||||
084C9F2D4F78134CB1EFE676,
|
||||
4DAD08CD3A688747C9CA237B,
|
||||
60FE8BFA252E3EF2D60B77AD,
|
||||
|
|
|
|||
|
|
@ -745,7 +745,6 @@
|
|||
<Filter Name="geometry">
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_AffineTransform.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_AffineTransform.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_BorderSize.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_BorderSize.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_Line.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_Path.cpp"/>
|
||||
|
|
@ -755,8 +754,6 @@
|
|||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_PathStrokeType.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_PathStrokeType.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_Point.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_PositionedRectangle.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_PositionedRectangle.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_Rectangle.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_RectangleList.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_RectangleList.h"/>
|
||||
|
|
|
|||
|
|
@ -745,7 +745,6 @@
|
|||
<Filter Name="geometry">
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_AffineTransform.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_AffineTransform.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_BorderSize.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_BorderSize.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_Line.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_Path.cpp"/>
|
||||
|
|
@ -755,8 +754,6 @@
|
|||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_PathStrokeType.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_PathStrokeType.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_Point.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_PositionedRectangle.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_PositionedRectangle.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_Rectangle.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_RectangleList.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_RectangleList.h"/>
|
||||
|
|
|
|||
|
|
@ -747,7 +747,6 @@
|
|||
<Filter Name="geometry">
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_AffineTransform.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_AffineTransform.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_BorderSize.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_BorderSize.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_Line.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_Path.cpp"/>
|
||||
|
|
@ -757,8 +756,6 @@
|
|||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_PathStrokeType.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_PathStrokeType.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_Point.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_PositionedRectangle.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_PositionedRectangle.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_Rectangle.h"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_RectangleList.cpp"/>
|
||||
<File RelativePath="..\..\src\gui\graphics\geometry\juce_RectangleList.h"/>
|
||||
|
|
|
|||
|
|
@ -336,11 +336,9 @@
|
|||
<ClCompile Include="..\..\src\gui\graphics\fonts\juce_TextLayout.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\graphics\fonts\juce_Typeface.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\graphics\geometry\juce_AffineTransform.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\graphics\geometry\juce_BorderSize.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\graphics\geometry\juce_Path.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\graphics\geometry\juce_PathIterator.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\graphics\geometry\juce_PathStrokeType.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\graphics\geometry\juce_PositionedRectangle.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\graphics\geometry\juce_RectangleList.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\graphics\imaging\image_file_formats\juce_GIFLoader.cpp"/>
|
||||
<ClCompile Include="..\..\src\gui\graphics\imaging\image_file_formats\juce_JPEGLoader.cpp"/>
|
||||
|
|
@ -707,7 +705,6 @@
|
|||
<ClInclude Include="..\..\src\gui\graphics\geometry\juce_PathIterator.h"/>
|
||||
<ClInclude Include="..\..\src\gui\graphics\geometry\juce_PathStrokeType.h"/>
|
||||
<ClInclude Include="..\..\src\gui\graphics\geometry\juce_Point.h"/>
|
||||
<ClInclude Include="..\..\src\gui\graphics\geometry\juce_PositionedRectangle.h"/>
|
||||
<ClInclude Include="..\..\src\gui\graphics\geometry\juce_Rectangle.h"/>
|
||||
<ClInclude Include="..\..\src\gui\graphics\geometry\juce_RectangleList.h"/>
|
||||
<ClInclude Include="..\..\src\gui\graphics\imaging\juce_CameraDevice.h"/>
|
||||
|
|
|
|||
|
|
@ -865,9 +865,6 @@
|
|||
<ClCompile Include="..\..\src\gui\graphics\geometry\juce_AffineTransform.cpp">
|
||||
<Filter>Juce\Source\gui\graphics\geometry</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\gui\graphics\geometry\juce_BorderSize.cpp">
|
||||
<Filter>Juce\Source\gui\graphics\geometry</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\gui\graphics\geometry\juce_Path.cpp">
|
||||
<Filter>Juce\Source\gui\graphics\geometry</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -877,9 +874,6 @@
|
|||
<ClCompile Include="..\..\src\gui\graphics\geometry\juce_PathStrokeType.cpp">
|
||||
<Filter>Juce\Source\gui\graphics\geometry</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\gui\graphics\geometry\juce_PositionedRectangle.cpp">
|
||||
<Filter>Juce\Source\gui\graphics\geometry</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\gui\graphics\geometry\juce_RectangleList.cpp">
|
||||
<Filter>Juce\Source\gui\graphics\geometry</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -2052,9 +2046,6 @@
|
|||
<ClInclude Include="..\..\src\gui\graphics\geometry\juce_Point.h">
|
||||
<Filter>Juce\Source\gui\graphics\geometry</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\gui\graphics\geometry\juce_PositionedRectangle.h">
|
||||
<Filter>Juce\Source\gui\graphics\geometry</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\gui\graphics\geometry\juce_Rectangle.h">
|
||||
<Filter>Juce\Source\gui\graphics\geometry</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
|||
|
|
@ -222,11 +222,9 @@
|
|||
803FFCA3DAC0C004A80143B4 = { isa = PBXBuildFile; fileRef = 91CB423DBC5F3CBEDD9CF2EF; };
|
||||
F0556B3AD9D388177E26B90D = { isa = PBXBuildFile; fileRef = AF66A9951377E2D04C54CADD; };
|
||||
0558FFF11AED944C6B3E5FB5 = { isa = PBXBuildFile; fileRef = 2ED8CC539A9D9BE611F67A9A; };
|
||||
11109DE27B3E3E3863360113 = { isa = PBXBuildFile; fileRef = 4B550E0887AA76BBAF8BA5BF; };
|
||||
CF73FAC91E319C464F07C966 = { isa = PBXBuildFile; fileRef = 29BC53FEE9BC27F44534C909; };
|
||||
B6D3EDA0F2E3516F3922F23F = { isa = PBXBuildFile; fileRef = 312F208B501E0D7764C6B613; };
|
||||
E7C9FAA5F8A4AEDAD8A8CC1D = { isa = PBXBuildFile; fileRef = 9D3F1BAB1D48DDECB9F35916; };
|
||||
DC4BB8AFC054ECD4141B47CC = { isa = PBXBuildFile; fileRef = 11D8021D49B895410A836486; };
|
||||
084C9F2D4F78134CB1EFE676 = { isa = PBXBuildFile; fileRef = 1B170F70AF8AA0A39074F671; };
|
||||
4DAD08CD3A688747C9CA237B = { isa = PBXBuildFile; fileRef = 0F1C5770B363EF7DF64A876A; };
|
||||
60FE8BFA252E3EF2D60B77AD = { isa = PBXBuildFile; fileRef = 6619D27E74F623B1E8CE8F71; };
|
||||
|
|
@ -839,7 +837,6 @@
|
|||
932024E0F2A2CC22B7657691 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Typeface.h; path = ../../src/gui/graphics/fonts/juce_Typeface.h; sourceTree = SOURCE_ROOT; };
|
||||
2ED8CC539A9D9BE611F67A9A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_AffineTransform.cpp; path = ../../src/gui/graphics/geometry/juce_AffineTransform.cpp; sourceTree = SOURCE_ROOT; };
|
||||
5CD42FFF9F1A509D117BD0CB = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_AffineTransform.h; path = ../../src/gui/graphics/geometry/juce_AffineTransform.h; sourceTree = SOURCE_ROOT; };
|
||||
4B550E0887AA76BBAF8BA5BF = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_BorderSize.cpp; path = ../../src/gui/graphics/geometry/juce_BorderSize.cpp; sourceTree = SOURCE_ROOT; };
|
||||
C18F342C087F69D141B3FAF5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_BorderSize.h; path = ../../src/gui/graphics/geometry/juce_BorderSize.h; sourceTree = SOURCE_ROOT; };
|
||||
4011751B9EFCA7B9345D7D7C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Line.h; path = ../../src/gui/graphics/geometry/juce_Line.h; sourceTree = SOURCE_ROOT; };
|
||||
29BC53FEE9BC27F44534C909 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_Path.cpp; path = ../../src/gui/graphics/geometry/juce_Path.cpp; sourceTree = SOURCE_ROOT; };
|
||||
|
|
@ -849,8 +846,6 @@
|
|||
9D3F1BAB1D48DDECB9F35916 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_PathStrokeType.cpp; path = ../../src/gui/graphics/geometry/juce_PathStrokeType.cpp; sourceTree = SOURCE_ROOT; };
|
||||
C2700BB57B9EED7BFE975564 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PathStrokeType.h; path = ../../src/gui/graphics/geometry/juce_PathStrokeType.h; sourceTree = SOURCE_ROOT; };
|
||||
132E3C38B4F0C6229EDF7000 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Point.h; path = ../../src/gui/graphics/geometry/juce_Point.h; sourceTree = SOURCE_ROOT; };
|
||||
11D8021D49B895410A836486 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_PositionedRectangle.cpp; path = ../../src/gui/graphics/geometry/juce_PositionedRectangle.cpp; sourceTree = SOURCE_ROOT; };
|
||||
469347B6414F2CE9DCEEA386 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PositionedRectangle.h; path = ../../src/gui/graphics/geometry/juce_PositionedRectangle.h; sourceTree = SOURCE_ROOT; };
|
||||
F8C44FF03700F6140950F373 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_Rectangle.h; path = ../../src/gui/graphics/geometry/juce_Rectangle.h; sourceTree = SOURCE_ROOT; };
|
||||
1B170F70AF8AA0A39074F671 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_RectangleList.cpp; path = ../../src/gui/graphics/geometry/juce_RectangleList.cpp; sourceTree = SOURCE_ROOT; };
|
||||
8B7D7435287A20CB2D8E3704 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_RectangleList.h; path = ../../src/gui/graphics/geometry/juce_RectangleList.h; sourceTree = SOURCE_ROOT; };
|
||||
|
|
@ -1613,7 +1608,6 @@
|
|||
BF4679D9201C5AAE6751536B = { isa = PBXGroup; children = (
|
||||
2ED8CC539A9D9BE611F67A9A,
|
||||
5CD42FFF9F1A509D117BD0CB,
|
||||
4B550E0887AA76BBAF8BA5BF,
|
||||
C18F342C087F69D141B3FAF5,
|
||||
4011751B9EFCA7B9345D7D7C,
|
||||
29BC53FEE9BC27F44534C909,
|
||||
|
|
@ -1623,8 +1617,6 @@
|
|||
9D3F1BAB1D48DDECB9F35916,
|
||||
C2700BB57B9EED7BFE975564,
|
||||
132E3C38B4F0C6229EDF7000,
|
||||
11D8021D49B895410A836486,
|
||||
469347B6414F2CE9DCEEA386,
|
||||
F8C44FF03700F6140950F373,
|
||||
1B170F70AF8AA0A39074F671,
|
||||
8B7D7435287A20CB2D8E3704 ); name = geometry; sourceTree = "<group>"; };
|
||||
|
|
@ -2178,11 +2170,9 @@
|
|||
803FFCA3DAC0C004A80143B4,
|
||||
F0556B3AD9D388177E26B90D,
|
||||
0558FFF11AED944C6B3E5FB5,
|
||||
11109DE27B3E3E3863360113,
|
||||
CF73FAC91E319C464F07C966,
|
||||
B6D3EDA0F2E3516F3922F23F,
|
||||
E7C9FAA5F8A4AEDAD8A8CC1D,
|
||||
DC4BB8AFC054ECD4141B47CC,
|
||||
084C9F2D4F78134CB1EFE676,
|
||||
4DAD08CD3A688747C9CA237B,
|
||||
60FE8BFA252E3EF2D60B77AD,
|
||||
|
|
|
|||
|
|
@ -1092,8 +1092,6 @@
|
|||
file="src/gui/graphics/geometry/juce_AffineTransform.cpp"/>
|
||||
<FILE id="NWFLILuh7" name="juce_AffineTransform.h" compile="0" resource="0"
|
||||
file="src/gui/graphics/geometry/juce_AffineTransform.h"/>
|
||||
<FILE id="EzBXrEdQc" name="juce_BorderSize.cpp" compile="1" resource="0"
|
||||
file="src/gui/graphics/geometry/juce_BorderSize.cpp"/>
|
||||
<FILE id="Yrgxtk9Y" name="juce_BorderSize.h" compile="0" resource="0"
|
||||
file="src/gui/graphics/geometry/juce_BorderSize.h"/>
|
||||
<FILE id="kctD1TPMS" name="juce_Line.h" compile="0" resource="0" file="src/gui/graphics/geometry/juce_Line.h"/>
|
||||
|
|
@ -1109,10 +1107,6 @@
|
|||
<FILE id="0sf51PJbY" name="juce_PathStrokeType.h" compile="0" resource="0"
|
||||
file="src/gui/graphics/geometry/juce_PathStrokeType.h"/>
|
||||
<FILE id="n1Fp2JipH" name="juce_Point.h" compile="0" resource="0" file="src/gui/graphics/geometry/juce_Point.h"/>
|
||||
<FILE id="rYmmzSqNV" name="juce_PositionedRectangle.cpp" compile="1"
|
||||
resource="0" file="src/gui/graphics/geometry/juce_PositionedRectangle.cpp"/>
|
||||
<FILE id="KBwtfubIY" name="juce_PositionedRectangle.h" compile="0"
|
||||
resource="0" file="src/gui/graphics/geometry/juce_PositionedRectangle.h"/>
|
||||
<FILE id="6SejKO45p" name="juce_Rectangle.h" compile="0" resource="0"
|
||||
file="src/gui/graphics/geometry/juce_Rectangle.h"/>
|
||||
<FILE id="HaB5yPbdw" name="juce_RectangleList.cpp" compile="1" resource="0"
|
||||
|
|
|
|||
|
|
@ -359,11 +359,9 @@
|
|||
#include "../src/gui/graphics/fonts/juce_TextLayout.cpp"
|
||||
#include "../src/gui/graphics/fonts/juce_Typeface.cpp"
|
||||
#include "../src/gui/graphics/geometry/juce_AffineTransform.cpp"
|
||||
#include "../src/gui/graphics/geometry/juce_BorderSize.cpp"
|
||||
#include "../src/gui/graphics/geometry/juce_Path.cpp"
|
||||
#include "../src/gui/graphics/geometry/juce_PathIterator.cpp"
|
||||
#include "../src/gui/graphics/geometry/juce_PathStrokeType.cpp"
|
||||
#include "../src/gui/graphics/geometry/juce_PositionedRectangle.cpp"
|
||||
#include "../src/gui/graphics/geometry/juce_RectangleList.cpp"
|
||||
#include "../src/gui/graphics/imaging/juce_Image.cpp"
|
||||
#include "../src/gui/graphics/imaging/juce_ImageCache.cpp"
|
||||
|
|
|
|||
|
|
@ -109,6 +109,9 @@ namespace Ids
|
|||
DECLARE_ID (rootItemVisible);
|
||||
DECLARE_ID (openByDefault);
|
||||
DECLARE_ID (locked);
|
||||
DECLARE_ID (tooltip);
|
||||
DECLARE_ID (memberName);
|
||||
DECLARE_ID (focusOrder);
|
||||
const Identifier class_ ("class");
|
||||
const Identifier id_ ("id");
|
||||
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ public:
|
|||
void resized()
|
||||
{
|
||||
// position our table with a gap around its edge
|
||||
table.setBoundsInset (BorderSize (8));
|
||||
table.setBoundsInset (BorderSize<int> (8));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ private:
|
|||
|
||||
void resized()
|
||||
{
|
||||
comboBox.setBoundsInset (BorderSize (2));
|
||||
comboBox.setBoundsInset (BorderSize<int> (2));
|
||||
}
|
||||
|
||||
// Our demo code will call this when we may need to update our contents
|
||||
|
|
|
|||
|
|
@ -170,9 +170,9 @@ public:
|
|||
void resized()
|
||||
{
|
||||
if (treeView != 0)
|
||||
treeView->setBoundsInset (BorderSize (40, 10, 10, 10));
|
||||
treeView->setBoundsInset (BorderSize<int> (40, 10, 10, 10));
|
||||
else if (fileTreeComp != 0)
|
||||
fileTreeComp->setBoundsInset (BorderSize (40, 10, 10, 10));
|
||||
fileTreeComp->setBoundsInset (BorderSize<int> (40, 10, 10, 10));
|
||||
|
||||
typeButton.changeWidthToFitText (22);
|
||||
typeButton.setTopLeftPosition (10, 10);
|
||||
|
|
|
|||
|
|
@ -441,7 +441,14 @@
|
|||
isa = PBXProject;
|
||||
buildConfigurationList = C0E91AC908A95435008D54AB /* Build configuration list for PBXProject "Jucer" */;
|
||||
compatibilityVersion = "Xcode 2.4";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 20286C29FDCF999611CA2CEA /* Jucer */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ PaintElement::PaintElement (PaintRoutine* owner_,
|
|||
|
||||
addChildComponent (border = new ResizableBorderComponent (this, this));
|
||||
|
||||
border->setBorderThickness (BorderSize (borderThickness));
|
||||
border->setBorderThickness (BorderSize<int> (borderThickness));
|
||||
|
||||
if (owner != 0)
|
||||
owner->getSelectedElements().addChangeListener (this);
|
||||
|
|
@ -260,7 +260,7 @@ void PaintElement::paint (Graphics& g)
|
|||
|
||||
if (selected)
|
||||
{
|
||||
const BorderSize borderSize (border->getBorderThickness());
|
||||
const BorderSize<int> borderSize (border->getBorderThickness());
|
||||
|
||||
drawResizableBorder (g, getWidth(), getHeight(), borderSize,
|
||||
(isMouseOverOrDragging() || border->isMouseOverOrDragging()));
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ ComponentOverlayComponent::ComponentOverlayComponent (Component* const target_,
|
|||
|
||||
addChildComponent (border = new ResizableBorderComponent (this, this));
|
||||
|
||||
border->setBorderThickness (BorderSize (borderThickness));
|
||||
border->setBorderThickness (BorderSize<int> (borderThickness));
|
||||
|
||||
target->addComponentListener (this);
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ void ComponentOverlayComponent::paint (Graphics& g)
|
|||
|
||||
if (selected)
|
||||
{
|
||||
const BorderSize borderSize (border->getBorderThickness());
|
||||
const BorderSize<int> borderSize (border->getBorderThickness());
|
||||
|
||||
drawResizableBorder (g, getWidth(), getHeight(), borderSize, (isMouseOverOrDragging() || border->isMouseOverOrDragging()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public:
|
|||
|
||||
void resized()
|
||||
{
|
||||
reloadButton->setBoundsInset (BorderSize (2));
|
||||
reloadButton->setBoundsInset (BorderSize<int> (2));
|
||||
}
|
||||
|
||||
void buttonClicked (Button*)
|
||||
|
|
|
|||
|
|
@ -569,7 +569,7 @@ const String justificationToCode (const Justification& justification)
|
|||
//==============================================================================
|
||||
void drawResizableBorder (Graphics& g,
|
||||
int w, int h,
|
||||
const BorderSize borderSize,
|
||||
const BorderSize<int> borderSize,
|
||||
const bool isMouseOver)
|
||||
{
|
||||
g.setColour (Colours::orange.withAlpha (isMouseOver ? 0.4f : 0.3f));
|
||||
|
|
|
|||
|
|
@ -28,6 +28,555 @@
|
|||
class JucerDocument;
|
||||
class ComponentLayout;
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
A rectangle whose co-ordinates can be defined in terms of absolute or
|
||||
proportional distances.
|
||||
|
||||
Designed mainly for storing component positions, this gives you a lot of
|
||||
control over how each co-ordinate is stored, either as an absolute position,
|
||||
or as a proportion of the size of a parent rectangle.
|
||||
|
||||
It also allows you to define the anchor points by which the rectangle is
|
||||
positioned, so for example you could specify that the top right of the
|
||||
rectangle should be an absolute distance from its parent's bottom-right corner.
|
||||
|
||||
This object can be stored as a string, which takes the form "x y w h", including
|
||||
symbols like '%' and letters to indicate the anchor point. See its toString()
|
||||
method for more info.
|
||||
|
||||
Example usage:
|
||||
@code
|
||||
class MyComponent
|
||||
{
|
||||
void resized()
|
||||
{
|
||||
// this will set the child component's x to be 20% of our width, its y
|
||||
// to be 30, its width to be 150, and its height to be 50% of our
|
||||
// height..
|
||||
const PositionedRectangle pos1 ("20% 30 150 50%");
|
||||
pos1.applyToComponent (*myChildComponent1);
|
||||
|
||||
// this will inset the child component with a gap of 10 pixels
|
||||
// around each of its edges..
|
||||
const PositionedRectangle pos2 ("10 10 20M 20M");
|
||||
pos2.applyToComponent (*myChildComponent2);
|
||||
}
|
||||
};
|
||||
@endcode
|
||||
*/
|
||||
class PositionedRectangle
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Creates an empty rectangle with all co-ordinates set to zero.
|
||||
|
||||
The default anchor point is top-left; the default
|
||||
*/
|
||||
PositionedRectangle() throw()
|
||||
: x (0.0), y (0.0), w (0.0), h (0.0),
|
||||
xMode (anchorAtLeftOrTop | absoluteFromParentTopLeft),
|
||||
yMode (anchorAtLeftOrTop | absoluteFromParentTopLeft),
|
||||
wMode (absoluteSize), hMode (absoluteSize)
|
||||
{
|
||||
}
|
||||
|
||||
/** Initialises a PositionedRectangle from a saved string version.
|
||||
|
||||
The string must be in the format generated by toString().
|
||||
*/
|
||||
PositionedRectangle (const String& stringVersion) throw()
|
||||
{
|
||||
StringArray tokens;
|
||||
tokens.addTokens (stringVersion, false);
|
||||
|
||||
decodePosString (tokens [0], xMode, x);
|
||||
decodePosString (tokens [1], yMode, y);
|
||||
decodeSizeString (tokens [2], wMode, w);
|
||||
decodeSizeString (tokens [3], hMode, h);
|
||||
}
|
||||
|
||||
/** Creates a copy of another PositionedRectangle. */
|
||||
PositionedRectangle (const PositionedRectangle& other) throw()
|
||||
: x (other.x), y (other.y), w (other.w), h (other.h),
|
||||
xMode (other.xMode), yMode (other.yMode),
|
||||
wMode (other.wMode), hMode (other.hMode)
|
||||
{
|
||||
}
|
||||
|
||||
/** Copies another PositionedRectangle. */
|
||||
PositionedRectangle& operator= (const PositionedRectangle& other) throw()
|
||||
{
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
w = other.w;
|
||||
h = other.h;
|
||||
xMode = other.xMode;
|
||||
yMode = other.yMode;
|
||||
wMode = other.wMode;
|
||||
hMode = other.hMode;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a string version of this position, from which it can later be
|
||||
re-generated.
|
||||
|
||||
The format is four co-ordinates, "x y w h".
|
||||
|
||||
- If a co-ordinate is absolute, it is stored as an integer, e.g. "100".
|
||||
- If a co-ordinate is proportional to its parent's width or height, it is stored
|
||||
as a percentage, e.g. "80%".
|
||||
- If the X or Y co-ordinate is relative to the parent's right or bottom edge, the
|
||||
number has "R" appended to it, e.g. "100R" means a distance of 100 pixels from
|
||||
the parent's right-hand edge.
|
||||
- If the X or Y co-ordinate is relative to the parent's centre, the number has "C"
|
||||
appended to it, e.g. "-50C" would be 50 pixels left of the parent's centre.
|
||||
- If the X or Y co-ordinate should be anchored at the component's right or bottom
|
||||
edge, then it has "r" appended to it. So "-50Rr" would mean that this component's
|
||||
right-hand edge should be 50 pixels left of the parent's right-hand edge.
|
||||
- If the X or Y co-ordinate should be anchored at the component's centre, then it
|
||||
has "c" appended to it. So "-50Rc" would mean that this component's
|
||||
centre should be 50 pixels left of the parent's right-hand edge. "40%c" means that
|
||||
this component's centre should be placed 40% across the parent's width.
|
||||
- If it's a width or height that should use the parentSizeMinusAbsolute mode, then
|
||||
the number has "M" appended to it.
|
||||
|
||||
To reload a stored string, use the constructor that takes a string parameter.
|
||||
*/
|
||||
const String toString() const throw()
|
||||
{
|
||||
String s;
|
||||
s.preallocateStorage (12);
|
||||
addPosDescription (s, xMode, x); s << ' ';
|
||||
addPosDescription (s, yMode, y); s << ' ';
|
||||
addSizeDescription (s, wMode, w); s << ' ';
|
||||
addSizeDescription (s, hMode, h);
|
||||
return s;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
/** Calculates the absolute position, given the size of the space that
|
||||
it should go in.
|
||||
|
||||
This will work out any proportional distances and sizes relative to the
|
||||
target rectangle, and will return the absolute position.
|
||||
|
||||
@see applyToComponent
|
||||
*/
|
||||
const Rectangle<int> getRectangle (const Rectangle<int>& target) const throw()
|
||||
{
|
||||
jassert (! target.isEmpty());
|
||||
|
||||
double x_, y_, w_, h_;
|
||||
applyPosAndSize (x_, w_, x, w, xMode, wMode, target.getX(), target.getWidth());
|
||||
applyPosAndSize (y_, h_, y, h, yMode, hMode, target.getY(), target.getHeight());
|
||||
return Rectangle<int> (roundToInt (x_), roundToInt (y_), roundToInt (w_), roundToInt (h_));
|
||||
}
|
||||
|
||||
/** Same as getRectangle(), but returning the values as doubles rather than ints. */
|
||||
void getRectangleDouble (const Rectangle<int>& target,
|
||||
double& x_, double& y_, double& w_, double& h_) const throw()
|
||||
{
|
||||
jassert (! target.isEmpty());
|
||||
applyPosAndSize (x_, w_, x, w, xMode, wMode, target.getX(), target.getWidth());
|
||||
applyPosAndSize (y_, h_, y, h, yMode, hMode, target.getY(), target.getHeight());
|
||||
}
|
||||
|
||||
/** This sets the bounds of the given component to this position.
|
||||
|
||||
This is equivalent to writing:
|
||||
@code
|
||||
comp.setBounds (getRectangle (Rectangle<int> (0, 0, comp.getParentWidth(), comp.getParentHeight())));
|
||||
@endcode
|
||||
|
||||
@see getRectangle, updateFromComponent
|
||||
*/
|
||||
void applyToComponent (Component& comp) const throw()
|
||||
{
|
||||
comp.setBounds (getRectangle (Rectangle<int> (comp.getParentWidth(), comp.getParentHeight())));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
/** Updates this object's co-ordinates to match the given rectangle.
|
||||
|
||||
This will set all co-ordinates based on the given rectangle, re-calculating
|
||||
any proportional distances, and using the current anchor points.
|
||||
|
||||
So for example if the x co-ordinate mode is currently proportional, this will
|
||||
re-calculate x based on the rectangle's relative position within the target
|
||||
rectangle's width.
|
||||
|
||||
If the target rectangle's width or height are zero then it may not be possible
|
||||
to re-calculate some proportional co-ordinates. In this case, those co-ordinates
|
||||
will not be changed.
|
||||
*/
|
||||
void updateFrom (const Rectangle<int>& newPosition,
|
||||
const Rectangle<int>& targetSpaceToBeRelativeTo) throw()
|
||||
{
|
||||
updatePosAndSize (x, w, newPosition.getX(), newPosition.getWidth(), xMode, wMode, targetSpaceToBeRelativeTo.getX(), targetSpaceToBeRelativeTo.getWidth());
|
||||
updatePosAndSize (y, h, newPosition.getY(), newPosition.getHeight(), yMode, hMode, targetSpaceToBeRelativeTo.getY(), targetSpaceToBeRelativeTo.getHeight());
|
||||
}
|
||||
|
||||
/** Same functionality as updateFrom(), but taking doubles instead of ints.
|
||||
*/
|
||||
void updateFromDouble (const double newX, const double newY,
|
||||
const double newW, const double newH,
|
||||
const Rectangle<int>& target) throw()
|
||||
{
|
||||
updatePosAndSize (x, w, newX, newW, xMode, wMode, target.getX(), target.getWidth());
|
||||
updatePosAndSize (y, h, newY, newH, yMode, hMode, target.getY(), target.getHeight());
|
||||
}
|
||||
|
||||
/** Updates this object's co-ordinates to match the bounds of this component.
|
||||
|
||||
This is equivalent to calling updateFrom() with the component's bounds and
|
||||
it parent size.
|
||||
|
||||
If the component doesn't currently have a parent, then proportional co-ordinates
|
||||
might not be updated because it would need to know the parent's size to do the
|
||||
maths for this.
|
||||
*/
|
||||
void updateFromComponent (const Component& comp) throw()
|
||||
{
|
||||
if (comp.getParentComponent() == 0 && ! comp.isOnDesktop())
|
||||
updateFrom (comp.getBounds(), Rectangle<int>());
|
||||
else
|
||||
updateFrom (comp.getBounds(), Rectangle<int> (comp.getParentWidth(), comp.getParentHeight()));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
/** Specifies the point within the rectangle, relative to which it should be positioned. */
|
||||
enum AnchorPoint
|
||||
{
|
||||
anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
|
||||
anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
|
||||
anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
|
||||
};
|
||||
|
||||
/** Specifies how an x or y co-ordinate should be interpreted. */
|
||||
enum PositionMode
|
||||
{
|
||||
absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
|
||||
absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
|
||||
absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
|
||||
proportionOfParentSize = 1 << 6 /**< The x or y co-ordinate specifies a proportion of the parent's width or height, measured from the parent's top or left. */
|
||||
};
|
||||
|
||||
/** Specifies how the width or height should be interpreted. */
|
||||
enum SizeMode
|
||||
{
|
||||
absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
|
||||
parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
|
||||
proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
/** Sets all options for all co-ordinates.
|
||||
|
||||
This requires a reference rectangle to be specified, because if you're changing any
|
||||
of the modes from proportional to absolute or vice-versa, then it'll need to convert
|
||||
the co-ordinates, and will need to know the parent size so it can calculate this.
|
||||
*/
|
||||
void setModes (const AnchorPoint xAnchor, const PositionMode xMode_,
|
||||
const AnchorPoint yAnchor, const PositionMode yMode_,
|
||||
const SizeMode widthMode, const SizeMode heightMode,
|
||||
const Rectangle<int>& target) throw()
|
||||
{
|
||||
if (xMode != (xAnchor | xMode_) || wMode != widthMode)
|
||||
{
|
||||
double tx, tw;
|
||||
applyPosAndSize (tx, tw, x, w, xMode, wMode, target.getX(), target.getWidth());
|
||||
|
||||
xMode = (uint8) (xAnchor | xMode_);
|
||||
wMode = (uint8) widthMode;
|
||||
|
||||
updatePosAndSize (x, w, tx, tw, xMode, wMode, target.getX(), target.getWidth());
|
||||
}
|
||||
|
||||
if (yMode != (yAnchor | yMode_) || hMode != heightMode)
|
||||
{
|
||||
double ty, th;
|
||||
applyPosAndSize (ty, th, y, h, yMode, hMode, target.getY(), target.getHeight());
|
||||
|
||||
yMode = (uint8) (yAnchor | yMode_);
|
||||
hMode = (uint8) heightMode;
|
||||
|
||||
updatePosAndSize (y, h, ty, th, yMode, hMode, target.getY(), target.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the anchoring mode for the x co-ordinate.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
AnchorPoint getAnchorPointX() const throw()
|
||||
{
|
||||
return (AnchorPoint) (xMode & (anchorAtLeftOrTop | anchorAtRightOrBottom | anchorAtCentre));
|
||||
}
|
||||
|
||||
/** Returns the positioning mode for the x co-ordinate.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
PositionMode getPositionModeX() const throw()
|
||||
{
|
||||
return (PositionMode) (xMode & (absoluteFromParentTopLeft | absoluteFromParentBottomRight
|
||||
| absoluteFromParentCentre | proportionOfParentSize));
|
||||
}
|
||||
|
||||
/** Returns the raw x co-ordinate.
|
||||
|
||||
If the x position mode is absolute, then this will be the absolute value. If it's
|
||||
proportional, then this will be a fractional proportion, where 1.0 means the full
|
||||
width of the parent space.
|
||||
*/
|
||||
double getX() const throw() { return x; }
|
||||
|
||||
/** Sets the raw value of the x co-ordinate.
|
||||
|
||||
See getX() for the meaning of this value.
|
||||
*/
|
||||
void setX (const double newX) throw() { x = newX; }
|
||||
|
||||
/** Returns the anchoring mode for the y co-ordinate.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
AnchorPoint getAnchorPointY() const throw()
|
||||
{
|
||||
return (AnchorPoint) (yMode & (anchorAtLeftOrTop | anchorAtRightOrBottom | anchorAtCentre));
|
||||
}
|
||||
|
||||
/** Returns the positioning mode for the y co-ordinate.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
PositionMode getPositionModeY() const throw()
|
||||
{
|
||||
return (PositionMode) (yMode & (absoluteFromParentTopLeft | absoluteFromParentBottomRight
|
||||
| absoluteFromParentCentre | proportionOfParentSize));
|
||||
}
|
||||
|
||||
/** Returns the raw y co-ordinate.
|
||||
|
||||
If the y position mode is absolute, then this will be the absolute value. If it's
|
||||
proportional, then this will be a fractional proportion, where 1.0 means the full
|
||||
height of the parent space.
|
||||
*/
|
||||
double getY() const throw() { return y; }
|
||||
|
||||
/** Sets the raw value of the y co-ordinate.
|
||||
|
||||
See getY() for the meaning of this value.
|
||||
*/
|
||||
void setY (const double newY) throw() { y = newY; }
|
||||
|
||||
/** Returns the mode used to calculate the width.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
SizeMode getWidthMode() const throw() { return (SizeMode) wMode; }
|
||||
|
||||
/** Returns the raw width value.
|
||||
|
||||
If the width mode is absolute, then this will be the absolute value. If the mode is
|
||||
proportional, then this will be a fractional proportion, where 1.0 means the full
|
||||
width of the parent space.
|
||||
*/
|
||||
double getWidth() const throw() { return w; }
|
||||
|
||||
/** Sets the raw width value.
|
||||
|
||||
See getWidth() for the details about what this value means.
|
||||
*/
|
||||
void setWidth (const double newWidth) throw() { w = newWidth; }
|
||||
|
||||
/** Returns the mode used to calculate the height.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
SizeMode getHeightMode() const throw() { return (SizeMode) hMode; }
|
||||
|
||||
/** Returns the raw height value.
|
||||
|
||||
If the height mode is absolute, then this will be the absolute value. If the mode is
|
||||
proportional, then this will be a fractional proportion, where 1.0 means the full
|
||||
height of the parent space.
|
||||
*/
|
||||
double getHeight() const throw() { return h; }
|
||||
|
||||
/** Sets the raw height value.
|
||||
|
||||
See getHeight() for the details about what this value means.
|
||||
*/
|
||||
void setHeight (const double newHeight) throw() { h = newHeight; }
|
||||
|
||||
//==============================================================================
|
||||
/** If the size and position are constance, and wouldn't be affected by changes
|
||||
in the parent's size, then this will return true.
|
||||
*/
|
||||
bool isPositionAbsolute() const throw()
|
||||
{
|
||||
return xMode == absoluteFromParentTopLeft
|
||||
&& yMode == absoluteFromParentTopLeft
|
||||
&& wMode == absoluteSize
|
||||
&& hMode == absoluteSize;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
/** Compares two objects. */
|
||||
bool operator== (const PositionedRectangle& other) const throw()
|
||||
{
|
||||
return x == other.x && y == other.y
|
||||
&& w == other.w && h == other.h
|
||||
&& xMode == other.xMode && yMode == other.yMode
|
||||
&& wMode == other.wMode && hMode == other.hMode;
|
||||
}
|
||||
|
||||
/** Compares two objects. */
|
||||
bool operator!= (const PositionedRectangle& other) const throw()
|
||||
{
|
||||
return ! operator== (other);
|
||||
}
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
double x, y, w, h;
|
||||
uint8 xMode, yMode, wMode, hMode;
|
||||
|
||||
void addPosDescription (String& s, const uint8 mode, const double value) const throw()
|
||||
{
|
||||
if ((mode & proportionOfParentSize) != 0)
|
||||
{
|
||||
s << (roundToInt (value * 100000.0) / 1000.0) << '%';
|
||||
}
|
||||
else
|
||||
{
|
||||
s << (roundToInt (value * 100.0) / 100.0);
|
||||
|
||||
if ((mode & absoluteFromParentBottomRight) != 0)
|
||||
s << 'R';
|
||||
else if ((mode & absoluteFromParentCentre) != 0)
|
||||
s << 'C';
|
||||
}
|
||||
|
||||
if ((mode & anchorAtRightOrBottom) != 0)
|
||||
s << 'r';
|
||||
else if ((mode & anchorAtCentre) != 0)
|
||||
s << 'c';
|
||||
}
|
||||
|
||||
void addSizeDescription (String& s, const uint8 mode, const double value) const throw()
|
||||
{
|
||||
if (mode == proportionalSize)
|
||||
s << (roundToInt (value * 100000.0) / 1000.0) << '%';
|
||||
else if (mode == parentSizeMinusAbsolute)
|
||||
s << (roundToInt (value * 100.0) / 100.0) << 'M';
|
||||
else
|
||||
s << (roundToInt (value * 100.0) / 100.0);
|
||||
}
|
||||
|
||||
void decodePosString (const String& s, uint8& mode, double& value) throw()
|
||||
{
|
||||
if (s.containsChar ('r'))
|
||||
mode = anchorAtRightOrBottom;
|
||||
else if (s.containsChar ('c'))
|
||||
mode = anchorAtCentre;
|
||||
else
|
||||
mode = anchorAtLeftOrTop;
|
||||
|
||||
if (s.containsChar ('%'))
|
||||
{
|
||||
mode |= proportionOfParentSize;
|
||||
value = s.removeCharacters ("%rcRC").getDoubleValue() / 100.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s.containsChar ('R'))
|
||||
mode |= absoluteFromParentBottomRight;
|
||||
else if (s.containsChar ('C'))
|
||||
mode |= absoluteFromParentCentre;
|
||||
else
|
||||
mode |= absoluteFromParentTopLeft;
|
||||
|
||||
value = s.removeCharacters ("rcRC").getDoubleValue();
|
||||
}
|
||||
}
|
||||
|
||||
void decodeSizeString (const String& s, uint8& mode, double& value) throw()
|
||||
{
|
||||
if (s.containsChar ('%'))
|
||||
{
|
||||
mode = proportionalSize;
|
||||
value = s.upToFirstOccurrenceOf ("%", false, false).getDoubleValue() / 100.0;
|
||||
}
|
||||
else if (s.containsChar ('M'))
|
||||
{
|
||||
mode = parentSizeMinusAbsolute;
|
||||
value = s.getDoubleValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = absoluteSize;
|
||||
value = s.getDoubleValue();
|
||||
}
|
||||
}
|
||||
|
||||
void applyPosAndSize (double& xOut, double& wOut, const double x_, const double w_,
|
||||
const uint8 xMode_, const uint8 wMode_,
|
||||
const int parentPos, const int parentSize) const throw()
|
||||
{
|
||||
if (wMode_ == proportionalSize)
|
||||
wOut = roundToInt (w_ * parentSize);
|
||||
else if (wMode_ == parentSizeMinusAbsolute)
|
||||
wOut = jmax (0, parentSize - roundToInt (w_));
|
||||
else
|
||||
wOut = roundToInt (w_);
|
||||
|
||||
if ((xMode_ & proportionOfParentSize) != 0)
|
||||
xOut = parentPos + x_ * parentSize;
|
||||
else if ((xMode_ & absoluteFromParentBottomRight) != 0)
|
||||
xOut = (parentPos + parentSize) - x_;
|
||||
else if ((xMode_ & absoluteFromParentCentre) != 0)
|
||||
xOut = x_ + (parentPos + parentSize / 2);
|
||||
else
|
||||
xOut = x_ + parentPos;
|
||||
|
||||
if ((xMode_ & anchorAtRightOrBottom) != 0)
|
||||
xOut -= wOut;
|
||||
else if ((xMode_ & anchorAtCentre) != 0)
|
||||
xOut -= wOut / 2;
|
||||
}
|
||||
|
||||
void updatePosAndSize (double& xOut, double& wOut, double x_, const double w_,
|
||||
const uint8 xMode_, const uint8 wMode_,
|
||||
const int parentPos, const int parentSize) const throw()
|
||||
{
|
||||
if (wMode_ == proportionalSize)
|
||||
{
|
||||
if (parentSize > 0)
|
||||
wOut = w_ / parentSize;
|
||||
}
|
||||
else if (wMode_ == parentSizeMinusAbsolute)
|
||||
wOut = parentSize - w_;
|
||||
else
|
||||
wOut = w_;
|
||||
|
||||
if ((xMode_ & anchorAtRightOrBottom) != 0)
|
||||
x_ += w_;
|
||||
else if ((xMode_ & anchorAtCentre) != 0)
|
||||
x_ += w_ / 2;
|
||||
|
||||
if ((xMode_ & proportionOfParentSize) != 0)
|
||||
{
|
||||
if (parentSize > 0)
|
||||
xOut = (x_ - parentPos) / parentSize;
|
||||
}
|
||||
else if ((xMode_ & absoluteFromParentBottomRight) != 0)
|
||||
xOut = (parentPos + parentSize) - x_;
|
||||
else if ((xMode_ & absoluteFromParentCentre) != 0)
|
||||
xOut = x_ - (parentPos + parentSize / 2);
|
||||
else
|
||||
xOut = x_ - parentPos;
|
||||
}
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
struct RelativePositionedRectangle
|
||||
{
|
||||
|
|
@ -106,7 +655,7 @@ void positionToCode (const RelativePositionedRectangle& position,
|
|||
//==============================================================================
|
||||
void drawResizableBorder (Graphics& g,
|
||||
int w, int h,
|
||||
const BorderSize borderSize,
|
||||
const BorderSize<int> borderSize,
|
||||
const bool isMouseOver);
|
||||
|
||||
void drawMouseOverCorners (Graphics& g, int w, int h);
|
||||
|
|
|
|||
|
|
@ -40617,7 +40617,7 @@ void Component::centreWithSize (const int width, const int height)
|
|||
width, height);
|
||||
}
|
||||
|
||||
void Component::setBoundsInset (const BorderSize& borders)
|
||||
void Component::setBoundsInset (const BorderSize<int>& borders)
|
||||
{
|
||||
setBounds (borders.subtractedFrom (ComponentHelpers::getParentOrMainMonitorBounds (*this)));
|
||||
}
|
||||
|
|
@ -48199,7 +48199,7 @@ void Label::mouseDoubleClick (const MouseEvent& e)
|
|||
void Label::resized()
|
||||
{
|
||||
if (editor != 0)
|
||||
editor->setBoundsInset (BorderSize (0));
|
||||
editor->setBoundsInset (BorderSize<int> (0));
|
||||
}
|
||||
|
||||
void Label::focusGained (FocusChangeType cause)
|
||||
|
|
@ -48698,10 +48698,8 @@ void ListBox::paintOverChildren (Graphics& g)
|
|||
|
||||
void ListBox::resized()
|
||||
{
|
||||
viewport->setBoundsInset (BorderSize (outlineThickness + ((headerComponent != 0) ? headerComponent->getHeight() : 0),
|
||||
outlineThickness,
|
||||
outlineThickness,
|
||||
outlineThickness));
|
||||
viewport->setBoundsInset (BorderSize<int> (outlineThickness + ((headerComponent != 0) ? headerComponent->getHeight() : 0),
|
||||
outlineThickness, outlineThickness, outlineThickness));
|
||||
|
||||
viewport->setSingleStepSizes (20, getRowHeight());
|
||||
|
||||
|
|
@ -53468,13 +53466,13 @@ void TextEditor::setIndents (const int newLeftIndent,
|
|||
topIndent = newTopIndent;
|
||||
}
|
||||
|
||||
void TextEditor::setBorder (const BorderSize& border)
|
||||
void TextEditor::setBorder (const BorderSize<int>& border)
|
||||
{
|
||||
borderSize = border;
|
||||
resized();
|
||||
}
|
||||
|
||||
const BorderSize TextEditor::getBorder() const
|
||||
const BorderSize<int> TextEditor::getBorder() const
|
||||
{
|
||||
return borderSize;
|
||||
}
|
||||
|
|
@ -55696,7 +55694,7 @@ void ToolbarItemPalette::replaceComponent (ToolbarItemComponent* const comp)
|
|||
|
||||
void ToolbarItemPalette::resized()
|
||||
{
|
||||
viewport.setBoundsInset (BorderSize (1));
|
||||
viewport.setBoundsInset (BorderSize<int> (1));
|
||||
|
||||
Component* const itemHolder = viewport.getViewedComponent();
|
||||
|
||||
|
|
@ -61673,7 +61671,7 @@ void ComponentBoundsConstrainer::setBoundsForComponent (Component* const compone
|
|||
jassert (component != 0);
|
||||
|
||||
Rectangle<int> limits, bounds (targetBounds);
|
||||
BorderSize border;
|
||||
BorderSize<int> border;
|
||||
|
||||
Component* const parent = component->getParentComponent();
|
||||
|
||||
|
|
@ -62576,7 +62574,7 @@ bool ResizableBorderComponent::Zone::operator== (const ResizableBorderComponent:
|
|||
bool ResizableBorderComponent::Zone::operator!= (const ResizableBorderComponent::Zone& other) const throw() { return zone != other.zone; }
|
||||
|
||||
const ResizableBorderComponent::Zone ResizableBorderComponent::Zone::fromPositionOnBorder (const Rectangle<int>& totalSize,
|
||||
const BorderSize& border,
|
||||
const BorderSize<int>& border,
|
||||
const Point<int>& position)
|
||||
{
|
||||
int z = 0;
|
||||
|
|
@ -62698,7 +62696,7 @@ bool ResizableBorderComponent::hitTest (int x, int y)
|
|||
|| y >= getHeight() - borderSize.getBottom();
|
||||
}
|
||||
|
||||
void ResizableBorderComponent::setBorderThickness (const BorderSize& newBorderSize)
|
||||
void ResizableBorderComponent::setBorderThickness (const BorderSize<int>& newBorderSize)
|
||||
{
|
||||
if (borderSize != newBorderSize)
|
||||
{
|
||||
|
|
@ -62707,7 +62705,7 @@ void ResizableBorderComponent::setBorderThickness (const BorderSize& newBorderSi
|
|||
}
|
||||
}
|
||||
|
||||
const BorderSize ResizableBorderComponent::getBorderThickness() const
|
||||
const BorderSize<int> ResizableBorderComponent::getBorderThickness() const
|
||||
{
|
||||
return borderSize;
|
||||
}
|
||||
|
|
@ -64189,7 +64187,7 @@ namespace TabbedComponentHelpers
|
|||
delete comp;
|
||||
}
|
||||
|
||||
const Rectangle<int> getTabArea (Rectangle<int>& content, BorderSize& outline,
|
||||
const Rectangle<int> getTabArea (Rectangle<int>& content, BorderSize<int>& outline,
|
||||
const TabbedButtonBar::Orientation orientation, const int tabDepth)
|
||||
{
|
||||
switch (orientation)
|
||||
|
|
@ -64387,7 +64385,7 @@ void TabbedComponent::paint (Graphics& g)
|
|||
g.fillAll (findColour (backgroundColourId));
|
||||
|
||||
Rectangle<int> content (getLocalBounds());
|
||||
BorderSize outline (outlineThickness);
|
||||
BorderSize<int> outline (outlineThickness);
|
||||
TabbedComponentHelpers::getTabArea (content, outline, getOrientation(), tabDepth);
|
||||
|
||||
g.reduceClipRegion (content);
|
||||
|
|
@ -64406,10 +64404,10 @@ void TabbedComponent::paint (Graphics& g)
|
|||
void TabbedComponent::resized()
|
||||
{
|
||||
Rectangle<int> content (getLocalBounds());
|
||||
BorderSize outline (outlineThickness);
|
||||
BorderSize<int> outline (outlineThickness);
|
||||
|
||||
tabs->setBounds (TabbedComponentHelpers::getTabArea (content, outline, getOrientation(), tabDepth));
|
||||
content = BorderSize (edgeIndent).subtractedFrom (outline.subtractedFrom (content));
|
||||
content = BorderSize<int> (edgeIndent).subtractedFrom (outline.subtractedFrom (content));
|
||||
|
||||
for (int i = contentComponents.size(); --i >= 0;)
|
||||
if (contentComponents.getReference (i) != 0)
|
||||
|
|
@ -66554,7 +66552,7 @@ void LookAndFeel::drawCornerResizer (Graphics& g,
|
|||
}
|
||||
}
|
||||
|
||||
void LookAndFeel::drawResizableFrame (Graphics& g, int w, int h, const BorderSize& border)
|
||||
void LookAndFeel::drawResizableFrame (Graphics& g, int w, int h, const BorderSize<int>& border)
|
||||
{
|
||||
if (! border.isEmpty())
|
||||
{
|
||||
|
|
@ -66576,13 +66574,13 @@ void LookAndFeel::drawResizableFrame (Graphics& g, int w, int h, const BorderSiz
|
|||
}
|
||||
|
||||
void LookAndFeel::fillResizableWindowBackground (Graphics& g, int /*w*/, int /*h*/,
|
||||
const BorderSize& /*border*/, ResizableWindow& window)
|
||||
const BorderSize<int>& /*border*/, ResizableWindow& window)
|
||||
{
|
||||
g.fillAll (window.getBackgroundColour());
|
||||
}
|
||||
|
||||
void LookAndFeel::drawResizableWindowBorder (Graphics&, int /*w*/, int /*h*/,
|
||||
const BorderSize& /*border*/, ResizableWindow&)
|
||||
const BorderSize<int>& /*border*/, ResizableWindow&)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -77609,7 +77607,7 @@ void DocumentWindow::paint (Graphics& g)
|
|||
{
|
||||
g.setColour (getBackgroundColour().overlaidWith (Colour (0x80000000)));
|
||||
|
||||
const BorderSize border (getBorderThickness());
|
||||
const BorderSize<int> border (getBorderThickness());
|
||||
|
||||
g.fillRect (0, 0, getWidth(), border.getTop());
|
||||
g.fillRect (0, border.getTop(), border.getLeft(), getHeight() - border.getTopAndBottom());
|
||||
|
|
@ -77667,15 +77665,15 @@ void DocumentWindow::resized()
|
|||
titleBarArea.getWidth(), menuBarHeight);
|
||||
}
|
||||
|
||||
const BorderSize DocumentWindow::getBorderThickness()
|
||||
const BorderSize<int> DocumentWindow::getBorderThickness()
|
||||
{
|
||||
return BorderSize ((isFullScreen() || isUsingNativeTitleBar())
|
||||
? 0 : (resizableBorder != 0 ? 4 : 1));
|
||||
return BorderSize<int> ((isFullScreen() || isUsingNativeTitleBar())
|
||||
? 0 : (resizableBorder != 0 ? 4 : 1));
|
||||
}
|
||||
|
||||
const BorderSize DocumentWindow::getContentComponentBorder()
|
||||
const BorderSize<int> DocumentWindow::getContentComponentBorder()
|
||||
{
|
||||
BorderSize border (getBorderThickness());
|
||||
BorderSize<int> border (getBorderThickness());
|
||||
|
||||
border.setTop (border.getTop()
|
||||
+ (isUsingNativeTitleBar() ? 0 : titleBarHeight)
|
||||
|
|
@ -77691,7 +77689,7 @@ int DocumentWindow::getTitleBarHeight() const
|
|||
|
||||
const Rectangle<int> DocumentWindow::getTitleBarArea()
|
||||
{
|
||||
const BorderSize border (getBorderThickness());
|
||||
const BorderSize<int> border (getBorderThickness());
|
||||
|
||||
return Rectangle<int> (border.getLeft(), border.getTop(),
|
||||
getWidth() - border.getLeftAndRight(),
|
||||
|
|
@ -77900,18 +77898,18 @@ void ResizableWindow::setContentComponentSize (int width, int height)
|
|||
{
|
||||
jassert (width > 0 && height > 0); // not a great idea to give it a zero size..
|
||||
|
||||
const BorderSize border (getContentComponentBorder());
|
||||
const BorderSize<int> border (getContentComponentBorder());
|
||||
|
||||
setSize (width + border.getLeftAndRight(),
|
||||
height + border.getTopAndBottom());
|
||||
}
|
||||
|
||||
const BorderSize ResizableWindow::getBorderThickness()
|
||||
const BorderSize<int> ResizableWindow::getBorderThickness()
|
||||
{
|
||||
return BorderSize (isUsingNativeTitleBar() ? 0 : ((resizableBorder != 0 && ! isFullScreen()) ? 5 : 3));
|
||||
return BorderSize<int> (isUsingNativeTitleBar() ? 0 : ((resizableBorder != 0 && ! isFullScreen()) ? 5 : 3));
|
||||
}
|
||||
|
||||
const BorderSize ResizableWindow::getContentComponentBorder()
|
||||
const BorderSize<int> ResizableWindow::getContentComponentBorder()
|
||||
{
|
||||
return getBorderThickness();
|
||||
}
|
||||
|
|
@ -77977,7 +77975,7 @@ void ResizableWindow::childBoundsChanged (Component* child)
|
|||
jassert (child->getWidth() > 0);
|
||||
jassert (child->getHeight() > 0);
|
||||
|
||||
const BorderSize borders (getContentComponentBorder());
|
||||
const BorderSize<int> borders (getContentComponentBorder());
|
||||
|
||||
setSize (child->getWidth() + borders.getLeftAndRight(),
|
||||
child->getHeight() + borders.getTopAndBottom());
|
||||
|
|
@ -77986,7 +77984,7 @@ void ResizableWindow::childBoundsChanged (Component* child)
|
|||
|
||||
void ResizableWindow::activeWindowStatusChanged()
|
||||
{
|
||||
const BorderSize border (getContentComponentBorder());
|
||||
const BorderSize<int> border (getContentComponentBorder());
|
||||
|
||||
Rectangle<int> area (getLocalBounds());
|
||||
repaint (area.removeFromTop (border.getTop()));
|
||||
|
|
@ -82706,21 +82704,19 @@ void Graphics::drawHorizontalLine (const int y, float left, float right) const
|
|||
context->drawHorizontalLine (y, left, right);
|
||||
}
|
||||
|
||||
void Graphics::drawLine (float x1, float y1, float x2, float y2) const
|
||||
void Graphics::drawLine (const float x1, const float y1, const float x2, const float y2) const
|
||||
{
|
||||
context->drawLine (Line<float> (x1, y1, x2, y2));
|
||||
}
|
||||
|
||||
void Graphics::drawLine (const float startX, const float startY,
|
||||
const float endX, const float endY,
|
||||
const float lineThickness) const
|
||||
{
|
||||
drawLine (Line<float> (startX, startY, endX, endY),lineThickness);
|
||||
}
|
||||
|
||||
void Graphics::drawLine (const Line<float>& line) const
|
||||
{
|
||||
drawLine (line.getStartX(), line.getStartY(), line.getEndX(), line.getEndY());
|
||||
context->drawLine (line);
|
||||
}
|
||||
|
||||
void Graphics::drawLine (const float x1, const float y1, const float x2, const float y2, const float lineThickness) const
|
||||
{
|
||||
drawLine (Line<float> (x1, y1, x2, y2), lineThickness);
|
||||
}
|
||||
|
||||
void Graphics::drawLine (const Line<float>& line, const float lineThickness) const
|
||||
|
|
@ -82730,42 +82726,35 @@ void Graphics::drawLine (const Line<float>& line, const float lineThickness) con
|
|||
fillPath (p);
|
||||
}
|
||||
|
||||
void Graphics::drawDashedLine (const float startX, const float startY,
|
||||
const float endX, const float endY,
|
||||
const float* const dashLengths,
|
||||
const int numDashLengths,
|
||||
const float lineThickness) const
|
||||
void Graphics::drawDashedLine (const Line<float>& line, const float* const dashLengths,
|
||||
const int numDashLengths, const float lineThickness, int n) const
|
||||
{
|
||||
const double dx = endX - startX;
|
||||
const double dy = endY - startY;
|
||||
const double totalLen = juce_hypot (dx, dy);
|
||||
jassert (n >= 0 && n < numDashLengths); // your start index must be valid!
|
||||
|
||||
if (totalLen >= 0.5)
|
||||
const Point<double> delta ((line.getEnd() - line.getStart()).toDouble());
|
||||
const double totalLen = delta.getDistanceFromOrigin();
|
||||
|
||||
if (totalLen >= 0.1)
|
||||
{
|
||||
const double onePixAlpha = 1.0 / totalLen;
|
||||
|
||||
double alpha = 0.0;
|
||||
float x = startX;
|
||||
float y = startY;
|
||||
int n = 0;
|
||||
|
||||
while (alpha < 1.0f)
|
||||
for (double alpha = 0.0; alpha < 1.0;)
|
||||
{
|
||||
alpha = jmin (1.0, alpha + dashLengths[n++] * onePixAlpha);
|
||||
n = n % numDashLengths;
|
||||
jassert (dashLengths[n] > 0); // can't have zero-length dashes!
|
||||
|
||||
const float oldX = x;
|
||||
const float oldY = y;
|
||||
|
||||
x = (float) (startX + dx * alpha);
|
||||
y = (float) (startY + dy * alpha);
|
||||
const double lastAlpha = alpha;
|
||||
alpha = jmin (1.0, alpha + dashLengths [n] * onePixAlpha);
|
||||
n = (n + 1) % numDashLengths;
|
||||
|
||||
if ((n & 1) != 0)
|
||||
{
|
||||
const Line<float> segment (line.getStart() + (delta * lastAlpha).toFloat(),
|
||||
line.getStart() + (delta * alpha).toFloat());
|
||||
|
||||
if (lineThickness != 1.0f)
|
||||
drawLine (oldX, oldY, x, y, lineThickness);
|
||||
drawLine (segment, lineThickness);
|
||||
else
|
||||
drawLine (oldX, oldY, x, y);
|
||||
context->drawLine (segment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -91771,7 +91760,7 @@ const AffineTransform AffineTransform::inverted() const throw()
|
|||
|
||||
bool AffineTransform::isSingularity() const throw()
|
||||
{
|
||||
return (mat00 * mat11 - mat10 * mat01) == 0.0;
|
||||
return (mat00 * mat11 - mat10 * mat01) == 0;
|
||||
}
|
||||
|
||||
const AffineTransform AffineTransform::fromTargetPoints (const float x00, const float y00,
|
||||
|
|
@ -91808,117 +91797,6 @@ END_JUCE_NAMESPACE
|
|||
/*** End of inlined file: juce_AffineTransform.cpp ***/
|
||||
|
||||
|
||||
/*** Start of inlined file: juce_BorderSize.cpp ***/
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
BorderSize::BorderSize() throw()
|
||||
: top (0),
|
||||
left (0),
|
||||
bottom (0),
|
||||
right (0)
|
||||
{
|
||||
}
|
||||
|
||||
BorderSize::BorderSize (const BorderSize& other) throw()
|
||||
: top (other.top),
|
||||
left (other.left),
|
||||
bottom (other.bottom),
|
||||
right (other.right)
|
||||
{
|
||||
}
|
||||
|
||||
BorderSize::BorderSize (const int topGap,
|
||||
const int leftGap,
|
||||
const int bottomGap,
|
||||
const int rightGap) throw()
|
||||
: top (topGap),
|
||||
left (leftGap),
|
||||
bottom (bottomGap),
|
||||
right (rightGap)
|
||||
{
|
||||
}
|
||||
|
||||
BorderSize::BorderSize (const int allGaps) throw()
|
||||
: top (allGaps),
|
||||
left (allGaps),
|
||||
bottom (allGaps),
|
||||
right (allGaps)
|
||||
{
|
||||
}
|
||||
|
||||
BorderSize::~BorderSize() throw()
|
||||
{
|
||||
}
|
||||
|
||||
void BorderSize::setTop (const int newTopGap) throw()
|
||||
{
|
||||
top = newTopGap;
|
||||
}
|
||||
|
||||
void BorderSize::setLeft (const int newLeftGap) throw()
|
||||
{
|
||||
left = newLeftGap;
|
||||
}
|
||||
|
||||
void BorderSize::setBottom (const int newBottomGap) throw()
|
||||
{
|
||||
bottom = newBottomGap;
|
||||
}
|
||||
|
||||
void BorderSize::setRight (const int newRightGap) throw()
|
||||
{
|
||||
right = newRightGap;
|
||||
}
|
||||
|
||||
const Rectangle<int> BorderSize::subtractedFrom (const Rectangle<int>& r) const throw()
|
||||
{
|
||||
return Rectangle<int> (r.getX() + left,
|
||||
r.getY() + top,
|
||||
r.getWidth() - (left + right),
|
||||
r.getHeight() - (top + bottom));
|
||||
}
|
||||
|
||||
void BorderSize::subtractFrom (Rectangle<int>& r) const throw()
|
||||
{
|
||||
r.setBounds (r.getX() + left,
|
||||
r.getY() + top,
|
||||
r.getWidth() - (left + right),
|
||||
r.getHeight() - (top + bottom));
|
||||
}
|
||||
|
||||
const Rectangle<int> BorderSize::addedTo (const Rectangle<int>& r) const throw()
|
||||
{
|
||||
return Rectangle<int> (r.getX() - left,
|
||||
r.getY() - top,
|
||||
r.getWidth() + (left + right),
|
||||
r.getHeight() + (top + bottom));
|
||||
}
|
||||
|
||||
void BorderSize::addTo (Rectangle<int>& r) const throw()
|
||||
{
|
||||
r.setBounds (r.getX() - left,
|
||||
r.getY() - top,
|
||||
r.getWidth() + (left + right),
|
||||
r.getHeight() + (top + bottom));
|
||||
}
|
||||
|
||||
bool BorderSize::operator== (const BorderSize& other) const throw()
|
||||
{
|
||||
return top == other.top
|
||||
&& left == other.left
|
||||
&& bottom == other.bottom
|
||||
&& right == other.right;
|
||||
}
|
||||
|
||||
bool BorderSize::operator!= (const BorderSize& other) const throw()
|
||||
{
|
||||
return ! operator== (other);
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
/*** End of inlined file: juce_BorderSize.cpp ***/
|
||||
|
||||
|
||||
/*** Start of inlined file: juce_Path.cpp ***/
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
|
|
@ -94438,13 +94316,6 @@ END_JUCE_NAMESPACE
|
|||
/*** End of inlined file: juce_PathStrokeType.cpp ***/
|
||||
|
||||
|
||||
/*** Start of inlined file: juce_PositionedRectangle.cpp ***/
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
/*** End of inlined file: juce_PositionedRectangle.cpp ***/
|
||||
|
||||
|
||||
/*** Start of inlined file: juce_RectangleList.cpp ***/
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
|
|
@ -241871,10 +241742,10 @@ public:
|
|||
|
||||
if (GetWindowInfo (hwnd, &info))
|
||||
{
|
||||
windowBorder = BorderSize (info.rcClient.top - info.rcWindow.top,
|
||||
info.rcClient.left - info.rcWindow.left,
|
||||
info.rcWindow.bottom - info.rcClient.bottom,
|
||||
info.rcWindow.right - info.rcClient.right);
|
||||
windowBorder = BorderSize<int> (info.rcClient.top - info.rcWindow.top,
|
||||
info.rcClient.left - info.rcWindow.left,
|
||||
info.rcWindow.bottom - info.rcClient.bottom,
|
||||
info.rcWindow.right - info.rcClient.right);
|
||||
}
|
||||
|
||||
#if JUCE_DIRECT2D
|
||||
|
|
@ -242053,7 +241924,7 @@ public:
|
|||
return w == hwnd || (trueIfInAChildWindow && (IsChild (hwnd, w) != 0));
|
||||
}
|
||||
|
||||
const BorderSize getFrameSize() const
|
||||
const BorderSize<int> getFrameSize() const
|
||||
{
|
||||
return windowBorder;
|
||||
}
|
||||
|
|
@ -242316,7 +242187,7 @@ private:
|
|||
ScopedPointer<Direct2DLowLevelGraphicsContext> direct2DContext;
|
||||
#endif
|
||||
bool fullScreen, isDragging, isMouseOver, hasCreatedCaret, constrainerIsResizing;
|
||||
BorderSize windowBorder;
|
||||
BorderSize<int> windowBorder;
|
||||
HICON currentWindowIcon;
|
||||
ScopedPointer<NOTIFYICONDATA> taskBarIcon;
|
||||
IDropTarget* dropTarget;
|
||||
|
|
@ -257673,9 +257544,9 @@ public:
|
|||
return child == None;
|
||||
}
|
||||
|
||||
const BorderSize getFrameSize() const
|
||||
const BorderSize<int> getFrameSize() const
|
||||
{
|
||||
return BorderSize();
|
||||
return BorderSize<int>();
|
||||
}
|
||||
|
||||
bool setAlwaysOnTop (bool alwaysOnTop)
|
||||
|
|
@ -258505,7 +258376,7 @@ private:
|
|||
bool fullScreen, mapped;
|
||||
Visual* visual;
|
||||
int depth;
|
||||
BorderSize windowBorder;
|
||||
BorderSize<int> windowBorder;
|
||||
|
||||
struct MotifWmHints
|
||||
{
|
||||
|
|
@ -258919,7 +258790,7 @@ private:
|
|||
{
|
||||
if ((styleFlags & windowHasTitleBar) == 0)
|
||||
{
|
||||
windowBorder = BorderSize (0);
|
||||
windowBorder = BorderSize<int> (0);
|
||||
}
|
||||
else if (windowBorder.getTopAndBottom() == 0 && windowBorder.getLeftAndRight() == 0)
|
||||
{
|
||||
|
|
@ -258940,8 +258811,8 @@ private:
|
|||
const unsigned long* const sizes = (const unsigned long*) data;
|
||||
|
||||
if (actualFormat == 32)
|
||||
windowBorder = BorderSize ((int) sizes[2], (int) sizes[0],
|
||||
(int) sizes[3], (int) sizes[1]);
|
||||
windowBorder = BorderSize<int> ((int) sizes[2], (int) sizes[0],
|
||||
(int) sizes[3], (int) sizes[1]);
|
||||
|
||||
XFree (data);
|
||||
}
|
||||
|
|
@ -266453,7 +266324,7 @@ public:
|
|||
void setFullScreen (bool shouldBeFullScreen);
|
||||
bool isFullScreen() const;
|
||||
bool contains (const Point<int>& position, bool trueIfInAChildWindow) const;
|
||||
const BorderSize getFrameSize() const;
|
||||
const BorderSize<int> getFrameSize() const;
|
||||
bool setAlwaysOnTop (bool alwaysOnTop);
|
||||
void toFront (bool makeActiveWindow);
|
||||
void toBehind (ComponentPeer* other);
|
||||
|
|
@ -267003,9 +266874,9 @@ bool UIViewComponentPeer::contains (const Point<int>& position, bool trueIfInACh
|
|||
return v == view;
|
||||
}
|
||||
|
||||
const BorderSize UIViewComponentPeer::getFrameSize() const
|
||||
const BorderSize<int> UIViewComponentPeer::getFrameSize() const
|
||||
{
|
||||
return BorderSize();
|
||||
return BorderSize<int>();
|
||||
}
|
||||
|
||||
bool UIViewComponentPeer::setAlwaysOnTop (bool alwaysOnTop)
|
||||
|
|
@ -271211,7 +271082,7 @@ public:
|
|||
void setFullScreen (bool shouldBeFullScreen);
|
||||
bool isFullScreen() const;
|
||||
bool contains (const Point<int>& position, bool trueIfInAChildWindow) const;
|
||||
const BorderSize getFrameSize() const;
|
||||
const BorderSize<int> getFrameSize() const;
|
||||
bool setAlwaysOnTop (bool alwaysOnTop);
|
||||
void toFront (bool makeActiveWindow);
|
||||
void toBehind (ComponentPeer* other);
|
||||
|
|
@ -272206,9 +272077,9 @@ bool NSViewComponentPeer::contains (const Point<int>& position, bool trueIfInACh
|
|||
return v == view;
|
||||
}
|
||||
|
||||
const BorderSize NSViewComponentPeer::getFrameSize() const
|
||||
const BorderSize<int> NSViewComponentPeer::getFrameSize() const
|
||||
{
|
||||
BorderSize b;
|
||||
BorderSize<int> b;
|
||||
|
||||
if (! isSharedWindow)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
|
|||
*/
|
||||
#define JUCE_MAJOR_VERSION 1
|
||||
#define JUCE_MINOR_VERSION 53
|
||||
#define JUCE_BUILDNUMBER 12
|
||||
#define JUCE_BUILDNUMBER 13
|
||||
|
||||
/** Current Juce version number.
|
||||
|
||||
|
|
@ -20668,7 +20668,7 @@ class Point
|
|||
public:
|
||||
|
||||
/** Creates a point with co-ordinates (0, 0). */
|
||||
Point() throw() : x (0), y (0) {}
|
||||
Point() throw() : x(), y() {}
|
||||
|
||||
/** Creates a copy of another point. */
|
||||
Point (const Point& other) throw() : x (other.x), y (other.y) {}
|
||||
|
|
@ -20779,11 +20779,14 @@ public:
|
|||
const Point transformedBy (const AffineTransform& transform) const throw() { return Point (transform.mat00 * x + transform.mat01 * y + transform.mat02,
|
||||
transform.mat10 * x + transform.mat11 * y + transform.mat12); }
|
||||
|
||||
/** Casts this point to a Point<int> object. */
|
||||
const Point<int> toInt() const throw() { return Point<int> (static_cast <int> (x), static_cast<int> (y)); }
|
||||
|
||||
/** Casts this point to a Point<float> object. */
|
||||
const Point<float> toFloat() const throw() { return Point<float> (static_cast <float> (x), static_cast<float> (y)); }
|
||||
|
||||
/** Casts this point to a Point<int> object. */
|
||||
const Point<int> toInt() const throw() { return Point<int> (static_cast <int> (x), static_cast<int> (y)); }
|
||||
/** Casts this point to a Point<double> object. */
|
||||
const Point<double> toDouble() const throw() { return Point<double> (static_cast <double> (x), static_cast<double> (y)); }
|
||||
|
||||
/** Returns the point as a string in the form "x, y". */
|
||||
const String toString() const { return String (x) + ", " + String (y); }
|
||||
|
|
@ -21930,7 +21933,7 @@ public:
|
|||
The default co-ordinates will be (0, 0, 0, 0).
|
||||
*/
|
||||
Rectangle() throw()
|
||||
: x (0), y (0), w (0), h (0)
|
||||
: x(), y(), w(), h()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -21951,7 +21954,7 @@ public:
|
|||
|
||||
/** Creates a rectangle with a given size, and a position of (0, 0). */
|
||||
Rectangle (const ValueType width, const ValueType height) throw()
|
||||
: x (0), y (0), w (width), h (height)
|
||||
: x(), y(), w (width), h (height)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -21962,8 +21965,8 @@ public:
|
|||
w (corner1.getX() - corner2.getX()),
|
||||
h (corner1.getY() - corner2.getY())
|
||||
{
|
||||
if (w < 0) w = -w;
|
||||
if (h < 0) h = -h;
|
||||
if (w < ValueType()) w = -w;
|
||||
if (h < ValueType()) h = -h;
|
||||
}
|
||||
|
||||
/** Creates a Rectangle from a set of left, right, top, bottom coordinates.
|
||||
|
|
@ -21987,7 +21990,7 @@ public:
|
|||
~Rectangle() throw() {}
|
||||
|
||||
/** Returns true if the rectangle's width and height are both zero or less */
|
||||
bool isEmpty() const throw() { return w <= 0 || h <= 0; }
|
||||
bool isEmpty() const throw() { return w <= ValueType() || h <= ValueType(); }
|
||||
|
||||
/** Returns the x co-ordinate of the rectangle's left-hand-side. */
|
||||
inline ValueType getX() const throw() { return x; }
|
||||
|
|
@ -22382,12 +22385,12 @@ public:
|
|||
const int maxX = jmax (otherX, x);
|
||||
otherW = jmin (otherX + otherW, x + w) - maxX;
|
||||
|
||||
if (otherW > 0)
|
||||
if (otherW > ValueType())
|
||||
{
|
||||
const int maxY = jmax (otherY, y);
|
||||
otherH = jmin (otherY + otherH, y + h) - maxY;
|
||||
|
||||
if (otherH > 0)
|
||||
if (otherH > ValueType())
|
||||
{
|
||||
otherX = maxX; otherY = maxY;
|
||||
return true;
|
||||
|
|
@ -22553,12 +22556,12 @@ public:
|
|||
const ValueType x = jmax (x1, x2);
|
||||
w1 = jmin (x1 + w1, x2 + w2) - x;
|
||||
|
||||
if (w1 > 0)
|
||||
if (w1 > ValueType())
|
||||
{
|
||||
const ValueType y = jmax (y1, y2);
|
||||
h1 = jmin (y1 + h1, y2 + h2) - y;
|
||||
|
||||
if (h1 > 0)
|
||||
if (h1 > ValueType())
|
||||
{
|
||||
x1 = x; y1 = y;
|
||||
return true;
|
||||
|
|
@ -25780,21 +25783,19 @@ public:
|
|||
|
||||
/** Draws a dashed line using a custom set of dash-lengths.
|
||||
|
||||
@param startX the line's start x co-ordinate
|
||||
@param startY the line's start y co-ordinate
|
||||
@param endX the line's end x co-ordinate
|
||||
@param endY the line's end y co-ordinate
|
||||
@param line the line to draw
|
||||
@param dashLengths a series of lengths to specify the on/off lengths - e.g.
|
||||
{ 4, 5, 6, 7 } will draw a line of 4 pixels, skip 5 pixels,
|
||||
draw 6 pixels, skip 7 pixels, and then repeat.
|
||||
@param numDashLengths the number of elements in the array (this must be an even number).
|
||||
@param lineThickness the thickness of the line to draw
|
||||
@param dashIndexToStartFrom the index in the dash-length array to use for the first segment
|
||||
@see PathStrokeType::createDashedStroke
|
||||
*/
|
||||
void drawDashedLine (float startX, float startY,
|
||||
float endX, float endY,
|
||||
void drawDashedLine (const Line<float>& line,
|
||||
const float* dashLengths, int numDashLengths,
|
||||
float lineThickness = 1.0f) const;
|
||||
float lineThickness = 1.0f,
|
||||
int dashIndexToStartFrom = 0) const;
|
||||
|
||||
/** Draws a vertical line of pixels at a given x position.
|
||||
|
||||
|
|
@ -26758,82 +26759,113 @@ private:
|
|||
|
||||
@see Rectangle
|
||||
*/
|
||||
class JUCE_API BorderSize
|
||||
template <typename ValueType>
|
||||
class BorderSize
|
||||
{
|
||||
public:
|
||||
|
||||
/** Creates a null border.
|
||||
|
||||
All sizes are left as 0.
|
||||
*/
|
||||
BorderSize() throw();
|
||||
BorderSize() throw()
|
||||
: top(), left(), bottom(), right()
|
||||
{
|
||||
}
|
||||
|
||||
/** Creates a copy of another border. */
|
||||
BorderSize (const BorderSize& other) throw();
|
||||
BorderSize (const BorderSize& other) throw()
|
||||
: top (other.top), left (other.left), bottom (other.bottom), right (other.right)
|
||||
{
|
||||
}
|
||||
|
||||
/** Creates a border with the given gaps. */
|
||||
BorderSize (int topGap,
|
||||
int leftGap,
|
||||
int bottomGap,
|
||||
int rightGap) throw();
|
||||
BorderSize (ValueType topGap, ValueType leftGap, ValueType bottomGap, ValueType rightGap) throw()
|
||||
: top (topGap), left (leftGap), bottom (bottomGap), right (rightGap)
|
||||
{
|
||||
}
|
||||
|
||||
/** Creates a border with the given gap on all sides. */
|
||||
explicit BorderSize (int allGaps) throw();
|
||||
|
||||
/** Destructor. */
|
||||
~BorderSize() throw();
|
||||
explicit BorderSize (ValueType allGaps) throw()
|
||||
: top (allGaps), left (allGaps), bottom (allGaps), right (allGaps)
|
||||
{
|
||||
}
|
||||
|
||||
/** Returns the gap that should be left at the top of the region. */
|
||||
int getTop() const throw() { return top; }
|
||||
ValueType getTop() const throw() { return top; }
|
||||
|
||||
/** Returns the gap that should be left at the top of the region. */
|
||||
int getLeft() const throw() { return left; }
|
||||
ValueType getLeft() const throw() { return left; }
|
||||
|
||||
/** Returns the gap that should be left at the top of the region. */
|
||||
int getBottom() const throw() { return bottom; }
|
||||
ValueType getBottom() const throw() { return bottom; }
|
||||
|
||||
/** Returns the gap that should be left at the top of the region. */
|
||||
int getRight() const throw() { return right; }
|
||||
ValueType getRight() const throw() { return right; }
|
||||
|
||||
/** Returns the sum of the top and bottom gaps. */
|
||||
int getTopAndBottom() const throw() { return top + bottom; }
|
||||
ValueType getTopAndBottom() const throw() { return top + bottom; }
|
||||
|
||||
/** Returns the sum of the left and right gaps. */
|
||||
int getLeftAndRight() const throw() { return left + right; }
|
||||
ValueType getLeftAndRight() const throw() { return left + right; }
|
||||
|
||||
/** Returns true if this border has no thickness along any edge. */
|
||||
bool isEmpty() const throw() { return left + right + top + bottom == 0; }
|
||||
bool isEmpty() const throw() { return left + right + top + bottom == ValueType(); }
|
||||
|
||||
/** Changes the top gap. */
|
||||
void setTop (int newTopGap) throw();
|
||||
void setTop (ValueType newTopGap) throw() { top = newTopGap; }
|
||||
|
||||
/** Changes the left gap. */
|
||||
void setLeft (int newLeftGap) throw();
|
||||
void setLeft (ValueType newLeftGap) throw() { left = newLeftGap; }
|
||||
|
||||
/** Changes the bottom gap. */
|
||||
void setBottom (int newBottomGap) throw();
|
||||
void setBottom (ValueType newBottomGap) throw() { bottom = newBottomGap; }
|
||||
|
||||
/** Changes the right gap. */
|
||||
void setRight (int newRightGap) throw();
|
||||
void setRight (ValueType newRightGap) throw() { right = newRightGap; }
|
||||
|
||||
/** Returns a rectangle with these borders removed from it. */
|
||||
const Rectangle<int> subtractedFrom (const Rectangle<int>& original) const throw();
|
||||
const Rectangle<ValueType> subtractedFrom (const Rectangle<ValueType>& original) const throw()
|
||||
{
|
||||
return Rectangle<ValueType> (original.getX() + left,
|
||||
original.getY() + top,
|
||||
original.getWidth() - (left + right),
|
||||
original.getHeight() - (top + bottom));
|
||||
}
|
||||
|
||||
/** Removes this border from a given rectangle. */
|
||||
void subtractFrom (Rectangle<int>& rectangle) const throw();
|
||||
void subtractFrom (Rectangle<ValueType>& rectangle) const throw()
|
||||
{
|
||||
rectangle = subtractedFrom (rectangle);
|
||||
}
|
||||
|
||||
/** Returns a rectangle with these borders added around it. */
|
||||
const Rectangle<int> addedTo (const Rectangle<int>& original) const throw();
|
||||
const Rectangle<ValueType> addedTo (const Rectangle<ValueType>& original) const throw()
|
||||
{
|
||||
return Rectangle<ValueType> (original.getX() - left,
|
||||
original.getY() - top,
|
||||
original.getWidth() + (left + right),
|
||||
original.getHeight() + (top + bottom));
|
||||
}
|
||||
|
||||
/** Adds this border around a given rectangle. */
|
||||
void addTo (Rectangle<int>& original) const throw();
|
||||
void addTo (Rectangle<ValueType>& rectangle) const throw()
|
||||
{
|
||||
rectangle = addedTo (rectangle);
|
||||
}
|
||||
|
||||
bool operator== (const BorderSize& other) const throw();
|
||||
bool operator!= (const BorderSize& other) const throw();
|
||||
bool operator== (const BorderSize& other) const throw()
|
||||
{
|
||||
return top == other.top && left == other.left && bottom == other.bottom && right == other.right;
|
||||
}
|
||||
|
||||
bool operator!= (const BorderSize& other) const throw()
|
||||
{
|
||||
return ! operator== (other);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
int top, left, bottom, right;
|
||||
ValueType top, left, bottom, right;
|
||||
|
||||
JUCE_LEAK_DETECTOR (BorderSize);
|
||||
};
|
||||
|
|
@ -27499,7 +27531,7 @@ public:
|
|||
|
||||
@see setBounds
|
||||
*/
|
||||
void setBoundsInset (const BorderSize& borders);
|
||||
void setBoundsInset (const BorderSize<int>& borders);
|
||||
|
||||
/** Positions the component within a given rectangle, keeping its proportions
|
||||
unchanged.
|
||||
|
|
@ -38929,13 +38961,13 @@ public:
|
|||
|
||||
@see getBorder
|
||||
*/
|
||||
void setBorder (const BorderSize& border);
|
||||
void setBorder (const BorderSize<int>& border);
|
||||
|
||||
/** Returns the size of border around the edge of the component.
|
||||
|
||||
@see setBorder
|
||||
*/
|
||||
const BorderSize getBorder() const;
|
||||
const BorderSize<int> getBorder() const;
|
||||
|
||||
/** Used to disable the auto-scrolling which keeps the cursor visible.
|
||||
|
||||
|
|
@ -39054,7 +39086,7 @@ private:
|
|||
|
||||
ScopedPointer <Viewport> viewport;
|
||||
TextHolderComponent* textHolder;
|
||||
BorderSize borderSize;
|
||||
BorderSize<int> borderSize;
|
||||
|
||||
bool readOnly : 1;
|
||||
bool multiline : 1;
|
||||
|
|
@ -52293,13 +52325,13 @@ public:
|
|||
|
||||
@see getBorderThickness
|
||||
*/
|
||||
void setBorderThickness (const BorderSize& newBorderSize);
|
||||
void setBorderThickness (const BorderSize<int>& newBorderSize);
|
||||
|
||||
/** Returns the number of pixels wide that the draggable edges of this component are.
|
||||
|
||||
@see setBorderThickness
|
||||
*/
|
||||
const BorderSize getBorderThickness() const;
|
||||
const BorderSize<int> getBorderThickness() const;
|
||||
|
||||
/** Represents the different sections of a resizable border, which allow it to
|
||||
resized in different ways.
|
||||
|
|
@ -52329,7 +52361,7 @@ public:
|
|||
zone that the point lies within.
|
||||
*/
|
||||
static const Zone fromPositionOnBorder (const Rectangle<int>& totalSize,
|
||||
const BorderSize& border,
|
||||
const BorderSize<int>& border,
|
||||
const Point<int>& position);
|
||||
|
||||
/** Returns an appropriate mouse-cursor for this resize zone. */
|
||||
|
|
@ -52399,7 +52431,7 @@ protected:
|
|||
private:
|
||||
WeakReference<Component> component;
|
||||
ComponentBoundsConstrainer* constrainer;
|
||||
BorderSize borderSize;
|
||||
BorderSize<int> borderSize;
|
||||
Rectangle<int> originalBounds;
|
||||
Zone mouseZone;
|
||||
|
||||
|
|
@ -52709,12 +52741,12 @@ public:
|
|||
/** Returns the width of the frame to use around the window.
|
||||
@see getContentComponentBorder
|
||||
*/
|
||||
virtual const BorderSize getBorderThickness();
|
||||
virtual const BorderSize<int> getBorderThickness();
|
||||
|
||||
/** Returns the insets to use when positioning the content component.
|
||||
@see getBorderThickness
|
||||
*/
|
||||
virtual const BorderSize getContentComponentBorder();
|
||||
virtual const BorderSize<int> getContentComponentBorder();
|
||||
|
||||
/** A set of colour IDs to use to change the colour of various aspects of the window.
|
||||
|
||||
|
|
@ -55094,9 +55126,9 @@ public:
|
|||
/** @internal */
|
||||
void lookAndFeelChanged();
|
||||
/** @internal */
|
||||
const BorderSize getBorderThickness();
|
||||
const BorderSize<int> getBorderThickness();
|
||||
/** @internal */
|
||||
const BorderSize getContentComponentBorder();
|
||||
const BorderSize<int> getContentComponentBorder();
|
||||
/** @internal */
|
||||
void mouseDoubleClick (const MouseEvent& e);
|
||||
/** @internal */
|
||||
|
|
@ -56671,15 +56703,15 @@ public:
|
|||
|
||||
virtual void drawResizableFrame (Graphics& g,
|
||||
int w, int h,
|
||||
const BorderSize& borders);
|
||||
const BorderSize<int>& borders);
|
||||
|
||||
virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
|
||||
const BorderSize& border,
|
||||
const BorderSize<int>& border,
|
||||
ResizableWindow& window);
|
||||
|
||||
virtual void drawResizableWindowBorder (Graphics& g,
|
||||
int w, int h,
|
||||
const BorderSize& border,
|
||||
const BorderSize<int>& border,
|
||||
ResizableWindow& window);
|
||||
|
||||
virtual void drawDocumentWindowTitleBar (DocumentWindow& window,
|
||||
|
|
@ -60619,7 +60651,7 @@ public:
|
|||
Whether or not the window has a normal window frame depends on the flags
|
||||
that were set when the window was created by Component::addToDesktop()
|
||||
*/
|
||||
virtual const BorderSize getFrameSize() const = 0;
|
||||
virtual const BorderSize<int> getFrameSize() const = 0;
|
||||
|
||||
/** This is called when the window's bounds change.
|
||||
|
||||
|
|
@ -62665,560 +62697,6 @@ private:
|
|||
#endif
|
||||
#ifndef __JUCE_POINT_JUCEHEADER__
|
||||
|
||||
#endif
|
||||
#ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
|
||||
|
||||
/*** Start of inlined file: juce_PositionedRectangle.h ***/
|
||||
#ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
|
||||
#define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
|
||||
|
||||
/**
|
||||
A rectangle whose co-ordinates can be defined in terms of absolute or
|
||||
proportional distances.
|
||||
|
||||
Designed mainly for storing component positions, this gives you a lot of
|
||||
control over how each co-ordinate is stored, either as an absolute position,
|
||||
or as a proportion of the size of a parent rectangle.
|
||||
|
||||
It also allows you to define the anchor points by which the rectangle is
|
||||
positioned, so for example you could specify that the top right of the
|
||||
rectangle should be an absolute distance from its parent's bottom-right corner.
|
||||
|
||||
This object can be stored as a string, which takes the form "x y w h", including
|
||||
symbols like '%' and letters to indicate the anchor point. See its toString()
|
||||
method for more info.
|
||||
|
||||
Example usage:
|
||||
@code
|
||||
class MyComponent
|
||||
{
|
||||
void resized()
|
||||
{
|
||||
// this will set the child component's x to be 20% of our width, its y
|
||||
// to be 30, its width to be 150, and its height to be 50% of our
|
||||
// height..
|
||||
const PositionedRectangle pos1 ("20% 30 150 50%");
|
||||
pos1.applyToComponent (*myChildComponent1);
|
||||
|
||||
// this will inset the child component with a gap of 10 pixels
|
||||
// around each of its edges..
|
||||
const PositionedRectangle pos2 ("10 10 20M 20M");
|
||||
pos2.applyToComponent (*myChildComponent2);
|
||||
}
|
||||
};
|
||||
@endcode
|
||||
*/
|
||||
class PositionedRectangle
|
||||
{
|
||||
public:
|
||||
|
||||
/** Creates an empty rectangle with all co-ordinates set to zero.
|
||||
|
||||
The default anchor point is top-left; the default
|
||||
*/
|
||||
PositionedRectangle() throw()
|
||||
: x (0.0), y (0.0), w (0.0), h (0.0),
|
||||
xMode (anchorAtLeftOrTop | absoluteFromParentTopLeft),
|
||||
yMode (anchorAtLeftOrTop | absoluteFromParentTopLeft),
|
||||
wMode (absoluteSize), hMode (absoluteSize)
|
||||
{
|
||||
}
|
||||
|
||||
/** Initialises a PositionedRectangle from a saved string version.
|
||||
|
||||
The string must be in the format generated by toString().
|
||||
*/
|
||||
PositionedRectangle (const String& stringVersion) throw()
|
||||
{
|
||||
StringArray tokens;
|
||||
tokens.addTokens (stringVersion, false);
|
||||
|
||||
decodePosString (tokens [0], xMode, x);
|
||||
decodePosString (tokens [1], yMode, y);
|
||||
decodeSizeString (tokens [2], wMode, w);
|
||||
decodeSizeString (tokens [3], hMode, h);
|
||||
}
|
||||
|
||||
/** Creates a copy of another PositionedRectangle. */
|
||||
PositionedRectangle (const PositionedRectangle& other) throw()
|
||||
: x (other.x), y (other.y), w (other.w), h (other.h),
|
||||
xMode (other.xMode), yMode (other.yMode),
|
||||
wMode (other.wMode), hMode (other.hMode)
|
||||
{
|
||||
}
|
||||
|
||||
/** Copies another PositionedRectangle. */
|
||||
PositionedRectangle& operator= (const PositionedRectangle& other) throw()
|
||||
{
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
w = other.w;
|
||||
h = other.h;
|
||||
xMode = other.xMode;
|
||||
yMode = other.yMode;
|
||||
wMode = other.wMode;
|
||||
hMode = other.hMode;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** Returns a string version of this position, from which it can later be
|
||||
re-generated.
|
||||
|
||||
The format is four co-ordinates, "x y w h".
|
||||
|
||||
- If a co-ordinate is absolute, it is stored as an integer, e.g. "100".
|
||||
- If a co-ordinate is proportional to its parent's width or height, it is stored
|
||||
as a percentage, e.g. "80%".
|
||||
- If the X or Y co-ordinate is relative to the parent's right or bottom edge, the
|
||||
number has "R" appended to it, e.g. "100R" means a distance of 100 pixels from
|
||||
the parent's right-hand edge.
|
||||
- If the X or Y co-ordinate is relative to the parent's centre, the number has "C"
|
||||
appended to it, e.g. "-50C" would be 50 pixels left of the parent's centre.
|
||||
- If the X or Y co-ordinate should be anchored at the component's right or bottom
|
||||
edge, then it has "r" appended to it. So "-50Rr" would mean that this component's
|
||||
right-hand edge should be 50 pixels left of the parent's right-hand edge.
|
||||
- If the X or Y co-ordinate should be anchored at the component's centre, then it
|
||||
has "c" appended to it. So "-50Rc" would mean that this component's
|
||||
centre should be 50 pixels left of the parent's right-hand edge. "40%c" means that
|
||||
this component's centre should be placed 40% across the parent's width.
|
||||
- If it's a width or height that should use the parentSizeMinusAbsolute mode, then
|
||||
the number has "M" appended to it.
|
||||
|
||||
To reload a stored string, use the constructor that takes a string parameter.
|
||||
*/
|
||||
const String toString() const throw()
|
||||
{
|
||||
String s;
|
||||
s.preallocateStorage (12);
|
||||
addPosDescription (s, xMode, x); s << ' ';
|
||||
addPosDescription (s, yMode, y); s << ' ';
|
||||
addSizeDescription (s, wMode, w); s << ' ';
|
||||
addSizeDescription (s, hMode, h);
|
||||
return s;
|
||||
}
|
||||
|
||||
/** Calculates the absolute position, given the size of the space that
|
||||
it should go in.
|
||||
|
||||
This will work out any proportional distances and sizes relative to the
|
||||
target rectangle, and will return the absolute position.
|
||||
|
||||
@see applyToComponent
|
||||
*/
|
||||
const Rectangle<int> getRectangle (const Rectangle<int>& target) const throw()
|
||||
{
|
||||
jassert (! target.isEmpty());
|
||||
|
||||
double x_, y_, w_, h_;
|
||||
applyPosAndSize (x_, w_, x, w, xMode, wMode, target.getX(), target.getWidth());
|
||||
applyPosAndSize (y_, h_, y, h, yMode, hMode, target.getY(), target.getHeight());
|
||||
return Rectangle<int> (roundToInt (x_), roundToInt (y_), roundToInt (w_), roundToInt (h_));
|
||||
}
|
||||
|
||||
/** Same as getRectangle(), but returning the values as doubles rather than ints. */
|
||||
void getRectangleDouble (const Rectangle<int>& target,
|
||||
double& x_, double& y_, double& w_, double& h_) const throw()
|
||||
{
|
||||
jassert (! target.isEmpty());
|
||||
applyPosAndSize (x_, w_, x, w, xMode, wMode, target.getX(), target.getWidth());
|
||||
applyPosAndSize (y_, h_, y, h, yMode, hMode, target.getY(), target.getHeight());
|
||||
}
|
||||
|
||||
/** This sets the bounds of the given component to this position.
|
||||
|
||||
This is equivalent to writing:
|
||||
@code
|
||||
comp.setBounds (getRectangle (Rectangle<int> (0, 0, comp.getParentWidth(), comp.getParentHeight())));
|
||||
@endcode
|
||||
|
||||
@see getRectangle, updateFromComponent
|
||||
*/
|
||||
void applyToComponent (Component& comp) const throw()
|
||||
{
|
||||
comp.setBounds (getRectangle (Rectangle<int> (comp.getParentWidth(), comp.getParentHeight())));
|
||||
}
|
||||
|
||||
/** Updates this object's co-ordinates to match the given rectangle.
|
||||
|
||||
This will set all co-ordinates based on the given rectangle, re-calculating
|
||||
any proportional distances, and using the current anchor points.
|
||||
|
||||
So for example if the x co-ordinate mode is currently proportional, this will
|
||||
re-calculate x based on the rectangle's relative position within the target
|
||||
rectangle's width.
|
||||
|
||||
If the target rectangle's width or height are zero then it may not be possible
|
||||
to re-calculate some proportional co-ordinates. In this case, those co-ordinates
|
||||
will not be changed.
|
||||
*/
|
||||
void updateFrom (const Rectangle<int>& newPosition,
|
||||
const Rectangle<int>& targetSpaceToBeRelativeTo) throw()
|
||||
{
|
||||
updatePosAndSize (x, w, newPosition.getX(), newPosition.getWidth(), xMode, wMode, targetSpaceToBeRelativeTo.getX(), targetSpaceToBeRelativeTo.getWidth());
|
||||
updatePosAndSize (y, h, newPosition.getY(), newPosition.getHeight(), yMode, hMode, targetSpaceToBeRelativeTo.getY(), targetSpaceToBeRelativeTo.getHeight());
|
||||
}
|
||||
|
||||
/** Same functionality as updateFrom(), but taking doubles instead of ints.
|
||||
*/
|
||||
void updateFromDouble (const double newX, const double newY,
|
||||
const double newW, const double newH,
|
||||
const Rectangle<int>& target) throw()
|
||||
{
|
||||
updatePosAndSize (x, w, newX, newW, xMode, wMode, target.getX(), target.getWidth());
|
||||
updatePosAndSize (y, h, newY, newH, yMode, hMode, target.getY(), target.getHeight());
|
||||
}
|
||||
|
||||
/** Updates this object's co-ordinates to match the bounds of this component.
|
||||
|
||||
This is equivalent to calling updateFrom() with the component's bounds and
|
||||
it parent size.
|
||||
|
||||
If the component doesn't currently have a parent, then proportional co-ordinates
|
||||
might not be updated because it would need to know the parent's size to do the
|
||||
maths for this.
|
||||
*/
|
||||
void updateFromComponent (const Component& comp) throw()
|
||||
{
|
||||
if (comp.getParentComponent() == 0 && ! comp.isOnDesktop())
|
||||
updateFrom (comp.getBounds(), Rectangle<int>());
|
||||
else
|
||||
updateFrom (comp.getBounds(), Rectangle<int> (comp.getParentWidth(), comp.getParentHeight()));
|
||||
}
|
||||
|
||||
/** Specifies the point within the rectangle, relative to which it should be positioned. */
|
||||
enum AnchorPoint
|
||||
{
|
||||
anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
|
||||
anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
|
||||
anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
|
||||
};
|
||||
|
||||
/** Specifies how an x or y co-ordinate should be interpreted. */
|
||||
enum PositionMode
|
||||
{
|
||||
absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
|
||||
absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
|
||||
absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
|
||||
proportionOfParentSize = 1 << 6 /**< The x or y co-ordinate specifies a proportion of the parent's width or height, measured from the parent's top or left. */
|
||||
};
|
||||
|
||||
/** Specifies how the width or height should be interpreted. */
|
||||
enum SizeMode
|
||||
{
|
||||
absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
|
||||
parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
|
||||
proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
|
||||
};
|
||||
|
||||
/** Sets all options for all co-ordinates.
|
||||
|
||||
This requires a reference rectangle to be specified, because if you're changing any
|
||||
of the modes from proportional to absolute or vice-versa, then it'll need to convert
|
||||
the co-ordinates, and will need to know the parent size so it can calculate this.
|
||||
*/
|
||||
void setModes (const AnchorPoint xAnchor, const PositionMode xMode_,
|
||||
const AnchorPoint yAnchor, const PositionMode yMode_,
|
||||
const SizeMode widthMode, const SizeMode heightMode,
|
||||
const Rectangle<int>& target) throw()
|
||||
{
|
||||
if (xMode != (xAnchor | xMode_) || wMode != widthMode)
|
||||
{
|
||||
double tx, tw;
|
||||
applyPosAndSize (tx, tw, x, w, xMode, wMode, target.getX(), target.getWidth());
|
||||
|
||||
xMode = (uint8) (xAnchor | xMode_);
|
||||
wMode = (uint8) widthMode;
|
||||
|
||||
updatePosAndSize (x, w, tx, tw, xMode, wMode, target.getX(), target.getWidth());
|
||||
}
|
||||
|
||||
if (yMode != (yAnchor | yMode_) || hMode != heightMode)
|
||||
{
|
||||
double ty, th;
|
||||
applyPosAndSize (ty, th, y, h, yMode, hMode, target.getY(), target.getHeight());
|
||||
|
||||
yMode = (uint8) (yAnchor | yMode_);
|
||||
hMode = (uint8) heightMode;
|
||||
|
||||
updatePosAndSize (y, h, ty, th, yMode, hMode, target.getY(), target.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the anchoring mode for the x co-ordinate.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
AnchorPoint getAnchorPointX() const throw()
|
||||
{
|
||||
return (AnchorPoint) (xMode & (anchorAtLeftOrTop | anchorAtRightOrBottom | anchorAtCentre));
|
||||
}
|
||||
|
||||
/** Returns the positioning mode for the x co-ordinate.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
PositionMode getPositionModeX() const throw()
|
||||
{
|
||||
return (PositionMode) (xMode & (absoluteFromParentTopLeft | absoluteFromParentBottomRight
|
||||
| absoluteFromParentCentre | proportionOfParentSize));
|
||||
}
|
||||
|
||||
/** Returns the raw x co-ordinate.
|
||||
|
||||
If the x position mode is absolute, then this will be the absolute value. If it's
|
||||
proportional, then this will be a fractional proportion, where 1.0 means the full
|
||||
width of the parent space.
|
||||
*/
|
||||
double getX() const throw() { return x; }
|
||||
|
||||
/** Sets the raw value of the x co-ordinate.
|
||||
|
||||
See getX() for the meaning of this value.
|
||||
*/
|
||||
void setX (const double newX) throw() { x = newX; }
|
||||
|
||||
/** Returns the anchoring mode for the y co-ordinate.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
AnchorPoint getAnchorPointY() const throw()
|
||||
{
|
||||
return (AnchorPoint) (yMode & (anchorAtLeftOrTop | anchorAtRightOrBottom | anchorAtCentre));
|
||||
}
|
||||
|
||||
/** Returns the positioning mode for the y co-ordinate.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
PositionMode getPositionModeY() const throw()
|
||||
{
|
||||
return (PositionMode) (yMode & (absoluteFromParentTopLeft | absoluteFromParentBottomRight
|
||||
| absoluteFromParentCentre | proportionOfParentSize));
|
||||
}
|
||||
|
||||
/** Returns the raw y co-ordinate.
|
||||
|
||||
If the y position mode is absolute, then this will be the absolute value. If it's
|
||||
proportional, then this will be a fractional proportion, where 1.0 means the full
|
||||
height of the parent space.
|
||||
*/
|
||||
double getY() const throw() { return y; }
|
||||
|
||||
/** Sets the raw value of the y co-ordinate.
|
||||
|
||||
See getY() for the meaning of this value.
|
||||
*/
|
||||
void setY (const double newY) throw() { y = newY; }
|
||||
|
||||
/** Returns the mode used to calculate the width.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
SizeMode getWidthMode() const throw() { return (SizeMode) wMode; }
|
||||
|
||||
/** Returns the raw width value.
|
||||
|
||||
If the width mode is absolute, then this will be the absolute value. If the mode is
|
||||
proportional, then this will be a fractional proportion, where 1.0 means the full
|
||||
width of the parent space.
|
||||
*/
|
||||
double getWidth() const throw() { return w; }
|
||||
|
||||
/** Sets the raw width value.
|
||||
|
||||
See getWidth() for the details about what this value means.
|
||||
*/
|
||||
void setWidth (const double newWidth) throw() { w = newWidth; }
|
||||
|
||||
/** Returns the mode used to calculate the height.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
SizeMode getHeightMode() const throw() { return (SizeMode) hMode; }
|
||||
|
||||
/** Returns the raw height value.
|
||||
|
||||
If the height mode is absolute, then this will be the absolute value. If the mode is
|
||||
proportional, then this will be a fractional proportion, where 1.0 means the full
|
||||
height of the parent space.
|
||||
*/
|
||||
double getHeight() const throw() { return h; }
|
||||
|
||||
/** Sets the raw height value.
|
||||
|
||||
See getHeight() for the details about what this value means.
|
||||
*/
|
||||
void setHeight (const double newHeight) throw() { h = newHeight; }
|
||||
|
||||
/** If the size and position are constance, and wouldn't be affected by changes
|
||||
in the parent's size, then this will return true.
|
||||
*/
|
||||
bool isPositionAbsolute() const throw()
|
||||
{
|
||||
return xMode == absoluteFromParentTopLeft
|
||||
&& yMode == absoluteFromParentTopLeft
|
||||
&& wMode == absoluteSize
|
||||
&& hMode == absoluteSize;
|
||||
}
|
||||
|
||||
/** Compares two objects. */
|
||||
bool operator== (const PositionedRectangle& other) const throw()
|
||||
{
|
||||
return x == other.x && y == other.y
|
||||
&& w == other.w && h == other.h
|
||||
&& xMode == other.xMode && yMode == other.yMode
|
||||
&& wMode == other.wMode && hMode == other.hMode;
|
||||
}
|
||||
|
||||
/** Compares two objects. */
|
||||
bool operator!= (const PositionedRectangle& other) const throw()
|
||||
{
|
||||
return ! operator== (other);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
double x, y, w, h;
|
||||
uint8 xMode, yMode, wMode, hMode;
|
||||
|
||||
void addPosDescription (String& s, const uint8 mode, const double value) const throw()
|
||||
{
|
||||
if ((mode & proportionOfParentSize) != 0)
|
||||
{
|
||||
s << (roundToInt (value * 100000.0) / 1000.0) << '%';
|
||||
}
|
||||
else
|
||||
{
|
||||
s << (roundToInt (value * 100.0) / 100.0);
|
||||
|
||||
if ((mode & absoluteFromParentBottomRight) != 0)
|
||||
s << 'R';
|
||||
else if ((mode & absoluteFromParentCentre) != 0)
|
||||
s << 'C';
|
||||
}
|
||||
|
||||
if ((mode & anchorAtRightOrBottom) != 0)
|
||||
s << 'r';
|
||||
else if ((mode & anchorAtCentre) != 0)
|
||||
s << 'c';
|
||||
}
|
||||
|
||||
void addSizeDescription (String& s, const uint8 mode, const double value) const throw()
|
||||
{
|
||||
if (mode == proportionalSize)
|
||||
s << (roundToInt (value * 100000.0) / 1000.0) << '%';
|
||||
else if (mode == parentSizeMinusAbsolute)
|
||||
s << (roundToInt (value * 100.0) / 100.0) << 'M';
|
||||
else
|
||||
s << (roundToInt (value * 100.0) / 100.0);
|
||||
}
|
||||
|
||||
void decodePosString (const String& s, uint8& mode, double& value) throw()
|
||||
{
|
||||
if (s.containsChar ('r'))
|
||||
mode = anchorAtRightOrBottom;
|
||||
else if (s.containsChar ('c'))
|
||||
mode = anchorAtCentre;
|
||||
else
|
||||
mode = anchorAtLeftOrTop;
|
||||
|
||||
if (s.containsChar ('%'))
|
||||
{
|
||||
mode |= proportionOfParentSize;
|
||||
value = s.removeCharacters ("%rcRC").getDoubleValue() / 100.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s.containsChar ('R'))
|
||||
mode |= absoluteFromParentBottomRight;
|
||||
else if (s.containsChar ('C'))
|
||||
mode |= absoluteFromParentCentre;
|
||||
else
|
||||
mode |= absoluteFromParentTopLeft;
|
||||
|
||||
value = s.removeCharacters ("rcRC").getDoubleValue();
|
||||
}
|
||||
}
|
||||
|
||||
void decodeSizeString (const String& s, uint8& mode, double& value) throw()
|
||||
{
|
||||
if (s.containsChar ('%'))
|
||||
{
|
||||
mode = proportionalSize;
|
||||
value = s.upToFirstOccurrenceOf ("%", false, false).getDoubleValue() / 100.0;
|
||||
}
|
||||
else if (s.containsChar ('M'))
|
||||
{
|
||||
mode = parentSizeMinusAbsolute;
|
||||
value = s.getDoubleValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = absoluteSize;
|
||||
value = s.getDoubleValue();
|
||||
}
|
||||
}
|
||||
|
||||
void applyPosAndSize (double& xOut, double& wOut, const double x_, const double w_,
|
||||
const uint8 xMode_, const uint8 wMode_,
|
||||
const int parentPos, const int parentSize) const throw()
|
||||
{
|
||||
if (wMode_ == proportionalSize)
|
||||
wOut = roundToInt (w_ * parentSize);
|
||||
else if (wMode_ == parentSizeMinusAbsolute)
|
||||
wOut = jmax (0, parentSize - roundToInt (w_));
|
||||
else
|
||||
wOut = roundToInt (w_);
|
||||
|
||||
if ((xMode_ & proportionOfParentSize) != 0)
|
||||
xOut = parentPos + x_ * parentSize;
|
||||
else if ((xMode_ & absoluteFromParentBottomRight) != 0)
|
||||
xOut = (parentPos + parentSize) - x_;
|
||||
else if ((xMode_ & absoluteFromParentCentre) != 0)
|
||||
xOut = x_ + (parentPos + parentSize / 2);
|
||||
else
|
||||
xOut = x_ + parentPos;
|
||||
|
||||
if ((xMode_ & anchorAtRightOrBottom) != 0)
|
||||
xOut -= wOut;
|
||||
else if ((xMode_ & anchorAtCentre) != 0)
|
||||
xOut -= wOut / 2;
|
||||
}
|
||||
|
||||
void updatePosAndSize (double& xOut, double& wOut, double x_, const double w_,
|
||||
const uint8 xMode_, const uint8 wMode_,
|
||||
const int parentPos, const int parentSize) const throw()
|
||||
{
|
||||
if (wMode_ == proportionalSize)
|
||||
{
|
||||
if (parentSize > 0)
|
||||
wOut = w_ / parentSize;
|
||||
}
|
||||
else if (wMode_ == parentSizeMinusAbsolute)
|
||||
wOut = parentSize - w_;
|
||||
else
|
||||
wOut = w_;
|
||||
|
||||
if ((xMode_ & anchorAtRightOrBottom) != 0)
|
||||
x_ += w_;
|
||||
else if ((xMode_ & anchorAtCentre) != 0)
|
||||
x_ += w_ / 2;
|
||||
|
||||
if ((xMode_ & proportionOfParentSize) != 0)
|
||||
{
|
||||
if (parentSize > 0)
|
||||
xOut = (x_ - parentPos) / parentSize;
|
||||
}
|
||||
else if ((xMode_ & absoluteFromParentBottomRight) != 0)
|
||||
xOut = (parentPos + parentSize) - x_;
|
||||
else if ((xMode_ & absoluteFromParentCentre) != 0)
|
||||
xOut = x_ - (parentPos + parentSize / 2);
|
||||
else
|
||||
xOut = x_ - parentPos;
|
||||
}
|
||||
|
||||
JUCE_LEAK_DETECTOR (PositionedRectangle);
|
||||
};
|
||||
|
||||
#endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
|
||||
/*** End of inlined file: juce_PositionedRectangle.h ***/
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef __JUCE_RECTANGLE_JUCEHEADER__
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
*/
|
||||
#define JUCE_MAJOR_VERSION 1
|
||||
#define JUCE_MINOR_VERSION 53
|
||||
#define JUCE_BUILDNUMBER 12
|
||||
#define JUCE_BUILDNUMBER 13
|
||||
|
||||
/** Current Juce version number.
|
||||
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ void Label::mouseDoubleClick (const MouseEvent& e)
|
|||
void Label::resized()
|
||||
{
|
||||
if (editor != 0)
|
||||
editor->setBoundsInset (BorderSize (0));
|
||||
editor->setBoundsInset (BorderSize<int> (0));
|
||||
}
|
||||
|
||||
void Label::focusGained (FocusChangeType cause)
|
||||
|
|
|
|||
|
|
@ -408,10 +408,8 @@ void ListBox::paintOverChildren (Graphics& g)
|
|||
|
||||
void ListBox::resized()
|
||||
{
|
||||
viewport->setBoundsInset (BorderSize (outlineThickness + ((headerComponent != 0) ? headerComponent->getHeight() : 0),
|
||||
outlineThickness,
|
||||
outlineThickness,
|
||||
outlineThickness));
|
||||
viewport->setBoundsInset (BorderSize<int> (outlineThickness + ((headerComponent != 0) ? headerComponent->getHeight() : 0),
|
||||
outlineThickness, outlineThickness, outlineThickness));
|
||||
|
||||
viewport->setSingleStepSizes (20, getRowHeight());
|
||||
|
||||
|
|
|
|||
|
|
@ -1468,13 +1468,13 @@ void TextEditor::setIndents (const int newLeftIndent,
|
|||
topIndent = newTopIndent;
|
||||
}
|
||||
|
||||
void TextEditor::setBorder (const BorderSize& border)
|
||||
void TextEditor::setBorder (const BorderSize<int>& border)
|
||||
{
|
||||
borderSize = border;
|
||||
resized();
|
||||
}
|
||||
|
||||
const BorderSize TextEditor::getBorder() const
|
||||
const BorderSize<int> TextEditor::getBorder() const
|
||||
{
|
||||
return borderSize;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -488,13 +488,13 @@ public:
|
|||
|
||||
@see getBorder
|
||||
*/
|
||||
void setBorder (const BorderSize& border);
|
||||
void setBorder (const BorderSize<int>& border);
|
||||
|
||||
/** Returns the size of border around the edge of the component.
|
||||
|
||||
@see setBorder
|
||||
*/
|
||||
const BorderSize getBorder() const;
|
||||
const BorderSize<int> getBorder() const;
|
||||
|
||||
/** Used to disable the auto-scrolling which keeps the cursor visible.
|
||||
|
||||
|
|
@ -616,7 +616,7 @@ private:
|
|||
|
||||
ScopedPointer <Viewport> viewport;
|
||||
TextHolderComponent* textHolder;
|
||||
BorderSize borderSize;
|
||||
BorderSize<int> borderSize;
|
||||
|
||||
bool readOnly : 1;
|
||||
bool multiline : 1;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ void ToolbarItemPalette::replaceComponent (ToolbarItemComponent* const comp)
|
|||
|
||||
void ToolbarItemPalette::resized()
|
||||
{
|
||||
viewport.setBoundsInset (BorderSize (1));
|
||||
viewport.setBoundsInset (BorderSize<int> (1));
|
||||
|
||||
Component* const itemHolder = viewport.getViewedComponent();
|
||||
|
||||
|
|
|
|||
|
|
@ -1126,7 +1126,7 @@ void Component::centreWithSize (const int width, const int height)
|
|||
width, height);
|
||||
}
|
||||
|
||||
void Component::setBoundsInset (const BorderSize& borders)
|
||||
void Component::setBoundsInset (const BorderSize<int>& borders)
|
||||
{
|
||||
setBounds (borders.subtractedFrom (ComponentHelpers::getParentOrMainMonitorBounds (*this)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ public:
|
|||
|
||||
@see setBounds
|
||||
*/
|
||||
void setBoundsInset (const BorderSize& borders);
|
||||
void setBoundsInset (const BorderSize<int>& borders);
|
||||
|
||||
/** Positions the component within a given rectangle, keeping its proportions
|
||||
unchanged.
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ void ComponentBoundsConstrainer::setBoundsForComponent (Component* const compone
|
|||
jassert (component != 0);
|
||||
|
||||
Rectangle<int> limits, bounds (targetBounds);
|
||||
BorderSize border;
|
||||
BorderSize<int> border;
|
||||
|
||||
Component* const parent = component->getParentComponent();
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ bool ResizableBorderComponent::Zone::operator== (const ResizableBorderComponent:
|
|||
bool ResizableBorderComponent::Zone::operator!= (const ResizableBorderComponent::Zone& other) const throw() { return zone != other.zone; }
|
||||
|
||||
const ResizableBorderComponent::Zone ResizableBorderComponent::Zone::fromPositionOnBorder (const Rectangle<int>& totalSize,
|
||||
const BorderSize& border,
|
||||
const BorderSize<int>& border,
|
||||
const Point<int>& position)
|
||||
{
|
||||
int z = 0;
|
||||
|
|
@ -177,7 +177,7 @@ bool ResizableBorderComponent::hitTest (int x, int y)
|
|||
|| y >= getHeight() - borderSize.getBottom();
|
||||
}
|
||||
|
||||
void ResizableBorderComponent::setBorderThickness (const BorderSize& newBorderSize)
|
||||
void ResizableBorderComponent::setBorderThickness (const BorderSize<int>& newBorderSize)
|
||||
{
|
||||
if (borderSize != newBorderSize)
|
||||
{
|
||||
|
|
@ -186,7 +186,7 @@ void ResizableBorderComponent::setBorderThickness (const BorderSize& newBorderSi
|
|||
}
|
||||
}
|
||||
|
||||
const BorderSize ResizableBorderComponent::getBorderThickness() const
|
||||
const BorderSize<int> ResizableBorderComponent::getBorderThickness() const
|
||||
{
|
||||
return borderSize;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,13 +78,13 @@ public:
|
|||
|
||||
@see getBorderThickness
|
||||
*/
|
||||
void setBorderThickness (const BorderSize& newBorderSize);
|
||||
void setBorderThickness (const BorderSize<int>& newBorderSize);
|
||||
|
||||
/** Returns the number of pixels wide that the draggable edges of this component are.
|
||||
|
||||
@see setBorderThickness
|
||||
*/
|
||||
const BorderSize getBorderThickness() const;
|
||||
const BorderSize<int> getBorderThickness() const;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -118,7 +118,7 @@ public:
|
|||
zone that the point lies within.
|
||||
*/
|
||||
static const Zone fromPositionOnBorder (const Rectangle<int>& totalSize,
|
||||
const BorderSize& border,
|
||||
const BorderSize<int>& border,
|
||||
const Point<int>& position);
|
||||
|
||||
/** Returns an appropriate mouse-cursor for this resize zone. */
|
||||
|
|
@ -189,7 +189,7 @@ protected:
|
|||
private:
|
||||
WeakReference<Component> component;
|
||||
ComponentBoundsConstrainer* constrainer;
|
||||
BorderSize borderSize;
|
||||
BorderSize<int> borderSize;
|
||||
Rectangle<int> originalBounds;
|
||||
Zone mouseZone;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace TabbedComponentHelpers
|
|||
delete comp;
|
||||
}
|
||||
|
||||
const Rectangle<int> getTabArea (Rectangle<int>& content, BorderSize& outline,
|
||||
const Rectangle<int> getTabArea (Rectangle<int>& content, BorderSize<int>& outline,
|
||||
const TabbedButtonBar::Orientation orientation, const int tabDepth)
|
||||
{
|
||||
switch (orientation)
|
||||
|
|
@ -245,7 +245,7 @@ void TabbedComponent::paint (Graphics& g)
|
|||
g.fillAll (findColour (backgroundColourId));
|
||||
|
||||
Rectangle<int> content (getLocalBounds());
|
||||
BorderSize outline (outlineThickness);
|
||||
BorderSize<int> outline (outlineThickness);
|
||||
TabbedComponentHelpers::getTabArea (content, outline, getOrientation(), tabDepth);
|
||||
|
||||
g.reduceClipRegion (content);
|
||||
|
|
@ -264,10 +264,10 @@ void TabbedComponent::paint (Graphics& g)
|
|||
void TabbedComponent::resized()
|
||||
{
|
||||
Rectangle<int> content (getLocalBounds());
|
||||
BorderSize outline (outlineThickness);
|
||||
BorderSize<int> outline (outlineThickness);
|
||||
|
||||
tabs->setBounds (TabbedComponentHelpers::getTabArea (content, outline, getOrientation(), tabDepth));
|
||||
content = BorderSize (edgeIndent).subtractedFrom (outline.subtractedFrom (content));
|
||||
content = BorderSize<int> (edgeIndent).subtractedFrom (outline.subtractedFrom (content));
|
||||
|
||||
for (int i = contentComponents.size(); --i >= 0;)
|
||||
if (contentComponents.getReference (i) != 0)
|
||||
|
|
|
|||
|
|
@ -1820,7 +1820,7 @@ void LookAndFeel::drawCornerResizer (Graphics& g,
|
|||
}
|
||||
}
|
||||
|
||||
void LookAndFeel::drawResizableFrame (Graphics& g, int w, int h, const BorderSize& border)
|
||||
void LookAndFeel::drawResizableFrame (Graphics& g, int w, int h, const BorderSize<int>& border)
|
||||
{
|
||||
if (! border.isEmpty())
|
||||
{
|
||||
|
|
@ -1843,13 +1843,13 @@ void LookAndFeel::drawResizableFrame (Graphics& g, int w, int h, const BorderSiz
|
|||
|
||||
//==============================================================================
|
||||
void LookAndFeel::fillResizableWindowBackground (Graphics& g, int /*w*/, int /*h*/,
|
||||
const BorderSize& /*border*/, ResizableWindow& window)
|
||||
const BorderSize<int>& /*border*/, ResizableWindow& window)
|
||||
{
|
||||
g.fillAll (window.getBackgroundColour());
|
||||
}
|
||||
|
||||
void LookAndFeel::drawResizableWindowBorder (Graphics&, int /*w*/, int /*h*/,
|
||||
const BorderSize& /*border*/, ResizableWindow&)
|
||||
const BorderSize<int>& /*border*/, ResizableWindow&)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -456,16 +456,16 @@ public:
|
|||
|
||||
virtual void drawResizableFrame (Graphics& g,
|
||||
int w, int h,
|
||||
const BorderSize& borders);
|
||||
const BorderSize<int>& borders);
|
||||
|
||||
//==============================================================================
|
||||
virtual void fillResizableWindowBackground (Graphics& g, int w, int h,
|
||||
const BorderSize& border,
|
||||
const BorderSize<int>& border,
|
||||
ResizableWindow& window);
|
||||
|
||||
virtual void drawResizableWindowBorder (Graphics& g,
|
||||
int w, int h,
|
||||
const BorderSize& border,
|
||||
const BorderSize<int>& border,
|
||||
ResizableWindow& window);
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ public:
|
|||
Whether or not the window has a normal window frame depends on the flags
|
||||
that were set when the window was created by Component::addToDesktop()
|
||||
*/
|
||||
virtual const BorderSize getFrameSize() const = 0;
|
||||
virtual const BorderSize<int> getFrameSize() const = 0;
|
||||
|
||||
/** This is called when the window's bounds change.
|
||||
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ void DocumentWindow::paint (Graphics& g)
|
|||
{
|
||||
g.setColour (getBackgroundColour().overlaidWith (Colour (0x80000000)));
|
||||
|
||||
const BorderSize border (getBorderThickness());
|
||||
const BorderSize<int> border (getBorderThickness());
|
||||
|
||||
g.fillRect (0, 0, getWidth(), border.getTop());
|
||||
g.fillRect (0, border.getTop(), border.getLeft(), getHeight() - border.getTopAndBottom());
|
||||
|
|
@ -270,15 +270,15 @@ void DocumentWindow::resized()
|
|||
titleBarArea.getWidth(), menuBarHeight);
|
||||
}
|
||||
|
||||
const BorderSize DocumentWindow::getBorderThickness()
|
||||
const BorderSize<int> DocumentWindow::getBorderThickness()
|
||||
{
|
||||
return BorderSize ((isFullScreen() || isUsingNativeTitleBar())
|
||||
? 0 : (resizableBorder != 0 ? 4 : 1));
|
||||
return BorderSize<int> ((isFullScreen() || isUsingNativeTitleBar())
|
||||
? 0 : (resizableBorder != 0 ? 4 : 1));
|
||||
}
|
||||
|
||||
const BorderSize DocumentWindow::getContentComponentBorder()
|
||||
const BorderSize<int> DocumentWindow::getContentComponentBorder()
|
||||
{
|
||||
BorderSize border (getBorderThickness());
|
||||
BorderSize<int> border (getBorderThickness());
|
||||
|
||||
border.setTop (border.getTop()
|
||||
+ (isUsingNativeTitleBar() ? 0 : titleBarHeight)
|
||||
|
|
@ -294,7 +294,7 @@ int DocumentWindow::getTitleBarHeight() const
|
|||
|
||||
const Rectangle<int> DocumentWindow::getTitleBarArea()
|
||||
{
|
||||
const BorderSize border (getBorderThickness());
|
||||
const BorderSize<int> border (getBorderThickness());
|
||||
|
||||
return Rectangle<int> (border.getLeft(), border.getTop(),
|
||||
getWidth() - border.getLeftAndRight(),
|
||||
|
|
|
|||
|
|
@ -238,9 +238,9 @@ public:
|
|||
/** @internal */
|
||||
void lookAndFeelChanged();
|
||||
/** @internal */
|
||||
const BorderSize getBorderThickness();
|
||||
const BorderSize<int> getBorderThickness();
|
||||
/** @internal */
|
||||
const BorderSize getContentComponentBorder();
|
||||
const BorderSize<int> getContentComponentBorder();
|
||||
/** @internal */
|
||||
void mouseDoubleClick (const MouseEvent& e);
|
||||
/** @internal */
|
||||
|
|
|
|||
|
|
@ -131,18 +131,18 @@ void ResizableWindow::setContentComponentSize (int width, int height)
|
|||
{
|
||||
jassert (width > 0 && height > 0); // not a great idea to give it a zero size..
|
||||
|
||||
const BorderSize border (getContentComponentBorder());
|
||||
const BorderSize<int> border (getContentComponentBorder());
|
||||
|
||||
setSize (width + border.getLeftAndRight(),
|
||||
height + border.getTopAndBottom());
|
||||
}
|
||||
|
||||
const BorderSize ResizableWindow::getBorderThickness()
|
||||
const BorderSize<int> ResizableWindow::getBorderThickness()
|
||||
{
|
||||
return BorderSize (isUsingNativeTitleBar() ? 0 : ((resizableBorder != 0 && ! isFullScreen()) ? 5 : 3));
|
||||
return BorderSize<int> (isUsingNativeTitleBar() ? 0 : ((resizableBorder != 0 && ! isFullScreen()) ? 5 : 3));
|
||||
}
|
||||
|
||||
const BorderSize ResizableWindow::getContentComponentBorder()
|
||||
const BorderSize<int> ResizableWindow::getContentComponentBorder()
|
||||
{
|
||||
return getBorderThickness();
|
||||
}
|
||||
|
|
@ -208,7 +208,7 @@ void ResizableWindow::childBoundsChanged (Component* child)
|
|||
jassert (child->getWidth() > 0);
|
||||
jassert (child->getHeight() > 0);
|
||||
|
||||
const BorderSize borders (getContentComponentBorder());
|
||||
const BorderSize<int> borders (getContentComponentBorder());
|
||||
|
||||
setSize (child->getWidth() + borders.getLeftAndRight(),
|
||||
child->getHeight() + borders.getTopAndBottom());
|
||||
|
|
@ -219,7 +219,7 @@ void ResizableWindow::childBoundsChanged (Component* child)
|
|||
//==============================================================================
|
||||
void ResizableWindow::activeWindowStatusChanged()
|
||||
{
|
||||
const BorderSize border (getContentComponentBorder());
|
||||
const BorderSize<int> border (getContentComponentBorder());
|
||||
|
||||
Rectangle<int> area (getLocalBounds());
|
||||
repaint (area.removeFromTop (border.getTop()));
|
||||
|
|
|
|||
|
|
@ -271,12 +271,12 @@ public:
|
|||
/** Returns the width of the frame to use around the window.
|
||||
@see getContentComponentBorder
|
||||
*/
|
||||
virtual const BorderSize getBorderThickness();
|
||||
virtual const BorderSize<int> getBorderThickness();
|
||||
|
||||
/** Returns the insets to use when positioning the content component.
|
||||
@see getBorderThickness
|
||||
*/
|
||||
virtual const BorderSize getContentComponentBorder();
|
||||
virtual const BorderSize<int> getContentComponentBorder();
|
||||
|
||||
//==============================================================================
|
||||
/** A set of colour IDs to use to change the colour of various aspects of the window.
|
||||
|
|
|
|||
|
|
@ -560,21 +560,19 @@ void Graphics::drawHorizontalLine (const int y, float left, float right) const
|
|||
context->drawHorizontalLine (y, left, right);
|
||||
}
|
||||
|
||||
void Graphics::drawLine (float x1, float y1, float x2, float y2) const
|
||||
void Graphics::drawLine (const float x1, const float y1, const float x2, const float y2) const
|
||||
{
|
||||
context->drawLine (Line<float> (x1, y1, x2, y2));
|
||||
}
|
||||
|
||||
void Graphics::drawLine (const float startX, const float startY,
|
||||
const float endX, const float endY,
|
||||
const float lineThickness) const
|
||||
{
|
||||
drawLine (Line<float> (startX, startY, endX, endY),lineThickness);
|
||||
}
|
||||
|
||||
void Graphics::drawLine (const Line<float>& line) const
|
||||
{
|
||||
drawLine (line.getStartX(), line.getStartY(), line.getEndX(), line.getEndY());
|
||||
context->drawLine (line);
|
||||
}
|
||||
|
||||
void Graphics::drawLine (const float x1, const float y1, const float x2, const float y2, const float lineThickness) const
|
||||
{
|
||||
drawLine (Line<float> (x1, y1, x2, y2), lineThickness);
|
||||
}
|
||||
|
||||
void Graphics::drawLine (const Line<float>& line, const float lineThickness) const
|
||||
|
|
@ -584,42 +582,35 @@ void Graphics::drawLine (const Line<float>& line, const float lineThickness) con
|
|||
fillPath (p);
|
||||
}
|
||||
|
||||
void Graphics::drawDashedLine (const float startX, const float startY,
|
||||
const float endX, const float endY,
|
||||
const float* const dashLengths,
|
||||
const int numDashLengths,
|
||||
const float lineThickness) const
|
||||
void Graphics::drawDashedLine (const Line<float>& line, const float* const dashLengths,
|
||||
const int numDashLengths, const float lineThickness, int n) const
|
||||
{
|
||||
const double dx = endX - startX;
|
||||
const double dy = endY - startY;
|
||||
const double totalLen = juce_hypot (dx, dy);
|
||||
jassert (n >= 0 && n < numDashLengths); // your start index must be valid!
|
||||
|
||||
if (totalLen >= 0.5)
|
||||
const Point<double> delta ((line.getEnd() - line.getStart()).toDouble());
|
||||
const double totalLen = delta.getDistanceFromOrigin();
|
||||
|
||||
if (totalLen >= 0.1)
|
||||
{
|
||||
const double onePixAlpha = 1.0 / totalLen;
|
||||
|
||||
double alpha = 0.0;
|
||||
float x = startX;
|
||||
float y = startY;
|
||||
int n = 0;
|
||||
|
||||
while (alpha < 1.0f)
|
||||
for (double alpha = 0.0; alpha < 1.0;)
|
||||
{
|
||||
alpha = jmin (1.0, alpha + dashLengths[n++] * onePixAlpha);
|
||||
n = n % numDashLengths;
|
||||
jassert (dashLengths[n] > 0); // can't have zero-length dashes!
|
||||
|
||||
const float oldX = x;
|
||||
const float oldY = y;
|
||||
|
||||
x = (float) (startX + dx * alpha);
|
||||
y = (float) (startY + dy * alpha);
|
||||
const double lastAlpha = alpha;
|
||||
alpha = jmin (1.0, alpha + dashLengths [n] * onePixAlpha);
|
||||
n = (n + 1) % numDashLengths;
|
||||
|
||||
if ((n & 1) != 0)
|
||||
{
|
||||
const Line<float> segment (line.getStart() + (delta * lastAlpha).toFloat(),
|
||||
line.getStart() + (delta * alpha).toFloat());
|
||||
|
||||
if (lineThickness != 1.0f)
|
||||
drawLine (oldX, oldY, x, y, lineThickness);
|
||||
drawLine (segment, lineThickness);
|
||||
else
|
||||
drawLine (oldX, oldY, x, y);
|
||||
context->drawLine (segment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -374,21 +374,19 @@ public:
|
|||
|
||||
/** Draws a dashed line using a custom set of dash-lengths.
|
||||
|
||||
@param startX the line's start x co-ordinate
|
||||
@param startY the line's start y co-ordinate
|
||||
@param endX the line's end x co-ordinate
|
||||
@param endY the line's end y co-ordinate
|
||||
@param line the line to draw
|
||||
@param dashLengths a series of lengths to specify the on/off lengths - e.g.
|
||||
{ 4, 5, 6, 7 } will draw a line of 4 pixels, skip 5 pixels,
|
||||
draw 6 pixels, skip 7 pixels, and then repeat.
|
||||
@param numDashLengths the number of elements in the array (this must be an even number).
|
||||
@param lineThickness the thickness of the line to draw
|
||||
@param dashIndexToStartFrom the index in the dash-length array to use for the first segment
|
||||
@see PathStrokeType::createDashedStroke
|
||||
*/
|
||||
void drawDashedLine (float startX, float startY,
|
||||
float endX, float endY,
|
||||
void drawDashedLine (const Line<float>& line,
|
||||
const float* dashLengths, int numDashLengths,
|
||||
float lineThickness = 1.0f) const;
|
||||
float lineThickness = 1.0f,
|
||||
int dashIndexToStartFrom = 0) const;
|
||||
|
||||
/** Draws a vertical line of pixels at a given x position.
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ const AffineTransform AffineTransform::inverted() const throw()
|
|||
|
||||
bool AffineTransform::isSingularity() const throw()
|
||||
{
|
||||
return (mat00 * mat11 - mat10 * mat01) == 0.0;
|
||||
return (mat00 * mat11 - mat10 * mat01) == 0;
|
||||
}
|
||||
|
||||
const AffineTransform AffineTransform::fromTargetPoints (const float x00, const float y00,
|
||||
|
|
|
|||
|
|
@ -1,141 +0,0 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library - "Jules' Utility Class Extensions"
|
||||
Copyright 2004-10 by Raw Material Software Ltd.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
JUCE can be redistributed and/or modified under the terms of the GNU General
|
||||
Public License (Version 2), as published by the Free Software Foundation.
|
||||
A copy of the license is included in the JUCE distribution, or can be found
|
||||
online at www.gnu.org/licenses.
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.rawmaterialsoftware.com/juce for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include "../../../core/juce_StandardHeader.h"
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
#include "juce_BorderSize.h"
|
||||
|
||||
|
||||
//==============================================================================
|
||||
BorderSize::BorderSize() throw()
|
||||
: top (0),
|
||||
left (0),
|
||||
bottom (0),
|
||||
right (0)
|
||||
{
|
||||
}
|
||||
|
||||
BorderSize::BorderSize (const BorderSize& other) throw()
|
||||
: top (other.top),
|
||||
left (other.left),
|
||||
bottom (other.bottom),
|
||||
right (other.right)
|
||||
{
|
||||
}
|
||||
|
||||
BorderSize::BorderSize (const int topGap,
|
||||
const int leftGap,
|
||||
const int bottomGap,
|
||||
const int rightGap) throw()
|
||||
: top (topGap),
|
||||
left (leftGap),
|
||||
bottom (bottomGap),
|
||||
right (rightGap)
|
||||
{
|
||||
}
|
||||
|
||||
BorderSize::BorderSize (const int allGaps) throw()
|
||||
: top (allGaps),
|
||||
left (allGaps),
|
||||
bottom (allGaps),
|
||||
right (allGaps)
|
||||
{
|
||||
}
|
||||
|
||||
BorderSize::~BorderSize() throw()
|
||||
{
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void BorderSize::setTop (const int newTopGap) throw()
|
||||
{
|
||||
top = newTopGap;
|
||||
}
|
||||
|
||||
void BorderSize::setLeft (const int newLeftGap) throw()
|
||||
{
|
||||
left = newLeftGap;
|
||||
}
|
||||
|
||||
void BorderSize::setBottom (const int newBottomGap) throw()
|
||||
{
|
||||
bottom = newBottomGap;
|
||||
}
|
||||
|
||||
void BorderSize::setRight (const int newRightGap) throw()
|
||||
{
|
||||
right = newRightGap;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
const Rectangle<int> BorderSize::subtractedFrom (const Rectangle<int>& r) const throw()
|
||||
{
|
||||
return Rectangle<int> (r.getX() + left,
|
||||
r.getY() + top,
|
||||
r.getWidth() - (left + right),
|
||||
r.getHeight() - (top + bottom));
|
||||
}
|
||||
|
||||
void BorderSize::subtractFrom (Rectangle<int>& r) const throw()
|
||||
{
|
||||
r.setBounds (r.getX() + left,
|
||||
r.getY() + top,
|
||||
r.getWidth() - (left + right),
|
||||
r.getHeight() - (top + bottom));
|
||||
}
|
||||
|
||||
const Rectangle<int> BorderSize::addedTo (const Rectangle<int>& r) const throw()
|
||||
{
|
||||
return Rectangle<int> (r.getX() - left,
|
||||
r.getY() - top,
|
||||
r.getWidth() + (left + right),
|
||||
r.getHeight() + (top + bottom));
|
||||
}
|
||||
|
||||
void BorderSize::addTo (Rectangle<int>& r) const throw()
|
||||
{
|
||||
r.setBounds (r.getX() - left,
|
||||
r.getY() - top,
|
||||
r.getWidth() + (left + right),
|
||||
r.getHeight() + (top + bottom));
|
||||
}
|
||||
|
||||
bool BorderSize::operator== (const BorderSize& other) const throw()
|
||||
{
|
||||
return top == other.top
|
||||
&& left == other.left
|
||||
&& bottom == other.bottom
|
||||
&& right == other.right;
|
||||
}
|
||||
|
||||
bool BorderSize::operator!= (const BorderSize& other) const throw()
|
||||
{
|
||||
return ! operator== (other);
|
||||
}
|
||||
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
@ -38,87 +38,118 @@
|
|||
|
||||
@see Rectangle
|
||||
*/
|
||||
class JUCE_API BorderSize
|
||||
template <typename ValueType>
|
||||
class BorderSize
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Creates a null border.
|
||||
|
||||
All sizes are left as 0.
|
||||
*/
|
||||
BorderSize() throw();
|
||||
BorderSize() throw()
|
||||
: top(), left(), bottom(), right()
|
||||
{
|
||||
}
|
||||
|
||||
/** Creates a copy of another border. */
|
||||
BorderSize (const BorderSize& other) throw();
|
||||
BorderSize (const BorderSize& other) throw()
|
||||
: top (other.top), left (other.left), bottom (other.bottom), right (other.right)
|
||||
{
|
||||
}
|
||||
|
||||
/** Creates a border with the given gaps. */
|
||||
BorderSize (int topGap,
|
||||
int leftGap,
|
||||
int bottomGap,
|
||||
int rightGap) throw();
|
||||
BorderSize (ValueType topGap, ValueType leftGap, ValueType bottomGap, ValueType rightGap) throw()
|
||||
: top (topGap), left (leftGap), bottom (bottomGap), right (rightGap)
|
||||
{
|
||||
}
|
||||
|
||||
/** Creates a border with the given gap on all sides. */
|
||||
explicit BorderSize (int allGaps) throw();
|
||||
|
||||
/** Destructor. */
|
||||
~BorderSize() throw();
|
||||
explicit BorderSize (ValueType allGaps) throw()
|
||||
: top (allGaps), left (allGaps), bottom (allGaps), right (allGaps)
|
||||
{
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the gap that should be left at the top of the region. */
|
||||
int getTop() const throw() { return top; }
|
||||
ValueType getTop() const throw() { return top; }
|
||||
|
||||
/** Returns the gap that should be left at the top of the region. */
|
||||
int getLeft() const throw() { return left; }
|
||||
ValueType getLeft() const throw() { return left; }
|
||||
|
||||
/** Returns the gap that should be left at the top of the region. */
|
||||
int getBottom() const throw() { return bottom; }
|
||||
ValueType getBottom() const throw() { return bottom; }
|
||||
|
||||
/** Returns the gap that should be left at the top of the region. */
|
||||
int getRight() const throw() { return right; }
|
||||
ValueType getRight() const throw() { return right; }
|
||||
|
||||
/** Returns the sum of the top and bottom gaps. */
|
||||
int getTopAndBottom() const throw() { return top + bottom; }
|
||||
ValueType getTopAndBottom() const throw() { return top + bottom; }
|
||||
|
||||
/** Returns the sum of the left and right gaps. */
|
||||
int getLeftAndRight() const throw() { return left + right; }
|
||||
ValueType getLeftAndRight() const throw() { return left + right; }
|
||||
|
||||
/** Returns true if this border has no thickness along any edge. */
|
||||
bool isEmpty() const throw() { return left + right + top + bottom == 0; }
|
||||
bool isEmpty() const throw() { return left + right + top + bottom == ValueType(); }
|
||||
|
||||
//==============================================================================
|
||||
/** Changes the top gap. */
|
||||
void setTop (int newTopGap) throw();
|
||||
void setTop (ValueType newTopGap) throw() { top = newTopGap; }
|
||||
|
||||
/** Changes the left gap. */
|
||||
void setLeft (int newLeftGap) throw();
|
||||
void setLeft (ValueType newLeftGap) throw() { left = newLeftGap; }
|
||||
|
||||
/** Changes the bottom gap. */
|
||||
void setBottom (int newBottomGap) throw();
|
||||
void setBottom (ValueType newBottomGap) throw() { bottom = newBottomGap; }
|
||||
|
||||
/** Changes the right gap. */
|
||||
void setRight (int newRightGap) throw();
|
||||
void setRight (ValueType newRightGap) throw() { right = newRightGap; }
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a rectangle with these borders removed from it. */
|
||||
const Rectangle<int> subtractedFrom (const Rectangle<int>& original) const throw();
|
||||
const Rectangle<ValueType> subtractedFrom (const Rectangle<ValueType>& original) const throw()
|
||||
{
|
||||
return Rectangle<ValueType> (original.getX() + left,
|
||||
original.getY() + top,
|
||||
original.getWidth() - (left + right),
|
||||
original.getHeight() - (top + bottom));
|
||||
}
|
||||
|
||||
/** Removes this border from a given rectangle. */
|
||||
void subtractFrom (Rectangle<int>& rectangle) const throw();
|
||||
void subtractFrom (Rectangle<ValueType>& rectangle) const throw()
|
||||
{
|
||||
rectangle = subtractedFrom (rectangle);
|
||||
}
|
||||
|
||||
/** Returns a rectangle with these borders added around it. */
|
||||
const Rectangle<int> addedTo (const Rectangle<int>& original) const throw();
|
||||
const Rectangle<ValueType> addedTo (const Rectangle<ValueType>& original) const throw()
|
||||
{
|
||||
return Rectangle<ValueType> (original.getX() - left,
|
||||
original.getY() - top,
|
||||
original.getWidth() + (left + right),
|
||||
original.getHeight() + (top + bottom));
|
||||
}
|
||||
|
||||
|
||||
/** Adds this border around a given rectangle. */
|
||||
void addTo (Rectangle<int>& original) const throw();
|
||||
void addTo (Rectangle<ValueType>& rectangle) const throw()
|
||||
{
|
||||
rectangle = addedTo (rectangle);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
bool operator== (const BorderSize& other) const throw();
|
||||
bool operator!= (const BorderSize& other) const throw();
|
||||
bool operator== (const BorderSize& other) const throw()
|
||||
{
|
||||
return top == other.top && left == other.left && bottom == other.bottom && right == other.right;
|
||||
}
|
||||
|
||||
bool operator!= (const BorderSize& other) const throw()
|
||||
{
|
||||
return ! operator== (other);
|
||||
}
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
int top, left, bottom, right;
|
||||
ValueType top, left, bottom, right;
|
||||
|
||||
JUCE_LEAK_DETECTOR (BorderSize);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class Point
|
|||
public:
|
||||
//==============================================================================
|
||||
/** Creates a point with co-ordinates (0, 0). */
|
||||
Point() throw() : x (0), y (0) {}
|
||||
Point() throw() : x(), y() {}
|
||||
|
||||
/** Creates a copy of another point. */
|
||||
Point (const Point& other) throw() : x (other.x), y (other.y) {}
|
||||
|
|
@ -156,11 +156,14 @@ public:
|
|||
const Point transformedBy (const AffineTransform& transform) const throw() { return Point (transform.mat00 * x + transform.mat01 * y + transform.mat02,
|
||||
transform.mat10 * x + transform.mat11 * y + transform.mat12); }
|
||||
|
||||
/** Casts this point to a Point<int> object. */
|
||||
const Point<int> toInt() const throw() { return Point<int> (static_cast <int> (x), static_cast<int> (y)); }
|
||||
|
||||
/** Casts this point to a Point<float> object. */
|
||||
const Point<float> toFloat() const throw() { return Point<float> (static_cast <float> (x), static_cast<float> (y)); }
|
||||
|
||||
/** Casts this point to a Point<int> object. */
|
||||
const Point<int> toInt() const throw() { return Point<int> (static_cast <int> (x), static_cast<int> (y)); }
|
||||
/** Casts this point to a Point<double> object. */
|
||||
const Point<double> toDouble() const throw() { return Point<double> (static_cast <double> (x), static_cast<double> (y)); }
|
||||
|
||||
/** Returns the point as a string in the form "x, y". */
|
||||
const String toString() const { return String (x) + ", " + String (y); }
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library - "Jules' Utility Class Extensions"
|
||||
Copyright 2004-10 by Raw Material Software Ltd.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
JUCE can be redistributed and/or modified under the terms of the GNU General
|
||||
Public License (Version 2), as published by the Free Software Foundation.
|
||||
A copy of the license is included in the JUCE distribution, or can be found
|
||||
online at www.gnu.org/licenses.
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.rawmaterialsoftware.com/juce for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include "../../../core/juce_StandardHeader.h"
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
#include "juce_PositionedRectangle.h"
|
||||
|
||||
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
@ -1,584 +0,0 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library - "Jules' Utility Class Extensions"
|
||||
Copyright 2004-10 by Raw Material Software Ltd.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
JUCE can be redistributed and/or modified under the terms of the GNU General
|
||||
Public License (Version 2), as published by the Free Software Foundation.
|
||||
A copy of the license is included in the JUCE distribution, or can be found
|
||||
online at www.gnu.org/licenses.
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.rawmaterialsoftware.com/juce for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
|
||||
#define __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
|
||||
|
||||
#include "../../components/juce_Component.h"
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
A rectangle whose co-ordinates can be defined in terms of absolute or
|
||||
proportional distances.
|
||||
|
||||
Designed mainly for storing component positions, this gives you a lot of
|
||||
control over how each co-ordinate is stored, either as an absolute position,
|
||||
or as a proportion of the size of a parent rectangle.
|
||||
|
||||
It also allows you to define the anchor points by which the rectangle is
|
||||
positioned, so for example you could specify that the top right of the
|
||||
rectangle should be an absolute distance from its parent's bottom-right corner.
|
||||
|
||||
This object can be stored as a string, which takes the form "x y w h", including
|
||||
symbols like '%' and letters to indicate the anchor point. See its toString()
|
||||
method for more info.
|
||||
|
||||
Example usage:
|
||||
@code
|
||||
class MyComponent
|
||||
{
|
||||
void resized()
|
||||
{
|
||||
// this will set the child component's x to be 20% of our width, its y
|
||||
// to be 30, its width to be 150, and its height to be 50% of our
|
||||
// height..
|
||||
const PositionedRectangle pos1 ("20% 30 150 50%");
|
||||
pos1.applyToComponent (*myChildComponent1);
|
||||
|
||||
// this will inset the child component with a gap of 10 pixels
|
||||
// around each of its edges..
|
||||
const PositionedRectangle pos2 ("10 10 20M 20M");
|
||||
pos2.applyToComponent (*myChildComponent2);
|
||||
}
|
||||
};
|
||||
@endcode
|
||||
*/
|
||||
class PositionedRectangle
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Creates an empty rectangle with all co-ordinates set to zero.
|
||||
|
||||
The default anchor point is top-left; the default
|
||||
*/
|
||||
PositionedRectangle() throw()
|
||||
: x (0.0), y (0.0), w (0.0), h (0.0),
|
||||
xMode (anchorAtLeftOrTop | absoluteFromParentTopLeft),
|
||||
yMode (anchorAtLeftOrTop | absoluteFromParentTopLeft),
|
||||
wMode (absoluteSize), hMode (absoluteSize)
|
||||
{
|
||||
}
|
||||
|
||||
/** Initialises a PositionedRectangle from a saved string version.
|
||||
|
||||
The string must be in the format generated by toString().
|
||||
*/
|
||||
PositionedRectangle (const String& stringVersion) throw()
|
||||
{
|
||||
StringArray tokens;
|
||||
tokens.addTokens (stringVersion, false);
|
||||
|
||||
decodePosString (tokens [0], xMode, x);
|
||||
decodePosString (tokens [1], yMode, y);
|
||||
decodeSizeString (tokens [2], wMode, w);
|
||||
decodeSizeString (tokens [3], hMode, h);
|
||||
}
|
||||
|
||||
/** Creates a copy of another PositionedRectangle. */
|
||||
PositionedRectangle (const PositionedRectangle& other) throw()
|
||||
: x (other.x), y (other.y), w (other.w), h (other.h),
|
||||
xMode (other.xMode), yMode (other.yMode),
|
||||
wMode (other.wMode), hMode (other.hMode)
|
||||
{
|
||||
}
|
||||
|
||||
/** Copies another PositionedRectangle. */
|
||||
PositionedRectangle& operator= (const PositionedRectangle& other) throw()
|
||||
{
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
w = other.w;
|
||||
h = other.h;
|
||||
xMode = other.xMode;
|
||||
yMode = other.yMode;
|
||||
wMode = other.wMode;
|
||||
hMode = other.hMode;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a string version of this position, from which it can later be
|
||||
re-generated.
|
||||
|
||||
The format is four co-ordinates, "x y w h".
|
||||
|
||||
- If a co-ordinate is absolute, it is stored as an integer, e.g. "100".
|
||||
- If a co-ordinate is proportional to its parent's width or height, it is stored
|
||||
as a percentage, e.g. "80%".
|
||||
- If the X or Y co-ordinate is relative to the parent's right or bottom edge, the
|
||||
number has "R" appended to it, e.g. "100R" means a distance of 100 pixels from
|
||||
the parent's right-hand edge.
|
||||
- If the X or Y co-ordinate is relative to the parent's centre, the number has "C"
|
||||
appended to it, e.g. "-50C" would be 50 pixels left of the parent's centre.
|
||||
- If the X or Y co-ordinate should be anchored at the component's right or bottom
|
||||
edge, then it has "r" appended to it. So "-50Rr" would mean that this component's
|
||||
right-hand edge should be 50 pixels left of the parent's right-hand edge.
|
||||
- If the X or Y co-ordinate should be anchored at the component's centre, then it
|
||||
has "c" appended to it. So "-50Rc" would mean that this component's
|
||||
centre should be 50 pixels left of the parent's right-hand edge. "40%c" means that
|
||||
this component's centre should be placed 40% across the parent's width.
|
||||
- If it's a width or height that should use the parentSizeMinusAbsolute mode, then
|
||||
the number has "M" appended to it.
|
||||
|
||||
To reload a stored string, use the constructor that takes a string parameter.
|
||||
*/
|
||||
const String toString() const throw()
|
||||
{
|
||||
String s;
|
||||
s.preallocateStorage (12);
|
||||
addPosDescription (s, xMode, x); s << ' ';
|
||||
addPosDescription (s, yMode, y); s << ' ';
|
||||
addSizeDescription (s, wMode, w); s << ' ';
|
||||
addSizeDescription (s, hMode, h);
|
||||
return s;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
/** Calculates the absolute position, given the size of the space that
|
||||
it should go in.
|
||||
|
||||
This will work out any proportional distances and sizes relative to the
|
||||
target rectangle, and will return the absolute position.
|
||||
|
||||
@see applyToComponent
|
||||
*/
|
||||
const Rectangle<int> getRectangle (const Rectangle<int>& target) const throw()
|
||||
{
|
||||
jassert (! target.isEmpty());
|
||||
|
||||
double x_, y_, w_, h_;
|
||||
applyPosAndSize (x_, w_, x, w, xMode, wMode, target.getX(), target.getWidth());
|
||||
applyPosAndSize (y_, h_, y, h, yMode, hMode, target.getY(), target.getHeight());
|
||||
return Rectangle<int> (roundToInt (x_), roundToInt (y_), roundToInt (w_), roundToInt (h_));
|
||||
}
|
||||
|
||||
/** Same as getRectangle(), but returning the values as doubles rather than ints. */
|
||||
void getRectangleDouble (const Rectangle<int>& target,
|
||||
double& x_, double& y_, double& w_, double& h_) const throw()
|
||||
{
|
||||
jassert (! target.isEmpty());
|
||||
applyPosAndSize (x_, w_, x, w, xMode, wMode, target.getX(), target.getWidth());
|
||||
applyPosAndSize (y_, h_, y, h, yMode, hMode, target.getY(), target.getHeight());
|
||||
}
|
||||
|
||||
/** This sets the bounds of the given component to this position.
|
||||
|
||||
This is equivalent to writing:
|
||||
@code
|
||||
comp.setBounds (getRectangle (Rectangle<int> (0, 0, comp.getParentWidth(), comp.getParentHeight())));
|
||||
@endcode
|
||||
|
||||
@see getRectangle, updateFromComponent
|
||||
*/
|
||||
void applyToComponent (Component& comp) const throw()
|
||||
{
|
||||
comp.setBounds (getRectangle (Rectangle<int> (comp.getParentWidth(), comp.getParentHeight())));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
/** Updates this object's co-ordinates to match the given rectangle.
|
||||
|
||||
This will set all co-ordinates based on the given rectangle, re-calculating
|
||||
any proportional distances, and using the current anchor points.
|
||||
|
||||
So for example if the x co-ordinate mode is currently proportional, this will
|
||||
re-calculate x based on the rectangle's relative position within the target
|
||||
rectangle's width.
|
||||
|
||||
If the target rectangle's width or height are zero then it may not be possible
|
||||
to re-calculate some proportional co-ordinates. In this case, those co-ordinates
|
||||
will not be changed.
|
||||
*/
|
||||
void updateFrom (const Rectangle<int>& newPosition,
|
||||
const Rectangle<int>& targetSpaceToBeRelativeTo) throw()
|
||||
{
|
||||
updatePosAndSize (x, w, newPosition.getX(), newPosition.getWidth(), xMode, wMode, targetSpaceToBeRelativeTo.getX(), targetSpaceToBeRelativeTo.getWidth());
|
||||
updatePosAndSize (y, h, newPosition.getY(), newPosition.getHeight(), yMode, hMode, targetSpaceToBeRelativeTo.getY(), targetSpaceToBeRelativeTo.getHeight());
|
||||
}
|
||||
|
||||
/** Same functionality as updateFrom(), but taking doubles instead of ints.
|
||||
*/
|
||||
void updateFromDouble (const double newX, const double newY,
|
||||
const double newW, const double newH,
|
||||
const Rectangle<int>& target) throw()
|
||||
{
|
||||
updatePosAndSize (x, w, newX, newW, xMode, wMode, target.getX(), target.getWidth());
|
||||
updatePosAndSize (y, h, newY, newH, yMode, hMode, target.getY(), target.getHeight());
|
||||
}
|
||||
|
||||
/** Updates this object's co-ordinates to match the bounds of this component.
|
||||
|
||||
This is equivalent to calling updateFrom() with the component's bounds and
|
||||
it parent size.
|
||||
|
||||
If the component doesn't currently have a parent, then proportional co-ordinates
|
||||
might not be updated because it would need to know the parent's size to do the
|
||||
maths for this.
|
||||
*/
|
||||
void updateFromComponent (const Component& comp) throw()
|
||||
{
|
||||
if (comp.getParentComponent() == 0 && ! comp.isOnDesktop())
|
||||
updateFrom (comp.getBounds(), Rectangle<int>());
|
||||
else
|
||||
updateFrom (comp.getBounds(), Rectangle<int> (comp.getParentWidth(), comp.getParentHeight()));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
/** Specifies the point within the rectangle, relative to which it should be positioned. */
|
||||
enum AnchorPoint
|
||||
{
|
||||
anchorAtLeftOrTop = 1 << 0, /**< The x or y co-ordinate specifies where the left or top edge of the rectangle should be. */
|
||||
anchorAtRightOrBottom = 1 << 1, /**< The x or y co-ordinate specifies where the right or bottom edge of the rectangle should be. */
|
||||
anchorAtCentre = 1 << 2 /**< The x or y co-ordinate specifies where the centre of the rectangle should be. */
|
||||
};
|
||||
|
||||
/** Specifies how an x or y co-ordinate should be interpreted. */
|
||||
enum PositionMode
|
||||
{
|
||||
absoluteFromParentTopLeft = 1 << 3, /**< The x or y co-ordinate specifies an absolute distance from the parent's top or left edge. */
|
||||
absoluteFromParentBottomRight = 1 << 4, /**< The x or y co-ordinate specifies an absolute distance from the parent's bottom or right edge. */
|
||||
absoluteFromParentCentre = 1 << 5, /**< The x or y co-ordinate specifies an absolute distance from the parent's centre. */
|
||||
proportionOfParentSize = 1 << 6 /**< The x or y co-ordinate specifies a proportion of the parent's width or height, measured from the parent's top or left. */
|
||||
};
|
||||
|
||||
/** Specifies how the width or height should be interpreted. */
|
||||
enum SizeMode
|
||||
{
|
||||
absoluteSize = 1 << 0, /**< The width or height specifies an absolute size. */
|
||||
parentSizeMinusAbsolute = 1 << 1, /**< The width or height is an amount that should be subtracted from the parent's width or height. */
|
||||
proportionalSize = 1 << 2, /**< The width or height specifies a proportion of the parent's width or height. */
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
/** Sets all options for all co-ordinates.
|
||||
|
||||
This requires a reference rectangle to be specified, because if you're changing any
|
||||
of the modes from proportional to absolute or vice-versa, then it'll need to convert
|
||||
the co-ordinates, and will need to know the parent size so it can calculate this.
|
||||
*/
|
||||
void setModes (const AnchorPoint xAnchor, const PositionMode xMode_,
|
||||
const AnchorPoint yAnchor, const PositionMode yMode_,
|
||||
const SizeMode widthMode, const SizeMode heightMode,
|
||||
const Rectangle<int>& target) throw()
|
||||
{
|
||||
if (xMode != (xAnchor | xMode_) || wMode != widthMode)
|
||||
{
|
||||
double tx, tw;
|
||||
applyPosAndSize (tx, tw, x, w, xMode, wMode, target.getX(), target.getWidth());
|
||||
|
||||
xMode = (uint8) (xAnchor | xMode_);
|
||||
wMode = (uint8) widthMode;
|
||||
|
||||
updatePosAndSize (x, w, tx, tw, xMode, wMode, target.getX(), target.getWidth());
|
||||
}
|
||||
|
||||
if (yMode != (yAnchor | yMode_) || hMode != heightMode)
|
||||
{
|
||||
double ty, th;
|
||||
applyPosAndSize (ty, th, y, h, yMode, hMode, target.getY(), target.getHeight());
|
||||
|
||||
yMode = (uint8) (yAnchor | yMode_);
|
||||
hMode = (uint8) heightMode;
|
||||
|
||||
updatePosAndSize (y, h, ty, th, yMode, hMode, target.getY(), target.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the anchoring mode for the x co-ordinate.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
AnchorPoint getAnchorPointX() const throw()
|
||||
{
|
||||
return (AnchorPoint) (xMode & (anchorAtLeftOrTop | anchorAtRightOrBottom | anchorAtCentre));
|
||||
}
|
||||
|
||||
/** Returns the positioning mode for the x co-ordinate.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
PositionMode getPositionModeX() const throw()
|
||||
{
|
||||
return (PositionMode) (xMode & (absoluteFromParentTopLeft | absoluteFromParentBottomRight
|
||||
| absoluteFromParentCentre | proportionOfParentSize));
|
||||
}
|
||||
|
||||
/** Returns the raw x co-ordinate.
|
||||
|
||||
If the x position mode is absolute, then this will be the absolute value. If it's
|
||||
proportional, then this will be a fractional proportion, where 1.0 means the full
|
||||
width of the parent space.
|
||||
*/
|
||||
double getX() const throw() { return x; }
|
||||
|
||||
/** Sets the raw value of the x co-ordinate.
|
||||
|
||||
See getX() for the meaning of this value.
|
||||
*/
|
||||
void setX (const double newX) throw() { x = newX; }
|
||||
|
||||
/** Returns the anchoring mode for the y co-ordinate.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
AnchorPoint getAnchorPointY() const throw()
|
||||
{
|
||||
return (AnchorPoint) (yMode & (anchorAtLeftOrTop | anchorAtRightOrBottom | anchorAtCentre));
|
||||
}
|
||||
|
||||
/** Returns the positioning mode for the y co-ordinate.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
PositionMode getPositionModeY() const throw()
|
||||
{
|
||||
return (PositionMode) (yMode & (absoluteFromParentTopLeft | absoluteFromParentBottomRight
|
||||
| absoluteFromParentCentre | proportionOfParentSize));
|
||||
}
|
||||
|
||||
/** Returns the raw y co-ordinate.
|
||||
|
||||
If the y position mode is absolute, then this will be the absolute value. If it's
|
||||
proportional, then this will be a fractional proportion, where 1.0 means the full
|
||||
height of the parent space.
|
||||
*/
|
||||
double getY() const throw() { return y; }
|
||||
|
||||
/** Sets the raw value of the y co-ordinate.
|
||||
|
||||
See getY() for the meaning of this value.
|
||||
*/
|
||||
void setY (const double newY) throw() { y = newY; }
|
||||
|
||||
/** Returns the mode used to calculate the width.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
SizeMode getWidthMode() const throw() { return (SizeMode) wMode; }
|
||||
|
||||
/** Returns the raw width value.
|
||||
|
||||
If the width mode is absolute, then this will be the absolute value. If the mode is
|
||||
proportional, then this will be a fractional proportion, where 1.0 means the full
|
||||
width of the parent space.
|
||||
*/
|
||||
double getWidth() const throw() { return w; }
|
||||
|
||||
/** Sets the raw width value.
|
||||
|
||||
See getWidth() for the details about what this value means.
|
||||
*/
|
||||
void setWidth (const double newWidth) throw() { w = newWidth; }
|
||||
|
||||
/** Returns the mode used to calculate the height.
|
||||
To change any of the modes, use setModes().
|
||||
*/
|
||||
SizeMode getHeightMode() const throw() { return (SizeMode) hMode; }
|
||||
|
||||
/** Returns the raw height value.
|
||||
|
||||
If the height mode is absolute, then this will be the absolute value. If the mode is
|
||||
proportional, then this will be a fractional proportion, where 1.0 means the full
|
||||
height of the parent space.
|
||||
*/
|
||||
double getHeight() const throw() { return h; }
|
||||
|
||||
/** Sets the raw height value.
|
||||
|
||||
See getHeight() for the details about what this value means.
|
||||
*/
|
||||
void setHeight (const double newHeight) throw() { h = newHeight; }
|
||||
|
||||
//==============================================================================
|
||||
/** If the size and position are constance, and wouldn't be affected by changes
|
||||
in the parent's size, then this will return true.
|
||||
*/
|
||||
bool isPositionAbsolute() const throw()
|
||||
{
|
||||
return xMode == absoluteFromParentTopLeft
|
||||
&& yMode == absoluteFromParentTopLeft
|
||||
&& wMode == absoluteSize
|
||||
&& hMode == absoluteSize;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
/** Compares two objects. */
|
||||
bool operator== (const PositionedRectangle& other) const throw()
|
||||
{
|
||||
return x == other.x && y == other.y
|
||||
&& w == other.w && h == other.h
|
||||
&& xMode == other.xMode && yMode == other.yMode
|
||||
&& wMode == other.wMode && hMode == other.hMode;
|
||||
}
|
||||
|
||||
/** Compares two objects. */
|
||||
bool operator!= (const PositionedRectangle& other) const throw()
|
||||
{
|
||||
return ! operator== (other);
|
||||
}
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
double x, y, w, h;
|
||||
uint8 xMode, yMode, wMode, hMode;
|
||||
|
||||
void addPosDescription (String& s, const uint8 mode, const double value) const throw()
|
||||
{
|
||||
if ((mode & proportionOfParentSize) != 0)
|
||||
{
|
||||
s << (roundToInt (value * 100000.0) / 1000.0) << '%';
|
||||
}
|
||||
else
|
||||
{
|
||||
s << (roundToInt (value * 100.0) / 100.0);
|
||||
|
||||
if ((mode & absoluteFromParentBottomRight) != 0)
|
||||
s << 'R';
|
||||
else if ((mode & absoluteFromParentCentre) != 0)
|
||||
s << 'C';
|
||||
}
|
||||
|
||||
if ((mode & anchorAtRightOrBottom) != 0)
|
||||
s << 'r';
|
||||
else if ((mode & anchorAtCentre) != 0)
|
||||
s << 'c';
|
||||
}
|
||||
|
||||
void addSizeDescription (String& s, const uint8 mode, const double value) const throw()
|
||||
{
|
||||
if (mode == proportionalSize)
|
||||
s << (roundToInt (value * 100000.0) / 1000.0) << '%';
|
||||
else if (mode == parentSizeMinusAbsolute)
|
||||
s << (roundToInt (value * 100.0) / 100.0) << 'M';
|
||||
else
|
||||
s << (roundToInt (value * 100.0) / 100.0);
|
||||
}
|
||||
|
||||
void decodePosString (const String& s, uint8& mode, double& value) throw()
|
||||
{
|
||||
if (s.containsChar ('r'))
|
||||
mode = anchorAtRightOrBottom;
|
||||
else if (s.containsChar ('c'))
|
||||
mode = anchorAtCentre;
|
||||
else
|
||||
mode = anchorAtLeftOrTop;
|
||||
|
||||
if (s.containsChar ('%'))
|
||||
{
|
||||
mode |= proportionOfParentSize;
|
||||
value = s.removeCharacters ("%rcRC").getDoubleValue() / 100.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s.containsChar ('R'))
|
||||
mode |= absoluteFromParentBottomRight;
|
||||
else if (s.containsChar ('C'))
|
||||
mode |= absoluteFromParentCentre;
|
||||
else
|
||||
mode |= absoluteFromParentTopLeft;
|
||||
|
||||
value = s.removeCharacters ("rcRC").getDoubleValue();
|
||||
}
|
||||
}
|
||||
|
||||
void decodeSizeString (const String& s, uint8& mode, double& value) throw()
|
||||
{
|
||||
if (s.containsChar ('%'))
|
||||
{
|
||||
mode = proportionalSize;
|
||||
value = s.upToFirstOccurrenceOf ("%", false, false).getDoubleValue() / 100.0;
|
||||
}
|
||||
else if (s.containsChar ('M'))
|
||||
{
|
||||
mode = parentSizeMinusAbsolute;
|
||||
value = s.getDoubleValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = absoluteSize;
|
||||
value = s.getDoubleValue();
|
||||
}
|
||||
}
|
||||
|
||||
void applyPosAndSize (double& xOut, double& wOut, const double x_, const double w_,
|
||||
const uint8 xMode_, const uint8 wMode_,
|
||||
const int parentPos, const int parentSize) const throw()
|
||||
{
|
||||
if (wMode_ == proportionalSize)
|
||||
wOut = roundToInt (w_ * parentSize);
|
||||
else if (wMode_ == parentSizeMinusAbsolute)
|
||||
wOut = jmax (0, parentSize - roundToInt (w_));
|
||||
else
|
||||
wOut = roundToInt (w_);
|
||||
|
||||
if ((xMode_ & proportionOfParentSize) != 0)
|
||||
xOut = parentPos + x_ * parentSize;
|
||||
else if ((xMode_ & absoluteFromParentBottomRight) != 0)
|
||||
xOut = (parentPos + parentSize) - x_;
|
||||
else if ((xMode_ & absoluteFromParentCentre) != 0)
|
||||
xOut = x_ + (parentPos + parentSize / 2);
|
||||
else
|
||||
xOut = x_ + parentPos;
|
||||
|
||||
if ((xMode_ & anchorAtRightOrBottom) != 0)
|
||||
xOut -= wOut;
|
||||
else if ((xMode_ & anchorAtCentre) != 0)
|
||||
xOut -= wOut / 2;
|
||||
}
|
||||
|
||||
void updatePosAndSize (double& xOut, double& wOut, double x_, const double w_,
|
||||
const uint8 xMode_, const uint8 wMode_,
|
||||
const int parentPos, const int parentSize) const throw()
|
||||
{
|
||||
if (wMode_ == proportionalSize)
|
||||
{
|
||||
if (parentSize > 0)
|
||||
wOut = w_ / parentSize;
|
||||
}
|
||||
else if (wMode_ == parentSizeMinusAbsolute)
|
||||
wOut = parentSize - w_;
|
||||
else
|
||||
wOut = w_;
|
||||
|
||||
if ((xMode_ & anchorAtRightOrBottom) != 0)
|
||||
x_ += w_;
|
||||
else if ((xMode_ & anchorAtCentre) != 0)
|
||||
x_ += w_ / 2;
|
||||
|
||||
if ((xMode_ & proportionOfParentSize) != 0)
|
||||
{
|
||||
if (parentSize > 0)
|
||||
xOut = (x_ - parentPos) / parentSize;
|
||||
}
|
||||
else if ((xMode_ & absoluteFromParentBottomRight) != 0)
|
||||
xOut = (parentPos + parentSize) - x_;
|
||||
else if ((xMode_ & absoluteFromParentCentre) != 0)
|
||||
xOut = x_ - (parentPos + parentSize / 2);
|
||||
else
|
||||
xOut = x_ - parentPos;
|
||||
}
|
||||
|
||||
JUCE_LEAK_DETECTOR (PositionedRectangle);
|
||||
};
|
||||
|
||||
|
||||
#endif // __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
|
||||
|
|
@ -47,7 +47,7 @@ public:
|
|||
The default co-ordinates will be (0, 0, 0, 0).
|
||||
*/
|
||||
Rectangle() throw()
|
||||
: x (0), y (0), w (0), h (0)
|
||||
: x(), y(), w(), h()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
/** Creates a rectangle with a given size, and a position of (0, 0). */
|
||||
Rectangle (const ValueType width, const ValueType height) throw()
|
||||
: x (0), y (0), w (width), h (height)
|
||||
: x(), y(), w (width), h (height)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -79,8 +79,8 @@ public:
|
|||
w (corner1.getX() - corner2.getX()),
|
||||
h (corner1.getY() - corner2.getY())
|
||||
{
|
||||
if (w < 0) w = -w;
|
||||
if (h < 0) h = -h;
|
||||
if (w < ValueType()) w = -w;
|
||||
if (h < ValueType()) h = -h;
|
||||
}
|
||||
|
||||
/** Creates a Rectangle from a set of left, right, top, bottom coordinates.
|
||||
|
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Returns true if the rectangle's width and height are both zero or less */
|
||||
bool isEmpty() const throw() { return w <= 0 || h <= 0; }
|
||||
bool isEmpty() const throw() { return w <= ValueType() || h <= ValueType(); }
|
||||
|
||||
/** Returns the x co-ordinate of the rectangle's left-hand-side. */
|
||||
inline ValueType getX() const throw() { return x; }
|
||||
|
|
@ -503,12 +503,12 @@ public:
|
|||
const int maxX = jmax (otherX, x);
|
||||
otherW = jmin (otherX + otherW, x + w) - maxX;
|
||||
|
||||
if (otherW > 0)
|
||||
if (otherW > ValueType())
|
||||
{
|
||||
const int maxY = jmax (otherY, y);
|
||||
otherH = jmin (otherY + otherH, y + h) - maxY;
|
||||
|
||||
if (otherH > 0)
|
||||
if (otherH > ValueType())
|
||||
{
|
||||
otherX = maxX; otherY = maxY;
|
||||
return true;
|
||||
|
|
@ -675,12 +675,12 @@ public:
|
|||
const ValueType x = jmax (x1, x2);
|
||||
w1 = jmin (x1 + w1, x2 + w2) - x;
|
||||
|
||||
if (w1 > 0)
|
||||
if (w1 > ValueType())
|
||||
{
|
||||
const ValueType y = jmax (y1, y2);
|
||||
h1 = jmin (y1 + h1, y2 + h2) - y;
|
||||
|
||||
if (h1 > 0)
|
||||
if (h1 > ValueType())
|
||||
{
|
||||
x1 = x; y1 = y;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -722,9 +722,6 @@
|
|||
#ifndef __JUCE_POINT_JUCEHEADER__
|
||||
#include "gui/graphics/geometry/juce_Point.h"
|
||||
#endif
|
||||
#ifndef __JUCE_POSITIONEDRECTANGLE_JUCEHEADER__
|
||||
#include "gui/graphics/geometry/juce_PositionedRectangle.h"
|
||||
#endif
|
||||
#ifndef __JUCE_RECTANGLE_JUCEHEADER__
|
||||
#include "gui/graphics/geometry/juce_Rectangle.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1040,9 +1040,9 @@ public:
|
|||
return child == None;
|
||||
}
|
||||
|
||||
const BorderSize getFrameSize() const
|
||||
const BorderSize<int> getFrameSize() const
|
||||
{
|
||||
return BorderSize();
|
||||
return BorderSize<int>();
|
||||
}
|
||||
|
||||
bool setAlwaysOnTop (bool alwaysOnTop)
|
||||
|
|
@ -1876,7 +1876,7 @@ private:
|
|||
bool fullScreen, mapped;
|
||||
Visual* visual;
|
||||
int depth;
|
||||
BorderSize windowBorder;
|
||||
BorderSize<int> windowBorder;
|
||||
|
||||
struct MotifWmHints
|
||||
{
|
||||
|
|
@ -2291,7 +2291,7 @@ private:
|
|||
{
|
||||
if ((styleFlags & windowHasTitleBar) == 0)
|
||||
{
|
||||
windowBorder = BorderSize (0);
|
||||
windowBorder = BorderSize<int> (0);
|
||||
}
|
||||
else if (windowBorder.getTopAndBottom() == 0 && windowBorder.getLeftAndRight() == 0)
|
||||
{
|
||||
|
|
@ -2312,8 +2312,8 @@ private:
|
|||
const unsigned long* const sizes = (const unsigned long*) data;
|
||||
|
||||
if (actualFormat == 32)
|
||||
windowBorder = BorderSize ((int) sizes[2], (int) sizes[0],
|
||||
(int) sizes[3], (int) sizes[1]);
|
||||
windowBorder = BorderSize<int> ((int) sizes[2], (int) sizes[0],
|
||||
(int) sizes[3], (int) sizes[1]);
|
||||
|
||||
XFree (data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ public:
|
|||
void setFullScreen (bool shouldBeFullScreen);
|
||||
bool isFullScreen() const;
|
||||
bool contains (const Point<int>& position, bool trueIfInAChildWindow) const;
|
||||
const BorderSize getFrameSize() const;
|
||||
const BorderSize<int> getFrameSize() const;
|
||||
bool setAlwaysOnTop (bool alwaysOnTop);
|
||||
void toFront (bool makeActiveWindow);
|
||||
void toBehind (ComponentPeer* other);
|
||||
|
|
@ -680,9 +680,9 @@ bool UIViewComponentPeer::contains (const Point<int>& position, bool trueIfInACh
|
|||
return v == view;
|
||||
}
|
||||
|
||||
const BorderSize UIViewComponentPeer::getFrameSize() const
|
||||
const BorderSize<int> UIViewComponentPeer::getFrameSize() const
|
||||
{
|
||||
return BorderSize();
|
||||
return BorderSize<int>();
|
||||
}
|
||||
|
||||
bool UIViewComponentPeer::setAlwaysOnTop (bool alwaysOnTop)
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ public:
|
|||
void setFullScreen (bool shouldBeFullScreen);
|
||||
bool isFullScreen() const;
|
||||
bool contains (const Point<int>& position, bool trueIfInAChildWindow) const;
|
||||
const BorderSize getFrameSize() const;
|
||||
const BorderSize<int> getFrameSize() const;
|
||||
bool setAlwaysOnTop (bool alwaysOnTop);
|
||||
void toFront (bool makeActiveWindow);
|
||||
void toBehind (ComponentPeer* other);
|
||||
|
|
@ -1178,9 +1178,9 @@ bool NSViewComponentPeer::contains (const Point<int>& position, bool trueIfInACh
|
|||
return v == view;
|
||||
}
|
||||
|
||||
const BorderSize NSViewComponentPeer::getFrameSize() const
|
||||
const BorderSize<int> NSViewComponentPeer::getFrameSize() const
|
||||
{
|
||||
BorderSize b;
|
||||
BorderSize<int> b;
|
||||
|
||||
if (! isSharedWindow)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -560,10 +560,10 @@ public:
|
|||
|
||||
if (GetWindowInfo (hwnd, &info))
|
||||
{
|
||||
windowBorder = BorderSize (info.rcClient.top - info.rcWindow.top,
|
||||
info.rcClient.left - info.rcWindow.left,
|
||||
info.rcWindow.bottom - info.rcClient.bottom,
|
||||
info.rcWindow.right - info.rcClient.right);
|
||||
windowBorder = BorderSize<int> (info.rcClient.top - info.rcWindow.top,
|
||||
info.rcClient.left - info.rcWindow.left,
|
||||
info.rcWindow.bottom - info.rcClient.bottom,
|
||||
info.rcWindow.right - info.rcClient.right);
|
||||
}
|
||||
|
||||
#if JUCE_DIRECT2D
|
||||
|
|
@ -742,7 +742,7 @@ public:
|
|||
return w == hwnd || (trueIfInAChildWindow && (IsChild (hwnd, w) != 0));
|
||||
}
|
||||
|
||||
const BorderSize getFrameSize() const
|
||||
const BorderSize<int> getFrameSize() const
|
||||
{
|
||||
return windowBorder;
|
||||
}
|
||||
|
|
@ -1010,7 +1010,7 @@ private:
|
|||
ScopedPointer<Direct2DLowLevelGraphicsContext> direct2DContext;
|
||||
#endif
|
||||
bool fullScreen, isDragging, isMouseOver, hasCreatedCaret, constrainerIsResizing;
|
||||
BorderSize windowBorder;
|
||||
BorderSize<int> windowBorder;
|
||||
HICON currentWindowIcon;
|
||||
ScopedPointer<NOTIFYICONDATA> taskBarIcon;
|
||||
IDropTarget* dropTarget;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue