mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Replace deprecated [NSScroller scrollerWidth] with modern equivalent.
This commit is contained in:
+31
-16
@@ -199,7 +199,7 @@ enum {
|
||||
|| !([[self window] styleMask] & NSTexturedBackgroundWindowMask))
|
||||
return;
|
||||
|
||||
int sw = [NSScroller scrollerWidth];
|
||||
int sw = [NSScroller scrollerWidthForControlSize:NSRegularControlSize scrollerStyle:NSScrollerStyleLegacy];
|
||||
|
||||
// add .5 to the pixel locations to put the lines on a pixel boundary.
|
||||
// the top and right edges of the rect will be outside of the bounds rect
|
||||
@@ -699,11 +699,16 @@ enum {
|
||||
continue;
|
||||
|
||||
NSRect rect;
|
||||
#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)
|
||||
CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSRegularControlSize scrollerStyle:NSScrollerStyleLegacy];
|
||||
#else
|
||||
CGFloat scrollerWidth = [NSScroller scrollerWidth];
|
||||
#endif
|
||||
if ([scroller type] == MMScrollerTypeBottom) {
|
||||
rect = [textView rectForColumnsInRange:[scroller range]];
|
||||
rect.size.height = [NSScroller scrollerWidth];
|
||||
rect.size.height = scrollerWidth;
|
||||
if (leftSbVisible)
|
||||
rect.origin.x += [NSScroller scrollerWidth];
|
||||
rect.origin.x += scrollerWidth;
|
||||
|
||||
// HACK! Make sure the horizontal scrollbar covers the text view
|
||||
// all the way to the right, otherwise it looks ugly when the user
|
||||
@@ -722,7 +727,7 @@ enum {
|
||||
if (NSMaxX(rect) > NSMaxX(textViewFrame))
|
||||
rect.size.width -= NSMaxX(rect) - NSMaxX(textViewFrame);
|
||||
if (!rightSbVisible)
|
||||
rect.size.width -= [NSScroller scrollerWidth];
|
||||
rect.size.width -= scrollerWidth;
|
||||
if (rect.size.width < 0)
|
||||
rect.size.width = 0;
|
||||
} else {
|
||||
@@ -730,7 +735,7 @@ enum {
|
||||
// Adjust for the fact that text layout is flipped.
|
||||
rect.origin.y = NSMaxY(textViewFrame) - rect.origin.y
|
||||
- rect.size.height;
|
||||
rect.size.width = [NSScroller scrollerWidth];
|
||||
rect.size.width = scrollerWidth;
|
||||
if ([scroller type] == MMScrollerTypeRight)
|
||||
rect.origin.x = NSMaxX(textViewFrame);
|
||||
|
||||
@@ -752,9 +757,9 @@ enum {
|
||||
// Vertical scrollers must not cover the resize box in the
|
||||
// bottom-right corner of the window.
|
||||
if ([[self window] showsResizeIndicator] // XXX: make this a flag
|
||||
&& rect.origin.y < [NSScroller scrollerWidth]) {
|
||||
rect.size.height -= [NSScroller scrollerWidth] - rect.origin.y;
|
||||
rect.origin.y = [NSScroller scrollerWidth];
|
||||
&& rect.origin.y < scrollerWidth) {
|
||||
rect.size.height -= scrollerWidth - rect.origin.y;
|
||||
rect.origin.y = scrollerWidth;
|
||||
}
|
||||
|
||||
// Make sure scrollbar rect is bounded by the text view frame.
|
||||
@@ -808,16 +813,21 @@ enum {
|
||||
- (NSSize)vimViewSizeForTextViewSize:(NSSize)textViewSize
|
||||
{
|
||||
NSSize size = textViewSize;
|
||||
#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)
|
||||
CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSRegularControlSize scrollerStyle:NSScrollerStyleLegacy];
|
||||
#else
|
||||
CGFloat scrollerWidth = [NSScroller scrollerWidth];
|
||||
#endif
|
||||
|
||||
if (![[self tabBarControl] isHidden])
|
||||
size.height += [[self tabBarControl] frame].size.height;
|
||||
|
||||
if ([self bottomScrollbarVisible])
|
||||
size.height += [NSScroller scrollerWidth];
|
||||
size.height += scrollerWidth;
|
||||
if ([self leftScrollbarVisible])
|
||||
size.width += [NSScroller scrollerWidth];
|
||||
size.width += scrollerWidth;
|
||||
if ([self rightScrollbarVisible])
|
||||
size.width += [NSScroller scrollerWidth];
|
||||
size.width += scrollerWidth;
|
||||
|
||||
return size;
|
||||
}
|
||||
@@ -825,20 +835,25 @@ enum {
|
||||
- (NSRect)textViewRectForVimViewSize:(NSSize)contentSize
|
||||
{
|
||||
NSRect rect = { {0, 0}, {contentSize.width, contentSize.height} };
|
||||
#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)
|
||||
CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSRegularControlSize scrollerStyle:NSScrollerStyleLegacy];
|
||||
#else
|
||||
CGFloat scrollerWidth = [NSScroller scrollerWidth];
|
||||
#endif
|
||||
|
||||
if (![[self tabBarControl] isHidden])
|
||||
rect.size.height -= [[self tabBarControl] frame].size.height;
|
||||
|
||||
if ([self bottomScrollbarVisible]) {
|
||||
rect.size.height -= [NSScroller scrollerWidth];
|
||||
rect.origin.y += [NSScroller scrollerWidth];
|
||||
rect.size.height -= scrollerWidth;
|
||||
rect.origin.y += scrollerWidth;
|
||||
}
|
||||
if ([self leftScrollbarVisible]) {
|
||||
rect.size.width -= [NSScroller scrollerWidth];
|
||||
rect.origin.x += [NSScroller scrollerWidth];
|
||||
rect.size.width -= scrollerWidth;
|
||||
rect.origin.x += scrollerWidth;
|
||||
}
|
||||
if ([self rightScrollbarVisible])
|
||||
rect.size.width -= [NSScroller scrollerWidth];
|
||||
rect.size.width -= scrollerWidth;
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user