File:  [NeXTSTEP 3.3 examples] / Examples / DatabaseKit / Evaluator / Controller.m
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:48:58 2018 UTC (8 years, 1 month ago) by root
Branches: NeXT, MAIN
CVS tags: NeXTSTEP33, HEAD
Sample Programs from NeXSTEP 3.3

/* Controller.m:
 * You may freely copy, distribute, and reuse the code in this example.
 * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
 * fitness for any particular use.
 *
 * 
 *
 */
 
#import "Controller.h"
#import	"SQLWindow.h"

@implementation Controller

#define DEFAULT_LIBRARY "Library/Databases"

- open:sender
{
    char **files;
    char *path;
    const char *directory;
    const char *const types[] = { "dbmodel", "dbmodela", 0 };
    id openPanel;

    openPanel = [OpenPanel new];
    [openPanel allowMultipleFiles:YES];
    path = alloca(1 + MAXPATHLEN);
    sprintf(path, "%s/%s", getenv("HOME"), DEFAULT_LIBRARY);
    if ([openPanel runModalForDirectory:path file:NULL types:types])
	if ((files = (char **) [openPanel filenames]) != NULL)
	{
	    directory = [openPanel directory];
	    for (; *files; ++files)
	    {
		sprintf(path, "%s/%s", directory, *files);
		[self openFileNamed:path];
	    }
	}

    return self;
}

- openFileNamed:(const char *)filename
{
    return [[SQLWindow alloc] initWithFile:filename];
}

- evaluate:sender
{
    [[[NXApp mainWindow] delegate] evaluate:sender];
    return self;
}

- clear:sender
{
    [[[NXApp mainWindow] delegate] clear:sender];
    return self;
}

- print:sender
{
    [[[NXApp mainWindow] delegate] print:sender];
    return self;
}

- close:sender
{
    [[[NXApp mainWindow] delegate] performClose:sender];
    return self;
}

@end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.