Annotation of Examples/DatabaseKit/Evaluator/Controller.m, revision 1.1.1.1

1.1       root        1: /* Controller.m:
                      2:  * You may freely copy, distribute, and reuse the code in this example.
                      3:  * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
                      4:  * fitness for any particular use.
                      5:  *
                      6:  * 
                      7:  *
                      8:  */
                      9:  
                     10: #import "Controller.h"
                     11: #import        "SQLWindow.h"
                     12: 
                     13: @implementation Controller
                     14: 
                     15: #define DEFAULT_LIBRARY "Library/Databases"
                     16: 
                     17: - open:sender
                     18: {
                     19:     char **files;
                     20:     char *path;
                     21:     const char *directory;
                     22:     const char *const types[] = { "dbmodel", "dbmodela", 0 };
                     23:     id openPanel;
                     24: 
                     25:     openPanel = [OpenPanel new];
                     26:     [openPanel allowMultipleFiles:YES];
                     27:     path = alloca(1 + MAXPATHLEN);
                     28:     sprintf(path, "%s/%s", getenv("HOME"), DEFAULT_LIBRARY);
                     29:     if ([openPanel runModalForDirectory:path file:NULL types:types])
                     30:        if ((files = (char **) [openPanel filenames]) != NULL)
                     31:        {
                     32:            directory = [openPanel directory];
                     33:            for (; *files; ++files)
                     34:            {
                     35:                sprintf(path, "%s/%s", directory, *files);
                     36:                [self openFileNamed:path];
                     37:            }
                     38:        }
                     39: 
                     40:     return self;
                     41: }
                     42: 
                     43: - openFileNamed:(const char *)filename
                     44: {
                     45:     return [[SQLWindow alloc] initWithFile:filename];
                     46: }
                     47: 
                     48: - evaluate:sender
                     49: {
                     50:     [[[NXApp mainWindow] delegate] evaluate:sender];
                     51:     return self;
                     52: }
                     53: 
                     54: - clear:sender
                     55: {
                     56:     [[[NXApp mainWindow] delegate] clear:sender];
                     57:     return self;
                     58: }
                     59: 
                     60: - print:sender
                     61: {
                     62:     [[[NXApp mainWindow] delegate] print:sender];
                     63:     return self;
                     64: }
                     65: 
                     66: - close:sender
                     67: {
                     68:     [[[NXApp mainWindow] delegate] performClose:sender];
                     69:     return self;
                     70: }
                     71: 
                     72: @end

unix.superglobalmegacorp.com

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