1 line
15 KiB
ArmAsm
1 line
15 KiB
ArmAsm
|
load 'macros.dump'
include 'driver.equ'
include 'pl.equ'
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
IMPORT D_CloseDialog
IMPORT D_DigitsOnly
IMPORT D_FastMult
IMPORT D_GetNewModalDialog
IMPORT P_AllHGCount
IMPORT P_AllHGuides
IMPORT P_AllVGCount
IMPORT P_AllVGuides
IMPORT P_ContentRect
IMPORT P_CurrentWin
IMPORT P_DPageDlog
IMPORT P_DblPage
IMPORT P_DelObjList
IMPORT P_DeleteData
IMPORT P_DrawContent
IMPORT P_DrawObjList
IMPORT P_FirstPOff
IMPORT P_FixMenus
IMPORT P_FixSpecMenu
IMPORT P_GrewDoc
IMPORT P_HorizGCount
IMPORT P_HorizGuides
IMPORT P_InsertData
IMPORT P_KillUndo
IMPORT P_LastObj
IMPORT P_ListOp
IMPORT P_Merge
IMPORT P_ObjList
IMPORT P_PIconRect
IMPORT P_PInfoSize
IMPORT P_Page
IMPORT P_PageArray
IMPORT P_PageCount
IMPORT P_PageDlog
IMPORT P_PageIcons
IMPORT P_PageInfo
IMPORT P_PageStart
IMPORT P_PortRect
IMPORT P_ToolType
IMPORT P_UseTemplate
IMPORT P_VertGCount
IMPORT P_VertGuides
IMPORT T_ClipThread
IMPORT T_DotObj
IMPORT D_UseStdColors
IMPORT D_SetFileChanged
IMPORT T_Editing
IMPORT T_Deactivate
;-----------------------------------------------
;
; Forward addresses and entries
;
;-----------------------------------------------
ENTRY P_CenterPage
ENTRY P_ChangePage
ENTRY P_FixTextObj
ENTRY P_InitPage
ENTRY P_KillPage
ENTRY P_LoadPage
ENTRY P_MergeGuides
ENTRY P_SavePage
ENTRY P_InsPgFilter
; ppage.s
;---------------------------------------------------------------------------
;
; P_InsertPages
;
;
; OKBut 1
; CancelBut 2
; Text1 3 ; Insert
; PgCnt 4 ; 1
; Text2 5 ; page(s)
; RCtl1 6 ; at the beginning.
; RCtl2 7 ; after the current page.
; RCtl3 8 ; at the end.
;
; invariants: P_PageCount = # of user pages
; P_PageStart = 1st user page that is displayed as an icon
; P_Page = current page's index into page array
; = user page # + 1
; P_DblPage = bool. F=1 template, T=L/R template
P_InsertPages PROC EXPORT
;Using P_Data
;Using P_AttrData
;Using P_ICONDATA
Text1I equ 3
PgCntI equ 4
Text2I equ 5
RCtl1 equ 6
RCtl2 equ 7
RCtl3 equ 8
local TheDlog:l,result:w,NewPages:w,thepage:w
local WhichCtl:w,offset:w,ptr:l,count:w,hdl:l,oldpage:w
local Len:w,pagetext:r
error err
begin +b
moveword #RCtl2,WhichCtl
moveword P_Page,oldpage
jsl D_UseStdColors
call D_GetNewModalDialog,in=(#P_PageDlog:l),out=(TheDlog:l)
cmpw P_Page,#2
bge DlogLoop
moveword #RCtl1,WhichCtl
tool _SetDItemValue,in=(#1:w,TheDlog:l,#RCtl1:w)
pushword #255
tool _GetControlDItem,in=(TheDlog:l,#RCtl2:w),out=(:l)
tool _HiliteControl,in=(:w,:l) ; [sic]
DlogLoop
tool _ModalDialog,in=(#P_InsPgFilter+$80000000:l),out=(result:w)
cmp #OK
jeq HitOK
cmp #Cancel
jeq DoCancel
cmp #RCtl1
blt DlogLoop
cmp #RCtl3+1
bge DlogLoop
sta WhichCtl
tool _SetDItemValue,in=(#1:w,TheDlog:l,WhichCtl:w)
brl DlogLoop
DoCancel
call D_CloseDialog,in=(TheDlog:l)
brl Exit
HitOK tool _GetIText,in=(TheDlog:l,#PgCntI:w,!pagetext:l)
lda pagetext
and #$00FF
sta Len
tool _Dec2Int,in=(!pagetext+1:l,Len:w,#0:w),out=(NewPages:w)
lda NewPages
beq DoCancel
call D_CloseDialog,in=(TheDlog:l)
call P_KillUndo
call P_SavePage,in=(P_Page:w)
cmpw WhichCtl,#RCtl1
bne Ck2 ; after the first page
moveword #2,thepage
bra DoneCk
Ck2 cmp #RCtl2
bne Ck3 ; after the current page
lda P_Page
ina
sta thepage
bra DoneCk
Ck3 ; ; must be Ctl3: ; after the last page
addword P_PageCount,#2,thepage
DoneCk addword P_PageCount,#2,count
rcall D_FastMult,in=(#P_PInfoSize:x,thepage:y),out=(offset:a)
in P_PageArray:l,offset:w,NewPages:w,#P_PInfoSize:w,count:w
xerr err
xcall P_InsertData
jcs whoops
moveword NewPages,count
moveword thepage,offset
ZilchLoop call P_InitPage,in=(offset:w)
inc offset
dec count
jne ZilchLoop
lda offset ; Make P_Page correspond
dec a ; to the page globals, so
sta P_Pag
|