summaryrefslogtreecommitdiff
path: root/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.cpp')
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.cpp120
1 files changed, 60 insertions, 60 deletions
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.cpp
index 8976b401c0..d0b7b4107a 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUControlGroup.cpp
@@ -2,14 +2,14 @@
File: AUControlGroup.cpp
Abstract: AUControlGroup.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 <Carbon/Carbon.h>
#include "AUCarbonViewBase.h"
@@ -59,10 +59,10 @@ static bool sLocalized = false;
#endif
void AUControlGroup::CreateLabelledSlider(
- AUCarbonViewBase * auView,
- const CAAUParameter & auvp,
- const Rect & area,
- Point labelSize,
+ AUCarbonViewBase * auView,
+ const CAAUParameter & auvp,
+ const Rect & area,
+ Point labelSize,
const ControlFontStyleRec & inFontStyle)
{
#if !__LP64__
@@ -73,14 +73,14 @@ void AUControlGroup::CreateLabelledSlider(
CFStringRef cfstr;
int sliderValueMax, sliderValueMin, sliderValueDefault;
AUCarbonViewControl::ControlType sliderType;
-
+
bool horizontal = (width > height);
if (horizontal) {
maxValRect.top = minValRect.top = area.top + (height - labelSize.v) / 2;
minValRect.left = area.left;
maxValRect.left = area.right - labelSize.h;
-
+
minValRect.bottom = minValRect.top + labelSize.v;
minValRect.right = minValRect.left + labelSize.h;
maxValRect.bottom = maxValRect.top + labelSize.v;
@@ -104,12 +104,12 @@ void AUControlGroup::CreateLabelledSlider(
maxValRect.left = minValRect.left = area.left + (width - labelSize.h) / 2;
maxValRect.top = area.top;
minValRect.top = area.bottom - labelSize.v;
-
+
minValRect.bottom = minValRect.top + labelSize.v;
minValRect.right = minValRect.left + labelSize.h;
maxValRect.bottom = maxValRect.top + labelSize.v;
maxValRect.right = maxValRect.left + labelSize.h;
-
+
sliderRect.left = area.left + (width - kSliderThinDimension) / 2;
sliderRect.right = sliderRect.left + kSliderThinDimension + 4;
sliderRect.top = maxValRect.bottom + kLabelAndSliderSpacing;
@@ -117,7 +117,7 @@ void AUControlGroup::CreateLabelledSlider(
if (auvp.IsIndexedParam ()) {
sliderValueMin = sliderValueDefault = int(auvp.ParamInfo().minValue);
- sliderValueMax = int(auvp.ParamInfo().maxValue);
+ sliderValueMax = int(auvp.ParamInfo().maxValue);
sliderType = AUCarbonViewControl::kTypeDiscrete;
} else {
sliderValueMin = sliderValueDefault = 0;
@@ -134,7 +134,7 @@ void AUControlGroup::CreateLabelledSlider(
verify_noerr(CreateStaticTextControl(auView->GetCarbonWindow(), &minValRect, cfstr, &fontStyle, &newControl));
CFRelease(cfstr);
verify_noerr(auView->EmbedControl(newControl));
-
+
// maximum value label
cfstr = auvp.GetStringFromValueCopy(&auvp.ParamInfo().maxValue);
fontStyle.just = horizontal ? teFlushLeft : teCenter;
@@ -142,7 +142,7 @@ void AUControlGroup::CreateLabelledSlider(
CFRelease(cfstr);
verify_noerr(auView->EmbedControl(newControl));
}
-
+
// slider
verify_noerr(CreateSliderControl(auView->GetCarbonWindow(), &sliderRect, sliderValueDefault, sliderValueMin, sliderValueMax, kControlSliderDoesNotPoint, 0, true, AUCarbonViewControl::SliderTrackProc, &newControl));
@@ -154,10 +154,10 @@ void AUControlGroup::CreateLabelledSlider(
}
void AUControlGroup::CreateLabelledSliderAndEditText(
- AUCarbonViewBase * auView,
- const CAAUParameter & auvp,
- const Rect & area,
- Point labelSize,
+ AUCarbonViewBase * auView,
+ const CAAUParameter & auvp,
+ const Rect & area,
+ Point labelSize,
Point editTextSize,
const ControlFontStyleRec & inFontStyle)
{
@@ -166,7 +166,7 @@ void AUControlGroup::CreateLabelledSliderAndEditText(
Rect sliderArea, textArea;
ControlRef newControl;
int width = area.right - area.left, height = area.bottom - area.top;
-
+
bool horizontal = (width > height);
sliderArea = area;
@@ -188,55 +188,55 @@ void AUControlGroup::CreateLabelledSliderAndEditText(
textArea.right = textArea.left + editTextSize.h;
}
CreateLabelledSlider(auView, auvp, sliderArea, labelSize, fontStyle);
-
- verify_noerr(CreateEditUnicodeTextControl(auView->GetCarbonWindow(), &textArea, CFSTR(""), false,
+
+ verify_noerr(CreateEditUnicodeTextControl(auView->GetCarbonWindow(), &textArea, CFSTR(""), false,
&fontStyle, &newControl));
auView->AddCarbonControl(AUCarbonViewControl::kTypeText, auvp, newControl);
#endif
}
-void AUControlGroup::CreatePopupMenu (AUCarbonViewBase * auView,
- const CAAUParameter & auvp,
- const Rect & area,
+void AUControlGroup::CreatePopupMenu (AUCarbonViewBase * auView,
+ const CAAUParameter & auvp,
+ const Rect & area,
const ControlFontStyleRec & inFontStyle,
const bool inSizeToFit)
{
#if !__LP64__
ControlRef thePopUp;
-
- verify_noerr(CreatePopupButtonControl (auView->GetCarbonWindow(), &area, NULL,
+
+ verify_noerr(CreatePopupButtonControl (auView->GetCarbonWindow(), &area, NULL,
-12345, // DON'T GET MENU FROM RESOURCE mMenuID
- FALSE, // variableWidth,
- 0, // titleWidth,
- 0, // titleJustification,
- 0, // titleStyle,
+ FALSE, // variableWidth,
+ 0, // titleWidth,
+ 0, // titleJustification,
+ 0, // titleStyle,
&thePopUp));
-
+
ControlSize small = kControlSizeSmall;
SetControlData(thePopUp, kControlEntireControl, kControlSizeTag, sizeof(ControlSize), &small);
-
+
MenuRef menuRef;
verify_noerr(CreateNewMenu( 1, 0, &menuRef));
-
+
for (int i = 0; i < auvp.GetNumIndexedParams(); ++i) {
verify_noerr(AppendMenuItemTextWithCFString (menuRef, auvp.GetParamName(i), kMenuItemAttrIgnoreMeta, 0, 0));
}
-
+
verify_noerr(SetControlData(thePopUp, 0, kControlPopupButtonMenuRefTag, sizeof(menuRef), &menuRef));
SetControl32BitMaximum(thePopUp, auvp.GetNumIndexedParams());
verify_noerr (SetControlFontStyle (thePopUp, &inFontStyle));
-
+
if (inSizeToFit) {
AUCarbonViewControl::SizeControlToFit(thePopUp);
}
-
+
auView->AddCarbonControl(AUCarbonViewControl::kTypeDiscrete, auvp, thePopUp);
#endif
}
-void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
- const Point & inLocation,
+void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
+ const Point & inLocation,
const SInt16 inRightOffset,
const SInt16 inTotalWidth)
{
@@ -245,14 +245,14 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
ComponentDescription desc;
Handle h1 = NewHandleClear(4);
OSStatus err = GetComponentInfo ((Component)auView->GetEditAudioUnit(), &desc, h1, 0, 0);
-
- if (err == noErr) {
+
+ if (err == noErr) {
// Get the manufacturer's name... look for the ':' character convention
HLock(h1);
char* ptr1 = *h1;
int len = *ptr1++;
char* displayStr = 0;
-
+
for (int i = 0; i < len; ++i) {
if (ptr1[i] == ':') { // found the name
ptr1[i++] = 0;
@@ -260,7 +260,7 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
break;
}
}
-
+
// localize as necessary:
if (!sLocalized) {
CFBundleRef mainBundle = CFBundleGetBundleWithIdentifier(kLocalizedStringBundle_AUView);
@@ -271,7 +271,7 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
sLocalized = true;
}
}
-
+
// display strings
ControlRef newControl;
Rect r;
@@ -279,7 +279,7 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
ControlFontStyleRec fontStyle;
fontStyle.flags = kControlUseFontMask | kControlUseJustMask;
fontStyle.font = kControlFontSmallBoldSystemFont;
-
+
// display manufacturer string
if (displayStr) {
CFMutableStringRef mfrstring = CFStringCreateMutable(NULL, 0);
@@ -291,15 +291,15 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
CFStringAppend(mfrstring, mfrname); // "Manufacturer: MFRName"
CFRelease (mfrname);
}
-
- r.left = inLocation.h + inRightOffset;
+
+ r.left = inLocation.h + inRightOffset;
r.right = inLocation.h + inTotalWidth - 28;
fontStyle.just = teFlushRight;
-
+
verify_noerr(CreateStaticTextControl(auView->GetCarbonWindow(), &r, mfrstring, &fontStyle, &newControl));
verify_noerr(auView->EmbedControl(newControl));
CFRelease (mfrstring);
-
+
//move displayStr ptr past the manu, to the name
// we move the characters down an index, because the handle doesn't have any room
// at the end for the \0
@@ -316,42 +316,42 @@ void AUControlGroup::AddAUInfo ( AUCarbonViewBase * auView,
displayStr[j] = displayStr[i];
++j; ++i;
} while (i < len);
-
+
displayStr[j] = 0;
}
-
+
// display AudioUnit string
r.left = inLocation.h; r.right = r.left + inRightOffset;
fontStyle.just = 0;
-
+
CFMutableStringRef cfstr = CFStringCreateMutable(NULL, 0);
CFStringAppend(cfstr, kAUViewLocalizedStringKey_AudioUnit); // "Audio Unit"
CFStringAppend(cfstr, kAUViewUnlocalizedString_TitleSeparator);
// "Audio Unit: "
-
+
CFStringRef auname = CFStringCreateWithCString(NULL, displayStr, kCFStringEncodingUTF8);
CFStringAppend(cfstr, auname); // "Audio Unit: AUName"
CFRelease (auname);
-
+
verify_noerr(CreateStaticTextControl(auView->GetCarbonWindow(), &r, cfstr, &fontStyle, &newControl));
-
+
// size text control correctly
Boolean bValue = false;
SetControlData(newControl, kControlEntireControl, 'stim' /* kControlStaticTextIsMultilineTag */, sizeof(Boolean), &bValue);
SInt16 baseLineOffset;
Rect bestRect;
- err = GetBestControlRect(newControl, &bestRect, &baseLineOffset);
+ err = GetBestControlRect(newControl, &bestRect, &baseLineOffset);
if (err == noErr)
{
int width = (bestRect.right - bestRect.left) + 1;
int height = (bestRect.bottom - bestRect.top) + 1;
SizeControl (newControl, width, height);
}
-
+
verify_noerr(auView->EmbedControl(newControl));
CFRelease (cfstr);
}
-
+
DisposeHandle (h1);
#endif
}