sys7.1-doc-wip/ProcessMgr/PuppetString.MacWrite.a

122 lines
3.6 KiB
Plaintext

;
; File: PuppetString.MacWrite.a
;
; Contains: Puppet string conversion table custumized for MacWrite
;
; Written by: Phil Goldman
;
; Copyright: © 1986-1991 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <0> x/xx/86 PYG New Today.
;
;--------------------------------------------------------------------
;--------------------------------------------------------------------
;
; This table is used to convert puppet instructions to event sequences specifically
; for MacWrite. MacWrite is identified as having a creator equal to 'MACA'. The basic
; instructions are handled by the default table defined in PuppetString.Default.a.
;
;--------------------------------------------------------------------
LOAD 'ProcessMgrIncludes.D'
PRINT OFF
INCLUDE 'PuppetStringDefs.a'
PRINT ON
FUNC
BLANKS ON
STRING ASIS
TableTop
NumberOfEntries DC.B (EntriesBottom-EntriesTop)/6,0
EntriesTop
ResetEntry DC.W pstNullInstr
DC.L 0
CutEntry DC.W pstMenuItem
DC.W 3,3
CopyEntry DC.W pstMenuItem
DC.W 3,4
PasteEntry DC.W pstMenuItem
DC.W 3,5
SelectRectEntry DC.W pstEventList
DC.L SREvtList-TableTop
SelectAllEntry DC.W pstEventCode
DC.L SAEvtCode-TableTop
MemCopyEntry DC.W pstIllegalInstr
DC.L 0
OutlineRectEntry DC.W pstNullInstr
DC.L 0
EntriesBottom
SREvtList
SRParamCount DC.W (SREvtListOffset-SRParams)/6
SRParams
SRParam1 DC.L SRParam1LocStart-TableTop
DC.W SRParam1LocEnd-SRParam1LocStart
SRParam2 DC.L SRParam2LocStart-TableTop
DC.W SRParam2LocEnd-SRParam2LocStart
SREvtListOffset DC.L 6
SREvtListCount DC.W (SREvtListBottom-SREvt1)/evtBlkSize
SREvt1
SREvt1what DC.W mButDwnEvt+evtMouseEither+evtIsImportant
SREvt1message DC.L 0
SREvt1when DC.L 0
SRParam1LocStart
SREvt1where DC.W 0,0
SRParam1LocEnd
SREvt1modifiers DC.W 0
SREvt2
SREvt2what DC.W mButUpEvt+evtMouseEither+evtIsUnimportant
SREvt2message DC.L 0
SREvt2when DC.L 0
SRParam2LocStart
SREvt2where DC.W 0,0
SRParam2LocEnd
SREvt2modifiers DC.W $80
SREvtListBottom
SAEvtCode ; just do select rectangle of whole window
MOVE.L (SP)+,D1 ;get return address
ADD #4,SP ;skip event ptr
MOVE.L D1,-(SP) ;put return address back on stack
LEA SREvtListOffset,A0
MOVE.L #SREvtListBottom-SREvtListOffset,D0 ;get length
_PtrToHand
MOVE.W D0,D0 ;check result code
BNE.S SAErr ;if error, branch
MOVE.L A0,4(SP) ;save handle in return location
MOVE.L (A0),A0 ;handle -> ptr
; make sure the ulh pt is local, lrh pt is global
MOVE.W #evtMouseLocal,SREvt1modifiers-SREvtListOffset(A0)
MOVE.W #evtMouseGlobal,SREvt2modifiers-SREvtListOffset(A0)
; ulh pt is local coord 0
MOVE.W #0,SRParam1LocStart-SREvtListOffset(A0)
; now get coordinates of LRH corner of the top window
MOVE.L WindowList,A1 ;get top window
MOVE.L contRgn(A1),A1 ;get handle to content region
MOVE.L (A1),A1 ;handle -> ptr
MOVE.L rgnBBox+botRight(A1),D0 ;get lrh pt of cont rgn
MOVE.L GrafGlobals(A5),A1 ;get ptr to qd globals
MOVE.L screenBits+bounds+botRight(A1),D1 ;get lrh pt of screen
CMP.W D1,D0 ;is x coord offscreen
BLE.S @0 ;if not, branch
MOVE.W D1,D0 ;otherwise use screen bound
@0 SWAP D0 ;get y coord in lower word
SWAP D1 ;get y coord in lower word
CMP.W D1,D0 ;is y coord offscreen
BLE.S @1 ;if not, branch
MOVE.W D1,D0 ;otherwise use screen bound
@1 SWAP D0 ;set him back correctly
MOVE.L D0,SRParam2LocStart-SREvtListOffset(A0)
RTS
SAErr
MOVE.L #0,4(SP)
RTS
END