antoine-source/appleworksgs/WP/Src/Delete.aii
2023-03-04 03:45:20 +01:00

1 line
5.9 KiB
Plaintext
Executable File

load 'macros.dump'
include 'driver.equ'
include 'wp.equ'
include 'wp.macros'
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
IMPORT W_CalcDocRect
IMPORT W_CalcFBytes
IMPORT W_CalcPages
IMPORT W_CheckDocPos
IMPORT W_CurDoc
IMPORT W_DelPars
IMPORT W_DoRoom
IMPORT W_eOffset
IMPORT W_EndLine
IMPORT W_EndOffset
IMPORT W_EndPar
IMPORT W_FindFont
IMPORT W_FindLine
IMPORT W_GetAddr
IMPORT W_GetEndPar
IMPORT W_GetParRec
IMPORT W_JunkLeft
IMPORT W_JunkRight
IMPORT W_LessRoom
IMPORT W_LineToTopPixel
IMPORT W_MakeCaret
IMPORT W_MakeLines
IMPORT W_ParRec
IMPORT W_PutOnScreen
IMPORT W_SelectOff
IMPORT W_STLIne
IMPORT W_StartLine
IMPORT W_StartOffset
IMPORT W_StartPar
IMPORT W_UnUseRuler
IMPORT W_UpdateText
IMPORT W_UseRuler
IMPORT W_WriteFBytes2
IMPORT Q_Line
IMPORT W_offset
IMPORT Q_Rect
IMPORT W_Selected
********************************************************************
* Includes....
* Thursday, April 27, 1989 1:38:25 AM
********************************************************************
****************************************************************
* W_DeleteRange(par,Q_Line,W_offset,par,Q_Line,W_offset)
W_DeleteRange PROC EXPORT
input par:w,Q_Line:w,W_offset:w,EPar:w,ELine:w,W_eOffset:w
local FBytes:w,temp:w,PlacePtr:l,bytes:w
local Font1:l,col1:w,Font2:l,col2:w,PBFlag:w,W_ParRec:l
local SParRec:l,EParRec:l
output OPar:w,OLine:w,OOffset:w
begin
stz PBFlag
moveword par,OPar
moveword Q_Line,Oline
lda Par
jsl W_GetParRec
movelong ax,W_ParRec
moveword [W_ParRec]:#W_pAttr,a
and #W_PgBrk
beq NoPb
inc PBFlag
inc par
stz Q_Line
moveword #W_TextHeader,W_offset
cmpw par,EPar
bne NoPb
cmpw Q_Line,ELine
bne NoPB
cmpw W_offset,W_eOffset
jeq AllPB
NoPB
in par:w,Q_Line:w,W_offset:w
out W_offset:w
Xcall W_JunkLeft
sta OOffset
in Epar:w,Eline:w,W_eOffset:w
out W_eOffset:w
Xcall W_JunkRight
pha ;space for output
pha
pha
pha
pushword par
pushword Q_Line
pushword W_offset
jsl W_FindFont
moveword 1:s,col1
movelong 3:s,font1
pha
pha
pha
pushword Epar
pushword Eline
pushword W_eOffset
jsl W_FindFont
moveword 1:s,col2
movelong 3:s,font2
jsl W_CalcFBytes
pullword fBytes
cmpw par,EPar
jeq SamePar
pha
pushword EPar
jsl W_GetEndPar
pla
sec
sbc W_eOffset
sta bytes
pha
pushword Par
jsl W_GetEndPar
pla
sta temp
pushword Par
pushword W_offset
lda bytes
clc ;bytes+fbytes-(temp-W_offset)
adc fbytes
adc W_offset
sec
sbc temp
pha
jsl W_DoRoom
cmpw W_offset,#W_TextHeader
bne NotBegR
lda par
jsl W_GetParRec
movelong ax,SParRec
lda EPar
jsl W_GetParRec
movelong ax,EParRec
pushword #1
pushlong [SParRec]:#W_pRulerHand
jsl W_UnUseRuler
movelong [EParRec]:#W_pRulerHand,[SParRec]:#W_pRulerHand
pushword #1
pushlong [SParRec]:#W_pRulerHand
jsl W_UseRuler
NotBegR
lda EPar
ldx W_eOffset
jsl W_GetAddr
phx
pha
addword W_offset,fbytes,x
lda Par
jsl W_GetAddr
phx
pha
pushword #0
pushword bytes
_BlockMove
pha
pushword par
pushword W_offset
pushlong Font1
pushword col1
pushlong Font2
pushword col2
jsl W_WriteFBytes2
pla
lda par
inc a
pha
pushword EPar
jsl W_DelPars
lda PBFlag
jeq DRExit
AllPB
lda par
dec a
pha
pha
jsl W_DelPars
lda par
dec a
sta OPar
stz OLine
moveword #W_TextHeader,OOffset
brl DRExit
;---------------------delete within a par
SamePar
pushword par
pushword W_offset
subword W_eOffset,W_offset,a
subword a,fbytes,a
pha
jsl W_LessRoom
pha
pushword par
pushword W_offset
pushlong Font1
pushword col1
pushlong Font2
pushword col2
jsl W_WriteFBytes2
pla
DRExit
pushword par
jsl W_MakeLines
pha
pushword OPar
pushword OOffset
jsl W_FindLine
pullword OLine
return
ENDP
****************************************************************
* W_DelSelect - deletes selection and turns off selc
W_DelSelect PROC EXPORT
local Q_Rect:r,temp:w
begin +b
pushlong W_CurDoc
_SetPort
lda W_Selected
jeq DSExit
pushword W_StartPar
pushword W_StartLine
pushlong #0
jsl W_PutOnScreen
jsl W_SelectOff
pha
pha
pha
pushword W_StartPar
pushword W_StartLine
pushword W_StartOffset
pushword W_EndPar
pushword W_EndLine
pushword W_EndOffset
jsl W_DeleteRange
pullword W_StartOffset
pullword W_StartLine
pullword W_StartPar
jsl W_CalcPages
pushlong !Q_Rect
jsl W_CalcDocRect
pha
pha
pushword W_StartPar
lda W_StartLine
beq DoPush
dec a
DoPush pha
jsl W_LineToTopPixel
pla
pla
sta temp
bmi ClipIt ;if minus it was a page break!
PutIfMax temp,Q_Rect
ClipIt
pushlong !Q_Rect
_ClipRect
pushlong !Q_Rect
_EraseRect
jsl W_UpdateText
jsl W_CheckDocPos
; pha
; pushword W_StartPar
; pushword W_StartOffset
; jsl W_FindLine
; pullword W_StartLine
jsl W_MakeCaret
DSExit
return
ENDP
****************************************************************
* W_DelSelect - deletes selection and turns off selc
W_DeleteRangeD PROC EXPORT
input StPar:w,W_STLIne:w,StOffset:w,EPar:w,ELine:w,W_eOffset:w
local Q_Rect:r,temp:w
output OPar:w,OLine:w,OOffset:w
begin +b
pushlong W_CurDoc
_SetPort
pushword StPar
pushword W_STLIne
pushlong #0
jsl W_PutOnScreen
pha
pha
pha
pushword StPar
pushword W_STLIne
pushword StOffset
pushword EPar
pushword ELine
pushword W_eOffset
jsl W_DeleteRange
pullword OOffset
pullword OLine
pullword OPar
jsl W_CalcPages
pushlong !Q_Rect
jsl W_CalcDocRect
pha
pha
pushword OPar
lda Oline
beq DoPush
dec a
DoPush pha
jsl W_LineToTopPixel
pla
pla
sta temp
scmpw temp,Q_Rect
bcc NoChan
moveword temp,Q_Rect
NoChan
pushlong !Q_Rect
_ClipRect
pushlong !Q_Rect
_EraseRect
jsl W_UpdateText
jsl W_CheckDocPos
DSExit
return
ENDP
END