supermario/base/SuperMarioProj.1994-02-09/Internal/Asm/TextEditPriv.a
2019-06-29 23:17:50 +08:00

285 lines
10 KiB
Plaintext

;
; File: TextEditPriv.a
;
; Contains: Private TextEdit equates.
;
; Written by: Sue Bartalo
;
; Copyright: © 1990-1992 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM3> 10/6/92 PN # 1040150 Get rid of Sysvers conditionals and bring the code to
; the current state (7.1)
; <16> 7/15/92 SMB ## <ys>: Move DoText selectors from here to ToolEqu.a (and
; Pascal/C equates) so the whole darn world can use them instead
; of hard-coded constants!
; <15> 9/15/91 YS Defined an offset to a byte in TEDispatchRec (lastscript), to be
; used by the split/single caret stuff. <15-YDS-8/27/91>
; <14> 8/26/91 JSM Cleanup header.
; <13> 2/14/91 SMB pke,#70628 - removing ForwardDeleteChar for now.
; <12> 2/1/91 SMB pke,#82169: Removing MetricsFrame. Renamed leftSide to
; leadingEdge in P2CFrame record. Added WidthRemaining to
; P2CFrame.
; <11> 1/14/91 SMB (jdt) Added forwardDeleteChar. Added MetricsFrame for
; _OutlineMetrics call in TextEdit.
; <10> 10/30/90 SMB Adding hasTextWidthHook conditional for the code changes
; supporting the new TextWidthhook. Also added hasBufferingFix for
; the code changes supporting the bug fixes for the text buffering
; feature. Increased size of TEDispatchRec, intDispSize, and moved
; frame for TextBox into here.
; <9> 9/11/90 SMB Added an equate, defBufSize, that was hiding deep in the bowels
; of InsertRecal! Also moved HiliteFrame here.
; <8> 6/11/90 SMB NEEDED for ROM builds: SysVers not defined for ROM so
; hasInlineInput flag must be set explicitly. Oops!
; <7> 6/11/90 SMB NEEDED FOR SIXPACK AND 7.0: added hasInlineInput conditional for
; Inline Input support.
; <5> 3/21/90 SMB NEEDED FOR SS-6.0.5: Fixing FmtOrderFrame to include LRTextFlag
; field for compatibility with the ROM.
; <4> 2/13/90 SMB NEEDED FOR 6.0.5 - removed teLFlush, teRFlush, and teCenter.
; Increased size of DispatchRec to allow for nWidthHook.
; <3> 1/30/90 SMB Needed For 6.0.5 - -Moved names of FindWord callers into
; ToolEqu.a. -Adding private equates and frames here and removing
; them from TextEdit.a.
; <2> 1/16/90 SMB Fixed comment in header.
; <1> 1/9/90 SB first checked in. Moved private definitions at end of
; TEDispatchRec here. Increased size of TEDispatchRec.
; NEEDED FOR 6.0.5: Moved newTEFlags and intDispSize here
; from ToolEqu.a. Also added TwoByteCharBuffer at end of
; TEDispatchRec since need it local for each TE record.
;___________________________________________________________________________________________________
IF &TYPE('__IncludingTextEditPriv__') = 'UNDEFINED' THEN
__IncludingTextEditPriv__ SET 1
IF forRom THEN ; <8>
hasInlineInput equ 1 ; <8>
hasTextWidthHook equ 1 ; <10>
hasBufferingFix equ 1 ; <10>
ELSE ; <8>
hasInlineInput equ SysVers >= $606 ; <7>
hasTextWidthHook equ SysVers >= $606 ; <10>
hasBufferingFix equ SysVers >= $606 ; <10>
ENDIF ; <8>
; -- private offsets into TEDispatchRec
newTEFlags EQU 16 ; teFAutoScr, tefTextBuffering, teFOutlineHilite <1>
TwoByteCharBuffer EQU 20 ; storage for buffered double-byte character <1>
lastScript EQU 22 ; keep last script for a proper split/single caret display <15-YDS-8/27/91>
measOverFlow EQU 0 ; text measure overflow (00000001b)
; -- size of TEDispatchRec
intDispSize EQU 32 ; <4><10>
teStylSize Equ 28 ; initial size of teStylesRec with 2 entries
stBaseSize Equ 20 ; added to fix MakeRoom bug
; TESetStyle/TEContinuousStyle modes
doAll2 EQU $1F ; all of the above + add size
doAll3 EQU $3F ; all of the above + toggle faces
BufferSize equ 50 ; <1Feb89smb> max num of bytes for text buffer
; defined key characters <7Aug89smb>
downArrowChar equ $1F
upArrowChar equ $1E
rightArrowChar equ $1D
leftArrowChar equ $1C
backspaceChar equ $08
returnChar equ $0D
tabChar equ $09
IF 0 THEN ; <13>
forwardDeleteChar equ $7F ; on extended keyboard <11>
ENDIF ; <13>
;-----------------------
inHandle Equ 8 ; TE handle offset
saveHandle Equ -2 ; incoming handle flags
savePort Equ saveHandle-4 ; incoming graf port
saveClip Equ savePort-4 ; incoming clip in TE port
saveTH Equ saveClip-2 ; saved text handle flags
saveFont Equ saveTH-2 ; Grafport's font
saveFace Equ saveFont-2 ; Grafport's face
saveSize Equ saveFace-2 ; Grafport's size
saveColor Equ saveSize-6 ; Grafport's color
stdLink Equ saveColor
lnStStartSize equ 2 ; stStartSize = 4; bit shift left of 2! <26June89smb>
UnboundLeft equ $8002 ; unbound left edge for rectangle (hilite, erase, etc) <12July89smb>
UnboundRight equ $7FFE ; unbound right edge for rectangle (hilite, erase, etc) <12July89smb>
numStyleRuns equ 10 ; <28Sept88smb> max # for local frame; if more, allocate handle
FmtOrderFrame record 0 ; <13Mar89smb> broke these fields out into another record
; The record is in incremental order but the frames including it are in decremental order so it
; would change the offsets of the other elements in the record if they were added at the "bottom"
firstStyleRun ds.l 1 ; <18Nov89smb> moved here for TextFrame
secondStyleRun ds.l 1 ; <18Nov89smb> moved here for TextFrame
directionParam equ * ; beginning of dirParams for dirProc
startStyleRun ds.l 1 ; directionParam: address of styleRun array at d3
teRecPtr ds.l 1 ; directionParam: ptr to teRecord
LRTextFlag ds.w 1 ; set but not tested (place holder for ROM frame).
numberOfRuns ds.w 1 ; num of style runs on current (a2) line
styleRunIndex ds.w 1 ; dummy entry (for GetNextDisplayStyle)
fmtOrdering ds.w numStyleRuns
fmtOrderingPtr ds.l 1
a2StyleRun ds.l 1 ; is an offset for a styled teRec, otherwise a ptr <5Aug89smb>
fmtOrderingIndex ds.w 1
endR
; standard frame for doText ; <4Oct88smb>
TextFrame record {a6Link},decr
a6Link ds.l 1
saveLeft ds.w 1 ; true left
saveJust ds.w 1 ; left setting after justification
useOldMethod ds.w 1
TEFormatOrder ds FmtOrderFrame ; <13Mar89smb>
TextFrameSz equ *
endR
;saveLeft Equ -2 ; true left
;saveJust Equ saveLeft-2 ; left setting after justification
;txtLink Equ saveJust ; <28Sept88smb> - replaced with above record
SharedFrame record {a6Link},decr
a6Link ds.l 1 ; shared storage: maintain ordering here!
dummy ds.l 1 ; space filler for template ordering.
dummyByte ds.b 1 ; as named <6Mar89smb>
doneFlag ds.b 1
TEFormatOrder ds FmtOrderFrame ; <13Mar89smb>
; *** storage shared between CaretDisplay and OnSameLine ***
;;<8Nov89smb> moved to FmtOrderFrame secondStyleRun ds.l 1
;;<8Nov89smb> moved to FmtOrderFrame firstStyleRun ds.l 1
selRectR ds.w 1
selRectB ds.w 1
selRectL ds.w 1
selRectT ds.w 1
; *** CaretDisplay unique storage <4Jan89smb> ***
cursorScriptDir ds.b 1
previousScriptDir ds.b 1
scriptDirection ds.b 1
prevStyleFlag ds.b 1
onBoundaryFlag ds.b 1
gotOneRun ds.b 1
lineEndFlag ds.b 1 ; changed to byte <6Mar89smb>
highCaret ds.b 1 ; changed to byte <6Mar89smb>
; *** OnSameLine unique storage <4Jan89smb> ***
d3StyleRun ds.l 1 ; preserve address of styleRun array at d3 (1st char posn)
d4StyleRun ds.l 1 ; preserve address of styleRun array at d4 (2nd char posn)
totalWidth ds.w 1
foundD3 ds.b 1 ; flag T if found d3 format index
foundD4 ds.b 1 ; flag T if found d4 format index
d3FmtIndex ds.w 1 ; d3 format ordering
d4FmtIndex ds.w 1 ; d4 format ordering
sameStyle ds.b 1 ; flag T if [d3,d4] in same style run
hiliteInbetween ds.b 1
saveD3 ds.w 1
saveD4 ds.w 1
anchorL ds.w 1 ; for hiliting the middle rectangle
anchorR ds.w 1 ; for hiliting the middle rectangle
offPairs ds.l 3 ; storage for offset pairs returned from HiliteText
hiliteLEndFlag ds.b 1
hiliteREndFlag ds.b 1
SharedFrameSz equ *
endR
; frame for recallines
savedD4 Equ -2
savedD2 Equ savedD4-2
startHndl Equ savedD2-4
savePtr Equ startHndl-4
oldNLines Equ savePtr-2
RecalLink Equ oldNLines
defBufSize Equ 256 ; initial size of temp line start buffer in InsertRecal <9>
; frame for new GetCurScript // <DGO 880819>
gcsTemp equ -4
gcsIndex equ gcsTemp-2
gcsLink equ gcsIndex
; replaced Dave's equates with a frame <23May89smb>
FindWordFrame record {a6Link},decr
a6Link ds.l 1
fwOffTab ds.l 3
fwSelWrap ds.l 1
fwSRTxtPtr ds.l 1
fwSavedD2 ds.l 1
fwLeadingEdge ds.w 1
fwSROffset ds.w 1
fwSRLength ds.w 1
fwSRFont ds.w 1
fwSRIndx ds.w 1
fwSRStrtCh ds.w 1
fwLink equ *
endR
; frame for Outline Hilighting in TEActivate and TEDeactivate <21Sept89smb>
OutlineFrame record {a6Link},decr
a6Link ds.l 1
oldPenState ds.b 18 ; 18 bytes for pnLoc, pnSize, pnMode, pnPat
oldHighHook ds.l 1
oldCaretHook ds.l 1
paintFlag ds.b 1 ; <16Oct89smb>
dummy ds.b 1 ; <16Oct89smb>
OutlineFrameSz equ *
endR
CursorFrame record {a6Link},decr
a6Link ds.l 1
dummies ds.w 3 ; space fillers due to necc positioning in template
TEFormatOrder ds FmtOrderFrame ; <13Mar89smb>
FormatEndFlag ds.b 1
RunDirection ds.w 1 ; <17Jan89smb>
CursorFrameSz equ *
endR
LineBreakFrame record {oldA6},decrement
oldA6 ds.l 1
length ds.l 1 ; StyledLineBreak param
width ds.l 1 ; StyledLineBreak param
offset ds.l 1 ; StyledLineBreak param
start ds.l 1 ; StyledLineBreak param
end ds.l 1 ; StyledLineBreak param
currStyle ds.l 1
nextStyle ds.l 1
textPtr ds.l 1
initlTextPtr ds.l 1
textPtrOffset ds.w 1
lineStart ds.w 1
EOLCharPosn ds.w 1 ; current EOL (char posn) accumulated by style runs
styleIndex ds.w 1
localFrame equ *
endR
P2CFrame record {a6Link},decr
return ds.l 1
a6Link ds.l 1
leadingEdge ds.w 1 ; was named leftSide <12>
textLen ds.w 1
textPtr ds.l 1
pixelWidth ds.w 1
slop ds.w 1
txtWidth ds.w 1
widthRemaining ds.l 1 ; fixed for NPixel2Char <12>
locals equ *
endR
HiliteFrame record {a6Link},decr ; <9>
a6Link ds.l 1
savD4 ds.w 1
d3Line ds.l 1 ; ptr to lineStart for d3
d4Line ds.l 1 ; ptr to lineStart for d4
HiLiteSz equ *
endR
; frame for TextBox <10>
TBJust Equ 8
TBBox Equ 10
TBLength Equ 14
TBText Equ 18
ENDIF ; ...already included