summaryrefslogtreecommitdiff
path: root/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp')
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp
index 332475335d..d3394ee19d 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp
@@ -2,14 +2,14 @@
File: AUCarbonViewBase.cpp
Abstract: AUCarbonViewBase.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "AUCarbonViewBase.h"
#include "AUCarbonViewControl.h"
@@ -59,11 +59,11 @@ AUCarbonViewBase::AUCarbonViewBase(AudioUnitCarbonView inInstance, Float32 inNot
mTimerUPP (NULL),
mCarbonWindow(NULL),
mCarbonPane(NULL),
- mXOffset(0),
+ mXOffset(0),
mYOffset(0)
{
AUEventListenerCreate (ParameterListener, this,
- CFRunLoopGetCurrent(), kCFRunLoopCommonModes,
+ CFRunLoopGetCurrent(), kCFRunLoopCommonModes,
inNotificationInterval, inNotificationInterval,
&mParameterListener);
}
@@ -82,12 +82,12 @@ AUCarbonViewBase::~AUCarbonViewBase()
if (mTimerRef)
::RemoveEventLoopTimer (mTimerRef);
-
+
if (mTimerUPP)
DisposeEventLoopTimerUPP (mTimerUPP);
#endif
}
-
+
void AUCarbonViewBase::AddControl(AUCarbonViewControl *control)
{
ControlList::iterator it = find(mControlList.begin(), mControlList.end(), control);
@@ -126,7 +126,7 @@ void AUCarbonViewBase::ParameterListener(void * inCallbackRefCon,
}
}
-
+
OSStatus AUCarbonViewBase::CreateCarbonView(AudioUnit inAudioUnit, WindowRef inWindow, ControlRef inParentControl, const Float32Point &inLocation, const Float32Point &inSize, ControlRef &outParentControl)
{
#if !__LP64__
@@ -140,19 +140,19 @@ OSStatus AUCarbonViewBase::CreateCarbonView(AudioUnit inAudioUnit, WindowRef i
Rect area;
area.left = short(inLocation.x); area.top = short(inLocation.y);
area.right = short(area.left + inSize.x); area.bottom = short(area.top + inSize.y);
- OSStatus err = ::CreateUserPaneControl(inWindow, &area,
+ OSStatus err = ::CreateUserPaneControl(inWindow, &area,
kControlSupportsEmbedding,
&mCarbonPane); // subclass can resize mCarbonPane to taste
verify_noerr(err);
if (err) return err;
outParentControl = mCarbonPane;
-
+
// register for mouse-down in our pane -- we want to clear focus
EventTypeSpec paneEvents[] = {
{ kEventClassControl, kEventControlClick }
};
WantEventTypes(GetControlEventTarget(mCarbonPane), GetEventTypeCount(paneEvents), paneEvents);
-
+
if (IsCompositWindow()) {
verify_noerr(::HIViewAddSubview(inParentControl, mCarbonPane));
mXOffset = 0;
@@ -164,7 +164,7 @@ OSStatus AUCarbonViewBase::CreateCarbonView(AudioUnit inAudioUnit, WindowRef i
mYOffset = inLocation.y;
}
mBottomRight.h = mBottomRight.v = 0;
-
+
SizeControl(mCarbonPane, 0, 0);
if (err = CreateUI(mXOffset, mYOffset))
return err;
@@ -187,12 +187,12 @@ OSStatus AUCarbonViewBase::CreateCarbonView(AudioUnit inAudioUnit, WindowRef i
{ kEventClassScrollable, kEventScrollableGetInfo },
{ kEventClassScrollable, kEventScrollableScrollTo }
};
-
+
WantEventTypes(GetControlEventTarget(mCarbonPane), GetEventTypeCount(scrollEvents), scrollEvents);
-
+
mCurrentScrollPoint.x = mCurrentScrollPoint.y = 0.0f;
}
-
+
return err;
#else
return noErr;
@@ -212,10 +212,10 @@ OSStatus AUCarbonViewBase::EmbedControl(ControlRef ctl)
if (r.right > mBottomRight.h) mBottomRight.h = r.right;
if (r.bottom > mBottomRight.v) mBottomRight.v = r.bottom;
- if (IsCompositWindow())
+ if (IsCompositWindow())
return ::HIViewAddSubview(mCarbonPane, ctl);
- else
- return ::EmbedControl(ctl, mCarbonPane);
+ else
+ return ::EmbedControl(ctl, mCarbonPane);
#else
return noErr;
#endif
@@ -224,19 +224,19 @@ OSStatus AUCarbonViewBase::EmbedControl(ControlRef ctl)
void AUCarbonViewBase::AddCarbonControl(AUCarbonViewControl::ControlType type, const CAAUParameter &param, ControlRef control)
{
verify_noerr(EmbedControl(control));
-
+
AUCarbonViewControl *auvc = new AUCarbonViewControl(this, mParameterListener, type, param, control);
auvc->Bind();
AddControl(auvc);
}
bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef event)
-{
+{
#if !__LP64__
UInt32 eclass = GetEventClass(event);
UInt32 ekind = GetEventKind(event);
ControlRef control;
-
+
switch (eclass) {
case kEventClassControl:
{
@@ -250,7 +250,7 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
}
}
break;
-
+
case kEventClassScrollable:
{
switch (ekind) {
@@ -262,7 +262,7 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
*/
HISize originalSize = { mBottomRight.h, mBottomRight.v };
verify_noerr(SetEventParameter(event, kEventParamImageSize, typeHISize, sizeof(HISize), &originalSize));
-
+
// [2/4]
/* <-- kEventParamViewSize (out, typeHISize)
* On exit, contains the amount of the scrollable view that is
@@ -274,7 +274,7 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
//HISize windowSize = { float(windowBounds.right - windowBounds.left),
// float(windowBounds.bottom - windowBounds.top) };
verify_noerr(SetEventParameter(event, kEventParamViewSize, typeHISize, sizeof(HISize), &(parentBounds.size)));
-
+
// [3/4]
/* <-- kEventParamLineSize (out, typeHISize)
* On exit, contains the amount that should be scrolled in
@@ -282,7 +282,7 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
*/
HISize scrollIncrementSize = { 16.0f, float(20) };
verify_noerr(SetEventParameter(event, kEventParamLineSize, typeHISize, sizeof(HISize), &scrollIncrementSize));
-
+
// [4/4]
/* <-- kEventParamOrigin (out, typeHIPoint)
* On exit, contains the scrollable viewÕs current origin (the
@@ -294,17 +294,17 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
verify_noerr(SetEventParameter(event, kEventParamOrigin, typeHIPoint, sizeof(HIPoint), &mCurrentScrollPoint));
}
return true;
-
+
case kEventScrollableScrollTo:
{
/*
* kEventClassScrollable / kEventScrollableScrollTo
- *
+ *
* Summary:
* Requests that an HIScrollViewÕs scrollable view should scroll to
* a particular origin.
*/
-
+
/* --> kEventParamOrigin (in, typeHIPoint)
* The new origin for the scrollable view. The origin
* coordinates will vary from (0,0) to scrollable viewÕs image
@@ -312,24 +312,24 @@ bool AUCarbonViewBase::HandleEvent(EventHandlerCallRef inHandlerRef, EventRef ev
*/
HIPoint pointToScrollTo;
verify_noerr(GetEventParameter(event, kEventParamOrigin, typeHIPoint, NULL, sizeof(HIPoint), NULL, &pointToScrollTo));
-
+
float xDelta = mCurrentScrollPoint.x - pointToScrollTo.x;
float yDelta = mCurrentScrollPoint.y - pointToScrollTo.y;
// move visible portion the appropriate amount
verify_noerr(HIViewScrollRect(mCarbonPane, NULL, xDelta, yDelta));
// set new content to be drawn
verify_noerr(HIViewSetBoundsOrigin(mCarbonPane, pointToScrollTo.x, pointToScrollTo.y));
-
+
mCurrentScrollPoint = pointToScrollTo;
}
return true;
-
+
default:
break;
}
}
break;
-
+
default:
break;
}
@@ -352,7 +352,7 @@ void AUCarbonViewBase::TellListener (const CAAUParameter &auvp, AudioUnitCarbonV
} else {
auEvent.mEventType = kAudioUnitEvent_EndParameterChangeGesture;
}
- AUEventListenerNotify(mParameterListener, this, &auEvent);
+ AUEventListenerNotify(mParameterListener, this, &auEvent);
}
@@ -370,34 +370,34 @@ pascal void AUCarbonViewBase::TheTimerProc (EventLoopTimerRef inTimer, void *in
This->RespondToEventTimer (inTimer);
}
-void AUCarbonViewBase::RespondToEventTimer (EventLoopTimerRef inTimer)
+void AUCarbonViewBase::RespondToEventTimer (EventLoopTimerRef inTimer)
{}
-/*
+/*
THESE are reasonable values for these two times
- 0.005 // delay
+ 0.005 // delay
0.050 // interval
*/
-OSStatus AUCarbonViewBase::CreateEventLoopTimer (Float32 inDelay, Float32 inInterval)
+OSStatus AUCarbonViewBase::CreateEventLoopTimer (Float32 inDelay, Float32 inInterval)
{
if (mTimerUPP)
return noErr;
-
+
mTimerUPP = NewEventLoopTimerUPP(TheTimerProc);
-
+
EventLoopRef mainEventLoop = GetMainEventLoop();
-
+
//doesn't seem to like too small a value
if (inDelay < 0.005)
inDelay = 0.005;
-
+
OSStatus timerResult = ::InstallEventLoopTimer(
mainEventLoop,
inDelay,
inInterval,
mTimerUPP,
this,
- &mTimerRef);
+ &mTimerRef);
return timerResult;
}