Changeset 4706

Show
Ignore:
Timestamp:
04/23/07 18:39:24 (2 years ago)
Author:
morris
Message:

Batch commit of refactoring

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Footagehead/trunk/English.lproj/InfoPlist.strings

    r4369 r4706  
    22CFBundleName = "Footagehead"; 
    33CFBundleShortVersionString = "Footagehead 1.2.2"; 
    4 CFBundleGetInfoString = "Footagehead 1.2.2, Copyright 2003-2006 Zanka Software."; 
    5 NSHumanReadableCopyright = "Copyright 2003-2006 Zanka Software."; 
     4CFBundleGetInfoString = "Footagehead 1.2.2, Copyright 2003-2007 Zanka Software."; 
     5NSHumanReadableCopyright = "Copyright 2003-2007 Zanka Software."; 
  • Footagehead/trunk/English.lproj/MainMenu.nib/classes.nib

    r4465 r4706  
    33        {CLASS = FHBrowserView; LANGUAGE = ObjC; SUPERCLASS = NSMatrix; },  
    44        { 
    5             ACTIONS = { 
    6                 autoSwitch = id;  
    7                 delete = id;  
    8                 firstFile = id;  
    9                 lastFile = id;  
    10                 nextImage = id;  
    11                 nextPage = id;  
    12                 open = id;  
    13                 openFile = id;  
    14                 openMenu = id;  
    15                 openParent = id;  
    16                 openSpotlight = id;  
    17                 openURL = id;  
    18                 previousImage = id;  
    19                 previousPage = id;  
    20                 reload = id;  
    21                 revealInFinder = id;  
    22                 rotateLeft = id;  
    23                 rotateRight = id;  
    24                 setAsDesktopPicture = id;  
    25                 slideshow = id;  
    26                 toggleStatusBar = id;  
    27                 zoom = id;  
    28             };  
    295            CLASS = FHController;  
    306            LANGUAGE = ObjC;  
     
    3410                "_fullscreenImageView" = FHImageView;  
    3511                "_fullscreenPanel" = NSPanel;  
     12                "_goMenu" = NSMenu;  
    3613                "_imageView" = FHImageView;  
    3714                "_leftStatusTextField" = NSTextField;  
     
    6239                "_zoomButton" = NSButton;  
    6340            };  
    64             SUPERCLASS = WIWindowController;  
     41            SUPERCLASS = NSObject;  
    6542        },  
    6643        { 
     
    7754        },  
    7855        { 
    79             ACTIONS = {cancelSheet = id; submitSheet = id; };  
     56            ACTIONS = { 
     57                cancelSheet = id;  
     58                go = id;  
     59                moveToTrash = id;  
     60                open = id;  
     61                openParent = id;  
     62                openSpotlight = id;  
     63                openURL = id;  
     64                reload = id;  
     65                revealInFinder = id;  
     66                rotateLeft = id;  
     67                rotateRight = id;  
     68                setAsDesktopBackground = id;  
     69                submitSheet = id;  
     70                toggleStatusBar = id;  
     71                zoomMode = id;  
     72                zoomToFit = id;  
     73            };  
    8074            CLASS = FirstResponder;  
    8175            LANGUAGE = ObjC;  
  • Footagehead/trunk/English.lproj/MainMenu.nib/info.nib

    r4705 r4706  
    44<dict> 
    55        <key>IBDocumentLocation</key> 
    6         <string>860 245 395 374 0 0 1920 1178 </string> 
     6        <string>838 346 395 374 0 0 1920 1178 </string> 
    77        <key>IBEditorPositions</key> 
    88        <dict> 
    99                <key>29</key> 
    10                 <string>854 978 365 44 0 0 1920 1178 </string> 
    11                 <key>592</key> 
    12                 <string>118 501 223 118 0 0 1280 1002 </string> 
     10                <string>854 977 400 44 0 0 1920 1178 </string> 
    1311        </dict> 
    1412        <key>IBFramework Version</key> 
     
    1816        <key>IBOpenObjects</key> 
    1917        <array> 
    20                 <integer>21</integer> 
    21                 <integer>302</integer> 
    2218                <integer>29</integer> 
    2319        </array> 
    2420        <key>IBSystem Version</key> 
    25         <string>8L2127</string> 
     21        <string>8P135</string> 
    2622</dict> 
    2723</plist> 
  • Footagehead/trunk/English.lproj/ReleaseNotes.rtf

    r4465 r4706  
    486486\f1\b0\fs24 \cf0 \ 
    487487\ 
    488 Copyright \'a9 2003-2006 Axel Andersson\ 
     488Copyright \'a9 2003-2007 Axel Andersson\ 
    489489All rights reserved.\ 
    490490\ 
  • Footagehead/trunk/English.lproj/Window.nib/classes.nib

    r4705 r4706  
    2020        },  
    2121        { 
     22            ACTIONS = { 
     23                firstFile = id;  
     24                lastFile = id;  
     25                nextImage = id;  
     26                nextPage = id;  
     27                openDirectory = id;  
     28                openFile = id;  
     29                openParent = id;  
     30                previousImage = id;  
     31                previousPage = id;  
     32            };  
    2233            CLASS = FHWindowController;  
    2334            LANGUAGE = ObjC;  
    2435            OUTLETS = { 
     36                "_contentBox" = NSBox;  
    2537                "_fileTableColumn" = NSTableColumn;  
    2638                "_imageView" = FHImageView;  
     39                "_leftStatusTextField" = NSTextField;  
    2740                "_leftView" = NSView;  
    28                 "_progressIndicator" = NSProgressIndicator;  
     41                "_openSpotlightPanel" = NSPanel;  
     42                "_openSpotlightTextView" = NSTextView;  
     43                "_openURLPanel" = NSPanel;  
     44                "_openURLPopUpButton" = NSPopUpButton;  
     45                "_openURLTextView" = NSTextView;  
     46                "_rightStatusTextField" = NSTextField;  
    2947                "_rightView" = NSView;  
    3048                "_scrollView" = NSScrollView;  
    3149                "_splitView" = WISplitView;  
     50                "_statusBox" = NSBox;  
    3251                "_tableView" = FHTableView;  
    3352            };  
     
    3958            LANGUAGE = ObjC;  
    4059            SUPERCLASS = NSObject;  
     60        },  
     61        { 
     62            ACTIONS = {cancelSheet = id; submitSheet = id; };  
     63            CLASS = NSWindowController;  
     64            LANGUAGE = ObjC;  
     65            SUPERCLASS = NSResponder;  
    4166        },  
    4267        {CLASS = WISplitView; LANGUAGE = ObjC; SUPERCLASS = NSSplitView; },  
  • Footagehead/trunk/English.lproj/Window.nib/info.nib

    r4705 r4706  
    44<dict> 
    55        <key>IBDocumentLocation</key> 
    6         <string>1019 123 403 407 0 0 1920 1178 </string> 
     6        <string>1063 138 403 407 0 0 1920 1178 </string> 
    77        <key>IBEditorPositions</key> 
    88        <dict> 
     
    1515        <array> 
    1616                <integer>7</integer> 
     17                <integer>52</integer> 
     18                <integer>82</integer> 
    1719        </array> 
    1820        <key>IBSystem Version</key> 
    19         <string>8P2137</string> 
     21        <string>8P135</string> 
    2022</dict> 
    2123</plist> 
  • Footagehead/trunk/FHCache.h

    r3400 r4706  
    22 
    33/* 
    4  *  Copyright (c) 2003-2005 Axel Andersson 
     4 *  Copyright (c) 2003-2007 Axel Andersson 
    55 *  All rights reserved. 
    66 *  
  • Footagehead/trunk/FHCache.m

    r3400 r4706  
    22 
    33/* 
    4  *  Copyright (c) 2003-2005 Axel Andersson 
     4 *  Copyright (c) 2003-2007 Axel Andersson 
    55 *  All rights reserved. 
    66 *  
     
    6262        [_fileIcons release]; 
    6363        [_largeFileIcons release]; 
     64        [_thumbnails release]; 
    6465         
    6566        [super dealloc]; 
  • Footagehead/trunk/FHController.h

    r4704 r4706  
    22 
    33/* 
    4  *  Copyright (c) 2003-2005 Axel Andersson 
     4 *  Copyright (c) 2003-2007 Axel Andersson 
    55 *  All rights reserved. 
    66 *  
     
    3131@class FHHandler, FHFile; 
    3232 
    33 @interface FHController : WIWindowController
     33@interface FHController : NSObject
    3434        IBOutlet NSMenuItem                             *_openSpotlightMenuItem; 
    35          
     35 
     36        IBOutlet NSMenu                                 *_goMenu; 
     37 
    3638        IBOutlet NSMenu                                 *_viewMenu; 
    3739        IBOutlet NSMenuItem                             *_toggleStatusBarMenuItem; 
     
    9597        BOOL                                                    _deletingFile; 
    9698        unsigned int                                    _spinners; 
    97         unsigned int                                    _menuItems; 
     99         
     100        NSUInteger                                              _menuItems, _initialMenuItems; 
    98101} 
    99102 
    100103 
    101 + (FHController *)controller; 
     104//- (IBAction)open:(id)sender; 
     105//- (IBAction)openURL:(id)sender; 
     106//- (IBAction)openSpotlight:(id)sender; 
    102107 
    103 - (IBAction)open:(id)sender; 
    104 - (IBAction)openURL:(id)sender; 
    105 - (IBAction)openSpotlight:(id)sender; 
    106 - (IBAction)openParent:(id)sender; 
    107 - (IBAction)openMenu:(id)sender; 
     108/*- (IBAction)openMenu:(id)sender; 
    108109- (IBAction)openFile:(id)sender; 
    109110- (IBAction)firstFile:(id)sender; 
     
    113114- (IBAction)previousPage:(id)sender; 
    114115- (IBAction)nextPage:(id)sender; 
    115 - (IBAction)reload:(id)sender; 
    116 - (IBAction)zoom:(id)sender; 
    117 - (IBAction)rotateRight:(id)sender; 
    118 - (IBAction)rotateLeft:(id)sender; 
    119116- (IBAction)slideshow:(id)sender; 
    120117- (IBAction)autoSwitch:(id)sender; 
    121 - (IBAction)revealInFinder:(id)sender; 
    122 - (IBAction)setAsDesktopPicture:(id)sender; 
    123 - (IBAction)delete:(id)sender; 
    124 - (IBAction)toggleStatusBar:(id)sender; 
    125  
     118*/ 
    126119@end 
  • Footagehead/trunk/FHController.m

    r4705 r4706  
    22 
    33/* 
    4  *  Copyright (c) 2003-2005 Axel Andersson 
     4 *  Copyright (c) 2003-2007 Axel Andersson 
    55 *  All rights reserved. 
    66 *  
     
    3737#import "FHImageView.h" 
    3838#import "FHSettings.h" 
    39  
    40  
    4139#import "FHWindowController.h" 
    4240 
    43 #define FHUnloadImageCount                      5 
    44 #define FHPreloadImageCount                     10 
    45  
    46 static FHController                                     *sharedController; 
    47  
    48  
    4941@interface FHController(Private) 
    5042 
    51 - (void)_selectFileAtIndex:(unsigned int)index; 
    52 - (FHFile *)_selectedFile; 
    53 - (FHFile *)_fileAtIndex:(unsigned int)index; 
    54  
    55 - (void)_loadURL:(WIURL *)url; 
    56 - (void)_loadURL:(WIURL *)url selectRow:(int)row; 
    57 - (void)_loadURL:(WIURL *)url selectFile:(NSString *)file; 
    58 - (void)_loadURL:(WIURL *)url selectRow:(int)row file:(NSString *)file; 
    59 - (void)_reloadURL:(WIURL *)url; 
    60 - (void)_loadFile:(FHFile *)file; 
    61  
    62 - (void)_addMenuItemWithPath:(NSString *)path keyEquivalent:(NSString *)keyEquivalent; 
    63 - (void)_reloadVolumesMenu; 
    64 - (void)_reloadPathMenu; 
     43- (void)_buildGoMenu; 
     44- (void)_reloadVolumesInGoMenu; 
     45- (void)_addGoMenuItemWithPath:(NSString *)path keyEquivalent:(NSString *)keyEquivalent; 
     46- (void)_reloadPathsInGoMenuForHandler:(FHHandler *)handler; 
     47 
    6548- (void)_reloadScreens; 
    6649- (void)_reloadScreenBackgrounds; 
     
    6851- (void)_startSpinning; 
    6952- (void)_stopSpinning; 
    70 - (void)_updateImage; 
    71 - (void)_updateButtons; 
    72 - (void)_updateStatus; 
    73 - (void)_updateLeftStatus; 
    74 - (void)_updateRightStatus; 
    7553- (void)_updateFullscreenStatus; 
    76 - (void)_updateTableView; 
    7754 
    7855- (NSToolbar *)_toolbar; 
    7956 
    80 - (void)_toggleStatusBar:(BOOL)show; 
    81  
    8257@end 
    8358 
     
    8560@implementation FHController(Private) 
    8661 
    87 - (void)_selectFileAtIndex:(unsigned int)index { 
    88         [_loadImageTimer setFireDate:[NSDate distantFuture]]; 
    89         [_tableView selectRow:index byExtendingSelection:NO]; 
    90         [_tableView scrollRowToVisible:index]; 
    91 
    92  
    93  
    94  
    95 - (FHFile *)_selectedFile { 
    96         int             row; 
    97          
    98         row = [_tableView selectedRow]; 
    99          
    100         if(row < 0) 
    101                 return NULL; 
    102          
    103         return [self _fileAtIndex:row]; 
    104 
    105  
    106  
    107  
    108 - (FHFile *)_fileAtIndex:(NSUInteger)index { 
    109         return [[_handler files] objectAtIndex:index]; 
     62- (void)_buildGoMenu { 
     63        _initialMenuItems = [_goMenu numberOfItems]; 
     64         
     65        [self _reloadVolumesInGoMenu]; 
     66 
     67        [self _addGoMenuItemWithPath:@"~" keyEquivalent:@"H"]; 
     68        [self _addGoMenuItemWithPath:@"~/Desktop" keyEquivalent:@"d"]; 
     69        [self _addGoMenuItemWithPath:@"~/Pictures" keyEquivalent:@"P"]; 
     70         
     71        [_goMenu addItem:[NSMenuItem separatorItem]]; 
     72        _menuItems++; 
     73
     74 
     75 
     76 
     77- (void)_reloadVolumesInGoMenu { 
     78        NSEnumerator    *enumerator; 
     79        NSMenuItem              *item; 
     80        NSString                *volume, *path; 
     81        NSImage                 *icon; 
     82        NSUInteger              i = _initialMenuItems; 
     83         
     84        if((NSUInteger) [_goMenu numberOfItems] > _initialMenuItems) { 
     85                while(![[_goMenu itemAtIndex:_initialMenuItems] isSeparatorItem]) { 
     86                        [_goMenu removeItemAtIndex:_initialMenuItems]; 
     87                        _menuItems--; 
     88                } 
     89        } 
     90         
     91        enumerator = [[[NSFileManager defaultManager] directoryContentsAtPath:@"/Volumes/"] objectEnumerator]; 
     92         
     93        while((volume = [enumerator nextObject])) { 
     94                if([volume hasPrefix:@"."]) 
     95                        continue; 
     96                 
     97                path = [NSSWF:@"/Volumes/%@", volume]; 
     98                icon = [[NSWorkspace sharedWorkspace] iconForFile:path]; 
     99                [icon setSize:NSMakeSize(16.0, 16.0)]; 
     100 
     101                item = [NSMenuItem itemWithTitle:[[NSFileManager defaultManager] displayNameAtPath:path] 
     102                                                                  action:@selector(go:)]; 
     103                [item setImage:icon]; 
     104                [item setRepresentedObject:[WIURL fileURLWithPath:path]]; 
     105                [_goMenu insertItem:item atIndex:i]; 
     106                _menuItems++; 
     107                i++; 
     108        } 
     109         
     110        if(i == (NSUInteger) [_goMenu numberOfItems] || ![[_goMenu itemAtIndex:i] isSeparatorItem]) { 
     111                [_goMenu insertItem:[NSMenuItem separatorItem] atIndex:i]; 
     112                _menuItems++; 
     113        } 
     114
     115 
     116 
     117 
     118- (void)_addGoMenuItemWithPath:(NSString *)path keyEquivalent:(NSString *)keyEquivalent { 
     119        NSMenuItem      *item; 
     120        NSImage         *icon; 
     121         
     122        path = [path stringByStandardizingPath]; 
     123        icon = [[NSWorkspace sharedWorkspace] iconForFile:path]; 
     124        [icon setSize:NSMakeSize(16.0, 16.0)]; 
     125 
     126        item = [NSMenuItem itemWithTitle:[[NSFileManager defaultManager] displayNameAtPath:path] 
     127                                                          action:@selector(go:) 
     128                                           keyEquivalent:keyEquivalent]; 
     129 
     130        [item setImage:icon]; 
     131        [item setRepresentedObject:[WIURL fileURLWithPath:path]]; 
     132        [_goMenu addItem:item]; 
     133 
     134        _menuItems++; 
     135
     136 
     137 
     138 
     139- (void)_reloadPathsInGoMenuForHandler:(FHHandler *)handler { 
     140        NSArray                 *stringComponents, *urlComponents; 
     141        NSMenuItem              *item; 
     142        NSImage                 *icon; 
     143        NSString                *name; 
     144        WIURL                   *url; 
     145        NSUInteger              i, count, items; 
     146         
     147        stringComponents        = [handler stringComponents]; 
     148        urlComponents           = [handler URLComponents]; 
     149        count                           = [stringComponents count]; 
     150        items                           = [_goMenu numberOfItems]; 
     151         
     152        for(i = 0; i < count; i++) { 
     153                if(_menuItems + i + _initialMenuItems < items) { 
     154                        name = [[_goMenu itemAtIndex:i + _menuItems + _initialMenuItems] title]; 
     155                         
     156                        if([name isEqualToString:[stringComponents objectAtIndex:i]]) 
     157                                continue; 
     158                         
     159                        [_goMenu removeItemAtIndex:_menuItems + i + _initialMenuItems]; 
     160                        items--; 
     161                } 
     162                 
     163                url = [urlComponents objectAtIndex:i]; 
     164 
     165                item = [NSMenuItem itemWithTitle:[stringComponents objectAtIndex:i] 
     166                                                                  action:@selector(go:)]; 
     167                [item setRepresentedObject:url]; 
     168                 
     169                icon = [handler iconForURL:url]; 
     170                 
     171                if(icon) { 
     172                        [icon setSize:NSMakeSize(16.0, 16.0)]; 
     173                        [item setImage:icon]; 
     174                } 
     175                         
     176                [_goMenu insertItem:item atIndex:_menuItems + i + _initialMenuItems]; 
     177                items++; 
     178        } 
     179         
     180        while(items > _menuItems + count + _initialMenuItems) { 
     181                [_goMenu removeItemAtIndex:_menuItems + count + _initialMenuItems]; 
     182                 
     183                items--; 
     184        } 
    110185} 
    111186 
     
    113188 
    114189#pragma mark - 
    115  
    116 - (void)_loadURL:(WIURL *)url { 
    117         [self _loadURL:url selectRow:0 file:NULL]; 
    118 } 
    119  
    120  
    121  
    122 - (void)_loadURL:(WIURL *)url selectRow:(int)row { 
    123         [self _loadURL:url selectRow:row file:NULL]; 
    124 } 
    125  
    126  
    127  
    128 - (void)_loadURL:(WIURL *)url selectFile:(NSString *)file { 
    129         [self _loadURL:url selectRow:0 file:file]; 
    130 } 
    131  
    132  
    133  
    134 - (void)_loadURL:(WIURL *)url selectRow:(int)row file:(NSString *)file { 
    135         NSArray                 *files; 
    136         FHHandler               *handler; 
    137         unsigned int    i, count; 
    138         BOOL                    select; 
    139          
    140         [self _startSpinning]; 
    141          
    142         _switchingURL = YES; 
    143  
    144         handler = [[FHHandler alloc] initHandlerWithURL:url]; 
    145          
    146         if(!handler) { 
    147                 [self _stopSpinning]; 
    148                  
    149                 return; 
    150         } 
    151  
    152         if(_handler) { 
    153                 if(![_handler isSynchronous] && ![_handler isFinished]) 
    154                         [self _stopSpinning]; 
    155                  
    156                 if([_handler isLocal]) 
    157                         [_queue removePath:[[_handler URL] path]]; 
    158                  
    159                 [_handler release]; 
    160         } 
    161          
    162         _handler = handler; 
    163         [_handler setDelegate:self]; 
    164         files = [_handler files]; 
    165          
    166         if([_handler isLocal]) 
    167                 [_queue addPath:[[_handler URL] path] forMode:WIEventFileWrite]; 
    168          
    169         [self _updateLeftStatus]; 
    170         [self _updateButtons]; 
    171         [self _reloadPathMenu]; 
    172          
    173         if(file) { 
    174                 for(i = 0, count = [files count]; i < count; i++) { 
    175                         if([[[files objectAtIndex:i] name] isEqualToString:file]) { 
    176                                 row = i; 
    177                                  
    178                                 break; 
    179                         } 
    180                 } 
    181         } 
    182          
    183         select = (row != [_tableView selectedRow]); 
    184         [_tableView reloadData]; 
    185          
    186         if(select) { 
    187                 [_tableView selectRow:row byExtendingSelection:NO]; 
    188         } else { 
    189                 [_loadImageLock lock]; 
    190                 _selectedRow = row; 
    191                 _imageCounter++; 
    192                 [_loadImageLock unlockWithCondition:1]; 
    193         } 
    194  
    195         [_tableView scrollRowToVisible:row]; 
    196  
    197         if([_handler isLocal]) { 
    198                 [_loadThumbnailsLock lock]; 
    199                 _thumbnailsCounter++; 
    200                 [_loadThumbnailsLock unlockWithCondition:1]; 
    201         } 
    202  
    203         _switchingURL = NO; 
    204  
    205         if([_handler isSynchronous]) 
    206                 [self _stopSpinning]; 
    207 } 
    208  
    209  
    210  
    211 - (void)_reloadURL:(WIURL *)url { 
    212         NSString        *file; 
    213          
    214         file = [[[self _selectedFile] name] retain]; 
    215         [[FHCache cache] dropThumbnailsForURL:url]; 
    216         [self _loadURL:url selectFile:file]; 
    217         [file release]; 
    218 } 
    219  
    220  
    221  
    222 - (void)_loadFile:(FHFile *)file { 
    223         if([file isLoaded]) { 
    224                 [self performSelector:@selector(_fileDidLoadImage:) withObject:file]; 
    225         } else { 
    226                 [_imageView setImage:NULL]; 
    227                 [self _updateRightStatus]; 
    228         } 
    229 } 
    230  
    231  
    232190 
    233191- (void)_loadFileTimer:(NSTimer *)timer { 
     
    236194        BOOL            next = NO; 
    237195         
    238       [self nextImage:self]; 
     196//    [self nextImage:self]; 
    239197         
    240198        i = [_tableView selectedRow]; 
     
    256214 
    257215 
    258 - (void)_loadImageThread:(id)arg { 
    259         NSAutoreleasePool   *pool; 
    260         NSArray                         *files; 
    261         FHImage                         *image; 
    262         FHFile                          *file; 
    263         unsigned int            i, count, counter, images, row, lastRow, lastCounter; 
    264          
    265         lastRow = lastCounter = 0; 
    266          
    267         while(YES) { 
    268                 pool = [[NSAutoreleasePool alloc] init]; 
    269  
    270                 [_loadImageLock lockWhenCondition:1]; 
    271                 row = _selectedRow; 
    272                 files = [[_handler files] copy]; 
    273                 counter = _imageCounter; 
    274                 [_loadImageLock unlockWithCondition:0]; 
    275                  
    276                 if(counter != lastCounter) { 
    277                         count = [files count]; 
    278                          
    279                         // --- purge all but the last couple of images 
    280                         if(row > FHUnloadImageCount) { 
    281                                 for(i = 0; i < count && i < row - FHUnloadImageCount; i++) { 
    282                                         file = [files objectAtIndex:i]; 
    283                                          
    284                                         if([file isDirectory]) 
    285                                                 continue; 
    286                                          
    287                                         if(![file isLoaded]) 
    288                                                 continue; 
    289                                          
    290                                         [file setImage:NULL]; 
    291                                         [file setLoaded:NO]; 
    292                                 } 
    293                         } 
    294                          
    295                         // --- load the next couple of images 
    296                         for(i = row, images = 0; i < count; i++) { 
    297                                 file = [files objectAtIndex:i]; 
    298                                  
    299                                 if([file isDirectory]) 
    300                                         goto next; 
    301                                  
    302                                 if(++images > FHPreloadImageCount) 
    303                                         break; 
    304                                  
    305                                 if([file image]) 
    306                                         goto next; 
    307                                  
    308                                 image = [[FHImage alloc] initImageWithURL:[file URL]]; 
    309                                 [file setImage:image]; 
    310                                 [file setLoaded:YES]; 
    311                                 [image release]; 
    312                                  
    313                                 [self performSelectorOnMainThread:@selector(_fileDidLoadImage:) withObject:file waitUntilDone:YES]; 
    314  
    315 next: 
    316                                 [_loadImageLock lock]; 
    317                                 if(counter != _imageCounter) 
    318                                         i = count; 
    319                                 [_loadImageLock unlockWithCondition:counter == _imageCounter ? 0 : 1]; 
    320                         } 
    321                          
    322                         lastRow = row; 
    323                         lastCounter = counter; 
    324                 } 
    325  
    326                 [files release]; 
    327                 [pool release]; 
    328         } 
    329 } 
    330  
    331  
    332  
    333 - (void)_loadThumbnailsThread:(id)arg { 
    334         NSAutoreleasePool       *pool; 
    335         NSArray                         *files; 
    336         FHImage                         *image; 
    337         FHFile                          *file; 
    338         WIURL                           *url; 
    339         unsigned int            i, count, counter, images; 
    340          
    341         [NSThread setThreadPriority:0.25]; 
    342  
    343         while(YES) { 
    344                 pool = [[NSAutoreleasePool alloc] init]; 
    345  
    346                 [_loadThumbnailsLock lockWhenCondition:1]; 
    347                 files = [[_handler files] copy]; 
    348                 counter = _thumbnailsCounter; 
    349                 [_loadThumbnailsLock unlockWithCondition:0]; 
    350                  
    351                 count = [files count]; 
    352  
    353                 for(i = images = 0; i < count; i++) { 
    354                         file = [files objectAtIndex:i]; 
    355                          
    356                         if([file isDirectory] || [file thumbnail]) 
    357                                 goto next; 
    358                          
    359                         url = [file URL]; 
    360                          
    361                         if(![url isFileURL]) 
    362                                 goto next; 
    363                          
    364                         image = [[FHCache cache] thumbnailForURL:url]; 
    365                          
    366                         if(!image) { 
    367                                 image = [[FHImage alloc] initThumbnailWithURL:url preferredSize:NSMakeSize(128.0, 128.0)]; 
    368                                  
    369                                 if(image) 
    370                                         [[FHCache cache] setThumbnail:image forURL:url]; 
    371                         } 
    372                          
    373                         if(image) { 
    374                                 [file setThumbnail:image]; 
    375                                 [image release]; 
    376                          
    377                                 [self performSelectorOnMainThread:@selector(_fileDidLoadThumbnail:) withObject:file waitUntilDone:YES]; 
    378                         } 
    379                          
    380 next: 
    381                         if(++images % 5 == 0) { 
    382                                 [_loadThumbnailsLock lock]; 
    383                                 if(counter != _thumbnailsCounter) 
    384                                         i = count; 
    385                                 [_loadThumbnailsLock unlockWithCondition:counter == _thumbnailsCounter ? 0 : 1]; 
    386                         } 
    387                 } 
    388                          
    389                 [files release]; 
    390                 [pool release]; 
    391         } 
    392 } 
    393  
    394  
    395  
    396 - (void)_fileDidLoadImage:(FHFile *)file { 
    397         FHImage         *image; 
    398         BOOL            success; 
    399          
    400         image = [file image]; 
    401         success = (image && [image size].width > 0.0); 
    402          
    403         if([file isEqual:[self _sele