mirror of
https://github.com/antoinevignau/source.git
synced 2025-01-21 08:33:23 +00:00
1 line
14 KiB
Plaintext
1 line
14 KiB
Plaintext
|
LOAD 'Macros.dump'
INCLUDE 'SS.equ'
INCLUDE 'Driver.equ'
INCLUDE 'Heap.aii.i'
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
; IMPORT KeyPad
; IMPORT appleKey
IMPORT S_ActiveWindow
IMPORT S_CellWidth
IMPORT S_Clear
IMPORT S_CurBRSelect
IMPORT S_CurBScrl
IMPORT S_CurContHt
IMPORT S_CurContRect
IMPORT S_CurContWd
IMPORT S_CurContXpt
IMPORT S_CurContYpt
IMPORT S_CurEditFlag
IMPORT S_CurLEHandle
IMPORT S_CurMaxTLCell
IMPORT S_CurRScrl
IMPORT S_CurTLCell
IMPORT S_CurTLSelect
IMPORT S_DoChecks
IMPORT S_DrawLocation
IMPORT S_EndEdit
IMPORT S_GetCellIndex
IMPORT S_HiliteCells
IMPORT S_NewEditCell
IMPORT S_NewLineEdit
IMPORT S_SetCurFormat
IMPORT S_SetEdittingMenus
IMPORT S_SwapIn
IMPORT S_Thumb
IMPORT S_WhereCell
IMPORT S_WhichCell
;-----------------------------------------------
;
; Forward addresses and entries
;
;-----------------------------------------------
ENTRY S_DoPageDown
ENTRY S_DoPageLeft
ENTRY S_DoPageRight
ENTRY S_DoPageUp
ENTRY S_PageOver
;-------------------------------------------------------------------------;
; S_KeyDown ( TaskRecordPtr:l )
;
; S_KeyDown is called by the driver to handle a key down event in the
; currently active window.
S_KeyDown PROC EXPORT
;Using S_CurrentData
input TaskRecordPtr:l
local Key:w,Mods:w,NotArrow:w
BEGIN +b
stz NotArrow
Call S_SwapIn,in=(S_ActiveWindow:l)
Tool _SetPort,in=(S_ActiveWindow:l)
lda S_CurEditFlag
and #S_KeysInactive
jne Exit
ldy #2
lda [TaskRecordPtr],y
and #$00FF
sta Key
ldy #14
lda [TaskRecordPtr],y
sta Mods
CmpLong S_CurTLSelect,S_CurBRSelect
jne rangeSelected
ldx #MaxCellTable
lda Key
loop
cmp CellKeyTable,x
beq foundkey
dex
dex
bne loop
notfound
lda Mods
and #appleKey
jne Exit
lda S_CurEditFlag
and #S_EditingBit
bne doEdit
lda S_CurEditFlag
ora #S_EditingBit
sta S_CurEditFlag
Tool _LEActivate,in=(S_CurLEHandle:l)
Tool _LEGetTextLen,in=(S_CurLEHandle:l),out=(x:w)
Tool _LESetSelect,in=(#0:w,x:w,S_CurLEHandle:l)
Call S_SetCurFormat,in=(S_CurTLSelect:l)
Call S_SetEdittingMenus
doEdit
Tool _LEKey,in=(Key:w,Mods:w,S_CurLEHandle:l)
bra Exit
foundkey
lda Mods
and #appleKey
bne appledown
lda S_CurEditFlag
and #S_EditingBit
bne editing
jsr (CellTable,x)
bra Exit
editing
jsr (CellEdit,x)
bra Exit
appledown
jsr (CellApple,x)
bra Exit
rangeSelected
ldx #MaxRangeTable
lda Key
Rloop
cmp RangeKeyTable,x
beq foundRkey
dex
dex
bne Rloop
RKeyNotFound
bra Exit
foundRkey
lda Mods
and #appleKey
bne Rappledown
jsr (RangeTable,x)
bra Exit
Rappledown
jsr (RangeApple,x)
Exit
RETURN
;-----------------------------
maxCellTable equ 16
maxRangeTable equ 10
CellKeyTable DC.W 0
DC.W 8 ; left arrow
DC.W 21 ; right arrow
DC.W 10 ; down arrow
DC.W 11 ; up arrow
DC.W 13 ; return
DC.W 9 ; tab
DC.W 27 ; esc
DC.W 127 ; delete
CellTable DC.W 0
DC.W cellLeft ; left arrow
DC.W cellRight ; right arrow
DC.W cellDown ; down arrow
DC.W cellUp ; up arrow
DC.W cellReturn ; return
DC.W cellTab ; tab
DC.W cellEsc ; esc
DC.W rangeDelete ; delete
CellEdit DC.W 0
DC.W enterLE ; left arrow
DC.W enterLE ; right arrow
DC.W cellDown ; down arrow
DC.W cellUp ; up arrow
DC.W cellReturn ; return
DC.W cellTab ; tab
DC.W cellEsc ; esc
DC.W enterLE ; delete
CellApple DC.W 0
DC.W doPageLeft ; apple-left arrow
DC.W doPageRight ; apple-right arrow
DC.W doPageDown ; apple-down arrow
DC.W doPageUp ; apple-up arrow
DC.W cellAppleReturn ; apple-return
DC.W cellAppleTab ; apple-tab
DC.W cellEsc ; esc
DC.W nothing ; delete
RangeKeyTable
DC.W 0
DC.W 8 ; left arrow
DC.W 21 ; right arrow
DC.W
|