File: TimeMonWraps.m

package info (click to toggle)
timemon.app 4.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 580 kB
  • sloc: objc: 698; ansic: 161; makefile: 23; sh: 9
file content (56 lines) | stat: -rw-r--r-- 2,044 bytes parent folder | download | duplicates (4)
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
// translated from the pswraps for GNUstep/MOSX by Gregory John Casamento

#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSGeometry.h>
#import <AppKit/NSBezierPath.h>
#import "NSColorExtensions.h"

#import "TimeMonWraps.h"

void drawArc2(double radius, double bdeg, double ddeg, double ldeg,
	      double mdeg)
{
  NSBezierPath *bp = nil;
  NSPoint point = NSMakePoint(24,24);
  NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
  NSColor *idleColor = [NSColor colorFromStringRepresentation: 
				  [defaults stringForKey: @"IdleColor"]];
  NSColor *niceColor = [NSColor colorFromStringRepresentation: 
				  [defaults stringForKey: @"NiceColor"]];
  NSColor *userColor = [NSColor colorFromStringRepresentation: 
				  [defaults stringForKey: @"UserColor"]];
  NSColor *systemColor = [NSColor colorFromStringRepresentation: 
				    [defaults stringForKey: @"SystemColor"]];
  NSColor *ioWaitColor = [NSColor colorFromStringRepresentation:
				    [defaults stringForKey: @"IOWaitColor"]];

  [idleColor set];
  bp = [NSBezierPath bezierPath];
  [bp moveToPoint: point];
  [bp appendBezierPathWithArcWithCenter: point radius: radius startAngle: 0 endAngle: 360 clockwise: NO];
  [bp fill];

  [systemColor set]; 
  bp = [NSBezierPath bezierPath];
  [bp moveToPoint: point];
  [bp appendBezierPathWithArcWithCenter: point radius: radius startAngle: 90 endAngle: bdeg clockwise: YES];
  [bp fill];

  [userColor set];
  bp = [NSBezierPath bezierPath];
  [bp moveToPoint: point];
  [bp appendBezierPathWithArcWithCenter: point radius: radius startAngle: bdeg endAngle: ddeg clockwise: YES];
  [bp fill];

  [niceColor set];
  bp = [NSBezierPath bezierPath];
  [bp moveToPoint: point];
  [bp appendBezierPathWithArcWithCenter: point radius: radius startAngle: ddeg endAngle: ldeg clockwise: YES];
  [bp fill];

  [ioWaitColor set];
  bp = [NSBezierPath bezierPath];
  [bp moveToPoint: point];
  [bp appendBezierPathWithArcWithCenter: point radius: radius startAngle: ldeg endAngle: mdeg clockwise: YES];
  [bp fill];
}