<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -4,6 +4,7 @@ CPU History:
 		- finish graphing code changes @done
 		- test with @boredzo
 	- floater window position
+	- transparency
 	- divider width
 
 - bugs:
@@ -12,9 +13,10 @@ CPU History:
 			- switch code back to delta by default @done
 		- test with @boredzo's mac pro
 	- let the user pick a divider width
+		- it's drawing too high I think
 	- floater doesn't remember last position
 		- set a pref for window position, draw graph to that location when we make it.
-		- changing prefs snaps graph back to center of screen
+			- changing prefs snaps graph back to center of screen @done
 	- 4. make window snap to screen edges
 		- see: MGSnappingWindow
 	- 5. transparency for graphing window
@@ -22,6 +24,7 @@ CPU History:
 		- transparency of dock icon as well?
 	- 2. cmd-w doesn't close prefs window or about window: escape does
 		- no known way to fix?
+	- allow larger graphing window
 
 - a system to keep release notes synced and build a disk image with what I need?
 </diff>
      <filename>CPUHist.taskpaper</filename>
    </modified>
    <modified>
      <diff>@@ -32,6 +32,8 @@
 				&lt;string&gt;id&lt;/string&gt;
 				&lt;key&gt;dockIconSizeSlider&lt;/key&gt;
 				&lt;string&gt;id&lt;/string&gt;
+				&lt;key&gt;graphSpacerSlider&lt;/key&gt;
+				&lt;string&gt;id&lt;/string&gt;
 				&lt;key&gt;graphWindowOnTop&lt;/key&gt;
 				&lt;string&gt;id&lt;/string&gt;
 				&lt;key&gt;graphWindowOptionsView&lt;/key&gt;</diff>
      <filename>English.lproj/Preferences.nib/classes.nib</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,7 @@
 		&lt;integer&gt;6&lt;/integer&gt;
 	&lt;/array&gt;
 	&lt;key&gt;IBSystem Version&lt;/key&gt;
-	&lt;string&gt;9B18&lt;/string&gt;
+	&lt;string&gt;9C7010&lt;/string&gt;
 	&lt;key&gt;targetFramework&lt;/key&gt;
 	&lt;string&gt;IBCocoaFramework&lt;/string&gt;
 &lt;/dict&gt;</diff>
      <filename>English.lproj/Preferences.nib/info.nib</filename>
    </modified>
    <modified>
      <diff></diff>
      <filename>English.lproj/Preferences.nib/keyedobjects.nib</filename>
    </modified>
    <modified>
      <diff>@@ -34,7 +34,7 @@
 #define GRAPH_SIZE	128
 // define GRAPH_WIDTH	8
 
-#define GRAPH_SPACER 8
+// define GRAPH_SPACER 8
 
 @implementation MainController
 
@@ -57,7 +57,7 @@
 		[window orderWindow:NSWindowBelow relativeTo:[preferences windowNumber]];
 		[window setLevel:([[preferences objectForKey:GRAPH_WINDOW_ON_TOP_KEY] boolValue] ?
 			NSFloatingWindowLevel : NSNormalWindowLevel)];
-		[window center];
+		// [window center];
 	} else
 		[window orderOut:self];
 }
@@ -67,8 +67,7 @@
 // completely redraw graphImage, put graph into displayImage
 {	
 
-
-	#undef NSLOG_DEBUG
+// #undef NSLOG_DEBUG
 
 
 	
@@ -78,10 +77,11 @@
 
 	CPUData			cpudata;
 	unsigned 		cpu, numCPUs = [cpuInfo numCPUs];
-	float			height = ( GRAPH_SIZE - (GRAPH_SPACER * (numCPUs - 1) ) ) / numCPUs; // returns just GRAPH_SIZE on single-core machines.
+	float			graphSpacer = [[preferences objectForKey:GRAPH_SPACER_WIDTH] floatValue];
+	float			height = ( GRAPH_SIZE - (graphSpacer * (numCPUs - 1) ) ) / numCPUs; // returns just GRAPH_SIZE on single-core machines.
 	float			width = GRAPH_SIZE;
 	float			x = 0.0, y = 0.0, ybottom = 0.0;
-	int barWidth = (int)[[preferences objectForKey:BAR_WIDTH_SIZE_KEY] floatValue];
+	float barWidth = (float)[[preferences objectForKey:BAR_WIDTH_SIZE_KEY] floatValue];
 	
 	[graphImage lockFocus];
 	// draw the cpu usage graph
@@ -91,8 +91,9 @@
 		[cpuInfo startBackwardIterate];
 
 		// init the base (bottom) of this cpu's graph space.
-		float yBase = cpu * (height + GRAPH_SPACER);
+		float yBase = cpu * (height + graphSpacer);
 		ybottom = yBase;
+		NSLog(@&quot;\n\n%s ybottom: %.2f&quot;, _cmd, ybottom);
 		
 		#ifdef NSLOG_DEBUG
 		NSLog(@&quot;%s cpu %i: drawing starts at %f px high\n\n&quot;, _cmd, cpu, ybottom);
@@ -101,14 +102,19 @@
 		if (cpu != 0) // we need to draw the transparent spacer
 		{
 			[[NSColor colorWithCalibratedRed:0.0 green:0.0 blue:0.0 alpha:0.0] set];
-			NSRectFill (NSMakeRect(0, ybottom, width, GRAPH_SPACER));
+			#ifdef NSLOG_DEBUG
+			NSLog(@&quot;%s spacer:\t\t(%.2f, %.2f) by (%.2f, %.2f)&quot;, _cmd, 0.0, ybottom, width, graphSpacer);
+			NSLog(@&quot;%s y = %.2f, ybottom = %.2f&quot;, _cmd, y, ybottom);
+			#endif
+			
+			NSRectFill (NSMakeRect(0, ybottom, width, graphSpacer));
 		}
 		
 		// set the idle background
 		[[preferences objectForKey:IDLE_COLOR_KEY] set];
 		NSRectFill(NSMakeRect(0, ybottom, width, height));
 		// loop through the previous CPU data and draw them.
-		for (x = width; x &gt; 0.0 &amp;&amp; [cpuInfo getPrev:&amp;cpudata forCPU:cpu]; x -= (float)barWidth) {
+		for (x = width; x &gt; 0.0 &amp;&amp; [cpuInfo getPrev:&amp;cpudata forCPU:cpu]; x -= barWidth) {
 			#ifdef NSLOG_DEBUG
 			NSLog(@&quot;%s width left to draw: %.2f&quot;, _cmd, x);
 			NSLog(@&quot;CPU %d: User: %.4f, Sys: %.4f, Idle: %.4f&quot;, cpu, cpudata.user, cpudata.sys, cpudata.idle);
@@ -121,27 +127,39 @@
 			NSLog(@&quot;%s system:\t\t(%.2f, %.2f) by (%.2f, %.2f)&quot;, _cmd, x - (float)barWidth, ybottom, (float)barWidth, y);
 			NSLog(@&quot;%s y = %.2f, ybottom = %.2f&quot;, _cmd, y, ybottom);
 			#endif
-			NSRectFill (NSMakeRect(x - (float)barWidth, ybottom, (float)barWidth, y));
+			NSRectFill (NSMakeRect(x - barWidth, ybottom, barWidth, y));
 			ybottom += y;
 			
 			y = cpudata.user * height;
 			[[preferences objectForKey:USER_COLOR_KEY] set];
 			#ifdef NSLOG_DEBUG
-			NSLog(@&quot;%s user:\t\t(%.2f, %.2f) by (%.2f, %.2f)&quot;, _cmd, x - (float)barWidth, ybottom, (float)barWidth, y);
+			NSLog(@&quot;%s user:\t\t(%.2f, %.2f) by (%.2f, %.2f)&quot;, _cmd, x - barWidth, ybottom, barWidth, y);
 			NSLog(@&quot;%s y = %.2f, ybottom = %.2f&quot;, _cmd, y, ybottom);
 			#endif
-			NSRectFill (NSMakeRect(x - (float)barWidth, ybottom, (float)barWidth, y));
+			NSRectFill (NSMakeRect(x - barWidth, ybottom, barWidth, y));
 			ybottom += y;
 			
 			y = cpudata.idle * height;
 			[[preferences objectForKey:IDLE_COLOR_KEY] set];
 			#ifdef NSLOG_DEBUG
-			NSLog(@&quot;%s idle:\t\t(%.2f, %.2f) by (%.2f, %.2f)&quot;, _cmd, x - (float)barWidth, ybottom, (float)barWidth, y);
+			NSLog(@&quot;%s idle:\t\t(%.2f, %.2f) by (%.2f, %.2f)&quot;, _cmd, x - barWidth, ybottom, barWidth, y);
 			NSLog(@&quot;%s y = %.2f, ybottom = %.2f&quot;, _cmd, y, ybottom);
 			#endif
-			NSRectFill (NSMakeRect(x - (float)barWidth, ybottom, (float)barWidth, y));
+			NSRectFill (NSMakeRect(x - barWidth, ybottom, barWidth, y));
 			ybottom += y;
 		}
+		
+		if (cpu != 0) // we need to draw the transparent spacer
+		{
+			[[NSColor colorWithCalibratedRed:0.0 green:0.0 blue:0.0 alpha:0.0] set];
+			#ifdef NSLOG_DEBUG
+			NSLog(@&quot;%s spacer:\t\t(%.2f, %.2f) by (%.2f, %.2f)&quot;, _cmd, 0.0, yBase, width, graphSpacer);
+			NSLog(@&quot;%s y = %.2f, ybottom = %.2f&quot;, _cmd, y, yBase);
+			#endif
+			
+			NSRectFill (NSMakeRect(0, yBase, width, graphSpacer));
+		}
+		
 	}
 	
 	// transfer graph image to icon image
@@ -163,7 +181,8 @@
 
 	CPUData			cpudata, cpudata0;
 	unsigned 		cpu, numCPUs = [cpuInfo numCPUs];
-	float			height = ( GRAPH_SIZE - (GRAPH_SPACER * (numCPUs - 1) ) ) / numCPUs;
+	float			graphSpacer = [[preferences objectForKey:GRAPH_SPACER_WIDTH] floatValue];
+	float			height = ( GRAPH_SIZE - (graphSpacer * (numCPUs - 1) ) ) / numCPUs;
 	float			width = GRAPH_SIZE;
 	float			y = 0.0, ybottom = 0.0;
 	int barWidth = (int)[[preferences objectForKey:BAR_WIDTH_SIZE_KEY] floatValue];
@@ -175,7 +194,7 @@
 	[graphImage compositeToPoint:NSMakePoint(-barWidth, 0) operation:NSCompositeCopy];
 		
 	for (cpu = 0; cpu &lt; numCPUs; cpu++ ) {
-		float yBase = cpu * (height + GRAPH_SPACER);
+		float yBase = cpu * (height + graphSpacer);
 		ybottom = yBase;
 		
 		#ifdef NSLOG_DEBUG
@@ -185,7 +204,7 @@
 		if (cpu != 0)
 		{
 			[[NSColor colorWithCalibratedRed:0.0 green:0.0 blue:0.0 alpha:0.0] set];
-			NSRectFill (NSMakeRect(width - (float)barWidth, ybottom, (float)barWidth, GRAPH_SPACER));
+			NSRectFill (NSMakeRect(width - (float)barWidth, ybottom, (float)barWidth, graphSpacer));
 		}
 		
 		[cpuInfo getLast:&amp;cpudata0 forCPU:cpu];
@@ -250,7 +269,8 @@
 // get a new sample and refresh the graph
 {
 	[cpuInfo refresh];
-	[self drawDelta];
+	// [self drawDelta];
+	[self drawComplete];
 	[self setApplicationIcon];
 	
 	if ([[preferences objectForKey:SHOW_GRAPH_WINDOW_KEY] boolValue]) {</diff>
      <filename>MainController.m</filename>
    </modified>
    <modified>
      <diff>@@ -26,58 +26,25 @@
 
 #import &lt;Cocoa/Cocoa.h&gt;
 
-/*
-	TODO define: delete MemMon #defines
-*/
-// define WIRED_COLOR_KEY		@&quot;WiredColor&quot;
-// define ACTIVE_COLOR_KEY	@&quot;ActiveColor&quot;
-// define INACTIVE_COLOR_KEY	@&quot;InactiveColor&quot;
-// define FREE_COLOR_KEY		@&quot;FreeColor&quot;
-// 
-// define PAGEIN_COLOR_KEY	@&quot;PageinColor&quot;
-// define PAGEOUT_COLOR_KEY	@&quot;PageoutColor&quot;
-// define PAGING_SCALE_MAX_KEY	@&quot;PagingScaleMax&quot;
-// define PAGEIN_ATOP_PAGEOUT_KEY	@&quot;PageinAtopPageout&quot;
-// define SHOW_PAGING_RATE_KEY	@&quot;ShowPagingRate&quot;
+#define USER_COLOR_KEY            @&quot;UserColor&quot;
+#define SYS_COLOR_KEY             @&quot;SysColor&quot;
+#define NICE_COLOR_KEY            @&quot;NiceColor&quot;
+#define IDLE_COLOR_KEY            @&quot;IdleColor&quot;
 
-/*
-	CPU History
-*/
-#define USER_COLOR_KEY		@&quot;UserColor&quot;
-#define SYS_COLOR_KEY		@&quot;SysColor&quot;
-#define NICE_COLOR_KEY		@&quot;NiceColor&quot;
-#define IDLE_COLOR_KEY		@&quot;IdleColor&quot;
+#define UPDATE_FREQUENCY_KEY      @&quot;UpdateFrequency&quot;
+#define SHOW_GRAPH_WINDOW_KEY     @&quot;ShowGraphWindow&quot;
+#define GRAPH_WINDOW_ON_TOP_KEY   @&quot;GraphWindowOnTop&quot;
+#define GRAPH_WINDOW_SIZE_KEY     @&quot;GraphWindowSize&quot;
+#define DOCK_ICON_SIZE_KEY        @&quot;DockIconSize&quot;
+#define BAR_WIDTH_SIZE_KEY        @&quot;BarWidthSize&quot;
 
-#define UPDATE_FREQUENCY_KEY	@&quot;UpdateFrequency&quot;
-#define SHOW_GRAPH_WINDOW_KEY	@&quot;ShowGraphWindow&quot;
-#define GRAPH_WINDOW_ON_TOP_KEY	@&quot;GraphWindowOnTop&quot;
-#define GRAPH_WINDOW_SIZE_KEY	@&quot;GraphWindowSize&quot;
-#define DOCK_ICON_SIZE_KEY	@&quot;DockIconSize&quot;
-#define BAR_WIDTH_SIZE_KEY @&quot;BarWidthSize&quot;
+#define GRAPH_SPACER_WIDTH        @&quot;GraphSpacerWidth&quot;
 
-#define PREFERENCES_CHANGED	@&quot;PrefsChanged&quot;
+#define PREFERENCES_CHANGED       @&quot;PrefsChanged&quot;
 
 
 @interface Preferences : NSObject
 {
-	/*
-		TODO interface: remove MemMon stuff
-	*/
-/*	IBOutlet id		wiredColor;
-	IBOutlet id		activeColor;
-	IBOutlet id		inactiveColor;
-	IBOutlet id		freeColor;
-	
-	IBOutlet id		pageinColor;
-	IBOutlet id		pageoutColor;
-	IBOutlet id		pageinAtopPageout;
-	IBOutlet id		pagingScale;
-	IBOutlet id		showPagingRate;
-*/
-
-
-
-
 	IBOutlet id		userColor;
 	IBOutlet id		sysColor;
 	IBOutlet id		niceColor;
@@ -92,6 +59,8 @@
 	IBOutlet id		graphWindowOptionsView;
 	IBOutlet id		dockIconSizeSlider;
 	IBOutlet id		barWidthSlider;
+	IBOutlet id		graphSpacerSlider;
+	
 	NSMutableDictionary	*currentSettings;
 }
 </diff>
      <filename>Preferences.h</filename>
    </modified>
    <modified>
      <diff>@@ -58,6 +58,7 @@
 		[NSNumber numberWithInt:128], GRAPH_WINDOW_SIZE_KEY,
 		[NSNumber numberWithFloat:1.0], DOCK_ICON_SIZE_KEY,
 		[NSNumber numberWithInt:4], BAR_WIDTH_SIZE_KEY,
+		[NSNumber numberWithFloat:4.0], GRAPH_SPACER_WIDTH,
 		nil]);
 }
 
@@ -82,18 +83,7 @@
 	
 	self = [super init];
         currentSettings = [Preferences defaultPreferences];
-/*	SCANCOLOR (WIRED_COLOR_KEY);
-	SCANCOLOR (ACTIVE_COLOR_KEY);
-	SCANCOLOR (INACTIVE_COLOR_KEY);
-	SCANCOLOR (FREE_COLOR_KEY);
-	SCANCOLOR (PAGEIN_COLOR_KEY);
-	SCANCOLOR (PAGEOUT_COLOR_KEY);
-	GETNUMBER (PAGING_SCALE_MAX_KEY);
-	GETNUMBER (PAGEIN_ATOP_PAGEOUT_KEY);
-	GETNUMBER (SHOW_PAGING_RATE_KEY);
-*/
 	// transparency = 1.0;			/* paging was drawn without transparency in version 1.1 */
-	// GETNUMBER (OLD_TRANSPARENCY_KEY);
 
 	SCANCOLOR (USER_COLOR_KEY);
 	SCANCOLOR (SYS_COLOR_KEY);
@@ -105,6 +95,7 @@
 	GETNUMBER (GRAPH_WINDOW_SIZE_KEY);
 	GETNUMBER (DOCK_ICON_SIZE_KEY);
 	GETNUMBER (BAR_WIDTH_SIZE_KEY);
+	GETNUMBER (GRAPH_SPACER_WIDTH);
 	transparency = obj ? [obj floatValue] : 0.8;	/* global transparency setting of version 1.1 */
 	[[NSColorPanel sharedColorPanel] setShowsAlpha:YES];
 	return (self);
@@ -148,18 +139,6 @@
 		}
 	}
 	
-/*	[wiredColor setColor:[currentSettings objectForKey:WIRED_COLOR_KEY]];
-	[activeColor setColor:[currentSettings objectForKey:ACTIVE_COLOR_KEY]];
-	[inactiveColor setColor:[currentSettings objectForKey:INACTIVE_COLOR_KEY]];
-	[freeColor setColor:[currentSettings objectForKey:FREE_COLOR_KEY]];
-	[pageinColor setColor:[currentSettings objectForKey:PAGEIN_COLOR_KEY]];
-	[pageoutColor setColor:[currentSettings objectForKey:PAGEOUT_COLOR_KEY]];
-	[pagingScale selectItemAtIndex:[pagingScale
-		indexOfItemWithTag:[[currentSettings objectForKey:PAGING_SCALE_MAX_KEY] intValue]]];
-	[pageinAtopPageout selectCellWithTag:[[currentSettings objectForKey:PAGEIN_ATOP_PAGEOUT_KEY] intValue]];
-	[showPagingRate setState:[[currentSettings objectForKey:SHOW_PAGING_RATE_KEY] boolValue]];
-*/
-
 	[userColor setColor:[currentSettings objectForKey:USER_COLOR_KEY]];
 	[sysColor setColor:[currentSettings objectForKey:SYS_COLOR_KEY]];
 	[niceColor setColor:[currentSettings objectForKey:NICE_COLOR_KEY]];
@@ -173,6 +152,7 @@
 	[graphWindowSize setFloatValue:[[currentSettings objectForKey:GRAPH_WINDOW_SIZE_KEY] floatValue]];
 	[dockIconSizeSlider setFloatValue:[[currentSettings objectForKey:DOCK_ICON_SIZE_KEY] floatValue]];
 	[barWidthSlider setFloatValue:[[currentSettings objectForKey:BAR_WIDTH_SIZE_KEY] floatValue]];
+	[graphSpacerSlider setFloatValue:[[currentSettings objectForKey:GRAPH_SPACER_WIDTH] floatValue]];
 	[self adjustGraphWindowControls];
 	[panel makeKeyAndOrderFront:nil];
 }
@@ -218,19 +198,6 @@
 - (IBAction)preferencesChanged:(id)sender
 {
 	int	freq;
-	
-/*	[currentSettings setObject:[wiredColor color] forKey:WIRED_COLOR_KEY];
-	[currentSettings setObject:[activeColor color] forKey:ACTIVE_COLOR_KEY];
-	[currentSettings setObject:[inactiveColor color] forKey:INACTIVE_COLOR_KEY];
-	[currentSettings setObject:[freeColor color] forKey:FREE_COLOR_KEY];
-	[currentSettings setObject:[pageinColor color] forKey:PAGEIN_COLOR_KEY];
-	[currentSettings setObject:[pageoutColor color] forKey:PAGEOUT_COLOR_KEY];
-	[currentSettings setObject:[NSNumber numberWithInt:[[pagingScale selectedItem] tag]] forKey:PAGING_SCALE_MAX_KEY];
-	[currentSettings setObject:[NSNumber numberWithInt:[[pageinAtopPageout selectedCell] tag]] forKey:PAGEIN_ATOP_PAGEOUT_KEY];
-	[currentSettings setObject:[NSNumber numberWithInt:[showPagingRate state]] forKey:SHOW_PAGING_RATE_KEY];
-*/
-
-
 
 	[currentSettings setObject:[userColor color] forKey:USER_COLOR_KEY];
 	[currentSettings setObject:[sysColor color] forKey:SYS_COLOR_KEY];
@@ -245,6 +212,7 @@
 	[currentSettings setObject:[NSNumber numberWithInt:[graphWindowSize intValue]] forKey:GRAPH_WINDOW_SIZE_KEY];
 	[currentSettings setObject:[NSNumber numberWithFloat:[dockIconSizeSlider floatValue]] forKey:DOCK_ICON_SIZE_KEY];
 	[currentSettings setObject:[NSNumber numberWithInt:[barWidthSlider intValue]] forKey:BAR_WIDTH_SIZE_KEY];
+	[currentSettings setObject:[NSNumber numberWithFloat:[graphSpacerSlider floatValue]] forKey:GRAPH_SPACER_WIDTH];
 	[self adjustGraphWindowControls];
 	[[NSNotificationCenter defaultCenter] postNotificationName:PREFERENCES_CHANGED object:nil];
 }</diff>
      <filename>Preferences.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>fa3ecedb39c5dceea48ed408df47c490261d0169</id>
    </parent>
  </parents>
  <author>
    <name>Christopher Bowns</name>
    <email>christopher@cbowns.com</email>
  </author>
  <url>http://github.com/cbowns/cpu-history/commit/efdabcffee94c8781e91736b0f84bdff42d9a7f7</url>
  <id>efdabcffee94c8781e91736b0f84bdff42d9a7f7</id>
  <committed-date>2008-04-20T10:25:17-07:00</committed-date>
  <authored-date>2008-04-20T10:25:17-07:00</authored-date>
  <message>adding dynamic divider to graph. need to fix display of spacer.</message>
  <tree>394bc2ba4899ff365aca9b9c29dff6fcfb14ef6a</tree>
  <committer>
    <name>Christopher Bowns</name>
    <email>christopher@cbowns.com</email>
  </committer>
</commit>
