Changeset 2875
- Timestamp:
- 05/19/05 20:58:47 (4 years ago)
- Files:
-
- Footagehead/trunk/FHController.h (modified) (1 diff)
- Footagehead/trunk/FHController.m (modified) (12 diffs)
- Footagehead/trunk/FHFileCell.m (modified) (2 diffs)
- Footagehead/trunk/FHImageView.m (modified) (2 diffs)
- Footagehead/trunk/Footagehead.xcode/project.pbxproj (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Footagehead/trunk/FHController.h
r2874 r2875 63 63 NSConditionLock *_loadImageLock; 64 64 NSConditionLock *_loadThumbnailsLock; 65 unsigned int _row; 65 unsigned int _selectedRow; 66 unsigned int _imageCounter; 67 unsigned int _thumbnailsCounter; 66 68 67 69 BOOL _openLast; Footagehead/trunk/FHController.m
r2874 r2875 160 160 [self updateTableView]; 161 161 162 // --- detach loader thread 162 // --- detach loader threads 163 163 [NSThread detachNewThreadSelector:@selector(loadImageThread:) toTarget:self withObject:NULL]; 164 164 [NSThread detachNewThreadSelector:@selector(loadThumbnailsThread:) toTarget:self withObject:NULL]; … … 693 693 } else { 694 694 [_loadImageLock lock]; 695 _row = row; 695 _selectedRow = row; 696 _imageCounter++; 696 697 [_loadImageLock unlockWithCondition:1]; 697 698 } … … 701 702 if([_handler isLocal]) { 702 703 [_loadThumbnailsLock lock]; 704 _thumbnailsCounter++; 703 705 [_loadThumbnailsLock unlockWithCondition:1]; 704 706 } … … 750 752 NSImage *image; 751 753 FHFile *file; 752 unsigned int i, count, images, row, lastRow;754 unsigned int i, count, counter, images, row, lastRow; 753 755 754 756 lastRow = 0; … … 758 760 759 761 [_loadImageLock lockWhenCondition:1]; 760 row = _row; 761 files = [[_handler files] retain]; 762 row = _selectedRow; 763 files = [[_handler files] copy]; 764 counter = _imageCounter; 762 765 [_loadImageLock unlockWithCondition:0]; 763 766 … … 783 786 784 787 if([file isDirectory]) 785 continue;788 goto next; 786 789 787 790 if(++images > 10) … … 789 792 790 793 if([file image]) 791 continue;792 794 goto next; 795 793 796 image = [[NSImage alloc] initWithContentsOfURL:[[file URL] URL]]; 794 797 [file setImage:[image smoothedImage]]; … … 796 799 797 800 [self performSelectorOnMainThread:@selector(fileDidLoadImage:) withObject:file waitUntilDone:YES]; 801 802 next: 803 [_loadImageLock lock]; 804 if(counter != _imageCounter) 805 i = count; 806 [_loadImageLock unlockWithCondition:0]; 798 807 } 799 808 … … 813 822 NSImage *image; 814 823 FHFile *file; 815 unsigned int i, count; 816 824 unsigned int i, count, counter; 825 826 [NSThread setThreadPriority:0.2]; 827 817 828 while(YES) { 818 829 pool = [[NSAutoreleasePool alloc] init]; 819 830 820 831 [_loadThumbnailsLock lockWhenCondition:1]; 821 files = [[_handler files] retain]; 832 files = [[_handler files] copy]; 833 counter = _thumbnailsCounter; 822 834 [_loadThumbnailsLock unlockWithCondition:0]; 823 835 … … 828 840 829 841 if([file isDirectory]) 830 continue;842 goto next; 831 843 832 844 if([file hasThumbnail]) 833 continue;845 goto next; 834 846 835 847 image = [[NSImage alloc] initWithJPEGFile:[file path] preferredSize:NSMakeSize(128.0, 128.0)]; … … 841 853 [self performSelectorOnMainThread:@selector(fileDidLoadThumbnail:) withObject:file waitUntilDone:YES]; 842 854 } 843 } 844 855 next: 856 if(i % 5 == 0) { 857 [_loadThumbnailsLock lock]; 858 if(counter != _thumbnailsCounter) 859 i = count; 860 [_loadThumbnailsLock unlockWithCondition:0]; 861 } 862 } 863 845 864 [files release]; 846 865 [pool release]; … … 1185 1204 1186 1205 [_loadImageLock lock]; 1187 _ row = [_tableView selectedRow];1206 _selectedRow = [_tableView selectedRow]; 1188 1207 [_loadImageLock unlockWithCondition:1]; 1189 1208 } Footagehead/trunk/FHFileCell.m
r2874 r2875 82 82 83 83 - (void)drawWithFrame:(NSRect)frame inView:(NSView *)view { 84 NSString *name; 85 NSImage *icon; 86 NSRect rect; 84 NSAttributedString *string; 85 NSString *name; 86 NSImage *icon; 87 NSRect rect; 87 88 88 89 name = [(NSDictionary *) [self objectValue] objectForKey:FHFileCellNameKey]; … … 90 91 91 92 rect = NSMakeRect(frame.origin.x, frame.origin.y + frame.size.height - 26.0, frame.size.width, 24.0); 92 [_nameCell setAttributedStringValue:93 [NSAttributedString attributedStringWithString:name attributes:_attributes]];93 string = [[NSAttributedString alloc] initWithString:name attributes:_attributes]; 94 [_nameCell setAttributedStringValue:string]; 94 95 [_nameCell setHighlighted:[self isHighlighted]]; 95 96 [_nameCell drawWithFrame:rect inView:view]; 97 [string release]; 96 98 97 99 rect = NSMakeRect(frame.origin.x, frame.origin.y + 2.0, frame.size.width, frame.size.height - 28.0); Footagehead/trunk/FHImageView.m
r2874 r2875 26 26 27 27 - (void) setImage:(NSImage *)image { 28 BOOL display; 29 30 display = (image != NULL || _image != NULL); 31 28 32 [image retain]; 29 33 [_image release]; … … 31 35 _image = image; 32 36 [_image setScalesWhenResized:YES]; 33 34 [self setNeedsDisplay:YES]; 37 38 if(display) 39 [self setNeedsDisplay:YES]; 35 40 } 36 41 Footagehead/trunk/Footagehead.xcode/project.pbxproj
r2874 r2875 705 705 ); 706 706 buildSettings = { 707 GCC_GENERATE_DEBUGGING_SYMBOLS = NO;708 GCC_MODEL_TUNING = G5;709 707 LIBRARY_STYLE = STATIC; 710 OTHER_CFLAGS = "";711 OTHER_LDFLAGS = "";712 OTHER_REZFLAGS = "";713 PREBINDING = NO;714 708 PRODUCT_NAME = jpeg; 715 SECTORDER_FLAGS = "";716 WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";717 709 }; 718 710 dependencies = ( … … 1492 1484 buildActionMask = 2147483647; 1493 1485 files = ( 1494 8D11072A0486CEB800E47090,1495 1486 8D11072B0486CEB800E47090, 1496 1487 A5E51751057750A70004F5D6, 1497 1488 A5E5174405774ED40004F5D6, 1498 1489 77CDAE72083B3515003BE654, 1490 8D11072A0486CEB800E47090, 1499 1491 A51395F505771ED4007FE220, 1500 1492 A587DF71055AA3C4005D2097,
