Skip to content

Commit

Permalink
Make sure the window border color is only drawn for the border itself…
Browse files Browse the repository at this point in the history
… and not the graph background.
  • Loading branch information
mikepj committed Sep 1, 2022
1 parent b227ddb commit 83b850a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
5 changes: 4 additions & 1 deletion Controllers/XRGGraphWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,10 @@ - (void)setObjectsToTransparency:(id) sender {
case 26: [self.appSettings setBorderTransparency: [sender floatValue]]; break;
case 27: [self.appSettings setTextTransparency: [sender floatValue]]; break;
}
[[self contentView] setNeedsDisplay:YES];

for (NSView *subview in self.contentView.subviews) {
[subview setNeedsDisplay:YES];
}
}

- (IBAction)setFastCPUUsageCheckbox:(id)sender {
Expand Down
43 changes: 20 additions & 23 deletions Graph Views/XRGBackgroundView.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ - (NSBezierPath *)innerPath {
}

- (void)drawRect:(NSRect)rect{
// rotate the coordinate system if necessary
// Rotate the coordinate system if necessary
if (![moduleManager graphOrientationVertical] && isVertical) {
// first update our size:
NSRect f = [parentWindow frame];
Expand Down Expand Up @@ -119,34 +119,31 @@ - (void)drawRect:(NSRect)rect{
}

NSGraphicsContext *gc = [NSGraphicsContext currentContext];

int borderWidth = [parentWindow borderWidth];

NSRect tmpRect = [self bounds];
tmpRect.origin.x += borderWidth;
tmpRect.origin.y = tmpRect.size.height - borderWidth - [appSettings textRectHeight];
tmpRect.size.width -= borderWidth * 2;
tmpRect.size.height = [appSettings textRectHeight];

// Draw the border
[[appSettings borderColor] set];
[[self outerPath] fill];
NSBezierPath *borderPath = [self outerPath];

NSBezierPath *excludePath = [NSBezierPath bezierPath];
for (XRGModule *module in parentWindow.moduleManager.displayList) {
NSRect graphRect = module.reference.frame;
graphRect = [self convertRect:module.reference.bounds fromView:module.reference];
[excludePath appendBezierPath:[NSBezierPath bezierPathWithRect:graphRect]];
}

[borderPath appendBezierPath:[excludePath bezierPathByReversingPath]];
[borderPath fill];

// Draw the title background
[[appSettings backgroundColor] set];
[[self innerPath] fill];

NSRect titleRect;
if (isVertical) {
titleRect = NSMakeRect(borderWidth,
[self bounds].size.height - borderWidth - [appSettings textRectHeight],
[self bounds].size.width - 2 * borderWidth,
[appSettings textRectHeight]);
}
else {
titleRect = NSMakeRect(borderWidth,
[self bounds].size.height - borderWidth - [appSettings textRectHeight],
[self bounds].size.width - 2 * borderWidth,
[appSettings textRectHeight]);
}
// Draw the title
int borderWidth = [parentWindow borderWidth];
NSRect titleRect = NSMakeRect(borderWidth,
[self bounds].size.height - borderWidth - [appSettings textRectHeight],
[self bounds].size.width - 2 * borderWidth,
[appSettings textRectHeight]);
NSRectFill(titleRect);

[gc setShouldAntialias:[appSettings antialiasText]];
Expand Down
6 changes: 3 additions & 3 deletions Utility/XRGModuleManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
@class XRGGraphWindow;

@interface XRGModuleManager : NSObject {
NSMutableArray *allModules;
NSMutableArray *displayModules;
NSMutableArray *alwaysUpdateModules;
NSMutableArray<XRGModule *> *allModules;
NSMutableArray<XRGModule *> *displayModules;
NSMutableArray<XRGModule *> *alwaysUpdateModules;
XRGGraphWindow *myWindow;
}

Expand Down

0 comments on commit 83b850a

Please sign in to comment.