Changeset 4732
- Timestamp:
- 04/27/07 23:37:50 (1 year ago)
- Files:
-
- Footagehead/trunk/English.lproj/Localizable.strings (modified) (3 diffs)
- Footagehead/trunk/FHBrowserController.m (modified) (16 diffs)
- Footagehead/trunk/FHImageLoader.m (modified) (1 diff)
- Footagehead/trunk/FHImageView.m (modified) (2 diffs)
- Footagehead/trunk/FHSlideshowController.m (modified) (6 diffs)
- Footagehead/trunk/FHSpread.m (modified) (1 diff)
- Footagehead/trunk/FHTableView.m (modified) (6 diffs)
- Footagehead/trunk/FHWindowController.h (modified) (2 diffs)
- Footagehead/trunk/FHWindowController.m (modified) (11 diffs)
- Footagehead/trunk/Footagehead.xcodeproj/project.pbxproj (modified) (2 diffs)
- Footagehead/trunk/Japanese.lproj/Localizable.strings (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Footagehead/trunk/English.lproj/Localizable.strings
r4721 r4732 1 1 /* 'image.jpg - 1/10' */ 2 2 "%@ %C %u/%u" = "%1$@ %2$C %3$u/%4$u"; 3 4 /* 'image1.jpg' & 'image2.jpg' */ 5 "%@ & %@" = "%1$@ & %2$@"; 3 6 4 7 /* 'image.jpg, 640x480' */ … … 19 22 /* Actual size toolbar item */ 20 23 "Actual Size" = "Actual Size"; 24 25 /* Color black */ 26 "Black" = "Black"; 27 28 /* Error message */ 29 "error opening image" = "error opening image"; 30 31 /* Color gray */ 32 "Gray" = "Gray"; 21 33 22 34 /* Menu item title */ … … 65 77 "Stretch To Fit" = "Stretch To Fit"; 66 78 79 /* Color white */ 80 "White" = "White"; 81 67 82 /* Zoom to fit toolbar item */ 68 83 "Zoom To Fit" = "Zoom To Fit"; 84 Footagehead/trunk/FHBrowserController.m
r4731 r4732 48 48 - (void)_loadURL:(WIURL *)url; 49 49 - (void)_loadURL:(WIURL *)url selectRow:(NSInteger)row; 50 - (void)_loadURL:(WIURL *)url select File:(NSString *)file;51 - (void)_loadURL:(WIURL *)url selectRow:(NSInteger)row file:(NSString *)file;50 - (void)_loadURL:(WIURL *)url selectName:(NSString *)name; 51 - (void)_loadURL:(WIURL *)url selectRow:(NSInteger)row name:(NSString *)name; 52 52 53 53 - (void)_reload; … … 235 235 236 236 - (void)_loadURL:(WIURL *)url { 237 [self _loadURL:url selectRow:0 file:NULL];237 [self _loadURL:url selectRow:0 name:NULL]; 238 238 } 239 239 … … 241 241 242 242 - (void)_loadURL:(WIURL *)url selectRow:(NSInteger)row { 243 [self _loadURL:url selectRow:row file:NULL];244 } 245 246 247 248 - (void)_loadURL:(WIURL *)url select File:(NSString *)file {249 [self _loadURL:url selectRow:0 file:file];250 } 251 252 253 254 - (void)_loadURL:(WIURL *)url selectRow:(NSInteger)row file:(NSString *)file {243 [self _loadURL:url selectRow:row name:NULL]; 244 } 245 246 247 248 - (void)_loadURL:(WIURL *)url selectName:(NSString *)name { 249 [self _loadURL:url selectRow:0 name:name]; 250 } 251 252 253 254 - (void)_loadURL:(WIURL *)url selectRow:(NSInteger)row name:(NSString *)name { 255 255 NSArray *files; 256 256 FHHandler *handler; 257 FHFile *file; 257 258 NSUInteger i, count; 258 259 BOOL select; … … 292 293 if(file) { 293 294 for(i = 0, count = [files count]; i < count; i++) { 294 if([[[files objectAtIndex:i] name] isEqualToString: file]) {295 if([[[files objectAtIndex:i] name] isEqualToString:name]) { 295 296 row = i; 296 297 … … 307 308 [_tableView selectRow:row byExtendingSelection:NO]; 308 309 } else { 309 [_imageLoader startLoadingImageAtIndex:row]; 310 311 [self showFile:[self selectedFile]]; 310 file = [self selectedFile]; 311 312 [self startLoadingImageForFile:file atIndex:row]; 313 [self showFile:file]; 312 314 } 313 315 … … 325 327 326 328 - (void)_reload { 327 NSString * file;329 NSString *name; 328 330 WIURL *url; 329 331 330 332 url = [[_handler URL] retain]; 331 file = [[[self selectedFile] name] retain];333 name = [[[self selectedFile] name] retain]; 332 334 333 335 [[FHCache cache] dropThumbnailsForURL:url]; 334 336 335 [self _loadURL:url select File:file];337 [self _loadURL:url selectName:name]; 336 338 337 339 [url release]; 338 [ file release];340 [name release]; 339 341 } 340 342 … … 357 359 - (void)_updateRightStatus { 358 360 NSMutableString *string; 361 NSString *name; 359 362 NSSize imageSize, frameSize; 360 363 CGFloat zoom, size; … … 390 393 zoom = 100.0; 391 394 395 if([FHSettings intForKey:FHSpreadMode] == FHSpreadNone) 396 name = [[self selectedFile] name]; 397 else 398 name = [[self selectedSpread] name]; 399 392 400 string = [NSMutableString stringWithFormat:NSLS(@"%@, %.0fx%.0f", @"'image.jpg, 640x480'"), 393 [[self selectedFile] name],401 name, 394 402 imageSize.width, 395 403 imageSize.height]; … … 519 527 selector:@selector(windowControllerChangedZoomMode:) 520 528 name:FHWindowControllerChangedZoomMode]; 529 530 [[NSNotificationCenter defaultCenter] 531 addObserver:self 532 selector:@selector(windowControllerChangedSpreadMode:) 533 name:FHWindowControllerChangedSpreadMode]; 521 534 } 522 535 … … 530 543 531 544 - (void)windowControllerChangedZoomMode:(NSNotification *)notification { 532 if([notification object] != _imageView) 545 if([notification object] != _imageView) { 533 546 [_imageView setImageScaling:[FHSettings intForKey:FHImageScalingMethod]]; 534 547 535 [self _updateZoomModeToolbarItems]; 536 537 [self _updateRightStatus]; 548 [self _updateZoomModeToolbarItems]; 549 550 [self _updateRightStatus]; 551 } 552 } 553 554 555 556 - (void)windowControllerChangedSpreadMode:(NSNotification *)notification { 557 if([notification object] != _imageView) { 558 [self updateSpreads]; 559 560 [self showFile:[self selectedFile]]; 561 } 538 562 } 539 563 … … 891 915 name = [[[_handler URL] path] lastPathComponent]; 892 916 893 [self _loadURL:url select File:name];917 [self _loadURL:url selectName:name]; 894 918 } 895 919 } … … 1057 1081 1058 1082 - (void)loadURL:(WIURL *)url { 1059 NSString * file;1083 NSString *name; 1060 1084 Class class; 1061 1085 … … 1063 1087 1064 1088 if([url isFileURL] && ![class handlesURLAsDirectory:url]) { 1065 file = [[url path] lastPathComponent];1089 name = [[url path] lastPathComponent]; 1066 1090 url = [WIURL fileURLWithPath:[[url path] stringByDeletingLastPathComponent]]; 1067 1091 … … 1069 1093 return; 1070 1094 1071 [self _loadURL:url select File:file];1095 [self _loadURL:url selectName:name]; 1072 1096 } else { 1073 1097 [self _loadURL:url]; … … 1138 1162 1139 1163 - (void)tableViewSelectionDidChange:(NSNotification *)notification { 1164 FHFile *file; 1140 1165 NSInteger row; 1141 1142 [self showFile:[self selectedFile]]; 1143 1166 1144 1167 row = [_tableView selectedRow]; 1168 file = [self selectedFile]; 1169 1170 [self startLoadingImageForFile:file atIndex:row]; 1171 [self showFile:file]; 1145 1172 1146 1173 if(!_switchingURL && row < _previousRow) { … … 1148 1175 [_imageView scrollPoint:NSZeroPoint]; 1149 1176 } 1150 1151 [_imageLoader startLoadingImageAtIndex:row];1152 1177 1153 1178 _previousRow = row; Footagehead/trunk/FHImageLoader.m
r4731 r4732 173 173 goto next; 174 174 175 if(i > index && _pixels >= _maxPixels)176 break;177 178 175 if([file image]) 179 176 goto next; 177 178 if(i > index + 1 && _pixels >= _maxPixels) 179 break; 180 180 181 181 url = [file URL]; Footagehead/trunk/FHImageView.m
r4731 r4732 76 76 77 77 - (void)_adjustScaling { 78 NSSize contentSize, imageSize, frameSize;79 CGFloat s ize, scrollerWidth;78 NSSize contentSize, imageSize, combinedImageSize, frameSize; 79 CGFloat scrollerWidth; 80 80 81 81 if(_adjustingScaling) … … 96 96 _imageScaling == FHScaleWidthProportionally || 97 97 _imageScaling == FHScaleHeightProportionally)) { 98 imageSize = [self _scaledImageSizeForSize:_combinedImageSize bounds:contentSize]; 99 100 if(ABS(_imageRotation) == 90.0 || ABS(_imageRotation) == 270.0) { 101 size = imageSize.width; 102 imageSize.width = imageSize.height; 103 imageSize.height = size; 98 99 if(ABS(_imageRotation) == 0.0 || ABS(_imageRotation) == 180.0) { 100 imageSize = [self _scaledImageSizeForSize:_combinedImageSize bounds:contentSize]; 101 } else { 102 if(_image) { 103 combinedImageSize.width = _combinedImageSize.height; 104 combinedImageSize.height = _combinedImageSize.width; 105 } else { 106 combinedImageSize.width = MAX(_leftSize.height, _rightSize.height); 107 combinedImageSize.height = _leftSize.width + _rightSize.width; 108 } 109 110 imageSize = [self _scaledImageSizeForSize:combinedImageSize bounds:contentSize]; 104 111 } 105 112 Footagehead/trunk/FHSlideshowController.m
r4731 r4732 54 54 name:FHImageLoaderDidLoadImage]; 55 55 56 [self updateSpreads]; 57 56 58 [self retain]; 57 59 [self window]; … … 76 78 NSScreen *screen; 77 79 NSColor *color; 80 FHFile *file; 78 81 NSRect frame; 79 82 NSUInteger index; … … 95 98 defer:YES 96 99 screen:screen]; 97 100 101 #ifndef DEBUG 98 102 [_slideshowWindow setLevel:NSScreenSaverWindowLevel]; 103 #endif 104 99 105 [_slideshowWindow setDelegate:self]; 100 106 [_slideshowWindow setReleasedWhenClosed:NO]; … … 112 118 [_imageView setImageScaling:[FHSettings intForKey:FHImageScalingMethod]]; 113 119 114 [_imageLoader startLoadingImageAtIndex:[self selectedIndex]]; 120 file = [self selectedFile]; 121 122 [self showFile:[self selectedFile]]; 123 [self startLoadingImageForFile:file atIndex:[self selectedIndex]]; 115 124 116 125 if([FHSettings boolForKey:FHFullscreenAutoSwitch]) { … … 121 130 repeats:YES] retain]; 122 131 } 123 124 [self showFile:[self selectedFile]];125 132 } 126 133 … … 160 167 161 168 - (void)selectFileAtIndex:(NSUInteger)index { 169 FHFile *file; 170 162 171 _index = index; 172 173 file = [self selectedFile]; 174 175 [self showFile:file]; 176 [self startLoadingImageForFile:file atIndex:_index]; 163 177 164 178 [_timer setFireDate:[NSDate distantFuture]]; 165 166 [self showFile:[self selectedFile]];167 168 [_imageLoader startLoadingImageAtIndex:_index];169 179 } 170 180 Footagehead/trunk/FHSpread.m
r4731 r4732 60 60 #pragma mark - 61 61 62 - (NSString *)name { 63 if(_leftFile && _rightFile) { 64 return [NSSWF:NSLS(@"%@ & %@", @"'image1.jpg' & 'image2.jpg'"), 65 [_leftFile name], [_rightFile name]]; 66 } 67 else if(_leftFile) { 68 return [_leftFile name]; 69 } 70 else if(_rightFile) { 71 return [_rightFile name]; 72 } 73 74 return NULL; 75 } 76 77 78 62 79 - (FHFile *)leftFile { 63 80 return _leftFile; Footagehead/trunk/FHTableView.m
r4715 r4732 48 48 scroller = [_imageScrollView verticalScroller]; 49 49 50 if((up && [scroller floatValue] > 0.0 f) || (!up && [scroller floatValue] < 1.0f)) {50 if((up && [scroller floatValue] > 0.01) || (!up && [scroller floatValue] < 0.99)) { 51 51 rect = [_imageScrollView documentVisibleRect]; 52 52 delta = 0.75 * rect.size.height; … … 71 71 scroller = [_imageScrollView verticalScroller]; 72 72 73 if((c == NSPageUpFunctionKey && [scroller floatValue] > 0.0 f) ||74 (c == NSPageDownFunctionKey && [scroller floatValue] < 1.0f)) {73 if((c == NSPageUpFunctionKey && [scroller floatValue] > 0.01) || 74 (c == NSPageDownFunctionKey && [scroller floatValue] < 0.99)) { 75 75 rect = [_imageScrollView documentVisibleRect]; 76 76 delta = rect.size.height; … … 95 95 scroller = [_imageScrollView verticalScroller]; 96 96 97 if((c == NSHomeFunctionKey && [scroller floatValue] > 0.0 f) ||98 (c == NSEndFunctionKey && [scroller floatValue] < 1.0f)) {97 if((c == NSHomeFunctionKey && [scroller floatValue] > 0.01) || 98 (c == NSEndFunctionKey && [scroller floatValue] < 0.99)) { 99 99 rect = [_imageView frame]; 100 100 rect.origin.y = (c == NSHomeFunctionKey) ? rect.size.height : 0; … … 118 118 scroller = [_imageScrollView verticalScroller]; 119 119 120 if((c == NSUpArrowFunctionKey && [scroller floatValue] > 0.0 f) ||121 (c == NSDownArrowFunctionKey && [scroller floatValue] < 1.0f)) {120 if((c == NSUpArrowFunctionKey && [scroller floatValue] > 0.01) || 121 (c == NSDownArrowFunctionKey && [scroller floatValue] < 0.99)) { 122 122 rect = [_imageScrollView documentVisibleRect]; 123 123 delta = 0.75 * rect.size.height; … … 128 128 } 129 129 } 130 131 if(!handled) { 132 if(c == NSUpArrowFunctionKey) 133 [[self delegate] previousFile:self]; 134 else 135 [[self delegate] nextFile:self]; 136 137 handled = YES; 138 } 130 139 } 131 140 else if(c == NSRightArrowFunctionKey || c == NSLeftArrowFunctionKey) { … … 133 142 scroller = [_imageScrollView horizontalScroller]; 134 143 135 if((c == NSRightArrowFunctionKey && [scroller floatValue] < 1.0f) ||136 (c == NSLeftArrowFunctionKey && [scroller floatValue] > 0.0 f)) {144 if((c == NSRightArrowFunctionKey && [scroller floatValue] < 0.99) || 145 (c == NSLeftArrowFunctionKey && [scroller floatValue] > 0.01)) { 137 146 rect = [_imageScrollView documentVisibleRect]; 138 147 delta = 0.75 * rect.size.height; Footagehead/trunk/FHWindowController.h
r4731 r4732 52 52 - (NSUInteger)selectedIndex; 53 53 - (void)selectFileAtIndex:(NSUInteger)index; 54 - (void)startLoadingImageForFile:(FHFile *)file atIndex:(NSUInteger)index; 54 55 - (void)showFile:(FHFile *)file; 55 56 - (void)updateFileStatus; … … 60 61 - (void)firstFile:(id)sender; 61 62 - (void)lastFile:(id)sender; 63 - (void)previousFile:(id)sender; 64 - (void)nextFile:(id)sender; 62 65 - (void)previousImage:(id)sender; 63 66 - (void)nextImage:(id)sender; Footagehead/trunk/FHWindowController.m
r4731 r4732 92 92 93 93 - (void)setImageLoader:(FHImageLoader *)imageLoader { 94 [[_imageLoader notificationCenter] removeObserver:self]; 95 94 96 [imageLoader retain]; 95 97 [_imageLoader release]; … … 150 152 151 153 - (void)selectFileAtIndex:(NSUInteger)index { 154 } 155 156 157 158 - (void)startLoadingImageForFile:(FHFile *)file atIndex:(NSUInteger)index { 159 if([FHSettings intForKey:FHSpreadMode] == FHSpreadNone || index == 0) { 160 [_imageLoader startLoadingImageAtIndex:index]; 161 } else { 162 if(file == [[self spreadForFile:file] rightFile]) 163 index--; 164 165 [_imageLoader startLoadingImageAtIndex:index]; 166 } 152 167 } 153 168 … … 297 312 298 313 314 - (void)previousFile:(id)sender { 315 NSUInteger index, newIndex; 316 317 index = [self selectedIndex]; 318 319 if(index == NSNotFound) 320 return; 321 322 if([FHSettings intForKey:FHSpreadMode] == FHSpreadNone) 323 newIndex = index - 1; 324 else 325 newIndex = index - 2; 326 327 if((NSInteger) newIndex >= 0) 328 [self selectFileAtIndex:newIndex]; 329 } 330 331 332 333 - (void)nextFile:(id)sender { 334 NSUInteger index, newIndex; 335 336 index = [self selectedIndex]; 337 338 if(index == NSNotFound) 339 return; 340 341 if([FHSettings intForKey:FHSpreadMode] == FHSpreadNone) 342 newIndex = index + 1; 343 else 344 newIndex = index + 2; 345 346 if(newIndex < [[self files] count]) 347 [self selectFileAtIndex:newIndex]; 348 } 349 350 351 299 352 - (void)previousImage:(id)sender { 300 353 NSArray *files; 301 NSUInteger i, count, index, newIndex;354 NSUInteger i, count, start, index, newIndex; 302 355 303 356 index = [self selectedIndex]; … … 311 364 312 365 if(index > 0) { 313 i = index - 1; 366 if([FHSettings intForKey:FHSpreadMode] == FHSpreadNone) 367 start = index - 1; 368 else 369 start = index - 2; 370 371 i = start; 314 372 315 373 do { … … 330 388 - (void)nextImage:(id)sender { 331 389 NSArray *files; 332 NSUInteger i, count, index, newIndex;390 NSUInteger i, count, start, index, newIndex; 333 391 334 392 index = [self selectedIndex]; … … 345 403 newIndex = NSNotFound; 346 404 347 if(index + 1 < count) { 348 for(i = index + 1; i < count; i++) { 405 if([FHSettings intForKey:FHSpreadMode] == FHSpreadNone) 406 start = index + 1; 407 else 408 start = index + 2; 409 410 if(start < count) { 411 for(i = start; i < count; i++) { 349 412 if(![[files objectAtIndex:i] isDirectory]) { 350 413 newIndex = i; … … 375 438 step = (double) count / 10.0; 376 439 step = WI_CLAMP(step, 2, 10); 377 440 441 if([FHSettings intForKey:FHSpreadMode] != FHSpreadNone && step % 2 != 0) 442 step++; 443 378 444 if(index > step) { 379 445 for(i = index - step; i > 0; i--) { … … 412 478 step = WI_CLAMP(step, 2, 10); 413 479 480 if([FHSettings intForKey:FHSpreadMode] != FHSpreadNone && step % 2 != 0) 481 step++; 482 414 483 if(index + step < count) { 415 484 for(i = index + step; i < count; i++) { … … 449 518 450 519 [self updateSpreads]; 520 451 521 [self showFile:[self selectedFile]]; 452 522 … … 457 527 458 528 - (void)rotateRight:(id)sender { 459 float rotation;460 461 rotation = [_imageView imageRotation];462 463 if(rotation == -270.0)464 rotation = 0.0;465 else466 rotation -= 90.0;467 468 [_imageView setImageRotation:rotation];469 470 [FHSettings setFloat:rotation forKey:FHImageRotation];471 }472 473 474 475 - (void)rotateLeft:(id)sender {476 529 float rotation; 477 530 … … 484 537 485 538 [_imageView setImageRotation:rotation]; 486 539 487 540 [FHSettings setFloat:rotation forKey:FHImageRotation]; 488 541 } 489 542 543 544 545 - (void)rotateLeft:(id)sender { 546 float rotation; 547 548 rotation = [_imageView imageRotation]; 549 550 if(rotation == 0.0) 551 rotation = 270.0; 552 else 553 rotation -= 90.0; 554 555 [_imageView setImageRotation:rotation]; 556 557 [FHSettings setFloat:rotation forKey:FHImageRotation]; 558 } 559 490 560 @end Footagehead/trunk/Footagehead.xcodeproj/project.pbxproj
r4731 r4732 498 498 A599A10E075F94F400A03BA5 /* FHFileCell.m */, 499 499 A599A10D075F94F400A03BA5 /* FHFileCell.h */, 500 77B151860BD8FEBB009B6183 /* FHImageLoader.m */,501 77B151850BD8FEBB009B6183 /* FHImageLoader.h */,502 500 77CDB021083B6B85003BE654 /* FHImageView.m */, 503 501 77CDB020083B6B85003BE654 /* FHImageView.h */, … … 746 744 77494702085A57F600BA0915 /* FHImage.m */, 747 745 77494701085A57F600BA0915 /* FHImage.h */, 746 77B151860BD8FEBB009B6183 /* FHImageLoader.m */, 747 77B151850BD8FEBB009B6183 /* FHImageLoader.h */, 748 748 A587DF7B055AA418005D2097 /* FHSettings.m */, 749 749 A587DF76055AA418005D2097 /* FHSettings.h */, Footagehead/trunk/Japanese.lproj/Localizable.strings
r4720 r4732 1 1 /* 'image.jpg - 1/10' */ 2 2 "%@ %C %u/%u" = "%1$@ %2$C %3$u/%4$u"; 3 4 /* 'image1.jpg' & 'image2.jpg' */ 5 "%@ & %@" = "%1$@ & %2$@"; 3 6 4 7 /* 'image.jpg, 640x480' */ … … 19 22 /* Actual size toolbar item */ 20 23 "Actual Size" = "Actual Size"; 24 25 /* Color black */ 26 "Black" = "Black"; 27 28 /* Error message */ 29 "error opening image" = "error opening image"; 30 31 /* Color gray */ 32 "Gray" = "Gray"; 21 33 22 34 /* Menu item title */ … … 65 77 "Stretch To Fit" = "Stretch To Fit"; 66 78 79 /* Color white */ 80 "White" = "White"; 81 67 82 /* Zoom to fit toolbar item */ 68 83 "Zoom To Fit" = "Zoom To Fit"; 84
