home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / msysjour / vol04 / 02b / project / act / projapp.act < prev   
Text File  |  1988-11-30  |  3KB  |  83 lines

  1. /*  ProjApp.act  --based on the skeleton file UserApp.act.
  2.  
  3.     This file is used during the seal off process to define
  4.     methods specific to the project application.
  5. */
  6.  
  7.  
  8. /* Define the application class */
  9. inherit(Object, #ProjApp, #(pw cmdLine), nil, nil)!!
  10.  
  11. /* Define an init method for ProjApp.  This is executed when the
  12.    application starts up, and must create the windows and objects
  13.    necessary for the application.
  14. */!!
  15.  
  16. now(ProjApp)!!
  17.  
  18. Def init(self , str | dlg)
  19. {       initSystem(self);
  20.         register(ProjWindow);
  21.         register(GanttWindow);
  22.         cmdLine := str;
  23.         pw := new(ProjWindow, nil, nil, loadString(PW_APPNAME), nil);
  24.         show(pw, CmdShow);
  25.         pw.isMain := true;
  26.         dlg := new(Dialog);
  27.         runModal(dlg, ABOUT_BOX, pw);
  28.         /* move the cursor to the top in case there's no mouse */
  29.         setCursorPos(pw, point(pw.boxHSpace, pw.boxHeight));
  30.  }!!
  31.  
  32. /* Check if it's ok to close the window. */
  33. Def shouldClose(self)
  34. {
  35.   ^shouldClose(pw);
  36. }!!
  37.  
  38. /* The installation method for the application.
  39.    This removes the compiler and miscelaneous junk and then
  40.    takes a snapshot.
  41.  
  42.  Note: This method must be invoked via abort(installProj));
  43.        or abort(Object.methods[#installProj]);
  44. */
  45. now(Object)!!
  46.  
  47. Def installProj(self)
  48. {       setName(VImage, "Project.ima");
  49.         removeCompiler();
  50.         removeJunk();           /* unused methods */
  51.         TheApp := new(ProjApp);
  52.         printLine("sealing off...");
  53.         cleanup();
  54.         create(VImage);
  55.         snap(VImage, 59, 25);   /* Static and Dynamic memory */
  56.                                 /* adjust later with MemChg.EXE */
  57.         close(VImage);
  58.         exit();
  59. }!!
  60.  
  61. /* Remove unused methods during seal off. */
  62. Def removeJunk(self)
  63. {
  64.   removeGlobal(#OrderedDictionary);
  65.   removeGlobal(#TextCollection);
  66.   printLine("removing...");
  67.   removeMethods(Number, #(cos sqrt tan sin exp log arcCos arcSin degToRad
  68.         radToDeg));
  69.   removeMethods(Int, #(random));
  70.   removeMethods(Rect, #(inflate offset intersect union));
  71.   removeMethods(Object, #(removeCompiler));
  72.   removeMethods(Network, #(show));
  73.   removeMethods(Node, #(show));
  74.   removeMethods(Date, #(asLongString asVeryLongString asDayString
  75.         diff inc dec next previous dayOfWeek));
  76.   removeMethods(DateClass, #(current));
  77.  
  78.   /* automatically generated by optimize utility */
  79.   removeJunk1();
  80.   removeJunk2();
  81.   removeMethods(Object, #(removeJunk1 removeJunk2));
  82. }!!
  83.