* the definitions in this file have been optimized for fast loading not
* comfortable reading, please see Docs/PTE for more information

set path 'PTEDefs:^3' 'PTEDir:Demos/^3' 'PTEDir:Docs/^3' 'PTEDefs:Examples^3' 'DF0:^3'
set delay 50
set rate 14
set environment 1 '- '
set environment 2 'PTEDir:Icons/Def'
set state ''

flag clear
flag 254 '  Col ' ''
flag 253 ' Icon ' ''
* get rid of multi-keystroke commands
sequence clear

* load the pop-down menu definitions
macro PTEDefs:Menus.Def
menu 2 2 5 off
menu 3 4 2 off
menu 3 4 3 off
menu 3 5 2 off
menu 3 5 3 off
menu 4 3 0 off
menu 4 4 0 off
menu 5 0 0 off
* disable loading of pte.def
menu 6 7 3 off

*** cursor keys ****
def up=[up]
def down=[down]
def left=[left]
def right=[right]
def s-up=[page up]
def s-down=[page down]
def s-left=[backtab word]
def s-right=[tab word]
def a-up=[top]
def a-down=[bottom]
def a-left=[begin line]
def a-right=[end line]
def c-up=[scroll up]
def c-down=[scroll down]
def c-left=[scroll left]
def c-right=[scroll right]

**** numeric key pad ****
def num-0=[if flag 254][if squeeze mode][replace mode][else][squeeze mode][end if][else][insert toggle][end if]
def num-1=[end line]
def num-2=[down]
def num-3=[page down]
def num-4=[left]
def num-5=[store cursor]
def num-6=[right]
def num-7=[begin line]
def num-8=[up]
def num-9=[page up]
def decimal=[execute key delete]
def s-num-0='0'
def s-num-1='1'
def s-num-2='2'
def s-num-3='3'
def s-num-4='4'
def s-num-5='5'
def s-num-6='6'
def s-num-7='7'
def s-num-8='8'
def s-num-9='9'
def s-minus='-'
def s-decimal='.'
def a-num-0=[toggle flag 254][if flag 254][if insert mode][squeeze mode][end if][else][if squeeze mode][insert mode][end if][end if]
def a-num-1=[last nonblank]
def a-num-2=[next blank line][do][if blank line][down][else][exit loop][end if][loop][center line 10]
def a-num-3=[bottom]
def a-num-4=[backtab word]
def a-num-5=[recall cursor]
def a-num-6=[tab word]
def a-num-7=[first nonblank]
def a-num-8=[prev blank line][do][if blank line][up][else][exit loop][end if][loop][if][prev blank line][down][else][top][end if][center line 10]
def a-num-9=[top]
def a-minus=[forget cursor][recall cursor]
def a-decimal=[store cursor][if no mark][mark char][else][end mark][unanchor][recall cursor][end if][end line][re-mark][recall cursor][forget cursor]

**** function keys ****
def f1=[confirm]
def f2=[command cursor][if flag 253][if file exists][environment 241]'^3.info'[else][execute key s-f3][end if][end if][error]'Saving file ...'[execute]'save'[error]
def f3=[execute key f2][execute key f4]
def f4=[command cursor][if modified][error 2]'File Modified! Hit F1 to abandon changes.'[else][error]'Quitting file ...'[end if][execute]'quit'[error]
def f5=[clear last change][begin line][erase end line][error]
def f6=[clear last change][erase end line]
def f7=[delete line]
def f8=[next file]
def f9=[if command cursor][previous command][else][undo][end if]
def f10=[insert line][if blank line][else][first nonblank][end if][down]
def s-f1=[confirm][execute]
def s-f3=[error]'Saving icon ...'[command cursor][delete line]'icon '[environment 2][execute][error]
def s-f4=[store mark][store cursor][if][locate]'Directory "''c-'[right 11][unmark][mark char][end char]'-"'[left][if char in]'-:/'[right][insert mode]'/'[left][end if][mark char][command cursor][delete line]'set envir 9 \''
def s-f4+[import mark][end line]'\''[execute][data cursor][else][error][execute]'set envir 9 \' \''[end if][recall cursor][begin line][unmark][mark char][end word][left][mark char][tab word][if string is]'Dir'[execute]'set env 8 \'dir \''
def s-f4+[else][execute]'set env 8 \'edit \''[end if][command cursor][delete line][envir 8][envir 9][import mark][unmark][data cursor][recall mark][forget mark][recall cursor][forget cursor][down][execute]
def s-f5=[command cursor][delete line][command toggle][if block mark][command toggle]'number '[import mark][unmark][execute][data cursor][begin mark][else][error 2]'Block mark needed for numbering.'[end if]
def s-f6=[clear last change][erase begin line]
def s-f8=[previous file]
def s-f9=[if command cursor][next command][else][last change][end if]
def s-f10=[command cursor][delete line][error]'Hit key to be redefined.'[key name][begin line][store cursor][insert mode]'? key '[recall cursor][forget cursor][execute]
def a-f1=[store cursor][error 1]'Hit key or command to be repeated'[clear flag 250][if next key in]'-'[set flag 250][end if][error]'Hit any key to stop.'[command cursor][delete line][key name][begin line][insert mode]'exec [do][update]'
def a-f1+[if flag 250]'\'\\'[end line]'\''[else]'[exec key '[end line]']'[end if]'[loop]'[recall cursor][recall cursor mode][forget cursor][execute]
def a-f3=[command cursor][delete line][command toggle][unmark][mark line][command toggle][import mark][execute][data cursor][unmark][down]
def a-f4=[import mark]
def a-f5=[command cursor][delete line]'fill'[separator][import mark][unmark][execute][data cursor]
def a-f7=[shift left]
def a-f8=[shift right]
def a-f9=[clear last change]
def a-f10=[exec key a-f5][begin mark][unanchor][store cursor][end mark][recall cursor line][replace mode]'='[down][left][re-mark][fill mark]'+'[unmark][recall cursor][forget cursor]

**** mouse buttons ****
def left-button=[if just pressed][if right pressed][if double clicked][execute key a-u][end if][else][pointer cursor][if double clicked][if same]'.directory'[environment 113][execute key s-f4][else][execute key a-w][end if][end if][end if][else]
def left-button+[unanchor][if mark][change mark to char][end if][re-mark char][pointer cursor][re-mark char][end if]
def right-button=[if just pressed][if left pressed][if double clicked][execute key a-u][end if][else][pointer cursor][if double clicked][execute key a-decimal][end if][end if][else][unanchor][if left pressed][if mark][change mark to line][end if]
def right-button+[re-mark line][pointer cursor][re-mark line][else][if mark][change mark to block][end if][re-mark block][pointer cursor][re-mark block][end if][end if]

**** misc. keys ****
def escape=[command toggle]
def tab=[if command cursor][separator][else][tab][end if]
def backspace=[backspace]
def s-backspace=[store cursor][if flag 254][squeeze mode][end if][rubout][recall cursor mode][forget cursor]
def return=[if bottom][insert line][end if][if blank line][else][first nonblank][end if][down]
def del=[store cursor][if flag 254][squeeze mode][end if][delete char][recall cursor mode][forget cursor]
def s-tab=[backtab]
def s-del=[if][end word][store mark][unmark][mark char][backtab word][mark char][delete mark][recall mark][forget mark][end if]
def a-del=[delete line]
def a-tab=[tab]
def c-return=[execute]
def close-window=[do][if same]'.directory'[environment 113][execute]'quit con'[else][update][if modified][execute key f3][else][execute key f4][end if][end if][loop]
def help=[execute]'edit PTEDir:Docs/PTEHelp'

**** alpha keys ****
def a-a=[store mark][unmark][mark line][copy mark][recall mark][forget mark][down][first nonblank]
def a-b=[mark block]
def a-c=[mark char]
def a-d=[begin mark][delete mark]
def a-e=[end mark]
def a-f=[fill mark]
def a-g=[recall mark][forget mark]
def a-h=[unanchor]
def a-i=[execute key a-w][lowercase][recall mark][forget mark]
def a-j=[join]
def a-k=[execute key a-w][uppercase][recall mark][forget mark]
def a-l=[mark line]
def a-m=[move mark]
def a-n=[center line 10]
def a-o=[overlay block]
def a-r=[re-mark]
def a-s=[split][down][begin line]
def a-t=[transfer block]
def a-u=[if mark][store mark][unmark][end if]
def a-v=[execute key a-w][store cursor][lowercase][begin mark][unmark][mark char][uppercase][recall mark][forget mark][recall cursor][forget cursor]
def a-w=[right][backtab characters][environment 1][store mark][unmark][mark char][end characters][environment 1][left][mark char][right][if not][tab characters][environment 1][end line][end if]
def a-x=[locate]'('[store mark][unmark][left][mark char][right][locate nested]'('')'[left][mark char][begin mark][right]
def a-y=[begin mark]
def a-z=[store mark][copy mark]
def a-1=[lowercase]
def a-2=[uppercase]
def a-3=[escape]
def sa-i=[store mark][unmark][mark line][lowercase][recall mark][forget mark]
def sa-k=[store mark][unmark][mark line][uppercase][recall mark][forget mark]
def sa-x=[locate]')''-'[store mark][unmark][mark char][locate nested]')''(''-'[mark char][end mark]
def sa-d=[if character mark][begin mark][delete mark][recall mark][copy mark][forget mark][else][error 2]'Character mark required.'[end if][store mark][unmark]
def sa-z=[store mark][begin mark][recall mark 2][copy mark][recall mark 2][begin mark][delete mark][recall mark][move mark][forget mark][forget mark][unmark]

* demo definitions *
def zz-10 = [execute key zz-13] [insert line] [down] [left margin] [update] [wait 2]
def zz-10 + [execute key zz-13] [insert line] [down] [update] [wait 2]
def zz-10 + [execute key zz-13] [insert line] [down] [update] [wait 2]
def zz-10 + [execute key zz-13] [insert line] [down] [update] [wait 2]
def zz-10 + [execute key zz-13] [insert line] [down] [update] [wait 2]

def zz-11 = [execute key zz-13] [insert line] [down] [left margin] [update] [wait 2]
def zz-11 + [execute key zz-13] [insert line] [down] [update] [wait 2]

def zz-12 = [execute key zz-13] [insert line] [down] [left margin] [update] [wait 2]
def zz-13 = [if next key] [terminate] [end if]

def a-decimal=[store cursor][clear last change][if no mark][mark char][else][end mark][unanchor][recall cursor][end if][if][next blank line][up][else][bottom][end if][last nonblank][insert mode]'.'[left][re-mark][recall cursor][forget cursor]
def a-decimal+[execute]'\0,\0i\0;\0i\0.\0i\0!\0i\0:\0i\0?\0i'[left][store cursor][end mark][undo][recall cursor][forget cursor][re-mark][command cursor][delete line][data cursor][right]
