Fandom

Scratchpad

20090401180634

216,084pages on
this wiki
Add New Page
Discuss this page0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Only in aclock-0.2.4: AClock.app
Common subdirectories: aclock-0.2.3/AClock.gorm and aclock-0.2.4/AClock.gorm
diff -u aclock-0.2.3/Clock.m aclock-0.2.4/Clock.m
--- aclock-0.2.3/Clock.m	2004-11-19 11:16:15.000000000 +0700
+++ aclock-0.2.4/Clock.m	2009-04-02 01:04:18.000000000 +0700
@@ -344,47 +344,50 @@
 		_cacheFrame = [[NSImage alloc] initWithSize:_bounds.size];
 
 		[_cacheFrame lockFocus];
-
-		/* draw face */
-		[faceColor set];
-		DPSgsave(ctxt);
-		DPSsetalpha(ctxt, faceTrans);
-		DPSmoveto(ctxt,center.x+radius,center.y);
-		DPSarc(ctxt,center.x,center.y,radius,0,360);
-		DPSfill(ctxt);
-		DPSgrestore(ctxt);
-
-		/* draw frame and frame shadow */
-		[frameColor set];
-		DPSsetlinewidth(ctxt, base_width*2);
-		DPSmoveto(ctxt,center.x+radius,center.y);
-		DPSarc(ctxt,center.x,center.y,radius,0,360);
-		DPSclosepath(ctxt);
-		DPSstroke(ctxt);
-
-		if (shadow)
 		{
+			NSGraphicsContext *ctxt=GSCurrentContext();
+
+			/* draw face */
+			[faceColor set];
 			DPSgsave(ctxt);
-			[[NSColor blackColor] set];
-			DPSsetlinewidth(ctxt, base_width*1.5);
-			DPSsetalpha(ctxt,0.4);
+			DPSsetalpha(ctxt, faceTrans);
 			DPSmoveto(ctxt,center.x+radius,center.y);
-			DPSarc(ctxt,center.x + 0.5*base_width,center.y-0.5*base_width,radius,0,360);
-			DPSclosepath(ctxt);
-			DPSstroke(ctxt);
+			DPSarc(ctxt,center.x,center.y,radius,0,360);
+			DPSfill(ctxt);
 			DPSgrestore(ctxt);
 
-			[[NSColor whiteColor] set];
-			DPSgsave(ctxt);
-			DPSsetlinewidth(ctxt, base_width*1.0);
-			DPSsetalpha(ctxt,0.3);
+			/* draw frame and frame shadow */
+			[frameColor set];
+			DPSsetlinewidth(ctxt, base_width*2);
 			DPSmoveto(ctxt,center.x+radius,center.y);
-			DPSarc(ctxt,center.x - 0.5*base_width,center.y + 0.5*base_width,radius,0,360);
+			DPSarc(ctxt,center.x,center.y,radius,0,360);
 			DPSclosepath(ctxt);
 			DPSstroke(ctxt);
-			DPSgrestore(ctxt);
-		}
 
+			if (shadow)
+			{
+				DPSgsave(ctxt);
+				[[NSColor blackColor] set];
+				DPSsetlinewidth(ctxt, base_width*1.5);
+				DPSsetalpha(ctxt,0.4);
+				DPSmoveto(ctxt,center.x+radius,center.y);
+				DPSarc(ctxt,center.x + 0.5*base_width,center.y-0.5*base_width,radius,0,360);
+				DPSclosepath(ctxt);
+				DPSstroke(ctxt);
+				DPSgrestore(ctxt);
+
+				[[NSColor whiteColor] set];
+				DPSgsave(ctxt);
+				DPSsetlinewidth(ctxt, base_width*1.0);
+				DPSsetalpha(ctxt,0.3);
+				DPSmoveto(ctxt,center.x+radius,center.y);
+				DPSarc(ctxt,center.x - 0.5*base_width,center.y + 0.5*base_width,radius,0,360);
+				DPSclosepath(ctxt);
+				DPSstroke(ctxt);
+				DPSgrestore(ctxt);
+			}
+
+		}
 		[_cacheFrame unlockFocus];
 
 	}
@@ -396,100 +399,102 @@
 		/* print numbers and draw mark */
 
 		[_cacheMark lockFocus];
-
-		/* print AM PM */
-		if (showAMPM)
 		{
-			NSMutableAttributedString *str = [[NSMutableAttributedString alloc]
-				initWithString:(handsTime - 86400 * floor(handsTime/86400))/3600 >= 12?@"PM":@"AM"];
-			[str addAttribute:NSForegroundColorAttributeName
-				value:marksColor
-				range:NSMakeRange(0,[str length])];
-			[str addAttribute:NSFontAttributeName
-				value:font
-				range:NSMakeRange(0,[str length])];
-			NSSize strSize = [str size];
-			[str drawAtPoint:NSMakePoint(center.x - strSize.width/2, center.y - radius * 0.8 + strSize.height/2)];
-			RELEASE(str);
-		}
+			NSGraphicsContext *ctxt=GSCurrentContext();
 
+			/* print AM PM */
+			if (showAMPM)
+			{
+				NSMutableAttributedString *str = [[NSMutableAttributedString alloc]
+					initWithString:(handsTime - 86400 * floor(handsTime/86400))/3600 >= 12?@"PM":@"AM"];
+				[str addAttribute:NSForegroundColorAttributeName
+							value:marksColor
+							range:NSMakeRange(0,[str length])];
+				[str addAttribute:NSFontAttributeName
+							value:font
+							range:NSMakeRange(0,[str length])];
+				NSSize strSize = [str size];
+				[str drawAtPoint:NSMakePoint(center.x - strSize.width/2, center.y - radius * 0.8 + strSize.height/2)];
+				RELEASE(str);
+			}
 
-		{
-			int i;
-			double a,x,y;
 
-			[marksColor set];
+			{
+				int i;
+				double a,x,y;
 
-			if (numberType != 0 && radius >= 27)
-				for (i=0;i<60;i++)
-				{
-					if (i%5)
+				[marksColor set];
+
+				if (numberType != 0 && radius >= 27)
+					for (i=0;i<60;i++)
 					{
-						a=i/60.0*2*PI;
-						x=sin(a);
-						y=cos(a);
-						DPSarc(ctxt,center.x+x*radius*0.90,center.y+y*radius*0.90,0.5*base_width,0,360);
-						DPSfill(ctxt);
+						if (i%5)
+						{
+							a=i/60.0*2*PI;
+							x=sin(a);
+							y=cos(a);
+							DPSarc(ctxt,center.x+x*radius*0.90,center.y+y*radius*0.90,0.5*base_width,0,360);
+							DPSfill(ctxt);
+						}
 					}
-				}
 
-			for (i=0;i<12;i++)
-			{
-				a=i/12.0*2*PI;
-				x=sin(a);
-				y=cos(a);
-
-				if (numberType != 0)
+				for (i=0;i<12;i++)
 				{
-					DPSmoveto(ctxt,center.x+x*radius*0.95,center.y+y*radius*0.95);
-					DPSlineto(ctxt,center.x+x*radius*0.83,center.y+y*radius*0.83);
-					DPSstroke(ctxt);
-				}
+					a=i/12.0*2*PI;
+					x=sin(a);
+					y=cos(a);
 
-				if (numberType == 1)
-				{
-					NSMutableAttributedString *str = [[NSMutableAttributedString alloc]
-						initWithString:[numArray[1] objectAtIndex:i]];
-					[str addAttribute:NSForegroundColorAttributeName
-						value:marksColor
-						range:NSMakeRange(0,[str length])];
-					[str addAttribute:NSFontAttributeName
-						value:font
-						range:NSMakeRange(0,[str length])];
-					NSSize size = [str size];
-					[str drawAtPoint:NSMakePoint(center.x+x*radius*0.7 - size.width/2, center.y+y*radius*0.7 - size.height/2)];
-					RELEASE(str);
-
-					if (dayColor && i == (int)[_date monthOfYear])
+					if (numberType != 0)
 					{
-						DPSgsave(ctxt);
-						DPSsetalpha(ctxt,0.7);
-						DPSarc(ctxt,center.x+x*radius*0.7,center.y+y*radius*0.7,3*base_width,0,360);
+						DPSmoveto(ctxt,center.x+x*radius*0.95,center.y+y*radius*0.95);
+						DPSlineto(ctxt,center.x+x*radius*0.83,center.y+y*radius*0.83);
 						DPSstroke(ctxt);
-						DPSgrestore(ctxt);
 					}
 
-				}
-				else if (numberType == 0)
-				{
-					NSMutableAttributedString *str = [[NSMutableAttributedString alloc]
-						initWithString:[numArray[0] objectAtIndex:i]];
-					[str addAttribute:NSForegroundColorAttributeName
-						value:marksColor
-						range:NSMakeRange(0,[str length])];
-					[str addAttribute:NSFontAttributeName
-						value:font
-						range:NSMakeRange(0,[str length])];
-					NSSize size = [str size];
-					[str drawAtPoint:NSMakePoint(center.x+x*radius*0.80 - size.width/2.5, center.y+y*radius*0.80 - size.height/2)];
-					RELEASE(str);
-				}
+					if (numberType == 1)
+					{
+						NSMutableAttributedString *str = [[NSMutableAttributedString alloc]
+							initWithString:[numArray[1] objectAtIndex:i]];
+						[str addAttribute:NSForegroundColorAttributeName
+									value:marksColor
+									range:NSMakeRange(0,[str length])];
+						[str addAttribute:NSFontAttributeName
+									value:font
+									range:NSMakeRange(0,[str length])];
+						NSSize size = [str size];
+						[str drawAtPoint:NSMakePoint(center.x+x*radius*0.7 - size.width/2, center.y+y*radius*0.7 - size.height/2)];
+						RELEASE(str);
+
+						if (dayColor && i == (int)[_date monthOfYear])
+						{
+							DPSgsave(ctxt);
+							DPSsetalpha(ctxt,0.7);
+							DPSarc(ctxt,center.x+x*radius*0.7,center.y+y*radius*0.7,3*base_width,0,360);
+							DPSstroke(ctxt);
+							DPSgrestore(ctxt);
+						}
+
+					}
+					else if (numberType == 0)
+					{
+						NSMutableAttributedString *str = [[NSMutableAttributedString alloc]
+							initWithString:[numArray[0] objectAtIndex:i]];
+						[str addAttribute:NSForegroundColorAttributeName
+									value:marksColor
+									range:NSMakeRange(0,[str length])];
+						[str addAttribute:NSFontAttributeName
+									value:font
+									range:NSMakeRange(0,[str length])];
+						NSSize size = [str size];
+						[str drawAtPoint:NSMakePoint(center.x+x*radius*0.80 - size.width/2.5, center.y+y*radius*0.80 - size.height/2)];
+						RELEASE(str);
+					}
 
+				}
 			}
-		}
 
+		}
 		[_cacheMark unlockFocus];
-		NSLog(@"create cache");
 	}
 
 	[_cacheFrame compositeToPoint:NSZeroPoint
Only in aclock-0.2.4: obj

Also on Fandom

Random wikia