Browse Source

Mouse fix for audio plugins in Muse Receptor. Fixed DrawableText constructor.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
cb7b3d7562
7 changed files with 146 additions and 144 deletions
  1. +9
    -9
      extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp
  2. +118
    -130
      extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp
  3. +9
    -1
      extras/audio plugins/wrapper/juce_PluginHostType.h
  4. +3
    -3
      extras/juce demo/Source/MainDemoWindow.cpp
  5. +3
    -0
      juce_amalgamated.cpp
  6. +3
    -0
      src/gui/graphics/drawables/juce_DrawableText.cpp
  7. +1
    -1
      src/juce_DefineMacros.h

+ 9
- 9
extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp View File

@@ -109,7 +109,7 @@
#undef MemoryBlock #undef MemoryBlock
//============================================================================== //==============================================================================
#if JUCE_WIN32
#if JUCE_WINDOWS
extern void JUCE_CALLTYPE attachSubWindow (void* hostWindow, int& titleW, int& titleH, JUCE_NAMESPACE::Component* comp); extern void JUCE_CALLTYPE attachSubWindow (void* hostWindow, int& titleW, int& titleH, JUCE_NAMESPACE::Component* comp);
extern void JUCE_CALLTYPE resizeHostWindow (void* hostWindow, int& titleW, int& titleH, JUCE_NAMESPACE::Component* comp); extern void JUCE_CALLTYPE resizeHostWindow (void* hostWindow, int& titleW, int& titleH, JUCE_NAMESPACE::Component* comp);
#if ! JucePlugin_EditorRequiresKeyboardFocus #if ! JucePlugin_EditorRequiresKeyboardFocus
@@ -257,7 +257,7 @@ public:
{ {
updateSize(); updateSize();
#if JUCE_WIN32
#if JUCE_WINDOWS
void* const hostWindow = (void*) ASI_GethWnd ((WindowPtr) port); void* const hostWindow = (void*) ASI_GethWnd ((WindowPtr) port);
#else #else
void* const hostWindow = (void*) GetWindowFromPort (port); void* const hostWindow = (void*) GetWindowFromPort (port);
@@ -276,7 +276,7 @@ public:
void DrawContents (Rect*) void DrawContents (Rect*)
{ {
#if JUCE_WIN32
#if JUCE_WINDOWS
if (wrapper != 0) if (wrapper != 0)
{ {
ComponentPeer* const peer = wrapper->getPeer(); ComponentPeer* const peer = wrapper->getPeer();
@@ -346,21 +346,21 @@ public:
editorComp->setTopLeftPosition (0, 0); editorComp->setTopLeftPosition (0, 0);
addAndMakeVisible (editorComp); addAndMakeVisible (editorComp);
#if JUCE_WIN32
#if JUCE_WINDOWS
attachSubWindow (hostWindow, titleW, titleH, this); attachSubWindow (hostWindow, titleW, titleH, this);
#else #else
nsWindow = attachSubWindow (hostWindow, this); nsWindow = attachSubWindow (hostWindow, this);
#endif #endif
setVisible (true); setVisible (true);
#if JUCE_WIN32 && ! JucePlugin_EditorRequiresKeyboardFocus
#if JUCE_WINDOWS && ! JucePlugin_EditorRequiresKeyboardFocus
Desktop::getInstance().addFocusChangeListener (this); Desktop::getInstance().addFocusChangeListener (this);
#endif #endif
} }
~EditorCompWrapper() ~EditorCompWrapper()
{ {
#if JUCE_WIN32 && ! JucePlugin_EditorRequiresKeyboardFocus
#if JUCE_WINDOWS && ! JucePlugin_EditorRequiresKeyboardFocus
Desktop::getInstance().removeFocusChangeListener (this); Desktop::getInstance().removeFocusChangeListener (this);
#endif #endif
@@ -383,7 +383,7 @@ public:
repaint(); repaint();
} }
#if JUCE_WIN32
#if JUCE_WINDOWS
void globalFocusChanged (JUCE_NAMESPACE::Component*) void globalFocusChanged (JUCE_NAMESPACE::Component*)
{ {
#if ! JucePlugin_EditorRequiresKeyboardFocus #if ! JucePlugin_EditorRequiresKeyboardFocus
@@ -398,7 +398,7 @@ public:
setSize (child->getWidth(), child->getHeight()); setSize (child->getWidth(), child->getHeight());
child->setTopLeftPosition (0, 0); child->setTopLeftPosition (0, 0);
#if JUCE_WIN32
#if JUCE_WINDOWS
resizeHostWindow (hostWindow, titleW, titleH, this); resizeHostWindow (hostWindow, titleW, titleH, this);
#endif #endif
owner->updateSize(); owner->updateSize();
@@ -954,7 +954,7 @@ private:
static CEffectProcess* createNewProcess() static CEffectProcess* createNewProcess()
{ {
// Juce setup // Juce setup
#if JUCE_WIN32
#if JUCE_WINDOWS
PlatformUtilities::setCurrentModuleInstanceHandle (gThisModule); PlatformUtilities::setCurrentModuleInstanceHandle (gThisModule);
#endif #endif
initialiseJuce_GUI(); initialiseJuce_GUI();


+ 118
- 130
extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp View File

@@ -165,7 +165,7 @@ END_JUCE_NAMESPACE
//============================================================================== //==============================================================================
#if JUCE_WIN32
#if JUCE_WINDOWS
static HWND findMDIParentOf (HWND w) static HWND findMDIParentOf (HWND w)
{ {
@@ -255,104 +255,8 @@ juce_ImplementSingleton (SharedMessageThread)
#endif #endif
//==============================================================================
// A component to hold the AudioProcessorEditor, and cope with some housekeeping
// chores when it changes or repaints.
class EditorCompWrapper : public Component,
public AsyncUpdater
{
JuceVSTWrapper* wrapper;
public:
EditorCompWrapper (JuceVSTWrapper* const wrapper_,
AudioProcessorEditor* const editor)
: wrapper (wrapper_)
{
setOpaque (true);
editor->setOpaque (true);
setBounds (editor->getBounds());
editor->setTopLeftPosition (0, 0);
addAndMakeVisible (editor);
#if JUCE_WIN32
addMouseListener (this, true);
#endif
}
~EditorCompWrapper()
{
deleteAllChildren();
}
void paint (Graphics& g)
{
}
void paintOverChildren (Graphics& g)
{
// this causes an async call to masterIdle() to help
// creaky old DAWs like Nuendo repaint themselves while we're
// repainting. Otherwise they just seem to give up and sit there
// waiting.
triggerAsyncUpdate();
}
#if JUCE_MAC
bool keyPressed (const KeyPress& kp)
{
// If we have an unused keypress, move the key-focus to a host window
// and re-inject the event..
forwardCurrentKeyEventToHost (this);
return true;
}
#endif
AudioProcessorEditor* getEditorComp() const
{
return dynamic_cast <AudioProcessorEditor*> (getChildComponent (0));
}
void resized()
{
Component* const c = getChildComponent (0);
if (c != 0)
c->setBounds (0, 0, getWidth(), getHeight());
}
void childBoundsChanged (Component* child);
void handleAsyncUpdate();
#if JUCE_WIN32
void mouseDown (const MouseEvent&)
{
broughtToFront();
}
void broughtToFront()
{
// for hosts like nuendo, need to also pop the MDI container to the
// front when our comp is clicked on.
HWND parent = findMDIParentOf ((HWND) getWindowHandle());
if (parent != 0)
{
SetWindowPos (parent,
HWND_TOP,
0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE);
}
}
#endif
//==============================================================================
juce_UseDebuggingNewOperator
};
static Array<void*> activePlugins; static Array<void*> activePlugins;
//============================================================================== //==============================================================================
/** /**
This wraps an AudioProcessor as an AudioEffectX... This wraps an AudioProcessor as an AudioEffectX...
@@ -642,7 +546,7 @@ public:
filter->setNonRealtime (getCurrentProcessLevel() == 4 /* kVstProcessLevelOffline */); filter->setNonRealtime (getCurrentProcessLevel() == 4 /* kVstProcessLevelOffline */);
#if JUCE_WIN32
#if JUCE_WINDOWS
if (GetThreadPriority (GetCurrentThread()) <= THREAD_PRIORITY_NORMAL if (GetThreadPriority (GetCurrentThread()) <= THREAD_PRIORITY_NORMAL
&& GetThreadPriority (GetCurrentThread()) >= THREAD_PRIORITY_LOWEST) && GetThreadPriority (GetCurrentThread()) >= THREAD_PRIORITY_LOWEST)
filter->setNonRealtime (true); filter->setNonRealtime (true);
@@ -1181,7 +1085,7 @@ public:
ed->setOpaque (true); ed->setOpaque (true);
ed->setVisible (true); ed->setVisible (true);
editorComp = new EditorCompWrapper (this, ed);
editorComp = new EditorCompWrapper (*this, ed);
} }
else else
{ {
@@ -1262,7 +1166,7 @@ public:
editorComp->setOpaque (true); editorComp->setOpaque (true);
editorComp->setVisible (false); editorComp->setVisible (false);
#if JUCE_WIN32
#if JUCE_WINDOWS
editorComp->addToDesktop (0); editorComp->addToDesktop (0);
hostWindow = (HWND) ptr; hostWindow = (HWND) ptr;
HWND editorWnd = (HWND) editorComp->getWindowHandle(); HWND editorWnd = (HWND) editorComp->getWindowHandle();
@@ -1271,14 +1175,14 @@ public:
DWORD val = GetWindowLong (editorWnd, GWL_STYLE); DWORD val = GetWindowLong (editorWnd, GWL_STYLE);
val = (val & ~WS_POPUP) | WS_CHILD; val = (val & ~WS_POPUP) | WS_CHILD;
SetWindowLong (editorWnd, GWL_STYLE, val); SetWindowLong (editorWnd, GWL_STYLE, val);
#elif JUCE_LINUX
#elif JUCE_LINUX
editorComp->addToDesktop (0); editorComp->addToDesktop (0);
hostWindow = (Window) ptr; hostWindow = (Window) ptr;
Window editorWnd = (Window) editorComp->getWindowHandle(); Window editorWnd = (Window) editorComp->getWindowHandle();
XReparentWindow (display, editorWnd, hostWindow, 0, 0); XReparentWindow (display, editorWnd, hostWindow, 0, 0);
#else
#else
hostWindow = attachComponentToWindowRef (editorComp, (WindowRef) ptr); hostWindow = attachComponentToWindowRef (editorComp, (WindowRef) ptr);
#endif
#endif
editorComp->setVisible (true); editorComp->setVisible (true);
return 1; return 1;
@@ -1397,6 +1301,117 @@ public:
} }
} }
static PluginHostType& getHostType()
{
static PluginHostType hostType;
return hostType;
}
//==============================================================================
// A component to hold the AudioProcessorEditor, and cope with some housekeeping
// chores when it changes or repaints.
class EditorCompWrapper : public Component,
public AsyncUpdater
{
public:
EditorCompWrapper (JuceVSTWrapper& wrapper_, AudioProcessorEditor* editor)
: wrapper (wrapper_)
{
setOpaque (true);
editor->setOpaque (true);
setBounds (editor->getBounds());
editor->setTopLeftPosition (0, 0);
addAndMakeVisible (editor);
#if JUCE_WIN
if (! getHostType().isReceptor())
addMouseListener (this, true);
#endif
}
~EditorCompWrapper()
{
deleteAllChildren();
}
void paint (Graphics& g) {}
void paintOverChildren (Graphics& g)
{
// this causes an async call to masterIdle() to help
// creaky old DAWs like Nuendo repaint themselves while we're
// repainting. Otherwise they just seem to give up and sit there
// waiting.
triggerAsyncUpdate();
}
#if JUCE_MAC
bool keyPressed (const KeyPress& kp)
{
// If we have an unused keypress, move the key-focus to a host window
// and re-inject the event..
forwardCurrentKeyEventToHost (this);
return true;
}
#endif
AudioProcessorEditor* getEditorComp() const
{
return dynamic_cast <AudioProcessorEditor*> (getChildComponent (0));
}
void resized()
{
Component* const c = getChildComponent (0);
if (c != 0)
c->setBounds (0, 0, getWidth(), getHeight());
}
void childBoundsChanged (Component* child)
{
child->setTopLeftPosition (0, 0);
const int cw = child->getWidth();
const int ch = child->getHeight();
wrapper.resizeHostWindow (cw, ch);
setSize (cw, ch);
#if JUCE_MAC
wrapper.resizeHostWindow (cw, ch); // (doing this a second time seems to be necessary in tracktion)
#endif
}
void handleAsyncUpdate()
{
wrapper.tryMasterIdle();
}
#if JUCE_WINDOWS
void mouseDown (const MouseEvent&)
{
broughtToFront();
}
void broughtToFront()
{
// for hosts like nuendo, need to also pop the MDI container to the
// front when our comp is clicked on.
HWND parent = findMDIParentOf ((HWND) getWindowHandle());
if (parent != 0)
SetWindowPos (parent, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
#endif
//==============================================================================
juce_UseDebuggingNewOperator
private:
JuceVSTWrapper& wrapper;
};
//============================================================================== //==============================================================================
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator
@@ -1421,12 +1436,6 @@ private:
bool shouldDeleteEditor; bool shouldDeleteEditor;
//============================================================================== //==============================================================================
static PluginHostType& getHostType()
{
static PluginHostType hostType;
return hostType;
}
#if JUCE_WINDOWS // Workarounds for Wavelab's happy-go-lucky use of threads. #if JUCE_WINDOWS // Workarounds for Wavelab's happy-go-lucky use of threads.
class NonWavelabMMLock class NonWavelabMMLock
{ {
@@ -1479,27 +1488,6 @@ private:
#endif #endif
}; };
//==============================================================================
void EditorCompWrapper::childBoundsChanged (Component* child)
{
child->setTopLeftPosition (0, 0);
const int cw = child->getWidth();
const int ch = child->getHeight();
wrapper->resizeHostWindow (cw, ch);
setSize (cw, ch);
#if JUCE_MAC
wrapper->resizeHostWindow (cw, ch); // (doing this a second time seems to be necessary in tracktion)
#endif
}
void EditorCompWrapper::handleAsyncUpdate()
{
wrapper->tryMasterIdle();
}
//============================================================================== //==============================================================================
/** Somewhere in the codebase of your plugin, you need to implement this function /** Somewhere in the codebase of your plugin, you need to implement this function
and make it create an instance of the filter subclass that you're building. and make it create an instance of the filter subclass that you're building.


+ 9
- 1
extras/audio plugins/wrapper/juce_PluginHostType.h View File

@@ -57,7 +57,8 @@ public:
SteinbergCubaseGeneric, SteinbergCubaseGeneric,
SteinbergWavelab5, SteinbergWavelab5,
SteinbergWavelab6, SteinbergWavelab6,
SteinbergWavelabGeneric
SteinbergWavelabGeneric,
MuseReceptorGeneric
}; };
const HostType type; const HostType type;
@@ -93,6 +94,11 @@ public:
return type == SteinbergWavelabGeneric || type == SteinbergWavelab5 || type == SteinbergWavelab6; return type == SteinbergWavelabGeneric || type == SteinbergWavelab5 || type == SteinbergWavelab6;
} }
bool isReceptor() const throw()
{
return type == MuseReceptorGeneric;
}
//============================================================================== //==============================================================================
private: private:
static HostType getHostType() throw() static HostType getHostType() throw()
@@ -128,6 +134,8 @@ private:
if (hostFilename.containsIgnoreCase ("Wavelab")) return SteinbergWavelabGeneric; if (hostFilename.containsIgnoreCase ("Wavelab")) return SteinbergWavelabGeneric;
if (hostFilename.containsIgnoreCase ("reaper")) return Reaper; if (hostFilename.containsIgnoreCase ("reaper")) return Reaper;
if (hostFilename.containsIgnoreCase ("Logic")) return EmagicLogic; if (hostFilename.containsIgnoreCase ("Logic")) return EmagicLogic;
if (hostFilename.containsIgnoreCase ("rm-host")) return MuseReceptorGeneric;
#elif JUCE_LINUX #elif JUCE_LINUX
jassertfalse // not yet done! jassertfalse // not yet done!


+ 3
- 3
extras/juce demo/Source/MainDemoWindow.cpp View File

@@ -495,7 +495,7 @@ public:
}; };
//============================================================================== //==============================================================================
#if JUCE_WIN32 || JUCE_LINUX
#if JUCE_WINDOWS || JUCE_LINUX
// Just add a simple icon to the Window system tray area.. // Just add a simple icon to the Window system tray area..
class DemoTaskbarComponent : public SystemTrayIconComponent class DemoTaskbarComponent : public SystemTrayIconComponent
@@ -569,14 +569,14 @@ MainDemoWindow::MainDemoWindow()
setVisible (true); setVisible (true);
#if JUCE_WIN32 || JUCE_LINUX
#if JUCE_WINDOWS || JUCE_LINUX
taskbarIcon = new DemoTaskbarComponent(); taskbarIcon = new DemoTaskbarComponent();
#endif #endif
} }
MainDemoWindow::~MainDemoWindow() MainDemoWindow::~MainDemoWindow()
{ {
#if JUCE_WIN32 || JUCE_LINUX
#if JUCE_WINDOWS || JUCE_LINUX
deleteAndZero (taskbarIcon); deleteAndZero (taskbarIcon);
#endif #endif


+ 3
- 0
juce_amalgamated.cpp View File

@@ -86951,6 +86951,9 @@ DrawableText::DrawableText()
: colour (Colours::black), : colour (Colours::black),
justification (Justification::centredLeft) justification (Justification::centredLeft)
{ {
setBoundingBox (RelativeParallelogram (RelativePoint (0.0f, 0.0f),
RelativePoint (50.0f, 0.0f),
RelativePoint (0.0f, 20.0f)));
setFont (Font (15.0f), true); setFont (Font (15.0f), true);
} }




+ 3
- 0
src/gui/graphics/drawables/juce_DrawableText.cpp View File

@@ -36,6 +36,9 @@ DrawableText::DrawableText()
: colour (Colours::black), : colour (Colours::black),
justification (Justification::centredLeft) justification (Justification::centredLeft)
{ {
setBoundingBox (RelativeParallelogram (RelativePoint (0.0f, 0.0f),
RelativePoint (50.0f, 0.0f),
RelativePoint (0.0f, 20.0f)));
setFont (Font (15.0f), true); setFont (Font (15.0f), true);
} }


+ 1
- 1
src/juce_DefineMacros.h View File

@@ -53,7 +53,7 @@
#endif #endif
// "Rectangle" is defined in some of the newer windows header files.. // "Rectangle" is defined in some of the newer windows header files..
#if JUCE_WIN32
#if JUCE_WINDOWS
#define Rectangle JUCE_NAMESPACE::Rectangle #define Rectangle JUCE_NAMESPACE::Rectangle
#endif #endif
#endif #endif


Loading…
Cancel
Save