1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-11 23:54:18 +00:00

Fix for plugin host build on mac, and minor tidy-up of some plugin hosting classes.

This commit is contained in:
Julian Storer 2011-09-06 11:55:24 +01:00
parent 4fcd1e3384
commit da7e8603f7
15 changed files with 939 additions and 841 deletions

View file

@ -55,6 +55,10 @@
#include <Cocoa/Cocoa.h>
#if JUCE_SUPPORT_CARBON
#define Point CarbonDummyPointName
#define Component CarbonDummyCompName
#include <Carbon/Carbon.h>
#undef Point
#undef Component
#endif
#endif

View file

@ -802,8 +802,8 @@ private:
bool saveToFXBFile (MemoryBlock& dest, bool isFXB, int maxSizeMB);
int getVersionNumber() const noexcept { return effect != nullptr ? effect->version : 0; }
const String getVersion() const;
const String getCategory() const;
String getVersion() const;
String getCategory() const;
void setPower (const bool on);
@ -1138,7 +1138,7 @@ public:
pluginWindow = None;
pluginProc = None;
#else
addAndMakeVisible (innerWrapper = new InnerWrapperComponent (this));
addAndMakeVisible (innerWrapper = new InnerWrapperComponent (*this));
#endif
activeVSTWindows.add (this);
@ -1752,15 +1752,15 @@ private:
#endif
#if JUCE_MAC
#if ! JUCE_SUPPORT_CARBON
#error "To build VSTs, you need to enable the JUCE_SUPPORT_CARBON flag in your config!"
#endif
//==============================================================================
#if ! JUCE_SUPPORT_CARBON
#error "To build VSTs, you need to enable the JUCE_SUPPORT_CARBON flag in your config!"
#endif
class InnerWrapperComponent : public CarbonViewWrapperComponent
{
public:
InnerWrapperComponent (VSTPluginWindow* const owner_)
InnerWrapperComponent (VSTPluginWindow& owner_)
: owner (owner_),
alreadyInside (false)
{
@ -1773,24 +1773,24 @@ private:
HIViewRef attachView (WindowRef windowRef, HIViewRef rootView)
{
owner->openPluginWindow (windowRef);
owner.openPluginWindow (windowRef);
return 0;
}
void removeView (HIViewRef)
{
if (owner->isOpen)
if (owner.isOpen)
{
owner->isOpen = false;
owner->dispatch (effEditClose, 0, 0, 0, 0);
owner->dispatch (effEditSleep, 0, 0, 0, 0);
owner.isOpen = false;
owner.dispatch (effEditClose, 0, 0, 0, 0);
owner.dispatch (effEditSleep, 0, 0, 0, 0);
}
}
bool getEmbeddedViewSize (int& w, int& h)
{
ERect* rect = nullptr;
owner->dispatch (effEditGetRect, 0, 0, &rect, 0);
owner.dispatch (effEditGetRect, 0, 0, &rect, 0);
w = rect->right - rect->left;
h = rect->bottom - rect->top;
return true;
@ -1802,7 +1802,7 @@ private:
{
alreadyInside = true;
getTopLevelComponent()->toFront (true);
owner->dispatch (effEditMouse, x, y, 0, 0);
owner.dispatch (effEditMouse, x, y, 0, 0);
alreadyInside = false;
}
else
@ -1824,13 +1824,15 @@ private:
r.top = pos.getY();
r.bottom = r.top + getHeight();
owner->dispatch (effEditDraw, 0, 0, &r, 0);
owner.dispatch (effEditDraw, 0, 0, &r, 0);
}
}
private:
VSTPluginWindow* const owner;
VSTPluginWindow& owner;
bool alreadyInside;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (InnerWrapperComponent);
};
friend class InnerWrapperComponent;
@ -1838,7 +1840,8 @@ private:
void resized()
{
innerWrapper->setSize (getWidth(), getHeight());
if (innerWrapper != nullptr)
innerWrapper->setSize (getWidth(), getHeight());
}
#endif
@ -2357,7 +2360,7 @@ static VstIntPtr VSTCALLBACK audioMaster (AEffect* effect, VstInt32 opcode, VstI
}
//==============================================================================
const String VSTPluginInstance::getVersion() const
String VSTPluginInstance::getVersion() const
{
unsigned int v = dispatch (effGetVendorVersion, 0, 0, 0, 0);
@ -2401,7 +2404,7 @@ int VSTPluginInstance::getUID() const
return uid;
}
const String VSTPluginInstance::getCategory() const
String VSTPluginInstance::getCategory() const
{
const char* result = nullptr;

View file

@ -39,6 +39,7 @@
#define JUCE_DONT_DEFINE_MACROS 1
#include "../juce_core/native/juce_BasicNativeHeaders.h"
#include "juce_audio_processors.h"
#include "../juce_gui_extra/juce_gui_extra.h"
//==============================================================================
#if JUCE_MAC

View file

@ -28,7 +28,6 @@
#include "../juce_gui_basics/juce_gui_basics.h"
#include "../juce_audio_basics/juce_audio_basics.h"
//#include "../juce_audio_devices/juce_audio_devices.h"
//=============================================================================

View file

@ -141,6 +141,9 @@ public:
/** Returns the object that this ScopedPointer refers to. */
inline operator ObjectType*() const noexcept { return object; }
/** Returns the object that this ScopedPointer refers to. */
inline ObjectType* get() const noexcept { return object; }
/** Returns the object that this ScopedPointer refers to. */
inline ObjectType& operator*() const noexcept { return *object; }

View file

@ -34,9 +34,10 @@
This class lets you launch an executable, and read its output. You can also
use it to check whether the child process has finished.
*/
class ChildProcess
class JUCE_API ChildProcess
{
public:
//==============================================================================
/** Creates a process object.
To actually launch the process, use start().
*/

View file

@ -90,10 +90,9 @@ public:
return;
carbonWindow = [[NSWindow alloc] initWithWindowRef: wrapperWindow];
NSWindow* ownerWindow = [((NSView*) getWindowHandle()) window];
[ownerWindow addChildWindow: carbonWindow
ordered: NSWindowAbove];
[getOwnerWindow() addChildWindow: carbonWindow
ordered: NSWindowAbove];
embeddedView = attachView (wrapperWindow, HIViewGetRoot (wrapperWindow));
@ -130,6 +129,14 @@ public:
if (wrapperWindow != 0)
{
NSWindow* ownerWindow = getOwnerWindow();
if ([[ownerWindow childWindows] count] > 0)
{
[ownerWindow removeChildWindow: carbonWindow];
[carbonWindow close];
}
RemoveEventHandler (eventHandlerRef);
DisposeWindow (wrapperWindow);
wrapperWindow = 0;
@ -275,6 +282,8 @@ protected:
Time creationTime;
EventHandlerRef eventHandlerRef;
NSWindow* getOwnerWindow() const { return [((NSView*) getWindowHandle()) window]; }
};
#endif // __JUCE_MAC_CARBONVIEWWRAPPERCOMPONENT_JUCEHEADER__