Changeset 901

Show
Ignore:
Timestamp:
12/03/04 13:32:51 (4 years ago)
Author:
morris
Message:

frist stab at 1.2 (no visible changes):

- links with ZankaAdditions?
- use a table view instead of a browser
- FHHandler is a proper class cluster
- Shark optimizations

Files:

Legend:

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

    r867 r901  
    22 
    33CFBundleName = "Footagehead"; 
    4 CFBundleShortVersionString = "Footagehead 1.1"; 
    5 CFBundleGetInfoString = "Footagehead 1.1, Copyright 2003-2004 Zanka Software."; 
     4CFBundleShortVersionString = "Footagehead 1.2"; 
     5CFBundleGetInfoString = "Footagehead 1.2, Copyright 2003-2004 Zanka Software."; 
    66NSHumanReadableCopyright = "Copyright 2003-2004 Zanka Software."; 
  • Footagehead/trunk/English.lproj/Localizable.strings

    r867 r901  
    1616/* No comment provided by engineer. */ 
    1717"Screen %u, %.0fx%.0f" = "Screen %u, %.0fx%.0f"; 
     18 
  • Footagehead/trunk/English.lproj/MainMenu.nib/classes.nib

    r887 r901  
    44        { 
    55            ACTIONS = { 
    6                 cancelSheet = id;  
    76                delete = id;  
    87                open = id;  
     8                openFile = id;  
    99                openMenu = id;  
    1010                openParent = id;  
     
    1414                slideshow = id;  
    1515                slideshowButtons = id;  
    16                 submitSheet = id;  
    1716            };  
    1817            CLASS = FHController;  
    1918            LANGUAGE = ObjC;  
    2019            OUTLETS = { 
    21                 "_browserScrollView" = NSScrollView;  
    22                 "_browserView" = FHBrowserView;  
     20                "_fileTableColumn" = NSTableColumn;  
    2321                "_fullscreenImageView" = FHImageView;  
    2422                "_fullscreenPanel" = NSPanel;  
    25                 "_imageScrollView" = NSScrollView;  
    2623                "_imageView" = NSImageView;  
    2724                "_leftStatusTextField" = NSTextField;  
     25                "_leftView" = NSScrollView;  
    2826                "_menu" = NSPopUpButton;  
    2927                "_moveToTrashButton" = NSButton;  
     
    3432                "_revealInFinderButton" = NSButton;  
    3533                "_rightStatusTextField" = NSTextField;  
     34                "_rightView" = NSScrollView;  
    3635                "_screenAutoSwitchButton" = NSButton;  
    3736                "_screenAutoSwitchTextField" = NSTextField;  
    3837                "_screenPanel" = NSPanel;  
    3938                "_screenPopUpButton" = NSPopUpButton;  
    40                 "_splitView" = FHSplitView;  
     39                "_splitView" = ZASplitView;  
     40                "_tableView" = ZATableView;  
    4141            };  
    42             SUPERCLASS = NSWindowController;  
     42            SUPERCLASS = ZAWindowController;  
    4343        },  
    4444        {CLASS = FHImageView; LANGUAGE = ObjC; SUPERCLASS = NSImageView; },  
    45         {CLASS = FHSplitView; LANGUAGE = ObjC; SUPERCLASS = NSSplitView; },  
    46         {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 
     45        { 
     46            ACTIONS = {cancelSheet = id; submitSheet = id; };  
     47            CLASS = FirstResponder;  
     48            LANGUAGE = ObjC;  
     49            SUPERCLASS = NSObject;  
     50        },  
     51        {CLASS = NSObject; LANGUAGE = ObjC; },  
     52        {CLASS = ZASplitView; LANGUAGE = ObjC; SUPERCLASS = NSSplitView; },  
     53        { 
     54            ACTIONS = {showViewOptions = id; };  
     55            CLASS = ZATableView;  
     56            LANGUAGE = ObjC;  
     57            SUPERCLASS = NSTableView;  
     58        },  
     59        { 
     60            CLASS = ZAWindowController;  
     61            LANGUAGE = ObjC;  
     62            SUPERCLASS = NSWindowController;  
     63        } 
    4764    );  
    4865    IBVersion = 1;  
  • Footagehead/trunk/English.lproj/MainMenu.nib/info.nib

    r887 r901  
    44<dict> 
    55        <key>IBDocumentLocation</key> 
    6         <string>349 217 395 374 0 0 1280 1002 </string> 
     6        <string>894 604 395 374 0 0 1680 1028 </string> 
    77        <key>IBEditorPositions</key> 
    88        <dict> 
    99                <key>29</key> 
    10                 <string>423 630 256 44 0 0 1280 1002 </string> 
     10                <string>588 647 256 44 0 0 1680 1028 </string> 
    1111        </dict> 
    1212        <key>IBFramework Version</key> 
     
    1616        <key>IBOpenObjects</key> 
    1717        <array> 
     18                <integer>438</integer> 
     19                <integer>302</integer> 
     20                <integer>29</integer> 
    1821                <integer>21</integer> 
    19                 <integer>29</integer> 
    2022        </array> 
    2123        <key>IBSystem Version</key> 
    22         <string>7H63</string> 
     24        <string>7R28</string> 
    2325</dict> 
    2426</plist> 
  • Footagehead/trunk/FHCache.h

    r866 r901  
    1 /* $Id: FHCache.h,v 1.1 2004/06/14 23:36:06 morris Exp $ */ 
     1/* $Id: FHCache.h,v 1.2 2004/12/03 12:29:49 morris Exp $ */ 
    22 
    33/* 
     
    2727 */ 
    2828 
    29 @interface FHCache : NSObject 
     29@interface FHCache : NSObject { 
     30        NSImage                                         *_directoryIcon; 
     31        NSMutableDictionary                     *_fileIcons; 
     32        NSMutableDictionary                     *_images; 
     33        NSMutableArray                          *_temporaryPaths; 
     34         
     35        NSRecursiveLock                         *_lock; 
     36
    3037 
    3138 
    32 + (NSImage *)                                  directoryIcon
     39+ (FHCache *)                                  cache
    3340 
    34 + (void)                                                setFileIcon:(NSImage *)icon forExtension:(NSString *)extension; 
    35 + (NSImage *)                                   fileIconForExtension:(NSString *)extension; 
     41- (NSImage *)                                   directoryIcon; 
    3642 
    37 + (void)                                               setFileIcon:(NSImage *)icon forPath:(NSString *)extension; 
    38 + (NSImage *)                                  fileIconForPath:(NSString *)path
     43- (void)                                               setFileIcon:(NSImage *)icon forExtension:(NSString *)extension; 
     44- (NSImage *)                                  fileIconForExtension:(NSString *)extension
    3945 
    40 + (void)                                               setImage:(NSImage *)image forURL:(NSURL *)url
    41 + (NSImage *)                                  imageForURL:(NSURL *)url
     46- (void)                                               setFileIcon:(NSImage *)icon forPath:(NSString *)extension
     47- (NSImage *)                                  fileIconForPath:(NSString *)path
    4248 
    43 + (void)                                                addTemporaryPath:(NSString *)path; 
    44 + (void)                                                purgeTemporaryPaths; 
     49- (void)                                                setImage:(NSImage *)image forURL:(NSURL *)url; 
     50- (NSImage *)                                   imageForURL:(NSURL *)url; 
     51 
     52- (void)                                                addTemporaryPath:(NSString *)path; 
     53- (void)                                                purgeTemporaryPaths; 
    4554 
    4655@end 
  • Footagehead/trunk/FHCache.m

    r869 r901  
    1 /* $Id: FHCache.m,v 1.2 2004/06/16 12:56:17 morris Exp $ */ 
     1/* $Id: FHCache.m,v 1.3 2004/12/03 12:29:49 morris Exp $ */ 
    22 
    33/* 
     
    2929#import "FHCache.h" 
    3030 
    31 static NSImage                                          *directoryIcon; 
    32 static NSMutableDictionary                      *fileIcons; 
    33 static NSMutableDictionary                      *images; 
    34 static NSMutableArray                           *temporaryPaths; 
     31@implementation FHCache 
     32 
     33+ (FHCache *)cache { 
     34        static FHCache          *sharedCache; 
     35         
     36        if(!sharedCache) 
     37                sharedCache = [[self alloc] init]; 
     38         
     39        return sharedCache; 
     40
    3541 
    3642 
    37 @implementation FHCache 
    3843 
    3944- (id)init { 
    4045        self = [super init]; 
    4146         
    42         // --- init directory icon 
    43         directoryIcon = [[[NSWorkspace sharedWorkspace] iconForFile:@"/tmp"] retain]; 
    44         [directoryIcon setSize:NSMakeSize(128, 128)]; 
     47        _directoryIcon = [[[NSWorkspace sharedWorkspace] iconForFile:@"/tmp"] retain]; 
     48        [_directoryIcon setSize:NSMakeSize(128, 128)]; 
    4549         
    46         // --- init dictionaries to hold our caches 
    47         fileIcons = [[NSMutableDictionary alloc] initWithCapacity:100]; 
    48         images = [[NSMutableDictionary alloc] initWithCapacity:5]; 
    49         temporaryPaths = [[NSMutableArray alloc] initWithCapacity:10]; 
     50        _fileIcons = [[NSMutableDictionary alloc] initWithCapacity:100]; 
     51        _images = [[NSMutableDictionary alloc] initWithCapacity:5]; 
     52        _temporaryPaths = [[NSMutableArray alloc] initWithCapacity:10]; 
     53         
     54        _lock = [[NSRecursiveLock alloc] init]; 
    5055         
    5156        return self; 
     
    5560 
    5661- (void)dealloc { 
    57         [directoryIcon release]; 
    58         [fileIcons release]; 
    59         [images release]; 
    60         [temporaryPaths release]; 
     62        [_directoryIcon release]; 
     63        [_fileIcons release]; 
     64        [_images release]; 
     65        [_temporaryPaths release]; 
     66         
     67        [_lock release]; 
    6168         
    6269        [super dealloc]; 
     
    6774#pragma mark - 
    6875 
    69 + (NSImage *)directoryIcon { 
    70         return directoryIcon; 
     76- (NSImage *)directoryIcon { 
     77        return _directoryIcon; 
    7178} 
    7279 
     
    7582#pragma mark - 
    7683 
    77 + (void)setFileIcon:(NSImage *)icon forExtension:(NSString *)extension { 
    78         if([fileIcons count] > 100) 
    79                 [fileIcons removeObjectForKey:[[fileIcons allKeys] objectAtIndex:0]]; 
     84- (void)setFileIcon:(NSImage *)icon forExtension:(NSString *)extension { 
     85        [_lock lock]; 
    8086         
    81         [fileIcons setObject:icon forKey:extension]; 
     87        if([_fileIcons count] > 100) 
     88                [_fileIcons removeObjectForKey:[[_fileIcons allKeys] objectAtIndex:0]]; 
     89         
     90        [_fileIcons setObject:icon forKey:extension]; 
     91 
     92        [_lock unlock]; 
    8293} 
    8394 
    8495 
    8596 
    86 + (NSImage *)fileIconForExtension:(NSString *)extension { 
    87         return [fileIcons objectForKey:extension]; 
     97- (NSImage *)fileIconForExtension:(NSString *)extension { 
     98        NSImage         *image; 
     99         
     100        [_lock lock]; 
     101        image = [_fileIcons objectForKey:extension]; 
     102        [_lock unlock]; 
     103         
     104        return image; 
    88105} 
    89106 
     
    92109#pragma mark - 
    93110 
    94 + (void)setFileIcon:(NSImage *)icon forPath:(NSString *)path { 
    95         if([fileIcons count] > 100) 
    96                 [fileIcons removeObjectForKey:[[fileIcons allKeys] objectAtIndex:0]]; 
     111- (void)setFileIcon:(NSImage *)icon forPath:(NSString *)path { 
     112        [_lock lock]; 
    97113         
    98         [fileIcons setObject:icon forKey:path]; 
     114        if([_fileIcons count] > 100) 
     115                [_fileIcons removeObjectForKey:[[_fileIcons allKeys] objectAtIndex:0]]; 
     116         
     117        [_fileIcons setObject:icon forKey:path]; 
     118         
     119        [_lock unlock]; 
    99120} 
    100121 
    101122 
    102123 
    103 + (NSImage *)fileIconForPath:(NSString *)path { 
    104         return [fileIcons objectForKey:path]; 
     124- (NSImage *)fileIconForPath:(NSString *)path { 
     125        NSImage         *image; 
     126         
     127        [_lock lock]; 
     128        image = [_fileIcons objectForKey:path]; 
     129        [_lock unlock]; 
     130         
     131        return image; 
    105132} 
    106133 
     
    109136#pragma mark - 
    110137 
    111 + (void)setImage:(NSImage *)image forURL:(NSURL *)url { 
     138- (void)setImage:(NSImage *)image forURL:(NSURL *)url { 
     139        [_lock lock]; 
     140         
    112141        if(!image) { 
    113                 [images removeObjectForKey:url]; 
     142                [_images removeObjectForKey:url]; 
    114143        } else { 
    115                 if([images count] > 5) 
    116                         [images removeObjectForKey:[[images allKeys] objectAtIndex:0]]; 
     144                if([_images count] > 5) 
     145                        [_images removeObjectForKey:[[_images allKeys] objectAtIndex:0]]; 
    117146                 
    118                 [images setObject:image forKey:[url absoluteString]]; 
     147                [_images setObject:image forKey:[url absoluteString]]; 
    119148        } 
     149         
     150        [_lock unlock]; 
    120151} 
    121152 
    122153 
    123154 
    124 + (NSImage *)imageForURL:(NSURL *)url { 
    125         return [images objectForKey:[url absoluteString]]; 
     155- (NSImage *)imageForURL:(NSURL *)url { 
     156        NSImage         *image; 
     157         
     158        [_lock lock]; 
     159        image = [[_images objectForKey:[url absoluteString]] retain]; 
     160        [_lock unlock]; 
     161         
     162        return [image autorelease]; 
    126163} 
    127164 
     
    130167#pragma mark - 
    131168 
    132 + (void)addTemporaryPath:(NSString *)path { 
    133         [temporaryPaths addObject:path]; 
     169- (void)addTemporaryPath:(NSString *)path { 
     170        [_lock lock]; 
     171        [_temporaryPaths addObject:path]; 
     172        [_lock unlock]; 
    134173} 
    135174 
    136175 
    137176 
    138 + (void)purgeTemporaryPaths { 
    139         int                     i, count; 
     177- (void)purgeTemporaryPaths { 
     178        NSFileManager   *fileManager; 
     179        int                             i, count; 
     180 
     181        [_lock lock]; 
    140182         
    141         count = [temporaryPaths count]; 
     183        fileManager = [NSFileManager defaultManager]; 
     184        count = [_temporaryPaths count]; 
    142185         
    143         for(i = 0; i < count; i++) { 
    144                 [[NSFileManager defaultManager] removeFileAtPath:[temporaryPaths objectAtIndex:i] 
    145                                                                                                 handler:NULL]; 
    146         } 
     186        for(i = 0; i < count; i++) 
     187                [fileManager removeFileAtPath:[_temporaryPaths objectAtIndex:i] handler:NULL]; 
     188         
     189        [_lock unlock]; 
    147190} 
    148191 
  • Footagehead/trunk/FHController.h

    r885 r901  
    1 /* $Id: FHController.h,v 1.9 2004/07/09 03:08:36 morris Exp $ */ 
     1/* $Id: FHController.h,v 1.10 2004/12/03 12:29:49 morris Exp $ */ 
    22 
    33/* 
    4  *  Copyright © 2003-2004 Axel Andersson 
     4 *  Copyright (c) 2003-2004 Axel Andersson 
    55 *  All rights reserved. 
    66 *  
     
    2727 */ 
    2828 
    29 @class FHSplitView, FHBrowserView, FHImageView, FHFullscreenWindow; 
    30 @class FHSettings, FHCache, FHHandler, FHFile; 
     29@class FHImageView, FHFullscreenWindow; 
     30@class FHHandler, FHFile; 
    3131 
    32 @interface FHController : NSWindowController { 
    33         IBOutlet FHSplitView                    *_splitView; 
    34         IBOutlet NSScrollView                   *_browserScrollView; 
    35         IBOutlet FHBrowserView                  *_browserView; 
    36         IBOutlet NSScrollView                   *_imageScrollView; 
     32@interface FHController : ZAWindowController { 
     33        IBOutlet ZASplitView                    *_splitView; 
     34        IBOutlet NSScrollView                   *_leftView; 
     35        IBOutlet ZATableView                    *_tableView; 
     36        IBOutlet NSTableColumn                  *_fileTableColumn; 
     37        IBOutlet NSScrollView                   *_rightView; 
    3738        IBOutlet NSImageView                    *_imageView; 
    3839         
    39         IBOutlet NSPopUpButton                  *_menu; 
    4040        IBOutlet NSButton                               *_revealInFinderButton; 
    4141        IBOutlet NSButton                               *_moveToTrashButton; 
    4242        IBOutlet NSProgressIndicator    *_progressIndicator; 
     43        IBOutlet NSPopUpButton                  *_menu; 
    4344 
    4445        IBOutlet NSTextField            *_leftStatusTextField; 
     
    5758        IBOutlet NSMatrix                               *_openURLExtractMatrix; 
    5859 
    59         FHSettings                                              *_settings; 
    60         FHCache                                                 *_cache; 
    61  
    6260        FHFullscreenWindow                              *_fullscreenWindow; 
    6361        FHHandler                                               *_handler; 
    6462        FHFile                                                  *_file; 
    6563         
     64        NSTimer                                                 *_timer; 
     65         
    6666        BOOL                                                    _openLast; 
    67         int                                                            _items; 
    68         int                                                            _spinners; 
     67        unsigned int                                   _spinners; 
     68        unsigned int                                   _menuItems; 
    6969} 
    7070 
    7171 
    72 #define                                                         FHFileKey                               @"FHFileKey" 
    73 #define                                                         FHImageKey                              @"FHImageKey" 
    74  
     72+ (FHController *)                                      controller; 
    7573 
    7674- (IBAction)                                            open:(id)sender; 
    7775- (IBAction)                                            openURL:(id)sender; 
    78 - (void)                                                        openFile:(FHFile *)file; 
    7976- (IBAction)                                            openParent:(id)sender; 
    8077- (IBAction)                                            openMenu:(id)sender; 
    81  
     78- (IBAction)                                            openFile:(id)sender; 
     79- (IBAction)                                            previousImage:(id)sender; 
     80- (IBAction)                                            nextImage:(id)sender; 
    8281- (IBAction)                                            reload:(id)sender; 
    8382- (IBAction)                                            slideshow:(id)sender; 
     
    8685- (IBAction)                                            delete:(id)sender; 
    8786 
    88 - (IBAction)                                            submitSheet:(id)sender; 
    89 - (IBAction)                                            cancelSheet:(id)sender; 
    90  
    91 - (FHBrowserView *)                                     browserView; 
    92 - (FHHandler *)                                         handler; 
    93 - (FHImageView *)                                       fullscreenImageView; 
    94  
    95 - (void)                                                        startSlideshow; 
    96 - (void)                                                        selectRow:(int)row; 
    97 - (void)                                                        loadImage:(FHFile *)file; 
    98  
    99 - (void)                                                        startSpinning; 
    100 - (void)                                                        stopSpinning; 
    101 - (void)                                                        update; 
    102 - (void)                                                        updateButtons; 
    103 - (void)                                                        updateVolumes; 
    104 - (void)                                                        updateMenu; 
    105 - (void)                                                        updateStatus; 
    106  
    10787@end 
  • Footagehead/trunk/FHController.m

    r900 r901  
    1 /* $Id: FHController.m,v 1.16 2004/10/30 16:48:53 morris Exp $ */ 
     1/* $Id: FHController.m,v 1.17 2004/12/03 12:29:49 morris Exp $ */ 
    22 
    33/* 
    4  *  Copyright © 2003-2004 Axel Andersson 
     4 *  Copyright (c) 2003-2004 Axel Andersson 
    55 *  All rights reserved. 
    66 *  
     
    2727 */ 
    2828 
    29 #import "NSFileManagerAdditions.h" 
    30 #import "NSImageAdditions.h" 
    31 #import "NSStringAdditions.h" 
     29#import "NSImage-FHAdditions.h" 
    3230#import "FHCache.h" 
    3331#import "FHController.h" 
    34 #import "FHBrowserCell.h" 
    35 #import "FHBrowserView.h" 
    3632#import "FHFile.h" 
     33#import "FHFileCell.h" 
    3734#import "FHFullscreenWindow.h" 
     35#import "FHHandler.h" 
    3836#import "FHImageView.h" 
    39 #import "FHHandler.h" 
    4037#import "FHSettings.h" 
    41 #import "FHSplitView.h" 
     38 
     39@interface FHController(Private) 
     40 
     41static FHController             *sharedController; 
     42 
     43 
     44- (FHFile *)                    selectedFile; 
     45- (FHFile *)                    fileAtIndex:(unsigned int)index; 
     46 
     47- (void)                                loadURL:(NSURL *)url withHint:(FHHandlerHint)hint selectRow:(unsigned int)row; 
     48- (void)                                loadFile:(FHFile *)file; 
     49 
     50- (void)                                addMenuItemWithPath:(NSString *)path keyEquivalent:(NSString *)keyEquivalent; 
     51- (void)                                reloadVolumesMenu; 
     52- (void)                                reloadPathMenu; 
     53 
     54- (void)                                startSpinning; 
     55- (void)                                stopSpinning; 
     56- (void)                                updateImage; 
     57- (void)                                updateButtons; 
     58- (void)                                updateStatus; 
     59- (void)                                updateLeftStatus; 
     60- (void)                                updateRightStatus; 
     61- (void)                                updateFullscreenStatus; 
     62- (void)                                updateTableView; 
     63 
     64@end 
     65 
    4266 
    4367@implementation FHController 
     68 
     69+ (FHController *)controller { 
     70        return sharedController; 
     71} 
     72 
     73 
    4474 
    4575- (void)awakeFromNib { 
    4676        NSArray                 *screens; 
    47         NSMenuItem              *item; 
    48         NSImage                 *icon; 
    49         NSString                *path; 
    50         int                             i; 
    51          
    52         // --- create static classes 
    53         _settings = [[FHSettings alloc] init]; 
    54         _cache = [[FHCache alloc] init]; 
    55          
    56         // --- splitview position 
    57         [_splitView setAutosaveName:@"FHBrowser"]; 
    58          
    59         // --- window position 
    60         [self setWindowFrameAutosaveName:@"FHFootagehead"]; 
     77        FHFileCell              *fileCell; 
     78        int                             i, count; 
     79         
     80        sharedController = self; 
     81         
     82        /// --- set custom cell type 
     83        fileCell = [[FHFileCell alloc] init]; 
     84        [_fileTableColumn setDataCell:fileCell]; 
     85        [fileCell release]; 
     86         
     87        // --- set up table view 
     88        [_tableView setDoubleAction:@selector(openFile:)]; 
     89        [_tableView setForwardAction:@selector(nextImage:)]; 
     90        [_tableView setBackAction:@selector(previousImage:)]; 
     91        [_tableView setDeleteAction:@selector(openParent:)]; 
     92         
     93        // --- set up split view 
     94        [_splitView setAutosaveName:@"Browser"]; 
     95         
     96        // --- thread spinner 
     97        [_progressIndicator setUsesThreadedAnimation:YES]; 
     98         
     99        // --- set up window 
    61100        [self setShouldCascadeWindows:NO]; 
    62          
    63         // --- URL settings 
     101        [self setWindowFrameAutosaveName:@"Footagehead"]; 
     102                 
     103                // --- set up URL panel 
    64104        [_openURLExtractMatrix selectCellWithTag:[FHSettings intForKey:FHExtract]]; 
    65105 
    66         // --- screen settings 
     106        // --- set up fullscreen panel 
    67107        [_screenPopUpButton removeAllItems]; 
    68108        screens = [NSScreen screens]; 
    69          
    70         for(i = 0; i < [screens count]; i++) { 
     109        count = [screens count]; 
     110         
     111        for(i = 0; i < count; i++) { 
    71112                [_screenPopUpButton addItemWithTitle:[NSString stringWithFormat: 
    72                         NSLocalizedString(@"Screen %u, %.0fx%.0f", @""), 
     113                        NSLS(@"Screen %u, %.0fx%.0f", @""), 
    73114                        i + 1, 
    74115                        [[screens objectAtIndex:i] frame].size.width, 
     
    76117        } 
    77118         
    78         if([FHSettings intForKey:FHScreen] < [screens count]
     119        if([FHSettings intForKey:FHScreen] < count
    79120                [_screenPopUpButton selectItemAtIndex:[FHSettings intForKey:FHScreen]]; 
    80121 
     
    83124        [_screenAutoSwitchTextField setIntValue:[FHSettings intForKey:FHAutoSwitchTime]]; 
    84125 
    85         // --- thread spinner 
    86         [_progressIndicator setUsesThreadedAnimation:YES]; 
    87          
    88126        // --- open last directory by default (unset if started by opening a file) 
    89127        _openLast = YES; 
    90128 
    91         // --- clear menu 
     129        // --- build menu 
    92130        [_menu removeAllItems]; 
    93          
    94         // --- load disks to menu 
    95         [self updateVolumes]; 
    96          
    97         // --- add home directory to menu 
    98         path = NSHomeDirectory(); 
    99         item = [[NSMenuItem alloc] initWithTitle:[[NSFileManager defaultManager] displayNameAtPath:path] 
    100                                                                           action:@selector(openMenu:) 
    101                                                            keyEquivalent:@"H"]; 
    102         icon = [[NSWorkspace sharedWorkspace] iconForFile:path]; 
    103         [icon setSize:NSMakeSize(16, 16)]; 
    104         [item setRepresentedObject:[NSURL fileURLWithPath:path]]; 
    105         [item setImage:icon]; 
    106         [[_menu menu] addItem:item]; 
    107         _items++; 
    108         [item release]; 
    109          
    110         // --- add desktop directory to menu 
    111         path = [NSHomeDirectory() stringByAppendingPathComponent:@"Desktop"]; 
    112         item = [[NSMenuItem alloc] initWithTitle:[[NSFileManager defaultManager] displayNameAtPath:path] 
    113                                                                           action:@selector(openMenu:) 
    114                                                            keyEquivalent:@"d"]; 
    115         icon = [[NSWorkspace sharedWorkspace] iconForFile:path]; 
    116         [icon setSize:NSMakeSize(16, 16)]; 
    117         [item setRepresentedObject:[NSURL fileURLWithPath:path]]; 
    118         [item setImage:icon]; 
    119         [[_menu menu] addItem:item]; 
    120         _items++; 
    121         [item release]; 
    122          
    123         // --- add pictures directory to menu 
    124         path = [NSHomeDirectory() stringByAppendingPathComponent:@"Pictures"]; 
    125         item = [[NSMenuItem alloc] initWithTitle:[[NSFileManager defaultManager] displayNameAtPath:path] 
    126                                                                           action:@selector(openMenu:) 
    127                                                            keyEquivalent:@"P"]; 
    128         icon = [[NSWorkspace sharedWorkspace] iconForFile:path]; 
    129         [icon setSize:NSMakeSize(16, 16)]; 
    130         [item setRepresentedObject:[NSURL fileURLWithPath:path]]; 
    131         [item setImage:icon]; 
    132         [[_menu menu] addItem:item]; 
    133         _items++; 
    134         [item release]; 
    135          
    136         // --- add spacer to menu 
    137         [[_menu menu] addItem:[NSMenuItem separatorItem]]; 
    138         _items++; 
    139          
    140         // --- register with these 
     131        [self reloadVolumesMenu]; 
     132        [self addMenuItemWithPath:@"~" keyEquivalent:@"H"]; 
     133        [self addMenuItemWithPath:@"~/Desktop" keyEquivalent:@"d"]; 
     134        [self addMenuItemWithPath:@"~/Pictures" keyEquivalent:@"P"]; 
     135        [_menu addItem:[NSMenuItem separatorItem]]; 
     136        _menuItems++; 
     137         
     138        // --- subscribe to these 
    141139        [[[NSWorkspace sharedWorkspace] notificationCenter] 
    142140                addObserver:self 
     
    150148                           name:NSWorkspaceDidUnmountNotification 
    151149                         object:NULL]; 
     150         
     151        [[NSNotificationCenter defaultCenter] 
     152                addObserver:self 
     153                   selector:@selector(viewFrameDidChange:) 
     154                           name:NSViewFrameDidChangeNotification 
     155                         object:_tableView]; 
     156 
     157        // --- set from prefs 
     158        [self updateTableView]; 
    152159} 
    153160 
     
    157164 
    158165- (void)applicationDidFinishLaunching:(NSNotification *)notification { 
    159         int            hint
    160          
    161         // --- get hint 
     166        NSURL          *url
     167        int                    hint; 
     168         
    162169        hint = [FHSettings intForKey:FHOpenHint]; 
    163170         
    164171        // --- if option redirect to home 
    165172        if((GetCurrentKeyModifiers() & optionKey) != 0) { 
    166                 [FHSettings setObject:[[NSURL fileURLWithPath:NSHomeDirectory()] absoluteString] 
    167                                            forKey:FHOpenURL]; 
    168                  
    169                 hint = FHHandlerHintNone; 
    170         } 
    171                  
    172         // --- go to last open directory 
     173                [FHSettings setObject:[[NSURL fileURLWithPath:NSHomeDirectory()] absoluteString] forKey:FHOpenURL]; 
     174                 
     175                hint = FHHandlerHintFile; 
     176        } 
     177                 
    173178        if(_openLast) { 
    174                 NSURL           *url; 
    175                  
    176                 // --- start spinning 
    177                 [self startSpinning]; 
    178  
    179                 // --- get url 
     179                // --- get url of last open directory 
    180180                url = [NSURL URLWithString:[FHSettings objectForKey:FHOpenURL]]; 
    181181 
    182                 if([url isFileURL] && ![NSFileManager directoryExistsAtPath:[url path]]) { 
     182                if([url isFileURL] && ![[NSFileManager defaultManager] directoryExistsAtPath:[url path]]) { 
    183183                        url = [NSURL fileURLWithPath:NSHomeDirectory()]; 
    184184                        hint = FHHandlerHintNone; 
    185185                } 
    186186 
    187                 // --- create handler 
    188                 _handler = [[FHHandler alloc] initWithURL:url hint:hint]; 
    189                  
    190                 // --- set files 
    191