From 952b8c394092791e241e2964fc8632380819d503 Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Mon, 29 Nov 2010 16:22:06 +0000 Subject: [PATCH] Updated ComponentDragger to handle transformed components (this required a change to its parameters). Tidied up some classes with the JUCE_DECLARE_NON_COPYABLE macro. Changed some 3rd-party include statements to use angle-bracket quotes. --- .../wrapper/RTAS/juce_RTAS_DigiCode1.cpp | 16 +- .../wrapper/RTAS/juce_RTAS_DigiCode2.cpp | 4 +- .../wrapper/RTAS/juce_RTAS_DigiCode3.cpp | 10 +- .../wrapper/RTAS/juce_RTAS_DigiCode_Header.h | 4 +- .../wrapper/RTAS/juce_RTAS_Wrapper.cpp | 21 +- .../wrapper/VST/juce_VST_Wrapper.cpp | 16 +- .../wrapper/juce_PluginHostType.h | 3 +- extras/juce demo/Source/demos/WidgetsDemo.cpp | 4 +- juce.h | 2 +- juce_amalgamated.cpp | 519 ++++++------------ juce_amalgamated.h | 353 +++++------- src/application/juce_Application.h | 3 +- .../juce_ApplicationCommandTarget.h | 3 +- .../juce_AudioFormatWriter.cpp | 3 +- .../juce_BufferingAudioSource.cpp | 3 +- src/audio/devices/juce_AudioIODeviceType.h | 3 +- src/audio/dsp/juce_AudioDataConverters.h | 6 +- src/audio/midi/juce_MidiBuffer.h | 3 +- .../plugins/formats/juce_VSTMidiEventList.h | 9 +- .../plugins/formats/juce_VSTPluginFormat.cpp | 4 +- .../processors/juce_AudioProcessorEditor.h | 3 +- .../processors/juce_AudioProcessorGraph.cpp | 21 +- src/containers/juce_ArrayAllocationBase.h | 3 +- src/containers/juce_Expression.cpp | 15 +- src/containers/juce_HeapBlock.h | 35 +- src/containers/juce_Value.cpp | 3 +- src/containers/juce_ValueTree.cpp | 9 +- src/containers/juce_ValueTree.h | 3 +- src/core/juce_ByteOrder.h | 4 +- src/core/juce_LeakedObjectDetector.h | 10 +- src/core/juce_Memory.h | 102 ++-- src/core/juce_PlatformUtilities.h | 7 +- src/core/juce_StandardHeader.h | 2 +- src/core/juce_SystemStats.cpp | 54 +- src/core/juce_SystemStats.h | 4 +- src/cryptography/juce_Primes.h | 4 +- src/events/juce_ActionBroadcaster.cpp | 7 +- src/events/juce_ActionBroadcaster.h | 3 +- src/events/juce_ChangeBroadcaster.h | 3 +- src/events/juce_ListenerList.h | 6 +- src/events/juce_MessageManager.cpp | 3 +- src/events/juce_MessageManager.h | 3 +- src/events/juce_Timer.cpp | 3 +- .../code_editor/juce_CodeDocument.cpp | 32 +- .../code_editor/juce_CodeEditorComponent.cpp | 9 +- src/gui/components/controls/juce_ComboBox.cpp | 3 +- .../controls/juce_TableHeaderComponent.cpp | 7 +- .../components/controls/juce_TextEditor.cpp | 47 +- src/gui/components/controls/juce_TreeView.cpp | 6 +- src/gui/components/juce_Component.cpp | 3 +- src/gui/components/juce_Component.h | 3 +- .../components/juce_ModalComponentManager.cpp | 6 +- .../components/juce_ModalComponentManager.h | 3 +- .../juce_KeyMappingEditorComponent.cpp | 3 +- .../components/layout/juce_GroupComponent.h | 3 +- .../layout/juce_TabbedButtonBar.cpp | 3 +- .../menus/juce_MenuBarComponent.cpp | 3 +- src/gui/components/menus/juce_PopupMenu.cpp | 3 +- .../menus/juce_PopupMenuCustomComponent.h | 3 +- .../mouse/juce_ComponentDragger.cpp | 13 +- .../components/mouse/juce_ComponentDragger.h | 19 +- .../mouse/juce_DragAndDropContainer.cpp | 3 +- .../mouse/juce_MouseHoverDetector.h | 3 +- .../mouse/juce_MouseInputSource.cpp | 3 +- .../properties/juce_PropertyPanel.cpp | 6 +- .../juce_AudioDeviceSelectorComponent.cpp | 6 +- .../special/juce_ColourSelector.cpp | 18 +- .../components/special/juce_DropShadower.cpp | 3 +- .../special/juce_MagnifierComponent.cpp | 3 +- .../special/juce_MidiKeyboardComponent.cpp | 3 +- .../components/windows/juce_AlertWindow.cpp | 10 +- .../components/windows/juce_DialogWindow.cpp | 3 +- .../windows/juce_ResizableWindow.cpp | 4 +- .../windows/juce_TopLevelWindow.cpp | 3 +- src/gui/graphics/colour/juce_Colours.h | 4 +- .../juce_LowLevelGraphicsSoftwareRenderer.cpp | 30 +- .../drawables/juce_DrawableComposite.cpp | 3 +- src/gui/graphics/geometry/juce_Path.h | 3 +- .../graphics/geometry/juce_RectangleList.h | 3 +- .../geometry/juce_RelativeCoordinate.h | 18 +- .../image_file_formats/juce_GIFLoader.cpp | 3 +- src/gui/graphics/imaging/juce_Image.cpp | 5 +- src/gui/graphics/imaging/juce_Image.h | 3 +- src/gui/graphics/imaging/juce_ImageCache.cpp | 3 +- src/gui/graphics/imaging/juce_ImageCache.h | 4 +- src/io/files/juce_ZipFile.cpp | 3 +- .../juce_GZIPCompressorOutputStream.cpp | 8 +- .../streams/juce_GZIPCompressorOutputStream.h | 16 +- .../juce_GZIPDecompressorInputStream.cpp | 3 +- src/native/common/juce_MidiDataConcatenator.h | 3 +- src/native/common/juce_posix_SharedCode.h | 3 +- src/native/linux/juce_linux_Files.cpp | 3 +- src/native/linux/juce_linux_Windowing.cpp | 3 +- src/native/mac/juce_iphone_Audio.cpp | 3 +- .../mac/juce_mac_CoreGraphicsContext.mm | 3 +- src/native/mac/juce_mac_Files.mm | 3 +- src/native/mac/juce_mac_Fonts.mm | 28 +- .../windows/juce_win32_AudioCDReader.cpp | 3 +- .../windows/juce_win32_CameraDevice.cpp | 3 +- src/native/windows/juce_win32_Fonts.cpp | 3 +- src/native/windows/juce_win32_Midi.cpp | 3 +- .../windows/juce_win32_NativeIncludes.h | 2 +- src/native/windows/juce_win32_WASAPI.cpp | 9 +- src/native/windows/juce_win32_Windowing.cpp | 12 +- src/text/juce_String.h | 3 +- src/threads/juce_CriticalSection.h | 6 +- src/threads/juce_InterProcessLock.h | 6 +- src/threads/juce_Process.h | 4 +- src/threads/juce_ReadWriteLock.h | 3 +- src/threads/juce_ScopedLock.h | 6 +- src/threads/juce_ScopedReadLock.h | 3 +- src/threads/juce_ScopedTryLock.h | 3 +- src/threads/juce_ScopedWriteLock.h | 3 +- src/threads/juce_ThreadPool.cpp | 7 +- src/utilities/juce_DeletedAtShutdown.h | 5 +- src/utilities/juce_UnitTest.h | 6 +- 116 files changed, 654 insertions(+), 1127 deletions(-) diff --git a/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode1.cpp b/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode1.cpp index 940ebfad72..1e833da57d 100644 --- a/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode1.cpp +++ b/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode1.cpp @@ -47,13 +47,13 @@ #undef UNICODE #endif -#include "CEffectGroup.cpp" -#include "CEffectGroupMIDI.cpp" -#include "CEffectMIDIUtils.cpp" -#include "CEffectProcess.cpp" -#include "CEffectProcessAS.cpp" -#include "CEffectType.cpp" -#include "CEffectTypeRTAS.cpp" -#include "ChunkDataParser.cpp" +#include +#include +#include +#include +#include +#include +#include +#include #endif diff --git a/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode2.cpp b/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode2.cpp index c137a24ab1..426c82d22d 100644 --- a/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode2.cpp +++ b/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode2.cpp @@ -42,7 +42,7 @@ list of the necessary Digidesign paths in juce_RTAS_Wrapper.cpp */ -#include "CEffectProcessMIDI.cpp" -#include "PlugInUtils.cpp" +#include +#include #endif diff --git a/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode3.cpp b/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode3.cpp index 1847296c99..baf372df7d 100644 --- a/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode3.cpp +++ b/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode3.cpp @@ -52,7 +52,7 @@ #if JucePlugin_Build_VST #define DllMain DllMainRTAS - #include "DLLMain.cpp" + #include #undef DllMain extern BOOL WINAPI DllMainVST (HINSTANCE instance, DWORD dwReason, LPVOID); @@ -66,15 +66,15 @@ return DllMainVST (hInstance, ul_reason_for_call, lpReserved); } #else - #include "DLLMain.cpp" + #include #endif - #include "DefaultSwap.cpp" + #include #else //============================================================================== - #include "PlugInInitialize.cpp" - #include "Dispatcher.cpp" + #include + #include #endif #else diff --git a/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode_Header.h b/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode_Header.h index 205ebed9f7..809bea67ab 100644 --- a/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode_Header.h +++ b/extras/audio plugins/wrapper/RTAS/juce_RTAS_DigiCode_Header.h @@ -49,7 +49,7 @@ #pragma pack (2) #pragma warning (disable: 4267 4996 4311 4312 4103) - #include "ForcedInclude.h" + #include #else @@ -65,7 +65,7 @@ #define PLUGIN_SDK_DIRECTMIDI 1 #define DIGI_PASCAL - #include "MacAlwaysInclude.h" + #include #endif #endif diff --git a/extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp b/extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp index d1d169a1ea..4791ae4b2d 100644 --- a/extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp +++ b/extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp @@ -34,7 +34,7 @@ #if JucePlugin_Build_RTAS #ifdef _MSC_VER - #include "Mac2Win.H" + #include #endif /* Note about include paths @@ -73,14 +73,14 @@ some filename clashes between them. */ -#include "CEffectGroupMIDI.h" -#include "CEffectProcessMIDI.h" -#include "CEffectProcessRTAS.h" -#include "CCustomView.h" -#include "CEffectTypeRTAS.h" -#include "CPluginControl.h" -#include "CPluginControl_OnOff.h" -#include "FicProcessTokens.h" +#include +#include +#include +#include +#include +#include +#include +#include //============================================================================== #ifdef _MSC_VER @@ -904,8 +904,7 @@ private: AudioProcessor* const juceFilter; const int index; - JucePluginControl (const JucePluginControl&); - JucePluginControl& operator= (const JucePluginControl&); + JUCE_DECLARE_NON_COPYABLE (JucePluginControl); }; }; diff --git a/extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp b/extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp index 2f68b91ef3..7c912b4bcc 100644 --- a/extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp +++ b/extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp @@ -63,10 +63,10 @@ #endif // VSTSDK V2.4 includes.. - #include "public.sdk/source/vst2.x/audioeffectx.h" - #include "public.sdk/source/vst2.x/aeffeditor.h" - #include "public.sdk/source/vst2.x/audioeffectx.cpp" - #include "public.sdk/source/vst2.x/audioeffect.cpp" + #include + #include + #include + #include #if ! VST_2_4_EXTENSIONS #error // You're probably trying to include the wrong VSTSDK version - make sure your include path matches the JUCE_USE_VSTSDK_2_4 flag @@ -74,10 +74,10 @@ #else // VSTSDK V2.3 includes.. - #include "source/common/audioeffectx.h" - #include "source/common/AEffEditor.hpp" - #include "source/common/audioeffectx.cpp" - #include "source/common/AudioEffect.cpp" + #include + #include + #include + #include #if (! VST_2_3_EXTENSIONS) || VST_2_4_EXTENSIONS #error // You're probably trying to include the wrong VSTSDK version - make sure your include path matches the JUCE_USE_VSTSDK_2_4 flag diff --git a/extras/audio plugins/wrapper/juce_PluginHostType.h b/extras/audio plugins/wrapper/juce_PluginHostType.h index 269642d8c9..a75eb78b9d 100644 --- a/extras/audio plugins/wrapper/juce_PluginHostType.h +++ b/extras/audio plugins/wrapper/juce_PluginHostType.h @@ -173,6 +173,5 @@ private: return UnknownHost; } - PluginHostType (const PluginHostType&); - PluginHostType& operator= (const PluginHostType&); + JUCE_DECLARE_NON_COPYABLE (PluginHostType); }; diff --git a/extras/juce demo/Source/demos/WidgetsDemo.cpp b/extras/juce demo/Source/demos/WidgetsDemo.cpp index d93cdfe5e7..47f5f4763a 100644 --- a/extras/juce demo/Source/demos/WidgetsDemo.cpp +++ b/extras/juce demo/Source/demos/WidgetsDemo.cpp @@ -109,7 +109,7 @@ public: void mouseDown (const MouseEvent& e) { - dragger.startDraggingComponent (this, e, 0); + dragger.startDraggingComponent (this, e); } void mouseDrag (const MouseEvent& e) @@ -137,7 +137,7 @@ public: addToDesktop (ComponentPeer::windowIsTemporary); } - dragger.dragComponent (this, e); + dragger.dragComponent (this, e, 0); } } diff --git a/juce.h b/juce.h index 65e6cc49a1..9e67aa89ed 100644 --- a/juce.h +++ b/juce.h @@ -61,7 +61,7 @@ BEGIN_JUCE_NAMESPACE #pragma pack (pop) #endif -#if JUCE_DLL +#ifdef JUCE_DLL #undef JUCE_LEAK_DETECTOR(OwnerClass) #define JUCE_LEAK_DETECTOR(OwnerClass) #endif diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 810024f1dc..795c5ee73a 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -569,7 +569,7 @@ ASIO SDK installed, you can disable ASIO support by commenting-out the "#define JUCE_ASIO" line in juce_Config.h, and rebuild your Juce library. */ - #include "iasiodrv.h" + #include #endif #if JUCE_USE_CDBURNER @@ -1696,50 +1696,17 @@ const String SystemStats::getJUCEVersion() } #ifdef JUCE_DLL + void* juce_Malloc (int size) { return malloc (size); } + void* juce_Calloc (int size) { return calloc (1, size); } + void* juce_Realloc (void* block, int size) { return realloc (block, size); } + void juce_Free (void* block) { free (block); } -void* juce_Malloc (const int size) -{ - return malloc (size); -} - -void* juce_Calloc (const int size) -{ - return calloc (1, size); -} - -void* juce_Realloc (void* const block, const int size) -{ - return realloc (block, size); -} - -void juce_Free (void* const block) -{ - free (block); -} - -#if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS - -void* juce_DebugMalloc (const int size, const char* file, const int line) -{ - return _malloc_dbg (size, _NORMAL_BLOCK, file, line); -} - -void* juce_DebugCalloc (const int size, const char* file, const int line) -{ - return _calloc_dbg (1, size, _NORMAL_BLOCK, file, line); -} - -void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line) -{ - return _realloc_dbg (block, size, _NORMAL_BLOCK, file, line); -} - -void juce_DebugFree (void* const block) -{ - _free_dbg (block, _NORMAL_BLOCK); -} - -#endif + #if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS + void* juce_DebugMalloc (int size, const char* file, int line) { return _malloc_dbg (size, _NORMAL_BLOCK, file, line); } + void* juce_DebugCalloc (int size, const char* file, int line) { return _calloc_dbg (1, size, _NORMAL_BLOCK, file, line); } + void* juce_DebugRealloc (void* block, int size, const char* file, int line) { return _realloc_dbg (block, size, _NORMAL_BLOCK, file, line); } + void juce_DebugFree (void* block) { _free_dbg (block, _NORMAL_BLOCK); } + #endif #endif END_JUCE_NAMESPACE @@ -4981,8 +4948,7 @@ public: } private: - Add (const Add&); - Add& operator= (const Add&); + JUCE_DECLARE_NON_COPYABLE (Add); }; class Subtract : public BinaryTerm @@ -5008,8 +4974,7 @@ public: } private: - Subtract (const Subtract&); - Subtract& operator= (const Subtract&); + JUCE_DECLARE_NON_COPYABLE (Subtract); }; class Multiply : public BinaryTerm @@ -5032,8 +4997,7 @@ public: } private: - Multiply (const Multiply&); - Multiply& operator= (const Multiply&); + JUCE_DECLARE_NON_COPYABLE (Multiply); }; class Divide : public BinaryTerm @@ -5059,8 +5023,7 @@ public: } private: - Divide (const Divide&); - Divide& operator= (const Divide&); + JUCE_DECLARE_NON_COPYABLE (Divide); }; static Term* findDestinationFor (Term* const topLevel, const Term* const inputTerm) @@ -5415,8 +5378,7 @@ public: return e; } - Parser (const Parser&); - Parser& operator= (const Parser&); + JUCE_DECLARE_NON_COPYABLE (Parser); }; }; @@ -10621,8 +10583,7 @@ private: InputStream* inputStream; ScopedPointer streamToDelete; - ZipInputStream (const ZipInputStream&); - ZipInputStream& operator= (const ZipInputStream&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ZipInputStream); }; ZipFile::ZipFile (InputStream* const source_, const bool deleteStreamWhenDestroyed) @@ -17244,10 +17205,6 @@ public: { } - ~ThreadPoolThread() - { - } - void run() { while (! threadShouldExit()) @@ -17261,8 +17218,7 @@ private: ThreadPool& pool; bool volatile busy; - ThreadPoolThread (const ThreadPoolThread&); - ThreadPoolThread& operator= (const ThreadPoolThread&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ThreadPoolThread); }; ThreadPool::ThreadPool (const int numThreads, @@ -18032,8 +17988,7 @@ private: var oldValue; const bool isAddingNewProperty : 1, isDeletingProperty : 1; - SetPropertyAction (const SetPropertyAction&); - SetPropertyAction& operator= (const SetPropertyAction&); + JUCE_DECLARE_NON_COPYABLE (SetPropertyAction); }; class ValueTree::AddOrRemoveChildAction : public UndoableAction @@ -18088,8 +18043,7 @@ private: const int childIndex; const bool isDeleting; - AddOrRemoveChildAction (const AddOrRemoveChildAction&); - AddOrRemoveChildAction& operator= (const AddOrRemoveChildAction&); + JUCE_DECLARE_NON_COPYABLE (AddOrRemoveChildAction); }; class ValueTree::MoveChildAction : public UndoableAction @@ -18136,8 +18090,7 @@ private: const SharedObjectPtr parent; const int startIndex, endIndex; - MoveChildAction (const MoveChildAction&); - MoveChildAction& operator= (const MoveChildAction&); + JUCE_DECLARE_NON_COPYABLE (MoveChildAction); }; ValueTree::SharedObject::SharedObject (const Identifier& type_) @@ -18933,8 +18886,7 @@ public: private: var value; - SimpleValueSource (const SimpleValueSource&); - SimpleValueSource& operator= (const SimpleValueSource&); + JUCE_DECLARE_NON_COPYABLE (SimpleValueSource); }; Value::Value() @@ -21835,8 +21787,7 @@ private: ScopedPointer writer; volatile bool isRunning; - Buffer (const Buffer&); - Buffer& operator= (const Buffer&); + JUCE_DECLARE_NON_COPYABLE (Buffer); }; AudioFormatWriter::ThreadedWriter::ThreadedWriter (AudioFormatWriter* writer, TimeSliceThread& backgroundThread, int numSamplesToBuffer) @@ -24365,8 +24316,7 @@ private: deleteInstance(); } - SharedBufferingAudioSourceThread (const SharedBufferingAudioSourceThread&); - SharedBufferingAudioSourceThread& operator= (const SharedBufferingAudioSourceThread&); + JUCE_DECLARE_NON_COPYABLE (SharedBufferingAudioSourceThread); }; juce_ImplementSingleton (SharedBufferingAudioSourceThread) @@ -32865,7 +32815,7 @@ BEGIN_JUCE_NAMESPACE If you're not interested in VSTs, you can disable them by changing the JUCE_PLUGINHOST_VST flag in juce_Config.h */ -#include "pluginterfaces/vst2.x/aeffectx.h" +#include #if JUCE_MSVC #pragma warning (pop) @@ -32923,7 +32873,7 @@ public: { if (e->type == kVstSysExType) { - juce_free (((VstMidiSysexEvent*) e)->sysexDump); + delete[] (((VstMidiSysexEvent*) e)->sysexDump); e->type = kVstMidiType; e->byteSize = sizeof (VstMidiEvent); e->noteLength = 0; @@ -32940,10 +32890,9 @@ public: VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e; if (se->type == kVstSysExType) - se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes); - else - se->sysexDump = (char*) juce_malloc (numBytes); + delete[] se->sysexDump; + se->sysexDump = new char [numBytes]; memcpy (se->sysexDump, midiData, numBytes); se->type = kVstSysExType; @@ -33017,7 +32966,7 @@ public: VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]); if (e->type == kVstSysExType) - juce_free (((VstMidiSysexEvent*) e)->sysexDump); + delete[] (((VstMidiSysexEvent*) e)->sysexDump); juce_free (e); } @@ -33163,7 +33112,7 @@ class VSTPluginWindow; #if JUCE_MAC && JUCE_PPC static void* NewCFMFromMachO (void* const machofp) throw() { - void* result = juce_malloc (8); + void* result = (void*) new char[8]; ((void**) result)[0] = machofp; ((void**) result)[1] = result; @@ -36495,8 +36444,7 @@ public: private: const int channelNum; - ClearChannelOp (const ClearChannelOp&); - ClearChannelOp& operator= (const ClearChannelOp&); + JUCE_DECLARE_NON_COPYABLE (ClearChannelOp); }; class CopyChannelOp : public AudioGraphRenderingOp @@ -36517,8 +36465,7 @@ public: private: const int srcChannelNum, dstChannelNum; - CopyChannelOp (const CopyChannelOp&); - CopyChannelOp& operator= (const CopyChannelOp&); + JUCE_DECLARE_NON_COPYABLE (CopyChannelOp); }; class AddChannelOp : public AudioGraphRenderingOp @@ -36539,8 +36486,7 @@ public: private: const int srcChannelNum, dstChannelNum; - AddChannelOp (const AddChannelOp&); - AddChannelOp& operator= (const AddChannelOp&); + JUCE_DECLARE_NON_COPYABLE (AddChannelOp); }; class ClearMidiBufferOp : public AudioGraphRenderingOp @@ -36560,8 +36506,7 @@ public: private: const int bufferNum; - ClearMidiBufferOp (const ClearMidiBufferOp&); - ClearMidiBufferOp& operator= (const ClearMidiBufferOp&); + JUCE_DECLARE_NON_COPYABLE (ClearMidiBufferOp); }; class CopyMidiBufferOp : public AudioGraphRenderingOp @@ -36582,8 +36527,7 @@ public: private: const int srcBufferNum, dstBufferNum; - CopyMidiBufferOp (const CopyMidiBufferOp&); - CopyMidiBufferOp& operator= (const CopyMidiBufferOp&); + JUCE_DECLARE_NON_COPYABLE (CopyMidiBufferOp); }; class AddMidiBufferOp : public AudioGraphRenderingOp @@ -36605,8 +36549,7 @@ public: private: const int srcBufferNum, dstBufferNum; - AddMidiBufferOp (const AddMidiBufferOp&); - AddMidiBufferOp& operator= (const AddMidiBufferOp&); + JUCE_DECLARE_NON_COPYABLE (AddMidiBufferOp); }; class ProcessBufferOp : public AudioGraphRenderingOp @@ -36651,8 +36594,7 @@ private: int totalChans; int midiBufferToUse; - ProcessBufferOp (const ProcessBufferOp&); - ProcessBufferOp& operator= (const ProcessBufferOp&); + JUCE_DECLARE_NON_COPYABLE (ProcessBufferOp); }; /** Used to calculate the correct sequence of rendering ops needed, based on @@ -38285,17 +38227,16 @@ BEGIN_JUCE_NAMESPACE class ActionMessage : public Message { public: - const String message; - ActionMessage (const String& messageText, ActionListener* const listener_) throw() : message (messageText) { pointerParameter = listener_; } + const String message; + private: - ActionMessage (const ActionMessage&); - ActionMessage& operator= (const ActionMessage&); + JUCE_DECLARE_NON_COPYABLE (ActionMessage); }; ActionBroadcaster::CallbackReceiver::CallbackReceiver() {} @@ -39173,8 +39114,7 @@ public: WaitableEvent lockedEvent, releaseEvent; private: - SharedEvents (const SharedEvents&); - SharedEvents& operator= (const SharedEvents&); + JUCE_DECLARE_NON_COPYABLE (SharedEvents); }; class MessageManagerLock::BlockingMessage : public CallbackMessage @@ -39676,8 +39616,7 @@ private: startThread (7); } - InternalTimerThread (const InternalTimerThread&); - InternalTimerThread& operator= (const InternalTimerThread&); + JUCE_DECLARE_NON_COPYABLE (InternalTimerThread); }; InternalTimerThread* InternalTimerThread::instance = 0; @@ -39915,8 +39854,7 @@ private: Array listeners; int numDeepMouseListeners; - MouseListenerList (const MouseListenerList&); - MouseListenerList& operator= (const MouseListenerList&); + JUCE_DECLARE_NON_COPYABLE (MouseListenerList); }; class Component::ComponentHelpers @@ -43082,8 +43020,7 @@ public: bool isActive, isDeleted; private: - ModalItem (const ModalItem&); - ModalItem& operator= (const ModalItem&); + JUCE_DECLARE_NON_COPYABLE (ModalItem); }; ModalComponentManager::ModalComponentManager() @@ -43248,8 +43185,7 @@ private: int& value; bool& finished; - ReturnValueRetriever (const ReturnValueRetriever&); - ReturnValueRetriever& operator= (const ReturnValueRetriever&); + JUCE_DECLARE_NON_COPYABLE (ReturnValueRetriever); }; int ModalComponentManager::runEventLoopForCurrentComponent() @@ -45468,13 +45404,6 @@ void CodeDocument::sendListenerChangeMessage (const int startLine, const int end class CodeDocumentInsertAction : public UndoableAction { - CodeDocument& owner; - const String text; - int insertPos; - - CodeDocumentInsertAction (const CodeDocumentInsertAction&); - CodeDocumentInsertAction& operator= (const CodeDocumentInsertAction&); - public: CodeDocumentInsertAction (CodeDocument& owner_, const String& text_, const int insertPos_) throw() : owner (owner_), @@ -45483,8 +45412,6 @@ public: { } - ~CodeDocumentInsertAction() {} - bool perform() { owner.currentActionIndex++; @@ -45500,6 +45427,13 @@ public: } int getSizeInUnits() { return text.length() + 32; } + +private: + CodeDocument& owner; + const String text; + int insertPos; + + JUCE_DECLARE_NON_COPYABLE (CodeDocumentInsertAction); }; void CodeDocument::insert (const String& text, const int insertPos, const bool undoable) @@ -45573,13 +45507,6 @@ void CodeDocument::insert (const String& text, const int insertPos, const bool u class CodeDocumentDeleteAction : public UndoableAction { - CodeDocument& owner; - int startPos, endPos; - String removedText; - - CodeDocumentDeleteAction (const CodeDocumentDeleteAction&); - CodeDocumentDeleteAction& operator= (const CodeDocumentDeleteAction&); - public: CodeDocumentDeleteAction (CodeDocument& owner_, const int startPos_, const int endPos_) throw() : owner (owner_), @@ -45590,8 +45517,6 @@ public: CodeDocument::Position (&owner, endPos)); } - ~CodeDocumentDeleteAction() {} - bool perform() { owner.currentActionIndex++; @@ -45607,6 +45532,13 @@ public: } int getSizeInUnits() { return removedText.length() + 32; } + +private: + CodeDocument& owner; + int startPos, endPos; + String removedText; + + JUCE_DECLARE_NON_COPYABLE (CodeDocumentDeleteAction); }; void CodeDocument::remove (const int startPos, const int endPos, const bool undoable) @@ -45716,10 +45648,9 @@ public: private: CodeEditorComponent& owner; - CaretComponent (const CaretComponent&); - CaretComponent& operator= (const CaretComponent&); - bool shouldBeShown() const { return owner.hasKeyboardFocus (true); } + + JUCE_DECLARE_NON_COPYABLE (CaretComponent); }; class CodeEditorComponent::CodeEditorLine @@ -45730,10 +45661,6 @@ public: { } - ~CodeEditorLine() throw() - { - } - bool update (CodeDocument& document, int lineNum, CodeDocument::Iterator& source, CodeTokeniser* analyser, const int spacesPerTab, @@ -47987,8 +47914,7 @@ public: private: Component::SafePointer box; - Callback (const Callback&); - Callback& operator= (const Callback&); + JUCE_DECLARE_NON_COPYABLE (Callback); }; void ComboBox::showPopup() @@ -50922,10 +50848,6 @@ public: setAlwaysOnTop (true); } - ~DragOverlayComp() - { - } - void paint (Graphics& g) { g.drawImageAt (image, 0, 0); @@ -50934,8 +50856,7 @@ public: private: Image image; - DragOverlayComp (const DragOverlayComp&); - DragOverlayComp& operator= (const DragOverlayComp&); + JUCE_DECLARE_NON_COPYABLE (DragOverlayComp); }; TableHeaderComponent::TableHeaderComponent() @@ -52972,15 +52893,6 @@ private: class TextEditor::InsertAction : public UndoableAction { - TextEditor& owner; - const String text; - const int insertIndex, oldCaretPos, newCaretPos; - const Font font; - const Colour colour; - - InsertAction (const InsertAction&); - InsertAction& operator= (const InsertAction&); - public: InsertAction (TextEditor& owner_, const String& text_, @@ -52999,10 +52911,6 @@ public: { } - ~InsertAction() - { - } - bool perform() { owner.insert (text, insertIndex, font, colour, 0, newCaretPos); @@ -53019,18 +52927,19 @@ public: { return text.length() + 16; } + +private: + TextEditor& owner; + const String text; + const int insertIndex, oldCaretPos, newCaretPos; + const Font font; + const Colour colour; + + JUCE_DECLARE_NON_COPYABLE (InsertAction); }; class TextEditor::RemoveAction : public UndoableAction { - TextEditor& owner; - const Range range; - const int oldCaretPos, newCaretPos; - Array removedSections; - - RemoveAction (const RemoveAction&); - RemoveAction& operator= (const RemoveAction&); - public: RemoveAction (TextEditor& owner_, const Range range_, @@ -53077,6 +52986,14 @@ public: return n + 16; } + +private: + TextEditor& owner; + const Range range; + const int oldCaretPos, newCaretPos; + Array removedSections; + + JUCE_DECLARE_NON_COPYABLE (RemoveAction); }; class TextEditor::TextHolderComponent : public Component, @@ -53121,8 +53038,7 @@ public: private: TextEditor& owner; - TextHolderComponent (const TextHolderComponent&); - TextHolderComponent& operator= (const TextHolderComponent&); + JUCE_DECLARE_NON_COPYABLE (TextHolderComponent); }; class TextEditorViewport : public Viewport @@ -53160,8 +53076,7 @@ private: float lastWordWrapWidth; bool rentrant; - TextEditorViewport (const TextEditorViewport&); - TextEditorViewport& operator= (const TextEditorViewport&); + JUCE_DECLARE_NON_COPYABLE (TextEditorViewport); }; namespace TextEditorDefs @@ -53992,8 +53907,7 @@ public: private: Component::SafePointer editor; - TextEditorMenuPerformer (const TextEditorMenuPerformer&); - TextEditorMenuPerformer& operator= (const TextEditorMenuPerformer&); + JUCE_DECLARE_NON_COPYABLE (TextEditorMenuPerformer); }; void TextEditor::mouseDown (const MouseEvent& e) @@ -56811,8 +56725,7 @@ public: int lastIndex; private: - InsertPointHighlight (const InsertPointHighlight&); - InsertPointHighlight& operator= (const InsertPointHighlight&); + JUCE_DECLARE_NON_COPYABLE (InsertPointHighlight); }; class TreeView::TargetGroupHighlight : public Component @@ -56838,8 +56751,7 @@ public: } private: - TargetGroupHighlight (const TargetGroupHighlight&); - TargetGroupHighlight& operator= (const TargetGroupHighlight&); + JUCE_DECLARE_NON_COPYABLE (TargetGroupHighlight); }; void TreeView::showDragHighlight (TreeViewItem* item, int insertIndex, int x, int y) throw() @@ -60176,8 +60088,7 @@ public: private: KeyMappingEditorComponent& owner; - KeyEntryWindow (const KeyEntryWindow&); - KeyEntryWindow& operator= (const KeyEntryWindow&); + JUCE_DECLARE_NON_COPYABLE (KeyEntryWindow); }; void assignNewKey() @@ -63743,8 +63654,7 @@ public: private: TabbedButtonBar& owner; - BehindFrontTabComp (const BehindFrontTabComp&); - BehindFrontTabComp& operator= (const BehindFrontTabComp&); + JUCE_DECLARE_NON_COPYABLE (BehindFrontTabComp); }; TabbedButtonBar::TabbedButtonBar (const Orientation orientation_) @@ -68492,8 +68402,7 @@ private: Component::SafePointer bar; const int topLevelIndex; - AsyncCallback (const AsyncCallback&); - AsyncCallback& operator= (const AsyncCallback&); + JUCE_DECLARE_NON_COPYABLE (AsyncCallback); }; void MenuBarComponent::showMenu (int index) @@ -70117,8 +70026,7 @@ public: ScopedPointer component; private: - PopupMenuCompletionCallback (const PopupMenuCompletionCallback&); - PopupMenuCompletionCallback& operator= (const PopupMenuCompletionCallback&); + JUCE_DECLARE_NON_COPYABLE (PopupMenuCompletionCallback); }; int PopupMenu::showMenu (const Rectangle& target, @@ -70361,7 +70269,6 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE ComponentDragger::ComponentDragger() - : constrainer (0) { } @@ -70369,22 +70276,20 @@ ComponentDragger::~ComponentDragger() { } -void ComponentDragger::startDraggingComponent (Component* const componentToDrag, const MouseEvent& e, - ComponentBoundsConstrainer* const constrainer_) +void ComponentDragger::startDraggingComponent (Component* const componentToDrag, const MouseEvent& e) { jassert (componentToDrag != 0); + jassert (e.mods.isAnyMouseButtonDown()); // The event has to be a drag event! if (componentToDrag != 0) - { - constrainer = constrainer_; mouseDownWithinTarget = e.getEventRelativeTo (componentToDrag).getMouseDownPosition(); - } } -void ComponentDragger::dragComponent (Component* const componentToDrag, const MouseEvent& e) +void ComponentDragger::dragComponent (Component* const componentToDrag, const MouseEvent& e, + ComponentBoundsConstrainer* const constrainer) { jassert (componentToDrag != 0); - jassert (e.mods.isAnyMouseButtonDown()); // (the event has to be a drag event..) + jassert (e.mods.isAnyMouseButtonDown()); // The event has to be a drag event! if (componentToDrag != 0) { @@ -70659,8 +70564,7 @@ private: const Point imageOffset; bool hasCheckedForExternalDrag, drawImage; - DragImageComponent (const DragImageComponent&); - DragImageComponent& operator= (const DragImageComponent&); + JUCE_DECLARE_NON_COPYABLE (DragImageComponent); }; DragAndDropContainer::DragAndDropContainer() @@ -71573,8 +71477,7 @@ private: || mouseDowns[0].position.getDistanceFrom (screenPos) >= 4; } - MouseInputSourceInternal (const MouseInputSourceInternal&); - MouseInputSourceInternal& operator= (const MouseInputSourceInternal&); + JUCE_DECLARE_NON_COPYABLE (MouseInputSourceInternal); }; MouseInputSource::MouseInputSource (const int index, const bool isMouseDevice) @@ -72148,8 +72051,7 @@ private: int titleHeight; bool sectionIsOpen; - PropertySectionComponent (const PropertySectionComponent&); - PropertySectionComponent& operator= (const PropertySectionComponent&); + JUCE_DECLARE_NON_COPYABLE (PropertySectionComponent); }; class PropertyPanel::PropertyHolderComponent : public Component @@ -72198,8 +72100,7 @@ public: private: OwnedArray sections; - PropertyHolderComponent (const PropertyHolderComponent&); - PropertyHolderComponent& operator= (const PropertyHolderComponent&); + JUCE_DECLARE_NON_COPYABLE (PropertyHolderComponent); }; PropertyPanel::PropertyPanel() @@ -72625,8 +72526,7 @@ private: AudioDeviceManager* const manager; float level; - SimpleDeviceManagerInputLevelMeter (const SimpleDeviceManagerInputLevelMeter&); - SimpleDeviceManagerInputLevelMeter& operator= (const SimpleDeviceManagerInputLevelMeter&); + JUCE_DECLARE_NON_COPYABLE (SimpleDeviceManagerInputLevelMeter); }; class AudioDeviceSelectorComponent::MidiInputSelectorComponentListBox : public ListBox, @@ -73440,8 +73340,7 @@ public: private: ScopedPointer inputChanList, outputChanList; - AudioDeviceSettingsPanel (const AudioDeviceSettingsPanel&); - AudioDeviceSettingsPanel& operator= (const AudioDeviceSettingsPanel&); + JUCE_DECLARE_NON_COPYABLE (AudioDeviceSettingsPanel); }; AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager_, @@ -73965,8 +73864,7 @@ public: } private: - ColourComponentSlider (const ColourComponentSlider&); - ColourComponentSlider& operator= (const ColourComponentSlider&); + JUCE_DECLARE_NON_COPYABLE (ColourComponentSlider); }; class ColourSpaceMarker : public Component @@ -73986,8 +73884,7 @@ public: } private: - ColourSpaceMarker (const ColourSpaceMarker&); - ColourSpaceMarker& operator= (const ColourSpaceMarker&); + JUCE_DECLARE_NON_COPYABLE (ColourSpaceMarker); }; class ColourSelector::ColourSpaceView : public Component @@ -74081,8 +73978,7 @@ private: edge * 2, edge * 2); } - ColourSpaceView (const ColourSpaceView&); - ColourSpaceView& operator= (const ColourSpaceView&); + JUCE_DECLARE_NON_COPYABLE (ColourSpaceView); }; class HueSelectorMarker : public Component @@ -74112,8 +74008,7 @@ public: } private: - HueSelectorMarker (const HueSelectorMarker&); - HueSelectorMarker& operator= (const HueSelectorMarker&); + JUCE_DECLARE_NON_COPYABLE (HueSelectorMarker); }; class ColourSelector::HueSelectorComp : public Component @@ -74173,8 +74068,7 @@ private: HueSelectorMarker marker; const int edge; - HueSelectorComp (const HueSelectorComp&); - HueSelectorComp& operator= (const HueSelectorComp&); + JUCE_DECLARE_NON_COPYABLE (HueSelectorComp); }; class ColourSelector::SwatchComponent : public Component @@ -74221,8 +74115,7 @@ private: ColourSelector& owner; const int index; - SwatchComponent (const SwatchComponent&); - SwatchComponent& operator= (const SwatchComponent&); + JUCE_DECLARE_NON_COPYABLE (SwatchComponent); }; ColourSelector::ColourSelector (const int flags_, @@ -74571,8 +74464,7 @@ public: } private: - ShadowWindow (const ShadowWindow&); - ShadowWindow& operator= (const ShadowWindow&); + JUCE_DECLARE_NON_COPYABLE (ShadowWindow); }; DropShadower::DropShadower (const float alpha_, @@ -74947,8 +74839,7 @@ public: private: MagnifierComponent* const magnifierComp; - PeerHolderComp (const PeerHolderComp&); - PeerHolderComp& operator= (const PeerHolderComp&); + JUCE_DECLARE_NON_COPYABLE (PeerHolderComp); }; MagnifierComponent::MagnifierComponent (Component* const content_, @@ -75142,8 +75033,7 @@ private: MidiKeyboardComponent& owner; const int delta; - MidiKeyboardUpDownButton (const MidiKeyboardUpDownButton&); - MidiKeyboardUpDownButton& operator= (const MidiKeyboardUpDownButton&); + JUCE_DECLARE_NON_COPYABLE (MidiKeyboardUpDownButton); }; MidiKeyboardComponent::MidiKeyboardComponent (MidiKeyboardState& state_, @@ -76404,8 +76294,7 @@ public: } private: - AlertWindowTextEditor (const AlertWindowTextEditor&); - AlertWindowTextEditor& operator= (const AlertWindowTextEditor&); + JUCE_DECLARE_NON_COPYABLE (AlertWindowTextEditor); static juce_wchar getDefaultPasswordChar() throw() { @@ -76626,8 +76515,7 @@ public: private: int bestWidth; - AlertTextComp (const AlertTextComp&); - AlertTextComp& operator= (const AlertTextComp&); + JUCE_DECLARE_NON_COPYABLE (AlertTextComp); }; void AlertWindow::addTextBlock (const String& textBlock) @@ -76888,12 +76776,12 @@ bool AlertWindow::containsAnyExtraComponents() const void AlertWindow::mouseDown (const MouseEvent& e) { - dragger.startDraggingComponent (this, e, &constrainer); + dragger.startDraggingComponent (this, e); } void AlertWindow::mouseDrag (const MouseEvent& e) { - dragger.dragComponent (this, e); + dragger.dragComponent (this, e, &constrainer); } bool AlertWindow::keyPressed (const KeyPress& key) @@ -77809,8 +77697,7 @@ public: } private: - TempDialogWindow (const TempDialogWindow&); - TempDialogWindow& operator= (const TempDialogWindow&); + JUCE_DECLARE_NON_COPYABLE (TempDialogWindow); }; int DialogWindow::showModalDialog (const String& dialogTitle, @@ -78682,13 +78569,13 @@ bool ResizableWindow::restoreWindowStateFromString (const String& s) void ResizableWindow::mouseDown (const MouseEvent& e) { if (! isFullScreen()) - dragger.startDraggingComponent (this, e, constrainer); + dragger.startDraggingComponent (this, e); } void ResizableWindow::mouseDrag (const MouseEvent& e) { if (! isFullScreen()) - dragger.dragComponent (this, e); + dragger.dragComponent (this, e, constrainer); } #if JUCE_DEBUG @@ -79143,8 +79030,7 @@ private: && tlw->isShowing(); } - TopLevelWindowManager (const TopLevelWindowManager&); - TopLevelWindowManager& operator= (const TopLevelWindowManager&); + JUCE_DECLARE_NON_COPYABLE (TopLevelWindowManager); }; juce_ImplementSingleton_SingleThreaded (TopLevelWindowManager) @@ -83219,8 +83105,7 @@ private: } while (--width > 0); } - SolidColourEdgeTableRenderer (const SolidColourEdgeTableRenderer&); - SolidColourEdgeTableRenderer& operator= (const SolidColourEdgeTableRenderer&); + JUCE_DECLARE_NON_COPYABLE (SolidColourEdgeTableRenderer); }; class LinearGradientPixelGenerator @@ -83290,8 +83175,7 @@ private: bool vertical, horizontal; enum { numScaleBits = 12 }; - LinearGradientPixelGenerator (const LinearGradientPixelGenerator&); - LinearGradientPixelGenerator& operator= (const LinearGradientPixelGenerator&); + JUCE_DECLARE_NON_COPYABLE (LinearGradientPixelGenerator); }; class RadialGradientPixelGenerator @@ -83332,8 +83216,7 @@ protected: const double gx1, gy1; double maxDist, invScale, dy; - RadialGradientPixelGenerator (const RadialGradientPixelGenerator&); - RadialGradientPixelGenerator& operator= (const RadialGradientPixelGenerator&); + JUCE_DECLARE_NON_COPYABLE (RadialGradientPixelGenerator); }; class TransformedRadialGradientPixelGenerator : public RadialGradientPixelGenerator @@ -83372,8 +83255,7 @@ private: double tM10, tM00, lineYM01, lineYM11; const AffineTransform inverseTransform; - TransformedRadialGradientPixelGenerator (const TransformedRadialGradientPixelGenerator&); - TransformedRadialGradientPixelGenerator& operator= (const TransformedRadialGradientPixelGenerator&); + JUCE_DECLARE_NON_COPYABLE (TransformedRadialGradientPixelGenerator); }; template @@ -83437,8 +83319,7 @@ private: const Image::BitmapData& destData; PixelType* linePixels; - GradientEdgeTableRenderer (const GradientEdgeTableRenderer&); - GradientEdgeTableRenderer& operator= (const GradientEdgeTableRenderer&); + JUCE_DECLARE_NON_COPYABLE (GradientEdgeTableRenderer); }; namespace RenderingHelpers @@ -83587,8 +83468,7 @@ private: memcpy (dest, src, width * sizeof (PixelRGB)); } - ImageFillEdgeTableRenderer (const ImageFillEdgeTableRenderer&); - ImageFillEdgeTableRenderer& operator= (const ImageFillEdgeTableRenderer&); + JUCE_DECLARE_NON_COPYABLE (ImageFillEdgeTableRenderer); }; template @@ -84028,8 +83908,7 @@ private: const float pixelOffset; const int pixelOffsetInt; - TransformedImageSpanInterpolator (const TransformedImageSpanInterpolator&); - TransformedImageSpanInterpolator& operator= (const TransformedImageSpanInterpolator&); + JUCE_DECLARE_NON_COPYABLE (TransformedImageSpanInterpolator); }; TransformedImageSpanInterpolator interpolator; @@ -84043,8 +83922,7 @@ private: HeapBlock scratchBuffer; int scratchSize; - TransformedImageFillEdgeTableRenderer (const TransformedImageFillEdgeTableRenderer&); - TransformedImageFillEdgeTableRenderer& operator= (const TransformedImageFillEdgeTableRenderer&); + JUCE_DECLARE_NON_COPYABLE (TransformedImageFillEdgeTableRenderer); }; class ClipRegionBase : public ReferenceCountedObject @@ -84637,8 +84515,7 @@ private: const RectangleList& clip; const Rectangle area; - SubRectangleIterator (const SubRectangleIterator&); - SubRectangleIterator& operator= (const SubRectangleIterator&); + JUCE_DECLARE_NON_COPYABLE (SubRectangleIterator); }; class SubRectangleIteratorFloat @@ -84802,8 +84679,7 @@ private: const RectangleList& clip; const Rectangle& area; - SubRectangleIteratorFloat (const SubRectangleIteratorFloat&); - SubRectangleIteratorFloat& operator= (const SubRectangleIteratorFloat&); + JUCE_DECLARE_NON_COPYABLE (SubRectangleIteratorFloat); }; ClipRegion_RectangleList& operator= (const ClipRegion_RectangleList&); @@ -86369,8 +86245,7 @@ struct RentrancyCheckSetter private: bool& b; - RentrancyCheckSetter (const RentrancyCheckSetter&); - RentrancyCheckSetter& operator= (const RentrancyCheckSetter&); + JUCE_DECLARE_NON_COPYABLE (RentrancyCheckSetter); }; void DrawableComposite::updateBoundsToFitChildren() @@ -94995,8 +94870,6 @@ public: imageData = image_->getPixelData (area_.getX(), area_.getY()); } - ~SubsectionSharedImage() {} - Image::ImageType getType() const { return Image::SoftwareImage; @@ -95019,8 +94892,7 @@ private: const ReferenceCountedObjectPtr image; const Rectangle area; - SubsectionSharedImage (const SubsectionSharedImage&); - SubsectionSharedImage& operator= (const SubsectionSharedImage&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SubsectionSharedImage); }; const Image Image::getClippedImage (const Rectangle& area) const @@ -95610,8 +95482,7 @@ private: OwnedArray images; CriticalSection lock; - Pimpl (const Pimpl&); - Pimpl& operator= (const Pimpl&); + JUCE_DECLARE_NON_COPYABLE (Pimpl); }; juce_ImplementSingleton_SingleThreaded (ImageCache::Pimpl); @@ -96404,8 +96275,7 @@ private: static inline int makeWord (const uint8 a, const uint8 b) { return (b << 8) | a; } - GIFLoader (const GIFLoader&); - GIFLoader& operator= (const GIFLoader&); + JUCE_DECLARE_NON_COPYABLE (GIFLoader); }; #endif @@ -98134,7 +98004,7 @@ BEGIN_JUCE_NAMESPACE class GZIPCompressorOutputStream::GZIPCompressorHelper { public: - GZIPCompressorHelper (const int compressionLevel, const bool nowrap) + GZIPCompressorHelper (const int compressionLevel, const int windowBits) : data (0), dataSize (0), compLevel (compressionLevel), @@ -98148,7 +98018,7 @@ public: zerostruct (stream); streamIsValid = (deflateInit2 (&stream, compLevel, Z_DEFLATED, - nowrap ? -MAX_WBITS : MAX_WBITS, + windowBits != 0 ? windowBits : MAX_WBITS, 8, strategy) == Z_OK); } @@ -98219,7 +98089,7 @@ public: GZIPCompressorOutputStream::GZIPCompressorOutputStream (OutputStream* const destStream_, int compressionLevel, const bool deleteDestStream, - const bool noWrap) + const int windowBits) : destStream (destStream_), streamToDelete (deleteDestStream ? destStream_ : 0), buffer ((size_t) GZIPCompressorHelper::gzipCompBufferSize) @@ -98227,7 +98097,7 @@ GZIPCompressorOutputStream::GZIPCompressorOutputStream (OutputStream* const dest if (compressionLevel < 1 || compressionLevel > 9) compressionLevel = -1; - helper = new GZIPCompressorHelper (compressionLevel, noWrap); + helper = new GZIPCompressorHelper (compressionLevel, windowBits); } GZIPCompressorOutputStream::~GZIPCompressorOutputStream() @@ -105603,8 +105473,7 @@ private: uint8* data; int dataSize; - GZIPDecompressHelper (const GZIPDecompressHelper&); - GZIPDecompressHelper& operator= (const GZIPDecompressHelper&); + JUCE_DECLARE_NON_COPYABLE (GZIPDecompressHelper); }; GZIPDecompressorInputStream::GZIPDecompressorInputStream (InputStream* const sourceStream_, @@ -237490,8 +237359,7 @@ private: int pendingBytes; double pendingDataTime; - MidiDataConcatenator (const MidiDataConcatenator&); - MidiDataConcatenator& operator= (const MidiDataConcatenator&); + JUCE_DECLARE_NON_COPYABLE (MidiDataConcatenator); }; #endif @@ -240259,8 +240127,7 @@ private: int numKPs, size; bool bold, italic; - FontDCHolder (const FontDCHolder&); - FontDCHolder& operator= (const FontDCHolder&); + JUCE_DECLARE_NON_COPYABLE (FontDCHolder); }; juce_ImplementSingleton_SingleThreaded (FontDCHolder); @@ -242319,8 +242186,7 @@ private: private: Image image; - TemporaryImage (const TemporaryImage&); - TemporaryImage& operator= (const TemporaryImage&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TemporaryImage); }; TemporaryImage offscreenImageGenerator; @@ -243184,8 +243050,7 @@ private: } } - JuceDropTarget (const JuceDropTarget&); - JuceDropTarget& operator= (const JuceDropTarget&); + JUCE_DECLARE_NON_COPYABLE (JuceDropTarget); }; void doSettingChange() @@ -244027,8 +243892,7 @@ private: } } - JuceEnumFormatEtc (const JuceEnumFormatEtc&); - JuceEnumFormatEtc& operator= (const JuceEnumFormatEtc&); + JUCE_DECLARE_NON_COPYABLE (JuceEnumFormatEtc); }; class JuceDataObject : public ComBaseClassHelper @@ -244120,8 +243984,7 @@ private: const FORMATETC* const format; const STGMEDIUM* const medium; - JuceDataObject (const JuceDataObject&); - JuceDataObject& operator= (const JuceDataObject&); + JUCE_DECLARE_NON_COPYABLE (JuceDataObject); }; static HDROP createHDrop (const StringArray& fileNames) @@ -248270,8 +248133,7 @@ public: private: Pimpl& pimpl; - ScopedDiscOpener (const ScopedDiscOpener&); - ScopedDiscOpener& operator= (const ScopedDiscOpener&); + JUCE_DECLARE_NON_COPYABLE (ScopedDiscOpener); }; DiskState getDiskState() @@ -248701,8 +248563,7 @@ private: MIDIHDR hdr; char data [256]; - MidiHeader (const MidiHeader&); - MidiHeader& operator= (const MidiHeader&); + JUCE_DECLARE_NON_COPYABLE (MidiHeader); }; enum { numHeaders = 32 }; @@ -252743,8 +252604,7 @@ private: return false; } - WASAPIDeviceBase (const WASAPIDeviceBase&); - WASAPIDeviceBase& operator= (const WASAPIDeviceBase&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WASAPIDeviceBase); }; class WASAPIInputDevice : public WASAPIDeviceBase @@ -252859,8 +252719,7 @@ public: ScopedPointer converter; private: - WASAPIInputDevice (const WASAPIInputDevice&); - WASAPIInputDevice& operator= (const WASAPIInputDevice&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WASAPIInputDevice); }; class WASAPIOutputDevice : public WASAPIDeviceBase @@ -252945,8 +252804,7 @@ public: ScopedPointer converter; private: - WASAPIOutputDevice (const WASAPIOutputDevice&); - WASAPIOutputDevice& operator= (const WASAPIOutputDevice&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WASAPIOutputDevice); }; class WASAPIAudioIODevice : public AudioIODevice, @@ -254152,8 +254010,7 @@ private: Array listeners; CriticalSection listenerLock; - DShowCameraDeviceInteral (const DShowCameraDeviceInteral&); - DShowCameraDeviceInteral& operator= (const DShowCameraDeviceInteral&); + JUCE_DECLARE_NON_COPYABLE (DShowCameraDeviceInteral); }; CameraDevice::CameraDevice (const String& name_, int /*index*/) @@ -254536,8 +254393,7 @@ private: bool triggered; const bool manualReset; - WaitableEventImpl (const WaitableEventImpl&); - WaitableEventImpl& operator= (const WaitableEventImpl&); + JUCE_DECLARE_NON_COPYABLE (WaitableEventImpl); }; WaitableEvent::WaitableEvent (const bool manualReset) throw() @@ -255388,8 +255244,7 @@ private: const char* wildcardUTF8; DIR* dir; - Pimpl (const Pimpl&); - Pimpl& operator= (const Pimpl&); + JUCE_DECLARE_NON_COPYABLE (Pimpl); }; DirectoryIterator::NativeIterator::NativeIterator (const File& directory, const String& wildCard) @@ -259413,8 +259268,7 @@ private: #if JUCE_USE_XSHM bool useARGBImagesForRendering, shmCompletedDrawing; #endif - LinuxRepaintManager (const LinuxRepaintManager&); - LinuxRepaintManager& operator= (const LinuxRepaintManager&); + JUCE_DECLARE_NON_COPYABLE (LinuxRepaintManager); }; ScopedPointer repainter; @@ -264386,8 +264240,7 @@ private: bool triggered; const bool manualReset; - WaitableEventImpl (const WaitableEventImpl&); - WaitableEventImpl& operator= (const WaitableEventImpl&); + JUCE_DECLARE_NON_COPYABLE (WaitableEventImpl); }; WaitableEvent::WaitableEvent (const bool manualReset) throw() @@ -265305,8 +265158,7 @@ private: const char* wildcardUTF8; NSDirectoryEnumerator* enumerator; - Pimpl (const Pimpl&); - Pimpl& operator= (const Pimpl&); + JUCE_DECLARE_NON_COPYABLE (Pimpl); }; DirectoryIterator::NativeIterator::NativeIterator (const File& directory, const String& wildCard) @@ -266155,21 +266007,13 @@ public: NSPoint p[3]; switch ([bez elementAtIndex: i associatedPoints: p]) { - case NSMoveToBezierPathElement: - path.startNewSubPath ((float) p[0].x, (float) -p[0].y); - break; - case NSLineToBezierPathElement: - path.lineTo ((float) p[0].x, (float) -p[0].y); - break; - case NSCurveToBezierPathElement: - path.cubicTo ((float) p[0].x, (float) -p[0].y, (float) p[1].x, (float) -p[1].y, (float) p[2].x, (float) -p[2].y); - break; - case NSClosePathBezierPathElement: - path.closeSubPath(); - break; - default: - jassertfalse; - break; + case NSMoveToBezierPathElement: path.startNewSubPath ((float) p[0].x, (float) -p[0].y); break; + case NSLineToBezierPathElement: path.lineTo ((float) p[0].x, (float) -p[0].y); break; + case NSCurveToBezierPathElement: path.cubicTo ((float) p[0].x, (float) -p[0].y, + (float) p[1].x, (float) -p[1].y, + (float) p[2].x, (float) -p[2].y); break; + case NSClosePathBezierPathElement: path.closeSubPath(); break; + default: jassertfalse; break; } } @@ -266350,15 +266194,15 @@ const StringArray Font::findAllTypefaceNames() void Font::getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed, String& defaultFallback) { -#if JUCE_IOS + #if JUCE_IOS defaultSans = "Helvetica"; defaultSerif = "Times New Roman"; defaultFixed = "Courier New"; -#else + #else defaultSans = "Lucida Grande"; defaultSerif = "Times New Roman"; defaultFixed = "Monaco"; -#endif + #endif defaultFallback = "Arial Unicode MS"; } @@ -267121,8 +266965,7 @@ private: CGContextConcatCTM (context, t); } - CoreGraphicsContext (const CoreGraphicsContext&); - CoreGraphicsContext& operator= (const CoreGraphicsContext&); + JUCE_DECLARE_NON_COPYABLE (CoreGraphicsContext); }; LowLevelGraphicsContext* CoreGraphicsImage::createLowLevelContext() @@ -269995,8 +269838,7 @@ private: } } - IPhoneAudioIODevice (const IPhoneAudioIODevice&); - IPhoneAudioIODevice& operator= (const IPhoneAudioIODevice&); + JUCE_DECLARE_NON_COPYABLE (IPhoneAudioIODevice); }; class IPhoneAudioIODeviceType : public AudioIODeviceType @@ -270897,21 +270739,13 @@ public: NSPoint p[3]; switch ([bez elementAtIndex: i associatedPoints: p]) { - case NSMoveToBezierPathElement: - path.startNewSubPath ((float) p[0].x, (float) -p[0].y); - break; - case NSLineToBezierPathElement: - path.lineTo ((float) p[0].x, (float) -p[0].y); - break; - case NSCurveToBezierPathElement: - path.cubicTo ((float) p[0].x, (float) -p[0].y, (float) p[1].x, (float) -p[1].y, (float) p[2].x, (float) -p[2].y); - break; - case NSClosePathBezierPathElement: - path.closeSubPath(); - break; - default: - jassertfalse; - break; + case NSMoveToBezierPathElement: path.startNewSubPath ((float) p[0].x, (float) -p[0].y); break; + case NSLineToBezierPathElement: path.lineTo ((float) p[0].x, (float) -p[0].y); break; + case NSCurveToBezierPathElement: path.cubicTo ((float) p[0].x, (float) -p[0].y, + (float) p[1].x, (float) -p[1].y, + (float) p[2].x, (float) -p[2].y); break; + case NSClosePathBezierPathElement: path.closeSubPath(); break; + default: jassertfalse; break; } } @@ -271092,15 +270926,15 @@ const StringArray Font::findAllTypefaceNames() void Font::getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed, String& defaultFallback) { -#if JUCE_IOS + #if JUCE_IOS defaultSans = "Helvetica"; defaultSerif = "Times New Roman"; defaultFixed = "Courier New"; -#else + #else defaultSans = "Lucida Grande"; defaultSerif = "Times New Roman"; defaultFixed = "Monaco"; -#endif + #endif defaultFallback = "Arial Unicode MS"; } @@ -271863,8 +271697,7 @@ private: CGContextConcatCTM (context, t); } - CoreGraphicsContext (const CoreGraphicsContext&); - CoreGraphicsContext& operator= (const CoreGraphicsContext&); + JUCE_DECLARE_NON_COPYABLE (CoreGraphicsContext); }; LowLevelGraphicsContext* CoreGraphicsImage::createLowLevelContext() diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 67fe696312..806206b873 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -64,7 +64,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 52 -#define JUCE_BUILDNUMBER 97 +#define JUCE_BUILDNUMBER 98 /** Current Juce version number. @@ -857,33 +857,22 @@ extern JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger(); #define __JUCE_MEMORY_JUCEHEADER__ /* - This file defines the various juce_malloc(), juce_free() macros that should be used in + This file defines the various juce_malloc(), juce_free() macros that can be used in preference to the standard calls. + + None of this stuff is actually used in the library itself, and will probably be + deprecated at some point in the future, to force everyone to use HeapBlock and other + safer allocation methods. */ -#if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS +#if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS && ! DOXYGEN #ifndef JUCE_DLL // Win32 debug non-DLL versions.. - /** This should be used instead of calling malloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_malloc(numBytes) _malloc_dbg (numBytes, _NORMAL_BLOCK, __FILE__, __LINE__) - - /** This should be used instead of calling calloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_calloc(numBytes) _calloc_dbg (1, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__) - - /** This should be used instead of calling realloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_realloc(location, numBytes) _realloc_dbg (location, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__) - - /** This should be used instead of calling free directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_free(location) _free_dbg (location, _NORMAL_BLOCK) #else @@ -892,83 +881,64 @@ extern JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger(); // For the DLL, we'll define some functions in the DLL that will be used for allocation - that // way all juce calls in the DLL and in the host API will all use the same allocator. - extern JUCE_API void* juce_DebugMalloc (const int size, const char* file, const int line); - extern JUCE_API void* juce_DebugCalloc (const int size, const char* file, const int line); - extern JUCE_API void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line); - extern JUCE_API void juce_DebugFree (void* const block); + extern JUCE_API void* juce_DebugMalloc (int size, const char* file, int line); + extern JUCE_API void* juce_DebugCalloc (int size, const char* file, int line); + extern JUCE_API void* juce_DebugRealloc (void* block, int size, const char* file, int line); + extern JUCE_API void juce_DebugFree (void* block); - /** This should be used instead of calling malloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_DebugMalloc (numBytes, __FILE__, __LINE__) - - /** This should be used instead of calling calloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_DebugCalloc (numBytes, __FILE__, __LINE__) - - /** This should be used instead of calling realloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_DebugRealloc (location, numBytes, __FILE__, __LINE__) - - /** This should be used instead of calling free directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_free(location) JUCE_NAMESPACE::juce_DebugFree (location) + + #define JUCE_LEAK_DETECTOR(OwnerClass) public:\ + static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \ + static void* operator new (size_t, void* p) { return p; } \ + static void operator delete (void* p) { juce_free (p); } \ + static void operator delete (void*, void*) {} #endif -#elif defined (JUCE_DLL) +#elif defined (JUCE_DLL) && ! DOXYGEN // Win32 DLL (release) versions.. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that // way all juce calls in the DLL and in the host API will all use the same allocator. - extern JUCE_API void* juce_Malloc (const int size); - extern JUCE_API void* juce_Calloc (const int size); - extern JUCE_API void* juce_Realloc (void* const block, const int size); - extern JUCE_API void juce_Free (void* const block); + extern JUCE_API void* juce_Malloc (int size); + extern JUCE_API void* juce_Calloc (int size); + extern JUCE_API void* juce_Realloc (void* block, int size); + extern JUCE_API void juce_Free (void* block); - /** This should be used instead of calling malloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_Malloc (numBytes) - - /** This should be used instead of calling calloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_Calloc (numBytes) - - /** This should be used instead of calling realloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_Realloc (location, numBytes) - - /** This should be used instead of calling free directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_free(location) JUCE_NAMESPACE::juce_Free (location) + #define JUCE_LEAK_DETECTOR(OwnerClass) public:\ + static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \ + static void* operator new (size_t, void* p) { return p; } \ + static void operator delete (void* p) { juce_free (p); } \ + static void operator delete (void*, void*) {} #else // Mac, Linux and Win32 (release) versions.. - /** This should be used instead of calling malloc directly. + /** This can be used instead of calling malloc directly. Only use direct memory allocation if there's really no way to use a HeapBlock object instead! */ #define juce_malloc(numBytes) malloc (numBytes) - /** This should be used instead of calling calloc directly. + /** This can be used instead of calling calloc directly. Only use direct memory allocation if there's really no way to use a HeapBlock object instead! */ #define juce_calloc(numBytes) calloc (1, numBytes) - /** This should be used instead of calling realloc directly. + /** This can be used instead of calling realloc directly. Only use direct memory allocation if there's really no way to use a HeapBlock object instead! */ #define juce_realloc(location, numBytes) realloc (location, numBytes) - /** This should be used instead of calling free directly. + /** This can be used instead of calling free directly. Only use direct memory allocation if there's really no way to use a HeapBlock object instead! */ #define juce_free(location) free (location) @@ -1000,18 +970,17 @@ extern JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger(); #define alloca __builtin_alloca #endif -/** Clears a block of memory. */ +/** Fills a block of memory with zeros. */ inline void zeromem (void* memory, size_t numBytes) throw() { memset (memory, 0, numBytes); } -/** Clears a reference to a local structure. */ +/** Overwrites a structure or object with zeros. */ template inline void zerostruct (Type& structure) throw() { memset (&structure, 0, sizeof (structure)); } -/** A handy function that calls delete on a pointer if it's non-zero, and then sets - the pointer to null. +/** Delete an object pointer, and sets the pointer to null. - Never use this if there's any way you could use a ScopedPointer or other safer way of - managing the lieftimes of your objects! + Remember that it's not good c++ practice to use delete directly - always try to use a ScopedPointer + or other automatic lieftime-management system rather than resorting to deleting raw pointers! */ template inline void deleteAndZero (Type& pointer) { delete pointer; pointer = 0; } @@ -1434,8 +1403,8 @@ public: private: ByteOrder(); - ByteOrder (const ByteOrder&); - ByteOrder& operator= (const ByteOrder&); + + JUCE_DECLARE_NON_COPYABLE (ByteOrder); }; #if JUCE_USE_INTRINSICS @@ -2631,8 +2600,7 @@ public: String& result; int nextIndex; - Concatenator (const Concatenator&); - Concatenator& operator= (const Concatenator&); + JUCE_DECLARE_NON_COPYABLE (Concatenator); }; private: @@ -3214,15 +3182,7 @@ private: } }; -#if JUCE_DLL && ! DOXYGEN // This hack makes use of the leak detector macros to add dll-safe allocators to all the classes.. - #define JUCE_LEAK_DETECTOR(OwnerClass) \ - public:\ - static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \ - static void* operator new (size_t, void* p) { return p; } \ - static void operator delete (void* p) { juce_free (p); } \ - static void operator delete (void*, void*) { } - -#elif JUCE_CHECK_MEMORY_LEAKS || DOXYGEN +#if DOXYGEN || (JUCE_CHECK_MEMORY_LEAKS && ! defined (JUCE_LEAK_DETECTOR)) /** This macro lets you embed a leak-detecting object inside a class. To use it, simply declare a JUCE_LEAK_DETECTOR(YourClassName) inside a private section @@ -3494,13 +3454,13 @@ private: E.g. instead of this: @code - int* temp = (int*) juce_malloc (1024 * sizeof (int)); + int* temp = (int*) malloc (1024 * sizeof (int)); memcpy (temp, xyz, 1024 * sizeof (int)); - juce_free (temp); - temp = (int*) juce_calloc (2048 * sizeof (int)); + free (temp); + temp = (int*) calloc (2048 * sizeof (int)); temp[0] = 1234; memcpy (foobar, temp, 2048 * sizeof (int)); - juce_free (temp); + free (temp); @endcode ..you could just write this: @@ -3541,7 +3501,7 @@ public: If you want an array of zero values, you can use the calloc() method instead. */ explicit HeapBlock (const size_t numElements) - : data (static_cast (::juce_malloc (numElements * sizeof (ElementType)))) + : data (static_cast (::malloc (numElements * sizeof (ElementType)))) { } @@ -3551,7 +3511,7 @@ public: */ ~HeapBlock() { - ::juce_free (data); + ::free (data); } /** Returns a raw pointer to the allocated data. @@ -3621,8 +3581,8 @@ public: */ void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) { - ::juce_free (data); - data = static_cast (::juce_malloc (newNumElements * elementSize)); + ::free (data); + data = static_cast (::malloc (newNumElements * elementSize)); } /** Allocates a specified amount of memory and clears it. @@ -3630,8 +3590,8 @@ public: */ void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) { - ::juce_free (data); - data = static_cast (::juce_calloc (newNumElements * elementSize)); + ::free (data); + data = static_cast (::calloc (newNumElements, elementSize)); } /** Allocates a specified amount of memory and optionally clears it. @@ -3640,12 +3600,12 @@ public: */ void allocate (const size_t newNumElements, const bool initialiseToZero) { - ::juce_free (data); + ::free (data); if (initialiseToZero) - data = static_cast (::juce_calloc (newNumElements * sizeof (ElementType))); + data = static_cast (::calloc (newNumElements, sizeof (ElementType))); else - data = static_cast (::juce_malloc (newNumElements * sizeof (ElementType))); + data = static_cast (::malloc (newNumElements * sizeof (ElementType))); } /** Re-allocates a specified amount of memory. @@ -3656,9 +3616,9 @@ public: void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) { if (data == 0) - data = static_cast (::juce_malloc (newNumElements * elementSize)); + data = static_cast (::malloc (newNumElements * elementSize)); else - data = static_cast (::juce_realloc (data, newNumElements * elementSize)); + data = static_cast (::realloc (data, newNumElements * elementSize)); } /** Frees any currently-allocated data. @@ -3666,7 +3626,7 @@ public: */ void free() { - ::juce_free (data); + ::free (data); data = 0; } @@ -3682,8 +3642,7 @@ private: ElementType* data; - HeapBlock (const HeapBlock&); - HeapBlock& operator= (const HeapBlock&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HeapBlock); }; #endif // __JUCE_HEAPBLOCK_JUCEHEADER__ @@ -3770,8 +3729,7 @@ public: int numAllocated; private: - ArrayAllocationBase (const ArrayAllocationBase&); - ArrayAllocationBase& operator= (const ArrayAllocationBase&); + JUCE_DECLARE_NON_COPYABLE (ArrayAllocationBase); }; #endif // __JUCE_ARRAYALLOCATIONBASE_JUCEHEADER__ @@ -4109,8 +4067,7 @@ private: mutable pthread_mutex_t internal; #endif - CriticalSection (const CriticalSection&); - CriticalSection& operator= (const CriticalSection&); + JUCE_DECLARE_NON_COPYABLE (CriticalSection); }; /** @@ -4140,8 +4097,7 @@ public: typedef ScopedLockType ScopedUnlockType; private: - DummyCriticalSection (const DummyCriticalSection&); - DummyCriticalSection& operator= (const DummyCriticalSection&); + JUCE_DECLARE_NON_COPYABLE (DummyCriticalSection); }; #endif // __JUCE_CRITICALSECTION_JUCEHEADER__ @@ -12749,8 +12705,7 @@ public: const ListType& list; int index; - Iterator (const Iterator&); - Iterator& operator= (const Iterator&); + JUCE_DECLARE_NON_COPYABLE (Iterator); }; typedef ListenerList ThisType; @@ -12762,8 +12717,7 @@ private: ArrayType listeners; - ListenerList (const ListenerList&); - ListenerList& operator= (const ListenerList&); + JUCE_DECLARE_NON_COPYABLE (ListenerList); #undef LL_TEMPLATE #undef LL_PARAM @@ -13092,8 +13046,7 @@ private: void callListeners(); - ChangeBroadcaster (const ChangeBroadcaster&); - ChangeBroadcaster& operator= (const ChangeBroadcaster&); + JUCE_DECLARE_NON_COPYABLE (ChangeBroadcaster); }; #endif // __JUCE_CHANGEBROADCASTER_JUCEHEADER__ @@ -13830,8 +13783,7 @@ private: private: ElementComparator& comparator; - ComparatorAdapter (const ComparatorAdapter&); - ComparatorAdapter& operator= (const ComparatorAdapter&); + JUCE_DECLARE_NON_COPYABLE (ComparatorAdapter); }; friend class SharedObject; @@ -14359,8 +14311,8 @@ public: private: PlatformUtilities(); - PlatformUtilities (const PlatformUtilities&); - PlatformUtilities& operator= (const PlatformUtilities&); + + JUCE_DECLARE_NON_COPYABLE (PlatformUtilities); }; #if JUCE_MAC || JUCE_IOS @@ -14377,8 +14329,7 @@ public: private: void* pool; - ScopedAutoReleasePool (const ScopedAutoReleasePool&); - ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&); + JUCE_DECLARE_NON_COPYABLE (ScopedAutoReleasePool); }; #define JUCE_AUTORELEASEPOOL const JUCE_NAMESPACE::ScopedAutoReleasePool pool; @@ -14668,8 +14619,7 @@ private: const CriticalSection& lock_; - ScopedLock (const ScopedLock&); - ScopedLock& operator= (const ScopedLock&); + JUCE_DECLARE_NON_COPYABLE (ScopedLock); }; /** @@ -14738,8 +14688,7 @@ private: const CriticalSection& lock_; - ScopedUnlock (const ScopedLock&); - ScopedUnlock& operator= (const ScopedUnlock&); + JUCE_DECLARE_NON_COPYABLE (ScopedUnlock); }; #endif // __JUCE_SCOPEDLOCK_JUCEHEADER__ @@ -15134,8 +15083,8 @@ private: static CPUFlags cpuFlags; SystemStats(); - SystemStats (const SystemStats&); - SystemStats& operator= (const SystemStats&); + + JUCE_DECLARE_NON_COPYABLE (SystemStats); }; #endif // __JUCE_SYSTEMSTATS_JUCEHEADER__ @@ -15433,8 +15382,8 @@ public: private: Primes(); - Primes (const Primes&); - Primes& operator= (const Primes&); + + JUCE_DECLARE_NON_COPYABLE (Primes); }; #endif // __JUCE_PRIMES_JUCEHEADER__ @@ -17083,13 +17032,14 @@ public: indicates that a default compression level should be used. @param deleteDestStreamWhenDestroyed whether or not to delete the destStream object when this stream is destroyed - @param noWrap this is used internally by the ZipFile class - and should be ignored by user applications + @param windowBits this is used internally to change the window size used + by zlib - leave it as 0 unless you specifically need to set + its value for some reason */ GZIPCompressorOutputStream (OutputStream* destStream, int compressionLevel = 0, bool deleteDestStreamWhenDestroyed = false, - bool noWrap = false); + int windowBits = 0); /** Destructor. */ ~GZIPCompressorOutputStream(); @@ -17099,6 +17049,15 @@ public: bool setPosition (int64 newPosition); bool write (const void* destBuffer, int howMany); + /** These are preset values that can be used for the constructor's windowBits paramter. + For more info about this, see the zlib documentation for its windowBits parameter. + */ + enum WindowBitsValues + { + windowBitsRaw = -15, + windowBitsGZIP = 15 + 16 + }; + private: OutputStream* const destStream; @@ -17849,8 +17808,7 @@ public: InterProcessLock& lock_; bool lockWasSuccessful; - ScopedLockType (const ScopedLockType&); - ScopedLockType& operator= (const ScopedLockType&); + JUCE_DECLARE_NON_COPYABLE (ScopedLockType); }; private: @@ -17862,8 +17820,7 @@ private: CriticalSection lock; String name; - InterProcessLock (const InterProcessLock&); - InterProcessLock& operator= (const InterProcessLock&); + JUCE_DECLARE_NON_COPYABLE (InterProcessLock); }; #endif // __JUCE_INTERPROCESSLOCK_JUCEHEADER__ @@ -17938,8 +17895,8 @@ public: private: Process(); - Process (const Process&); - Process& operator= (const Process&); + + JUCE_DECLARE_NON_COPYABLE (Process); }; #endif // __JUCE_PROCESS_JUCEHEADER__ @@ -18377,8 +18334,7 @@ private: mutable Thread::ThreadID writerThreadId; mutable Array readerThreads; - ReadWriteLock (const ReadWriteLock&); - ReadWriteLock& operator= (const ReadWriteLock&); + JUCE_DECLARE_NON_COPYABLE (ReadWriteLock); }; #endif // __JUCE_READWRITELOCK_JUCEHEADER__ @@ -18446,8 +18402,7 @@ private: const ReadWriteLock& lock_; - ScopedReadLock (const ScopedReadLock&); - ScopedReadLock& operator= (const ScopedReadLock&); + JUCE_DECLARE_NON_COPYABLE (ScopedReadLock); }; #endif // __JUCE_SCOPEDREADLOCK_JUCEHEADER__ @@ -18525,8 +18480,7 @@ private: const CriticalSection& lock_; const bool lockWasSuccessful; - ScopedTryLock (const ScopedTryLock&); - ScopedTryLock& operator= (const ScopedTryLock&); + JUCE_DECLARE_NON_COPYABLE (ScopedTryLock); }; #endif // __JUCE_SCOPEDTRYLOCK_JUCEHEADER__ @@ -18591,8 +18545,7 @@ private: const ReadWriteLock& lock_; - ScopedWriteLock (const ScopedWriteLock&); - ScopedWriteLock& operator= (const ScopedWriteLock&); + JUCE_DECLARE_NON_COPYABLE (ScopedWriteLock); }; #endif // __JUCE_SCOPEDWRITELOCK_JUCEHEADER__ @@ -22445,8 +22398,7 @@ public: const Path& path; size_t index; - Iterator (const Iterator&); - Iterator& operator= (const Iterator&); + JUCE_DECLARE_NON_COPYABLE (Iterator); }; /** Loads a stored path from a data stream. @@ -24159,8 +24111,8 @@ private: // this isn't a class you should ever instantiate - it's just here for the // static values in it. Colours(); - Colours (const Colours&); - Colours& operator= (const Colours&); + + JUCE_DECLARE_NON_COPYABLE (Colours); }; #endif // __JUCE_COLOURS_JUCEHEADER__ @@ -25398,8 +25350,7 @@ public: int lineStride, pixelStride, width, height; private: - BitmapData (const BitmapData&); - BitmapData& operator= (const BitmapData&); + JUCE_DECLARE_NON_COPYABLE (BitmapData); }; /** Copies some pixel values to a rectangle of the image. @@ -25699,8 +25650,7 @@ public: const RectangleList& owner; int index; - Iterator (const Iterator&); - Iterator& operator= (const Iterator&); + JUCE_DECLARE_NON_COPYABLE (Iterator); }; private: @@ -25852,11 +25802,10 @@ public: static void deleteAll(); private: - DeletedAtShutdown (const DeletedAtShutdown&); - DeletedAtShutdown& operator= (const DeletedAtShutdown&); - static CriticalSection& getLock(); static Array & getObjects(); + + JUCE_DECLARE_NON_COPYABLE (DeletedAtShutdown); }; #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__ @@ -25969,8 +25918,7 @@ private: void endModal (Component* component, int returnValue); void endModal (Component* component); - ModalComponentManager (const ModalComponentManager&); - ModalComponentManager& operator= (const ModalComponentManager&); + JUCE_DECLARE_NON_COPYABLE (ModalComponentManager); }; #endif // __JUCE_MODALCOMPONENTMANAGER_JUCEHEADER__ @@ -27997,8 +27945,7 @@ public: SafeComponentPtr safePointer1, safePointer2; Component* const component2; - BailOutChecker (const BailOutChecker&); - BailOutChecker& operator= (const BailOutChecker&); + JUCE_DECLARE_NON_COPYABLE (BailOutChecker); }; #ifndef DOXYGEN @@ -28682,8 +28629,7 @@ private: private: ApplicationCommandTarget* const owner; - CommandTargetMessageInvoker (const CommandTargetMessageInvoker&); - CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&); + JUCE_DECLARE_NON_COPYABLE (CommandTargetMessageInvoker); }; ScopedPointer messageInvoker; @@ -28977,8 +28923,7 @@ private: ScopedPointer appLock; static JUCEApplication* appInstance; - JUCEApplication (const JUCEApplication&); - JUCEApplication& operator= (const JUCEApplication&); + JUCE_DECLARE_NON_COPYABLE (JUCEApplication); }; #endif // __JUCE_APPLICATION_JUCEHEADER__ @@ -30734,8 +30679,7 @@ public: } private: - ConverterInstance (const ConverterInstance&); - ConverterInstance& operator= (const ConverterInstance&); + JUCE_DECLARE_NON_COPYABLE (ConverterInstance); const int sourceChannels, destChannels; }; @@ -30800,8 +30744,7 @@ public: private: AudioDataConverters(); - AudioDataConverters (const AudioDataConverters&); - AudioDataConverters& operator= (const AudioDataConverters&); + JUCE_DECLARE_NON_COPYABLE (AudioDataConverters); }; #endif // __JUCE_AUDIODATACONVERTERS_JUCEHEADER__ @@ -34349,8 +34292,7 @@ protected: private: String typeName; - AudioIODeviceType (const AudioIODeviceType&); - AudioIODeviceType& operator= (const AudioIODeviceType&); + JUCE_DECLARE_NON_COPYABLE (AudioIODeviceType); }; #endif // __JUCE_AUDIOIODEVICETYPE_JUCEHEADER__ @@ -35561,8 +35503,7 @@ public: const MidiBuffer& buffer; const uint8* data; - Iterator (const Iterator&); - Iterator& operator= (const Iterator&); + JUCE_DECLARE_NON_COPYABLE (Iterator); }; private: @@ -39850,8 +39791,7 @@ private: AudioProcessor* const owner; - AudioProcessorEditor (const AudioProcessorEditor&); - AudioProcessorEditor& operator= (const AudioProcessorEditor&); + JUCE_DECLARE_NON_COPYABLE (AudioProcessorEditor); }; #endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__ @@ -40974,7 +40914,7 @@ public: { if (e->type == kVstSysExType) { - juce_free (((VstMidiSysexEvent*) e)->sysexDump); + delete[] (((VstMidiSysexEvent*) e)->sysexDump); e->type = kVstMidiType; e->byteSize = sizeof (VstMidiEvent); e->noteLength = 0; @@ -40991,10 +40931,9 @@ public: VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e; if (se->type == kVstSysExType) - se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes); - else - se->sysexDump = (char*) juce_malloc (numBytes); + delete[] se->sysexDump; + se->sysexDump = new char [numBytes]; memcpy (se->sysexDump, midiData, numBytes); se->type = kVstSysExType; @@ -41068,7 +41007,7 @@ public: VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]); if (e->type == kVstSysExType) - juce_free (((VstMidiSysexEvent*) e)->sysexDump); + delete[] (((VstMidiSysexEvent*) e)->sysexDump); juce_free (e); } @@ -43505,8 +43444,7 @@ private: SortedSet actionListeners; CriticalSection actionListenerLock; - ActionBroadcaster (const ActionBroadcaster&); - ActionBroadcaster& operator= (const ActionBroadcaster&); + JUCE_DECLARE_NON_COPYABLE (ActionBroadcaster); }; #endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__ @@ -44114,8 +44052,7 @@ private: void init (Thread* thread, ThreadPoolJob* job); - MessageManagerLock (const MessageManagerLock&); - MessageManagerLock& operator= (const MessageManagerLock&); + JUCE_DECLARE_NON_COPYABLE (MessageManagerLock); }; #endif // __JUCE_MESSAGEMANAGER_JUCEHEADER__ @@ -44645,8 +44582,7 @@ public: const ElementType type; private: - ElementBase (const ElementBase&); - ElementBase& operator= (const ElementBase&); + JUCE_DECLARE_NON_COPYABLE (ElementBase); }; class JUCE_API StartSubPath : public ElementBase @@ -44661,8 +44597,7 @@ public: RelativePoint startPos; private: - StartSubPath (const StartSubPath&); - StartSubPath& operator= (const StartSubPath&); + JUCE_DECLARE_NON_COPYABLE (StartSubPath); }; class JUCE_API CloseSubPath : public ElementBase @@ -44675,8 +44610,7 @@ public: RelativePoint* getControlPoints (int& numPoints); private: - CloseSubPath (const CloseSubPath&); - CloseSubPath& operator= (const CloseSubPath&); + JUCE_DECLARE_NON_COPYABLE (CloseSubPath); }; class JUCE_API LineTo : public ElementBase @@ -44691,8 +44625,7 @@ public: RelativePoint endPoint; private: - LineTo (const LineTo&); - LineTo& operator= (const LineTo&); + JUCE_DECLARE_NON_COPYABLE (LineTo); }; class JUCE_API QuadraticTo : public ElementBase @@ -44707,8 +44640,7 @@ public: RelativePoint controlPoints[2]; private: - QuadraticTo (const QuadraticTo&); - QuadraticTo& operator= (const QuadraticTo&); + JUCE_DECLARE_NON_COPYABLE (QuadraticTo); }; class JUCE_API CubicTo : public ElementBase @@ -44723,8 +44655,7 @@ public: RelativePoint controlPoints[3]; private: - CubicTo (const CubicTo&); - CubicTo& operator= (const CubicTo&); + JUCE_DECLARE_NON_COPYABLE (CubicTo); }; OwnedArray elements; @@ -50783,12 +50714,12 @@ private: void mouseDown (const MouseEvent& e) { - myDragger.startDraggingComponent (this, e, 0); + myDragger.startDraggingComponent (this, e); } void mouseDrag (const MouseEvent& e) { - myDragger.dragComponent (this, e); + myDragger.dragComponent (this, e, 0); } }; @endcode @@ -50806,13 +50737,11 @@ public: /** Call this from your component's mouseDown() method, to prepare for dragging. @param componentToDrag the component that you want to drag - @param constrainer a constrainer object to use to keep the component - from going offscreen + @param e the mouse event that is triggering the drag @see dragComponent */ void startDraggingComponent (Component* componentToDrag, - const MouseEvent& e, - ComponentBoundsConstrainer* constrainer); + const MouseEvent& e); /** Call this from your mouseDrag() callback to move the component. @@ -50823,14 +50752,17 @@ public: @param componentToDrag the component that you want to drag @param e the current mouse-drag event - @see dragComponent + @param constrainer an optional constrainer object that should be used + to apply limits to the component's position. Pass + null if you don't want to contrain the movement. + @see startDraggingComponent */ void dragComponent (Component* componentToDrag, - const MouseEvent& e); + const MouseEvent& e, + ComponentBoundsConstrainer* constrainer); private: - ComponentBoundsConstrainer* constrainer; Point mouseDownWithinTarget; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ComponentDragger); @@ -52833,8 +52765,7 @@ private: String text; Justification justification; - GroupComponent (const GroupComponent&); - GroupComponent& operator= (const GroupComponent&); + JUCE_DECLARE_NON_COPYABLE (GroupComponent); }; #endif // __JUCE_GROUPCOMPONENT_JUCEHEADER__ @@ -55734,8 +55665,7 @@ private: friend class PopupMenu::Window; bool isHighlighted, isTriggeredAutomatically; - PopupMenuCustomComponent (const PopupMenuCustomComponent&); - PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&); + JUCE_DECLARE_NON_COPYABLE (PopupMenuCustomComponent); }; #endif // __JUCE_POPUPMENUCUSTOMCOMPONENT_JUCEHEADER__ @@ -56363,8 +56293,7 @@ private: void hoverTimerCallback(); void checkJustHoveredCallback(); - MouseHoverDetector (const MouseHoverDetector&); - MouseHoverDetector& operator= (const MouseHoverDetector&); + JUCE_DECLARE_NON_COPYABLE (MouseHoverDetector); }; #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__ @@ -61807,9 +61736,9 @@ private: friend class Pimpl; ImageCache(); - ImageCache (const ImageCache&); - ImageCache& operator= (const ImageCache&); ~ImageCache(); + + JUCE_DECLARE_NON_COPYABLE (ImageCache); }; #endif // __JUCE_IMAGECACHE_JUCEHEADER__ @@ -62654,8 +62583,7 @@ private: const String name; UnitTestRunner* runner; - UnitTest (const UnitTest&); - UnitTest& operator= (const UnitTest&); + JUCE_DECLARE_NON_COPYABLE (UnitTest); }; /** @@ -62750,8 +62678,7 @@ private: void addPass(); void addFail (const String& failureMessage); - UnitTestRunner (const UnitTestRunner&); - UnitTestRunner& operator= (const UnitTestRunner&); + JUCE_DECLARE_NON_COPYABLE (UnitTestRunner); }; #endif // __JUCE_UNITTEST_JUCEHEADER__ @@ -62771,7 +62698,7 @@ private: #pragma pack (pop) #endif -#if JUCE_DLL +#ifdef JUCE_DLL #undef JUCE_LEAK_DETECTOR(OwnerClass) #define JUCE_LEAK_DETECTOR(OwnerClass) #endif diff --git a/src/application/juce_Application.h b/src/application/juce_Application.h index 4459faf3bf..e7770e72f7 100644 --- a/src/application/juce_Application.h +++ b/src/application/juce_Application.h @@ -287,8 +287,7 @@ private: ScopedPointer appLock; static JUCEApplication* appInstance; - JUCEApplication (const JUCEApplication&); - JUCEApplication& operator= (const JUCEApplication&); + JUCE_DECLARE_NON_COPYABLE (JUCEApplication); }; diff --git a/src/application/juce_ApplicationCommandTarget.h b/src/application/juce_ApplicationCommandTarget.h index 2b35b100a3..65f42d31a4 100644 --- a/src/application/juce_ApplicationCommandTarget.h +++ b/src/application/juce_ApplicationCommandTarget.h @@ -247,8 +247,7 @@ private: private: ApplicationCommandTarget* const owner; - CommandTargetMessageInvoker (const CommandTargetMessageInvoker&); - CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&); + JUCE_DECLARE_NON_COPYABLE (CommandTargetMessageInvoker); }; ScopedPointer messageInvoker; diff --git a/src/audio/audio_file_formats/juce_AudioFormatWriter.cpp b/src/audio/audio_file_formats/juce_AudioFormatWriter.cpp index eb5b4a62e5..96c3aeba89 100644 --- a/src/audio/audio_file_formats/juce_AudioFormatWriter.cpp +++ b/src/audio/audio_file_formats/juce_AudioFormatWriter.cpp @@ -250,8 +250,7 @@ private: ScopedPointer writer; volatile bool isRunning; - Buffer (const Buffer&); - Buffer& operator= (const Buffer&); + JUCE_DECLARE_NON_COPYABLE (Buffer); }; AudioFormatWriter::ThreadedWriter::ThreadedWriter (AudioFormatWriter* writer, TimeSliceThread& backgroundThread, int numSamplesToBuffer) diff --git a/src/audio/audio_sources/juce_BufferingAudioSource.cpp b/src/audio/audio_sources/juce_BufferingAudioSource.cpp index 4fe20b6f2d..16c50045d9 100644 --- a/src/audio/audio_sources/juce_BufferingAudioSource.cpp +++ b/src/audio/audio_sources/juce_BufferingAudioSource.cpp @@ -114,8 +114,7 @@ private: deleteInstance(); } - SharedBufferingAudioSourceThread (const SharedBufferingAudioSourceThread&); - SharedBufferingAudioSourceThread& operator= (const SharedBufferingAudioSourceThread&); + JUCE_DECLARE_NON_COPYABLE (SharedBufferingAudioSourceThread); }; juce_ImplementSingleton (SharedBufferingAudioSourceThread) diff --git a/src/audio/devices/juce_AudioIODeviceType.h b/src/audio/devices/juce_AudioIODeviceType.h index d971622a53..9f9756ced8 100644 --- a/src/audio/devices/juce_AudioIODeviceType.h +++ b/src/audio/devices/juce_AudioIODeviceType.h @@ -137,8 +137,7 @@ protected: private: String typeName; - AudioIODeviceType (const AudioIODeviceType&); - AudioIODeviceType& operator= (const AudioIODeviceType&); + JUCE_DECLARE_NON_COPYABLE (AudioIODeviceType); }; diff --git a/src/audio/dsp/juce_AudioDataConverters.h b/src/audio/dsp/juce_AudioDataConverters.h index 656f823cbc..641652d80e 100644 --- a/src/audio/dsp/juce_AudioDataConverters.h +++ b/src/audio/dsp/juce_AudioDataConverters.h @@ -568,8 +568,7 @@ public: } private: - ConverterInstance (const ConverterInstance&); - ConverterInstance& operator= (const ConverterInstance&); + JUCE_DECLARE_NON_COPYABLE (ConverterInstance); const int sourceChannels, destChannels; }; @@ -640,8 +639,7 @@ public: private: AudioDataConverters(); - AudioDataConverters (const AudioDataConverters&); - AudioDataConverters& operator= (const AudioDataConverters&); + JUCE_DECLARE_NON_COPYABLE (AudioDataConverters); }; diff --git a/src/audio/midi/juce_MidiBuffer.h b/src/audio/midi/juce_MidiBuffer.h index d5430592f5..fa379c1b82 100644 --- a/src/audio/midi/juce_MidiBuffer.h +++ b/src/audio/midi/juce_MidiBuffer.h @@ -218,8 +218,7 @@ public: const MidiBuffer& buffer; const uint8* data; - Iterator (const Iterator&); - Iterator& operator= (const Iterator&); + JUCE_DECLARE_NON_COPYABLE (Iterator); }; private: diff --git a/src/audio/plugins/formats/juce_VSTMidiEventList.h b/src/audio/plugins/formats/juce_VSTMidiEventList.h index 7811fdf2b8..67552b7159 100644 --- a/src/audio/plugins/formats/juce_VSTMidiEventList.h +++ b/src/audio/plugins/formats/juce_VSTMidiEventList.h @@ -69,7 +69,7 @@ public: { if (e->type == kVstSysExType) { - juce_free (((VstMidiSysexEvent*) e)->sysexDump); + delete[] (((VstMidiSysexEvent*) e)->sysexDump); e->type = kVstMidiType; e->byteSize = sizeof (VstMidiEvent); e->noteLength = 0; @@ -86,10 +86,9 @@ public: VstMidiSysexEvent* const se = (VstMidiSysexEvent*) e; if (se->type == kVstSysExType) - se->sysexDump = (char*) juce_realloc (se->sysexDump, numBytes); - else - se->sysexDump = (char*) juce_malloc (numBytes); + delete[] se->sysexDump; + se->sysexDump = new char [numBytes]; memcpy (se->sysexDump, midiData, numBytes); se->type = kVstSysExType; @@ -165,7 +164,7 @@ public: VstMidiEvent* const e = (VstMidiEvent*) (events->events[i]); if (e->type == kVstSysExType) - juce_free (((VstMidiSysexEvent*) e)->sysexDump); + delete[] (((VstMidiSysexEvent*) e)->sysexDump); juce_free (e); } diff --git a/src/audio/plugins/formats/juce_VSTPluginFormat.cpp b/src/audio/plugins/formats/juce_VSTPluginFormat.cpp index 5d4e301a3d..9a18f79a53 100644 --- a/src/audio/plugins/formats/juce_VSTPluginFormat.cpp +++ b/src/audio/plugins/formats/juce_VSTPluginFormat.cpp @@ -90,7 +90,7 @@ BEGIN_JUCE_NAMESPACE If you're not interested in VSTs, you can disable them by changing the JUCE_PLUGINHOST_VST flag in juce_Config.h */ -#include "pluginterfaces/vst2.x/aeffectx.h" +#include #if JUCE_MSVC #pragma warning (pop) @@ -237,7 +237,7 @@ class VSTPluginWindow; #if JUCE_MAC && JUCE_PPC static void* NewCFMFromMachO (void* const machofp) throw() { - void* result = juce_malloc (8); + void* result = (void*) new char[8]; ((void**) result)[0] = machofp; ((void**) result)[1] = result; diff --git a/src/audio/processors/juce_AudioProcessorEditor.h b/src/audio/processors/juce_AudioProcessorEditor.h index 43b5789163..a3ba2c6d9a 100644 --- a/src/audio/processors/juce_AudioProcessorEditor.h +++ b/src/audio/processors/juce_AudioProcessorEditor.h @@ -61,8 +61,7 @@ private: //============================================================================== AudioProcessor* const owner; - AudioProcessorEditor (const AudioProcessorEditor&); - AudioProcessorEditor& operator= (const AudioProcessorEditor&); + JUCE_DECLARE_NON_COPYABLE (AudioProcessorEditor); }; diff --git a/src/audio/processors/juce_AudioProcessorGraph.cpp b/src/audio/processors/juce_AudioProcessorGraph.cpp index 2467c9b37a..78824f20fd 100644 --- a/src/audio/processors/juce_AudioProcessorGraph.cpp +++ b/src/audio/processors/juce_AudioProcessorGraph.cpp @@ -373,8 +373,7 @@ public: private: const int channelNum; - ClearChannelOp (const ClearChannelOp&); - ClearChannelOp& operator= (const ClearChannelOp&); + JUCE_DECLARE_NON_COPYABLE (ClearChannelOp); }; //============================================================================== @@ -396,8 +395,7 @@ public: private: const int srcChannelNum, dstChannelNum; - CopyChannelOp (const CopyChannelOp&); - CopyChannelOp& operator= (const CopyChannelOp&); + JUCE_DECLARE_NON_COPYABLE (CopyChannelOp); }; //============================================================================== @@ -419,8 +417,7 @@ public: private: const int srcChannelNum, dstChannelNum; - AddChannelOp (const AddChannelOp&); - AddChannelOp& operator= (const AddChannelOp&); + JUCE_DECLARE_NON_COPYABLE (AddChannelOp); }; //============================================================================== @@ -441,8 +438,7 @@ public: private: const int bufferNum; - ClearMidiBufferOp (const ClearMidiBufferOp&); - ClearMidiBufferOp& operator= (const ClearMidiBufferOp&); + JUCE_DECLARE_NON_COPYABLE (ClearMidiBufferOp); }; //============================================================================== @@ -464,8 +460,7 @@ public: private: const int srcBufferNum, dstBufferNum; - CopyMidiBufferOp (const CopyMidiBufferOp&); - CopyMidiBufferOp& operator= (const CopyMidiBufferOp&); + JUCE_DECLARE_NON_COPYABLE (CopyMidiBufferOp); }; //============================================================================== @@ -488,8 +483,7 @@ public: private: const int srcBufferNum, dstBufferNum; - AddMidiBufferOp (const AddMidiBufferOp&); - AddMidiBufferOp& operator= (const AddMidiBufferOp&); + JUCE_DECLARE_NON_COPYABLE (AddMidiBufferOp); }; //============================================================================== @@ -535,8 +529,7 @@ private: int totalChans; int midiBufferToUse; - ProcessBufferOp (const ProcessBufferOp&); - ProcessBufferOp& operator= (const ProcessBufferOp&); + JUCE_DECLARE_NON_COPYABLE (ProcessBufferOp); }; //============================================================================== diff --git a/src/containers/juce_ArrayAllocationBase.h b/src/containers/juce_ArrayAllocationBase.h index bdf0f94d28..fed10b9645 100644 --- a/src/containers/juce_ArrayAllocationBase.h +++ b/src/containers/juce_ArrayAllocationBase.h @@ -113,8 +113,7 @@ public: int numAllocated; private: - ArrayAllocationBase (const ArrayAllocationBase&); - ArrayAllocationBase& operator= (const ArrayAllocationBase&); + JUCE_DECLARE_NON_COPYABLE (ArrayAllocationBase); }; diff --git a/src/containers/juce_Expression.cpp b/src/containers/juce_Expression.cpp index d72095db54..c512af51dd 100644 --- a/src/containers/juce_Expression.cpp +++ b/src/containers/juce_Expression.cpp @@ -325,8 +325,7 @@ public: } private: - Add (const Add&); - Add& operator= (const Add&); + JUCE_DECLARE_NON_COPYABLE (Add); }; //============================================================================== @@ -353,8 +352,7 @@ public: } private: - Subtract (const Subtract&); - Subtract& operator= (const Subtract&); + JUCE_DECLARE_NON_COPYABLE (Subtract); }; //============================================================================== @@ -378,8 +376,7 @@ public: } private: - Multiply (const Multiply&); - Multiply& operator= (const Multiply&); + JUCE_DECLARE_NON_COPYABLE (Multiply); }; //============================================================================== @@ -406,8 +403,7 @@ public: } private: - Divide (const Divide&); - Divide& operator= (const Divide&); + JUCE_DECLARE_NON_COPYABLE (Divide); }; //============================================================================== @@ -765,8 +761,7 @@ public: return e; } - Parser (const Parser&); - Parser& operator= (const Parser&); + JUCE_DECLARE_NON_COPYABLE (Parser); }; }; diff --git a/src/containers/juce_HeapBlock.h b/src/containers/juce_HeapBlock.h index abf89f5a03..1f21c03e3d 100644 --- a/src/containers/juce_HeapBlock.h +++ b/src/containers/juce_HeapBlock.h @@ -43,13 +43,13 @@ E.g. instead of this: @code - int* temp = (int*) juce_malloc (1024 * sizeof (int)); + int* temp = (int*) malloc (1024 * sizeof (int)); memcpy (temp, xyz, 1024 * sizeof (int)); - juce_free (temp); - temp = (int*) juce_calloc (2048 * sizeof (int)); + free (temp); + temp = (int*) calloc (2048 * sizeof (int)); temp[0] = 1234; memcpy (foobar, temp, 2048 * sizeof (int)); - juce_free (temp); + free (temp); @endcode ..you could just write this: @@ -90,7 +90,7 @@ public: If you want an array of zero values, you can use the calloc() method instead. */ explicit HeapBlock (const size_t numElements) - : data (static_cast (::juce_malloc (numElements * sizeof (ElementType)))) + : data (static_cast (::malloc (numElements * sizeof (ElementType)))) { } @@ -100,7 +100,7 @@ public: */ ~HeapBlock() { - ::juce_free (data); + ::free (data); } //============================================================================== @@ -173,8 +173,8 @@ public: */ void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) { - ::juce_free (data); - data = static_cast (::juce_malloc (newNumElements * elementSize)); + ::free (data); + data = static_cast (::malloc (newNumElements * elementSize)); } /** Allocates a specified amount of memory and clears it. @@ -182,8 +182,8 @@ public: */ void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) { - ::juce_free (data); - data = static_cast (::juce_calloc (newNumElements * elementSize)); + ::free (data); + data = static_cast (::calloc (newNumElements, elementSize)); } /** Allocates a specified amount of memory and optionally clears it. @@ -192,12 +192,12 @@ public: */ void allocate (const size_t newNumElements, const bool initialiseToZero) { - ::juce_free (data); + ::free (data); if (initialiseToZero) - data = static_cast (::juce_calloc (newNumElements * sizeof (ElementType))); + data = static_cast (::calloc (newNumElements, sizeof (ElementType))); else - data = static_cast (::juce_malloc (newNumElements * sizeof (ElementType))); + data = static_cast (::malloc (newNumElements * sizeof (ElementType))); } /** Re-allocates a specified amount of memory. @@ -208,9 +208,9 @@ public: void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType)) { if (data == 0) - data = static_cast (::juce_malloc (newNumElements * elementSize)); + data = static_cast (::malloc (newNumElements * elementSize)); else - data = static_cast (::juce_realloc (data, newNumElements * elementSize)); + data = static_cast (::realloc (data, newNumElements * elementSize)); } /** Frees any currently-allocated data. @@ -218,7 +218,7 @@ public: */ void free() { - ::juce_free (data); + ::free (data); data = 0; } @@ -235,8 +235,7 @@ private: //============================================================================== ElementType* data; - HeapBlock (const HeapBlock&); - HeapBlock& operator= (const HeapBlock&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HeapBlock); }; diff --git a/src/containers/juce_Value.cpp b/src/containers/juce_Value.cpp index ce06b34507..e42eeb29af 100644 --- a/src/containers/juce_Value.cpp +++ b/src/containers/juce_Value.cpp @@ -95,8 +95,7 @@ public: private: var value; - SimpleValueSource (const SimpleValueSource&); - SimpleValueSource& operator= (const SimpleValueSource&); + JUCE_DECLARE_NON_COPYABLE (SimpleValueSource); }; diff --git a/src/containers/juce_ValueTree.cpp b/src/containers/juce_ValueTree.cpp index 84323cbae9..8d02f7783b 100644 --- a/src/containers/juce_ValueTree.cpp +++ b/src/containers/juce_ValueTree.cpp @@ -95,8 +95,7 @@ private: var oldValue; const bool isAddingNewProperty : 1, isDeletingProperty : 1; - SetPropertyAction (const SetPropertyAction&); - SetPropertyAction& operator= (const SetPropertyAction&); + JUCE_DECLARE_NON_COPYABLE (SetPropertyAction); }; //============================================================================== @@ -152,8 +151,7 @@ private: const int childIndex; const bool isDeleting; - AddOrRemoveChildAction (const AddOrRemoveChildAction&); - AddOrRemoveChildAction& operator= (const AddOrRemoveChildAction&); + JUCE_DECLARE_NON_COPYABLE (AddOrRemoveChildAction); }; //============================================================================== @@ -201,8 +199,7 @@ private: const SharedObjectPtr parent; const int startIndex, endIndex; - MoveChildAction (const MoveChildAction&); - MoveChildAction& operator= (const MoveChildAction&); + JUCE_DECLARE_NON_COPYABLE (MoveChildAction); }; diff --git a/src/containers/juce_ValueTree.h b/src/containers/juce_ValueTree.h index 5ed29c5911..b0a169c2b4 100644 --- a/src/containers/juce_ValueTree.h +++ b/src/containers/juce_ValueTree.h @@ -511,8 +511,7 @@ private: private: ElementComparator& comparator; - ComparatorAdapter (const ComparatorAdapter&); - ComparatorAdapter& operator= (const ComparatorAdapter&); + JUCE_DECLARE_NON_COPYABLE (ComparatorAdapter); }; friend class SharedObject; diff --git a/src/core/juce_ByteOrder.h b/src/core/juce_ByteOrder.h index d3f82ca07b..d5fb9b1822 100644 --- a/src/core/juce_ByteOrder.h +++ b/src/core/juce_ByteOrder.h @@ -95,8 +95,8 @@ public: private: ByteOrder(); - ByteOrder (const ByteOrder&); - ByteOrder& operator= (const ByteOrder&); + + JUCE_DECLARE_NON_COPYABLE (ByteOrder); }; diff --git a/src/core/juce_LeakedObjectDetector.h b/src/core/juce_LeakedObjectDetector.h index c0cb40de00..c4041cbed3 100644 --- a/src/core/juce_LeakedObjectDetector.h +++ b/src/core/juce_LeakedObjectDetector.h @@ -107,15 +107,7 @@ private: }; //============================================================================== -#if JUCE_DLL && ! DOXYGEN // This hack makes use of the leak detector macros to add dll-safe allocators to all the classes.. - #define JUCE_LEAK_DETECTOR(OwnerClass) \ - public:\ - static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \ - static void* operator new (size_t, void* p) { return p; } \ - static void operator delete (void* p) { juce_free (p); } \ - static void operator delete (void*, void*) { } - -#elif JUCE_CHECK_MEMORY_LEAKS || DOXYGEN +#if DOXYGEN || (JUCE_CHECK_MEMORY_LEAKS && ! defined (JUCE_LEAK_DETECTOR)) /** This macro lets you embed a leak-detecting object inside a class. To use it, simply declare a JUCE_LEAK_DETECTOR(YourClassName) inside a private section diff --git a/src/core/juce_Memory.h b/src/core/juce_Memory.h index 6856f357df..91616bbc61 100644 --- a/src/core/juce_Memory.h +++ b/src/core/juce_Memory.h @@ -28,33 +28,22 @@ //============================================================================== /* - This file defines the various juce_malloc(), juce_free() macros that should be used in + This file defines the various juce_malloc(), juce_free() macros that can be used in preference to the standard calls. + + None of this stuff is actually used in the library itself, and will probably be + deprecated at some point in the future, to force everyone to use HeapBlock and other + safer allocation methods. */ -#if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS +#if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS && ! DOXYGEN #ifndef JUCE_DLL //============================================================================== // Win32 debug non-DLL versions.. - /** This should be used instead of calling malloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_malloc(numBytes) _malloc_dbg (numBytes, _NORMAL_BLOCK, __FILE__, __LINE__) - - /** This should be used instead of calling calloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_calloc(numBytes) _calloc_dbg (1, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__) - - /** This should be used instead of calling realloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_realloc(location, numBytes) _realloc_dbg (location, numBytes, _NORMAL_BLOCK, __FILE__, __LINE__) - - /** This should be used instead of calling free directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_free(location) _free_dbg (location, _NORMAL_BLOCK) #else @@ -63,84 +52,64 @@ // For the DLL, we'll define some functions in the DLL that will be used for allocation - that // way all juce calls in the DLL and in the host API will all use the same allocator. - extern JUCE_API void* juce_DebugMalloc (const int size, const char* file, const int line); - extern JUCE_API void* juce_DebugCalloc (const int size, const char* file, const int line); - extern JUCE_API void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line); - extern JUCE_API void juce_DebugFree (void* const block); + extern JUCE_API void* juce_DebugMalloc (int size, const char* file, int line); + extern JUCE_API void* juce_DebugCalloc (int size, const char* file, int line); + extern JUCE_API void* juce_DebugRealloc (void* block, int size, const char* file, int line); + extern JUCE_API void juce_DebugFree (void* block); - /** This should be used instead of calling malloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_DebugMalloc (numBytes, __FILE__, __LINE__) - - /** This should be used instead of calling calloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_DebugCalloc (numBytes, __FILE__, __LINE__) - - /** This should be used instead of calling realloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_DebugRealloc (location, numBytes, __FILE__, __LINE__) - - /** This should be used instead of calling free directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_free(location) JUCE_NAMESPACE::juce_DebugFree (location) + + #define JUCE_LEAK_DETECTOR(OwnerClass) public:\ + static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \ + static void* operator new (size_t, void* p) { return p; } \ + static void operator delete (void* p) { juce_free (p); } \ + static void operator delete (void*, void*) {} #endif -#elif defined (JUCE_DLL) +#elif defined (JUCE_DLL) && ! DOXYGEN //============================================================================== // Win32 DLL (release) versions.. // For the DLL, we'll define some functions in the DLL that will be used for allocation - that // way all juce calls in the DLL and in the host API will all use the same allocator. - extern JUCE_API void* juce_Malloc (const int size); - extern JUCE_API void* juce_Calloc (const int size); - extern JUCE_API void* juce_Realloc (void* const block, const int size); - extern JUCE_API void juce_Free (void* const block); + extern JUCE_API void* juce_Malloc (int size); + extern JUCE_API void* juce_Calloc (int size); + extern JUCE_API void* juce_Realloc (void* block, int size); + extern JUCE_API void juce_Free (void* block); - /** This should be used instead of calling malloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_malloc(numBytes) JUCE_NAMESPACE::juce_Malloc (numBytes) - - /** This should be used instead of calling calloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_calloc(numBytes) JUCE_NAMESPACE::juce_Calloc (numBytes) - - /** This should be used instead of calling realloc directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_realloc(location, numBytes) JUCE_NAMESPACE::juce_Realloc (location, numBytes) - - /** This should be used instead of calling free directly. - Only use direct memory allocation if there's really no way to use a HeapBlock object instead! - */ #define juce_free(location) JUCE_NAMESPACE::juce_Free (location) + #define JUCE_LEAK_DETECTOR(OwnerClass) public:\ + static void* operator new (size_t sz) { void* const p = juce_malloc ((int) sz); return (p != 0) ? p : ::operator new (sz); } \ + static void* operator new (size_t, void* p) { return p; } \ + static void operator delete (void* p) { juce_free (p); } \ + static void operator delete (void*, void*) {} #else - //============================================================================== // Mac, Linux and Win32 (release) versions.. - /** This should be used instead of calling malloc directly. + /** This can be used instead of calling malloc directly. Only use direct memory allocation if there's really no way to use a HeapBlock object instead! */ #define juce_malloc(numBytes) malloc (numBytes) - /** This should be used instead of calling calloc directly. + /** This can be used instead of calling calloc directly. Only use direct memory allocation if there's really no way to use a HeapBlock object instead! */ #define juce_calloc(numBytes) calloc (1, numBytes) - /** This should be used instead of calling realloc directly. + /** This can be used instead of calling realloc directly. Only use direct memory allocation if there's really no way to use a HeapBlock object instead! */ #define juce_realloc(location, numBytes) realloc (location, numBytes) - /** This should be used instead of calling free directly. + /** This can be used instead of calling free directly. Only use direct memory allocation if there's really no way to use a HeapBlock object instead! */ #define juce_free(location) free (location) @@ -176,18 +145,17 @@ #endif //============================================================================== -/** Clears a block of memory. */ +/** Fills a block of memory with zeros. */ inline void zeromem (void* memory, size_t numBytes) throw() { memset (memory, 0, numBytes); } -/** Clears a reference to a local structure. */ +/** Overwrites a structure or object with zeros. */ template inline void zerostruct (Type& structure) throw() { memset (&structure, 0, sizeof (structure)); } -/** A handy function that calls delete on a pointer if it's non-zero, and then sets - the pointer to null. +/** Delete an object pointer, and sets the pointer to null. - Never use this if there's any way you could use a ScopedPointer or other safer way of - managing the lieftimes of your objects! + Remember that it's not good c++ practice to use delete directly - always try to use a ScopedPointer + or other automatic lieftime-management system rather than resorting to deleting raw pointers! */ template inline void deleteAndZero (Type& pointer) { delete pointer; pointer = 0; } diff --git a/src/core/juce_PlatformUtilities.h b/src/core/juce_PlatformUtilities.h index 567ad37ae0..b94b1adb1d 100644 --- a/src/core/juce_PlatformUtilities.h +++ b/src/core/juce_PlatformUtilities.h @@ -197,8 +197,8 @@ public: private: PlatformUtilities(); - PlatformUtilities (const PlatformUtilities&); - PlatformUtilities& operator= (const PlatformUtilities&); + + JUCE_DECLARE_NON_COPYABLE (PlatformUtilities); }; @@ -217,8 +217,7 @@ public: private: void* pool; - ScopedAutoReleasePool (const ScopedAutoReleasePool&); - ScopedAutoReleasePool& operator= (const ScopedAutoReleasePool&); + JUCE_DECLARE_NON_COPYABLE (ScopedAutoReleasePool); }; #define JUCE_AUTORELEASEPOOL const JUCE_NAMESPACE::ScopedAutoReleasePool pool; diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h index 44430b8e5c..62ad18e892 100644 --- a/src/core/juce_StandardHeader.h +++ b/src/core/juce_StandardHeader.h @@ -33,7 +33,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 52 -#define JUCE_BUILDNUMBER 97 +#define JUCE_BUILDNUMBER 98 /** Current Juce version number. diff --git a/src/core/juce_SystemStats.cpp b/src/core/juce_SystemStats.cpp index b3cb15d383..dc2440128f 100644 --- a/src/core/juce_SystemStats.cpp +++ b/src/core/juce_SystemStats.cpp @@ -45,51 +45,17 @@ const String SystemStats::getJUCEVersion() //============================================================================== #ifdef JUCE_DLL + void* juce_Malloc (int size) { return malloc (size); } + void* juce_Calloc (int size) { return calloc (1, size); } + void* juce_Realloc (void* block, int size) { return realloc (block, size); } + void juce_Free (void* block) { free (block); } -void* juce_Malloc (const int size) -{ - return malloc (size); -} - -void* juce_Calloc (const int size) -{ - return calloc (1, size); -} - -void* juce_Realloc (void* const block, const int size) -{ - return realloc (block, size); -} - -void juce_Free (void* const block) -{ - free (block); -} - -#if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS - -void* juce_DebugMalloc (const int size, const char* file, const int line) -{ - return _malloc_dbg (size, _NORMAL_BLOCK, file, line); -} - -void* juce_DebugCalloc (const int size, const char* file, const int line) -{ - return _calloc_dbg (1, size, _NORMAL_BLOCK, file, line); -} - -void* juce_DebugRealloc (void* const block, const int size, const char* file, const int line) -{ - return _realloc_dbg (block, size, _NORMAL_BLOCK, file, line); -} - -void juce_DebugFree (void* const block) -{ - _free_dbg (block, _NORMAL_BLOCK); -} - + #if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS + void* juce_DebugMalloc (int size, const char* file, int line) { return _malloc_dbg (size, _NORMAL_BLOCK, file, line); } + void* juce_DebugCalloc (int size, const char* file, int line) { return _calloc_dbg (1, size, _NORMAL_BLOCK, file, line); } + void* juce_DebugRealloc (void* block, int size, const char* file, int line) { return _realloc_dbg (block, size, _NORMAL_BLOCK, file, line); } + void juce_DebugFree (void* block) { _free_dbg (block, _NORMAL_BLOCK); } + #endif #endif -#endif - END_JUCE_NAMESPACE diff --git a/src/core/juce_SystemStats.h b/src/core/juce_SystemStats.h index 63141bf0b4..ff062da58d 100644 --- a/src/core/juce_SystemStats.h +++ b/src/core/juce_SystemStats.h @@ -162,8 +162,8 @@ private: static CPUFlags cpuFlags; SystemStats(); - SystemStats (const SystemStats&); - SystemStats& operator= (const SystemStats&); + + JUCE_DECLARE_NON_COPYABLE (SystemStats); }; diff --git a/src/cryptography/juce_Primes.h b/src/cryptography/juce_Primes.h index 21a38764e7..b6f266034e 100644 --- a/src/cryptography/juce_Primes.h +++ b/src/cryptography/juce_Primes.h @@ -68,8 +68,8 @@ public: private: Primes(); - Primes (const Primes&); - Primes& operator= (const Primes&); + + JUCE_DECLARE_NON_COPYABLE (Primes); }; diff --git a/src/events/juce_ActionBroadcaster.cpp b/src/events/juce_ActionBroadcaster.cpp index b241e3666a..d44bb8e08e 100644 --- a/src/events/juce_ActionBroadcaster.cpp +++ b/src/events/juce_ActionBroadcaster.cpp @@ -37,17 +37,16 @@ BEGIN_JUCE_NAMESPACE class ActionMessage : public Message { public: - const String message; - ActionMessage (const String& messageText, ActionListener* const listener_) throw() : message (messageText) { pointerParameter = listener_; } + const String message; + private: - ActionMessage (const ActionMessage&); - ActionMessage& operator= (const ActionMessage&); + JUCE_DECLARE_NON_COPYABLE (ActionMessage); }; ActionBroadcaster::CallbackReceiver::CallbackReceiver() {} diff --git a/src/events/juce_ActionBroadcaster.h b/src/events/juce_ActionBroadcaster.h index 6ff0dbda7e..a5038808fc 100644 --- a/src/events/juce_ActionBroadcaster.h +++ b/src/events/juce_ActionBroadcaster.h @@ -86,8 +86,7 @@ private: SortedSet actionListeners; CriticalSection actionListenerLock; - ActionBroadcaster (const ActionBroadcaster&); - ActionBroadcaster& operator= (const ActionBroadcaster&); + JUCE_DECLARE_NON_COPYABLE (ActionBroadcaster); }; diff --git a/src/events/juce_ChangeBroadcaster.h b/src/events/juce_ChangeBroadcaster.h index 8c6399040b..51db15d2f3 100644 --- a/src/events/juce_ChangeBroadcaster.h +++ b/src/events/juce_ChangeBroadcaster.h @@ -103,8 +103,7 @@ private: void callListeners(); - ChangeBroadcaster (const ChangeBroadcaster&); - ChangeBroadcaster& operator= (const ChangeBroadcaster&); + JUCE_DECLARE_NON_COPYABLE (ChangeBroadcaster); }; diff --git a/src/events/juce_ListenerList.h b/src/events/juce_ListenerList.h index a8c32f4a93..98f78e53fe 100644 --- a/src/events/juce_ListenerList.h +++ b/src/events/juce_ListenerList.h @@ -317,8 +317,7 @@ public: const ListType& list; int index; - Iterator (const Iterator&); - Iterator& operator= (const Iterator&); + JUCE_DECLARE_NON_COPYABLE (Iterator); }; typedef ListenerList ThisType; @@ -330,8 +329,7 @@ private: //============================================================================== ArrayType listeners; - ListenerList (const ListenerList&); - ListenerList& operator= (const ListenerList&); + JUCE_DECLARE_NON_COPYABLE (ListenerList); #undef LL_TEMPLATE #undef LL_PARAM diff --git a/src/events/juce_MessageManager.cpp b/src/events/juce_MessageManager.cpp index 82d9739f93..3acb204dcb 100644 --- a/src/events/juce_MessageManager.cpp +++ b/src/events/juce_MessageManager.cpp @@ -233,8 +233,7 @@ public: WaitableEvent lockedEvent, releaseEvent; private: - SharedEvents (const SharedEvents&); - SharedEvents& operator= (const SharedEvents&); + JUCE_DECLARE_NON_COPYABLE (SharedEvents); }; class MessageManagerLock::BlockingMessage : public CallbackMessage diff --git a/src/events/juce_MessageManager.h b/src/events/juce_MessageManager.h index 77841e2839..5bd48498a7 100644 --- a/src/events/juce_MessageManager.h +++ b/src/events/juce_MessageManager.h @@ -308,8 +308,7 @@ private: void init (Thread* thread, ThreadPoolJob* job); - MessageManagerLock (const MessageManagerLock&); - MessageManagerLock& operator= (const MessageManagerLock&); + JUCE_DECLARE_NON_COPYABLE (MessageManagerLock); }; diff --git a/src/events/juce_Timer.cpp b/src/events/juce_Timer.cpp index 952232d894..7d6081880c 100644 --- a/src/events/juce_Timer.cpp +++ b/src/events/juce_Timer.cpp @@ -325,8 +325,7 @@ private: startThread (7); } - InternalTimerThread (const InternalTimerThread&); - InternalTimerThread& operator= (const InternalTimerThread&); + JUCE_DECLARE_NON_COPYABLE (InternalTimerThread); }; InternalTimerThread* InternalTimerThread::instance = 0; diff --git a/src/gui/components/code_editor/juce_CodeDocument.cpp b/src/gui/components/code_editor/juce_CodeDocument.cpp index 72ce156129..7353abba17 100644 --- a/src/gui/components/code_editor/juce_CodeDocument.cpp +++ b/src/gui/components/code_editor/juce_CodeDocument.cpp @@ -732,13 +732,6 @@ void CodeDocument::sendListenerChangeMessage (const int startLine, const int end //============================================================================== class CodeDocumentInsertAction : public UndoableAction { - CodeDocument& owner; - const String text; - int insertPos; - - CodeDocumentInsertAction (const CodeDocumentInsertAction&); - CodeDocumentInsertAction& operator= (const CodeDocumentInsertAction&); - public: CodeDocumentInsertAction (CodeDocument& owner_, const String& text_, const int insertPos_) throw() : owner (owner_), @@ -747,8 +740,6 @@ public: { } - ~CodeDocumentInsertAction() {} - bool perform() { owner.currentActionIndex++; @@ -764,6 +755,13 @@ public: } int getSizeInUnits() { return text.length() + 32; } + +private: + CodeDocument& owner; + const String text; + int insertPos; + + JUCE_DECLARE_NON_COPYABLE (CodeDocumentInsertAction); }; void CodeDocument::insert (const String& text, const int insertPos, const bool undoable) @@ -838,13 +836,6 @@ void CodeDocument::insert (const String& text, const int insertPos, const bool u //============================================================================== class CodeDocumentDeleteAction : public UndoableAction { - CodeDocument& owner; - int startPos, endPos; - String removedText; - - CodeDocumentDeleteAction (const CodeDocumentDeleteAction&); - CodeDocumentDeleteAction& operator= (const CodeDocumentDeleteAction&); - public: CodeDocumentDeleteAction (CodeDocument& owner_, const int startPos_, const int endPos_) throw() : owner (owner_), @@ -855,8 +846,6 @@ public: CodeDocument::Position (&owner, endPos)); } - ~CodeDocumentDeleteAction() {} - bool perform() { owner.currentActionIndex++; @@ -872,6 +861,13 @@ public: } int getSizeInUnits() { return removedText.length() + 32; } + +private: + CodeDocument& owner; + int startPos, endPos; + String removedText; + + JUCE_DECLARE_NON_COPYABLE (CodeDocumentDeleteAction); }; void CodeDocument::remove (const int startPos, const int endPos, const bool undoable) diff --git a/src/gui/components/code_editor/juce_CodeEditorComponent.cpp b/src/gui/components/code_editor/juce_CodeEditorComponent.cpp index 310ddb511f..01c14ee42b 100644 --- a/src/gui/components/code_editor/juce_CodeEditorComponent.cpp +++ b/src/gui/components/code_editor/juce_CodeEditorComponent.cpp @@ -65,10 +65,9 @@ public: private: CodeEditorComponent& owner; - CaretComponent (const CaretComponent&); - CaretComponent& operator= (const CaretComponent&); - bool shouldBeShown() const { return owner.hasKeyboardFocus (true); } + + JUCE_DECLARE_NON_COPYABLE (CaretComponent); }; //============================================================================== @@ -80,10 +79,6 @@ public: { } - ~CodeEditorLine() throw() - { - } - bool update (CodeDocument& document, int lineNum, CodeDocument::Iterator& source, CodeTokeniser* analyser, const int spacesPerTab, diff --git a/src/gui/components/controls/juce_ComboBox.cpp b/src/gui/components/controls/juce_ComboBox.cpp index f967c8f545..fe68491d67 100644 --- a/src/gui/components/controls/juce_ComboBox.cpp +++ b/src/gui/components/controls/juce_ComboBox.cpp @@ -526,8 +526,7 @@ public: private: Component::SafePointer box; - Callback (const Callback&); - Callback& operator= (const Callback&); + JUCE_DECLARE_NON_COPYABLE (Callback); }; diff --git a/src/gui/components/controls/juce_TableHeaderComponent.cpp b/src/gui/components/controls/juce_TableHeaderComponent.cpp index 2aafd4aeb4..dfd011efdb 100644 --- a/src/gui/components/controls/juce_TableHeaderComponent.cpp +++ b/src/gui/components/controls/juce_TableHeaderComponent.cpp @@ -46,10 +46,6 @@ public: setAlwaysOnTop (true); } - ~DragOverlayComp() - { - } - void paint (Graphics& g) { g.drawImageAt (image, 0, 0); @@ -58,8 +54,7 @@ public: private: Image image; - DragOverlayComp (const DragOverlayComp&); - DragOverlayComp& operator= (const DragOverlayComp&); + JUCE_DECLARE_NON_COPYABLE (DragOverlayComp); }; diff --git a/src/gui/components/controls/juce_TextEditor.cpp b/src/gui/components/controls/juce_TextEditor.cpp index 7c20378101..755d8842d0 100644 --- a/src/gui/components/controls/juce_TextEditor.cpp +++ b/src/gui/components/controls/juce_TextEditor.cpp @@ -758,15 +758,6 @@ private: //============================================================================== class TextEditor::InsertAction : public UndoableAction { - TextEditor& owner; - const String text; - const int insertIndex, oldCaretPos, newCaretPos; - const Font font; - const Colour colour; - - InsertAction (const InsertAction&); - InsertAction& operator= (const InsertAction&); - public: InsertAction (TextEditor& owner_, const String& text_, @@ -785,10 +776,6 @@ public: { } - ~InsertAction() - { - } - bool perform() { owner.insert (text, insertIndex, font, colour, 0, newCaretPos); @@ -805,19 +792,20 @@ public: { return text.length() + 16; } + +private: + TextEditor& owner; + const String text; + const int insertIndex, oldCaretPos, newCaretPos; + const Font font; + const Colour colour; + + JUCE_DECLARE_NON_COPYABLE (InsertAction); }; //============================================================================== class TextEditor::RemoveAction : public UndoableAction { - TextEditor& owner; - const Range range; - const int oldCaretPos, newCaretPos; - Array removedSections; - - RemoveAction (const RemoveAction&); - RemoveAction& operator= (const RemoveAction&); - public: RemoveAction (TextEditor& owner_, const Range range_, @@ -864,6 +852,14 @@ public: return n + 16; } + +private: + TextEditor& owner; + const Range range; + const int oldCaretPos, newCaretPos; + Array removedSections; + + JUCE_DECLARE_NON_COPYABLE (RemoveAction); }; //============================================================================== @@ -909,8 +905,7 @@ public: private: TextEditor& owner; - TextHolderComponent (const TextHolderComponent&); - TextHolderComponent& operator= (const TextHolderComponent&); + JUCE_DECLARE_NON_COPYABLE (TextHolderComponent); }; //============================================================================== @@ -949,8 +944,7 @@ private: float lastWordWrapWidth; bool rentrant; - TextEditorViewport (const TextEditorViewport&); - TextEditorViewport& operator= (const TextEditorViewport&); + JUCE_DECLARE_NON_COPYABLE (TextEditorViewport); }; //============================================================================== @@ -1795,8 +1789,7 @@ public: private: Component::SafePointer editor; - TextEditorMenuPerformer (const TextEditorMenuPerformer&); - TextEditorMenuPerformer& operator= (const TextEditorMenuPerformer&); + JUCE_DECLARE_NON_COPYABLE (TextEditorMenuPerformer); }; diff --git a/src/gui/components/controls/juce_TreeView.cpp b/src/gui/components/controls/juce_TreeView.cpp index 2e42a6e45f..110f18396a 100644 --- a/src/gui/components/controls/juce_TreeView.cpp +++ b/src/gui/components/controls/juce_TreeView.cpp @@ -896,8 +896,7 @@ public: int lastIndex; private: - InsertPointHighlight (const InsertPointHighlight&); - InsertPointHighlight& operator= (const InsertPointHighlight&); + JUCE_DECLARE_NON_COPYABLE (InsertPointHighlight); }; //============================================================================== @@ -924,8 +923,7 @@ public: } private: - TargetGroupHighlight (const TargetGroupHighlight&); - TargetGroupHighlight& operator= (const TargetGroupHighlight&); + JUCE_DECLARE_NON_COPYABLE (TargetGroupHighlight); }; //============================================================================== diff --git a/src/gui/components/juce_Component.cpp b/src/gui/components/juce_Component.cpp index e99059d3a5..1c45425c06 100644 --- a/src/gui/components/juce_Component.cpp +++ b/src/gui/components/juce_Component.cpp @@ -191,8 +191,7 @@ private: Array listeners; int numDeepMouseListeners; - MouseListenerList (const MouseListenerList&); - MouseListenerList& operator= (const MouseListenerList&); + JUCE_DECLARE_NON_COPYABLE (MouseListenerList); }; diff --git a/src/gui/components/juce_Component.h b/src/gui/components/juce_Component.h index 9fc1d53cde..196ac7b188 100644 --- a/src/gui/components/juce_Component.h +++ b/src/gui/components/juce_Component.h @@ -2106,8 +2106,7 @@ public: SafeComponentPtr safePointer1, safePointer2; Component* const component2; - BailOutChecker (const BailOutChecker&); - BailOutChecker& operator= (const BailOutChecker&); + JUCE_DECLARE_NON_COPYABLE (BailOutChecker); }; //============================================================================== diff --git a/src/gui/components/juce_ModalComponentManager.cpp b/src/gui/components/juce_ModalComponentManager.cpp index 25b6b4699a..5f4e654bf2 100644 --- a/src/gui/components/juce_ModalComponentManager.cpp +++ b/src/gui/components/juce_ModalComponentManager.cpp @@ -87,8 +87,7 @@ public: bool isActive, isDeleted; private: - ModalItem (const ModalItem&); - ModalItem& operator= (const ModalItem&); + JUCE_DECLARE_NON_COPYABLE (ModalItem); }; //============================================================================== @@ -256,8 +255,7 @@ private: int& value; bool& finished; - ReturnValueRetriever (const ReturnValueRetriever&); - ReturnValueRetriever& operator= (const ReturnValueRetriever&); + JUCE_DECLARE_NON_COPYABLE (ReturnValueRetriever); }; int ModalComponentManager::runEventLoopForCurrentComponent() diff --git a/src/gui/components/juce_ModalComponentManager.h b/src/gui/components/juce_ModalComponentManager.h index c26fffbc0e..77d93698d4 100644 --- a/src/gui/components/juce_ModalComponentManager.h +++ b/src/gui/components/juce_ModalComponentManager.h @@ -141,8 +141,7 @@ private: void endModal (Component* component, int returnValue); void endModal (Component* component); - ModalComponentManager (const ModalComponentManager&); - ModalComponentManager& operator= (const ModalComponentManager&); + JUCE_DECLARE_NON_COPYABLE (ModalComponentManager); }; diff --git a/src/gui/components/keyboard/juce_KeyMappingEditorComponent.cpp b/src/gui/components/keyboard/juce_KeyMappingEditorComponent.cpp index 0151dc39fd..d892daf2a9 100644 --- a/src/gui/components/keyboard/juce_KeyMappingEditorComponent.cpp +++ b/src/gui/components/keyboard/juce_KeyMappingEditorComponent.cpp @@ -147,8 +147,7 @@ public: private: KeyMappingEditorComponent& owner; - KeyEntryWindow (const KeyEntryWindow&); - KeyEntryWindow& operator= (const KeyEntryWindow&); + JUCE_DECLARE_NON_COPYABLE (KeyEntryWindow); }; void assignNewKey() diff --git a/src/gui/components/layout/juce_GroupComponent.h b/src/gui/components/layout/juce_GroupComponent.h index f1aceccfc6..b6787f0e9d 100644 --- a/src/gui/components/layout/juce_GroupComponent.h +++ b/src/gui/components/layout/juce_GroupComponent.h @@ -97,8 +97,7 @@ private: String text; Justification justification; - GroupComponent (const GroupComponent&); - GroupComponent& operator= (const GroupComponent&); + JUCE_DECLARE_NON_COPYABLE (GroupComponent); }; diff --git a/src/gui/components/layout/juce_TabbedButtonBar.cpp b/src/gui/components/layout/juce_TabbedButtonBar.cpp index b83ef28f4d..c2c8f4492b 100644 --- a/src/gui/components/layout/juce_TabbedButtonBar.cpp +++ b/src/gui/components/layout/juce_TabbedButtonBar.cpp @@ -155,8 +155,7 @@ public: private: TabbedButtonBar& owner; - BehindFrontTabComp (const BehindFrontTabComp&); - BehindFrontTabComp& operator= (const BehindFrontTabComp&); + JUCE_DECLARE_NON_COPYABLE (BehindFrontTabComp); }; diff --git a/src/gui/components/menus/juce_MenuBarComponent.cpp b/src/gui/components/menus/juce_MenuBarComponent.cpp index 292593261c..e924a4b2f0 100644 --- a/src/gui/components/menus/juce_MenuBarComponent.cpp +++ b/src/gui/components/menus/juce_MenuBarComponent.cpp @@ -191,8 +191,7 @@ private: Component::SafePointer bar; const int topLevelIndex; - AsyncCallback (const AsyncCallback&); - AsyncCallback& operator= (const AsyncCallback&); + JUCE_DECLARE_NON_COPYABLE (AsyncCallback); }; void MenuBarComponent::showMenu (int index) diff --git a/src/gui/components/menus/juce_PopupMenu.cpp b/src/gui/components/menus/juce_PopupMenu.cpp index b0125112e8..e662431d62 100644 --- a/src/gui/components/menus/juce_PopupMenu.cpp +++ b/src/gui/components/menus/juce_PopupMenu.cpp @@ -1433,8 +1433,7 @@ public: ScopedPointer component; private: - PopupMenuCompletionCallback (const PopupMenuCompletionCallback&); - PopupMenuCompletionCallback& operator= (const PopupMenuCompletionCallback&); + JUCE_DECLARE_NON_COPYABLE (PopupMenuCompletionCallback); }; diff --git a/src/gui/components/menus/juce_PopupMenuCustomComponent.h b/src/gui/components/menus/juce_PopupMenuCustomComponent.h index 02e469233e..32226e8f7c 100644 --- a/src/gui/components/menus/juce_PopupMenuCustomComponent.h +++ b/src/gui/components/menus/juce_PopupMenuCustomComponent.h @@ -83,8 +83,7 @@ private: friend class PopupMenu::Window; bool isHighlighted, isTriggeredAutomatically; - PopupMenuCustomComponent (const PopupMenuCustomComponent&); - PopupMenuCustomComponent& operator= (const PopupMenuCustomComponent&); + JUCE_DECLARE_NON_COPYABLE (PopupMenuCustomComponent); }; diff --git a/src/gui/components/mouse/juce_ComponentDragger.cpp b/src/gui/components/mouse/juce_ComponentDragger.cpp index 3d17cee9ed..432fbbbf54 100644 --- a/src/gui/components/mouse/juce_ComponentDragger.cpp +++ b/src/gui/components/mouse/juce_ComponentDragger.cpp @@ -33,7 +33,6 @@ BEGIN_JUCE_NAMESPACE //============================================================================== ComponentDragger::ComponentDragger() - : constrainer (0) { } @@ -42,22 +41,20 @@ ComponentDragger::~ComponentDragger() } //============================================================================== -void ComponentDragger::startDraggingComponent (Component* const componentToDrag, const MouseEvent& e, - ComponentBoundsConstrainer* const constrainer_) +void ComponentDragger::startDraggingComponent (Component* const componentToDrag, const MouseEvent& e) { jassert (componentToDrag != 0); + jassert (e.mods.isAnyMouseButtonDown()); // The event has to be a drag event! if (componentToDrag != 0) - { - constrainer = constrainer_; mouseDownWithinTarget = e.getEventRelativeTo (componentToDrag).getMouseDownPosition(); - } } -void ComponentDragger::dragComponent (Component* const componentToDrag, const MouseEvent& e) +void ComponentDragger::dragComponent (Component* const componentToDrag, const MouseEvent& e, + ComponentBoundsConstrainer* const constrainer) { jassert (componentToDrag != 0); - jassert (e.mods.isAnyMouseButtonDown()); // (the event has to be a drag event..) + jassert (e.mods.isAnyMouseButtonDown()); // The event has to be a drag event! if (componentToDrag != 0) { diff --git a/src/gui/components/mouse/juce_ComponentDragger.h b/src/gui/components/mouse/juce_ComponentDragger.h index a141fd82f1..2503f96a0e 100644 --- a/src/gui/components/mouse/juce_ComponentDragger.h +++ b/src/gui/components/mouse/juce_ComponentDragger.h @@ -47,12 +47,12 @@ void mouseDown (const MouseEvent& e) { - myDragger.startDraggingComponent (this, e, 0); + myDragger.startDraggingComponent (this, e); } void mouseDrag (const MouseEvent& e) { - myDragger.dragComponent (this, e); + myDragger.dragComponent (this, e, 0); } }; @endcode @@ -71,13 +71,11 @@ public: /** Call this from your component's mouseDown() method, to prepare for dragging. @param componentToDrag the component that you want to drag - @param constrainer a constrainer object to use to keep the component - from going offscreen + @param e the mouse event that is triggering the drag @see dragComponent */ void startDraggingComponent (Component* componentToDrag, - const MouseEvent& e, - ComponentBoundsConstrainer* constrainer); + const MouseEvent& e); /** Call this from your mouseDrag() callback to move the component. @@ -88,14 +86,17 @@ public: @param componentToDrag the component that you want to drag @param e the current mouse-drag event - @see dragComponent + @param constrainer an optional constrainer object that should be used + to apply limits to the component's position. Pass + null if you don't want to contrain the movement. + @see startDraggingComponent */ void dragComponent (Component* componentToDrag, - const MouseEvent& e); + const MouseEvent& e, + ComponentBoundsConstrainer* constrainer); private: //============================================================================== - ComponentBoundsConstrainer* constrainer; Point mouseDownWithinTarget; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ComponentDragger); diff --git a/src/gui/components/mouse/juce_DragAndDropContainer.cpp b/src/gui/components/mouse/juce_DragAndDropContainer.cpp index 98e4f326c8..865e626057 100644 --- a/src/gui/components/mouse/juce_DragAndDropContainer.cpp +++ b/src/gui/components/mouse/juce_DragAndDropContainer.cpp @@ -293,8 +293,7 @@ private: const Point imageOffset; bool hasCheckedForExternalDrag, drawImage; - DragImageComponent (const DragImageComponent&); - DragImageComponent& operator= (const DragImageComponent&); + JUCE_DECLARE_NON_COPYABLE (DragImageComponent); }; diff --git a/src/gui/components/mouse/juce_MouseHoverDetector.h b/src/gui/components/mouse/juce_MouseHoverDetector.h index 12284cd78b..2abe8c66f9 100644 --- a/src/gui/components/mouse/juce_MouseHoverDetector.h +++ b/src/gui/components/mouse/juce_MouseHoverDetector.h @@ -124,8 +124,7 @@ private: void hoverTimerCallback(); void checkJustHoveredCallback(); - MouseHoverDetector (const MouseHoverDetector&); - MouseHoverDetector& operator= (const MouseHoverDetector&); + JUCE_DECLARE_NON_COPYABLE (MouseHoverDetector); }; #endif // __JUCE_MOUSEHOVERDETECTOR_JUCEHEADER__ diff --git a/src/gui/components/mouse/juce_MouseInputSource.cpp b/src/gui/components/mouse/juce_MouseInputSource.cpp index 04908b9fb9..73a371f39c 100644 --- a/src/gui/components/mouse/juce_MouseInputSource.cpp +++ b/src/gui/components/mouse/juce_MouseInputSource.cpp @@ -489,8 +489,7 @@ private: || mouseDowns[0].position.getDistanceFrom (screenPos) >= 4; } - MouseInputSourceInternal (const MouseInputSourceInternal&); - MouseInputSourceInternal& operator= (const MouseInputSourceInternal&); + JUCE_DECLARE_NON_COPYABLE (MouseInputSourceInternal); }; //============================================================================== diff --git a/src/gui/components/properties/juce_PropertyPanel.cpp b/src/gui/components/properties/juce_PropertyPanel.cpp index 1c351adddf..362721fc77 100644 --- a/src/gui/components/properties/juce_PropertyPanel.cpp +++ b/src/gui/components/properties/juce_PropertyPanel.cpp @@ -137,8 +137,7 @@ private: int titleHeight; bool sectionIsOpen; - PropertySectionComponent (const PropertySectionComponent&); - PropertySectionComponent& operator= (const PropertySectionComponent&); + JUCE_DECLARE_NON_COPYABLE (PropertySectionComponent); }; //============================================================================== @@ -188,8 +187,7 @@ public: private: OwnedArray sections; - PropertyHolderComponent (const PropertyHolderComponent&); - PropertyHolderComponent& operator= (const PropertyHolderComponent&); + JUCE_DECLARE_NON_COPYABLE (PropertyHolderComponent); }; diff --git a/src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp b/src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp index 5fbdbbeb38..153f347e1f 100644 --- a/src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp +++ b/src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp @@ -74,8 +74,7 @@ private: AudioDeviceManager* const manager; float level; - SimpleDeviceManagerInputLevelMeter (const SimpleDeviceManagerInputLevelMeter&); - SimpleDeviceManagerInputLevelMeter& operator= (const SimpleDeviceManagerInputLevelMeter&); + JUCE_DECLARE_NON_COPYABLE (SimpleDeviceManagerInputLevelMeter); }; @@ -894,8 +893,7 @@ public: private: ScopedPointer inputChanList, outputChanList; - AudioDeviceSettingsPanel (const AudioDeviceSettingsPanel&); - AudioDeviceSettingsPanel& operator= (const AudioDeviceSettingsPanel&); + JUCE_DECLARE_NON_COPYABLE (AudioDeviceSettingsPanel); }; diff --git a/src/gui/components/special/juce_ColourSelector.cpp b/src/gui/components/special/juce_ColourSelector.cpp index 725a10609c..24bd770211 100644 --- a/src/gui/components/special/juce_ColourSelector.cpp +++ b/src/gui/components/special/juce_ColourSelector.cpp @@ -55,8 +55,7 @@ public: } private: - ColourComponentSlider (const ColourComponentSlider&); - ColourComponentSlider& operator= (const ColourComponentSlider&); + JUCE_DECLARE_NON_COPYABLE (ColourComponentSlider); }; //============================================================================== @@ -77,8 +76,7 @@ public: } private: - ColourSpaceMarker (const ColourSpaceMarker&); - ColourSpaceMarker& operator= (const ColourSpaceMarker&); + JUCE_DECLARE_NON_COPYABLE (ColourSpaceMarker); }; //============================================================================== @@ -173,8 +171,7 @@ private: edge * 2, edge * 2); } - ColourSpaceView (const ColourSpaceView&); - ColourSpaceView& operator= (const ColourSpaceView&); + JUCE_DECLARE_NON_COPYABLE (ColourSpaceView); }; //============================================================================== @@ -205,8 +202,7 @@ public: } private: - HueSelectorMarker (const HueSelectorMarker&); - HueSelectorMarker& operator= (const HueSelectorMarker&); + JUCE_DECLARE_NON_COPYABLE (HueSelectorMarker); }; //============================================================================== @@ -267,8 +263,7 @@ private: HueSelectorMarker marker; const int edge; - HueSelectorComp (const HueSelectorComp&); - HueSelectorComp& operator= (const HueSelectorComp&); + JUCE_DECLARE_NON_COPYABLE (HueSelectorComp); }; //============================================================================== @@ -316,8 +311,7 @@ private: ColourSelector& owner; const int index; - SwatchComponent (const SwatchComponent&); - SwatchComponent& operator= (const SwatchComponent&); + JUCE_DECLARE_NON_COPYABLE (SwatchComponent); }; //============================================================================== diff --git a/src/gui/components/special/juce_DropShadower.cpp b/src/gui/components/special/juce_DropShadower.cpp index 9e8e686804..ca028b67e0 100644 --- a/src/gui/components/special/juce_DropShadower.cpp +++ b/src/gui/components/special/juce_DropShadower.cpp @@ -117,8 +117,7 @@ public: } private: - ShadowWindow (const ShadowWindow&); - ShadowWindow& operator= (const ShadowWindow&); + JUCE_DECLARE_NON_COPYABLE (ShadowWindow); }; diff --git a/src/gui/components/special/juce_MagnifierComponent.cpp b/src/gui/components/special/juce_MagnifierComponent.cpp index 76fc2c6b66..df79587b85 100644 --- a/src/gui/components/special/juce_MagnifierComponent.cpp +++ b/src/gui/components/special/juce_MagnifierComponent.cpp @@ -180,8 +180,7 @@ public: private: MagnifierComponent* const magnifierComp; - PeerHolderComp (const PeerHolderComp&); - PeerHolderComp& operator= (const PeerHolderComp&); + JUCE_DECLARE_NON_COPYABLE (PeerHolderComp); }; diff --git a/src/gui/components/special/juce_MidiKeyboardComponent.cpp b/src/gui/components/special/juce_MidiKeyboardComponent.cpp index 7c2ba8679b..acac5aa9c3 100644 --- a/src/gui/components/special/juce_MidiKeyboardComponent.cpp +++ b/src/gui/components/special/juce_MidiKeyboardComponent.cpp @@ -65,8 +65,7 @@ private: MidiKeyboardComponent& owner; const int delta; - MidiKeyboardUpDownButton (const MidiKeyboardUpDownButton&); - MidiKeyboardUpDownButton& operator= (const MidiKeyboardUpDownButton&); + JUCE_DECLARE_NON_COPYABLE (MidiKeyboardUpDownButton); }; //============================================================================== diff --git a/src/gui/components/windows/juce_AlertWindow.cpp b/src/gui/components/windows/juce_AlertWindow.cpp index c13b8a43ff..1fdf509400 100644 --- a/src/gui/components/windows/juce_AlertWindow.cpp +++ b/src/gui/components/windows/juce_AlertWindow.cpp @@ -64,8 +64,7 @@ public: } private: - AlertWindowTextEditor (const AlertWindowTextEditor&); - AlertWindowTextEditor& operator= (const AlertWindowTextEditor&); + JUCE_DECLARE_NON_COPYABLE (AlertWindowTextEditor); static juce_wchar getDefaultPasswordChar() throw() { @@ -295,8 +294,7 @@ public: private: int bestWidth; - AlertTextComp (const AlertTextComp&); - AlertTextComp& operator= (const AlertTextComp&); + JUCE_DECLARE_NON_COPYABLE (AlertTextComp); }; void AlertWindow::addTextBlock (const String& textBlock) @@ -561,12 +559,12 @@ bool AlertWindow::containsAnyExtraComponents() const //============================================================================== void AlertWindow::mouseDown (const MouseEvent& e) { - dragger.startDraggingComponent (this, e, &constrainer); + dragger.startDraggingComponent (this, e); } void AlertWindow::mouseDrag (const MouseEvent& e) { - dragger.dragComponent (this, e); + dragger.dragComponent (this, e, &constrainer); } bool AlertWindow::keyPressed (const KeyPress& key) diff --git a/src/gui/components/windows/juce_DialogWindow.cpp b/src/gui/components/windows/juce_DialogWindow.cpp index c032e14782..70f9ef76f4 100644 --- a/src/gui/components/windows/juce_DialogWindow.cpp +++ b/src/gui/components/windows/juce_DialogWindow.cpp @@ -78,8 +78,7 @@ public: } private: - TempDialogWindow (const TempDialogWindow&); - TempDialogWindow& operator= (const TempDialogWindow&); + JUCE_DECLARE_NON_COPYABLE (TempDialogWindow); }; int DialogWindow::showModalDialog (const String& dialogTitle, diff --git a/src/gui/components/windows/juce_ResizableWindow.cpp b/src/gui/components/windows/juce_ResizableWindow.cpp index 1f838a7a75..5e30c765a2 100644 --- a/src/gui/components/windows/juce_ResizableWindow.cpp +++ b/src/gui/components/windows/juce_ResizableWindow.cpp @@ -529,13 +529,13 @@ bool ResizableWindow::restoreWindowStateFromString (const String& s) void ResizableWindow::mouseDown (const MouseEvent& e) { if (! isFullScreen()) - dragger.startDraggingComponent (this, e, constrainer); + dragger.startDraggingComponent (this, e); } void ResizableWindow::mouseDrag (const MouseEvent& e) { if (! isFullScreen()) - dragger.dragComponent (this, e); + dragger.dragComponent (this, e, constrainer); } //============================================================================== diff --git a/src/gui/components/windows/juce_TopLevelWindow.cpp b/src/gui/components/windows/juce_TopLevelWindow.cpp index a8faaa283c..936690db73 100644 --- a/src/gui/components/windows/juce_TopLevelWindow.cpp +++ b/src/gui/components/windows/juce_TopLevelWindow.cpp @@ -128,8 +128,7 @@ private: && tlw->isShowing(); } - TopLevelWindowManager (const TopLevelWindowManager&); - TopLevelWindowManager& operator= (const TopLevelWindowManager&); + JUCE_DECLARE_NON_COPYABLE (TopLevelWindowManager); }; juce_ImplementSingleton_SingleThreaded (TopLevelWindowManager) diff --git a/src/gui/graphics/colour/juce_Colours.h b/src/gui/graphics/colour/juce_Colours.h index 894c216833..06f57530df 100644 --- a/src/gui/graphics/colour/juce_Colours.h +++ b/src/gui/graphics/colour/juce_Colours.h @@ -104,8 +104,8 @@ private: // this isn't a class you should ever instantiate - it's just here for the // static values in it. Colours(); - Colours (const Colours&); - Colours& operator= (const Colours&); + + JUCE_DECLARE_NON_COPYABLE (Colours); }; #endif // __JUCE_COLOURS_JUCEHEADER__ diff --git a/src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp b/src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp index 349eacf9fc..55ec9d1f57 100644 --- a/src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp +++ b/src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp @@ -187,8 +187,7 @@ private: } while (--width > 0); } - SolidColourEdgeTableRenderer (const SolidColourEdgeTableRenderer&); - SolidColourEdgeTableRenderer& operator= (const SolidColourEdgeTableRenderer&); + JUCE_DECLARE_NON_COPYABLE (SolidColourEdgeTableRenderer); }; //============================================================================== @@ -259,8 +258,7 @@ private: bool vertical, horizontal; enum { numScaleBits = 12 }; - LinearGradientPixelGenerator (const LinearGradientPixelGenerator&); - LinearGradientPixelGenerator& operator= (const LinearGradientPixelGenerator&); + JUCE_DECLARE_NON_COPYABLE (LinearGradientPixelGenerator); }; //============================================================================== @@ -302,8 +300,7 @@ protected: const double gx1, gy1; double maxDist, invScale, dy; - RadialGradientPixelGenerator (const RadialGradientPixelGenerator&); - RadialGradientPixelGenerator& operator= (const RadialGradientPixelGenerator&); + JUCE_DECLARE_NON_COPYABLE (RadialGradientPixelGenerator); }; //============================================================================== @@ -343,8 +340,7 @@ private: double tM10, tM00, lineYM01, lineYM11; const AffineTransform inverseTransform; - TransformedRadialGradientPixelGenerator (const TransformedRadialGradientPixelGenerator&); - TransformedRadialGradientPixelGenerator& operator= (const TransformedRadialGradientPixelGenerator&); + JUCE_DECLARE_NON_COPYABLE (TransformedRadialGradientPixelGenerator); }; //============================================================================== @@ -409,8 +405,7 @@ private: const Image::BitmapData& destData; PixelType* linePixels; - GradientEdgeTableRenderer (const GradientEdgeTableRenderer&); - GradientEdgeTableRenderer& operator= (const GradientEdgeTableRenderer&); + JUCE_DECLARE_NON_COPYABLE (GradientEdgeTableRenderer); }; //============================================================================== @@ -561,8 +556,7 @@ private: memcpy (dest, src, width * sizeof (PixelRGB)); } - ImageFillEdgeTableRenderer (const ImageFillEdgeTableRenderer&); - ImageFillEdgeTableRenderer& operator= (const ImageFillEdgeTableRenderer&); + JUCE_DECLARE_NON_COPYABLE (ImageFillEdgeTableRenderer); }; //============================================================================== @@ -1007,8 +1001,7 @@ private: const float pixelOffset; const int pixelOffsetInt; - TransformedImageSpanInterpolator (const TransformedImageSpanInterpolator&); - TransformedImageSpanInterpolator& operator= (const TransformedImageSpanInterpolator&); + JUCE_DECLARE_NON_COPYABLE (TransformedImageSpanInterpolator); }; //============================================================================== @@ -1023,8 +1016,7 @@ private: HeapBlock scratchBuffer; int scratchSize; - TransformedImageFillEdgeTableRenderer (const TransformedImageFillEdgeTableRenderer&); - TransformedImageFillEdgeTableRenderer& operator= (const TransformedImageFillEdgeTableRenderer&); + JUCE_DECLARE_NON_COPYABLE (TransformedImageFillEdgeTableRenderer); }; //============================================================================== @@ -1622,8 +1614,7 @@ private: const RectangleList& clip; const Rectangle area; - SubRectangleIterator (const SubRectangleIterator&); - SubRectangleIterator& operator= (const SubRectangleIterator&); + JUCE_DECLARE_NON_COPYABLE (SubRectangleIterator); }; //============================================================================== @@ -1788,8 +1779,7 @@ private: const RectangleList& clip; const Rectangle& area; - SubRectangleIteratorFloat (const SubRectangleIteratorFloat&); - SubRectangleIteratorFloat& operator= (const SubRectangleIteratorFloat&); + JUCE_DECLARE_NON_COPYABLE (SubRectangleIteratorFloat); }; ClipRegion_RectangleList& operator= (const ClipRegion_RectangleList&); diff --git a/src/gui/graphics/drawables/juce_DrawableComposite.cpp b/src/gui/graphics/drawables/juce_DrawableComposite.cpp index bc8174825c..125570d39e 100644 --- a/src/gui/graphics/drawables/juce_DrawableComposite.cpp +++ b/src/gui/graphics/drawables/juce_DrawableComposite.cpp @@ -226,8 +226,7 @@ struct RentrancyCheckSetter private: bool& b; - RentrancyCheckSetter (const RentrancyCheckSetter&); - RentrancyCheckSetter& operator= (const RentrancyCheckSetter&); + JUCE_DECLARE_NON_COPYABLE (RentrancyCheckSetter); }; void DrawableComposite::updateBoundsToFitChildren() diff --git a/src/gui/graphics/geometry/juce_Path.h b/src/gui/graphics/geometry/juce_Path.h index 4a6e6a9973..8f4939e599 100644 --- a/src/gui/graphics/geometry/juce_Path.h +++ b/src/gui/graphics/geometry/juce_Path.h @@ -675,8 +675,7 @@ public: const Path& path; size_t index; - Iterator (const Iterator&); - Iterator& operator= (const Iterator&); + JUCE_DECLARE_NON_COPYABLE (Iterator); }; //============================================================================== diff --git a/src/gui/graphics/geometry/juce_RectangleList.h b/src/gui/graphics/geometry/juce_RectangleList.h index 78664b669b..b61bb785af 100644 --- a/src/gui/graphics/geometry/juce_RectangleList.h +++ b/src/gui/graphics/geometry/juce_RectangleList.h @@ -236,8 +236,7 @@ public: const RectangleList& owner; int index; - Iterator (const Iterator&); - Iterator& operator= (const Iterator&); + JUCE_DECLARE_NON_COPYABLE (Iterator); }; private: diff --git a/src/gui/graphics/geometry/juce_RelativeCoordinate.h b/src/gui/graphics/geometry/juce_RelativeCoordinate.h index 1adc672bc6..42d6d933d3 100644 --- a/src/gui/graphics/geometry/juce_RelativeCoordinate.h +++ b/src/gui/graphics/geometry/juce_RelativeCoordinate.h @@ -329,8 +329,7 @@ public: const ElementType type; private: - ElementBase (const ElementBase&); - ElementBase& operator= (const ElementBase&); + JUCE_DECLARE_NON_COPYABLE (ElementBase); }; class JUCE_API StartSubPath : public ElementBase @@ -345,8 +344,7 @@ public: RelativePoint startPos; private: - StartSubPath (const StartSubPath&); - StartSubPath& operator= (const StartSubPath&); + JUCE_DECLARE_NON_COPYABLE (StartSubPath); }; class JUCE_API CloseSubPath : public ElementBase @@ -359,8 +357,7 @@ public: RelativePoint* getControlPoints (int& numPoints); private: - CloseSubPath (const CloseSubPath&); - CloseSubPath& operator= (const CloseSubPath&); + JUCE_DECLARE_NON_COPYABLE (CloseSubPath); }; class JUCE_API LineTo : public ElementBase @@ -375,8 +372,7 @@ public: RelativePoint endPoint; private: - LineTo (const LineTo&); - LineTo& operator= (const LineTo&); + JUCE_DECLARE_NON_COPYABLE (LineTo); }; class JUCE_API QuadraticTo : public ElementBase @@ -391,8 +387,7 @@ public: RelativePoint controlPoints[2]; private: - QuadraticTo (const QuadraticTo&); - QuadraticTo& operator= (const QuadraticTo&); + JUCE_DECLARE_NON_COPYABLE (QuadraticTo); }; class JUCE_API CubicTo : public ElementBase @@ -407,8 +402,7 @@ public: RelativePoint controlPoints[3]; private: - CubicTo (const CubicTo&); - CubicTo& operator= (const CubicTo&); + JUCE_DECLARE_NON_COPYABLE (CubicTo); }; //============================================================================== diff --git a/src/gui/graphics/imaging/image_file_formats/juce_GIFLoader.cpp b/src/gui/graphics/imaging/image_file_formats/juce_GIFLoader.cpp index 9c7e43d574..6d70b9f9bd 100644 --- a/src/gui/graphics/imaging/image_file_formats/juce_GIFLoader.cpp +++ b/src/gui/graphics/imaging/image_file_formats/juce_GIFLoader.cpp @@ -472,8 +472,7 @@ private: static inline int makeWord (const uint8 a, const uint8 b) { return (b << 8) | a; } - GIFLoader (const GIFLoader&); - GIFLoader& operator= (const GIFLoader&); + JUCE_DECLARE_NON_COPYABLE (GIFLoader); }; #endif diff --git a/src/gui/graphics/imaging/juce_Image.cpp b/src/gui/graphics/imaging/juce_Image.cpp index 3a74de6a2e..1133658fb3 100644 --- a/src/gui/graphics/imaging/juce_Image.cpp +++ b/src/gui/graphics/imaging/juce_Image.cpp @@ -108,8 +108,6 @@ public: imageData = image_->getPixelData (area_.getX(), area_.getY()); } - ~SubsectionSharedImage() {} - Image::ImageType getType() const { return Image::SoftwareImage; @@ -132,8 +130,7 @@ private: const ReferenceCountedObjectPtr image; const Rectangle area; - SubsectionSharedImage (const SubsectionSharedImage&); - SubsectionSharedImage& operator= (const SubsectionSharedImage&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SubsectionSharedImage); }; const Image Image::getClippedImage (const Rectangle& area) const diff --git a/src/gui/graphics/imaging/juce_Image.h b/src/gui/graphics/imaging/juce_Image.h index b9f25d738e..c11f0be85b 100644 --- a/src/gui/graphics/imaging/juce_Image.h +++ b/src/gui/graphics/imaging/juce_Image.h @@ -326,8 +326,7 @@ public: int lineStride, pixelStride, width, height; private: - BitmapData (const BitmapData&); - BitmapData& operator= (const BitmapData&); + JUCE_DECLARE_NON_COPYABLE (BitmapData); }; /** Copies some pixel values to a rectangle of the image. diff --git a/src/gui/graphics/imaging/juce_ImageCache.cpp b/src/gui/graphics/imaging/juce_ImageCache.cpp index 03c1387896..bb5a7f27c5 100644 --- a/src/gui/graphics/imaging/juce_ImageCache.cpp +++ b/src/gui/graphics/imaging/juce_ImageCache.cpp @@ -123,8 +123,7 @@ private: OwnedArray images; CriticalSection lock; - Pimpl (const Pimpl&); - Pimpl& operator= (const Pimpl&); + JUCE_DECLARE_NON_COPYABLE (Pimpl); }; juce_ImplementSingleton_SingleThreaded (ImageCache::Pimpl); diff --git a/src/gui/graphics/imaging/juce_ImageCache.h b/src/gui/graphics/imaging/juce_ImageCache.h index f9f4b21200..600bfcc2e0 100644 --- a/src/gui/graphics/imaging/juce_ImageCache.h +++ b/src/gui/graphics/imaging/juce_ImageCache.h @@ -117,9 +117,9 @@ private: friend class Pimpl; ImageCache(); - ImageCache (const ImageCache&); - ImageCache& operator= (const ImageCache&); ~ImageCache(); + + JUCE_DECLARE_NON_COPYABLE (ImageCache); }; #endif // __JUCE_IMAGECACHE_JUCEHEADER__ diff --git a/src/io/files/juce_ZipFile.cpp b/src/io/files/juce_ZipFile.cpp index 87d397ea0b..ac616ea824 100644 --- a/src/io/files/juce_ZipFile.cpp +++ b/src/io/files/juce_ZipFile.cpp @@ -150,8 +150,7 @@ private: InputStream* inputStream; ScopedPointer streamToDelete; - ZipInputStream (const ZipInputStream&); - ZipInputStream& operator= (const ZipInputStream&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ZipInputStream); }; diff --git a/src/io/streams/juce_GZIPCompressorOutputStream.cpp b/src/io/streams/juce_GZIPCompressorOutputStream.cpp index 2ecb8f5260..f101123a50 100644 --- a/src/io/streams/juce_GZIPCompressorOutputStream.cpp +++ b/src/io/streams/juce_GZIPCompressorOutputStream.cpp @@ -48,7 +48,7 @@ BEGIN_JUCE_NAMESPACE class GZIPCompressorOutputStream::GZIPCompressorHelper { public: - GZIPCompressorHelper (const int compressionLevel, const bool nowrap) + GZIPCompressorHelper (const int compressionLevel, const int windowBits) : data (0), dataSize (0), compLevel (compressionLevel), @@ -62,7 +62,7 @@ public: zerostruct (stream); streamIsValid = (deflateInit2 (&stream, compLevel, Z_DEFLATED, - nowrap ? -MAX_WBITS : MAX_WBITS, + windowBits != 0 ? windowBits : MAX_WBITS, 8, strategy) == Z_OK); } @@ -135,7 +135,7 @@ public: GZIPCompressorOutputStream::GZIPCompressorOutputStream (OutputStream* const destStream_, int compressionLevel, const bool deleteDestStream, - const bool noWrap) + const int windowBits) : destStream (destStream_), streamToDelete (deleteDestStream ? destStream_ : 0), buffer ((size_t) GZIPCompressorHelper::gzipCompBufferSize) @@ -143,7 +143,7 @@ GZIPCompressorOutputStream::GZIPCompressorOutputStream (OutputStream* const dest if (compressionLevel < 1 || compressionLevel > 9) compressionLevel = -1; - helper = new GZIPCompressorHelper (compressionLevel, noWrap); + helper = new GZIPCompressorHelper (compressionLevel, windowBits); } GZIPCompressorOutputStream::~GZIPCompressorOutputStream() diff --git a/src/io/streams/juce_GZIPCompressorOutputStream.h b/src/io/streams/juce_GZIPCompressorOutputStream.h index c0ad49ab55..27b8c1e5dc 100644 --- a/src/io/streams/juce_GZIPCompressorOutputStream.h +++ b/src/io/streams/juce_GZIPCompressorOutputStream.h @@ -50,13 +50,14 @@ public: indicates that a default compression level should be used. @param deleteDestStreamWhenDestroyed whether or not to delete the destStream object when this stream is destroyed - @param noWrap this is used internally by the ZipFile class - and should be ignored by user applications + @param windowBits this is used internally to change the window size used + by zlib - leave it as 0 unless you specifically need to set + its value for some reason */ GZIPCompressorOutputStream (OutputStream* destStream, int compressionLevel = 0, bool deleteDestStreamWhenDestroyed = false, - bool noWrap = false); + int windowBits = 0); /** Destructor. */ ~GZIPCompressorOutputStream(); @@ -67,6 +68,15 @@ public: bool setPosition (int64 newPosition); bool write (const void* destBuffer, int howMany); + /** These are preset values that can be used for the constructor's windowBits paramter. + For more info about this, see the zlib documentation for its windowBits parameter. + */ + enum WindowBitsValues + { + windowBitsRaw = -15, + windowBitsGZIP = 15 + 16 + }; + private: //============================================================================== OutputStream* const destStream; diff --git a/src/io/streams/juce_GZIPDecompressorInputStream.cpp b/src/io/streams/juce_GZIPDecompressorInputStream.cpp index 2bd389e42d..ba98f30c34 100644 --- a/src/io/streams/juce_GZIPDecompressorInputStream.cpp +++ b/src/io/streams/juce_GZIPDecompressorInputStream.cpp @@ -153,8 +153,7 @@ private: uint8* data; int dataSize; - GZIPDecompressHelper (const GZIPDecompressHelper&); - GZIPDecompressHelper& operator= (const GZIPDecompressHelper&); + JUCE_DECLARE_NON_COPYABLE (GZIPDecompressHelper); }; //============================================================================== diff --git a/src/native/common/juce_MidiDataConcatenator.h b/src/native/common/juce_MidiDataConcatenator.h index 2e4900902b..4a443dca7b 100644 --- a/src/native/common/juce_MidiDataConcatenator.h +++ b/src/native/common/juce_MidiDataConcatenator.h @@ -138,8 +138,7 @@ private: int pendingBytes; double pendingDataTime; - MidiDataConcatenator (const MidiDataConcatenator&); - MidiDataConcatenator& operator= (const MidiDataConcatenator&); + JUCE_DECLARE_NON_COPYABLE (MidiDataConcatenator); }; #endif diff --git a/src/native/common/juce_posix_SharedCode.h b/src/native/common/juce_posix_SharedCode.h index 9dce34034e..4a0c39fdeb 100644 --- a/src/native/common/juce_posix_SharedCode.h +++ b/src/native/common/juce_posix_SharedCode.h @@ -152,8 +152,7 @@ private: bool triggered; const bool manualReset; - WaitableEventImpl (const WaitableEventImpl&); - WaitableEventImpl& operator= (const WaitableEventImpl&); + JUCE_DECLARE_NON_COPYABLE (WaitableEventImpl); }; WaitableEvent::WaitableEvent (const bool manualReset) throw() diff --git a/src/native/linux/juce_linux_Files.cpp b/src/native/linux/juce_linux_Files.cpp index ff2cd1e86f..51dc9878ef 100644 --- a/src/native/linux/juce_linux_Files.cpp +++ b/src/native/linux/juce_linux_Files.cpp @@ -294,8 +294,7 @@ private: const char* wildcardUTF8; DIR* dir; - Pimpl (const Pimpl&); - Pimpl& operator= (const Pimpl&); + JUCE_DECLARE_NON_COPYABLE (Pimpl); }; DirectoryIterator::NativeIterator::NativeIterator (const File& directory, const String& wildCard) diff --git a/src/native/linux/juce_linux_Windowing.cpp b/src/native/linux/juce_linux_Windowing.cpp index 163cad8737..f263f6fc4f 100644 --- a/src/native/linux/juce_linux_Windowing.cpp +++ b/src/native/linux/juce_linux_Windowing.cpp @@ -1909,8 +1909,7 @@ private: #if JUCE_USE_XSHM bool useARGBImagesForRendering, shmCompletedDrawing; #endif - LinuxRepaintManager (const LinuxRepaintManager&); - LinuxRepaintManager& operator= (const LinuxRepaintManager&); + JUCE_DECLARE_NON_COPYABLE (LinuxRepaintManager); }; ScopedPointer repainter; diff --git a/src/native/mac/juce_iphone_Audio.cpp b/src/native/mac/juce_iphone_Audio.cpp index 5e87dbc7fd..50cf2ab99d 100644 --- a/src/native/mac/juce_iphone_Audio.cpp +++ b/src/native/mac/juce_iphone_Audio.cpp @@ -519,8 +519,7 @@ private: } } - IPhoneAudioIODevice (const IPhoneAudioIODevice&); - IPhoneAudioIODevice& operator= (const IPhoneAudioIODevice&); + JUCE_DECLARE_NON_COPYABLE (IPhoneAudioIODevice); }; diff --git a/src/native/mac/juce_mac_CoreGraphicsContext.mm b/src/native/mac/juce_mac_CoreGraphicsContext.mm index dd5255d110..c69085b559 100644 --- a/src/native/mac/juce_mac_CoreGraphicsContext.mm +++ b/src/native/mac/juce_mac_CoreGraphicsContext.mm @@ -784,8 +784,7 @@ private: CGContextConcatCTM (context, t); } - CoreGraphicsContext (const CoreGraphicsContext&); - CoreGraphicsContext& operator= (const CoreGraphicsContext&); + JUCE_DECLARE_NON_COPYABLE (CoreGraphicsContext); }; LowLevelGraphicsContext* CoreGraphicsImage::createLowLevelContext() diff --git a/src/native/mac/juce_mac_Files.mm b/src/native/mac/juce_mac_Files.mm index b35d2b10c3..18a72ec719 100644 --- a/src/native/mac/juce_mac_Files.mm +++ b/src/native/mac/juce_mac_Files.mm @@ -362,8 +362,7 @@ private: const char* wildcardUTF8; NSDirectoryEnumerator* enumerator; - Pimpl (const Pimpl&); - Pimpl& operator= (const Pimpl&); + JUCE_DECLARE_NON_COPYABLE (Pimpl); }; DirectoryIterator::NativeIterator::NativeIterator (const File& directory, const String& wildCard) diff --git a/src/native/mac/juce_mac_Fonts.mm b/src/native/mac/juce_mac_Fonts.mm index 80952432d7..ebdb313987 100644 --- a/src/native/mac/juce_mac_Fonts.mm +++ b/src/native/mac/juce_mac_Fonts.mm @@ -310,21 +310,13 @@ public: NSPoint p[3]; switch ([bez elementAtIndex: i associatedPoints: p]) { - case NSMoveToBezierPathElement: - path.startNewSubPath ((float) p[0].x, (float) -p[0].y); - break; - case NSLineToBezierPathElement: - path.lineTo ((float) p[0].x, (float) -p[0].y); - break; - case NSCurveToBezierPathElement: - path.cubicTo ((float) p[0].x, (float) -p[0].y, (float) p[1].x, (float) -p[1].y, (float) p[2].x, (float) -p[2].y); - break; - case NSClosePathBezierPathElement: - path.closeSubPath(); - break; - default: - jassertfalse; - break; + case NSMoveToBezierPathElement: path.startNewSubPath ((float) p[0].x, (float) -p[0].y); break; + case NSLineToBezierPathElement: path.lineTo ((float) p[0].x, (float) -p[0].y); break; + case NSCurveToBezierPathElement: path.cubicTo ((float) p[0].x, (float) -p[0].y, + (float) p[1].x, (float) -p[1].y, + (float) p[2].x, (float) -p[2].y); break; + case NSClosePathBezierPathElement: path.closeSubPath(); break; + default: jassertfalse; break; } } @@ -507,15 +499,15 @@ const StringArray Font::findAllTypefaceNames() void Font::getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed, String& defaultFallback) { -#if JUCE_IOS + #if JUCE_IOS defaultSans = "Helvetica"; defaultSerif = "Times New Roman"; defaultFixed = "Courier New"; -#else + #else defaultSans = "Lucida Grande"; defaultSerif = "Times New Roman"; defaultFixed = "Monaco"; -#endif + #endif defaultFallback = "Arial Unicode MS"; } diff --git a/src/native/windows/juce_win32_AudioCDReader.cpp b/src/native/windows/juce_win32_AudioCDReader.cpp index c46476ab0c..24fc949cf9 100644 --- a/src/native/windows/juce_win32_AudioCDReader.cpp +++ b/src/native/windows/juce_win32_AudioCDReader.cpp @@ -2135,8 +2135,7 @@ public: private: Pimpl& pimpl; - ScopedDiscOpener (const ScopedDiscOpener&); - ScopedDiscOpener& operator= (const ScopedDiscOpener&); + JUCE_DECLARE_NON_COPYABLE (ScopedDiscOpener); }; DiskState getDiskState() diff --git a/src/native/windows/juce_win32_CameraDevice.cpp b/src/native/windows/juce_win32_CameraDevice.cpp index cc0dc32a6c..a9c41e462b 100644 --- a/src/native/windows/juce_win32_CameraDevice.cpp +++ b/src/native/windows/juce_win32_CameraDevice.cpp @@ -691,8 +691,7 @@ private: CriticalSection listenerLock; //============================================================================== - DShowCameraDeviceInteral (const DShowCameraDeviceInteral&); - DShowCameraDeviceInteral& operator= (const DShowCameraDeviceInteral&); + JUCE_DECLARE_NON_COPYABLE (DShowCameraDeviceInteral); }; diff --git a/src/native/windows/juce_win32_Fonts.cpp b/src/native/windows/juce_win32_Fonts.cpp index de4aca5098..f6166e9f84 100644 --- a/src/native/windows/juce_win32_Fonts.cpp +++ b/src/native/windows/juce_win32_Fonts.cpp @@ -242,8 +242,7 @@ private: int numKPs, size; bool bold, italic; - FontDCHolder (const FontDCHolder&); - FontDCHolder& operator= (const FontDCHolder&); + JUCE_DECLARE_NON_COPYABLE (FontDCHolder); }; juce_ImplementSingleton_SingleThreaded (FontDCHolder); diff --git a/src/native/windows/juce_win32_Midi.cpp b/src/native/windows/juce_win32_Midi.cpp index efa81efa48..5182fe6c15 100644 --- a/src/native/windows/juce_win32_Midi.cpp +++ b/src/native/windows/juce_win32_Midi.cpp @@ -185,8 +185,7 @@ private: MIDIHDR hdr; char data [256]; - MidiHeader (const MidiHeader&); - MidiHeader& operator= (const MidiHeader&); + JUCE_DECLARE_NON_COPYABLE (MidiHeader); }; enum { numHeaders = 32 }; diff --git a/src/native/windows/juce_win32_NativeIncludes.h b/src/native/windows/juce_win32_NativeIncludes.h index 9bf5a44e73..51f5ecf29d 100644 --- a/src/native/windows/juce_win32_NativeIncludes.h +++ b/src/native/windows/juce_win32_NativeIncludes.h @@ -108,7 +108,7 @@ ASIO SDK installed, you can disable ASIO support by commenting-out the "#define JUCE_ASIO" line in juce_Config.h, and rebuild your Juce library. */ - #include "iasiodrv.h" + #include #endif //============================================================================== diff --git a/src/native/windows/juce_win32_WASAPI.cpp b/src/native/windows/juce_win32_WASAPI.cpp index b2450df192..f8b8a1467c 100644 --- a/src/native/windows/juce_win32_WASAPI.cpp +++ b/src/native/windows/juce_win32_WASAPI.cpp @@ -329,8 +329,7 @@ private: return false; } - WASAPIDeviceBase (const WASAPIDeviceBase&); - WASAPIDeviceBase& operator= (const WASAPIDeviceBase&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WASAPIDeviceBase); }; //============================================================================== @@ -446,8 +445,7 @@ public: ScopedPointer converter; private: - WASAPIInputDevice (const WASAPIInputDevice&); - WASAPIInputDevice& operator= (const WASAPIInputDevice&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WASAPIInputDevice); }; //============================================================================== @@ -533,8 +531,7 @@ public: ScopedPointer converter; private: - WASAPIOutputDevice (const WASAPIOutputDevice&); - WASAPIOutputDevice& operator= (const WASAPIOutputDevice&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WASAPIOutputDevice); }; //============================================================================== diff --git a/src/native/windows/juce_win32_Windowing.cpp b/src/native/windows/juce_win32_Windowing.cpp index cc3ac3ce50..77cc579c33 100644 --- a/src/native/windows/juce_win32_Windowing.cpp +++ b/src/native/windows/juce_win32_Windowing.cpp @@ -1066,8 +1066,7 @@ private: private: Image image; - TemporaryImage (const TemporaryImage&); - TemporaryImage& operator= (const TemporaryImage&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TemporaryImage); }; TemporaryImage offscreenImageGenerator; @@ -1938,8 +1937,7 @@ private: } } - JuceDropTarget (const JuceDropTarget&); - JuceDropTarget& operator= (const JuceDropTarget&); + JUCE_DECLARE_NON_COPYABLE (JuceDropTarget); }; void doSettingChange() @@ -2806,8 +2804,7 @@ private: } } - JuceEnumFormatEtc (const JuceEnumFormatEtc&); - JuceEnumFormatEtc& operator= (const JuceEnumFormatEtc&); + JUCE_DECLARE_NON_COPYABLE (JuceEnumFormatEtc); }; class JuceDataObject : public ComBaseClassHelper @@ -2899,8 +2896,7 @@ private: const FORMATETC* const format; const STGMEDIUM* const medium; - JuceDataObject (const JuceDataObject&); - JuceDataObject& operator= (const JuceDataObject&); + JUCE_DECLARE_NON_COPYABLE (JuceDataObject); }; static HDROP createHDrop (const StringArray& fileNames) diff --git a/src/text/juce_String.h b/src/text/juce_String.h index 73b7d8cec1..9a44fef4ef 100644 --- a/src/text/juce_String.h +++ b/src/text/juce_String.h @@ -1034,8 +1034,7 @@ public: String& result; int nextIndex; - Concatenator (const Concatenator&); - Concatenator& operator= (const Concatenator&); + JUCE_DECLARE_NON_COPYABLE (Concatenator); }; private: diff --git a/src/threads/juce_CriticalSection.h b/src/threads/juce_CriticalSection.h index 6a2478fb1d..0502198f6b 100644 --- a/src/threads/juce_CriticalSection.h +++ b/src/threads/juce_CriticalSection.h @@ -110,8 +110,7 @@ private: mutable pthread_mutex_t internal; #endif - CriticalSection (const CriticalSection&); - CriticalSection& operator= (const CriticalSection&); + JUCE_DECLARE_NON_COPYABLE (CriticalSection); }; @@ -144,8 +143,7 @@ public: typedef ScopedLockType ScopedUnlockType; private: - DummyCriticalSection (const DummyCriticalSection&); - DummyCriticalSection& operator= (const DummyCriticalSection&); + JUCE_DECLARE_NON_COPYABLE (DummyCriticalSection); }; diff --git a/src/threads/juce_InterProcessLock.h b/src/threads/juce_InterProcessLock.h index 069746221b..1a61caa697 100644 --- a/src/threads/juce_InterProcessLock.h +++ b/src/threads/juce_InterProcessLock.h @@ -112,8 +112,7 @@ public: InterProcessLock& lock_; bool lockWasSuccessful; - ScopedLockType (const ScopedLockType&); - ScopedLockType& operator= (const ScopedLockType&); + JUCE_DECLARE_NON_COPYABLE (ScopedLockType); }; private: @@ -125,8 +124,7 @@ private: CriticalSection lock; String name; - InterProcessLock (const InterProcessLock&); - InterProcessLock& operator= (const InterProcessLock&); + JUCE_DECLARE_NON_COPYABLE (InterProcessLock); }; diff --git a/src/threads/juce_Process.h b/src/threads/juce_Process.h index cad5e8617a..0422a365b1 100644 --- a/src/threads/juce_Process.h +++ b/src/threads/juce_Process.h @@ -95,8 +95,8 @@ public: private: Process(); - Process (const Process&); - Process& operator= (const Process&); + + JUCE_DECLARE_NON_COPYABLE (Process); }; diff --git a/src/threads/juce_ReadWriteLock.h b/src/threads/juce_ReadWriteLock.h index 38ab34b53d..34a0194207 100644 --- a/src/threads/juce_ReadWriteLock.h +++ b/src/threads/juce_ReadWriteLock.h @@ -130,8 +130,7 @@ private: mutable Thread::ThreadID writerThreadId; mutable Array readerThreads; - ReadWriteLock (const ReadWriteLock&); - ReadWriteLock& operator= (const ReadWriteLock&); + JUCE_DECLARE_NON_COPYABLE (ReadWriteLock); }; diff --git a/src/threads/juce_ScopedLock.h b/src/threads/juce_ScopedLock.h index 1f6b057eb0..f83fa9dab1 100644 --- a/src/threads/juce_ScopedLock.h +++ b/src/threads/juce_ScopedLock.h @@ -82,8 +82,7 @@ private: //============================================================================== const CriticalSection& lock_; - ScopedLock (const ScopedLock&); - ScopedLock& operator= (const ScopedLock&); + JUCE_DECLARE_NON_COPYABLE (ScopedLock); }; @@ -155,8 +154,7 @@ private: //============================================================================== const CriticalSection& lock_; - ScopedUnlock (const ScopedLock&); - ScopedUnlock& operator= (const ScopedUnlock&); + JUCE_DECLARE_NON_COPYABLE (ScopedUnlock); }; diff --git a/src/threads/juce_ScopedReadLock.h b/src/threads/juce_ScopedReadLock.h index 92239f43a9..0cc667991e 100644 --- a/src/threads/juce_ScopedReadLock.h +++ b/src/threads/juce_ScopedReadLock.h @@ -82,8 +82,7 @@ private: //============================================================================== const ReadWriteLock& lock_; - ScopedReadLock (const ScopedReadLock&); - ScopedReadLock& operator= (const ScopedReadLock&); + JUCE_DECLARE_NON_COPYABLE (ScopedReadLock); }; diff --git a/src/threads/juce_ScopedTryLock.h b/src/threads/juce_ScopedTryLock.h index 02d3cfb223..164ce95687 100644 --- a/src/threads/juce_ScopedTryLock.h +++ b/src/threads/juce_ScopedTryLock.h @@ -94,8 +94,7 @@ private: const CriticalSection& lock_; const bool lockWasSuccessful; - ScopedTryLock (const ScopedTryLock&); - ScopedTryLock& operator= (const ScopedTryLock&); + JUCE_DECLARE_NON_COPYABLE (ScopedTryLock); }; diff --git a/src/threads/juce_ScopedWriteLock.h b/src/threads/juce_ScopedWriteLock.h index 95bd8cfd3c..63c9e2bb26 100644 --- a/src/threads/juce_ScopedWriteLock.h +++ b/src/threads/juce_ScopedWriteLock.h @@ -82,8 +82,7 @@ private: //============================================================================== const ReadWriteLock& lock_; - ScopedWriteLock (const ScopedWriteLock&); - ScopedWriteLock& operator= (const ScopedWriteLock&); + JUCE_DECLARE_NON_COPYABLE (ScopedWriteLock); }; diff --git a/src/threads/juce_ThreadPool.cpp b/src/threads/juce_ThreadPool.cpp index 2d313cfdad..3b9d1b5d01 100644 --- a/src/threads/juce_ThreadPool.cpp +++ b/src/threads/juce_ThreadPool.cpp @@ -75,10 +75,6 @@ public: { } - ~ThreadPoolThread() - { - } - void run() { while (! threadShouldExit()) @@ -92,8 +88,7 @@ private: ThreadPool& pool; bool volatile busy; - ThreadPoolThread (const ThreadPoolThread&); - ThreadPoolThread& operator= (const ThreadPoolThread&); + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ThreadPoolThread); }; //============================================================================== diff --git a/src/utilities/juce_DeletedAtShutdown.h b/src/utilities/juce_DeletedAtShutdown.h index e739d4cfac..d2b8267b69 100644 --- a/src/utilities/juce_DeletedAtShutdown.h +++ b/src/utilities/juce_DeletedAtShutdown.h @@ -63,11 +63,10 @@ public: static void deleteAll(); private: - DeletedAtShutdown (const DeletedAtShutdown&); - DeletedAtShutdown& operator= (const DeletedAtShutdown&); - static CriticalSection& getLock(); static Array & getObjects(); + + JUCE_DECLARE_NON_COPYABLE (DeletedAtShutdown); }; #endif // __JUCE_DELETEDATSHUTDOWN_JUCEHEADER__ diff --git a/src/utilities/juce_UnitTest.h b/src/utilities/juce_UnitTest.h index 2512a132bc..e3371354b6 100644 --- a/src/utilities/juce_UnitTest.h +++ b/src/utilities/juce_UnitTest.h @@ -167,8 +167,7 @@ private: const String name; UnitTestRunner* runner; - UnitTest (const UnitTest&); - UnitTest& operator= (const UnitTest&); + JUCE_DECLARE_NON_COPYABLE (UnitTest); }; @@ -266,8 +265,7 @@ private: void addPass(); void addFail (const String& failureMessage); - UnitTestRunner (const UnitTestRunner&); - UnitTestRunner& operator= (const UnitTestRunner&); + JUCE_DECLARE_NON_COPYABLE (UnitTestRunner); };