Merge pull request #41 from trunkmaster/master

More scroller drawing improvement
This commit is contained in:
Fred Kiefer 2019-12-17 22:28:00 +01:00 committed by GitHub
commit 998d06e4ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 19 deletions

View file

@ -1,3 +1,17 @@
2019-12-17 Sergii Stoian <stoyan255@gmail.com>
* Source/NSScrollView.m (tile): tweak location and height of vertical
scroller if header or corner view available.
* Source/GSThemeDrawing.m: (drawTableCornerView:withClip:): do not draw
black rectangle because -drawDarkButton:withClip: draws all necessary
elements.
* Source/GSThemeDrawing.m (drawScrollViewRect:inView:): further cleanup
of method implementation. Removed all tweaks of scroller length - all
required calculations must be done in NSScrollView's -tile method. Simplified
caluclations of X and Y positions of scroller.
2019-12-17 Sergii Stoian <stoyan255@gmail.com>
* Source/GSThemeDrawing.m (drawScrollViewRect:inView:): fixed scroller

View file

@ -1446,8 +1446,6 @@ static NSImage *spinningImages[MaxCount];
if (tiles == nil)
{
[[NSColor blackColor] set];
NSRectFill(divide);
rect = [self drawDarkButton: rect withClip: aRect];
[[NSColor controlShadowColor] set];
NSRectFill(rect);
@ -2646,7 +2644,7 @@ typedef enum {
NSScroller *vertScroller = [scrollView verticalScroller];
NSScroller *horizScroller = [scrollView horizontalScroller];
CGFloat scrollerWidth = [NSScroller scrollerWidth];
CGFloat borderWidth = [self sizeForBorderType: borderType].width;
NSRect scrollerFrame;
[color set];
@ -2654,43 +2652,39 @@ typedef enum {
{
NSInterfaceStyle style;
CGFloat xpos;
CGFloat scrollerHeight = bounds.size.height;
scrollerFrame = [vertScroller frame];
style = NSInterfaceStyleForKey(@"NSScrollViewInterfaceStyle", nil);
if (style == NSMacintoshInterfaceStyle
|| style == NSWindows95InterfaceStyle)
{
xpos = [vertScroller frame].origin.x - 1.0;
xpos = scrollerFrame.origin.x - 1.0;
}
else
{
xpos = [vertScroller frame].origin.x + scrollerWidth;
xpos = scrollerFrame.origin.x + scrollerWidth;
}
NSRectFill(NSMakeRect(xpos, [vertScroller frame].origin.y,
1.0, scrollerHeight - (borderWidth * 2)));
NSRectFill(NSMakeRect(xpos, scrollerFrame.origin.y,
1.0, scrollerFrame.size.height));
}
if ([scrollView hasHorizontalScroller])
{
CGFloat ypos;
CGFloat scrollerY = [horizScroller frame].origin.y;
CGFloat scrollerLength = bounds.size.width;
if ([scrollView hasVerticalScroller])
{
scrollerLength -= [NSScroller scrollerWidth];
}
scrollerFrame = [horizScroller frame];
if ([scrollView isFlipped])
{
ypos = scrollerY - 1.0;
ypos = scrollerFrame.origin.y - 1.0;
}
else
{
ypos = scrollerY + scrollerWidth + 1.0;
ypos = scrollerFrame.origin.y + scrollerWidth + 1.0;
}
NSRectFill(NSMakeRect([horizScroller frame].origin.x, ypos,
scrollerLength - (borderWidth * 2), 1.0));
scrollerFrame.size.width, 1.0));
}
}
}

View file

@ -1213,10 +1213,15 @@ GSOppositeEdge(NSRectEdge edge)
/** Vertically expand the scroller by 1pt on each end */
if (overlapBorders)
{
{
vertScrollerRect.origin.y -= 1;
vertScrollerRect.size.height += 2;
}
else if (_hasHeaderView || _hasCornerView)
{
vertScrollerRect.origin.y -= 1;
vertScrollerRect.size.height += 1;
}
[_vertScroller setFrame: vertScrollerRect];