antoine-source/appleworksgs/PL/Src/PTOOL.S

1 line
4.3 KiB
ArmAsm
Executable File

load 'macros.dump'
include 'driver.equ'
include 'pl.equ'
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
IMPORT D_DrawIcon
IMPORT P_BuildUndo
IMPORT P_CheckIcon
IMPORT P_CkLoc
IMPORT P_ContentRect
IMPORT P_Cursor
IMPORT P_DeSelectAll
IMPORT P_FillMode
IMPORT P_FillRect
IMPORT P_FrameRect
IMPORT P_IconPalette
IMPORT P_IsObjSel
IMPORT P_KillImport
IMPORT P_LineSize
IMPORT P_Palette
IMPORT P_SetObjAttr
IMPORT P_ToolHeights
IMPORT P_ToolType
IMPORT P_UnCkIcon
IMPORT P_VisPalette
IMPORT T_Deactivate
;-----------------------------------------------
;
; Forward addresses and entries
;
;-----------------------------------------------
ENTRY P_NewTool
;---------------------------------------------------------------------------
;
; P_DrawTools
;
P_DrawTools PROC EXPORT
;Using P_IconData
;Using P_Data
;Using P_ObjData
LOCAL tmp:l,tmprect:r
BEGIN
call D_DrawIcon,in=(#P_IconPalette:l,#-1:w,#-1:w,#0:w)
tool _SetPenSize,in=(#2:w,#1:w)
tool _MoveTo,in=(#36:w,#0:w)
tool _LineTo,in=(#36:w,#220:w)
tool _PenNormal
tool _InvertRect,in=(#P_Palette:l)
lda P_FillMode
beq DoFrame
tool _InvertRect,in=(#P_FillRect:l)
bra DrawCheck
DoFrame tool _InvertRect,in=(#P_FrameRect:l)
DrawCheck lda P_LineSize
asl a
addlong a,#P_CkLoc,tmp
call D_DrawIcon,in=(#P_CheckIcon:l,#1:w,[tmp]:w,#0:w)
RETURN
ENDP
;------------------------------------------------------------------------------
;
; P_MDInTools (ThePt:l)
;
P_MDInTools PROC EXPORT
;Using P_IconData
;Using P_Data
;Using P_ObjData
INPUT ThePt:l
LOCAL Tmp:l,NewSize:w
BEGIN
lda ThePt
ldx #0
ToolLoop cmp P_ToolHeights,x
blt FoundIt
inx
inx
bra ToolLoop
FoundIt
txa
lsr a
cmp #P_CIRCLE+1
beq ChangeFill
bge ChangeLine
NewTool
call P_NewTool,in=(a:w,#1:w)
brl Exit
ChangeFill
lda ThePt+2
cmp P_FrameRect+6
bge DoFill
lda P_FillMode
beq SetFF
stz P_FillMode
bra DoFillStuff
DoFill
lda P_FillMode
bne SetFF
moveword #1,P_FillMode
DoFillStuff
tool _ClipRect,in=(#P_IconPalette:l)
tool _InvertRect,in=(#P_FillRect:l)
tool _InvertRect,in=(#P_FrameRect:l)
tool _ClipRect,in=(#P_ContentRect:l)
SetFF
call P_IsObjSel,out=(a:w)
beq ToExit
call P_BuildUndo,in=(#P_FillUndo:w)
call P_SetObjAttr,in=(#P_FillAttr:w,P_FillMode:w)
ToExit brl Exit
ChangeLine
subword a,#P_CIRCLE+1,NewSize
tool _ClipRect,in=(#P_IconPalette:l)
; uncheck old D_Mark
lda P_LineSize
asl a
addlong a,#P_CkLoc,tmp
call D_DrawIcon,in=(#P_UnCkIcon:l,#1:w,[tmp]:w,#0:w)
; check D_New D_Mark
lda NewSize
sta P_LineSize
asl a
addlong a,#P_CkLoc,tmp
call D_DrawIcon,in=(#P_CheckIcon:l,#1:w,[tmp]:w,#0:w)
tool _ClipRect,in=(#P_ContentRect:l)
call P_IsObjSel,out=(a:w)
beq Exit
call P_BuildUndo,in=(#P_PenSizeUndo:w)
call P_SetObjAttr,in=(#P_PenSizeAttr:w,P_LineSize:w)
Exit RETURN
ENDP
;---------------------------------------------------------------------------
;
; P_NewTool (NewTool:w; KillImport:w)
;
P_NewTool PROC EXPORT
;Using P_Data
;Using P_IconDATA
;Using P_OBJData
;Using T_Data
INPUT NewTool:w,KillImport:w
LOCAL CRect:r
BEGIN
tool _ClipRect,in=(#P_ContentRect:l)
cmpw NewTool,P_ToolType
jeq Exit
; Deselect old tool and select D_New one
stz CRect
stz CRect+2
moveword P_ContentRect+4,CRect+4
moveword P_IconPalette+6,CRect+6
tool _ClipRect,in=(!CRect:l)
lda P_VisPalette
beq NotVis1
tool _InvertRect,in=(#P_Palette:l)
NotVis1
lda NewTool
asl a
tax
lda CursorTypes,x
sta P_Cursor
lda P_ToolHeights,x
dec a
moveword a,P_Palette+4
subword a,#12,P_Palette
lda P_VisPalette
beq NotVis2
tool _InvertRect,in=(#P_Palette:l)
NotVis2
tool _ClipRect,in=(#P_ContentRect:l)
lda KillImport
beq NoKill
jsl P_KillImport
NoKill
; If we're un-using the Arrow tool, deselect everything.
lda P_ToolType
cmp #P_ARROW
bne UnText
call P_DeSelectAll
bra Choose
; If we're un-using the I-beam tool, deactivate the Q_Text.
UnText
cmp #P_ALPHA
bne Choose
call T_Deactivate,in=(#1:w,#1:w)
Choose
moveword NewTool,P_ToolType
Exit RETURN
CursorTypes
DC.W ArrowCursor
DC.W BeamCursor
DC.W PageNumCursor
DC.W DateCursor
DC.W -1
DC.W -1
DC.W -1
DC.W -1
DC.W -1
ENDP
END