mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
ObjCHelpers: Rename makeCGRect from makeNSRect
This commit is contained in:
parent
90e72dbd98
commit
2d01e326db
9 changed files with 23 additions and 20 deletions
|
|
@ -1687,7 +1687,7 @@ public:
|
|||
static NSView* createViewFor (AudioProcessor* filter, JuceAU* au, AudioProcessorEditor* const editor)
|
||||
{
|
||||
auto* editorCompHolder = new EditorCompHolder (editor);
|
||||
auto r = convertToHostBounds (makeNSRect (editorCompHolder->getSizeToContainChild()));
|
||||
auto r = convertToHostBounds (makeCGRect (editorCompHolder->getSizeToContainChild()));
|
||||
|
||||
static JuceUIViewClass cls;
|
||||
auto* view = [[cls.createInstance() initWithFrame: r] autorelease];
|
||||
|
|
@ -1766,7 +1766,7 @@ public:
|
|||
[CATransaction begin];
|
||||
[CATransaction setValue: (id) kCFBooleanTrue forKey:kCATransactionDisableActions];
|
||||
|
||||
auto rect = convertToHostBounds (makeNSRect (lastBounds));
|
||||
auto rect = convertToHostBounds (makeCGRect (lastBounds));
|
||||
auto* view = (NSView*) getWindowHandle();
|
||||
|
||||
auto superRect = [[view superview] frame];
|
||||
|
|
|
|||
|
|
@ -160,8 +160,8 @@ private:
|
|||
{
|
||||
auto* view = static_cast<NSView*> (getView());
|
||||
const auto newArea = peer->getAreaCoveredBy (*this);
|
||||
[view setFrame: makeNSRect (newArea.withHeight (newArea.getHeight() + 1))];
|
||||
[view setFrame: makeNSRect (newArea)];
|
||||
[view setFrame: makeCGRect (newArea.withHeight (newArea.getHeight() + 1))];
|
||||
[view setFrame: makeCGRect (newArea)];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ private:
|
|||
{
|
||||
if (bounds != nullptr)
|
||||
{
|
||||
auto nsBounds = makeNSRect (*bounds);
|
||||
auto nsBounds = makeCGRect (*bounds);
|
||||
|
||||
auto mainScreenHeight = []
|
||||
{
|
||||
|
|
|
|||
|
|
@ -141,16 +141,19 @@ inline var nsDictionaryToVar (const NSDictionary* dictionary)
|
|||
return jsonDataToVar (jsonObjectToData (dictionary));
|
||||
}
|
||||
|
||||
#if JUCE_MAC
|
||||
// NSRect is just another name for CGRect, but CGRect is available on iOS *and* macOS.
|
||||
// Use makeCGRect below.
|
||||
template <typename RectangleType>
|
||||
NSRect makeNSRect (const RectangleType& r) noexcept
|
||||
CGRect makeNSRect (const RectangleType& r) noexcept = delete;
|
||||
|
||||
template <typename RectangleType>
|
||||
CGRect makeCGRect (const RectangleType& r) noexcept
|
||||
{
|
||||
return NSMakeRect (static_cast<CGFloat> (r.getX()),
|
||||
return CGRectMake (static_cast<CGFloat> (r.getX()),
|
||||
static_cast<CGFloat> (r.getY()),
|
||||
static_cast<CGFloat> (r.getWidth()),
|
||||
static_cast<CGFloat> (r.getHeight()));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if JUCE_INTEL
|
||||
template <typename T>
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ private:
|
|||
addMethod (@selector (accessibilityFrame), [] (id self, SEL)
|
||||
{
|
||||
if (auto* handler = getHandler (self))
|
||||
return flippedScreenRect (makeNSRect (handler->getComponent().getScreenBounds()));
|
||||
return flippedScreenRect (makeCGRect (handler->getComponent().getScreenBounds()));
|
||||
|
||||
return NSZeroRect;
|
||||
});
|
||||
|
|
@ -429,7 +429,7 @@ private:
|
|||
addMethod (@selector (accessibilityFrameForRange:), [] (id self, SEL, NSRange range)
|
||||
{
|
||||
if (auto* textInterface = getTextInterface (self))
|
||||
return flippedScreenRect (makeNSRect (textInterface->getTextBounds (nsRangeToJuce (range)).getBounds()));
|
||||
return flippedScreenRect (makeCGRect (textInterface->getTextBounds (nsRangeToJuce (range)).getBounds()));
|
||||
|
||||
return NSZeroRect;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public:
|
|||
|
||||
if (preview != nullptr)
|
||||
{
|
||||
nsViewPreview = [[NSView alloc] initWithFrame: makeNSRect (preview->getLocalBounds())];
|
||||
nsViewPreview = [[NSView alloc] initWithFrame: makeCGRect (preview->getLocalBounds())];
|
||||
[panel setAccessoryView: nsViewPreview];
|
||||
|
||||
preview->addToDesktop (0, (void*) nsViewPreview);
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ public:
|
|||
appFocusChangeCallback = appFocusChanged;
|
||||
isEventBlockedByModalComps = checkEventBlockedByModalComps;
|
||||
|
||||
auto r = makeNSRect (component.getLocalBounds());
|
||||
auto r = makeCGRect (component.getLocalBounds());
|
||||
|
||||
view = [createViewInstance() initWithFrame: r];
|
||||
setOwner (view, this);
|
||||
|
|
@ -391,7 +391,7 @@ public:
|
|||
|
||||
void setBounds (const Rectangle<int>& newBounds, bool) override
|
||||
{
|
||||
auto r = makeNSRect (newBounds);
|
||||
auto r = makeCGRect (newBounds);
|
||||
auto oldViewSize = [view frame].size;
|
||||
|
||||
if (isSharedWindow)
|
||||
|
|
@ -1115,7 +1115,7 @@ public:
|
|||
const Rectangle currentBounds { (float) frameSize.width, (float) frameSize.height };
|
||||
|
||||
for (auto& i : deferredRepaints)
|
||||
[view setNeedsDisplayInRect: makeNSRect (i)];
|
||||
[view setNeedsDisplayInRect: makeCGRect (i)];
|
||||
|
||||
lastRepaintTime = Time::getMillisecondCounter();
|
||||
|
||||
|
|
@ -1312,7 +1312,7 @@ public:
|
|||
constrainer->checkBounds (pos, original, screenBounds,
|
||||
isStretchingTop, isStretchingLeft, isStretchingBottom, isStretchingRight);
|
||||
|
||||
return flippedScreenRect (makeNSRect (detail::ScalingHelpers::scaledScreenPosToUnscaled (scale, pos)));
|
||||
return flippedScreenRect (makeCGRect (detail::ScalingHelpers::scaledScreenPosToUnscaled (scale, pos)));
|
||||
}
|
||||
|
||||
static void showArrowCursorIfNeeded()
|
||||
|
|
@ -2574,7 +2574,7 @@ struct JuceNSViewClass final : public NSViewComponentPeerWrapper<ObjCClass<NSVie
|
|||
: target->getTextBounds (codePointRange).getRectangle (0);
|
||||
const auto areaOnDesktop = comp->localAreaToGlobal (rect);
|
||||
|
||||
return flippedScreenRect (makeNSRect (detail::ScalingHelpers::scaledScreenPosToUnscaled (areaOnDesktop)));
|
||||
return flippedScreenRect (makeCGRect (detail::ScalingHelpers::scaledScreenPosToUnscaled (areaOnDesktop)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2842,7 +2842,7 @@ struct JuceNSWindowClass final : public NSViewComponentPeerWrapper<ObjCClass<NSW
|
|||
.withHeight ((float) constrainer->getMaximumHeight());
|
||||
const auto constrained = expanded.constrainedWithin (safeScreenBounds);
|
||||
|
||||
return flippedScreenRect (makeNSRect ([&]
|
||||
return flippedScreenRect (makeCGRect ([&]
|
||||
{
|
||||
if (constrained == owner->getBounds().toFloat())
|
||||
return owner->lastSizeBeforeZoom.toFloat();
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public:
|
|||
const auto newArea = peer->getAreaCoveredBy (owner);
|
||||
|
||||
if (convertToRectInt ([view frame]) != newArea)
|
||||
[view setFrame: makeNSRect (newArea)];
|
||||
[view setFrame: makeCGRect (newArea)];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ public:
|
|||
const auto newArea = peer->getAreaCoveredBy (owner);
|
||||
|
||||
if (convertToRectInt ([view frame]) != newArea)
|
||||
[view setFrame: makeNSRect (newArea)];
|
||||
[view setFrame: makeCGRect (newArea)];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue