mirror of
https://github.com/antoinevignau/source.git
synced 2025-01-04 04:31:04 +00:00
1 line
19 KiB
ArmAsm
Executable File
1 line
19 KiB
ArmAsm
Executable File
|
|
load 'macros.dump'
|
|
include 'driver.equ'
|
|
include 'pl.equ'
|
|
|
|
;-----------------------------------------------
|
|
;
|
|
; Imported addresses
|
|
;
|
|
;-----------------------------------------------
|
|
|
|
IMPORT Asc2Fix
|
|
IMPORT D_CloseDialog
|
|
IMPORT D_DecimalOnly
|
|
IMPORT D_Deref
|
|
IMPORT Fix2Asc
|
|
IMPORT D_GetNewModalDialog
|
|
IMPORT D_NeedHand
|
|
IMPORT P_AddGuide
|
|
IMPORT P_AllHGCount
|
|
IMPORT P_AllHGuides
|
|
IMPORT P_AllVGCount
|
|
IMPORT P_AllVGuides
|
|
IMPORT P_BuildUndo
|
|
IMPORT P_ContentRect
|
|
IMPORT P_DefSize
|
|
IMPORT P_DeleteData
|
|
IMPORT P_DoScritch
|
|
IMPORT P_DragStuff
|
|
IMPORT P_ExplodeGuide
|
|
IMPORT P_FindGuide
|
|
IMPORT P_Fix2Int
|
|
IMPORT P_FixPt
|
|
IMPORT P_H
|
|
IMPORT P_HorizGCount
|
|
IMPORT P_HorizGuides
|
|
IMPORT P_Local2PL
|
|
IMPORT P_LockGuides
|
|
IMPORT P_MergeGuides
|
|
IMPORT P_OldIdlePt
|
|
IMPORT P_PageMode
|
|
IMPORT P_PageRect
|
|
IMPORT P_PaperRect
|
|
IMPORT P_PrintHand
|
|
IMPORT P_SGuideDlog
|
|
IMPORT P_TrackMaskHorz
|
|
IMPORT P_TrackMaskVert
|
|
IMPORT P_TrackOn
|
|
IMPORT P_V
|
|
IMPORT P_VRulRect
|
|
IMPORT P_VertGCount
|
|
IMPORT P_VertGuides
|
|
IMPORT P_VisGuides
|
|
IMPORT D_Set4Pat
|
|
IMPORT D_SetCursor
|
|
IMPORT D_UnLock
|
|
IMPORT D_FastMult
|
|
|
|
IMPORT P_FullPaperRect
|
|
IMPORT D_UseStdColors
|
|
|
|
;-----------------------------------------------
|
|
;
|
|
; Forward addresses and entries
|
|
;
|
|
;-----------------------------------------------
|
|
|
|
ENTRY P_DrawAGuide
|
|
ENTRY P_KillOldGuides
|
|
|
|
; pguide.s
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
;
|
|
; P_NewGuide (Vert:w)
|
|
;
|
|
|
|
P_NewGuide PROC EXPORT
|
|
;Using P_Data
|
|
|
|
|
|
input Vert:w
|
|
local Amount:w,Count:w,Offset:w,guiderect:r
|
|
local Max:w,Min:w,array:l,dist:w,tmprect:r
|
|
local amt:l,newcount:w
|
|
error err
|
|
begin
|
|
|
|
stz err
|
|
|
|
|
|
|
|
lda vert
|
|
bne SetVert
|
|
call D_SetCursor,in=(#UpDownCursor:w)
|
|
bra DidCursor
|
|
|
|
SetVert call D_SetCursor,in=(#LeftRightCursor:w)
|
|
DidCursor
|
|
movelong P_ContentRect+4,tmprect+4
|
|
stz tmprect
|
|
moveword P_VRulRect+2,tmprect+2
|
|
|
|
tool _ClipRect,in=(!tmprect:l)
|
|
|
|
|
|
lda vert
|
|
bne VertArray
|
|
|
|
moveword P_AllHGCount,Count
|
|
movelong P_AllHGuides,array
|
|
|
|
moveword P_ContentRect,Min
|
|
moveword P_ContentRect+4,Max
|
|
moveword #2,dist
|
|
bra DidArrays
|
|
|
|
VertArray moveword P_AllVGCount,Count
|
|
movelong P_AllVGuides,array
|
|
|
|
moveword P_ContentRect+2,Min
|
|
moveword P_ContentRect+6,Max
|
|
moveword #4,dist
|
|
DidArrays
|
|
|
|
in #641:w,#201:w,count:w,array:l,#P_DrawAGuide:l,#RulerGuide:w
|
|
in Vert:w,Max:w,Min:w,dist:w,#0:w
|
|
out newcount:w,amt:w
|
|
xerr err
|
|
xcall P_DragStuff
|
|
|
|
call P_BuildUndo,in=(#P_GuideUndo:w)
|
|
|
|
cmpw count,newcount
|
|
beq DidMove
|
|
|
|
lda vert
|
|
beq GetHoriz
|
|
movelong P_VertGuides,array
|
|
moveword P_VertGCount,count
|
|
bra DidArrays2
|
|
GetHoriz movelong P_HorizGuides,array
|
|
moveword P_HorizGCount,count
|
|
|
|
DidArrays2 bne Unlocked
|
|
|
|
NeedNew call D_NeedHand,in=(#4:l),out=(array:l)
|
|
|
|
Unlocked
|
|
|
|
; ; Place it in the array.
|
|
in amt:w,array:l,count:w,#RulerGuide:w
|
|
out a:w
|
|
xerr err
|
|
xcall P_AddGuide
|
|
|
|
|
|
done lda vert
|
|
beq HorizCount
|
|
inc P_VertGCount
|
|
inc P_AllVGCount
|
|
movelong array,P_VertGuides
|
|
bra DidMove
|
|
|
|
HorizCount inc P_HorizGCount
|
|
inc P_AllHGCount
|
|
movelong array,P_HorizGuides
|
|
|
|
DidMove
|
|
|
|
exit call P_MergeGuides
|
|
tool _ClipRect,in=(#P_ContentRect:l)
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
;
|
|
; P_MoveGuide (Pt:l) -- localized Q_Point
|
|
;
|
|
; D_MouseDown at Pt.
|
|
; Look through page's guidelists to see if it should be dragged.
|
|
; If so, rip it out of the master guidelist, then call the drag
|
|
; routine with the master guidelist. Rip it out of the page
|
|
; guide list and re-insert it if it still exists.
|
|
;
|
|
; DragStuff needs to return a Q_Point. Guide existance can be checked
|
|
; by looking at the input/output count. The returned Q_Point is used
|
|
; for insertion into the page's guidelist.
|
|
;
|
|
|
|
P_MoveGuide PROC EXPORT
|
|
;Using P_Data
|
|
|
|
input Pt:l
|
|
output MovedIt:w
|
|
local vert:w,offset:w,array:l,count:w
|
|
local amt:w,newcount:w,OrigPt:l
|
|
local Max:w,Min:w,Dist:w
|
|
local tmprect:r,NewPt:l
|
|
local _p_array:l,_p_count:w
|
|
local hwidth:w,vwidth:w,guidetype:w
|
|
error err
|
|
|
|
begin
|
|
|
|
; Q_Point needs to be 'widened' to check 1 pixel above & below,
|
|
; 2 Q_Pixels each to the left & right?
|
|
; needs to coincide w/ draggings nearness checking.
|
|
|
|
stz MovedIt
|
|
|
|
lda P_LockGuides ; Don't drag if guides are X_Locked
|
|
jne exit
|
|
|
|
lda P_VisGuides ; or hidden.
|
|
jeq exit
|
|
|
|
moveword #2,vwidth
|
|
moveword #1,hwidth
|
|
|
|
movelong Pt,OrigPt
|
|
|
|
lda P_PageMode
|
|
beq DidMap
|
|
|
|
asl vwidth
|
|
asl vwidth ; ;** ?
|
|
asl hwidth
|
|
inc hwidth
|
|
|
|
; check vertical guides
|
|
DidMap moveword #1,vert
|
|
movelong P_VertGuides,array
|
|
moveword P_VertGCount,count
|
|
moveword Pt+2,amt
|
|
moveword P_ContentRect+2,Min
|
|
moveword P_ContentRect+6,Max
|
|
moveword #4,dist
|
|
|
|
in array:l,count:w,amt:w,vwidth:w,#-1:w
|
|
out offset:w,Pt+2:w,guidetype:w
|
|
xcall P_FindGuide
|
|
lda offset
|
|
bpl Removal
|
|
|
|
; check horizontal guides
|
|
stz vert
|
|
movelong P_HorizGuides,array
|
|
moveword P_HorizGCount,count
|
|
moveword Pt,amt
|
|
moveword P_ContentRect,Min
|
|
moveword P_ContentRect+4,Max
|
|
moveword #2,dist
|
|
|
|
in array:l,count:w,amt:w,hwidth:w,#-1:w
|
|
out offset:w,Pt:w,guidetype:w
|
|
xcall P_FindGuide
|
|
lda offset
|
|
bpl Removal
|
|
brl exit
|
|
|
|
|
|
; remove it.
|
|
Removal call P_BuildUndo,in=(#P_GuideUndo:w)
|
|
lda count
|
|
dec a
|
|
bne DeleteIt
|
|
tool _DisposeHandle,in=(array:l)
|
|
stzl array
|
|
stz count
|
|
bra Deleted
|
|
|
|
DeleteIt call P_DeleteData,in=(array:l,offset:w,#1:w,#4:w,count:w),err=(err)
|
|
dec count
|
|
Deleted
|
|
|
|
|
|
moverect P_ContentRect,tmprect
|
|
|
|
lda vert
|
|
beq DoHoriz
|
|
|
|
dec P_VertGCount
|
|
rcall P_FixPt,in=(Pt:ax,#1:y),out=(NewPt:ax)
|
|
stx tmprect+2
|
|
inx
|
|
stx tmprect+6
|
|
|
|
bra DidUnMap
|
|
|
|
DoHoriz dec P_HorizGCount
|
|
rcall P_FixPt,in=(Pt:ax,#0:y),out=(NewPt:ax)
|
|
sta tmprect
|
|
inc a
|
|
sta tmprect+4
|
|
|
|
DidUnmap
|
|
; re-merge
|
|
call P_MergeGuides
|
|
|
|
lda vert
|
|
beq HorizMerge
|
|
|
|
movelong P_AllVGuides,_p_array
|
|
moveword P_AllVGCount,_p_count
|
|
|
|
bra DidMerge
|
|
HorizMerge movelong P_AllHGuides,_p_array
|
|
moveword P_AllHGCount,_p_count
|
|
|
|
DidMerge
|
|
|
|
tool _EraseRect,in=(!tmprect:l)
|
|
tool _InvalRect,in=(!tmprect:l)
|
|
|
|
movelong P_ContentRect+4,tmprect+4
|
|
stz tmprect
|
|
moveword P_VRulRect+2,tmprect+2
|
|
tool _ClipRect,in=(!tmprect:l)
|
|
|
|
lda P_TrackOn
|
|
beq DidScritch
|
|
call P_DoScritch,in=(P_OldIdlePt:l)
|
|
stz P_TrackOn
|
|
DidScritch
|
|
|
|
lda vert
|
|
bne DoLeftRight
|
|
call D_SetCursor,in=(#UpDownCursor:w)
|
|
bra DidCurse
|
|
|
|
DoLeftRight call D_SetCursor,in=(#LeftRightCursor:w)
|
|
|
|
DidCurse
|
|
|
|
; drag it.
|
|
in #641:w,#201:w,_p_count:w,_p_array:l,#P_DrawAGuide:l,guidetype:w
|
|
in Vert:w,Max:w,Min:w,dist:w,#0:w
|
|
out newcount:w,amt:w
|
|
xerr err
|
|
xcall P_DragStuff
|
|
|
|
inc MovedIt
|
|
|
|
cmpw _p_count,newcount
|
|
beq DidMove
|
|
|
|
lda count
|
|
bne Unlocked
|
|
|
|
NeedNew call D_NeedHand,in=(#4:l),out=(array:l)
|
|
|
|
Unlocked
|
|
|
|
; ; Place it in the array.
|
|
in amt:w,array:l,count:w,guidetype:w
|
|
out a:w
|
|
xerr err
|
|
xcall P_AddGuide
|
|
|
|
|
|
done lda vert
|
|
beq HorizCount
|
|
inc P_VertGCount
|
|
inc P_AllVGCount
|
|
movelong array,P_VertGuides
|
|
bra DidMove
|
|
|
|
HorizCount inc P_HorizGCount
|
|
inc P_AllHGCount
|
|
movelong array,P_HorizGuides
|
|
|
|
DidMove
|
|
call P_MergeGuides
|
|
|
|
tool _ClipRect,in=(#P_ContentRect:l)
|
|
|
|
exit return
|
|
ENDP
|
|
|
|
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
;
|
|
; P_DrawGuides (RectPtr:l)
|
|
;
|
|
|
|
P_DrawGuides PROC EXPORT
|
|
;Using P_Data
|
|
|
|
input RectPtr:l
|
|
local Ptr:l,Count:w,H:w,V:w,offset:l
|
|
|
|
begin
|
|
ThePt equ V
|
|
|
|
|
|
subword P_ContentRect,P_V,offset
|
|
subword P_ContentRect+2,P_H,offset+2
|
|
|
|
lda P_AllVGCount
|
|
beq DoHoriz
|
|
|
|
; draw vertical guides
|
|
rcall D_Deref,in=(P_AllVGuides:ax),out=(Ptr:ax)
|
|
|
|
stz Count
|
|
|
|
VLoop lda Count
|
|
cmp P_AllVGCount
|
|
bge DoneVert
|
|
|
|
asl a
|
|
asl a
|
|
tay
|
|
moveword [Ptr]:y,H
|
|
|
|
lda P_PageMode
|
|
beq NormV
|
|
|
|
tool _MapPt,in=(!ThePt:l,#P_PaperRect:l,#P_FullPaperRect:l)
|
|
bra ShowV
|
|
|
|
NormV addword H,offset+2,H
|
|
|
|
ShowV call P_DrawAGuide,in=(#-1:l,H:w,#0:w,#-1:w,#1:w)
|
|
|
|
inc Count
|
|
bra VLoop
|
|
DoneVert
|
|
|
|
rcall D_UnLock,in=(P_AllVGuides:ax)
|
|
|
|
|
|
; draw horizontal guides
|
|
DoHoriz lda P_AllHGCount
|
|
beq Exit
|
|
|
|
rcall D_Deref,in=(P_AllHGuides:ax),out=(Ptr:ax)
|
|
|
|
stz Count
|
|
HLoop lda Count
|
|
cmp P_AllHGCount
|
|
bge DoneHoriz
|
|
|
|
asl a
|
|
asl a
|
|
tay
|
|
moveword [Ptr]:y,V
|
|
|
|
lda P_PageMode
|
|
beq NormH
|
|
|
|
tool _MapPt,in=(!ThePt:l,#P_PaperRect:l,#P_FullPaperRect:l)
|
|
bra ShowH
|
|
|
|
NormH addword V,offset,V
|
|
|
|
ShowH call P_DrawAGuide,in=(#-1:l,#0:w,V:w,#-1:w,#0:w)
|
|
|
|
inc Count
|
|
bra HLoop
|
|
DoneHoriz
|
|
|
|
rcall D_UnLock,in=(P_AllHGuides:ax)
|
|
|
|
Exit _PenNormal
|
|
return
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
|
|
|
|
;---------------------------------------------------------------------------
|
|
;
|
|
; P_DrawAGuide
|
|
;
|
|
; Notes for D_DrawProc:
|
|
;
|
|
; newpt of -1,-1 says to get rid of the old drawing & nothing else
|
|
;
|
|
; newpt == oldpt says to get rid of old, then redraw it for real.
|
|
;
|
|
; oldpt == -1,-1 says just draw it
|
|
;
|
|
; need to clip as necessary before calling this.
|
|
; Coordinates are in WINDOW local -- not offset nor scaled.
|
|
;
|
|
|
|
P_DrawAGuide PROC EXPORT
|
|
;Using P_Data
|
|
|
|
input oldpt:l,newpt:l,type:w,vert:w
|
|
local tmprect:r
|
|
begin
|
|
|
|
|
|
movelong P_ContentRect+4,tmprect+4
|
|
|
|
call D_Set4Pat,in=(#Black:w)
|
|
tool _SetPenSize,in=(#1:w,#1:w)
|
|
|
|
tool _SetPenMode,in=(#notXOR:w)
|
|
|
|
|
|
lda vert
|
|
beq MaskVert
|
|
|
|
tool _SetPenMask,in=(#P_TrackMaskVert:l)
|
|
bra DidMask
|
|
MaskVert tool _SetPenMask,in=(#P_TrackMaskHorz:l)
|
|
DidMask
|
|
|
|
; ; UnDraw the old first...
|
|
cmpl oldpt,#-1
|
|
beq DrawNew
|
|
|
|
DoErase lda vert
|
|
bne EraseV
|
|
|
|
tool _MoveTo,in=(P_VRulRect+2:w,OldPt:w)
|
|
tool _LineTo,in=(P_ContentRect+6:w,OldPt:w)
|
|
bra DidOld
|
|
|
|
EraseV tool _MoveTo,in=(OldPt+2:w,#0:w)
|
|
tool _LineTo,in=(OldPt+2:w,P_ContentRect+4:w)
|
|
|
|
DidOld
|
|
|
|
; ; Now the D_New...
|
|
DrawNew cmpl newpt,#-1
|
|
jeq exit
|
|
|
|
cmpl newpt,oldpt
|
|
bne DrawIt
|
|
; ; Do send to back stuff....
|
|
|
|
moverect P_ContentRect,tmprect
|
|
lda vert
|
|
bne SendBackV
|
|
|
|
moveword NewPt,tmprect
|
|
inc a
|
|
sta tmprect+4
|
|
|
|
bra SendIt
|
|
|
|
SendBackV moveword NewPt+2,tmprect+2
|
|
inc a
|
|
sta tmprect+6
|
|
|
|
SendIt tool _EraseRect,in=(!tmprect:l)
|
|
tool _InvalRect,in=(!tmprect:l)
|
|
brl exit
|
|
|
|
|
|
DrawIt
|
|
cmpl OldPt,#-1
|
|
bne Clipped
|
|
|
|
tool _SetPenMode,in=(#modeCOPY:w)
|
|
|
|
Clipped lda vert
|
|
bne ShowV
|
|
|
|
tool _MoveTo,in=(P_VRulRect+2:w,NewPt:w)
|
|
tool _LineTo,in=(P_ContentRect+6:w,NewPt:w)
|
|
bra Exit
|
|
|
|
ShowV
|
|
tool _MoveTo,in=(NewPt+2:w,#0:w)
|
|
tool _LineTo,in=(NewPt+2:w,P_ContentRect+4:w)
|
|
|
|
exit _PenNormal
|
|
|
|
return
|
|
ENDP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;---------------------------------------------------------------------------
|
|
;
|
|
; P_SetGuides
|
|
;
|
|
; 1 = OK, 2 = Cancel
|
|
;
|
|
; 4 = LR LineEdit
|
|
; 5 = TB LineEdit
|
|
; 6 = Col LineEdit
|
|
; 7 = CS LineEdit
|
|
;
|
|
; 8 = LR 0.25 inch
|
|
; 9 = 0.5 inch
|
|
; 10 = LE control
|
|
;
|
|
; 12 = TB 0.25 inch
|
|
; 13 = 0.5 inch
|
|
; 14 = LE control
|
|
;
|
|
; 16 = Col 1
|
|
; 17 = 2
|
|
; 18 = LE control
|
|
;
|
|
; 20 = CS 0.25 inch
|
|
; 21 = 0.5 inch
|
|
; 22 = LE control
|
|
;
|
|
; 24-27 Static Q_Text
|
|
|
|
P_SetGuides PROC EXPORT
|
|
;Using P_Data
|
|
local result:w,TheDlog:l,anItem:w,ptr:l,hdl:l
|
|
local vert:l,horz:l,tmp:l
|
|
local vfrac:l,hfrac:l,cols:w
|
|
local colspace:w,colwidth:w,margwidth:w
|
|
local str:r,inches:l
|
|
begin +b
|
|
|
|
; Dialog item #'s
|
|
LRLE equ 4
|
|
TBLE equ 5
|
|
ColLE equ 6
|
|
CSLE equ 7
|
|
LR1 equ 8
|
|
LR2 equ 9
|
|
LR3 equ 10
|
|
TB1 equ 12
|
|
TB2 equ 13
|
|
TB3 equ 14
|
|
Col1 equ 16
|
|
Col2 equ 17
|
|
Col3 equ 18
|
|
CS1 equ 20
|
|
CS2 equ 21
|
|
CS3 equ 22
|
|
|
|
FirstStat equ 24
|
|
LastLE equ 7
|
|
jsl D_UseStdColors
|
|
|
|
call D_GetNewModalDialog,in=(#P_SGuideDlog:l),out=(TheDlog:l)
|
|
; set defaults according to print record ??
|
|
|
|
movelong P_PrintHand,tmp
|
|
movelong [tmp],ptr
|
|
moveword [ptr]:#4,vert
|
|
moveword [ptr]:#6,horz
|
|
|
|
subword P_PageRect,P_PaperRect,tmp
|
|
tool _FixDiv,in=(tmp:w,#0:w,vert:w,#0:w),out=(vfrac:l)
|
|
|
|
subword P_PageRect+2,P_PaperRect+2,tmp
|
|
tool _FixDiv,in=(tmp:w,#0:w,horz:w,#0:w),out=(hfrac:l)
|
|
|
|
|
|
; Now check horz and vert to see if they are .25 or .5"
|
|
; if so, D_Activate the appropriate control. If not, set
|
|
; the Q_Text to reflect the real page Q_Rect & D_Activate the
|
|
; LE's ctl.
|
|
|
|
; horizontal
|
|
|
|
cmpl hfrac,#$00004000
|
|
beq DoHQuarter
|
|
|
|
cmpl hfrac,#$00008000
|
|
beq DoHHalf
|
|
|
|
DoHLE call Fix2Asc,in=(hfrac:l,!str:l)
|
|
tool _SetIText,in=(TheDlog:l,#LRLE:w,!str:l)
|
|
tool _SetDItemValue,in=(#1:w,TheDlog:l,#LR3:w)
|
|
tool _SelIText,in=(TheDlog:l,#LRLE:w,#0:w,#4:w)
|
|
bra DidH
|
|
DoHQuarter tool _SetDItemValue,in=(#1:w,TheDlog:l,#LR1:w)
|
|
bra DoneH
|
|
DoHHalf tool _SetDItemValue,in=(#1:w,TheDlog:l,#LR2:w)
|
|
|
|
DoneH tool _SelIText,in=(TheDlog:l,#LRLE:w,#4:w,#4:w)
|
|
DidH
|
|
; vertical
|
|
|
|
cmpl vfrac,#$00004000
|
|
beq DoVQuarter
|
|
|
|
cmpl vfrac,#$00008000
|
|
beq DoVHalf
|
|
|
|
DoVLE call Fix2Asc,in=(vfrac:l,!str:l)
|
|
tool _SetIText,in=(TheDlog:l,#TBLE:w,!str:l)
|
|
tool _SetDItemValue,in=(#1:w,TheDlog:l,#TB3:w)
|
|
bra DoneV
|
|
DoVQuarter tool _SetDItemValue,in=(#1:w,TheDlog:l,#TB1:w)
|
|
bra DoneV
|
|
DoVHalf tool _SetDItemValue,in=(#1:w,TheDlog:l,#TB2:w)
|
|
|
|
DoneV
|
|
|
|
Loop tool _ModalDialog,in=(#D_DecimalOnly+$80000000:l),out=(result:w)
|
|
beq Loop
|
|
|
|
cmp #OK
|
|
beq Add
|
|
cmp #Cancel
|
|
jeq QuitDlog
|
|
|
|
cmp #LastLE+1
|
|
blt Loop
|
|
cmp #FirstStat
|
|
bge Loop
|
|
|
|
tool _SetDItemValue,in=(#1:w,TheDlog:l,result:w)
|
|
|
|
cmpw result,#LR3
|
|
beq LEActive
|
|
cmp #TB3
|
|
beq LEActive
|
|
cmp #Col3
|
|
beq LEActive
|
|
cmp #CS3
|
|
beq LEActive
|
|
bra Loop
|
|
|
|
; ; 4 rctl's w/ LE's need to D_Activate that LE if selected!
|
|
; 10 -> 4, 14 -> 5, 18 -> 6, 22 -> 7.
|
|
;
|
|
LEActive lsr a
|
|
inc a
|
|
lsr a
|
|
inc a
|
|
sta anItem
|
|
|
|
tool _SelIText,in=(TheDlog:l,anItem:w,#0:w,#4:w)
|
|
|
|
bra Loop
|
|
|
|
; ; Add necessary guides, after deleting old marked guides
|
|
Add call P_KillOldGuides
|
|
|
|
; Top Margin
|
|
tool _GetDItemValue,in=(TheDlog:l,#TB1:w),out=(a:w)
|
|
beq Ck5TopB
|
|
movelong #$00004000,inches ; 1/4"
|
|
bra DoTopB
|
|
|
|
Ck5TopB tool _GetDItemValue,in=(TheDlog:l,#TB2:w),out=(a:w)
|
|
beq CkLETopB
|
|
movelong #$00008000,inches ; 1/2"
|
|
bra DoTopB
|
|
|
|
CkLETopB tool _GetIText,in=(TheDLog:l,#TBLE:w,!str:l)
|
|
call Asc2Fix,in=(!str:l),out=(inches:l)
|
|
bcs Margins
|
|
|
|
DoTopB lda P_HorizGCount
|
|
bne GotNewH
|
|
|
|
call D_NeedHand,in=(#4:l),out=(P_HorizGuides:l)
|
|
|
|
GotNewH spacelong
|
|
pushfixword vert
|
|
pushlong inches
|
|
_FixMul
|
|
rcall P_Fix2Int,in=(s:ax),out=(vert:a)
|
|
|
|
in a:w,P_HorizGuides:l,P_HorizGCount:w,#MargGuide:w
|
|
out P_HorizGCount:w
|
|
xcall P_AddGuide
|
|
|
|
; Bottom Margin
|
|
subword P_PaperRect+4,vert,a
|
|
in a:w,P_HorizGuides:l,P_HorizGCount:w,#MargGuide:w
|
|
out P_HorizGCount:w
|
|
xcall P_AddGuide
|
|
|
|
|
|
|
|
; Left Margin
|
|
Margins tool _GetDItemValue,in=(TheDlog:l,#LR1:w),out=(a:w)
|
|
beq Ck5LR
|
|
movelong #$00004000,inches ; 1/4"
|
|
bra DoLR
|
|
|
|
Ck5LR tool _GetDItemValue,in=(TheDlog:l,#LR2:w),out=(a:w)
|
|
beq CkLELR
|
|
movelong #$00008000,inches ; 1/2"
|
|
bra DoLR
|
|
|
|
CkLELR tool _GetIText,in=(TheDLog:l,#LRLE:w,!str:l)
|
|
call Asc2Fix,in=(!str:l),out=(inches:l)
|
|
bcs Columns
|
|
|
|
DoLR lda P_VertGCount
|
|
bne GotNewV
|
|
|
|
call D_NeedHand,in=(#4:l),out=(P_VertGuides:l)
|
|
|
|
GotNewV spacelong
|
|
pushfixword horz
|
|
pushlong inches
|
|
_FixMul
|
|
rcall P_Fix2Int,in=(s:ax),out=(margwidth:a)
|
|
and #$FFFE
|
|
in a:w,P_VertGuides:l,P_VertGCount:w,#MargGuide:w
|
|
out P_VertGCount:w
|
|
xcall P_AddGuide
|
|
|
|
; Right Margin
|
|
subword P_PaperRect+6,margwidth,a
|
|
and #$FFFE
|
|
in a:w,P_VertGuides:l,P_VertGCount:w,#MargGuide:w
|
|
out P_VertGCount:w
|
|
xcall P_AddGuide
|
|
|
|
; Column guides....
|
|
Columns tool _GetDItemValue,in=(TheDlog:l,#Col1:w),out=(a:w)
|
|
jne QuitDlog ; w/ 1 col, no col-guides necess
|
|
|
|
Ck2Col tool _GetDItemValue,in=(TheDlog:l,#Col2:w),out=(a:w)
|
|
beq CkLECol
|
|
moveword #2,cols
|
|
bra DoCol
|
|
|
|
CkLECol tool _GetIText,in=(TheDLog:l,#ColLE:w,!cols:l)
|
|
tool _Dec2Int,in=(!cols+1:l,#1:w,#0:w),out=(cols:w)
|
|
jcs QuitDlog
|
|
|
|
DoCol tool _GetDItemValue,in=(TheDlog:l,#CS1:w),out=(a:w)
|
|
beq Ck5CW
|
|
movelong #$00004000,inches ; 1/4"
|
|
bra DoCW
|
|
|
|
Ck5CW tool _GetDItemValue,in=(TheDlog:l,#CS2:w),out=(a:w)
|
|
beq CkLECW
|
|
movelong #$00008000,inches ; 1/2"
|
|
bra DoCW
|
|
|
|
CkLECW tool _GetIText,in=(TheDLog:l,#CSLE:w,!str:l)
|
|
call Asc2Fix,in=(!str:l),out=(inches:l)
|
|
jcs QuitDlog
|
|
|
|
DoCW spacelong
|
|
pushfixword horz
|
|
pushlong inches
|
|
_FixMul
|
|
|
|
rcall P_Fix2Int,in=(s:ax),out=(colspace:a)
|
|
|
|
; colwidth = (pagewidth - 2*marginwidth - (cols-1)*colspace) / cols.
|
|
lda margwidth
|
|
asl a
|
|
sta tmp
|
|
subword P_PaperRect+6,tmp,tmp
|
|
lda cols
|
|
dec a
|
|
rcall D_FastMult,in=(a:x,colspace:y),out=(tmp+2:a)
|
|
subword tmp,tmp+2,tmp
|
|
tool _UDivide,in=(tmp:w,cols:w),out=(y:w,colwidth:w)
|
|
|
|
moveword margwidth,tmp
|
|
|
|
ColLoop dec cols
|
|
beq QuitDlog
|
|
|
|
addword tmp,colwidth,tmp
|
|
and #$FFFE
|
|
|
|
in a:w,P_VertGuides:l,P_VertGCount:w,#ColGuide:w
|
|
out P_VertGCount:w
|
|
xcall P_AddGuide
|
|
|
|
addword tmp,colspace,tmp
|
|
and #$FFFE
|
|
|
|
in a:w,P_VertGuides:l,P_VertGCount:w,#ColGuide:w
|
|
out P_VertGCount:w
|
|
xcall P_AddGuide
|
|
|
|
bra ColLoop
|
|
|
|
QuitDlog call D_CloseDialog,in=(TheDlog:l)
|
|
cmpw result,#Cancel
|
|
beq exit
|
|
|
|
call P_MergeGuides
|
|
tool _EraseRect,in=(#P_ContentRect:l)
|
|
tool _InvalRect,in=(#P_ContentRect:l)
|
|
|
|
exit return
|
|
ENDP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;---------------------------------------------------------------------------
|
|
;
|
|
; P_KillOldGuides
|
|
;
|
|
|
|
P_KillOldGuides PROC EXPORT
|
|
;Using P_Data
|
|
|
|
local array:l,count:w,offset:w
|
|
begin
|
|
|
|
|
|
lda P_VertGCount
|
|
jeq DoHoriz
|
|
|
|
rcall D_Deref,in=(P_VertGuides:ax),out=(array:ax)
|
|
moveword P_VertGCount,count
|
|
dec a
|
|
asl a
|
|
asl a
|
|
ina
|
|
ina
|
|
sta offset
|
|
|
|
KillVLoop cmpw [array]:offset,#RulerGuide
|
|
bne KillV
|
|
|
|
subword offset,#4,offset
|
|
bra ContV
|
|
|
|
KillV rcall D_UnLock,in=(P_VertGuides:ax) ; ick!!!
|
|
|
|
dec offset
|
|
dec offset
|
|
in P_VertGuides:l,offset:w,#1:w,#4:w,P_VertGCount:w
|
|
xcall P_DeleteData
|
|
|
|
rcall D_Deref,in=(P_VertGuides:ax),out=(array:ax) ; doubly so.
|
|
|
|
dec P_VertGCount
|
|
dec offset
|
|
dec offset
|
|
|
|
ContV lda offset
|
|
bpl KillVLoop
|
|
|
|
rcall D_UnLock,in=(P_VertGuides:ax)
|
|
|
|
lda P_VertGCount
|
|
bne DoHoriz
|
|
|
|
tool _DisposeHandle,in=(P_VertGuides:l)
|
|
|
|
stzl P_VertGuides
|
|
|
|
|
|
DoHoriz lda P_HorizGCount
|
|
jeq exit
|
|
|
|
rcall D_Deref,in=(P_HorizGuides:ax),out=(array:ax)
|
|
moveword P_HorizGCount,count
|
|
dec a
|
|
asl a
|
|
asl a
|
|
ina
|
|
ina
|
|
sta offset
|
|
|
|
|
|
KillHLoop cmpw [array]:offset,#RulerGuide
|
|
bne KillH
|
|
|
|
subword offset,#4,offset
|
|
|
|
bra ContH
|
|
|
|
KillH rcall D_UnLock,in=(P_HorizGuides:ax) ; ick!!!
|
|
|
|
dec offset
|
|
dec offset
|
|
in P_HorizGuides:l,offset:w,#1:w,#4:w,P_HorizGCount:w
|
|
xcall P_DeleteData
|
|
|
|
rcall D_Deref,in=(P_HorizGuides:ax),out=(array:ax) ; doubly so.
|
|
|
|
dec P_HorizGCount
|
|
dec offset
|
|
dec offset
|
|
|
|
ContH lda offset
|
|
bpl KillHLoop
|
|
|
|
rcall D_UnLock,in=(P_HorizGuides:ax)
|
|
|
|
lda P_HorizGCount
|
|
bne exit
|
|
|
|
tool _DisposeHandle,in=(P_HorizGuides:l)
|
|
|
|
stzl P_HorizGuides
|
|
|
|
exit return
|
|
ENDP
|
|
|
|
|
|
|
|
;---------------------------------------------------------------------------
|
|
;
|
|
; P_ExplodeRect(pt:l,recptr:l) pt is in D_PL coords.
|
|
;
|
|
|
|
P_ExplodeRect PROC EXPORT
|
|
;Using P_Data
|
|
|
|
input pt:l,rectptr:l
|
|
local ptr:l,hdl:l,tmppt:l
|
|
error err
|
|
begin
|
|
|
|
moveword #1,err
|
|
|
|
rcall P_Local2PL,in=(P_PageRect:ax),out=(tmppt:ax)
|
|
subword pt,tmppt,a
|
|
jmi quit
|
|
subword pt+2,tmppt+2,a
|
|
jmi quit
|
|
|
|
rcall P_Local2PL,in=(P_PageRect+4:ax),out=(tmppt:ax)
|
|
subword tmppt,pt,a
|
|
jmi quit
|
|
jeq quit
|
|
cmp P_DefSize
|
|
jlt quit
|
|
|
|
subword tmppt+2,pt+2,a
|
|
jmi quit
|
|
jeq quit
|
|
|
|
DoTop in P_AllHGuides:l,P_AllHGCount:w,pt:w,#-1:w,#-1:w
|
|
out [rectptr]:w
|
|
xcall P_ExplodeGuide
|
|
bcc DoBottom
|
|
|
|
cmpw pt,P_PageRect
|
|
jlt quit
|
|
moveword P_PageRect,[rectptr]
|
|
|
|
DoBottom in P_AllHGuides:l,P_AllHGCount:w,pt:w,#-1:w,#1:w
|
|
out [rectptr]:#4:w
|
|
xcall P_ExplodeGuide
|
|
bcc DoLeft
|
|
|
|
cmpw P_PageRect+4,pt
|
|
jlt quit
|
|
subword P_PageRect+4,#1,[rectptr]:#4
|
|
|
|
DoLeft in P_AllVGuides:l,P_AllVGCount:w,pt+2:w,#-1:w,#-1:w
|
|
out [rectptr]:#2:w
|
|
xcall P_ExplodeGuide
|
|
bcc DoRight
|
|
|
|
cmpw pt+2,P_PageRect+2
|
|
jlt quit
|
|
moveword P_PageRect+2,[rectptr]:#2
|
|
|
|
DoRight in P_AllVGuides:l,P_AllVGCount:w,pt+2:w,#-1:w,#1:w
|
|
out [rectptr]:#6:w
|
|
xcall P_ExplodeGuide
|
|
bcc exit
|
|
|
|
cmpw P_PageRect+6,pt+2
|
|
blt quit
|
|
subword P_PageRect+6,#4,[rectptr]:#6
|
|
|
|
exit stz err
|
|
ldy #6
|
|
addword [rectptr]:y,#2,[rectptr]:y
|
|
ldy #4
|
|
addword [rectptr]:y,#1,[rectptr]:y
|
|
|
|
quit return
|
|
ENDP
|
|
END
|
|
|