home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel Volume 2 #1
/
carousel.iso
/
mactosh
/
lang
/
listmana.sha
/
ldproc0.asm
next >
Wrap
Assembly Source File
|
1986-07-10
|
5KB
|
172 lines
; File LDefProc0.Text
;-------------------------------------------------------------
;
; Standard List Definition Procedure for simple text
;
; Ernie Beernink March 1985
;
; This is the standard List defProc. Its primary task is to draw
; the contents of a list manager cell, either selected or deselected.
; It is passed a pointer to the cell's data, the length of the cell's
; data, and a rectangle in which to draw the cell. When it is called,
; the clip region is set to that rect.
; MODIFICATION HISTORY:
;
;-------------------------------------------------------------
ROM128K equ 0
HFSUsed equ 0
; .INCLUDE TLAsm/SysEqu.text
; .INCLUDE TLAsm/ToolEqu.text
; .INCLUDE TLAsm/QuickEqu.text
; .INCLUDE TLAsm/QuickTraps.text
; .INCLUDE TLAsm/PackMacs.text
public LDEF0
LDEF0
; PROCEDURE DrawCell(LMessage:INTEGER; LSelect:BOOLEAN; LRect:Rect; LCell: Cell;
; LDataOffset, LDataLen:INTEGER; LHandle:Handle);
; Message equates:
;InitMsg .EQU 0 ; tell drawing routines to init themselves
;DrawMsg .EQU 1 ; draw (and de/select) the indicated data
;HiliteMsg .EQU 2 ; de/select the indicated data
;CloseMsg .EQU 3 ; shut down, the list is being disposed
; Traps used
_GetFontInfo equ $a88b
_InverRect equ $a8a4
_AddPt equ $a87e
_MoveTo equ $a893
_PenNormal equ $a89e
_EraseRect equ $a8a3
_DrawText equ $a885
; Structure offsets used
; Point
v equ 0
h equ 2
; Rect
topLeft equ 0
; ListRec
indent equ 12
cells equ 80
; bit in heap flags
lock equ 7
; Stack Frame definition for ListDefProc 0
LHandle equ 8 ; Handle to list data record
LDataLen equ LHandle+4 ; length of data
LDataOffset equ LDataLen+2 ; offset to data
LCell equ LDataOffset+2 ; cell that was hit
LstRect equ LCell+4 ; rect to draw in
LSelect equ LstRect+4 ; 1=selected, 0=not selected
LMessage equ LSelect+2 ; 0=Init, 1=Draw, 2=Hilite, 3=Close
LParamSize equ LMessage+2-8 ; # of bytes of parameters
BRA.S a ; enter here
; standard header
dc.w 0 ; flags word
dc.b "LDEF" ; type
dc.w 0 ; ID
dc.w 0 ; version
a
LINK A6,#0 ; set up a stack frame
MOVEM.L D3-D7/A2-A4,-(SP) ; save the usual stuff
MOVE.L LHandle(A6),A4 ; get handle to list record
MOVE.L (A4),A3 ; get pointer to (locked) record
MOVE.W LMessage(A6),D0 ; why am I being called?
SUBQ #1,D0 ; check next in line
BEQ.S LstDraw ; code = 1 -> draw cell
SUBQ #1,D0 ; check next
BEQ.S LHilite ; code = 2 -> invert cell
BPL.S LDefExit ; other calls not needed here
;---------------
; LInit
; Here is the code that does the initialization for this defproc
LInit
; just set up our indent
SUBQ #8,SP ; make room for GetFontInfo record
MOVE.L SP,-(SP) ; point to it
dc.w _GetFontInfo ; and go get info
MOVE.W (SP),indent+v(A3) ; indent.v := ascent
MOVE.W #4,indent+h(A3) ; indent.h := 4
ADDQ #8,SP ; fix up stack
LDefExit
MOVEM.L (SP)+,D3-D7/A2-A4 ; restore the usual stuff
UNLK A6 ; unlink our frame
MOVE.L (SP)+,A0 ; get return address
ADD.L #LParamSize,SP ; strip off parameters
JMP (A0) ; and return
;---------------
; LHilite -- Here is the code that hilights/unhilights the
; cell. We know that it's drawn, and that we're only called
; if it needs to be de/selected, so inverrect is all we need.
LHilite
MOVE.L LstRect(A6),-(SP) ; push rect
dc.w _InverRect ; and invert it
BRA.S LDefExit ; all done
;---------------
; LstDraw -- Here is the code th
at does the drawing
; for the defProc.
LstDraw
MOVE.L LstRect(A6),A4 ; get rect into A4
MOVE.L topLeft(A4),-(SP) ; move pen to indent point
MOVE.L indent(A3),-(SP)
PEA 4(SP)
dc.w _AddPt
dc.w _MoveTo
; use default text mode
dc.w _PenNormal
MOVE.L cells(A3),A2 ; get data handle
MOVE.B (A2),-(SP) ; save current state
BSET #lock,(A2) ; and lock it
MOVE.L A4,-(SP) ; clear out the rect
dc.w _EraseRect
MOVE.W LDataLen(A6),D3 ; anything to draw?
BLE.S b ; =>nope, don't draw
MOVE.L (A2),-(SP) ; point to the text
MOVE.W LDataOffset(A6),-(SP) ; offset to first byte
MOVE.W D3,-(SP) ; and number of bytes
dc.w _DrawText
b
TST.B LSelect(A6) ; selected?
BEQ.S c
MOVE.L A4,-(SP) ; push rect
dc.w _InverRect ; and invert it
c
MOVE.B (SP)+,(A2) ; restore lock state
BRA.S LDefExit ; and return
; end of ldproc0.asm