home *** CD-ROM | disk | FTP | other *** search
- /*
- * This subclass only adds a few responsibilities to the Application class.
- * It loads the info and preferences panels on demand, keeps track of the
- * path to the app wrapper, and overrides sendEvent: to watch for
- * control-mouseDown events which it vectors off to the help object.
- *
- * Author: Julie Zelenski, NeXT Developer Support
- * 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 "SterOptikonApp.h"
- #import "Help.h"
- #import <appkit/View.h>
- #import <strings.h>
- #import <defaults/defaults.h> // for NXArgv
- #import <libc.h> // for chdir, getwd
-
-
- @implementation SterOptikonApp:Application
-
- + new;
- /* New is overridden so the SterOptikonApp gets and saves the path to executable.
- * The help object will ask the app for this, so it can find the help
- * files which are in a directory in the app wrapper.
- */
- {
- char *suffix;
-
- self = [super new];
- strcpy(appDirectory, NXArgv[0]);
- if (suffix = rindex(appDirectory,'/'))
- *suffix = '\0'; /* remove executable name */
- if (appDirectory) chdir(appDirectory);
- getwd(appDirectory);
- strcpy(openFileName,"");
- return self;
- }
-
- - (const char *)appDirectory;
- /* Returns the path to the app wrapper (for Help object).
- */
- {
- return appDirectory;
- }
-
- - (BOOL)appAcceptsAnotherFile:sender
- {
- return YES;
- }
-
- - (int)openFile:(const char *)filename ok:(int *)flag
- {
- strcpy(openFileName,filename);
- *flag = YES;
- return 0;
- }
-
- - (char *)getInitialFile;
- {
- return (char *)openFileName;
- }
-
- @end
-