forked from ttscoff/nv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDFView.m
96 lines (86 loc) · 2.21 KB
/
DFView.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//
// DFView.m
// Notation
//
// Created by ElasticThreads on 2/15/11.
//
#import "DFView.h"
#import "AppController.h"
@implementation DFView
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
if (!vColor) {
[self setBackgroundColor:[[NSApp delegate] backgrndColor]];
}
// Initialization code here.
}
return self;
}
- (void)dealloc{
[vColor release];
[super dealloc];
}
- (void)drawRect:(NSRect)rect {
[super drawRect:rect];
if (!IsLionOrLater&&([[NSApp delegate]isInFullScreen])){
NSRect bounds = [self bounds];
bounds.origin.x -=2.0f;
bounds.size.width +=4.0f;
NSBezierPath *aPath=[NSBezierPath bezierPath];
[aPath moveToPoint:NSMakePoint(floor(bounds.origin.x), floor(bounds.origin.y))];
[aPath lineToPoint:NSMakePoint(floor(bounds.origin.x+bounds.size.width), floor(bounds.origin.y))];
[aPath setLineWidth:1.0];
[vColor setStroke];
// [[NSColor redColor] setStroke];
[aPath stroke];
}
}
- (void)setBackgroundColor:(NSColor *)inColor{
if (vColor) {
[vColor release];
}
CGFloat fWhite;
fWhite = [[inColor colorUsingColorSpaceName:NSCalibratedWhiteColorSpace] whiteComponent];
if (fWhite < 0.75f) {
if (fWhite<0.25f) {
fWhite += 0.22f;
}else {
fWhite += 0.16f;
}
}else {
fWhite -= 0.20f;
}
vColor = [NSColor colorWithCalibratedWhite:fWhite alpha:1.0f];
[vColor retain];
}
//
//- (void)mouseDown:(NSEvent*)anEvent {
//
// NSLog(@"dfview mouse down");
// [[NSNotificationCenter defaultCenter] postNotificationName:@"ModTimersShouldReset" object:nil];
//
//
// [super mouseDown:anEvent];
//
//}
//
//- (void)mouseUp:(NSEvent*)anEvent {
//
// NSLog(@"dfview mouseUp");
// [[NSNotificationCenter defaultCenter] postNotificationName:@"ModTimersShouldReset" object:nil];
//
//
// [super mouseUp:anEvent];
//
//}
//
//- (NSMenu *)menuForEvent:(NSEvent *)theEvent{
// NSLog(@"dfview menuForEvent");
// [[NSNotificationCenter defaultCenter] postNotificationName:@"ModTimersShouldReset" object:nil];
//
//
// return [super menuForEvent:theEvent];
//
//}
@end