Changeset 2909
- Timestamp:
- 05/26/05 16:35:20 (4 years ago)
- Files:
-
- Footagehead/trunk/English.lproj/MainMenu.nib/classes.nib (modified) (2 diffs)
- Footagehead/trunk/English.lproj/MainMenu.nib/info.nib (modified) (2 diffs)
- 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) (3 diffs)
- Footagehead/trunk/FHImageView.h (modified) (2 diffs)
- Footagehead/trunk/FHImageView.m (modified) (10 diffs)
- Footagehead/trunk/Footagehead.xcode/project.pbxproj (modified) (3 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)
- Footagehead/trunk/Zoom.tiff (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Footagehead/trunk/English.lproj/MainMenu.nib/classes.nib
r2897 r2909 19 19 slideshow = id; 20 20 slideshowButtons = id; 21 zoom = id; 21 22 }; 22 23 CLASS = FHController; … … 62 63 CLASS = ZAApplication; 63 64 LANGUAGE = ObjC; 65 OUTLETS = {"_releaseNotesTextView" = NSTextView; "_releaseNotesWindow" = NSWindow; }; 64 66 SUPERCLASS = NSApplication; 65 67 }, Footagehead/trunk/English.lproj/MainMenu.nib/info.nib
r2906 r2909 4 4 <dict> 5 5 <key>IBDocumentLocation</key> 6 <string> 299 513395 374 0 0 1680 1028 </string>6 <string>909 492 395 374 0 0 1680 1028 </string> 7 7 <key>IBEditorPositions</key> 8 8 <dict> … … 14 14 <key>IBOldestOS</key> 15 15 <integer>3</integer> 16 <key>IBOpenObjects</key> 17 <array> 18 <integer>288</integer> 19 <integer>21</integer> 20 </array> 16 21 <key>IBSystem Version</key> 17 22 <string>8B15</string> Footagehead/trunk/FHController.h
r2887 r2909 91 91 - (IBAction)nextPage:(id)sender; 92 92 - (IBAction)reload:(id)sender; 93 - (IBAction)zoom:(id)sender; 93 94 - (IBAction)slideshow:(id)sender; 94 95 - (IBAction)slideshowButtons:(id)sender; Footagehead/trunk/FHController.m
r2907 r2909 122 122 123 123 [_fullscreenImageView setBackgroundColor:[NSColor blackColor]]; 124 [_fullscreenImageView setDrawsBorder:NO];125 124 126 125 // --- create locks … … 588 587 - (IBAction)reload:(id)sender { 589 588 [self loadURL:[_handler URL] withHint:[_handler hint] selectRow:[_tableView selectedRow]]; 589 } 590 591 592 593 - (IBAction)zoom:(id)sender { 594 [_imageView toggleScaling]; 595 596 [self updateRightStatus]; 590 597 } 591 598 … … 1161 1168 - (void)updateRightStatus { 1162 1169 NSSize imageSize, frameSize; 1163 double zoom = 100 ;1170 double zoom = 100.0; 1164 1171 1165 1172 if(![_imageView image]) { Footagehead/trunk/FHImageView.h
r2883 r2909 1 /* $Id$ */ 2 3 /* 4 * Copyright (c) 2003-2005 Axel Andersson 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 25 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * POSSIBILITY OF SUCH DAMAGE. 27 */ 28 1 29 @interface FHImageView : NSView { 2 30 NSImage *_image; 3 31 NSImageScaling _imageScaling; 4 32 5 BOOL _drawsBorder;6 7 33 NSColor *_backgroundColor; 8 34 … … 20 46 - (void)setLabel:(NSString *)label; 21 47 - (NSString *)label; 22 - (void)setDrawsBorder:(BOOL)value; 23 - ( BOOL)drawsBorder;48 49 - (void)toggleScaling; 24 50 25 51 @end Footagehead/trunk/FHImageView.m
r2883 r2909 1 /* $Id$ */ 2 3 /* 4 * Copyright (c) 2003-2005 Axel Andersson 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 25 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #import "FHController.h" 1 30 #import "FHImageView.h" 2 31 … … 4 33 5 34 - (void)_initImageView; 35 36 - (void)_adjustScaling; 6 37 7 38 @end … … 33 64 - (void)_initImageView { 34 65 _imageScaling = NSScaleProportionally; 35 _drawsBorder = YES;36 66 _backgroundColor = [[NSColor whiteColor] retain]; 37 67 … … 67 97 68 98 _image = image; 99 100 [self _adjustScaling]; 69 101 70 102 if(display) … … 83 115 _imageScaling = imageScaling; 84 116 117 [self _adjustScaling]; 85 118 [self setNeedsDisplay:YES]; 86 119 } … … 137 170 138 171 139 - (void)setDrawsBorder:(BOOL)value { 140 _drawsBorder = value; 141 142 [self setNeedsDisplay:YES]; 143 } 144 145 146 147 - (BOOL)drawsBorder { 148 return _drawsBorder; 172 #pragma mark - 173 174 - (void)toggleScaling { 175 if(_imageScaling == NSScaleNone) 176 _imageScaling = NSScaleProportionally; 177 else 178 _imageScaling = NSScaleNone; 179 180 [self _adjustScaling]; 181 [self display]; 182 } 183 184 185 186 - (void)_adjustScaling { 187 NSScrollView *scrollView; 188 NSSize size, imageSize; 189 190 scrollView = [self enclosingScrollView]; 191 192 if(scrollView) { 193 size = [scrollView contentSize]; 194 195 if(_imageScaling == NSScaleNone) { 196 imageSize = _image ? [_image size] : NSZeroSize; 197 198 [self setFrameSize:NSMakeSize(MAX(size.width, imageSize.width), MAX(size.height, imageSize.height))]; 199 [self scrollPoint:NSMakePoint(0.0, imageSize.height)]; 200 } else { 201 [self setFrameSize:size]; 202 } 203 } 204 } 205 206 207 208 - (void)mouseDown:(NSEvent *)event { 209 [[FHController controller] zoom:self]; 149 210 } 150 211 … … 162 223 NSImage *image; 163 224 NSImageRep *imageRep; 164 NSRect rect;225 NSRect bounds, rect; 165 226 float dx, dy, d; 166 227 167 if(_drawsBorder) { 168 [[NSColor lightGrayColor] set]; 169 NSFrameRect(frame); 170 frame = NSInsetRect(frame, 1.0, 1.0); 171 } 172 228 bounds = [self bounds]; 229 173 230 [_backgroundColor set]; 174 NSRectFill( frame);231 NSRectFill(bounds); 175 232 176 233 imageRep = [_image bestRepresentationForDevice:NULL]; … … 181 238 switch (_imageScaling) { 182 239 case NSScaleProportionally: 183 dx = frame.size.width / rect.size.width;184 dy = frame.size.height / rect.size.height;240 dx = bounds.size.width / rect.size.width; 241 dy = bounds.size.height / rect.size.height; 185 242 d = dx < dy ? dx : dy; 186 243 … … 192 249 193 250 case NSScaleToFit: 194 rect.size = frame.size;251 rect.size = bounds.size; 195 252 break; 196 253 … … 199 256 } 200 257 201 rect.origin.x = floorf(( (frame.size.width - rect.size.width) / 2.0) + 1.0);202 rect.origin.y = floorf(( (frame.size.height - rect.size.height) / 2.0) + 1.0);258 rect.origin.x = floorf((bounds.size.width - rect.size.width) / 2.0); 259 rect.origin.y = floorf((bounds.size.height - rect.size.height) / 2.0); 203 260 204 261 if([imageRep hasAlpha]) { Footagehead/trunk/Footagehead.xcode/project.pbxproj
r2893 r2909 185 185 A587DF70055AA3C4005D2097, 186 186 A5DE34850567F307003E7FE9, 187 77EA9C1508460B9C006C9F69, 187 188 ); 188 189 isa = PBXGroup; … … 1412 1413 remoteInfo = "Zanka Additions"; 1413 1414 }; 1415 77EA9C1508460B9C006C9F69 = { 1416 isa = PBXFileReference; 1417 lastKnownFileType = image.tiff; 1418 path = Zoom.tiff; 1419 refType = 4; 1420 sourceTree = "<group>"; 1421 }; 1422 77EA9C1608460B9C006C9F69 = { 1423 fileRef = 77EA9C1508460B9C006C9F69; 1424 isa = PBXBuildFile; 1425 settings = { 1426 }; 1427 }; 1414 1428 //770 1415 1429 //771 … … 1482 1496 A5DE34860567F307003E7FE9, 1483 1497 A50933FB083F5141006646D1, 1498 77EA9C1608460B9C006C9F69, 1484 1499 ); 1485 1500 isa = PBXResourcesBuildPhase; Footagehead/trunk/Japanese.lproj/MainMenu.nib/classes.nib
r2906 r2909 19 19 slideshow = id; 20 20 slideshowButtons = id; 21 zoom = id; 21 22 }; 22 23 CLASS = FHController; Footagehead/trunk/Japanese.lproj/MainMenu.nib/info.nib
r2906 r2909 4 4 <dict> 5 5 <key>IBDocumentLocation</key> 6 <string> 709 112395 374 0 0 1680 1028 </string>6 <string>90 508 395 374 0 0 1680 1028 </string> 7 7 <key>IBEditorPositions</key> 8 8 <dict> … … 14 14 <key>IBOpenObjects</key> 15 15 <array> 16 <integer>2 9</integer>16 <integer>21</integer> 17 17 </array> 18 18 <key>IBSystem Version</key>
