selection pretty much working
This commit is contained in:
parent
f5017b1988
commit
a9b2983347
91
term.tal
91
term.tal
|
@ -103,10 +103,11 @@
|
||||||
@lastmouse-y $2 ( last mouse y )
|
@lastmouse-y $2 ( last mouse y )
|
||||||
@lastmouse-st $1 ( last mouse press )
|
@lastmouse-st $1 ( last mouse press )
|
||||||
@is-lit $1
|
@is-lit $1
|
||||||
@lit-first-x $2
|
@is-lit-flip $1
|
||||||
@lit-first-y $2
|
@lit-click-x $2
|
||||||
@lit-last-x $2
|
@lit-click-y $2
|
||||||
@lit-last-y $2
|
@lit-drag-x $2
|
||||||
|
@lit-drag-y $2
|
||||||
|
|
||||||
( terminal settings )
|
( terminal settings )
|
||||||
@irm $1 ( 01: insert and move right, 00: replace and overwrite )
|
@irm $1 ( 01: insert and move right, 00: replace and overwrite )
|
||||||
|
@ -254,8 +255,9 @@
|
||||||
INC2
|
INC2
|
||||||
GTH2k ?&yloop
|
GTH2k ?&yloop
|
||||||
POP2 POP2 POP2r
|
POP2 POP2 POP2r
|
||||||
.is-lit LDZ #00 EQU ?&cursor redraw-selection
|
.is-lit LDZ #00 EQU ?&cursor redraw-selection draw-cursor !&finally
|
||||||
&cursor draw-cursor #00 .dirty STZ
|
&cursor draw-cursor draw-pointer
|
||||||
|
&finally #00 .dirty STZ
|
||||||
&done BRK
|
&done BRK
|
||||||
|
|
||||||
@screen-to-cell ( row* col* -> )
|
@screen-to-cell ( row* col* -> )
|
||||||
|
@ -323,17 +325,25 @@
|
||||||
.paste LDZ #00 EQU ?&end LIT "1 ;bracket-paste JSR2 &end
|
.paste LDZ #00 EQU ?&end LIT "1 ;bracket-paste JSR2 &end
|
||||||
JMP2r [ &path ".snarf 00 ]
|
JMP2r [ &path ".snarf 00 ]
|
||||||
|
|
||||||
|
@lit-first-y
|
||||||
|
.is-lit-flip LDZ ?&flip .lit-click-y LDZ2 JMP2r &flip .lit-drag-y LDZ2 JMP2r
|
||||||
|
@lit-first-x
|
||||||
|
.is-lit-flip LDZ ?&flip .lit-click-x LDZ2 JMP2r &flip .lit-drag-x LDZ2 JMP2r
|
||||||
|
@lit-last-y
|
||||||
|
.is-lit-flip LDZ ?&flip .lit-drag-y LDZ2 JMP2r &flip .lit-click-y LDZ2 JMP2r
|
||||||
|
@lit-last-x
|
||||||
|
.is-lit-flip LDZ ?&flip .lit-drag-x LDZ2 JMP2r &flip .lit-click-x LDZ2 JMP2r
|
||||||
|
|
||||||
@redraw-selection ( -> )
|
@redraw-selection ( -> )
|
||||||
#010e DEO
|
lit-first-y .cols LDZ2 MUL2 ( y0*cols* )
|
||||||
.lit-first-y LDZ2 .cols LDZ2 MUL2 ( y0*cols* )
|
lit-first-x ADD2 #0002 MUL2 ( 2(y0*cols+x0)* )
|
||||||
.lit-first-x LDZ2 ADD2 #0002 MUL2 ( 2(y0*cols+x0)* )
|
|
||||||
;cells ADD2 STH2 ( [addr*] )
|
;cells ADD2 STH2 ( [addr*] )
|
||||||
.lit-last-y LDZ2 INC2 .lit-first-y LDZ2 ( yn* y0* [addr*] )
|
lit-last-y INC2 lit-first-y ( yn* y0* [addr*] )
|
||||||
DUP2 .lit-first-x LDZ2 STH2k ( yn* y0* x0* [addr* x0*] )
|
DUP2 lit-first-x STH2k ( yn* y0* x0* [addr* x0*] )
|
||||||
screen-to-cell ( yn* y0* [addr* x0*] )
|
screen-to-cell ( yn* y0* [addr* x0*] )
|
||||||
&yloop ( yn* y* [addr* x*] )
|
&yloop ( yn* y* [addr* x*] )
|
||||||
OVR2 OVR2 INC2 GTH2 STH .cols LDZ2 ( yn* y* cols* [addr* x* last^] )
|
OVR2 OVR2 INC2 GTH2 STH .cols LDZ2 ( yn* y* cols* [addr* x* last^] )
|
||||||
.lit-last-x LDZ2 INC2 ( yn* y* cols* xn* [addr* x* last^] )
|
lit-last-x INC2 ( yn* y* cols* xn* [addr* x* last^] )
|
||||||
STHr JMP SWP2 POP2 STH2r ( yn* y* xlim* x* [addr*] )
|
STHr JMP SWP2 POP2 STH2r ( yn* y* xlim* x* [addr*] )
|
||||||
&xloop ( yn* y* xlim* x* [addr*] )
|
&xloop ( yn* y* xlim* x* [addr*] )
|
||||||
STH2kr LDA2 highlight-cell ( yn* y* xlim* x* [addr*] )
|
STH2kr LDA2 highlight-cell ( yn* y* xlim* x* [addr*] )
|
||||||
|
@ -345,7 +355,6 @@
|
||||||
#0008 .Screen/x DEO2 ( yn* y* [addr+2*] )
|
#0008 .Screen/x DEO2 ( yn* y* [addr+2*] )
|
||||||
LIT2r 0000 INC2 GTH2k ?&yloop ( yn* y+1* [addr+2* 0*] )
|
LIT2r 0000 INC2 GTH2k ?&yloop ( yn* y+1* [addr+2* 0*] )
|
||||||
POP2 POP2 POP2r POP2r ( )
|
POP2 POP2 POP2r POP2r ( )
|
||||||
#010e DEO
|
|
||||||
JMP2r ( )
|
JMP2r ( )
|
||||||
|
|
||||||
@point-to-coord ( x* y* -> row* col* )
|
@point-to-coord ( x* y* -> row* col* )
|
||||||
|
@ -353,42 +362,42 @@
|
||||||
DUP2 #0008 SUB2 min #0008 DIV2 #004f min JMP2r ( row* col=(x-8)/8* )
|
DUP2 #0008 SUB2 min #0008 DIV2 #004f min JMP2r ( row* col=(x-8)/8* )
|
||||||
|
|
||||||
@start-selection ( -> )
|
@start-selection ( -> )
|
||||||
#01 .is-lit STZ ( )
|
#01 .is-lit STZ ( )
|
||||||
.Mouse/x DEI2 .Mouse/y DEI2 ( x* y* )
|
.Mouse/x DEI2 .Mouse/y DEI2 ( x* y* )
|
||||||
point-to-coord OVR2 OVR2 ( row* col* row* col* )
|
#00 .is-lit-flip STZ ( x* y* )
|
||||||
.lit-first-x STZ2 .lit-first-y STZ2 ( row* col* )
|
point-to-coord ( row* col* )
|
||||||
.lit-last-x STZ2 .lit-last-y STZ2 ( )
|
DUP2 .lit-click-x STZ2 .lit-drag-x STZ2 ( row* )
|
||||||
redraw-selection !draw-cursor ( )
|
DUP2 .lit-click-y STZ2 .lit-drag-y STZ2 ( )
|
||||||
|
redraw-selection !draw-cursor ( )
|
||||||
|
|
||||||
@selection-is-empty ( -> bool^ )
|
@selection-is-empty ( -> bool^ )
|
||||||
.lit-first-y LDZ2 .lit-last-y LDZ2 EQU2
|
.lit-click-y LDZ2 .lit-drag-y LDZ2 EQU2
|
||||||
.lit-first-x LDZ2 .lit-last-x LDZ2 EQU2 AND JMP2r
|
.lit-click-x LDZ2 .lit-drag-x LDZ2 EQU2 AND JMP2r
|
||||||
|
|
||||||
@handle-selection ( -> )
|
@handle-selection ( -> )
|
||||||
selection-is-empty ?&skip
|
selection-is-empty ?&skip
|
||||||
( .lit-first-y LDZ2 .lit-first-x LDZ2
|
|
||||||
.lit-last-y LDZ2 .lit-last-x LDZ2
|
|
||||||
#010e DEO POP2 POP2 POP2 POP2 )
|
|
||||||
&skip !clear-selection
|
&skip !clear-selection
|
||||||
|
|
||||||
@clear-selection ( -> )
|
@clear-selection ( -> )
|
||||||
#00 .is-lit STZ
|
#00 .is-lit STZ
|
||||||
|
#00 .is-lit-flip STZ
|
||||||
#01 .dirty STZ
|
#01 .dirty STZ
|
||||||
#0000 DUP2 .lit-first-y STZ2
|
#0000 DUP2 .lit-click-y STZ2
|
||||||
DUP2 .lit-first-x STZ2
|
DUP2 .lit-click-x STZ2
|
||||||
DUP2 .lit-last-y STZ2
|
DUP2 .lit-drag-y STZ2
|
||||||
.lit-last-x STZ2 JMP2r
|
.lit-drag-x STZ2 JMP2r
|
||||||
|
|
||||||
@update-selection ( -> )
|
@update-selection ( -> )
|
||||||
.Mouse/x DEI2 .Mouse/y DEI2 ( x* y* )
|
.Mouse/x DEI2 .Mouse/y DEI2 point-to-coord ( row* col* )
|
||||||
point-to-coord OVR2 ( row* col* row* )
|
OVR2 .lit-drag-y STZ2 DUP2 .lit-drag-x STZ2 ( row* col* )
|
||||||
.lit-first-y LDZ2 LTH2 ?&earlier ( row* col* )
|
OVR2 .lit-click-y LDZ2 LTH2 ?&earlier ( row* col* )
|
||||||
.lit-last-x STZ2 .lit-last-y STZ2 JMP2r ( )
|
DUP2 .lit-click-x LDZ2 LTH2 ?&earlier ( row* col* )
|
||||||
&earlier ( row* col* )
|
#00 !&done &earlier #01 ( row* col* )
|
||||||
.lit-first-x STZ2 .lit-first-y STZ2 JMP2r ( )
|
&done .is-lit-flip STZ POP2 POP2 JMP2r ( )
|
||||||
|
|
||||||
@end-selection ( -> )
|
@end-selection ( -> )
|
||||||
update-selection redraw-selection ( )
|
update-selection ( redraw-selection ( ) )
|
||||||
|
( draw-pointer )
|
||||||
draw-cursor !handle-selection ( )
|
draw-cursor !handle-selection ( )
|
||||||
|
|
||||||
@on-click-down ( click^ -> )
|
@on-click-down ( click^ -> )
|
||||||
|
@ -415,18 +424,24 @@
|
||||||
|
|
||||||
( TODO: need to adjust first/last x/y while dragging )
|
( TODO: need to adjust first/last x/y while dragging )
|
||||||
|
|
||||||
|
@draw-pointer ( -> )
|
||||||
|
.lastmouse-x LDZ2 .lastmouse-y LDZ2 ( x* y* )
|
||||||
|
#01e0 ;cp437 ADD2 !draw-at ( )
|
||||||
|
|
||||||
@on-move ( -> )
|
@on-move ( -> )
|
||||||
.Mouse/x DEI2 .lastmouse-x LDZ2 NEQ2 ?&redraw ( )
|
.Mouse/x DEI2 .lastmouse-x LDZ2 NEQ2 ?&redraw ( )
|
||||||
.Mouse/y DEI2 .lastmouse-y LDZ2 NEQ2 ?&redraw ( )
|
.Mouse/y DEI2 .lastmouse-y LDZ2 NEQ2 ?&redraw ( )
|
||||||
JMP2r ( )
|
JMP2r ( )
|
||||||
&redraw ( )
|
&redraw ( )
|
||||||
.is-lit LDZ #00 EQU ?&next redraw-selection &next
|
|
||||||
update-selection ( )
|
|
||||||
.lastmouse-x LDZ2 .lastmouse-y LDZ2 ( lx* ly* )
|
.lastmouse-x LDZ2 .lastmouse-y LDZ2 ( lx* ly* )
|
||||||
#0200 ;cp437 ADD2 draw-at ( )
|
#0200 ;cp437 ADD2 draw-at ( )
|
||||||
|
.is-lit LDZ #00 EQU ?&next
|
||||||
|
update-selection ( redraw-selection )
|
||||||
|
#01 .dirty STZ
|
||||||
|
&next
|
||||||
.Mouse/x DEI2 .Mouse/y DEI2 ( x* y* )
|
.Mouse/x DEI2 .Mouse/y DEI2 ( x* y* )
|
||||||
OVR2 OVR2 #01e0 ;cp437 ADD2 draw-at ( x* y* )
|
|
||||||
.lastmouse-y STZ2 .lastmouse-x STZ2 ( )
|
.lastmouse-y STZ2 .lastmouse-x STZ2 ( )
|
||||||
|
draw-pointer
|
||||||
screen-to-cursor ( )
|
screen-to-cursor ( )
|
||||||
JMP2r ( )
|
JMP2r ( )
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue