home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / OB3.2D4.DMS / in.adf / Interfaces / Workbench.mod < prev   
Encoding:
Text File  |  1993-05-23  |  9.8 KB  |  243 lines

  1. (*-------------------------------------------------------------------------*)
  2. (*                                                                         *)
  3. (*  Amiga Oberon Interface Module:                    Date: 02-Nov-92      *)
  4. (*                                                                         *)
  5. (*   © 1992 by Fridtjof Siebert                                            *)
  6. (*   updated for V39 by hartmut Goebel                                     *)
  7. (*                                                                         *)
  8. (*-------------------------------------------------------------------------*)
  9.  
  10. MODULE Workbench;
  11.  
  12. IMPORT e   * := Exec,
  13.        I   * := Intuition,
  14.        d   * := Dos,
  15.        u   * := Utility,
  16.        sys * := SYSTEM;
  17.  
  18.  
  19. TYPE
  20.  
  21.   WBArgPtr * = UNTRACED POINTER TO WBArg;
  22.   WBArg * = STRUCT
  23.     lock * : d.FileLockPtr;     (* a lock descriptor *)
  24.     name * : e.STRPTR;          (* a string relative to that lock *)
  25.   END;
  26.  
  27.   WBArguments * = ARRAY 256 OF WBArg;
  28.   WBArgumentsPtr * = UNTRACED POINTER TO WBArguments;
  29.  
  30.   WBStartupPtr * = UNTRACED POINTER TO WBStartup;
  31.   WBStartup * = STRUCT (message * : e.Message) (* a standard message structure *)
  32.     process * : d.ProcessId;     (* the process descriptor for you *)
  33.     segment * : e.BPTR;          (* a descriptor for your code *)
  34.     numArgs * : LONGINT;         (* the number of elements in ArgList *)
  35.     toolWindow * : e.STRPTR;     (* description of window *)
  36.     argList * : WBArgumentsPtr;  (* the arguments themselves *)
  37.   END;
  38.  
  39. CONST
  40.  
  41.   disk      * = 1;
  42.   drawer    * = 2;
  43.   tool      * = 3;
  44.   project   * = 4;
  45.   garbage   * = 5;
  46.   device    * = 6;
  47.   kick      * = 7;
  48.   wbAppIcon * = 8;
  49.  
  50. TYPE
  51.  
  52.   OldDrawerDataPtr * = UNTRACED POINTER TO OldDrawerData;
  53.   OldDrawerData * = STRUCT       (* pre V36 definition *)
  54.    (newWindow * : I.NewWindow)   (* args to open window *)
  55.     currentX  * : LONGINT;       (* current x coordinate of origin *)
  56.     currentY  * : LONGINT;       (* current y coordinate of origin *)
  57.   END;
  58.  
  59. CONST
  60.  
  61. (* the amount of DrawerData actually written to disk *)
  62.   oldDrawerDataFileSize * = sys.SIZE(OldDrawerData);
  63.  
  64. TYPE
  65.  
  66.   DrawerDataPtr * = UNTRACED POINTER TO DrawerData;
  67.   DrawerData * = STRUCT (newWindow * : I.NewWindow) (* args to open window *)
  68.     currentX * : LONGINT;        (* current x coordinate of origin *)
  69.     currentY * : LONGINT;        (* current y coordinate of origin *)
  70.     flags * : LONGSET;           (* flags for drawer *)
  71.     viewModes * : SET;           (* view mode for drawer *)
  72.   END;
  73.  
  74. CONST
  75.  
  76. (* the amount of DrawerData actually written to disk *)
  77.   drawerDataFileSize * = sys.SIZE(DrawerData);
  78.  
  79. TYPE
  80.  
  81.   DiskObjectPtr * = UNTRACED POINTER TO DiskObject;
  82.   DiskObject * = STRUCT
  83.     magic * : INTEGER; (* a magic number at the start of the file *)
  84.     version * : INTEGER; (* a version number, so we can change it *)
  85.     gadget * : I.Gadget;      (* a copy of in core gadget *)
  86.     type * : SHORTINT;
  87.     defaultTool * : e.STRPTR;
  88.     toolTypes * : e.APTR;
  89.     currentX * : LONGINT;
  90.     currentY * : LONGINT;
  91.     drawerData * : DrawerDataPtr;
  92.     toolWindow * : e.STRPTR;  (* only applies to tools *)
  93.     stackSize * : LONGINT;   (* only applies to tools *)
  94.   END;
  95.  
  96. CONST
  97.   
  98.   diskMagic    * = 0E310U;  (* a magic number, not easily impersonated *)
  99.   diskVersion  * = 1;       (* our current version number *)
  100.   diskRevision * = 1;       (* our current revision number *)
  101. (* I only use the lower 8 bits of Gadget.userData for the revision # *)
  102.   diskRevisionMask * = 0FFH;
  103.  
  104. TYPE
  105.  
  106.   FreeListPtr * = UNTRACED POINTER TO FreeList;
  107.   FreeList * = STRUCT
  108.     numFree * : INTEGER;
  109.     memList * : e.List;
  110.   END;
  111.  
  112. CONST
  113.  
  114. (* each message that comes into the WorkBenchPort must have a type field
  115. ** in the preceeding short.  These are the defines for this type
  116. *)
  117.  
  118.   pstd          * = 1;      (* a "standard Potion" message *)
  119.   toolExit      * = 2;      (* exit message from our tools *)
  120.   diskChange    * = 3;      (* dos telling us of a disk change *)
  121.   timer         * = 4;      (* we got a timer tick *)
  122.   closeDown     * = 5;      (* <unimplemented> *)
  123.   ioProc        * = 6;      (* <unimplemented> *)
  124.   appWindow     * = 7;      (* msg from an app window *)
  125.   appIcon       * = 8;      (* msg from an app icon *)
  126.   appMenuItem   * = 9;      (* msg from an app menuitem *)
  127.   copyExit      * = 10;     (* exit msg from copy process *)
  128.   iConPut       * = 11;     (* msg from PutDiskObject in icon.library *)
  129.  
  130. (* workbench does different complement modes for its gadgets.
  131. ** It supports separate images, complement mode, and backfill mode.
  132. ** The first two are identical to intuitions GADGIMAGE and GADGHCOMP.
  133. ** backfill is similar to GADGHCOMP, but the region outside of the
  134. ** image (which normally would be color three when complemented)
  135. ** is flood-filled to color zero.
  136. *)
  137.   gadgBackFill * = {0};
  138.  
  139. (* if an icon does not really live anywhere, set its current position
  140. ** to here
  141. *)
  142.   noIconPosition * = 80000000H;
  143.  
  144. (* workbench now is a library.  this is it's name *)
  145.   workbenchName * = "workbench.library";
  146.  
  147. (* If you find AppMessage.Version >= amVersion, you know this structure has
  148.  * at least the fields defined in this version of the include file
  149.  *)
  150.   amVersion * = 1;
  151.  
  152. TYPE
  153.  
  154.   AppMessagePtr * = UNTRACED POINTER TO AppMessage;
  155.   AppMessage * = STRUCT (message * : e.Message) (* standard message structure *)
  156.     type * : INTEGER;             (* message type               *)
  157.     userData * : LONGINT;         (* application specific       *)
  158.     id * : LONGINT;               (* application definable ID   *)
  159.     numArgs * : LONGINT;          (* # of elements in arglist   *)
  160.     argList * : WBArgumentsPtr;   (* the arguements themselves  *)
  161.     version * : INTEGER;          (* will be AM_VERSION         *)
  162.     class * : SET;                (* message class              *)
  163.     mouseX * : INTEGER;           (* mouse x position of event  *)
  164.     mouseY * : INTEGER;           (* mouse y position of event  *)
  165.     seconds * : LONGINT;          (* current system clock time  *)
  166.     micros * : LONGINT;           (* current system clock time  *)
  167.     reserved * : ARRAY 8 OF LONGINT;    (* avoid recompilation  *)
  168.   END;
  169.  
  170. (*
  171.  * The following structures are private.  These are just stub
  172.  * structures for code compatibility...
  173.  *)
  174.  
  175.   AppWindowPtr * = UNTRACED POINTER TO STRUCT END;
  176.   AppIconPtr * = UNTRACED POINTER TO STRUCT END;
  177.   AppMenuItemPtr * = UNTRACED POINTER TO STRUCT END;
  178.  
  179. VAR
  180.   base * : e.LibraryPtr;
  181.  
  182. (* "workbench.library" *)
  183. (* --- functions in V36 or higher (distributed as Release 2.0) --- *)
  184. (* --- REMEMBER: You have to ensure that Workbench.base#NIL    --- *)
  185. (* ---           BEFORE you use the following Prozedures!      --- *)
  186. PROCEDURE StartWorkbench   *{base,- 42}(flags{0}      : LONGSET;
  187.                                         ptr{1}        : LONGINT): BOOLEAN;
  188. PROCEDURE AddAppWindowA    *{base,- 48}(id{0}         : LONGINT;
  189.                                         userdata{1}   : LONGINT;
  190.                                         window{8}     : I.WindowPtr;
  191.                                         msgport{9}    : e.MsgPortPtr;
  192.                                         taglist{10}   : ARRAY OF u.TagItem): AppWindowPtr;
  193. PROCEDURE AddAppWindow     *{base,- 48}(id{0}         : LONGINT;
  194.                                         userdata{1}   : LONGINT;
  195.                                         window{8}     : I.WindowPtr;
  196.                                         msgport{9}    : e.MsgPortPtr;
  197.                                         tag1{10}..    : u.Tag): AppWindowPtr;
  198. PROCEDURE RemoveAppWindow  *{base,- 54}(appWindow{8}  : AppWindowPtr): BOOLEAN;
  199. PROCEDURE AddAppIconA      *{base,- 60}(id{0}         : LONGINT;
  200.                                         userdata{1}   : LONGINT;
  201.                                         text{8}       : ARRAY OF CHAR;
  202.                                         msgprot{9}    : e.MsgPortPtr;
  203.                                         lock{10}      : d.FileLockPtr;
  204.                                         diskobj{11}   : DiskObjectPtr;
  205.                                         taglist{12}   : ARRAY OF u.TagItem): AppIconPtr;
  206. PROCEDURE AddAppIcon       *{base,- 60}(id{0}         : LONGINT;
  207.                                         userdata{1}   : LONGINT;
  208.                                         text{8}       : ARRAY OF CHAR;
  209.                                         msgprot{9}    : e.MsgPortPtr;
  210.                                         lock{10}      : d.FileLockPtr;
  211.                                         diskobj{11}   : DiskObjectPtr;
  212.                                         tag1{12}..    : u.Tag): AppIconPtr;
  213. PROCEDURE RemoveAppIcon    *{base,- 66}(appIcon{8}    : AppIconPtr): BOOLEAN;
  214. PROCEDURE AddAppMenuItemA  *{base,- 72}(id{0}         : LONGINT;
  215.                                         userData{1}   : LONGINT;
  216.                                         text{8}       : ARRAY OF CHAR;
  217.                                         msgprot{9}    : e.MsgPortPtr;
  218.                                         taglist{10}   : ARRAY OF u.TagItem): AppMenuItemPtr;
  219. PROCEDURE AddAppMenuItem   *{base,- 72}(id{0}         : LONGINT;
  220.                                         userData{1}   : LONGINT;
  221.                                         text{8}       : ARRAY OF CHAR;
  222.                                         msgprot{9}    : e.MsgPortPtr;
  223.                                         tag1{10}..    : u.Tag): AppMenuItemPtr;
  224. PROCEDURE RemoveAppMenuItem*{base,- 78}(appMenuItem{8}: AppMenuItemPtr): BOOLEAN;
  225.  
  226. (*--- functions in V39 or higher (beta release for developers only) ---*)
  227.  
  228. PROCEDURE WBInfo           *{base,-05AH}(lock{8}      : d.FileLockPtr;
  229.                                          name{9}      : ARRAY OF CHAR;
  230.                                          screen{10}   : I.ScreenPtr);
  231.  
  232.  
  233. (* $OvflChk- $RangeChk- $StackChk- $NilChk- $ReturnChk- $CaseChk- *)
  234.  
  235. BEGIN
  236.   base :=  e.OpenLibrary(workbenchName,37);
  237.  
  238. CLOSE
  239.   IF base#NIL THEN e.CloseLibrary(base) END;
  240.  
  241. END Workbench.
  242.  
  243.