From: Matthew Judy Date: Thu, 20 Nov 2003 14:37:58 +0000 (+0000) Subject: Lots more stuff merged in. Added an ITImageView/ITImageCell object to allow smooth... X-Git-Tag: v0.1~8 X-Git-Url: http://git.ithinksw.org/ITKit.git/commitdiff_plain/f3f68377429d64947ab0b32f925eb3632bd7e94b Lots more stuff merged in. Added an ITImageView/ITImageCell object to allow smooth scaling, but it doesn't seem to be doing the trick. Nonetheless, MenuTunes is using it, and if we can get it to work, MT will simply pick up that benefit. --- diff --git a/ITImageCell.h b/ITImageCell.h new file mode 100755 index 0000000..c4bb080 --- /dev/null +++ b/ITImageCell.h @@ -0,0 +1,28 @@ +/* + * ITKit + * ITImageCell + * NSImageCell subclass which adds new features. + * + * Original Author : Matt Judy + * Responsibility : Matt Judy + * + * Copyright (c) 2003 iThink Software. + * All Rights Reserved + * + */ + + +#import + + +@interface ITImageCell : NSImageCell { + + BOOL _scalesSmoothly; + +} + +- (BOOL)scalesSmoothly; +- (void)setScalesSmoothly:(BOOL)flag; + + +@end diff --git a/ITImageCell.m b/ITImageCell.m new file mode 100755 index 0000000..cefbcff --- /dev/null +++ b/ITImageCell.m @@ -0,0 +1,46 @@ +#import "ITImageCell.h" + + +@implementation ITImageCell + + +- (id)initImageCell:(NSImage *)image +{ + if ( (self = [super initImageCell:image]) ) { + _scalesSmoothly = YES; + } + NSLog(@"foo"); + return self; +} + + + +- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView +{ + NSImageInterpolation interpolation; + + if ( _scalesSmoothly ) { + interpolation = [[NSGraphicsContext currentContext] imageInterpolation]; + [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh]; + } + + [super drawWithFrame:rect inView:controlView]; + + if ( _scalesSmoothly ) { + [[NSGraphicsContext currentContext] setImageInterpolation:interpolation]; + } +} + +- (BOOL)scalesSmoothly +{ + return _scalesSmoothly; +} + +- (void)setScalesSmoothly:(BOOL)flag +{ + _scalesSmoothly = flag; + [[self controlView] setNeedsDisplay:YES]; +} + + +@end diff --git a/ITImageView.h b/ITImageView.h new file mode 100755 index 0000000..d9141c8 --- /dev/null +++ b/ITImageView.h @@ -0,0 +1,25 @@ +/* + * ITKit + * ITImageView + * NSImageView subclass which adds new features. + * + * Original Author : Matt Judy + * Responsibility : Matt Judy + * + * Copyright (c) 2003 iThink Software. + * All Rights Reserved + * + */ + + +#import + + +@interface ITImageView : NSImageView { + +} + +- (BOOL)scalesSmoothly; +- (void)setScalesSmoothly:(BOOL)flag; + +@end diff --git a/ITImageView.m b/ITImageView.m new file mode 100755 index 0000000..899cae6 --- /dev/null +++ b/ITImageView.m @@ -0,0 +1,40 @@ +#import "ITImageView.h" +#import "ITImageCell.h" + + +@implementation ITImageView + + ++ (void)initialize +{ + if ( self == [ITImageView class] ) { + [self setCellClass:[ITImageCell class]]; + } +} + ++ (Class)cellClass +{ + return [ITImageCell class]; +} + +- (id)initWithFrame:(NSRect)rect +{ + if ( (self = [super initWithFrame:rect]) ) { + [self setScalesSmoothly:YES]; + } + + return self; +} + +- (BOOL)scalesSmoothly +{ + return [[self cell] scalesSmoothly]; +} + +- (void)setScalesSmoothly:(BOOL)flag +{ + [[self cell] setScalesSmoothly:flag]; +} + + +@end diff --git a/ITKit.h b/ITKit.h index 75cbf13..ba348f0 100755 --- a/ITKit.h +++ b/ITKit.h @@ -21,6 +21,7 @@ #import #import #import +#import #import #import #import diff --git a/ITKit.xcode/project.pbxproj b/ITKit.xcode/project.pbxproj index a1a36f3..73e0eec 100755 --- a/ITKit.xcode/project.pbxproj +++ b/ITKit.xcode/project.pbxproj @@ -432,6 +432,68 @@ target = 8DC2EF4F0486A6940098B216; targetProxy = 2AC8297F056C451900A7D7E2; }; + 2AC8313F056D00F700A7D7E2 = { + expectedFileType = sourcecode.c.h; + fileEncoding = 4; + isa = PBXFileReference; + path = ITImageView.h; + refType = 4; + sourceTree = ""; + }; + 2AC83140056D00F700A7D7E2 = { + expectedFileType = sourcecode.c.objc; + fileEncoding = 4; + isa = PBXFileReference; + path = ITImageView.m; + refType = 4; + sourceTree = ""; + }; + 2AC83141056D00F700A7D7E2 = { + fileRef = 2AC8313F056D00F700A7D7E2; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 2AC83142056D00F700A7D7E2 = { + fileRef = 2AC83140056D00F700A7D7E2; + isa = PBXBuildFile; + settings = { + }; + }; + 2AC8319B056D037700A7D7E2 = { + expectedFileType = sourcecode.c.h; + fileEncoding = 4; + isa = PBXFileReference; + path = ITImageCell.h; + refType = 4; + sourceTree = ""; + }; + 2AC8319C056D037700A7D7E2 = { + expectedFileType = sourcecode.c.objc; + fileEncoding = 4; + isa = PBXFileReference; + path = ITImageCell.m; + refType = 4; + sourceTree = ""; + }; + 2AC8319D056D037700A7D7E2 = { + fileRef = 2AC8319B056D037700A7D7E2; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 2AC8319E056D037700A7D7E2 = { + fileRef = 2AC8319C056D037700A7D7E2; + isa = PBXBuildFile; + settings = { + }; + }; //2A0 //2A1 //2A2 @@ -998,6 +1060,9 @@ fileRef = 7C992DD8054F5179000B93EA; isa = PBXBuildFile; settings = { + ATTRIBUTES = ( + Private, + ); }; }; 7C992E0E054F5179000B93EA = { @@ -1446,6 +1511,8 @@ 7C992DCC054F5179000B93EA, 7C992DF5054F5179000B93EA, 7C992DF6054F5179000B93EA, + 2AC8313F056D00F700A7D7E2, + 2AC83140056D00F700A7D7E2, ); isa = PBXGroup; name = Controls; @@ -1458,6 +1525,8 @@ 7C992DCE054F5179000B93EA, 7C992DF7054F5179000B93EA, 7C992DF8054F5179000B93EA, + 2AC8319B056D037700A7D7E2, + 2AC8319C056D037700A7D7E2, ); isa = PBXGroup; name = Cells; @@ -1988,6 +2057,8 @@ 7C992E2E054F5179000B93EA, 7C992E30054F5179000B93EA, 7C992E32054F5179000B93EA, + 2AC83141056D00F700A7D7E2, + 2AC8319D056D037700A7D7E2, ); isa = PBXHeadersBuildPhase; runOnlyForDeploymentPostprocessing = 0; @@ -2044,6 +2115,8 @@ 7C992E2D054F5179000B93EA, 7C992E2F054F5179000B93EA, 7C992E31054F5179000B93EA, + 2AC83142056D00F700A7D7E2, + 2AC8319E056D037700A7D7E2, ); isa = PBXSourcesBuildPhase; runOnlyForDeploymentPostprocessing = 0; diff --git a/ITTextFieldCell.m b/ITTextFieldCell.m index aed1f00..aeb6ca7 100755 --- a/ITTextFieldCell.m +++ b/ITTextFieldCell.m @@ -15,7 +15,7 @@ #pragma mark INITIALIZATION METHODS /*************************************************************************/ -- (id)initTextCell:(NSString *)string; +- (id)initTextCell:(NSString *)string { if ( ( self = [super initTextCell:string] ) ) { castsShadow = NO; diff --git a/Showcase/English.lproj/MainMenu.nib/info.nib b/Showcase/English.lproj/MainMenu.nib/info.nib index 0484bb9..42842c4 100755 --- a/Showcase/English.lproj/MainMenu.nib/info.nib +++ b/Showcase/English.lproj/MainMenu.nib/info.nib @@ -7,7 +7,7 @@ IBEditorPositions 197 - 564 424 153 99 0 0 1056 770 + 564 424 153 118 0 0 1056 770 29 1 271 349 44 0 0 1056 770 @@ -15,7 +15,7 @@ 349.0 IBOpenObjects - 21 + 197 IBSystem Version 7C107 diff --git a/Showcase/English.lproj/MainMenu.nib/keyedobjects.nib b/Showcase/English.lproj/MainMenu.nib/keyedobjects.nib index 05d95b0..240f29a 100755 Binary files a/Showcase/English.lproj/MainMenu.nib/keyedobjects.nib and b/Showcase/English.lproj/MainMenu.nib/keyedobjects.nib differ