1.1 --- a/Source/Card.m Fri Mar 07 11:43:02 2008 -0800
1.2 +++ b/Source/Card.m Mon Mar 10 17:32:04 2008 -0700
1.3 @@ -21,6 +21,7 @@
1.4 THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1.5 */
1.6 #import "Card.h"
1.7 +#import "GGBTextLayer.h"
1.8 #import "QuartzUtils.h"
1.9
1.10
1.11 @@ -68,19 +69,11 @@
1.12 }
1.13
1.14
1.15 -- (void)encodeWithCoder:(NSCoder *)aCoder
1.16 +- (id) copyWithZone: (NSZone*)zone
1.17 {
1.18 - [super encodeWithCoder: aCoder];
1.19 - [aCoder encodeInt: _serialNumber forKey: @"serialNumber"];
1.20 -}
1.21 -
1.22 -- (id)initWithCoder:(NSCoder *)aDecoder
1.23 -{
1.24 - self = [super initWithCoder: aDecoder];
1.25 - if( self ) {
1.26 - _serialNumber = [aDecoder decodeIntForKey: @"serialNumber"];
1.27 - }
1.28 - return self;
1.29 + Card *clone = [super copyWithZone: zone];
1.30 + clone->_serialNumber = _serialNumber;
1.31 + return clone;
1.32 }
1.33
1.34
1.35 @@ -115,25 +108,25 @@
1.36 }
1.37
1.38
1.39 -- (CALayer*) createFront
1.40 +- (GGBLayer*) createFront
1.41 {
1.42 - CALayer *front = [[CALayer alloc] init];
1.43 + GGBLayer *front = [[GGBLayer alloc] init];
1.44 front.bounds = CGRectMake(0,0,kCardWidth,kCardHeight);
1.45 front.position = CGPointMake(kCardWidth/2,kCardHeight/2);
1.46 front.edgeAntialiasingMask = 0;
1.47 front.backgroundColor = kWhiteColor;
1.48 front.cornerRadius = 8;
1.49 front.borderWidth = 1;
1.50 - front.borderColor = CGColorCreateGenericGray(0.7, 1.0);
1.51 + front.borderColor = CreateGray(0.7, 1.0);
1.52 front.doubleSided = NO; // this makes the layer invisible when it's flipped
1.53 return [front autorelease];
1.54 }
1.55
1.56
1.57 -- (CALayer*) createBack
1.58 +- (GGBLayer*) createBack
1.59 {
1.60 CGSize size = self.bounds.size;
1.61 - CALayer *back = [[CALayer alloc] init];
1.62 + GGBLayer *back = [[GGBLayer alloc] init];
1.63 back.bounds = CGRectMake(0,0,size.width,size.height);
1.64 back.position = CGPointMake(kCardWidth/2,kCardHeight/2);
1.65 back.contents = (id) GetCGImageNamed(@"/Library/Desktop Pictures/Classic Aqua Blue.jpg");
1.66 @@ -145,10 +138,11 @@
1.67 back.edgeAntialiasingMask = 0;
1.68 back.doubleSided = NO; // this makes the layer invisible when it's flipped
1.69
1.70 - CATextLayer *label = AddTextLayer(back, @"\u2603", // Unicode snowman character
1.71 - [NSFont systemFontOfSize: 0.9*size.width],
1.72 - kCALayerWidthSizable|kCALayerHeightSizable);
1.73 - label.foregroundColor = CGColorCreateGenericGray(1.0,0.5);
1.74 + GGBTextLayer *label = [GGBTextLayer textLayerInSuperlayer: back
1.75 + withText: @"\u2603" // Unicode snowman character
1.76 + fontSize: 0.9*size.width
1.77 + alignment: kCALayerWidthSizable|kCALayerHeightSizable];
1.78 + label.foregroundColor = CreateGray(1.0,0.5);
1.79 return [back autorelease];
1.80 }
1.81
1.82 @@ -157,6 +151,8 @@
1.83 #pragma mark DRAG-AND-DROP:
1.84
1.85
1.86 +#if ! TARGET_OS_ASPEN
1.87 +
1.88 // An image from another app can be dragged onto a Card to change its background. */
1.89
1.90
1.91 @@ -173,7 +169,7 @@
1.92 {
1.93 CGImageRef image = GetCGImageFromPasteboard([sender draggingPasteboard]);
1.94 if( image ) {
1.95 - CALayer *face = _faceUp ?_front :_back;
1.96 + GGBLayer *face = _faceUp ?_front :_back;
1.97 face.contents = (id) image;
1.98 face.contentsGravity = kCAGravityResizeAspectFill;
1.99 face.masksToBounds = YES;
1.100 @@ -182,5 +178,6 @@
1.101 return NO;
1.102 }
1.103
1.104 +#endif
1.105
1.106 @end