From 5d30aecaf237c34971c5176c9974bcc749503fa7 Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Sun, 9 Jan 2011 21:59:02 +0000 Subject: [PATCH] Removed a couple of old classes: MagnifierComponent (you can use Component::setTransform() instead), and MouseHoverDetector (wasn't really very useful anyway - if you need it, please just take a copy of the class and use it in your own code). Renamed the PopupMenuCustomComponent as an inner class PopupMenu::CustomComponent. Added a default constructor for MidiMessage. --- Builds/Linux/Makefile | 12 - Builds/MacOSX/Juce.xcodeproj/project.pbxproj | 16 +- Builds/VisualStudio2005/Juce.vcproj | 5 - Builds/VisualStudio2008/Juce.vcproj | 5 - Builds/VisualStudio2008_DLL/Juce.vcproj | 5 - Builds/VisualStudio2010/Juce.vcxproj | 5 - Builds/VisualStudio2010/Juce.vcxproj.filters | 15 - Builds/iPhone/Juce.xcodeproj/project.pbxproj | 16 +- Juce.jucer | 10 - amalgamation/juce_amalgamated_template.cpp | 2 - juce_amalgamated.cpp | 511 ++---------------- juce_amalgamated.h | 355 +++--------- src/audio/midi/juce_MidiMessage.cpp | 8 + src/audio/midi/juce_MidiMessage.h | 6 + src/containers/juce_ValueTree.cpp | 14 +- src/core/juce_StandardHeader.h | 2 +- src/gui/components/controls/juce_Toolbar.cpp | 5 +- src/gui/components/menus/juce_PopupMenu.cpp | 57 +- src/gui/components/menus/juce_PopupMenu.h | 75 ++- .../menus/juce_PopupMenuCustomComponent.h | 91 ---- .../mouse/juce_DragAndDropContainer.cpp | 2 +- .../mouse/juce_MouseHoverDetector.cpp | 146 ----- .../mouse/juce_MouseHoverDetector.h | 130 ----- .../components/mouse/juce_MouseInputSource.h | 14 +- .../positioning/juce_MarkerList.cpp | 4 +- .../special/juce_MagnifierComponent.cpp | 339 ------------ .../special/juce_MagnifierComponent.h | 121 ----- .../juce_LowLevelGraphicsSoftwareRenderer.cpp | 2 +- src/juce_app_includes.h | 9 - src/native/windows/juce_win32_Midi.cpp | 2 + 30 files changed, 246 insertions(+), 1738 deletions(-) delete mode 100644 src/gui/components/menus/juce_PopupMenuCustomComponent.h delete mode 100644 src/gui/components/mouse/juce_MouseHoverDetector.cpp delete mode 100644 src/gui/components/mouse/juce_MouseHoverDetector.h delete mode 100644 src/gui/components/special/juce_MagnifierComponent.cpp delete mode 100644 src/gui/components/special/juce_MagnifierComponent.h diff --git a/Builds/Linux/Makefile b/Builds/Linux/Makefile index c581f3bf37..2772f3045b 100644 --- a/Builds/Linux/Makefile +++ b/Builds/Linux/Makefile @@ -193,7 +193,6 @@ OBJECTS := \ $(OBJDIR)/juce_DragAndDropContainer_553e412.o \ $(OBJDIR)/juce_MouseCursor_afb68802.o \ $(OBJDIR)/juce_MouseEvent_f6ca6078.o \ - $(OBJDIR)/juce_MouseHoverDetector_d4af7a00.o \ $(OBJDIR)/juce_MouseInputSource_8904aa23.o \ $(OBJDIR)/juce_MouseListener_eb73f8a0.o \ $(OBJDIR)/juce_MarkerList_2fbb4ef.o \ @@ -215,7 +214,6 @@ OBJECTS := \ $(OBJDIR)/juce_BubbleMessageComponent_22f737f9.o \ $(OBJDIR)/juce_ColourSelector_ac8bb1e2.o \ $(OBJDIR)/juce_DropShadower_5903f9f3.o \ - $(OBJDIR)/juce_MagnifierComponent_58d7efb6.o \ $(OBJDIR)/juce_MidiKeyboardComponent_896e2ac8.o \ $(OBJDIR)/juce_OpenGLComponent_73944221.o \ $(OBJDIR)/juce_PreferencesPanel_dbc7d503.o \ @@ -1139,11 +1137,6 @@ $(OBJDIR)/juce_MouseEvent_f6ca6078.o: ../../src/gui/components/mouse/juce_MouseE @echo "Compiling juce_MouseEvent.cpp" @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" -$(OBJDIR)/juce_MouseHoverDetector_d4af7a00.o: ../../src/gui/components/mouse/juce_MouseHoverDetector.cpp - -@mkdir -p $(OBJDIR) - @echo "Compiling juce_MouseHoverDetector.cpp" - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - $(OBJDIR)/juce_MouseInputSource_8904aa23.o: ../../src/gui/components/mouse/juce_MouseInputSource.cpp -@mkdir -p $(OBJDIR) @echo "Compiling juce_MouseInputSource.cpp" @@ -1249,11 +1242,6 @@ $(OBJDIR)/juce_DropShadower_5903f9f3.o: ../../src/gui/components/special/juce_Dr @echo "Compiling juce_DropShadower.cpp" @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" -$(OBJDIR)/juce_MagnifierComponent_58d7efb6.o: ../../src/gui/components/special/juce_MagnifierComponent.cpp - -@mkdir -p $(OBJDIR) - @echo "Compiling juce_MagnifierComponent.cpp" - @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" - $(OBJDIR)/juce_MidiKeyboardComponent_896e2ac8.o: ../../src/gui/components/special/juce_MidiKeyboardComponent.cpp -@mkdir -p $(OBJDIR) @echo "Compiling juce_MidiKeyboardComponent.cpp" diff --git a/Builds/MacOSX/Juce.xcodeproj/project.pbxproj b/Builds/MacOSX/Juce.xcodeproj/project.pbxproj index 6d7fec9bec..2c8df665e8 100644 --- a/Builds/MacOSX/Juce.xcodeproj/project.pbxproj +++ b/Builds/MacOSX/Juce.xcodeproj/project.pbxproj @@ -162,7 +162,6 @@ E6971F06B78AE76C35E1A19C = { isa = PBXBuildFile; fileRef = 3D74B30C63465C32E26D8E33; }; 6629D535AE1ABE35A0D53C69 = { isa = PBXBuildFile; fileRef = 944BC51C440C167C5B2A23E3; }; DD4599D0A8117B025B477DE1 = { isa = PBXBuildFile; fileRef = 067D84F9291770240D1AB5B4; }; - 968B31D8101A937444C6DFB3 = { isa = PBXBuildFile; fileRef = 2531C57B0C861A48E3F3A673; }; E064E329741F36C329989203 = { isa = PBXBuildFile; fileRef = 441257DD380138C03568FCBD; }; 61E659ADBF9D832ED8F24540 = { isa = PBXBuildFile; fileRef = 2886656DF7ACC9DDC888827F; }; 9379C833B875207E5DFC5A3F = { isa = PBXBuildFile; fileRef = 82DFF1BD3665DC32672FCCE8; }; @@ -184,7 +183,6 @@ 710BF477DE534CF18BD68959 = { isa = PBXBuildFile; fileRef = 4C3C3AFC3D97C1378B7D7435; }; E5DA150E966B948C4CB4EFDB = { isa = PBXBuildFile; fileRef = 0A20E7E561633610A76A34AB; }; E96B477EB51FC152AC2EA6BD = { isa = PBXBuildFile; fileRef = 9C1D5CDA61FB51F657DA8B22; }; - E847271789B669289C899425 = { isa = PBXBuildFile; fileRef = 4A6A78512816BA378FFF348A; }; CF36EF39EEAB7A4744C5D310 = { isa = PBXBuildFile; fileRef = 3C8C1AAF32DFECB89EB83271; }; 372B6FF28C49018F5191C517 = { isa = PBXBuildFile; fileRef = 1317F0BE5EC80371F744967B; }; D9AAB4AE220010CD526C87D2 = { isa = PBXBuildFile; fileRef = A34C0E63D41CFF5E55FD1D9E; }; @@ -702,7 +700,6 @@ 502B3625329816EA6330465F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MenuBarModel.h; path = ../../src/gui/components/menus/juce_MenuBarModel.h; sourceTree = SOURCE_ROOT; }; 6AACD2FD239E39F87B666C6F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_PopupMenu.cpp; path = ../../src/gui/components/menus/juce_PopupMenu.cpp; sourceTree = SOURCE_ROOT; }; A563BC883D801CF5956DC4BC = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PopupMenu.h; path = ../../src/gui/components/menus/juce_PopupMenu.h; sourceTree = SOURCE_ROOT; }; - 7B0A07F03743BCFD719863CF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PopupMenuCustomComponent.h; path = ../../src/gui/components/menus/juce_PopupMenuCustomComponent.h; sourceTree = SOURCE_ROOT; }; 9E4B3BAB9BDB06B60D28DF48 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ComponentDragger.cpp; path = ../../src/gui/components/mouse/juce_ComponentDragger.cpp; sourceTree = SOURCE_ROOT; }; BCDD702ED33BADF3FC19384C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ComponentDragger.h; path = ../../src/gui/components/mouse/juce_ComponentDragger.h; sourceTree = SOURCE_ROOT; }; 3D74B30C63465C32E26D8E33 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_DragAndDropContainer.cpp; path = ../../src/gui/components/mouse/juce_DragAndDropContainer.cpp; sourceTree = SOURCE_ROOT; }; @@ -714,8 +711,6 @@ 136109B3076DDA7B2E01CF90 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MouseCursor.h; path = ../../src/gui/components/mouse/juce_MouseCursor.h; sourceTree = SOURCE_ROOT; }; 067D84F9291770240D1AB5B4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MouseEvent.cpp; path = ../../src/gui/components/mouse/juce_MouseEvent.cpp; sourceTree = SOURCE_ROOT; }; 50C02B44D0CB18898F575B1E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MouseEvent.h; path = ../../src/gui/components/mouse/juce_MouseEvent.h; sourceTree = SOURCE_ROOT; }; - 2531C57B0C861A48E3F3A673 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MouseHoverDetector.cpp; path = ../../src/gui/components/mouse/juce_MouseHoverDetector.cpp; sourceTree = SOURCE_ROOT; }; - D6743AC444E80E191B8C8FE3 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MouseHoverDetector.h; path = ../../src/gui/components/mouse/juce_MouseHoverDetector.h; sourceTree = SOURCE_ROOT; }; 441257DD380138C03568FCBD = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MouseInputSource.cpp; path = ../../src/gui/components/mouse/juce_MouseInputSource.cpp; sourceTree = SOURCE_ROOT; }; 07CF9AF337779EB486AC92BF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MouseInputSource.h; path = ../../src/gui/components/mouse/juce_MouseInputSource.h; sourceTree = SOURCE_ROOT; }; 2886656DF7ACC9DDC888827F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MouseListener.cpp; path = ../../src/gui/components/mouse/juce_MouseListener.cpp; sourceTree = SOURCE_ROOT; }; @@ -760,8 +755,6 @@ CD9F817B7EF0DA080668A3A8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ColourSelector.h; path = ../../src/gui/components/special/juce_ColourSelector.h; sourceTree = SOURCE_ROOT; }; 9C1D5CDA61FB51F657DA8B22 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_DropShadower.cpp; path = ../../src/gui/components/special/juce_DropShadower.cpp; sourceTree = SOURCE_ROOT; }; 7DB8CFB77EA690ACF54C63B4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_DropShadower.h; path = ../../src/gui/components/special/juce_DropShadower.h; sourceTree = SOURCE_ROOT; }; - 4A6A78512816BA378FFF348A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MagnifierComponent.cpp; path = ../../src/gui/components/special/juce_MagnifierComponent.cpp; sourceTree = SOURCE_ROOT; }; - 3C61804B771D33BED18FADE4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MagnifierComponent.h; path = ../../src/gui/components/special/juce_MagnifierComponent.h; sourceTree = SOURCE_ROOT; }; 3C8C1AAF32DFECB89EB83271 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MidiKeyboardComponent.cpp; path = ../../src/gui/components/special/juce_MidiKeyboardComponent.cpp; sourceTree = SOURCE_ROOT; }; 127FC743FE67E6EEF2531BD5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MidiKeyboardComponent.h; path = ../../src/gui/components/special/juce_MidiKeyboardComponent.h; sourceTree = SOURCE_ROOT; }; 4387C6496C7079FB0032B99D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_NSViewComponent.h; path = ../../src/gui/components/special/juce_NSViewComponent.h; sourceTree = SOURCE_ROOT; }; @@ -1446,8 +1439,7 @@ 1DDE0A8E4C5857715D9B5FAE, 502B3625329816EA6330465F, 6AACD2FD239E39F87B666C6F, - A563BC883D801CF5956DC4BC, - 7B0A07F03743BCFD719863CF ); name = menus; sourceTree = ""; }; + A563BC883D801CF5956DC4BC ); name = menus; sourceTree = ""; }; 4F37E36BA5E052B3BD4B87AD = { isa = PBXGroup; children = ( 9E4B3BAB9BDB06B60D28DF48, BCDD702ED33BADF3FC19384C, @@ -1460,8 +1452,6 @@ 136109B3076DDA7B2E01CF90, 067D84F9291770240D1AB5B4, 50C02B44D0CB18898F575B1E, - 2531C57B0C861A48E3F3A673, - D6743AC444E80E191B8C8FE3, 441257DD380138C03568FCBD, 07CF9AF337779EB486AC92BF, 2886656DF7ACC9DDC888827F, @@ -1509,8 +1499,6 @@ CD9F817B7EF0DA080668A3A8, 9C1D5CDA61FB51F657DA8B22, 7DB8CFB77EA690ACF54C63B4, - 4A6A78512816BA378FFF348A, - 3C61804B771D33BED18FADE4, 3C8C1AAF32DFECB89EB83271, 127FC743FE67E6EEF2531BD5, 4387C6496C7079FB0032B99D, @@ -2128,7 +2116,6 @@ E6971F06B78AE76C35E1A19C, 6629D535AE1ABE35A0D53C69, DD4599D0A8117B025B477DE1, - 968B31D8101A937444C6DFB3, E064E329741F36C329989203, 61E659ADBF9D832ED8F24540, 9379C833B875207E5DFC5A3F, @@ -2150,7 +2137,6 @@ 710BF477DE534CF18BD68959, E5DA150E966B948C4CB4EFDB, E96B477EB51FC152AC2EA6BD, - E847271789B669289C899425, CF36EF39EEAB7A4744C5D310, 372B6FF28C49018F5191C517, D9AAB4AE220010CD526C87D2, diff --git a/Builds/VisualStudio2005/Juce.vcproj b/Builds/VisualStudio2005/Juce.vcproj index 81e8a63990..191c032138 100644 --- a/Builds/VisualStudio2005/Juce.vcproj +++ b/Builds/VisualStudio2005/Juce.vcproj @@ -582,7 +582,6 @@ - @@ -596,8 +595,6 @@ - - @@ -648,8 +645,6 @@ - - diff --git a/Builds/VisualStudio2008/Juce.vcproj b/Builds/VisualStudio2008/Juce.vcproj index d588f87638..822203c10e 100644 --- a/Builds/VisualStudio2008/Juce.vcproj +++ b/Builds/VisualStudio2008/Juce.vcproj @@ -582,7 +582,6 @@ - @@ -596,8 +595,6 @@ - - @@ -648,8 +645,6 @@ - - diff --git a/Builds/VisualStudio2008_DLL/Juce.vcproj b/Builds/VisualStudio2008_DLL/Juce.vcproj index 7e3266456c..5f6d4db9e2 100644 --- a/Builds/VisualStudio2008_DLL/Juce.vcproj +++ b/Builds/VisualStudio2008_DLL/Juce.vcproj @@ -584,7 +584,6 @@ - @@ -598,8 +597,6 @@ - - @@ -650,8 +647,6 @@ - - diff --git a/Builds/VisualStudio2010/Juce.vcxproj b/Builds/VisualStudio2010/Juce.vcxproj index 78ce4ae49b..cbf7edfb8c 100644 --- a/Builds/VisualStudio2010/Juce.vcxproj +++ b/Builds/VisualStudio2010/Juce.vcxproj @@ -276,7 +276,6 @@ - @@ -298,7 +297,6 @@ - @@ -628,7 +626,6 @@ - @@ -636,7 +633,6 @@ - @@ -660,7 +656,6 @@ - diff --git a/Builds/VisualStudio2010/Juce.vcxproj.filters b/Builds/VisualStudio2010/Juce.vcxproj.filters index b16e9db5ff..6906d196b8 100644 --- a/Builds/VisualStudio2010/Juce.vcxproj.filters +++ b/Builds/VisualStudio2010/Juce.vcxproj.filters @@ -685,9 +685,6 @@ Juce\Source\gui\components\mouse - - Juce\Source\gui\components\mouse - Juce\Source\gui\components\mouse @@ -751,9 +748,6 @@ Juce\Source\gui\components\special - - Juce\Source\gui\components\special - Juce\Source\gui\components\special @@ -1815,9 +1809,6 @@ Juce\Source\gui\components\menus - - Juce\Source\gui\components\menus - Juce\Source\gui\components\mouse @@ -1839,9 +1830,6 @@ Juce\Source\gui\components\mouse - - Juce\Source\gui\components\mouse - Juce\Source\gui\components\mouse @@ -1911,9 +1899,6 @@ Juce\Source\gui\components\special - - Juce\Source\gui\components\special - Juce\Source\gui\components\special diff --git a/Builds/iPhone/Juce.xcodeproj/project.pbxproj b/Builds/iPhone/Juce.xcodeproj/project.pbxproj index fc40598bfd..2bee968cd7 100644 --- a/Builds/iPhone/Juce.xcodeproj/project.pbxproj +++ b/Builds/iPhone/Juce.xcodeproj/project.pbxproj @@ -162,7 +162,6 @@ E6971F06B78AE76C35E1A19C = { isa = PBXBuildFile; fileRef = 3D74B30C63465C32E26D8E33; }; 6629D535AE1ABE35A0D53C69 = { isa = PBXBuildFile; fileRef = 944BC51C440C167C5B2A23E3; }; DD4599D0A8117B025B477DE1 = { isa = PBXBuildFile; fileRef = 067D84F9291770240D1AB5B4; }; - 968B31D8101A937444C6DFB3 = { isa = PBXBuildFile; fileRef = 2531C57B0C861A48E3F3A673; }; E064E329741F36C329989203 = { isa = PBXBuildFile; fileRef = 441257DD380138C03568FCBD; }; 61E659ADBF9D832ED8F24540 = { isa = PBXBuildFile; fileRef = 2886656DF7ACC9DDC888827F; }; 9379C833B875207E5DFC5A3F = { isa = PBXBuildFile; fileRef = 82DFF1BD3665DC32672FCCE8; }; @@ -184,7 +183,6 @@ 710BF477DE534CF18BD68959 = { isa = PBXBuildFile; fileRef = 4C3C3AFC3D97C1378B7D7435; }; E5DA150E966B948C4CB4EFDB = { isa = PBXBuildFile; fileRef = 0A20E7E561633610A76A34AB; }; E96B477EB51FC152AC2EA6BD = { isa = PBXBuildFile; fileRef = 9C1D5CDA61FB51F657DA8B22; }; - E847271789B669289C899425 = { isa = PBXBuildFile; fileRef = 4A6A78512816BA378FFF348A; }; CF36EF39EEAB7A4744C5D310 = { isa = PBXBuildFile; fileRef = 3C8C1AAF32DFECB89EB83271; }; 372B6FF28C49018F5191C517 = { isa = PBXBuildFile; fileRef = 1317F0BE5EC80371F744967B; }; D9AAB4AE220010CD526C87D2 = { isa = PBXBuildFile; fileRef = A34C0E63D41CFF5E55FD1D9E; }; @@ -702,7 +700,6 @@ 502B3625329816EA6330465F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MenuBarModel.h; path = ../../src/gui/components/menus/juce_MenuBarModel.h; sourceTree = SOURCE_ROOT; }; 6AACD2FD239E39F87B666C6F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_PopupMenu.cpp; path = ../../src/gui/components/menus/juce_PopupMenu.cpp; sourceTree = SOURCE_ROOT; }; A563BC883D801CF5956DC4BC = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PopupMenu.h; path = ../../src/gui/components/menus/juce_PopupMenu.h; sourceTree = SOURCE_ROOT; }; - 7B0A07F03743BCFD719863CF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_PopupMenuCustomComponent.h; path = ../../src/gui/components/menus/juce_PopupMenuCustomComponent.h; sourceTree = SOURCE_ROOT; }; 9E4B3BAB9BDB06B60D28DF48 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ComponentDragger.cpp; path = ../../src/gui/components/mouse/juce_ComponentDragger.cpp; sourceTree = SOURCE_ROOT; }; BCDD702ED33BADF3FC19384C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ComponentDragger.h; path = ../../src/gui/components/mouse/juce_ComponentDragger.h; sourceTree = SOURCE_ROOT; }; 3D74B30C63465C32E26D8E33 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_DragAndDropContainer.cpp; path = ../../src/gui/components/mouse/juce_DragAndDropContainer.cpp; sourceTree = SOURCE_ROOT; }; @@ -714,8 +711,6 @@ 136109B3076DDA7B2E01CF90 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MouseCursor.h; path = ../../src/gui/components/mouse/juce_MouseCursor.h; sourceTree = SOURCE_ROOT; }; 067D84F9291770240D1AB5B4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MouseEvent.cpp; path = ../../src/gui/components/mouse/juce_MouseEvent.cpp; sourceTree = SOURCE_ROOT; }; 50C02B44D0CB18898F575B1E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MouseEvent.h; path = ../../src/gui/components/mouse/juce_MouseEvent.h; sourceTree = SOURCE_ROOT; }; - 2531C57B0C861A48E3F3A673 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MouseHoverDetector.cpp; path = ../../src/gui/components/mouse/juce_MouseHoverDetector.cpp; sourceTree = SOURCE_ROOT; }; - D6743AC444E80E191B8C8FE3 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MouseHoverDetector.h; path = ../../src/gui/components/mouse/juce_MouseHoverDetector.h; sourceTree = SOURCE_ROOT; }; 441257DD380138C03568FCBD = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MouseInputSource.cpp; path = ../../src/gui/components/mouse/juce_MouseInputSource.cpp; sourceTree = SOURCE_ROOT; }; 07CF9AF337779EB486AC92BF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MouseInputSource.h; path = ../../src/gui/components/mouse/juce_MouseInputSource.h; sourceTree = SOURCE_ROOT; }; 2886656DF7ACC9DDC888827F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MouseListener.cpp; path = ../../src/gui/components/mouse/juce_MouseListener.cpp; sourceTree = SOURCE_ROOT; }; @@ -760,8 +755,6 @@ CD9F817B7EF0DA080668A3A8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_ColourSelector.h; path = ../../src/gui/components/special/juce_ColourSelector.h; sourceTree = SOURCE_ROOT; }; 9C1D5CDA61FB51F657DA8B22 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_DropShadower.cpp; path = ../../src/gui/components/special/juce_DropShadower.cpp; sourceTree = SOURCE_ROOT; }; 7DB8CFB77EA690ACF54C63B4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_DropShadower.h; path = ../../src/gui/components/special/juce_DropShadower.h; sourceTree = SOURCE_ROOT; }; - 4A6A78512816BA378FFF348A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MagnifierComponent.cpp; path = ../../src/gui/components/special/juce_MagnifierComponent.cpp; sourceTree = SOURCE_ROOT; }; - 3C61804B771D33BED18FADE4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MagnifierComponent.h; path = ../../src/gui/components/special/juce_MagnifierComponent.h; sourceTree = SOURCE_ROOT; }; 3C8C1AAF32DFECB89EB83271 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = juce_MidiKeyboardComponent.cpp; path = ../../src/gui/components/special/juce_MidiKeyboardComponent.cpp; sourceTree = SOURCE_ROOT; }; 127FC743FE67E6EEF2531BD5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_MidiKeyboardComponent.h; path = ../../src/gui/components/special/juce_MidiKeyboardComponent.h; sourceTree = SOURCE_ROOT; }; 4387C6496C7079FB0032B99D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = juce_NSViewComponent.h; path = ../../src/gui/components/special/juce_NSViewComponent.h; sourceTree = SOURCE_ROOT; }; @@ -1446,8 +1439,7 @@ 1DDE0A8E4C5857715D9B5FAE, 502B3625329816EA6330465F, 6AACD2FD239E39F87B666C6F, - A563BC883D801CF5956DC4BC, - 7B0A07F03743BCFD719863CF ); name = menus; sourceTree = ""; }; + A563BC883D801CF5956DC4BC ); name = menus; sourceTree = ""; }; 4F37E36BA5E052B3BD4B87AD = { isa = PBXGroup; children = ( 9E4B3BAB9BDB06B60D28DF48, BCDD702ED33BADF3FC19384C, @@ -1460,8 +1452,6 @@ 136109B3076DDA7B2E01CF90, 067D84F9291770240D1AB5B4, 50C02B44D0CB18898F575B1E, - 2531C57B0C861A48E3F3A673, - D6743AC444E80E191B8C8FE3, 441257DD380138C03568FCBD, 07CF9AF337779EB486AC92BF, 2886656DF7ACC9DDC888827F, @@ -1509,8 +1499,6 @@ CD9F817B7EF0DA080668A3A8, 9C1D5CDA61FB51F657DA8B22, 7DB8CFB77EA690ACF54C63B4, - 4A6A78512816BA378FFF348A, - 3C61804B771D33BED18FADE4, 3C8C1AAF32DFECB89EB83271, 127FC743FE67E6EEF2531BD5, 4387C6496C7079FB0032B99D, @@ -2128,7 +2116,6 @@ E6971F06B78AE76C35E1A19C, 6629D535AE1ABE35A0D53C69, DD4599D0A8117B025B477DE1, - 968B31D8101A937444C6DFB3, E064E329741F36C329989203, 61E659ADBF9D832ED8F24540, 9379C833B875207E5DFC5A3F, @@ -2150,7 +2137,6 @@ 710BF477DE534CF18BD68959, E5DA150E966B948C4CB4EFDB, E96B477EB51FC152AC2EA6BD, - E847271789B669289C899425, CF36EF39EEAB7A4744C5D310, 372B6FF28C49018F5191C517, D9AAB4AE220010CD526C87D2, diff --git a/Juce.jucer b/Juce.jucer index eb4780ea44..53514309d6 100644 --- a/Juce.jucer +++ b/Juce.jucer @@ -792,8 +792,6 @@ file="src/gui/components/menus/juce_PopupMenu.cpp"/> - - - - - hasProperty (name))); @@ -17663,8 +17661,6 @@ public: jassert (child != 0); } - ~AddOrRemoveChildAction() {} - bool perform() { if (isDeleting) @@ -17716,8 +17712,6 @@ public: { } - ~MoveChildAction() {} - bool perform() { parent->moveChild (startIndex, endIndex, 0); @@ -17919,7 +17913,7 @@ ValueTree ValueTree::SharedObject::getChildWithName (const Identifier& typeToMat { for (int i = 0; i < children.size(); ++i) if (children.getUnchecked(i)->type == typeToMatch) - return ValueTree (static_cast (children.getUnchecked(i))); + return ValueTree (children.getUnchecked(i).getObject()); return ValueTree::invalid; } @@ -17928,7 +17922,7 @@ ValueTree ValueTree::SharedObject::getOrCreateChildWithName (const Identifier& t { for (int i = 0; i < children.size(); ++i) if (children.getUnchecked(i)->type == typeToMatch) - return ValueTree (static_cast (children.getUnchecked(i))); + return ValueTree (children.getUnchecked(i).getObject()); SharedObject* const newObject = new SharedObject (typeToMatch); addChild (newObject, -1, undoManager); @@ -17940,7 +17934,7 @@ ValueTree ValueTree::SharedObject::getChildWithProperty (const Identifier& prope { for (int i = 0; i < children.size(); ++i) if (children.getUnchecked(i)->getProperty (propertyName) == propertyValue) - return ValueTree (static_cast (children.getUnchecked(i))); + return ValueTree (children.getUnchecked(i).getObject()); return ValueTree::invalid; } @@ -18179,7 +18173,7 @@ ValueTree ValueTree::getSibling (const int delta) const return invalid; const int index = object->parent->indexOf (*this) + delta; - return ValueTree (static_cast (object->parent->children [index])); + return ValueTree (object->parent->children [index].getObject()); } const var& ValueTree::operator[] (const Identifier& name) const @@ -28605,6 +28599,14 @@ int MidiMessage::getMessageLengthFromFirstByte (const uint8 firstByte) throw() return messageLengths [firstByte & 0x7f]; } +MidiMessage::MidiMessage() throw() + : timeStamp (0), + data (static_cast (preallocatedData.asBytes)), + size (1) +{ + data[0] = 0xfe; +} + MidiMessage::MidiMessage (const void* const d, const int dataSize, const double t) : timeStamp (t), size (dataSize) @@ -54772,11 +54774,11 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ToolbarSpacerComp); }; -class Toolbar::MissingItemsComponent : public PopupMenuCustomComponent +class Toolbar::MissingItemsComponent : public PopupMenu::CustomComponent { public: MissingItemsComponent (Toolbar& owner_, const int height_) - : PopupMenuCustomComponent (true), + : PopupMenu::CustomComponent (true), owner (&owner_), height (height_) { @@ -68844,7 +68846,7 @@ public: const Image& im, const Colour& textColour_, const bool usesColour_, - PopupMenuCustomComponent* const customComp_, + CustomComponent* const customComp_, const PopupMenu* const subMenu_, ApplicationCommandManager* const commandManager_) : itemId (itemId_), text (text_), textColour (textColour_), @@ -68906,7 +68908,7 @@ public: const Colour textColour; const bool active, isSeparator, isTicked, usesColour; Image image; - ReferenceCountedObjectPtr customComp; + ReferenceCountedObjectPtr customComp; ScopedPointer subMenu; ApplicationCommandManager* const commandManager; @@ -68939,22 +68941,15 @@ public: removeChildComponent (itemInfo.customComp); } - void getIdealSize (int& idealWidth, - int& idealHeight, - const int standardItemHeight) + void getIdealSize (int& idealWidth, int& idealHeight, const int standardItemHeight) { if (itemInfo.customComp != 0) - { itemInfo.customComp->getIdealSize (idealWidth, idealHeight); - } else - { getLookAndFeel().getIdealPopupMenuItemSize (itemInfo.text, itemInfo.isSeparator, standardItemHeight, - idealWidth, - idealHeight); - } + idealWidth, idealHeight); } void paint (Graphics& g) @@ -68999,10 +68994,7 @@ public: isHighlighted = shouldBeHighlighted; if (itemInfo.customComp != 0) - { - itemInfo.customComp->isHighlighted = shouldBeHighlighted; - itemInfo.customComp->repaint(); - } + itemInfo.customComp->setHighlighted (shouldBeHighlighted); repaint(); } @@ -69899,9 +69891,7 @@ private: && (isOver || (activeSubMenu == 0) || ! activeSubMenu->isVisible())) { if (isOver && (c != 0) && (activeSubMenu != 0)) - { activeSubMenu->hide (0, true); - } if (! isOver) mic = 0; @@ -69916,7 +69906,7 @@ private: if (currentChild != 0 && currentChild->itemInfo.canBeTriggered() && (currentChild->itemInfo.customComp == 0 - || currentChild->itemInfo.customComp->isTriggeredAutomatically)) + || currentChild->itemInfo.customComp->isTriggeredAutomatically())) { dismissMenu (¤tChild->itemInfo); } @@ -70064,8 +70054,7 @@ void PopupMenu::addColouredItem (const int itemResultId, itemTextColour, true, 0, 0, 0)); } -void PopupMenu::addCustomItem (const int itemResultId, - PopupMenuCustomComponent* const customComponent) +void PopupMenu::addCustomItem (const int itemResultId, CustomComponent* const customComponent) { jassert (itemResultId != 0); // 0 is used as a return value to indicate that the user // didn't pick anything, so you shouldn't use it as the id @@ -70077,19 +70066,17 @@ void PopupMenu::addCustomItem (const int itemResultId, Colours::black, false, customComponent, 0, 0)); } -class NormalComponentWrapper : public PopupMenuCustomComponent +class NormalComponentWrapper : public PopupMenu::CustomComponent { public: NormalComponentWrapper (Component* const comp, const int w, const int h, const bool triggerMenuItemAutomaticallyWhenClicked) - : PopupMenuCustomComponent (triggerMenuItemAutomaticallyWhenClicked), + : PopupMenu::CustomComponent (triggerMenuItemAutomaticallyWhenClicked), width (w), height (h) { addAndMakeVisible (comp); } - ~NormalComponentWrapper() {} - void getIdealSize (int& idealWidth, int& idealHeight) { idealWidth = width; @@ -70135,11 +70122,11 @@ void PopupMenu::addSeparator() separatorPending = true; } -class HeaderItemComponent : public PopupMenuCustomComponent +class HeaderItemComponent : public PopupMenu::CustomComponent { public: HeaderItemComponent (const String& name) - : PopupMenuCustomComponent (false) + : PopupMenu::CustomComponent (false) { setName (name); } @@ -70156,8 +70143,7 @@ public: Justification::bottomLeft, 1); } - void getIdealSize (int& idealWidth, - int& idealHeight) + void getIdealSize (int& idealWidth, int& idealHeight) { getLookAndFeel().getIdealPopupMenuItemSize (getName(), false, -1, idealWidth, idealHeight); idealHeight += idealHeight / 2; @@ -70359,17 +70345,23 @@ void PopupMenu::setLookAndFeel (LookAndFeel* const newLookAndFeel) lookAndFeel = newLookAndFeel; } -PopupMenuCustomComponent::PopupMenuCustomComponent (const bool isTriggeredAutomatically_) +PopupMenu::CustomComponent::CustomComponent (const bool isTriggeredAutomatically_) : isHighlighted (false), - isTriggeredAutomatically (isTriggeredAutomatically_) + triggeredAutomatically (isTriggeredAutomatically_) +{ +} + +PopupMenu::CustomComponent::~CustomComponent() { } -PopupMenuCustomComponent::~PopupMenuCustomComponent() +void PopupMenu::CustomComponent::setHighlighted (bool shouldBeHighlighted) { + isHighlighted = shouldBeHighlighted; + repaint(); } -void PopupMenuCustomComponent::triggerMenuItem() +void PopupMenu::CustomComponent::triggerMenuItem() { PopupMenu::ItemComponent* const mic = dynamic_cast (getParentComponent()); @@ -70429,7 +70421,7 @@ bool PopupMenu::MenuItemIterator::next() isSeparator = item->isSeparator; isTicked = item->isTicked; isEnabled = item->active; - isSectionHeader = dynamic_cast (static_cast (item->customComp)) != 0; + isSectionHeader = dynamic_cast (static_cast (item->customComp)) != 0; isCustomComponent = (! isSectionHeader) && item->customComp != 0; customColour = item->usesColour ? &(item->textColour) : 0; customImage = item->image; @@ -70741,7 +70733,7 @@ private: WeakReference currentlyOverComp; DragAndDropTarget* getCurrentlyOver() { - return dynamic_cast (static_cast (currentlyOverComp)); + return dynamic_cast (currentlyOverComp.get()); } String dragDesc; @@ -71707,122 +71699,6 @@ END_JUCE_NAMESPACE /*** End of inlined file: juce_MouseInputSource.cpp ***/ -/*** Start of inlined file: juce_MouseHoverDetector.cpp ***/ -BEGIN_JUCE_NAMESPACE - -MouseHoverDetector::MouseHoverDetector (const int hoverTimeMillisecs_) - : source (0), - hoverTimeMillisecs (hoverTimeMillisecs_), - hasJustHovered (false) -{ - internalTimer.owner = this; -} - -MouseHoverDetector::~MouseHoverDetector() -{ - setHoverComponent (0); -} - -void MouseHoverDetector::setHoverTimeMillisecs (const int newTimeInMillisecs) -{ - hoverTimeMillisecs = newTimeInMillisecs; -} - -void MouseHoverDetector::setHoverComponent (Component* const newSourceComponent) -{ - if (source != newSourceComponent) - { - internalTimer.stopTimer(); - hasJustHovered = false; - - if (source != 0) - source->removeMouseListener (&internalTimer); - - source = newSourceComponent; - - if (newSourceComponent != 0) - newSourceComponent->addMouseListener (&internalTimer, false); - } -} - -void MouseHoverDetector::hoverTimerCallback() -{ - internalTimer.stopTimer(); - - if (source != 0) - { - const Point pos (source->getMouseXYRelative()); - - if (source->reallyContains (pos, false)) - { - hasJustHovered = true; - mouseHovered (pos.getX(), pos.getY()); - } - } -} - -void MouseHoverDetector::checkJustHoveredCallback() -{ - if (hasJustHovered) - { - hasJustHovered = false; - mouseMovedAfterHover(); - } -} - -void MouseHoverDetector::HoverDetectorInternal::timerCallback() -{ - owner->hoverTimerCallback(); -} - -void MouseHoverDetector::HoverDetectorInternal::mouseEnter (const MouseEvent&) -{ - stopTimer(); - owner->checkJustHoveredCallback(); -} - -void MouseHoverDetector::HoverDetectorInternal::mouseExit (const MouseEvent&) -{ - stopTimer(); - owner->checkJustHoveredCallback(); -} - -void MouseHoverDetector::HoverDetectorInternal::mouseDown (const MouseEvent&) -{ - stopTimer(); - owner->checkJustHoveredCallback(); -} - -void MouseHoverDetector::HoverDetectorInternal::mouseUp (const MouseEvent&) -{ - stopTimer(); - owner->checkJustHoveredCallback(); -} - -void MouseHoverDetector::HoverDetectorInternal::mouseMove (const MouseEvent& e) -{ - if (lastX != e.x || lastY != e.y) // to avoid fake mouse-moves setting it off - { - lastX = e.x; - lastY = e.y; - - if (owner->source != 0) - startTimer (owner->hoverTimeMillisecs); - - owner->checkJustHoveredCallback(); - } -} - -void MouseHoverDetector::HoverDetectorInternal::mouseWheelMove (const MouseEvent&, float, float) -{ - stopTimer(); - owner->checkJustHoveredCallback(); -} - -END_JUCE_NAMESPACE -/*** End of inlined file: juce_MouseHoverDetector.cpp ***/ - - /*** Start of inlined file: juce_MouseListener.cpp ***/ BEGIN_JUCE_NAMESPACE @@ -74825,309 +74701,6 @@ END_JUCE_NAMESPACE /*** End of inlined file: juce_DropShadower.cpp ***/ -/*** Start of inlined file: juce_MagnifierComponent.cpp ***/ -BEGIN_JUCE_NAMESPACE - -class MagnifyingPeer : public ComponentPeer -{ -public: - - MagnifyingPeer (Component* const component_, - MagnifierComponent* const magnifierComp_) - : ComponentPeer (component_, 0), - magnifierComp (magnifierComp_) - { - } - - ~MagnifyingPeer() - { - } - - void* getNativeHandle() const { return 0; } - void setVisible (bool) {} - void setTitle (const String&) {} - void setPosition (int, int) {} - void setSize (int, int) {} - void setBounds (int, int, int, int, bool) {} - void setMinimised (bool) {} - void setAlpha (float /*newAlpha*/) {} - bool isMinimised() const { return false; } - void setFullScreen (bool) {} - bool isFullScreen() const { return false; } - const BorderSize getFrameSize() const { return BorderSize (0); } - bool setAlwaysOnTop (bool) { return true; } - void toFront (bool) {} - void toBehind (ComponentPeer*) {} - void setIcon (const Image&) {} - - bool isFocused() const - { - return magnifierComp->hasKeyboardFocus (true); - } - - void grabFocus() - { - ComponentPeer* peer = magnifierComp->getPeer(); - if (peer != 0) - peer->grabFocus(); - } - - void textInputRequired (const Point& position) - { - ComponentPeer* peer = magnifierComp->getPeer(); - if (peer != 0) - peer->textInputRequired (position); - } - - const Rectangle getBounds() const - { - return Rectangle (magnifierComp->getScreenX(), magnifierComp->getScreenY(), - component->getWidth(), component->getHeight()); - } - - const Point getScreenPosition() const - { - return magnifierComp->getScreenPosition(); - } - - const Point localToGlobal (const Point& relativePosition) - { - const double zoom = magnifierComp->getScaleFactor(); - return magnifierComp->localPointToGlobal (Point (roundToInt (relativePosition.getX() * zoom), - roundToInt (relativePosition.getY() * zoom))); - } - - const Point globalToLocal (const Point& screenPosition) - { - const Point p (magnifierComp->getLocalPoint (0, screenPosition)); - const double zoom = magnifierComp->getScaleFactor(); - - return Point (roundToInt (p.getX() / zoom), - roundToInt (p.getY() / zoom)); - } - - bool contains (const Point& position, bool) const - { - return isPositiveAndBelow (position.getX(), magnifierComp->getWidth()) - && isPositiveAndBelow (position.getY(), magnifierComp->getHeight()); - } - - void repaint (const Rectangle& area) - { - const double zoom = magnifierComp->getScaleFactor(); - - magnifierComp->repaint ((int) (area.getX() * zoom), - (int) (area.getY() * zoom), - roundToInt (area.getWidth() * zoom) + 1, - roundToInt (area.getHeight() * zoom) + 1); - } - - void performAnyPendingRepaintsNow() - { - } - -private: - MagnifierComponent* const magnifierComp; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MagnifyingPeer); -}; - -class PeerHolderComp : public Component -{ -public: - PeerHolderComp (MagnifierComponent* const magnifierComp_) - : magnifierComp (magnifierComp_) - { - setVisible (true); - } - - ~PeerHolderComp() - { - } - - ComponentPeer* createNewPeer (int, void*) - { - return new MagnifyingPeer (this, magnifierComp); - } - - void childBoundsChanged (Component* c) - { - if (c != 0) - { - setSize (c->getWidth(), c->getHeight()); - magnifierComp->childBoundsChanged (this); - } - } - - void mouseWheelMove (const MouseEvent& e, float ix, float iy) - { - // unhandled mouse wheel moves can be referred upwards to the parent comp.. - Component* const p = magnifierComp->getParentComponent(); - - if (p != 0) - p->mouseWheelMove (e.getEventRelativeTo (p), ix, iy); - } - -private: - MagnifierComponent* const magnifierComp; - - JUCE_DECLARE_NON_COPYABLE (PeerHolderComp); -}; - -MagnifierComponent::MagnifierComponent (Component* const content_, - const bool deleteContentCompWhenNoLongerNeeded) - : content (content_), - scaleFactor (0.0), - peer (0), - deleteContent (deleteContentCompWhenNoLongerNeeded), - quality (Graphics::lowResamplingQuality), - mouseSource (0, true) -{ - holderComp = new PeerHolderComp (this); - setScaleFactor (1.0); -} - -MagnifierComponent::~MagnifierComponent() -{ - delete holderComp; - - if (deleteContent) - delete content; -} - -void MagnifierComponent::setScaleFactor (double newScaleFactor) -{ - jassert (newScaleFactor > 0.0); // hmm - unlikely to work well with a negative scale factor - - newScaleFactor = jlimit (1.0 / 8.0, 1000.0, newScaleFactor); - - if (scaleFactor != newScaleFactor) - { - scaleFactor = newScaleFactor; - - if (scaleFactor == 1.0) - { - holderComp->removeFromDesktop(); - peer = 0; - addChildComponent (content); - childBoundsChanged (content); - } - else - { - holderComp->addAndMakeVisible (content); - holderComp->childBoundsChanged (content); - childBoundsChanged (holderComp); - holderComp->addToDesktop (0); - peer = holderComp->getPeer(); - } - - repaint(); - } -} - -void MagnifierComponent::setResamplingQuality (Graphics::ResamplingQuality newQuality) -{ - quality = newQuality; -} - -void MagnifierComponent::paint (Graphics& g) -{ - const int w = holderComp->getWidth(); - const int h = holderComp->getHeight(); - - if (w == 0 || h == 0) - return; - - const Rectangle r (g.getClipBounds()); - - const int srcX = (int) (r.getX() / scaleFactor); - const int srcY = (int) (r.getY() / scaleFactor); - int srcW = roundToInt (r.getRight() / scaleFactor) - srcX; - int srcH = roundToInt (r.getBottom() / scaleFactor) - srcY; - - if (scaleFactor >= 1.0) - { - ++srcW; - ++srcH; - } - - Image temp (Image::ARGB, jmax (w, srcX + srcW), jmax (h, srcY + srcH), false); - const Rectangle area (srcX, srcY, srcW, srcH); - temp.clear (area); - - { - Graphics g2 (temp); - g2.reduceClipRegion (area); - holderComp->paintEntireComponent (g2, false); - } - - g.setImageResamplingQuality (quality); - g.drawImageTransformed (temp, AffineTransform::scale ((float) scaleFactor, (float) scaleFactor), false); -} - -void MagnifierComponent::childBoundsChanged (Component* c) -{ - if (c != 0) - setSize (roundToInt (c->getWidth() * scaleFactor), - roundToInt (c->getHeight() * scaleFactor)); -} - -void MagnifierComponent::passOnMouseEventToPeer (const MouseEvent& e) -{ - if (peer != 0) - mouseSource.handleEvent (peer, Point (scaleInt (e.x), scaleInt (e.y)), - e.eventTime.toMilliseconds(), ModifierKeys::getCurrentModifiers()); -} - -void MagnifierComponent::mouseDown (const MouseEvent& e) -{ - passOnMouseEventToPeer (e); -} - -void MagnifierComponent::mouseUp (const MouseEvent& e) -{ - passOnMouseEventToPeer (e); -} - -void MagnifierComponent::mouseDrag (const MouseEvent& e) -{ - passOnMouseEventToPeer (e); -} - -void MagnifierComponent::mouseMove (const MouseEvent& e) -{ - passOnMouseEventToPeer (e); -} - -void MagnifierComponent::mouseEnter (const MouseEvent& e) -{ - passOnMouseEventToPeer (e); -} - -void MagnifierComponent::mouseExit (const MouseEvent& e) -{ - passOnMouseEventToPeer (e); -} - -void MagnifierComponent::mouseWheelMove (const MouseEvent& e, float ix, float iy) -{ - if (peer != 0) - peer->handleMouseWheel (e.source.getIndex(), - Point (scaleInt (e.x), scaleInt (e.y)), e.eventTime.toMilliseconds(), - ix * 256.0f, iy * 256.0f); - else - Component::mouseWheelMove (e, ix, iy); -} - -int MagnifierComponent::scaleInt (const int n) const -{ - return roundToInt (n / scaleFactor); -} - -END_JUCE_NAMESPACE -/*** End of inlined file: juce_MagnifierComponent.cpp ***/ - - /*** Start of inlined file: juce_MidiKeyboardComponent.cpp ***/ BEGIN_JUCE_NAMESPACE @@ -79639,12 +79212,12 @@ public: const Expression getSymbolValue (const String& objectName, const String& member) const { - if (member.isNotEmpty()) + if (member.isEmpty()) { const MarkerList::Marker* const marker = markerList.getMarker (objectName); if (marker != 0) - return Expression ((double) marker->position.resolve (this)); + return Expression (marker->position.resolve (this)); } else if (parentComponent != 0 && objectName == RelativeCoordinate::Strings::parent) { @@ -84461,7 +84034,7 @@ public: } y = y_; - generate (static_cast (scratchBuffer), x, width); + generate (scratchBuffer.getData(), x, width); et.clipLineToMask (x, y_, reinterpret_cast (scratchBuffer.getData()) + SrcPixelType::indexA, @@ -249127,6 +248700,8 @@ MidiOutput* MidiOutput::openDevice (int index) MidiOutput::~MidiOutput() { + stopBackgroundThread(); + MidiOutHandle* const h = static_cast (internal); if (MidiOutHandle::activeHandles.contains (h) && --(h->refCount) == 0) diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 840713360c..c9932de171 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -73,7 +73,7 @@ namespace JuceDummyNamespace {} */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 53 -#define JUCE_BUILDNUMBER 9 +#define JUCE_BUILDNUMBER 10 /** Current Juce version number. @@ -35473,6 +35473,12 @@ public: int& numBytesUsed, uint8 lastStatusByte, double timeStamp = 0); + /** Creates an active-sense message. + Since the MidiMessage has to contain a valid message, this default constructor + just initialises it with a simple one-byte active-sense message. + */ + MidiMessage() throw(); + /** Creates a copy of another midi message. */ MidiMessage (const MidiMessage& other); @@ -37943,8 +37949,6 @@ private: #ifndef __JUCE_POPUPMENU_JUCEHEADER__ #define __JUCE_POPUPMENU_JUCEHEADER__ -class PopupMenuCustomComponent; - /** Creates and displays a popup-menu. To show a popup-menu, you create one of these, add some items to it, then @@ -38059,19 +38063,10 @@ public: bool isTicked = false, const Image& iconToUse = Image::null); - /** Appends a custom menu item. - - This will add a user-defined component to use as a menu item. The component - passed in will be deleted by this menu when it's no longer needed. - - @see PopupMenuCustomComponent - */ - void addCustomItem (int itemResultId, PopupMenuCustomComponent* customComponent); - /** Appends a custom menu item that can't be used to trigger a result. This will add a user-defined component to use as a menu item. Unlike the - addCustomItem() method that takes a PopupMenuCustomComponent, this version + addCustomItem() method that takes a PopupMenu::CustomComponent, this version can't trigger a result from it, so doesn't take a menu ID. It also doesn't delete the component when it's finished, so it's the caller's responsibility to manage the component that is passed-in. @@ -38081,7 +38076,7 @@ public: menu ID specified in itemResultId. If this is false, the menu item can't be triggered, so itemResultId is not used. - @see PopupMenuCustomComponent + @see CustomComponent */ void addCustomItem (int itemResultId, Component* customComponent, @@ -38282,6 +38277,64 @@ public: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MenuItemIterator); }; + /** A user-defined copmonent that can be used as an item in a popup menu. + @see PopupMenu::addCustomItem + */ + class JUCE_API CustomComponent : public Component, + public ReferenceCountedObject + { + public: + /** Creates a custom item. + If isTriggeredAutomatically is true, then the menu will automatically detect + a mouse-click on this component and use that to invoke the menu item. If it's + false, then it's up to your class to manually trigger the item when it wants to. + */ + CustomComponent (bool isTriggeredAutomatically = true); + + /** Destructor. */ + ~CustomComponent(); + + /** Returns a rectangle with the size that this component would like to have. + + Note that the size which this method returns isn't necessarily the one that + the menu will give it, as the items will be stretched to have a uniform width. + */ + virtual void getIdealSize (int& idealWidth, int& idealHeight) = 0; + + /** Dismisses the menu, indicating that this item has been chosen. + + This will cause the menu to exit from its modal state, returning + this item's id as the result. + */ + void triggerMenuItem(); + + /** Returns true if this item should be highlighted because the mouse is over it. + You can call this method in your paint() method to find out whether + to draw a highlight. + */ + bool isItemHighlighted() const throw() { return isHighlighted; } + + /** @internal. */ + bool isTriggeredAutomatically() const throw() { return triggeredAutomatically; } + /** @internal. */ + void setHighlighted (bool shouldBeHighlighted); + + private: + + bool isHighlighted, triggeredAutomatically; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CustomComponent); + }; + + /** Appends a custom menu item. + + This will add a user-defined component to use as a menu item. The component + passed in will be deleted by this menu when it's no longer needed. + + @see CustomComponent + */ + void addCustomItem (int itemResultId, CustomComponent* customComponent); + private: class Item; @@ -38291,7 +38344,7 @@ private: friend class MenuItemIterator; friend class ItemComponent; friend class Window; - friend class PopupMenuCustomComponent; + friend class CustomComponent; friend class MenuBarComponent; friend class OwnedArray ; friend class OwnedArray ; @@ -56959,70 +57012,6 @@ private: #endif #ifndef __JUCE_POPUPMENU_JUCEHEADER__ -#endif -#ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__ - -/*** Start of inlined file: juce_PopupMenuCustomComponent.h ***/ -#ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__ -#define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__ - -/** A user-defined copmonent that can appear inside one of the rows of a popup menu. - - @see PopupMenu::addCustomItem -*/ -class JUCE_API PopupMenuCustomComponent : public Component, - public ReferenceCountedObject -{ -public: - /** Destructor. */ - ~PopupMenuCustomComponent(); - - /** Chooses the size that this component would like to have. - - Note that the size which this method returns isn't necessarily the one that - the menu will give it, as it will be stretched to fit the other items in - the menu. - */ - virtual void getIdealSize (int& idealWidth, - int& idealHeight) = 0; - - /** Dismisses the menu indicating that this item has been chosen. - - This will cause the menu to exit from its modal state, returning - this item's id as the result. - */ - void triggerMenuItem(); - - /** Returns true if this item should be highlighted because the mouse is - over it. - - You can call this method in your paint() method to find out whether - to draw a highlight. - */ - bool isItemHighlighted() const throw() { return isHighlighted; } - -protected: - /** Constructor. - - If isTriggeredAutomatically is true, then the menu will automatically detect - a click on this component and use that to trigger it. If it's false, then it's - up to your class to manually trigger the item if it wants to. - */ - PopupMenuCustomComponent (bool isTriggeredAutomatically = true); - -private: - friend class PopupMenu; - friend class PopupMenu::ItemComponent; - friend class PopupMenu::Window; - bool isHighlighted, isTriggeredAutomatically; - - JUCE_DECLARE_NON_COPYABLE (PopupMenuCustomComponent); -}; - -#endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__ -/*** End of inlined file: juce_PopupMenuCustomComponent.h ***/ - - #endif #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__ @@ -57548,109 +57537,6 @@ private: #endif #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__ -#endif -#ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__ - -/*** Start of inlined file: juce_MouseHoverDetector.h ***/ -#ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__ -#define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__ - -/** - Monitors a component for mouse activity, and triggers a callback - when the mouse hovers in one place for a specified length of time. - - To use a hover-detector, just create one and call its setHoverComponent() - method to start it watching a component. You can call setHoverComponent (0) - to make it inactive. - - (Be careful not to delete a component that's being monitored without first - stopping or deleting the hover detector). -*/ -class JUCE_API MouseHoverDetector -{ -public: - - /** Creates a hover detector. - - Initially the object is inactive, and you need to tell it which component - to monitor, using the setHoverComponent() method. - - @param hoverTimeMillisecs the number of milliseconds for which the mouse - needs to stay still before the mouseHovered() method - is invoked. You can change this setting later with - the setHoverTimeMillisecs() method - */ - MouseHoverDetector (int hoverTimeMillisecs = 400); - - /** Destructor. */ - virtual ~MouseHoverDetector(); - - /** Changes the time for which the mouse has to stay still before it's considered - to be hovering. - */ - void setHoverTimeMillisecs (int newTimeInMillisecs); - - /** Changes the component that's being monitored for hovering. - - Be careful not to delete a component that's being monitored without first - stopping or deleting the hover detector. - */ - void setHoverComponent (Component* newSourceComponent); - -protected: - - /** Called back when the mouse hovers. - - After the mouse has stayed still over the component for the length of time - specified by setHoverTimeMillisecs(), this method will be invoked. - - When the mouse is first moved after this callback has occurred, the - mouseMovedAfterHover() method will be called. - - @param mouseX the mouse's X position relative to the component being monitored - @param mouseY the mouse's Y position relative to the component being monitored - */ - virtual void mouseHovered (int mouseX, - int mouseY) = 0; - - /** Called when the mouse is moved away after just having hovered. */ - virtual void mouseMovedAfterHover() = 0; - -private: - - class JUCE_API HoverDetectorInternal : public MouseListener, - public Timer - { - public: - MouseHoverDetector* owner; - int lastX, lastY; - - void timerCallback(); - void mouseEnter (const MouseEvent&); - void mouseExit (const MouseEvent&); - void mouseDown (const MouseEvent&); - void mouseUp (const MouseEvent&); - void mouseMove (const MouseEvent&); - void mouseWheelMove (const MouseEvent&, float, float); - - } internalTimer; - - friend class HoverDetectorInternal; - - Component* source; - int hoverTimeMillisecs; - bool hasJustHovered; - - void hoverTimerCallback(); - void checkJustHoveredCallback(); - - JUCE_DECLARE_NON_COPYABLE (MouseHoverDetector); -}; - -#endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__ -/*** End of inlined file: juce_MouseHoverDetector.h ***/ - - #endif #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__ @@ -57658,8 +57544,6 @@ private: #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__ #define __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__ -class Component; -class ComponentPeer; class MouseInputSourceInternal; /** @@ -57756,12 +57640,22 @@ public: */ bool hasMouseMovedSignificantlySincePressed() const throw(); + /** Returns true if this input source uses a visible mouse cursor. */ bool hasMouseCursor() const throw(); + + /** Changes the mouse cursor, (if there is one). */ void showMouseCursor (const MouseCursor& cursor); + + /** Hides the mouse cursor (if there is one). */ void hideCursor(); + + /** Un-hides the mouse cursor if it was hidden by hideCursor(). */ void revealCursor(); + + /** Forces an update of the mouse cursor for whatever component it's currently over. */ void forceMouseCursorUpdate(); + /** Returns true if this mouse can be moved indefinitely in any direction without running out of space. */ bool canDoUnboundedMovement() const throw(); /** Allows the mouse to move beyond the edges of the screen. @@ -59081,99 +58975,6 @@ private: #endif #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__ -#endif -#ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__ - -/*** Start of inlined file: juce_MagnifierComponent.h ***/ -#ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__ -#define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__ - -/** - A component that contains another component, and can magnify or shrink it. - - This component will continually update its size so that it fits the zoomed - version of the content component that you put inside it, so don't try to - change the size of this component directly - instead change that of the - content component. - - To make it all work, the magnifier uses extremely cunning ComponentPeer tricks - to remap mouse events correctly. This means that the content component won't - appear to be a direct child of this component, and instead will think its - on the desktop. -*/ -class JUCE_API MagnifierComponent : public Component -{ -public: - - /** Creates a MagnifierComponent. - - This component will continually update its size so that it fits the zoomed - version of the content component that you put inside it, so don't try to - change the size of this component directly - instead change that of the - content component. - - @param contentComponent the component to add as the magnified one - @param deleteContentCompWhenNoLongerNeeded if true, the content component will - be deleted when this component is deleted. If false, - it's the caller's responsibility to delete it later. - */ - MagnifierComponent (Component* contentComponent, - bool deleteContentCompWhenNoLongerNeeded); - - /** Destructor. */ - ~MagnifierComponent(); - - /** Returns the current content component. */ - Component* getContentComponent() const { return content; } - - /** Changes the zoom level. - - The scale factor must be greater than zero. Values less than 1 will shrink the - image; values greater than 1 will multiply its size by this amount. - - When this is called, this component will change its size to fit the full extent - of the newly zoomed content. - */ - void setScaleFactor (double newScaleFactor); - - /** Returns the current zoom factor. */ - double getScaleFactor() const { return scaleFactor; } - - /** Changes the quality setting used to rescale the graphics. - */ - void setResamplingQuality (Graphics::ResamplingQuality newQuality); - - /** @internal */ - void childBoundsChanged (Component*); - -private: - Component* content; - Component* holderComp; - double scaleFactor; - ComponentPeer* peer; - bool deleteContent; - Graphics::ResamplingQuality quality; - MouseInputSource mouseSource; - - void paint (Graphics& g); - void mouseDown (const MouseEvent& e); - void mouseUp (const MouseEvent& e); - void mouseDrag (const MouseEvent& e); - void mouseMove (const MouseEvent& e); - void mouseEnter (const MouseEvent& e); - void mouseExit (const MouseEvent& e); - void mouseWheelMove (const MouseEvent& e, float, float); - - void passOnMouseEventToPeer (const MouseEvent& e); - int scaleInt (int n) const; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MagnifierComponent); -}; - -#endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__ -/*** End of inlined file: juce_MagnifierComponent.h ***/ - - #endif #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__ diff --git a/src/audio/midi/juce_MidiMessage.cpp b/src/audio/midi/juce_MidiMessage.cpp index f1a6b54967..3d5d77d1c6 100644 --- a/src/audio/midi/juce_MidiMessage.cpp +++ b/src/audio/midi/juce_MidiMessage.cpp @@ -75,6 +75,14 @@ int MidiMessage::getMessageLengthFromFirstByte (const uint8 firstByte) throw() } //============================================================================== +MidiMessage::MidiMessage() throw() + : timeStamp (0), + data (static_cast (preallocatedData.asBytes)), + size (1) +{ + data[0] = 0xfe; +} + MidiMessage::MidiMessage (const void* const d, const int dataSize, const double t) : timeStamp (t), size (dataSize) diff --git a/src/audio/midi/juce_MidiMessage.h b/src/audio/midi/juce_MidiMessage.h index fea4f2d667..61b3bb605f 100644 --- a/src/audio/midi/juce_MidiMessage.h +++ b/src/audio/midi/juce_MidiMessage.h @@ -90,6 +90,12 @@ public: int& numBytesUsed, uint8 lastStatusByte, double timeStamp = 0); + /** Creates an active-sense message. + Since the MidiMessage has to contain a valid message, this default constructor + just initialises it with a simple one-byte active-sense message. + */ + MidiMessage() throw(); + /** Creates a copy of another midi message. */ MidiMessage (const MidiMessage& other); diff --git a/src/containers/juce_ValueTree.cpp b/src/containers/juce_ValueTree.cpp index d55e7409b3..3213260231 100644 --- a/src/containers/juce_ValueTree.cpp +++ b/src/containers/juce_ValueTree.cpp @@ -43,8 +43,6 @@ public: { } - ~SetPropertyAction() {} - bool perform() { jassert (! (isAddingNewProperty && target->hasProperty (name))); @@ -112,8 +110,6 @@ public: jassert (child != 0); } - ~AddOrRemoveChildAction() {} - bool perform() { if (isDeleting) @@ -166,8 +162,6 @@ public: { } - ~MoveChildAction() {} - bool perform() { parent->moveChild (startIndex, endIndex, 0); @@ -373,7 +367,7 @@ ValueTree ValueTree::SharedObject::getChildWithName (const Identifier& typeToMat { for (int i = 0; i < children.size(); ++i) if (children.getUnchecked(i)->type == typeToMatch) - return ValueTree (static_cast (children.getUnchecked(i))); + return ValueTree (children.getUnchecked(i).getObject()); return ValueTree::invalid; } @@ -382,7 +376,7 @@ ValueTree ValueTree::SharedObject::getOrCreateChildWithName (const Identifier& t { for (int i = 0; i < children.size(); ++i) if (children.getUnchecked(i)->type == typeToMatch) - return ValueTree (static_cast (children.getUnchecked(i))); + return ValueTree (children.getUnchecked(i).getObject()); SharedObject* const newObject = new SharedObject (typeToMatch); addChild (newObject, -1, undoManager); @@ -394,7 +388,7 @@ ValueTree ValueTree::SharedObject::getChildWithProperty (const Identifier& prope { for (int i = 0; i < children.size(); ++i) if (children.getUnchecked(i)->getProperty (propertyName) == propertyValue) - return ValueTree (static_cast (children.getUnchecked(i))); + return ValueTree (children.getUnchecked(i).getObject()); return ValueTree::invalid; } @@ -635,7 +629,7 @@ ValueTree ValueTree::getSibling (const int delta) const return invalid; const int index = object->parent->indexOf (*this) + delta; - return ValueTree (static_cast (object->parent->children [index])); + return ValueTree (object->parent->children [index].getObject()); } const var& ValueTree::operator[] (const Identifier& name) const diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h index 4148e29580..fd50dd9b87 100644 --- a/src/core/juce_StandardHeader.h +++ b/src/core/juce_StandardHeader.h @@ -33,7 +33,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 53 -#define JUCE_BUILDNUMBER 9 +#define JUCE_BUILDNUMBER 10 /** Current Juce version number. diff --git a/src/gui/components/controls/juce_Toolbar.cpp b/src/gui/components/controls/juce_Toolbar.cpp index 35bd0e5fb9..13d8c36f87 100644 --- a/src/gui/components/controls/juce_Toolbar.cpp +++ b/src/gui/components/controls/juce_Toolbar.cpp @@ -32,7 +32,6 @@ BEGIN_JUCE_NAMESPACE #include "juce_ToolbarItemFactory.h" #include "juce_ToolbarItemPalette.h" #include "../menus/juce_PopupMenu.h" -#include "../menus/juce_PopupMenuCustomComponent.h" #include "../lookandfeel/juce_LookAndFeel.h" #include "../layout/juce_StretchableObjectResizer.h" #include "../windows/juce_DialogWindow.h" @@ -169,11 +168,11 @@ private: }; //============================================================================== -class Toolbar::MissingItemsComponent : public PopupMenuCustomComponent +class Toolbar::MissingItemsComponent : public PopupMenu::CustomComponent { public: MissingItemsComponent (Toolbar& owner_, const int height_) - : PopupMenuCustomComponent (true), + : PopupMenu::CustomComponent (true), owner (&owner_), height (height_) { diff --git a/src/gui/components/menus/juce_PopupMenu.cpp b/src/gui/components/menus/juce_PopupMenu.cpp index 2ba4c9a039..fb37eb91cd 100644 --- a/src/gui/components/menus/juce_PopupMenu.cpp +++ b/src/gui/components/menus/juce_PopupMenu.cpp @@ -28,7 +28,6 @@ BEGIN_JUCE_NAMESPACE #include "juce_PopupMenu.h" -#include "juce_PopupMenuCustomComponent.h" #include "../windows/juce_ComponentPeer.h" #include "../lookandfeel/juce_LookAndFeel.h" #include "../juce_Desktop.h" @@ -57,7 +56,7 @@ public: const Image& im, const Colour& textColour_, const bool usesColour_, - PopupMenuCustomComponent* const customComp_, + CustomComponent* const customComp_, const PopupMenu* const subMenu_, ApplicationCommandManager* const commandManager_) : itemId (itemId_), text (text_), textColour (textColour_), @@ -120,7 +119,7 @@ public: const Colour textColour; const bool active, isSeparator, isTicked, usesColour; Image image; - ReferenceCountedObjectPtr customComp; + ReferenceCountedObjectPtr customComp; ScopedPointer subMenu; ApplicationCommandManager* const commandManager; @@ -155,22 +154,15 @@ public: removeChildComponent (itemInfo.customComp); } - void getIdealSize (int& idealWidth, - int& idealHeight, - const int standardItemHeight) + void getIdealSize (int& idealWidth, int& idealHeight, const int standardItemHeight) { if (itemInfo.customComp != 0) - { itemInfo.customComp->getIdealSize (idealWidth, idealHeight); - } else - { getLookAndFeel().getIdealPopupMenuItemSize (itemInfo.text, itemInfo.isSeparator, standardItemHeight, - idealWidth, - idealHeight); - } + idealWidth, idealHeight); } void paint (Graphics& g) @@ -215,10 +207,7 @@ public: isHighlighted = shouldBeHighlighted; if (itemInfo.customComp != 0) - { - itemInfo.customComp->isHighlighted = shouldBeHighlighted; - itemInfo.customComp->repaint(); - } + itemInfo.customComp->setHighlighted (shouldBeHighlighted); repaint(); } @@ -1126,9 +1115,7 @@ private: && (isOver || (activeSubMenu == 0) || ! activeSubMenu->isVisible())) { if (isOver && (c != 0) && (activeSubMenu != 0)) - { activeSubMenu->hide (0, true); - } if (! isOver) mic = 0; @@ -1143,7 +1130,7 @@ private: if (currentChild != 0 && currentChild->itemInfo.canBeTriggered() && (currentChild->itemInfo.customComp == 0 - || currentChild->itemInfo.customComp->isTriggeredAutomatically)) + || currentChild->itemInfo.customComp->isTriggeredAutomatically())) { dismissMenu (¤tChild->itemInfo); } @@ -1294,8 +1281,7 @@ void PopupMenu::addColouredItem (const int itemResultId, } //============================================================================== -void PopupMenu::addCustomItem (const int itemResultId, - PopupMenuCustomComponent* const customComponent) +void PopupMenu::addCustomItem (const int itemResultId, CustomComponent* const customComponent) { jassert (itemResultId != 0); // 0 is used as a return value to indicate that the user // didn't pick anything, so you shouldn't use it as the id @@ -1307,19 +1293,17 @@ void PopupMenu::addCustomItem (const int itemResultId, Colours::black, false, customComponent, 0, 0)); } -class NormalComponentWrapper : public PopupMenuCustomComponent +class NormalComponentWrapper : public PopupMenu::CustomComponent { public: NormalComponentWrapper (Component* const comp, const int w, const int h, const bool triggerMenuItemAutomaticallyWhenClicked) - : PopupMenuCustomComponent (triggerMenuItemAutomaticallyWhenClicked), + : PopupMenu::CustomComponent (triggerMenuItemAutomaticallyWhenClicked), width (w), height (h) { addAndMakeVisible (comp); } - ~NormalComponentWrapper() {} - void getIdealSize (int& idealWidth, int& idealHeight) { idealWidth = width; @@ -1368,11 +1352,11 @@ void PopupMenu::addSeparator() //============================================================================== -class HeaderItemComponent : public PopupMenuCustomComponent +class HeaderItemComponent : public PopupMenu::CustomComponent { public: HeaderItemComponent (const String& name) - : PopupMenuCustomComponent (false) + : PopupMenu::CustomComponent (false) { setName (name); } @@ -1389,8 +1373,7 @@ public: Justification::bottomLeft, 1); } - void getIdealSize (int& idealWidth, - int& idealHeight) + void getIdealSize (int& idealWidth, int& idealHeight) { getLookAndFeel().getIdealPopupMenuItemSize (getName(), false, -1, idealWidth, idealHeight); idealHeight += idealHeight / 2; @@ -1596,17 +1579,23 @@ void PopupMenu::setLookAndFeel (LookAndFeel* const newLookAndFeel) } //============================================================================== -PopupMenuCustomComponent::PopupMenuCustomComponent (const bool isTriggeredAutomatically_) +PopupMenu::CustomComponent::CustomComponent (const bool isTriggeredAutomatically_) : isHighlighted (false), - isTriggeredAutomatically (isTriggeredAutomatically_) + triggeredAutomatically (isTriggeredAutomatically_) +{ +} + +PopupMenu::CustomComponent::~CustomComponent() { } -PopupMenuCustomComponent::~PopupMenuCustomComponent() +void PopupMenu::CustomComponent::setHighlighted (bool shouldBeHighlighted) { + isHighlighted = shouldBeHighlighted; + repaint(); } -void PopupMenuCustomComponent::triggerMenuItem() +void PopupMenu::CustomComponent::triggerMenuItem() { PopupMenu::ItemComponent* const mic = dynamic_cast (getParentComponent()); @@ -1667,7 +1656,7 @@ bool PopupMenu::MenuItemIterator::next() isSeparator = item->isSeparator; isTicked = item->isTicked; isEnabled = item->active; - isSectionHeader = dynamic_cast (static_cast (item->customComp)) != 0; + isSectionHeader = dynamic_cast (static_cast (item->customComp)) != 0; isCustomComponent = (! isSectionHeader) && item->customComp != 0; customColour = item->usesColour ? &(item->textColour) : 0; customImage = item->image; diff --git a/src/gui/components/menus/juce_PopupMenu.h b/src/gui/components/menus/juce_PopupMenu.h index 4984797769..5eda5da085 100644 --- a/src/gui/components/menus/juce_PopupMenu.h +++ b/src/gui/components/menus/juce_PopupMenu.h @@ -27,7 +27,7 @@ #define __JUCE_POPUPMENU_JUCEHEADER__ #include "../../../application/juce_ApplicationCommandManager.h" -class PopupMenuCustomComponent; +#include "../../../memory/juce_ReferenceCountedObject.h" //============================================================================== @@ -147,19 +147,10 @@ public: bool isTicked = false, const Image& iconToUse = Image::null); - /** Appends a custom menu item. - - This will add a user-defined component to use as a menu item. The component - passed in will be deleted by this menu when it's no longer needed. - - @see PopupMenuCustomComponent - */ - void addCustomItem (int itemResultId, PopupMenuCustomComponent* customComponent); - /** Appends a custom menu item that can't be used to trigger a result. This will add a user-defined component to use as a menu item. Unlike the - addCustomItem() method that takes a PopupMenuCustomComponent, this version + addCustomItem() method that takes a PopupMenu::CustomComponent, this version can't trigger a result from it, so doesn't take a menu ID. It also doesn't delete the component when it's finished, so it's the caller's responsibility to manage the component that is passed-in. @@ -169,7 +160,7 @@ public: menu ID specified in itemResultId. If this is false, the menu item can't be triggered, so itemResultId is not used. - @see PopupMenuCustomComponent + @see CustomComponent */ void addCustomItem (int itemResultId, Component* customComponent, @@ -378,6 +369,64 @@ public: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MenuItemIterator); }; + //============================================================================== + /** A user-defined copmonent that can be used as an item in a popup menu. + @see PopupMenu::addCustomItem + */ + class JUCE_API CustomComponent : public Component, + public ReferenceCountedObject + { + public: + /** Creates a custom item. + If isTriggeredAutomatically is true, then the menu will automatically detect + a mouse-click on this component and use that to invoke the menu item. If it's + false, then it's up to your class to manually trigger the item when it wants to. + */ + CustomComponent (bool isTriggeredAutomatically = true); + + /** Destructor. */ + ~CustomComponent(); + + /** Returns a rectangle with the size that this component would like to have. + + Note that the size which this method returns isn't necessarily the one that + the menu will give it, as the items will be stretched to have a uniform width. + */ + virtual void getIdealSize (int& idealWidth, int& idealHeight) = 0; + + /** Dismisses the menu, indicating that this item has been chosen. + + This will cause the menu to exit from its modal state, returning + this item's id as the result. + */ + void triggerMenuItem(); + + /** Returns true if this item should be highlighted because the mouse is over it. + You can call this method in your paint() method to find out whether + to draw a highlight. + */ + bool isItemHighlighted() const throw() { return isHighlighted; } + + /** @internal. */ + bool isTriggeredAutomatically() const throw() { return triggeredAutomatically; } + /** @internal. */ + void setHighlighted (bool shouldBeHighlighted); + + private: + //============================================================================== + bool isHighlighted, triggeredAutomatically; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CustomComponent); + }; + + /** Appends a custom menu item. + + This will add a user-defined component to use as a menu item. The component + passed in will be deleted by this menu when it's no longer needed. + + @see CustomComponent + */ + void addCustomItem (int itemResultId, CustomComponent* customComponent); private: //============================================================================== @@ -388,7 +437,7 @@ private: friend class MenuItemIterator; friend class ItemComponent; friend class Window; - friend class PopupMenuCustomComponent; + friend class CustomComponent; friend class MenuBarComponent; friend class OwnedArray ; friend class OwnedArray ; diff --git a/src/gui/components/menus/juce_PopupMenuCustomComponent.h b/src/gui/components/menus/juce_PopupMenuCustomComponent.h deleted file mode 100644 index 500c6990fb..0000000000 --- a/src/gui/components/menus/juce_PopupMenuCustomComponent.h +++ /dev/null @@ -1,91 +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_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__ -#define __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__ - -#include "juce_PopupMenu.h" -#include "../juce_Component.h" -#include "../../../memory/juce_ReferenceCountedObject.h" - - -//============================================================================== -/** A user-defined copmonent that can appear inside one of the rows of a popup menu. - - @see PopupMenu::addCustomItem -*/ -class JUCE_API PopupMenuCustomComponent : public Component, - public ReferenceCountedObject -{ -public: - /** Destructor. */ - ~PopupMenuCustomComponent(); - - /** Chooses the size that this component would like to have. - - Note that the size which this method returns isn't necessarily the one that - the menu will give it, as it will be stretched to fit the other items in - the menu. - */ - virtual void getIdealSize (int& idealWidth, - int& idealHeight) = 0; - - /** Dismisses the menu indicating that this item has been chosen. - - This will cause the menu to exit from its modal state, returning - this item's id as the result. - */ - void triggerMenuItem(); - - /** Returns true if this item should be highlighted because the mouse is - over it. - - You can call this method in your paint() method to find out whether - to draw a highlight. - */ - bool isItemHighlighted() const throw() { return isHighlighted; } - -protected: - /** Constructor. - - If isTriggeredAutomatically is true, then the menu will automatically detect - a click on this component and use that to trigger it. If it's false, then it's - up to your class to manually trigger the item if it wants to. - */ - PopupMenuCustomComponent (bool isTriggeredAutomatically = true); - - -private: - friend class PopupMenu; - friend class PopupMenu::ItemComponent; - friend class PopupMenu::Window; - bool isHighlighted, isTriggeredAutomatically; - - JUCE_DECLARE_NON_COPYABLE (PopupMenuCustomComponent); -}; - - - -#endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__ diff --git a/src/gui/components/mouse/juce_DragAndDropContainer.cpp b/src/gui/components/mouse/juce_DragAndDropContainer.cpp index f47390b737..8c8b47e46d 100644 --- a/src/gui/components/mouse/juce_DragAndDropContainer.cpp +++ b/src/gui/components/mouse/juce_DragAndDropContainer.cpp @@ -286,7 +286,7 @@ private: WeakReference currentlyOverComp; DragAndDropTarget* getCurrentlyOver() { - return dynamic_cast (static_cast (currentlyOverComp)); + return dynamic_cast (currentlyOverComp.get()); } String dragDesc; diff --git a/src/gui/components/mouse/juce_MouseHoverDetector.cpp b/src/gui/components/mouse/juce_MouseHoverDetector.cpp deleted file mode 100644 index 88e1221580..0000000000 --- a/src/gui/components/mouse/juce_MouseHoverDetector.cpp +++ /dev/null @@ -1,146 +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_Component.h" -#include "juce_MouseHoverDetector.h" -#include "juce_MouseEvent.h" - - -//============================================================================== -MouseHoverDetector::MouseHoverDetector (const int hoverTimeMillisecs_) - : source (0), - hoverTimeMillisecs (hoverTimeMillisecs_), - hasJustHovered (false) -{ - internalTimer.owner = this; -} - -MouseHoverDetector::~MouseHoverDetector() -{ - setHoverComponent (0); -} - -void MouseHoverDetector::setHoverTimeMillisecs (const int newTimeInMillisecs) -{ - hoverTimeMillisecs = newTimeInMillisecs; -} - -void MouseHoverDetector::setHoverComponent (Component* const newSourceComponent) -{ - if (source != newSourceComponent) - { - internalTimer.stopTimer(); - hasJustHovered = false; - - if (source != 0) - source->removeMouseListener (&internalTimer); - - source = newSourceComponent; - - if (newSourceComponent != 0) - newSourceComponent->addMouseListener (&internalTimer, false); - } -} - -void MouseHoverDetector::hoverTimerCallback() -{ - internalTimer.stopTimer(); - - if (source != 0) - { - const Point pos (source->getMouseXYRelative()); - - if (source->reallyContains (pos, false)) - { - hasJustHovered = true; - mouseHovered (pos.getX(), pos.getY()); - } - } -} - -void MouseHoverDetector::checkJustHoveredCallback() -{ - if (hasJustHovered) - { - hasJustHovered = false; - mouseMovedAfterHover(); - } -} - -//============================================================================== -void MouseHoverDetector::HoverDetectorInternal::timerCallback() -{ - owner->hoverTimerCallback(); -} - -void MouseHoverDetector::HoverDetectorInternal::mouseEnter (const MouseEvent&) -{ - stopTimer(); - owner->checkJustHoveredCallback(); -} - -void MouseHoverDetector::HoverDetectorInternal::mouseExit (const MouseEvent&) -{ - stopTimer(); - owner->checkJustHoveredCallback(); -} - -void MouseHoverDetector::HoverDetectorInternal::mouseDown (const MouseEvent&) -{ - stopTimer(); - owner->checkJustHoveredCallback(); -} - -void MouseHoverDetector::HoverDetectorInternal::mouseUp (const MouseEvent&) -{ - stopTimer(); - owner->checkJustHoveredCallback(); -} - -void MouseHoverDetector::HoverDetectorInternal::mouseMove (const MouseEvent& e) -{ - if (lastX != e.x || lastY != e.y) // to avoid fake mouse-moves setting it off - { - lastX = e.x; - lastY = e.y; - - if (owner->source != 0) - startTimer (owner->hoverTimeMillisecs); - - owner->checkJustHoveredCallback(); - } -} - -void MouseHoverDetector::HoverDetectorInternal::mouseWheelMove (const MouseEvent&, float, float) -{ - stopTimer(); - owner->checkJustHoveredCallback(); -} - -END_JUCE_NAMESPACE diff --git a/src/gui/components/mouse/juce_MouseHoverDetector.h b/src/gui/components/mouse/juce_MouseHoverDetector.h deleted file mode 100644 index 2abe8c66f9..0000000000 --- a/src/gui/components/mouse/juce_MouseHoverDetector.h +++ /dev/null @@ -1,130 +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_MOUSEHOVERDETECTOR_JUCEHEADER__ -#define __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__ - -#include "juce_MouseListener.h" -#include "../../../events/juce_Timer.h" - - -//============================================================================== -/** - Monitors a component for mouse activity, and triggers a callback - when the mouse hovers in one place for a specified length of time. - - To use a hover-detector, just create one and call its setHoverComponent() - method to start it watching a component. You can call setHoverComponent (0) - to make it inactive. - - (Be careful not to delete a component that's being monitored without first - stopping or deleting the hover detector). -*/ -class JUCE_API MouseHoverDetector -{ -public: - //============================================================================== - /** Creates a hover detector. - - Initially the object is inactive, and you need to tell it which component - to monitor, using the setHoverComponent() method. - - @param hoverTimeMillisecs the number of milliseconds for which the mouse - needs to stay still before the mouseHovered() method - is invoked. You can change this setting later with - the setHoverTimeMillisecs() method - */ - MouseHoverDetector (int hoverTimeMillisecs = 400); - - /** Destructor. */ - virtual ~MouseHoverDetector(); - - //============================================================================== - /** Changes the time for which the mouse has to stay still before it's considered - to be hovering. - */ - void setHoverTimeMillisecs (int newTimeInMillisecs); - - /** Changes the component that's being monitored for hovering. - - Be careful not to delete a component that's being monitored without first - stopping or deleting the hover detector. - */ - void setHoverComponent (Component* newSourceComponent); - - -protected: - //============================================================================== - /** Called back when the mouse hovers. - - After the mouse has stayed still over the component for the length of time - specified by setHoverTimeMillisecs(), this method will be invoked. - - When the mouse is first moved after this callback has occurred, the - mouseMovedAfterHover() method will be called. - - @param mouseX the mouse's X position relative to the component being monitored - @param mouseY the mouse's Y position relative to the component being monitored - */ - virtual void mouseHovered (int mouseX, - int mouseY) = 0; - - /** Called when the mouse is moved away after just having hovered. */ - virtual void mouseMovedAfterHover() = 0; - - - -private: - //============================================================================== - class JUCE_API HoverDetectorInternal : public MouseListener, - public Timer - { - public: - MouseHoverDetector* owner; - int lastX, lastY; - - void timerCallback(); - void mouseEnter (const MouseEvent&); - void mouseExit (const MouseEvent&); - void mouseDown (const MouseEvent&); - void mouseUp (const MouseEvent&); - void mouseMove (const MouseEvent&); - void mouseWheelMove (const MouseEvent&, float, float); - - } internalTimer; - - friend class HoverDetectorInternal; - - Component* source; - int hoverTimeMillisecs; - bool hasJustHovered; - - void hoverTimerCallback(); - void checkJustHoveredCallback(); - - JUCE_DECLARE_NON_COPYABLE (MouseHoverDetector); -}; - -#endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__ diff --git a/src/gui/components/mouse/juce_MouseInputSource.h b/src/gui/components/mouse/juce_MouseInputSource.h index 2ccff5d5cc..9e9497bcad 100644 --- a/src/gui/components/mouse/juce_MouseInputSource.h +++ b/src/gui/components/mouse/juce_MouseInputSource.h @@ -26,14 +26,12 @@ #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__ #define __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__ -class Component; -class ComponentPeer; -class MouseInputSourceInternal; #include "../keyboard/juce_ModifierKeys.h" #include "../../../core/juce_Time.h" #include "../../../memory/juce_ScopedPointer.h" #include "../../graphics/geometry/juce_Point.h" #include "../juce_Desktop.h" +class MouseInputSourceInternal; //============================================================================== @@ -132,12 +130,22 @@ public: */ bool hasMouseMovedSignificantlySincePressed() const throw(); + /** Returns true if this input source uses a visible mouse cursor. */ bool hasMouseCursor() const throw(); + + /** Changes the mouse cursor, (if there is one). */ void showMouseCursor (const MouseCursor& cursor); + + /** Hides the mouse cursor (if there is one). */ void hideCursor(); + + /** Un-hides the mouse cursor if it was hidden by hideCursor(). */ void revealCursor(); + + /** Forces an update of the mouse cursor for whatever component it's currently over. */ void forceMouseCursorUpdate(); + /** Returns true if this mouse can be moved indefinitely in any direction without running out of space. */ bool canDoUnboundedMovement() const throw(); /** Allows the mouse to move beyond the edges of the screen. diff --git a/src/gui/components/positioning/juce_MarkerList.cpp b/src/gui/components/positioning/juce_MarkerList.cpp index cbc5296ccd..12cf0f2417 100644 --- a/src/gui/components/positioning/juce_MarkerList.cpp +++ b/src/gui/components/positioning/juce_MarkerList.cpp @@ -257,12 +257,12 @@ public: const Expression getSymbolValue (const String& objectName, const String& member) const { - if (member.isNotEmpty()) + if (member.isEmpty()) { const MarkerList::Marker* const marker = markerList.getMarker (objectName); if (marker != 0) - return Expression ((double) marker->position.resolve (this)); + return Expression (marker->position.resolve (this)); } else if (parentComponent != 0 && objectName == RelativeCoordinate::Strings::parent) { diff --git a/src/gui/components/special/juce_MagnifierComponent.cpp b/src/gui/components/special/juce_MagnifierComponent.cpp deleted file mode 100644 index afe2cf7739..0000000000 --- a/src/gui/components/special/juce_MagnifierComponent.cpp +++ /dev/null @@ -1,339 +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_MagnifierComponent.h" -#include "../../graphics/imaging/juce_Image.h" -#include "../windows/juce_ComponentPeer.h" - - -//============================================================================== -class MagnifyingPeer : public ComponentPeer -{ -public: - //============================================================================== - MagnifyingPeer (Component* const component_, - MagnifierComponent* const magnifierComp_) - : ComponentPeer (component_, 0), - magnifierComp (magnifierComp_) - { - } - - ~MagnifyingPeer() - { - } - - //============================================================================== - void* getNativeHandle() const { return 0; } - void setVisible (bool) {} - void setTitle (const String&) {} - void setPosition (int, int) {} - void setSize (int, int) {} - void setBounds (int, int, int, int, bool) {} - void setMinimised (bool) {} - void setAlpha (float /*newAlpha*/) {} - bool isMinimised() const { return false; } - void setFullScreen (bool) {} - bool isFullScreen() const { return false; } - const BorderSize getFrameSize() const { return BorderSize (0); } - bool setAlwaysOnTop (bool) { return true; } - void toFront (bool) {} - void toBehind (ComponentPeer*) {} - void setIcon (const Image&) {} - - bool isFocused() const - { - return magnifierComp->hasKeyboardFocus (true); - } - - void grabFocus() - { - ComponentPeer* peer = magnifierComp->getPeer(); - if (peer != 0) - peer->grabFocus(); - } - - void textInputRequired (const Point& position) - { - ComponentPeer* peer = magnifierComp->getPeer(); - if (peer != 0) - peer->textInputRequired (position); - } - - const Rectangle getBounds() const - { - return Rectangle (magnifierComp->getScreenX(), magnifierComp->getScreenY(), - component->getWidth(), component->getHeight()); - } - - const Point getScreenPosition() const - { - return magnifierComp->getScreenPosition(); - } - - const Point localToGlobal (const Point& relativePosition) - { - const double zoom = magnifierComp->getScaleFactor(); - return magnifierComp->localPointToGlobal (Point (roundToInt (relativePosition.getX() * zoom), - roundToInt (relativePosition.getY() * zoom))); - } - - const Point globalToLocal (const Point& screenPosition) - { - const Point p (magnifierComp->getLocalPoint (0, screenPosition)); - const double zoom = magnifierComp->getScaleFactor(); - - return Point (roundToInt (p.getX() / zoom), - roundToInt (p.getY() / zoom)); - } - - bool contains (const Point& position, bool) const - { - return isPositiveAndBelow (position.getX(), magnifierComp->getWidth()) - && isPositiveAndBelow (position.getY(), magnifierComp->getHeight()); - } - - void repaint (const Rectangle& area) - { - const double zoom = magnifierComp->getScaleFactor(); - - magnifierComp->repaint ((int) (area.getX() * zoom), - (int) (area.getY() * zoom), - roundToInt (area.getWidth() * zoom) + 1, - roundToInt (area.getHeight() * zoom) + 1); - } - - void performAnyPendingRepaintsNow() - { - } - - //============================================================================== -private: - MagnifierComponent* const magnifierComp; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MagnifyingPeer); -}; - - -//============================================================================== -class PeerHolderComp : public Component -{ -public: - PeerHolderComp (MagnifierComponent* const magnifierComp_) - : magnifierComp (magnifierComp_) - { - setVisible (true); - } - - ~PeerHolderComp() - { - } - - ComponentPeer* createNewPeer (int, void*) - { - return new MagnifyingPeer (this, magnifierComp); - } - - void childBoundsChanged (Component* c) - { - if (c != 0) - { - setSize (c->getWidth(), c->getHeight()); - magnifierComp->childBoundsChanged (this); - } - } - - void mouseWheelMove (const MouseEvent& e, float ix, float iy) - { - // unhandled mouse wheel moves can be referred upwards to the parent comp.. - Component* const p = magnifierComp->getParentComponent(); - - if (p != 0) - p->mouseWheelMove (e.getEventRelativeTo (p), ix, iy); - } - -private: - MagnifierComponent* const magnifierComp; - - JUCE_DECLARE_NON_COPYABLE (PeerHolderComp); -}; - - -//============================================================================== -MagnifierComponent::MagnifierComponent (Component* const content_, - const bool deleteContentCompWhenNoLongerNeeded) - : content (content_), - scaleFactor (0.0), - peer (0), - deleteContent (deleteContentCompWhenNoLongerNeeded), - quality (Graphics::lowResamplingQuality), - mouseSource (0, true) -{ - holderComp = new PeerHolderComp (this); - setScaleFactor (1.0); -} - -MagnifierComponent::~MagnifierComponent() -{ - delete holderComp; - - if (deleteContent) - delete content; -} - -void MagnifierComponent::setScaleFactor (double newScaleFactor) -{ - jassert (newScaleFactor > 0.0); // hmm - unlikely to work well with a negative scale factor - - newScaleFactor = jlimit (1.0 / 8.0, 1000.0, newScaleFactor); - - if (scaleFactor != newScaleFactor) - { - scaleFactor = newScaleFactor; - - if (scaleFactor == 1.0) - { - holderComp->removeFromDesktop(); - peer = 0; - addChildComponent (content); - childBoundsChanged (content); - } - else - { - holderComp->addAndMakeVisible (content); - holderComp->childBoundsChanged (content); - childBoundsChanged (holderComp); - holderComp->addToDesktop (0); - peer = holderComp->getPeer(); - } - - repaint(); - } -} - -void MagnifierComponent::setResamplingQuality (Graphics::ResamplingQuality newQuality) -{ - quality = newQuality; -} - -void MagnifierComponent::paint (Graphics& g) -{ - const int w = holderComp->getWidth(); - const int h = holderComp->getHeight(); - - if (w == 0 || h == 0) - return; - - const Rectangle r (g.getClipBounds()); - - const int srcX = (int) (r.getX() / scaleFactor); - const int srcY = (int) (r.getY() / scaleFactor); - int srcW = roundToInt (r.getRight() / scaleFactor) - srcX; - int srcH = roundToInt (r.getBottom() / scaleFactor) - srcY; - - if (scaleFactor >= 1.0) - { - ++srcW; - ++srcH; - } - - Image temp (Image::ARGB, jmax (w, srcX + srcW), jmax (h, srcY + srcH), false); - const Rectangle area (srcX, srcY, srcW, srcH); - temp.clear (area); - - { - Graphics g2 (temp); - g2.reduceClipRegion (area); - holderComp->paintEntireComponent (g2, false); - } - - g.setImageResamplingQuality (quality); - g.drawImageTransformed (temp, AffineTransform::scale ((float) scaleFactor, (float) scaleFactor), false); -} - -void MagnifierComponent::childBoundsChanged (Component* c) -{ - if (c != 0) - setSize (roundToInt (c->getWidth() * scaleFactor), - roundToInt (c->getHeight() * scaleFactor)); -} - -void MagnifierComponent::passOnMouseEventToPeer (const MouseEvent& e) -{ - if (peer != 0) - mouseSource.handleEvent (peer, Point (scaleInt (e.x), scaleInt (e.y)), - e.eventTime.toMilliseconds(), ModifierKeys::getCurrentModifiers()); -} - -void MagnifierComponent::mouseDown (const MouseEvent& e) -{ - passOnMouseEventToPeer (e); -} - -void MagnifierComponent::mouseUp (const MouseEvent& e) -{ - passOnMouseEventToPeer (e); -} - -void MagnifierComponent::mouseDrag (const MouseEvent& e) -{ - passOnMouseEventToPeer (e); -} - -void MagnifierComponent::mouseMove (const MouseEvent& e) -{ - passOnMouseEventToPeer (e); -} - -void MagnifierComponent::mouseEnter (const MouseEvent& e) -{ - passOnMouseEventToPeer (e); -} - -void MagnifierComponent::mouseExit (const MouseEvent& e) -{ - passOnMouseEventToPeer (e); -} - -void MagnifierComponent::mouseWheelMove (const MouseEvent& e, float ix, float iy) -{ - if (peer != 0) - peer->handleMouseWheel (e.source.getIndex(), - Point (scaleInt (e.x), scaleInt (e.y)), e.eventTime.toMilliseconds(), - ix * 256.0f, iy * 256.0f); - else - Component::mouseWheelMove (e, ix, iy); -} - -int MagnifierComponent::scaleInt (const int n) const -{ - return roundToInt (n / scaleFactor); -} - - -END_JUCE_NAMESPACE diff --git a/src/gui/components/special/juce_MagnifierComponent.h b/src/gui/components/special/juce_MagnifierComponent.h deleted file mode 100644 index 19c13d6ff3..0000000000 --- a/src/gui/components/special/juce_MagnifierComponent.h +++ /dev/null @@ -1,121 +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_MAGNIFIERCOMPONENT_JUCEHEADER__ -#define __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__ - -#include "../juce_Component.h" -#include "../mouse/juce_MouseInputSource.h" - - -//============================================================================== -/** - A component that contains another component, and can magnify or shrink it. - - This component will continually update its size so that it fits the zoomed - version of the content component that you put inside it, so don't try to - change the size of this component directly - instead change that of the - content component. - - To make it all work, the magnifier uses extremely cunning ComponentPeer tricks - to remap mouse events correctly. This means that the content component won't - appear to be a direct child of this component, and instead will think its - on the desktop. -*/ -class JUCE_API MagnifierComponent : public Component -{ -public: - //============================================================================== - /** Creates a MagnifierComponent. - - This component will continually update its size so that it fits the zoomed - version of the content component that you put inside it, so don't try to - change the size of this component directly - instead change that of the - content component. - - @param contentComponent the component to add as the magnified one - @param deleteContentCompWhenNoLongerNeeded if true, the content component will - be deleted when this component is deleted. If false, - it's the caller's responsibility to delete it later. - */ - MagnifierComponent (Component* contentComponent, - bool deleteContentCompWhenNoLongerNeeded); - - /** Destructor. */ - ~MagnifierComponent(); - - //============================================================================== - /** Returns the current content component. */ - Component* getContentComponent() const { return content; } - - //============================================================================== - /** Changes the zoom level. - - The scale factor must be greater than zero. Values less than 1 will shrink the - image; values greater than 1 will multiply its size by this amount. - - When this is called, this component will change its size to fit the full extent - of the newly zoomed content. - */ - void setScaleFactor (double newScaleFactor); - - /** Returns the current zoom factor. */ - double getScaleFactor() const { return scaleFactor; } - - /** Changes the quality setting used to rescale the graphics. - */ - void setResamplingQuality (Graphics::ResamplingQuality newQuality); - - //============================================================================== - /** @internal */ - void childBoundsChanged (Component*); - -private: - Component* content; - Component* holderComp; - double scaleFactor; - ComponentPeer* peer; - bool deleteContent; - Graphics::ResamplingQuality quality; - MouseInputSource mouseSource; - - //============================================================================== - void paint (Graphics& g); - void mouseDown (const MouseEvent& e); - void mouseUp (const MouseEvent& e); - void mouseDrag (const MouseEvent& e); - void mouseMove (const MouseEvent& e); - void mouseEnter (const MouseEvent& e); - void mouseExit (const MouseEvent& e); - void mouseWheelMove (const MouseEvent& e, float, float); - - void passOnMouseEventToPeer (const MouseEvent& e); - int scaleInt (int n) const; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MagnifierComponent); -}; - - -#endif // __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__ diff --git a/src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp b/src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp index 4581377e59..a4f74f64e2 100644 --- a/src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp +++ b/src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp @@ -650,7 +650,7 @@ public: } y = y_; - generate (static_cast (scratchBuffer), x, width); + generate (scratchBuffer.getData(), x, width); et.clipLineToMask (x, y_, reinterpret_cast (scratchBuffer.getData()) + SrcPixelType::indexA, diff --git a/src/juce_app_includes.h b/src/juce_app_includes.h index 722b3cd111..8d7e46f0d6 100644 --- a/src/juce_app_includes.h +++ b/src/juce_app_includes.h @@ -482,9 +482,6 @@ #ifndef __JUCE_POPUPMENU_JUCEHEADER__ #include "gui/components/menus/juce_PopupMenu.h" #endif -#ifndef __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__ - #include "gui/components/menus/juce_PopupMenuCustomComponent.h" -#endif #ifndef __JUCE_COMPONENTDRAGGER_JUCEHEADER__ #include "gui/components/mouse/juce_ComponentDragger.h" #endif @@ -506,9 +503,6 @@ #ifndef __JUCE_MOUSEEVENT_JUCEHEADER__ #include "gui/components/mouse/juce_MouseEvent.h" #endif -#ifndef __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__ - #include "gui/components/mouse/juce_MouseHoverDetector.h" -#endif #ifndef __JUCE_MOUSEINPUTSOURCE_JUCEHEADER__ #include "gui/components/mouse/juce_MouseInputSource.h" #endif @@ -578,9 +572,6 @@ #ifndef __JUCE_DROPSHADOWER_JUCEHEADER__ #include "gui/components/special/juce_DropShadower.h" #endif -#ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__ - #include "gui/components/special/juce_MagnifierComponent.h" -#endif #ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__ #include "gui/components/special/juce_MidiKeyboardComponent.h" #endif diff --git a/src/native/windows/juce_win32_Midi.cpp b/src/native/windows/juce_win32_Midi.cpp index 5182fe6c15..dbd21b41f5 100644 --- a/src/native/windows/juce_win32_Midi.cpp +++ b/src/native/windows/juce_win32_Midi.cpp @@ -447,6 +447,8 @@ MidiOutput* MidiOutput::openDevice (int index) MidiOutput::~MidiOutput() { + stopBackgroundThread(); + MidiOutHandle* const h = static_cast (internal); if (MidiOutHandle::activeHandles.contains (h) && --(h->refCount) == 0)