Changeset 3879
- Timestamp:
- 03/05/06 19:27:34 (3 years ago)
- Files:
-
- Footagehead/trunk/English.lproj/MainMenu.nib/classes.nib (modified) (2 diffs)
- Footagehead/trunk/English.lproj/MainMenu.nib/info.nib (modified) (1 diff)
- Footagehead/trunk/English.lproj/MainMenu.nib/keyedobjects.nib (modified) (previous)
- Footagehead/trunk/English.lproj/MainMenu.nib/objects.nib (modified) (previous)
- Footagehead/trunk/FHController.h (modified) (1 diff)
- Footagehead/trunk/FHController.m (modified) (2 diffs)
- Footagehead/trunk/FHFileCell.m (modified) (1 diff)
- Footagehead/trunk/FHImage.h (modified) (1 diff)
- Footagehead/trunk/FHImage.m (modified) (2 diffs)
- Footagehead/trunk/FHImageView.h (modified) (2 diffs)
- Footagehead/trunk/FHImageView.m (modified) (2 diffs)
- Footagehead/trunk/FHSettings.h (modified) (1 diff)
- Footagehead/trunk/FHSettings.m (modified) (1 diff)
- Footagehead/trunk/Footagehead.xcodeproj/project.pbxproj (modified) (4 diffs)
- Footagehead/trunk/Japanese.lproj/MainMenu.nib/classes.nib (modified) (1 diff)
- Footagehead/trunk/Japanese.lproj/MainMenu.nib/info.nib (modified) (2 diffs)
- Footagehead/trunk/Japanese.lproj/MainMenu.nib/keyedobjects.nib (modified) (previous)
- Footagehead/trunk/Japanese.lproj/MainMenu.nib/objects.nib (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Footagehead/trunk/English.lproj/MainMenu.nib/classes.nib
r3876 r3879 19 19 reload = id; 20 20 revealInFinder = id; 21 rotateRight = id; 21 22 setAsDesktopPicture = id; 22 23 slideshow = id; … … 44 45 "_rightStatusTextField" = NSTextField; 45 46 "_rightView" = NSView; 47 "_rotateRightButton" = NSButton; 46 48 "_screenAutoSwitchButton" = NSButton; 47 49 "_screenAutoSwitchTextField" = NSTextField; Footagehead/trunk/English.lproj/MainMenu.nib/info.nib
r3876 r3879 18 18 <key>IBOpenObjects</key> 19 19 <array> 20 <integer>21</integer> 20 21 <integer>438</integer> 21 <integer>21</integer>22 22 </array> 23 23 <key>IBSystem Version</key> Footagehead/trunk/FHController.h
r3876 r3879 102 102 - (IBAction)reload:(id)sender; 103 103 - (IBAction)zoom:(id)sender; 104 - (IBAction)rotateRight:(id)sender; 104 105 - (IBAction)slideshow:(id)sender; 105 106 - (IBAction)slideshowButtons:(id)sender; Footagehead/trunk/FHController.m
r3876 r3879 815 815 816 816 [_imageView setImageScaling:[FHSettings intForKey:FHImageScaling]]; 817 [_imageView setImageRotation:[FHSettings floatForKey:FHImageRotation]]; 817 818 818 819 // --- create locks … … 1396 1397 1397 1398 1399 - (IBAction)rotateRight:(id)sender { 1400 float rotation; 1401 1402 rotation = [_imageView imageRotation]; 1403 1404 if(rotation == -270.0f) 1405 rotation = 0.0f; 1406 else 1407 rotation -= 90.0f; 1408 1409 [_imageView setImageRotation:rotation]; 1410 1411 [FHSettings setFloat:rotation forKey:FHImageRotation]; 1412 } 1413 1414 1415 1398 1416 - (IBAction)slideshow:(id)sender { 1399 1417 [NSApp beginSheet:_screenPanel Footagehead/trunk/FHFileCell.m
r2948 r3879 113 113 114 114 [icon setFlipped:YES]; 115 [icon drawInRect:imageRect ];115 [icon drawInRect:imageRect atAngle:0.0]; 116 116 } 117 117 Footagehead/trunk/FHImage.h
r3400 r3879 50 50 - (NSSize)size; 51 51 52 - (void)drawInRect:(NSRect)rect ;52 - (void)drawInRect:(NSRect)rect atAngle:(float)angle; 53 53 54 54 @end Footagehead/trunk/FHImage.m
r3400 r3879 234 234 #pragma mark - 235 235 236 - (void)drawInRect:(NSRect)rect { 237 if(_CGImage) { 238 CGContextRef cgContext; 239 CGRect cgRect; 240 241 cgContext = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]; 242 cgRect = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); 243 236 237 static inline double radians (double degrees) {return degrees * M_PI/180;} 238 239 - (void)drawInRect:(NSRect)rect atAngle:(float)angle { 240 NSImageRep *imageRep; 241 CGContextRef cgContext; 242 CGRect cgRect; 243 BOOL restore = NO; 244 245 cgContext = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]; 246 cgRect = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); 247 248 if(_flipped || angle != 0.0f) { 249 CGContextSaveGState(cgContext); 250 244 251 if(_flipped) { 245 CGContextSaveGState(cgContext);246 252 CGContextTranslateCTM(cgContext, 0.0f, rect.origin.y + rect.origin.y + rect.size.height); 247 253 CGContextScaleCTM(cgContext, 1.0f, -1.0f); 248 } 249 254 } else { 255 float x = rect.origin.x + (rect.size.width / 2.0f); 256 float y = rect.origin.y + (rect.size.height / 2.0f); 257 CGContextTranslateCTM(cgContext, x, y); 258 CGContextRotateCTM(cgContext, radians(angle)); 259 CGContextTranslateCTM(cgContext, -x, -y); 260 } 261 262 restore = YES; 263 } 264 265 if(_CGImage) { 250 266 CGContextDrawImage(cgContext, cgRect, _CGImage); 251 252 if(_flipped) 253 CGContextRestoreGState(cgContext); 254 } 255 else if(_NSImage) { 256 NSImageRep *imageRep; 257 267 } else { 258 268 imageRep = [_NSImage bestRepresentationForDevice:NULL]; 259 269 260 270 if(imageRep) { 261 [_NSImage setFlipped:_flipped];262 263 271 if([imageRep hasAlpha] || _flipped) 264 272 [_NSImage drawInRect:rect fromRect:NSMakeRect(0.0, 0.0, _size.width, _size.height) operation:NSCompositeSourceOver fraction:1.0]; … … 267 275 } 268 276 } 277 278 if(restore) 279 CGContextRestoreGState(cgContext); 269 280 } 270 281 Footagehead/trunk/FHImageView.h
r3023 r3879 34 34 FHImage *_image; 35 35 NSImageScaling _imageScaling; 36 float _imageRotation; 36 37 37 38 NSColor *_backgroundColor; … … 48 49 - (void)setImageScaling:(NSImageScaling)newScaling; 49 50 - (NSImageScaling)imageScaling; 51 - (void)setImageRotation:(float)rotation; 52 - (float)imageRotation; 50 53 - (void)setBackgroundColor:(NSColor *)color; 51 54 - (NSColor *)backgroundColor; Footagehead/trunk/FHImageView.m
r3388 r3879 181 181 182 182 183 - (void)setImageRotation:(float)imageRotation { 184 _imageRotation = imageRotation; 185 186 [self setNeedsDisplay:YES]; 187 } 188 189 190 191 - (float)imageRotation { 192 return _imageRotation; 193 } 194 195 196 183 197 - (void)setBackgroundColor:(NSColor *)color { 184 198 NSColor *textColor; … … 311 325 rect.origin.y = floorf((bounds.size.height - rect.size.height) / 2.0); 312 326 313 [_image drawInRect:rect ];327 [_image drawInRect:rect atAngle:_imageRotation]; 314 328 315 329 if(_label && [_label length] > 0) Footagehead/trunk/FHSettings.h
r3876 r3879 32 32 #define FHScreen @"FHScreen" 33 33 #define FHImageScaling @"FHImageScaling" 34 #define FHImageRotation @"FHImageRotation" 34 35 #define FHBackground @"FHBackground" 35 36 #define FHBackgroundBlack 0 Footagehead/trunk/FHSettings.m
r3876 r3879 40 40 [NSNumber numberWithInt:NSScaleProportionally], 41 41 FHImageScaling, 42 [NSNumber numberWithFloat:0.0f], 43 FHImageRotation, 42 44 [NSNumber numberWithInt:FHBackgroundBlack], 43 45 FHBackground, Footagehead/trunk/Footagehead.xcodeproj/project.pbxproj
r3877 r3879 144 144 A58BE56A09BA054F00C3C20D /* White.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A58BE56709BA054F00C3C20D /* White.tiff */; }; 145 145 A58BE56B09BA054F00C3C20D /* Gray.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A58BE56809BA054F00C3C20D /* Gray.tiff */; }; 146 A58BE75009BB53C400C3C20D /* RotateRight.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A58BE74F09BB53C400C3C20D /* RotateRight.tiff */; }; 146 147 A599A110075F94F400A03BA5 /* FHFileCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A599A10E075F94F400A03BA5 /* FHFileCell.m */; }; 147 148 A5B1F611067B3AA100111D0A /* FHHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = A5B1F60F067B3AA100111D0A /* FHHandler.m */; }; … … 426 427 A58BE56709BA054F00C3C20D /* White.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = White.tiff; sourceTree = "<group>"; }; 427 428 A58BE56809BA054F00C3C20D /* Gray.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Gray.tiff; sourceTree = "<group>"; }; 429 A58BE74F09BB53C400C3C20D /* RotateRight.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = RotateRight.tiff; sourceTree = "<group>"; }; 428 430 A591E22C056686CB00215980 /* prefix.pch */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = prefix.pch; sourceTree = "<group>"; }; 429 431 A599A10D075F94F400A03BA5 /* FHFileCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FHFileCell.h; sourceTree = "<group>"; }; … … 673 675 A58BE56809BA054F00C3C20D /* Gray.tiff */, 674 676 A583338D069E30D100D6A96D /* Reload.tiff */, 677 A58BE74F09BB53C400C3C20D /* RotateRight.tiff */, 675 678 A50933FA083F5141006646D1 /* Spotlight.tiff */, 676 679 A587DF70055AA3C4005D2097 /* Up.tiff */, … … 1188 1191 A58BE56A09BA054F00C3C20D /* White.tiff in Resources */, 1189 1192 A58BE56B09BA054F00C3C20D /* Gray.tiff in Resources */, 1193 A58BE75009BB53C400C3C20D /* RotateRight.tiff in Resources */, 1190 1194 ); 1191 1195 runOnlyForDeploymentPostprocessing = 0; Footagehead/trunk/Japanese.lproj/MainMenu.nib/classes.nib
r3876 r3879 19 19 reload = id; 20 20 revealInFinder = id; 21 rotateRight = id; 21 22 setAsDesktopPicture = id; 22 23 slideshow = id; Footagehead/trunk/Japanese.lproj/MainMenu.nib/info.nib
r3876 r3879 4 4 <dict> 5 5 <key>IBDocumentLocation</key> 6 <string>1 464 275 395 374 1280 0 1280 1024 </string>6 <string>1368 185 395 374 1280 0 1280 1024 </string> 7 7 <key>IBEditorPositions</key> 8 8 <dict> … … 17 17 <array> 18 18 <integer>534</integer> 19 <integer>571</integer>20 19 <integer>29</integer> 21 20 <integer>438</integer> 22 21 <integer>21</integer> 22 <integer>571</integer> 23 23 </array> 24 24 <key>IBSystem Version</key>
