This is FileManager.m in view mode; [Download] [Up]
/*
File FileManager.m
Release 1.2, 7 June 1994
Copyright (C) 1994 by H. Scott Roy
This code is part of IconKit, a general toolbox for drag-and-drop applications. IconKit is free for noncommercial use, but costs money for a commercial license. You should have received a copy of the license agreement with this file. If not, a copy of the license and the complete source of IconKit can be obtained from the author:
H. Scott Roy
2573 Stowe Ct.
Northbrook, IL 60062-8103
iconkit@cs.stanford.edu
For your editing convenience, this file is best viewed using an editor that automatically wraps long lines, in a fixed point font at 80 columns, with tabs every 4 spaces.
*/
/* ========================================================================== */
/*
The FileManager adds a few goodies to the basic IKBrowserManager. In particular, it can open files in the workspace, and it can open new file viewers rooted at the current selection.
*/
#import "FileManager.h"
#import "AppDelegate.h"
/* ========================================================================== */
/*
The sorting method gets overridden to sort files by name. Sorting gets done by the built in quicker sort function.
*/
static int
compare_names (const void * one, const void * two)
{
id
A = * ((id *) one),
B = * ((id *) two);
return strcmp ([A name], [B name]);
}
@implementation FileManager
- sort: (id *) files count: (int) n for: (int) column
{
qsort(files, n, sizeof(id), compare_names);
return self;
}
/* ========================================================================== */
/*
The action method below instructs the AppDelegate to open a file in the workspace. The file is taken from the current selection.
*/
- openFile: sender
{
NXRect
frame;
id
iconPath = [browser iconPath],
cell = [iconPath selectedCell],
file = [cell delegate];
[iconPath getCellFrame: &frame at: 0 : [iconPath selectedCol]];
[cell getIconRect: &frame];
frame.origin.y += frame.size.height;
[[Application workspace] openFile: [file path] fromImage: [file image]
at: &frame.origin inView: iconPath];
return self;
}
- openFolder: sender
{
[appDelegate newViewerAt: [[[browser iconPath] selectedCell] delegate]];
return self;
}
/* ========================================================================== */
/*
A FileManager installs itself as its window's delegate so that it can properly free itself when the window closes.
*/
- windowWillClose: sender
{
[sender setDelegate: nil];
[self free];
return sender;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.