File: programming/cocoa/Filie.zip/Filie/Filie/UKFSItem.m


/* =============================================================================
    PROJECT:    Filie
    FILE:       UKFSItem.m
    
    COPYRIGHT:  (c) 2004 by M. Uli Kusterer, all rights reserved.
    
    AUTHORS:    M. Uli Kusterer - UK
    
    LICENSES:   GNU GPL
    
    REVISIONS:
        2004-04-16  UK  Created.
   ========================================================================== */
 
// -----------------------------------------------------------------------------
//  Headers:
// -----------------------------------------------------------------------------
 
#import "UKFSItem.h"
#import "UKFSItemController.h"
#import "NSImage+NiceScaling.h"
#import "UKDirectoryEnumerator.h"
#import "IKIcon.h"
#import "UKFSDataSource.h"
#import "NSImage+Epeg.h"
#import "NSWorkspace+PreviewFile.h"
#import "UKFileInfoPanel.h"
#import "UKFileInfoMixedValueIndicator.h"
#import <limits.h>
 
 
// -----------------------------------------------------------------------------
//  Globals:
// -----------------------------------------------------------------------------
// Is this still in use?
// Is this still in use?
// -----------------------------------------------------------------------------
//  initWithURL:isDirectory:withAttributes:owner:
//      Create a new item representing the item at the specified URL.
//
//      FIX ME! This shouldn't assume it's a file URL.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  initWithPath:isDirectory:withAttributes:owner:
//      Create a new item representing the item at the specified path.
//
//      * DEPRECATED * Use the URL variant if you're writing client code.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  setName:
//      Rename the file this object is associated with.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// Is display name? No change.
// No change? Skip this.
    {
        // FIX ME! Hand the actual renaming off to the owner's data source?
// -----------------------------------------------------------------------------
//  name:
//      Return the actual file name, including suffix and whatever.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  path:
//      Return the full file path, ending in the actual file name.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  setPath:
//      Change the item's file path. This does *not* move the file, but rather
//      changes the file the item points to (e.g. after it's moved).
//
//      FIX ME! This should really be using a URL to allow for non-file items.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  icon:
//      Return an NSImage with the icon to display for this file. If the file's
//      icon hasn't been loaded yet, initiate the load  and return a placeholder
//      icon instead.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  displayName:
//      Return the file's display name. This may be a localized name (for apps,
//      or system directories like "Library" or "Pictures" or "Desktop"), or it
//      may be the file name with the extension hidden/shown as per the user's
//      prefs, or both.
//
//      The display name is fetched lazily and cached by the FSItem for faster
//      retrieval.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  setDisplayName:
//      Change the cached display name of this file to be another one. Don't
//      know why we'd need this, but it was auto-generated by Accessorizer, so
//      I'll leave it in there for now.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  iconSize:
//      Return the icon size to display this item's icon at.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  setIconSize:
//      Change the icon size to display this item's icon at.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  openController:
//      Open a controller for this item.
//
//      TODO: Maybe the controller registry should do the file package check as well?
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  openInfoPanel:
//      Open an info panel for this item.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// Make info panel reflect our attributes.
}
 
 
// -----------------------------------------------------------------------------
//  provideAttributesToInfoController:
//      Add this file's attributes to the list of attributes in an info
//      panel/inspector.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  takeAttributes:fromInfoController:
//      When it gets this, each delegate should take the attributes passed
//      (which should be the same as fileAttributes) and apply them to itself.
//      If any item is a UKFileInfoMixedValueIndicator (call
//      isDifferentAcrossSelectedItems to determine this easily), it should be
//      ignored and the old value for this attribute be used.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  resignFromInfoController:
//      An info controller (inspector or info panel) has been closed or for some
//      other reason no longer wishes to display our info. Dissociate ourselves
//      from it and, if it's our info panel, give up ownership of it.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// It's our info window, not just an inspector?
    {
        [infoPanel release];    // Make sure it closes!
// -----------------------------------------------------------------------------
//  setPosition:
//      Change the position of this item in its controller window (icon view).
//      This is in flipped, UKDistributedView coordinates.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  position:
//      Return the position of this item in its controller window (icon view).
//      This is in flipped, UKDistributedView coordinates.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  attributes:
//      Return a file attributes dictionary for our file.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  setAttributes:
//      Change the file attributes dictionary for our file. This mustn't change
//      the actual file's attributes.
//
//  REVISIONS:
//      2005-07-03  UK  Changed comments to indicate we really don't want this
//                      to change the file, as UKFolderController calls it in
//                      response to new files becoming known.
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  setOnDiskAttributes:
//      Change the file attributes dictionary for our file. This changes the
//      actual file attributes, as well as our internally cached attributes
//      dictionary.
//
//  REVISIONS:
//      2005-07-03  UK  Created.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  isDirectory:
//      Return whether this item is a file or a directory.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  labelColor:
//      Return the color to use for this file's label metadata attribute.
//      Returns white for "no label" or "unsupported label number".
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  loadItemIcon:
//      This method is called in its own thread to actually load the item of
//      this file. It gets the actual icon from the file system data source.
//
//  REVISIONS:
//      2004-12-23  UK  Documented.
// -----------------------------------------------------------------------------
// Actually got a better icon?
"position""icon""icon""icon""position""%@ isEjectable w: %d R: %d U: %d D: %@ T: %@"

This code uses the PclZip Zip File reading code, which is subject to the GNU LGPL. It also uses the GeSHi syntax highlighter, subject to the GPL. Ask if you want this for your own web site, it's free.