Define draw_all()=Prgm
PxlHorz main\±oy
PxlVert main\±ox
PxlHorz main\±ty
PxlVert main\±tx
PxlCrcl main\±oy,main\±ox,2
EndPrgm
© help()
© Display help dialog box
Define help()=Prgm
Dialog
Title "Ruler Help"
Text "[O] Set origin"
Text "[M] Measure"
Text "[STO▶] Copy measurement to Home"
Text "[H] Help"
Text "To quit:"
Text "[HOME], [ESC] or [QUIT]"
EndDlog
EndPrgm
© move_x(mode,distance)
© Move cursor (target or origin) in x-direction
Define move_x(m,i)=Prgm
If m=1 then © Move target cursor
PxlVert main\±tx,0 © ... erase old cursor line
mod(main\±tx+i,main\±x)→main\±tx © ... find new coordinate with wrap-around
Else © Move origin cursor
PxlVert main\±ox,0 © ... erase old cursor line
PxlCrcl main\±oy,main\±ox,2,0 © ... erase old origin circle
mod(main\±ox+i,main\±x)→main\±ox © ... find new coordinate with wrap-around
Endif
EndPrgm
© move_y(mode, distance)
© Move cursor (target or origin) in y-direction
Define move_y(m,i)=Prgm
If m=1 then © Move target cursor
PxlHorz main\±ty,0 © ... erase old cursor line
mod(main\±ty+i,main\±y)→main\±ty © ... find new coordinate with wrap-around
Else © Move origin cursor
PxlHorz main\±oy,0 © ... erase old cursor line
PxlCrcl main\±oy,main\±ox,2,0 © ... erase old origin circle
mod(main\±oy+i,main\±y)→main\±oy © ... find new coordinate with wrap-around
Endif
EndPrgm
© dist()
© Find distance and angle for current cursor locations
Define dist()=Func
local dd,dr,xd,yd
© dd angle in degrees
© dr angle in radians
© xd x-axis distance between cursors
© yd y-axis distance between cursors
(main\±tx-main\±ox)*±scl→xd © Find x-axis distance
(main\±oy-main\±ty)*±scl→yd © Find y-axis distance
If xd=0 and yd=0 Then © Find angle
undef→dr:dr→dd © ... angle is undef if x=0 and y=0
else
R▶Pθ(xd,yd)→dr © ... else calculate angle in radians
dr*180/Œ→dd © ... and degrees
1 - 25