

*********************************************************************
*
* workbench.h
*
* $Header: workbench.i,v 31.2 85/09/02 21:32:18 neil Exp $
*
* $Locker:  $
*
*********************************************************************

   IFND   EXEC_TYPES_I
   INCLUDE   "exec/types.i"
   ENDC

   IFND   EXEC_NODES_I
   INCLUDE   "exec/nodes.i"
   ENDC

   IFND   EXEC_LISTS_I
   INCLUDE   "exec/lists.i"
   ENDC

   IFND   EXEC_TASKS_I
   INCLUDE   "exec/tasks.i"
   ENDC

   IFND   INTUITION_INTUITION_I
   INCLUDE   "intuition/intuition.i"
   ENDC


; the Workbench object types
WBDISK      EQU   1
WBDRAWER   EQU   2
WBTOOL      EQU   3
WBPROJECT   EQU   4
WBGARBAGE   EQU   5
WBDEVICE   EQU   6
WBKICK      EQU   7


; the main workbench object structure
 STRUCTURE DrawerData,0
    STRUCT   dd_NewWindow,nw_SIZE   ; args to open window
    LONG   dd_CurrentX      ; current x coordinate of origin
    LONG   dd_CurrentY      ; current y coordinate of origin
    LONG   dd_MinX         ; smallest x coordinate in window
    LONG   dd_MinY         ; smallest y coordinate in window
    LONG   dd_MaxX         ; largest x coordinate in window
    LONG   dd_MaxY         ; largest y coordinate in window
    STRUCT   dd_HorizScroll,gg_SIZEOF
    STRUCT   dd_VertScroll,gg_SIZEOF
    STRUCT   dd_UpMove,gg_SIZEOF
    STRUCT   dd_DownMove,gg_SIZEOF
    STRUCT   dd_LeftMove,gg_SIZEOF
    STRUCT   dd_RightMove,gg_SIZEOF
    STRUCT   dd_HorizImage,ig_SIZEOF
    STRUCT   dd_VertImage,ig_SIZEOF
    STRUCT   dd_HorizProp,pi_SIZEOF
    STRUCT   dd_VertProp,pi_SIZEOF
    APTR   dd_DrawerWin      ; pointer to drawers window
    APTR   dd_Object      ; back pointer to drawer object
    STRUCT   dd_Children,LN_SIZE   ; where our children hang out
    LONG   dd_Lock
    LABEL   dd_SIZEOF

; the amount of DrawerData actually written to disk
DRAWERDATAFILESIZE   EQU (nw_SIZE+2*(4))


 STRUCTURE DiskObject,0
    UWORD   do_Magic       ; a magic num at the start of the file
    UWORD   do_Version       ; a version number, so we can change it
    STRUCT   do_Gadget,gg_SIZEOF   ; a copy of in core gadget
    UWORD    do_Type
    APTR   do_DefaultTool
    APTR   do_ToolTypes
    LONG   do_CurrentX
    LONG   do_CurrentY
    APTR   do_DrawerData
    APTR   do_ToolWindow      ; only applies to tools
    LONG   do_StackSize      ; only applies to tools
    LABEL   do_SIZEOF

WB_DISKMAGIC   EQU   $e310   ; a magic number, not easily impersonated
WB_DISKVERSION   EQU   1   ; our current version number

 STRUCTURE FreeList,0
    WORD   fl_NumFree
    STRUCT   fl_MemList,LH_SIZE
    ; weird name to avoid conflicts with FileLocks
    LABEL   FreeList_SIZEOF


 STRUCTURE WBObject,0
    STRUCT   wo_MasterNode,LN_SIZE   ; all objects are on this list
    STRUCT   wo_Siblings,LN_SIZE   ; list of drawer members
    STRUCT   wo_SelectNode,LN_SIZE   ; list of all selected objects
    STRUCT   wo_UtilityNode,LN_SIZE   ; function specific linkages
    APTR   wo_Parent

    ; object flags -- see below for definitions
    UBYTE   wo_Flags

    UBYTE   wo_Type         ; what flavor object is this?
    USHORT   wo_UseCount      ; number of references to this obj
    APTR   wo_Name         ; this object's textual name
    SHORT   wo_NameXOffset      ; where to put the name
    SHORT   wo_NameYOffset

    APTR   wo_DefaultTool
    APTR   wo_DrawerData      ; if this is a drawer or disk
    APTR   wo_IconWin       ; each object's icon lives here
    LONG   wo_CurrentX      ; virtual X in drawer
    LONG   wo_CurrentY      ; virtual Y in drawer
    APTR   wo_ToolTypes      ; the types for this tool
    STRUCT   wo_Gadget,gg_SIZEOF   ; NOT a ptr, but an instance of it
    STRUCT   wo_FreeList,FreeList_SIZEOF   ; this objects free list
    APTR   wo_ToolWindow      ; character string for tool's window
    LONG   wo_StackSize      ; how much stack to give to this
    LONG   wo_Lock         ; if this tool is in the backdrop
    LABEL   wo_SIZEOF

    ; workbench object flags
    BITDEF   WO,IconDisp,7   ; icon is currently in a window
    BITDEF   WO,DrawerOpen,6   ; we're a drawer, and it is open
    BITDEF   WO,Selected,5   ; our icon is selected
    BITDEF   WO,Background,4   ; set if icon is in background


* each message that comes into the WorkBenchPort must have a type field
* in the preceeding short.  These are the defines for this type
*

MTYPE_PSTD      EQU   1   ; a "standard Potion" message
MTYPE_TOOLEXIT      EQU   2   ; exit message from our tools
MTYPE_DISKCHANGE   EQU   3   ; dos telling us of a disk change
MTYPE_TIMER      EQU   4   ; we got a timer tick
MTYPE_CLOSEDOWN      EQU   5   ; <unimplemented>
MTYPE_IOPROC      EQU   6   ; <unimplemented>

; we use the gadget id field to encode some special information
GID_WBOBJECT   EQU   0   ; a normal workbench object
GID_HORIZSCROLL   EQU   1   ; the horizontal scroll gadget for a drawer
GID_VERTSCROLL   EQU   2   ; the vertical scroll gadget for a drawer
GID_LEFTSCROLL   EQU   3   ; move one window left
GID_RIGHTSCROLL   EQU   4   ; move one window right
GID_UPSCROLL   EQU   5   ; move one window up
GID_DOWNSCROLL   EQU   6   ; move one window down
GID_NAME   EQU   7   ; the name field for an object


* 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      EQU   $0001

* if an icon does not really live anywhere, set its current position
* to here
*
NO_ICON_POSITION   EQU   ($80000000)
