home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / SoundAndMusic / Hyperupic / Hyperupic.app / HyperupicApp.m < prev    next >
Text File  |  1992-08-10  |  2KB  |  62 lines

  1. /*
  2.  * This subclass only adds a few responsibilities to the Application class.
  3.  * It loads the info and preferences panels on demand, keeps track of the 
  4.  * path to the app wrapper, and overrides sendEvent: to watch for 
  5.  * control-mouseDown events which it vectors off to the help object.
  6.  *
  7.  * Author: Julie Zelenski, NeXT Developer Support  (Thanks Julie!)
  8.  * You may freely copy, distribute and reuse the code in this example.  
  9.  * NeXT disclaims any warranty of any kind, expressed or implied, as to 
  10.  * its fitness for any particular use.
  11.  */
  12.  
  13.  
  14. #import "HyperupicApp.h"
  15. #import "Help.h"
  16. #import <appkit/View.h>
  17. #import <strings.h>
  18. #import <appkit/defaults.h>      // for NXArgv
  19. #import <libc.h>        // for chdir, getwd
  20.  
  21.  
  22. @implementation HyperupicApp:Application
  23.  
  24. + new;
  25. /* New is overridden so the BusyBoxApp gets and saves the path to executable.
  26.  * The help object will ask the app for this, so it can find the help
  27.  * files which are in a directory in the app wrapper. 
  28.  */
  29. {
  30.     char *suffix;
  31.     
  32.     self = [super new];
  33.     strcpy(appDirectory, NXArgv[0]);
  34.     if (suffix = rindex(appDirectory,'/')) 
  35.         *suffix  = '\0';            // remove executable name
  36.     if (appDirectory) chdir(appDirectory); 
  37.     getwd(appDirectory);
  38.     return self;
  39. }
  40.  
  41.  
  42. - (const char *)appDirectory;
  43. /* Returns the path to the app wrapper (for Help object).
  44.  */
  45. {
  46.     return appDirectory;
  47. }
  48.  
  49.  
  50. - preferences:sender
  51. /*
  52.  * The preferences panel is a separate nib module and only loaded on demand.
  53.  */
  54. {
  55.     if (!prefPanel)
  56.        prefPanel=[self loadNibSection:"PrefPanel.nib" owner:self withNames:NO];
  57.     [prefPanel orderFront:self];
  58.     return self;
  59. }
  60.  
  61. @end
  62.