        IFND	LIBRARIES_NOTIFYINTUITION_I
LIBRARIES_NOTIFYINTUITION_I	SET	1
**
**	$VER: notifyintuition.i 2.40 (01.06.96)
**	Includes Release 40.15
**
**	Definitions for the notifyintuition library base
**
**	(C) Copyright 1994-96 Hans-W. Schober
**	    All Rights Reserved
**

        IFND	EXEC_PORTS_I
        INCLUDE	"exec/ports.i"
        ENDC
        IFND	EXEC_TASKS_I
        INCLUDE	"exec/tasks.i"
        ENDC

;------ IntNotifyRequest ----------------------------------------------

; Do not send to dos.library :-)

 STRUCTURE IntNotifyRequest,0
    CPTR   inr_Name                 ; Application sets this Pattern/Name
                                    ; like (WORKBENCH|DOPUS*)
    CPTR   inr_Tokenstring          ; Tokenstring created by notifyintuition.lib
    ULONG  inr_UserData             ; for the application's use
    ULONG  inr_Flags                ; see below

    ;-- inr_Msg:
    LABEL  inr_Task                 ; struct Task * for SEND_SIGNAL
    LABEL  inr_Port                 ; struct MsgPort * for SEND_MESSAGE
    APTR   inr_Hook                 ; notify.lib used your Entrypoint * for USE_HOOK

    ;-- inr_Signal:
    UBYTE  inr_SignalNum            ; for SEND_SIGNAL
    BYTE   inr_Error                ; An Error occured during NotIStartNotify()/NotIEndNotify()
    BYTE   inr_Pri                  ; Set your priority on NotIStartNotify()
    BYTE   inr_pad

    ;-- Unique:
    ULONG  inr_UniqueID             ; Make your tools sensetive to run only one of it

    ;-- Reserved fields:
    STRUCT inr_Reserved,3*4         ; I need it

    ;-- internal for use by handlers
    ULONG  inr_MsgCount             ; # of outstanding msgs
    APTR   inr_ReqSemaphore         ; Semaphore created by NotIStartNotify()
                                    ; Use AttemptSemaphore(), if you want no msg now
    LABEL  IntNotifyRequest_SIZEOF


;------ IntNotifyMessage ----------------------------------------------

; Sent to the application if SEND_MESSAGE is specified.
; Pointer in A1 if USE_HOOK is specified.

 STRUCTURE IntNotifyMessage,MN_SIZE
    ULONG  inm_Class
    UWORD  inm_Code
    APTR   inm_NReq                 ; Your STRUCT (IntNotifyRequest) don't modify the request!
    APTR   inm_IntObject            ; IntuitionObject like Screen or Window you wish reported to
    APTR   inm_TagListPtr           ; from OpenWindow/OpenScreen(TagList)
                                    ; You can modify or set the taglist in this message for use
                                    ; BEFORE_OPENWINDOW o. BEFORE_OPENSCREEN with WAIT_REPLY or USE_HOOK !!
    APTR   inm_Task                 ; Taskaddress from caller
    ULONG  inm_DoNotTouch1
    LABEL  IntNotifyMessage_SIZEOF

; Do not modify or re-use the intnotifyrequest while it is active.

;------ IntNotifyMessage Class ----------------------------------------

INTNOTIFY_CLASS   EQU   $43210000

;------ IntNotifyRequest Flags ----------------------------------------

   BITDEF  INR,SEND_MESSAGE,0          ; put your msg_Port in inr_Port
   BITDEF  INR,SEND_SIGNAL,1           ; put Taskaddress in inr_Task, it will wake up
   BITDEF  INR,USE_HOOK,2              ; Your entrypoint is used on notify
                                       ; A0=Hookaddress A1=STRUCT (IntNotifyMessage)
                                       ; A2=STRUCT (IntNotifyRequest)
                                       ; no need to restore Registers after call
   BITDEF  INR,WAIT_REPLY,4            ; If SEND_MESSAGE then notify.lib will wait for your reply
   BITDEF  INR,NOTIFY_INITIAL,5        ; You get an initial notifymsg/signal/hook

   BITDEF  INR,BEFORE_OPENSCREEN,6     ; a screen will be opened. Set or modify the TagList
   BITDEF  INR,AFTER_OPENSCREEN,7      ; If screen is now open
   BITDEF  INR,BEFORE_CLOSESCREEN,8    ; The screen will be closed
   BITDEF  INR,AFTER_CLOSEWINDOW_ON_SCREEN,9 ; There is allready closed a window on the screen
                                       ; Only if _NOT_ your window. So SEND_MESSAGE!WAIT_REPLY no risc
   BITDEF  INR,AFTER_PUBSCREENMODE,10  ; PubScreenStatus is changed
   BITDEF  INR,BEFORE_OPENWINDOW,11    ; a window will be opened. Set or modify the TagList
   BITDEF  INR,AFTER_OPENWINDOW,12     ; Notify for a window. Pattern of name in inr_Name
   BITDEF  INR,BEFORE_CLOSEWINDOW,13   ; Specified window will close now
   BITDEF  INR,AFTER_OPENWORKBENCH,14  ; If Workbench is open now
   BITDEF  INR,BEFORE_CLOSEWORKBENCH,15 ; Workbench will close now
   BITDEF  INR,BEFORE_LOCKPUBSCREEN,16 ; Name (inm_TagListPtr ) will locked now,
                                       ; you can open the screen now, if not available yet
   BITDEF  INR,AFTER_SCREENTOFRONT,17  ;
   BITDEF  INR,AFTER_SCREENTOBACK,18   ;

   BITDEF  INR,NOT_MYOWNREQUEST,23     ; does not report the actions caused by you

; If no inr_name given, all screens/windows would be reportet

* Flags reserved for private use by the notifyintuition.library:
INR_LIBRARY_FLAGS   EQU  $ff000000

;------ IntNotifyMessage Code -----------------------------------------

INRCODE_BEFORE_OPENSCREEN     EQU  $0001
INRCODE_AFTER_OPENSCREEN      EQU  $0002
INRCODE_BEFORE_CLOSESCREEN    EQU  $0004
INRCODE_AFTER_CLOSEWINSCREEN  EQU  $0008
INRCODE_AFTER_CHANGEPUBMODE   EQU  $0010
INRCODE_BEFORE_OPENWINDOW     EQU  $0020
INRCODE_AFTER_OPENWINDOW      EQU  $0040
INRCODE_BEFORE_CLOSEWINDOW    EQU  $0080
INRCODE_AFTER_OPENWORKBENCH   EQU  $0100
INRCODE_BEFORE_CLOSEWORKBENCH EQU  $0200
INRCODE_BEFORE_LOCKPUBSCREEN  EQU  $0400
INRCODE_AFTER_SCREENTOFRONT   EQU  $0800
INRCODE_AFTER_SCREENTOBACK    EQU  $1000

;------ IntNotifyError Codes ------------------------------------------

INRERROR_UNIQUE            EQU  98      ; This ID is already runnig
INRERROR_NOFLAGS           EQU  99      ; SEND_MESSAGE ? SEND_SIGNAL ? USE_HOOK
INRERROR_WRONGTYPE         EQU 100      ; for SEND_MESSAGE it must be a MsgPort (LN_TYPE==NT_MSGPORT)
                                        ; for SEND_SIGNAL it must be a Process (LN_TYPE==NT_PROCESS)
INRERROR_NOSIGNAL          EQU 101      ; no Signal given. Do not use NULL
INRERROR_NOTHINGTODO       EQU 102      ; define the MsgType you want
INRERROR_LOWMEM            EQU 103      ; No Memory available

INRERROR_OUTSTANDING_MSGS  EQU -1       ; Clean up your MsgPort
INRERROR_ISLOCKED          EQU -2       ; eg. cant free it while locked
INRERROR_UNKNOWN           EQU -3       ; is not started with NotIStartNotify()
INRERROR_INUSE             EQU -4       ; Notify allready startet

NOTIFYINTNAME MACRO
notifyintuitionname   dc.b  'notifyintuition.library',0
        cnop 0,2
_NotIBase      dc.l 0
        ENDM

NotI_VERSION EQU 2

OPENNOTIFYINT MACRO
      lea      notifyintuitionname(pc),a1
      moveq    #NotI_VERSION,d0
      CALLEXEC OpenLibrary
      lea      _NotIBase(pc),a0
      move.l   d0,(a0)
      ENDM

_LVONotIStartNotify    EQU  -30  A0=STRUCT(IntNotifyRequest)
_LVONotIEndNotify      EQU  -36  A0=STRUCT(IntNotifyRequest)
_LVONotIFindUniqueTask EQU  -42  D0=UniqueID

      ENDC     ; LIBRARIES_NOTIFYINTUITION_I
