Browse Source

Fixes for viewports, flac seeking, plugin hosting of carbon UIs, and activeX control embedding.

tags/2021-05-28
Julian Storer 16 years ago
parent
commit
f72563d6c7
6 changed files with 97 additions and 62 deletions
  1. +3
    -0
      extras/audio plugins/How to use this framework.txt
  2. +47
    -31
      juce_amalgamated.cpp
  3. +12
    -8
      src/audio/audio_file_formats/juce_FlacAudioFormat.cpp
  4. +10
    -20
      src/gui/components/layout/juce_Viewport.cpp
  5. +13
    -1
      src/native/mac/juce_mac_CarbonViewWrapperComponent.h
  6. +12
    -2
      src/native/windows/juce_win32_WebBrowserComponent.cpp

+ 3
- 0
extras/audio plugins/How to use this framework.txt View File

@@ -241,6 +241,9 @@ any compilation problems if, for example, you don't have the appropriate SDK for
- As for the PC, you'll need to make sure your project contains a correctly set-up JucePluginCharacteristics.h - As for the PC, you'll need to make sure your project contains a correctly set-up JucePluginCharacteristics.h
file - start with a copy of the one in the demo plugin project, and go through it making sure that file - start with a copy of the one in the demo plugin project, and go through it making sure that
all the values make sense for your plugin. all the values make sense for your plugin.
- The JucePluginCharacteristics.h file is included not only by the code, but also by the resources files - so it
needs to be locatable on both your normal header search path, and also on your resource include path, which is
the project setting called 'Rez Search Paths'
- Because of the flat naming structure used by Objective-C, if a host loads several different plugins which - Because of the flat naming structure used by Objective-C, if a host loads several different plugins which
all contain slightly different versions of the juce library, you can get nasty situations where all their obj-C all contain slightly different versions of the juce library, you can get nasty situations where all their obj-C
classes are cross-linked to the similarly-named class in other modules, and everything turns into a big mess... classes are cross-linked to the similarly-named class in other modules, and everything turns into a big mess...


+ 47
- 31
juce_amalgamated.cpp View File

@@ -782,6 +782,18 @@ public:
setEmbeddedWindowToOurSize(); setEmbeddedWindowToOurSize();
} }


static void recursiveHIViewRepaint (HIViewRef view) throw()
{
HIViewSetNeedsDisplay (view, true);
HIViewRef child = HIViewGetFirstSubview (view);

while (child != 0)
{
recursiveHIViewRepaint (child);
child = HIViewGetNextView (child);
}
}

void timerCallback() void timerCallback()
{ {
setOurSizeToEmbeddedViewSize(); setOurSizeToEmbeddedViewSize();
@@ -789,7 +801,7 @@ public:
// To avoid strange overpainting problems when the UI is first opened, we'll // To avoid strange overpainting problems when the UI is first opened, we'll
// repaint it a few times during the first second that it's on-screen.. // repaint it a few times during the first second that it's on-screen..
if ((Time::getCurrentTime() - creationTime).inMilliseconds() < 1000) if ((Time::getCurrentTime() - creationTime).inMilliseconds() < 1000)
HIViewSetNeedsDisplay (embeddedView, true);
recursiveHIViewRepaint (HIViewGetRoot (wrapperWindow));
} }


OSStatus carbonEventHandler (EventHandlerCallRef nextHandlerRef, OSStatus carbonEventHandler (EventHandlerCallRef nextHandlerRef,
@@ -60024,29 +60036,19 @@ void Viewport::updateVisibleRegion()
verticalScrollBar->setVisible (false); verticalScrollBar->setVisible (false);
} }


if ((contentComp->getWidth() > 0) && showHScrollbar
&& getHeight() > getScrollBarThickness())
{
horizontalScrollBar->setRangeLimits (0.0, contentComp->getWidth());
horizontalScrollBar->setCurrentRange (newVX, getMaximumVisibleWidth());
horizontalScrollBar->setSingleStepSize (singleStepX);
}
else
{
horizontalScrollBar->setRangeLimits (0.0, contentComp->getWidth());
horizontalScrollBar->setCurrentRange (newVX, getMaximumVisibleWidth());
horizontalScrollBar->setSingleStepSize (singleStepX);

if (! (contentComp->getWidth() > 0 && showHScrollbar && getHeight() > getScrollBarThickness()))
horizontalScrollBar->setVisible (false); horizontalScrollBar->setVisible (false);
}


if ((contentComp->getHeight() > 0) && showVScrollbar
&& getWidth() > getScrollBarThickness())
{
verticalScrollBar->setRangeLimits (0.0, contentComp->getHeight());
verticalScrollBar->setCurrentRange (newVY, getMaximumVisibleHeight());
verticalScrollBar->setSingleStepSize (singleStepY);
}
else
{
verticalScrollBar->setRangeLimits (0.0, contentComp->getHeight());
verticalScrollBar->setCurrentRange (newVY, getMaximumVisibleHeight());
verticalScrollBar->setSingleStepSize (singleStepY);

if (! (contentComp->getHeight() > 0 && showVScrollbar && getWidth() > getScrollBarThickness()))
verticalScrollBar->setVisible (false); verticalScrollBar->setVisible (false);
}


if (verticalScrollBar->isVisible()) if (verticalScrollBar->isVisible())
{ {
@@ -122969,17 +122971,17 @@ public:
} }
else else
{ {
if (startSampleInFile < reservoirStart
|| startSampleInFile > reservoirStart + jmax (samplesInReservoir, 511))
if (startSampleInFile >= (int) lengthInSamples)
{ {
samplesInReservoir = 0; samplesInReservoir = 0;
if (startSampleInFile >= (int) lengthInSamples)
break;
}
else if (startSampleInFile < reservoirStart
|| startSampleInFile > reservoirStart + jmax (samplesInReservoir, 511))
{
// had some problems with flac crashing if the read pos is aligned more // had some problems with flac crashing if the read pos is aligned more
// accurately than this. Probably fixed in newer versions of the library, though. // accurately than this. Probably fixed in newer versions of the library, though.
reservoirStart = (int) (startSampleInFile & ~511); reservoirStart = (int) (startSampleInFile & ~511);
samplesInReservoir = 0;
FLAC__stream_decoder_seek_absolute (decoder, (FLAC__uint64) reservoirStart); FLAC__stream_decoder_seek_absolute (decoder, (FLAC__uint64) reservoirStart);
} }
else else
@@ -123240,9 +123242,13 @@ public:
return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED; return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
} }


static FLAC__StreamEncoderTellStatus encodeTellCallback (const FLAC__StreamEncoder*, FLAC__uint64*, void*)
static FLAC__StreamEncoderTellStatus encodeTellCallback (const FLAC__StreamEncoder*, FLAC__uint64* absolute_byte_offset, void* client_data)
{ {
return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
if (client_data == 0)
return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;

*absolute_byte_offset = (FLAC__uint64) ((FlacWriter*) client_data)->output->getPosition();
return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
} }


static void encodeMetadataCallback (const FLAC__StreamEncoder*, static void encodeMetadataCallback (const FLAC__StreamEncoder*,
@@ -239115,11 +239121,13 @@ private:
IConnectionPoint* connectionPoint; IConnectionPoint* connectionPoint;
DWORD adviseCookie; DWORD adviseCookie;


class EventHandler : public IDispatch
class EventHandler : public IDispatch,
public ComponentMovementWatcher
{ {
public: public:
EventHandler (WebBrowserComponent* owner_) EventHandler (WebBrowserComponent* owner_)
: owner (owner_),
: ComponentMovementWatcher (owner_),
owner (owner_),
refCount (0) refCount (0)
{ {
} }
@@ -239180,6 +239188,14 @@ private:
return E_NOTIMPL; return E_NOTIMPL;
} }


void componentMovedOrResized (bool /*wasMoved*/, bool /*wasResized*/) {}
void componentPeerChanged() {}

void componentVisibilityChanged (Component&)
{
owner->visibilityChanged();
}

juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator


private: private:


+ 12
- 8
src/audio/audio_file_formats/juce_FlacAudioFormat.cpp View File

@@ -177,17 +177,17 @@ public:
} }
else else
{ {
if (startSampleInFile < reservoirStart
|| startSampleInFile > reservoirStart + jmax (samplesInReservoir, 511))
if (startSampleInFile >= (int) lengthInSamples)
{ {
samplesInReservoir = 0; samplesInReservoir = 0;
if (startSampleInFile >= (int) lengthInSamples)
break;
}
else if (startSampleInFile < reservoirStart
|| startSampleInFile > reservoirStart + jmax (samplesInReservoir, 511))
{
// had some problems with flac crashing if the read pos is aligned more // had some problems with flac crashing if the read pos is aligned more
// accurately than this. Probably fixed in newer versions of the library, though. // accurately than this. Probably fixed in newer versions of the library, though.
reservoirStart = (int) (startSampleInFile & ~511); reservoirStart = (int) (startSampleInFile & ~511);
samplesInReservoir = 0;
FLAC__stream_decoder_seek_absolute (decoder, (FLAC__uint64) reservoirStart); FLAC__stream_decoder_seek_absolute (decoder, (FLAC__uint64) reservoirStart);
} }
else else
@@ -454,9 +454,13 @@ public:
return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED; return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
} }
static FLAC__StreamEncoderTellStatus encodeTellCallback (const FLAC__StreamEncoder*, FLAC__uint64*, void*)
static FLAC__StreamEncoderTellStatus encodeTellCallback (const FLAC__StreamEncoder*, FLAC__uint64* absolute_byte_offset, void* client_data)
{ {
return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
if (client_data == 0)
return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
*absolute_byte_offset = (FLAC__uint64) ((FlacWriter*) client_data)->output->getPosition();
return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
} }
static void encodeMetadataCallback (const FLAC__StreamEncoder*, static void encodeMetadataCallback (const FLAC__StreamEncoder*,


+ 10
- 20
src/gui/components/layout/juce_Viewport.cpp View File

@@ -151,29 +151,19 @@ void Viewport::updateVisibleRegion()
verticalScrollBar->setVisible (false); verticalScrollBar->setVisible (false);
} }
if ((contentComp->getWidth() > 0) && showHScrollbar
&& getHeight() > getScrollBarThickness())
{
horizontalScrollBar->setRangeLimits (0.0, contentComp->getWidth());
horizontalScrollBar->setCurrentRange (newVX, getMaximumVisibleWidth());
horizontalScrollBar->setSingleStepSize (singleStepX);
}
else
{
horizontalScrollBar->setRangeLimits (0.0, contentComp->getWidth());
horizontalScrollBar->setCurrentRange (newVX, getMaximumVisibleWidth());
horizontalScrollBar->setSingleStepSize (singleStepX);
if (! (contentComp->getWidth() > 0 && showHScrollbar && getHeight() > getScrollBarThickness()))
horizontalScrollBar->setVisible (false); horizontalScrollBar->setVisible (false);
}
if ((contentComp->getHeight() > 0) && showVScrollbar
&& getWidth() > getScrollBarThickness())
{
verticalScrollBar->setRangeLimits (0.0, contentComp->getHeight());
verticalScrollBar->setCurrentRange (newVY, getMaximumVisibleHeight());
verticalScrollBar->setSingleStepSize (singleStepY);
}
else
{
verticalScrollBar->setRangeLimits (0.0, contentComp->getHeight());
verticalScrollBar->setCurrentRange (newVY, getMaximumVisibleHeight());
verticalScrollBar->setSingleStepSize (singleStepY);
if (! (contentComp->getHeight() > 0 && showVScrollbar && getWidth() > getScrollBarThickness()))
verticalScrollBar->setVisible (false); verticalScrollBar->setVisible (false);
}
if (verticalScrollBar->isVisible()) if (verticalScrollBar->isVisible())
{ {


+ 13
- 1
src/native/mac/juce_mac_CarbonViewWrapperComponent.h View File

@@ -202,6 +202,18 @@ public:
setEmbeddedWindowToOurSize(); setEmbeddedWindowToOurSize();
} }
static void recursiveHIViewRepaint (HIViewRef view) throw()
{
HIViewSetNeedsDisplay (view, true);
HIViewRef child = HIViewGetFirstSubview (view);
while (child != 0)
{
recursiveHIViewRepaint (child);
child = HIViewGetNextView (child);
}
}
void timerCallback() void timerCallback()
{ {
setOurSizeToEmbeddedViewSize(); setOurSizeToEmbeddedViewSize();
@@ -209,7 +221,7 @@ public:
// To avoid strange overpainting problems when the UI is first opened, we'll // To avoid strange overpainting problems when the UI is first opened, we'll
// repaint it a few times during the first second that it's on-screen.. // repaint it a few times during the first second that it's on-screen..
if ((Time::getCurrentTime() - creationTime).inMilliseconds() < 1000) if ((Time::getCurrentTime() - creationTime).inMilliseconds() < 1000)
HIViewSetNeedsDisplay (embeddedView, true);
recursiveHIViewRepaint (HIViewGetRoot (wrapperWindow));
} }
OSStatus carbonEventHandler (EventHandlerCallRef nextHandlerRef, OSStatus carbonEventHandler (EventHandlerCallRef nextHandlerRef,


+ 12
- 2
src/native/windows/juce_win32_WebBrowserComponent.cpp View File

@@ -129,11 +129,13 @@ private:
DWORD adviseCookie; DWORD adviseCookie;
//============================================================================== //==============================================================================
class EventHandler : public IDispatch
class EventHandler : public IDispatch,
public ComponentMovementWatcher
{ {
public: public:
EventHandler (WebBrowserComponent* owner_) EventHandler (WebBrowserComponent* owner_)
: owner (owner_),
: ComponentMovementWatcher (owner_),
owner (owner_),
refCount (0) refCount (0)
{ {
} }
@@ -195,6 +197,14 @@ private:
return E_NOTIMPL; return E_NOTIMPL;
} }
void componentMovedOrResized (bool /*wasMoved*/, bool /*wasResized*/) {}
void componentPeerChanged() {}
void componentVisibilityChanged (Component&)
{
owner->visibilityChanged();
}
//============================================================================== //==============================================================================
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator


Loading…
Cancel
Save