mirror of
https://github.com/antoinevignau/source.git
synced 2024-11-19 07:31:13 +00:00
1 line
22 KiB
Plaintext
Executable File
1 line
22 KiB
Plaintext
Executable File
load 'macros.dump'
|
|
include 'driver.equ'
|
|
include 'wp.equ'
|
|
include 'WP.Macros'
|
|
|
|
;-----------------------------------------------
|
|
;
|
|
; Imported addresses
|
|
;
|
|
;-----------------------------------------------
|
|
|
|
IMPORT W_BotLine
|
|
IMPORT W_BotPB
|
|
IMPORT W_BotPar
|
|
IMPORT W_CalcDocRect
|
|
IMPORT W_CalcFonts
|
|
IMPORT W_CalcGrowREct
|
|
IMPORT W_CalcNewLines
|
|
IMPORT W_CalcPages
|
|
IMPORT CaretOff
|
|
IMPORT W_CurDoc
|
|
IMPORT W_EdMakeCaret
|
|
IMPORT W_EndLine
|
|
IMPORT W_EndOffset
|
|
IMPORT W_EndPar
|
|
IMPORT W_FindLine
|
|
IMPORT W_GetBegLine
|
|
IMPORT W_GetEndLine
|
|
IMPORT W_GetEndPar
|
|
IMPORT W_GetHPos
|
|
IMPORT W_GetLastLine
|
|
IMPORT W_GetLeft
|
|
IMPORT W_GetLineOffset
|
|
IMPORT W_GetPageSize
|
|
IMPORT W_GetParRec
|
|
IMPORT W_GrewDoc
|
|
IMPORT W_LastP
|
|
IMPORT W_LeftMargin
|
|
IMPORT W_LineToTopPixel
|
|
IMPORT W_MakeCaret
|
|
IMPORT W_MakeLines
|
|
IMPORT W_MakeVisRuler
|
|
IMPORT W_ModifyRuler
|
|
IMPORT W_NewRuler
|
|
IMPORT W_PaperSize
|
|
IMPORT W_ParRec
|
|
|
|
IMPORT W_PixelToLine
|
|
IMPORT W_PixelToOffset
|
|
IMPORT W_PutOnScreen
|
|
IMPORT W_ReadRuler
|
|
IMPORT Q_Rect
|
|
IMPORT W_RightMargin
|
|
IMPORT W_RulBytes
|
|
IMPORT W_RulerClick
|
|
IMPORT W_ScrollBar
|
|
IMPORT W_ScrollBarProc
|
|
IMPORT W_ScrollClick
|
|
IMPORT W_SetDocRect
|
|
IMPORT D_SetFileChanged
|
|
IMPORT W_SetFullREct
|
|
IMPORT W_ShowRuler
|
|
IMPORT W_StartLine
|
|
IMPORT W_StartOffset
|
|
IMPORT W_StartPar
|
|
|
|
IMPORT D_TextSelectOff
|
|
IMPORT D_TextSelectOn
|
|
IMPORT W_TopLine
|
|
IMPORT W_TopPB
|
|
IMPORT W_TopPar
|
|
IMPORT W_TopPg
|
|
IMPORT W_TopPgPixel
|
|
IMPORT W_UnUseRuler
|
|
IMPORT W_UndoOff
|
|
IMPORT W_UseRuler
|
|
IMPORT W_WPFontFlag
|
|
IMPORT W_WordBounds
|
|
IMPORT W_GetTopSpace
|
|
IMPORT W_Selected
|
|
|
|
;-----------------------------------------------
|
|
;
|
|
; Forward addresses and entries
|
|
;
|
|
;-----------------------------------------------
|
|
|
|
ENTRY W_DoubleClick
|
|
ENTRY W_GotPBPar
|
|
ENTRY W_InvSelect
|
|
ENTRY W_InvText
|
|
ENTRY W_MInRuler
|
|
ENTRY W_MouseInContent
|
|
ENTRY W_PtToText
|
|
ENTRY W_SelectOff
|
|
ENTRY W_SelectOn
|
|
ENTRY W_StartFirst
|
|
ENTRY W_TripleClick
|
|
|
|
|
|
|
|
|
|
*****************************************************************
|
|
* A mouse down occurred in the (Your) active window.
|
|
* w-W_MyMouseDown(click:w,TaskRec:l,CLickPt2:l,ClickPt3:l)
|
|
* input -
|
|
* Click - the number of the click 1 - single click, 2 for double, 3 for triple
|
|
* TaskRec - a pointer to an Event Record for you to look at.
|
|
* ClickPt2 - the Q_Point(global) where the first click of this sequence was
|
|
* Single click (click=1) look at the TaskRec as before, ClickPts are undefined.
|
|
* Double click (click=2) look at the pt in the TaskRec(global) and see if it
|
|
* is D_Close enough to ClickPt2(global) to be a double click. ClickPt3 is undefin
|
|
* Triple click (click=3) check that ClickPt3 is D_Close enough to ClickPt2
|
|
* and the pt in TaskRec.
|
|
* If you don't support a type of click, or it isn't D_Close enough together
|
|
* just do the same thing you would do for single clicking
|
|
W_MyMouseDown PROC EXPORT
|
|
;Using WPGlobals
|
|
input click:w,TaskRec:l,ClickPt2:l,ClickPt3:l
|
|
local Pt:r,Q_Rect:r,par:w,W_ParRec:l
|
|
begin +b
|
|
|
|
pushlong W_CurDoc
|
|
_SetPort
|
|
|
|
jsl CaretOff
|
|
|
|
pha
|
|
pushlong TaskRec
|
|
jsl W_ScrollClick
|
|
pla
|
|
jne CExit
|
|
|
|
lda W_ShowRuler
|
|
beq NoRuler
|
|
|
|
pha
|
|
pushlong TaskRec ;changes Q_Point to local !!!!!!
|
|
jsl W_RulerClick
|
|
pla
|
|
beq NoRuler
|
|
|
|
jsl W_UndoOff
|
|
|
|
jsl W_MInRuler
|
|
|
|
brl CExit
|
|
|
|
NoRuler
|
|
movelong [TaskRec]:#owhere,Pt
|
|
pushlong !Pt
|
|
_GlobalToLocal
|
|
|
|
pushlong !Q_Rect
|
|
jsl W_CalcGrowREct
|
|
|
|
pha
|
|
pushlong !Pt
|
|
pushlong !Q_Rect
|
|
_PtInRect
|
|
pla
|
|
beq InContent
|
|
|
|
pha
|
|
pha ;room
|
|
pushword #200 ;minimum width
|
|
pushword #75 ;minimum W_Height
|
|
pushlong [TaskRec]:#owhere
|
|
pushlong W_CurDoc
|
|
_GrowWindow
|
|
pushlong W_CurDoc
|
|
_SizeWindow
|
|
|
|
pushlong W_CurDoc
|
|
jsl W_GrewDoc
|
|
|
|
bra CExit
|
|
|
|
InContent
|
|
pushlong !Q_Rect
|
|
jsl W_CalcDocRect
|
|
|
|
pha
|
|
pushlong !Pt
|
|
pushlong !Q_Rect
|
|
_PtInRect
|
|
pla
|
|
jeq CExit
|
|
|
|
jsl W_UndoOff
|
|
|
|
lda click
|
|
cmp #1
|
|
beq Click1
|
|
cmp #2
|
|
beq Click2
|
|
Click3
|
|
pushlong Pt
|
|
jsl W_TripleClick
|
|
brl CExit
|
|
|
|
Click2
|
|
pushlong Pt
|
|
jsl W_DoubleClick
|
|
brl CExit
|
|
|
|
Click1
|
|
pushlong TaskRec
|
|
pushlong Pt
|
|
jsl W_MouseInContent
|
|
|
|
CExit
|
|
return
|
|
ENDP
|
|
|
|
|
|
***************************************************************
|
|
* W_MouseInContent(Pt:l)
|
|
W_MouseInContent PROC EXPORT
|
|
;Using WPGlobals
|
|
|
|
input TaskRec:l,Pt:l
|
|
local TempPar:w,TempLine:w,TempOffset:w,Q_Rect:r
|
|
local TempPar2:w,TempLine2:w,TempOffset2:w
|
|
begin
|
|
|
|
jsl W_SetDocRect
|
|
|
|
pushlong !Q_Rect
|
|
jsl W_CalcDocRect
|
|
|
|
jsl CaretOff
|
|
|
|
moveword [TaskREc]:#omodifiers,a
|
|
and #$200
|
|
jeq NoShift
|
|
|
|
moveword W_EndPar,TempPar2
|
|
moveword W_EndLine,TempLine2
|
|
moveword W_EndOffset,TempOffset2
|
|
|
|
pha
|
|
pha
|
|
pha
|
|
pushlong Pt
|
|
jsl W_PtToText
|
|
pullword TempOffset
|
|
pullword TempLine
|
|
pullword TempPar
|
|
|
|
jsl W_SetDocRect
|
|
|
|
lda W_Selected
|
|
beq DoPut
|
|
|
|
cmpw TempPar,W_StartPar
|
|
bcc DoPut
|
|
; cmpw Templine,W_StartLine
|
|
; bcc DoPut
|
|
cmpw TempOffset,W_StartOffset
|
|
bcs NoPut
|
|
DoPut
|
|
moveword W_StartPar,TempPar2
|
|
moveword W_StartLine,TempLine2
|
|
moveword W_StartOffset,TempOffset2
|
|
|
|
NoPut
|
|
pushword TempPar
|
|
pushword TempLine
|
|
pushword TempOffset
|
|
pushword TempPar2
|
|
pushword TempLine2
|
|
pushword TempOffset2
|
|
jsl W_InvText
|
|
|
|
lda W_Selected
|
|
beq DoPut2
|
|
|
|
cmpw TempPar,W_StartPar
|
|
bcc NoPut2
|
|
; cmpw Templine,W_StartLine
|
|
; bcc NoPut2
|
|
cmpw TempOffset,W_StartOffset
|
|
bcs DoPut2
|
|
|
|
NoPut2
|
|
moveword W_EndPar,W_StartPar
|
|
moveword W_EndLine,W_StartLine
|
|
moveword W_EndOffset,W_StartOffset
|
|
DoPut2
|
|
moveword TempPar,W_EndPar
|
|
moveword TempLine,W_EndLine
|
|
moveword TempOffset,W_EndOffset
|
|
|
|
brl TrackLoop
|
|
|
|
|
|
NoShift
|
|
|
|
jsl W_SelectOff
|
|
|
|
pha
|
|
pha
|
|
pha
|
|
pushlong Pt
|
|
jsl W_PtToText
|
|
tay
|
|
pullword W_StartOffset
|
|
sta W_EndOffset
|
|
pullword W_StartLine
|
|
sta W_EndLine
|
|
pullword W_StartPar
|
|
sta W_EndPar
|
|
cpy #2
|
|
bne NoPB
|
|
|
|
dec W_StartPar
|
|
stz W_StartLine
|
|
moveword #W_TextHeader,W_StartOffset
|
|
|
|
moveword #1,W_Selected
|
|
|
|
jsl W_InvSelect
|
|
|
|
NoPB
|
|
jsl W_SetDocRect
|
|
|
|
TrackLoop
|
|
moveword #1,W_Selected
|
|
|
|
pha
|
|
pushword #0
|
|
_StillDown
|
|
pla
|
|
jeq EndTrack
|
|
|
|
pushlong !pt
|
|
_GetMouse
|
|
|
|
scmpw pt,Q_Rect
|
|
bcc ScrollUp
|
|
scmpw Q_Rect+4,pt
|
|
bcs NoScroll
|
|
|
|
jsl W_SetFullREct
|
|
|
|
pha ;scroll down
|
|
pushword #6
|
|
pushlong W_ScrollBar
|
|
jsl W_ScrollBarProc
|
|
pla
|
|
brl TrackLoop
|
|
|
|
ScrollUp
|
|
|
|
jsl W_SetFullREct
|
|
|
|
pha ;scroll up
|
|
pushword #5
|
|
pushlong W_ScrollBar
|
|
jsl W_ScrollBarProc
|
|
pla
|
|
brl TrackLoop
|
|
|
|
NoScroll
|
|
|
|
pha
|
|
pha
|
|
pha
|
|
pushlong Pt
|
|
jsl W_PtToText
|
|
pullword TempOffset
|
|
pullword TempLine
|
|
pullword TempPar
|
|
|
|
jsl W_SetDocRect
|
|
|
|
pushword TempPar
|
|
pushword TempLine
|
|
pushword TempOffset
|
|
pushword W_EndPar
|
|
pushword W_EndLine
|
|
pushword W_EndOffset
|
|
jsl W_InvText
|
|
|
|
moveword TempPar,W_EndPar
|
|
moveword TempLine,W_EndLine
|
|
moveword TempOffset,W_EndOffset
|
|
|
|
brl TrackLoop
|
|
|
|
EndTrack
|
|
stz W_Selected
|
|
|
|
No_Select
|
|
cmpw W_EndPar,W_StartPar
|
|
bne SelOn
|
|
; cmpw W_EndLine,W_StartLine
|
|
; bne SelOn
|
|
cmpw W_EndOffset,W_StartOffset
|
|
bne SelOn
|
|
|
|
jsl W_SelectOff
|
|
|
|
jsl W_MakeCaret
|
|
bra MICExit
|
|
|
|
SelOn
|
|
jsl W_SelectOn
|
|
|
|
MICExit
|
|
jsl W_SetFullREct
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
|
|
|
|
****************************************************************
|
|
W_InvText PROC EXPORT
|
|
;Using wpglobals
|
|
EXPORT W_GotPBPar
|
|
|
|
input Par1:w,line1:w,offset1:w,tPar2:w,tline2:w,toffset2:w
|
|
local Q_Rect:r,RectPtr:l,TopFlag:w,BotFlag:w,W_ParRec:l
|
|
local LastDone:w,Rgn:l,Par2:w,line2:w,offset2:w
|
|
local PBPar:w,TempPixel:w,OldPar2:w,OldPar1:w
|
|
begin
|
|
|
|
moveword tPar2,Par2
|
|
moveword tline2,line2
|
|
moveword toffset2,offset2
|
|
|
|
cmpw Par1,Par2
|
|
bcc SexSet
|
|
bne DoReverse
|
|
cmpw line1,line2
|
|
bcc SexSet
|
|
bne DoReverse
|
|
cmpw offset1,offset2
|
|
bcc SexSet
|
|
jeq ITExit
|
|
|
|
DoReverse
|
|
moveword Par1,Par2
|
|
moveword line1,line2
|
|
moveword offset1,offset2
|
|
|
|
moveword tPar2,Par1
|
|
moveword tline2,line1
|
|
moveword toffset2,offset1
|
|
|
|
SexSet
|
|
moveword par2,OldPar2
|
|
moveword par1,Oldpar1
|
|
|
|
stz TopFlag
|
|
stz BotFlag
|
|
|
|
_PenNormal
|
|
|
|
pushword #NotXOR
|
|
_SetPenMode
|
|
|
|
pushlong !Q_Rect
|
|
jsl W_CalcDocRect
|
|
|
|
cmpw W_TopPB,#2 ;now chwck for PB exception
|
|
bne NoTop
|
|
|
|
lda W_TopPar
|
|
dec a
|
|
cmp par1
|
|
bcc NoTop
|
|
sta PBPar
|
|
|
|
inc TopFlag
|
|
moveword W_TopPar,par1
|
|
stz line1
|
|
moveword #W_TextHeader,offset1
|
|
brl HighToPB
|
|
|
|
NoTop
|
|
cmpw W_BotPB,#2
|
|
bne NoBot
|
|
|
|
lda W_BotPar
|
|
dec a ;cmp if (W_BotPar-1)<= par2
|
|
cmp par2
|
|
bgt NoBot
|
|
|
|
inc BotFlag
|
|
|
|
subword W_BotPar,#2,par2
|
|
jsl W_GetLastLine
|
|
sta line2
|
|
|
|
pha
|
|
pushword par2
|
|
jsl W_GetEndPar
|
|
pullword offset2
|
|
|
|
lda W_BotPar
|
|
dec a
|
|
sta PBPar
|
|
brl W_GotPBPar
|
|
|
|
NoBot
|
|
subword Q_Rect+4,Q_Rect,a
|
|
addword a,W_TopPgPixel,a
|
|
cmp W_PaperSize
|
|
jcc NoPOnScreen
|
|
|
|
pha
|
|
pha
|
|
pha
|
|
subword W_PaperSize,W_TopPgPixel,a
|
|
addword a,Q_Rect,s
|
|
jsl W_PixelToLine
|
|
ply
|
|
pullword Tline2
|
|
pullword PBPar
|
|
cpy #2
|
|
jne NoPOnScreen
|
|
|
|
dec PBPar
|
|
|
|
W_GotPBPar ;
|
|
cmpw PBPar,OldPar1
|
|
jcc NoPOnScreen
|
|
cmpw OldPar2,PBPar
|
|
jcc NoPOnScreen
|
|
|
|
pha
|
|
pha
|
|
lda PBPar
|
|
dec a
|
|
pha
|
|
jsl W_GetLastLine
|
|
pha
|
|
jsl W_LineToTopPixel
|
|
pla
|
|
clc
|
|
adc 1,s
|
|
sta TempPixel
|
|
ply
|
|
|
|
lda TempPixel
|
|
bmi HightoPB
|
|
cmp Q_Rect
|
|
bcc HighToPB
|
|
sta Q_Rect
|
|
|
|
HighToPB
|
|
cmpw PBPar,OldPar1
|
|
jcc NoPOnScreen
|
|
cmpw OldPar2,PBPar
|
|
jcc NoPOnScreen
|
|
subword Q_Rect+4,Q_Rect,a
|
|
addword a,W_TopPgPixel,a
|
|
cmp W_PaperSize
|
|
bcc NoRectChan
|
|
|
|
lda W_TopPg
|
|
jsl W_GetTopSpace
|
|
sta TempPixel
|
|
lda W_TopPg
|
|
jsl W_GetPageSize
|
|
addword a,TempPixel,a
|
|
subword a,W_TopPgPixel,a
|
|
bmi NoPOnScreen
|
|
addword a,Q_Rect,TempPixel
|
|
PutIfMin TempPixel,Q_Rect+4
|
|
|
|
NoRectChan
|
|
lda PBPar
|
|
dec a
|
|
jsl W_GetParRec
|
|
movelong ax,W_ParRec
|
|
|
|
ldy #W_pRulerHand+2
|
|
lda [W_ParRec],y
|
|
tax
|
|
ldy #W_pRulerHand
|
|
lda [W_ParRec],y
|
|
jsl W_ReadRuler
|
|
|
|
moveword W_LeftMargin,Q_Rect+2
|
|
moveword W_RightMargin,Q_Rect+6
|
|
|
|
pushlong !Q_Rect
|
|
_PaintRect
|
|
|
|
|
|
; here we are done with PB's
|
|
NoPOnScreen
|
|
cmpw W_BotPar,par1
|
|
bcc W_NoDraw ;top is beloew screen
|
|
bne NolC
|
|
cmpw W_BotLine,line1 ;top is below screen
|
|
bcc W_NoDraw
|
|
NoLC
|
|
cmpw par2,W_TopPar ;bottom is above screen
|
|
bcc W_NoDraw
|
|
bne SomeDraw
|
|
cmpw line2,W_TopLine
|
|
bcs SomeDraw
|
|
W_NoDraw brl ITExit
|
|
|
|
SomeDraw
|
|
cmpw Par1,W_TopPar
|
|
beq CheckLine1
|
|
bcs GotTop
|
|
moveword W_TopPar,Par1
|
|
moveword W_TopLine,line1
|
|
|
|
pha
|
|
pushword Par1
|
|
pushword line1
|
|
jsl W_GetBegLine
|
|
pullword offset1
|
|
|
|
inc TopFlag
|
|
bra GotTop
|
|
CheckLine1
|
|
cmpw line1,W_TopLine
|
|
bcs GotTop
|
|
moveword W_TopLine,line1
|
|
inc TopFlag
|
|
|
|
GotTop
|
|
cmpw Par2,W_BotPar
|
|
beq CheckLine2
|
|
bcc GotBot
|
|
moveword W_BotPar,Par2
|
|
moveword W_BotLine,line2
|
|
|
|
pha
|
|
pushword Par2
|
|
pushword line2
|
|
jsl W_GetEndLine
|
|
pullword offset2
|
|
|
|
inc BotFlag
|
|
bra GotBot
|
|
CheckLine2
|
|
cmpw W_BotLine,line2
|
|
bcs GotBot
|
|
moveword W_BotLine,line2
|
|
inc BotFlag
|
|
|
|
GotBot
|
|
cmpw par2,par1
|
|
jcc ITExit
|
|
|
|
stz RectPtr+2
|
|
tdc
|
|
clc
|
|
adc #Q_Rect
|
|
sta RectPtr
|
|
|
|
lda par1
|
|
jsl W_GetParRec
|
|
movelong ax,W_ParRec
|
|
|
|
ldy #W_pRulerHand+2
|
|
lda [W_ParRec],y
|
|
tax
|
|
ldy #W_pRulerHand
|
|
lda [W_ParRec],y
|
|
jsl W_ReadRuler
|
|
|
|
cmpw par1,Par2
|
|
bne NotSame
|
|
cmpw line1,line2
|
|
jeq OnSameLine
|
|
|
|
NotSame
|
|
lda TopFlag
|
|
jne NoTopPart
|
|
|
|
moveword W_RightMargin,Q_Rect+6
|
|
|
|
pha
|
|
pha
|
|
pushword par1
|
|
pushword line1
|
|
jsl W_LineToTopPixel
|
|
pla
|
|
clc
|
|
adc 1,s
|
|
sta Q_Rect+4
|
|
pla
|
|
sta Q_Rect
|
|
|
|
pha
|
|
pushword par1
|
|
pushword line1
|
|
pushword offset1
|
|
jsl W_GetHPos
|
|
pla
|
|
sta Q_Rect+2
|
|
|
|
jsr CheckRect
|
|
|
|
pushlong RectPtr
|
|
_PaintRect
|
|
|
|
jsr W_NextLine
|
|
|
|
NoTopPart
|
|
stz LastDone
|
|
brl NewPar
|
|
|
|
LineLoop
|
|
cmpw par1,par2
|
|
bcc DoIt
|
|
jne DoneLines
|
|
cmpw line1,line2
|
|
jcs DoneLines
|
|
|
|
DoIt
|
|
pha
|
|
pha
|
|
pushword par1
|
|
pushword line1
|
|
jsl W_LineToTopPixel
|
|
pla
|
|
clc
|
|
adc 1,s
|
|
sta Q_Rect+4
|
|
pla
|
|
sta Q_Rect
|
|
|
|
jsr CheckRect
|
|
|
|
lda line1
|
|
jsl W_GetLeft
|
|
sta Q_Rect+2
|
|
|
|
pushlong rectptr
|
|
_PaintRect
|
|
|
|
jsr W_NextLine
|
|
bcc LineLoop
|
|
|
|
NewPar
|
|
moveword W_LeftMargin,Q_Rect+2
|
|
moveword W_RightMargin,Q_Rect+6
|
|
brl LineLoop
|
|
|
|
DoneLines
|
|
lda LastDone
|
|
jne DoPaint
|
|
inc LastDone
|
|
lda BotFlag
|
|
jne DoIt
|
|
|
|
lda line2
|
|
jsl W_GetLeft
|
|
sta Q_Rect+2
|
|
|
|
pha
|
|
pha
|
|
pushword par2
|
|
pushword line2
|
|
jsl W_LineToTopPixel
|
|
pla
|
|
clc
|
|
adc 1,s
|
|
sta Q_Rect+4
|
|
pla
|
|
sta Q_Rect
|
|
|
|
pha
|
|
pushword par2
|
|
pushword line2
|
|
pushword offset2
|
|
jsl W_GetHPos
|
|
pla
|
|
sta Q_Rect+6
|
|
|
|
jsr CheckRect
|
|
|
|
pushlong RectPtr
|
|
_PaintRect
|
|
|
|
DoPaint
|
|
|
|
brl ITExit
|
|
|
|
|
|
;--------------------special case of beginning and end on same Q_Line
|
|
OnSameLine
|
|
|
|
pha
|
|
pha
|
|
pushword par1
|
|
pushword line1
|
|
jsl W_LineToTopPixel
|
|
pla
|
|
clc
|
|
adc 1,s
|
|
sta Q_Rect+4
|
|
pla
|
|
sta Q_Rect
|
|
|
|
pha
|
|
pushword par1
|
|
pushword line1
|
|
pushword offset1
|
|
jsl W_GetHPos
|
|
pla
|
|
sta Q_Rect+2
|
|
|
|
pha
|
|
pushword par2
|
|
pushword line2
|
|
pushword offset2
|
|
jsl W_GetHPos
|
|
pla
|
|
sta Q_Rect+6
|
|
|
|
jsr CheckRect
|
|
|
|
pushlong RectPtr
|
|
_PaintRect
|
|
|
|
ITExit
|
|
_PenNormal
|
|
return
|
|
|
|
|
|
|
|
W_NextLine
|
|
inc line1
|
|
cmpw line1,[W_ParRec]:#W_pLastLine
|
|
bcc AllFine
|
|
|
|
stz line1
|
|
inc par1
|
|
lda par1
|
|
jsl W_GetParRec
|
|
movelong ax,W_ParRec
|
|
|
|
cmpw [W_ParRec]:#W_pAttr,#W_PgBrk
|
|
bne NoPBN
|
|
|
|
inc par1
|
|
lda par1
|
|
jsl W_GetParRec
|
|
movelong ax,W_ParRec
|
|
|
|
NoPBN
|
|
ldy #W_pRulerHand+2
|
|
lda [W_ParRec],y
|
|
tax
|
|
ldy #W_pRulerHand
|
|
lda [W_ParRec],y
|
|
jsl W_ReadRuler
|
|
|
|
sec
|
|
AllFine rts
|
|
|
|
|
|
CheckRect
|
|
lda W_RightMargin
|
|
cmp Q_Rect+6
|
|
bcs ROk
|
|
sta Q_Rect+6
|
|
ROk rts
|
|
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
****************************************************************
|
|
* W_SelectOn
|
|
W_SelectOn PROC EXPORT
|
|
;Using wpglobals
|
|
local W_ParRec:l
|
|
|
|
begin +b
|
|
|
|
jsl D_TextSelectOn
|
|
|
|
moveword #1,W_Selected
|
|
stz W_WPFontFlag
|
|
|
|
jsl W_StartFirst
|
|
|
|
lda W_StartPar
|
|
jsl W_GetParRec
|
|
movelong ax,W_ParRec
|
|
|
|
cmpw [W_ParRec]:#W_pAttr,#W_PgBrk
|
|
bne NoPN
|
|
|
|
sublong W_ParRec,#W_pBytes,W_ParRec
|
|
|
|
NoPN
|
|
jsl W_SetFullREct
|
|
|
|
lda W_ShowRuler
|
|
beq NoShow
|
|
pushlong [W_ParRec]:#W_pRulerHand
|
|
jsl W_MakeVisRuler
|
|
|
|
NoShow
|
|
jsl W_CalcFonts
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
****************************************************************
|
|
* W_SelectOff
|
|
W_SelectOff PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
begin
|
|
|
|
lda W_Selected
|
|
beq SOExit
|
|
|
|
jsl D_TextSelectOff
|
|
|
|
jsl W_InvSelect
|
|
|
|
stz W_Selected
|
|
|
|
SOExit
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
* W_KillSelect
|
|
W_KillSelect PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
local W_ParRec:l
|
|
begin
|
|
|
|
lda W_Selected
|
|
jeq KSExit
|
|
|
|
jsl W_SelectOff
|
|
|
|
jsl W_StartFirst
|
|
|
|
lda W_StartPar
|
|
jsl W_GetParRec
|
|
movelong ax,W_ParRec
|
|
|
|
moveword [W_ParRec]:#W_pAttr,a
|
|
beq NoPb
|
|
|
|
inc W_StartPar
|
|
stz W_StartLine
|
|
moveword #W_TextHeader,W_StartOffset
|
|
|
|
NoPB
|
|
cmpw W_StartOffset,#W_TextHeader
|
|
bcs OOk
|
|
|
|
moveword #W_TextHeader,W_StartOffset
|
|
|
|
OOK
|
|
jsl W_MakeCaret
|
|
|
|
KSExit
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
****************************************************************
|
|
W_MakeSelect PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
lda W_Selected
|
|
beq TurnOff
|
|
|
|
jsl D_TextSelectOn
|
|
|
|
brl MSExit
|
|
|
|
TurnOff
|
|
jsl D_TextSelectOff
|
|
|
|
MSExit
|
|
|
|
rtl
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
W_InvSelect PROC EXPORT
|
|
;Using wpglobals
|
|
EXPORT W_InvSelectUC
|
|
|
|
begin
|
|
|
|
lda W_Selected
|
|
beq ISExit
|
|
|
|
jsl W_SetDocRect
|
|
|
|
NoSet
|
|
pushword W_StartPar
|
|
pushword W_StartLine
|
|
pushword W_StartOffset
|
|
pushword W_EndPar
|
|
pushword W_EndLine
|
|
pushword W_EndOffset
|
|
jsl W_InvText
|
|
|
|
ISExit
|
|
return
|
|
|
|
W_InvSelectUC ; ;use clip
|
|
|
|
lda W_Selected
|
|
beq ISExit
|
|
bra NoSet
|
|
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
* W_DoubleClick
|
|
W_DoubleClick PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
input Pt:l
|
|
local Q_Rect:r,tempPar:w,TempLine:w,tempoffset:w
|
|
begin
|
|
|
|
jsl W_SetDocRect
|
|
|
|
pushlong !Q_Rect
|
|
jsl W_CalcDocRect
|
|
|
|
jsl CaretOff
|
|
|
|
jsl W_SelectOff
|
|
|
|
pha
|
|
pha
|
|
pha
|
|
pushlong Pt
|
|
jsl W_PtToText
|
|
pullword TempOffset
|
|
pullword TempLine
|
|
pullword TempPar
|
|
|
|
lda Temppar
|
|
ldx TempOffset
|
|
jsl W_WordBounds
|
|
sta W_StartPar
|
|
sta W_EndPar
|
|
stx W_StartOffset
|
|
sty W_EndOffset
|
|
|
|
pha
|
|
pushword W_StartPar
|
|
pushword W_StartOffset
|
|
jsl W_FindLine
|
|
pullWord W_StartLine
|
|
|
|
pha
|
|
pushword W_EndPar
|
|
pushword W_EndOffset
|
|
jsl W_FindLine
|
|
pullWord W_EndLine
|
|
|
|
moveword #1,W_Selected
|
|
jsl W_InvSelect
|
|
|
|
TrackLoop
|
|
|
|
pha
|
|
pushword #0
|
|
_StillDown
|
|
pla
|
|
jeq EndTrack
|
|
|
|
pushlong !pt
|
|
_GetMouse
|
|
|
|
scmpw pt,Q_Rect
|
|
bcc ScrollUp
|
|
scmpw Q_Rect+4,pt
|
|
bcs NoScroll
|
|
|
|
jsl W_SetFullREct
|
|
|
|
pha ;scroll down
|
|
pushword #6
|
|
pushlong W_ScrollBar
|
|
jsl W_ScrollBarProc
|
|
pla
|
|
brl TrackLoop
|
|
|
|
ScrollUp
|
|
|
|
jsl W_SetFullREct
|
|
|
|
pha ;scroll up
|
|
pushword #5
|
|
pushlong W_ScrollBar
|
|
jsl W_ScrollBarProc
|
|
pla
|
|
brl TrackLoop
|
|
|
|
NoScroll
|
|
|
|
pha
|
|
pha
|
|
pha
|
|
pushlong Pt
|
|
jsl W_PtToText
|
|
pullword TempOffset
|
|
pullword TempLine
|
|
pullword TempPar
|
|
|
|
jsl W_SetDocRect
|
|
|
|
cmpw TempPar,W_StartPar
|
|
beq CMo
|
|
bcs IsBel
|
|
CMo cmpw TempOffset,W_StartOffset
|
|
bcs IsBel
|
|
|
|
lda Temppar
|
|
ldx TempOffset
|
|
jsl W_WordBounds
|
|
sta TempPar
|
|
stx TempOffset
|
|
bra GotWord
|
|
|
|
IsBel
|
|
lda Temppar
|
|
ldx TempOffset
|
|
jsl W_WordBounds
|
|
sta TempPar
|
|
sty TempOffset
|
|
|
|
GotWord
|
|
pha
|
|
pushword TempPar
|
|
pushword TempOffset
|
|
jsl W_FindLine
|
|
pullWord TempLine
|
|
|
|
pushword TempPar
|
|
pushword TempLine
|
|
pushword TempOffset
|
|
pushword W_EndPar
|
|
pushword W_EndLine
|
|
pushword W_EndOffset
|
|
jsl W_InvText
|
|
|
|
moveword TempPar,W_EndPar
|
|
moveword TempLine,W_EndLine
|
|
moveword TempOffset,W_EndOffset
|
|
|
|
brl TrackLoop
|
|
|
|
EndTrack
|
|
stz W_Selected
|
|
|
|
No_Select
|
|
cmpw W_EndPar,W_StartPar
|
|
bne SelOn
|
|
cmpw W_EndLine,W_StartLine
|
|
bne SelOn
|
|
cmpw W_EndOffset,W_StartOffset
|
|
bne SelOn
|
|
|
|
jsl W_SelectOff
|
|
|
|
jsl W_MakeCaret
|
|
bra MICExit
|
|
|
|
SelOn
|
|
jsl W_SelectOn
|
|
|
|
MICExit
|
|
jsl W_SetFullREct
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
* W_TripleClick
|
|
W_TripleClick PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
input Pt:l
|
|
local Q_Rect:r,tempPar:w,TempLine:w,tempoffset:w
|
|
begin
|
|
|
|
jsl W_SetDocRect
|
|
|
|
pushlong !Q_Rect
|
|
jsl W_CalcDocRect
|
|
|
|
jsl CaretOff
|
|
|
|
jsl W_SelectOff
|
|
|
|
pha
|
|
pha
|
|
pha
|
|
pushword Pt
|
|
jsl W_PixelToLine
|
|
ply
|
|
pullword Templine
|
|
pullword Temppar
|
|
|
|
pha
|
|
pushword TempPar
|
|
pushword TempLine
|
|
jsl W_GetBegLine
|
|
pullword W_StartOffset
|
|
|
|
pha
|
|
pushword TempPar
|
|
pushword TempLine
|
|
jsl W_GetEndLine
|
|
pullword W_EndOffset
|
|
|
|
lda TempPar
|
|
sta W_EndPar
|
|
sta W_StartPar
|
|
lda TempLine
|
|
sta W_EndLine
|
|
sta W_StartLine
|
|
|
|
moveword #1,W_Selected
|
|
jsl W_InvSelect
|
|
|
|
TrackLoop
|
|
pha
|
|
pushword #0
|
|
_StillDown
|
|
pla
|
|
jeq EndTrack
|
|
|
|
pushlong !pt
|
|
_GetMouse
|
|
|
|
scmpw pt,Q_Rect
|
|
bcc ScrollUp
|
|
scmpw Q_Rect+4,pt
|
|
bcs NoScroll
|
|
|
|
jsl W_SetFullREct
|
|
|
|
pha ;scroll down
|
|
pushword #6
|
|
pushlong W_ScrollBar
|
|
jsl W_ScrollBarProc
|
|
pla
|
|
brl TrackLoop
|
|
|
|
ScrollUp
|
|
|
|
jsl W_SetFullREct
|
|
|
|
pha ;scroll up
|
|
pushword #5
|
|
pushlong W_ScrollBar
|
|
jsl W_ScrollBarProc
|
|
pla
|
|
brl TrackLoop
|
|
|
|
NoScroll
|
|
|
|
pha
|
|
pha
|
|
pha
|
|
pushword Pt
|
|
jsl W_PixelToLine
|
|
ply
|
|
pullword TempLine
|
|
pullword TempPar
|
|
|
|
jsl W_SetDocRect
|
|
|
|
cmpw TempPar,W_StartPar
|
|
beq CMo
|
|
bcs IsBel
|
|
CMo cmpw TempOffset,W_StartOffset
|
|
bcs IsBel
|
|
|
|
pha
|
|
pushword TempPar
|
|
pushword TempLine
|
|
jsl W_GetBegLine
|
|
pullword TempOffset
|
|
bra GotWord
|
|
|
|
IsBel
|
|
pha
|
|
pushword TempPar
|
|
pushword TempLine
|
|
jsl W_GetEndLine
|
|
pullword TempOffset
|
|
|
|
GotWord
|
|
pushword TempPar
|
|
pushword TempLine
|
|
pushword TempOffset
|
|
pushword W_EndPar
|
|
pushword W_EndLine
|
|
pushword W_EndOffset
|
|
jsl W_InvText
|
|
|
|
moveword TempPar,W_EndPar
|
|
moveword TempLine,W_EndLine
|
|
moveword TempOffset,W_EndOffset
|
|
|
|
brl TrackLoop
|
|
|
|
EndTrack
|
|
stz W_Selected
|
|
|
|
No_Select
|
|
cmpw W_EndPar,W_StartPar
|
|
bne SelOn
|
|
cmpw W_EndLine,W_StartLine
|
|
bne SelOn
|
|
cmpw W_EndOffset,W_StartOffset
|
|
bne SelOn
|
|
|
|
jsl W_SelectOff
|
|
|
|
jsl W_MakeCaret
|
|
bra MICExit
|
|
|
|
SelOn
|
|
jsl W_SelectOn
|
|
|
|
MICExit
|
|
jsl W_SetFullREct
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
|
|
****************************************************************
|
|
* W_PtToText
|
|
W_PtToText PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
input Pt:l
|
|
output TempPar:w,TempLine:w,TempOffset:w
|
|
error MyErr
|
|
begin
|
|
|
|
pha
|
|
pha
|
|
pha
|
|
pushword Pt
|
|
jsl W_PixelToLine
|
|
ply
|
|
sty MyErr
|
|
pullword Templine
|
|
pullword Temppar
|
|
cpy #0
|
|
beq NotBove
|
|
bmi IsAbove
|
|
cpy #2
|
|
beq GotPB
|
|
|
|
moveword W_LastP,TempPar
|
|
jsl W_GetLastLine
|
|
stx TempOffset
|
|
sta TempLine
|
|
bra GotTemp
|
|
|
|
IsAbove
|
|
pha
|
|
pushword TempPar
|
|
pushword TempLine
|
|
jsl W_GetLineOffset
|
|
pullword TempOffset
|
|
bra GotTemp
|
|
|
|
NotBove pha
|
|
pushword TempPar
|
|
pushword TempLine
|
|
pushword Pt+2
|
|
jsl W_PixelToOffset
|
|
pullWord TempOffset
|
|
bra GotTemp
|
|
|
|
GotPB
|
|
stz TempLine
|
|
moveword #W_TextHeader,TempOffset
|
|
|
|
GotTemp
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
****************************************************************
|
|
* W_StartFirst
|
|
W_StartFirst PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
local TempPar:w,TempLine:w,TempOffset:w
|
|
begin
|
|
|
|
cmpw W_StartPar,W_EndPar
|
|
bcc SOk
|
|
bne NOk
|
|
cmpw W_StartLine,W_EndLine
|
|
bcc SOk
|
|
bne NOk
|
|
cmpw W_StartOffset,W_EndOffset
|
|
bcc SOk
|
|
|
|
NOk moveword W_StartPar,TempPar
|
|
moveword W_StartLine,TempLine
|
|
moveword W_StartOffset,TempOffset
|
|
|
|
moveword W_EndPar,W_StartPar
|
|
moveword W_EndLine,W_StartLine
|
|
moveword W_EndOffset,W_StartOffset
|
|
|
|
moveword TempPar,W_EndPar
|
|
moveword TempLine,W_EndLine
|
|
moveword TempOffset,W_EndOffset
|
|
|
|
SOk
|
|
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
* W_MInRuler
|
|
W_MInRuler PROC EXPORT
|
|
;Using wpglobals
|
|
|
|
local Q_Rect:r,W_ParRec:l,Par:w,NRuler:l,OldRuler:l,times:w
|
|
local par2:w,NPtr:l,EPar:w
|
|
begin
|
|
|
|
pushlong W_CurDoc
|
|
jsl D_SetFileChanged
|
|
|
|
pushword W_StartPar
|
|
pushword W_StartLine
|
|
pushlong #0
|
|
jsl W_PutOnScreen
|
|
|
|
pushlong !Q_Rect
|
|
jsl W_CalcDocRect
|
|
|
|
pushlong !Q_Rect
|
|
_InValRect
|
|
|
|
moveword W_StartPar,par
|
|
ldy W_Selected
|
|
bne NoEnd
|
|
sta EPar
|
|
bra Parloop
|
|
|
|
NoEnd
|
|
moveword W_EndPar,EPar
|
|
cmpw W_EndOffset,#W_TextHeader
|
|
bne ParLoop
|
|
dec EPar
|
|
|
|
ParLoop
|
|
lda par
|
|
jsl W_GetParRec
|
|
movelong ax,W_ParRec
|
|
|
|
cmpw [W_ParRec]:#W_pAttr,#W_PgBrk
|
|
jeq NextRuler
|
|
|
|
moveword [W_ParRec]:#W_pRulerHand+2,a
|
|
bpl NotDone
|
|
and #$ff
|
|
sta [W_ParRec],y
|
|
brl NextRuler
|
|
|
|
|
|
NotDone
|
|
pha
|
|
pha
|
|
jsl W_NewRuler
|
|
pullLong NRuler
|
|
|
|
movelong [W_ParRec]:#W_pRulerHand,OldRuler
|
|
|
|
pushlong OldRuler
|
|
pushlong NRuler
|
|
pushlong #W_RulBytes
|
|
_HandToHand
|
|
|
|
movelong [NRuler],NPtr
|
|
moveword #0,[NPtr]
|
|
|
|
movelong NRuler,[W_ParRec]:#W_pRulerHand
|
|
|
|
pushlong NRuler
|
|
jsl W_ModifyRuler
|
|
|
|
moveword #1,times
|
|
|
|
pushword par
|
|
jsl W_MakeLines
|
|
|
|
lda NRuler+2
|
|
ora #$8000
|
|
sta NRuler+2
|
|
moveword par,par2
|
|
bra StartLoop2
|
|
|
|
PLoop
|
|
lda par2
|
|
jsl W_GetParRec
|
|
movelong ax,W_ParRec
|
|
|
|
cmpw [W_ParRec]:#W_pAttr,#W_PgBrk
|
|
beq StartLoop2
|
|
|
|
cmpl [W_ParRec]:#W_pRulerHand,OldRuler
|
|
bne StartLoop2
|
|
|
|
inc times
|
|
|
|
movelong NRuler,[W_ParRec]:#W_pRulerHand
|
|
|
|
pushword par2
|
|
jsl W_MakeLines
|
|
|
|
StartLoop2
|
|
inc par2
|
|
cmpw EPar,par2
|
|
bcs Ploop
|
|
|
|
pushword times
|
|
pushlong OldRuler
|
|
jsl W_UnUseRuler
|
|
|
|
pushword times
|
|
lda NRuler+2
|
|
and #$ff
|
|
pha
|
|
pushword NRuler
|
|
jsl W_UseRuler
|
|
|
|
NextRuler
|
|
inc par
|
|
lda EPar
|
|
cmp Par
|
|
jcs ParLoop
|
|
|
|
DonePars
|
|
jsl CaretOff
|
|
|
|
jsl W_CalcPages
|
|
|
|
jsl W_CalcNewLines
|
|
|
|
jsl W_EdMakeCaret
|
|
|
|
jsl W_SetFullREct
|
|
|
|
return
|
|
|
|
ENDP
|
|
END
|
|
|