home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
code
/
asm_ldef.sit
< prev
next >
Wrap
Text File
|
1988-06-20
|
6KB
|
158 lines
18-Jun-88 14:33:07-MDT,5729;000000000000
Return-Path: <u-lchoqu%sunset@cs.utah.edu>
Received: from cs.utah.edu by SIMTEL20.ARPA with TCP; Sat, 18 Jun 88 14:33:00 MDT
Received: by cs.utah.edu (5.54/utah-2.0-cs)
id AA22299; Sat, 18 Jun 88 14:33:01 MDT
Received: by sunset.utah.edu (5.54/utah-2.0-leaf)
id AA24661; Sat, 18 Jun 88 14:32:59 MDT
Date: Sat, 18 Jun 88 14:32:59 MDT
From: u-lchoqu%sunset@cs.utah.edu (Lee Choquette)
Message-Id: <8806182032.AA24661@sunset.utah.edu>
To: rthum@simtel20.arpa
Subject: LDEF-zero.asm
; 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
.PROC 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
; 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 @0 ; enter here
; standard header
.WORD 0 ; flags word
.ASCII 'LDEF' ; type
.WORD 0 ; ID
.WORD 0 ; version
@0
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
_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
_InverRect ; and invert it
BRA.S LDefExit ; all done
;---------------
; LstDraw -- Here is the code that 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)
_AddPt
_MoveTo
; use default text mode
_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
_EraseRect
MOVE.W LDataLen(A6),D3 ; anything to draw?
BLE.S @1 ; =>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
_DrawText
@1
TST.B LSelect(A6) ; selected?
BEQ.S @0
MOVE.L A4,-(SP) ; push rect
_InverRect ; and invert it
@0
MOVE.B (SP)+,(A2) ; restore lock state
BRA.S LDefExit ; and return
.END