Changeset 2948
- Timestamp:
- 06/17/05 00:42:27 (4 years ago)
- Files:
-
- Footagehead/trunk/English.lproj/MainMenu.nib/classes.nib (modified) (1 diff)
- 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/FHCache.h (modified) (2 diffs)
- Footagehead/trunk/FHCache.m (modified) (4 diffs)
- Footagehead/trunk/FHController.h (modified) (1 diff)
- Footagehead/trunk/FHController.m (modified) (15 diffs)
- Footagehead/trunk/FHFeedHandler.m (modified) (2 diffs)
- Footagehead/trunk/FHFile.h (modified) (4 diffs)
- Footagehead/trunk/FHFile.m (modified) (8 diffs)
- Footagehead/trunk/FHFileCell.h (modified) (2 diffs)
- Footagehead/trunk/FHFileCell.m (modified) (6 diffs)
- Footagehead/trunk/FHFileHandler.m (modified) (1 diff)
- Footagehead/trunk/FHHandler.h (modified) (1 diff)
- Footagehead/trunk/FHImage.h (added)
- Footagehead/trunk/FHImage.m (added)
- Footagehead/trunk/FHImageHandler.h (modified) (1 diff)
- Footagehead/trunk/FHImageHandler.m (modified) (1 diff)
- Footagehead/trunk/FHImageView.h (modified) (2 diffs)
- Footagehead/trunk/FHImageView.m (modified) (8 diffs)
- Footagehead/trunk/FHRangeHandler.m (modified) (2 diffs)
- Footagehead/trunk/FHSpotlightHandler.m (modified) (3 diffs)
- Footagehead/trunk/FHTableView.m (modified) (1 diff)
- Footagehead/trunk/FHURLHandler.m (modified) (3 diffs)
- Footagehead/trunk/Footagehead.xcconfig (added)
- Footagehead/trunk/Footagehead.xcode (deleted)
- Footagehead/trunk/Footagehead.xcodeproj (added)
- Footagehead/trunk/Footagehead.xcodeproj/project.pbxproj (added)
- Footagehead/trunk/Japanese.lproj/MainMenu.nib/classes.nib (modified) (1 diff)
- Footagehead/trunk/Japanese.lproj/MainMenu.nib/info.nib (modified) (1 diff)
- Footagehead/trunk/Japanese.lproj/MainMenu.nib/keyedobjects.nib (modified) (previous)
- Footagehead/trunk/Japanese.lproj/MainMenu.nib/objects.nib (modified) (previous)
- Footagehead/trunk/version.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Footagehead/trunk/English.lproj/MainMenu.nib/classes.nib
r2909 r2948 17 17 reload = id; 18 18 revealInFinder = id; 19 setAsDesktopBackground = id; 19 20 slideshow = id; 20 21 slideshowButtons = id; Footagehead/trunk/English.lproj/MainMenu.nib/info.nib
r2911 r2948 4 4 <dict> 5 5 <key>IBDocumentLocation</key> 6 <string> 909 492 395 374 0 0 1680 1028</string>6 <string>423 67 395 374 0 0 1152 746 </string> 7 7 <key>IBEditorPositions</key> 8 8 <dict> 9 9 <key>29</key> 10 <string>316 694 317 44 0 0 1680 1028 </string> 10 <string>317 694 317 44 0 0 1680 1028 </string> 11 <key>592</key> 12 <string>162 516 223 118 0 0 1680 1028 </string> 11 13 </dict> 12 14 <key>IBFramework Version</key> 13 <string>43 7.0</string>15 <string>439.0</string> 14 16 <key>IBOldestOS</key> 15 17 <integer>3</integer> 16 18 <key>IBOpenObjects</key> 17 19 <array> 20 <integer>29</integer> 18 21 <integer>21</integer> 19 22 <integer>288</integer> 23 <integer>592</integer> 20 24 </array> 21 25 <key>IBSystem Version</key> Footagehead/trunk/FHCache.h
r2935 r2948 30 30 NSImage *_directoryIcon; 31 31 NSMutableDictionary *_fileIcons; 32 NSMutable Array *_temporaryPaths;32 NSMutableDictionary *_largeFileIcons; 33 33 34 34 NSRecursiveLock *_lock; … … 46 46 - (NSImage *)fileIconForURL:(ZAURL *)url; 47 47 48 - (void)addTemporaryPath:(NSString *)path; 49 - (void)purgeTemporaryPaths; 48 - (void)setLargeFileIcon:(NSImage *)icon forExtension:(NSString *)extension; 49 - (NSImage *)largeFileIconForExtension:(NSString *)extension; 50 51 - (void)setLargeFileIcon:(NSImage *)icon forURL:(ZAURL *)url; 52 - (NSImage *)largeFileIconForURL:(ZAURL *)url; 50 53 51 54 @end Footagehead/trunk/FHCache.m
r2940 r2948 49 49 50 50 _fileIcons = [[NSMutableDictionary alloc] initWithCapacity:100]; 51 _ temporaryPaths = [[NSMutableArray alloc] initWithCapacity:10];51 _largeFileIcons = [[NSMutableDictionary alloc] initWithCapacity:100]; 52 52 53 53 _lock = [[NSRecursiveLock alloc] init]; … … 61 61 [_directoryIcon release]; 62 62 [_fileIcons release]; 63 [_ temporaryPaths release];63 [_largeFileIcons release]; 64 64 65 65 [_lock release]; … … 134 134 #pragma mark - 135 135 136 - (void) addTemporaryPath:(NSString *)path{136 - (void)setLargeFileIcon:(NSImage *)icon forExtension:(NSString *)extension { 137 137 [_lock lock]; 138 [_temporaryPaths addObject:path]; 138 139 if([_largeFileIcons count] > 100) 140 [_largeFileIcons removeObjectForKey:[[_largeFileIcons allKeys] objectAtIndex:0]]; 141 142 [_largeFileIcons setObject:icon forKey:extension]; 143 139 144 [_lock unlock]; 140 145 } … … 142 147 143 148 144 - (void)purgeTemporaryPaths { 145 NSFileManager *fileManager; 146 int i, count; 149 - (NSImage *)largeFileIconForExtension:(NSString *)extension { 150 NSImage *image; 151 152 [_lock lock]; 153 image = [_largeFileIcons objectForKey:extension]; 154 [_lock unlock]; 155 156 return image; 157 } 147 158 159 160 161 #pragma mark - 162 163 - (void)setLargeFileIcon:(NSImage *)icon forURL:(ZAURL *)url { 148 164 [_lock lock]; 149 165 150 fileManager = [NSFileManager defaultManager];151 count = [_temporaryPaths count];166 if([_largeFileIcons count] > 100) 167 [_largeFileIcons removeObjectForKey:[[_largeFileIcons allKeys] objectAtIndex:0]]; 152 168 153 for(i = 0; i < count; i++) 154 [fileManager removeFileAtPath:[_temporaryPaths objectAtIndex:i] handler:NULL]; 169 [_largeFileIcons setObject:icon forKey:[url string]]; 155 170 156 171 [_lock unlock]; 157 172 } 158 173 174 175 176 - (NSImage *)largeFileIconForURL:(ZAURL *)url { 177 NSImage *image; 178 179 [_lock lock]; 180 image = [_largeFileIcons objectForKey:[url string]]; 181 [_lock unlock]; 182 183 return image; 184 } 185 159 186 @end Footagehead/trunk/FHController.h
r2909 r2948 95 95 - (IBAction)slideshowButtons:(id)sender; 96 96 - (IBAction)revealInFinder:(id)sender; 97 - (IBAction)setAsDesktopBackground:(id)sender; 97 98 - (IBAction)delete:(id)sender; 98 99 Footagehead/trunk/FHController.m
r2945 r2948 34 34 #import "FHFullscreenWindow.h" 35 35 #import "FHHandler.h" 36 #import "FHImage.h" 36 37 #import "FHImageView.h" 37 38 #import "FHSettings.h" … … 208 209 if(url) 209 210 [FHSettings setObject:[url string] forKey:FHOpenURL]; 210 211 [[FHCache cache] purgeTemporaryPaths];212 211 } 213 212 … … 276 275 277 276 278 - (float)splitView:(NSSplitView *)splitView constrainMinCoordinate:(float)proposedM axofSubviewAt:(int)offset {277 - (float)splitView:(NSSplitView *)splitView constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset { 279 278 return 49.0; 279 } 280 281 282 283 - (float)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset { 284 return 145.0; 280 285 } 281 286 … … 339 344 // --- user pressed the return/enter key 340 345 if(selector == @selector(insertNewline:)) { 341 if([[[NSApp currentEvent] characters] characterAtIndex:0] == NSEnterCharacter) { 342 [self submitSheet:sender]; 343 344 handled = YES; 345 } 346 } 347 348 return handled; 346 [self submitSheet:sender]; 347 348 handled = YES; 349 } 350 351 return handled; 349 352 } 350 353 … … 368 371 - (FHFile *)fileAtIndex:(unsigned int)index { 369 372 return [[_handler files] objectAtIndex:index]; 373 } 374 375 376 377 #pragma mark - 378 379 - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { 380 FHFile *file; 381 SEL selector; 382 383 selector = [menuItem action]; 384 385 if(selector == @selector(zoom:) || selector == @selector(delete:) || selector == @selector(revealInFinder:)) { 386 file = [self selectedFile]; 387 388 return (file != NULL); 389 } 390 else if(selector == @selector(setAsDesktopBackground:)) { 391 file = [self selectedFile]; 392 393 return (file != NULL && [file isDirectory]); 394 } 395 396 return YES; 370 397 } 371 398 … … 695 722 696 723 724 - (IBAction)setAsDesktopBackground:(id)sender { 725 NSAppleScript *script; 726 NSAppleEventDescriptor *descriptor; 727 NSDictionary *error; 728 729 script = [[NSAppleScript alloc] initWithSource:[NSSWF: 730 @"tell application Finder" 731 @"set desktop picture to '/home/axela/Pictures/Desktops/Lain 1.jpg'" 732 @"end tell" 733 ]]; 734 735 descriptor = [script executeAndReturnError:&error]; 736 737 NSLog(@"descriptor = %@", descriptor); 738 739 if(!descriptor) 740 NSLog(@"error = %@", error); 741 742 [script release]; 743 } 744 745 746 697 747 - (IBAction)delete:(id)sender { 698 748 FHFile *file; … … 747 797 if(!handler) { 748 798 [self stopSpinning]; 749 750 if(!_handler)751 [_imageView setImage:NULL];752 799 753 800 return; … … 844 891 NSAutoreleasePool *pool; 845 892 NSArray *files; 846 NSImage *image;893 FHImage *image; 847 894 FHFile *file; 848 895 unsigned int i, count, counter, images, row, lastRow, lastCounter; … … 891 938 goto next; 892 939 893 image = [[ NSImage alloc] initWithContentsOfURL:[[file URL]URL]];894 [file setImage: [image smoothedImage]];940 image = [[FHImage alloc] initImageWithURL:[file URL]]; 941 [file setImage:image]; 895 942 [file setLoaded:YES]; 896 943 [image release]; … … 917 964 918 965 - (void)loadThumbnailsThread:(id)arg { 919 NSAutoreleasePool *pool;966 NSAutoreleasePool *pool; 920 967 NSArray *files; 921 NSImage *image;968 FHImage *image; 922 969 FHFile *file; 923 970 unsigned int i, count, counter, images; … … 941 988 goto next; 942 989 943 images++; 944 945 image = [[NSImage alloc] initWithJPEGFile:[file path] preferredSize:NSMakeSize(128.0, 128.0)]; 990 image = [[FHImage alloc] initImageWithURL:[file URL] preferredSize:NSMakeSize(128.0, 128.0)]; 946 991 947 992 if(image) { … … 951 996 [self performSelectorOnMainThread:@selector(fileDidLoadThumbnail:) withObject:file waitUntilDone:YES]; 952 997 } 998 953 999 next: 954 if( images % 5 == 0) {1000 if(++images % 5 == 0) { 955 1001 [_loadThumbnailsLock lock]; 956 1002 if(counter != _thumbnailsCounter) … … 968 1014 969 1015 - (void)fileDidLoadImage:(FHFile *)file { 970 NSImage *image;1016 FHImage *image; 971 1017 BOOL success; 972 1018 … … 1012 1058 1013 1059 1014 - (void)handlerDidAddFile :(FHHandler *)handler {1060 - (void)handlerDidAddFiles:(FHHandler *)handler { 1015 1061 [_tableView reloadData]; 1016 1062 [self updateLeftStatus]; … … 1292 1338 - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row { 1293 1339 FHFile *file; 1294 NSImage *icon;1340 FHImage *icon; 1295 1341 1296 1342 file = [self fileAtIndex:row]; 1297 1343 icon = [file thumbnail]; 1298 1344 1299 if(!icon) {1345 if(!icon) 1300 1346 icon = [file icon]; 1301 [icon setSize:NSMakeSize(128.0, 128.0)];1302 }1303 1347 1304 1348 return [NSDictionary dictionaryWithObjectsAndKeys: Footagehead/trunk/FHFeedHandler.m
r2944 r2948 220 220 break; 221 221 } 222 223 return NULL; 222 224 } 223 225 … … 238 240 break; 239 241 } 242 243 return NULL; 240 244 } 241 245 Footagehead/trunk/FHFile.h
r2919 r2948 27 27 */ 28 28 29 @class FHImage; 30 29 31 @interface FHFile : ZAObject { 30 32 NSString *_name; … … 32 34 NSString *_path; 33 35 NSString *_extension; 34 NSImage *_image;35 NSImage *_icon;36 NSImage *_thumbnail;36 FHImage *_image; 37 FHImage *_icon; 38 FHImage *_thumbnail; 37 39 BOOL _loaded; 38 40 BOOL _directory; … … 44 46 - (id)initWithURL:(ZAURL *)url name:(NSString *)name isDirectory:(BOOL)isDirectory index:(unsigned int)index; 45 47 46 - (void)setImage:( NSImage *)image;47 - ( NSImage *)image;48 - (void)setThumbnail:( NSImage *)thumbnail;49 - ( NSImage *)thumbnail;48 - (void)setImage:(FHImage *)image; 49 - (FHImage *)image; 50 - (void)setThumbnail:(FHImage *)thumbnail; 51 - (FHImage *)thumbnail; 50 52 - (void)setLoaded:(BOOL)loaded; 51 53 - (BOOL)isLoaded; … … 55 57 - (NSString *)path; 56 58 - (NSString *)extension; 57 - ( NSImage *)icon;59 - (FHImage *)icon; 58 60 - (BOOL)isDirectory; 59 61 - (unsigned int)index; Footagehead/trunk/FHFile.m
r2935 r2948 29 29 #import "FHCache.h" 30 30 #import "FHFile.h" 31 #import "FHImage.h" 31 32 32 33 @implementation FHFile … … 39 40 40 41 - (id)initWithURL:(ZAURL *)url name:(NSString *)name isDirectory:(BOOL)isDirectory index:(unsigned int)index { 42 NSImage *icon; 43 41 44 self = [super init]; 42 45 … … 50 53 if(!_directory) { 51 54 // --- get icon for extension 52 _icon = [[FHCache cache] fileIconForExtension:_extension];55 icon = [[FHCache cache] largeFileIconForExtension:_extension]; 53 56 54 if(!_icon) { 55 _icon = [[NSWorkspace sharedWorkspace] iconForFileType:_extension]; 57 if(!icon) { 58 icon = [[NSWorkspace sharedWorkspace] iconForFileType:_extension]; 59 [icon setSize:NSMakeSize(128.0, 128.0)]; 56 60 57 [[FHCache cache] set FileIcon:_icon forExtension:_extension];61 [[FHCache cache] setLargeFileIcon:icon forExtension:_extension]; 58 62 } 63 64 _icon = [[FHImage alloc] initImageWithImage:icon]; 59 65 } else { 60 66 if(![_url isFileURL]) { 61 67 // --- get icon for generic remote directory 62 _icon = [[FHCache cache] directoryIcon];68 icon = [[FHCache cache] directoryIcon]; 63 69 } else { 64 70 // --- get icon for local directory path 65 _icon = [[FHCache cache] fileIconForURL:url];71 icon = [[FHCache cache] largeFileIconForURL:url]; 66 72 67 if(!_icon) { 68 _icon = [[NSWorkspace sharedWorkspace] iconForFile:_path]; 73 if(!icon) { 74 icon = [[NSWorkspace sharedWorkspace] iconForFile:_path]; 75 [icon setSize:NSMakeSize(128.0, 128.0)]; 69 76 70 [[FHCache cache] set FileIcon:_icon forURL:_url];77 [[FHCache cache] setLargeFileIcon:icon forURL:_url]; 71 78 } 72 79 } 80 81 _icon = [[FHImage alloc] initImageWithImage:icon]; 73 82 } 74 75 [_icon retain];76 83 77 84 return self; … … 95 102 #pragma mark - 96 103 97 - (void)setImage:( NSImage *)image {104 - (void)setImage:(FHImage *)image { 98 105 [image retain]; 99 106 [_image release]; … … 104 111 105 112 106 - ( NSImage *)image {113 - (FHImage *)image { 107 114 return _image; 108 115 } … … 110 117 111 118 112 - (void)setThumbnail:( NSImage *)thumbnail {119 - (void)setThumbnail:(FHImage *)thumbnail { 113 120 [thumbnail retain]; 114 121 [_thumbnail release]; … … 119 126 120 127 121 - ( NSImage *)thumbnail {128 - (FHImage *)thumbnail { 122 129 return _thumbnail; 123 130 } … … 163 170 164 171 165 - ( NSImage *)icon {172 - (FHImage *)icon { 166 173 return _icon; 167 174 } Footagehead/trunk/FHFileCell.h
r920 r2948 1 /* $Id : FHFileCell.h,v 1.3 2005/01/08 22:55:46 morris Exp$ */1 /* $Id$ */ 2 2 3 3 /* … … 29 29 @interface FHFileCell : NSCell { 30 30 NSCell *_nameCell; 31 NSImageCell *_iconCell;32 31 33 32 NSDictionary *_attributes; Footagehead/trunk/FHFileCell.m
r2875 r2948 28 28 29 29 #import "FHFileCell.h" 30 #import "FHImage.h" 30 31 31 32 @implementation FHFileCell … … 37 38 38 39 _nameCell = [[NSCell alloc] init]; 39 _iconCell = [[NSImageCell alloc] init];40 [_iconCell setImageAlignment:NSImageAlignCenter];41 40 42 41 style = [[[NSMutableParagraphStyle alloc] init] autorelease]; … … 55 54 - (void)dealloc { 56 55 [_nameCell release]; 57 [_iconCell release];58 56 59 57 [_attributes release]; … … 71 69 cell = [super copyWithZone:zone]; 72 70 cell->_nameCell = [_nameCell retain]; 73 cell->_iconCell = [_iconCell retain];74 71 cell->_attributes = [_attributes retain]; 75 72 … … 84 81 NSAttributedString *string; 85 82 NSString *name; 86 NSImage *icon; 87 NSRect rect; 83 FHImage *icon; 84 NSRect rect, imageRect; 85 NSSize size; 86 float dx, dy, d; 88 87 89 88 name = [(NSDictionary *) [self objectValue] objectForKey:FHFileCellNameKey]; … … 97 96 [string release]; 98 97 99 rect = NSMakeRect(frame.origin.x, frame.origin.y + 2.0, frame.size.width, frame.size.height - 28.0); 100 [_iconCell setImage:icon]; 101 [_iconCell setHighlighted:[self isHighlighted]]; 102 [_iconCell drawWithFrame:rect inView:view]; 98 rect = NSMakeRect(frame.origin.x, frame.origin.y + 2.0, frame.size.width, frame.size.height - 28.0); 99 size = [icon size]; 100 imageRect.origin = rect.origin; 101 imageRect.size = size; 102 dx = rect.size.width / imageRect.size.width; 103 dy = rect.size.height / imageRect.size.height; 104 d = dx < dy ? dx : dy; 105 106 if(d < 1.0) { 107 imageRect.size.width = floorf(imageRect.size.width * d); 108 imageRect.size.height = floorf(imageRect.size.height * d); 109 } 110 111 imageRect.origin.x += floorf((rect.size.width - imageRect.size.width) / 2.0); 112 imageRect.origin.y += floorf((rect.size.height - imageRect.size.height) / 2.0); 113 114 [icon setFlipped:YES]; 115 [icon drawInRect:imageRect]; 103 116 } 104 117 Footagehead/trunk/FHFileHandler.m
r2946 r2948 37 37 38 38 + (BOOL)handlesURL:(ZAURL *)url isPrimary:(BOOL)primary { 39 if( [url isFileURL]) {39 if(primary && [url isFileURL]) { 40 40 if([[NSFileManager defaultManager] directoryExistsAtPath:[url path]]) 41 41 return YES; Footagehead/trunk/FHHandler.h
r2935 r2948 70 70 @interface NSObject(FHHandlerDelegate) 71 71 72 - (void)handlerDidAddFile :(FHHandler *)handler;72 - (void)handlerDidAddFiles:(FHHandler *)handler; 73 73 - (void)handlerDidFinishLoading:(FHHandler *)handler; 74 74 Footagehead/trunk/FHImageHandler.h
r2933 r2948 29 29 #import "FHURLHandler.h" 30 30 31 @class FHImage; 32 31 33 @interface FHImageHandler : FHURLHandler 32 34 33 - (id)initHandlerWithURL:(ZAURL *)url image:( NSImage *)image;35 - (id)initHandlerWithURL:(ZAURL *)url image:(FHImage *)image; 34 36 35 37 @end Footagehead/trunk/FHImageHandler.m
r2933 r2948 32 32 @implementation FHImageHandler 33 33 34 - (id)initHandlerWithURL:(ZAURL *)url image:( NSImage *)image {34 - (id)initHandlerWithURL:(ZAURL *)url image:(FHImage *)image { 35 35 FHFile *file; 36 36 Footagehead/trunk/FHImageView.h
r2916 r2948 27 27 */ 28 28 29 @class FHImage; 30 29 31 @interface FHImageView : NSView { 30 NSImage *_image;32 FHImage *_image; 31 33 NSImageScaling _imageScaling; 32 34 … … 40 42 41 43 42 - (void)setImage:( NSImage *)image;43 - ( NSImage *)image;44 - (void)setImage:(FHImage *)image; 45 - (FHImage *)image; 44 46 - (void)setImageScaling:(NSImageScaling)newScaling; 45 47 - (NSImageScaling)imageScaling; Footagehead/trunk/FHImageView.m
r2931 r2948 28 28 29 29 #import "FHController.h" 30 #import "FHImage.h" 30 31 #import "FHImageView.h" 31 32 … … 70 71 [NSColor blackColor], NSForegroundColorAttributeName, 71 72 NULL]; 72 73 73 } 74 74 … … 124 124 #pragma mark - 125 125 126 - (void)setImage:( NSImage *)image {126 - (void)setImage:(FHImage *)image { 127 127 BOOL display; 128 128 … … 142 142 143 143 144 - ( NSImage *)image {144 - (FHImage *)image { 145 145 return _image; 146 146 } … … 222 222 - (void)_adjustScaling { 223 223 NSScrollView *scrollView; 224 NSSize size, imageSize;224 NSSize contentSize, imageSize, frameSize; 225 225 226 226 scrollView = [self enclosingScrollView]; 227 227 228 if(scrollView) { 229 size = [scrollView contentSize]; 230 231 if(_imageScaling == NSScaleNone) { 232 imageSize = _image ? [_image size] : NSZeroSize; 233 size = NSMakeSize(MAX(size.width, imageSize.width), MAX(size.height, imageSize.height)); 234 235 // --- for some reason (bug?), when switching back from NSScaleProportionally, the first 236 // setFrameSize: doesn't fully resize the view, it leaves it a few pixels short 237 [self setFrameSize:size]; 238 [self setFrameSize:size]; 239 [self scrollPoint:NSMakePoint(0.0, size.height)]; 240 } else { 241 [self setFrameSize:size]; 242 } 228 contentSize = [scrollView contentSize]; 229 230 if(_image && _imageScaling == NSScaleNone) { 231 imageSize = _image ? [_image size] : NSZeroSize; 232 frameSize = NSMakeSize(MAX(contentSize.width, imageSize.width), MAX(contentSize.height, imageSize.height)); 233 234 [scrollView setHasHorizontalScroller:(imageSize.width > contentSize.width)]; 235 [scrollView setHasVerticalScroller:(imageSize.height > contentSize.height)]; 236 237 [self setFrameSize:frameSize]; 238 [self scrollPoint:NSMakePoint(0.0, frameSize.height)]; 239 } else { 240 [scrollView setHasHorizontalScroller:NO]; 241 [scrollView setHasVerticalScroller:NO]; 242 243 [self setFrameSize:contentSize]; 243 244 } 244 245 } … … 297 298 298 299 - (void)drawRect:(NSRect)frame { 299 NSImage *image;300 NSImageRep *imageRep;301 300 NSRect bounds, rect; 302 301 float dx, dy, d; … … 306 305 [_backgroundColor set]; 307 306 NSRectFill(bounds); 308 309 imageRep = [_image bestRepresentationForDevice:NULL]; 310 311 if(imageRep) { 307 308 if(_image) { 312 309 rect.size = [_image size]; 313 310 … … 335 332 rect.origin.y = floorf((bounds.size.height - rect.size.height) / 2.0); 336 333 337 if([imageRep hasAlpha]) { 338 image = [_image copy]; 339 [image setScalesWhenResized:YES]; 340 [image setSize:rect.size]; 341 [image compositeToPoint:rect.origin operation:NSCompositeSourceOver]; 342 [image release]; 343 } else { 344 [imageRep drawInRect:rect]; 345 } 334 [_image drawInRect:rect]; 346 335 347 336 if(_label && [_label length] > 0) Footagehead/trunk/FHRangeHandler.m
r2933 r2948 36 36 NSString *string; 37 37 38 if( ![url isFileURL]) {38 if(primary && ![url isFileURL]) { 39 39 string = [url path]; 40 40 … … 43 43 return YES; 44 44 } 45 45 46 46 return NO; 47 47 } Footagehead/trunk/FHSpotlightHandler.m
r2933 r2948 33 33 34 34 + (BOOL)handlesURL:(ZAURL *)url isPrimary:(BOOL)primary { 35 return [[url scheme] isEqualToString:@"spotlight"];35 return (primary && [[url scheme] isEqualToString:@"spotlight"]); 36 36 } 37 37 … … 41 41 42 42 - (id)initHandlerWithURL:(ZAURL *)url { 43 NSSortDescriptor *sortDescriptor;44 45 43 self = [super initHandlerWithURL:url]; 46 44 47 sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"FHSpotlightHandlerName"48 ascending:YES49 selector:@selector(caseInsensitiveCompare:)];50 45 _query = [[NSMetadataQuery alloc] init]; 51 // [_query setSortDescriptors:[NSArray arrayWithObject:sortDescriptor]];52 46 [_query setPredicate:[NSPredicate predicateWithFormat: 53 @"(kMDItemFSName like[cd] %@) && (kMDItemContentTypeTree == \"public.image\")",47 @"(kMDItemFSName LIKE[cd] %@) && (kMDItemContentTypeTree == \"public.image\")", 54 48 [[url path] substringFromIndex:1]]]; 55 [sortDescriptor release];56 49 57 50 [[NSNotificationCenter defaultCenter] … … 88 81 NSString *path; 89 82 FHFile *file; 83 unsigned int count; 90 84 91 item = [_query resultAtIndex:_index]; 92 path = [item valueForAttribute:@"kMDItemPath"]; 85 count = [_query resultCount]; 93 86 94 if(path) { 95 file = [[FHFile alloc] initWithURL:[ZAURL fileURLWithPath:path] isDirectory:NO index:_index]; 96 [_files addObject:file]; 97 [file release]; 87 for(; _index < count; _index++) { 88 item = [_query resultAtIndex:_index];  
