home *** CD-ROM | disk | FTP | other *** search
- (**************************************************************************
-
- $RCSfile: Workbench.mod $
- Description: Interface to workbench.library
-
- Created by: fjc (Frank Copeland)
- $Revision: 3.8 $
- $Author: fjc $
- $Date: 1995/06/04 23:13:14 $
-
- Includes Release 40.15
-
- (C) Copyright 1985-1993 Commodore-Amiga, Inc.
- All Rights Reserved
-
- Oberon-A interface Copyright © 1994-1995, Frank Copeland.
- This file is part of the Oberon-A Interface.
- See Oberon-A.doc for conditions of use and distribution.
-
- ***************************************************************************)
-
- <* STANDARD- *>
-
- MODULE [2] Workbench;
-
- IMPORT
- SYS := SYSTEM, Kernel, e := Exec, u := Utility, d := Dos, i := Intuition,
- s := Sets;
-
-
- (* Pointers are declared first for convenience *)
-
- TYPE
-
- OldDrawerDataPtr * = POINTER TO OldDrawerData;
- DrawerDataPtr * = POINTER TO DrawerData;
- DiskObjectPtr * = POINTER TO DiskObject;
- FreeListPtr * = POINTER TO FreeList;
- AppMessagePtr * = POINTER TO AppMessage;
- WBStartupPtr * = POINTER TO WBStartup;
- WBArgPtr * = POINTER TO WBArg;
- AppWindowPtr * = POINTER TO AppWindow;
- AppIconPtr * = POINTER TO AppIcon;
- AppMenuItemPtr * = POINTER TO AppMenuItem;
-
-
- (*
- ** $VER: startup.h 36.3 (11.7.90)
- **
- ** workbench startup definitions
- *)
-
-
- TYPE
-
- WBArg * = RECORD
- lock * : d.FileLockPtr; (* a lock descriptor *)
- name * : e.LSTRPTR; (* a string relative to that lock *)
- END; (* WBArg *)
-
- WBArguments * = ARRAY MAX(INTEGER) OF WBArg;
- WBArgumentsPtr * = POINTER TO WBArguments;
-
- WBStartup * = RECORD (e.MessageBase)
- message * : e.Message; (* a standard message structure *)
- process * : d.ProcessId; (* the process descriptor for you *)
- segment * : e.BPTR; (* a descriptor for your code *)
- numArgs * : LONGINT; (* the number of elements in ArgList *)
- toolWindow * : e.LSTRPTR; (* description of window *)
- argList * : WBArgumentsPtr; (* the arguments themselves *)
- END; (* WBStartup *)
-
-
- (*
- ** $VER: workbench.h 40.1 (26.8.93)
- **
- ** workbench.library general definitions
- *)
-
- CONST
-
- disk * = 1;
- drawer * = 2;
- tool * = 3;
- project * = 4;
- garbage * = 5;
- device * = 6;
- kick * = 7;
- wbAppIcon * = 8;
-
- TYPE
-
- OldDrawerData * = RECORD (i.NewWindowBase) (* pre V36 definition *)
- newWindow * : i.NewWindow; (* args to open window *)
- currentX * : LONGINT; (* current x coordinate of origin *)
- currentY * : LONGINT; (* current y coordinate of origin *)
- END; (* OldDrawerData *)
-
- CONST
-
- (* the amount of DrawerData actually written to disk *)
- oldDrawerDataFileSize * = SIZE (OldDrawerData);
-
- TYPE
-
- DrawerData * = RECORD (i.NewWindowBase)
- newWindow * : i.NewWindow; (* args to open window *)
- currentX * : LONGINT; (* current x coordinate of origin *)
- currentY * : LONGINT; (* current y coordinate of origin *)
- flags * : s.SET32; (* flags for drawer *)
- viewModes * : s.SET16; (* view mode for drawer *)
- END; (* DrawerData *)
-
- CONST
-
- (* the amount of DrawerData actually written to disk *)
- drawerDataFileSize * = SIZE (DrawerData);
-
- TYPE
-
- ToolTypePtr * = POINTER TO ARRAY MAX(INTEGER) OF e.LSTRPTR;
-
- DiskObject * = RECORD
- magic * : e.UWORD; (* a magic number at the start of the file *)
- version * : e.UWORD; (* a version number, so we can change it *)
- gadget * : i.Gadget; (* a copy of in core gadget *)
- type * : SHORTINT;
- defaultTool * : e.LSTRPTR;
- toolTypes * : ToolTypePtr;
- currentX * : LONGINT;
- currentY * : LONGINT;
- drawerData * : DrawerDataPtr;
- toolWindow * : e.LSTRPTR; (* only applies to tools *)
- stackSize * : LONGINT; (* only applies to tools *)
- END; (* DiskObject *)
-
- CONST
-
- diskMagic * = -1CF0H; (*0E310H*) (* a magic number, not easily impersonated *)
- diskVersion * = 1; (* our current version number *)
- diskRevision * = 1; (* our current revision number *)
- (* I only use the lower 8 bits of Gadget.UserData for the revision # *)
- diskRevisionMask * = 0FFH;
-
- TYPE
-
- FreeList * = RECORD
- numFree * : INTEGER;
- memList * : e.List;
- END; (* FreeList *)
-
- CONST
-
- (* workbench does different complement modes for its gadgets.
- ** It supports separate images, complement mode, and backfill mode.
- ** The first two are identical to intuitions GADGIMAGE and GADGHCOMP.
- ** backfill is similar to GADGHCOMP, but the region outside of the
- ** image (which normally would be color three when complemented)
- ** is flood-filled to color zero.
- *)
- gadgBackFill * = {0};
-
- (* if an icon does not really live anywhere, set its current position
- ** to here
- *)
- noIconPosition * = 80000000H;
-
- (* workbench now is a library. this is it's name *)
- workbenchName * = "workbench.library";
-
- (* If you find amVersion >= amVERSION, you know this structure has
- * at least the fields defined in this version of the include file
- *)
- amVersion * = 1;
-
- TYPE
-
- AppMessage * = RECORD (e.MessageBase)
- message * : e.Message; (* standard message structure *)
- type * : e.UWORD; (* message type *)
- userData * : LONGINT; (* application specific *)
- id * : e.ULONG; (* application definable ID *)
- numArgs * : LONGINT; (* # of elements in arglist *)
- argList * : WBArgumentsPtr; (* the arguements themselves *)
- version * : e.UWORD; (* will be amVERSION *)
- class * : s.SET16; (* message class *)
- mouseX * : INTEGER; (* mouse x position of event *)
- mouseY * : INTEGER; (* mouse y position of event *)
- seconds * : e.ULONG; (* current system clock time *)
- micros * : e.ULONG; (* current system clock time *)
- reserved * : ARRAY 8 OF e.ULONG; (* avoid recompilation *)
- END; (* AppMessage *)
-
- CONST
-
- (* types of app messages *)
- appWindow * = 7; (* app window message *)
- appIcon * = 8; (* app icon message *)
- appMenuItem * = 9; (* app menu item message *)
-
- TYPE
-
- (*
- * The following structures are private. These are just stub
- * structures for code compatibility...
- *)
- AppWindow * = RECORD END;
- AppIcon * = RECORD END;
- AppMenuItem * = RECORD END;
-
- (*-- Library Base variable --------------------------------------------*)
-
- VAR
-
- base * : e.LibraryPtr;
-
-
- (*-- Library Functions ------------------------------------------------*)
-
- (*
- ** $VER: wb_protos.h 38.4 (31.5.92)
- *)
-
- (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
-
- PROCEDURE StartWorkbench* [base,-42]
- ( flags [0] : s.SET32;
- ptr [1] : LONGINT)
- : BOOLEAN;
- PROCEDURE AddAppWindowA* [base,-48]
- ( id [0] : e.ULONG;
- userdata [1] : LONGINT;
- window [8] : i.WindowPtr;
- msgport [9] : e.MsgPortBasePtr;
- taglist [10] : ARRAY OF u.TagItem )
- : AppWindowPtr;
- PROCEDURE AddAppWindow* [base,-48]
- ( id [0] : e.ULONG;
- userdata [1] : LONGINT;
- window [8] : i.WindowPtr;
- msgport [9] : e.MsgPortBasePtr;
- taglist [10].. : u.Tag )
- : AppWindowPtr;
- PROCEDURE RemoveAppWindow* [base,-54]
- ( appWindow [8] : AppWindowPtr )
- : BOOLEAN;
- PROCEDURE AddAppIconA* [base,-60]
- ( id [0] : e.ULONG;
- userdata [1] : LONGINT;
- text [8] : ARRAY OF CHAR;
- msgport [9] : e.MsgPortBasePtr;
- lock [10] : d.FileLockPtr;
- diskobj [11] : DiskObjectPtr;
- taglist [12] : ARRAY OF u.TagItem )
- : AppIconPtr;
- PROCEDURE AddAppIcon* [base,-60]
- ( id [0] : e.ULONG;
- userdata [1] : LONGINT;
- text [8] : ARRAY OF CHAR;
- msgport [9] : e.MsgPortBasePtr;
- lock [10] : d.FileLockPtr;
- diskobj [11] : DiskObjectPtr;
- taglist [12]..: u.Tag )
- : AppIconPtr;
- PROCEDURE RemoveAppIcon* [base,-66]
- ( appIcon [8] : AppIconPtr )
- : BOOLEAN;
- PROCEDURE AddAppMenuItemA* [base,-72]
- ( id [0] : e.ULONG;
- userdata [1] : LONGINT;
- text [8] : ARRAY OF CHAR;
- msgport [9] : e.MsgPortBasePtr;
- taglist [10] : ARRAY OF u.TagItem )
- : AppMenuItemPtr;
- PROCEDURE AddAppMenuItem* [base,-72]
- ( id [0] : e.ULONG;
- userdata [1] : LONGINT;
- text [8] : ARRAY OF CHAR;
- msgport [9] : e.MsgPortPtr;
- taglist [10].. : u.Tag )
- : AppMenuItemPtr;
- PROCEDURE RemoveAppMenuItem* [base,-78]
- ( appMenuItem [8] : AppMenuItemPtr )
- : BOOLEAN;
-
- (*--- functions in V39 or higher (Release 3) ---*)
-
- PROCEDURE WBInfo* [base,-90]
- ( lock [8] : d.FileLockPtr;
- name [9] : ARRAY OF CHAR;
- screen [10] : i.ScreenPtr );
-
-
- (*-- Library Base variable --------------------------------------------*)
-
- <*$LongVars-*>
-
- (*-----------------------------------*)
- PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
-
- BEGIN (* CloseLib *)
- IF base # NIL THEN e.CloseLibrary (base) END;
- END CloseLib;
-
- BEGIN
- base := e.OpenLibrary (workbenchName, e.libraryMinimum);
- IF base # NIL THEN Kernel.SetCleanup (CloseLib) END
- END Workbench.
-