mirror of
https://github.com/antoinevignau/source.git
synced 2024-06-01 00:41:39 +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'
|
||
|
||
********************************************************************
|
||
*
|
||
* Includes...
|
||
*
|
||
*
|
||
* Monday, May 1, 1989 2:57:54 AM
|
||
********************************************************************
|
||
|
||
IMPORT D_AddStrings
|
||
IMPORT D_NeedHand
|
||
IMPORT D_AlertBox
|
||
IMPORT W_CalcDocRect
|
||
IMPORT W_Caret
|
||
IMPORT CaretOff
|
||
IMPORT W_CaretOn
|
||
IMPORT W_ChangeAll
|
||
IMPORT W_CheckDocPos
|
||
IMPORT D_CheckMenuFID
|
||
IMPORT W_CheckSpelling
|
||
IMPORT D_ClearFileChanged
|
||
IMPORT W_Thesaurus
|
||
IMPORT W_EditUserDict
|
||
IMPORT W_CreateReport
|
||
IMPORT W_CurDoc
|
||
IMPORT W_DelPars
|
||
IMPORT W_DelSelect
|
||
IMPORT D_Deref
|
||
IMPORT D_DisableMItems
|
||
IMPORT D_DisposePtr
|
||
IMPORT W_DoNormal
|
||
IMPORT W_DoSetPg
|
||
IMPORT W_DrawGrow
|
||
IMPORT W_DrawPgBox
|
||
IMPORT W_DrawRuler
|
||
IMPORT W_EditEvent
|
||
IMPORT W_EditEventSize
|
||
IMPORT W_EndLine
|
||
IMPORT W_EndOffset
|
||
IMPORT W_EndPar
|
||
IMPORT W_FillDateTime
|
||
IMPORT W_FindFont
|
||
IMPORT W_FindReplace
|
||
|
||
IMPORT W_GetDoc
|
||
IMPORT D_GetNewUntitled
|
||
IMPORT W_GetParRec
|
||
IMPORT D_GetRefCon
|
||
IMPORT W_GotSize
|
||
IMPORT W_GotStyle
|
||
|
||
IMPORT W_InitNew
|
||
IMPORT W_InitVisRuler
|
||
IMPORT W_InsertKeys
|
||
IMPORT D_KillFont
|
||
IMPORT W_MakeCaretNS
|
||
IMPORT D_MakeNewWin
|
||
IMPORT W_MakeSelect
|
||
IMPORT W_MergeDocWin
|
||
IMPORT W_MergeDocName
|
||
IMPORT W_MyCopy
|
||
IMPORT W_MyCut
|
||
IMPORT W_MyMouseDown
|
||
IMPORT W_MyUndo
|
||
IMPORT W_MyPaste
|
||
IMPORT W_NewWinComin
|
||
IMPORT W_OpenDoc
|
||
IMPORT W_PHandle
|
||
IMPORT W_PPtr
|
||
IMPORT W_ParRec
|
||
IMPORT W_PasteFooter
|
||
IMPORT W_PasteHeader
|
||
IMPORT W_PickMergeDB
|
||
IMPORT W_PrintChanged
|
||
IMPORT W_PrintDoc
|
||
IMPORT W_PrintMerge
|
||
IMPORT W_PutDoc
|
||
IMPORT W_SaveDoc
|
||
IMPORT W_ScreenChanged
|
||
IMPORT W_SelSentence
|
||
IMPORT D_SetCursor
|
||
IMPORT W_SetDocRect
|
||
IMPORT W_SetFullREct
|
||
IMPORT D_SetUndoStr
|
||
IMPORT W_ShowRuler
|
||
IMPORT W_StartLine
|
||
IMPORT W_StartOffset
|
||
IMPORT W_StartPar
|
||
IMPORT W_StartRuler
|
||
IMPORT W_Statistics
|
||
IMPORT W_SwitchData
|
||
|
||
IMPORT W_UnUseRuler
|
||
IMPORT W_UndoHandle
|
||
IMPORT W_UndoOff
|
||
IMPORT W_UndoOn
|
||
IMPORT W_UpdateText
|
||
IMPORT W_View
|
||
IMPORT W_WpCopy
|
||
IMPORT W_WpDoColors
|
||
IMPORT D_Cursor
|
||
IMPORT W_LastP
|
||
IMPORT Q_Rect
|
||
IMPORT W_Selected
|
||
|
||
import W_CopyRuler
|
||
import W_PasteRuler
|
||
import W_WpSelectAll
|
||
import W_WpSelectPar
|
||
import W_AddMergeField
|
||
import W_FindNext
|
||
import W_MakeCaret
|
||
import W_GotoBeg
|
||
import W_GotoEnd
|
||
import W_DoHead
|
||
import W_DoFoot
|
||
import W_ChangeRuler
|
||
import W_InsertPageBrk
|
||
import W_DoPageNum
|
||
import W_DoDate
|
||
import W_DoTime
|
||
import W_DoFonts
|
||
import UpperCase
|
||
import W_lowercase
|
||
import W_Capitalize
|
||
import W_GotoPg
|
||
import W_CollapseRulers
|
||
import D_LoadSegment
|
||
import D_UnloadSegment
|
||
import W_ShrinkTextBlocks
|
||
import W_LockArrays
|
||
import W_UnlockArrays
|
||
|
||
;-----------------------------------------------
|
||
;
|
||
; Forward addresses and entries
|
||
;
|
||
;-----------------------------------------------
|
||
|
||
ENTRY W_ActivateDoc
|
||
ENTRY W_AddMerge
|
||
ENTRY W_AttrTable
|
||
ENTRY W_Button1
|
||
ENTRY W_Button2
|
||
ENTRY W_CopyRul
|
||
ENTRY W_DeActivateDoc
|
||
ENTRY W_DisposeDoc
|
||
ENTRY W_DocTable
|
||
ENTRY W_Document
|
||
ENTRY W_DoneCheck
|
||
ENTRY W_ExEditList
|
||
ENTRY W_ExTitle
|
||
ENTRY W_GrewDoc
|
||
ENTRY W_LoadMod
|
||
ENTRY W_MLastBList
|
||
ENTRY W_MakeWin
|
||
ENTRY W_MenuBitList
|
||
ENTRY W_MenuList
|
||
ENTRY W_MenuProcList
|
||
ENTRY W_MyClear
|
||
ENTRY W_MyIdleProc
|
||
ENTRY W_MyKeyDown
|
||
ENTRY W_MyMouseInfo
|
||
ENTRY W_NewDoc
|
||
ENTRY W_PasteRul
|
||
ENTRY W_ReLockMem
|
||
ENTRY W_SPlane
|
||
ENTRY W_SwinParams
|
||
ENTRY W_Search
|
||
ENTRY W_SelectA
|
||
ENTRY W_SelectFile
|
||
ENTRY W_SelectP
|
||
ENTRY W_SelectS
|
||
ENTRY W_StyleTable
|
||
ENTRY W_SwinEnd
|
||
ENTRY W_TBarColor
|
||
ENTRY W_TitleColor
|
||
ENTRY W_TitlePtr
|
||
ENTRY W_UnLoadMod
|
||
ENTRY W_UnLockMem
|
||
ENTRY W_UndoStr
|
||
ENTRY W_UpdateDoc
|
||
ENTRY W_WPMessage
|
||
ENTRY W_WPRect
|
||
ENTRY W_WPWinRect
|
||
ENTRY W_WindColors
|
||
ENTRY W_WpMouseUp
|
||
ENTRY W_MyMakeRoom
|
||
|
||
|
||
W_Procs PROC EXPORT
|
||
;Using W_ATTRData
|
||
|
||
DC.L W_AttrTable ;attribute table for module
|
||
jml W_OpenDoc ;Open a file
|
||
jml W_NewDoc ;Create a New file
|
||
jml W_DisposeDoc ;dispose of a window
|
||
jml W_SaveDoc ;Save a Document
|
||
jml W_MyUndo ;undo in active window
|
||
jml W_MyCut ;cut in active window
|
||
jml W_MyCopy ;do a copy in a window active or not
|
||
jml W_MyPaste ;Do a Paste in a window active or not
|
||
jml W_MyClear ;Do a clear in the active window
|
||
jml W_ActivateDoc ;make a window active
|
||
jml W_DeActivateDoc ;
|
||
jml W_UpdateDoc ;Update a window
|
||
jml W_MyMouseDown ;mouse down in active window
|
||
jml W_MyKeyDown ;Key down in active window
|
||
jml W_MyMouseInfo ;mouse down in active window bar
|
||
jml W_GrewDoc ;Document changed size
|
||
jml W_MyIdleProc ;called in MainLoop
|
||
jml W_MyMakeRoom ;release unneeded memory
|
||
jml W_PrintChanged ;the print record for the active doc changed
|
||
jml W_PrintDoc ;print current document
|
||
jml W_WpMouseUp ;mouse up in active window
|
||
jml W_WPMessage ;message for WP module
|
||
jml W_LoadMod
|
||
jml W_UnLoadMod
|
||
jml W_UnLockMem
|
||
jml W_ReLockMem
|
||
jml W_MakeWin
|
||
DC.W 2
|
||
|
||
ENDP
|
||
|
||
W_ATTRData PROC EXPORT
|
||
EXPORT W_AttrTable
|
||
EXPORT W_Buttons
|
||
EXPORT W_Button1
|
||
EXPORT W_Button2
|
||
EXPORT W_ExTitle
|
||
EXPORT W_MenuList
|
||
EXPORT W_Search
|
||
EXPORT W_Spelling
|
||
EXPORT W_Thes
|
||
EXPORT W_EUser
|
||
EXPORT W_Document
|
||
EXPORT W_ShowItem
|
||
EXPORT W_HideItem
|
||
EXPORT W_ExEditList
|
||
EXPORT W_CopyRul
|
||
EXPORT W_PasteRul
|
||
EXPORT W_SelectA
|
||
EXPORT W_SelectP
|
||
EXPORT W_SelectS
|
||
EXPORT W_SelectFile
|
||
EXPORT W_AddMerge
|
||
EXPORT W_MenuBitList
|
||
EXPORT W_MLastBList
|
||
EXPORT W_UndoStr
|
||
EXPORT W_MenuProcList
|
||
EXPORT W_ExEditTable
|
||
EXPORT W_SearchTable
|
||
EXPORT W_DocTable
|
||
EXPORT W_FontTable
|
||
EXPORT W_SizeTable
|
||
EXPORT W_StyleTable
|
||
EXPORT W_ColorTable
|
||
|
||
|
||
W_AttrTable
|
||
DC.L W_MenuList ;list of applications menus
|
||
DC.L W_MenuProcList ;ptrs to W_Procs for each menu
|
||
DC.L W_MenuBitList ;bit descriptions of above]
|
||
DC.L W_MLastBList ;the last menu bit*2 for each menu
|
||
DC.L W_ExEditList ;extra edit items, can be 0
|
||
DC.L W_UndoStr ;default undo string, can be 0
|
||
DC.L W_ExTitle
|
||
W_Buttons
|
||
DC.W 2 ; 2 W_Buttons, put 0 for no W_Buttons
|
||
DC.L W_Button1
|
||
DC.L W_Button2
|
||
|
||
W_Button1 str 'With formatting'
|
||
W_Button2 str 'As ASCII Text'
|
||
|
||
W_ExTitle str ' (WP) '
|
||
|
||
; menus are inserted backwards
|
||
W_MenuList
|
||
DC.L ColorMenu+9 ;menu 9
|
||
DC.L StyleMenu+8 ;menu 8
|
||
DC.L SizeMenu+7 ;menu 7
|
||
DC.L FontMenu+6 ;menu 6
|
||
DC.L W_Document ;menu 5
|
||
DC.L W_Search ;menu 4
|
||
DC.L 0
|
||
|
||
W_Search
|
||
DC.B '> Search \N4'
|
||
DC.B cr
|
||
DC.B ' Find/Replace<63> \H'
|
||
DC.W $401
|
||
DC.B cr
|
||
DC.B ' Find Again \V*FfH'
|
||
DC.W $402
|
||
DC.B cr
|
||
DC.B ' Go To Insertion \*|\H'
|
||
DC.W $403
|
||
DC.B cr
|
||
DC.B ' Go To Page<67> \H'
|
||
DC.W $404
|
||
DC.B cr
|
||
DC.B ' Go To Beginning \*1!H'
|
||
DC.W $405
|
||
DC.B cr
|
||
DC.B ' Go To End \V*9(H'
|
||
DC.W $406
|
||
DC.B cr
|
||
W_Spelling
|
||
DC.B ' Check Spelling<6E>\*"''H'
|
||
DC.W $407
|
||
DC.B cr
|
||
W_Thes
|
||
DC.B ' Synonyms<6D>\H'
|
||
DC.W $408
|
||
DC.B cr
|
||
W_EUser
|
||
DC.B ' Edit Dictionary<72>\H'
|
||
DC.W $409
|
||
DC.B cr
|
||
DC.B '.'
|
||
|
||
|
||
W_Document
|
||
DC.B '> Document \N5'
|
||
DC.B cr
|
||
DC.B ' Normal View \*WwH'
|
||
DC.W $501
|
||
DC.B cr
|
||
DC.B ' View Header \H'
|
||
DC.W $502
|
||
DC.B cr
|
||
DC.B ' View Footer \VH'
|
||
DC.W $503
|
||
DC.B cr
|
||
W_ShowItem
|
||
DC.B ' Hide Ruler \*RrH'
|
||
DC.W $504
|
||
DC.B cr
|
||
DC.B ' Pages<65> \*EeH'
|
||
DC.W $505
|
||
DC.B cr
|
||
DC.B ' Insert Page Break \*-_VH'
|
||
DC.W $506
|
||
DC.B cr
|
||
DC.B ' Insert Page # \H'
|
||
DC.W $507
|
||
DC.B cr
|
||
DC.B ' Insert Date \H'
|
||
DC.W $508
|
||
DC.B cr
|
||
DC.B ' Insert Time \VH'
|
||
DC.W $509
|
||
DC.B cr
|
||
DC.B ' Statistics<63> \H'
|
||
DC.W $50a
|
||
DC.B cr
|
||
DC.B '.'
|
||
|
||
W_HideItem
|
||
DC.B ' Show Ruler \*RrH'
|
||
DC.W $504
|
||
DC.B cr
|
||
|
||
|
||
|
||
|
||
W_ExEditList
|
||
DC.L W_CopyRul
|
||
DC.L W_PasteRul
|
||
DC.L W_SelectA
|
||
DC.L W_SelectP
|
||
DC.L W_SelectS
|
||
DC.L W_SelectFile
|
||
DC.L W_AddMerge
|
||
DC.L 0
|
||
|
||
W_CopyRul
|
||
DC.B ' Copy Ruler \*[{H'
|
||
DC.W ExEditStart
|
||
DC.B cr
|
||
W_PasteRul
|
||
DC.B ' Paste Ruler \V*]}H'
|
||
DC.W ExEditStart+1
|
||
DC.B cr
|
||
W_SelectA
|
||
DC.B ' Select All \*AaH'
|
||
DC.W ExEditStart+2
|
||
DC.B cr
|
||
W_SelectP
|
||
DC.B ' Select Paragraph \*YyH'
|
||
DC.W ExEditStart+3
|
||
DC.B cr
|
||
W_SelectS
|
||
DC.B ' Select Sentence \VH'
|
||
DC.W ExEditStart+4
|
||
DC.B cr
|
||
W_SelectFile
|
||
DC.B ' Select Merge Database<73> \H'
|
||
DC.W ExEditStart+5
|
||
DC.B cr
|
||
W_AddMerge
|
||
DC.B ' Add Merge Field<6C> \H'
|
||
DC.W ExEditStart+6
|
||
DC.B cr
|
||
|
||
W_MenuBitList
|
||
DS.B 4 ;skips zero and one
|
||
DC.W FileStandard+MergeBit ;file menu
|
||
DC.W W_EditAll-UndoBit-CopyBit-ClearBit-CutBit
|
||
DC.W W_AllSearch
|
||
DC.W W_AllDocument-W_IDBit-W_IPNBit-W_ITBit
|
||
DC.W 1 ;font
|
||
DC.W 1
|
||
DC.W 1
|
||
DC.W 1 ;color
|
||
|
||
W_MLastBList
|
||
DS.B 4 ;W_Skip menu0 D_Menu1
|
||
DC.W QuitBit<<1
|
||
DC.W W_SpellBit<<1
|
||
DC.W W_GEndBit<<1
|
||
DC.W W_statBit<<1
|
||
DC.W 0 ;font
|
||
DC.W 1
|
||
DC.W 1
|
||
DC.W 0 ;color
|
||
|
||
W_UndoStr str 'Typing'
|
||
|
||
W_MenuProcList
|
||
DC.L 0,0,W_ExEditTable,W_SearchTable
|
||
DC.L W_DocTable,W_FontTable,W_SizeTable
|
||
DC.L W_StyleTable,W_ColorTable
|
||
|
||
W_ExEditTable
|
||
DC.L 0,0,0,0,0,W_CopyRuler,W_PasteRuler,W_WpSelectAll,W_WpSelectPar
|
||
DC.L W_SelSentence
|
||
DC.L W_PickMergeDB,W_AddMergeField
|
||
|
||
W_SearchTable
|
||
DC.L W_FindReplace,W_FindNext,W_MakeCaret,W_GotoPg,W_GotoBeg,W_GotoEnd
|
||
DC.L W_CheckSpelling,W_Thesaurus,W_EditUserDict
|
||
|
||
W_DocTable
|
||
DC.L W_DoNormal,W_DoHead,W_DoFoot,W_ChangeRuler
|
||
DC.L W_DoSetPg,W_InsertPageBrk,W_DoPageNum,W_DoDate,W_DoTime
|
||
DC.L W_Statistics
|
||
|
||
W_FontTable DC.L W_ChangeAll,W_DoFonts
|
||
|
||
W_SizeTable
|
||
DC.L W_GotSize,0,0
|
||
|
||
W_StyleTable DC.L W_GotStyle,Uppercase,W_lowercase,W_Capitalize
|
||
|
||
W_ColorTable DC.L W_WpDoColors
|
||
|
||
|
||
ENDP
|
||
|
||
|
||
|
||
|
||
|
||
|
||
****************************************************************
|
||
* W_MakeWin - Makes a window and sets the port stuff. Does not allocate
|
||
* or touch window names. Should use a default window name.
|
||
* Returns memory manager errors.
|
||
|
||
W_MakeWin PROC EXPORT
|
||
;Using WpGlobals
|
||
;Using D_IOData
|
||
;Using W_SampleData
|
||
;Using W_ATTRData
|
||
|
||
input Plane:l,RectPtr:l
|
||
output window:l
|
||
error err
|
||
begin +b
|
||
|
||
moverect W_WPRect,W_WPWinRect
|
||
cpzl RectPtr
|
||
beq GotRect
|
||
moverect [RectPtr],W_WPWinRect
|
||
GotRect movelong Plane,W_SPlane
|
||
|
||
pha
|
||
pha
|
||
pushlong #W_SwinParams
|
||
_NewWindow
|
||
sta err
|
||
pullLong window
|
||
jcs exit
|
||
|
||
pushword #$fffc
|
||
pushlong window
|
||
_SetOriginMask
|
||
|
||
pushlong #W_WindColors
|
||
pushlong window
|
||
_GetFrameColor
|
||
lda #$20f
|
||
sta W_TBarColor
|
||
lda #$f00
|
||
sta W_TitleColor
|
||
pushlong #W_WindColors
|
||
pushlong window
|
||
_SetFrameColor
|
||
|
||
pushlong window
|
||
_SetPort
|
||
|
||
pushword #%00000100
|
||
_SetFontFlags
|
||
|
||
exit return
|
||
|
||
ENDP
|
||
|
||
|
||
|
||
|
||
|
||
*****************************************************************
|
||
* W_NewDoc - opens a blank W_Document on the desktop
|
||
* input - ModuleNum use as reference for D_MakeNewWin
|
||
* Plane - is the plane paramter in NewWindow
|
||
* Return memory error. If successful call D_MakeNewWin so the driver
|
||
* can init the window.
|
||
W_NewDoc PROC EXPORT
|
||
;Using D_GlobalData
|
||
;Using W_SampleData
|
||
;Using W_ATTRData
|
||
;Using WPGlobals
|
||
|
||
input MWinPtr:l
|
||
local Handle:l
|
||
error err
|
||
begin +b
|
||
|
||
stz err
|
||
call D_NeedHand,in=(#$2000:l),out=(Handle:l),err=err
|
||
bcc killit
|
||
brl exit
|
||
|
||
killit tool _DisposeHandle,in=(Handle:l)
|
||
|
||
pushlong W_CurDoc
|
||
jsl W_PutDoc
|
||
|
||
tool _SetPort,in=(MWinPtr:l)
|
||
|
||
jsl D_KillFont
|
||
|
||
pushlong MWinPtr
|
||
jsl W_InitNew
|
||
|
||
movelong MWinPtr,W_CurDoc
|
||
|
||
jsl W_FillDateTime
|
||
|
||
pushlong MWinPtr
|
||
jsl D_ClearFileChanged
|
||
|
||
movelong MWinPtr,W_NewWinComin
|
||
|
||
jsl W_GetDoc
|
||
exit return
|
||
ENDP
|
||
|
||
|
||
|
||
|
||
*****************************************************************
|
||
* W_DisposeDoc - called to remove a window from the desktop
|
||
* input - the window to throw away
|
||
* should throw away all data etc., don't D_CloseWindow, driver will
|
||
* do it for you.
|
||
W_DisposeDoc PROC EXPORT
|
||
;Using WPGlobals
|
||
input Window:l
|
||
local W_ParRec:l,ParRec2:l
|
||
begin +b
|
||
|
||
pushlong window
|
||
jsl W_GetDoc
|
||
|
||
pushword #W_NormalOn
|
||
jsl W_SwitchData
|
||
jsr DisposePart
|
||
|
||
pushword #W_HeaderOn
|
||
jsl W_SwitchData
|
||
jsr DisposePart
|
||
|
||
pushword #W_FooterOn
|
||
jsl W_SwitchData
|
||
jsr DisposePart
|
||
|
||
DoneParts
|
||
; pushlong W_ScrollBar
|
||
; _DisposeControl
|
||
|
||
spacelong
|
||
pushlong window
|
||
jsl D_GetRefCon
|
||
jsl D_DisposePtr
|
||
|
||
stz W_CurDoc
|
||
stz W_CurDoc+2
|
||
|
||
return
|
||
|
||
|
||
|
||
;--------------------------------------
|
||
DisposePart
|
||
lda W_LastP
|
||
dec a
|
||
cmp #2
|
||
bcc NoDP
|
||
pushword #2
|
||
pha
|
||
jsl W_DelPars
|
||
|
||
NoDP
|
||
lda #1
|
||
jsl W_GetParRec
|
||
movelong ax,W_ParRec
|
||
|
||
pushword #1
|
||
pushlong [W_ParRec]:#W_pRulerHand
|
||
jsl W_UnUseRuler
|
||
|
||
cpzl [W_ParRec]:#W_pLineHand
|
||
beq NoToss
|
||
|
||
pushlong [W_ParRec]:#W_pLineHand
|
||
_Disposehandle
|
||
NoToss
|
||
|
||
pushlong [W_ParRec]
|
||
_disposeHandle
|
||
|
||
cmpw #1,W_LastP ;now dispose of the second par
|
||
jeq DoneD
|
||
|
||
cmpl [W_ParRec],[W_ParRec]:#W_pBytes
|
||
beq NoD2
|
||
pushlong [W_ParRec]:#W_pBytes
|
||
_DisposeHandle
|
||
NoD2
|
||
|
||
pushword #1
|
||
pushlong [W_ParRec]:#W_pRulerHand+W_pBytes
|
||
jsl W_UnUseRuler
|
||
|
||
cpzl [W_ParRec]:#W_pLineHand+W_pBytes
|
||
beq NoToss2
|
||
|
||
pushlong [W_ParRec]:#W_pLineHand+W_pBytes
|
||
_Disposehandle
|
||
NoToss2
|
||
|
||
DoneD
|
||
|
||
pushlong W_PHandle
|
||
_DisposeHandle
|
||
|
||
rts
|
||
|
||
ENDP
|
||
|
||
|
||
|
||
|
||
*****************************************************************
|
||
* Clear was chosen for the active W_Document from the menu.
|
||
W_MyClear PROC EXPORT
|
||
;Using wpglobals
|
||
begin +b
|
||
|
||
pushlong W_CurDoc
|
||
jsl W_GetDoc
|
||
|
||
pushlong W_CurDoc
|
||
_SetPort
|
||
|
||
jsl CaretOff
|
||
|
||
lda W_Selected
|
||
beq MCExit
|
||
|
||
jsl W_UndoOff
|
||
|
||
spacelong
|
||
pushword W_StartPar
|
||
pushword W_StartLine
|
||
pushword W_StartOffset
|
||
pushword W_EndPar
|
||
pushword W_EndLine
|
||
pushword W_EndOffset
|
||
jsl W_WpCopy
|
||
pulllong W_UndoHandle
|
||
bcc D_DoUndo
|
||
|
||
|
||
D_DoUndo
|
||
pushword #W_ClearUndo
|
||
jsl W_UndoOn
|
||
|
||
jsl W_DelSelect
|
||
|
||
MCExit
|
||
return
|
||
ENDP
|
||
|
||
|
||
|
||
*****************************************************************
|
||
* The Window is becoming active.
|
||
* input - Window, the window becoming active.
|
||
* The Frame assures that the menu is as you left it except for
|
||
* checks, any menu item style change etc. Items are enabled,
|
||
* disabled, inserted and deleted just as you last saw this W_Document.
|
||
W_ActivateDoc PROC EXPORT
|
||
;Using WPGlobals
|
||
;Using W_ATTRData
|
||
EXPORT W_DoneCheck
|
||
|
||
input window:l
|
||
local Item:l,View:w,Color:w,FontId:l
|
||
begin +b
|
||
|
||
cmpl window,W_CurDoc
|
||
jeq NoDis
|
||
|
||
pushlong window
|
||
_SetPort
|
||
|
||
pushlong window
|
||
jsl W_GetDoc
|
||
|
||
jsl W_Lockarrays
|
||
|
||
movelong W_PHandle,ax
|
||
jsl D_Deref
|
||
movelong ax,W_PPtr
|
||
|
||
jsl D_KillFont
|
||
|
||
movelong #W_ShowItem,Item
|
||
|
||
pushlong W_StartRuler
|
||
jsl W_InitVisRuler
|
||
|
||
lda W_ShowRuler
|
||
bne NoHide
|
||
|
||
movelong #W_HideItem,Item
|
||
NoHide
|
||
|
||
jsl W_MakeSelect
|
||
call W_FindFont,in=(W_StartPar:w,W_StartLine:w,W_StartOffset:w),out=(FontId:l,Color:w)
|
||
; rcall D_SelectFont,in=(FontID:ax,Color:y)
|
||
call D_CheckMenuFID,in=(FontId:l,Color:w)
|
||
|
||
pushword #$504
|
||
_DeleteMItem
|
||
|
||
pushlong Item
|
||
pushword #$503
|
||
pushword #5
|
||
_InsertMItem
|
||
|
||
|
||
pushword #0
|
||
pushword #W_NVItem
|
||
_CheckMItem
|
||
|
||
pushword #0
|
||
pushword #W_VHItem
|
||
_CheckMItem
|
||
|
||
pushword #0
|
||
pushword #W_VFItem
|
||
_CheckMItem
|
||
|
||
lda W_View
|
||
bne NotNorm
|
||
|
||
pushword #1
|
||
pushword #W_NVItem
|
||
_CheckMItem
|
||
bra W_DoneCheck
|
||
|
||
NotNorm cmp #1
|
||
bne isFoot
|
||
|
||
pushword #1
|
||
pushword #W_VHItem
|
||
_CheckMItem
|
||
bra W_DoneCheck
|
||
|
||
IsFoot
|
||
|
||
pushword #1
|
||
pushword #W_VFItem
|
||
_CheckMItem
|
||
|
||
W_DoneCheck ;
|
||
|
||
cmpl window,W_NewWinComin
|
||
bne NoDis
|
||
|
||
stzl W_NewWinComin
|
||
|
||
pushword #UndoBit
|
||
pushword #3
|
||
jsl D_DisableMItems
|
||
|
||
pushlong #0
|
||
pushlong window
|
||
jsl D_SetUndoStr
|
||
|
||
NoDis
|
||
return
|
||
ENDP
|
||
|
||
|
||
|
||
*****************************************************************
|
||
* This window is becoming inactive.
|
||
W_DeActivateDoc PROC EXPORT
|
||
;Using WPGlobals
|
||
|
||
input window:l
|
||
begin +b
|
||
|
||
cmpl window,W_CurDoc
|
||
bne DAExit
|
||
|
||
pushlong W_CurDoc
|
||
_SetPort
|
||
|
||
jsl CaretOff
|
||
|
||
jsl W_UndoOff
|
||
|
||
jsl W_PutDoc
|
||
|
||
stz W_CurDoc
|
||
stz W_CurDoc+2
|
||
|
||
jsl D_KillFont
|
||
|
||
jsl W_ShrinkTextBlocks
|
||
|
||
jsl W_UnlockArrays
|
||
|
||
DaExit
|
||
return
|
||
ENDP
|
||
|
||
|
||
|
||
*****************************************************************
|
||
* Please D_Update the window.I call BeginUpdate and EndUpdate for you.
|
||
* Youy must set your own origin.
|
||
* input - window, the one to D_Update
|
||
W_UpdateDoc PROC EXPORT
|
||
;Using WPGlobals
|
||
input window:l
|
||
local Q_Rect:r
|
||
begin +b
|
||
pushlong W_CurDoc
|
||
|
||
jsl D_KillFont
|
||
|
||
pushlong window
|
||
jsl W_GetDoc
|
||
|
||
jsl W_LockArrays
|
||
|
||
pushlong W_StartRuler
|
||
jsl W_InitVisRuler
|
||
|
||
pushlong !Q_Rect
|
||
_GetPortRect
|
||
|
||
pushlong !Q_Rect
|
||
_EraseRect
|
||
|
||
pushlong window
|
||
_DrawControls
|
||
|
||
jsl W_DrawPgBox
|
||
jsl W_DrawGrow
|
||
|
||
lda W_ShowRuler
|
||
beq W_NoDraw
|
||
|
||
jsl W_DrawRuler
|
||
|
||
W_NoDraw
|
||
jsl W_SetDocRect
|
||
|
||
jsl W_UpdateText
|
||
|
||
jsl W_SetFullREct
|
||
|
||
jsl W_GetDoc
|
||
|
||
cpzl W_CurDoc
|
||
beq UExit
|
||
pushlong W_StartRuler
|
||
jsl W_InitVisRuler
|
||
|
||
UExit jsl W_UnlockArrays
|
||
return
|
||
ENDP
|
||
|
||
|
||
*****************************************************************
|
||
* A W_Key down occurred in the active window
|
||
* input - TaskRec, a pointer to an Event Record for you to look at.
|
||
W_MyKeyDown PROC EXPORT
|
||
;Using W_EditData
|
||
;Using wpglobals
|
||
|
||
input TaskRec:l
|
||
begin +b
|
||
|
||
pushlong W_CurDoc
|
||
_SetPort
|
||
|
||
jsl CaretOff
|
||
|
||
pushlong TaskRec
|
||
pushlong #W_EditEvent
|
||
pushlong #W_EditEventSize
|
||
_BlockMove
|
||
|
||
jsl W_InsertKeys
|
||
|
||
return
|
||
ENDP
|
||
|
||
|
||
*****************************************************************
|
||
* A mouse down occurred in the (Your) active window info bar.
|
||
* input - TaskRec, a pointer to an Event Record for you to look at.
|
||
W_MyMouseInfo PROC EXPORT
|
||
input TaskRec:l
|
||
begin
|
||
|
||
return
|
||
ENDP
|
||
|
||
|
||
|
||
|
||
*****************************************************************
|
||
* The Window was grown. You should use this make any scroll bar
|
||
* adjustments, updates etc.
|
||
* input - window, the one that changed size.
|
||
W_GrewDoc PROC EXPORT
|
||
input window:l
|
||
begin +b
|
||
|
||
jsl W_SetFullREct
|
||
|
||
pushlong window
|
||
_SetPort
|
||
|
||
jsl W_ScreenChanged
|
||
|
||
jsl W_CheckDocPos
|
||
|
||
jsl W_MakeCaretNS
|
||
|
||
return
|
||
ENDP
|
||
|
||
|
||
|
||
*****************************************************************
|
||
* The idle routine - called every time through D_MainLoop for the active doc.
|
||
* It should W_Handle carets a blinken' and cursors a changin'.
|
||
* input - InMyWin boolean, is the D_Cursor over my active window
|
||
* - RectPtr pointer to your the Port Q_Rect of the active window
|
||
* - PtPtr pointer to the current (local) Q_Point that the D_Cursor is over
|
||
* - Time The current TickCount
|
||
W_MyIdleProc PROC EXPORT
|
||
;Using W_SampleData
|
||
;Using W_RulerData
|
||
;Using wpglobals
|
||
input InMyWin:w,RectPtr:l,PtPtr:l,Time:l
|
||
local D_Cursor:w,_rect:r,FlashTime:l,TempTime:l,Message:l,Mptr:l
|
||
begin +b
|
||
|
||
cpzl W_CurDoc
|
||
jeq Exit
|
||
|
||
IF (Developing) THEN
|
||
; lda >$c025
|
||
; and #$03 ; fan-Shift
|
||
; cmp #$03
|
||
; bne @nomesg
|
||
|
||
call D_NeedHand,in=(#12:l),out=(Message:l)
|
||
bcs @nomesg
|
||
|
||
MoveLong [Message],Mptr
|
||
MoveWord W_LastP,[Mptr]:#6
|
||
MoveLong W_PHandle,[Mptr]:#8
|
||
|
||
tool _MessageCenter,in=(#3:w,#$B0B1:w,#0:l)
|
||
tool _MessageCenter,in=(#1:w,#$B0B1:w,Message:l)
|
||
tool _DisposeHandle,in=(Message:l)
|
||
@nomesg
|
||
ENDIF
|
||
|
||
tool _GetCaretTime,out=(FlashTime:l)
|
||
addlong LastTime,FlashTime,TempTime
|
||
|
||
cmpl TempTime,Time
|
||
bge NoBlink
|
||
|
||
cpzl FlashTime
|
||
bne @1
|
||
lda W_Caret
|
||
bne NoBlink
|
||
@1 jsl W_SetDocRect
|
||
|
||
lda W_Caret
|
||
beq TurnOn
|
||
jsl CaretOff
|
||
bra DoneBlink
|
||
|
||
TurnOn jsl W_CaretOn
|
||
DoneBlink jsl W_SetFullRect
|
||
movelong Time,LastTime
|
||
|
||
NoBlink lda InMyWin
|
||
beq Exit
|
||
|
||
moveword #BeamCursor,D_Cursor
|
||
|
||
call W_CalcDocRect,in=(!_rect:l)
|
||
|
||
tool _PtInRect,in=(PtPtr:l,!_rect:l),out=(a:w)
|
||
bne GotCurs
|
||
|
||
moveword #ArrowCursor,D_Cursor
|
||
|
||
GotCurs call D_SetCursor,in=(D_Cursor:w)
|
||
|
||
Exit return
|
||
|
||
LastTime DS.L 1
|
||
|
||
ENDP
|
||
|
||
|
||
|
||
*****************************************************************
|
||
* This will be called when memory is needed. You should make purgeable
|
||
* any W_Handle not needed.
|
||
* This call WILL change as this project progresses.
|
||
W_MyMakeRoom PROC EXPORT
|
||
EXPORT W_MakingRoom
|
||
|
||
input Window:l
|
||
local CurrentDoc:l,ActiveDoc:l
|
||
begin +b
|
||
|
||
inc W_MakingRoom
|
||
|
||
MoveLong W_CurDoc,CurrentDoc
|
||
call W_GetDoc,in=(Window:l)
|
||
|
||
Cmpl Window,CurrentDoc
|
||
beq @nocollapse
|
||
jsl W_CollapseRulers
|
||
@nocollapse
|
||
jsl W_ShrinkTextBlocks
|
||
|
||
call W_GetDoc,in=(CurrentDoc:l)
|
||
dec W_MakingRoom
|
||
|
||
@exit return
|
||
|
||
W_MakingRoom DC.W 0
|
||
|
||
ENDP
|
||
|
||
|
||
|
||
|
||
*****************************************************************
|
||
* A mouse up occurred after a mouse down was in the (Your) active window.
|
||
* input - TaskRec, a pointer to an Event Record for you to look at.
|
||
* The mouse up was not necessarily in your window. But the preceding
|
||
* mouse down was.
|
||
W_WpMouseUp PROC EXPORT
|
||
input TaskRec:l
|
||
begin
|
||
|
||
return
|
||
ENDP
|
||
|
||
|
||
|
||
|
||
****************************************************************
|
||
* A W_WPMessage is being sent. The problem is that the language is
|
||
* currently undefined. Therefore, you don't currently understand it.
|
||
W_WPMessage PROC EXPORT
|
||
|
||
input type:w,message:l
|
||
output result:l
|
||
error oops
|
||
|
||
begin +b
|
||
|
||
lda type
|
||
|
||
cmp #1 ; print merge?
|
||
bne notpm
|
||
jsl W_PrintMerge
|
||
sta oops
|
||
bra exit
|
||
|
||
notpm cmp #2 ; D_Create report?
|
||
bne notrep
|
||
spacelong
|
||
pushlong message ; scrap
|
||
jsl W_CreateReport
|
||
sta oops
|
||
pulllong result ; window pointer
|
||
bra exit
|
||
|
||
notrep cmp #3 ; paste into header?
|
||
bne nothead
|
||
pushlong [message] ; window pointer
|
||
pushlong [message]:#4 ; scrap
|
||
jsl W_PasteHeader
|
||
sta oops
|
||
bra exit
|
||
|
||
nothead cmp #4 ; paste into footer?
|
||
bne exit
|
||
pushlong [message] ; window pointer
|
||
pushlong [message]:#4 ; scrap
|
||
jsl W_PasteFooter
|
||
sta oops
|
||
|
||
exit return
|
||
|
||
ENDP
|
||
|
||
|
||
|
||
|
||
|
||
; looks easy doesn't it, only 20+ calls and you have a whole program.
|
||
|
||
|
||
|
||
|
||
****************************************************************
|
||
* W_LoadMod
|
||
W_LoadMod PROC EXPORT
|
||
|
||
error err
|
||
|
||
begin +b
|
||
|
||
stz err
|
||
|
||
; call D_LoadSegment, in=(#segWP2:w,#1:w),out=(ax:l),err=err
|
||
; bcs exit
|
||
|
||
call D_LoadSegment,in=(#segWPIO:w,#1:w),out=(ax:l),err=err
|
||
|
||
exit return
|
||
ENDP
|
||
|
||
|
||
****************************************************************
|
||
* W_UnLoadMod
|
||
W_UnLoadMod PROC EXPORT
|
||
|
||
error err
|
||
|
||
begin +b
|
||
|
||
stz err
|
||
|
||
lda W_MergeDocWin
|
||
ora W_MergeDocWin+2
|
||
beq mergeDocGone
|
||
|
||
Tool _DisposeHandle,in=(W_MergeDocName:l)
|
||
stzl W_MergeDocName
|
||
stzl W_MergeDocWin
|
||
|
||
mergeDocGone
|
||
; call D_UnloadSegment, in=(#segWP2:w,#1:w)
|
||
call D_UnloadSegment,in=(#segWPIO:w,#1:w)
|
||
|
||
return
|
||
ENDP
|
||
|
||
|
||
****************************************************************
|
||
* W_UnLockMem
|
||
W_UnLockMem PROC EXPORT
|
||
|
||
input Window:l
|
||
begin +b
|
||
|
||
return
|
||
ENDP
|
||
|
||
|
||
****************************************************************
|
||
* W_ReLockMem
|
||
W_ReLockMem PROC EXPORT
|
||
|
||
input Window:l
|
||
begin +b
|
||
|
||
return
|
||
ENDP
|
||
|
||
|
||
|
||
|
||
|
||
|
||
W_SampleData PROC EXPORT
|
||
EXPORT W_SwinParams
|
||
EXPORT W_TitlePtr
|
||
EXPORT W_WPWinRect
|
||
EXPORT W_SPlane
|
||
EXPORT W_SwinEnd
|
||
EXPORT W_WPRect
|
||
EXPORT W_WindColors
|
||
EXPORT W_FrameColor
|
||
EXPORT W_TitleColor
|
||
EXPORT W_TBarColor
|
||
EXPORT W_GrowColor
|
||
EXPORT W_InfoBarColor
|
||
EXPORT W_HotRect
|
||
|
||
W_DefaultTitle STR ' Foo (WP) '
|
||
|
||
W_SwinParams DC.W W_SwinEnd-W_SwinParams ; Parameter block length
|
||
DC.W %1100001111000000 ; flags (right scroll only?)
|
||
W_TitlePtr DC.L W_DefaultTitle ; title W_Ptr
|
||
DC.L 2 ; RefCon
|
||
DC.W 28,4,197,636 ; Full Size (default)
|
||
DC.L 0 ; Color table pointer (default)
|
||
DC.W 0,0 ; Effective TM origin
|
||
DC.W 180,0 ; Data size
|
||
DC.W 0,0 ; Max content size (default)
|
||
DC.W 5,0 ; # scroll Q_Pixels (GUESS)
|
||
DC.W 50,0 ; # page Q_Pixels (GUESS)
|
||
DC.L 0 ; Info bar data (none)
|
||
DC.W 0 ; Info bar W_Height (none)
|
||
DC.L 0 ; Frame defproc (default)
|
||
DC.L 0 ; Info bar defproc (none)
|
||
DC.L 0 ; Content defproc
|
||
W_WPWinRect DC.W 28,4,197,636 ;
|
||
W_SPlane DC.L $FFFFFFFF ; Starting plane (front)
|
||
DC.L 0 ; Address (any)
|
||
W_SwinEnd
|
||
|
||
W_WPRect DC.W 28,4,197,636 ;
|
||
|
||
|
||
W_WindColors
|
||
W_FrameColor DS.B 2
|
||
W_TitleColor DS.B 2
|
||
W_TBarColor DS.B 2
|
||
W_GrowColor DS.B 2
|
||
W_InfoBarColor DS.B 2
|
||
|
||
W_HotRect DC.W 100,100,150,400
|
||
|
||
|
||
|
||
ENDP
|
||
END
|
||
|