7TQAF4BYIK75EEYCCK7VEUSZHNCWMWIA3HZGQKIILYESUZ5ZZRVQC
CSZU5JBBHYIVF6TDKKFN6CWPH7LLSVKMR6Q7DIGRURYDNUUOY4YAC
ST3PJGM6WQJ4MPRI7BRIVQLVX4Y5V6IPBLDW4LPH6OUXU6QDTI7QC
4KJN6AHYUWMMMAZXA7FLQOQQP53BWQFDDAEFCPN6ETQ62KK6VTYQC
BUFUT2NOLF3GOOFLUEMNFVPOVQNYFYLWWRQWJZ3SKULTSCBXGB5QC
NV26PZ2UU2L2SIOJEUPX5H6GU6IUCF4DOAVMHZ2YRZVW3YHHA3XAC
EAOVG5VN7KN6G6WF3BZORNZDO7FLWLTNQXBRPVADK4W52OPI7LKAC
P3PCGTC4ZITFU44PE5G6ITA5KRJPDENP66Y7YLQY3RQIFPUNOWYAC
OF6EVRGFLYBDDTQZYTBAST3PCARPJ5RFMYFXAZ6KM3FS2IXRFSSAC
ZD7ENMQLJJ3DKIXID7FACNRBBHJATOPJAVXFIOWJ2HUDY67DD22QC
IBXNUZM7R2OUGL5TDRF7OUFYY53GTZMEFQ5VJRFQF47P3VWDVDJAC
2RPK7DRUT4TC46JV22XF3JG2VX3MF3LKITVBORHE5L733LX42TIAC
K6ZDYZKXSLTLCCHWYK6K6WOCNXBZOXEDKDVNNJVCZUFOLLSUO5UAC
R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC
DMCRN3CEDMPBFFQA37BSGYQCUVLFDETXSS3NFJ3U4K6XSFPPDC2AC
IIGGIT4GLZLUM34VTEKORAKZXBGRU4OBOKKXXAVDXQLDK5PCL4LAC
VHQ3Q2ELIMSM4G3CKJFBYEX7HIDWLIMWASW2VC2AROBDKAM6VTHQC
PPVABNGQTQMPYILHDNSNXBI5IOCBSIYO45NIHUR4LYPABQZE6PAQC
YEAUKHVNGAAUVZ2CL2NN34L52ZOMDJRXQ43K6KIP5SN57H7DPV3AC
PZ5EM7IADKAEHIG2L47W7TMKKHHJESOM7JBOIXG6ADFXHMWFD4LQC
JIBCAKTUIYZ2NAAOXJ7YBM72XG7FZA2AQL64MZBJVM62ELU2BO4AC
JYPY2I2R7E4FYGJKIHVBXZ6ASKDRHNVTEXOPCTUXEBT7PLW7IYYQC
V4N3AUWQBOS6A3WMFYRLSM7YFSKWLEVKDHH2RTJFY4RPLAAHU6CQC
3UBHBO3RAARJB3KC4IWVZ5KZMOXD2WL52LZLRZVTOZWQYPUE4VUAC
BCQXLC3R2LVIQD46DOO4GWMW2TRXII55V3CCENFMXR47KICY4IJQC
XUYQTR6PPSMIKIVBYPDOBAH2TJ5JODWIKDQALZOAUKG34QHD6G7AC
YQHOPPHYPT2O4GDLUILYIWHG7UJBWFOQ7G6YPS2SQMCO3IQXFPPAC
RN7CFVHBLHLRZVYRCFJ3Z3YAU5GKTIWKVIPIPGGXQFKUY4JZ3I2AC
KNIWRJUPMICZHFGJSACTP4JER56PCKEBVNGDTVKCK7B4YT6IDC3AC
N6R6YJMUEX2DSXVXTHLC65URGKUMYTBPVEGLJDPZCNAW4EFDPP5AC
W2GO5IRO6GKXJPNWUAB3UNWRXE2XIWODJDKOG3LXZ53J5DMDXYHQC
AKQBXWCVTZ5LEG76QW54B7MHXYFA7GD2Y2GSEN7RUXO5CHMYCZKAC
2DMUYDN4QCFRWAQFS37HX5UKZOPCTJEIXR35JEOMHCTEG4VSMMYQC
Z6RIHI6QMDAVY4MDPS6Q6VLJMWT6XMSRPFFJB66LD3IICQQXZUMAC
D2IUVB3LC5R4XQB466K5DJGDPLMPWLZFS63C2PD27DSELWCA2RXQC
7R2OQYJUMC5YZEXR6V7TD3ATXKQEOSIBIXHWCIG3OLJ37ZUUEOUQC
E5DWT4J3EOYPCJUFMHPYX4CLAI5LBF5B2H73M4MIFS2EN5HGISNQC
RAEGXYHVWPWYHRMNVGFNDDK4LG4QCWPWLEV5OUIOKI7JEBSAYO7AC
6J7LEUDIW3UZ5I56OYVQZ6W7RZA64WXP5EIT5KYDKR5PCBINZ76AC
IPA7EFXT6X46DJ3HJVJWIPBVZVGNS2KGYJGVAFIUCSH2ZKKYS26AC
MAUOADNV62ZEWXWUTNJPVNWE6IFEDN23F6S5YVWW743EQJQ6NNVAC
O6JOCPML4QCKJ33RF2SXDHMNH4KF2FA54SQBS7QOJFIWJJPTKBNAC
TTMMK6S6ILBQ6YN6H2DR5I5PH4ZUITWAGG72AJWLKLKGO5AATT2AC
ZAAYA23GE7JWXF22KUFZMKMTL5ZVGNKMCTUYUDXU4UTXBKRTFAOAC
PBREXBI62EXGQAYPXRATHZE57UZ4PCEVEBCZVTQV6KY5EFGCURTQC
NJHPKGC4MV6DDRYI4NJEE5LQBSWJBB54QV7EPSOS2ECVI7CBPOJQC
ZQMQVMFWZIGWBRCB455IKHPTAOUYPLYCSC44NBPPET557RGVRX3AC
CCPQONNNZGI6OOZTUR4FE4OAWEF7DH6UUCCS647WU2SYYFBWQ65QC
XCEP7G5GRX6WQGCROJDNZRTLSITGAETL7EFCFTR74S36VXK32HBQC
36OINW5D3J2CFMKWXBLHEPVUGVSPY77YEBEAJAXS52AEBYKMIOTQC
HOD2RB3XN756P6ZEQXGQCTLAMJ3C5UAXGPGMF52WUAUUNYBRDFEQC
U6QP5SNXVIQNNI7RPUFUKFKIEXKS6TGONITJK7QVJ4MYMOUI6VEQC
MQMKQ2JO6E3KDJN3H6WACIETJI4C2APUS5N4YQZDM75ZIZDSC4XAC
6FM47PAEXXD74ABGEP7AJT7PA3U3SERUAEE6PHJJMBXLKPHLKJSQC
TQS2PIWKR64MHXPQOC5PYOB3TZAUWAZUSJH55NQOW722LZ76M3LQC
EKAI7FKQV6ALBAFMJFEDIVNCWRKBE7PWLWRXM3NGYARPSQO5T22QC
GYAC2MUOXZZKO5CKVXRS7YZLULNRNJMEHFT3WPWKV6O3HREELIOQC
OEWRTQIK5VNX6GEQF4JYHELTZSTLJKQARLIC557M53RJVJD2YDRQC
5VNEE6PVZWCUX5FKXEN2J4VGYEDSGDZGFUWVPBOEXDBQLMZMMHZAC
BEQ7QB74QBYDIGVCQTI5BXZX4XPDEJSMLEGVMNMIXUDL672XP5BAC
2JZZ7BDCWN37RJCEOJZQGCVNPWBS2IPQI5VEALMFLCMN4HLGC5DQC
36EJO2HGILPVXIKIGN665EMEQ4JJO4S32QZXHI76R45TVUKKVZGAC
VHT5NALKBXY6CZ2AJPLIJ33OSP5X2TF6GTDMIYXVKNIXPZXPAMAAC
4GYICRO5RGEO3W63GQ46SUFELX7G2XU3CH2MCIRV4WTWBU6HCZBQC
4IGCV3VLATQW2E2XDVBJ4BZWBMVZ2PNQI2EJFRZSVF4RMAT5TBYQC
RWAJBVUNC6V5EBL6GXSDHKPPRQGWI65MREMBYSOGJL7Z2LULJRDQC
O4XAVDJWAM73TFGXRFXMB7Z4G2D4EQ6F2W6PY4SITYKGYF6ER7PQC
FSDP53RPYP3MOPGRMOHQYISG24ZILVPKJC4X72S26TTQYSLDDSWQC
WUAOFC5IXNHFPCVIY2SSQ7U5V3GUVNT5R43EDYOXYXLGZQQY2AEAC
EDO5VRWMNMKQZ6U5EQJS7DSKMZXKX55LXDLIG6N5RTN4ZFXMD2TQC
Y6O2RFHV5UGHFS3ZZEH5HPKN5I7SV74GEV47MTI4WGJPAINJMBZAC
HVXSKRTLBMYDCDJHD764N5FCEDBMS3IPDN2NZ5LWR6AEXDBHBCDAC
KBDGS7PDKMQZTA6U2VLSHKZATFIXYAZJ4O77OTOTAFBPBJLDCPQAC
SOOY5XYLNNJQSPMYWLFG7D2VIOX4U2U7VPAP7QBBVLHYCIVSMO5AC
MSB47AAAQZMIWQSHDEVY2QYYG26LMFY5TFYOP54YRKCKAP7U6M3AC
BCMRXDVBMOVHT3S4JJXVFYUVYCVKSR7374O3SV3K74QMCXSVUEBQC
C472R5Z2F5ORCBB46YKBEKROI7EBVFDNYBLPMEJDE74M2ZMALIRQC
MV6W5JMDU7HP2MBMYGPAIXSF6TSZPSCFIA4MW5VXHDFRIQR4WPPAC
WVKFFN6FAJVKUL6NGAOWSS33WFD63GPOPSLDQ7JT4WM27KV7H65QC
L3RKMFQ6F357CCIE6W2Z7JSSYSB4P5TIYJ6IXJKSSXYTS6274NZQC
PRDLXNAROQL5DCMYD2SIW76INUVGEK3SLNEZEFUXEBNHSAQXNZ2QC
XLWCGJAPQSTYE7U74H3RCIFCBHILC4TPQRHBJCAFSJTXL2J3B7LQC
RCA6YTTP4UPHWHPD556KAIXOROWQK6G6ZTNQNC3FPY3XGPZBK7GQC
UHQQZ6T4AAORLMRQIPHW6DHKTMLS6P45E44RCU5K654IO7PRFMTQC
ND6BDFN7SOG6MEQAYX34HFNKQ6JCAWG3GU5VFMICVQLJM4VCRRMQC
AU3CDALJIIHGTDB2ZAHTKJ4UWUPQ5M7RXO6J5ORIGKWHEXVRHLHAC
333YTGP5MR37OQCXSWT66YMB3K62IUF7S6QU4NZ2CE3SNZFYTIYQC
IVNYKN3O3QN2CRR25WPA3FT6TNPIH6WDPHIP7SB5Y7HXHYIY7UXAC
MEP5NZPONYLPILVA7MEX2ZFQDOLEKAJQEVFH5UZ6XZERGS22Z5ZQC
AZ6CTT4SN7QA2CXWNJ6UQ7BNENF6G76NJY53PBNJSAPWYFIFWQ5QC
CINOGX34U6PA3UZ6PXVIHH27KNNNHS26XOYNHPLO236HFQBG6I7QC
4EU33OQNAAPCL7VD4W2IGH4ALEXZUUOSN5JYHV6BYSQR7XYRK7FQC
VY24DRY6CZGUUURGPIYSL63HYTE22D573G5UX4MN55JORJ5GNW6AC
NBCAEIEPA5HPJJBGWVANSLO2DO43ZACMPGY7L6FHABZPWB3747AAC
BPKE3AXOWROQM5MDU7HVQ3VLNTJDD4LCH5OBCRE7SZAJDFDSNQ4QC
6LYD2XCQC5OXNX22M4DQWIFAMW2DWRZFAN2JV4MGDTYMMZXWPZRQC
EDRTD2YKYXX7R4NCJC757JIOVGDVJBQHFC3HYDD2ONDWMPFJOJ6AC
KR33DR75FPD3WGIADGWUP6B6JAKZH5Q6OKIHKP4YD4KIVD3TI65QC
GT3XZRTCVBWCSWUXAJ7N4OK2U2G5Y7EGSC5YE76KXZG7C4L53VTQC
LRDM35CEK3OHXOTB7TEFJRL7P6PQWO5ZG3F2BVA7DIDFHBPJQ7KAC
VWENQ7CIHY7WUYOTFFVYTZ3QMWIR44VEZEPBYLX5FLPBFICRUSTAC
F4LHH2ZI56NF2YUFLTQKSUN55XRL32L2RJTLFNO56EMWMO6YAHZQC
EZHO4TSWIYYUE73S6XQWIEF3HA3H7MKCNJOT27NTWTVSPVS2SL5QC
SLWFPKOOFZBENBKNSSPRWZ674ZTKSL6XO6BVJXFJYDOAQFJYY65QC
CZ75J5XVD2PTAPK67BUL4QY2RDBGRLITYX3SOLXUJ2UFD5CCVRCQC
FS2ITYYHBLFT66YUC3ENPFYI2HOYHOVEPQIN7NQR6KF5MEK4NKZAC
NVOQWGKABCBXTLJZ5DJIDBLXZ4FCKEQRFTEXXEAIISCY3VAPHERAC
MISEW25VIMXQ6ID37VQ365KAMPQ5O4COYWEIK6M4JXKIG7L5DVSQC
2DVVKKVA6PJ7VKYLGPQ22AXUB6ZWFMPWB445PRDZJDNLURUFDNDQC
D4FEFHQCSILZFQ5VLWNXAIRZNUMCDNGJSM4UJ6T6FDMMIWYRYILQC
GDBDGLRHJSMN527PHXGZVSGF55EYT4X3GFNF4LF6363JE2FGBQXQC
SGZ44T7WGWSQ27MZ6CSCHTGBOLQTIECJIP6KBSTP7A55DZCUBLHAC
L2HMMGZPLQTMRPSHKIZZA77KOKKNVREUOWNSUKTIMS2GPMLJL4BAC
BF7TW3EKRIDYC6J2Q2J4YOBAVQF55Y3H6KGZIHNXMH4N72MR6GXQC
JIBCE66ZTWM5WEHEHNKKTRWBJQSQWBDDWPMOJIJR5Q676OSHYCNAC
X7HYGAL2QVKG7M5EMZ2VSH37UYWGE3EPUXYQBJOVL6IGJFZ2I5AAC
4TL2FLYP36JS4K6QBXZBCFCTIBMIT7OAF7KMAAFGPAF5OWSP4QFAC
FBDRJ53NJ5BWDQGU2GWZ6NEYHKCCRD7RODMIG7QQZBRFUB4HR7OAC
OLCKKDVSDTIBX5U3IRCLRL6KQMG2RDWKGDN4OTPI3WMN4FSX6ROQC
DXFOMHQIWZ6EAUIDZQLY3ZRRDWJRB2VQHJXHBBNXQYCYCABIMJ5QC
TBPJ5WSRM5IKQH7FTAVYTWWUBWW7G2CLT5M6FN7CMPLD6Y77YIWQC
QJAYOFWY7V4BWVLJMEDCCBC2HX4BDAZI6PQVLWCLYRHWGMOBFTVAC
4WW67KAXORLJFOJVWV3CP4VNHTEIJY5WQMSDMXMFKRWSI5EEHTRAC
TEY2M55SZ72OVJ6263EYWFXBHHMR7GPGBNNOGBFIOQPGGHAXSMJQC
KV64IWA3DKR4FL6E4BIG5SFCRQJ3DZFEJOUELCD5TC7DDVJQ6SWAC
FAZW23IDQ6JTXYSJXB5XEALXTWXSDRTDDBBIOWIOKPQ2R3S3WUMQC
Q2C4QGRCXKMCWMEQJT2OJMC5A3OIYKWPQBU4U3QWICEJHFXO6LPQC
PHJEOJAWCHNI4CGTSAJQTWM3UFP6N6J3ZF2TRSSIR4S42OF2PZUQC
json = require 'json'
function main(args)
local infile = io.open(args[1])
local manifest_s = infile:read('*a')
infile:close()
local manifest = json.decode(manifest_s)
local core_filenames = {}
for k,v in pairs(manifest) do
if not starts_with(k, 'fw_') then
table.insert(core_filenames, k)
end
end
table.sort(core_filenames)
for _,core in ipairs(core_filenames) do
local filename = ('%04d'):format(manifest[core])..'-'..core
local f = io.open(filename)
if f then
print(f:read('*a'))
print('')
end
end
end
function starts_with(s, prefix)
if #s < #prefix then
return false
end
for i=1,#prefix do
if s:sub(i,i) ~= prefix:sub(i,i) then
return false
end
end
return true
end
main(arg)
{"vy":546,"on.update":802,"add_def_to_menu":640,"maybe_update_key_in_definitions":529,"on.code_change":820,"load_manifest":694,"get_manifest":768,"on.keychord_press":785,"Menu_background_color":611,"Menu_border_color":612,"box_height":680,"Menu_highlight_color":614,"draw_menu_bar":641,"Manifest":769,"tick_spec":660,"Cursor_node":172,"draw_manifest_navigator":677,"Page":475,"B":379,"on.text_input":521,"sx":544,"mouse_cursor":558,"on.code_submit":787,"Mouse_cursor":559,"set_mouse_cursor":562,"initialize_editor":678,"fw_parent":825,"on":1,"fw_app":"driver","schema1_of_y":667,"get_multiple_definitions_from_app":783,"wait_for_response":781,"interpolate_viewport":824,"load_definition":716,"from_viewport":823,"Spawn_point":822,"manifest_navigator_candidates":638,"line_height":365,"on.draw":797,"manifest_index":637,"draw_run_time_error":808,"font":353,"manifest_coord":636,"sy":469,"keychord_press_on_manifest_navigator":765,"on.load_settings":782,"text_input_on_manifest_navigator":634,"scale":712,"draw_cursor":639,"copy_shape":396,"y_of_schema1":364,"table_and_array_both_empty":689,"survey_animation":826,"on.initialize":807,"animate_next":809,"Manifest_navigator":495,"on_text":539,"add_hotkey_to_menu":616,"on.save_settings":742,"delete_definition":673,"animate_next_frame":825,"on_handle":547,"vx":545,"reset_manifest_navigator":772,"Viewport":604,"approximate":579,"load_from_iterator":670,"Menu_command_color":613,"get_definition_from_app":784,"new_definition":821,"surface_bounds":814,"update_editor_box":711,"on.mouse_press":722,"manifest_navigator_up":628,"approximate_up":658,"manifest_navigator_down":635,"draw_ticks":663,"compute_layout":385,"A":713,"Definitions":503,"move_candidate_to_front_of_manifest":632,"Ticks_font":669,"add_thick_line":400,"Surface":422,"Animating":813,"num_lines_for_manifest_navigator":676,"order_of_magnitude":573,"on.key_release":720,"initialize_manifest_navigator":773,"on.mouse_release":721}
{"vy":546,"on.update":802,"add_def_to_menu":640,"maybe_update_key_in_definitions":529,"on.code_change":820,"load_manifest":694,"get_manifest":768,"on.keychord_press":785,"Menu_background_color":611,"Menu_border_color":612,"box_height":680,"Menu_highlight_color":614,"draw_menu_bar":641,"Manifest":769,"tick_spec":660,"Cursor_node":172,"draw_manifest_navigator":677,"Page":475,"B":379,"on.text_input":521,"sx":544,"mouse_cursor":558,"on.code_submit":787,"Mouse_cursor":559,"set_mouse_cursor":562,"initialize_editor":678,"fw_parent":824,"on":1,"fw_app":"driver","schema1_of_y":667,"get_multiple_definitions_from_app":783,"wait_for_response":781,"interpolate_viewport":824,"load_definition":716,"from_viewport":823,"Spawn_point":822,"manifest_navigator_candidates":638,"line_height":365,"on.draw":797,"manifest_index":637,"draw_run_time_error":808,"font":353,"manifest_coord":636,"sy":469,"keychord_press_on_manifest_navigator":765,"on.load_settings":782,"text_input_on_manifest_navigator":634,"scale":712,"draw_cursor":639,"copy_shape":396,"y_of_schema1":364,"table_and_array_both_empty":689,"survey_animation":816,"on.initialize":807,"animate_next":809,"Manifest_navigator":495,"on_text":539,"add_hotkey_to_menu":616,"on.save_settings":742,"delete_definition":673,"animate_next_frame":825,"on_handle":547,"vx":545,"reset_manifest_navigator":772,"Viewport":604,"approximate":579,"load_from_iterator":670,"Menu_command_color":613,"get_definition_from_app":784,"new_definition":821,"surface_bounds":814,"update_editor_box":711,"on.mouse_press":722,"manifest_navigator_up":628,"approximate_up":658,"manifest_navigator_down":635,"draw_ticks":663,"compute_layout":385,"A":713,"Definitions":503,"move_candidate_to_front_of_manifest":632,"Ticks_font":669,"add_thick_line":400,"Surface":422,"Animating":813,"num_lines_for_manifest_navigator":676,"order_of_magnitude":573,"on.key_release":720,"initialize_manifest_navigator":773,"on.mouse_release":721}
Page2 = {
x=500, y=300,
-- page
type='text',
data={
"Call me Ishmael. Some years ago--never mind how long precisely--having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation. Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking people's hats off--then, I account it high time to get to sea as soon as I can. This is my substitute for pistol and ball. With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship. There is nothing surprising in this. If they but knew it, almost all men in their degree, some time or other, cherish very nearly the same feelings towards the ocean with me."
},
width=400, bg={r=0,g=0.8,b=0}
}
A = function(preserve_screen_top_of_cursor_node)
-- translate Page to Surface
while #Surface > 3 do table.remove(Surface) end -- HACK
local red = false
for x=-1000,2000,300 do
for y=-10000,10000,200 do
add_thick_line({type='line', data={x,y, x+200,y+200, x,y+400}, r=red and 1 or 0,g=red and 0 or 0.5,b=0}, 10)
red = not red
end
end
compute_layout(Page, Page.x,Page.y, Surface, preserve_screen_top_of_cursor_node)
compute_layout(Page2, Page2.x,Page2.y, Surface, preserve_screen_top_of_cursor_node)
-- continue the pipeline
B(preserve_screen_top_of_cursor_node)
-- TODO: ugly that we're manipulating editor objects twice
end
{"vy":546,"on.update":802,"add_def_to_menu":640,"maybe_update_key_in_definitions":529,"on.code_change":820,"load_manifest":694,"get_manifest":768,"on.keychord_press":785,"Menu_background_color":611,"Menu_border_color":612,"box_height":680,"Menu_highlight_color":614,"draw_menu_bar":641,"Manifest":769,"tick_spec":660,"Cursor_node":172,"draw_manifest_navigator":677,"Page":475,"B":379,"on.text_input":521,"sx":544,"mouse_cursor":558,"on.code_submit":787,"Mouse_cursor":559,"set_mouse_cursor":562,"initialize_editor":678,"fw_parent":823,"on":1,"fw_app":"driver","schema1_of_y":667,"get_multiple_definitions_from_app":783,"wait_for_response":781,"interpolate_viewport":824,"load_definition":716,"from_viewport":823,"Spawn_point":822,"manifest_navigator_candidates":638,"line_height":365,"on.draw":797,"manifest_index":637,"draw_run_time_error":808,"font":353,"manifest_coord":636,"sy":469,"keychord_press_on_manifest_navigator":765,"on.load_settings":782,"text_input_on_manifest_navigator":634,"scale":712,"draw_cursor":639,"copy_shape":396,"y_of_schema1":364,"table_and_array_both_empty":689,"survey_animation":816,"on.initialize":807,"animate_next":809,"Manifest_navigator":495,"on_text":539,"add_hotkey_to_menu":616,"on.save_settings":742,"delete_definition":673,"animate_next_frame":817,"on_handle":547,"vx":545,"reset_manifest_navigator":772,"Viewport":604,"approximate":579,"load_from_iterator":670,"Menu_command_color":613,"get_definition_from_app":784,"new_definition":821,"surface_bounds":814,"update_editor_box":711,"on.mouse_press":722,"manifest_navigator_up":628,"approximate_up":658,"manifest_navigator_down":635,"draw_ticks":663,"compute_layout":385,"A":713,"Definitions":503,"move_candidate_to_front_of_manifest":632,"Ticks_font":669,"add_thick_line":400,"Surface":422,"Animating":813,"num_lines_for_manifest_navigator":676,"order_of_magnitude":573,"on.key_release":720,"initialize_manifest_navigator":773,"on.mouse_release":721}
{"vy":546,"on.update":802,"add_def_to_menu":640,"maybe_update_key_in_definitions":529,"on.code_change":820,"load_manifest":694,"get_manifest":768,"on.keychord_press":785,"Menu_background_color":611,"Menu_border_color":612,"box_height":680,"Menu_highlight_color":614,"draw_menu_bar":641,"Manifest":769,"tick_spec":660,"Cursor_node":172,"draw_manifest_navigator":677,"Page":475,"B":379,"on.text_input":521,"sx":544,"mouse_cursor":558,"on.code_submit":787,"Mouse_cursor":559,"set_mouse_cursor":562,"initialize_editor":678,"fw_parent":822,"on":1,"fw_app":"driver","schema1_of_y":667,"get_multiple_definitions_from_app":783,"wait_for_response":781,"load_definition":716,"from_viewport":823,"Spawn_point":822,"manifest_navigator_candidates":638,"line_height":365,"on.draw":797,"manifest_index":637,"draw_run_time_error":808,"font":353,"manifest_coord":636,"sy":469,"keychord_press_on_manifest_navigator":765,"on.load_settings":782,"text_input_on_manifest_navigator":634,"scale":712,"draw_cursor":639,"copy_shape":396,"y_of_schema1":364,"table_and_array_both_empty":689,"survey_animation":816,"on.initialize":807,"animate_next":809,"Manifest_navigator":495,"on_text":539,"add_hotkey_to_menu":616,"on.save_settings":742,"delete_definition":673,"animate_next_frame":817,"on_handle":547,"vx":545,"reset_manifest_navigator":772,"Viewport":604,"approximate":579,"load_from_iterator":670,"Menu_command_color":613,"get_definition_from_app":784,"new_definition":821,"surface_bounds":814,"update_editor_box":711,"on.mouse_press":722,"manifest_navigator_up":628,"approximate_up":658,"manifest_navigator_down":635,"draw_ticks":663,"compute_layout":385,"A":713,"Definitions":503,"move_candidate_to_front_of_manifest":632,"Ticks_font":669,"add_thick_line":400,"Surface":422,"Animating":813,"num_lines_for_manifest_navigator":676,"order_of_magnitude":573,"on.key_release":720,"initialize_manifest_navigator":773,"on.mouse_release":721}
{"add_def_to_menu":640,"on.key_release":720,"on.code_submit":787,"surface_bounds":814,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"compute_layout":385,"set_mouse_cursor":562,"draw_ticks":663,"on.text_input":521,"order_of_magnitude":573,"approximate":579,"on.initialize":807,"A":713,"load_definition":716,"scale":712,"B":379,"approximate_up":658,"vy":546,"Ticks_font":669,"on.load_settings":782,"table_and_array_both_empty":689,"draw_cursor":639,"sy":469,"get_definition_from_app":784,"vx":545,"load_from_iterator":670,"sx":544,"initialize_editor":678,"reset_manifest_navigator":772,"Menu_command_color":613,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Cursor_node":172,"on_text":539,"Manifest_navigator":495,"Page":475,"Menu_background_color":611,"Manifest":769,"Menu_border_color":612,"add_hotkey_to_menu":616,"update_editor_box":711,"Animating":813,"Menu_highlight_color":614,"on.code_change":820,"Surface":422,"draw_menu_bar":641,"font":353,"on.draw":797,"maybe_update_key_in_definitions":529,"initialize_manifest_navigator":773,"on.update":802,"Viewport":604,"load_manifest":694,"on.mouse_release":721,"get_manifest":768,"get_multiple_definitions_from_app":783,"on.mouse_press":722,"fw_parent":821,"tick_spec":660,"fw_app":"driver","animate_next_frame":817,"Definitions":503,"y_of_schema1":364,"new_definition":821,"manifest_navigator_up":628,"on.keychord_press":785,"manifest_navigator_down":635,"on_handle":547,"survey_animation":816,"delete_definition":673,"on.save_settings":742,"move_candidate_to_front_of_manifest":632,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"copy_shape":396,"text_input_on_manifest_navigator":634,"animate_next":809,"wait_for_response":781,"manifest_coord":636,"draw_run_time_error":808,"manifest_index":637,"line_height":365,"manifest_navigator_candidates":638,"on":1,"schema1_of_y":667,"Spawn_point":822}
{"add_def_to_menu":640,"on.key_release":720,"on.code_submit":787,"surface_bounds":814,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"compute_layout":385,"set_mouse_cursor":562,"draw_ticks":663,"on.text_input":521,"order_of_magnitude":573,"approximate":579,"on.initialize":807,"A":713,"load_definition":716,"scale":712,"B":379,"approximate_up":658,"vy":546,"Ticks_font":669,"on.load_settings":782,"table_and_array_both_empty":689,"draw_cursor":639,"sy":469,"get_definition_from_app":784,"vx":545,"load_from_iterator":670,"sx":544,"initialize_editor":678,"reset_manifest_navigator":772,"Menu_command_color":613,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Cursor_node":172,"on_text":539,"Manifest_navigator":495,"Page":475,"Menu_background_color":611,"Manifest":769,"Menu_border_color":612,"add_hotkey_to_menu":616,"update_editor_box":711,"Animating":813,"Menu_highlight_color":614,"on.code_change":820,"Surface":422,"draw_menu_bar":641,"font":353,"on.draw":797,"maybe_update_key_in_definitions":529,"initialize_manifest_navigator":773,"on.update":802,"Viewport":604,"load_manifest":694,"on.mouse_release":721,"get_manifest":768,"get_multiple_definitions_from_app":783,"on.mouse_press":722,"fw_parent":820,"tick_spec":660,"fw_app":"driver","animate_next_frame":817,"Definitions":503,"y_of_schema1":364,"new_definition":821,"manifest_navigator_up":628,"on.keychord_press":785,"manifest_navigator_down":635,"on_handle":547,"survey_animation":816,"delete_definition":673,"on.save_settings":742,"move_candidate_to_front_of_manifest":632,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"copy_shape":396,"text_input_on_manifest_navigator":634,"animate_next":809,"wait_for_response":781,"manifest_coord":636,"draw_run_time_error":808,"manifest_index":637,"line_height":365,"manifest_navigator_candidates":638,"on":1,"schema1_of_y":667}
{"add_def_to_menu":640,"on.key_release":720,"on.code_submit":787,"surface_bounds":814,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"compute_layout":385,"set_mouse_cursor":562,"draw_ticks":663,"on.text_input":521,"order_of_magnitude":573,"approximate":579,"on.initialize":807,"A":713,"load_definition":716,"scale":712,"B":379,"approximate_up":658,"vy":546,"Ticks_font":669,"on.load_settings":782,"table_and_array_both_empty":689,"draw_cursor":639,"sy":469,"get_definition_from_app":784,"vx":545,"load_from_iterator":670,"sx":544,"initialize_editor":678,"reset_manifest_navigator":772,"Menu_command_color":613,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Cursor_node":172,"on_text":539,"Manifest_navigator":495,"Page":475,"Menu_background_color":611,"Manifest":769,"Menu_border_color":612,"add_hotkey_to_menu":616,"update_editor_box":711,"Animating":813,"Menu_highlight_color":614,"on.code_change":820,"Surface":422,"draw_menu_bar":641,"font":353,"on.draw":797,"maybe_update_key_in_definitions":529,"initialize_manifest_navigator":773,"on.update":802,"Viewport":604,"load_manifest":694,"on.mouse_release":721,"get_manifest":768,"get_multiple_definitions_from_app":783,"on.mouse_press":722,"fw_parent":819,"tick_spec":660,"fw_app":"driver","animate_next_frame":817,"Definitions":503,"y_of_schema1":364,"new_definition":819,"manifest_navigator_up":628,"on.keychord_press":785,"manifest_navigator_down":635,"on_handle":547,"survey_animation":816,"delete_definition":673,"on.save_settings":742,"move_candidate_to_front_of_manifest":632,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"copy_shape":396,"text_input_on_manifest_navigator":634,"animate_next":809,"wait_for_response":781,"manifest_coord":636,"draw_run_time_error":808,"manifest_index":637,"line_height":365,"manifest_navigator_candidates":638,"on":1,"schema1_of_y":667}
on.mouse_release = function(x,y, mouse_button)
if Animating then return end
if Pan then
Pan = nil
A()
elseif Move then
Move = nil
A()
elseif Cursor_node then
Cursor_node.show_cursor = true
edit.mouse_release(Cursor_node.editor, x,y, mouse_button)
end
end
{"add_def_to_menu":640,"on.key_release":720,"on.code_submit":787,"surface_bounds":814,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"compute_layout":385,"set_mouse_cursor":562,"draw_ticks":663,"on.text_input":521,"order_of_magnitude":573,"approximate":579,"on.initialize":807,"A":713,"load_definition":716,"scale":712,"B":379,"approximate_up":658,"vy":546,"Ticks_font":669,"on.load_settings":782,"table_and_array_both_empty":689,"draw_cursor":639,"sy":469,"get_definition_from_app":784,"vx":545,"load_from_iterator":670,"sx":544,"initialize_editor":678,"reset_manifest_navigator":772,"Menu_command_color":613,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Cursor_node":172,"on_text":539,"Manifest_navigator":495,"Page":475,"Menu_background_color":611,"Manifest":769,"Menu_border_color":612,"add_hotkey_to_menu":616,"update_editor_box":711,"Animating":813,"Menu_highlight_color":614,"on.code_change":818,"Surface":422,"draw_menu_bar":641,"font":353,"on.draw":797,"maybe_update_key_in_definitions":529,"initialize_manifest_navigator":773,"on.update":802,"Viewport":604,"load_manifest":694,"on.mouse_release":721,"get_manifest":768,"get_multiple_definitions_from_app":783,"on.mouse_press":722,"fw_parent":818,"tick_spec":660,"fw_app":"driver","animate_next_frame":817,"Definitions":503,"y_of_schema1":364,"new_definition":819,"manifest_navigator_up":628,"on.keychord_press":785,"manifest_navigator_down":635,"on_handle":547,"survey_animation":816,"delete_definition":673,"on.save_settings":742,"move_candidate_to_front_of_manifest":632,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"copy_shape":396,"text_input_on_manifest_navigator":634,"animate_next":809,"wait_for_response":781,"manifest_coord":636,"draw_run_time_error":808,"manifest_index":637,"line_height":365,"manifest_navigator_candidates":638,"on":1,"schema1_of_y":667}
new_definition = function()
if Cursor_node then
Cursor_node.show_cursor = false
end
table.insert(Definitions, {
type='text',
data={''},
x=0, y=0,
width=600,
bg={r=0.7,g=0.7,b=1},
})
Viewport.x = -30
Viewport.y = -30
Cursor_node = Definitions[#Definitions]
Cursor_node.show_cursor = true
end
{"add_def_to_menu":640,"on.key_release":720,"on.code_submit":787,"surface_bounds":814,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"compute_layout":385,"set_mouse_cursor":562,"draw_ticks":663,"on.text_input":521,"order_of_magnitude":573,"approximate":579,"on.initialize":807,"A":713,"load_definition":716,"scale":712,"B":379,"approximate_up":658,"vy":546,"Ticks_font":669,"on.load_settings":782,"table_and_array_both_empty":689,"draw_cursor":639,"sy":469,"get_definition_from_app":784,"vx":545,"load_from_iterator":670,"sx":544,"initialize_editor":678,"reset_manifest_navigator":772,"Menu_command_color":613,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Cursor_node":172,"on_text":539,"Manifest_navigator":495,"Page":475,"Menu_background_color":611,"Manifest":769,"Menu_border_color":612,"add_hotkey_to_menu":616,"update_editor_box":711,"Animating":813,"Menu_highlight_color":614,"on.code_change":818,"Surface":422,"draw_menu_bar":641,"font":353,"on.draw":797,"maybe_update_key_in_definitions":529,"initialize_manifest_navigator":773,"on.update":802,"Viewport":604,"load_manifest":694,"on.mouse_release":721,"get_manifest":768,"get_multiple_definitions_from_app":783,"on.mouse_press":722,"fw_parent":817,"tick_spec":660,"fw_app":"driver","animate_next_frame":817,"Definitions":503,"y_of_schema1":364,"new_definition":767,"manifest_navigator_up":628,"on.keychord_press":785,"manifest_navigator_down":635,"on_handle":547,"survey_animation":816,"delete_definition":673,"on.save_settings":742,"move_candidate_to_front_of_manifest":632,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"copy_shape":396,"text_input_on_manifest_navigator":634,"animate_next":809,"wait_for_response":781,"manifest_coord":636,"draw_run_time_error":808,"manifest_index":637,"line_height":365,"manifest_navigator_candidates":638,"on":1,"schema1_of_y":667}
new_definition = function()
if Cursor_node then
Cursor_node.show_cursor = false
end
table.insert(Definitions, {
type='text',
data={''},
x=Spawn_point.x, y=Spawn_point.y,
width=600,
bg={r=0.7,g=0.7,b=1},
})
Viewport.x = Spawn_point.x-30
Viewport.y = Spawn_point.y-30
Cursor_node = Definitions[#Definitions]
Cursor_node.show_cursor = true
end
{"add_def_to_menu":640,"on.key_release":720,"on.code_submit":787,"surface_bounds":814,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"compute_layout":385,"set_mouse_cursor":562,"draw_ticks":663,"on.text_input":521,"order_of_magnitude":573,"approximate":579,"on.initialize":807,"A":713,"load_definition":716,"scale":712,"B":379,"approximate_up":658,"vy":546,"Ticks_font":669,"on.load_settings":782,"table_and_array_both_empty":689,"draw_cursor":639,"sy":469,"get_definition_from_app":784,"vx":545,"load_from_iterator":670,"sx":544,"initialize_editor":678,"reset_manifest_navigator":772,"Menu_command_color":613,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Cursor_node":172,"on_text":539,"Manifest_navigator":495,"Page":475,"Menu_background_color":611,"Manifest":769,"Menu_border_color":612,"add_hotkey_to_menu":616,"update_editor_box":711,"Animating":813,"Menu_highlight_color":614,"on.code_change":799,"Surface":422,"draw_menu_bar":641,"font":353,"on.draw":797,"maybe_update_key_in_definitions":529,"initialize_manifest_navigator":773,"on.update":802,"Viewport":604,"load_manifest":694,"on.mouse_release":721,"get_manifest":768,"get_multiple_definitions_from_app":783,"on.mouse_press":722,"fw_parent":816,"tick_spec":660,"fw_app":"driver","animate_next_frame":817,"Definitions":503,"y_of_schema1":364,"new_definition":767,"manifest_navigator_up":628,"on.keychord_press":785,"manifest_navigator_down":635,"on_handle":547,"survey_animation":816,"delete_definition":673,"on.save_settings":742,"move_candidate_to_front_of_manifest":632,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"copy_shape":396,"text_input_on_manifest_navigator":634,"animate_next":809,"wait_for_response":781,"manifest_coord":636,"draw_run_time_error":808,"manifest_index":637,"line_height":365,"manifest_navigator_candidates":638,"on":1,"schema1_of_y":667}
{"add_def_to_menu":640,"on.key_release":720,"on.code_submit":787,"surface_bounds":814,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"compute_layout":385,"set_mouse_cursor":562,"draw_ticks":663,"on.text_input":521,"order_of_magnitude":573,"approximate":579,"on.initialize":807,"A":713,"load_definition":716,"scale":712,"B":379,"approximate_up":658,"vy":546,"Ticks_font":669,"on.load_settings":782,"table_and_array_both_empty":689,"draw_cursor":639,"sy":469,"get_definition_from_app":784,"vx":545,"load_from_iterator":670,"sx":544,"initialize_editor":678,"reset_manifest_navigator":772,"Menu_command_color":613,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Cursor_node":172,"on_text":539,"Manifest_navigator":495,"Page":475,"Menu_background_color":611,"Manifest":769,"Menu_border_color":612,"add_hotkey_to_menu":616,"update_editor_box":711,"Animating":813,"Menu_highlight_color":614,"on.code_change":799,"Surface":422,"draw_menu_bar":641,"font":353,"on.draw":797,"maybe_update_key_in_definitions":529,"initialize_manifest_navigator":773,"on.update":802,"Viewport":604,"load_manifest":694,"on.mouse_release":721,"get_manifest":768,"get_multiple_definitions_from_app":783,"on.mouse_press":722,"fw_parent":815,"tick_spec":660,"fw_app":"driver","animate_next_frame":811,"Definitions":503,"y_of_schema1":364,"new_definition":767,"manifest_navigator_up":628,"on.keychord_press":785,"manifest_navigator_down":635,"on_handle":547,"survey_animation":816,"delete_definition":673,"on.save_settings":742,"move_candidate_to_front_of_manifest":632,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"copy_shape":396,"text_input_on_manifest_navigator":634,"animate_next":809,"wait_for_response":781,"manifest_coord":636,"draw_run_time_error":808,"manifest_index":637,"line_height":365,"manifest_navigator_candidates":638,"on":1,"schema1_of_y":667}
on.code_submit = function(editor)
if not editor.load_time_error then
Manifest_navigator.reload = true
end
-- update definition backgrounds of failing tests
for name,node in pairs(Definitions) do
if starts_with(name, 'test_') then
if Client_app_test_failures[name] then
node.bg = Failing_test_definition_background_color
else
node.bg = Test_definition_background_color
end
end
end
A()
end
{"add_def_to_menu":640,"on.key_release":720,"on.code_submit":787,"surface_bounds":814,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"compute_layout":385,"set_mouse_cursor":562,"draw_ticks":663,"on.text_input":521,"order_of_magnitude":573,"approximate":579,"on.initialize":807,"A":713,"load_definition":716,"scale":712,"B":379,"approximate_up":658,"vy":546,"Ticks_font":669,"on.load_settings":782,"table_and_array_both_empty":689,"draw_cursor":639,"sy":469,"get_definition_from_app":784,"vx":545,"load_from_iterator":670,"sx":544,"initialize_editor":678,"reset_manifest_navigator":772,"Menu_command_color":613,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Cursor_node":172,"on_text":539,"Manifest_navigator":495,"Page":475,"Menu_background_color":611,"Manifest":769,"Menu_border_color":612,"add_hotkey_to_menu":616,"update_editor_box":711,"Animating":813,"Menu_highlight_color":614,"on.code_change":799,"Surface":422,"draw_menu_bar":641,"font":353,"on.draw":797,"maybe_update_key_in_definitions":529,"initialize_manifest_navigator":773,"on.update":802,"Viewport":604,"load_manifest":694,"on.mouse_release":721,"get_manifest":768,"get_multiple_definitions_from_app":783,"on.mouse_press":722,"fw_parent":814,"tick_spec":660,"fw_app":"driver","animate_next_frame":811,"Definitions":503,"y_of_schema1":364,"new_definition":767,"manifest_navigator_up":628,"on.keychord_press":785,"manifest_navigator_down":635,"on_handle":547,"survey_animation":815,"delete_definition":673,"on.save_settings":742,"move_candidate_to_front_of_manifest":632,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"copy_shape":396,"text_input_on_manifest_navigator":634,"animate_next":809,"wait_for_response":781,"manifest_coord":636,"draw_run_time_error":808,"manifest_index":637,"line_height":365,"manifest_navigator_candidates":638,"on":1,"schema1_of_y":667}
on.update = function(dt)
if Animating then
animate_next(dt)
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
B()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
on.update = function(dt)
if Animating then
animate_next(dt)
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x()-Move.xoff)
Move.node.y = sy(App.mouse_y()-Move.yoff)
B()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
on.mouse_press = function(x,y, mouse_button)
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
survey_animation = function()
---[[
local minx, miny, maxx, maxy = surface_bounds(Definitions)
local zoom = math.min(App.screen.width/(maxx-minx), App.screen.height/(maxy-miny))
Animating = {
{x=minx, y=miny, w=maxx-minx, h=maxy-miny, zoom=zoom},
{x=Viewport.x, y=Viewport.y, w=Viewport.w, h=Viewport.h, zoom=Viewport.zoom},
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"add_def_to_menu":640,"on.key_release":720,"on.code_submit":787,"surface_bounds":814,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"compute_layout":385,"set_mouse_cursor":562,"draw_ticks":663,"on.text_input":521,"order_of_magnitude":573,"approximate":579,"on.initialize":807,"A":713,"load_definition":716,"scale":712,"B":379,"approximate_up":658,"vy":546,"Ticks_font":669,"on.load_settings":782,"table_and_array_both_empty":689,"draw_cursor":639,"sy":469,"get_definition_from_app":784,"vx":545,"load_from_iterator":670,"sx":544,"initialize_editor":678,"reset_manifest_navigator":772,"Menu_command_color":613,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Cursor_node":172,"on_text":539,"Manifest_navigator":495,"Page":475,"Menu_background_color":611,"Manifest":769,"Menu_border_color":612,"add_hotkey_to_menu":616,"update_editor_box":711,"Animating":813,"Menu_highlight_color":614,"on.code_change":799,"Surface":422,"draw_menu_bar":641,"font":353,"on.draw":797,"maybe_update_key_in_definitions":529,"initialize_manifest_navigator":773,"on.update":802,"Viewport":604,"load_manifest":694,"on.mouse_release":721,"get_manifest":768,"get_multiple_definitions_from_app":783,"on.mouse_press":722,"fw_parent":813,"tick_spec":660,"fw_app":"driver","animate_next_frame":811,"Definitions":503,"y_of_schema1":364,"new_definition":767,"manifest_navigator_up":628,"on.keychord_press":785,"manifest_navigator_down":635,"on_handle":547,"survey_animation":812,"delete_definition":673,"on.save_settings":742,"move_candidate_to_front_of_manifest":632,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"copy_shape":396,"text_input_on_manifest_navigator":634,"animate_next":809,"wait_for_response":781,"manifest_coord":636,"draw_run_time_error":808,"manifest_index":637,"line_height":365,"manifest_navigator_candidates":638,"on":1,"schema1_of_y":667}
on.code_submit = function(editor)
if not editor.load_time_error then
Manifest_navigator.reload = true
end
-- update definition backgrounds of failing tests
for name,node in pairs(Definitions) do
-- ignore temporary definitions with numeric indices; they haven't been saved yet
if type(name) == 'string' and starts_with(name, 'test_') then
if Client_app_test_failures[name] then
node.bg = Failing_test_definition_background_color
else
node.bg = Test_definition_background_color
end
end
end
A()
end
{"add_def_to_menu":640,"on.key_release":720,"on.code_submit":787,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"compute_layout":385,"set_mouse_cursor":562,"draw_ticks":663,"on.text_input":521,"order_of_magnitude":573,"approximate":579,"on.initialize":807,"A":713,"load_definition":716,"scale":712,"B":379,"approximate_up":658,"vy":546,"Ticks_font":669,"on.load_settings":782,"table_and_array_both_empty":689,"draw_cursor":639,"sy":469,"get_definition_from_app":784,"vx":545,"load_from_iterator":670,"sx":544,"initialize_editor":678,"reset_manifest_navigator":772,"Menu_command_color":613,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Cursor_node":172,"on_text":539,"Manifest_navigator":495,"Page":475,"Menu_background_color":611,"Manifest":769,"Menu_border_color":612,"add_hotkey_to_menu":616,"update_editor_box":711,"Animating":813,"Menu_highlight_color":614,"on.code_change":799,"Surface":422,"draw_menu_bar":641,"font":353,"on.draw":797,"maybe_update_key_in_definitions":529,"initialize_manifest_navigator":773,"on.update":802,"Viewport":604,"load_manifest":694,"on.mouse_release":721,"get_manifest":768,"get_multiple_definitions_from_app":783,"on.mouse_press":722,"fw_parent":812,"tick_spec":660,"fw_app":"driver","animate_next_frame":811,"Definitions":503,"y_of_schema1":364,"new_definition":767,"manifest_navigator_up":628,"on.keychord_press":785,"manifest_navigator_down":635,"on_handle":547,"survey_animation":812,"delete_definition":673,"on.save_settings":742,"move_candidate_to_front_of_manifest":632,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"copy_shape":396,"text_input_on_manifest_navigator":634,"animate_next":809,"wait_for_response":781,"manifest_coord":636,"draw_run_time_error":808,"manifest_index":637,"line_height":365,"manifest_navigator_candidates":638,"on":1,"schema1_of_y":667}
snapshot_canvas = function()
-- Render the canvas at pixel perfect resolution.
local winw,winh = App.screen.width, App.screen.height
App.screen.width,App.screen.height = Global_viewport.w, Global_viewport.h
Viewport = copy_viewport(Global_viewport)
Viewport.zoom = 1.0
A()
Canvas = love.graphics.newCanvas(cw,ch)
love.graphics.setCanvas(Canvas)
App.fake_key_press = true -- Hack; disable drawing the menu and ticks
on.draw()
App.fake_key_press = nil
love.graphics.setCanvas()
App.screen.width,App.screen.height = winw,winh
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
Animating = {
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
Global_viewport,
desired_viewport,
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
local desired_viewport = Viewport
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
-- Render the canvas at pixel perfect resolution.
local winw,winh = App.screen.width, App.screen.height
App.screen.width,App.screen.height = Global_viewport.w, Global_viewport.h
Viewport = {x=minx, y=miny, w=cw, h=ch, zoom=1.0}
A()
Canvas = love.graphics.newCanvas(cw,ch)
love.graphics.setCanvas(Canvas)
App.run_tests = true -- Hack; disable drawing the menu
on.draw()
App.run_tests = nil
love.graphics.setCanvas()
App.screen.width,App.screen.height = winw,winh
-- initialize animation
get_multiple_definitions_from_app = function(defs)
-- batch interface for speed
-- turn an array of string names into a table of string definitions corresponding to them
if #defs == 0 then return {} end
live.send_to_app('GET* '..table.concat(defs, ' '))
local response = wait_for_response()
local result = {}
for def in response:gmatch('(.-)\n==fw: definition boundary==\n') do
local name = live.get_cmd_from_buffer(def)
if name == nil then
print('failed to get cmd from buffer', def)
end
result[name] = def
end
return result
end
snapshot_canvas = function()
-- Render the canvas at pixel perfect resolution.
local winw,winh = App.screen.width, App.screen.height
App.screen.width,App.screen.height = Global_viewport.w, Global_viewport.h
Viewport = {x=Global_viewport.x, y=Global_viewport.y, w=Global_viewport.w, h=Global_viewport.h, zoom=1.0}
A()
Canvas = love.graphics.newCanvas(cw,ch)
love.graphics.setCanvas(Canvas)
App.fake_key_press = true -- Hack; disable drawing the menu and ticks
on.draw()
App.fake_key_press = nil
love.graphics.setCanvas()
App.screen.width,App.screen.height = winw,winh
end
{"on.key_release":720,"add_thick_line":400,"manifest_navigator_down":635,"on":1,"delete_definition":673,"scale":712,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"Mouse_cursor":559,"compute_layout":385,"set_mouse_cursor":562,"Cursor_node":172,"on.code_change":799,"manifest_navigator_candidates":638,"wait_for_response":781,"add_def_to_menu":640,"on.text_input":521,"order_of_magnitude":573,"on.code_submit":787,"approximate":579,"sy":469,"approximate_up":658,"tick_spec":660,"Ticks_font":669,"on.initialize":807,"Manifest_navigator":495,"animate_next_frame":811,"font":353,"draw_cursor":639,"B":379,"vy":546,"Manifest":769,"line_height":365,"on.save_settings":742,"on.load_settings":782,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"table_and_array_both_empty":689,"new_definition":767,"on_handle":547,"manifest_navigator_up":628,"survey_animation":812,"load_definition":716,"Viewport":604,"animate_next":809,"A":713,"draw_run_time_error":808,"copy_shape":396,"y_of_schema1":364,"Surface":422,"draw_ticks":663,"get_multiple_definitions_from_app":783,"on.draw":797,"manifest_coord":636,"maybe_update_key_in_definitions":529,"schema1_of_y":667,"fw_parent":811,"update_editor_box":711,"fw_app":"driver","mouse_cursor":558,"Animating":770,"initialize_manifest_navigator":773,"text_input_on_manifest_navigator":634,"load_manifest":694,"on.mouse_press":722,"draw_manifest_navigator":677,"on.mouse_release":721,"Menu_highlight_color":614,"on.update":802,"draw_menu_bar":641,"on.keychord_press":785,"add_hotkey_to_menu":616,"box_height":680,"manifest_index":637,"Page":475,"on_text":539,"num_lines_for_manifest_navigator":676,"get_manifest":768,"Definitions":503,"reset_manifest_navigator":772,"initialize_editor":678,"sx":544,"load_from_iterator":670,"vx":545,"get_definition_from_app":784}
{"draw_cursor":639,"on_text":539,"animate_next_frame":811,"on.mouse_press":722,"on.load_settings":782,"sx":544,"table_and_array_both_empty":689,"on.key_release":720,"line_height":365,"update_editor_box":711,"Mouse_cursor":559,"vy":546,"set_mouse_cursor":562,"draw_ticks":663,"Menu_background_color":611,"schema1_of_y":667,"Menu_border_color":612,"Menu_command_color":613,"Animating":770,"Menu_highlight_color":614,"order_of_magnitude":573,"draw_menu_bar":641,"on.draw":797,"add_hotkey_to_menu":616,"approximate":579,"draw_manifest_navigator":677,"Cursor_node":172,"sy":469,"reset_manifest_navigator":772,"load_from_iterator":670,"on.mouse_release":721,"on.update":802,"Ticks_font":669,"on.keychord_press":785,"manifest_navigator_up":628,"manifest_navigator_down":635,"Page":475,"delete_definition":673,"scale":712,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"copy_shape":396,"manifest_coord":636,"manifest_index":637,"load_manifest":694,"manifest_navigator_candidates":638,"get_manifest":768,"on.code_submit":787,"add_def_to_menu":640,"Definitions":503,"initialize_manifest_navigator":773,"box_height":680,"Manifest_navigator":495,"mouse_cursor":558,"vx":545,"on":1,"on.code_change":799,"num_lines_for_manifest_navigator":676,"new_definition":767,"wait_for_response":781,"on.save_settings":742,"approximate_up":658,"compute_layout":385,"tick_spec":660,"maybe_update_key_in_definitions":529,"fw_parent":810,"get_multiple_definitions_from_app":783,"fw_app":"driver","add_thick_line":400,"on.text_input":521,"animate_next":809,"y_of_schema1":364,"get_definition_from_app":784,"on.initialize":807,"draw_run_time_error":808,"A":713,"Surface":422,"Viewport":604,"load_definition":716,"B":379,"survey_animation":806,"initialize_editor":678,"on_handle":547,"font":353,"Manifest":769}
{"draw_cursor":639,"on_text":539,"animate_next_frame":810,"on.mouse_press":722,"on.load_settings":782,"sx":544,"table_and_array_both_empty":689,"on.key_release":720,"line_height":365,"update_editor_box":711,"Mouse_cursor":559,"vy":546,"set_mouse_cursor":562,"draw_ticks":663,"Menu_background_color":611,"schema1_of_y":667,"Menu_border_color":612,"Menu_command_color":613,"Animating":770,"Menu_highlight_color":614,"order_of_magnitude":573,"draw_menu_bar":641,"on.draw":797,"add_hotkey_to_menu":616,"approximate":579,"draw_manifest_navigator":677,"Cursor_node":172,"sy":469,"reset_manifest_navigator":772,"load_from_iterator":670,"on.mouse_release":721,"on.update":802,"Ticks_font":669,"on.keychord_press":785,"manifest_navigator_up":628,"manifest_navigator_down":635,"Page":475,"delete_definition":673,"scale":712,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"copy_shape":396,"manifest_coord":636,"manifest_index":637,"load_manifest":694,"manifest_navigator_candidates":638,"get_manifest":768,"on.code_submit":787,"add_def_to_menu":640,"Definitions":503,"initialize_manifest_navigator":773,"box_height":680,"Manifest_navigator":495,"mouse_cursor":558,"vx":545,"on":1,"on.code_change":799,"num_lines_for_manifest_navigator":676,"new_definition":767,"wait_for_response":781,"on.save_settings":742,"approximate_up":658,"compute_layout":385,"tick_spec":660,"maybe_update_key_in_definitions":529,"fw_parent":809,"get_multiple_definitions_from_app":783,"fw_app":"driver","add_thick_line":400,"on.text_input":521,"animate_next":809,"y_of_schema1":364,"get_definition_from_app":784,"on.initialize":807,"draw_run_time_error":808,"A":713,"Surface":422,"Viewport":604,"load_definition":716,"B":379,"survey_animation":806,"initialize_editor":678,"on_handle":547,"font":353,"Manifest":769}
on.load_settings = function(settings)
App_name = load_manifest()
print('app name', App_name, settings)
if settings == nil then return end
Settings = settings -- stash all settings into a global for on.save_settings
if settings[App_name] == nil then
return
end
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
for name, def_editor in pairs(Definitions) do
local def = get_definition_from_app(name)
if def == '' then
-- app doesn't know about this definition
-- just delete it from the driver for now
Definitions[name] = nil
else
def_editor.data = load_from_iterator(def:gmatch("[^\r\n]+"))
end
end
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
if vy(node.y) > 0 then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, -vy(node.y))
end
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
end
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
Page = {
-- page
type='cols', x=0, y=0,
width=800, data={
-- editor covering left side
{
type='text',
name='editor',
doc='prose goes here, on the left half of the window',
margin=Margin_left,
data={
"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
'1',
'2',
'3',
'mno',
'Acb',
'g',
'hij',
'klm',
'nop',
},
width=400, bg={r=1,g=1,b=0}
},
-- a table on the right
{ type='rows', name='searches', margin=50, data={
{ type='text', data={''},},
{ type='cols', data={
{ type='text', data={'search:'},},
{ type='text', name='search', bg={r=0.8,g=0.8,b=0.8}, data={''}, width=90,},
}},
{ type='text', data={'table:'},},
{ type='cols', bg={r=0.8,g=0.8,b=0.8}, data={
{ type='rows', width=90, data={
{type='text', data={'abc'},},
{type='text', data={'abc'},},
}},
{ type='rows', width=90, data={
{type='text', data={'def'},},
{type='text', data={'def'},},
}},
}},
}},
},
}
on.mouse_press = function(x,y, mouse_button)
if Animating then return end
if Zoomed_out then
zoom_in(x,y)
Zoomed_out = nil
Save_viewport = nil
B()
return
end
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
if mouse_press_consumed_by_any_button_handler(HUD, x,y, mouse_button) then
return
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
{"draw_cursor":639,"on_text":539,"animate_next_frame":805,"on.mouse_press":722,"on.load_settings":782,"sx":544,"table_and_array_both_empty":689,"on.key_release":720,"line_height":365,"update_editor_box":711,"Mouse_cursor":559,"vy":546,"set_mouse_cursor":562,"draw_ticks":663,"Menu_background_color":611,"schema1_of_y":667,"Menu_border_color":612,"Menu_command_color":613,"Animating":770,"Menu_highlight_color":614,"order_of_magnitude":573,"draw_menu_bar":641,"on.draw":797,"add_hotkey_to_menu":616,"approximate":579,"draw_manifest_navigator":677,"Cursor_node":172,"sy":469,"reset_manifest_navigator":772,"load_from_iterator":670,"on.mouse_release":721,"on.update":802,"Ticks_font":669,"on.keychord_press":785,"manifest_navigator_up":628,"manifest_navigator_down":635,"Page":475,"delete_definition":673,"scale":712,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"copy_shape":396,"manifest_coord":636,"manifest_index":637,"load_manifest":694,"manifest_navigator_candidates":638,"get_manifest":768,"on.code_submit":787,"add_def_to_menu":640,"Definitions":503,"initialize_manifest_navigator":773,"box_height":680,"Manifest_navigator":495,"mouse_cursor":558,"vx":545,"on":1,"on.code_change":799,"num_lines_for_manifest_navigator":676,"new_definition":767,"wait_for_response":781,"on.save_settings":742,"approximate_up":658,"compute_layout":385,"tick_spec":660,"maybe_update_key_in_definitions":529,"fw_parent":808,"get_multiple_definitions_from_app":783,"fw_app":"driver","add_thick_line":400,"on.text_input":521,"animate_next":809,"y_of_schema1":364,"get_definition_from_app":784,"on.initialize":807,"draw_run_time_error":808,"A":713,"Surface":422,"Viewport":604,"load_definition":716,"B":379,"survey_animation":806,"initialize_editor":678,"on_handle":547,"font":353,"Manifest":769}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
if vy(node.y) > 0 then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, -vy(node.y))
end
edit.update_font_settings(node.editor, scale(20))
node.editor.left = math.floor(vx(node.x)) + Line_number_width*App.width(node.editor.em)
node.editor.right = math.ceil(vx(node.x+node.w))
Text.redraw_all(node.editor)
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
end
node.editor.left = math.floor(vx(node.x + Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
{"draw_cursor":639,"on_text":539,"animate_next_frame":805,"on.mouse_press":722,"on.load_settings":782,"sx":544,"table_and_array_both_empty":689,"on.key_release":720,"line_height":365,"update_editor_box":711,"Mouse_cursor":559,"vy":546,"set_mouse_cursor":562,"draw_ticks":663,"Menu_background_color":611,"schema1_of_y":667,"Menu_border_color":612,"Menu_command_color":613,"Animating":770,"Menu_highlight_color":614,"order_of_magnitude":573,"draw_menu_bar":641,"on.draw":797,"add_hotkey_to_menu":616,"approximate":579,"draw_manifest_navigator":677,"Cursor_node":172,"sy":469,"reset_manifest_navigator":772,"load_from_iterator":670,"on.mouse_release":721,"on.update":802,"Ticks_font":669,"on.keychord_press":785,"manifest_navigator_up":628,"manifest_navigator_down":635,"Page":475,"delete_definition":673,"scale":712,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"copy_shape":396,"manifest_coord":636,"manifest_index":637,"load_manifest":694,"manifest_navigator_candidates":638,"get_manifest":768,"on.code_submit":787,"add_def_to_menu":640,"Definitions":503,"initialize_manifest_navigator":773,"box_height":680,"Manifest_navigator":495,"mouse_cursor":558,"vx":545,"on":1,"on.code_change":799,"num_lines_for_manifest_navigator":676,"new_definition":767,"wait_for_response":781,"on.save_settings":742,"approximate_up":658,"compute_layout":385,"tick_spec":660,"maybe_update_key_in_definitions":529,"fw_parent":807,"get_multiple_definitions_from_app":783,"fw_app":"driver","add_thick_line":400,"on.text_input":521,"animate_next":801,"y_of_schema1":364,"get_definition_from_app":784,"on.initialize":807,"draw_run_time_error":808,"A":713,"Surface":422,"Viewport":604,"load_definition":716,"B":379,"survey_animation":806,"initialize_editor":678,"on_handle":547,"font":353,"Manifest":769}
on.update = function(dt)
if Pan then
B()
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
on.load_settings = function(settings)
local manifest_version
App_name, manifest_version = load_manifest()
print('app name', App_name, settings)
if settings == nil then return end
Settings = settings -- stash all settings into a global for on.save_settings
if settings[App_name] == nil then
return
end
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
for name, def in pairs(Definitions) do
local filename = definition_file(name, manifest_version)
print('loading', filename)
local f = io.open(filename)
def.data = load_from_iterator(f:lines())
print(def.data[1])
end
end
{"vy":546,"set_mouse_cursor":562,"draw_cursor":639,"draw_run_time_error":798,"on.initialize":807,"A":713,"initialize_editor":678,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"on.text_input":521,"draw_menu_bar":641,"survey_animation":806,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"font":353,"load_from_iterator":670,"get_definition_from_app":784,"manifest_navigator_up":628,"manifest_navigator_down":635,"Animating":770,"delete_definition":673,"Manifest":769,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"Cursor_node":172,"manifest_coord":636,"update_editor_box":711,"manifest_index":637,"Surface":422,"manifest_navigator_candidates":638,"on.draw":797,"add_def_to_menu":640,"Viewport":604,"schema1_of_y":667,"animate_next":801,"animate_next_frame":805,"y_of_schema1":364,"on.mouse_release":721,"maybe_update_key_in_definitions":529,"on.update":802,"on.keychord_press":785,"tick_spec":660,"line_height":365,"sy":469,"Page":475,"Definitions":503,"draw_ticks":663,"fw_parent":806,"scale":712,"on_handle":547,"box_height":680,"copy_shape":396,"on.code_submit":787,"load_definition":716,"on_text":539,"Ticks_font":669,"on.mouse_press":722,"approximate":579,"order_of_magnitude":573,"add_thick_line":400,"initialize_manifest_navigator":773,"sx":544,"on":1,"on.save_settings":742,"on.code_change":799,"on.load_settings":782,"get_multiple_definitions_from_app":783,"compute_layout":385,"get_manifest":768,"on.key_release":720,"wait_for_response":781,"table_and_array_both_empty":689,"approximate_up":658,"fw_app":"driver","new_definition":767,"B":379,"load_manifest":694,"vx":545,"mouse_cursor":558,"Manifest_navigator":495,"Mouse_cursor":559}
Page = {
-- page
type='cols', x=0, y=0,
width=800, data={
-- editor covering left side
{
type='text',
name='editor',
doc='prose goes here, on the left half of the window',
data={''},
width=400, bg={r=0.5,g=0.5,b=1},
},
},
}
{"vy":546,"set_mouse_cursor":562,"draw_cursor":639,"draw_run_time_error":798,"on.initialize":695,"A":713,"initialize_editor":678,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"on.text_input":521,"draw_menu_bar":641,"survey_animation":806,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"font":353,"load_from_iterator":670,"get_definition_from_app":784,"manifest_navigator_up":628,"manifest_navigator_down":635,"Animating":770,"delete_definition":673,"Manifest":769,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"Cursor_node":172,"manifest_coord":636,"update_editor_box":711,"manifest_index":637,"Surface":422,"manifest_navigator_candidates":638,"on.draw":797,"add_def_to_menu":640,"Viewport":604,"schema1_of_y":667,"animate_next":801,"animate_next_frame":805,"y_of_schema1":364,"on.mouse_release":721,"maybe_update_key_in_definitions":529,"on.update":802,"on.keychord_press":785,"tick_spec":660,"line_height":365,"sy":469,"Page":475,"Definitions":503,"draw_ticks":663,"fw_parent":805,"scale":712,"on_handle":547,"box_height":680,"copy_shape":396,"on.code_submit":787,"load_definition":716,"on_text":539,"Ticks_font":669,"on.mouse_press":722,"approximate":579,"order_of_magnitude":573,"add_thick_line":400,"initialize_manifest_navigator":773,"sx":544,"on":1,"on.save_settings":742,"on.code_change":799,"on.load_settings":782,"get_multiple_definitions_from_app":783,"compute_layout":385,"get_manifest":768,"on.key_release":720,"wait_for_response":781,"table_and_array_both_empty":689,"approximate_up":658,"fw_app":"driver","new_definition":767,"B":379,"load_manifest":694,"vx":545,"mouse_cursor":558,"Manifest_navigator":495,"Mouse_cursor":559}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
end
node.editor.top = node.editor.top + Menu_bar_height
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
if vy(node.y) > 0 then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, -vy(node.y))
end
node.editor.left = math.floor(vx(node.x)+Line_number_width*App.width(node.editor.em))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
on.text_input = function(t)
print('text input', t)
if Manifest_navigator.show then
text_input_on_manifest_navigator(t)
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.text_input(Cursor_node.editor, t)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
-- we need to call A sometimes, but redoing compute_layout on every single character is too much
B(--[[preserve screen_top of cursor node]] true)
end
end
{"vy":546,"set_mouse_cursor":562,"draw_cursor":639,"draw_run_time_error":798,"on.initialize":695,"A":713,"initialize_editor":678,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"on.text_input":521,"draw_menu_bar":641,"survey_animation":800,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"font":353,"load_from_iterator":670,"get_definition_from_app":784,"manifest_navigator_up":628,"manifest_navigator_down":635,"Animating":770,"delete_definition":673,"Manifest":769,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"Cursor_node":172,"manifest_coord":636,"update_editor_box":711,"manifest_index":637,"Surface":422,"manifest_navigator_candidates":638,"on.draw":797,"add_def_to_menu":640,"Viewport":604,"schema1_of_y":667,"animate_next":801,"animate_next_frame":805,"y_of_schema1":364,"on.mouse_release":721,"maybe_update_key_in_definitions":529,"on.update":802,"on.keychord_press":785,"tick_spec":660,"line_height":365,"sy":469,"Page":475,"Definitions":503,"draw_ticks":663,"fw_parent":802,"scale":712,"on_handle":547,"box_height":680,"copy_shape":396,"on.code_submit":787,"load_definition":716,"on_text":539,"Ticks_font":669,"on.mouse_press":722,"approximate":579,"order_of_magnitude":573,"add_thick_line":400,"initialize_manifest_navigator":773,"sx":544,"on":1,"on.save_settings":742,"on.code_change":799,"on.load_settings":782,"get_multiple_definitions_from_app":783,"compute_layout":385,"get_manifest":768,"on.key_release":720,"wait_for_response":781,"table_and_array_both_empty":689,"approximate_up":658,"fw_app":"driver","new_definition":767,"B":379,"load_manifest":694,"vx":545,"mouse_cursor":558,"Manifest_navigator":495,"Mouse_cursor":559}
{"vy":546,"set_mouse_cursor":562,"draw_cursor":639,"draw_run_time_error":798,"on.initialize":695,"A":713,"initialize_editor":678,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"on.text_input":521,"draw_menu_bar":641,"survey_animation":800,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"font":353,"load_from_iterator":670,"get_definition_from_app":784,"manifest_navigator_up":628,"manifest_navigator_down":635,"Animating":770,"delete_definition":673,"Manifest":769,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"Cursor_node":172,"manifest_coord":636,"update_editor_box":711,"manifest_index":637,"Surface":422,"manifest_navigator_candidates":638,"on.draw":797,"add_def_to_menu":640,"Viewport":604,"schema1_of_y":667,"animate_next":801,"y_of_schema1":364,"on.mouse_release":721,"maybe_update_key_in_definitions":529,"on.update":802,"on.keychord_press":785,"tick_spec":660,"animate_next_frame(state,":804,"line_height":365,"sy":469,"Page":475,"Definitions":503,"draw_ticks":663,"fw_parent":802,"scale":712,"on_handle":547,"box_height":680,"copy_shape":396,"on.code_submit":787,"load_definition":716,"on_text":539,"Ticks_font":669,"on.mouse_press":722,"approximate":579,"order_of_magnitude":573,"add_thick_line":400,"initialize_manifest_navigator":773,"sx":544,"on":1,"on.save_settings":742,"on.code_change":799,"on.load_settings":782,"get_multiple_definitions_from_app":783,"compute_layout":385,"get_manifest":768,"on.key_release":720,"wait_for_response":781,"table_and_array_both_empty":689,"approximate_up":658,"fw_app":"driver","new_definition":767,"B":379,"load_manifest":694,"vx":545,"mouse_cursor":558,"Manifest_navigator":495,"Mouse_cursor":559}
{"vy":546,"set_mouse_cursor":562,"draw_cursor":639,"draw_run_time_error":798,"on.initialize":695,"A":713,"initialize_editor":678,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"on.text_input":521,"draw_menu_bar":641,"survey_animation":800,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"Manifest_navigator":495,"load_from_iterator":670,"get_definition_from_app":784,"manifest_navigator_up":628,"manifest_navigator_down":635,"Animating":770,"delete_definition":673,"Manifest":769,"move_candidate_to_front_of_manifest":632,"load_manifest":694,"text_input_on_manifest_navigator":634,"Cursor_node":172,"manifest_coord":636,"update_editor_box":711,"manifest_index":637,"B":379,"manifest_navigator_candidates":638,"new_definition":767,"add_def_to_menu":640,"Viewport":604,"schema1_of_y":667,"animate_next":801,"y_of_schema1":364,"on.mouse_release":721,"maybe_update_key_in_definitions":529,"on.update":802,"on.keychord_press":785,"Page":475,"animate_next_frame(state,":803,"Surface":422,"font":353,"initialize_manifest_navigator":773,"line_height":365,"keychord_press_on_manifest_navigator":765,"vx":545,"sx":544,"on_handle":547,"table_and_array_both_empty":689,"on.draw":797,"on.code_submit":787,"load_definition":716,"on_text":539,"tick_spec":660,"on.mouse_press":722,"on.save_settings":742,"order_of_magnitude":573,"add_thick_line":400,"fw_app":"driver","copy_shape":396,"on":1,"approximate":579,"on.code_change":799,"on.load_settings":782,"get_multiple_definitions_from_app":783,"compute_layout":385,"get_manifest":768,"on.key_release":720,"wait_for_response":781,"Ticks_font":669,"approximate_up":658,"box_height":680,"scale":712,"fw_parent":802,"draw_ticks":663,"Definitions":503,"mouse_cursor":558,"sy":469,"Mouse_cursor":559}
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+2,maxy+1
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
schema1_of_y = function(editor, y)
-- return line/pos of screen line starting near a given y offset,
-- and the (negative) offset remaining after the calculation
-- invariants:
-- - 0 >= y_offset >= -Line_height
-- - let loc, y_offset = schema1_of_y(pane, y)
-- y + y_offset == y_of_schema1(pane, loc)
assert(y >= 0)
local y_offset = y
for i=1,#editor.lines do
Text.populate_screen_line_starting_pos(editor, i)
local height = line_height(editor, i)
if y_offset < height then
local line = editor.lines[i]
local nlines = math.floor(y_offset/editor.line_height)
assert(nlines >= 0 and nlines < #editor.line_cache[i].screen_line_starting_pos)
local pos = editor.line_cache[i].screen_line_starting_pos[nlines+1] -- switch to 1-indexing
y_offset = y_offset - nlines*editor.line_height
return {line=i, pos=pos}, -y_offset
end
y_offset = y_offset - height
end
-- y is below the pane
return {line=#editor.lines+1, pos=1}, y_offset -- positive value
end
{"vy":546,"set_mouse_cursor":562,"draw_cursor":639,"draw_run_time_error":798,"on.initialize":695,"A":713,"initialize_editor":678,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"on.text_input":521,"draw_menu_bar":641,"survey_animation":800,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"Manifest_navigator":495,"load_from_iterator":670,"get_definition_from_app":784,"manifest_navigator_up":628,"manifest_navigator_down":635,"Animating":770,"delete_definition":673,"Manifest":769,"move_candidate_to_front_of_manifest":632,"load_manifest":694,"text_input_on_manifest_navigator":634,"Cursor_node":172,"manifest_coord":636,"update_editor_box":711,"manifest_index":637,"B":379,"manifest_navigator_candidates":638,"new_definition":767,"add_def_to_menu":640,"Viewport":604,"schema1_of_y":667,"animate_next":801,"y_of_schema1":364,"on.mouse_release":721,"maybe_update_key_in_definitions":529,"on.update":802,"on.keychord_press":785,"Page":475,"Surface":422,"font":353,"initialize_manifest_navigator":773,"line_height":365,"keychord_press_on_manifest_navigator":765,"vx":545,"sx":544,"on_handle":547,"table_and_array_both_empty":689,"on.draw":797,"on.code_submit":787,"load_definition":716,"on_text":539,"tick_spec":660,"on.mouse_press":722,"on.save_settings":742,"order_of_magnitude":573,"add_thick_line":400,"fw_app":"driver","copy_shape":396,"on":1,"approximate":579,"on.code_change":799,"on.load_settings":782,"get_multiple_definitions_from_app":783,"compute_layout":385,"get_manifest":768,"on.key_release":720,"wait_for_response":781,"Ticks_font":669,"approximate_up":658,"box_height":680,"scale":712,"fw_parent":801,"draw_ticks":663,"Definitions":503,"mouse_cursor":558,"sy":469,"Mouse_cursor":559}
{"vy":546,"set_mouse_cursor":562,"draw_cursor":639,"draw_run_time_error":798,"on.initialize":695,"A":713,"initialize_editor":678,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"on.text_input":521,"draw_menu_bar":641,"survey_animation":800,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"Manifest_navigator":495,"load_from_iterator":670,"get_definition_from_app":784,"manifest_navigator_up":628,"manifest_navigator_down":635,"Animating":770,"delete_definition":673,"Manifest":769,"move_candidate_to_front_of_manifest":632,"load_manifest":694,"text_input_on_manifest_navigator":634,"Cursor_node":172,"manifest_coord":636,"update_editor_box":711,"manifest_index":637,"B":379,"manifest_navigator_candidates":638,"new_definition":767,"add_def_to_menu":640,"Viewport":604,"schema1_of_y":667,"animate_next":801,"y_of_schema1":364,"on.mouse_release":721,"maybe_update_key_in_definitions":529,"on.update":741,"on.keychord_press":785,"Page":475,"Surface":422,"font":353,"initialize_manifest_navigator":773,"line_height":365,"keychord_press_on_manifest_navigator":765,"vx":545,"sx":544,"on_handle":547,"table_and_array_both_empty":689,"on.draw":797,"on.code_submit":787,"load_definition":716,"on_text":539,"tick_spec":660,"on.mouse_press":722,"on.save_settings":742,"order_of_magnitude":573,"add_thick_line":400,"fw_app":"driver","copy_shape":396,"on":1,"approximate":579,"on.code_change":799,"on.load_settings":782,"get_multiple_definitions_from_app":783,"compute_layout":385,"get_manifest":768,"on.key_release":720,"wait_for_response":781,"Ticks_font":669,"approximate_up":658,"box_height":680,"scale":712,"fw_parent":800,"draw_ticks":663,"Definitions":503,"mouse_cursor":558,"sy":469,"Mouse_cursor":559}
{"vy":546,"set_mouse_cursor":562,"draw_cursor":639,"draw_run_time_error":798,"on.initialize":695,"A":713,"initialize_editor":678,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"on.text_input":521,"draw_menu_bar":641,"survey_animation":800,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"Manifest_navigator":495,"load_from_iterator":670,"get_definition_from_app":784,"manifest_navigator_up":628,"manifest_navigator_down":635,"Animating":770,"delete_definition":673,"Manifest":769,"move_candidate_to_front_of_manifest":632,"load_manifest":694,"text_input_on_manifest_navigator":634,"Cursor_node":172,"manifest_coord":636,"update_editor_box":711,"manifest_index":637,"B":379,"manifest_navigator_candidates":638,"new_definition":767,"add_def_to_menu":640,"Viewport":604,"schema1_of_y":667,"y_of_schema1":364,"on.mouse_release":721,"maybe_update_key_in_definitions":529,"on.update":741,"on.keychord_press":785,"Page":475,"Surface":422,"font":353,"initialize_manifest_navigator":773,"line_height":365,"keychord_press_on_manifest_navigator":765,"vx":545,"sx":544,"on_handle":547,"table_and_array_both_empty":689,"on.draw":797,"on.code_submit":787,"load_definition":716,"on_text":539,"tick_spec":660,"on.mouse_press":722,"on.save_settings":742,"order_of_magnitude":573,"add_thick_line":400,"fw_app":"driver","copy_shape":396,"on":1,"approximate":579,"on.code_change":799,"on.load_settings":782,"get_multiple_definitions_from_app":783,"compute_layout":385,"get_manifest":768,"on.key_release":720,"wait_for_response":781,"Ticks_font":669,"approximate_up":658,"box_height":680,"scale":712,"fw_parent":799,"draw_ticks":663,"Definitions":503,"mouse_cursor":558,"sy":469,"Mouse_cursor":559}
maybe_update_key_in_definitions = function(old_definition_name, definition_name, Cursor_node)
--print(old_definition_name, definition_name)
if old_definition_name ~= definition_name then
if old_definition_name == nil or Definitions[old_definition_name] ~= Cursor_node then
local pos = array.find(Definitions, Cursor_node)
--print('found at index', pos)
assert(pos)
table.remove(Definitions, pos)
elseif Definitions[old_definition_name] == Cursor_node then
--print('found at key', old_definition_name)
Definitions[old_definition_name] = nil
end
if definition_name and Definitions[definition_name] == nil then
--print('moving to key', definition_name)
Definitions[definition_name] = Cursor_node
elseif definition_name == nil or Definitions[definition_name] then
-- temporary collision; try again later
-- deleting and reinserting is inefficient, but hopefully rare
--print('moving to index', #Definitions+1)
table.insert(Definitions, Cursor_node)
end
--print('-- definition keys')
--for k in pairs(Definitions) do
--print(k)
--end
end
end
{"vy":546,"set_mouse_cursor":562,"draw_cursor":639,"draw_run_time_error":798,"on.initialize":695,"A":713,"initialize_editor":678,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"on.text_input":521,"draw_menu_bar":641,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"Manifest_navigator":495,"load_from_iterator":670,"get_definition_from_app":784,"manifest_navigator_up":628,"manifest_navigator_down":635,"Animating":770,"delete_definition":673,"Manifest":769,"move_candidate_to_front_of_manifest":632,"load_manifest":694,"text_input_on_manifest_navigator":634,"Cursor_node":172,"manifest_coord":636,"update_editor_box":711,"manifest_index":637,"B":379,"manifest_navigator_candidates":638,"new_definition":767,"add_def_to_menu":640,"Viewport":604,"schema1_of_y":667,"y_of_schema1":364,"on.mouse_release":721,"maybe_update_key_in_definitions":529,"on.update":741,"on.keychord_press":785,"Page":475,"Surface":422,"font":353,"initialize_manifest_navigator":773,"line_height":365,"keychord_press_on_manifest_navigator":765,"vx":545,"sx":544,"on_handle":547,"table_and_array_both_empty":689,"on.draw":797,"on.code_submit":787,"load_definition":716,"on_text":539,"tick_spec":660,"on.mouse_press":722,"on.save_settings":742,"order_of_magnitude":573,"add_thick_line":400,"fw_app":"driver","copy_shape":396,"on":1,"approximate":579,"on.code_change":799,"on.load_settings":782,"get_multiple_definitions_from_app":783,"compute_layout":385,"get_manifest":768,"on.key_release":720,"wait_for_response":781,"Ticks_font":669,"approximate_up":658,"box_height":680,"scale":712,"fw_parent":798,"draw_ticks":663,"Definitions":503,"mouse_cursor":558,"sy":469,"Mouse_cursor":559}
{"draw_manifest_navigator":677,"on.draw":797,"load_from_iterator":670,"vy":546,"get_definition_from_app":784,"Viewport":604,"Cursor_node":172,"manifest_navigator_down":635,"on.mouse_press":722,"scale":712,"on.mouse_release":721,"move_candidate_to_front_of_manifest":632,"on.update":741,"keychord_press_on_manifest_navigator":765,"on.initialize":695,"text_input_on_manifest_navigator":634,"A":713,"Page":475,"sy":469,"fw_parent":797,"manifest_navigator_candidates":638,"fw_app":"driver","copy_shape":396,"on.code_submit":787,"Manifest_navigator":495,"initialize_manifest_navigator":773,"get_multiple_definitions_from_app":783,"tick_spec":660,"wait_for_response":781,"mouse_cursor":558,"on.code_change":734,"get_manifest":768,"set_mouse_cursor":562,"font":353,"Definitions":503,"new_definition":767,"update_editor_box":711,"order_of_magnitude":573,"approximate":579,"on.save_settings":742,"schema1_of_y":667,"initialize_editor":678,"maybe_update_key_in_definitions":529,"approximate_up":658,"box_height":680,"Ticks_font":669,"draw_run_time_error":798,"on.load_settings":782,"Mouse_cursor":559,"manifest_navigator_up":628,"y_of_schema1":364,"reset_manifest_navigator":772,"draw_ticks":663,"on":1,"draw_cursor":639,"on_handle":547,"load_definition":716,"num_lines_for_manifest_navigator":676,"on.text_input":521,"manifest_index":637,"on_text":539,"manifest_coord":636,"load_manifest":694,"Menu_command_color":613,"Manifest":769,"table_and_array_both_empty":689,"sx":544,"Animating":770,"vx":545,"B":379,"Menu_background_color":611,"on.keychord_press":785,"Menu_border_color":612,"delete_definition":673,"on.key_release":720,"line_height":365,"Menu_highlight_color":614,"add_thick_line":400,"draw_menu_bar":641,"add_def_to_menu":640,"add_hotkey_to_menu":616,"compute_layout":385,"Surface":422}
on.load_settings = function(settings)
App_name = load_manifest()
print('app name', App_name, settings)
-- backstop any default settings for this app, and stash everything to a global for on.save_settings
if settings == nil then
Settings = {}
else
Settings = settings
end
if Settings[App_name] == nil then
Settings[App_name] = {}
Settings[App_name].viewport = Viewport
Settings[App_name].definitions = get_default_map()
end
Viewport = Settings[App_name].viewport
Definitions = Settings[App_name].definitions
local names = {}
for name, _ in pairs(Definitions) do
table.insert(names, name)
end
local defs = get_multiple_definitions_from_app(names)
for name, def_editor in pairs(Definitions) do
if def_editor.type == nil then
def_editor.type = 'text'
end
if def_editor.bg == nil then
def_editor.bg = definition_background_color(name)
end
if def_editor.width == nil then
def_editor.width = 600
end
if defs[name] then
def_editor.data = load_from_iterator(defs[name]:gmatch("[^\r\n]+"))
else
-- app doesn't know about this definition
-- just delete it from the driver for now
print('deleting', name)
Definitions[name] = nil
end
end
end
{"draw_manifest_navigator":677,"on.draw":797,"load_from_iterator":670,"vy":546,"get_definition_from_app":784,"Viewport":604,"Cursor_node":172,"manifest_navigator_down":635,"on.mouse_press":722,"scale":712,"on.mouse_release":721,"move_candidate_to_front_of_manifest":632,"on.update":741,"keychord_press_on_manifest_navigator":765,"on.initialize":695,"text_input_on_manifest_navigator":634,"A":713,"Page":475,"sy":469,"fw_parent":796,"manifest_navigator_candidates":638,"fw_app":"driver","copy_shape":396,"on.code_submit":787,"Manifest_navigator":495,"initialize_manifest_navigator":773,"get_multiple_definitions_from_app":783,"tick_spec":660,"wait_for_response":781,"mouse_cursor":558,"on.code_change":734,"get_manifest":768,"set_mouse_cursor":562,"font":353,"Definitions":503,"new_definition":767,"update_editor_box":711,"order_of_magnitude":573,"approximate":579,"on.save_settings":742,"schema1_of_y":667,"initialize_editor":678,"maybe_update_key_in_definitions":529,"approximate_up":658,"box_height":680,"Ticks_font":669,"draw_run_time_error":796,"on.load_settings":782,"Mouse_cursor":559,"manifest_navigator_up":628,"y_of_schema1":364,"reset_manifest_navigator":772,"draw_ticks":663,"on":1,"draw_cursor":639,"on_handle":547,"load_definition":716,"num_lines_for_manifest_navigator":676,"on.text_input":521,"manifest_index":637,"on_text":539,"manifest_coord":636,"load_manifest":694,"Menu_command_color":613,"Manifest":769,"table_and_array_both_empty":689,"sx":544,"Animating":770,"vx":545,"B":379,"Menu_background_color":611,"on.keychord_press":785,"Menu_border_color":612,"delete_definition":673,"on.key_release":720,"line_height":365,"Menu_highlight_color":614,"add_thick_line":400,"draw_menu_bar":641,"add_def_to_menu":640,"add_hotkey_to_menu":616,"compute_layout":385,"Surface":422}
{"draw_manifest_navigator":677,"on.draw":795,"load_from_iterator":670,"vy":546,"get_definition_from_app":784,"Viewport":604,"Cursor_node":172,"manifest_navigator_down":635,"on.mouse_press":722,"scale":712,"on.mouse_release":721,"move_candidate_to_front_of_manifest":632,"on.update":741,"keychord_press_on_manifest_navigator":765,"on.initialize":695,"text_input_on_manifest_navigator":634,"A":713,"Page":475,"sy":469,"fw_parent":795,"manifest_navigator_candidates":638,"fw_app":"driver","copy_shape":396,"on.code_submit":787,"Manifest_navigator":495,"initialize_manifest_navigator":773,"get_multiple_definitions_from_app":783,"tick_spec":660,"wait_for_response":781,"mouse_cursor":558,"on.code_change":734,"get_manifest":768,"set_mouse_cursor":562,"font":353,"Definitions":503,"new_definition":767,"update_editor_box":711,"order_of_magnitude":573,"approximate":579,"on.save_settings":742,"schema1_of_y":667,"initialize_editor":678,"maybe_update_key_in_definitions":529,"approximate_up":658,"box_height":680,"Ticks_font":669,"draw_run_time_error":796,"on.load_settings":782,"Mouse_cursor":559,"manifest_navigator_up":628,"y_of_schema1":364,"reset_manifest_navigator":772,"draw_ticks":663,"on":1,"draw_cursor":639,"on_handle":547,"load_definition":716,"num_lines_for_manifest_navigator":676,"on.text_input":521,"manifest_index":637,"on_text":539,"manifest_coord":636,"load_manifest":694,"Menu_command_color":613,"Manifest":769,"table_and_array_both_empty":689,"sx":544,"Animating":770,"vx":545,"B":379,"Menu_background_color":611,"on.keychord_press":785,"Menu_border_color":612,"delete_definition":673,"on.key_release":720,"line_height":365,"Menu_highlight_color":614,"add_thick_line":400,"draw_menu_bar":641,"add_def_to_menu":640,"add_hotkey_to_menu":616,"compute_layout":385,"Surface":422}
{"approximate":579,"table_and_array_both_empty":689,"vy":546,"approximate_up":658,"Ticks_font":669,"fw_parent":794,"font":353,"fw_app":"driver","Cursor_node":172,"sy":469,"update_editor_box":711,"on.initialize":695,"scale":712,"Animating":770,"B":379,"schema1_of_y":667,"Menu_background_color":611,"Manifest_navigator":495,"initialize_manifest_navigator":773,"Definitions":503,"on.draw":795,"new_definition":767,"Menu_highlight_color":614,"get_multiple_definitions_from_app":783,"add_hotkey_to_menu":616,"wait_for_response":781,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Manifest":769,"on.mouse_release":721,"load_manifest":694,"maybe_update_key_in_definitions":529,"get_manifest":768,"on.keychord_press":785,"get_definition_from_app":784,"on.text_input":521,"Page":475,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"line_height":365,"move_candidate_to_front_of_manifest":632,"on":1,"keychord_press_on_manifest_navigator":765,"add_thick_line":400,"text_input_on_manifest_navigator":634,"copy_shape":396,"manifest_coord":636,"on_text":539,"manifest_index":637,"on.mouse_press":722,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"box_height":680,"compute_layout":385,"on.code_change":734,"initialize_editor":678,"Menu_command_color":613,"Surface":422,"on.key_release":720,"draw_menu_bar":641,"mouse_cursor":558,"load_definition":716,"Mouse_cursor":559,"tick_spec":660,"load_from_iterator":670,"on.update":741,"set_mouse_cursor":562,"draw_cursor":639,"draw_ticks":663,"reset_manifest_navigator":772,"A":713,"Viewport":604,"y_of_schema1":364,"Menu_border_color":612,"on_handle":547,"on.code_submit":787,"on.save_settings":742,"order_of_magnitude":573,"on.load_settings":782}
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
local desired_viewport = Viewport
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
-- Render the canvas at pixel perfect resolution.
local winw,winh = App.screen.width, App.screen.height
App.screen.width,App.screen.height = Global_viewport.w, Global_viewport.h
Viewport = {x=minx, y=miny, w=cw, h=ch, zoom=1.0}
A()
Canvas = love.graphics.newCanvas(cw,ch)
love.graphics.setCanvas(Canvas)
App.run_tests = true -- Hack; disable drawing the menu and ticks
on.draw()
App.run_tests = nil
love.graphics.setCanvas()
App.screen.width,App.screen.height = winw,winh
-- initialize animation
Animating = {
Global_viewport,
desired_viewport,
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"approximate":579,"table_and_array_both_empty":689,"vy":546,"approximate_up":658,"Ticks_font":669,"fw_parent":793,"font":353,"fw_app":"driver","Cursor_node":172,"sy":469,"update_editor_box":711,"on.initialize":695,"scale":712,"Animating":770,"B":379,"schema1_of_y":667,"Menu_background_color":611,"Manifest_navigator":495,"initialize_manifest_navigator":773,"Definitions":503,"on.draw":794,"new_definition":767,"Menu_highlight_color":614,"get_multiple_definitions_from_app":783,"add_hotkey_to_menu":616,"wait_for_response":781,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Manifest":769,"on.mouse_release":721,"load_manifest":694,"maybe_update_key_in_definitions":529,"get_manifest":768,"on.keychord_press":785,"get_definition_from_app":784,"on.text_input":521,"Page":475,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"line_height":365,"move_candidate_to_front_of_manifest":632,"on":1,"keychord_press_on_manifest_navigator":765,"add_thick_line":400,"text_input_on_manifest_navigator":634,"copy_shape":396,"manifest_coord":636,"on_text":539,"manifest_index":637,"on.mouse_press":722,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"box_height":680,"compute_layout":385,"on.code_change":734,"initialize_editor":678,"Menu_command_color":613,"Surface":422,"on.key_release":720,"draw_menu_bar":641,"mouse_cursor":558,"load_definition":716,"Mouse_cursor":559,"tick_spec":660,"load_from_iterator":670,"on.update":741,"set_mouse_cursor":562,"draw_cursor":639,"draw_ticks":663,"reset_manifest_navigator":772,"A":713,"Viewport":604,"y_of_schema1":364,"Menu_border_color":612,"on_handle":547,"on.code_submit":787,"on.save_settings":742,"order_of_magnitude":573,"on.load_settings":782}
{"approximate":579,"table_and_array_both_empty":689,"vy":546,"approximate_up":658,"Ticks_font":669,"fw_parent":792,"font":353,"fw_app":"driver","Cursor_node":172,"sy":469,"update_editor_box":711,"on.initialize":695,"scale":712,"Animating":770,"B":379,"schema1_of_y":667,"Menu_background_color":611,"Manifest_navigator":495,"initialize_manifest_navigator":773,"Definitions":503,"on.draw":793,"new_definition":767,"Menu_highlight_color":614,"get_multiple_definitions_from_app":783,"add_hotkey_to_menu":616,"wait_for_response":781,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Manifest":769,"on.mouse_release":721,"load_manifest":694,"maybe_update_key_in_definitions":529,"get_manifest":768,"on.keychord_press":785,"get_definition_from_app":784,"on.text_input":521,"Page":475,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"line_height":365,"move_candidate_to_front_of_manifest":632,"on":1,"keychord_press_on_manifest_navigator":765,"add_thick_line":400,"text_input_on_manifest_navigator":634,"copy_shape":396,"manifest_coord":636,"on_text":539,"manifest_index":637,"on.mouse_press":722,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"box_height":680,"compute_layout":385,"on.code_change":734,"initialize_editor":678,"Menu_command_color":613,"Surface":422,"on.key_release":720,"draw_menu_bar":641,"mouse_cursor":558,"load_definition":716,"Mouse_cursor":559,"tick_spec":660,"load_from_iterator":670,"on.update":741,"set_mouse_cursor":562,"draw_cursor":639,"draw_ticks":663,"reset_manifest_navigator":772,"A":713,"Viewport":604,"y_of_schema1":364,"Menu_border_color":612,"on_handle":547,"on.code_submit":787,"on.save_settings":742,"order_of_magnitude":573,"on.load_settings":782}
Page = {
-- page
type='cols', x=0, y=0,
width=800, data={
-- editor covering left side
{
type='text',
name='editor',
doc='prose goes here, on the left half of the window',
data={''},
width=400, bg={r=1,g=1,b=0},
},
},
}
on.load_settings = function(settings)
App_name = load_manifest()
print('app name', App_name, settings)
-- backstop any default settings for this app, and stash everything to a global for on.save_settings
if settings == nil then
Settings = {}
else
Settings = settings
end
if Settings[App_name] == nil then
Settings[App_name] = {}
Settings[App_name].viewport = Viewport
Settings[App_name].definitions = get_default_map()
end
Viewport = Settings[App_name].viewport
Definitions = Settings[App_name].definitions
local names = {}
for name, _ in pairs(Definitions) do
table.insert(names, name)
end
local defs = get_multiple_definitions_from_app(names)
for name, def_editor in pairs(Definitions) do
print('definition:', name)
if def_editor.type == nil then
def_editor.type = 'text'
end
if def_editor.bg == nil then
print('initializing bg')
def_editor.bg = definition_background_color(name)
end
if def_editor.width == nil then
print('initializing width')
def_editor.width = 600
end
print('at', def_editor.x, def_editor.y)
if defs[name] then
def_editor.data = load_from_iterator(defs[name]:gmatch("[^\r\n]+"))
else
-- app doesn't know about this definition
-- just delete it from the driver for now
print('deleting', name)
Definitions[name] = nil
end
end
end
on.update = function(dt)
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
A()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
{"approximate":579,"table_and_array_both_empty":689,"vy":546,"approximate_up":658,"Ticks_font":669,"fw_parent":791,"font":353,"fw_app":"driver","Cursor_node":172,"sy":469,"update_editor_box":711,"on.initialize":695,"scale":712,"Animating":770,"B":379,"schema1_of_y":667,"Menu_background_color":611,"Manifest_navigator":495,"initialize_manifest_navigator":773,"Definitions":503,"on.draw":792,"new_definition":767,"Menu_highlight_color":614,"get_multiple_definitions_from_app":783,"add_hotkey_to_menu":616,"wait_for_response":781,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Manifest":769,"on.mouse_release":721,"load_manifest":694,"maybe_update_key_in_definitions":529,"get_manifest":768,"on.keychord_press":785,"get_definition_from_app":784,"on.text_input":521,"Page":475,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"line_height":365,"move_candidate_to_front_of_manifest":632,"on":1,"keychord_press_on_manifest_navigator":765,"add_thick_line":400,"text_input_on_manifest_navigator":634,"copy_shape":396,"manifest_coord":636,"on_text":539,"manifest_index":637,"on.mouse_press":722,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"box_height":680,"compute_layout":385,"on.code_change":734,"initialize_editor":678,"Menu_command_color":613,"Surface":422,"on.key_release":720,"draw_menu_bar":641,"mouse_cursor":558,"load_definition":716,"Mouse_cursor":559,"tick_spec":660,"load_from_iterator":670,"on.update":741,"set_mouse_cursor":562,"draw_cursor":639,"draw_ticks":663,"reset_manifest_navigator":772,"A":713,"Viewport":604,"y_of_schema1":364,"Menu_border_color":612,"on_handle":547,"on.code_submit":787,"on.save_settings":742,"order_of_magnitude":573,"on.load_settings":782}
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxx+1
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
local desired_viewport = Viewport
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
-- Render the canvas at pixel perfect resolution.
local winw,winh = App.screen.width, App.screen.height
App.screen.width,App.screen.height = Global_viewport.w, Global_viewport.h
Viewport = {x=minx, y=miny, w=cw, h=ch, zoom=1.0}
A()
Canvas = love.graphics.newCanvas(cw,ch)
love.graphics.setCanvas(Canvas)
App.run_tests = true -- Hack; disable drawing the menu and ticks
on.draw()
App.run_tests = nil
love.graphics.setCanvas()
App.screen.width,App.screen.height = winw,winh
-- initialize animation
Animating = {
Global_viewport,
desired_viewport,
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"approximate":579,"table_and_array_both_empty":689,"vy":546,"approximate_up":658,"Ticks_font":669,"fw_parent":790,"font":353,"fw_app":"driver","Cursor_node":172,"sy":469,"update_editor_box":711,"on.initialize":695,"scale":712,"Animating":770,"B":379,"schema1_of_y":667,"Menu_background_color":611,"Manifest_navigator":495,"initialize_manifest_navigator":773,"Definitions":503,"on.draw":791,"new_definition":767,"Menu_highlight_color":614,"get_multiple_definitions_from_app":783,"add_hotkey_to_menu":616,"wait_for_response":781,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Manifest":769,"on.mouse_release":721,"load_manifest":694,"maybe_update_key_in_definitions":529,"get_manifest":768,"on.keychord_press":785,"get_definition_from_app":784,"on.text_input":521,"Page":475,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"line_height":365,"move_candidate_to_front_of_manifest":632,"on":1,"keychord_press_on_manifest_navigator":765,"add_thick_line":400,"text_input_on_manifest_navigator":634,"copy_shape":396,"manifest_coord":636,"on_text":539,"manifest_index":637,"on.mouse_press":722,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"box_height":680,"compute_layout":385,"on.code_change":734,"initialize_editor":678,"Menu_command_color":613,"Surface":422,"on.key_release":720,"draw_menu_bar":641,"mouse_cursor":558,"load_definition":716,"Mouse_cursor":559,"tick_spec":660,"load_from_iterator":670,"on.update":741,"set_mouse_cursor":562,"draw_cursor":639,"draw_ticks":663,"reset_manifest_navigator":772,"A":713,"Viewport":604,"y_of_schema1":364,"Menu_border_color":612,"on_handle":547,"on.code_submit":787,"on.save_settings":742,"order_of_magnitude":573,"on.load_settings":782}
{"set_mouse_cursor":562,"box_height":680,"Page":475,"font":353,"on.save_settings":742,"on":1,"scale":712,"fw_parent":789,"fw_app":"driver","Viewport":604,"load_manifest":694,"draw_ticks":663,"on.mouse_press":722,"on.initialize":695,"on.update":741,"Manifest":769,"on.keychord_press":785,"on.text_input":521,"Menu_background_color":611,"Manifest_navigator":495,"Menu_border_color":612,"A":713,"Menu_highlight_color":614,"y_of_schema1":364,"Animating":770,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"draw_cursor":639,"reset_manifest_navigator":772,"load_from_iterator":670,"get_definition_from_app":784,"Definitions":503,"manifest_navigator_up":628,"order_of_magnitude":573,"manifest_navigator_down":635,"delete_definition":673,"approximate":579,"move_candidate_to_front_of_manifest":632,"Ticks_font":669,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"add_thick_line":400,"maybe_update_key_in_definitions":529,"copy_shape":396,"update_editor_box":711,"manifest_index":637,"manifest_navigator_candidates":638,"get_manifest":768,"add_def_to_menu":640,"on.code_change":734,"new_definition":767,"on_handle":547,"add_hotkey_to_menu":616,"on.code_submit":787,"get_multiple_definitions_from_app":783,"on_text":539,"on.mouse_release":721,"wait_for_response":781,"Cursor_node":172,"approximate_up":658,"on.load_settings":782,"initialize_manifest_navigator":773,"tick_spec":660,"on.draw":790,"sy":469,"line_height":365,"initialize_editor":678,"Surface":422,"load_definition":716,"sx":544,"schema1_of_y":667,"vx":545,"B":379,"on.key_release":720,"draw_menu_bar":641,"vy":546,"mouse_cursor":558,"Menu_command_color":613,"Mouse_cursor":559,"compute_layout":385,"table_and_array_both_empty":689,"manifest_coord":636}
on.update = function(dt)
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
A()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
{"Manifest_navigator":495,"Animating":770,"on.initialize":695,"B":379,"Surface":422,"on.draw":789,"load_manifest":694,"Viewport":604,"get_manifest":768,"font":353,"approximate_up":658,"on":1,"new_definition":767,"on.update":741,"on.keychord_press":785,"Page":475,"draw_cursor":639,"maybe_update_key_in_definitions":529,"on.code_submit":787,"Menu_background_color":611,"update_editor_box":711,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"initialize_manifest_navigator":773,"draw_menu_bar":641,"add_hotkey_to_menu":616,"on_text":539,"on.mouse_press":722,"y_of_schema1":364,"wait_for_response":781,"reset_manifest_navigator":772,"sx":544,"load_from_iterator":670,"vx":545,"get_definition_from_app":784,"load_definition":716,"on.key_release":720,"manifest_navigator_down":635,"draw_manifest_navigator":677,"box_height":680,"delete_definition":673,"compute_layout":385,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"on.save_settings":742,"num_lines_for_manifest_navigator":676,"text_input_on_manifest_navigator":634,"vy":546,"draw_ticks":663,"manifest_coord":636,"set_mouse_cursor":562,"manifest_index":637,"table_and_array_both_empty":689,"manifest_navigator_candidates":638,"A":713,"fw_parent":787,"add_def_to_menu":640,"fw_app":"driver","copy_shape":396,"mouse_cursor":558,"on.text_input":521,"order_of_magnitude":573,"Definitions":503,"Manifest":769,"manifest_navigator_up":628,"line_height":365,"approximate":579,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"sy":469,"get_multiple_definitions_from_app":783,"on.load_settings":782,"Cursor_node":172,"on_handle":547,"schema1_of_y":667,"on.code_change":734,"on.mouse_release":721,"tick_spec":660,"scale":712,"Ticks_font":669,"initialize_editor":678}
{"Manifest_navigator":495,"Animating":770,"on.initialize":695,"B":379,"Surface":422,"on.draw":788,"load_manifest":694,"Viewport":604,"get_manifest":768,"font":353,"approximate_up":658,"on":1,"Ticks_font":669,"on.update":741,"on.keychord_press":785,"Page":475,"draw_cursor":639,"maybe_update_key_in_definitions":529,"on.code_submit":787,"Menu_background_color":611,"update_editor_box":711,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"initialize_manifest_navigator":773,"on_handle":547,"schema1_of_y":667,"on_text":539,"on.mouse_press":722,"y_of_schema1":364,"wait_for_response":781,"reset_manifest_navigator":772,"sx":544,"load_from_iterator":670,"vx":545,"get_definition_from_app":784,"load_definition":716,"on.key_release":720,"manifest_navigator_down":635,"on.code_change":734,"box_height":680,"delete_definition":673,"on.mouse_release":721,"move_candidate_to_front_of_manifest":632,"num_lines_for_manifest_navigator":676,"on.save_settings":742,"new_definition":767,"text_input_on_manifest_navigator":634,"vy":546,"draw_manifest_navigator":677,"manifest_coord":636,"set_mouse_cursor":562,"manifest_index":637,"table_and_array_both_empty":689,"manifest_navigator_candidates":638,"add_hotkey_to_menu":616,"fw_parent":787,"scale":712,"fw_app":"driver","copy_shape":396,"draw_menu_bar":641,"on.text_input":521,"order_of_magnitude":573,"add_def_to_menu":640,"Manifest":769,"on.load_settings":782,"get_multiple_definitions_from_app":783,"approximate":579,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"sy":469,"line_height":365,"manifest_navigator_up":628,"Cursor_node":172,"Definitions":503,"mouse_cursor":558,"A":713,"draw_ticks":663,"tick_spec":660,"Mouse_cursor":559,"compute_layout":385,"initialize_editor":678}
{"Manifest_navigator":495,"Animating":770,"on.initialize":695,"B":379,"Surface":422,"on.draw":565,"load_manifest":694,"Viewport":604,"get_manifest":768,"font":353,"approximate_up":658,"on":1,"Ticks_font":669,"on.update":741,"on.keychord_press":785,"Page":475,"draw_cursor":639,"maybe_update_key_in_definitions":529,"on.code_submit":787,"Menu_background_color":611,"update_editor_box":711,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"initialize_manifest_navigator":773,"on_handle":547,"schema1_of_y":667,"on_text":539,"on.mouse_press":722,"y_of_schema1":364,"wait_for_response":781,"reset_manifest_navigator":772,"sx":544,"load_from_iterator":670,"vx":545,"get_definition_from_app":784,"load_definition":716,"on.key_release":720,"manifest_navigator_down":635,"on.code_change":734,"box_height":680,"delete_definition":673,"on.mouse_release":721,"move_candidate_to_front_of_manifest":632,"num_lines_for_manifest_navigator":676,"on.save_settings":742,"new_definition":767,"text_input_on_manifest_navigator":634,"vy":546,"draw_manifest_navigator":677,"manifest_coord":636,"set_mouse_cursor":562,"manifest_index":637,"table_and_array_both_empty":689,"manifest_navigator_candidates":638,"add_hotkey_to_menu":616,"fw_parent":786,"scale":712,"fw_app":"driver","copy_shape":396,"draw_menu_bar":641,"on.text_input":521,"order_of_magnitude":573,"add_def_to_menu":640,"Manifest":769,"on.load_settings":782,"get_multiple_definitions_from_app":783,"approximate":579,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"sy":469,"line_height":365,"manifest_navigator_up":628,"Cursor_node":172,"Definitions":503,"mouse_cursor":558,"A":713,"draw_ticks":663,"tick_spec":660,"Mouse_cursor":559,"compute_layout":385,"initialize_editor":678}
{"Manifest_navigator":495,"Animating":770,"on.initialize":695,"B":379,"Surface":422,"on.draw":565,"load_manifest":694,"Viewport":604,"get_manifest":768,"font":353,"approximate_up":658,"on":1,"Ticks_font":669,"on.update":741,"on.keychord_press":785,"Page":475,"draw_cursor":639,"maybe_update_key_in_definitions":529,"on.code_submit":786,"Menu_background_color":611,"update_editor_box":711,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"initialize_manifest_navigator":773,"on_handle":547,"schema1_of_y":667,"on_text":539,"on.mouse_press":722,"y_of_schema1":364,"wait_for_response":781,"reset_manifest_navigator":772,"sx":544,"load_from_iterator":670,"vx":545,"get_definition_from_app":784,"load_definition":716,"on.key_release":720,"manifest_navigator_down":635,"on.code_change":734,"box_height":680,"delete_definition":673,"on.mouse_release":721,"move_candidate_to_front_of_manifest":632,"num_lines_for_manifest_navigator":676,"on.save_settings":742,"new_definition":767,"text_input_on_manifest_navigator":634,"vy":546,"draw_manifest_navigator":677,"manifest_coord":636,"set_mouse_cursor":562,"manifest_index":637,"table_and_array_both_empty":689,"manifest_navigator_candidates":638,"add_hotkey_to_menu":616,"fw_parent":785,"scale":712,"fw_app":"driver","copy_shape":396,"draw_menu_bar":641,"on.text_input":521,"order_of_magnitude":573,"add_def_to_menu":640,"Manifest":769,"on.load_settings":782,"get_multiple_definitions_from_app":783,"approximate":579,"add_thick_line":400,"keychord_press_on_manifest_navigator":765,"sy":469,"line_height":365,"manifest_navigator_up":628,"Cursor_node":172,"Definitions":503,"mouse_cursor":558,"A":713,"draw_ticks":663,"tick_spec":660,"Mouse_cursor":559,"compute_layout":385,"initialize_editor":678}
{"fw_parent":784,"manifest_navigator_up":628,"Definitions":503,"tick_spec":660,"B":379,"scale":712,"add_thick_line":400,"maybe_update_key_in_definitions":529,"copy_shape":396,"on.text_input":521,"Page":475,"reset_manifest_navigator":772,"get_definition_from_app":784,"on_handle":547,"on_text":539,"sx":544,"keychord_press_on_manifest_navigator":765,"initialize_manifest_navigator":773,"on":1,"get_multiple_definitions_from_app":783,"wait_for_response":781,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"schema1_of_y":667,"set_mouse_cursor":562,"on.key_release":720,"draw_ticks":663,"on.load_settings":782,"line_height":365,"on.keychord_press":785,"on.save_settings":742,"update_editor_box":711,"A":713,"order_of_magnitude":573,"Ticks_font":669,"font":353,"on.code_submit":766,"on.mouse_press":722,"manifest_coord":636,"fw_app":"driver","manifest_index":637,"approximate":579,"draw_cursor":639,"manifest_navigator_candidates":638,"vy":546,"Surface":422,"Viewport":604,"manifest_navigator_down":635,"sy":469,"compute_layout":385,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"Menu_command_color":613,"Manifest":769,"text_input_on_manifest_navigator":634,"Cursor_node":172,"load_manifest":694,"Menu_background_color":611,"get_manifest":768,"on.draw":565,"initialize_editor":678,"vx":545,"load_definition":716,"Menu_highlight_color":614,"add_def_to_menu":640,"draw_menu_bar":641,"y_of_schema1":364,"add_hotkey_to_menu":616,"load_from_iterator":670,"on.initialize":695,"draw_manifest_navigator":677,"new_definition":767,"num_lines_for_manifest_navigator":676,"on.mouse_release":721,"Menu_border_color":612,"on.update":741,"Manifest_navigator":495,"approximate_up":658,"on.code_change":734,"Animating":770}
{"draw_ticks":663,"Page":475,"table_and_array_both_empty":689,"on.initialize":695,"font":353,"order_of_magnitude":573,"approximate":579,"draw_cursor":639,"A":713,"approximate_up":658,"Animating":770,"Ticks_font":669,"scale":712,"Manifest":769,"on.code_change":734,"load_manifest":694,"initialize_editor":678,"Manifest_navigator":495,"B":379,"Menu_background_color":611,"Cursor_node":172,"Menu_border_color":612,"add_def_to_menu":640,"Menu_command_color":613,"Mouse_cursor":559,"Menu_highlight_color":614,"line_height":365,"draw_menu_bar":641,"wait_for_response":781,"add_hotkey_to_menu":616,"on_text":539,"set_mouse_cursor":562,"draw_manifest_navigator":677,"box_height":680,"num_lines_for_manifest_navigator":676,"Definitions":503,"load_definition":716,"reset_manifest_navigator":772,"get_manifest":768,"fw_parent":783,"load_from_iterator":670,"fw_app":"driver","get_definition_from_app":784,"on.code_submit":766,"on_handle":547,"move_candidate_to_front_of_manifest":632,"mouse_cursor":558,"manifest_navigator_up":628,"update_editor_box":711,"manifest_navigator_down":635,"on":1,"initialize_manifest_navigator":773,"delete_definition":673,"maybe_update_key_in_definitions":529,"copy_shape":396,"sy":469,"keychord_press_on_manifest_navigator":765,"schema1_of_y":667,"text_input_on_manifest_navigator":634,"tick_spec":660,"add_thick_line":400,"on.draw":565,"new_definition":767,"vx":545,"compute_layout":385,"Viewport":604,"on.key_release":720,"Surface":422,"vy":546,"manifest_navigator_candidates":638,"on.text_input":521,"manifest_index":637,"manifest_coord":636,"on.mouse_press":722,"get_multiple_definitions_from_app":783,"on.mouse_release":721,"y_of_schema1":364,"on.update":741,"on.save_settings":742,"on.keychord_press":774,"on.load_settings":782,"sx":544}
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
if obj.editor.load_time_error then
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, vy(obj.y))
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(5*20*Viewport.zoom))
love.graphics.setColor(0,0,0)
love.graphics.print(obj.editor.load_time_error, vx(obj.x), error_y)
end
end
end
end
draw_ticks()
draw_menu_bar()
end
{"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"box_height":680,"keychord_press_on_manifest_navigator":765,"on_handle":547,"text_input_on_manifest_navigator":634,"manifest_coord":636,"add_thick_line":400,"manifest_index":637,"on.mouse_press":722,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.code_change":734,"on.code_submit":766,"on":1,"on.key_release":720,"initialize_manifest_navigator":773,"initialize_editor":678,"mouse_cursor":558,"tick_spec":660,"on.initialize":695,"set_mouse_cursor":562,"A":713,"draw_ticks":663,"B":379,"on.keychord_press":774,"order_of_magnitude":573,"approximate":579,"on.save_settings":742,"on.load_settings":782,"approximate_up":658,"vy":546,"table_and_array_both_empty":689,"Ticks_font":669,"fw_parent":782,"fw_app":"driver","sy":469,"Cursor_node":172,"draw_cursor":639,"on.draw":565,"Viewport":604,"wait_for_response":781,"new_definition":767,"Manifest_navigator":495,"update_editor_box":711,"Menu_command_color":613,"get_multiple_definitions_from_app":783,"Surface":422,"schema1_of_y":667,"Menu_background_color":611,"on.mouse_release":721,"Menu_border_color":612,"on.update":741,"Animating":770,"copy_shape":396,"Menu_highlight_color":614,"compute_layout":385,"draw_menu_bar":641,"Manifest":769,"y_of_schema1":364,"font":353,"load_manifest":694,"draw_manifest_navigator":677,"get_manifest":768,"num_lines_for_manifest_navigator":676,"add_hotkey_to_menu":616,"load_definition":716,"reset_manifest_navigator":772,"Definitions":503,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"on_text":539,"get_definition_from_app":777,"line_height":365,"scale":712,"Mouse_cursor":559,"Page":475,"manifest_navigator_up":628,"on.text_input":521}
{"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"box_height":680,"keychord_press_on_manifest_navigator":765,"on_handle":547,"text_input_on_manifest_navigator":634,"manifest_coord":636,"add_thick_line":400,"manifest_index":637,"on.mouse_press":722,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.code_change":734,"on.code_submit":766,"on":1,"on.key_release":720,"initialize_manifest_navigator":773,"initialize_editor":678,"mouse_cursor":558,"tick_spec":660,"on.initialize":695,"set_mouse_cursor":562,"A":713,"draw_ticks":663,"B":379,"on.keychord_press":774,"order_of_magnitude":573,"approximate":579,"on.save_settings":742,"on.load_settings":782,"approximate_up":658,"vy":546,"table_and_array_both_empty":689,"Ticks_font":669,"fw_parent":781,"fw_app":"driver","sy":469,"Cursor_node":172,"draw_cursor":639,"on.draw":565,"Viewport":604,"wait_for_response":781,"new_definition":767,"Manifest_navigator":495,"update_editor_box":711,"Menu_command_color":613,"get_multiple_definitions_from_app":778,"Surface":422,"schema1_of_y":667,"Menu_background_color":611,"on.mouse_release":721,"Menu_border_color":612,"on.update":741,"Animating":770,"copy_shape":396,"Menu_highlight_color":614,"compute_layout":385,"draw_menu_bar":641,"Manifest":769,"y_of_schema1":364,"font":353,"load_manifest":694,"draw_manifest_navigator":677,"get_manifest":768,"num_lines_for_manifest_navigator":676,"add_hotkey_to_menu":616,"load_definition":716,"reset_manifest_navigator":772,"Definitions":503,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"on_text":539,"get_definition_from_app":777,"line_height":365,"scale":712,"Mouse_cursor":559,"Page":475,"manifest_navigator_up":628,"on.text_input":521}
A = function(preserve_screen_top_of_cursor_node)
-- translate Definitions to Surface
Surface = {}
for _,node in pairs(Definitions) do
compute_layout(node, node.x,node.y, Surface, preserve_screen_top_of_cursor_node)
end
-- continue the pipeline
B(preserve_screen_top_of_cursor_node)
-- TODO: ugly that we're manipulating editor objects twice
end
{
"get_manifest": 768,
"Viewport": 604,
"update_editor_box": 711,
"Menu_border_color": 612,
"tick_spec": 660,
"Definitions": 503,
"Menu_highlight_color": 614,
"on.mouse_press": 722,
"draw_menu_bar": 641,
"on.mouse_release": 721,
"add_hotkey_to_menu": 616,
"on.update": 741,
"on.keychord_press": 774,
"y_of_schema1": 364,
"load_definition": 716,
"maybe_update_key_in_definitions": 529,
"get_definition_from_app": 777,
"manifest_navigator_up": 628,
"manifest_navigator_down": 635,
"delete_definition": 673,
"move_candidate_to_front_of_manifest": 632,
"table_and_array_both_empty": 689,
"keychord_press_on_manifest_navigator": 765,
"on_handle": 547,
"draw_cursor": 639,
"on_text": 539,
"compute_layout": 385,
"add_thick_line": 400,
"Cursor_node": 172,
"on.code_change": 734,
"sx": 544,
"vx": 545,
"on.text_input": 521,
"line_height": 365,
"on.key_release": 720,
"Page": 475,
"initialize_manifest_navigator": 773,
"Animating": 770,
"mouse_cursor": 558,
"fw_parent": 780,
"Mouse_cursor": 559,
"fw_app": "driver",
"vy": 546,
"set_mouse_cursor": 562,
"initialize_editor": 678,
"draw_ticks": 663,
"on": 1,
"on.initialize": 695,
"A": 713,
"order_of_magnitude": 573,
"approximate": 579,
"sy": 469,
"font": 353,
"load_from_iterator": 670,
"approximate_up": 658,
"reset_manifest_navigator": 772,
"text_input_on_manifest_navigator": 634,
"scale": 712,
"load_manifest": 694,
"manifest_coord": 636,
"num_lines_for_manifest_navigator": 676,
"Manifest_navigator": 495,
"Manifest": 769,
"manifest_navigator_candidates": 638,
"draw_manifest_navigator": 677,
"Ticks_font": 669,
"add_def_to_menu": 640,
"B": 379,
"manifest_index": 637,
"box_height": 680,
"on.code_submit": 766,
"on.save_settings": 742,
"on.load_settings": 780,
"copy_shape": 396,
"Menu_command_color": 613,
"schema1_of_y": 667,
"Surface": 422,
"get_multiple_definitions_from_app": 778,
"Menu_background_color": 611,
"on.draw": 565,
"new_definition": 767,
"wait_for_response": 781,
}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
end
node.editor.left = math.floor(vx(node.x))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
get_definition_from_app = function(name)
live.send_to_app('GET '..name)
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
return response_string
end
load_definition = function(name)
move_candidate_to_front_of_manifest(name)
if Definitions[name] then return end -- just one copy per definition for now
Definitions[name] = {
type='text',
data=load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+")),
x=0, y=0,
width=600,
bg={r=0.7,g=0.7,b=1},
}
end
{"get_manifest":768,"Viewport":604,"update_editor_box":711,"Menu_border_color":612,"tick_spec":660,"Definitions":503,"Menu_highlight_color":614,"on.mouse_press":722,"draw_menu_bar":641,"on.mouse_release":721,"add_hotkey_to_menu":616,"on.update":741,"on.keychord_press":774,"y_of_schema1":364,"load_definition":716,"maybe_update_key_in_definitions":529,"get_definition_from_app":777,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"table_and_array_both_empty":689,"keychord_press_on_manifest_navigator":765,"on_handle":547,"draw_cursor":639,"on_text":539,"compute_layout":385,"add_thick_line":400,"Cursor_node":172,"on.code_change":734,"sx":544,"vx":545,"on.text_input":521,"line_height":365,"on.key_release":720,"Page":475,"initialize_manifest_navigator":773,"Animating":770,"mouse_cursor":558,"fw_parent":779,"Mouse_cursor":559,"fw_app":"driver","vy":546,"set_mouse_cursor":562,"initialize_editor":678,"draw_ticks":663,"on":1,"on.initialize":695,"A":713,"order_of_magnitude":573,"approximate":579,"sy":469,"font":353,"load_from_iterator":670,"approximate_up":658,"reset_manifest_navigator":772,"text_input_on_manifest_navigator":634,"scale":712,"load_manifest":694,"manifest_coord":636,"num_lines_for_manifest_navigator":676,"Manifest_navigator":495,"Manifest":769,"manifest_navigator_candidates":638,"draw_manifest_navigator":677,"Ticks_font":669,"add_def_to_menu":640,"B":379,"manifest_index":637,"box_height":680,"on.code_submit":766,"on.save_settings":742,"on.load_settings":780,"copy_shape":396,"Menu_command_color":613,"schema1_of_y":667,"Surface":422,"get_multiple_definitions_from_app":778,"Menu_background_color":611,"on.draw":565,"new_definition":767}
{"Definitions":503,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"draw_cursor":639,"manifest_coord":636,"maybe_update_key_in_definitions":529,"on":1,"order_of_magnitude":573,"add_def_to_menu":640,"approximate":579,"Page":475,"approximate_up":658,"on_handle":547,"on_text":539,"on.initialize":695,"on.mouse_press":722,"A":713,"tick_spec":660,"scale":712,"Viewport":604,"vx":545,"box_height":680,"on.key_release":720,"on.update":741,"load_definition":716,"y_of_schema1":364,"on.keychord_press":774,"on.mouse_release":721,"Mouse_cursor":559,"on.code_submit":766,"on.save_settings":742,"set_mouse_cursor":562,"on.load_settings":779,"draw_ticks":663,"initialize_manifest_navigator":773,"on.text_input":521,"table_and_array_both_empty":689,"initialize_editor":678,"get_multiple_definitions_from_app":778,"on.draw":565,"sy":469,"update_editor_box":711,"vy":546,"compute_layout":385,"add_thick_line":400,"manifest_navigator_candidates":638,"copy_shape":396,"schema1_of_y":667,"B":379,"new_definition":767,"text_input_on_manifest_navigator":634,"mouse_cursor":558,"Manifest_navigator":495,"Menu_background_color":611,"fw_parent":778,"Menu_border_color":612,"fw_app":"driver","Menu_command_color":613,"Animating":770,"Menu_highlight_color":614,"on.code_change":734,"draw_menu_bar":641,"manifest_index":637,"add_hotkey_to_menu":616,"Surface":422,"Ticks_font":669,"draw_manifest_navigator":677,"Manifest":769,"num_lines_for_manifest_navigator":676,"sx":544,"load_manifest":694,"reset_manifest_navigator":772,"get_manifest":768,"load_from_iterator":670,"font":353,"line_height":365,"get_definition_from_app":777,"Cursor_node":172}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
if vy(node.y) > 0 then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, vy(node.y))
end
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
{"Definitions":503,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"draw_cursor":639,"manifest_coord":636,"maybe_update_key_in_definitions":529,"on":1,"order_of_magnitude":573,"add_def_to_menu":640,"approximate":579,"Page":475,"approximate_up":658,"on_handle":547,"on_text":539,"on.initialize":695,"on.mouse_press":722,"A":713,"tick_spec":660,"scale":712,"Viewport":604,"vx":545,"box_height":680,"on.key_release":720,"on.update":741,"load_definition":716,"y_of_schema1":364,"on.keychord_press":774,"on.mouse_release":721,"Mouse_cursor":559,"on.code_submit":766,"on.save_settings":742,"set_mouse_cursor":562,"on.load_settings":776,"draw_ticks":663,"initialize_manifest_navigator":773,"on.text_input":521,"table_and_array_both_empty":689,"initialize_editor":678,"get_multiple_definitions_from_app":778,"on.draw":565,"sy":469,"update_editor_box":711,"vy":546,"compute_layout":385,"add_thick_line":400,"manifest_navigator_candidates":638,"copy_shape":396,"schema1_of_y":667,"B":379,"new_definition":767,"text_input_on_manifest_navigator":634,"mouse_cursor":558,"Manifest_navigator":495,"Menu_background_color":611,"fw_parent":777,"Menu_border_color":612,"fw_app":"driver","Menu_command_color":613,"Animating":770,"Menu_highlight_color":614,"on.code_change":734,"draw_menu_bar":641,"manifest_index":637,"add_hotkey_to_menu":616,"Surface":422,"Ticks_font":669,"draw_manifest_navigator":677,"Manifest":769,"num_lines_for_manifest_navigator":676,"sx":544,"load_manifest":694,"reset_manifest_navigator":772,"get_manifest":768,"load_from_iterator":670,"font":353,"line_height":365,"get_definition_from_app":777,"Cursor_node":172}
{"Definitions":503,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"draw_cursor":639,"manifest_coord":636,"maybe_update_key_in_definitions":529,"on":1,"order_of_magnitude":573,"add_def_to_menu":640,"approximate":579,"Page":475,"approximate_up":658,"on_handle":547,"on_text":539,"on.initialize":695,"on.mouse_press":722,"A":713,"tick_spec":660,"scale":712,"Viewport":604,"vx":545,"box_height":680,"on.key_release":720,"on.update":741,"load_definition":716,"y_of_schema1":364,"on.keychord_press":774,"on.mouse_release":721,"Mouse_cursor":559,"on.code_submit":766,"on.save_settings":742,"set_mouse_cursor":562,"on.load_settings":776,"draw_ticks":663,"initialize_manifest_navigator":773,"on.text_input":521,"table_and_array_both_empty":689,"initialize_editor":678,"on.draw":565,"sy":469,"update_editor_box":711,"vy":546,"compute_layout":385,"add_thick_line":400,"manifest_navigator_candidates":638,"copy_shape":396,"schema1_of_y":667,"B":379,"new_definition":767,"text_input_on_manifest_navigator":634,"mouse_cursor":558,"Manifest_navigator":495,"Menu_background_color":611,"fw_parent":776,"Menu_border_color":612,"fw_app":"driver","Menu_command_color":613,"Animating":770,"Menu_highlight_color":614,"on.code_change":734,"draw_menu_bar":641,"manifest_index":637,"add_hotkey_to_menu":616,"Surface":422,"Ticks_font":669,"draw_manifest_navigator":677,"Manifest":769,"num_lines_for_manifest_navigator":676,"sx":544,"load_manifest":694,"reset_manifest_navigator":772,"get_manifest":768,"load_from_iterator":670,"font":353,"line_height":365,"get_definition_from_app":777,"Cursor_node":172}
{"on_handle":547,"definition_background_color":859,"draw_run_time_error":808,"survey_animation":847,"sx":544,"animate_next":841,"on.update":835,"load_definition":854,"on.keychord_press":828,"animate_next_frame":825,"box_height":680,"schema1_of_y":667,"on.save_settings":742,"surface_bounds":814,"Ticks_font":669,"y_of_schema1":364,"set_mouse_cursor":562,"font":353,"table_and_array_both_empty":689,"Spawn_point":822,"from_viewport":823,"load_manifest":694,"interpolate_viewport":843,"order_of_magnitude":573,"on.text_input":855,"Manifest":769,"B":830,"on.code_change":820,"get_manifest":768,"Cursor_node":172,"manifest_index":637,"approximate_up":658,"manifest_navigator_candidates":638,"Num_animation_frames":840,"new_definition":848,"add_thick_line":400,"update_editor_box":711,"copy_shape":396,"sy":469,"draw_manifest_navigator":677,"on.mouse_press":722,"Surface":422,"Test_definition_background_color":858,"draw_cursor":639,"Definition_background_color":849,"Viewport":604,"add_hotkey_to_menu":616,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"draw_ticks":844,"approximate":579,"tick_spec":660,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"vy":546,"Menu_command_color":613,"Mouse_cursor":559,"Menu_highlight_color":614,"mouse_cursor":558,"draw_menu_bar":641,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"Page":475,"on.code_submit":787,"Manifest_navigator":495,"fw_app":"driver","line_height":365,"on.initialize":807,"Definitions":503,"delete_definition":673,"keychord_press_on_manifest_navigator":765,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"get_multiple_definitions_from_app":783,"manifest_navigator_down":635,"on":1,"compute_layout":385,"on.key_release":720,"move_candidate_to_front_of_manifest":632,"Animating":842,"wait_for_response":781,"text_input_on_manifest_navigator":634,"fw_parent":858,"A":831,"manifest_coord":636,"scale":712,"on.mouse_release":836,"reset_manifest_navigator":772,"on.draw":797,"vx":545}
{"Ticks_font":669,"new_definition":848,"table_and_array_both_empty":689,"draw_run_time_error":808,"maybe_update_key_in_definitions":529,"y_of_schema1":364,"animate_next":841,"Menu_background_color":611,"Menu_border_color":612,"animate_next_frame":825,"Menu_command_color":613,"vx":545,"Menu_highlight_color":614,"Viewport":604,"draw_menu_bar":861,"vy":546,"surface_bounds":814,"Cursor_node":172,"num_lines_for_manifest_navigator":676,"on.mouse_release":836,"reset_manifest_navigator":772,"load_from_iterator":670,"Spawn_point":822,"get_definition_from_app":784,"from_viewport":823,"Page":475,"interpolate_viewport":843,"add_thick_line":400,"manifest_navigator_up":628,"copy_shape":396,"manifest_navigator_down":635,"Animating":842,"B":830,"Num_animation_frames":840,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"on_handle":547,"text_input_on_manifest_navigator":634,"A":831,"on":1,"on.code_change":820,"manifest_index":637,"on.mouse_press":722,"manifest_navigator_candidates":638,"on.update":835,"sx":544,"on.draw":797,"scale":712,"manifest_coord":636,"on.key_release":720,"fw_parent":861,"wait_for_response":781,"Surface":422,"sy":469,"compute_layout":385,"get_multiple_definitions_from_app":783,"initialize_manifest_navigator":773,"delete_definition":673,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"tick_spec":660,"font":353,"fw_app":"driver","set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":862,"line_height":365,"on.initialize":807,"on.code_submit":787,"initialize_editor":678,"on.text_input":855,"survey_animation":860,"on_text":539,"approximate_up":658,"order_of_magnitude":573,"load_definition":854,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.keychord_press":828,"approximate":579,"Manifest":769,"update_editor_box":711,"box_height":680,"load_manifest":694,"definition_background_color":859,"get_manifest":768,"Test_definition_background_color":858,"on.save_settings":742,"schema1_of_y":667,"on.load_settings":782,"Definition_background_color":849,"add_def_to_menu":640,"draw_cursor":639}
{"box_height":680,"maybe_update_key_in_definitions":529,"load_definition":716,"on.code_change":734,"on.save_settings":742,"on.load_settings":776,"on_handle":547,"table_and_array_both_empty":689,"scale":712,"on_text":539,"on.mouse_press":722,"initialize_editor":678,"sx":544,"Cursor_node":172,"vx":545,"line_height":365,"on.key_release":720,"fw_parent":775,"on":1,"fw_app":"driver","Mouse_cursor":559,"Animating":770,"set_mouse_cursor":562,"draw_ticks":663,"order_of_magnitude":573,"approximate":579,"Menu_background_color":611,"sy":469,"Menu_border_color":612,"Surface":422,"Menu_command_color":613,"Menu_highlight_color":614,"approximate_up":658,"draw_menu_bar":641,"manifest_index":637,"Viewport":604,"on.draw":565,"Ticks_font":669,"Manifest_navigator":495,"keychord_press_on_manifest_navigator":765,"num_lines_for_manifest_navigator":676,"on.code_submit":766,"copy_shape":396,"reset_manifest_navigator":772,"manifest_coord":636,"on.mouse_release":721,"load_from_iterator":670,"on.update":741,"get_definition_from_app":775,"on.keychord_press":774,"mouse_cursor":558,"font":353,"add_thick_line":400,"Manifest":769,"manifest_navigator_up":628,"manifest_navigator_down":635,"load_manifest":694,"A":713,"get_manifest":768,"draw_cursor":639,"move_candidate_to_front_of_manifest":632,"add_hotkey_to_menu":616,"on.initialize":695,"initialize_manifest_navigator":773,"text_input_on_manifest_navigator":634,"Definitions":503,"delete_definition":673,"new_definition":767,"B":379,"tick_spec":660,"schema1_of_y":667,"manifest_navigator_candidates":638,"compute_layout":385,"vy":546,"add_def_to_menu":640,"update_editor_box":711,"draw_manifest_navigator":677,"y_of_schema1":364,"Page":475,"on.text_input":521}
initialize_editor = function(obj)
if obj.w then
-- use an editor to wrap the text
local scaled_fontsize = scale(20)
local scaled_lineheight = math.floor(scaled_fontsize*1.3)
-- HACK: modify obj.editor.left after initialization
obj.editor = edit.initialize_state(Menu_bar_height + vy(obj.y), math.floor(vx(obj.x)), math.ceil(vx(obj.x+obj.w)), scaled_fontsize, scaled_lineheight)
obj.editor.lines = load_array(obj.data)
Text.redraw_all(obj.editor)
end
end
obj.editor.left = obj.editor.left + Line_number_width*App.width('m')
obj.editor.width = obj.editor.right - obj.editor.left
A = function(preserve_screen_top_of_cursor_node)
love.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current font
-- translate Definitions to Surface
Surface = {}
for _,node in pairs(Definitions) do
compute_layout(node, node.x,node.y, Surface, preserve_screen_top_of_cursor_node)
end
-- continue the pipeline
B(preserve_screen_top_of_cursor_node)
-- TODO: ugly that we're manipulating editor objects twice
end
{"box_height":680,"maybe_update_key_in_definitions":529,"load_definition":716,"on.code_change":734,"on.save_settings":742,"on.load_settings":700,"on_handle":547,"table_and_array_both_empty":689,"scale":712,"on_text":539,"on.mouse_press":722,"initialize_editor":678,"sx":544,"Cursor_node":172,"vx":545,"line_height":365,"on.key_release":720,"fw_parent":774,"on":1,"fw_app":"driver","Mouse_cursor":559,"Animating":770,"set_mouse_cursor":562,"draw_ticks":663,"order_of_magnitude":573,"approximate":579,"Menu_background_color":611,"sy":469,"Menu_border_color":612,"Surface":422,"Menu_command_color":613,"Menu_highlight_color":614,"approximate_up":658,"draw_menu_bar":641,"manifest_index":637,"Viewport":604,"on.draw":565,"Ticks_font":669,"Manifest_navigator":495,"keychord_press_on_manifest_navigator":765,"num_lines_for_manifest_navigator":676,"on.code_submit":766,"copy_shape":396,"reset_manifest_navigator":772,"manifest_coord":636,"on.mouse_release":721,"load_from_iterator":670,"on.update":741,"get_definition_from_app":775,"on.keychord_press":774,"mouse_cursor":558,"font":353,"add_thick_line":400,"Manifest":769,"manifest_navigator_up":628,"manifest_navigator_down":635,"load_manifest":694,"A":713,"get_manifest":768,"draw_cursor":639,"move_candidate_to_front_of_manifest":632,"add_hotkey_to_menu":616,"on.initialize":695,"initialize_manifest_navigator":773,"text_input_on_manifest_navigator":634,"Definitions":503,"delete_definition":673,"new_definition":767,"B":379,"tick_spec":660,"schema1_of_y":667,"manifest_navigator_candidates":638,"compute_layout":385,"vy":546,"add_def_to_menu":640,"update_editor_box":711,"draw_manifest_navigator":677,"y_of_schema1":364,"Page":475,"on.text_input":521}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
if vy(node.y) > 0 then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, -vy(node.y))
end
node.editor.left = math.floor(vx(node.x+Line_number_width*App.width(node.editor.em)))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
{"load_definition":716,"Manifest":769,"load_manifest":694,"get_manifest":768,"on.draw":565,"delete_definition":673,"Menu_background_color":611,"move_candidate_to_front_of_manifest":632,"on.load_settings":700,"Surface":422,"Menu_command_color":613,"text_input_on_manifest_navigator":634,"Menu_highlight_color":614,"vy":546,"table_and_array_both_empty":689,"Viewport":604,"manifest_navigator_candidates":638,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"on.update":741,"get_definition_from_app":735,"font":353,"fw_app":"driver","sy":469,"manifest_navigator_down":635,"on":1,"initialize_manifest_navigator":773,"on_handle":547,"Manifest_navigator":495,"on_text":539,"on.mouse_press":722,"update_editor_box":711,"sx":544,"vx":545,"box_height":680,"schema1_of_y":667,"compute_layout":385,"on.key_release":720,"on.code_change":734,"y_of_schema1":364,"mouse_cursor":558,"Mouse_cursor":559,"add_hotkey_to_menu":616,"set_mouse_cursor":562,"Page":475,"draw_ticks":663,"on.mouse_release":721,"approximate":579,"tick_spec":660,"Menu_border_color":612,"scale":712,"on.text_input":521,"add_def_to_menu":640,"on.save_settings":742,"order_of_magnitude":573,"initialize_editor":678,"line_height":365,"Animating":770,"new_definition":767,"Cursor_node":172,"on.initialize":695,"draw_cursor":639,"A":713,"fw_parent":773,"manifest_navigator_up":628,"add_thick_line":400,"B":379,"copy_shape":396,"approximate_up":658,"manifest_coord":636,"on.keychord_press":774,"draw_menu_bar":641,"on.code_submit":766,"Ticks_font":669,"keychord_press_on_manifest_navigator":765,"Definitions":503,"manifest_index":637}
draw_run_time_error = function()
if Run_time_error == nil then return end
local height = math.min(20*HUD_line_height, App.screen.height*0.4)
App.color{r=0.8,g=0,b=0}
love.graphics.rectangle('fill', 0, App.screen.height - height-10, App.screen.width, height+10)
App.color{r=0,g=0,b=0}
love.graphics.print(Run_time_error, 30, App.screen.height - height)
end
box_height = function(node)
-- return the height of a text editor node (explicit width). The result is unscaled.
local y = 0
for i=1,#node.editor.lines do
local line = node.editor.lines[i]
if node.editor.line_cache[i] == nil then
node.editor.line_cache[i] = {}
end
node.editor.line_cache[i].fragments = nil
node.editor.line_cache[i].screen_line_starting_pos = nil
Text.compute_fragments(node.editor, i)
Text.populate_screen_line_starting_pos(node.editor, i)
y = y + 20*1.3*#node.editor.line_cache[i].screen_line_starting_pos
Text.clear_screen_line_cache(node.editor, i)
end
return y
end
{"vy":546,"mouse_cursor":558,"Mouse_cursor":559,"on.save_settings":742,"on.load_settings":782,"set_mouse_cursor":562,"draw_ticks":663,"animate_next":841,"table_and_array_both_empty":689,"animate_next_frame":825,"order_of_magnitude":573,"sy":469,"update_editor_box":711,"approximate":579,"surface_bounds":814,"schema1_of_y":667,"approximate_up":658,"Manifest_navigator":495,"Cursor_node":172,"Spawn_point":822,"Ticks_font":669,"from_viewport":823,"interpolate_viewport":843,"Animating":842,"font":353,"draw_menu_bar":641,"add_hotkey_to_menu":616,"Manifest":769,"draw_manifest_navigator":677,"load_manifest":694,"num_lines_for_manifest_navigator":676,"get_manifest":768,"reset_manifest_navigator":772,"on.text_input":834,"load_from_iterator":670,"get_definition_from_app":784,"Menu_background_color":611,"on.draw":797,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"new_definition":821,"Menu_highlight_color":614,"delete_definition":673,"copy_shape":396,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"on.mouse_release":836,"manifest_coord":636,"on.keychord_press":828,"maybe_update_key_in_definitions":529,"B":830,"Num_animation_frames":840,"Page":475,"add_def_to_menu":640,"y_of_schema1":364,"draw_cursor":639,"scale":712,"A":831,"manifest_navigator_up":628,"on.update":835,"tick_spec":660,"vx":545,"survey_animation":827,"Surface":422,"get_multiple_definitions_from_app":783,"on.code_submit":787,"manifest_navigator_candidates":638,"on_handle":547,"add_thick_line":400,"draw_run_time_error":808,"move_candidate_to_front_of_manifest":632,"line_height":365,"on_text":539,"initialize_manifest_navigator":773,"on.mouse_press":722,"box_height":680,"manifest_navigator_down":635,"initialize_editor":678,"fw_parent":842,"sx":544,"fw_app":"driver","compute_layout":385,"manifest_index":637,"wait_for_response":781,"on.code_change":820,"on.initialize":807,"on":1,"on.key_release":720,"Viewport":604,"load_definition":716}
{"load_definition":716,"Manifest":769,"load_manifest":694,"get_manifest":768,"on.draw":565,"delete_definition":673,"Menu_background_color":611,"move_candidate_to_front_of_manifest":632,"on.load_settings":700,"Surface":422,"Menu_command_color":613,"text_input_on_manifest_navigator":634,"Menu_highlight_color":614,"vy":546,"table_and_array_both_empty":689,"Viewport":604,"manifest_navigator_candidates":638,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"on.update":741,"get_definition_from_app":735,"font":353,"fw_app":"driver","sy":469,"manifest_navigator_down":635,"on":1,"initialize_manifest_navigator":773,"on_handle":547,"Manifest_navigator":495,"on_text":539,"on.mouse_press":722,"update_editor_box":711,"sx":544,"vx":545,"box_height":680,"schema1_of_y":667,"compute_layout":385,"on.key_release":720,"on.code_change":734,"y_of_schema1":364,"mouse_cursor":558,"Mouse_cursor":559,"add_hotkey_to_menu":616,"set_mouse_cursor":562,"Page":475,"draw_ticks":663,"on.mouse_release":721,"approximate":579,"tick_spec":660,"Menu_border_color":612,"scale":712,"on.text_input":521,"add_def_to_menu":640,"on.save_settings":742,"order_of_magnitude":573,"initialize_editor":678,"line_height":365,"Animating":770,"new_definition":767,"Cursor_node":172,"on.initialize":695,"draw_cursor":639,"A":713,"fw_parent":772,"manifest_navigator_up":628,"add_thick_line":400,"B":379,"copy_shape":396,"approximate_up":658,"manifest_coord":636,"on.keychord_press":739,"draw_menu_bar":641,"on.code_submit":766,"Ticks_font":669,"keychord_press_on_manifest_navigator":765,"Definitions":503,"manifest_index":637}
load_definition = function(name)
move_candidate_to_front_of_manifest(name)
if Cursor_node then
Cursor_node.show_cursor = false
end
-- just one copy per definition for now
if Definitions[name] == nil then
Definitions[name] = {
type='text',
data=load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+")),
x=0, y=0,
width=600,
bg={r=0.7,g=0.7,b=1},
}
end
Viewport.x = Definitions[name].x-30
Viewport.y = Definitions[name].y-30
Cursor_node = Definitions[name]
Cursor_node.show_cursor = true
end
{"approximate_up":658,"Ticks_font":669,"on.mouse_release":836,"on.save_settings":742,"on.load_settings":782,"table_and_array_both_empty":689,"on.text_input":834,"line_height":365,"box_height":680,"compute_layout":385,"on.code_change":820,"add_thick_line":400,"Cursor_node":172,"scale":712,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Animating":813,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Surface":422,"initialize_editor":678,"get_multiple_definitions_from_app":783,"load_from_iterator":670,"copy_shape":396,"get_definition_from_app":784,"wait_for_response":781,"Viewport":604,"fw_app":"driver","Manifest_navigator":495,"manifest_navigator_up":628,"on.initialize":807,"manifest_navigator_down":635,"B":830,"on.mouse_press":722,"delete_definition":673,"fw_parent":835,"move_candidate_to_front_of_manifest":632,"sx":544,"keychord_press_on_manifest_navigator":765,"manifest_coord":636,"on.keychord_press":828,"draw_run_time_error":808,"draw_cursor":639,"Manifest":769,"Page":475,"manifest_index":637,"on.key_release":720,"manifest_navigator_candidates":638,"animate_next":809,"get_manifest":768,"add_def_to_menu":640,"on_text":539,"load_manifest":694,"on":1,"animate_next_frame":825,"mouse_cursor":558,"reset_manifest_navigator":772,"new_definition":821,"on_handle":547,"Definitions":503,"sy":469,"set_mouse_cursor":562,"on.code_submit":787,"draw_ticks":663,"surface_bounds":814,"initialize_manifest_navigator":773,"approximate":579,"font":353,"survey_animation":827,"vy":546,"vx":545,"tick_spec":660,"maybe_update_key_in_definitions":529,"Spawn_point":822,"order_of_magnitude":573,"from_viewport":823,"update_editor_box":711,"interpolate_viewport":824,"on.update":835,"on.draw":797,"Mouse_cursor":559,"load_definition":716,"A":831,"text_input_on_manifest_navigator":634,"y_of_schema1":364,"schema1_of_y":667}
{"load_definition":716,"Manifest":769,"load_manifest":694,"get_manifest":768,"on.draw":565,"delete_definition":673,"Menu_background_color":611,"move_candidate_to_front_of_manifest":632,"on.load_settings":700,"Surface":422,"Menu_command_color":613,"text_input_on_manifest_navigator":634,"Menu_highlight_color":614,"vy":546,"table_and_array_both_empty":689,"Viewport":604,"manifest_navigator_candidates":638,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"on.update":741,"get_definition_from_app":735,"font":353,"fw_app":"driver","sy":469,"manifest_navigator_down":635,"on":1,"on_handle":547,"Manifest_navigator":495,"on_text":539,"on.mouse_press":722,"update_editor_box":711,"sx":544,"vx":545,"box_height":680,"schema1_of_y":667,"compute_layout":385,"on.key_release":720,"on.code_change":734,"y_of_schema1":364,"mouse_cursor":558,"Mouse_cursor":559,"add_hotkey_to_menu":616,"set_mouse_cursor":562,"Page":475,"draw_ticks":663,"on.mouse_release":721,"approximate":579,"tick_spec":660,"Menu_border_color":612,"scale":712,"on.text_input":521,"add_def_to_menu":640,"on.save_settings":742,"order_of_magnitude":573,"initialize_editor":678,"line_height":365,"Animating":770,"new_definition":767,"Cursor_node":172,"on.initialize":695,"draw_cursor":639,"A":713,"fw_parent":771,"manifest_navigator_up":628,"add_thick_line":400,"B":379,"copy_shape":396,"approximate_up":658,"manifest_coord":636,"on.keychord_press":739,"draw_menu_bar":641,"on.code_submit":766,"Ticks_font":669,"keychord_press_on_manifest_navigator":765,"Definitions":503,"manifest_index":637}
get_multiple_definitions_from_app = function(defs)
-- batch interface for speed
-- turn an array of string names into a table of string definitions corresponding to them
if #defs == 0 then return {} end
live.send_to_app('GET* '..table.concat(defs, ' '))
local response = wait_for_response()
local result = {}
for def in response:gmatch('(.-)\n==fw: definition boundary==\n') do
local name = live.get_cmd_from_buffer(def)
result[name] = def
end
return result
end
get_manifest = function()
live.send_to_app('MANIFEST')
local response
repeat
love.timer.sleep(0.01)
response = live.receive_from_app()
until response
local result = {}
if #response == 0 then
-- error; retry
return result
else
-- stop retrying
Manifest_navigator.reload = false
end
local app_name
local manifest_version = json.decode(response)
for name, value in pairs(manifest_version) do
if not starts_with(name, 'fw_') then
table.insert(result, name)
elseif name == 'fw_app' then
app_name = value
end
end
return result, app_name
end
{"on.key_release":720,"order_of_magnitude":573,"load_definition":716,"approximate":579,"mouse_cursor":558,"Mouse_cursor":559,"on.save_settings":742,"load_manifest":694,"on.load_settings":700,"approximate_up":658,"draw_ticks":663,"Ticks_font":669,"Definitions":503,"new_definition":767,"fw_parent":770,"fw_app":"driver","update_editor_box":711,"line_height":365,"Animating":770,"schema1_of_y":667,"Menu_background_color":611,"Manifest_navigator":495,"Menu_border_color":612,"Menu_command_color":613,"y_of_schema1":364,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"scale":712,"num_lines_for_manifest_navigator":676,"on.draw":565,"reset_manifest_navigator":621,"load_from_iterator":670,"get_definition_from_app":735,"on.text_input":521,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.mouse_release":721,"on.update":741,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"add_thick_line":400,"text_input_on_manifest_navigator":634,"copy_shape":396,"manifest_coord":636,"font":353,"maybe_update_key_in_definitions":529,"manifest_navigator_candidates":638,"on.code_submit":766,"add_def_to_menu":640,"sy":469,"on.initialize":695,"on.keychord_press":739,"Cursor_node":172,"delete_definition":673,"manifest_index":637,"Viewport":604,"table_and_array_both_empty":689,"initialize_editor":678,"on_handle":547,"compute_layout":385,"Surface":422,"on":1,"box_height":680,"on_text":539,"Manifest":769,"on.mouse_press":722,"tick_spec":660,"on.code_change":734,"A":713,"B":379,"sx":544,"Page":475,"vx":545,"draw_cursor":639,"vy":546,"get_manifest":768,"set_mouse_cursor":562}
{"table_and_array_both_empty":689,"zoom_in":920,"on.code_submit":787,"on.mouse_press":916,"on.mouse_release":836,"on.update":900,"initialize_manifest_navigator":773,"on.keychord_press":919,"load_manifest":694,"draw_cursor":639,"get_manifest":768,"get_multiple_definitions_from_app":783,"Menu_background_color":611,"wait_for_response":781,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"new_definition":848,"Menu_highlight_color":614,"draw_menu_bar":861,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"draw_run_time_error":808,"reset_manifest_navigator":772,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"survey_animation":906,"get_definition_from_app":784,"animate_next":914,"manifest_navigator_up":628,"undo_zoom_out":921,"manifest_navigator_down":635,"y_of_schema1":364,"on.text_input":855,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"surface_bounds":814,"manifest_coord":636,"on_text":539,"manifest_navigator_candidates":638,"manifest_index":637,"approximate_up":658,"add_def_to_menu":640,"sx":544,"from_viewport":823,"Page":475,"interpolate_viewport":843,"Viewport":604,"Spawn_point":822,"definition_background_color":859,"on.key_release":720,"Test_definition_background_color":858,"animate_next_frame":915,"B":830,"tick_spec":660,"vy":546,"scale":712,"add_thick_line":400,"Manifest":769,"copy_shape":396,"on.save_settings":742,"Mouse_cursor":559,"on_handle":547,"on.code_change":924,"Num_animation_frames":840,"set_mouse_cursor":562,"compute_layout":385,"draw_ticks":862,"Definition_background_color":849,"copy_viewport":866,"Manifest_navigator":495,"schema1_of_y":667,"fw_parent":923,"A":831,"fw_app":"driver","update_editor_box":711,"mouse_cursor":558,"order_of_magnitude":573,"Cursor_node":172,"load_definition":854,"Ticks_font":669,"on":1,"approximate":579,"on.initialize":807,"initialize_editor":678,"Surface":422,"box_height":680,"snapshot_canvas":913,"delete_definition":673,"Save_viewport":865,"Animating":842,"line_height":365,"font":353,"on.load_settings":782,"zoom_out":908,"sy":469,"Zoomed_out":869,"vx":545,"on.draw":917}
{"on.update":900,"Test_definition_background_color":858,"sx":544,"definition_background_color":859,"on.mouse_release":836,"add_thick_line":400,"on.key_release":720,"copy_shape":396,"manifest_navigator_up":628,"snapshot_canvas":913,"manifest_navigator_down":635,"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"move_candidate_to_front_of_manifest":632,"zoom_out":908,"keychord_press_on_manifest_navigator":765,"Zoomed_out":869,"set_mouse_cursor":562,"draw_load_time_error":929,"draw_ticks":862,"draw_test_failure_indicator":935,"manifest_index":637,"font":353,"manifest_navigator_candidates":638,"Surface":422,"add_def_to_menu":640,"order_of_magnitude":573,"on.draw":932,"vx":545,"approximate":579,"Viewport":604,"line_height":365,"Page":475,"approximate_up":658,"on":1,"Manifest_navigator":495,"on.keychord_press":919,"draw_run_time_error":808,"draw_cursor":639,"manifest_coord":636,"schema1_of_y":667,"survey_animation":906,"on.initialize":807,"animate_next":914,"A":831,"on.code_submit":927,"on.mouse_press":916,"Manifest":769,"load_definition":854,"animate_next_frame":915,"load_manifest":694,"update_editor_box":711,"get_manifest":768,"initialize_editor":678,"compute_layout":385,"box_height":680,"tick_spec":660,"Menu_background_color":611,"initialize_manifest_navigator":773,"Definitions":503,"on.save_settings":742,"new_definition":848,"on.load_settings":782,"Menu_highlight_color":614,"get_multiple_definitions_from_app":783,"draw_menu_bar":861,"text_input_on_manifest_navigator":634,"add_hotkey_to_menu":616,"Spawn_point":822,"Failing_test_definition_background_color":925,"from_viewport":823,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"vy":546,"wait_for_response":781,"reset_manifest_navigator":772,"maybe_update_key_in_definitions":529,"scale":712,"load_from_iterator":670,"B":830,"get_definition_from_app":784,"y_of_schema1":364,"Ticks_font":669,"sy":469,"surface_bounds":814,"Cursor_node":172,"zoom_in":920,"undo_zoom_out":921,"mouse_cursor":558,"fw_parent":934,"Num_animation_frames":840,"fw_app":"driver","table_and_array_both_empty":689,"Mouse_cursor":559,"on_handle":547,"Menu_command_color":613,"draw_manifest_navigator":677,"on.code_change":924,"Animating":842,"on_text":539,"Definition_background_color":849,"Menu_border_color":612,"delete_definition":673}
on.keychord_press = function(chord, key)
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
A()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
A()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
A()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
on.keychord_press = function(chord, key)
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"on.key_release":720,"order_of_magnitude":573,"load_definition":716,"approximate":579,"mouse_cursor":558,"Mouse_cursor":559,"on.save_settings":742,"load_manifest":694,"on.load_settings":700,"approximate_up":658,"draw_ticks":663,"Ticks_font":669,"Definitions":503,"new_definition":767,"fw_parent":769,"fw_app":"driver","update_editor_box":711,"line_height":365,"Animating":770,"schema1_of_y":667,"Menu_background_color":611,"Manifest_navigator":495,"Menu_border_color":612,"Menu_command_color":613,"y_of_schema1":364,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"scale":712,"num_lines_for_manifest_navigator":676,"on.draw":565,"reset_manifest_navigator":621,"load_from_iterator":670,"get_definition_from_app":735,"on.text_input":521,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.mouse_release":721,"on.update":741,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"add_thick_line":400,"text_input_on_manifest_navigator":634,"copy_shape":396,"manifest_coord":636,"font":353,"maybe_update_key_in_definitions":529,"manifest_navigator_candidates":638,"on.code_submit":766,"--":727,"add_def_to_menu":640,"sy":469,"on.initialize":695,"on.keychord_press":739,"Cursor_node":172,"delete_definition":673,"manifest_index":637,"Viewport":604,"table_and_array_both_empty":689,"initialize_editor":678,"on_handle":547,"compute_layout":385,"Surface":422,"on":1,"box_height":680,"on_text":539,"Manifest":769,"on.mouse_press":722,"tick_spec":660,"on.code_change":734,"A":713,"B":379,"sx":544,"Page":475,"vx":545,"draw_cursor":639,"vy":546,"get_manifest":768,"set_mouse_cursor":562}
initialize_editor = function(obj)
if obj.w then
-- use an editor to wrap the text
local scaled_fontsize = scale(20)
local scaled_lineheight = math.floor(scaled_fontsize*1.3)
obj.editor = edit.initialize_state(Menu_bar_height + vy(obj.y), math.floor(vx(obj.x)), math.ceil(vx(obj.x+obj.w)), scaled_fontsize, scaled_lineheight)
obj.editor.lines = load_array(obj.data)
Text.redraw_all(obj.editor)
end
end
{"Manifest":769,"Viewport":604,"approximate":579,"snapshot_canvas":913,"get_manifest":768,"copy_viewport":866,"on.save_settings":742,"sy":469,"approximate_up":658,"Definitions":503,"update_editor_box":711,"new_definition":848,"on.code_submit":787,"table_and_array_both_empty":689,"zoom_in":920,"Page":475,"schema1_of_y":667,"initialize_manifest_navigator":773,"y_of_schema1":364,"get_multiple_definitions_from_app":783,"wait_for_response":781,"Menu_background_color":611,"Menu_border_color":612,"on.text_input":855,"box_height":680,"fw_parent":920,"compute_layout":385,"fw_app":"driver","on.code_change":820,"on_text":539,"survey_animation":906,"animate_next":914,"scale":712,"sx":544,"undo_zoom_out":921,"vx":545,"load_from_iterator":670,"from_viewport":823,"get_definition_from_app":784,"Surface":422,"on_handle":547,"Ticks_font":669,"draw_menu_bar":861,"manifest_navigator_up":628,"copy_shape":396,"manifest_navigator_down":635,"surface_bounds":814,"Save_viewport":865,"delete_definition":673,"font":353,"move_candidate_to_front_of_manifest":632,"draw_cursor":639,"keychord_press_on_manifest_navigator":765,"on.update":900,"text_input_on_manifest_navigator":634,"Spawn_point":822,"zoom_out":908,"manifest_coord":636,"on.mouse_release":836,"manifest_index":637,"animate_next_frame":915,"manifest_navigator_candidates":638,"initialize_editor":678,"interpolate_viewport":843,"add_def_to_menu":640,"on.load_settings":782,"A":831,"maybe_update_key_in_definitions":529,"order_of_magnitude":573,"on.initialize":807,"on":1,"add_thick_line":400,"load_manifest":694,"on.key_release":720,"on.keychord_press":919,"Menu_highlight_color":614,"Num_animation_frames":840,"draw_run_time_error":808,"reset_manifest_navigator":772,"on.mouse_press":916,"num_lines_for_manifest_navigator":676,"draw_manifest_navigator":677,"mouse_cursor":558,"add_hotkey_to_menu":616,"Mouse_cursor":559,"tick_spec":660,"Definition_background_color":849,"Manifest_navigator":495,"set_mouse_cursor":562,"vy":546,"draw_ticks":862,"Test_definition_background_color":858,"Cursor_node":172,"definition_background_color":859,"Animating":842,"Menu_command_color":613,"Zoomed_out":869,"line_height":365,"B":830,"on.draw":917,"load_definition":854}
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":993,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":994,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":992,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":996,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":997,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":992,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
{"load_manifest":694,"get_manifest":768,"vx":545,"Viewport":604,"vy":956,"scale":712,"new_definition":848,"Save_viewport":865,"Menu_background_color":611,"copy_viewport":866,"Menu_border_color":612,"on.mouse_release":836,"zoom_out":908,"on.update":945,"Menu_highlight_color":614,"Animating":842,"draw_menu_bar":861,"add_hotkey_to_menu":616,"Page":475,"zoom_in":920,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"on.code_change":924,"load_from_iterator":670,"get_definition_from_app":784,"Cursor_node":172,"manifest_navigator_down":635,"on_handle":547,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"on_text":539,"keychord_press_on_manifest_navigator":765,"fw_parent":1014,"text_input_on_manifest_navigator":634,"fw_app":"driver","on":1,"sx":955,"manifest_index":637,"Definitions":503,"manifest_navigator_candidates":638,"Menu_command_color":613,"Test_definition_background_color":858,"line_height":365,"manifest_coord":636,"schema1_of_y":667,"manifest_navigator_up":628,"y_of_schema1":364,"update_editor_box":711,"animate_next_frame":915,"on.key_release":720,"on.draw":986,"mouse_cursor":558,"on.code_submit":947,"Mouse_cursor":559,"Surface":422,"on.keychord_press":919,"snapshot_canvas":913,"set_mouse_cursor":562,"surface_bounds":814,"draw_ticks":997,"initialize_manifest_navigator":773,"Num_animation_frames":840,"add_thick_line":400,"tick_spec":998,"copy_shape":396,"draw_test_failure_indicator":935,"get_multiple_definitions_from_app":783,"Spawn_point":822,"order_of_magnitude":573,"from_viewport":823,"wait_for_response":781,"interpolate_viewport":843,"get_default_map":937,"approximate":579,"font":353,"B":830,"draw_load_time_error":929,"add_def_to_menu":640,"sy":954,"on.text_input":855,"undo_zoom_out":921,"Failing_test_definition_background_color":925,"approximate_up":985,"initialize_editor":678,"maybe_update_key_in_definitions":529,"box_height":680,"draw_run_time_error":808,"Ticks_font":669,"reset_manifest_navigator":772,"iscale":953,"Manifest_navigator":495,"survey_animation":1014,"on.load_settings":940,"animate_next":914,"Zoomed_out":869,"compute_layout":385,"draw_cursor":639,"on.save_settings":742,"table_and_array_both_empty":689,"Definition_background_color":849,"on.mouse_press":916,"test_approximate_up":983,"on.initialize":948,"load_definition":854,"A":831,"Manifest":769,"definition_background_color":1015}
{"manifest_navigator_down":635,"line_height":365,"delete_definition":673,"add_thick_line":400,"copy_shape":396,"fw_parent":1017,"draw_run_time_error":808,"on_handle":547,"box_height":680,"compute_layout":385,"survey_animation":1014,"on_text":539,"on.load_settings":940,"sx":955,"table_and_array_both_empty":689,"font":353,"on.key_release":720,"text_input_on_manifest_navigator":634,"surface_bounds":814,"manifest_index":637,"on.initialize":948,"mouse_cursor":558,"A":1017,"Mouse_cursor":559,"initialize_editor":678,"B":1018,"set_mouse_cursor":562,"draw_ticks":997,"get_definition_from_app":784,"on.update":945,"on.draw":986,"Animating":842,"undo_zoom_out":921,"order_of_magnitude":573,"Failing_test_definition_background_color":925,"animate_next_frame":915,"zoom_out":908,"initialize_manifest_navigator":773,"approximate":579,"tick_spec":998,"Definitions":503,"Num_animation_frames":840,"add_def_to_menu":640,"draw_load_time_error":929,"load_manifest":694,"draw_test_failure_indicator":935,"scale":712,"approximate_up":985,"manifest_navigator_candidates":638,"zoom_in":920,"on.keychord_press":919,"Definition_background_color":849,"Ticks_font":669,"manifest_coord":636,"load_definition":854,"Menu_border_color":612,"Test_definition_background_color":858,"interpolate_viewport":843,"definition_background_color":1015,"keychord_press_on_manifest_navigator":765,"from_viewport":823,"sy":954,"move_candidate_to_front_of_manifest":632,"Spawn_point":822,"on.save_settings":742,"update_editor_box":711,"Surface":422,"wait_for_response":781,"fw_app":"driver","iscale":953,"snapshot_canvas":913,"vx":545,"Save_viewport":865,"Manifest_navigator":495,"copy_viewport":866,"on.code_change":924,"vy":956,"Menu_background_color":611,"test_approximate_up":983,"Zoomed_out":869,"y_of_schema1":364,"on.mouse_press":916,"on.code_submit":947,"Menu_highlight_color":614,"animate_next":914,"draw_menu_bar":861,"draw_cursor":639,"add_hotkey_to_menu":616,"Manifest":769,"get_default_map":937,"draw_manifest_navigator":677,"Page":475,"num_lines_for_manifest_navigator":676,"get_manifest":768,"on":1,"reset_manifest_navigator":772,"get_multiple_definitions_from_app":1016,"schema1_of_y":667,"load_from_iterator":670,"maybe_update_key_in_definitions":529,"Cursor_node":172,"on.mouse_release":836,"new_definition":848,"Viewport":604,"Menu_command_color":613,"manifest_navigator_up":628,"on.text_input":855}
{"Manifest":769,"get_definition_from_app":735,"load_manifest":694,"get_manifest":768,"manifest_navigator_up":628,"manifest_navigator_down":635,"Manifest_navigator":495,"Definitions":503,"move_candidate_to_front_of_manifest":632,"new_definition":767,"A":713,"on_handle":547,"text_input_on_manifest_navigator":634,"on.mouse_release":721,"on.save_settings":742,"manifest_coord":636,"on_text":539,"manifest_index":637,"on.mouse_press":722,"manifest_navigator_candidates":638,"--":727,"add_def_to_menu":640,"sx":544,"maybe_update_key_in_definitions":529,"vx":545,"Cursor_node":172,"on.text_input":521,"on.key_release":720,"on.draw":565,"Viewport":604,"mouse_cursor":558,"Mouse_cursor":559,"add_thick_line":400,"copy_shape":396,"set_mouse_cursor":562,"draw_ticks":663,"on.keychord_press":739,"Animating":726,"Page":475,"compute_layout":385,"order_of_magnitude":573,"load_definition":716,"approximate":579,"Surface":422,"approximate_up":658,"box_height":680,"Ticks_font":669,"on.code_change":734,"fw_parent":768,"fw_app":"driver","line_height":365,"draw_cursor":639,"on.update":741,"schema1_of_y":667,"load_from_iterator":670,"scale":712,"add_hotkey_to_menu":616,"vy":546,"Menu_background_color":611,"keychord_press_on_manifest_navigator":765,"Menu_border_color":612,"on.load_settings":700,"Menu_command_color":613,"update_editor_box":711,"Menu_highlight_color":614,"font":353,"draw_menu_bar":641,"on":1,"initialize_editor":678,"table_and_array_both_empty":689,"tick_spec":660,"draw_manifest_navigator":677,"on.code_submit":766,"num_lines_for_manifest_navigator":676,"delete_definition":673,"B":379,"reset_manifest_navigator":621,"y_of_schema1":364,"on.initialize":695,"sy":469}
on.keychord_press = function(chord, key)
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
draw_manifest_navigator = function()
App.color(Menu_command_color)
local filter_text = to_hud_text(Manifest_navigator.filter)
App.screen.draw(filter_text, 5, 5)
App.color(Menu_background_color)
love.graphics.rectangle('fill', 0,Menu_bar_height, App.screen.width, Manifest_navigator.num_lines * (HUD_line_height + --[[highlight padding]]5))
local x,y = 5, Menu_bar_height
for i,definition in ipairs(Manifest_navigator.candidates) do
x,y = add_def_to_menu(x,y, definition, i == Manifest_navigator.index)
if Menu_cursor >= App.screen.width - 5 then
break
end
end
Manifest_navigator.bottom_y = y + HUD_line_height + --[[highlight padding]] 5
end
draw_cursor(5 + filter_text:getWidth(), 5)
{"get_manifest":768,"load_from_iterator":670,"get_definition_from_app":735,"Definitions":503,"new_definition":767,"manifest_navigator_down":635,"draw_cursor":639,"delete_definition":673,"text_input_on_manifest_navigator":634,"maybe_update_key_in_definitions":529,"manifest_coord":636,"scale":712,"manifest_navigator_candidates":638,"add_def_to_menu":640,"on.code_submit":766,"Surface":422,"on.draw":565,"on_handle":547,"on.key_release":720,"font":353,"on_text":539,"on":1,"sx":544,"tick_spec":660,"draw_ticks":663,"on.initialize":695,"add_thick_line":400,"A":713,"copy_shape":396,"mouse_cursor":558,"load_definition":716,"compute_layout":385,"fw_parent":767,"set_mouse_cursor":562,"fw_app":"driver","on.save_settings":742,"approximate_up":658,"order_of_magnitude":573,"vx":545,"Menu_highlight_color":614,"Viewport":604,"table_and_array_both_empty":689,"approximate":579,"vy":546,"draw_manifest_navigator":677,"y_of_schema1":364,"reset_manifest_navigator":621,"on.text_input":521,"on.mouse_release":721,"--":727,"Ticks_font":669,"sy":469,"on.keychord_press":739,"line_height":365,"manifest_navigator_up":628,"B":379,"Page":475,"Menu_border_color":612,"Menu_background_color":611,"move_candidate_to_front_of_manifest":632,"Animating":726,"Cursor_node":172,"initialize_editor":678,"Manifest_navigator":495,"on.mouse_press":722,"update_editor_box":711,"on.update":741,"on.load_settings":700,"keychord_press_on_manifest_navigator":765,"add_hotkey_to_menu":616,"Mouse_cursor":559,"draw_menu_bar":641,"on.code_change":734,"box_height":680,"schema1_of_y":667,"Menu_command_color":613,"Manifest":494,"manifest_index":637,"num_lines_for_manifest_navigator":676,"load_manifest":694}
{"on.key_release":720,"Menu_background_color":611,"Menu_border_color":612,"compute_layout":385,"Menu_command_color":613,"draw_run_time_error":808,"mouse_cursor":558,"draw_menu_bar":641,"Mouse_cursor":559,"add_hotkey_to_menu":616,"survey_animation":827,"Animating":813,"animate_next":809,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"animate_next_frame":825,"load_from_iterator":670,"on.code_change":820,"order_of_magnitude":573,"manifest_navigator_up":628,"approximate":579,"manifest_navigator_down":635,"font":353,"delete_definition":673,"fw_app":"driver","keychord_press_on_manifest_navigator":765,"Spawn_point":822,"text_input_on_manifest_navigator":634,"from_viewport":823,"scale":712,"interpolate_viewport":824,"Ticks_font":669,"maybe_update_key_in_definitions":529,"manifest_navigator_candidates":638,"on.text_input":834,"add_def_to_menu":640,"B":830,"on.draw":797,"vx":545,"Viewport":604,"update_editor_box":711,"vy":546,"on.mouse_release":721,"on.update":835,"on.keychord_press":828,"tick_spec":660,"Manifest":769,"Page":475,"schema1_of_y":667,"Manifest_navigator":495,"new_definition":821,"line_height":365,"load_definition":716,"Menu_highlight_color":614,"A":831,"y_of_schema1":364,"sy":469,"initialize_editor":678,"on.initialize":807,"box_height":680,"approximate_up":658,"manifest_index":637,"Surface":422,"surface_bounds":814,"on.save_settings":742,"on.code_submit":787,"on.load_settings":782,"get_manifest":768,"Cursor_node":172,"draw_manifest_navigator":677,"Definitions":503,"get_multiple_definitions_from_app":783,"on_handle":547,"initialize_manifest_navigator":773,"move_candidate_to_front_of_manifest":632,"on":1,"load_manifest":694,"on_text":539,"set_mouse_cursor":562,"on.mouse_press":722,"table_and_array_both_empty":689,"draw_cursor":639,"manifest_coord":636,"wait_for_response":781,"sx":544,"fw_parent":834,"get_definition_from_app":784,"add_thick_line":400,"draw_ticks":663,"copy_shape":396}
on.keychord_press = function(chord, key)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
print('a', Cursor_node.editor.line_cache[1])
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"keychord_press_on_manifest_navigator":765,"on.mouse_press":722,"reset_manifest_navigator":621,"fw_parent":766,"on.update":741,"fw_app":"driver","get_definition_from_app":735,"copy_shape":396,"load_definition":716,"Page":475,"on.code_submit":766,"on.save_settings":742,"on.keychord_press":739,"on_handle":547,"font":353,"on_text":539,"initialize_editor":678,"sx":544,"box_height":680,"compute_layout":385,"update_editor_box":711,"on.key_release":720,"schema1_of_y":667,"mouse_cursor":558,"on.draw":565,"Mouse_cursor":559,"vx":545,"y_of_schema1":364,"Animating":726,"set_mouse_cursor":562,"vy":546,"order_of_magnitude":573,"--":727,"approximate":579,"manifest_navigator_up":628,"approximate_up":658,"manifest_navigator_down":635,"num_lines_for_manifest_navigator":676,"table_and_array_both_empty":689,"delete_definition":673,"Ticks_font":669,"move_candidate_to_front_of_manifest":632,"on.code_change":734,"sy":469,"text_input_on_manifest_navigator":634,"add_hotkey_to_menu":616,"Definitions":503,"manifest_coord":636,"draw_cursor":639,"manifest_index":637,"on.load_settings":700,"manifest_navigator_candidates":638,"add_thick_line":400,"Menu_command_color":613,"add_def_to_menu":640,"Manifest_navigator":495,"Cursor_node":172,"A":713,"maybe_update_key_in_definitions":529,"draw_ticks":663,"on.initialize":695,"new_definition":767,"Viewport":604,"scale":712,"load_from_iterator":670,"Menu_background_color":611,"on.mouse_release":721,"Menu_border_color":612,"Surface":422,"Manifest":494,"line_height":365,"Menu_highlight_color":614,"load_manifest":694,"draw_menu_bar":641,"get_manifest":706,"tick_spec":660,"on.text_input":521,"B":379,"draw_manifest_navigator":677,"on":1}
get_manifest = function()
live.send_to_app('MANIFEST')
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
local result = {}
if #response_string == 0 then
-- error; retry
return result
else
-- stop retrying
Manifest_navigator.reload = false
end
local app_name
local response = json.decode(response_string)
for name, value in pairs(response) do
if not starts_with(name, 'fw_') then
table.insert(result, name)
elseif name == 'fw_app' then
app_name = value
end
end
return result, app_name
end
on.keychord_press = function(chord, key)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
if vy(node.y) > 0 then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, -vy(node.y))
end
if node.editor.font_height ~= scale(20) then
edit.update_font_settings(node.editor, scale(20))
end
node.editor.right = math.ceil(vx(node.x+node.w))
node.editor.width = node.editor.right - node.editor.left
end
node.editor.left = math.floor(vx(node.x)) + Line_number_width*App.width('m')
{"reset_manifest_navigator":621,"sy":469,"scale":712,"get_definition_from_app":735,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"A":713,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"font":353,"Surface":422,"manifest_coord":636,"draw_cursor":639,"manifest_index":637,"manifest_navigator_candidates":638,"on.update":741,"Viewport":604,"add_def_to_menu":640,"load_manifest":694,"get_manifest":706,"Definitions":503,"new_definition":681,"Page":475,"maybe_update_key_in_definitions":529,"update_editor_box":711,"Cursor_node":172,"approximate":579,"box_height":680,"on.keychord_press":739,"compute_layout":385,"on":1,"move_candidate_to_front_of_manifest":632,"on.code_change":734,"y_of_schema1":364,"on_text":539,"vx":545,"on.mouse_press":722,"on.mouse_release":721,"Menu_border_color":612,"Ticks_font":669,"draw_ticks":663,"sx":544,"on.initialize":695,"tick_spec":660,"order_of_magnitude":573,"load_definition":716,"on.code_submit":766,"fw_app":"driver","line_height":365,"on.key_release":720,"Menu_highlight_color":614,"on.draw":565,"on_handle":547,"on.text_input":521,"draw_menu_bar":641,"Animating":726,"Manifest":494,"initialize_editor":678,"mouse_cursor":558,"schema1_of_y":667,"Mouse_cursor":559,"vy":546,"fw_parent":765,"Menu_background_color":611,"set_mouse_cursor":562,"Manifest_navigator":495,"Menu_command_color":613,"add_thick_line":400,"on.save_settings":742,"copy_shape":396,"on.load_settings":700,"load_from_iterator":670,"add_hotkey_to_menu":616,"B":379,"approximate_up":658,"draw_manifest_navigator":677,"table_and_array_both_empty":689,"num_lines_for_manifest_navigator":676,"--":727}
on.mouse_release = function(x,y, mouse_button)
if Pan then
Pan = nil
elseif Move then
Move = nil
elseif Cursor_node then
Cursor_node.show_cursor = true
edit.mouse_release(Cursor_node.editor, x,y, mouse_button)
end
end
{"draw_run_time_error":808,"mouse_cursor":558,"Mouse_cursor":559,"tick_spec":660,"animate_next":809,"set_mouse_cursor":562,"draw_ticks":663,"Surface":422,"animate_next_frame":825,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"load_definition":716,"sy":469,"surface_bounds":814,"approximate":579,"on.mouse_press":722,"box_height":680,"on.save_settings":742,"on.load_settings":782,"approximate_up":658,"Manifest_navigator":495,"interpolate_viewport":824,"on.code_change":820,"table_and_array_both_empty":689,"Cursor_node":172,"load_manifest":694,"get_manifest":768,"on.text_input":521,"Definitions":503,"font":353,"new_definition":821,"compute_layout":385,"on.draw":797,"Menu_background_color":611,"initialize_editor":678,"Menu_border_color":612,"Menu_command_color":613,"Animating":813,"maybe_update_key_in_definitions":529,"Page":475,"draw_menu_bar":641,"add_hotkey_to_menu":616,"draw_cursor":639,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"on.mouse_release":721,"initialize_manifest_navigator":773,"on.code_submit":787,"on.key_release":720,"get_definition_from_app":784,"on_handle":547,"scale":712,"on.initialize":807,"Ticks_font":669,"line_height":365,"on_text":539,"manifest_navigator_down":635,"move_candidate_to_front_of_manifest":632,"B":379,"delete_definition":673,"update_editor_box":711,"sx":544,"A":713,"vx":545,"manifest_navigator_up":628,"text_input_on_manifest_navigator":634,"load_from_iterator":670,"on":1,"manifest_coord":636,"schema1_of_y":667,"manifest_index":637,"get_multiple_definitions_from_app":783,"manifest_navigator_candidates":638,"Viewport":604,"on.update":802,"add_def_to_menu":640,"vy":546,"Manifest":769,"Menu_highlight_color":614,"from_viewport":823,"Spawn_point":822,"wait_for_response":781,"fw_app":"driver","fw_parent":826,"on.keychord_press":785,"keychord_press_on_manifest_navigator":765,"survey_animation":827,"y_of_schema1":364}
{"tick_spec":660,"on_handle":547,"on_text":539,"Menu_background_color":611,"on.mouse_press":722,"Menu_border_color":612,"Menu_command_color":613,"load_definition":716,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"box_height":680,"on.key_release":720,"num_lines_for_manifest_navigator":676,"on.save_settings":742,"on.load_settings":700,"A":713,"on.draw":565,"mouse_cursor":558,"y_of_schema1":364,"table_and_array_both_empty":689,"Viewport":604,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"on.mouse_release":721,"on.update":741,"--":727,"manifest_coord":636,"Page":475,"manifest_index":637,"sy":469,"approximate_up":658,"Animating":726,"scale":712,"copy_shape":396,"Ticks_font":669,"Manifest_navigator":495,"update_editor_box":711,"on.code_change":734,"on.text_input":521,"schema1_of_y":667,"on.initialize":695,"Manifest":494,"add_thick_line":400,"maybe_update_key_in_definitions":529,"load_manifest":694,"load_from_iterator":670,"get_manifest":706,"reset_manifest_navigator":621,"draw_cursor":639,"get_definition_from_app":735,"draw_manifest_navigator":677,"line_height":365,"B":379,"Definitions":503,"fw_parent":742,"new_definition":681,"fw_app":"driver","compute_layout":385,"set_mouse_cursor":562,"approximate":579,"manifest_navigator_candidates":638,"text_input_on_manifest_navigator":634,"font":353,"add_def_to_menu":640,"order_of_magnitude":573,"keychord_press_on_manifest_navigator":765,"initialize_editor":678,"move_candidate_to_front_of_manifest":632,"draw_ticks":663,"vy":546,"Cursor_node":172,"Mouse_cursor":559,"vx":545,"Surface":422,"sx":544,"on":1,"on.keychord_press":739}
{"box_height":680,"on.save_settings":742,"on.load_settings":764,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"get_manifest":750,"draw_manifest_navigator":677,"load_manifest":757,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"add_thick_line":400,"load_from_iterator":763,"Viewport":604,"get_definition_from_app":735,"vy":546,"manifest_navigator_up":628,"on.mouse_press":722,"on.mouse_release":721,"delete_definition":673,"A":713,"move_candidate_to_front_of_manifest":632,"on.keychord_press":739,"keychord_press_on_manifest_navigator":756,"text_input_on_manifest_navigator":634,"Animating":726,"manifest_coord":636,"manifest_index":637,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"update_editor_box":711,"sx":544,"on.key_release":720,"fw_parent":763,"on":1,"font":353,"Mouse_cursor":559,"definition_file":761,"on.code_change":753,"set_mouse_cursor":562,"Manifest_versions":749,"draw_ticks":663,"order_of_magnitude":573,"Manifest_navigator":495,"line_height":365,"vx":545,"Surface":422,"on.initialize":695,"manifest_navigator_down":635,"draw_cursor":639,"scale":712,"table_and_array_both_empty":689,"B":379,"on.text_input":521,"Cursor_node":172,"approximate_up":658,"maybe_update_key_in_definitions":529,"Manifest":748,"fw_app":"driver","approximate":579,"compute_layout":385,"Page":475,"sy":469,"schema1_of_y":667,"on.update":741,"on_handle":547,"--":727,"Definitions":503,"new_definition":745,"tick_spec":660,"initialize_editor":678,"Ticks_font":669,"load_definition":716,"y_of_schema1":364,"copy_shape":396,"on.draw":565,"mouse_cursor":558,"Menu_background_color":611}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
{"box_height":680,"on.save_settings":742,"on.load_settings":759,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"get_manifest":750,"draw_manifest_navigator":677,"load_manifest":757,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"add_thick_line":400,"load_from_iterator":763,"Viewport":604,"get_definition_from_app":735,"vy":546,"manifest_navigator_up":628,"on.mouse_press":722,"on.mouse_release":721,"delete_definition":673,"A":713,"move_candidate_to_front_of_manifest":632,"on.keychord_press":739,"keychord_press_on_manifest_navigator":756,"text_input_on_manifest_navigator":634,"Animating":726,"manifest_coord":636,"manifest_index":637,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"update_editor_box":711,"sx":544,"on.key_release":720,"fw_parent":762,"on":1,"font":353,"Mouse_cursor":559,"definition_file":761,"on.code_change":753,"set_mouse_cursor":562,"Manifest_versions":749,"draw_ticks":663,"order_of_magnitude":573,"Manifest_navigator":495,"line_height":365,"vx":545,"Surface":422,"on.initialize":695,"manifest_navigator_down":635,"draw_cursor":639,"scale":712,"table_and_array_both_empty":689,"B":379,"on.text_input":521,"Cursor_node":172,"approximate_up":658,"maybe_update_key_in_definitions":529,"Manifest":748,"fw_app":"driver","approximate":579,"compute_layout":385,"Page":475,"sy":469,"schema1_of_y":667,"on.update":741,"on_handle":547,"--":727,"Definitions":503,"new_definition":745,"tick_spec":660,"initialize_editor":678,"Ticks_font":669,"load_definition":716,"y_of_schema1":364,"copy_shape":396,"on.draw":565,"mouse_cursor":558,"Menu_background_color":611}
{"box_height":680,"on.save_settings":742,"on.load_settings":759,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"get_manifest":750,"draw_manifest_navigator":677,"load_manifest":757,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"add_thick_line":400,"load_from_iterator":762,"Viewport":604,"get_definition_from_app":735,"vy":546,"manifest_navigator_up":628,"on.mouse_press":722,"on.mouse_release":721,"delete_definition":673,"A":713,"move_candidate_to_front_of_manifest":632,"on.keychord_press":739,"keychord_press_on_manifest_navigator":756,"text_input_on_manifest_navigator":634,"Animating":726,"manifest_coord":636,"manifest_index":637,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"update_editor_box":711,"sx":544,"on.key_release":720,"fw_parent":761,"on":1,"font":353,"Mouse_cursor":559,"definition_file":761,"on.code_change":753,"set_mouse_cursor":562,"Manifest_versions":749,"draw_ticks":663,"order_of_magnitude":573,"Manifest_navigator":495,"line_height":365,"vx":545,"Surface":422,"on.initialize":695,"manifest_navigator_down":635,"draw_cursor":639,"scale":712,"table_and_array_both_empty":689,"B":379,"on.text_input":521,"Cursor_node":172,"approximate_up":658,"maybe_update_key_in_definitions":529,"Manifest":748,"fw_app":"driver","approximate":579,"compute_layout":385,"Page":475,"sy":469,"schema1_of_y":667,"on.update":741,"on_handle":547,"--":727,"Definitions":503,"new_definition":745,"tick_spec":660,"initialize_editor":678,"Ticks_font":669,"load_definition":716,"y_of_schema1":364,"copy_shape":396,"on.draw":565,"mouse_cursor":558,"Menu_background_color":611}
keychord_press_on_manifest_navigator = function(chord, key)
if chord == 'escape' then
reset_manifest_navigator()
elseif chord == 'return' then
if Manifest_navigator.delete then
delete_definition(Manifest_navigator.candidates[Manifest_navigator.index])
else
load_definition(Manifest_navigator.candidates[Manifest_navigator.index])
end
A()
reset_manifest_navigator()
elseif chord == 'backspace' then
local len = utf8.len(Manifest_navigator.filter)
local byte_offset = Text.offset(Manifest_navigator.filter, len)
Manifest_navigator.filter = string.sub(Manifest_navigator.filter, 1, byte_offset-1)
Manifest_navigator.index = 1
Manifest_navigator.candidates = manifest_navigator_candidates()
elseif chord == 'left' then
if Manifest_navigator.index > 1 then
Manifest_navigator.index = Manifest_navigator.index-1
end
elseif chord == 'right' then
if Manifest_navigator.index < #Manifest_navigator.candidates then
Manifest_navigator.index = Manifest_navigator.index+1
end
elseif chord == 'down' then
manifest_navigator_down()
elseif chord == 'up' then
manifest_navigator_up()
end
end
on.update = function(dt)
if Pan then
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
elseif Mouse_cursor ~= 'arrow' then
Mouse_cursor = 'arrow'
love.mouse.setCursor(love.mouse.getSystemCursor('arrow'))
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
A()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
{"on.code_change":924,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":784,"Definitions":503,"Zoomed_out":869,"manifest_navigator_up":628,"Manifest":769,"manifest_navigator_down":635,"zoom_in":920,"delete_definition":673,"get_manifest":768,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"maybe_update_key_in_definitions":529,"manifest_coord":636,"new_definition":848,"manifest_navigator_candidates":638,"fw_app":"driver","add_def_to_menu":640,"on.draw":917,"Cursor_node":172,"Failing_test_definition_background_color":925,"on_handle":547,"on.code_submit":927,"on":1,"on_text":539,"on.mouse_press":916,"tick_spec":660,"on.keychord_press":919,"get_multiple_definitions_from_app":783,"schema1_of_y":667,"vx":545,"wait_for_response":781,"copy_viewport":866,"zoom_out":908,"on.load_settings":782,"Surface":422,"mouse_cursor":558,"line_height":365,"Mouse_cursor":559,"Menu_highlight_color":614,"Save_viewport":865,"sx":544,"set_mouse_cursor":562,"box_height":680,"Viewport":604,"font":353,"on.key_release":720,"vy":546,"on.save_settings":742,"initialize_manifest_navigator":773,"scale":712,"on.initialize":807,"survey_animation":906,"load_definition":854,"animate_next":914,"Ticks_font":669,"table_and_array_both_empty":689,"approximate":579,"Page":475,"order_of_magnitude":573,"animate_next_frame":915,"update_editor_box":711,"load_manifest":694,"draw_ticks":862,"A":831,"fw_parent":926,"Manifest_navigator":495,"Num_animation_frames":840,"sy":469,"surface_bounds":814,"y_of_schema1":364,"compute_layout":385,"copy_shape":396,"manifest_index":637,"draw_cursor":639,"undo_zoom_out":921,"on.mouse_release":836,"Definition_background_color":849,"Menu_command_color":613,"Spawn_point":822,"Menu_background_color":611,"from_viewport":823,"Test_definition_background_color":858,"interpolate_viewport":843,"definition_background_color":859,"initialize_editor":678,"approximate_up":658,"Animating":842,"draw_menu_bar":861,"on.text_input":855,"add_hotkey_to_menu":616,"B":830,"Menu_border_color":612,"draw_manifest_navigator":677,"on.update":900,"num_lines_for_manifest_navigator":676,"snapshot_canvas":913,"draw_run_time_error":808,"reset_manifest_navigator":772}
{"box_height":680,"on.save_settings":742,"on.load_settings":759,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"get_manifest":750,"draw_manifest_navigator":677,"load_manifest":757,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"add_thick_line":400,"load_from_iterator":670,"Viewport":604,"get_definition_from_app":735,"vy":546,"manifest_navigator_up":628,"on.mouse_press":722,"on.mouse_release":721,"delete_definition":673,"A":713,"move_candidate_to_front_of_manifest":632,"on.keychord_press":739,"keychord_press_on_manifest_navigator":756,"text_input_on_manifest_navigator":634,"Animating":726,"manifest_coord":636,"manifest_index":637,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"update_editor_box":711,"sx":544,"on.key_release":720,"fw_parent":760,"on":1,"font":353,"Mouse_cursor":559,"definition_file":761,"on.code_change":753,"set_mouse_cursor":562,"Manifest_versions":749,"draw_ticks":663,"order_of_magnitude":573,"Manifest_navigator":495,"line_height":365,"vx":545,"Surface":422,"on.initialize":695,"manifest_navigator_down":635,"draw_cursor":639,"scale":712,"table_and_array_both_empty":689,"B":379,"on.text_input":521,"Cursor_node":172,"approximate_up":658,"maybe_update_key_in_definitions":529,"Manifest":748,"fw_app":"driver","approximate":579,"compute_layout":385,"Page":475,"sy":469,"schema1_of_y":667,"on.update":741,"on_handle":547,"--":727,"Definitions":503,"new_definition":745,"tick_spec":660,"initialize_editor":678,"Ticks_font":669,"load_definition":716,"y_of_schema1":364,"copy_shape":396,"on.draw":565,"mouse_cursor":558,"Menu_background_color":611}
{"y_of_schema1":364,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"add_def_to_menu":640,"box_height":680,"Manifest_navigator":495,"compute_layout":385,"on_text":539,"scale":712,"on":1,"sx":544,"add_thick_line":400,"on.key_release":720,"draw_run_time_error":808,"tick_spec":660,"load_manifest":694,"font":353,"survey_animation":863,"mouse_cursor":558,"Surface":422,"Mouse_cursor":559,"Definitions":503,"on.draw":797,"initialize_editor":678,"vx":545,"Viewport":604,"vy":546,"approximate":579,"surface_bounds":814,"on.save_settings":742,"on.mouse_release":836,"maybe_update_key_in_definitions":529,"on.update":835,"load_definition":854,"approximate_up":658,"table_and_array_both_empty":689,"Ticks_font":669,"interpolate_viewport":843,"order_of_magnitude":573,"draw_cursor":639,"Definition_background_color":849,"on.load_settings":782,"schema1_of_y":667,"on_handle":547,"line_height":365,"get_manifest":768,"definition_background_color":859,"on.text_input":855,"new_definition":848,"animate_next_frame":825,"on.initialize":807,"Manifest":769,"Num_animation_frames":840,"initialize_manifest_navigator":773,"on.keychord_press":828,"fw_parent":863,"B":830,"fw_app":"driver","Menu_background_color":611,"get_multiple_definitions_from_app":783,"Menu_border_color":612,"set_mouse_cursor":562,"Menu_command_color":613,"wait_for_response":781,"Menu_highlight_color":614,"on.code_submit":787,"snapshot_canvas":864,"add_hotkey_to_menu":616,"Test_definition_background_color":858,"draw_ticks":862,"draw_manifest_navigator":677,"Cursor_node":172,"sy":469,"on.code_change":820,"manifest_navigator_up":628,"reset_manifest_navigator":772,"update_editor_box":711,"Animating":842,"load_from_iterator":670,"Spawn_point":822,"get_definition_from_app":784,"draw_menu_bar":861,"Page":475,"num_lines_for_manifest_navigator":676,"animate_next":841,"on.mouse_press":722,"A":831,"manifest_navigator_down":635,"copy_shape":396,"from_viewport":823,"delete_definition":673}
num_lines_for_manifest_navigator = function(candidates)
local result = 1
local x = 5
for i,def in ipairs(candidates) do
if x + width > App.screen.width - 5 then
result = result+1
x = 5
end
x = x + width + 30
end
return result
end
local width = to_hud_text(def):getWidth()
{"B":830,"Menu_background_color":611,"vy":546,"Definitions":503,"Menu_command_color":613,"new_definition":848,"box_height":680,"draw_run_time_error":808,"draw_menu_bar":861,"on.mouse_release":836,"add_hotkey_to_menu":616,"on.save_settings":742,"survey_animation":863,"on.keychord_press":871,"animate_next":841,"num_lines_for_manifest_navigator":676,"Page":475,"reset_manifest_navigator":772,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"get_definition_from_app":784,"Zoomed_out":869,"manifest_navigator_up":628,"surface_bounds":814,"on.draw":797,"Num_animation_frames":840,"Spawn_point":822,"update_editor_box":711,"on_text":539,"Save_viewport":865,"on.mouse_press":722,"Definition_background_color":849,"Animating":842,"schema1_of_y":667,"vx":545,"scale":712,"definition_background_color":859,"y_of_schema1":364,"on.key_release":720,"copy_viewport":866,"Viewport":604,"mouse_cursor":558,"Mouse_cursor":559,"zoom_out":870,"delete_definition":673,"initialize_editor":678,"set_mouse_cursor":562,"from_viewport":823,"draw_ticks":862,"draw_cursor":639,"sy":469,"move_candidate_to_front_of_manifest":632,"font":353,"keychord_press_on_manifest_navigator":765,"manifest_navigator_down":635,"text_input_on_manifest_navigator":634,"manifest_index":637,"order_of_magnitude":573,"fw_parent":871,"on.code_change":820,"fw_app":"driver","add_thick_line":400,"manifest_navigator_candidates":638,"copy_shape":396,"approximate":579,"add_def_to_menu":640,"draw_manifest_navigator":677,"Test_definition_background_color":858,"snapshot_canvas":872,"manifest_coord":636,"Menu_highlight_color":614,"approximate_up":658,"wait_for_response":781,"Menu_border_color":612,"on.code_submit":787,"Cursor_node":172,"Ticks_font":669,"Manifest_navigator":495,"on":1,"on.initialize":807,"load_definition":854,"sx":544,"initialize_manifest_navigator":773,"on_handle":547,"on.update":835,"interpolate_viewport":843,"tick_spec":660,"line_height":365,"get_multiple_definitions_from_app":783,"on.text_input":855,"animate_next_frame":825,"compute_layout":385,"Manifest":769,"Surface":422,"A":831,"load_manifest":694,"on.load_settings":782,"get_manifest":768}
on.keychord_press = function(chord, key)
print('key', chord)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-g' then
-- special Expose-like 'global zoom' mode
if Zoomed_out == nil then
zoom_out()
else
undo_zoom_out()
end
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
if chord == 'return' then
A(--[[preserve screen_top of cursor node]] true)
else
B(--[[preserve screen_top of cursor node]] true)
end
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"on_handle":547,"B":379,"manifest_coord":636,"initialize_editor":678,"manifest_index":637,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"Animating":726,"Surface":422,"on.key_release":720,"fw_app":"driver","sy":469,"mouse_cursor":558,"update_editor_box":711,"Mouse_cursor":559,"tick_spec":660,"on.mouse_release":721,"draw_ticks":663,"Manifest_navigator":495,"Page":475,"y_of_schema1":364,"order_of_magnitude":573,"load_definition":716,"Manifest_versions":749,"approximate":579,"Manifest":748,"on.update":741,"on.save_settings":742,"on":1,"get_manifest":750,"approximate_up":658,"box_height":680,"Ticks_font":669,"Definitions":503,"new_definition":745,"add_thick_line":400,"copy_shape":396,"Cursor_node":172,"definition_file":760,"schema1_of_y":667,"load_manifest":757,"Menu_background_color":611,"Viewport":604,"Menu_border_color":612,"on.code_change":753,"Menu_command_color":613,"on.draw":565,"Menu_highlight_color":614,"set_mouse_cursor":562,"draw_menu_bar":641,"vy":546,"on.mouse_press":722,"A":713,"num_lines_for_manifest_navigator":676,"draw_manifest_navigator":677,"move_candidate_to_front_of_manifest":632,"compute_layout":385,"add_hotkey_to_menu":616,"on.load_settings":759,"reset_manifest_navigator":621,"font":353,"text_input_on_manifest_navigator":634,"maybe_update_key_in_definitions":529,"on.text_input":521,"--":727,"table_and_array_both_empty":689,"get_definition_from_app":735,"scale":712,"load_from_iterator":670,"manifest_navigator_up":628,"draw_cursor":639,"manifest_navigator_down":635,"on.keychord_press":739,"fw_parent":759,"delete_definition":673,"on_text":539,"on.initialize":695,"line_height":365,"keychord_press_on_manifest_navigator":756}
{"Page":475,"load_definition":716,"initialize_editor":678,"box_height":680,"Ticks_font":669,"fw_parent":758,"sy":469,"fw_app":"driver","on.load_settings":759,"table_and_array_both_empty":689,"Manifest_navigator":495,"compute_layout":385,"Manifest":748,"B":379,"get_manifest":750,"on.keychord_press":739,"Menu_background_color":611,"new_definition":745,"Menu_border_color":612,"Menu_command_color":613,"A":713,"Menu_highlight_color":614,"Definitions":503,"on":1,"add_hotkey_to_menu":616,"Animating":726,"on.mouse_press":722,"on.key_release":720,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"font":353,"load_from_iterator":670,"maybe_update_key_in_definitions":529,"get_definition_from_app":735,"on.text_input":521,"vx":545,"manifest_navigator_up":628,"manifest_navigator_down":635,"vy":546,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"order_of_magnitude":573,"keychord_press_on_manifest_navigator":756,"text_input_on_manifest_navigator":634,"on.update":741,"approximate":579,"draw_cursor":639,"manifest_index":637,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"line_height":365,"--":727,"on.mouse_release":721,"on.save_settings":742,"tick_spec":660,"Manifest_versions":749,"on_handle":547,"draw_ticks":663,"y_of_schema1":364,"manifest_coord":636,"on.initialize":695,"draw_manifest_navigator":677,"scale":712,"mouse_cursor":558,"approximate_up":658,"Mouse_cursor":559,"update_editor_box":711,"draw_menu_bar":641,"Surface":422,"set_mouse_cursor":562,"on.draw":565,"on.code_change":753,"Viewport":604,"copy_shape":396,"load_manifest":757,"add_thick_line":400,"schema1_of_y":667,"definition_file":758,"Cursor_node":172}
keychord_press_on_manifest_navigator = function(chord, key)
if chord == 'escape' then
reset_manifest_navigator()
elseif chord == 'return' then
if Manifest_navigator.for_delete then
delete_definition(Manifest_navigator.candidates[Manifest_navigator.index])
else
load_definition(Manifest_navigator.candidates[Manifest_navigator.index])
end
A()
reset_manifest_navigator()
elseif chord == 'backspace' then
local len = utf8.len(Manifest_navigator.filter)
local byte_offset = Text.offset(Manifest_navigator.filter, len)
Manifest_navigator.filter = string.sub(Manifest_navigator.filter, 1, byte_offset-1)
Manifest_navigator.index = 1
Manifest_navigator.candidates = manifest_navigator_candidates()
elseif chord == 'left' then
if Manifest_navigator.index > 1 then
Manifest_navigator.index = Manifest_navigator.index-1
end
elseif chord == 'right' then
if Manifest_navigator.index < #Manifest_navigator.candidates then
Manifest_navigator.index = Manifest_navigator.index+1
end
elseif chord == 'down' then
manifest_navigator_down()
elseif chord == 'up' then
manifest_navigator_up()
end
end
{"Page":475,"load_definition":716,"initialize_editor":678,"box_height":680,"Ticks_font":669,"fw_parent":757,"sy":469,"fw_app":"driver","on.load_settings":754,"table_and_array_both_empty":689,"Manifest_navigator":495,"compute_layout":385,"Manifest":748,"B":379,"get_manifest":750,"on.keychord_press":739,"Menu_background_color":611,"new_definition":745,"Menu_border_color":612,"Menu_command_color":613,"A":713,"Menu_highlight_color":614,"Definitions":503,"on":1,"add_hotkey_to_menu":616,"Animating":726,"on.mouse_press":722,"on.key_release":720,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"font":353,"load_from_iterator":670,"maybe_update_key_in_definitions":529,"get_definition_from_app":735,"on.text_input":521,"vx":545,"manifest_navigator_up":628,"manifest_navigator_down":635,"vy":546,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"order_of_magnitude":573,"keychord_press_on_manifest_navigator":756,"text_input_on_manifest_navigator":634,"on.update":741,"approximate":579,"draw_cursor":639,"manifest_index":637,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"line_height":365,"--":727,"on.mouse_release":721,"on.save_settings":742,"tick_spec":660,"Manifest_versions":749,"on_handle":547,"draw_ticks":663,"y_of_schema1":364,"manifest_coord":636,"on.initialize":695,"draw_manifest_navigator":677,"scale":712,"mouse_cursor":558,"approximate_up":658,"Mouse_cursor":559,"update_editor_box":711,"draw_menu_bar":641,"Surface":422,"set_mouse_cursor":562,"on.draw":565,"on.code_change":753,"Viewport":604,"copy_shape":396,"load_manifest":757,"add_thick_line":400,"schema1_of_y":667,"definition_file":758,"Cursor_node":172}
{"fw_parent":831,"surface_bounds":814,"font":353,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"Definitions":503,"text_input_on_manifest_navigator":634,"from_viewport":823,"manifest_coord":636,"interpolate_viewport":824,"manifest_index":637,"manifest_navigator_candidates":638,"Cursor_node":172,"copy_shape":396,"add_def_to_menu":640,"B":830,"maybe_update_key_in_definitions":529,"on.mouse_release":721,"on.key_release":720,"Animating":813,"mouse_cursor":558,"y_of_schema1":364,"Mouse_cursor":559,"on.text_input":832,"line_height":365,"draw_cursor":639,"set_mouse_cursor":562,"on.code_change":820,"draw_ticks":663,"on_text":539,"on.mouse_press":722,"scale":712,"order_of_magnitude":573,"sx":544,"vx":545,"approximate":579,"on":1,"approximate_up":658,"Ticks_font":669,"initialize_editor":678,"Manifest_navigator":495,"tick_spec":660,"Page":475,"on.keychord_press":828,"keychord_press_on_manifest_navigator":765,"schema1_of_y":667,"on.update":802,"wait_for_response":781,"on.code_submit":787,"on.initialize":807,"vy":546,"manifest_navigator_down":635,"load_manifest":694,"on_handle":547,"animate_next_frame":825,"Manifest":769,"initialize_manifest_navigator":773,"load_definition":716,"delete_definition":673,"sy":469,"update_editor_box":711,"Menu_background_color":611,"get_multiple_definitions_from_app":783,"Surface":422,"get_manifest":768,"Menu_command_color":613,"on.draw":797,"Menu_highlight_color":614,"draw_run_time_error":808,"draw_menu_bar":641,"Viewport":604,"add_hotkey_to_menu":616,"A":831,"survey_animation":827,"draw_manifest_navigator":677,"animate_next":809,"num_lines_for_manifest_navigator":676,"Menu_border_color":612,"compute_layout":385,"reset_manifest_navigator":772,"fw_app":"driver","box_height":680,"load_from_iterator":670,"new_definition":821,"get_definition_from_app":784,"Spawn_point":822,"on.save_settings":742,"add_thick_line":400,"on.load_settings":782,"manifest_navigator_up":628}
{"A":831,"move_candidate_to_front_of_manifest":632,"Spawn_point":822,"keychord_press_on_manifest_navigator":765,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"Mouse_cursor":559,"manifest_coord":636,"manifest_index":637,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":862,"add_def_to_menu":640,"line_height":365,"Definition_background_color":849,"box_height":680,"order_of_magnitude":573,"compute_layout":385,"definition_background_color":859,"on.code_change":924,"approximate":579,"load_manifest":694,"on":1,"get_manifest":768,"approximate_up":658,"snapshot_canvas":913,"Save_viewport":865,"draw_cursor":639,"Ticks_font":669,"zoom_out":908,"Zoomed_out":869,"update_editor_box":711,"initialize_editor":678,"zoom_in":920,"get_default_map":937,"on.mouse_press":916,"fw_app":"driver","on.save_settings":742,"num_lines_for_manifest_navigator":676,"Manifest_navigator":495,"on.code_submit":927,"initialize_manifest_navigator":773,"Menu_background_color":611,"animate_next_frame":915,"Menu_border_color":612,"y_of_schema1":364,"Menu_command_color":613,"Manifest":769,"Menu_highlight_color":614,"copy_viewport":866,"draw_menu_bar":861,"font":353,"add_hotkey_to_menu":616,"animate_next":914,"get_multiple_definitions_from_app":783,"Num_animation_frames":840,"survey_animation":906,"on.load_settings":940,"wait_for_response":781,"on.text_input":855,"fw_parent":944,"sx":544,"maybe_update_key_in_definitions":529,"vx":545,"sy":469,"load_definition":854,"scale":712,"Animating":842,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":660,"on.key_release":720,"on.draw":932,"Page":475,"draw_run_time_error":808,"new_definition":848,"undo_zoom_out":921,"add_thick_line":400,"B":830,"copy_shape":396,"on_handle":547,"Failing_test_definition_background_color":925,"vy":546,"draw_manifest_navigator":677,"draw_test_failure_indicator":935,"on_text":539,"draw_load_time_error":929,"table_and_array_both_empty":689,"reset_manifest_navigator":772,"Cursor_node":172,"on.mouse_release":836,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.keychord_press":919,"Viewport":604,"Test_definition_background_color":858,"surface_bounds":814,"manifest_navigator_up":628,"Definitions":503,"manifest_navigator_down":635,"Surface":422,"on.initialize":807,"delete_definition":673}
{"Menu_border_color":612,"Menu_command_color":613,"Animating":726,"Menu_highlight_color":614,"draw_menu_bar":641,"mouse_cursor":558,"add_hotkey_to_menu":616,"Mouse_cursor":559,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"draw_ticks":663,"reset_manifest_navigator":621,"scale":712,"load_from_iterator":670,"get_definition_from_app":735,"schema1_of_y":667,"manifest_navigator_up":628,"load_manifest":757,"manifest_navigator_down":635,"get_manifest":750,"y_of_schema1":364,"delete_definition":673,"definition_file":752,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":756,"Definitions":503,"text_input_on_manifest_navigator":634,"new_definition":745,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"add_def_to_menu":640,"approximate_up":658,"maybe_update_key_in_definitions":529,"font":353,"add_thick_line":400,"copy_shape":396,"tick_spec":660,"Cursor_node":172,"on_text":539,"on.text_input":521,"Surface":422,"on.draw":565,"load_definition":716,"Viewport":604,"on":1,"Menu_background_color":611,"on.initialize":695,"table_and_array_both_empty":689,"on.load_settings":754,"B":379,"initialize_editor":678,"compute_layout":385,"on.keychord_press":739,"A":713,"Ticks_font":669,"approximate":579,"vy":546,"on.key_release":720,"fw_parent":756,"on.code_change":753,"fw_app":"driver","draw_cursor":639,"update_editor_box":711,"on.update":741,"on_handle":547,"box_height":680,"Page":475,"Manifest_versions":749,"on.mouse_press":722,"set_mouse_cursor":562,"order_of_magnitude":573,"sx":544,"on.save_settings":742,"vx":545,"Manifest_navigator":495,"on.mouse_release":721,"--":727,"Manifest":748,"sy":469,"line_height":365}
draw_test_failure_indicator = function()
if Client_app_test_failures == nil then
return
end
if next(Client_app_test_failures, nil) == nil then
return
end
App.color(Failing_test_definition_background_color)
local border_width = App.screen.width/40, App.screen.height
love.graphics.rectangle('fill', 0,0, border_width,App.screen.height)
love.graphics.rectangle('fill', App.screen.width-border_width, 0, border_width, App.screen.height)
love.graphics.rectangle('fill', 0,App.screen.height-border_width, App.screen.width, border_width)
end
{"survey_animation":906,"on.save_settings":742,"fw_app":"driver","on.load_settings":940,"Spawn_point":822,"from_viewport":823,"y_of_schema1":364,"interpolate_viewport":843,"table_and_array_both_empty":689,"get_default_map":937,"Manifest_navigator":495,"move_candidate_to_front_of_manifest":632,"B":830,"text_input_on_manifest_navigator":634,"manifest_coord":636,"A":831,"Animating":842,"manifest_navigator_candidates":638,"Menu_background_color":611,"Num_animation_frames":840,"Menu_border_color":612,"on.mouse_press":916,"Menu_command_color":613,"Menu_highlight_color":614,"add_hotkey_to_menu":616,"on.code_change":924,"draw_ticks":862,"add_thick_line":400,"draw_menu_bar":861,"copy_shape":396,"Test_definition_background_color":858,"definition_background_color":859,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"vx":545,"maybe_update_key_in_definitions":529,"get_definition_from_app":784,"snapshot_canvas":913,"Save_viewport":865,"on.initialize":807,"copy_viewport":866,"zoom_out":908,"Ticks_font":669,"Viewport":604,"delete_definition":673,"Surface":422,"keychord_press_on_manifest_navigator":765,"on_handle":547,"zoom_in":920,"manifest_navigator_down":635,"Definitions":503,"manifest_navigator_up":628,"on_text":539,"surface_bounds":814,"on.code_submit":947,"on.update":945,"on.keychord_press":919,"Page":475,"sx":544,"load_from_iterator":670,"Manifest":769,"on.mouse_release":836,"Cursor_node":172,"load_manifest":694,"mouse_cursor":558,"get_manifest":768,"draw_load_time_error":929,"draw_test_failure_indicator":935,"vy":546,"Failing_test_definition_background_color":925,"animate_next_frame":915,"reset_manifest_navigator":772,"draw_run_time_error":808,"initialize_manifest_navigator":773,"new_definition":848,"Mouse_cursor":559,"on.key_release":720,"tick_spec":660,"schema1_of_y":667,"get_multiple_definitions_from_app":783,"scale":712,"update_editor_box":711,"Zoomed_out":869,"wait_for_response":781,"on":1,"compute_layout":385,"draw_cursor":639,"manifest_index":637,"approximate_up":658,"order_of_magnitude":573,"font":353,"on.draw":932,"animate_next":914,"sy":469,"approximate":579,"load_definition":854,"undo_zoom_out":921,"set_mouse_cursor":562,"Definition_background_color":849,"initialize_editor":678,"line_height":365,"box_height":680,"add_def_to_menu":640,"on.text_input":855,"fw_parent":946}
zoom_in = function(x,y)
-- precondition: Zoomed_out
-- precondition: Viewport == Global_viewport
-- precondition: Save_viewport exists
-- center Viewport on x,y at zoom level Saved_viewport.zoom
snapshot_canvas()
Animating = {
{
x=sx(x)-App.screen.width/Save_viewport.zoom/2,
y=sy(y)-App.screen.height/Save_viewport.zoom/2,
w=App.screen.width/Save_viewport.zoom,
h=App.screen.height/Save_viewport.zoom,
zoom=Save_viewport.zoom,
},
}
Zoomed_out = nil
Save_viewport = nil
end
maybe_update_key_in_definitions = function(old_definition_name, definition_name, Cursor_node)
print(old_definition_name, definition_name)
if old_definition_name ~= definition_name then
if old_definition_name == nil or Definitions[old_definition_name] ~= Cursor_node then
local pos = array.find(Definitions, Cursor_node)
print('found at index', pos)
assert(pos)
table.remove(Definitions, pos)
elseif Definitions[old_definition_name] == Cursor_node then
print('found at key', old_definition_name)
Definitions[old_definition_name] = nil
end
if definition_name and Definitions[definition_name] == nil then
print('moving to key', definition_name)
Definitions[definition_name] = Cursor_node
elseif definition_name == nil or Definitions[definition_name] then
-- temporary collision; try again later
-- deleting and reinserting is inefficient, but hopefully rare
print('moving to index', #Definitions+1)
table.insert(Definitions, Cursor_node)
end
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
end
end
{"Menu_border_color":612,"Menu_command_color":613,"Animating":726,"Menu_highlight_color":614,"draw_menu_bar":641,"mouse_cursor":558,"add_hotkey_to_menu":616,"Mouse_cursor":559,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"draw_ticks":663,"reset_manifest_navigator":621,"scale":712,"load_from_iterator":670,"get_definition_from_app":735,"schema1_of_y":667,"manifest_navigator_up":628,"load_manifest":755,"manifest_navigator_down":635,"get_manifest":750,"y_of_schema1":364,"delete_definition":673,"definition_file":752,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":756,"Definitions":503,"text_input_on_manifest_navigator":634,"new_definition":745,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"add_def_to_menu":640,"approximate_up":658,"maybe_update_key_in_definitions":529,"font":353,"add_thick_line":400,"copy_shape":396,"tick_spec":660,"Cursor_node":172,"on_text":539,"on.text_input":521,"Surface":422,"on.draw":565,"load_definition":716,"Viewport":604,"on":1,"Menu_background_color":611,"on.initialize":695,"table_and_array_both_empty":689,"on.load_settings":754,"B":379,"initialize_editor":678,"compute_layout":385,"on.keychord_press":739,"A":713,"Ticks_font":669,"approximate":579,"vy":546,"on.key_release":720,"fw_parent":755,"on.code_change":753,"fw_app":"driver","draw_cursor":639,"update_editor_box":711,"on.update":741,"on_handle":547,"box_height":680,"Page":475,"Manifest_versions":749,"on.mouse_press":722,"set_mouse_cursor":562,"order_of_magnitude":573,"sx":544,"on.save_settings":742,"vx":545,"Manifest_navigator":495,"on.mouse_release":721,"--":727,"Manifest":748,"sy":469,"line_height":365}
{"draw_cursor":639,"mouse_cursor":558,"fw_parent":878,"Mouse_cursor":559,"Definitions":503,"on.mouse_release":836,"set_mouse_cursor":562,"zoom_out":870,"draw_ticks":862,"load_manifest":694,"zoom_in":877,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"on.code_submit":787,"approximate":579,"add_thick_line":400,"y_of_schema1":364,"A":831,"approximate_up":658,"get_multiple_definitions_from_app":783,"Ticks_font":669,"on_handle":547,"wait_for_response":781,"Page":475,"on_text":539,"on.code_change":820,"sx":544,"manifest_navigator_down":635,"from_viewport":823,"on.initialize":807,"vx":545,"draw_run_time_error":808,"tick_spec":660,"update_editor_box":711,"get_manifest":768,"on.key_release":720,"survey_animation":863,"Manifest":769,"animate_next":841,"Menu_border_color":612,"schema1_of_y":667,"on":1,"scale":712,"Menu_highlight_color":614,"animate_next_frame":825,"draw_menu_bar":861,"copy_shape":396,"add_hotkey_to_menu":616,"load_definition":854,"on.mouse_press":879,"draw_manifest_navigator":677,"vy":546,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"surface_bounds":814,"reset_manifest_navigator":772,"on.keychord_press":871,"line_height":365,"load_from_iterator":670,"Animating":842,"get_definition_from_app":784,"manifest_navigator_candidates":638,"on.load_settings":782,"Spawn_point":822,"manifest_index":637,"manifest_navigator_up":628,"Num_animation_frames":840,"interpolate_viewport":843,"Surface":422,"new_definition":848,"delete_definition":673,"sy":469,"move_candidate_to_front_of_manifest":632,"on.text_input":855,"keychord_press_on_manifest_navigator":765,"B":830,"text_input_on_manifest_navigator":634,"font":353,"Zoomed_out":869,"manifest_coord":636,"initialize_manifest_navigator":773,"Test_definition_background_color":858,"Cursor_node":172,"Manifest_navigator":495,"on.update":835,"on.save_settings":742,"add_def_to_menu":640,"fw_app":"driver","table_and_array_both_empty":689,"Menu_background_color":611,"definition_background_color":859,"compute_layout":385,"Menu_command_color":613,"box_height":680,"on.draw":797,"snapshot_canvas":872,"Definition_background_color":849,"Save_viewport":865,"Viewport":604,"copy_viewport":866}
{"Menu_border_color":612,"Menu_command_color":613,"Animating":726,"Menu_highlight_color":614,"draw_menu_bar":641,"mouse_cursor":558,"add_hotkey_to_menu":616,"Mouse_cursor":559,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"draw_ticks":663,"reset_manifest_navigator":621,"scale":712,"load_from_iterator":670,"get_definition_from_app":735,"schema1_of_y":667,"manifest_navigator_up":628,"load_manifest":755,"manifest_navigator_down":635,"get_manifest":750,"y_of_schema1":364,"delete_definition":673,"definition_file":752,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"Definitions":503,"text_input_on_manifest_navigator":634,"new_definition":745,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"add_def_to_menu":640,"approximate_up":658,"maybe_update_key_in_definitions":529,"font":353,"add_thick_line":400,"copy_shape":396,"tick_spec":660,"Cursor_node":172,"on_text":539,"on.text_input":521,"Surface":422,"on.draw":565,"load_definition":716,"Viewport":604,"on":1,"Menu_background_color":611,"on.initialize":695,"table_and_array_both_empty":689,"on.load_settings":754,"B":379,"initialize_editor":678,"compute_layout":385,"on.keychord_press":739,"A":713,"Ticks_font":669,"approximate":579,"vy":546,"on.key_release":720,"fw_parent":754,"on.code_change":753,"fw_app":"driver","draw_cursor":639,"update_editor_box":711,"on.update":741,"on_handle":547,"box_height":680,"Page":475,"Manifest_versions":749,"on.mouse_press":722,"set_mouse_cursor":562,"order_of_magnitude":573,"sx":544,"on.save_settings":742,"vx":545,"Manifest_navigator":495,"on.mouse_release":721,"--":727,"Manifest":748,"sy":469,"line_height":365}
{"on_handle":547,"Failing_test_definition_background_color":925,"Definitions":503,"on_text":539,"new_definition":848,"A":831,"draw_test_failure_indicator":935,"tick_spec":998,"sx":955,"definition_background_color":1015,"Surface":422,"get_default_map":937,"on.draw":986,"on.key_release":720,"vx":545,"Viewport":604,"snapshot_canvas":913,"load_definition":854,"Save_viewport":865,"mouse_cursor":558,"copy_viewport":866,"Mouse_cursor":559,"on.mouse_release":836,"iscale":953,"set_mouse_cursor":562,"draw_ticks":997,"add_thick_line":400,"on.load_settings":940,"copy_shape":396,"Page":475,"Ticks_font":669,"initialize_manifest_navigator":773,"box_height":680,"compute_layout":385,"approximate":579,"Cursor_node":172,"fw_parent":1015,"update_editor_box":711,"fw_app":"driver","line_height":365,"on.initialize":948,"test_approximate_up":983,"on.mouse_press":916,"schema1_of_y":667,"Definition_background_color":849,"table_and_array_both_empty":689,"on.save_settings":742,"Menu_background_color":611,"draw_cursor":639,"y_of_schema1":364,"Zoomed_out":869,"Menu_command_color":613,"Animating":842,"Menu_highlight_color":614,"initialize_editor":678,"draw_menu_bar":861,"animate_next":914,"add_hotkey_to_menu":616,"survey_animation":1014,"Manifest_navigator":495,"draw_manifest_navigator":677,"approximate_up":985,"num_lines_for_manifest_navigator":676,"draw_run_time_error":808,"maybe_update_key_in_definitions":529,"reset_manifest_navigator":772,"on.code_submit":947,"on.text_input":855,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"on.code_change":924,"surface_bounds":814,"draw_load_time_error":929,"B":830,"manifest_navigator_up":628,"font":353,"manifest_navigator_down":635,"order_of_magnitude":573,"wait_for_response":781,"delete_definition":673,"Spawn_point":822,"move_candidate_to_front_of_manifest":632,"from_viewport":823,"keychord_press_on_manifest_navigator":765,"interpolate_viewport":843,"text_input_on_manifest_navigator":634,"get_multiple_definitions_from_app":1016,"Menu_border_color":612,"manifest_coord":636,"on.keychord_press":919,"manifest_index":637,"zoom_in":920,"manifest_navigator_candidates":638,"scale":712,"load_manifest":694,"add_def_to_menu":640,"on":1,"Test_definition_background_color":858,"Manifest":769,"zoom_out":908,"animate_next_frame":915,"Num_animation_frames":840,"undo_zoom_out":921,"get_manifest":768,"on.update":945,"vy":956}
{"draw_ticks":663,"Menu_command_color":613,"Menu_highlight_color":614,"on.update":741,"on.keychord_press":739,"reset_manifest_navigator":621,"draw_cursor":639,"fw_parent":753,"fw_app":"driver","manifest_navigator_up":628,"vx":545,"approximate_up":658,"Animating":726,"move_candidate_to_front_of_manifest":632,"vy":546,"on.mouse_release":721,"on.mouse_press":722,"Page":475,"box_height":680,"on_handle":547,"on_text":539,"on.initialize":695,"y_of_schema1":364,"Manifest":748,"definition_file":752,"sy":469,"draw_menu_bar":641,"tick_spec":660,"font":353,"mouse_cursor":558,"num_lines_for_manifest_navigator":676,"Mouse_cursor":559,"Manifest_navigator":495,"set_mouse_cursor":562,"new_definition":745,"load_definition":716,"line_height":365,"order_of_magnitude":573,"Manifest_versions":749,"delete_definition":673,"Definitions":503,"approximate":579,"on.save_settings":742,"keychord_press_on_manifest_navigator":675,"on.load_settings":754,"text_input_on_manifest_navigator":634,"maybe_update_key_in_definitions":529,"--":727,"manifest_coord":636,"load_from_iterator":670,"manifest_index":637,"on.draw":565,"manifest_navigator_candidates":638,"on.code_change":753,"update_editor_box":711,"add_def_to_menu":640,"get_definition_from_app":735,"load_manifest":694,"draw_manifest_navigator":677,"schema1_of_y":667,"get_manifest":750,"add_hotkey_to_menu":616,"add_thick_line":400,"Cursor_node":172,"copy_shape":396,"scale":712,"Surface":422,"manifest_navigator_down":635,"on.key_release":720,"on.text_input":521,"sx":544,"initialize_editor":678,"A":713,"Viewport":604,"compute_layout":385,"Ticks_font":669,"B":379,"table_and_array_both_empty":689,"Menu_background_color":611,"on":1,"Menu_border_color":612}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = Menu_bar_height + vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
end
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
{"draw_ticks":663,"Menu_command_color":613,"Menu_highlight_color":614,"on.update":741,"on.keychord_press":739,"reset_manifest_navigator":621,"draw_cursor":639,"fw_parent":752,"fw_app":"driver","manifest_navigator_up":628,"vx":545,"approximate_up":658,"Animating":726,"move_candidate_to_front_of_manifest":632,"vy":546,"on.mouse_release":721,"on.mouse_press":722,"Page":475,"box_height":680,"on_handle":547,"on_text":539,"on.initialize":695,"y_of_schema1":364,"Manifest":748,"definition_file":752,"sy":469,"draw_menu_bar":641,"tick_spec":660,"font":353,"mouse_cursor":558,"num_lines_for_manifest_navigator":676,"Mouse_cursor":559,"Manifest_navigator":495,"set_mouse_cursor":562,"new_definition":745,"load_definition":716,"line_height":365,"order_of_magnitude":573,"Manifest_versions":749,"delete_definition":673,"Definitions":503,"approximate":579,"on.save_settings":742,"keychord_press_on_manifest_navigator":675,"on.load_settings":751,"text_input_on_manifest_navigator":634,"maybe_update_key_in_definitions":529,"--":727,"manifest_coord":636,"load_from_iterator":670,"manifest_index":637,"on.draw":565,"manifest_navigator_candidates":638,"on.code_change":753,"update_editor_box":711,"add_def_to_menu":640,"get_definition_from_app":735,"load_manifest":694,"draw_manifest_navigator":677,"schema1_of_y":667,"get_manifest":750,"add_hotkey_to_menu":616,"add_thick_line":400,"Cursor_node":172,"copy_shape":396,"scale":712,"Surface":422,"manifest_navigator_down":635,"on.key_release":720,"on.text_input":521,"sx":544,"initialize_editor":678,"A":713,"Viewport":604,"compute_layout":385,"Ticks_font":669,"B":379,"table_and_array_both_empty":689,"Menu_background_color":611,"on":1,"Menu_border_color":612}
{"draw_ticks":663,"Menu_command_color":613,"Menu_highlight_color":614,"on.update":741,"on.keychord_press":739,"reset_manifest_navigator":621,"draw_cursor":639,"fw_parent":751,"fw_app":"driver","manifest_navigator_up":628,"vx":545,"approximate_up":658,"Animating":726,"move_candidate_to_front_of_manifest":632,"vy":546,"on.mouse_release":721,"on.mouse_press":722,"Page":475,"box_height":680,"on_handle":547,"on_text":539,"on.initialize":695,"y_of_schema1":364,"Manifest":748,"definition_file":752,"sy":469,"draw_menu_bar":641,"tick_spec":660,"font":353,"mouse_cursor":558,"num_lines_for_manifest_navigator":676,"Mouse_cursor":559,"Manifest_navigator":495,"set_mouse_cursor":562,"new_definition":745,"load_definition":716,"line_height":365,"order_of_magnitude":573,"Manifest_versions":749,"delete_definition":673,"Definitions":503,"approximate":579,"on.save_settings":742,"keychord_press_on_manifest_navigator":675,"on.load_settings":751,"text_input_on_manifest_navigator":634,"maybe_update_key_in_definitions":529,"--":727,"manifest_coord":636,"load_from_iterator":670,"manifest_index":637,"on.draw":565,"manifest_navigator_candidates":638,"on.code_change":747,"update_editor_box":711,"add_def_to_menu":640,"get_definition_from_app":735,"load_manifest":694,"draw_manifest_navigator":677,"schema1_of_y":667,"get_manifest":750,"add_hotkey_to_menu":616,"add_thick_line":400,"Cursor_node":172,"copy_shape":396,"scale":712,"Surface":422,"manifest_navigator_down":635,"on.key_release":720,"on.text_input":521,"sx":544,"initialize_editor":678,"A":713,"Viewport":604,"compute_layout":385,"Ticks_font":669,"B":379,"table_and_array_both_empty":689,"Menu_background_color":611,"on":1,"Menu_border_color":612}
{"draw_ticks":663,"Menu_command_color":613,"Menu_highlight_color":614,"on.update":741,"on.keychord_press":739,"reset_manifest_navigator":621,"draw_cursor":639,"fw_parent":750,"fw_app":"driver","manifest_navigator_up":628,"vx":545,"approximate_up":658,"Animating":726,"move_candidate_to_front_of_manifest":632,"vy":546,"on.mouse_release":721,"on.mouse_press":722,"Page":475,"box_height":680,"on_handle":547,"on_text":539,"on.initialize":695,"y_of_schema1":364,"Manifest":748,"definition_file":746,"sy":469,"draw_menu_bar":641,"tick_spec":660,"font":353,"mouse_cursor":558,"num_lines_for_manifest_navigator":676,"Mouse_cursor":559,"Manifest_navigator":495,"set_mouse_cursor":562,"new_definition":745,"load_definition":716,"line_height":365,"order_of_magnitude":573,"Manifest_versions":749,"delete_definition":673,"Definitions":503,"approximate":579,"on.save_settings":742,"keychord_press_on_manifest_navigator":675,"on.load_settings":751,"text_input_on_manifest_navigator":634,"maybe_update_key_in_definitions":529,"--":727,"manifest_coord":636,"load_from_iterator":670,"manifest_index":637,"on.draw":565,"manifest_navigator_candidates":638,"on.code_change":747,"update_editor_box":711,"add_def_to_menu":640,"get_definition_from_app":735,"load_manifest":694,"draw_manifest_navigator":677,"schema1_of_y":667,"get_manifest":750,"add_hotkey_to_menu":616,"add_thick_line":400,"Cursor_node":172,"copy_shape":396,"scale":712,"Surface":422,"manifest_navigator_down":635,"on.key_release":720,"on.text_input":521,"sx":544,"initialize_editor":678,"A":713,"Viewport":604,"compute_layout":385,"Ticks_font":669,"B":379,"table_and_array_both_empty":689,"Menu_background_color":611,"on":1,"Menu_border_color":612}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, sx(App.screen.width))
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, sy(App.screen.height))
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
on.load_settings = function(settings)
App_name = load_manifest()
print('app name', App_name, settings)
if settings == nil then return end
Settings = settings -- stash all settings into a global for on.save_settings
if settings[App_name] == nil then
return
end
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
local names = {}
for name, _ in pairs(Definitions) do
table.insert(names, name)
end
local defs = get_multiple_definitions_from_app(names)
for name, def_editor in pairs(Definitions) do
if defs[name] then
def_editor.data = load_from_iterator(defs[name]:gmatch("[^\r\n]+"))
else
-- app doesn't know about this definition
-- just delete it from the driver for now
print('deleting', name)
Definitions[name] = nil
end
end
end
on.code_submit = function(editor)
if not editor.load_time_error then
Manifest_navigator.reload = true
end
-- update definition backgrounds of failing tests
for name,node in pairs(Definitions) do
if starts_with(name, 'test_') then
if Client_app_test_failures[name] then
node.bg = Failing_test_definition_background_color
else
node.bg = Test_definition_background_color
end
end
end
end
on.keychord_press = function(chord, key)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
print('a', Cursor_node.editor.line_cache[1])
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"draw_ticks":663,"Menu_command_color":613,"Menu_highlight_color":614,"on.update":741,"on.keychord_press":739,"reset_manifest_navigator":621,"draw_cursor":639,"fw_parent":749,"fw_app":"driver","manifest_navigator_up":628,"vx":545,"approximate_up":658,"Animating":726,"move_candidate_to_front_of_manifest":632,"vy":546,"on.mouse_release":721,"on.mouse_press":722,"Page":475,"box_height":680,"on_handle":547,"on_text":539,"on.initialize":695,"y_of_schema1":364,"Manifest":748,"definition_file":746,"sy":469,"draw_menu_bar":641,"tick_spec":660,"font":353,"mouse_cursor":558,"num_lines_for_manifest_navigator":676,"Mouse_cursor":559,"Manifest_navigator":495,"set_mouse_cursor":562,"new_definition":745,"load_definition":716,"line_height":365,"order_of_magnitude":573,"Manifest_versions":749,"delete_definition":673,"Definitions":503,"approximate":579,"on.save_settings":742,"keychord_press_on_manifest_navigator":675,"on.load_settings":700,"text_input_on_manifest_navigator":634,"maybe_update_key_in_definitions":529,"--":727,"manifest_coord":636,"load_from_iterator":670,"manifest_index":637,"on.draw":565,"manifest_navigator_candidates":638,"on.code_change":747,"update_editor_box":711,"add_def_to_menu":640,"get_definition_from_app":735,"load_manifest":694,"draw_manifest_navigator":677,"schema1_of_y":667,"get_manifest":750,"add_hotkey_to_menu":616,"add_thick_line":400,"Cursor_node":172,"copy_shape":396,"scale":712,"Surface":422,"manifest_navigator_down":635,"on.key_release":720,"on.text_input":521,"sx":544,"initialize_editor":678,"A":713,"Viewport":604,"compute_layout":385,"Ticks_font":669,"B":379,"table_and_array_both_empty":689,"Menu_background_color":611,"on":1,"Menu_border_color":612}
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
end
end
end
end
{"draw_ticks":663,"Menu_command_color":613,"Menu_highlight_color":614,"on.update":741,"on.keychord_press":739,"reset_manifest_navigator":621,"draw_cursor":639,"fw_parent":748,"fw_app":"driver","manifest_navigator_up":628,"vx":545,"approximate_up":658,"Animating":726,"move_candidate_to_front_of_manifest":632,"vy":546,"on.mouse_release":721,"on.mouse_press":722,"Page":475,"box_height":680,"on_handle":547,"on_text":539,"on.initialize":695,"y_of_schema1":364,"Manifest":748,"definition_file":746,"sy":469,"draw_menu_bar":641,"tick_spec":660,"font":353,"mouse_cursor":558,"num_lines_for_manifest_navigator":676,"Mouse_cursor":559,"Manifest_navigator":495,"set_mouse_cursor":562,"new_definition":745,"load_definition":716,"line_height":365,"order_of_magnitude":573,"Manifest_versions":749,"delete_definition":673,"Definitions":503,"approximate":579,"on.save_settings":742,"keychord_press_on_manifest_navigator":675,"on.load_settings":700,"text_input_on_manifest_navigator":634,"maybe_update_key_in_definitions":529,"--":727,"manifest_coord":636,"load_from_iterator":670,"manifest_index":637,"on.draw":565,"manifest_navigator_candidates":638,"on.code_change":747,"update_editor_box":711,"add_def_to_menu":640,"get_definition_from_app":735,"load_manifest":694,"draw_manifest_navigator":677,"schema1_of_y":667,"get_manifest":706,"add_hotkey_to_menu":616,"add_thick_line":400,"Cursor_node":172,"copy_shape":396,"scale":712,"Surface":422,"manifest_navigator_down":635,"on.key_release":720,"on.text_input":521,"sx":544,"initialize_editor":678,"A":713,"Viewport":604,"compute_layout":385,"Ticks_font":669,"B":379,"table_and_array_both_empty":689,"Menu_background_color":611,"on":1,"Menu_border_color":612}
{"draw_ticks":663,"Menu_command_color":613,"Menu_highlight_color":614,"on.update":741,"on.keychord_press":739,"reset_manifest_navigator":621,"draw_cursor":639,"fw_parent":747,"fw_app":"driver","manifest_navigator_up":628,"vx":545,"approximate_up":658,"Animating":726,"move_candidate_to_front_of_manifest":632,"vy":546,"on.mouse_release":721,"on.mouse_press":722,"Page":475,"box_height":680,"on_handle":547,"on_text":539,"on.initialize":695,"y_of_schema1":364,"Manifest":748,"definition_file":746,"sy":469,"draw_menu_bar":641,"tick_spec":660,"font":353,"mouse_cursor":558,"num_lines_for_manifest_navigator":676,"Mouse_cursor":559,"Manifest_navigator":495,"set_mouse_cursor":562,"new_definition":745,"load_definition":716,"line_height":365,"order_of_magnitude":573,"delete_definition":673,"Definitions":503,"approximate":579,"on.save_settings":742,"keychord_press_on_manifest_navigator":675,"on.load_settings":700,"text_input_on_manifest_navigator":634,"maybe_update_key_in_definitions":529,"--":727,"manifest_coord":636,"load_from_iterator":670,"manifest_index":637,"on.draw":565,"manifest_navigator_candidates":638,"on.code_change":747,"update_editor_box":711,"add_def_to_menu":640,"get_definition_from_app":735,"load_manifest":694,"draw_manifest_navigator":677,"schema1_of_y":667,"get_manifest":706,"add_hotkey_to_menu":616,"add_thick_line":400,"Cursor_node":172,"copy_shape":396,"scale":712,"Surface":422,"manifest_navigator_down":635,"on.key_release":720,"on.text_input":521,"sx":544,"initialize_editor":678,"A":713,"Viewport":604,"compute_layout":385,"Ticks_font":669,"B":379,"table_and_array_both_empty":689,"Menu_background_color":611,"on":1,"Menu_border_color":612}
on.text_input = function(t)
print('text input', t)
if Manifest_navigator.show then
text_input_on_manifest_navigator(t)
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.text_input(Cursor_node.editor, t)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
end
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
if vy(node.y) > Menu_bar_height - 5 then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, vy(node.y))
end
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
{"copy_shape":396,"manifest_navigator_up":628,"manifest_navigator_down":635,"on":1,"Page":475,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"on_handle":547,"initialize_editor":678,"manifest_coord":636,"manifest_index":637,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"on.key_release":720,"compute_layout":385,"on.text_input":521,"mouse_cursor":558,"Mouse_cursor":559,"tick_spec":660,"set_mouse_cursor":562,"draw_ticks":663,"definition_file":746,"line_height":365,"order_of_magnitude":573,"get_manifest":706,"approximate":579,"load_manifest":694,"vx":545,"scale":712,"load_definition":716,"fw_parent":746,"vy":546,"fw_app":"driver","font":353,"box_height":680,"--":727,"on.mouse_press":722,"Ticks_font":669,"on.mouse_release":721,"on.save_settings":742,"on.update":741,"on.load_settings":700,"update_editor_box":711,"A":713,"Manifest_navigator":495,"table_and_array_both_empty":689,"on.initialize":695,"Animating":726,"schema1_of_y":667,"y_of_schema1":364,"Cursor_node":172,"Manifest":744,"Menu_background_color":611,"on.keychord_press":739,"Menu_border_color":612,"Viewport":604,"Menu_command_color":613,"draw_cursor":639,"Menu_highlight_color":614,"new_definition":745,"draw_menu_bar":641,"Definitions":503,"add_hotkey_to_menu":616,"B":379,"Surface":422,"draw_manifest_navigator":677,"get_definition_from_app":735,"num_lines_for_manifest_navigator":676,"sy":469,"on.code_change":747,"reset_manifest_navigator":621,"on.draw":565,"approximate_up":658,"load_from_iterator":670,"maybe_update_key_in_definitions":529,"add_thick_line":400}
B = function(preserve_screen_top_of_cursor_node)
-- print('B')
-- recompute various aspects based on the current viewport settings
love.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current font so update it
for _,obj in ipairs(Surface) do
if obj.type == 'line' then
obj.zdata = {}
for i=1,#obj.data,2 do
table.insert(obj.zdata, vx(obj.data[i]))
table.insert(obj.zdata, vy(obj.data[i+1]))
end
elseif obj.type == 'bezier' then
zdata = {}
for i=1,#obj.data,2 do
table.insert(zdata, vx(obj.data[i]))
table.insert(zdata, vy(obj.data[i+1]))
end
obj.zdata = love.math.newBezierCurve(zdata):render()
elseif obj.type == 'text' then
if obj.w then
update_editor_box(obj, preserve_screen_top_of_cursor_node)
else
obj.text = love.graphics.newText(love.graphics.getFont(), obj.data)
end
end
end
end
{"manifest_navigator_candidates":638,"approximate_up":658,"add_def_to_menu":640,"schema1_of_y":667,"Ticks_font":669,"on.mouse_press":722,"Manifest_navigator":495,"on.mouse_release":836,"y_of_schema1":364,"box_height":680,"on.keychord_press":828,"Page":475,"initialize_manifest_navigator":773,"tick_spec":660,"load_manifest":694,"get_multiple_definitions_from_app":783,"get_manifest":768,"wait_for_response":781,"Definitions":503,"font":353,"new_definition":821,"load_definition":716,"add_thick_line":400,"copy_shape":396,"compute_layout":385,"draw_run_time_error":808,"on.save_settings":742,"on.code_change":820,"on.load_settings":782,"survey_animation":845,"on.text_input":834,"table_and_array_both_empty":689,"animate_next_frame":825,"initialize_editor":678,"surface_bounds":814,"on.key_release":720,"on":1,"on.initialize":807,"Surface":422,"A":831,"fw_parent":844,"scale":712,"fw_app":"driver","Spawn_point":822,"sx":544,"from_viewport":823,"Viewport":604,"vx":545,"load_from_iterator":670,"Menu_command_color":613,"on_text":539,"Menu_highlight_color":614,"get_definition_from_app":784,"draw_menu_bar":641,"Menu_border_color":612,"add_hotkey_to_menu":616,"on_handle":547,"on.code_submit":787,"draw_manifest_navigator":677,"update_editor_box":711,"num_lines_for_manifest_navigator":676,"Animating":842,"mouse_cursor":558,"reset_manifest_navigator":772,"Num_animation_frames":840,"Cursor_node":172,"vy":546,"approximate":579,"set_mouse_cursor":562,"draw_cursor":639,"draw_ticks":844,"animate_next":841,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"Mouse_cursor":559,"manifest_navigator_down":635,"line_height":365,"Menu_background_color":611,"delete_definition":673,"order_of_magnitude":573,"move_candidate_to_front_of_manifest":632,"Manifest":769,"keychord_press_on_manifest_navigator":765,"manifest_coord":636,"text_input_on_manifest_navigator":634,"B":830,"interpolate_viewport":843,"on.draw":797,"sy":469,"manifest_index":637,"on.update":835}
{"copy_shape":396,"manifest_navigator_up":628,"manifest_navigator_down":635,"on":1,"Page":475,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"on_handle":547,"initialize_editor":678,"manifest_coord":636,"manifest_index":637,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"on.key_release":720,"compute_layout":385,"on.text_input":521,"mouse_cursor":558,"Mouse_cursor":559,"tick_spec":660,"set_mouse_cursor":562,"draw_ticks":663,"definition_file":746,"line_height":365,"order_of_magnitude":573,"get_manifest":706,"approximate":579,"load_manifest":694,"vx":545,"scale":712,"load_definition":716,"fw_parent":745,"vy":546,"fw_app":"driver","font":353,"box_height":680,"--":727,"on.mouse_press":722,"Ticks_font":669,"on.mouse_release":721,"on.save_settings":742,"on.update":741,"on.load_settings":700,"update_editor_box":711,"A":713,"Manifest_navigator":495,"table_and_array_both_empty":689,"on.initialize":695,"Animating":726,"schema1_of_y":667,"y_of_schema1":364,"Cursor_node":172,"Manifest":744,"Menu_background_color":611,"on.keychord_press":739,"Menu_border_color":612,"Viewport":604,"Menu_command_color":613,"draw_cursor":639,"Menu_highlight_color":614,"new_definition":745,"draw_menu_bar":641,"Definitions":503,"add_hotkey_to_menu":616,"B":379,"Surface":422,"draw_manifest_navigator":677,"get_definition_from_app":735,"num_lines_for_manifest_navigator":676,"sy":469,"on.code_change":734,"reset_manifest_navigator":621,"on.draw":565,"approximate_up":658,"load_from_iterator":670,"maybe_update_key_in_definitions":529,"add_thick_line":400}
on.update = function(dt)
if Animating then
animate_next(dt)
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x()-Move.xoff)
Move.node.y = sy(App.mouse_y())-Move.yoff
B()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
{"Menu_highlight_color":614,"load_definition":854,"fw_app":"driver","add_hotkey_to_menu":616,"get_manifest":768,"draw_manifest_navigator":677,"scale":712,"test_approximate_up":983,"initialize_editor":678,"on.save_settings":742,"reset_manifest_navigator":772,"Save_viewport":865,"new_definition":848,"copy_viewport":866,"get_definition_from_app":784,"zoom_out":908,"table_and_array_both_empty":689,"Zoomed_out":869,"on.initialize":948,"manifest_navigator_up":628,"manifest_navigator_down":635,"load_manifest":694,"delete_definition":673,"Manifest_navigator":495,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"draw_cursor":639,"add_def_to_menu":640,"Cursor_node":172,"on_handle":547,"vx":545,"Viewport":604,"Definitions":503,"vy":956,"draw_run_time_error":808,"on.mouse_press":916,"survey_animation":1014,"mouse_cursor":558,"on.update":945,"Surface":422,"tick_spec":998,"on.key_release":720,"set_mouse_cursor":562,"add_thick_line":400,"draw_ticks":997,"copy_shape":396,"on.code_change":924,"Mouse_cursor":559,"on.mouse_release":836,"on":1,"sx":955,"sy":954,"line_height":365,"surface_bounds":814,"Manifest":769,"Page":475,"iscale":953,"order_of_magnitude":573,"approximate":579,"A":831,"Animating":842,"fw_parent":1013,"Spawn_point":822,"undo_zoom_out":921,"from_viewport":823,"maybe_update_key_in_definitions":529,"interpolate_viewport":843,"approximate_up":985,"Failing_test_definition_background_color":925,"load_from_iterator":670,"box_height":680,"y_of_schema1":364,"Ticks_font":669,"draw_load_time_error":929,"B":830,"draw_test_failure_indicator":935,"zoom_in":920,"draw_menu_bar":861,"on_text":539,"animate_next_frame":915,"on.code_submit":947,"font":353,"get_default_map":937,"compute_layout":385,"on.text_input":855,"Num_animation_frames":840,"on.keychord_press":919,"snapshot_canvas":913,"initialize_manifest_navigator":773,"animate_next":914,"num_lines_for_manifest_navigator":676,"on.draw":986,"on.load_settings":940,"update_editor_box":711,"get_multiple_definitions_from_app":783,"Definition_background_color":849,"schema1_of_y":667,"Menu_background_color":611,"wait_for_response":781,"Menu_border_color":612,"Test_definition_background_color":858,"Menu_command_color":613,"definition_background_color":859}
{"copy_shape":396,"manifest_navigator_up":628,"manifest_navigator_down":635,"on":1,"Page":475,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"on_handle":547,"initialize_editor":678,"manifest_coord":636,"manifest_index":637,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"on.key_release":720,"compute_layout":385,"on.text_input":521,"mouse_cursor":558,"Mouse_cursor":559,"tick_spec":660,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"order_of_magnitude":573,"get_manifest":706,"approximate":579,"load_manifest":694,"vx":545,"scale":712,"load_definition":716,"fw_parent":744,"vy":546,"fw_app":"driver","font":353,"box_height":680,"--":727,"on.mouse_press":722,"Ticks_font":669,"on.mouse_release":721,"on.save_settings":742,"on.update":741,"on.load_settings":700,"update_editor_box":711,"A":713,"Manifest_navigator":495,"table_and_array_both_empty":689,"on.initialize":695,"Animating":726,"schema1_of_y":667,"y_of_schema1":364,"Cursor_node":172,"Manifest":744,"Menu_background_color":611,"on.keychord_press":739,"Menu_border_color":612,"Viewport":604,"Menu_command_color":613,"draw_cursor":639,"Menu_highlight_color":614,"new_definition":745,"draw_menu_bar":641,"Definitions":503,"add_hotkey_to_menu":616,"B":379,"Surface":422,"draw_manifest_navigator":677,"get_definition_from_app":735,"num_lines_for_manifest_navigator":676,"sy":469,"on.code_change":734,"reset_manifest_navigator":621,"on.draw":565,"approximate_up":658,"load_from_iterator":670,"maybe_update_key_in_definitions":529,"add_thick_line":400}
{"copy_shape":396,"manifest_navigator_up":628,"manifest_navigator_down":635,"on":1,"Page":475,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"on_handle":547,"initialize_editor":678,"manifest_coord":636,"manifest_index":637,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"on.key_release":720,"compute_layout":385,"on.text_input":521,"mouse_cursor":558,"Mouse_cursor":559,"tick_spec":660,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"order_of_magnitude":573,"get_manifest":706,"approximate":579,"load_manifest":694,"vx":545,"scale":712,"load_definition":716,"fw_parent":743,"vy":546,"fw_app":"driver","font":353,"box_height":680,"--":727,"on.mouse_press":722,"Ticks_font":669,"on.mouse_release":721,"on.save_settings":742,"on.update":741,"on.load_settings":700,"update_editor_box":711,"A":713,"Manifest_navigator":495,"table_and_array_both_empty":689,"on.initialize":695,"Animating":726,"schema1_of_y":667,"y_of_schema1":364,"Cursor_node":172,"Manifest":744,"Menu_background_color":611,"on.keychord_press":739,"Menu_border_color":612,"Viewport":604,"Menu_command_color":613,"draw_cursor":639,"Menu_highlight_color":614,"new_definition":681,"draw_menu_bar":641,"Definitions":503,"add_hotkey_to_menu":616,"B":379,"Surface":422,"draw_manifest_navigator":677,"get_definition_from_app":735,"num_lines_for_manifest_navigator":676,"sy":469,"on.code_change":734,"reset_manifest_navigator":621,"on.draw":565,"approximate_up":658,"load_from_iterator":670,"maybe_update_key_in_definitions":529,"add_thick_line":400}
{"order_of_magnitude":573,"schema1_of_y":667,"approximate":579,"sy":469,"y_of_schema1":364,"approximate_up":658,"on":1,"Ticks_font":669,"Manifest_navigator":495,"load_definition":716,"on.code_submit":787,"on.save_settings":742,"Manifest":769,"Cursor_node":172,"get_manifest":768,"add_thick_line":400,"Viewport":604,"copy_shape":396,"Menu_background_color":611,"wait_for_response":781,"draw_run_time_error":808,"Definitions":503,"Menu_command_color":613,"new_definition":821,"Menu_highlight_color":614,"survey_animation":847,"draw_menu_bar":641,"animate_next":841,"on.update":835,"on.keychord_press":828,"animate_next_frame":825,"Page":475,"fw_app":"driver","maybe_update_key_in_definitions":529,"surface_bounds":814,"on.mouse_press":722,"Animating":842,"on.initialize":807,"fw_parent":846,"A":831,"Menu_border_color":612,"add_hotkey_to_menu":616,"on.mouse_release":836,"B":830,"draw_manifest_navigator":677,"from_viewport":823,"num_lines_for_manifest_navigator":676,"on_handle":547,"Surface":422,"reset_manifest_navigator":772,"compute_layout":385,"sx":544,"load_from_iterator":670,"Spawn_point":822,"get_definition_from_app":784,"Num_animation_frames":840,"on.text_input":834,"on.code_change":820,"font":353,"manifest_navigator_up":628,"line_height":365,"vx":545,"set_mouse_cursor":562,"draw_cursor":639,"delete_definition":673,"get_multiple_definitions_from_app":783,"move_candidate_to_front_of_manifest":632,"on.key_release":720,"keychord_press_on_manifest_navigator":765,"manifest_navigator_down":635,"text_input_on_manifest_navigator":634,"initialize_manifest_navigator":773,"on.draw":797,"manifest_coord":636,"on.load_settings":782,"manifest_index":637,"mouse_cursor":558,"manifest_navigator_candidates":638,"Mouse_cursor":559,"vy":546,"add_def_to_menu":640,"tick_spec":660,"initialize_editor":678,"table_and_array_both_empty":689,"draw_ticks":844,"load_manifest":694,"box_height":680,"update_editor_box":711,"on_text":539,"interpolate_viewport":843,"scale":712}
on.code_submit = function(editor)
if not editor.load_time_error then
Manifest_navigator.reload = true
end
-- update definition backgrounds of failing tests
for name,node in pairs(Definitions) do
-- ignore temporary definitions with numeric indices; they haven't been saved yet
if isstring(name) and starts_with(name, 'test_') then
if Client_app_test_failures[name] then
node.bg = Failing_test_definition_background_color
else
node.bg = Test_definition_background_color
end
end
end
A()
end
{"copy_shape":396,"manifest_navigator_up":628,"manifest_navigator_down":635,"on":1,"Page":475,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"on_handle":547,"initialize_editor":678,"manifest_coord":636,"manifest_index":637,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"on.key_release":720,"compute_layout":385,"on.text_input":521,"mouse_cursor":558,"Mouse_cursor":559,"tick_spec":660,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"order_of_magnitude":573,"get_manifest":706,"approximate":579,"load_manifest":694,"vx":545,"scale":712,"load_definition":716,"fw_parent":742,"vy":546,"fw_app":"driver","font":353,"box_height":680,"--":727,"on.mouse_press":722,"Ticks_font":669,"on.mouse_release":721,"on.save_settings":742,"on.update":741,"on.load_settings":700,"update_editor_box":711,"A":713,"Manifest_navigator":495,"table_and_array_both_empty":689,"on.initialize":695,"Animating":726,"schema1_of_y":667,"y_of_schema1":364,"Cursor_node":172,"Manifest":743,"Menu_background_color":611,"on.keychord_press":739,"Menu_border_color":612,"Viewport":604,"Menu_command_color":613,"draw_cursor":639,"Menu_highlight_color":614,"new_definition":681,"draw_menu_bar":641,"Definitions":503,"add_hotkey_to_menu":616,"B":379,"Surface":422,"draw_manifest_navigator":677,"get_definition_from_app":735,"num_lines_for_manifest_navigator":676,"sy":469,"on.code_change":734,"reset_manifest_navigator":621,"on.draw":565,"approximate_up":658,"load_from_iterator":670,"maybe_update_key_in_definitions":529,"add_thick_line":400}
{"copy_shape":396,"manifest_navigator_up":628,"manifest_navigator_down":635,"on":1,"Page":475,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"on_handle":547,"initialize_editor":678,"manifest_coord":636,"manifest_index":637,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"on.key_release":720,"compute_layout":385,"on.text_input":521,"mouse_cursor":558,"Mouse_cursor":559,"tick_spec":660,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"order_of_magnitude":573,"get_manifest":706,"approximate":579,"load_manifest":694,"vx":545,"scale":712,"load_definition":716,"fw_parent":741,"vy":546,"fw_app":"driver","font":353,"box_height":680,"--":727,"on.mouse_press":722,"Ticks_font":669,"on.mouse_release":721,"on.save_settings":742,"on.update":741,"on.load_settings":700,"update_editor_box":711,"A":713,"Manifest_navigator":495,"table_and_array_both_empty":689,"on.initialize":695,"Animating":726,"schema1_of_y":667,"y_of_schema1":364,"Cursor_node":172,"Manifest":494,"Menu_background_color":611,"on.keychord_press":739,"Menu_border_color":612,"Viewport":604,"Menu_command_color":613,"draw_cursor":639,"Menu_highlight_color":614,"new_definition":681,"draw_menu_bar":641,"Definitions":503,"add_hotkey_to_menu":616,"B":379,"Surface":422,"draw_manifest_navigator":677,"get_definition_from_app":735,"num_lines_for_manifest_navigator":676,"sy":469,"on.code_change":734,"reset_manifest_navigator":621,"on.draw":565,"approximate_up":658,"load_from_iterator":670,"maybe_update_key_in_definitions":529,"add_thick_line":400}
{"copy_shape":396,"manifest_navigator_up":628,"manifest_navigator_down":635,"on":1,"Page":475,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"on_handle":547,"initialize_editor":678,"manifest_coord":636,"manifest_index":637,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"on.key_release":720,"compute_layout":385,"on.text_input":521,"mouse_cursor":558,"Mouse_cursor":559,"tick_spec":660,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"order_of_magnitude":573,"get_manifest":706,"approximate":579,"load_manifest":694,"vx":545,"scale":712,"load_definition":716,"fw_parent":740,"vy":546,"fw_app":"driver","font":353,"box_height":680,"--":727,"on.mouse_press":722,"Ticks_font":669,"on.mouse_release":721,"on.save_settings":702,"on.update":741,"on.load_settings":700,"update_editor_box":711,"A":713,"Manifest_navigator":495,"table_and_array_both_empty":689,"on.initialize":695,"Animating":726,"schema1_of_y":667,"y_of_schema1":364,"Cursor_node":172,"Manifest":494,"Menu_background_color":611,"on.keychord_press":739,"Menu_border_color":612,"Viewport":604,"Menu_command_color":613,"draw_cursor":639,"Menu_highlight_color":614,"new_definition":681,"draw_menu_bar":641,"Definitions":503,"add_hotkey_to_menu":616,"B":379,"Surface":422,"draw_manifest_navigator":677,"get_definition_from_app":735,"num_lines_for_manifest_navigator":676,"sy":469,"on.code_change":734,"reset_manifest_navigator":621,"on.draw":565,"approximate_up":658,"load_from_iterator":670,"maybe_update_key_in_definitions":529,"add_thick_line":400}
{"keychord_press_on_manifest_navigator":675,"on.mouse_press":722,"y_of_schema1":364,"on.mouse_release":721,"manifest_coord":636,"on.update":740,"manifest_index":637,"manifest_navigator_candidates":638,"set_mouse_cursor":562,"add_def_to_menu":640,"draw_ticks":663,"line_height":365,"font":353,"order_of_magnitude":573,"fw_parent":739,"fw_app":"driver","approximate":579,"on":1,"tick_spec":660,"add_thick_line":400,"copy_shape":396,"--":727,"box_height":680,"compute_layout":385,"Manifest_navigator":495,"on.code_change":734,"load_definition":716,"on.save_settings":702,"on.load_settings":700,"load_manifest":694,"get_manifest":706,"Ticks_font":669,"initialize_editor":678,"Definitions":503,"new_definition":681,"Manifest":494,"text_input_on_manifest_navigator":634,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"maybe_update_key_in_definitions":529,"delete_definition":673,"Menu_background_color":611,"on.initialize":695,"vy":546,"A":713,"Menu_border_color":612,"approximate_up":658,"Menu_command_color":613,"Animating":726,"Menu_highlight_color":614,"update_editor_box":711,"draw_menu_bar":641,"mouse_cursor":558,"add_hotkey_to_menu":616,"Page":475,"Mouse_cursor":559,"draw_manifest_navigator":677,"on_handle":547,"num_lines_for_manifest_navigator":676,"on.text_input":521,"on.draw":565,"reset_manifest_navigator":621,"on_text":539,"scale":712,"load_from_iterator":670,"sy":469,"get_definition_from_app":735,"Surface":422,"sx":544,"B":379,"vx":545,"manifest_navigator_up":628,"Cursor_node":172,"manifest_navigator_down":635,"Viewport":604,"on.keychord_press":739,"on.key_release":720,"schema1_of_y":667,"draw_cursor":639}
{"definition_background_color":1015,"Manifest_navigator":495,"add_def_to_menu":640,"y_of_schema1":364,"on.code_submit":947,"snapshot_canvas":913,"Save_viewport":865,"Cursor_node":172,"copy_viewport":866,"initialize_manifest_navigator":773,"zoom_out":908,"Zoomed_out":869,"line_height":365,"Menu_border_color":612,"wait_for_response":781,"zoom_in":920,"Menu_highlight_color":614,"fw_app":"driver","draw_menu_bar":861,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"load_definition":854,"add_thick_line":400,"reset_manifest_navigator":772,"copy_shape":396,"draw_run_time_error":808,"maybe_update_key_in_definitions":529,"survey_animation":1014,"on.text_input":855,"on.load_settings":1020,"tick_spec":998,"Menu_command_color":613,"Viewport":604,"new_definition":848,"Definitions":503,"animate_next_frame":915,"box_height":680,"compute_layout":385,"schema1_of_y":667,"get_multiple_definitions_from_app":1016,"on.code_change":924,"on":1,"on_handle":547,"get_manifest":768,"num_lines_for_manifest_navigator":676,"surface_bounds":814,"Page":475,"on_text":539,"font":353,"Ticks_font":669,"on.initialize":948,"Manifest":769,"A":1017,"sx":955,"Spawn_point":822,"undo_zoom_out":921,"from_viewport":823,"draw_cursor":639,"interpolate_viewport":843,"animate_next":914,"on.key_release":720,"on.mouse_press":916,"initialize_editor":678,"Menu_background_color":611,"table_and_array_both_empty":689,"Animating":842,"on.save_settings":742,"draw_test_failure_indicator":935,"Surface":422,"mouse_cursor":558,"iscale":953,"Mouse_cursor":559,"update_editor_box":711,"vx":545,"get_default_map":937,"set_mouse_cursor":562,"B":1018,"draw_ticks":997,"vy":956,"on.draw":986,"approximate_up":985,"load_from_iterator":670,"fw_parent":1019,"get_definition_from_app":784,"draw_load_time_error":929,"on.mouse_release":836,"order_of_magnitude":573,"on.update":945,"manifest_navigator_up":628,"on.keychord_press":919,"Num_animation_frames":840,"approximate":579,"Failing_test_definition_background_color":925,"delete_definition":673,"manifest_navigator_down":635,"move_candidate_to_front_of_manifest":632,"sy":954,"keychord_press_on_manifest_navigator":765,"load_manifest":694,"text_input_on_manifest_navigator":634,"Definition_background_color":849,"scale":712,"manifest_coord":636,"test_approximate_up":983,"manifest_index":637,"Test_definition_background_color":858,"manifest_navigator_candidates":638}
{"manifest_coord":636,"update_editor_box":711,"manifest_index":637,"on":1,"line_height":365,"on.text_input":521,"sx":544,"schema1_of_y":667,"y_of_schema1":364,"fw_parent":738,"fw_app":"driver","mouse_cursor":558,"font":353,"set_mouse_cursor":562,"draw_ticks":663,"add_def_to_menu":640,"order_of_magnitude":573,"draw_cursor":639,"scale":712,"approximate":579,"Animating":726,"copy_shape":396,"on.draw":565,"vx":545,"tick_spec":660,"Viewport":604,"A":713,"Ticks_font":669,"B":379,"Manifest_navigator":495,"on.mouse_press":722,"initialize_editor":678,"on.mouse_release":721,"on.update":731,"load_definition":716,"compute_layout":385,"Page":475,"Manifest":494,"on.save_settings":702,"load_manifest":694,"on.load_settings":700,"get_manifest":706,"box_height":680,"table_and_array_both_empty":689,"Definitions":503,"on.code_change":734,"new_definition":681,"on.key_release":720,"draw_menu_bar":641,"add_hotkey_to_menu":616,"vy":546,"Mouse_cursor":559,"draw_manifest_navigator":677,"get_definition_from_app":735,"num_lines_for_manifest_navigator":676,"sy":469,"Menu_highlight_color":614,"reset_manifest_navigator":621,"maybe_update_key_in_definitions":529,"Menu_border_color":612,"load_from_iterator":670,"Surface":422,"Cursor_node":172,"manifest_navigator_candidates":638,"on_text":539,"Menu_command_color":613,"manifest_navigator_up":628,"on.initialize":695,"manifest_navigator_down":635,"approximate_up":658,"Menu_background_color":611,"delete_definition":673,"add_thick_line":400,"move_candidate_to_front_of_manifest":632,"--":727,"keychord_press_on_manifest_navigator":675,"on_handle":547,"text_input_on_manifest_navigator":634,"on.keychord_press":739}
Page = {
-- page
type='cols', x=0, y=0,
width=800, data={
-- editor covering left side
{
type='text',
name='editor',
doc='prose goes here, on the left half of the window',
data={
"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
'1',
'2',
'3',
'mno',
'Acb',
'g',
'hij',
'klm',
'nop',
},
width=400, bg={r=1,g=1,b=0}
},
},
}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
-- print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
-- print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
on.mouse_press = function(x,y, mouse_button)
if Animating then return end
if Zoomed_out then
zoom_in(x,y)
Zoomed_out = nil
Save_viewport = nil
return
end
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
if mouse_press_consumed_by_any_button_handler(HUD, x,y, mouse_button) then
return
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
-- print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
-- print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-40, vy+2)
end
love.graphics.setFont(old_font)
end
{"manifest_coord":636,"update_editor_box":711,"manifest_index":637,"on":1,"line_height":365,"on.text_input":521,"sx":544,"schema1_of_y":667,"y_of_schema1":364,"fw_parent":737,"fw_app":"driver","mouse_cursor":558,"font":353,"set_mouse_cursor":562,"draw_ticks":663,"add_def_to_menu":640,"order_of_magnitude":573,"draw_cursor":639,"scale":712,"approximate":579,"Animating":726,"copy_shape":396,"on.draw":565,"vx":545,"tick_spec":660,"Viewport":604,"A":713,"Ticks_font":669,"B":379,"Manifest_navigator":495,"on.mouse_press":722,"initialize_editor":678,"on.mouse_release":721,"on.update":731,"load_definition":716,"compute_layout":385,"Page":475,"Manifest":494,"on.save_settings":702,"load_manifest":694,"on.load_settings":700,"get_manifest":706,"box_height":680,"table_and_array_both_empty":689,"Definitions":503,"on.code_change":734,"new_definition":681,"on.key_release":720,"draw_menu_bar":641,"add_hotkey_to_menu":616,"vy":546,"Mouse_cursor":559,"draw_manifest_navigator":677,"get_definition_from_app":735,"num_lines_for_manifest_navigator":676,"sy":469,"Menu_highlight_color":614,"reset_manifest_navigator":621,"maybe_update_key_in_definitions":529,"Menu_border_color":612,"load_from_iterator":670,"Surface":422,"Cursor_node":172,"manifest_navigator_candidates":638,"on_text":539,"Menu_command_color":613,"manifest_navigator_up":628,"on.initialize":695,"manifest_navigator_down":635,"approximate_up":658,"Menu_background_color":611,"delete_definition":673,"add_thick_line":400,"move_candidate_to_front_of_manifest":632,"--":727,"keychord_press_on_manifest_navigator":675,"on_handle":547,"text_input_on_manifest_navigator":634,"on.keychord_press":738}
{"manifest_coord":636,"update_editor_box":711,"manifest_index":637,"on":1,"line_height":365,"on.text_input":521,"sx":544,"schema1_of_y":667,"y_of_schema1":364,"fw_parent":736,"fw_app":"driver","mouse_cursor":558,"font":353,"set_mouse_cursor":562,"draw_ticks":663,"add_def_to_menu":640,"order_of_magnitude":573,"draw_cursor":639,"scale":712,"approximate":579,"Animating":726,"copy_shape":396,"on.draw":565,"vx":545,"tick_spec":660,"Viewport":604,"A":713,"Ticks_font":669,"B":379,"Manifest_navigator":495,"on.mouse_press":722,"initialize_editor":678,"on.mouse_release":721,"on.update":731,"load_definition":716,"compute_layout":385,"Page":475,"Manifest":494,"on.save_settings":702,"load_manifest":694,"on.load_settings":700,"get_manifest":706,"box_height":680,"table_and_array_both_empty":689,"Definitions":503,"on.code_change":734,"new_definition":681,"on.key_release":720,"draw_menu_bar":641,"add_hotkey_to_menu":616,"vy":546,"Mouse_cursor":559,"draw_manifest_navigator":677,"get_definition_from_app":735,"num_lines_for_manifest_navigator":676,"sy":469,"Menu_highlight_color":614,"reset_manifest_navigator":621,"maybe_update_key_in_definitions":529,"Menu_border_color":612,"load_from_iterator":670,"Surface":422,"Cursor_node":172,"manifest_navigator_candidates":638,"on_text":539,"Menu_command_color":613,"manifest_navigator_up":628,"on.initialize":695,"manifest_navigator_down":635,"approximate_up":658,"Menu_background_color":611,"delete_definition":673,"add_thick_line":400,"move_candidate_to_front_of_manifest":632,"--":727,"keychord_press_on_manifest_navigator":675,"on_handle":547,"text_input_on_manifest_navigator":634,"on.keychord_press":737}
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxx+1
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
local desired_viewport = Viewport
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
snapshot_canvas()
-- initialize animation
Animating = {
Global_viewport,
desired_viewport,
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"manifest_coord":636,"update_editor_box":711,"manifest_index":637,"on":1,"line_height":365,"on.text_input":521,"sx":544,"schema1_of_y":667,"y_of_schema1":364,"fw_parent":735,"fw_app":"driver","mouse_cursor":558,"font":353,"set_mouse_cursor":562,"draw_ticks":663,"add_def_to_menu":640,"order_of_magnitude":573,"draw_cursor":639,"scale":712,"approximate":579,"Animating":726,"copy_shape":396,"on.draw":565,"vx":545,"tick_spec":660,"Viewport":604,"A":713,"Ticks_font":669,"B":379,"Manifest_navigator":495,"on.mouse_press":722,"initialize_editor":678,"on.mouse_release":721,"on.update":731,"load_definition":716,"compute_layout":385,"Page":475,"Manifest":494,"on.save_settings":702,"load_manifest":694,"on.load_settings":700,"get_manifest":706,"box_height":680,"table_and_array_both_empty":689,"Definitions":503,"on.code_change":734,"new_definition":681,"on.key_release":720,"draw_menu_bar":641,"add_hotkey_to_menu":616,"vy":546,"Mouse_cursor":559,"draw_manifest_navigator":677,"get_definition_from_app":735,"num_lines_for_manifest_navigator":676,"sy":469,"Menu_highlight_color":614,"reset_manifest_navigator":621,"maybe_update_key_in_definitions":529,"Menu_border_color":612,"load_from_iterator":670,"Surface":422,"Cursor_node":172,"manifest_navigator_candidates":638,"on_text":539,"Menu_command_color":613,"manifest_navigator_up":628,"on.initialize":695,"manifest_navigator_down":635,"approximate_up":658,"Menu_background_color":611,"delete_definition":673,"add_thick_line":400,"move_candidate_to_front_of_manifest":632,"--":727,"keychord_press_on_manifest_navigator":675,"on_handle":547,"text_input_on_manifest_navigator":634,"on.keychord_press":736}
{"Surface":422,"on.draw":932,"Viewport":604,"load_definition":854,"vy":546,"undo_zoom_out":921,"Manifest_navigator":495,"draw_run_time_error":808,"scale":712,"Failing_test_definition_background_color":925,"on.mouse_release":836,"on.save_settings":742,"on.update":900,"on_text":539,"on.keychord_press":919,"on.mouse_press":916,"draw_test_failure_indicator":935,"Page":475,"table_and_array_both_empty":689,"on.initialize":807,"A":831,"load_manifest":694,"get_manifest":768,"B":830,"on.key_release":720,"surface_bounds":814,"Definitions":503,"new_definition":848,"mouse_cursor":558,"Spawn_point":822,"Mouse_cursor":559,"from_viewport":823,"interpolate_viewport":843,"set_mouse_cursor":562,"add_thick_line":400,"box_height":680,"copy_shape":396,"compute_layout":385,"maybe_update_key_in_definitions":529,"Menu_highlight_color":614,"draw_menu_bar":861,"add_hotkey_to_menu":616,"Test_definition_background_color":858,"definition_background_color":859,"tick_spec":660,"approximate":579,"order_of_magnitude":573,"font":353,"reset_manifest_navigator":772,"Cursor_node":172,"on":1,"load_from_iterator":670,"draw_manifest_navigator":677,"on_handle":547,"approximate_up":658,"snapshot_canvas":913,"update_editor_box":711,"Save_viewport":865,"manifest_navigator_up":628,"Ticks_font":669,"manifest_navigator_down":635,"initialize_editor":678,"zoom_out":908,"delete_definition":673,"Zoomed_out":869,"move_candidate_to_front_of_manifest":632,"schema1_of_y":667,"keychord_press_on_manifest_navigator":765,"draw_ticks":862,"text_input_on_manifest_navigator":634,"zoom_in":920,"Animating":842,"y_of_schema1":364,"get_definition_from_app":784,"manifest_index":637,"manifest_coord":636,"manifest_navigator_candidates":638,"sy":469,"draw_cursor":639,"add_def_to_menu":640,"vx":545,"sx":544,"fw_parent":939,"on.text_input":855,"Menu_background_color":611,"get_default_map":937,"Menu_border_color":612,"on.code_change":924,"Menu_command_color":613,"Definition_background_color":849,"on.load_settings":940,"survey_animation":906,"line_height":365,"Num_animation_frames":840,"initialize_manifest_navigator":773,"on.code_submit":927,"animate_next":914,"copy_viewport":866,"Manifest":769,"animate_next_frame":915,"get_multiple_definitions_from_app":783,"num_lines_for_manifest_navigator":676,"fw_app":"driver","draw_load_time_error":929,"wait_for_response":781}
{"manifest_navigator_down":635,"on.initialize":695,"update_editor_box":711,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"order_of_magnitude":573,"font":353,"manifest_coord":636,"box_height":680,"manifest_index":637,"compute_layout":385,"manifest_navigator_candidates":638,"draw_cursor":639,"add_def_to_menu":640,"Cursor_node":172,"Manifest_navigator":495,"line_height":365,"tick_spec":660,"schema1_of_y":667,"Manifest":494,"fw_parent":734,"load_manifest":694,"fw_app":"driver","get_manifest":706,"load_definition":716,"Definitions":503,"new_definition":681,"on.save_settings":702,"on.load_settings":700,"on":1,"A":713,"table_and_array_both_empty":689,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"add_thick_line":400,"copy_shape":396,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Viewport":604,"Menu_background_color":611,"reset_manifest_navigator":621,"approximate":579,"on_handle":547,"on.draw":565,"approximate_up":658,"--":727,"on.mouse_press":722,"on_text":539,"draw_ticks":663,"Ticks_font":669,"add_hotkey_to_menu":616,"manifest_navigator_up":628,"Animating":726,"initialize_editor":678,"sx":544,"on.text_input":521,"vx":545,"on.mouse_release":721,"maybe_update_key_in_definitions":529,"on.update":731,"delete_definition":673,"on.keychord_press":719,"on.key_release":720,"Surface":422,"sy":469,"on.code_change":734,"Menu_border_color":612,"Page":475,"y_of_schema1":364,"text_input_on_manifest_navigator":634,"load_from_iterator":670,"mouse_cursor":558,"get_definition_from_app":735,"Mouse_cursor":559,"vy":546,"scale":712,"B":379,"set_mouse_cursor":562}
{"on.load_settings":700,"scale":712,"get_manifest":706,"table_and_array_both_empty":689,"Menu_border_color":612,"Definitions":503,"draw_cursor":639,"update_editor_box":711,"on.text_input":521,"Surface":422,"on.draw":565,"font":353,"schema1_of_y":667,"maybe_update_key_in_definitions":529,"y_of_schema1":364,"Menu_command_color":613,"Animating":726,"Menu_highlight_color":614,"initialize_editor":678,"draw_menu_bar":641,"on.keychord_press":719,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"on.mouse_press":722,"load_from_iterator":670,"get_definition_from_app":717,"sx":544,"vx":545,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"box_height":680,"mouse_cursor":558,"manifest_index":637,"vy":546,"manifest_navigator_candidates":638,"set_mouse_cursor":562,"on":1,"draw_ticks":663,"order_of_magnitude":573,"fw_parent":733,"on.initialize":695,"A":713,"Page":475,"Cursor_node":172,"sy":469,"B":379,"on.code_change":734,"tick_spec":660,"fw_app":"driver","on_text":539,"approximate_up":658,"compute_layout":385,"add_thick_line":400,"load_manifest":694,"on.update":731,"Ticks_font":669,"Manifest_navigator":495,"line_height":365,"on.key_release":720,"Mouse_cursor":559,"manifest_coord":636,"copy_shape":396,"load_definition":716,"on_handle":547,"add_def_to_menu":640,"on.mouse_release":721,"--":727,"approximate":579,"Menu_background_color":611,"Viewport":604,"new_definition":681,"Manifest":494,"on.save_settings":702}
{"on.load_settings":700,"scale":712,"get_manifest":706,"table_and_array_both_empty":689,"Menu_border_color":612,"Definitions":503,"draw_cursor":639,"update_editor_box":711,"on.text_input":521,"Surface":422,"on.draw":565,"font":353,"schema1_of_y":667,"maybe_update_key_in_definitions":529,"y_of_schema1":364,"Menu_command_color":613,"Animating":726,"Menu_highlight_color":614,"initialize_editor":678,"draw_menu_bar":641,"on.keychord_press":719,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"on.mouse_press":722,"load_from_iterator":670,"get_definition_from_app":717,"sx":544,"vx":545,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"box_height":680,"mouse_cursor":558,"manifest_index":637,"vy":546,"manifest_navigator_candidates":638,"set_mouse_cursor":562,"on":1,"draw_ticks":663,"order_of_magnitude":573,"fw_parent":732,"on.initialize":695,"A":713,"Page":475,"Cursor_node":172,"sy":469,"B":379,"on.code_change":733,"tick_spec":660,"fw_app":"driver","on_text":539,"approximate_up":658,"compute_layout":385,"add_thick_line":400,"load_manifest":694,"on.update":731,"Ticks_font":669,"Manifest_navigator":495,"line_height":365,"on.key_release":720,"Mouse_cursor":559,"manifest_coord":636,"copy_shape":396,"load_definition":716,"on_handle":547,"add_def_to_menu":640,"on.mouse_release":721,"--":727,"approximate":579,"Menu_background_color":611,"Viewport":604,"new_definition":681,"Manifest":494,"on.save_settings":702}
on.keychord_press = function(chord, key)
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
on.draw = function()
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
if obj.editor.load_time_error then
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, vy(obj.y))
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(5*20*Viewport.zoom))
love.graphics.setColor(0,0,0)
love.graphics.print(obj.editor.load_time_error, vx(obj.x), error_y)
end
end
end
end
draw_run_time_error()
draw_ticks()
draw_menu_bar()
end
if Animating then
local q = love.graphics.newQuad((Viewport.x-Global_viewport.x)*Viewport.zoom,(Viewport.y-Global_viewport.y)*Viewport.zoom, App.screen.width, App.screen.height, Global_viewport.w*Viewport.zoom, Global_viewport.h*Viewport.zoom)
App.color{r=1,g=1,b=1}
love.graphics.draw(Canvas, q, 0,0)
return
end
{"on.load_settings":700,"scale":712,"get_manifest":706,"table_and_array_both_empty":689,"Menu_border_color":612,"Definitions":503,"draw_cursor":639,"update_editor_box":711,"on.text_input":521,"Surface":422,"on.draw":565,"font":353,"schema1_of_y":667,"maybe_update_key_in_definitions":529,"y_of_schema1":364,"Menu_command_color":613,"Animating":726,"Menu_highlight_color":614,"initialize_editor":678,"draw_menu_bar":641,"on.keychord_press":719,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"on.mouse_press":722,"load_from_iterator":670,"get_definition_from_app":717,"sx":544,"vx":545,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"box_height":680,"mouse_cursor":558,"manifest_index":637,"vy":546,"manifest_navigator_candidates":638,"set_mouse_cursor":562,"on":1,"draw_ticks":663,"order_of_magnitude":573,"fw_parent":731,"on.initialize":695,"A":713,"Page":475,"Cursor_node":172,"sy":469,"B":379,"on.code_change":732,"tick_spec":660,"fw_app":"driver","on_text":539,"approximate_up":658,"compute_layout":385,"add_thick_line":400,"load_manifest":694,"on.update":731,"Ticks_font":669,"Manifest_navigator":495,"line_height":365,"on.key_release":720,"Mouse_cursor":559,"manifest_coord":636,"copy_shape":396,"load_definition":716,"on_handle":547,"add_def_to_menu":640,"on.mouse_release":721,"--":727,"approximate":579,"Menu_background_color":611,"Viewport":604,"new_definition":681,"Manifest":494,"on.save_settings":702}
{"on.load_settings":700,"scale":712,"get_manifest":706,"table_and_array_both_empty":689,"Menu_border_color":612,"Definitions":503,"draw_cursor":639,"update_editor_box":711,"on.text_input":521,"Surface":422,"on.draw":565,"font":353,"schema1_of_y":667,"maybe_update_key_in_definitions":529,"y_of_schema1":364,"Menu_command_color":613,"Animating":726,"Menu_highlight_color":614,"initialize_editor":678,"draw_menu_bar":641,"on.keychord_press":719,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"on.mouse_press":722,"load_from_iterator":670,"get_definition_from_app":717,"sx":544,"vx":545,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"box_height":680,"mouse_cursor":558,"manifest_index":637,"vy":546,"manifest_navigator_candidates":638,"set_mouse_cursor":562,"on":1,"draw_ticks":663,"order_of_magnitude":573,"fw_parent":730,"on.initialize":695,"A":713,"Page":475,"Cursor_node":172,"sy":469,"B":379,"on.code_change":730,"tick_spec":660,"fw_app":"driver","on_text":539,"approximate_up":658,"compute_layout":385,"add_thick_line":400,"load_manifest":694,"on.update":731,"Ticks_font":669,"Manifest_navigator":495,"line_height":365,"on.key_release":720,"Mouse_cursor":559,"manifest_coord":636,"copy_shape":396,"load_definition":716,"on_handle":547,"add_def_to_menu":640,"on.mouse_release":721,"--":727,"approximate":579,"Menu_background_color":611,"Viewport":604,"new_definition":681,"Manifest":494,"on.save_settings":702}
{"on.load_settings":700,"scale":712,"get_manifest":706,"table_and_array_both_empty":689,"Menu_border_color":612,"Definitions":503,"draw_cursor":639,"update_editor_box":711,"on.text_input":521,"Surface":422,"on.draw":565,"font":353,"schema1_of_y":667,"maybe_update_key_in_definitions":529,"y_of_schema1":364,"Menu_command_color":613,"Animating":726,"Menu_highlight_color":614,"initialize_editor":678,"draw_menu_bar":641,"on.keychord_press":719,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"on.mouse_press":722,"load_from_iterator":670,"get_definition_from_app":717,"sx":544,"vx":545,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"box_height":680,"mouse_cursor":558,"manifest_index":637,"vy":546,"manifest_navigator_candidates":638,"set_mouse_cursor":562,"on":1,"draw_ticks":663,"order_of_magnitude":573,"fw_parent":729,"on.initialize":695,"A":713,"Page":475,"Cursor_node":172,"sy":469,"B":379,"on.code_change":730,"tick_spec":660,"fw_app":"driver","on_text":539,"approximate_up":658,"compute_layout":385,"add_thick_line":400,"load_manifest":694,"on.update":725,"Ticks_font":669,"Manifest_navigator":495,"line_height":365,"on.key_release":720,"Mouse_cursor":559,"manifest_coord":636,"copy_shape":396,"load_definition":716,"on_handle":547,"add_def_to_menu":640,"on.mouse_release":721,"--":727,"approximate":579,"Menu_background_color":611,"Viewport":604,"new_definition":681,"Manifest":494,"on.save_settings":702}
{"font":353,"manifest_navigator_down":635,"scale":712,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"mouse_cursor":558,"Mouse_cursor":559,"manifest_coord":636,"load_definition":716,"manifest_index":637,"set_mouse_cursor":562,"Viewport":604,"on.key_release":720,"initialize_editor":678,"add_def_to_menu":640,"box_height":680,"fw_parent":728,"on.mouse_press":722,"on.save_settings":702,"on.load_settings":700,"on.update":725,"on.keychord_press":719,"table_and_array_both_empty":689,"on.initialize":695,"on":1,"load_manifest":694,"schema1_of_y":667,"draw_ticks":663,"draw_cursor":639,"Manifest_navigator":495,"update_editor_box":711,"approximate":579,"A":713,"line_height":365,"Manifest":494,"approximate_up":658,"on.mouse_release":721,"Ticks_font":669,"Surface":422,"B":379,"vx":545,"vy":546,"get_manifest":706,"add_thick_line":400,"copy_shape":396,"new_definition":681,"--":727,"sy":469,"on_handle":547,"Menu_background_color":611,"order_of_magnitude":573,"Menu_border_color":612,"reset_manifest_navigator":621,"Menu_command_color":613,"manifest_navigator_up":628,"Menu_highlight_color":614,"maybe_update_key_in_definitions":529,"draw_menu_bar":641,"Animating":726,"add_hotkey_to_menu":616,"tick_spec":660,"y_of_schema1":364,"draw_manifest_navigator":677,"text_input_on_manifest_navigator":634,"num_lines_for_manifest_navigator":676,"on.draw":565,"compute_layout":385,"on_text":539,"fw_app":"driver","on.code_change":729,"load_from_iterator":670,"Cursor_node":172,"get_definition_from_app":717,"sx":544,"manifest_navigator_candidates":638,"Definitions":503,"Page":475,"on.text_input":521}
{"font":353,"manifest_navigator_down":635,"scale":712,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"mouse_cursor":558,"Mouse_cursor":559,"manifest_coord":636,"load_definition":716,"manifest_index":637,"set_mouse_cursor":562,"Viewport":604,"on.key_release":720,"initialize_editor":678,"add_def_to_menu":640,"box_height":680,"fw_parent":727,"on.mouse_press":722,"on.save_settings":702,"on.load_settings":700,"on.update":725,"on.keychord_press":719,"table_and_array_both_empty":689,"on.initialize":695,"on":1,"load_manifest":694,"schema1_of_y":667,"draw_ticks":663,"draw_cursor":639,"Manifest_navigator":495,"update_editor_box":711,"approximate":579,"A":713,"line_height":365,"Manifest":494,"approximate_up":658,"on.mouse_release":721,"Ticks_font":669,"Surface":422,"B":379,"vx":545,"vy":546,"get_manifest":706,"add_thick_line":400,"copy_shape":396,"new_definition":681,"--":727,"sy":469,"on_handle":547,"Menu_background_color":611,"order_of_magnitude":573,"Menu_border_color":612,"reset_manifest_navigator":621,"Menu_command_color":613,"manifest_navigator_up":628,"Menu_highlight_color":614,"maybe_update_key_in_definitions":529,"draw_menu_bar":641,"Animating":726,"add_hotkey_to_menu":616,"tick_spec":660,"y_of_schema1":364,"draw_manifest_navigator":677,"text_input_on_manifest_navigator":634,"num_lines_for_manifest_navigator":676,"on.draw":565,"compute_layout":385,"on_text":539,"fw_app":"driver","on.code_change":728,"load_from_iterator":670,"Cursor_node":172,"get_definition_from_app":717,"sx":544,"manifest_navigator_candidates":638,"Definitions":503,"Page":475,"on.text_input":521}
{"font":353,"manifest_navigator_down":635,"scale":712,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"mouse_cursor":558,"Mouse_cursor":559,"manifest_coord":636,"load_definition":716,"manifest_index":637,"set_mouse_cursor":562,"Viewport":604,"on.key_release":720,"initialize_editor":678,"add_def_to_menu":640,"box_height":680,"fw_parent":726,"on.mouse_press":722,"on.save_settings":702,"on.load_settings":700,"on.update":725,"on.keychord_press":719,"table_and_array_both_empty":689,"on.initialize":695,"on":1,"load_manifest":694,"schema1_of_y":667,"draw_ticks":663,"draw_cursor":639,"Manifest_navigator":495,"update_editor_box":711,"approximate":579,"A":713,"line_height":365,"Manifest":494,"approximate_up":658,"on.mouse_release":721,"Ticks_font":669,"Surface":422,"B":379,"vx":545,"vy":546,"get_manifest":706,"add_thick_line":400,"copy_shape":396,"new_definition":681,"--":727,"sy":469,"on_handle":547,"Menu_background_color":611,"order_of_magnitude":573,"Menu_border_color":612,"reset_manifest_navigator":621,"Menu_command_color":613,"manifest_navigator_up":628,"Menu_highlight_color":614,"maybe_update_key_in_definitions":529,"draw_menu_bar":641,"Animating":726,"add_hotkey_to_menu":616,"tick_spec":660,"y_of_schema1":364,"draw_manifest_navigator":677,"text_input_on_manifest_navigator":634,"num_lines_for_manifest_navigator":676,"on.draw":565,"compute_layout":385,"on_text":539,"fw_app":"driver","on.code_change":306,"load_from_iterator":670,"Cursor_node":172,"get_definition_from_app":717,"sx":544,"manifest_navigator_candidates":638,"Definitions":503,"Page":475,"on.text_input":521}
{"font":353,"manifest_navigator_down":635,"scale":712,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"mouse_cursor":558,"Mouse_cursor":559,"manifest_coord":636,"load_definition":716,"manifest_index":637,"set_mouse_cursor":562,"Viewport":604,"on.key_release":720,"initialize_editor":678,"add_def_to_menu":640,"box_height":680,"fw_parent":725,"on.mouse_press":722,"on.save_settings":702,"on.load_settings":700,"on.update":725,"on.keychord_press":719,"table_and_array_both_empty":689,"on.initialize":695,"on":1,"load_manifest":694,"schema1_of_y":667,"draw_ticks":663,"draw_cursor":639,"Manifest_navigator":495,"update_editor_box":711,"approximate":579,"A":713,"line_height":365,"Manifest":494,"approximate_up":658,"on.mouse_release":721,"Ticks_font":669,"Surface":422,"B":379,"vx":545,"vy":546,"get_manifest":706,"add_thick_line":400,"copy_shape":396,"new_definition":681,"sy":469,"on_handle":547,"Menu_background_color":611,"order_of_magnitude":573,"Menu_border_color":612,"reset_manifest_navigator":621,"Menu_command_color":613,"manifest_navigator_up":628,"Menu_highlight_color":614,"maybe_update_key_in_definitions":529,"draw_menu_bar":641,"Animating":726,"add_hotkey_to_menu":616,"tick_spec":660,"y_of_schema1":364,"draw_manifest_navigator":677,"text_input_on_manifest_navigator":634,"num_lines_for_manifest_navigator":676,"on.draw":565,"compute_layout":385,"on_text":539,"fw_app":"driver","on.code_change":306,"load_from_iterator":670,"Cursor_node":172,"get_definition_from_app":717,"sx":544,"manifest_navigator_candidates":638,"Definitions":503,"Page":475,"on.text_input":521}
{"vy":546,"mouse_cursor":558,"Mouse_cursor":559,"on.save_settings":742,"on.load_settings":782,"set_mouse_cursor":562,"draw_ticks":663,"animate_next":841,"table_and_array_both_empty":689,"animate_next_frame":825,"order_of_magnitude":573,"sy":469,"update_editor_box":711,"approximate":579,"surface_bounds":814,"schema1_of_y":667,"approximate_up":658,"Manifest_navigator":495,"Cursor_node":172,"Spawn_point":822,"Ticks_font":669,"from_viewport":823,"interpolate_viewport":839,"Animating":842,"font":353,"draw_menu_bar":641,"add_hotkey_to_menu":616,"Manifest":769,"draw_manifest_navigator":677,"load_manifest":694,"num_lines_for_manifest_navigator":676,"get_manifest":768,"reset_manifest_navigator":772,"on.text_input":834,"load_from_iterator":670,"get_definition_from_app":784,"Menu_background_color":611,"on.draw":797,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"new_definition":821,"Menu_highlight_color":614,"delete_definition":673,"copy_shape":396,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"on.mouse_release":836,"manifest_coord":636,"on.keychord_press":828,"maybe_update_key_in_definitions":529,"B":830,"Num_animation_frames":840,"Page":475,"add_def_to_menu":640,"y_of_schema1":364,"draw_cursor":639,"scale":712,"A":831,"manifest_navigator_up":628,"on.update":835,"tick_spec":660,"vx":545,"survey_animation":827,"Surface":422,"get_multiple_definitions_from_app":783,"on.code_submit":787,"manifest_navigator_candidates":638,"on_handle":547,"add_thick_line":400,"draw_run_time_error":808,"move_candidate_to_front_of_manifest":632,"line_height":365,"on_text":539,"initialize_manifest_navigator":773,"on.mouse_press":722,"box_height":680,"manifest_navigator_down":635,"initialize_editor":678,"fw_parent":841,"sx":544,"fw_app":"driver","compute_layout":385,"manifest_index":637,"wait_for_response":781,"on.code_change":820,"on.initialize":807,"on":1,"on.key_release":720,"Viewport":604,"load_definition":716}
{"font":353,"manifest_navigator_down":635,"scale":712,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"mouse_cursor":558,"Mouse_cursor":559,"manifest_coord":636,"load_definition":716,"manifest_index":637,"set_mouse_cursor":562,"Viewport":604,"on.key_release":720,"initialize_editor":678,"add_def_to_menu":640,"box_height":680,"fw_parent":724,"on.mouse_press":722,"on.save_settings":702,"on.load_settings":700,"on.update":725,"on.keychord_press":719,"table_and_array_both_empty":689,"on.initialize":695,"on":1,"load_manifest":694,"schema1_of_y":667,"draw_ticks":663,"draw_cursor":639,"Manifest_navigator":495,"update_editor_box":711,"approximate":579,"A":713,"line_height":365,"Manifest":494,"approximate_up":658,"on.mouse_release":721,"Ticks_font":669,"Surface":422,"B":379,"vx":545,"vy":546,"get_manifest":706,"add_thick_line":400,"copy_shape":396,"new_definition":681,"sy":469,"on_handle":547,"Menu_background_color":611,"order_of_magnitude":573,"Menu_border_color":612,"reset_manifest_navigator":621,"Menu_command_color":613,"manifest_navigator_up":628,"Menu_highlight_color":614,"maybe_update_key_in_definitions":529,"draw_menu_bar":641,"Animating":718,"add_hotkey_to_menu":616,"tick_spec":660,"y_of_schema1":364,"draw_manifest_navigator":677,"text_input_on_manifest_navigator":634,"num_lines_for_manifest_navigator":676,"on.draw":565,"compute_layout":385,"on_text":539,"fw_app":"driver","on.code_change":306,"load_from_iterator":670,"Cursor_node":172,"get_definition_from_app":717,"sx":544,"manifest_navigator_candidates":638,"Definitions":503,"Page":475,"on.text_input":521}
{"fw_app":"driver","Surface":422,"manifest_navigator_up":628,"on.draw":565,"manifest_navigator_down":635,"vx":545,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"vy":546,"keychord_press_on_manifest_navigator":675,"on_text":539,"text_input_on_manifest_navigator":634,"y_of_schema1":364,"on.mouse_press":722,"manifest_coord":636,"on.mouse_release":721,"manifest_index":637,"sx":544,"manifest_navigator_candidates":638,"on.keychord_press":719,"Page":475,"add_def_to_menu":640,"on.key_release":720,"Viewport":604,"compute_layout":385,"on.code_change":306,"mouse_cursor":558,"Mouse_cursor":559,"initialize_editor":678,"set_mouse_cursor":562,"draw_ticks":663,"tick_spec":660,"order_of_magnitude":573,"on":1,"approximate":579,"sy":469,"draw_cursor":639,"load_definition":716,"approximate_up":658,"A":713,"Ticks_font":669,"Manifest_navigator":495,"B":379,"on.initialize":695,"on.save_settings":702,"on.load_settings":700,"Animating":718,"line_height":365,"table_and_array_both_empty":689,"Manifest":494,"load_manifest":694,"get_manifest":706,"on.text_input":521,"font":353,"Definitions":503,"new_definition":681,"Menu_border_color":612,"Cursor_node":172,"Menu_command_color":613,"add_thick_line":400,"Menu_highlight_color":614,"fw_parent":723,"draw_menu_bar":641,"box_height":680,"add_hotkey_to_menu":616,"scale":712,"copy_shape":396,"draw_manifest_navigator":677,"maybe_update_key_in_definitions":529,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"reset_manifest_navigator":621,"update_editor_box":711,"on.update":724,"Menu_background_color":611,"load_from_iterator":670,"on_handle":547,"get_definition_from_app":717}
{"fw_app":"driver","Surface":422,"manifest_navigator_up":628,"on.draw":565,"manifest_navigator_down":635,"vx":545,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"vy":546,"keychord_press_on_manifest_navigator":675,"on_text":539,"text_input_on_manifest_navigator":634,"y_of_schema1":364,"on.mouse_press":722,"manifest_coord":636,"on.mouse_release":721,"manifest_index":637,"sx":544,"manifest_navigator_candidates":638,"on.keychord_press":719,"Page":475,"add_def_to_menu":640,"on.key_release":720,"Viewport":604,"compute_layout":385,"on.code_change":306,"mouse_cursor":558,"Mouse_cursor":559,"initialize_editor":678,"set_mouse_cursor":562,"draw_ticks":663,"tick_spec":660,"order_of_magnitude":573,"on":1,"approximate":579,"sy":469,"draw_cursor":639,"load_definition":716,"approximate_up":658,"A":713,"Ticks_font":669,"Manifest_navigator":495,"B":379,"on.initialize":695,"on.save_settings":702,"on.load_settings":700,"Animating":718,"line_height":365,"table_and_array_both_empty":689,"Manifest":494,"load_manifest":694,"get_manifest":706,"on.text_input":521,"font":353,"Definitions":503,"new_definition":681,"Menu_border_color":612,"Cursor_node":172,"Menu_command_color":613,"add_thick_line":400,"Menu_highlight_color":614,"fw_parent":722,"draw_menu_bar":641,"box_height":680,"add_hotkey_to_menu":616,"scale":712,"copy_shape":396,"draw_manifest_navigator":677,"maybe_update_key_in_definitions":529,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"reset_manifest_navigator":621,"update_editor_box":711,"on.update":723,"Menu_background_color":611,"load_from_iterator":670,"on_handle":547,"get_definition_from_app":717}
{"fw_app":"driver","Surface":422,"manifest_navigator_up":628,"on.draw":565,"manifest_navigator_down":635,"vx":545,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"vy":546,"keychord_press_on_manifest_navigator":675,"on_text":539,"text_input_on_manifest_navigator":634,"y_of_schema1":364,"on.mouse_press":722,"manifest_coord":636,"on.mouse_release":721,"manifest_index":637,"sx":544,"manifest_navigator_candidates":638,"on.keychord_press":719,"Page":475,"add_def_to_menu":640,"on.key_release":720,"Viewport":604,"compute_layout":385,"on.code_change":306,"mouse_cursor":558,"Mouse_cursor":559,"initialize_editor":678,"set_mouse_cursor":562,"draw_ticks":663,"tick_spec":660,"order_of_magnitude":573,"on":1,"approximate":579,"sy":469,"draw_cursor":639,"load_definition":716,"approximate_up":658,"A":713,"Ticks_font":669,"Manifest_navigator":495,"B":379,"on.initialize":695,"on.save_settings":702,"on.load_settings":700,"Animating":718,"line_height":365,"table_and_array_both_empty":689,"Manifest":494,"load_manifest":694,"get_manifest":706,"on.text_input":521,"font":353,"Definitions":503,"new_definition":681,"Menu_border_color":612,"Cursor_node":172,"Menu_command_color":613,"add_thick_line":400,"Menu_highlight_color":614,"fw_parent":721,"draw_menu_bar":641,"box_height":680,"add_hotkey_to_menu":616,"scale":712,"copy_shape":396,"draw_manifest_navigator":677,"maybe_update_key_in_definitions":529,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"reset_manifest_navigator":621,"update_editor_box":711,"on.update":561,"Menu_background_color":611,"load_from_iterator":670,"on_handle":547,"get_definition_from_app":717}
{"fw_app":"driver","Surface":422,"manifest_navigator_up":628,"on.draw":565,"manifest_navigator_down":635,"vx":545,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"vy":546,"keychord_press_on_manifest_navigator":675,"on_text":539,"text_input_on_manifest_navigator":634,"y_of_schema1":364,"on.mouse_press":617,"manifest_coord":636,"on.mouse_release":721,"manifest_index":637,"sx":544,"manifest_navigator_candidates":638,"on.keychord_press":719,"Page":475,"add_def_to_menu":640,"on.key_release":720,"Viewport":604,"compute_layout":385,"on.code_change":306,"mouse_cursor":558,"Mouse_cursor":559,"initialize_editor":678,"set_mouse_cursor":562,"draw_ticks":663,"tick_spec":660,"order_of_magnitude":573,"on":1,"approximate":579,"sy":469,"draw_cursor":639,"load_definition":716,"approximate_up":658,"A":713,"Ticks_font":669,"Manifest_navigator":495,"B":379,"on.initialize":695,"on.save_settings":702,"on.load_settings":700,"Animating":718,"line_height":365,"table_and_array_both_empty":689,"Manifest":494,"load_manifest":694,"get_manifest":706,"on.text_input":521,"font":353,"Definitions":503,"new_definition":681,"Menu_border_color":612,"Cursor_node":172,"Menu_command_color":613,"add_thick_line":400,"Menu_highlight_color":614,"fw_parent":720,"draw_menu_bar":641,"box_height":680,"add_hotkey_to_menu":616,"scale":712,"copy_shape":396,"draw_manifest_navigator":677,"maybe_update_key_in_definitions":529,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"reset_manifest_navigator":621,"update_editor_box":711,"on.update":561,"Menu_background_color":611,"load_from_iterator":670,"on_handle":547,"get_definition_from_app":717}
{"on_handle":547,"definition_background_color":857,"draw_run_time_error":808,"survey_animation":847,"sx":544,"animate_next":841,"on.update":835,"load_definition":854,"on.keychord_press":828,"animate_next_frame":825,"box_height":680,"schema1_of_y":667,"on.save_settings":742,"surface_bounds":814,"Ticks_font":669,"y_of_schema1":364,"set_mouse_cursor":562,"font":353,"table_and_array_both_empty":689,"Spawn_point":822,"from_viewport":823,"load_manifest":694,"interpolate_viewport":843,"order_of_magnitude":573,"on.text_input":855,"Manifest":769,"B":830,"on.code_change":820,"get_manifest":768,"Cursor_node":172,"manifest_index":637,"approximate_up":658,"manifest_navigator_candidates":638,"Num_animation_frames":840,"new_definition":848,"add_thick_line":400,"update_editor_box":711,"copy_shape":396,"sy":469,"draw_manifest_navigator":677,"on.mouse_press":722,"Surface":422,"Test_definition_background_color":858,"draw_cursor":639,"Definition_background_color":849,"Viewport":604,"add_hotkey_to_menu":616,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"draw_ticks":844,"approximate":579,"tick_spec":660,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"vy":546,"Menu_command_color":613,"Mouse_cursor":559,"Menu_highlight_color":614,"mouse_cursor":558,"draw_menu_bar":641,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"Page":475,"on.code_submit":787,"Manifest_navigator":495,"fw_app":"driver","line_height":365,"on.initialize":807,"Definitions":503,"delete_definition":673,"keychord_press_on_manifest_navigator":765,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"get_multiple_definitions_from_app":783,"manifest_navigator_down":635,"on":1,"compute_layout":385,"on.key_release":720,"move_candidate_to_front_of_manifest":632,"Animating":842,"wait_for_response":781,"text_input_on_manifest_navigator":634,"fw_parent":857,"A":831,"manifest_coord":636,"scale":712,"on.mouse_release":836,"reset_manifest_navigator":772,"on.draw":797,"vx":545}
Page = {
-- page
type='cols', x=0, y=0,
width=800, data={
-- editor covering left side
{
type='text',
name='editor',
doc='prose goes here, on the left half of the window',
data={''},
width=400, bg={r=0.8,g=0.8,b=1},
},
},
}
{"fw_app":"driver","Surface":422,"manifest_navigator_up":628,"on.draw":565,"manifest_navigator_down":635,"vx":545,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"vy":546,"keychord_press_on_manifest_navigator":675,"on_text":539,"text_input_on_manifest_navigator":634,"y_of_schema1":364,"on.mouse_press":617,"manifest_coord":636,"on.mouse_release":554,"manifest_index":637,"sx":544,"manifest_navigator_candidates":638,"on.keychord_press":719,"Page":475,"add_def_to_menu":640,"on.key_release":720,"Viewport":604,"compute_layout":385,"on.code_change":306,"mouse_cursor":558,"Mouse_cursor":559,"initialize_editor":678,"set_mouse_cursor":562,"draw_ticks":663,"tick_spec":660,"order_of_magnitude":573,"on":1,"approximate":579,"sy":469,"draw_cursor":639,"load_definition":716,"approximate_up":658,"A":713,"Ticks_font":669,"Manifest_navigator":495,"B":379,"on.initialize":695,"on.save_settings":702,"on.load_settings":700,"Animating":718,"line_height":365,"table_and_array_both_empty":689,"Manifest":494,"load_manifest":694,"get_manifest":706,"on.text_input":521,"font":353,"Definitions":503,"new_definition":681,"Menu_border_color":612,"Cursor_node":172,"Menu_command_color":613,"add_thick_line":400,"Menu_highlight_color":614,"fw_parent":719,"draw_menu_bar":641,"box_height":680,"add_hotkey_to_menu":616,"scale":712,"copy_shape":396,"draw_manifest_navigator":677,"maybe_update_key_in_definitions":529,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"reset_manifest_navigator":621,"update_editor_box":711,"on.update":561,"Menu_background_color":611,"load_from_iterator":670,"on_handle":547,"get_definition_from_app":717}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/2
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2
end
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
{"fw_app":"driver","Surface":422,"manifest_navigator_up":628,"on.draw":565,"manifest_navigator_down":635,"vx":545,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"vy":546,"keychord_press_on_manifest_navigator":675,"on_text":539,"text_input_on_manifest_navigator":634,"y_of_schema1":364,"on.mouse_press":617,"manifest_coord":636,"on.mouse_release":554,"manifest_index":637,"sx":544,"manifest_navigator_candidates":638,"on.keychord_press":719,"Page":475,"add_def_to_menu":640,"on.key_release":552,"Viewport":604,"compute_layout":385,"on.code_change":306,"mouse_cursor":558,"Mouse_cursor":559,"initialize_editor":678,"set_mouse_cursor":562,"draw_ticks":663,"tick_spec":660,"order_of_magnitude":573,"on":1,"approximate":579,"sy":469,"draw_cursor":639,"load_definition":716,"approximate_up":658,"A":713,"Ticks_font":669,"Manifest_navigator":495,"B":379,"on.initialize":695,"on.save_settings":702,"on.load_settings":700,"Animating":718,"line_height":365,"table_and_array_both_empty":689,"Manifest":494,"load_manifest":694,"get_manifest":706,"on.text_input":521,"font":353,"Definitions":503,"new_definition":681,"Menu_border_color":612,"Cursor_node":172,"Menu_command_color":613,"add_thick_line":400,"Menu_highlight_color":614,"fw_parent":718,"draw_menu_bar":641,"box_height":680,"add_hotkey_to_menu":616,"scale":712,"copy_shape":396,"draw_manifest_navigator":677,"maybe_update_key_in_definitions":529,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"reset_manifest_navigator":621,"update_editor_box":711,"on.update":561,"Menu_background_color":611,"load_from_iterator":670,"on_handle":547,"get_definition_from_app":717}
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+2,maxy+1
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, vy(node.y))
end
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
get_definition_from_app = function(name)
-- return definition for a name
-- if no such definition, return ''
live.send_to_app('GET '..name)
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
return response_string
end
load_from_iterator = function(f)
local result = {}
while true do
local line = f()
if line == nil then break end
table.insert(result, line)
end
if #result == 0 then
table.insert(result, '')
end
return result
end
load_definition = function(name)
move_candidate_to_front_of_manifest(name)
if Definitions[name] then
-- just one copy per definition for now
if Cursor_node then
Cursor_node.show_cursor = false
end
Viewport.x = Definitions[name].x-30
Viewport.y = Definitions[name].y-30
Cursor_node = Definitions[name]
Cursor_node.show_cursor = true
return
end
Definitions[name] = {
type='text',
data=load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+")),
x=0, y=0,
width=600,
bg={r=0.7,g=0.7,b=1},
}
end
{"fw_app":"driver","Surface":422,"manifest_navigator_up":628,"on.draw":565,"manifest_navigator_down":635,"vx":545,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"vy":546,"keychord_press_on_manifest_navigator":675,"on_text":539,"text_input_on_manifest_navigator":634,"y_of_schema1":364,"on.mouse_press":617,"manifest_coord":636,"on.mouse_release":554,"manifest_index":637,"sx":544,"manifest_navigator_candidates":638,"on.keychord_press":666,"Page":475,"add_def_to_menu":640,"on.key_release":552,"Viewport":604,"compute_layout":385,"on.code_change":306,"mouse_cursor":558,"Mouse_cursor":559,"initialize_editor":678,"set_mouse_cursor":562,"draw_ticks":663,"tick_spec":660,"order_of_magnitude":573,"on":1,"approximate":579,"sy":469,"draw_cursor":639,"load_definition":716,"approximate_up":658,"A":713,"Ticks_font":669,"Manifest_navigator":495,"B":379,"on.initialize":695,"on.save_settings":702,"on.load_settings":700,"Animating":718,"line_height":365,"table_and_array_both_empty":689,"Manifest":494,"load_manifest":694,"get_manifest":706,"on.text_input":521,"font":353,"Definitions":503,"new_definition":681,"Menu_border_color":612,"Cursor_node":172,"Menu_command_color":613,"add_thick_line":400,"Menu_highlight_color":614,"fw_parent":717,"draw_menu_bar":641,"box_height":680,"add_hotkey_to_menu":616,"scale":712,"copy_shape":396,"draw_manifest_navigator":677,"maybe_update_key_in_definitions":529,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"reset_manifest_navigator":621,"update_editor_box":711,"on.update":561,"Menu_background_color":611,"load_from_iterator":670,"on_handle":547,"get_definition_from_app":717}
{"Viewport":604,"approximate":579,"sy":469,"vy":546,"Surface":422,"on":1,"Ticks_font":669,"Manifest_navigator":495,"update_editor_box":711,"schema1_of_y":667,"Manifest":494,"y_of_schema1":364,"load_manifest":694,"get_manifest":706,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"Definitions":503,"draw_manifest_navigator":677,"load_definition":716,"reset_manifest_navigator":621,"load_from_iterator":670,"get_definition_from_app":717,"on.save_settings":702,"fw_parent":716,"manifest_navigator_up":628,"fw_app":"driver","manifest_navigator_down":635,"on.draw":565,"delete_definition":673,"copy_shape":396,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"on.mouse_release":554,"on.update":561,"add_def_to_menu":640,"on.keychord_press":666,"draw_cursor":639,"on.mouse_press":617,"Page":475,"sx":544,"vx":545,"on.initialize":695,"new_definition":681,"A":713,"Menu_background_color":611,"on.key_release":552,"approximate_up":658,"B":379,"draw_ticks":663,"tick_spec":660,"on_handle":547,"maybe_update_key_in_definitions":529,"on.load_settings":700,"initialize_editor":678,"mouse_cursor":558,"table_and_array_both_empty":689,"Mouse_cursor":559,"line_height":365,"num_lines_for_manifest_navigator":676,"set_mouse_cursor":562,"box_height":680,"on.text_input":521,"compute_layout":385,"Menu_border_color":612,"Menu_command_color":613,"on.code_change":306,"on_text":539,"scale":712,"manifest_navigator_candidates":638,"Cursor_node":172,"font":353,"order_of_magnitude":573,"add_thick_line":400}
{"load_definition":716,"draw_manifest_navigator":677,"schema1_of_y":667,"approximate":579,"y_of_schema1":364,"on.load_settings":700,"table_and_array_both_empty":689,"on.initialize":695,"Ticks_font":669,"draw_cursor":639,"load_manifest":694,"add_thick_line":400,"copy_shape":396,"sy":469,"scale":712,"update_editor_box":711,"line_height":365,"Definitions":503,"get_manifest":706,"on":1,"Manifest_navigator":495,"font":353,"vx":545,"Viewport":604,"new_definition":681,"vy":546,"on.mouse_press":617,"on.update":561,"maybe_update_key_in_definitions":529,"Surface":422,"num_lines_for_manifest_navigator":676,"Page":475,"on.draw":565,"load_from_iterator":670,"fw_parent":715,"fw_app":"driver","Cursor_node":172,"manifest_navigator_down":635,"on_handle":547,"on.text_input":521,"delete_definition":673,"Menu_border_color":612,"on_text":539,"Menu_command_color":613,"text_input_on_manifest_navigator":634,"add_hotkey_to_menu":616,"manifest_index":637,"manifest_navigator_candidates":638,"reset_manifest_navigator":621,"on.key_release":552,"get_definition_from_app":624,"manifest_navigator_up":628,"mouse_cursor":558,"Mouse_cursor":559,"B":379,"add_def_to_menu":640,"set_mouse_cursor":562,"on.keychord_press":666,"box_height":680,"draw_menu_bar":641,"compute_layout":385,"on.mouse_release":554,"tick_spec":660,"on.code_change":306,"Menu_highlight_color":614,"on.save_settings":702,"order_of_magnitude":573,"draw_ticks":663,"keychord_press_on_manifest_navigator":675,"manifest_coord":636,"sx":544,"approximate_up":658,"A":713,"Manifest":494,"Menu_background_color":611,"initialize_editor":678,"move_candidate_to_front_of_manifest":632}
Animating = nil -- set this to enable animation
-- When enabled, animation should consist of a series of viewport states that we animate into.
-- Each viewport state will be attained in Num_animation_frames frames, each of 0.01 ms or 1 Love frame.
-- Each state will specify the final state of various viewport keys. Keys not mentioned will remain unchanged.
{"load_definition":715,"draw_manifest_navigator":677,"schema1_of_y":667,"approximate":579,"y_of_schema1":364,"on.load_settings":700,"table_and_array_both_empty":689,"on.initialize":695,"Ticks_font":669,"draw_cursor":639,"load_manifest":694,"add_thick_line":400,"copy_shape":396,"sy":469,"scale":712,"update_editor_box":711,"line_height":365,"Definitions":503,"get_manifest":706,"on":1,"Manifest_navigator":495,"font":353,"vx":545,"Viewport":604,"new_definition":681,"vy":546,"on.mouse_press":617,"on.update":561,"maybe_update_key_in_definitions":529,"Surface":422,"num_lines_for_manifest_navigator":676,"Page":475,"on.draw":565,"load_from_iterator":670,"fw_parent":714,"fw_app":"driver","Cursor_node":172,"manifest_navigator_down":635,"on_handle":547,"on.text_input":521,"delete_definition":673,"Menu_border_color":612,"on_text":539,"Menu_command_color":613,"text_input_on_manifest_navigator":634,"add_hotkey_to_menu":616,"manifest_index":637,"manifest_navigator_candidates":638,"reset_manifest_navigator":621,"on.key_release":552,"get_definition_from_app":624,"manifest_navigator_up":628,"mouse_cursor":558,"Mouse_cursor":559,"B":379,"add_def_to_menu":640,"set_mouse_cursor":562,"on.keychord_press":666,"box_height":680,"draw_menu_bar":641,"compute_layout":385,"on.mouse_release":554,"tick_spec":660,"on.code_change":306,"Menu_highlight_color":614,"on.save_settings":702,"order_of_magnitude":573,"draw_ticks":663,"keychord_press_on_manifest_navigator":675,"manifest_coord":636,"sx":544,"approximate_up":658,"A":713,"Manifest":494,"Menu_background_color":611,"initialize_editor":678,"move_candidate_to_front_of_manifest":632}
{"table_and_array_both_empty":689,"Ticks_font":669,"snapshot_canvas":913,"initialize_editor":678,"Page":475,"copy_viewport":866,"zoom_out":908,"on.initialize":807,"Zoomed_out":869,"A":831,"sy":469,"animate_next":914,"zoom_in":920,"update_editor_box":711,"font":353,"animate_next_frame":915,"Menu_background_color":611,"Menu_border_color":612,"schema1_of_y":667,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":861,"y_of_schema1":364,"add_hotkey_to_menu":616,"on":1,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Manifest":769,"reset_manifest_navigator":772,"load_manifest":694,"load_from_iterator":670,"get_manifest":768,"get_definition_from_app":784,"Surface":422,"Animating":842,"manifest_navigator_up":628,"Definitions":503,"manifest_navigator_down":635,"new_definition":848,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"vy":546,"keychord_press_on_manifest_navigator":765,"on.code_change":923,"text_input_on_manifest_navigator":634,"undo_zoom_out":921,"manifest_coord":636,"copy_shape":396,"fw_parent":922,"on.update":900,"manifest_navigator_candidates":638,"surface_bounds":814,"add_def_to_menu":640,"sx":544,"vx":545,"add_thick_line":400,"Spawn_point":822,"draw_cursor":639,"from_viewport":823,"on.draw":917,"interpolate_viewport":843,"B":830,"line_height":365,"on.text_input":855,"on_handle":547,"Cursor_node":172,"on.save_settings":742,"mouse_cursor":558,"tick_spec":660,"on_text":539,"Mouse_cursor":559,"on.mouse_press":916,"Manifest_navigator":495,"set_mouse_cursor":562,"Definition_background_color":849,"draw_ticks":862,"draw_run_time_error":808,"Num_animation_frames":840,"box_height":680,"on.code_submit":787,"compute_layout":385,"on.keychord_press":919,"on.key_release":720,"load_definition":854,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"scale":712,"initialize_manifest_navigator":773,"survey_animation":906,"approximate":579,"fw_app":"driver","Save_viewport":865,"Test_definition_background_color":858,"get_multiple_definitions_from_app":783,"definition_background_color":859,"on.load_settings":782,"Viewport":604,"wait_for_response":781,"approximate_up":658,"on.mouse_release":836,"manifest_index":637}
load_definition = function(name)
move_candidate_to_front_of_manifest(name)
if Definitions[name] then return end -- just one copy per definition for now
Definitions[name] = {
type='text',
data=load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+")),
x=0, y=0,
width=400,
bg={r=0.7,g=0.7,b=1},
}
end
on.load_settings = function(settings)
App_name = load_manifest()
print('app name', App_name, settings)
if settings == nil then return end
Settings = settings -- stash all settings into a global for on.save_settings
if settings[App_name] == nil then
settings[App_name] = get_default_map()
return
end
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
local names = {}
for name, _ in pairs(Definitions) do
table.insert(names, name)
end
local defs = get_multiple_definitions_from_app(names)
for name, def_editor in pairs(Definitions) do
if defs[name] then
def_editor.data = load_from_iterator(defs[name]:gmatch("[^\r\n]+"))
else
-- app doesn't know about this definition
-- just delete it from the driver for now
print('deleting', name)
Definitions[name] = nil
end
end
end
{"reset_manifest_navigator":621,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"get_definition_from_app":624,"update_editor_box":711,"Manifest":494,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.draw":565,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"on_handle":547,"text_input_on_manifest_navigator":634,"fw_parent":713,"manifest_coord":636,"on_text":539,"manifest_index":637,"manifest_navigator_candidates":638,"Page":475,"sx":544,"vx":545,"on.save_settings":702,"on.load_settings":700,"on.key_release":552,"table_and_array_both_empty":689,"on.initialize":695,"get_manifest":706,"load_manifest":694,"tick_spec":660,"set_mouse_cursor":562,"y_of_schema1":364,"draw_ticks":663,"compute_layout":385,"schema1_of_y":667,"Viewport":604,"new_definition":681,"order_of_magnitude":573,"font":353,"load_definition":714,"A":713,"approximate":579,"Surface":422,"box_height":680,"approximate_up":658,"Ticks_font":669,"add_thick_line":400,"copy_shape":396,"on":1,"on.text_input":521,"draw_cursor":639,"fw_app":"driver","Cursor_node":172,"add_hotkey_to_menu":616,"vy":546,"scale":712,"line_height":365,"sy":469,"on.code_change":306,"Menu_background_color":611,"initialize_editor":678,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.mouse_press":617,"Menu_highlight_color":614,"on.mouse_release":554,"draw_menu_bar":641,"on.update":561,"Manifest_navigator":495,"on.keychord_press":666,"add_def_to_menu":640,"draw_manifest_navigator":677,"mouse_cursor":558,"num_lines_for_manifest_navigator":676,"B":379,"Mouse_cursor":559}
{"Menu_background_color":611,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"new_definition":681,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"box_height":680,"compute_layout":385,"maybe_update_key_in_definitions":529,"on.code_change":306,"get_definition_from_app":624,"vy":546,"manifest_navigator_up":628,"manifest_navigator_down":635,"line_height":365,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"on_handle":547,"text_input_on_manifest_navigator":634,"manifest_coord":636,"on_text":539,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"sy":469,"add_def_to_menu":640,"sx":544,"vx":545,"initialize_editor":678,"on.key_release":552,"schema1_of_y":667,"Manifest_navigator":495,"y_of_schema1":364,"mouse_cursor":558,"Cursor_node":172,"Mouse_cursor":559,"tick_spec":660,"set_mouse_cursor":562,"Manifest":494,"load_manifest":694,"get_manifest":706,"order_of_magnitude":573,"load_definition":682,"approximate":579,"Surface":422,"on.update":561,"on.save_settings":702,"on.load_settings":700,"add_thick_line":400,"Viewport":604,"copy_shape":396,"on":1,"Ticks_font":669,"table_and_array_both_empty":689,"draw_ticks":663,"reset_manifest_navigator":621,"update_editor_box":711,"on.mouse_release":554,"scale":712,"on.initialize":695,"font":353,"on.keychord_press":666,"A":713,"approximate_up":658,"load_from_iterator":670,"Page":475,"on.draw":565,"fw_parent":712,"B":379,"fw_app":"driver","draw_cursor":639,"on.text_input":521}
new_definition = function()
if Cursor_node then
Cursor_node.show_cursor = false
end
table.insert(Definitions, {
type='text',
data={''},
x=Spawn_point.x, y=Spawn_point.y,
width=600,
bg={r=0.7,g=0.7,b=1},
})
Viewport.x = -30
Viewport.y = -30
Cursor_node = Definitions[#Definitions]
Cursor_node.show_cursor = true
end
maybe_update_key_in_definitions = function(old_definition_name, definition_name, Cursor_node)
print(old_definition_name, definition_name)
if old_definition_name ~= definition_name then
if old_definition_name == nil or Definitions[old_definition_name] ~= Cursor_node then
local pos = array.find(Definitions, Cursor_node)
print('found at index', pos)
assert(pos)
table.remove(Definitions, pos)
elseif Definitions[old_definition_name] == Cursor_node then
print('found at key', old_definition_name)
Definitions[old_definition_name] = nil
end
if definition_name and Definitions[definition_name] == nil then
print('moving to key', definition_name)
Definitions[definition_name] = Cursor_node
elseif definition_name == nil or Definitions[definition_name] then
-- temporary collision; try again later
-- deleting and reinserting is inefficient, but hopefully rare
print('moving to index', #Definitions+1)
table.insert(Definitions, definition_name)
end
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
end
end
{"schema1_of_y":667,"order_of_magnitude":573,"load_definition":682,"on.draw":565,"on.mouse_release":554,"approximate":579,"Manifest":494,"Viewport":604,"on":1,"load_manifest":694,"on.save_settings":702,"on.load_settings":700,"approximate_up":658,"Definitions":503,"Ticks_font":669,"new_definition":681,"on.keychord_press":666,"Page":475,"add_thick_line":400,"copy_shape":396,"maybe_update_key_in_definitions":529,"draw_cursor":639,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"line_height":365,"add_hotkey_to_menu":616,"on.code_change":306,"on_text":539,"num_lines_for_manifest_navigator":676,"on.mouse_press":617,"reset_manifest_navigator":621,"load_from_iterator":670,"fw_parent":711,"get_definition_from_app":624,"fw_app":"driver","manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"initialize_editor":678,"text_input_on_manifest_navigator":634,"vy":546,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"A":507,"add_def_to_menu":640,"sx":544,"B":379,"mouse_cursor":558,"compute_layout":385,"on.update":561,"on.text_input":521,"draw_manifest_navigator":677,"on.key_release":552,"Manifest_navigator":495,"Cursor_node":172,"y_of_schema1":364,"box_height":680,"sy":469,"on.initialize":695,"scale":712,"Surface":422,"update_editor_box":711,"vx":545,"Mouse_cursor":559,"tick_spec":660,"get_manifest":706,"font":353,"set_mouse_cursor":562,"on_handle":547,"draw_ticks":663,"table_and_array_both_empty":689}
get_manifest = function()
live.send_to_app('MANIFEST')
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
local result = {}
if #response_string == 0 then
-- error; retry
return result
else
-- stop retrying
Manifest_navigator.reload = false
end
local app_name
local response = json.decode(response_string)
for name, value in pairs(response) do
if not starts_with(name, 'fw_') then
table.insert(result, name)
elseif name == 'fw_app' then
print('get manifest: app_name', value)
app_name = value
end
end
return result, app_name
end
{"Mouse_cursor":559,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"Cursor_node":172,"add_def_to_menu":640,"order_of_magnitude":573,"approximate":579,"box_height":680,"on.draw":565,"font":353,"on.code_change":306,"Viewport":604,"on.initialize":695,"A":507,"Manifest_navigator":495,"B":379,"on.update":561,"on.keychord_press":666,"load_definition":682,"on":1,"initialize_editor":678,"get_manifest":706,"on.save_settings":702,"on.load_settings":700,"approximate_up":658,"Definitions":503,"new_definition":681,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"update_editor_box":711,"Surface":422,"scale":7,"on.mouse_release":554,"vx":545,"draw_cursor":639,"set_mouse_cursor":562,"schema1_of_y":667,"Menu_background_color":611,"draw_ticks":663,"Menu_border_color":612,"manifest_navigator_down":635,"Menu_command_color":613,"load_manifest":694,"y_of_schema1":364,"on_handle":547,"draw_menu_bar":641,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"Manifest":494,"on_text":539,"draw_manifest_navigator":677,"on.mouse_press":617,"num_lines_for_manifest_navigator":676,"sy":469,"Ticks_font":669,"reset_manifest_navigator":621,"sx":544,"line_height":365,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":624,"copy_shape":396,"tick_spec":660,"on.text_input":521,"on.key_release":552,"fw_parent":710,"Page":475,"fw_app":"driver","Menu_highlight_color":614,"vy":546,"delete_definition":673,"compute_layout":385,"move_candidate_to_front_of_manifest":632,"mouse_cursor":558,"keychord_press_on_manifest_navigator":675}
{"schema1_of_y":667,"draw_ticks":663,"Cursor_node":172,"y_of_schema1":364,"on.text_input":829,"order_of_magnitude":573,"load_definition":716,"approximate":579,"on.save_settings":742,"box_height":680,"on.load_settings":782,"approximate_up":658,"table_and_array_both_empty":689,"on.code_change":820,"scale":712,"Ticks_font":669,"initialize_manifest_navigator":773,"get_multiple_definitions_from_app":783,"add_thick_line":400,"copy_shape":396,"Manifest":769,"load_manifest":694,"initialize_editor":678,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"font":353,"draw_menu_bar":641,"animate_next":809,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"animate_next_frame":825,"A":831,"reset_manifest_navigator":772,"survey_animation":827,"B":830,"maybe_update_key_in_definitions":529,"get_definition_from_app":784,"add_def_to_menu":640,"surface_bounds":814,"on.keychord_press":828,"compute_layout":385,"manifest_navigator_up":628,"fw_app":"driver","manifest_navigator_down":635,"wait_for_response":781,"new_definition":821,"delete_definition":673,"Spawn_point":822,"move_candidate_to_front_of_manifest":632,"from_viewport":823,"keychord_press_on_manifest_navigator":765,"interpolate_viewport":824,"text_input_on_manifest_navigator":634,"on_handle":547,"get_manifest":768,"manifest_coord":636,"Viewport":604,"Surface":422,"draw_cursor":639,"manifest_navigator_candidates":638,"on.draw":797,"manifest_index":637,"vx":545,"on":1,"sx":544,"load_from_iterator":670,"set_mouse_cursor":562,"vy":546,"on.code_submit":787,"on.initialize":807,"draw_run_time_error":808,"on.key_release":720,"on.mouse_press":722,"Mouse_cursor":559,"on.mouse_release":721,"line_height":365,"on.update":802,"sy":469,"update_editor_box":711,"Animating":813,"mouse_cursor":558,"num_lines_for_manifest_navigator":676,"Page":475,"tick_spec":660,"fw_parent":830,"on_text":539,"Manifest_navigator":495}
{"Mouse_cursor":559,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"Cursor_node":172,"add_def_to_menu":640,"order_of_magnitude":573,"approximate":579,"box_height":680,"on.draw":565,"font":353,"on.code_change":306,"Viewport":604,"on.initialize":695,"A":507,"Manifest_navigator":495,"B":379,"on.update":561,"on.keychord_press":666,"load_definition":682,"on":1,"initialize_editor":678,"get_manifest":706,"on.save_settings":702,"on.load_settings":700,"approximate_up":658,"Definitions":503,"new_definition":681,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"update_editor_box":710,"Surface":422,"scale":7,"on.mouse_release":554,"vx":545,"draw_cursor":639,"set_mouse_cursor":562,"schema1_of_y":667,"Menu_background_color":611,"draw_ticks":663,"Menu_border_color":612,"manifest_navigator_down":635,"Menu_command_color":613,"load_manifest":694,"y_of_schema1":364,"on_handle":547,"draw_menu_bar":641,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"Manifest":494,"on_text":539,"draw_manifest_navigator":677,"on.mouse_press":617,"num_lines_for_manifest_navigator":676,"sy":469,"Ticks_font":669,"reset_manifest_navigator":621,"sx":544,"line_height":365,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":624,"copy_shape":396,"tick_spec":660,"on.text_input":521,"on.key_release":552,"fw_parent":709,"Page":475,"fw_app":"driver","Menu_highlight_color":614,"vy":546,"delete_definition":673,"compute_layout":385,"move_candidate_to_front_of_manifest":632,"mouse_cursor":558,"keychord_press_on_manifest_navigator":675}
on.load_settings = function(settings)
App_name = load_manifest()
print('app name', App_name, settings)
-- backstop any default settings for this app, and stash everything to a global for on.save_settings
if settings == nil then
Settings = {}
else
Settings = settings
end
if Settings[App_name] == nil then
Settings[App_name] = {}
Settings[App_name].viewport = Viewport
Settings[App_name].definitions = get_default_map()
end
Viewport = Settings[App_name].viewport
Definitions = Settings[App_name].definitions
local names = {}
for name, _ in pairs(Definitions) do
table.insert(names, name)
end
local defs = get_multiple_definitions_from_app(names)
for name, def_editor in pairs(Definitions) do
if def_editor.type == nil then
def_editor.type = 'text'
end
if def_editor.bg == nil then
def_editor.bg = definition_background_color(name)
end
if def_editor.width == nil then
def_editor.width = 600
end
if defs[name] then
def_editor.data = load_from_iterator(defs[name]:gmatch("[^\r\n]+"))
else
-- app doesn't know about this definition
-- just delete it from the driver for now
print('deleting', name)
Definitions[name] = nil
end
end
end
{"Mouse_cursor":559,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"Cursor_node":172,"add_def_to_menu":640,"order_of_magnitude":573,"approximate":579,"box_height":680,"on.draw":565,"font":353,"on.code_change":306,"Viewport":604,"on.initialize":695,"A":507,"Manifest_navigator":495,"B":379,"on.update":561,"on.keychord_press":666,"load_definition":682,"on":1,"initialize_editor":678,"get_manifest":706,"on.save_settings":702,"on.load_settings":700,"approximate_up":658,"Definitions":503,"new_definition":681,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"update_editor_box":709,"Surface":422,"scale":7,"on.mouse_release":554,"vx":545,"draw_cursor":639,"set_mouse_cursor":562,"schema1_of_y":667,"Menu_background_color":611,"draw_ticks":663,"Menu_border_color":612,"manifest_navigator_down":635,"Menu_command_color":613,"load_manifest":694,"y_of_schema1":364,"on_handle":547,"draw_menu_bar":641,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"Manifest":494,"on_text":539,"draw_manifest_navigator":677,"on.mouse_press":617,"num_lines_for_manifest_navigator":676,"sy":469,"Ticks_font":669,"reset_manifest_navigator":621,"sx":544,"line_height":365,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":624,"copy_shape":396,"tick_spec":660,"on.text_input":521,"on.key_release":552,"fw_parent":708,"Page":475,"fw_app":"driver","Menu_highlight_color":614,"vy":546,"delete_definition":673,"compute_layout":385,"move_candidate_to_front_of_manifest":632,"mouse_cursor":558,"keychord_press_on_manifest_navigator":675}
animate_next_frame = function(state, dt)
if state.initial == nil then
state.initial = from_viewport(state)
-- once we've checked keys, pollute the keyspace
state.step = 0
state.frame_time = 0
return
end
state.frame_time = state.frame_time + dt
if state.frame_time > 0.01 then
state.frame_time = state.frame_time - 0.01
state.step = state.step+1
interpolate_viewport(state.initial, state, state.step)
B()
end
end
{"Mouse_cursor":559,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"Cursor_node":172,"add_def_to_menu":640,"order_of_magnitude":573,"approximate":579,"box_height":680,"on.draw":565,"font":353,"on.code_change":306,"Viewport":604,"on.initialize":695,"A":507,"Manifest_navigator":495,"B":379,"on.update":561,"on.keychord_press":666,"load_definition":682,"on":1,"initialize_editor":678,"get_manifest":706,"on.save_settings":702,"on.load_settings":700,"approximate_up":658,"Definitions":503,"new_definition":681,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"update_editor_box":708,"Surface":422,"scale":7,"on.mouse_release":554,"vx":545,"draw_cursor":639,"set_mouse_cursor":562,"schema1_of_y":667,"Menu_background_color":611,"draw_ticks":663,"Menu_border_color":612,"manifest_navigator_down":635,"Menu_command_color":613,"load_manifest":694,"y_of_schema1":364,"on_handle":547,"draw_menu_bar":641,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"Manifest":494,"on_text":539,"draw_manifest_navigator":677,"on.mouse_press":617,"num_lines_for_manifest_navigator":676,"sy":469,"Ticks_font":669,"reset_manifest_navigator":621,"sx":544,"line_height":365,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":624,"copy_shape":396,"tick_spec":660,"on.text_input":521,"on.key_release":552,"fw_parent":707,"Page":475,"fw_app":"driver","Menu_highlight_color":614,"vy":546,"delete_definition":673,"compute_layout":385,"move_candidate_to_front_of_manifest":632,"mouse_cursor":558,"keychord_press_on_manifest_navigator":675}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
if vy(node.y) > 0 then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, -vy(node.y))
end
if node.editor.font_height ~= scale(20) then
edit.update_font_settings(node.editor, scale(20))
end
node.editor.left = math.floor(vx(node.x)) + Line_number_width*App.width(node.editor.em)
node.editor.right = math.ceil(vx(node.x+node.w))
end
{"Mouse_cursor":559,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"Cursor_node":172,"add_def_to_menu":640,"order_of_magnitude":573,"approximate":579,"box_height":680,"on.draw":565,"font":353,"on.code_change":306,"Viewport":604,"on.initialize":695,"A":507,"Manifest_navigator":495,"B":379,"on.update":561,"on.keychord_press":666,"load_definition":682,"on":1,"initialize_editor":678,"get_manifest":706,"on.save_settings":702,"on.load_settings":700,"approximate_up":658,"Definitions":503,"new_definition":681,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"update_editor_box":707,"Surface":422,"scale":7,"on.mouse_release":554,"vx":545,"draw_cursor":639,"set_mouse_cursor":562,"schema1_of_y":667,"Menu_background_color":611,"draw_ticks":663,"Menu_border_color":612,"manifest_navigator_down":635,"Menu_command_color":613,"load_manifest":694,"y_of_schema1":364,"on_handle":547,"draw_menu_bar":641,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"Manifest":494,"on_text":539,"draw_manifest_navigator":677,"on.mouse_press":617,"num_lines_for_manifest_navigator":676,"sy":469,"Ticks_font":669,"reset_manifest_navigator":621,"sx":544,"line_height":365,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":624,"copy_shape":396,"tick_spec":660,"on.text_input":521,"on.key_release":552,"fw_parent":706,"Page":475,"fw_app":"driver","Menu_highlight_color":614,"vy":546,"delete_definition":673,"compute_layout":385,"move_candidate_to_front_of_manifest":632,"mouse_cursor":558,"keychord_press_on_manifest_navigator":675}
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxx+1
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
local desired_viewport = Viewport
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
-- Render the canvas at pixel perfect resolution.
local winw,winh = App.screen.width, App.screen.height
App.screen.width,App.screen.height = Global_viewport.w, Global_viewport.h
Viewport = {x=minx, y=miny, w=cw, h=ch, zoom=1.0}
A()
Canvas = love.graphics.newCanvas(cw,ch)
love.graphics.setCanvas(Canvas)
App.run_tests = true -- Hack; disable drawing the menu and ticks
on.draw()
App.run_tests = nil
love.graphics.setCanvas()
App.screen.width,App.screen.height = winw,winh
-- initialize animation
Animating = {
Global_viewport,
desired_viewport,
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"on_handle":547,"text_input_on_manifest_navigator":634,"new_definition":681,"manifest_coord":636,"on_text":539,"on.mouse_press":617,"font":353,"add_thick_line":400,"A":507,"sx":544,"vx":545,"B":379,"on.key_release":552,"on":1,"mouse_cursor":558,"Mouse_cursor":559,"add_def_to_menu":640,"set_mouse_cursor":562,"Surface":422,"box_height":680,"compute_layout":385,"on.code_change":306,"order_of_magnitude":573,"approximate":579,"tick_spec":660,"update_editor_box":570,"approximate_up":658,"Ticks_font":669,"vy":546,"schema1_of_y":667,"Page":475,"on.save_settings":702,"on.load_settings":700,"scale":7,"initialize_editor":678,"Cursor_node":172,"table_and_array_both_empty":689,"manifest_index":637,"sy":469,"Menu_background_color":611,"line_height":365,"Menu_border_color":612,"manifest_navigator_candidates":638,"Menu_command_color":613,"on.keychord_press":666,"Menu_highlight_color":614,"on.initialize":695,"draw_menu_bar":641,"num_lines_for_manifest_navigator":676,"add_hotkey_to_menu":616,"Manifest_navigator":495,"draw_cursor":639,"draw_manifest_navigator":677,"fw_parent":705,"y_of_schema1":364,"fw_app":"driver","on.update":561,"reset_manifest_navigator":621,"Definitions":503,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"on.draw":565,"get_definition_from_app":624,"load_definition":682,"copy_shape":396,"Manifest":494,"Viewport":604,"manifest_navigator_up":628,"load_manifest":694,"manifest_navigator_down":635,"get_manifest":706,"draw_ticks":663,"delete_definition":673,"on.text_input":521,"move_candidate_to_front_of_manifest":632,"on.mouse_release":554,"keychord_press_on_manifest_navigator":675}
{"manifest_navigator_candidates":638,"add_def_to_menu":640,"draw_cursor":639,"Manifest":494,"load_manifest":694,"get_manifest":705,"Definitions":503,"tick_spec":660,"new_definition":681,"update_editor_box":570,"load_definition":682,"maybe_update_key_in_definitions":529,"fw_parent":704,"fw_app":"driver","box_height":680,"schema1_of_y":667,"on.save_settings":702,"on.load_settings":700,"y_of_schema1":364,"on_handle":547,"Surface":422,"font":353,"on.mouse_press":617,"on.draw":565,"sx":544,"vx":545,"Viewport":604,"compute_layout":385,"vy":546,"on":1,"on.key_release":552,"Menu_background_color":611,"on.mouse_release":554,"Menu_border_color":612,"on.update":561,"Menu_command_color":613,"mouse_cursor":558,"copy_shape":396,"Mouse_cursor":559,"Cursor_node":172,"initialize_editor":678,"add_hotkey_to_menu":616,"set_mouse_cursor":562,"draw_menu_bar":641,"draw_ticks":663,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"B":379,"scale":7,"reset_manifest_navigator":621,"Menu_highlight_color":614,"on_text":539,"load_from_iterator":670,"order_of_magnitude":573,"get_definition_from_app":624,"on.initialize":695,"Manifest_navigator":495,"table_and_array_both_empty":689,"approximate":579,"manifest_navigator_up":628,"sy":469,"manifest_navigator_down":635,"on.keychord_press":666,"line_height":365,"delete_definition":673,"A":507,"move_candidate_to_front_of_manifest":632,"approximate_up":658,"keychord_press_on_manifest_navigator":675,"Page":475,"text_input_on_manifest_navigator":634,"on.code_change":306,"Ticks_font":669,"manifest_coord":636,"on.text_input":521,"manifest_index":637,"add_thick_line":400}
{"maybe_update_key_in_definitions":529,"load_from_iterator":670,"schema1_of_y":667,"get_definition_from_app":624,"sy":469,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"on_handle":547,"Manifest_navigator":495,"initialize_editor":678,"on.initialize":695,"on_text":539,"manifest_index":637,"manifest_navigator_candidates":638,"on.update":561,"add_def_to_menu":640,"vx":545,"Manifest":494,"on.mouse_release":554,"load_manifest":694,"on.key_release":552,"get_manifest":704,"Definitions":503,"mouse_cursor":558,"new_definition":681,"compute_layout":385,"Cursor_node":172,"on.code_change":306,"set_mouse_cursor":562,"draw_ticks":663,"vy":546,"on.mouse_press":617,"order_of_magnitude":573,"load_definition":682,"on.keychord_press":666,"approximate":579,"Page":475,"A":507,"on.save_settings":702,"on.load_settings":700,"add_thick_line":400,"Ticks_font":669,"table_and_array_both_empty":689,"draw_cursor":639,"Viewport":604,"scale":7,"text_input_on_manifest_navigator":634,"sx":544,"approximate_up":658,"on.text_input":521,"font":353,"copy_shape":396,"line_height":365,"y_of_schema1":364,"box_height":680,"Surface":422,"Menu_background_color":611,"keychord_press_on_manifest_navigator":675,"Menu_border_color":612,"on.draw":565,"Menu_command_color":613,"update_editor_box":570,"Menu_highlight_color":614,"tick_spec":660,"draw_menu_bar":641,"Mouse_cursor":559,"add_hotkey_to_menu":616,"manifest_coord":636,"B":379,"draw_manifest_navigator":677,"on":1,"num_lines_for_manifest_navigator":676,"fw_app":"driver","fw_parent":703,"reset_manifest_navigator":621}
{"Manifest":769,"Viewport":604,"approximate":579,"snapshot_canvas":913,"get_manifest":768,"copy_viewport":866,"on.save_settings":742,"sy":469,"approximate_up":658,"Definitions":503,"update_editor_box":711,"new_definition":848,"on.code_submit":787,"table_and_array_both_empty":689,"zoom_in":920,"Page":475,"schema1_of_y":667,"initialize_manifest_navigator":773,"y_of_schema1":364,"get_multiple_definitions_from_app":783,"wait_for_response":781,"Menu_background_color":611,"Menu_border_color":612,"on.text_input":855,"box_height":680,"fw_parent":919,"compute_layout":385,"fw_app":"driver","on.code_change":820,"on_text":539,"survey_animation":906,"animate_next":914,"scale":712,"sx":544,"vx":545,"load_from_iterator":670,"from_viewport":823,"get_definition_from_app":784,"Surface":422,"on_handle":547,"Ticks_font":669,"draw_menu_bar":861,"manifest_navigator_up":628,"copy_shape":396,"manifest_navigator_down":635,"surface_bounds":814,"Save_viewport":865,"delete_definition":673,"font":353,"move_candidate_to_front_of_manifest":632,"draw_cursor":639,"keychord_press_on_manifest_navigator":765,"on.update":900,"text_input_on_manifest_navigator":634,"Spawn_point":822,"zoom_out":908,"manifest_coord":636,"on.mouse_release":836,"manifest_index":637,"animate_next_frame":915,"manifest_navigator_candidates":638,"initialize_editor":678,"interpolate_viewport":843,"add_def_to_menu":640,"on.load_settings":782,"A":831,"maybe_update_key_in_definitions":529,"order_of_magnitude":573,"on.initialize":807,"on":1,"add_thick_line":400,"load_manifest":694,"on.key_release":720,"on.keychord_press":919,"Menu_highlight_color":614,"Num_animation_frames":840,"draw_run_time_error":808,"reset_manifest_navigator":772,"on.mouse_press":916,"num_lines_for_manifest_navigator":676,"draw_manifest_navigator":677,"mouse_cursor":558,"add_hotkey_to_menu":616,"Mouse_cursor":559,"tick_spec":660,"Definition_background_color":849,"Manifest_navigator":495,"set_mouse_cursor":562,"vy":546,"draw_ticks":862,"Test_definition_background_color":858,"Cursor_node":172,"definition_background_color":859,"Animating":842,"Menu_command_color":613,"Zoomed_out":869,"line_height":365,"B":830,"on.draw":917,"load_definition":854}
draw_ticks = function()
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi)
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi)
end
{"table_and_array_both_empty":689,"Ticks_font":669,"on.initialize":695,"B":379,"get_manifest":703,"load_manifest":694,"on.keychord_press":666,"on_handle":547,"on_text":539,"Surface":422,"vx":545,"vy":546,"Menu_background_color":611,"on.mouse_release":554,"Menu_border_color":612,"on.update":561,"Menu_command_color":613,"Page":475,"draw_menu_bar":641,"add_hotkey_to_menu":616,"on.mouse_press":617,"mouse_cursor":558,"draw_manifest_navigator":677,"Mouse_cursor":559,"num_lines_for_manifest_navigator":676,"set_mouse_cursor":562,"load_from_iterator":670,"update_editor_box":570,"get_definition_from_app":624,"manifest_navigator_down":635,"delete_definition":673,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"scale":7,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on.draw":565,"sy":469,"add_def_to_menu":640,"Viewport":604,"draw_cursor":639,"Manifest_navigator":495,"fw_parent":702,"tick_spec":660,"fw_app":"driver","line_height":365,"on":1,"Manifest":494,"schema1_of_y":667,"draw_ticks":663,"new_definition":681,"maybe_update_key_in_definitions":529,"Definitions":503,"reset_manifest_navigator":621,"load_definition":682,"on.save_settings":702,"order_of_magnitude":573,"box_height":680,"compute_layout":385,"initialize_editor":678,"Cursor_node":172,"approximate":579,"add_thick_line":400,"y_of_schema1":364,"copy_shape":396,"font":353,"on.text_input":521,"on.code_change":306,"on.load_settings":700,"A":507,"approximate_up":658,"on.key_release":552,"sx":544,"Menu_highlight_color":614}
{"box_height":680,"move_candidate_to_front_of_manifest":632,"wait_for_response":781,"undo_zoom_out":921,"Cursor_node":172,"Failing_test_definition_background_color":925,"manifest_index":637,"on.text_input":855,"manifest_navigator_candidates":638,"load_definition":854,"update_editor_box":711,"add_def_to_menu":640,"draw_run_time_error":808,"get_default_map":937,"survey_animation":1014,"animate_next":914,"on_text":539,"y_of_schema1":364,"initialize_editor":678,"animate_next_frame":915,"sx":955,"iscale":953,"on.key_release":720,"test_approximate_up":983,"fw_parent":1020,"fw_app":"driver","Test_definition_background_color":858,"manifest_coord":636,"on.keychord_press":1021,"mouse_cursor":558,"Definition_background_color":849,"Mouse_cursor":559,"text_input_on_manifest_navigator":634,"load_manifest":694,"approximate":579,"Spawn_point":822,"keychord_press_on_manifest_navigator":765,"from_viewport":823,"sy":954,"interpolate_viewport":843,"add_thick_line":400,"surface_bounds":814,"copy_shape":396,"approximate_up":985,"A":1017,"vy":956,"order_of_magnitude":573,"scale":712,"Ticks_font":669,"definition_background_color":1015,"on.code_change":924,"on.mouse_release":836,"draw_load_time_error":929,"line_height":365,"load_from_iterator":670,"Zoomed_out":869,"Num_animation_frames":840,"draw_ticks":997,"B":1018,"set_mouse_cursor":562,"compute_layout":385,"Surface":422,"draw_test_failure_indicator":935,"on.save_settings":742,"Animating":842,"on":1,"draw_cursor":639,"table_and_array_both_empty":689,"Manifest_navigator":495,"tick_spec":998,"maybe_update_key_in_definitions":529,"on.initialize":948,"font":353,"Menu_background_color":611,"on_handle":547,"Menu_border_color":612,"add_hotkey_to_menu":616,"Menu_command_color":613,"Viewport":604,"Menu_highlight_color":614,"get_manifest":768,"draw_menu_bar":861,"on.draw":986,"Manifest":769,"vx":545,"snapshot_canvas":913,"draw_manifest_navigator":677,"Save_viewport":865,"num_lines_for_manifest_navigator":676,"copy_viewport":866,"on.code_submit":947,"reset_manifest_navigator":772,"zoom_out":908,"schema1_of_y":667,"on.mouse_press":916,"Definitions":503,"get_definition_from_app":784,"new_definition":848,"on.update":945,"initialize_manifest_navigator":773,"zoom_in":920,"manifest_navigator_up":628,"on.load_settings":1020,"manifest_navigator_down":635,"Page":475,"get_multiple_definitions_from_app":1016,"delete_definition":673}
{"on.save_settings":702,"on.load_settings":700,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":701,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
{"on.save_settings":701,"on.load_settings":700,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":700,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
{"on.mouse_release":721,"schema1_of_y":667,"on.update":802,"on.keychord_press":828,"get_multiple_definitions_from_app":783,"on.save_settings":742,"Page":475,"approximate_up":658,"wait_for_response":781,"compute_layout":385,"Ticks_font":669,"table_and_array_both_empty":689,"Manifest_navigator":495,"maybe_update_key_in_definitions":529,"fw_parent":833,"Manifest":769,"font":353,"load_manifest":694,"on_text":539,"on_handle":547,"on.mouse_press":722,"Menu_background_color":611,"A":831,"sx":544,"Definitions":503,"vx":545,"Animating":813,"draw_menu_bar":641,"draw_run_time_error":808,"on.key_release":720,"draw_manifest_navigator":677,"survey_animation":827,"on.code_change":820,"reset_manifest_navigator":772,"mouse_cursor":558,"load_from_iterator":670,"Mouse_cursor":559,"animate_next_frame":825,"add_thick_line":400,"set_mouse_cursor":562,"copy_shape":396,"draw_ticks":663,"draw_cursor":639,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"manifest_coord":636,"from_viewport":823,"interpolate_viewport":824,"add_def_to_menu":640,"update_editor_box":711,"manifest_navigator_up":628,"on.load_settings":782,"B":830,"Spawn_point":822,"get_definition_from_app":784,"new_definition":821,"box_height":680,"on.code_submit":787,"fw_app":"driver","Menu_border_color":612,"num_lines_for_manifest_navigator":676,"animate_next":809,"add_hotkey_to_menu":616,"approximate":579,"Menu_highlight_color":614,"on.draw":797,"Menu_command_color":613,"get_manifest":768,"surface_bounds":814,"vy":546,"on.text_input":834,"Surface":422,"line_height":365,"manifest_index":637,"scale":712,"y_of_schema1":364,"manifest_navigator_candidates":638,"on":1,"Viewport":604,"initialize_editor":678,"tick_spec":660,"on.initialize":807,"manifest_navigator_down":635,"order_of_magnitude":573,"load_definition":716,"sy":469,"initialize_manifest_navigator":773,"Cursor_node":172}
{"Ticks_font":669,"new_definition":848,"table_and_array_both_empty":689,"draw_run_time_error":808,"maybe_update_key_in_definitions":529,"y_of_schema1":364,"animate_next":841,"Menu_background_color":611,"Menu_border_color":612,"animate_next_frame":825,"Menu_command_color":613,"vx":545,"Menu_highlight_color":614,"Viewport":604,"draw_menu_bar":861,"vy":546,"surface_bounds":814,"Cursor_node":172,"num_lines_for_manifest_navigator":676,"on.mouse_release":836,"reset_manifest_navigator":772,"load_from_iterator":670,"Spawn_point":822,"get_definition_from_app":784,"from_viewport":823,"Page":475,"interpolate_viewport":843,"add_thick_line":400,"manifest_navigator_up":628,"copy_shape":396,"manifest_navigator_down":635,"Animating":842,"B":830,"Num_animation_frames":840,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"on_handle":547,"text_input_on_manifest_navigator":634,"A":831,"on":1,"on.code_change":820,"manifest_index":637,"on.mouse_press":722,"manifest_navigator_candidates":638,"on.update":835,"sx":544,"on.draw":797,"scale":712,"manifest_coord":636,"on.key_release":720,"fw_parent":860,"wait_for_response":781,"Surface":422,"sy":469,"compute_layout":385,"get_multiple_definitions_from_app":783,"initialize_manifest_navigator":773,"delete_definition":673,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"tick_spec":660,"font":353,"fw_app":"driver","set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":844,"line_height":365,"on.initialize":807,"on.code_submit":787,"initialize_editor":678,"on.text_input":855,"survey_animation":860,"on_text":539,"approximate_up":658,"order_of_magnitude":573,"load_definition":854,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.keychord_press":828,"approximate":579,"Manifest":769,"update_editor_box":711,"box_height":680,"load_manifest":694,"definition_background_color":859,"get_manifest":768,"Test_definition_background_color":858,"on.save_settings":742,"schema1_of_y":667,"on.load_settings":782,"Definition_background_color":849,"add_def_to_menu":640,"draw_cursor":639}
{"on.update":900,"Test_definition_background_color":858,"sx":544,"definition_background_color":859,"on.mouse_release":836,"add_thick_line":400,"on.key_release":720,"copy_shape":396,"manifest_navigator_up":628,"snapshot_canvas":913,"manifest_navigator_down":635,"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"move_candidate_to_front_of_manifest":632,"zoom_out":908,"keychord_press_on_manifest_navigator":765,"Zoomed_out":869,"set_mouse_cursor":562,"draw_load_time_error":929,"draw_ticks":862,"draw_test_failure_indicator":934,"manifest_index":637,"font":353,"manifest_navigator_candidates":638,"Surface":422,"add_def_to_menu":640,"order_of_magnitude":573,"on.draw":932,"vx":545,"approximate":579,"Viewport":604,"line_height":365,"Page":475,"approximate_up":658,"on":1,"Manifest_navigator":495,"on.keychord_press":919,"draw_run_time_error":808,"draw_cursor":639,"manifest_coord":636,"schema1_of_y":667,"survey_animation":906,"on.initialize":807,"animate_next":914,"A":831,"on.code_submit":927,"on.mouse_press":916,"Manifest":769,"load_definition":854,"animate_next_frame":915,"load_manifest":694,"update_editor_box":711,"get_manifest":768,"initialize_editor":678,"compute_layout":385,"box_height":680,"tick_spec":660,"Menu_background_color":611,"initialize_manifest_navigator":773,"Definitions":503,"on.save_settings":742,"new_definition":848,"on.load_settings":782,"Menu_highlight_color":614,"get_multiple_definitions_from_app":783,"draw_menu_bar":861,"text_input_on_manifest_navigator":634,"add_hotkey_to_menu":616,"Spawn_point":822,"Failing_test_definition_background_color":925,"from_viewport":823,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"vy":546,"wait_for_response":781,"reset_manifest_navigator":772,"maybe_update_key_in_definitions":529,"scale":712,"load_from_iterator":670,"B":830,"get_definition_from_app":784,"y_of_schema1":364,"Ticks_font":669,"sy":469,"surface_bounds":814,"Cursor_node":172,"zoom_in":920,"undo_zoom_out":921,"mouse_cursor":558,"fw_parent":933,"Num_animation_frames":840,"fw_app":"driver","table_and_array_both_empty":689,"Mouse_cursor":559,"on_handle":547,"Menu_command_color":613,"draw_manifest_navigator":677,"on.code_change":924,"Animating":842,"on_text":539,"Definition_background_color":849,"Menu_border_color":612,"delete_definition":673}
{"on.save_settings":687,"on.load_settings":700,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":699,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
if obj.editor.load_time_error then
print('load time error found')
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, vy(obj.y))
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(5*20*Viewport.zoom))
love.graphics.setColor(0,0,0)
love.graphics.print(obj.editor.load_time_error, vx(obj.x), error_y)
end
end
end
end
draw_ticks()
draw_menu_bar()
end
{"on.save_settings":687,"on.load_settings":699,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":698,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
{"manifest_navigator_candidates":638,"approximate_up":658,"add_def_to_menu":640,"schema1_of_y":667,"Ticks_font":669,"on.mouse_press":722,"Manifest_navigator":495,"on.mouse_release":836,"y_of_schema1":364,"box_height":680,"on.keychord_press":828,"Page":475,"initialize_manifest_navigator":773,"tick_spec":660,"load_manifest":694,"get_multiple_definitions_from_app":783,"get_manifest":768,"wait_for_response":781,"Definitions":503,"font":353,"new_definition":821,"load_definition":716,"add_thick_line":400,"copy_shape":396,"compute_layout":385,"draw_run_time_error":808,"on.save_settings":742,"on.code_change":820,"on.load_settings":782,"survey_animation":827,"on.text_input":834,"table_and_array_both_empty":689,"animate_next_frame":825,"initialize_editor":678,"surface_bounds":814,"on.key_release":720,"on":1,"on.initialize":807,"Surface":422,"A":831,"fw_parent":843,"scale":712,"fw_app":"driver","Spawn_point":822,"sx":544,"from_viewport":823,"Viewport":604,"vx":545,"load_from_iterator":670,"Menu_command_color":613,"on_text":539,"Menu_highlight_color":614,"get_definition_from_app":784,"draw_menu_bar":641,"Menu_border_color":612,"add_hotkey_to_menu":616,"on_handle":547,"on.code_submit":787,"draw_manifest_navigator":677,"update_editor_box":711,"num_lines_for_manifest_navigator":676,"Animating":842,"mouse_cursor":558,"reset_manifest_navigator":772,"Num_animation_frames":840,"Cursor_node":172,"vy":546,"approximate":579,"set_mouse_cursor":562,"draw_cursor":639,"draw_ticks":844,"animate_next":841,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"Mouse_cursor":559,"manifest_navigator_down":635,"line_height":365,"Menu_background_color":611,"delete_definition":673,"order_of_magnitude":573,"move_candidate_to_front_of_manifest":632,"Manifest":769,"keychord_press_on_manifest_navigator":765,"manifest_coord":636,"text_input_on_manifest_navigator":634,"B":830,"interpolate_viewport":843,"on.draw":797,"sy":469,"manifest_index":637,"on.update":835}
A = function(preserve_screen_top_of_cursor_node)
print('A')
love.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current font
-- translate Definitions to Surface
Surface = {}
for _,node in pairs(Definitions) do
compute_layout(node, node.x,node.y, Surface, preserve_screen_top_of_cursor_node)
end
-- continue the pipeline
B(preserve_screen_top_of_cursor_node)
-- TODO: ugly that we're manipulating editor objects twice
end
{"on.save_settings":687,"on.load_settings":698,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":697,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
on.keychord_press = function(chord, key)
print('key', chord)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-g' then
-- special 'global zoom' mode
zoom_out()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"on.save_settings":687,"on.load_settings":697,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":696,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
{"on.save_settings":687,"on.load_settings":696,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":695,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
{"on.code_change":924,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":784,"Definitions":503,"Zoomed_out":869,"manifest_navigator_up":628,"Manifest":769,"manifest_navigator_down":635,"zoom_in":920,"delete_definition":673,"get_manifest":768,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"maybe_update_key_in_definitions":529,"manifest_coord":636,"new_definition":848,"manifest_navigator_candidates":638,"fw_app":"driver","add_def_to_menu":640,"on.draw":917,"Cursor_node":172,"Failing_test_definition_background_color":925,"on_handle":547,"on.code_submit":926,"on":1,"on_text":539,"on.mouse_press":916,"tick_spec":660,"on.keychord_press":919,"get_multiple_definitions_from_app":783,"schema1_of_y":667,"vx":545,"wait_for_response":781,"copy_viewport":866,"zoom_out":908,"on.load_settings":782,"Surface":422,"mouse_cursor":558,"line_height":365,"Mouse_cursor":559,"Menu_highlight_color":614,"Save_viewport":865,"sx":544,"set_mouse_cursor":562,"box_height":680,"Viewport":604,"font":353,"on.key_release":720,"vy":546,"on.save_settings":742,"initialize_manifest_navigator":773,"scale":712,"on.initialize":807,"survey_animation":906,"load_definition":854,"animate_next":914,"Ticks_font":669,"table_and_array_both_empty":689,"approximate":579,"Page":475,"order_of_magnitude":573,"animate_next_frame":915,"update_editor_box":711,"load_manifest":694,"draw_ticks":862,"A":831,"fw_parent":925,"Manifest_navigator":495,"Num_animation_frames":840,"sy":469,"surface_bounds":814,"y_of_schema1":364,"compute_layout":385,"copy_shape":396,"manifest_index":637,"draw_cursor":639,"undo_zoom_out":921,"on.mouse_release":836,"Definition_background_color":849,"Menu_command_color":613,"Spawn_point":822,"Menu_background_color":611,"from_viewport":823,"Test_definition_background_color":858,"interpolate_viewport":843,"definition_background_color":859,"initialize_editor":678,"approximate_up":658,"Animating":842,"draw_menu_bar":861,"on.text_input":855,"add_hotkey_to_menu":616,"B":830,"Menu_border_color":612,"draw_manifest_navigator":677,"on.update":900,"num_lines_for_manifest_navigator":676,"snapshot_canvas":913,"draw_run_time_error":808,"reset_manifest_navigator":772}
{"on.save_settings":687,"on.load_settings":688,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":695,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":694,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
{"on.save_settings":687,"on.load_settings":688,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":692,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":693,"Viewport":604,"load_manifest":694,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
on.update = function(dt)
if Pan then
end
if Move or on_handle(App.mouse_x(), App.mouse_y()) then
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
A()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
{"on.save_settings":687,"on.load_settings":688,"manifest_navigator_down":635,"delete_definition":673,"table_and_array_both_empty":689,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"box_height":680,"text_input_on_manifest_navigator":634,"compute_layout":385,"manifest_coord":636,"on.code_change":306,"manifest_index":637,"on.mouse_press":617,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"on.key_release":552,"draw_cursor":639,"initialize_editor":678,"font":353,"update_editor_box":570,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"add_thick_line":400,"copy_shape":396,"order_of_magnitude":573,"on.mouse_release":554,"approximate":579,"approximate_up":658,"scale":7,"Ticks_font":669,"on.initialize":692,"A":507,"Surface":422,"fw_app":"driver","on.text_input":521,"on.draw":565,"Cursor_node":172,"Manifest":494,"fw_parent":692,"Viewport":604,"load_manifest":496,"y_of_schema1":364,"get_manifest":693,"on_text":539,"on_handle":547,"schema1_of_y":667,"Menu_background_color":611,"tick_spec":660,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"on.keychord_press":666,"draw_menu_bar":641,"vy":546,"add_hotkey_to_menu":616,"Page":475,"on":1,"draw_manifest_navigator":677,"new_definition":681,"num_lines_for_manifest_navigator":676,"load_definition":682,"sy":469,"reset_manifest_navigator":621,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"B":379,"get_definition_from_app":624,"Manifest_navigator":495}
{"draw_ticks":663,"update_editor_box":570,"tick_spec":660,"order_of_magnitude":573,"schema1_of_y":667,"box_height":680,"approximate":579,"copy_shape":396,"load_definition":682,"approximate_up":658,"sy":469,"on.save_settings":687,"on.load_settings":688,"new_definition":681,"table_and_array_both_empty":689,"Manifest_navigator":495,"Surface":422,"draw_cursor":639,"on.mouse_release":554,"Menu_background_color":611,"on":1,"Menu_border_color":612,"Menu_command_color":613,"load_manifest":496,"Menu_highlight_color":614,"get_manifest":497,"draw_menu_bar":641,"add_hotkey_to_menu":616,"line_height":365,"draw_manifest_navigator":677,"Definitions":503,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"load_from_iterator":670,"get_definition_from_app":624,"manifest_navigator_up":628,"initialize_editor":678,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"on.draw":565,"vx":545,"manifest_coord":636,"A":507,"add_thick_line":400,"scale":7,"vy":546,"B":379,"on_handle":547,"sx":544,"mouse_cursor":558,"on.mouse_press":617,"text_input_on_manifest_navigator":634,"on_text":539,"manifest_index":637,"on.update":561,"manifest_navigator_candidates":638,"on.keychord_press":666,"maybe_update_key_in_definitions":529,"add_def_to_menu":640,"on.code_change":306,"Page":475,"Ticks_font":669,"y_of_schema1":364,"Cursor_node":172,"fw_parent":691,"on.key_release":552,"on.initialize":692,"on.text_input":521,"Viewport":604,"compute_layout":385,"font":353,"Mouse_cursor":559,"set_mouse_cursor":562,"Manifest":494}
on.keychord_press = function(chord, key)
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"draw_ticks":663,"update_editor_box":570,"tick_spec":660,"order_of_magnitude":573,"schema1_of_y":667,"box_height":680,"approximate":579,"copy_shape":396,"load_definition":682,"approximate_up":658,"sy":469,"on.save_settings":687,"on.load_settings":688,"new_definition":681,"table_and_array_both_empty":689,"Manifest_navigator":495,"Surface":422,"draw_cursor":639,"on.mouse_release":554,"Menu_background_color":611,"on":1,"Menu_border_color":612,"Menu_command_color":613,"load_manifest":496,"Menu_highlight_color":614,"get_manifest":497,"draw_menu_bar":641,"add_hotkey_to_menu":616,"line_height":365,"draw_manifest_navigator":677,"Definitions":503,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"load_from_iterator":670,"get_definition_from_app":624,"manifest_navigator_up":628,"initialize_editor":678,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"on.draw":565,"vx":545,"manifest_coord":636,"A":507,"add_thick_line":400,"scale":7,"vy":546,"B":379,"on_handle":547,"sx":544,"mouse_cursor":558,"on.mouse_press":617,"text_input_on_manifest_navigator":634,"on_text":539,"manifest_index":637,"on.update":561,"manifest_navigator_candidates":638,"on.keychord_press":666,"maybe_update_key_in_definitions":529,"add_def_to_menu":640,"on.code_change":306,"Page":475,"Ticks_font":669,"y_of_schema1":364,"Cursor_node":172,"fw_parent":690,"on.key_release":552,"on.initialize":691,"on.text_input":521,"Viewport":604,"compute_layout":385,"font":353,"Mouse_cursor":559,"set_mouse_cursor":562,"Manifest":494}
{"reset_manifest_navigator":621,"load_from_iterator":670,"get_definition_from_app":624,"add_thick_line":400,"line_height":365,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"manifest_navigator_down":635,"on.initialize":690,"delete_definition":673,"on.save_settings":687,"scale":7,"on.load_settings":688,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"table_and_array_both_empty":689,"manifest_index":637,"manifest_navigator_candidates":638,"vx":545,"vy":546,"on_text":539,"on.mouse_release":554,"new_definition":681,"Page":475,"draw_cursor":639,"on.key_release":552,"tick_spec":660,"mouse_cursor":558,"on":1,"Mouse_cursor":559,"font":353,"update_editor_box":570,"on.code_change":306,"approximate":579,"y_of_schema1":364,"approximate_up":658,"Ticks_font":669,"add_def_to_menu":640,"on.keychord_press":666,"Cursor_node":172,"fw_parent":689,"copy_shape":396,"move_candidate_to_front_of_manifest":632,"on.draw":565,"B":379,"on.text_input":521,"Viewport":604,"Manifest_navigator":495,"compute_layout":385,"Surface":422,"load_definition":682,"A":507,"draw_manifest_navigator":677,"schema1_of_y":667,"on.mouse_press":617,"sy":469,"draw_ticks":663,"initialize_editor":678,"on.update":561,"get_manifest":497,"Menu_background_color":611,"Manifest":494,"Menu_border_color":612,"Menu_command_color":613,"load_manifest":496,"order_of_magnitude":573,"Menu_highlight_color":614,"manifest_coord":636,"draw_menu_bar":641,"sx":544,"add_hotkey_to_menu":616,"box_height":680,"on_handle":547,"Definitions":503,"set_mouse_cursor":562,"num_lines_for_manifest_navigator":676}
{"manifest_navigator_down":635,"line_height":365,"delete_definition":673,"add_thick_line":400,"copy_shape":396,"fw_parent":1016,"draw_run_time_error":808,"on_handle":547,"box_height":680,"compute_layout":385,"survey_animation":1014,"on_text":539,"on.load_settings":940,"sx":955,"table_and_array_both_empty":689,"font":353,"on.key_release":720,"text_input_on_manifest_navigator":634,"surface_bounds":814,"manifest_index":637,"on.initialize":948,"mouse_cursor":558,"A":1017,"Mouse_cursor":559,"initialize_editor":678,"B":830,"set_mouse_cursor":562,"draw_ticks":997,"get_definition_from_app":784,"on.update":945,"on.draw":986,"Animating":842,"undo_zoom_out":921,"order_of_magnitude":573,"Failing_test_definition_background_color":925,"animate_next_frame":915,"zoom_out":908,"initialize_manifest_navigator":773,"approximate":579,"tick_spec":998,"Definitions":503,"Num_animation_frames":840,"add_def_to_menu":640,"draw_load_time_error":929,"load_manifest":694,"draw_test_failure_indicator":935,"scale":712,"approximate_up":985,"manifest_navigator_candidates":638,"zoom_in":920,"on.keychord_press":919,"Definition_background_color":849,"Ticks_font":669,"manifest_coord":636,"load_definition":854,"Menu_border_color":612,"Test_definition_background_color":858,"interpolate_viewport":843,"definition_background_color":1015,"keychord_press_on_manifest_navigator":765,"from_viewport":823,"sy":954,"move_candidate_to_front_of_manifest":632,"Spawn_point":822,"on.save_settings":742,"update_editor_box":711,"Surface":422,"wait_for_response":781,"fw_app":"driver","iscale":953,"snapshot_canvas":913,"vx":545,"Save_viewport":865,"Manifest_navigator":495,"copy_viewport":866,"on.code_change":924,"vy":956,"Menu_background_color":611,"test_approximate_up":983,"Zoomed_out":869,"y_of_schema1":364,"on.mouse_press":916,"on.code_submit":947,"Menu_highlight_color":614,"animate_next":914,"draw_menu_bar":861,"draw_cursor":639,"add_hotkey_to_menu":616,"Manifest":769,"get_default_map":937,"draw_manifest_navigator":677,"Page":475,"num_lines_for_manifest_navigator":676,"get_manifest":768,"on":1,"reset_manifest_navigator":772,"get_multiple_definitions_from_app":1016,"schema1_of_y":667,"load_from_iterator":670,"maybe_update_key_in_definitions":529,"Cursor_node":172,"on.mouse_release":836,"new_definition":848,"Viewport":604,"Menu_command_color":613,"manifest_navigator_up":628,"on.text_input":855}
{"Page":475,"initialize_editor":678,"add_thick_line":400,"approximate_up":658,"copy_shape":396,"Manifest_navigator":495,"Ticks_font":669,"new_definition":681,"Manifest":494,"load_manifest":496,"get_manifest":497,"on.text_input":521,"scale":7,"Definitions":503,"on.initialize":506,"A":507,"Menu_command_color":613,"B":379,"table_and_array_both_empty":689,"draw_menu_bar":641,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":621,"load_from_iterator":670,"maybe_update_key_in_definitions":529,"get_definition_from_app":624,"on":1,"manifest_navigator_up":628,"draw_cursor":639,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"manifest_coord":636,"on_handle":547,"manifest_index":637,"fw_parent":688,"manifest_navigator_candidates":638,"on_text":539,"sy":469,"load_definition":682,"update_editor_box":570,"sx":544,"on.save_settings":687,"on.key_release":552,"schema1_of_y":667,"Cursor_node":172,"line_height":365,"box_height":680,"font":353,"y_of_schema1":364,"tick_spec":660,"mouse_cursor":558,"on.code_change":306,"Mouse_cursor":559,"vx":545,"on.update":561,"Viewport":604,"set_mouse_cursor":562,"vy":546,"draw_ticks":663,"Menu_highlight_color":614,"Menu_border_color":612,"Surface":422,"compute_layout":385,"on.mouse_press":617,"text_input_on_manifest_navigator":634,"on.mouse_release":554,"on.draw":565,"order_of_magnitude":573,"Menu_background_color":611,"on.keychord_press":666,"on.load_settings":688,"add_def_to_menu":640,"approximate":579}
{"A":831,"move_candidate_to_front_of_manifest":632,"Spawn_point":822,"keychord_press_on_manifest_navigator":765,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"Mouse_cursor":559,"manifest_coord":636,"manifest_index":637,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":862,"add_def_to_menu":640,"line_height":365,"Definition_background_color":849,"box_height":680,"order_of_magnitude":573,"compute_layout":385,"definition_background_color":859,"on.code_change":924,"approximate":579,"load_manifest":694,"on":1,"get_manifest":768,"approximate_up":658,"snapshot_canvas":913,"Save_viewport":865,"draw_cursor":639,"Ticks_font":669,"zoom_out":908,"Zoomed_out":869,"update_editor_box":711,"initialize_editor":678,"zoom_in":920,"get_default_map":937,"on.mouse_press":916,"fw_app":"driver","on.save_settings":742,"num_lines_for_manifest_navigator":676,"Manifest_navigator":495,"on.code_submit":927,"initialize_manifest_navigator":773,"Menu_background_color":611,"animate_next_frame":915,"Menu_border_color":612,"y_of_schema1":364,"Menu_command_color":613,"Manifest":769,"Menu_highlight_color":614,"copy_viewport":866,"draw_menu_bar":861,"font":353,"add_hotkey_to_menu":616,"animate_next":914,"get_multiple_definitions_from_app":783,"Num_animation_frames":840,"survey_animation":906,"on.load_settings":940,"wait_for_response":781,"on.text_input":855,"fw_parent":943,"sx":544,"maybe_update_key_in_definitions":529,"vx":545,"sy":469,"load_definition":854,"scale":712,"Animating":842,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":660,"on.key_release":720,"on.draw":932,"Page":475,"draw_run_time_error":808,"new_definition":848,"undo_zoom_out":921,"add_thick_line":400,"B":830,"copy_shape":396,"on_handle":547,"Failing_test_definition_background_color":925,"vy":546,"draw_manifest_navigator":677,"draw_test_failure_indicator":935,"on_text":539,"draw_load_time_error":929,"table_and_array_both_empty":689,"reset_manifest_navigator":772,"Cursor_node":172,"on.mouse_release":836,"load_from_iterator":670,"on.update":944,"get_definition_from_app":784,"on.keychord_press":919,"Viewport":604,"Test_definition_background_color":858,"surface_bounds":814,"manifest_navigator_up":628,"Definitions":503,"manifest_navigator_down":635,"Surface":422,"on.initialize":807,"delete_definition":673}
{"add_thick_line":400,"draw_ticks":663,"copy_shape":396,"maybe_update_key_in_definitions":529,"compute_layout":385,"order_of_magnitude":573,"load_definition":682,"update_editor_box":570,"approximate":579,"on.save_settings":687,"on.load_settings":688,"on_handle":547,"y_of_schema1":364,"on.mouse_press":617,"on.mouse_release":554,"sx":544,"initialize_editor":678,"vx":545,"on.key_release":552,"on":1,"on.text_input":521,"mouse_cursor":558,"Menu_background_color":611,"Mouse_cursor":559,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"scale":7,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"draw_cursor":639,"reset_manifest_navigator":621,"load_from_iterator":670,"get_definition_from_app":624,"sy":469,"Surface":422,"manifest_navigator_down":635,"on.draw":565,"delete_definition":673,"Viewport":604,"box_height":680,"on.initialize":506,"A":507,"manifest_coord":636,"B":379,"manifest_index":637,"manifest_navigator_candidates":638,"on.keychord_press":666,"add_def_to_menu":640,"move_candidate_to_front_of_manifest":632,"Manifest":494,"text_input_on_manifest_navigator":634,"Page":475,"load_manifest":496,"schema1_of_y":667,"get_manifest":497,"manifest_navigator_up":628,"fw_parent":687,"on.code_change":306,"font":353,"keychord_press_on_manifest_navigator":675,"approximate_up":658,"Definitions":503,"vy":546,"new_definition":681,"Cursor_node":172,"Manifest_navigator":495,"on.update":561,"on_text":539,"tick_spec":660,"Ticks_font":669,"line_height":365,"set_mouse_cursor":562}
Page = {
-- page
type='cols', x=0, y=0,
width=800, data={
-- editor covering left side
{
type='text',
name='editor',
doc='prose goes here, on the left half of the window',
data={
"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
'1',
'2',
'3',
'mno',
'Acb',
'g',
'hij',
'klm',
'nop',
},
width=400, bg={r=1,g=1,b=0}
},
-- a table on the right
{ type='rows', name='searches', margin=50, data={
{ type='text', data={''},},
{ type='cols', data={
{ type='text', data={'search:'},},
{ type='text', name='search', bg={r=0.8,g=0.8,b=0.8}, data={''}, width=90,},
}},
{ type='text', data={'table:'},},
{ type='cols', bg={r=0.8,g=0.8,b=0.8}, data={
{ type='rows', width=90, data={
{type='text', data={'abc'},},
{type='text', data={'abc'},},
}},
{ type='rows', width=90, data={
{type='text', data={'def'},},
{type='text', data={'def'},},
}},
}},
}},
},
}
{"Surface":422,"keychord_press_on_manifest_navigator":675,"draw_cursor":639,"on.draw":565,"new_definition":681,"on.key_release":552,"manifest_coord":636,"manifest_index":637,"on.text_input":521,"vy":546,"on.initialize":506,"add_def_to_menu":640,"mouse_cursor":558,"copy_shape":396,"Mouse_cursor":559,"on.mouse_release":554,"B":379,"maybe_update_key_in_definitions":529,"set_mouse_cursor":562,"on.keychord_press":666,"draw_ticks":663,"initialize_editor":678,"tick_spec":660,"on_handle":547,"order_of_magnitude":573,"load_definition":682,"Page":475,"box_height":680,"approximate":579,"compute_layout":385,"font":353,"on.save_settings":687,"Viewport":604,"on.load_settings":684,"approximate_up":658,"Ticks_font":669,"Cursor_node":172,"scale":7,"sy":469,"Menu_background_color":611,"sx":544,"Menu_border_color":612,"manifest_navigator_candidates":638,"Menu_command_color":613,"on.update":561,"Menu_highlight_color":614,"vx":545,"draw_menu_bar":641,"on_text":539,"add_hotkey_to_menu":616,"Manifest_navigator":495,"add_thick_line":400,"draw_manifest_navigator":677,"line_height":365,"num_lines_for_manifest_navigator":676,"Definitions":503,"y_of_schema1":364,"reset_manifest_navigator":621,"on":1,"on.code_change":306,"load_from_iterator":670,"update_editor_box":570,"get_definition_from_app":624,"A":507,"Manifest":494,"fw_parent":686,"on.mouse_press":617,"manifest_navigator_up":628,"load_manifest":496,"manifest_navigator_down":635,"get_manifest":497,"schema1_of_y":667,"delete_definition":673,"text_input_on_manifest_navigator":634,"move_candidate_to_front_of_manifest":632}
{"survey_animation":906,"on.save_settings":742,"fw_app":"driver","on.load_settings":940,"Spawn_point":822,"from_viewport":823,"y_of_schema1":364,"interpolate_viewport":843,"table_and_array_both_empty":689,"get_default_map":937,"Manifest_navigator":495,"move_candidate_to_front_of_manifest":632,"B":830,"text_input_on_manifest_navigator":634,"manifest_coord":636,"A":831,"Animating":842,"manifest_navigator_candidates":638,"Menu_background_color":611,"Num_animation_frames":840,"Menu_border_color":612,"on.mouse_press":916,"Menu_command_color":613,"Menu_highlight_color":614,"add_hotkey_to_menu":616,"on.code_change":924,"draw_ticks":862,"add_thick_line":400,"draw_menu_bar":861,"copy_shape":396,"Test_definition_background_color":858,"definition_background_color":859,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"vx":545,"maybe_update_key_in_definitions":529,"get_definition_from_app":784,"snapshot_canvas":913,"Save_viewport":865,"on.initialize":807,"copy_viewport":866,"zoom_out":908,"Ticks_font":669,"Viewport":604,"delete_definition":673,"Surface":422,"keychord_press_on_manifest_navigator":765,"on_handle":547,"zoom_in":920,"manifest_navigator_down":635,"Definitions":503,"manifest_navigator_up":628,"on_text":539,"surface_bounds":814,"on.code_submit":946,"on.update":945,"on.keychord_press":919,"Page":475,"sx":544,"load_from_iterator":670,"Manifest":769,"on.mouse_release":836,"Cursor_node":172,"load_manifest":694,"mouse_cursor":558,"get_manifest":768,"draw_load_time_error":929,"draw_test_failure_indicator":935,"vy":546,"Failing_test_definition_background_color":925,"animate_next_frame":915,"reset_manifest_navigator":772,"draw_run_time_error":808,"initialize_manifest_navigator":773,"new_definition":848,"Mouse_cursor":559,"on.key_release":720,"tick_spec":660,"schema1_of_y":667,"get_multiple_definitions_from_app":783,"scale":712,"update_editor_box":711,"Zoomed_out":869,"wait_for_response":781,"on":1,"compute_layout":385,"draw_cursor":639,"manifest_index":637,"approximate_up":658,"order_of_magnitude":573,"font":353,"on.draw":932,"animate_next":914,"sy":469,"approximate":579,"load_definition":854,"undo_zoom_out":921,"set_mouse_cursor":562,"Definition_background_color":849,"initialize_editor":678,"line_height":365,"box_height":680,"add_def_to_menu":640,"on.text_input":855,"fw_parent":945}
{"add_def_to_menu":640,"sx":544,"update_editor_box":570,"B":379,"on.mouse_release":554,"on.key_release":552,"schema1_of_y":667,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":663,"compute_layout":385,"fw_parent":685,"on.code_change":306,"order_of_magnitude":573,"initialize_editor":678,"approximate":579,"on.draw":565,"approximate_up":658,"Ticks_font":669,"on.initialize":506,"y_of_schema1":364,"sy":469,"Manifest":494,"load_manifest":496,"get_manifest":497,"draw_cursor":639,"Menu_background_color":611,"Page":475,"tick_spec":660,"Definitions":503,"Menu_command_color":613,"new_definition":681,"Menu_highlight_color":614,"Menu_border_color":612,"draw_menu_bar":641,"A":507,"add_hotkey_to_menu":616,"on.text_input":521,"Viewport":604,"draw_manifest_navigator":677,"Surface":422,"vy":546,"manifest_index":637,"load_definition":682,"reset_manifest_navigator":621,"Manifest_navigator":495,"on.mouse_press":617,"load_from_iterator":670,"font":353,"line_height":365,"on.update":561,"scale":7,"on.keychord_press":666,"text_input_on_manifest_navigator":634,"on.save_settings":686,"maybe_update_key_in_definitions":529,"on.load_settings":684,"get_definition_from_app":624,"box_height":680,"delete_definition":673,"manifest_navigator_down":635,"move_candidate_to_front_of_manifest":632,"manifest_navigator_up":628,"keychord_press_on_manifest_navigator":675,"on":1,"on_handle":547,"Cursor_node":172,"copy_shape":396,"manifest_coord":636,"add_thick_line":400,"on_text":539,"vx":545,"manifest_navigator_candidates":638,"num_lines_for_manifest_navigator":676}
{"y_of_schema1":364,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"add_def_to_menu":640,"box_height":680,"Manifest_navigator":495,"compute_layout":385,"on_text":539,"scale":712,"on":1,"sx":544,"add_thick_line":400,"on.key_release":720,"draw_run_time_error":808,"tick_spec":660,"load_manifest":694,"font":353,"survey_animation":863,"mouse_cursor":558,"Surface":422,"Mouse_cursor":559,"Definitions":503,"on.draw":797,"initialize_editor":678,"vx":545,"Viewport":604,"vy":546,"approximate":579,"surface_bounds":814,"on.save_settings":742,"on.mouse_release":836,"maybe_update_key_in_definitions":529,"on.update":835,"load_definition":854,"approximate_up":658,"table_and_array_both_empty":689,"Ticks_font":669,"interpolate_viewport":843,"draw_cursor":639,"Definition_background_color":849,"on.load_settings":782,"schema1_of_y":667,"on_handle":547,"line_height":365,"get_manifest":768,"definition_background_color":859,"on.text_input":855,"new_definition":848,"animate_next_frame":825,"on.initialize":807,"Manifest":769,"Num_animation_frames":840,"initialize_manifest_navigator":773,"on.keychord_press":828,"fw_parent":862,"B":830,"fw_app":"driver","Menu_background_color":611,"get_multiple_definitions_from_app":783,"Menu_border_color":612,"set_mouse_cursor":562,"Menu_command_color":613,"wait_for_response":781,"Menu_highlight_color":614,"on.code_submit":787,"order_of_magnitude":573,"add_hotkey_to_menu":616,"Test_definition_background_color":858,"draw_ticks":862,"draw_manifest_navigator":677,"Cursor_node":172,"sy":469,"on.code_change":820,"manifest_navigator_up":628,"reset_manifest_navigator":772,"update_editor_box":711,"Animating":842,"load_from_iterator":670,"Spawn_point":822,"get_definition_from_app":784,"draw_menu_bar":861,"Page":475,"num_lines_for_manifest_navigator":676,"animate_next":841,"on.mouse_press":722,"A":831,"manifest_navigator_down":635,"copy_shape":396,"from_viewport":823,"delete_definition":673}
box_height = function(node)
-- return the height of a text editor node (explicit width). The result is unscaled.
local y = 0
for i=1,#node.editor.lines do
local line = node.editor.lines[i]
if node.editor.line_cache[i] == nil then
node.editor.line_cache[i] = {}
end
node.editor.line_cache[i].fragments = nil
node.editor.line_cache[i].screen_line_starting_pos = nil
Text.populate_screen_line_starting_pos(node.editor, i)
y = y + 20*1.3*#node.editor.line_cache[i].screen_line_starting_pos
Text.clear_screen_line_cache(node.editor, i)
end
return y
end
{"draw_cursor":639,"mouse_cursor":558,"fw_parent":877,"Mouse_cursor":559,"Definitions":503,"on.mouse_release":836,"set_mouse_cursor":562,"zoom_out":870,"draw_ticks":862,"load_manifest":694,"zoom_in":877,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"on.code_submit":787,"approximate":579,"add_thick_line":400,"y_of_schema1":364,"A":831,"approximate_up":658,"get_multiple_definitions_from_app":783,"Ticks_font":669,"on_handle":547,"wait_for_response":781,"Page":475,"on_text":539,"on.code_change":820,"sx":544,"manifest_navigator_down":635,"from_viewport":823,"on.initialize":807,"vx":545,"draw_run_time_error":808,"tick_spec":660,"update_editor_box":711,"get_manifest":768,"on.key_release":720,"survey_animation":863,"Manifest":769,"animate_next":841,"Menu_border_color":612,"schema1_of_y":667,"on":1,"scale":712,"Menu_highlight_color":614,"animate_next_frame":825,"draw_menu_bar":861,"copy_shape":396,"add_hotkey_to_menu":616,"load_definition":854,"on.mouse_press":878,"draw_manifest_navigator":677,"vy":546,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"surface_bounds":814,"reset_manifest_navigator":772,"on.keychord_press":871,"line_height":365,"load_from_iterator":670,"Animating":842,"get_definition_from_app":784,"manifest_navigator_candidates":638,"on.load_settings":782,"Spawn_point":822,"manifest_index":637,"manifest_navigator_up":628,"Num_animation_frames":840,"interpolate_viewport":843,"Surface":422,"new_definition":848,"delete_definition":673,"sy":469,"move_candidate_to_front_of_manifest":632,"on.text_input":855,"keychord_press_on_manifest_navigator":765,"B":830,"text_input_on_manifest_navigator":634,"font":353,"Zoomed_out":869,"manifest_coord":636,"initialize_manifest_navigator":773,"Test_definition_background_color":858,"Cursor_node":172,"Manifest_navigator":495,"on.update":835,"on.save_settings":742,"add_def_to_menu":640,"fw_app":"driver","table_and_array_both_empty":689,"Menu_background_color":611,"definition_background_color":859,"compute_layout":385,"Menu_command_color":613,"box_height":680,"on.draw":797,"snapshot_canvas":872,"Definition_background_color":849,"Save_viewport":865,"Viewport":604,"copy_viewport":866}
{"load_definition":682,"scale":7,"on.draw":565,"sy":469,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"Manifest_navigator":495,"box_height":680,"Cursor_node":172,"Manifest":494,"Surface":422,"compute_layout":385,"get_manifest":497,"on.code_change":306,"vx":545,"Definitions":503,"on.save_settings":685,"draw_ticks":663,"on.mouse_press":617,"get_definition_from_app":624,"on.update":561,"on.keychord_press":666,"initialize_editor":678,"manifest_navigator_up":628,"manifest_navigator_down":635,"approximate":579,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"approximate_up":658,"manifest_coord":636,"manifest_index":637,"Ticks_font":669,"manifest_navigator_candidates":638,"on.load_settings":684,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"order_of_magnitude":573,"Menu_command_color":613,"line_height":365,"font":353,"on_handle":547,"draw_menu_bar":641,"Mouse_cursor":559,"add_hotkey_to_menu":616,"on_text":539,"new_definition":681,"draw_manifest_navigator":677,"load_manifest":496,"num_lines_for_manifest_navigator":676,"update_editor_box":570,"fw_parent":684,"reset_manifest_navigator":621,"maybe_update_key_in_definitions":529,"sx":544,"load_from_iterator":670,"tick_spec":660,"on":1,"on.key_release":552,"vy":546,"schema1_of_y":667,"y_of_schema1":364,"on.text_input":521,"Viewport":604,"on.initialize":506,"Menu_highlight_color":614,"A":507,"mouse_cursor":558,"Page":475,"draw_cursor":639,"B":379,"set_mouse_cursor":562}
{"load_definition":682,"scale":7,"on.draw":565,"sy":469,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"Manifest_navigator":495,"box_height":680,"Cursor_node":172,"Manifest":494,"Surface":422,"compute_layout":385,"get_manifest":497,"on.code_change":306,"vx":545,"Definitions":503,"on.save_settings":683,"draw_ticks":663,"on.mouse_press":617,"get_definition_from_app":624,"on.update":561,"on.keychord_press":666,"initialize_editor":678,"manifest_navigator_up":628,"manifest_navigator_down":635,"approximate":579,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"approximate_up":658,"manifest_coord":636,"manifest_index":637,"Ticks_font":669,"manifest_navigator_candidates":638,"on.load_settings":684,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"order_of_magnitude":573,"Menu_command_color":613,"line_height":365,"font":353,"on_handle":547,"draw_menu_bar":641,"Mouse_cursor":559,"add_hotkey_to_menu":616,"on_text":539,"new_definition":681,"draw_manifest_navigator":677,"load_manifest":496,"num_lines_for_manifest_navigator":676,"update_editor_box":570,"fw_parent":683,"reset_manifest_navigator":621,"maybe_update_key_in_definitions":529,"sx":544,"load_from_iterator":670,"tick_spec":660,"on":1,"on.key_release":552,"vy":546,"schema1_of_y":667,"y_of_schema1":364,"on.text_input":521,"Viewport":604,"on.initialize":506,"Menu_highlight_color":614,"A":507,"mouse_cursor":558,"Page":475,"draw_cursor":639,"B":379,"set_mouse_cursor":562}
draw_test_failure_indicator = function()
print('test failure indicator A')
if Client_app_test_failures == nil then
return
end
print('test failure indicator B')
if next(Client_app_test_failures, nil) == nil then
return
end
print('test failure indicator C')
App.color(Failing_test_definition_background_color)
local border_width = App.screen.width/40, App.screen.height
love.graphics.rectangle('fill', 0,0, border_width,App.screen.height)
love.graphics.rectangle('fill', App.screen.width-border_width, 0, border_width, App.screen.height)
love.graphics.rectangle('fill', 0,App.screen.height-border_width, App.screen.width, border_width)
end
{"load_definition":682,"scale":7,"on.draw":565,"sy":469,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"Manifest_navigator":495,"box_height":680,"Cursor_node":172,"Manifest":494,"Surface":422,"compute_layout":385,"get_manifest":497,"on.code_change":306,"vx":545,"Definitions":503,"on.save_settings":683,"draw_ticks":663,"on.mouse_press":617,"get_definition_from_app":624,"on.update":561,"on.keychord_press":666,"initialize_editor":678,"manifest_navigator_up":628,"manifest_navigator_down":635,"approximate":579,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"approximate_up":658,"manifest_coord":636,"manifest_index":637,"Ticks_font":669,"manifest_navigator_candidates":638,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"order_of_magnitude":573,"Menu_command_color":613,"line_height":365,"font":353,"on_handle":547,"draw_menu_bar":641,"Mouse_cursor":559,"add_hotkey_to_menu":616,"on_text":539,"new_definition":681,"draw_manifest_navigator":677,"load_manifest":496,"num_lines_for_manifest_navigator":676,"update_editor_box":570,"fw_parent":682,"reset_manifest_navigator":621,"maybe_update_key_in_definitions":529,"sx":544,"load_from_iterator":670,"tick_spec":660,"on":1,"on.key_release":552,"vy":546,"schema1_of_y":667,"y_of_schema1":364,"on.text_input":521,"Viewport":604,"on.initialize":506,"Menu_highlight_color":614,"A":507,"mouse_cursor":558,"Page":475,"draw_cursor":639,"B":379,"set_mouse_cursor":562}
{"compute_layout":385,"approximate":579,"maybe_update_key_in_definitions":529,"approximate_up":658,"Ticks_font":669,"sy":469,"update_editor_box":570,"on_handle":547,"initialize_editor":678,"on_text":539,"schema1_of_y":667,"Manifest_navigator":495,"sx":544,"y_of_schema1":364,"draw_manifest_navigator":677,"Menu_background_color":611,"num_lines_for_manifest_navigator":676,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"Manifest":494,"draw_menu_bar":641,"Cursor_node":172,"add_hotkey_to_menu":616,"on.code_change":306,"get_manifest":497,"manifest_navigator_up":628,"manifest_navigator_down":635,"draw_cursor":639,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"on":1,"manifest_index":637,"manifest_navigator_candidates":638,"on.text_input":521,"add_def_to_menu":640,"Viewport":604,"vy":546,"on.mouse_press":617,"on.mouse_release":554,"vx":545,"on.draw":565,"tick_spec":660,"on.key_release":552,"Page":475,"on.initialize":506,"A":507,"load_definition":682,"line_height":365,"add_thick_line":400,"B":379,"mouse_cursor":558,"Surface":422,"box_height":680,"get_definition_from_app":624,"load_from_iterator":670,"font":353,"set_mouse_cursor":562,"scale":7,"draw_ticks":663,"fw_parent":681,"Definitions":503,"load_manifest":496,"new_definition":681,"Mouse_cursor":559,"reset_manifest_navigator":621,"on.update":561,"on.keychord_press":666,"order_of_magnitude":573,"copy_shape":396,"manifest_coord":636}
{"compute_layout":385,"approximate":579,"maybe_update_key_in_definitions":529,"approximate_up":658,"Ticks_font":669,"sy":469,"update_editor_box":570,"on_handle":547,"initialize_editor":678,"on_text":539,"schema1_of_y":667,"Manifest_navigator":495,"sx":544,"y_of_schema1":364,"draw_manifest_navigator":677,"Menu_background_color":611,"num_lines_for_manifest_navigator":676,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"Manifest":494,"draw_menu_bar":641,"Cursor_node":172,"add_hotkey_to_menu":616,"on.code_change":306,"get_manifest":497,"manifest_navigator_up":628,"manifest_navigator_down":635,"draw_cursor":639,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"on":1,"manifest_index":637,"manifest_navigator_candidates":638,"on.text_input":521,"add_def_to_menu":640,"Viewport":604,"vy":546,"on.mouse_press":617,"on.mouse_release":554,"vx":545,"on.draw":565,"tick_spec":660,"on.key_release":552,"Page":475,"on.initialize":506,"A":507,"load_definition":674,"line_height":365,"add_thick_line":400,"B":379,"mouse_cursor":558,"Surface":422,"box_height":680,"get_definition_from_app":624,"load_from_iterator":670,"font":353,"set_mouse_cursor":562,"scale":7,"draw_ticks":663,"fw_parent":680,"Definitions":503,"load_manifest":496,"new_definition":681,"Mouse_cursor":559,"reset_manifest_navigator":621,"on.update":561,"on.keychord_press":666,"order_of_magnitude":573,"copy_shape":396,"manifest_coord":636}
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":992,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":993,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":992,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":995,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":996,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":992,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
{"compute_layout":385,"approximate":579,"maybe_update_key_in_definitions":529,"approximate_up":658,"Ticks_font":669,"sy":469,"update_editor_box":570,"on_handle":547,"initialize_editor":678,"on_text":539,"schema1_of_y":667,"Manifest_navigator":495,"sx":544,"y_of_schema1":364,"draw_manifest_navigator":677,"Menu_background_color":611,"num_lines_for_manifest_navigator":676,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"Manifest":494,"draw_menu_bar":641,"Cursor_node":172,"add_hotkey_to_menu":616,"on.code_change":306,"get_manifest":497,"manifest_navigator_up":628,"manifest_navigator_down":635,"draw_cursor":639,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"on":1,"manifest_index":637,"manifest_navigator_candidates":638,"on.text_input":521,"add_def_to_menu":640,"Viewport":604,"vy":546,"on.mouse_press":617,"on.mouse_release":554,"vx":545,"on.draw":565,"tick_spec":660,"on.key_release":552,"Page":475,"on.initialize":506,"A":507,"load_definition":674,"line_height":365,"add_thick_line":400,"B":379,"mouse_cursor":558,"Surface":422,"box_height":680,"get_definition_from_app":624,"load_from_iterator":670,"font":353,"set_mouse_cursor":562,"scale":7,"draw_ticks":663,"fw_parent":679,"Definitions":503,"load_manifest":496,"new_definition":671,"Mouse_cursor":559,"reset_manifest_navigator":621,"on.update":561,"on.keychord_press":666,"order_of_magnitude":573,"copy_shape":396,"manifest_coord":636}
draw_menu_bar = function()
if App.fake_key_press then return end -- disable in tests
App.color(Menu_background_color)
love.graphics.rectangle('fill', 0,0, App.screen.width, Menu_bar_height)
App.color(Menu_border_color)
love.graphics.rectangle('line', 0,0, App.screen.width, Menu_bar_height)
App.color(Menu_command_color)
Menu_cursor = 5
if Manifest_navigator.show then
draw_manifest_navigator()
return
end
add_hotkey_to_menu('ctrl+l: load definition')
add_hotkey_to_menu('ctrl+n: new definition')
add_hotkey_to_menu('ctrl+d: delete definition')
add_hotkey_to_menu('ctrl+f: find')
add_hotkey_to_menu('ctrl+left ctrl+right: prev/next word')
add_hotkey_to_menu('ctrl+z ctrl+y: undo/redo')
add_hotkey_to_menu('ctrl+x ctrl+c ctrl+v: cut/copy/paste')
add_hotkey_to_menu('ctrl+= ctrl+- ctrl+0: zoom')
end
{"manifest_navigator_down":635,"Page":475,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"text_input_on_manifest_navigator":634,"scale":7,"manifest_coord":636,"on.mouse_press":617,"sy":469,"font":353,"sx":544,"vx":545,"compute_layout":385,"Cursor_node":172,"on.key_release":552,"on.initialize":506,"A":507,"on.text_input":521,"B":379,"mouse_cursor":558,"Mouse_cursor":559,"fw_parent":678,"Manifest":494,"draw_ticks":663,"load_manifest":496,"get_manifest":497,"initialize_editor":678,"order_of_magnitude":573,"Definitions":503,"new_definition":671,"approximate":579,"approximate_up":658,"maybe_update_key_in_definitions":529,"Ticks_font":669,"update_editor_box":570,"schema1_of_y":667,"reset_manifest_navigator":621,"copy_shape":396,"on.keychord_press":666,"y_of_schema1":364,"Manifest_navigator":495,"manifest_navigator_up":628,"on.update":561,"Menu_background_color":611,"box_height":679,"Menu_border_color":612,"load_definition":674,"Menu_command_color":613,"vy":546,"Menu_highlight_color":614,"on.draw":565,"draw_menu_bar":641,"on_text":539,"add_hotkey_to_menu":616,"line_height":365,"draw_cursor":639,"draw_manifest_navigator":677,"Viewport":604,"num_lines_for_manifest_navigator":676,"on.code_change":306,"manifest_navigator_candidates":638,"on":1,"set_mouse_cursor":562,"tick_spec":660,"load_from_iterator":670,"add_def_to_menu":640,"get_definition_from_app":624,"on.mouse_release":554,"manifest_index":637,"on_handle":547,"Surface":422,"add_thick_line":400}
on.text_input = function(t)
print('text input', t)
if Manifest_navigator.show then
text_input_on_manifest_navigator(t)
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.text_input(Cursor_node.editor, t)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
-- we need to call A sometimes, but redoing compute_layout on every single character is too much
B(--[[preserve screen_top of cursor node]] true)
end
end
{"load_from_iterator":670,"get_definition_from_app":624,"on.code_change":306,"manifest_navigator_up":628,"manifest_navigator_down":635,"Page":475,"Cursor_node":172,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"on.keychord_press":666,"text_input_on_manifest_navigator":634,"tick_spec":660,"manifest_coord":636,"on_text":539,"manifest_navigator_candidates":638,"add_def_to_menu":640,"sx":544,"vx":545,"load_definition":674,"on.key_release":552,"Viewport":604,"mouse_cursor":558,"on.update":561,"vy":546,"line_height":365,"draw_ticks":663,"box_height":345,"on.mouse_press":617,"order_of_magnitude":573,"approximate":579,"sy":469,"Surface":422,"update_editor_box":570,"on.draw":565,"Ticks_font":669,"schema1_of_y":667,"y_of_schema1":364,"on.mouse_release":554,"on":1,"set_mouse_cursor":562,"maybe_update_key_in_definitions":529,"on.text_input":521,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":675,"draw_cursor":639,"Manifest":494,"B":379,"manifest_index":637,"load_manifest":496,"add_thick_line":400,"get_manifest":497,"draw_manifest_navigator":677,"approximate_up":658,"Menu_background_color":611,"on_handle":547,"Menu_border_color":612,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"new_definition":671,"fw_parent":677,"draw_menu_bar":641,"font":353,"add_hotkey_to_menu":616,"on.initialize":506,"Manifest_navigator":495,"A":507,"scale":7,"num_lines_for_manifest_navigator":676,"compute_layout":385,"copy_shape":396,"reset_manifest_navigator":621,"initialize_editor":678}
A = function(preserve_screen_top_of_cursor_node)
-- print('A')
love.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current font
-- translate Definitions to Surface
Surface = {}
for _,node in pairs(Definitions) do
compute_layout(node, node.x,node.y, Surface, preserve_screen_top_of_cursor_node)
end
-- continue the pipeline
B(preserve_screen_top_of_cursor_node)
-- TODO: ugly that we're manipulating editor objects twice
end
{"line_height":365,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"on.initialize":506,"draw_manifest_navigator":677,"vy":546,"reset_manifest_navigator":621,"A":507,"load_from_iterator":670,"get_definition_from_app":624,"B":379,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"sy":469,"text_input_on_manifest_navigator":634,"draw_cursor":639,"manifest_index":637,"manifest_navigator_candidates":638,"on.draw":565,"add_def_to_menu":640,"sx":544,"tick_spec":660,"vx":545,"update_editor_box":570,"on.key_release":552,"on.mouse_press":617,"schema1_of_y":667,"Manifest":494,"mouse_cursor":558,"on.mouse_release":554,"on.keychord_press":666,"set_mouse_cursor":562,"draw_ticks":663,"font":353,"order_of_magnitude":573,"Viewport":604,"add_thick_line":400,"approximate":579,"load_definition":674,"on_handle":547,"approximate_up":658,"fw_parent":676,"Manifest_navigator":495,"scale":7,"box_height":345,"load_manifest":496,"compute_layout":385,"new_definition":671,"copy_shape":396,"on.code_change":306,"Definitions":503,"Ticks_font":669,"num_lines_for_manifest_navigator":676,"Menu_background_color":611,"manifest_coord":636,"on_text":539,"Surface":422,"initialize_editor":450,"Cursor_node":172,"y_of_schema1":364,"keychord_press_on_manifest_navigator":675,"on.update":561,"Mouse_cursor":559,"Page":475,"on.text_input":521,"maybe_update_key_in_definitions":529,"get_manifest":497,"on":1}
on.update = function(dt)
if Animating then
animate_next(dt)
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
B()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
{"line_height":365,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"on.initialize":506,"draw_manifest_navigator":618,"vy":546,"reset_manifest_navigator":621,"A":507,"load_from_iterator":670,"get_definition_from_app":624,"B":379,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"sy":469,"text_input_on_manifest_navigator":634,"draw_cursor":639,"manifest_index":637,"manifest_navigator_candidates":638,"on.draw":565,"add_def_to_menu":640,"sx":544,"tick_spec":660,"vx":545,"update_editor_box":570,"on.key_release":552,"on.mouse_press":617,"schema1_of_y":667,"Manifest":494,"mouse_cursor":558,"on.mouse_release":554,"on.keychord_press":666,"set_mouse_cursor":562,"draw_ticks":663,"font":353,"order_of_magnitude":573,"Viewport":604,"add_thick_line":400,"approximate":579,"load_definition":674,"on_handle":547,"approximate_up":658,"fw_parent":675,"Manifest_navigator":495,"scale":7,"box_height":345,"load_manifest":496,"compute_layout":385,"new_definition":671,"copy_shape":396,"on.code_change":306,"Definitions":503,"Ticks_font":669,"num_lines_for_manifest_navigator":676,"Menu_background_color":611,"manifest_coord":636,"on_text":539,"Surface":422,"initialize_editor":450,"Cursor_node":172,"y_of_schema1":364,"keychord_press_on_manifest_navigator":675,"on.update":561,"Mouse_cursor":559,"Page":475,"on.text_input":521,"maybe_update_key_in_definitions":529,"get_manifest":497,"on":1}
{"Ticks_font":669,"vy":546,"Manifest":494,"load_manifest":496,"get_manifest":497,"B":379,"Definitions":503,"new_definition":671,"Menu_background_color":611,"Menu_border_color":612,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"manifest_index":637,"Surface":422,"add_def_to_menu":640,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"maybe_update_key_in_definitions":529,"on.keychord_press":666,"on":1,"on.text_input":521,"manifest_navigator_down":635,"delete_definition":673,"keychord_press_on_manifest_navigator":675,"tick_spec":660,"update_editor_box":570,"on.draw":565,"on_text":539,"schema1_of_y":667,"get_definition_from_app":624,"load_from_iterator":670,"on.mouse_press":617,"copy_shape":396,"y_of_schema1":364,"on.update":561,"on.key_release":552,"Page":475,"mouse_cursor":558,"line_height":365,"Mouse_cursor":559,"on.initialize":506,"initialize_editor":450,"load_definition":674,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":663,"font":353,"move_candidate_to_front_of_manifest":632,"draw_manifest_navigator":618,"manifest_coord":636,"draw_cursor":639,"manifest_navigator_up":628,"reset_manifest_navigator":621,"on.code_change":306,"order_of_magnitude":573,"A":507,"sy":469,"on.mouse_release":554,"box_height":345,"approximate":579,"compute_layout":385,"add_hotkey_to_menu":616,"draw_menu_bar":641,"scale":7,"Manifest_navigator":495,"fw_parent":674,"add_thick_line":400,"Viewport":604,"approximate_up":658,"sx":544,"on_handle":547,"vx":545}
{"Ticks_font":669,"vy":546,"Manifest":494,"load_manifest":496,"get_manifest":497,"B":379,"Definitions":503,"new_definition":671,"Menu_background_color":611,"Menu_border_color":612,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"manifest_index":637,"Surface":422,"add_def_to_menu":640,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"maybe_update_key_in_definitions":529,"on.keychord_press":666,"on":1,"on.text_input":521,"manifest_navigator_down":635,"delete_definition":673,"keychord_press_on_manifest_navigator":672,"tick_spec":660,"update_editor_box":570,"on.draw":565,"on_text":539,"schema1_of_y":667,"get_definition_from_app":624,"load_from_iterator":670,"on.mouse_press":617,"copy_shape":396,"y_of_schema1":364,"on.update":561,"on.key_release":552,"Page":475,"mouse_cursor":558,"line_height":365,"Mouse_cursor":559,"on.initialize":506,"initialize_editor":450,"load_definition":674,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":663,"font":353,"move_candidate_to_front_of_manifest":632,"draw_manifest_navigator":618,"manifest_coord":636,"draw_cursor":639,"manifest_navigator_up":628,"reset_manifest_navigator":621,"on.code_change":306,"order_of_magnitude":573,"A":507,"sy":469,"on.mouse_release":554,"box_height":345,"approximate":579,"compute_layout":385,"add_hotkey_to_menu":616,"draw_menu_bar":641,"scale":7,"Manifest_navigator":495,"fw_parent":673,"add_thick_line":400,"Viewport":604,"approximate_up":658,"sx":544,"on_handle":547,"vx":545}
zoom_in = function(x,y)
-- precondition: Zoomed_out
-- precondition: Viewport == Global_viewport
-- precondition: Save_viewport exists
-- center Viewport on x,y at zoom level Saved_viewport.zoom
Viewport = {
x=sx(x)-App.screen.width/Save_viewport.zoom/2,
y=sy(y)-App.screen.height/Save_viewport.zoom/2,
w=App.screen.width/Save_viewport.zoom,
h=App.screen.height/Save_viewport.zoom,
zoom=Save_viewport.zoom,
}
end
on.keychord_press = function(chord, key)
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
print(Viewport.zoom)
if Viewport.zoom > 0.1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
draw_ticks = function()
if App.run_tests then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, sx(App.screen.width))
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, sy(App.screen.height))
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
{"Ticks_font":669,"vy":546,"Manifest":494,"load_manifest":496,"get_manifest":497,"B":379,"Definitions":503,"new_definition":671,"Menu_background_color":611,"Menu_border_color":612,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"manifest_index":637,"Surface":422,"add_def_to_menu":640,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"maybe_update_key_in_definitions":529,"on.keychord_press":666,"on":1,"on.text_input":521,"manifest_navigator_down":635,"delete_definition":673,"keychord_press_on_manifest_navigator":672,"tick_spec":660,"update_editor_box":570,"on.draw":565,"on_text":539,"schema1_of_y":667,"get_definition_from_app":624,"load_from_iterator":670,"on.mouse_press":617,"copy_shape":396,"y_of_schema1":364,"on.update":561,"on.key_release":552,"Page":475,"mouse_cursor":558,"Mouse_cursor":559,"on.initialize":506,"initialize_editor":450,"line_height":365,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":663,"font":353,"move_candidate_to_front_of_manifest":632,"draw_manifest_navigator":618,"manifest_coord":636,"draw_cursor":639,"manifest_navigator_up":628,"reset_manifest_navigator":621,"on.code_change":306,"order_of_magnitude":573,"A":507,"sy":469,"on.mouse_release":554,"box_height":345,"approximate":579,"compute_layout":385,"add_hotkey_to_menu":616,"draw_menu_bar":641,"scale":7,"Manifest_navigator":495,"fw_parent":672,"add_thick_line":400,"Viewport":604,"approximate_up":658,"sx":544,"on_handle":547,"vx":545}
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
end
end
end
draw_ticks()
draw_menu_bar()
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
end
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
{"Ticks_font":669,"vy":546,"Manifest":494,"load_manifest":496,"get_manifest":497,"B":379,"Definitions":503,"new_definition":671,"Menu_background_color":611,"Menu_border_color":612,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"manifest_index":637,"Surface":422,"add_def_to_menu":640,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"maybe_update_key_in_definitions":529,"on.keychord_press":666,"on":1,"on.text_input":521,"manifest_navigator_down":635,"delete_definition":631,"keychord_press_on_manifest_navigator":672,"tick_spec":660,"update_editor_box":570,"on.draw":565,"on_text":539,"schema1_of_y":667,"get_definition_from_app":624,"load_from_iterator":670,"on.mouse_press":617,"copy_shape":396,"y_of_schema1":364,"on.update":561,"on.key_release":552,"Page":475,"mouse_cursor":558,"Mouse_cursor":559,"on.initialize":506,"initialize_editor":450,"line_height":365,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":663,"font":353,"move_candidate_to_front_of_manifest":632,"draw_manifest_navigator":618,"manifest_coord":636,"draw_cursor":639,"manifest_navigator_up":628,"reset_manifest_navigator":621,"on.code_change":306,"order_of_magnitude":573,"A":507,"sy":469,"on.mouse_release":554,"box_height":345,"approximate":579,"compute_layout":385,"add_hotkey_to_menu":616,"draw_menu_bar":641,"scale":7,"Manifest_navigator":495,"fw_parent":671,"add_thick_line":400,"Viewport":604,"approximate_up":658,"sx":544,"on_handle":547,"vx":545}
{"Ticks_font":669,"vy":546,"Manifest":494,"load_manifest":496,"get_manifest":497,"B":379,"Definitions":503,"new_definition":671,"Menu_background_color":611,"Menu_border_color":612,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"manifest_index":637,"Surface":422,"add_def_to_menu":640,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"maybe_update_key_in_definitions":529,"on.keychord_press":666,"on":1,"on.text_input":521,"manifest_navigator_down":635,"delete_definition":631,"keychord_press_on_manifest_navigator":633,"tick_spec":660,"update_editor_box":570,"on.draw":565,"on_text":539,"schema1_of_y":667,"get_definition_from_app":624,"load_from_iterator":670,"on.mouse_press":617,"copy_shape":396,"y_of_schema1":364,"on.update":561,"on.key_release":552,"Page":475,"mouse_cursor":558,"Mouse_cursor":559,"on.initialize":506,"initialize_editor":450,"line_height":365,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":663,"font":353,"move_candidate_to_front_of_manifest":632,"draw_manifest_navigator":618,"manifest_coord":636,"draw_cursor":639,"manifest_navigator_up":628,"reset_manifest_navigator":621,"on.code_change":306,"order_of_magnitude":573,"A":507,"sy":469,"on.mouse_release":554,"box_height":345,"approximate":579,"compute_layout":385,"add_hotkey_to_menu":616,"draw_menu_bar":641,"scale":7,"Manifest_navigator":495,"fw_parent":670,"add_thick_line":400,"Viewport":604,"approximate_up":658,"sx":544,"on_handle":547,"vx":545}
{"Ticks_font":669,"vy":546,"Manifest":494,"load_manifest":496,"get_manifest":497,"B":379,"Definitions":503,"new_definition":504,"Menu_background_color":611,"Menu_border_color":612,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"manifest_index":637,"Surface":422,"add_def_to_menu":640,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"maybe_update_key_in_definitions":529,"on.keychord_press":666,"on":1,"on.text_input":521,"manifest_navigator_down":635,"delete_definition":631,"keychord_press_on_manifest_navigator":633,"tick_spec":660,"update_editor_box":570,"on.draw":565,"on_text":539,"schema1_of_y":667,"get_definition_from_app":624,"load_from_iterator":670,"on.mouse_press":617,"copy_shape":396,"y_of_schema1":364,"on.update":561,"on.key_release":552,"Page":475,"mouse_cursor":558,"Mouse_cursor":559,"on.initialize":506,"initialize_editor":450,"line_height":365,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":663,"font":353,"move_candidate_to_front_of_manifest":632,"draw_manifest_navigator":618,"manifest_coord":636,"draw_cursor":639,"manifest_navigator_up":628,"reset_manifest_navigator":621,"on.code_change":306,"order_of_magnitude":573,"A":507,"sy":469,"on.mouse_release":554,"box_height":345,"approximate":579,"compute_layout":385,"add_hotkey_to_menu":616,"draw_menu_bar":641,"scale":7,"Manifest_navigator":495,"fw_parent":669,"add_thick_line":400,"Viewport":604,"approximate_up":658,"sx":544,"on_handle":547,"vx":545}
load_from_iterator = function(f)
local result = {}
local i,line = 0, ''
while true do
local line = f()
if line == nil then break end
table.insert(result, line)
end
if #result == 0 then
table.insert(result, '')
end
return result
end
{"vy":546,"A":507,"B":379,"Cursor_node":172,"Menu_background_color":611,"on.code_change":306,"Menu_border_color":612,"Menu_command_color":613,"sy":469,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"schema1_of_y":667,"num_lines_for_manifest_navigator":619,"Manifest_navigator":495,"y_of_schema1":364,"on.mouse_release":554,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":631,"on.draw":565,"keychord_press_on_manifest_navigator":633,"text_input_on_manifest_navigator":634,"Viewport":604,"get_manifest":497,"manifest_coord":636,"on.text_input":521,"draw_cursor":639,"manifest_navigator_candidates":638,"Definitions":503,"add_def_to_menu":640,"new_definition":504,"on.update":561,"on.keychord_press":666,"Page":475,"copy_shape":396,"maybe_update_key_in_definitions":529,"tick_spec":660,"mouse_cursor":558,"Mouse_cursor":559,"fw_parent":668,"set_mouse_cursor":562,"draw_ticks":663,"move_candidate_to_front_of_manifest":632,"on_handle":547,"Surface":422,"box_height":345,"compute_layout":385,"on_text":539,"scale":7,"on.mouse_press":617,"approximate":579,"reset_manifest_navigator":621,"sx":544,"add_thick_line":400,"vx":545,"load_from_iterator":623,"manifest_index":637,"font":353,"Manifest":494,"approximate_up":658,"on.key_release":552,"order_of_magnitude":573,"load_manifest":496,"line_height":365,"Ticks_font":669,"on":1,"get_definition_from_app":624,"update_editor_box":570,"initialize_editor":450,"on.initialize":506}
maybe_update_key_in_definitions = function(old_definition_name, definition_name, Cursor_node)
print(old_definition_name, definition_name)
if old_definition_name ~= definition_name then
if old_definition_name == nil or Definitions[old_definition_name] ~= Cursor_node then
local pos = array.find(Definitions, Cursor_node)
print('found at index', pos)
assert(pos)
table.remove(Definitions, pos)
elseif Definitions[old_definition_name] == Cursor_node then
print('found at key', old_definition_name)
Definitions[old_definition_name] = nil
end
if definition_name and Definitions[definition_name] == nil then
print('moving to key', definition_name)
Definitions[definition_name] = Cursor_node
elseif definition_name == nil or Definitions[definition_name] then
-- temporary collision; try again later
-- deleting and reinserting is inefficient, but hopefully rare
print('moving to index', #Definitions)
table.insert(Definitions, definition_name)
end
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
end
end
{"vy":546,"A":507,"B":379,"Cursor_node":172,"Menu_background_color":611,"on.code_change":306,"Menu_border_color":612,"Menu_command_color":613,"sy":469,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"schema1_of_y":667,"num_lines_for_manifest_navigator":619,"Manifest_navigator":495,"y_of_schema1":364,"on.mouse_release":554,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":631,"on.draw":565,"keychord_press_on_manifest_navigator":633,"text_input_on_manifest_navigator":634,"Viewport":604,"get_manifest":497,"manifest_coord":636,"on.text_input":521,"draw_cursor":639,"manifest_navigator_candidates":638,"Definitions":503,"add_def_to_menu":640,"new_definition":504,"on.update":561,"on.keychord_press":666,"Page":475,"copy_shape":396,"maybe_update_key_in_definitions":529,"tick_spec":660,"mouse_cursor":558,"Mouse_cursor":559,"fw_parent":667,"set_mouse_cursor":562,"draw_ticks":663,"move_candidate_to_front_of_manifest":632,"on_handle":547,"Surface":422,"box_height":345,"compute_layout":385,"on_text":539,"scale":7,"on.mouse_press":617,"approximate":579,"reset_manifest_navigator":621,"sx":544,"add_thick_line":400,"vx":545,"load_from_iterator":623,"manifest_index":637,"font":353,"Manifest":494,"approximate_up":658,"on.key_release":552,"order_of_magnitude":573,"load_manifest":496,"line_height":365,"Ticks_font":668,"on":1,"get_definition_from_app":624,"update_editor_box":570,"initialize_editor":450,"on.initialize":506}
{"vy":546,"mouse_cursor":558,"Mouse_cursor":559,"on.save_settings":742,"on.load_settings":782,"set_mouse_cursor":562,"draw_ticks":663,"animate_next":841,"table_and_array_both_empty":689,"animate_next_frame":825,"order_of_magnitude":573,"sy":469,"update_editor_box":711,"approximate":579,"surface_bounds":814,"schema1_of_y":667,"approximate_up":658,"Manifest_navigator":495,"Cursor_node":172,"Spawn_point":822,"Ticks_font":669,"from_viewport":823,"interpolate_viewport":839,"Animating":838,"font":353,"draw_menu_bar":641,"add_hotkey_to_menu":616,"Manifest":769,"draw_manifest_navigator":677,"load_manifest":694,"num_lines_for_manifest_navigator":676,"get_manifest":768,"reset_manifest_navigator":772,"on.text_input":834,"load_from_iterator":670,"get_definition_from_app":784,"Menu_background_color":611,"on.draw":797,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"new_definition":821,"Menu_highlight_color":614,"delete_definition":673,"copy_shape":396,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"on.mouse_release":836,"manifest_coord":636,"on.keychord_press":828,"maybe_update_key_in_definitions":529,"B":830,"Num_animation_frames":840,"Page":475,"add_def_to_menu":640,"y_of_schema1":364,"draw_cursor":639,"scale":712,"A":831,"manifest_navigator_up":628,"on.update":835,"tick_spec":660,"vx":545,"survey_animation":827,"Surface":422,"get_multiple_definitions_from_app":783,"on.code_submit":787,"manifest_navigator_candidates":638,"on_handle":547,"add_thick_line":400,"draw_run_time_error":808,"move_candidate_to_front_of_manifest":632,"line_height":365,"on_text":539,"initialize_manifest_navigator":773,"on.mouse_press":722,"box_height":680,"manifest_navigator_down":635,"initialize_editor":678,"fw_parent":840,"sx":544,"fw_app":"driver","compute_layout":385,"manifest_index":637,"wait_for_response":781,"on.code_change":820,"on.initialize":807,"on":1,"on.key_release":720,"Viewport":604,"load_definition":716}
{"on_handle":547,"definition_background_color":857,"draw_run_time_error":808,"survey_animation":847,"sx":544,"animate_next":841,"on.update":835,"load_definition":854,"on.keychord_press":828,"animate_next_frame":825,"box_height":680,"schema1_of_y":667,"on.save_settings":742,"surface_bounds":814,"Ticks_font":669,"y_of_schema1":364,"set_mouse_cursor":562,"font":353,"table_and_array_both_empty":689,"Spawn_point":822,"from_viewport":823,"load_manifest":694,"interpolate_viewport":843,"order_of_magnitude":573,"on.text_input":855,"Manifest":769,"B":830,"on.code_change":820,"get_manifest":768,"Cursor_node":172,"manifest_index":637,"approximate_up":658,"manifest_navigator_candidates":638,"Num_animation_frames":840,"new_definition":848,"add_thick_line":400,"update_editor_box":711,"copy_shape":396,"sy":469,"draw_manifest_navigator":677,"on.mouse_press":722,"Surface":422,"Test_definition_background_color":852,"draw_cursor":639,"Definition_background_color":849,"Viewport":604,"add_hotkey_to_menu":616,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"draw_ticks":844,"approximate":579,"tick_spec":660,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"vy":546,"Menu_command_color":613,"Mouse_cursor":559,"Menu_highlight_color":614,"mouse_cursor":558,"draw_menu_bar":641,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"Page":475,"on.code_submit":787,"Manifest_navigator":495,"fw_app":"driver","line_height":365,"on.initialize":807,"Definitions":503,"delete_definition":673,"keychord_press_on_manifest_navigator":765,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"get_multiple_definitions_from_app":783,"manifest_navigator_down":635,"on":1,"compute_layout":385,"on.key_release":720,"move_candidate_to_front_of_manifest":632,"Animating":842,"wait_for_response":781,"text_input_on_manifest_navigator":634,"fw_parent":856,"A":831,"manifest_coord":636,"scale":712,"on.mouse_release":836,"reset_manifest_navigator":772,"on.draw":797,"vx":545}
{"Surface":422,"tick_spec":660,"mouse_cursor":558,"on.draw":565,"vy":546,"Viewport":604,"set_mouse_cursor":562,"draw_ticks":663,"Manifest":494,"on.mouse_release":554,"load_manifest":496,"order_of_magnitude":573,"get_manifest":497,"approximate":579,"Page":475,"get_definition_from_app":624,"Definitions":503,"update_editor_box":570,"reset_manifest_navigator":621,"approximate_up":658,"scale":7,"schema1_of_y":667,"on.update":561,"box_height":345,"compute_layout":385,"on.code_change":306,"fw_parent":666,"initialize_editor":450,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"manifest_navigator_up":628,"manifest_navigator_down":635,"on":1,"font":353,"delete_definition":631,"draw_cursor":639,"line_height":365,"keychord_press_on_manifest_navigator":633,"Manifest_navigator":495,"text_input_on_manifest_navigator":634,"move_candidate_to_front_of_manifest":632,"maybe_update_key_in_definitions":529,"manifest_coord":636,"on_handle":547,"manifest_index":637,"A":507,"manifest_navigator_candidates":638,"on.keychord_press":666,"on_text":539,"add_def_to_menu":640,"on.text_input":521,"on.mouse_press":617,"copy_shape":396,"y_of_schema1":364,"sx":544,"on.initialize":506,"vx":545,"sy":469,"Mouse_cursor":559,"Ticks_font":594,"Cursor_node":172,"B":379,"on.key_release":552,"new_definition":504,"load_from_iterator":623,"add_thick_line":400}
on.keychord_press = function(chord, key)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
print('a', Cursor_node.editor.line_cache[1])
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"Manifest_navigator":495,"Ticks_font":594,"y_of_schema1":364,"Cursor_node":172,"box_height":345,"Manifest":494,"on.code_change":306,"load_manifest":496,"get_manifest":497,"on.text_input":521,"Menu_background_color":611,"Definitions":503,"Menu_border_color":612,"new_definition":504,"Menu_command_color":613,"vy":546,"Menu_highlight_color":614,"draw_menu_bar":641,"add_thick_line":400,"copy_shape":396,"initialize_editor":450,"Viewport":604,"maybe_update_key_in_definitions":529,"compute_layout":385,"on.initialize":506,"A":507,"B":379,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"on_handle":547,"num_lines_for_manifest_navigator":619,"Surface":422,"scale":7,"on_text":539,"on.mouse_press":617,"manifest_navigator_up":628,"sx":544,"manifest_navigator_down":635,"vx":545,"delete_definition":631,"keychord_press_on_manifest_navigator":633,"text_input_on_manifest_navigator":634,"on.key_release":552,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"set_mouse_cursor":562,"load_from_iterator":623,"draw_ticks":663,"update_editor_box":570,"reset_manifest_navigator":621,"add_def_to_menu":640,"on.update":561,"on.keychord_press":666,"on.draw":565,"order_of_magnitude":573,"fw_parent":665,"schema1_of_y":467,"Page":475,"tick_spec":660,"approximate":579,"sy":469,"line_height":365,"draw_cursor":639,"font":353,"on.mouse_release":554,"get_definition_from_app":624,"mouse_cursor":558,"on":1,"approximate_up":658}
load_definition = function(name)
move_candidate_to_front_of_manifest(name)
if Definitions[name] then
-- just one copy per definition for now
Viewport.x = Definitions[name].x-30
Viewport.y = Definitions[name].y-30
Cursor_node = Definitions[name]
return
end
Definitions[name] = {
type='text',
data=load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+")),
x=0, y=0,
width=600,
bg={r=0.7,g=0.7,b=1},
}
end
{"sy":469,"update_editor_box":570,"on.update":561,"get_definition_from_app":624,"load_from_iterator":623,"schema1_of_y":467,"Manifest_navigator":495,"reset_manifest_navigator":621,"tick_spec":660,"mouse_cursor":558,"y_of_schema1":364,"Mouse_cursor":559,"fw_parent":664,"set_mouse_cursor":562,"draw_ticks":663,"line_height":365,"Manifest":494,"load_manifest":496,"get_manifest":497,"order_of_magnitude":573,"font":353,"draw_cursor":639,"approximate":579,"Definitions":503,"new_definition":504,"approximate_up":658,"add_thick_line":400,"copy_shape":396,"Ticks_font":594,"maybe_update_key_in_definitions":529,"Surface":422,"on.draw":565,"Viewport":604,"on_handle":547,"on.mouse_release":554,"Menu_background_color":611,"Menu_border_color":612,"on.text_input":521,"Menu_command_color":613,"A":507,"Menu_highlight_color":614,"scale":7,"draw_menu_bar":641,"B":379,"add_hotkey_to_menu":616,"Page":475,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"on.key_release":552,"on":1,"Cursor_node":172,"manifest_navigator_up":628,"on.keychord_press":665,"manifest_navigator_down":635,"move_candidate_to_front_of_manifest":632,"vy":546,"delete_definition":631,"initialize_editor":450,"vx":545,"keychord_press_on_manifest_navigator":633,"sx":544,"text_input_on_manifest_navigator":634,"on.mouse_press":617,"on_text":539,"manifest_coord":636,"box_height":345,"manifest_index":637,"compute_layout":385,"manifest_navigator_candidates":638,"on.initialize":506,"on.code_change":306,"add_def_to_menu":640}
{"order_of_magnitude":573,"approximate":579,"on.text_input":521,"on.initialize":506,"sy":469,"A":507,"approximate_up":658,"B":379,"box_height":345,"compute_layout":385,"get_definition_from_app":624,"schema1_of_y":467,"on.code_change":306,"y_of_schema1":364,"Manifest":494,"line_height":365,"load_manifest":496,"get_manifest":497,"Menu_border_color":612,"Menu_command_color":613,"initialize_editor":450,"Menu_highlight_color":614,"Definitions":503,"draw_menu_bar":641,"new_definition":504,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"add_thick_line":400,"copy_shape":396,"Cursor_node":172,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":631,"keychord_press_on_manifest_navigator":633,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"on_handle":547,"font":353,"add_def_to_menu":640,"on_text":539,"on.mouse_press":617,"sx":544,"draw_cursor":639,"vx":545,"on.draw":565,"tick_spec":660,"Viewport":604,"on.key_release":552,"load_from_iterator":623,"fw_parent":663,"Surface":422,"update_editor_box":570,"manifest_navigator_candidates":638,"move_candidate_to_front_of_manifest":632,"reset_manifest_navigator":621,"scale":7,"mouse_cursor":558,"on.mouse_release":554,"Mouse_cursor":559,"on.update":561,"Menu_background_color":611,"on.keychord_press":664,"set_mouse_cursor":562,"vy":546,"draw_ticks":663,"Page":475,"Manifest_navigator":495,"Ticks_font":594,"on":1}
{"order_of_magnitude":573,"approximate":579,"on.text_input":521,"on.initialize":506,"sy":469,"A":507,"approximate_up":658,"B":379,"box_height":345,"compute_layout":385,"get_definition_from_app":624,"schema1_of_y":467,"on.code_change":306,"y_of_schema1":364,"Manifest":494,"line_height":365,"load_manifest":496,"get_manifest":497,"Menu_border_color":612,"Menu_command_color":613,"initialize_editor":450,"Menu_highlight_color":614,"Definitions":503,"draw_menu_bar":641,"new_definition":504,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"add_thick_line":400,"copy_shape":396,"Cursor_node":172,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":631,"keychord_press_on_manifest_navigator":633,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"on_handle":547,"font":353,"add_def_to_menu":640,"on_text":539,"on.mouse_press":617,"sx":544,"draw_cursor":639,"vx":545,"on.draw":565,"tick_spec":660,"Viewport":604,"on.key_release":552,"load_from_iterator":623,"fw_parent":662,"Surface":422,"update_editor_box":570,"manifest_navigator_candidates":638,"move_candidate_to_front_of_manifest":632,"reset_manifest_navigator":621,"scale":7,"mouse_cursor":558,"on.mouse_release":554,"Mouse_cursor":559,"on.update":561,"Menu_background_color":611,"on.keychord_press":610,"set_mouse_cursor":562,"vy":546,"draw_ticks":663,"Page":475,"Manifest_navigator":495,"Ticks_font":594,"on":1}
draw_menu_bar = function()
if App.run_tests then return end -- disable in tests
App.color(Menu_background_color)
love.graphics.rectangle('fill', 0,0, App.screen.width, Menu_bar_height)
App.color(Menu_border_color)
love.graphics.rectangle('line', 0,0, App.screen.width, Menu_bar_height)
App.color(Menu_command_color)
Menu_cursor = 5
if Manifest_navigator.show then
draw_manifest_navigator()
return
end
add_hotkey_to_menu('ctrl+l: load definition')
add_hotkey_to_menu('ctrl+n: new definition')
add_hotkey_to_menu('ctrl+d: delete definition')
add_hotkey_to_menu('ctrl+f: find')
add_hotkey_to_menu('ctrl+left ctrl+right: prev/next word')
add_hotkey_to_menu('ctrl+z ctrl+y: undo/redo')
add_hotkey_to_menu('ctrl+x ctrl+c ctrl+v: cut/copy/paste')
add_hotkey_to_menu('ctrl+= ctrl+- ctrl+0: zoom')
end
{"order_of_magnitude":573,"approximate":579,"on.text_input":521,"on.initialize":506,"sy":469,"A":507,"approximate_up":658,"B":379,"box_height":345,"compute_layout":385,"get_definition_from_app":624,"schema1_of_y":467,"on.code_change":306,"y_of_schema1":364,"Manifest":494,"line_height":365,"load_manifest":496,"get_manifest":497,"Menu_border_color":612,"Menu_command_color":613,"initialize_editor":450,"Menu_highlight_color":614,"Definitions":503,"draw_menu_bar":641,"new_definition":504,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"add_thick_line":400,"copy_shape":396,"Cursor_node":172,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":631,"keychord_press_on_manifest_navigator":633,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"on_handle":547,"font":353,"add_def_to_menu":640,"on_text":539,"on.mouse_press":617,"sx":544,"draw_cursor":639,"vx":545,"on.draw":565,"tick_spec":660,"Viewport":604,"on.key_release":552,"load_from_iterator":623,"fw_parent":661,"Surface":422,"update_editor_box":570,"manifest_navigator_candidates":638,"move_candidate_to_front_of_manifest":632,"reset_manifest_navigator":621,"scale":7,"mouse_cursor":558,"on.mouse_release":554,"Mouse_cursor":559,"on.update":561,"Menu_background_color":611,"on.keychord_press":610,"set_mouse_cursor":562,"vy":546,"draw_ticks":662,"Page":475,"Manifest_navigator":495,"Ticks_font":594,"on":1}
{"delete_definition":673,"test_approximate_up":983,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"snapshot_canvas":913,"text_input_on_manifest_navigator":634,"Save_viewport":865,"manifest_coord":636,"order_of_magnitude":573,"zoom_out":908,"manifest_navigator_candidates":638,"update_editor_box":711,"approximate":579,"fw_app":"driver","zoom_in":920,"initialize_manifest_navigator":773,"get_multiple_definitions_from_app":783,"wait_for_response":781,"Ticks_font":669,"tick_spec":998,"on.draw":986,"add_thick_line":400,"on.key_release":720,"draw_test_failure_indicator":935,"schema1_of_y":667,"load_definition":854,"on.code_submit":947,"Zoomed_out":869,"draw_run_time_error":808,"new_definition":848,"manifest_index":637,"Failing_test_definition_background_color":925,"undo_zoom_out":921,"survey_animation":1013,"copy_viewport":866,"animate_next":914,"draw_ticks":997,"vx":545,"initialize_editor":678,"Menu_border_color":612,"box_height":680,"Menu_command_color":613,"Page":475,"Menu_highlight_color":614,"Cursor_node":172,"Manifest_navigator":495,"on.update":945,"on.load_settings":940,"definition_background_color":859,"manifest_navigator_down":635,"Viewport":604,"surface_bounds":814,"num_lines_for_manifest_navigator":676,"table_and_array_both_empty":689,"Test_definition_background_color":858,"reset_manifest_navigator":772,"scale":712,"manifest_navigator_up":628,"on.mouse_press":916,"load_manifest":694,"Spawn_point":822,"Surface":422,"from_viewport":823,"on.save_settings":742,"on.keychord_press":919,"mouse_cursor":558,"get_definition_from_app":784,"draw_load_time_error":929,"load_from_iterator":670,"Definitions":503,"on.text_input":855,"on.initialize":948,"B":830,"A":831,"font":353,"y_of_schema1":364,"get_default_map":937,"animate_next_frame":915,"on_text":539,"draw_menu_bar":861,"draw_cursor":639,"Menu_background_color":611,"interpolate_viewport":843,"Num_animation_frames":840,"Animating":842,"maybe_update_key_in_definitions":529,"fw_parent":1012,"copy_shape":396,"add_hotkey_to_menu":616,"approximate_up":985,"add_def_to_menu":640,"compute_layout":385,"Definition_background_color":849,"iscale":953,"line_height":365,"Manifest":769,"sy":954,"set_mouse_cursor":562,"sx":955,"on":1,"vy":956,"on.mouse_release":836,"get_manifest":768,"on_handle":547,"Mouse_cursor":559,"on.code_change":924,"draw_manifest_navigator":677}
{"order_of_magnitude":573,"approximate":579,"on.text_input":521,"on.initialize":506,"sy":469,"A":507,"approximate_up":658,"B":379,"box_height":345,"compute_layout":385,"get_definition_from_app":624,"schema1_of_y":467,"on.code_change":306,"y_of_schema1":364,"Manifest":494,"line_height":365,"load_manifest":496,"get_manifest":497,"Menu_border_color":612,"Menu_command_color":613,"initialize_editor":450,"Menu_highlight_color":614,"Definitions":503,"draw_menu_bar":641,"new_definition":504,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"add_thick_line":400,"copy_shape":396,"Cursor_node":172,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":631,"keychord_press_on_manifest_navigator":633,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"on_handle":547,"font":353,"add_def_to_menu":640,"on_text":539,"on.mouse_press":617,"sx":544,"draw_cursor":639,"vx":545,"on.draw":565,"tick_spec":660,"Viewport":604,"on.key_release":552,"load_from_iterator":623,"fw_parent":660,"Surface":422,"update_editor_box":570,"manifest_navigator_candidates":638,"move_candidate_to_front_of_manifest":632,"reset_manifest_navigator":621,"scale":7,"mouse_cursor":558,"on.mouse_release":554,"Mouse_cursor":559,"on.update":561,"Menu_background_color":611,"on.keychord_press":610,"set_mouse_cursor":562,"vy":546,"draw_ticks":661,"Page":475,"Manifest_navigator":495,"Ticks_font":594,"on":1}
animate_next = function(dt)
if Animating[1].step and Animating[1].step >= Num_animation_frames then
table.remove(Animating, 1)
if #Animating == 0 then
Animating = nil
Canvas = nil
A()
return
end
end
animate_next_frame(Animating[1], dt)
end
{"order_of_magnitude":573,"approximate":579,"on.text_input":521,"on.initialize":506,"sy":469,"A":507,"approximate_up":658,"B":379,"box_height":345,"compute_layout":385,"get_definition_from_app":624,"schema1_of_y":467,"on.code_change":306,"y_of_schema1":364,"Manifest":494,"line_height":365,"load_manifest":496,"get_manifest":497,"Menu_border_color":612,"Menu_command_color":613,"initialize_editor":450,"Menu_highlight_color":614,"Definitions":503,"draw_menu_bar":641,"new_definition":504,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"add_thick_line":400,"copy_shape":396,"Cursor_node":172,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":631,"keychord_press_on_manifest_navigator":633,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"on_handle":547,"font":353,"add_def_to_menu":640,"on_text":539,"on.mouse_press":617,"sx":544,"draw_cursor":639,"vx":545,"on.draw":565,"tick_spec":660,"Viewport":604,"on.key_release":552,"load_from_iterator":623,"fw_parent":659,"Surface":422,"update_editor_box":570,"manifest_navigator_candidates":638,"move_candidate_to_front_of_manifest":632,"reset_manifest_navigator":621,"scale":7,"mouse_cursor":558,"on.mouse_release":554,"Mouse_cursor":559,"on.update":561,"Menu_background_color":611,"on.keychord_press":610,"set_mouse_cursor":562,"vy":546,"draw_ticks":659,"Page":475,"Manifest_navigator":495,"Ticks_font":594,"on":1}
{"schema1_of_y":467,"manifest_navigator_up":628,"manifest_navigator_down":635,"box_height":345,"Menu_background_color":611,"y_of_schema1":364,"Menu_border_color":612,"Menu_command_color":613,"Cursor_node":172,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"copy_shape":396,"font":353,"add_def_to_menu":640,"load_manifest":496,"get_manifest":497,"maybe_update_key_in_definitions":529,"approximate_up":658,"initialize_editor":450,"new_definition":504,"vx":545,"vy":546,"Page":475,"on_handle":547,"on_text":539,"sx":544,"on":1,"on.key_release":552,"on.initialize":506,"A":507,"mouse_cursor":558,"B":379,"Mouse_cursor":559,"scale":7,"set_mouse_cursor":562,"on.draw":565,"move_candidate_to_front_of_manifest":632,"order_of_magnitude":573,"draw_cursor":639,"get_definition_from_app":624,"sy":469,"approximate":579,"on.mouse_release":554,"reset_manifest_navigator":621,"on.keychord_press":610,"Manifest":494,"on.mouse_press":617,"keychord_press_on_manifest_navigator":633,"on.update":561,"Manifest_navigator":495,"delete_definition":631,"Ticks_font":594,"on.text_input":521,"Menu_highlight_color":614,"line_height":365,"draw_menu_bar":641,"num_lines_for_manifest_navigator":619,"add_hotkey_to_menu":616,"draw_ticks":659,"on.code_change":306,"draw_manifest_navigator":618,"compute_layout":385,"update_editor_box":570,"Definitions":503,"Surface":422,"fw_parent":658,"load_from_iterator":623,"Viewport":604}
{"table_and_array_both_empty":689,"Ticks_font":669,"snapshot_canvas":913,"initialize_editor":678,"Page":475,"copy_viewport":866,"zoom_out":908,"on.initialize":807,"Zoomed_out":869,"A":831,"sy":469,"animate_next":914,"zoom_in":920,"update_editor_box":711,"font":353,"animate_next_frame":915,"Menu_background_color":611,"Menu_border_color":612,"schema1_of_y":667,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":861,"y_of_schema1":364,"add_hotkey_to_menu":616,"on":1,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"Manifest":769,"reset_manifest_navigator":772,"load_manifest":694,"load_from_iterator":670,"get_manifest":768,"get_definition_from_app":784,"Surface":422,"Animating":842,"manifest_navigator_up":628,"Definitions":503,"manifest_navigator_down":635,"new_definition":848,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"vy":546,"keychord_press_on_manifest_navigator":765,"on.code_change":922,"text_input_on_manifest_navigator":634,"undo_zoom_out":921,"manifest_coord":636,"copy_shape":396,"fw_parent":921,"on.update":900,"manifest_navigator_candidates":638,"surface_bounds":814,"add_def_to_menu":640,"sx":544,"vx":545,"add_thick_line":400,"Spawn_point":822,"draw_cursor":639,"from_viewport":823,"on.draw":917,"interpolate_viewport":843,"B":830,"line_height":365,"on.text_input":855,"on_handle":547,"Cursor_node":172,"on.save_settings":742,"mouse_cursor":558,"tick_spec":660,"on_text":539,"Mouse_cursor":559,"on.mouse_press":916,"Manifest_navigator":495,"set_mouse_cursor":562,"Definition_background_color":849,"draw_ticks":862,"draw_run_time_error":808,"Num_animation_frames":840,"box_height":680,"on.code_submit":787,"compute_layout":385,"on.keychord_press":919,"on.key_release":720,"load_definition":854,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"scale":712,"initialize_manifest_navigator":773,"survey_animation":906,"approximate":579,"fw_app":"driver","Save_viewport":865,"Test_definition_background_color":858,"get_multiple_definitions_from_app":783,"definition_background_color":859,"on.load_settings":782,"Viewport":604,"wait_for_response":781,"approximate_up":658,"on.mouse_release":836,"manifest_index":637}
{"Manifest_navigator":495,"survey_animation":846,"y_of_schema1":364,"animate_next":841,"animate_next_frame":825,"Manifest":769,"tick_spec":660,"load_manifest":694,"get_manifest":768,"surface_bounds":814,"load_definition":716,"new_definition":821,"order_of_magnitude":573,"Spawn_point":822,"on.initialize":807,"approximate":579,"A":831,"on.save_settings":742,"add_thick_line":400,"on.load_settings":782,"copy_shape":396,"on.draw":797,"Animating":842,"approximate_up":658,"Viewport":604,"Ticks_font":669,"on.mouse_press":722,"on.update":835,"on_handle":547,"table_and_array_both_empty":689,"on_text":539,"sy":469,"box_height":680,"interpolate_viewport":843,"compute_layout":385,"line_height":365,"on.mouse_release":836,"on.code_change":820,"vx":545,"Menu_border_color":612,"B":830,"Menu_command_color":613,"Cursor_node":172,"Menu_highlight_color":614,"on.key_release":720,"draw_menu_bar":641,"draw_run_time_error":808,"add_hotkey_to_menu":616,"vy":546,"maybe_update_key_in_definitions":529,"draw_manifest_navigator":677,"on":1,"num_lines_for_manifest_navigator":676,"mouse_cursor":558,"scale":712,"reset_manifest_navigator":772,"draw_cursor":639,"on.code_submit":787,"load_from_iterator":670,"Surface":422,"get_definition_from_app":784,"draw_ticks":844,"manifest_navigator_up":628,"initialize_editor":678,"Menu_background_color":611,"initialize_manifest_navigator":773,"font":353,"manifest_navigator_down":635,"Mouse_cursor":559,"Page":475,"delete_definition":673,"get_multiple_definitions_from_app":783,"move_candidate_to_front_of_manifest":632,"set_mouse_cursor":562,"keychord_press_on_manifest_navigator":765,"wait_for_response":781,"text_input_on_manifest_navigator":634,"on.text_input":834,"Num_animation_frames":840,"manifest_coord":636,"sx":544,"manifest_index":637,"update_editor_box":711,"manifest_navigator_candidates":638,"Definitions":503,"on.keychord_press":828,"add_def_to_menu":640,"fw_parent":845,"from_viewport":823,"fw_app":"driver","schema1_of_y":667}
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"Cursor_node":172,"on.text_input":521,"compute_layout":385,"on_text":539,"on.code_change":306,"update_editor_box":570,"sx":544,"Menu_background_color":611,"schema1_of_y":467,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"y_of_schema1":364,"draw_menu_bar":641,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"add_thick_line":400,"font":353,"copy_shape":396,"manifest_navigator_up":628,"scale":7,"delete_definition":631,"keychord_press_on_manifest_navigator":633,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"move_candidate_to_front_of_manifest":632,"on":1,"get_definition_from_app":624,"load_from_iterator":623,"vx":545,"reset_manifest_navigator":621,"draw_cursor":639,"on.key_release":552,"fw_parent":657,"mouse_cursor":558,"load_manifest":496,"Mouse_cursor":559,"get_manifest":497,"on.initialize":506,"set_mouse_cursor":562,"vy":546,"draw_ticks":657,"B":379,"Definitions":503,"new_definition":504,"order_of_magnitude":573,"Surface":422,"approximate":579,"on.draw":565,"maybe_update_key_in_definitions":529,"Viewport":604,"sy":469,"line_height":365,"approximate_up":658,"box_height":345,"Page":475,"add_def_to_menu":640,"manifest_navigator_down":635,"Ticks_font":594,"A":507,"on.mouse_release":554,"initialize_editor":450,"on.update":561,"Manifest_navigator":495,"on.keychord_press":610,"on.mouse_press":617,"Manifest":494,"on_handle":547}
{"Surface":422,"on.draw":932,"Viewport":604,"load_definition":854,"vy":546,"undo_zoom_out":921,"Manifest_navigator":495,"draw_run_time_error":808,"scale":712,"Failing_test_definition_background_color":925,"on.mouse_release":836,"on.save_settings":742,"on.update":900,"on_text":539,"on.keychord_press":919,"on.mouse_press":916,"draw_test_failure_indicator":935,"Page":475,"table_and_array_both_empty":689,"on.initialize":807,"A":831,"load_manifest":694,"get_manifest":768,"B":830,"on.key_release":720,"surface_bounds":814,"Definitions":503,"new_definition":848,"mouse_cursor":558,"Spawn_point":822,"Mouse_cursor":559,"from_viewport":823,"interpolate_viewport":843,"set_mouse_cursor":562,"add_thick_line":400,"box_height":680,"copy_shape":396,"compute_layout":385,"maybe_update_key_in_definitions":529,"Menu_highlight_color":614,"draw_menu_bar":861,"add_hotkey_to_menu":616,"Test_definition_background_color":858,"definition_background_color":859,"tick_spec":660,"approximate":579,"order_of_magnitude":573,"font":353,"reset_manifest_navigator":772,"Cursor_node":172,"on":1,"load_from_iterator":670,"draw_manifest_navigator":677,"on_handle":547,"approximate_up":658,"snapshot_canvas":913,"update_editor_box":711,"Save_viewport":865,"manifest_navigator_up":628,"Ticks_font":669,"manifest_navigator_down":635,"initialize_editor":678,"zoom_out":908,"delete_definition":673,"Zoomed_out":869,"move_candidate_to_front_of_manifest":632,"schema1_of_y":667,"keychord_press_on_manifest_navigator":765,"draw_ticks":862,"text_input_on_manifest_navigator":634,"zoom_in":920,"Animating":842,"y_of_schema1":364,"get_definition_from_app":784,"manifest_index":637,"manifest_coord":636,"manifest_navigator_candidates":638,"sy":469,"draw_cursor":639,"add_def_to_menu":640,"vx":545,"sx":544,"fw_parent":938,"on.text_input":855,"Menu_background_color":611,"get_default_map":937,"Menu_border_color":612,"on.code_change":924,"Menu_command_color":613,"Definition_background_color":849,"on.load_settings":939,"survey_animation":906,"line_height":365,"Num_animation_frames":840,"initialize_manifest_navigator":773,"on.code_submit":927,"animate_next":914,"copy_viewport":866,"Manifest":769,"animate_next_frame":915,"get_multiple_definitions_from_app":783,"num_lines_for_manifest_navigator":676,"fw_app":"driver","draw_load_time_error":929,"wait_for_response":781}
{"sx":544,"vx":545,"line_height":365,"on.key_release":552,"Surface":422,"on.code_change":306,"on.text_input":521,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":657,"Viewport":604,"order_of_magnitude":573,"initialize_editor":450,"on.initialize":506,"approximate":579,"A":507,"sy":469,"B":379,"approximate_up":583,"Ticks_font":594,"Manifest_navigator":495,"update_editor_box":570,"Manifest":494,"load_manifest":496,"schema1_of_y":467,"get_manifest":497,"Menu_background_color":611,"y_of_schema1":364,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.mouse_release":554,"Menu_highlight_color":614,"on.draw":565,"draw_menu_bar":641,"scale":7,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"vy":546,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"on_handle":547,"maybe_update_key_in_definitions":529,"add_def_to_menu":640,"new_definition":504,"on.update":561,"draw_cursor":639,"manifest_navigator_up":628,"get_definition_from_app":624,"manifest_navigator_down":635,"on":1,"Page":475,"delete_definition":631,"on.keychord_press":610,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":633,"add_thick_line":400,"text_input_on_manifest_navigator":634,"font":353,"on_text":539,"manifest_coord":636,"load_from_iterator":623,"manifest_index":637,"box_height":345,"manifest_navigator_candidates":638,"fw_parent":656,"reset_manifest_navigator":621,"on.mouse_press":617,"copy_shape":396,"compute_layout":385}
get_manifest = function()
live.send_to_app('MANIFEST')
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
local result = {}
if #response_string == 0 then
-- error; retry
return result
else
-- stop retrying
Manifest_navigator.reload = false
end
local app_name
local response = json.decode(response_string)
for name, value in pairs(response) do
if not starts_with(name, 'fw_') then
table.insert(result, name)
elseif name == 'fw_app' then
app_name = value
end
end
return result, app_name
end
{"sx":544,"vx":545,"line_height":365,"on.key_release":552,"Surface":422,"on.code_change":306,"on.text_input":521,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"draw_ticks":656,"Viewport":604,"order_of_magnitude":573,"initialize_editor":450,"on.initialize":506,"approximate":579,"A":507,"sy":469,"B":379,"approximate_up":583,"Ticks_font":594,"Manifest_navigator":495,"update_editor_box":570,"Manifest":494,"load_manifest":496,"schema1_of_y":467,"get_manifest":497,"Menu_background_color":611,"y_of_schema1":364,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"on.mouse_release":554,"Menu_highlight_color":614,"on.draw":565,"draw_menu_bar":641,"scale":7,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"vy":546,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"on_handle":547,"maybe_update_key_in_definitions":529,"add_def_to_menu":640,"new_definition":504,"on.update":561,"draw_cursor":639,"manifest_navigator_up":628,"get_definition_from_app":624,"manifest_navigator_down":635,"on":1,"Page":475,"delete_definition":631,"on.keychord_press":610,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":633,"add_thick_line":400,"text_input_on_manifest_navigator":634,"font":353,"on_text":539,"manifest_coord":636,"load_from_iterator":623,"manifest_index":637,"box_height":345,"manifest_navigator_candidates":638,"fw_parent":655,"reset_manifest_navigator":621,"on.mouse_press":617,"copy_shape":396,"compute_layout":385}
{"add_thick_line":400,"copy_shape":396,"maybe_update_key_in_definitions":529,"on.initialize":506,"line_height":365,"A":507,"B":379,"mouse_cursor":558,"Mouse_cursor":559,"Page":475,"set_mouse_cursor":562,"on_handle":547,"on_text":539,"order_of_magnitude":573,"sx":544,"on.mouse_release":554,"vx":545,"approximate":579,"on":1,"on.keychord_press":610,"on.text_input":521,"approximate_up":583,"compute_layout":385,"Ticks_font":594,"on.code_change":306,"vy":546,"Surface":422,"on.draw":565,"Viewport":604,"Menu_background_color":611,"sy":469,"Menu_border_color":612,"Menu_command_color":613,"initialize_editor":450,"Menu_highlight_color":614,"draw_menu_bar":641,"box_height":345,"add_hotkey_to_menu":616,"schema1_of_y":467,"num_lines_for_manifest_navigator":619,"draw_manifest_navigator":618,"font":353,"y_of_schema1":364,"new_definition":504,"on.update":561,"on.key_release":552,"fw_parent":654,"draw_ticks":655,"manifest_navigator_up":628,"draw_cursor":639,"manifest_navigator_down":635,"Manifest":494,"manifest_navigator_candidates":638,"delete_definition":631,"load_manifest":496,"Definitions":503,"keychord_press_on_manifest_navigator":633,"Cursor_node":172,"text_input_on_manifest_navigator":634,"move_candidate_to_front_of_manifest":632,"get_manifest":497,"manifest_coord":636,"scale":7,"manifest_index":637,"get_definition_from_app":624,"load_from_iterator":623,"on.mouse_press":617,"Manifest_navigator":495,"add_def_to_menu":640,"update_editor_box":570,"reset_manifest_navigator":621}
{"on.key_release":552,"manifest_index":637,"move_candidate_to_front_of_manifest":632,"manifest_navigator_candidates":638,"Surface":422,"draw_cursor":639,"mouse_cursor":558,"get_definition_from_app":624,"Mouse_cursor":559,"Viewport":604,"set_mouse_cursor":562,"reset_manifest_navigator":621,"draw_ticks":654,"Manifest_navigator":495,"order_of_magnitude":573,"on.mouse_release":554,"line_height":365,"y_of_schema1":364,"Cursor_node":172,"approximate":579,"Manifest":494,"approximate_up":583,"Ticks_font":594,"on.text_input":521,"fw_parent":653,"compute_layout":385,"on.initialize":506,"copy_shape":396,"on.code_change":306,"load_manifest":496,"get_manifest":497,"B":379,"Menu_background_color":611,"Menu_border_color":612,"Definitions":503,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"scale":7,"num_lines_for_manifest_navigator":619,"initialize_editor":450,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":631,"box_height":345,"add_def_to_menu":640,"keychord_press_on_manifest_navigator":633,"on.mouse_press":617,"text_input_on_manifest_navigator":634,"add_thick_line":400,"A":507,"manifest_coord":636,"update_editor_box":570,"load_from_iterator":623,"on.draw":565,"Menu_command_color":613,"on.keychord_press":610,"on_text":539,"on":1,"Page":475,"vy":546,"schema1_of_y":467,"on_handle":547,"sx":544,"on.update":561,"vx":545,"new_definition":504,"font":353,"draw_manifest_navigator":618,"sy":469}
A = function(preserve_screen_top_of_cursor_node)
-- translate Page to Surface
Surface = {}
compute_layout(Page, Page.x,Page.y, Surface, preserve_screen_top_of_cursor_node)
-- continue the pipeline
B(preserve_screen_top_of_cursor_node)
-- TODO: ugly that we're manipulating editor objects twice
end
{"vx":545,"Viewport":604,"get_definition_from_app":624,"load_from_iterator":623,"on_handle":547,"reset_manifest_navigator":621,"on.update":561,"on_text":539,"fw_parent":652,"Page":475,"sx":544,"on.mouse_release":554,"draw_cursor":639,"on.key_release":552,"line_height":365,"Cursor_node":172,"mouse_cursor":558,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"y_of_schema1":364,"draw_ticks":653,"box_height":345,"on.initialize":506,"order_of_magnitude":573,"A":507,"on.code_change":306,"scale":7,"update_editor_box":570,"sy":469,"approximate_up":583,"Ticks_font":594,"on.keychord_press":610,"add_thick_line":400,"Menu_background_color":611,"copy_shape":396,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"Manifest":494,"draw_manifest_navigator":618,"load_manifest":496,"get_manifest":497,"initialize_editor":450,"Definitions":503,"manifest_navigator_up":628,"new_definition":504,"manifest_navigator_down":635,"vy":546,"Manifest_navigator":495,"delete_definition":631,"approximate":579,"font":353,"keychord_press_on_manifest_navigator":633,"compute_layout":385,"text_input_on_manifest_navigator":634,"B":379,"num_lines_for_manifest_navigator":619,"manifest_coord":636,"schema1_of_y":467,"manifest_index":637,"maybe_update_key_in_definitions":529,"manifest_navigator_candidates":638,"on.mouse_press":617,"Surface":422,"add_def_to_menu":640,"on.text_input":521,"on.draw":565,"move_candidate_to_front_of_manifest":632}
{"set_mouse_cursor":562,"compute_layout":385,"draw_ticks":652,"on":1,"order_of_magnitude":573,"update_editor_box":570,"approximate":579,"sy":469,"schema1_of_y":467,"approximate_up":583,"on.text_input":521,"y_of_schema1":364,"Manifest_navigator":495,"on.initialize":506,"on.keychord_press":610,"move_candidate_to_front_of_manifest":632,"on.code_change":306,"get_definition_from_app":624,"load_from_iterator":623,"draw_cursor":639,"load_manifest":496,"get_manifest":497,"reset_manifest_navigator":621,"Menu_background_color":611,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"new_definition":504,"add_thick_line":400,"copy_shape":396,"line_height":365,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"font":353,"num_lines_for_manifest_navigator":619,"maybe_update_key_in_definitions":529,"on.draw":565,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":631,"on.mouse_release":554,"A":507,"on.update":561,"B":379,"on_text":539,"keychord_press_on_manifest_navigator":633,"Page":475,"text_input_on_manifest_navigator":634,"manifest_coord":636,"sx":544,"manifest_index":637,"vx":545,"manifest_navigator_candidates":638,"Ticks_font":594,"add_def_to_menu":640,"draw_menu_bar":641,"on.key_release":552,"on_handle":547,"Menu_highlight_color":614,"on.mouse_press":617,"fw_parent":651,"box_height":345,"scale":7,"Manifest":494,"Surface":422,"mouse_cursor":558,"vy":546,"Mouse_cursor":559,"Viewport":604,"initialize_editor":450,"Cursor_node":172}
{"definition_background_color":1015,"Manifest_navigator":495,"add_def_to_menu":640,"y_of_schema1":364,"on.code_submit":947,"snapshot_canvas":913,"Save_viewport":865,"Cursor_node":172,"copy_viewport":866,"initialize_manifest_navigator":773,"zoom_out":908,"Zoomed_out":869,"line_height":365,"Menu_border_color":612,"wait_for_response":781,"zoom_in":920,"Menu_highlight_color":614,"fw_app":"driver","draw_menu_bar":861,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"load_definition":854,"add_thick_line":400,"reset_manifest_navigator":772,"copy_shape":396,"draw_run_time_error":808,"maybe_update_key_in_definitions":529,"survey_animation":1014,"on.text_input":855,"on.load_settings":1019,"tick_spec":998,"Menu_command_color":613,"Viewport":604,"new_definition":848,"Definitions":503,"animate_next_frame":915,"box_height":680,"compute_layout":385,"schema1_of_y":667,"get_multiple_definitions_from_app":1016,"on.code_change":924,"on":1,"on_handle":547,"get_manifest":768,"num_lines_for_manifest_navigator":676,"surface_bounds":814,"Page":475,"on_text":539,"font":353,"Ticks_font":669,"on.initialize":948,"Manifest":769,"A":1017,"sx":955,"Spawn_point":822,"undo_zoom_out":921,"from_viewport":823,"draw_cursor":639,"interpolate_viewport":843,"animate_next":914,"on.key_release":720,"on.mouse_press":916,"initialize_editor":678,"Menu_background_color":611,"table_and_array_both_empty":689,"Animating":842,"on.save_settings":742,"draw_test_failure_indicator":935,"Surface":422,"mouse_cursor":558,"iscale":953,"Mouse_cursor":559,"update_editor_box":711,"vx":545,"get_default_map":937,"set_mouse_cursor":562,"B":1018,"draw_ticks":997,"vy":956,"on.draw":986,"approximate_up":985,"load_from_iterator":670,"fw_parent":1018,"get_definition_from_app":784,"draw_load_time_error":929,"on.mouse_release":836,"order_of_magnitude":573,"on.update":945,"manifest_navigator_up":628,"on.keychord_press":919,"Num_animation_frames":840,"approximate":579,"Failing_test_definition_background_color":925,"delete_definition":673,"manifest_navigator_down":635,"move_candidate_to_front_of_manifest":632,"sy":954,"keychord_press_on_manifest_navigator":765,"load_manifest":694,"text_input_on_manifest_navigator":634,"Definition_background_color":849,"scale":712,"manifest_coord":636,"test_approximate_up":983,"manifest_index":637,"Test_definition_background_color":858,"manifest_navigator_candidates":638}
{"schema1_of_y":667,"draw_ticks":663,"Cursor_node":172,"y_of_schema1":364,"on.text_input":829,"order_of_magnitude":573,"load_definition":716,"approximate":579,"on.save_settings":742,"box_height":680,"on.load_settings":782,"approximate_up":658,"table_and_array_both_empty":689,"on.code_change":820,"scale":712,"Ticks_font":669,"initialize_manifest_navigator":773,"get_multiple_definitions_from_app":783,"add_thick_line":400,"copy_shape":396,"Manifest":769,"load_manifest":694,"initialize_editor":678,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"font":353,"draw_menu_bar":641,"animate_next":809,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"animate_next_frame":825,"A":713,"reset_manifest_navigator":772,"survey_animation":827,"B":830,"maybe_update_key_in_definitions":529,"get_definition_from_app":784,"add_def_to_menu":640,"surface_bounds":814,"on.keychord_press":828,"compute_layout":385,"manifest_navigator_up":628,"fw_app":"driver","manifest_navigator_down":635,"wait_for_response":781,"new_definition":821,"delete_definition":673,"Spawn_point":822,"move_candidate_to_front_of_manifest":632,"from_viewport":823,"keychord_press_on_manifest_navigator":765,"interpolate_viewport":824,"text_input_on_manifest_navigator":634,"on_handle":547,"get_manifest":768,"manifest_coord":636,"Viewport":604,"Surface":422,"draw_cursor":639,"manifest_navigator_candidates":638,"on.draw":797,"manifest_index":637,"vx":545,"on":1,"sx":544,"load_from_iterator":670,"set_mouse_cursor":562,"vy":546,"on.code_submit":787,"on.initialize":807,"draw_run_time_error":808,"on.key_release":720,"on.mouse_press":722,"Mouse_cursor":559,"on.mouse_release":721,"line_height":365,"on.update":802,"sy":469,"update_editor_box":711,"Animating":813,"mouse_cursor":558,"num_lines_for_manifest_navigator":676,"Page":475,"tick_spec":660,"fw_parent":829,"on_text":539,"Manifest_navigator":495}
{"add_def_to_menu":640,"Manifest":494,"load_manifest":496,"get_manifest":497,"Menu_background_color":611,"add_thick_line":400,"Definitions":503,"on":1,"new_definition":504,"Menu_highlight_color":614,"fw_parent":650,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"move_candidate_to_front_of_manifest":632,"maybe_update_key_in_definitions":529,"draw_cursor":639,"get_definition_from_app":624,"manifest_navigator_up":628,"manifest_navigator_down":635,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"box_height":345,"text_input_on_manifest_navigator":634,"on_handle":547,"manifest_coord":636,"manifest_index":637,"on_text":539,"on.mouse_press":617,"sx":544,"vx":545,"on.mouse_release":554,"on.key_release":552,"initialize_editor":450,"scale":7,"font":353,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"Surface":422,"draw_ticks":651,"on.draw":565,"y_of_schema1":364,"sy":469,"Menu_border_color":612,"Viewport":604,"update_editor_box":570,"Cursor_node":172,"vy":546,"draw_menu_bar":641,"B":379,"order_of_magnitude":573,"copy_shape":396,"approximate":579,"on.text_input":521,"schema1_of_y":467,"manifest_navigator_candidates":638,"on.update":561,"on.code_change":306,"on.keychord_press":610,"delete_definition":631,"A":507,"approximate_up":583,"Page":475,"load_from_iterator":623,"line_height":365,"Manifest_navigator":495,"Ticks_font":594,"Menu_command_color":613,"on.initialize":506,"compute_layout":385}
{"add_def_to_menu":640,"Manifest":494,"load_manifest":496,"get_manifest":497,"Menu_background_color":611,"add_thick_line":400,"Definitions":503,"on":1,"new_definition":504,"Menu_highlight_color":614,"fw_parent":649,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"move_candidate_to_front_of_manifest":632,"maybe_update_key_in_definitions":529,"draw_cursor":639,"get_definition_from_app":624,"manifest_navigator_up":628,"manifest_navigator_down":635,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"box_height":345,"text_input_on_manifest_navigator":634,"on_handle":547,"manifest_coord":636,"manifest_index":637,"on_text":539,"on.mouse_press":617,"sx":544,"vx":545,"on.mouse_release":554,"on.key_release":552,"initialize_editor":450,"scale":7,"font":353,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"Surface":422,"draw_ticks":650,"on.draw":565,"y_of_schema1":364,"sy":469,"Menu_border_color":612,"Viewport":604,"update_editor_box":570,"Cursor_node":172,"vy":546,"draw_menu_bar":641,"B":379,"order_of_magnitude":573,"copy_shape":396,"approximate":579,"on.text_input":521,"schema1_of_y":467,"manifest_navigator_candidates":638,"on.update":561,"on.code_change":306,"on.keychord_press":610,"delete_definition":631,"A":507,"approximate_up":583,"Page":475,"load_from_iterator":623,"line_height":365,"Manifest_navigator":495,"Ticks_font":594,"Menu_command_color":613,"on.initialize":506,"compute_layout":385}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
-- print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
-- print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-10, vy+2)
end
love.graphics.setFont(old_font)
end
{"add_def_to_menu":640,"Manifest":494,"load_manifest":496,"get_manifest":497,"Menu_background_color":611,"add_thick_line":400,"Definitions":503,"on":1,"new_definition":504,"Menu_highlight_color":614,"fw_parent":648,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"move_candidate_to_front_of_manifest":632,"maybe_update_key_in_definitions":529,"draw_cursor":639,"get_definition_from_app":624,"manifest_navigator_up":628,"manifest_navigator_down":635,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"box_height":345,"text_input_on_manifest_navigator":634,"on_handle":547,"manifest_coord":636,"manifest_index":637,"on_text":539,"on.mouse_press":617,"sx":544,"vx":545,"on.mouse_release":554,"on.key_release":552,"initialize_editor":450,"scale":7,"font":353,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"Surface":422,"draw_ticks":649,"on.draw":565,"y_of_schema1":364,"sy":469,"Menu_border_color":612,"Viewport":604,"update_editor_box":570,"Cursor_node":172,"vy":546,"draw_menu_bar":641,"B":379,"order_of_magnitude":573,"copy_shape":396,"approximate":579,"on.text_input":521,"schema1_of_y":467,"manifest_navigator_candidates":638,"on.update":561,"on.code_change":306,"on.keychord_press":610,"delete_definition":631,"A":507,"approximate_up":583,"Page":475,"load_from_iterator":623,"line_height":365,"Manifest_navigator":495,"Ticks_font":594,"Menu_command_color":613,"on.initialize":506,"compute_layout":385}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
if vy(node.y) > 0 then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, -vy(node.y))
end
if node.editor.font_height ~= scale(20) then
edit.update_font_settings(node.editor, scale(20))
end
node.editor.left = math.floor(vx(node.x)) + Line_number_width*App.width(node.editor.em)
node.editor.right = math.ceil(vx(node.x+node.w))
end
{"add_def_to_menu":640,"Manifest":494,"load_manifest":496,"get_manifest":497,"Menu_background_color":611,"add_thick_line":400,"Definitions":503,"on":1,"new_definition":504,"Menu_highlight_color":614,"fw_parent":647,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"move_candidate_to_front_of_manifest":632,"maybe_update_key_in_definitions":529,"draw_cursor":639,"get_definition_from_app":624,"manifest_navigator_up":628,"manifest_navigator_down":635,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"box_height":345,"text_input_on_manifest_navigator":634,"on_handle":547,"manifest_coord":636,"manifest_index":637,"on_text":539,"on.mouse_press":617,"sx":544,"vx":545,"on.mouse_release":554,"on.key_release":552,"initialize_editor":450,"scale":7,"font":353,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"Surface":422,"draw_ticks":648,"on.draw":565,"y_of_schema1":364,"sy":469,"Menu_border_color":612,"Viewport":604,"update_editor_box":570,"Cursor_node":172,"vy":546,"draw_menu_bar":641,"B":379,"order_of_magnitude":573,"copy_shape":396,"approximate":579,"on.text_input":521,"schema1_of_y":467,"manifest_navigator_candidates":638,"on.update":561,"on.code_change":306,"on.keychord_press":610,"delete_definition":631,"A":507,"approximate_up":583,"Page":475,"load_from_iterator":623,"line_height":365,"Manifest_navigator":495,"Ticks_font":594,"Menu_command_color":613,"on.initialize":506,"compute_layout":385}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
-- print(Viewport.zoom, Viewport.x, Viewport.x+iscale(App.screen.width))
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
-- print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
{"add_def_to_menu":640,"Manifest":494,"load_manifest":496,"get_manifest":497,"Menu_background_color":611,"add_thick_line":400,"Definitions":503,"on":1,"new_definition":504,"Menu_highlight_color":614,"fw_parent":646,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"move_candidate_to_front_of_manifest":632,"maybe_update_key_in_definitions":529,"draw_cursor":639,"get_definition_from_app":624,"manifest_navigator_up":628,"manifest_navigator_down":635,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"box_height":345,"text_input_on_manifest_navigator":634,"on_handle":547,"manifest_coord":636,"manifest_index":637,"on_text":539,"on.mouse_press":617,"sx":544,"vx":545,"on.mouse_release":554,"on.key_release":552,"initialize_editor":450,"scale":7,"font":353,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"Surface":422,"draw_ticks":647,"on.draw":565,"y_of_schema1":364,"sy":469,"Menu_border_color":612,"Viewport":604,"update_editor_box":570,"Cursor_node":172,"vy":546,"draw_menu_bar":641,"B":379,"order_of_magnitude":573,"copy_shape":396,"approximate":579,"on.text_input":521,"schema1_of_y":467,"manifest_navigator_candidates":638,"on.update":561,"on.code_change":306,"on.keychord_press":610,"delete_definition":631,"A":507,"approximate_up":583,"Page":475,"load_from_iterator":623,"line_height":365,"Manifest_navigator":495,"Ticks_font":594,"Menu_command_color":613,"on.initialize":506,"compute_layout":385}
{"add_def_to_menu":640,"Manifest":494,"load_manifest":496,"get_manifest":497,"Menu_background_color":611,"add_thick_line":400,"Definitions":503,"on":1,"new_definition":504,"Menu_highlight_color":614,"fw_parent":645,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"move_candidate_to_front_of_manifest":632,"maybe_update_key_in_definitions":529,"draw_cursor":639,"get_definition_from_app":624,"manifest_navigator_up":628,"manifest_navigator_down":635,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"box_height":345,"text_input_on_manifest_navigator":634,"on_handle":547,"manifest_coord":636,"manifest_index":637,"on_text":539,"on.mouse_press":617,"sx":544,"vx":545,"on.mouse_release":554,"on.key_release":552,"initialize_editor":450,"scale":7,"font":353,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"Surface":422,"draw_ticks":646,"on.draw":565,"y_of_schema1":364,"sy":469,"Menu_border_color":612,"Viewport":604,"update_editor_box":570,"Cursor_node":172,"vy":546,"draw_menu_bar":641,"B":379,"order_of_magnitude":573,"copy_shape":396,"approximate":579,"on.text_input":521,"schema1_of_y":467,"manifest_navigator_candidates":638,"on.update":561,"on.code_change":306,"on.keychord_press":610,"delete_definition":631,"A":507,"approximate_up":583,"Page":475,"load_from_iterator":623,"line_height":365,"Manifest_navigator":495,"Ticks_font":594,"Menu_command_color":613,"on.initialize":506,"compute_layout":385}
on.load_settings = function(settings)
Viewport = settings.viewport
Definitions = settings.definitions
for name, def in pairs(Definitions) do
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
{"add_def_to_menu":640,"Manifest":494,"load_manifest":496,"get_manifest":497,"Menu_background_color":611,"add_thick_line":400,"Definitions":503,"on":1,"new_definition":504,"Menu_highlight_color":614,"fw_parent":643,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"move_candidate_to_front_of_manifest":632,"maybe_update_key_in_definitions":529,"draw_cursor":639,"get_definition_from_app":624,"manifest_navigator_up":628,"manifest_navigator_down":635,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"box_height":345,"text_input_on_manifest_navigator":634,"on_handle":547,"manifest_coord":636,"manifest_index":637,"on_text":539,"on.mouse_press":617,"sx":544,"vx":545,"on.mouse_release":554,"on.key_release":552,"initialize_editor":450,"scale":7,"font":353,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"Surface":422,"draw_ticks":645,"on.draw":565,"y_of_schema1":364,"sy":469,"Menu_border_color":612,"Viewport":604,"update_editor_box":570,"Cursor_node":172,"vy":546,"draw_menu_bar":641,"B":379,"order_of_magnitude":573,"copy_shape":396,"approximate":579,"on.text_input":521,"schema1_of_y":467,"manifest_navigator_candidates":638,"on.update":561,"on.code_change":306,"on.keychord_press":610,"delete_definition":631,"A":507,"approximate_up":583,"Page":475,"load_from_iterator":623,"line_height":365,"Manifest_navigator":495,"Ticks_font":594,"Menu_command_color":613,"on.initialize":506,"compute_layout":385}
{"B":830,"Menu_background_color":611,"vy":546,"Definitions":503,"Menu_command_color":613,"new_definition":848,"box_height":680,"draw_run_time_error":808,"draw_menu_bar":861,"on.mouse_release":836,"add_hotkey_to_menu":616,"on.save_settings":742,"survey_animation":863,"on.keychord_press":871,"animate_next":841,"num_lines_for_manifest_navigator":676,"Page":475,"reset_manifest_navigator":772,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"get_definition_from_app":784,"Zoomed_out":869,"manifest_navigator_up":628,"surface_bounds":814,"on.draw":797,"Num_animation_frames":840,"Spawn_point":822,"update_editor_box":711,"on_text":539,"Save_viewport":865,"on.mouse_press":722,"Definition_background_color":849,"Animating":842,"schema1_of_y":667,"vx":545,"scale":712,"definition_background_color":859,"y_of_schema1":364,"on.key_release":720,"copy_viewport":866,"Viewport":604,"mouse_cursor":558,"Mouse_cursor":559,"zoom_out":870,"delete_definition":673,"initialize_editor":678,"set_mouse_cursor":562,"from_viewport":823,"draw_ticks":862,"draw_cursor":639,"sy":469,"move_candidate_to_front_of_manifest":632,"font":353,"keychord_press_on_manifest_navigator":765,"manifest_navigator_down":635,"text_input_on_manifest_navigator":634,"manifest_index":637,"order_of_magnitude":573,"fw_parent":870,"on.code_change":820,"fw_app":"driver","add_thick_line":400,"manifest_navigator_candidates":638,"copy_shape":396,"approximate":579,"add_def_to_menu":640,"draw_manifest_navigator":677,"Test_definition_background_color":858,"snapshot_canvas":867,"manifest_coord":636,"Menu_highlight_color":614,"approximate_up":658,"wait_for_response":781,"Menu_border_color":612,"on.code_submit":787,"Cursor_node":172,"Ticks_font":669,"Manifest_navigator":495,"on":1,"on.initialize":807,"load_definition":854,"sx":544,"initialize_manifest_navigator":773,"on_handle":547,"on.update":835,"interpolate_viewport":843,"tick_spec":660,"line_height":365,"get_multiple_definitions_from_app":783,"on.text_input":855,"animate_next_frame":825,"compute_layout":385,"Manifest":769,"Surface":422,"A":831,"load_manifest":694,"on.load_settings":782,"get_manifest":768}
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxx+1
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
local desired_viewport = Viewport
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
-- Render the canvas at pixel perfect resolution.
local winw,winh = App.screen.width, App.screen.height
App.screen.width,App.screen.height = Global_viewport.w, Global_viewport.h
Viewport = {x=minx, y=miny, w=cw, h=ch, zoom=1.0}
A()
Canvas = love.graphics.newCanvas(cw,ch)
love.graphics.setCanvas(Canvas)
App.fake_key_press = true -- Hack; disable drawing the menu and ticks
on.draw()
App.fake_key_press = nil
love.graphics.setCanvas()
App.screen.width,App.screen.height = winw,winh
-- initialize animation
Animating = {
Global_viewport,
desired_viewport,
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"add_def_to_menu":640,"Manifest":494,"load_manifest":496,"get_manifest":497,"compute_layout":385,"add_thick_line":400,"Menu_border_color":612,"on":1,"Menu_command_color":613,"Menu_highlight_color":614,"fw_parent":643,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"move_candidate_to_front_of_manifest":632,"maybe_update_key_in_definitions":529,"draw_cursor":639,"get_definition_from_app":624,"load_from_iterator":623,"manifest_navigator_down":635,"delete_definition":631,"keychord_press_on_manifest_navigator":633,"box_height":345,"text_input_on_manifest_navigator":634,"on_handle":547,"on.code_change":306,"manifest_index":637,"manifest_navigator_candidates":638,"on.mouse_press":617,"sx":544,"vx":545,"on.mouse_release":554,"on.key_release":552,"initialize_editor":450,"scale":7,"font":353,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"Surface":422,"draw_ticks":644,"on.draw":565,"Menu_background_color":611,"sy":469,"A":507,"Viewport":604,"update_editor_box":570,"line_height":365,"order_of_magnitude":573,"on_text":539,"B":379,"draw_menu_bar":641,"manifest_coord":636,"approximate":579,"reset_manifest_navigator":621,"schema1_of_y":467,"new_definition":504,"on.update":561,"Definitions":503,"on.keychord_press":610,"manifest_navigator_up":628,"vy":546,"approximate_up":583,"Page":475,"on.text_input":521,"copy_shape":396,"Manifest_navigator":495,"Ticks_font":594,"Cursor_node":172,"on.initialize":506,"y_of_schema1":364}
{"add_def_to_menu":640,"Manifest":494,"load_manifest":496,"get_manifest":497,"compute_layout":385,"add_thick_line":400,"Menu_border_color":612,"on":1,"Menu_command_color":613,"Menu_highlight_color":614,"fw_parent":642,"add_hotkey_to_menu":616,"draw_manifest_navigator":618,"num_lines_for_manifest_navigator":619,"move_candidate_to_front_of_manifest":632,"maybe_update_key_in_definitions":529,"draw_cursor":639,"get_definition_from_app":624,"load_from_iterator":623,"manifest_navigator_down":635,"delete_definition":631,"keychord_press_on_manifest_navigator":633,"box_height":345,"text_input_on_manifest_navigator":634,"on_handle":547,"on.code_change":306,"manifest_index":637,"manifest_navigator_candidates":638,"on.mouse_press":617,"sx":544,"vx":545,"on.mouse_release":554,"on.key_release":552,"initialize_editor":450,"scale":7,"font":353,"mouse_cursor":558,"Mouse_cursor":559,"set_mouse_cursor":562,"Surface":422,"draw_ticks":643,"on.draw":565,"Menu_background_color":611,"sy":469,"A":507,"Viewport":604,"update_editor_box":570,"line_height":365,"order_of_magnitude":573,"on_text":539,"B":379,"draw_menu_bar":641,"manifest_coord":636,"approximate":579,"reset_manifest_navigator":621,"schema1_of_y":467,"new_definition":504,"on.update":561,"Definitions":503,"on.keychord_press":610,"manifest_navigator_up":628,"vy":546,"approximate_up":583,"Page":475,"on.text_input":521,"copy_shape":396,"Manifest_navigator":495,"Ticks_font":594,"Cursor_node":172,"on.initialize":506,"y_of_schema1":364}
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":641,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"manifest_index":637,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"add_def_to_menu":640,"manifest_navigator_candidates":638,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"fw_parent":641,"approximate":579,"sy":469,"approximate_up":583,"draw_cursor":639,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":642,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
{"on.code_change":924,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":784,"Definitions":503,"Zoomed_out":869,"manifest_navigator_up":628,"Manifest":769,"manifest_navigator_down":635,"zoom_in":920,"delete_definition":673,"get_manifest":768,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"maybe_update_key_in_definitions":529,"manifest_coord":636,"new_definition":848,"manifest_navigator_candidates":638,"fw_app":"driver","add_def_to_menu":640,"on.draw":917,"Cursor_node":172,"Failing_test_definition_background_color":925,"on_handle":547,"on.code_submit":787,"on":1,"on_text":539,"on.mouse_press":916,"tick_spec":660,"on.keychord_press":919,"get_multiple_definitions_from_app":783,"schema1_of_y":667,"vx":545,"wait_for_response":781,"copy_viewport":866,"zoom_out":908,"on.load_settings":782,"Surface":422,"mouse_cursor":558,"line_height":365,"Mouse_cursor":559,"Menu_highlight_color":614,"Save_viewport":865,"sx":544,"set_mouse_cursor":562,"box_height":680,"Viewport":604,"font":353,"on.key_release":720,"vy":546,"on.save_settings":742,"initialize_manifest_navigator":773,"scale":712,"on.initialize":807,"survey_animation":906,"load_definition":854,"animate_next":914,"Ticks_font":669,"table_and_array_both_empty":689,"approximate":579,"Page":475,"order_of_magnitude":573,"animate_next_frame":915,"update_editor_box":711,"load_manifest":694,"draw_ticks":862,"A":831,"fw_parent":924,"Manifest_navigator":495,"Num_animation_frames":840,"sy":469,"surface_bounds":814,"y_of_schema1":364,"compute_layout":385,"copy_shape":396,"manifest_index":637,"draw_cursor":639,"undo_zoom_out":921,"on.mouse_release":836,"Definition_background_color":849,"Menu_command_color":613,"Spawn_point":822,"Menu_background_color":611,"from_viewport":823,"Test_definition_background_color":858,"interpolate_viewport":843,"definition_background_color":859,"initialize_editor":678,"approximate_up":658,"Animating":842,"draw_menu_bar":861,"on.text_input":855,"add_hotkey_to_menu":616,"B":830,"Menu_border_color":612,"draw_manifest_navigator":677,"on.update":900,"num_lines_for_manifest_navigator":676,"snapshot_canvas":913,"draw_run_time_error":808,"reset_manifest_navigator":772}
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":641,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"manifest_index":637,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"add_def_to_menu":640,"manifest_navigator_candidates":638,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"fw_parent":640,"approximate":579,"sy":469,"approximate_up":583,"draw_cursor":639,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"manifest_index":637,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"add_def_to_menu":640,"manifest_navigator_candidates":638,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"fw_parent":639,"approximate":579,"sy":469,"approximate_up":583,"draw_cursor":639,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
on.keychord_press = function(chord, key)
print('key', chord)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-g' then
-- special Expose-like 'global zoom' mode
if Zoomed_out == nil then
zoom_out()
else
undo_zoom_out()
end
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"manifest_index":637,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"manifest_navigator_candidates":638,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"fw_parent":638,"approximate":579,"sy":469,"approximate_up":583,"draw_cursor":639,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
on.mouse_press = function(x,y, mouse_button)
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"manifest_index":637,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"manifest_navigator_candidates":638,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"fw_parent":637,"approximate":579,"sy":469,"approximate_up":583,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"manifest_index":637,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"fw_parent":636,"approximate":579,"sy":469,"approximate_up":583,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
on.load_settings = function(settings)
App_name = load_manifest()
print('app name', App_name, settings)
if settings == nil then return end
Settings = settings -- stash all settings into a global for on.save_settings
if settings[App_name] == nil then
settings[App_name] = get_default_map()
return
end
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
local names = {}
for name, _ in pairs(Definitions) do
table.insert(names, name)
end
local defs = get_multiple_definitions_from_app(names)
for name, def_editor in pairs(Definitions) do
if defs[name] then
def_editor.data = load_from_iterator(defs[name]:gmatch("[^\r\n]+"))
else
-- app doesn't know about this definition
-- just delete it from the driver for now
print('deleting', name)
Definitions[name] = nil
end
end
end
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"fw_parent":635,"approximate":579,"sy":469,"approximate_up":583,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"fw_parent":634,"approximate":579,"sy":469,"approximate_up":583,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
schema1_of_y = function(editor, y)
-- return line/pos of screen line starting near a given y offset,
-- and the (negative) offset remaining after the calculation
-- invariants:
-- - 0 >= y_offset >= -Line_height
-- - let loc, y_offset = schema1_of_y(pane, y)
-- y + y_offset == y_of_schema1(pane, loc)
print(y)
assert(y >= 0)
local y_offset = y
for i=1,#editor.lines do
Text.populate_screen_line_starting_pos(editor, i)
local height = line_height(editor, i)
if y_offset < height then
local line = editor.lines[i]
local nlines = math.floor(y_offset/editor.line_height)
assert(nlines >= 0 and nlines < #editor.line_cache[i].screen_line_starting_pos)
local pos = editor.line_cache[i].screen_line_starting_pos[nlines+1] -- switch to 1-indexing
y_offset = y_offset - nlines*editor.line_height
return {line=i, pos=pos}, -y_offset
end
y_offset = y_offset - height
end
-- y is below the pane
return {line=#editor.lines+1, pos=1}, y_offset -- positive value
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxy+1 -- maxy+19 works, +15 doesn't
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":629,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"fw_parent":633,"approximate":579,"sy":469,"approximate_up":583,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":629,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"fw_parent":632,"approximate":579,"sy":469,"approximate_up":583,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
A = function(preserve_screen_top_of_cursor_node)
-- translate Page to Surface
compute_layout(Page, Page.x,Page.y, Surface, preserve_screen_top_of_cursor_node)
-- continue the pipeline
B(preserve_screen_top_of_cursor_node)
-- TODO: ugly that we're manipulating editor objects twice
end
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"move_candidate_to_front_of_manifest":632,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"add_thick_line":400,"fw_parent":631,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"on_handle":547,"Viewport":604,"on.update":561,"load_manifest":496,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.mouse_press":617,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"delete_definition":631,"on.initialize":506,"A":507,"manifest_navigator_down":629,"manifest_navigator_up":628,"on.mouse_release":554,"add_hotkey_to_menu":616,"line_height":365,"draw_ticks":609,"sy":469,"Menu_border_color":612,"Menu_command_color":613,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"get_definition_from_app":624,"load_from_iterator":623,"Ticks_font":594,"Manifest_navigator":495,"B":379,"draw_manifest_navigator":618,"initialize_editor":450,"on_text":539,"y_of_schema1":364,"Page":475,"approximate":579,"on":1,"set_mouse_cursor":562,"sx":544,"Manifest":494}
{"on.mouse_release":721,"schema1_of_y":667,"on.update":802,"on.keychord_press":828,"get_multiple_definitions_from_app":783,"on.save_settings":742,"Page":475,"approximate_up":658,"wait_for_response":781,"compute_layout":385,"Ticks_font":669,"table_and_array_both_empty":689,"Manifest_navigator":495,"maybe_update_key_in_definitions":529,"fw_parent":832,"Manifest":769,"font":353,"load_manifest":694,"on_text":539,"on_handle":547,"on.mouse_press":722,"Menu_background_color":611,"A":831,"sx":544,"Definitions":503,"vx":545,"Animating":813,"draw_menu_bar":641,"draw_run_time_error":808,"on.key_release":720,"draw_manifest_navigator":677,"survey_animation":827,"on.code_change":820,"reset_manifest_navigator":772,"mouse_cursor":558,"load_from_iterator":670,"Mouse_cursor":559,"animate_next_frame":825,"add_thick_line":400,"set_mouse_cursor":562,"copy_shape":396,"draw_ticks":663,"draw_cursor":639,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"manifest_coord":636,"from_viewport":823,"interpolate_viewport":824,"add_def_to_menu":640,"update_editor_box":711,"manifest_navigator_up":628,"on.load_settings":782,"B":830,"Spawn_point":822,"get_definition_from_app":784,"new_definition":821,"box_height":680,"on.code_submit":787,"fw_app":"driver","Menu_border_color":612,"num_lines_for_manifest_navigator":676,"animate_next":809,"add_hotkey_to_menu":616,"approximate":579,"Menu_highlight_color":614,"on.draw":797,"Menu_command_color":613,"get_manifest":768,"surface_bounds":814,"vy":546,"on.text_input":833,"Surface":422,"line_height":365,"manifest_index":637,"scale":712,"y_of_schema1":364,"manifest_navigator_candidates":638,"on":1,"Viewport":604,"initialize_editor":678,"tick_spec":660,"on.initialize":807,"manifest_navigator_down":635,"order_of_magnitude":573,"load_definition":716,"sy":469,"initialize_manifest_navigator":773,"Cursor_node":172}
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"delete_definition":631,"manifest_navigator_down":629,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Manifest":494,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":630,"set_mouse_cursor":562,"on":1,"approximate":579,"manifest_navigator_up":628,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"manifest_navigator_down":629,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Manifest":494,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":629,"set_mouse_cursor":562,"on":1,"approximate":579,"manifest_navigator_up":628,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
B = function(preserve_screen_top_of_cursor_node)
print('B')
-- recompute various aspects based on the current viewport settings
love.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current font so update it
for _,obj in ipairs(Surface) do
if obj.type == 'line' then
obj.zdata = {}
for i=1,#obj.data,2 do
table.insert(obj.zdata, vx(obj.data[i]))
table.insert(obj.zdata, vy(obj.data[i+1]))
end
elseif obj.type == 'bezier' then
zdata = {}
for i=1,#obj.data,2 do
table.insert(zdata, vx(obj.data[i]))
table.insert(zdata, vy(obj.data[i+1]))
end
obj.zdata = love.math.newBezierCurve(zdata):render()
elseif obj.type == 'text' then
if obj.w then
update_editor_box(obj, preserve_screen_top_of_cursor_node)
else
obj.text = love.graphics.newText(love.graphics.getFont(), obj.data)
end
end
end
end
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":627,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"manifest_navigator_down":629,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Manifest":494,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":628,"set_mouse_cursor":562,"on":1,"approximate":579,"manifest_navigator_up":628,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":627,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Manifest":494,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":627,"set_mouse_cursor":562,"on":1,"approximate":579,"manifest_navigator_up":628,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
draw_ticks = function()
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo)
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo)
end
{"on.update":900,"Test_definition_background_color":858,"sx":544,"definition_background_color":859,"on.mouse_release":836,"add_thick_line":400,"on.key_release":720,"copy_shape":396,"manifest_navigator_up":628,"snapshot_canvas":913,"manifest_navigator_down":635,"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"move_candidate_to_front_of_manifest":632,"zoom_out":908,"keychord_press_on_manifest_navigator":765,"Zoomed_out":869,"set_mouse_cursor":562,"draw_load_time_error":929,"draw_ticks":862,"draw_test_failure_indicator":933,"manifest_index":637,"font":353,"manifest_navigator_candidates":638,"Surface":422,"add_def_to_menu":640,"order_of_magnitude":573,"on.draw":932,"vx":545,"approximate":579,"Viewport":604,"line_height":365,"Page":475,"approximate_up":658,"on":1,"Manifest_navigator":495,"on.keychord_press":919,"draw_run_time_error":808,"draw_cursor":639,"manifest_coord":636,"schema1_of_y":667,"survey_animation":906,"on.initialize":807,"animate_next":914,"A":831,"on.code_submit":927,"on.mouse_press":916,"Manifest":769,"load_definition":854,"animate_next_frame":915,"load_manifest":694,"update_editor_box":711,"get_manifest":768,"initialize_editor":678,"compute_layout":385,"box_height":680,"tick_spec":660,"Menu_background_color":611,"initialize_manifest_navigator":773,"Definitions":503,"on.save_settings":742,"new_definition":848,"on.load_settings":782,"Menu_highlight_color":614,"get_multiple_definitions_from_app":783,"draw_menu_bar":861,"text_input_on_manifest_navigator":634,"add_hotkey_to_menu":616,"Spawn_point":822,"Failing_test_definition_background_color":925,"from_viewport":823,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"vy":546,"wait_for_response":781,"reset_manifest_navigator":772,"maybe_update_key_in_definitions":529,"scale":712,"load_from_iterator":670,"B":830,"get_definition_from_app":784,"y_of_schema1":364,"Ticks_font":669,"sy":469,"surface_bounds":814,"Cursor_node":172,"zoom_in":920,"undo_zoom_out":921,"mouse_cursor":558,"fw_parent":932,"Num_animation_frames":840,"fw_app":"driver","table_and_array_both_empty":689,"Mouse_cursor":559,"on_handle":547,"Menu_command_color":613,"draw_manifest_navigator":677,"on.code_change":924,"Animating":842,"on_text":539,"Definition_background_color":849,"Menu_border_color":612,"delete_definition":673}
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":627,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":626,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
on.load_settings = function(settings)
App_name = load_manifest()
print('app name', App_name, settings)
if settings == nil then return end
Settings = settings -- stash all settings into a global for on.save_settings
if settings[App_name] == nil then
return
end
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
local names = {}
for name, _ in pairs(Definitions) do
table.insert(names, name)
end
local defs = get_multiple_definitions_from_app(names)
print('responses received')
for k,v in pairs(defs) do
print(k)
end
for name, def_editor in pairs(Definitions) do
if defs[name] then
def_editor.data = load_from_iterator(defs[name]:gmatch("[^\r\n]+"))
else
-- app doesn't know about this definition
-- just delete it from the driver for now
print('deleting', name)
Definitions[name] = nil
end
end
end
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":626,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":625,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
maybe_update_key_in_definitions = function(old_definition_name, definition_name, Cursor_node)
print(old_definition_name, definition_name)
if old_definition_name ~= definition_name then
if old_definition_name == nil or Definitions[old_definition_name] ~= Cursor_node then
local pos = array.find(Definitions, Cursor_node)
print('found at index', pos)
assert(pos)
table.remove(Definitions, pos)
elseif Definitions[old_definition_name] == Cursor_node then
print('found at key', old_definition_name)
Definitions[old_definition_name] = nil
end
if definition_name and Definitions[definition_name] == nil then
print('moving to key', definition_name)
Definitions[definition_name] = Cursor_node
elseif Definitions[definition_name] then
-- temporary collision; try again later
-- deleting and reinserting is inefficient, but hopefully rare
print('moving to index', #Definitions)
table.insert(Definitions, definition_name)
end
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
end
end
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":625,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":624,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":622,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":623,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), vy(y)+2, 5)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":622,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":622,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":622,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":621,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":620,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":620,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
{"draw_cursor":639,"mouse_cursor":558,"fw_parent":876,"Mouse_cursor":559,"Definitions":503,"on.mouse_release":836,"set_mouse_cursor":562,"zoom_out":870,"draw_ticks":862,"load_manifest":694,"zoom_in":877,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"on.code_submit":787,"approximate":579,"add_thick_line":400,"y_of_schema1":364,"A":831,"approximate_up":658,"get_multiple_definitions_from_app":783,"Ticks_font":669,"on_handle":547,"wait_for_response":781,"Page":475,"on_text":539,"on.code_change":820,"sx":544,"manifest_navigator_down":635,"from_viewport":823,"on.initialize":807,"vx":545,"draw_run_time_error":808,"tick_spec":660,"update_editor_box":711,"get_manifest":768,"on.key_release":720,"survey_animation":863,"Manifest":769,"animate_next":841,"Menu_border_color":612,"schema1_of_y":667,"on":1,"scale":712,"Menu_highlight_color":614,"animate_next_frame":825,"draw_menu_bar":861,"copy_shape":396,"add_hotkey_to_menu":616,"load_definition":854,"on.mouse_press":875,"draw_manifest_navigator":677,"vy":546,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"surface_bounds":814,"reset_manifest_navigator":772,"on.keychord_press":871,"line_height":365,"load_from_iterator":670,"Animating":842,"get_definition_from_app":784,"manifest_navigator_candidates":638,"on.load_settings":782,"Spawn_point":822,"manifest_index":637,"manifest_navigator_up":628,"Num_animation_frames":840,"interpolate_viewport":843,"Surface":422,"new_definition":848,"delete_definition":673,"sy":469,"move_candidate_to_front_of_manifest":632,"on.text_input":855,"keychord_press_on_manifest_navigator":765,"B":830,"text_input_on_manifest_navigator":634,"font":353,"Zoomed_out":869,"manifest_coord":636,"initialize_manifest_navigator":773,"Test_definition_background_color":858,"Cursor_node":172,"Manifest_navigator":495,"on.update":835,"on.save_settings":742,"add_def_to_menu":640,"fw_app":"driver","table_and_array_both_empty":689,"Menu_background_color":611,"definition_background_color":859,"compute_layout":385,"Menu_command_color":613,"box_height":680,"on.draw":797,"snapshot_canvas":872,"Definition_background_color":849,"Save_viewport":865,"Viewport":604,"copy_viewport":866}
definition_file = function(name, manifest_version)
local client_app_save_dir = love.filesystem.getSaveDirectory():gsub(love.filesystem.getIdentity()..'$', App_name)
local filename = live.versioned_filename(manifest_version[name], name)
return client_app_save_dir..'/'..filename
end
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":620,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":619,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
-- print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 4 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 8 do
-- print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
-- print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
-- print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
{"A":831,"move_candidate_to_front_of_manifest":632,"Spawn_point":822,"keychord_press_on_manifest_navigator":765,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"Mouse_cursor":559,"manifest_coord":636,"manifest_index":637,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":862,"add_def_to_menu":640,"line_height":365,"Definition_background_color":849,"box_height":680,"order_of_magnitude":573,"compute_layout":385,"definition_background_color":859,"on.code_change":924,"approximate":579,"load_manifest":694,"on":1,"get_manifest":768,"approximate_up":658,"snapshot_canvas":913,"Save_viewport":865,"draw_cursor":639,"Ticks_font":669,"zoom_out":908,"Zoomed_out":869,"update_editor_box":711,"initialize_editor":678,"zoom_in":920,"get_default_map":937,"on.mouse_press":916,"fw_app":"driver","on.save_settings":742,"num_lines_for_manifest_navigator":676,"Manifest_navigator":495,"on.code_submit":927,"initialize_manifest_navigator":773,"Menu_background_color":611,"animate_next_frame":915,"Menu_border_color":612,"y_of_schema1":364,"Menu_command_color":613,"Manifest":769,"Menu_highlight_color":614,"copy_viewport":866,"draw_menu_bar":861,"font":353,"add_hotkey_to_menu":616,"animate_next":914,"get_multiple_definitions_from_app":783,"Num_animation_frames":840,"survey_animation":906,"on.load_settings":940,"wait_for_response":781,"on.text_input":855,"fw_parent":942,"sx":544,"maybe_update_key_in_definitions":529,"vx":545,"sy":469,"load_definition":854,"scale":712,"Animating":842,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":660,"on.key_release":720,"on.draw":932,"Page":475,"draw_run_time_error":808,"new_definition":848,"undo_zoom_out":921,"add_thick_line":400,"B":830,"copy_shape":396,"on_handle":547,"Failing_test_definition_background_color":925,"vy":546,"draw_manifest_navigator":677,"draw_test_failure_indicator":935,"on_text":539,"draw_load_time_error":929,"table_and_array_both_empty":689,"reset_manifest_navigator":772,"Cursor_node":172,"on.mouse_release":836,"load_from_iterator":670,"on.update":943,"get_definition_from_app":784,"on.keychord_press":919,"Viewport":604,"Test_definition_background_color":858,"surface_bounds":814,"manifest_navigator_up":628,"Definitions":503,"manifest_navigator_down":635,"Surface":422,"on.initialize":807,"delete_definition":673}
on.update = function(dt)
if Animating then
Animating.frame_time = Animating.frame_time + dt
print(Animating.frame_time)
if Animating.frame_time > 0.01 then
Animating.frame_time = Animating.frame_time - 0.01
Animating.step = Animating.step+1
if Animating.step >= 10 then
Animating = nil
return
end
Viewport[Animating.viewport_key] = Animating.start + Animating.step * Animating.step_increment
B()
end
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
A()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":618,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"on.draw":565,"on.key_release":552,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":617,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"on.draw":565,"on.key_release":552,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"fw_parent":616,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"set_mouse_cursor":562,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
{"sy":469,"update_editor_box":570,"scale":7,"on.update":561,"on.keychord_press":610,"on_handle":547,"schema1_of_y":467,"Ticks_font":594,"font":353,"on_text":539,"Cursor_node":172,"on.mouse_press":556,"on.code_change":306,"sx":544,"add_hotkey_to_menu":616,"vx":545,"Surface":422,"Menu_background_color":611,"Menu_command_color":613,"load_manifest":496,"Menu_border_color":612,"get_manifest":497,"on.key_release":552,"Viewport":604,"Menu_highlight_color":614,"draw_menu_bar":615,"add_thick_line":400,"Manifest_navigator":495,"Definitions":503,"approximate_up":583,"new_definition":504,"compute_layout":385,"box_height":345,"vy":546,"on.initialize":506,"A":507,"fw_parent":615,"set_mouse_cursor":562,"mouse_cursor":558,"draw_ticks":609,"B":379,"line_height":365,"copy_shape":396,"Mouse_cursor":559,"on.draw":565,"maybe_update_key_in_definitions":529,"approximate":579,"on.mouse_release":554,"order_of_magnitude":573,"y_of_schema1":364,"Page":475,"initialize_editor":450,"on.text_input":521,"Manifest":494,"on":1}
{"sy":469,"update_editor_box":570,"scale":7,"on.update":561,"on.keychord_press":610,"on_handle":547,"schema1_of_y":467,"Ticks_font":594,"font":353,"on_text":539,"Cursor_node":172,"on.mouse_press":556,"on.code_change":306,"sx":544,"vx":545,"Surface":422,"Menu_background_color":611,"Menu_command_color":613,"load_manifest":496,"Menu_border_color":612,"get_manifest":497,"on.key_release":552,"Viewport":604,"Menu_highlight_color":614,"draw_menu_bar":615,"add_thick_line":400,"Manifest_navigator":495,"Definitions":503,"approximate_up":583,"new_definition":504,"compute_layout":385,"box_height":345,"vy":546,"on.initialize":506,"A":507,"fw_parent":614,"set_mouse_cursor":562,"mouse_cursor":558,"draw_ticks":609,"B":379,"line_height":365,"copy_shape":396,"Mouse_cursor":559,"on.draw":565,"maybe_update_key_in_definitions":529,"approximate":579,"on.mouse_release":554,"order_of_magnitude":573,"y_of_schema1":364,"Page":475,"initialize_editor":450,"on.text_input":521,"Manifest":494,"on":1}
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
if obj.editor.load_time_error then
print('load time error found')
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, vy(obj.y))
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(5*20*Viewport.zoom))
love.graphics.setColor(0,0,0)
love.graphics.print(obj.editor.load_time_error, vx(obj.x), error_y)
end
end
end
end
draw_ticks()
draw_menu_bar()
end
{"sy":469,"update_editor_box":570,"scale":7,"on.update":561,"on.keychord_press":610,"on_handle":547,"schema1_of_y":467,"Ticks_font":594,"font":353,"on_text":539,"Cursor_node":172,"on.mouse_press":556,"on.code_change":306,"sx":544,"vx":545,"Menu_background_color":611,"Menu_command_color":613,"load_manifest":496,"Menu_border_color":612,"get_manifest":497,"on.key_release":552,"Viewport":604,"Menu_highlight_color":614,"Surface":422,"add_thick_line":400,"Manifest_navigator":495,"Definitions":503,"approximate_up":583,"new_definition":504,"compute_layout":385,"box_height":345,"vy":546,"on.initialize":506,"A":507,"fw_parent":613,"set_mouse_cursor":562,"mouse_cursor":558,"draw_ticks":609,"B":379,"line_height":365,"copy_shape":396,"Mouse_cursor":559,"on.draw":565,"maybe_update_key_in_definitions":529,"approximate":579,"on.mouse_release":554,"order_of_magnitude":573,"y_of_schema1":364,"Page":475,"initialize_editor":450,"on.text_input":521,"Manifest":494,"on":1}
draw_test_failure_indicator = function()
if Client_app_test_failures == nil then
return
end
if next(Client_app_test_failures, nil) == nil then
return
end
App.color(Failing_test_definition_background_color)
local border_width = App.screen.width/40, App.screen.height
love.graphics.rectangle('fill', 0,0, border_width,App.screen.height)
love.graphics.rectangle('fill', App.screen.width-border_width, 0, border_width, App.screen.height)
love.graphics.rectangle('fill', 0,App.screen.height-border_width, App.screen.width, border_width)
end
{"sy":469,"update_editor_box":570,"scale":7,"on.update":561,"on.keychord_press":610,"on_handle":547,"schema1_of_y":467,"Ticks_font":594,"font":353,"on_text":539,"Cursor_node":172,"on.mouse_press":556,"on.code_change":306,"sx":544,"vx":545,"Menu_command_color":613,"load_manifest":496,"Menu_border_color":612,"get_manifest":497,"on.key_release":552,"Viewport":604,"Menu_background_color":611,"Surface":422,"add_thick_line":400,"Manifest_navigator":495,"Definitions":503,"approximate_up":583,"new_definition":504,"compute_layout":385,"box_height":345,"vy":546,"on.initialize":506,"A":507,"fw_parent":612,"set_mouse_cursor":562,"mouse_cursor":558,"draw_ticks":609,"B":379,"line_height":365,"copy_shape":396,"Mouse_cursor":559,"on.draw":565,"maybe_update_key_in_definitions":529,"approximate":579,"on.mouse_release":554,"order_of_magnitude":573,"y_of_schema1":364,"Page":475,"initialize_editor":450,"on.text_input":521,"Manifest":494,"on":1}
{"vy":546,"mouse_cursor":558,"Mouse_cursor":559,"on.save_settings":742,"on.load_settings":782,"set_mouse_cursor":562,"draw_ticks":663,"animate_next":837,"table_and_array_both_empty":689,"animate_next_frame":825,"order_of_magnitude":573,"sy":469,"update_editor_box":711,"approximate":579,"surface_bounds":814,"schema1_of_y":667,"approximate_up":658,"Manifest_navigator":495,"Cursor_node":172,"Spawn_point":822,"Ticks_font":669,"from_viewport":823,"interpolate_viewport":839,"Animating":838,"font":353,"draw_menu_bar":641,"add_hotkey_to_menu":616,"Manifest":769,"draw_manifest_navigator":677,"load_manifest":694,"num_lines_for_manifest_navigator":676,"get_manifest":768,"reset_manifest_navigator":772,"on.text_input":834,"load_from_iterator":670,"get_definition_from_app":784,"Menu_background_color":611,"on.draw":797,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"new_definition":821,"Menu_highlight_color":614,"delete_definition":673,"copy_shape":396,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"on.mouse_release":836,"manifest_coord":636,"on.keychord_press":828,"maybe_update_key_in_definitions":529,"B":830,"Num_animation_frames":840,"Page":475,"add_def_to_menu":640,"y_of_schema1":364,"draw_cursor":639,"scale":712,"A":831,"manifest_navigator_up":628,"on.update":835,"tick_spec":660,"vx":545,"survey_animation":827,"Surface":422,"get_multiple_definitions_from_app":783,"on.code_submit":787,"manifest_navigator_candidates":638,"on_handle":547,"add_thick_line":400,"draw_run_time_error":808,"move_candidate_to_front_of_manifest":632,"line_height":365,"on_text":539,"initialize_manifest_navigator":773,"on.mouse_press":722,"box_height":680,"manifest_navigator_down":635,"initialize_editor":678,"fw_parent":839,"sx":544,"fw_app":"driver","compute_layout":385,"manifest_index":637,"wait_for_response":781,"on.code_change":820,"on.initialize":807,"on":1,"on.key_release":720,"Viewport":604,"load_definition":716}
{"sy":469,"update_editor_box":570,"scale":7,"on.update":561,"on.keychord_press":610,"on_handle":547,"schema1_of_y":467,"Ticks_font":594,"font":353,"on_text":539,"Cursor_node":172,"on.mouse_press":556,"on.code_change":306,"sx":544,"vx":545,"load_manifest":496,"Menu_border_color":612,"get_manifest":497,"on.key_release":552,"Viewport":604,"Menu_background_color":611,"Surface":422,"add_thick_line":400,"Manifest_navigator":495,"Definitions":503,"approximate_up":583,"new_definition":504,"compute_layout":385,"box_height":345,"vy":546,"on.initialize":506,"A":507,"fw_parent":611,"set_mouse_cursor":562,"mouse_cursor":558,"draw_ticks":609,"B":379,"line_height":365,"copy_shape":396,"Mouse_cursor":559,"on.draw":565,"maybe_update_key_in_definitions":529,"approximate":579,"on.mouse_release":554,"order_of_magnitude":573,"y_of_schema1":364,"Page":475,"initialize_editor":450,"on.text_input":521,"Manifest":494,"on":1}
add_def_to_menu = function(x,y, s, cursor_highlight)
local s_text = to_hud_text(s)
if x + width > App.screen.width - 5 then
y = y + HUD_line_height + --[[highlight padding]] 5
x = 5
end
local color = Menu_background_color
if cursor_highlight then
color = Menu_highlight_color
end
button(HUD, 'menu', {x=x-5, y=y-2, w=width+5*2, h=HUD_line_height+2*2, color=colortable(color),
onpress1 = function()
load_definition(s)
end
})
App.color(Menu_command_color)
App.screen.draw(s_text, x,y)
x = x + width + 30
return x,y
end
local width = s_text:getWidth()
{"on_handle":547,"definition_background_color":856,"draw_run_time_error":808,"survey_animation":847,"sx":544,"animate_next":841,"on.update":835,"load_definition":854,"on.keychord_press":828,"animate_next_frame":825,"box_height":680,"schema1_of_y":667,"on.save_settings":742,"surface_bounds":814,"Ticks_font":669,"y_of_schema1":364,"set_mouse_cursor":562,"font":353,"table_and_array_both_empty":689,"Spawn_point":822,"from_viewport":823,"load_manifest":694,"interpolate_viewport":843,"order_of_magnitude":573,"on.text_input":855,"Manifest":769,"B":830,"on.code_change":820,"get_manifest":768,"Cursor_node":172,"manifest_index":637,"approximate_up":658,"manifest_navigator_candidates":638,"Num_animation_frames":840,"new_definition":848,"add_thick_line":400,"update_editor_box":711,"copy_shape":396,"sy":469,"draw_manifest_navigator":677,"on.mouse_press":722,"Surface":422,"Test_definition_background_color":852,"draw_cursor":639,"Definition_background_color":849,"Viewport":604,"add_hotkey_to_menu":616,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"draw_ticks":844,"approximate":579,"tick_spec":660,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"vy":546,"Menu_command_color":613,"Mouse_cursor":559,"Menu_highlight_color":614,"mouse_cursor":558,"draw_menu_bar":641,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"Page":475,"on.code_submit":787,"Manifest_navigator":495,"fw_app":"driver","line_height":365,"on.initialize":807,"Definitions":503,"delete_definition":673,"keychord_press_on_manifest_navigator":765,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"get_multiple_definitions_from_app":783,"manifest_navigator_down":635,"on":1,"compute_layout":385,"on.key_release":720,"move_candidate_to_front_of_manifest":632,"Animating":842,"wait_for_response":781,"text_input_on_manifest_navigator":634,"fw_parent":855,"A":831,"manifest_coord":636,"scale":712,"on.mouse_release":836,"reset_manifest_navigator":772,"on.draw":797,"vx":545}
A = function(preserve_screen_top_of_cursor_node)
-- translate Page to Surface
while #Surface > 3 do table.remove(Surface) end -- HACK
compute_layout(Page, Page.x,Page.y, Surface, preserve_screen_top_of_cursor_node)
-- continue the pipeline
B(preserve_screen_top_of_cursor_node)
-- TODO: ugly that we're manipulating editor objects twice
end
{"sy":469,"update_editor_box":570,"scale":7,"on.update":561,"on.keychord_press":610,"on_handle":547,"schema1_of_y":467,"Ticks_font":594,"font":353,"on_text":539,"Cursor_node":172,"on.mouse_press":556,"on.code_change":306,"sx":544,"vx":545,"load_manifest":496,"get_manifest":497,"on.key_release":552,"Viewport":604,"Menu_background_color":611,"Surface":422,"add_thick_line":400,"Manifest_navigator":495,"Definitions":503,"approximate_up":583,"new_definition":504,"compute_layout":385,"box_height":345,"vy":546,"on.initialize":506,"A":507,"fw_parent":610,"set_mouse_cursor":562,"mouse_cursor":558,"draw_ticks":609,"B":379,"line_height":365,"copy_shape":396,"Mouse_cursor":559,"on.draw":565,"maybe_update_key_in_definitions":529,"approximate":579,"on.mouse_release":554,"order_of_magnitude":573,"y_of_schema1":364,"Page":475,"initialize_editor":450,"on.text_input":521,"Manifest":494,"on":1}
{"update_editor_box":570,"on_text":539,"on.mouse_press":556,"on.draw":565,"sx":544,"schema1_of_y":467,"vx":545,"Manifest_navigator":495,"y_of_schema1":364,"load_manifest":496,"get_manifest":497,"Cursor_node":172,"on.mouse_release":554,"initialize_editor":450,"on":1,"Definitions":503,"new_definition":504,"scale":7,"Page":475,"vy":546,"compute_layout":385,"draw_ticks":609,"on.text_input":521,"on.initialize":506,"line_height":365,"on.keychord_press":610,"B":379,"order_of_magnitude":573,"font":353,"set_mouse_cursor":562,"Manifest":494,"Viewport":604,"approximate":579,"add_thick_line":400,"Mouse_cursor":559,"copy_shape":396,"mouse_cursor":558,"sy":469,"on.key_release":552,"fw_parent":609,"A":507,"box_height":345,"Ticks_font":594,"on.update":561,"approximate_up":583,"on_handle":547,"on.code_change":306,"maybe_update_key_in_definitions":529,"Surface":422}
on.text_input = function(t)
print('text input', t)
if Manifest_navigator.show then
text_input_on_manifest_navigator(t)
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.text_input(Cursor_node.editor, t)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
end
end
zoom_in = function(x,y)
-- precondition: Zoomed_out
-- precondition: Viewport == Global_viewport
-- precondition: Saved_viewport exists
-- center Viewport on x,y at zoom level Saved_viewport.zoom
Viewport = {
x=sx(x)-App.screen.width/Saved_viewport.zoom/2,
y=sy(y)-App.screen.height/Saved_viewport.zoom/2,
w=App.screen.width/Saved_viewport.zoom,
h=App.screen.height/Saved_viewport.zoom,
zoom=Saved_viewport.zoom,
}
end
keychord_press_on_manifest_navigator = function(chord, key)
if chord == 'escape' then
reset_manifest_navigator()
elseif chord == 'return' then
if Manifest_navigator.delete then
delete_definition(Manifest_navigator.candidates[Manifest_navigator.index])
else
load_definition(Manifest_navigator.candidates[Manifest_navigator.index])
end
reset_manifest_navigator()
elseif chord == 'backspace' then
local len = utf8.len(Manifest_navigator.filter)
local byte_offset = Text.offset(Manifest_navigator.filter, len)
Manifest_navigator.filter = string.sub(Manifest_navigator.filter, 1, byte_offset-1)
Manifest_navigator.index = 1
Manifest_navigator.candidates = manifest_navigator_candidates()
elseif chord == 'left' then
if Manifest_navigator.index > 1 then
Manifest_navigator.index = Manifest_navigator.index-1
end
elseif chord == 'right' then
if Manifest_navigator.index < #Manifest_navigator.candidates then
Manifest_navigator.index = Manifest_navigator.index+1
end
elseif chord == 'down' then
manifest_navigator_down()
elseif chord == 'up' then
manifest_navigator_up()
end
end
{"compute_layout":385,"on":1,"on.code_change":306,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"copy_shape":396,"on.update":561,"approximate":579,"Surface":422,"on.draw":565,"scale":7,"approximate_up":583,"initialize_editor":450,"Definitions":503,"update_editor_box":570,"new_definition":504,"on_handle":547,"on_text":539,"schema1_of_y":467,"Manifest_navigator":495,"line_height":365,"sx":544,"Page":475,"vx":545,"on.mouse_release":554,"Ticks_font":594,"on.initialize":506,"A":507,"sy":469,"on.text_input":521,"box_height":345,"load_manifest":496,"B":379,"fw_parent":608,"get_manifest":497,"on.key_release":552,"mouse_cursor":558,"Mouse_cursor":559,"Viewport":604,"add_thick_line":400,"y_of_schema1":364,"Manifest":494,"set_mouse_cursor":562,"Cursor_node":172,"draw_ticks":609,"vy":546,"font":353,"on.keychord_press":569,"on.mouse_press":556}
{"order_of_magnitude":573,"initialize_editor":450,"A":507,"Surface":422,"approximate":579,"Manifest":494,"on.draw":565,"Viewport":604,"approximate_up":583,"y_of_schema1":364,"Ticks_font":594,"on.mouse_release":554,"update_editor_box":570,"on_text":539,"on.keychord_press":569,"load_manifest":496,"get_manifest":497,"Page":475,"schema1_of_y":467,"vx":545,"Definitions":503,"on.update":561,"new_definition":504,"on.key_release":552,"on.code_change":306,"vy":546,"Manifest_navigator":495,"Cursor_node":172,"on.mouse_press":556,"on.initialize":506,"on_handle":547,"maybe_update_key_in_definitions":529,"mouse_cursor":558,"add_thick_line":400,"Mouse_cursor":559,"copy_shape":396,"scale":7,"font":353,"set_mouse_cursor":562,"sx":544,"draw_ticks":608,"B":379,"line_height":365,"compute_layout":385,"box_height":345,"on":1,"on.text_input":521,"sy":469,"fw_parent":607}
on.update = function(dt)
if Animating then
animate_next(dt)
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-sx(Move.xoff)
Move.node.y = sy(App.mouse_y())-Move.yoff
B()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
{"order_of_magnitude":573,"initialize_editor":450,"A":507,"Surface":422,"approximate":579,"Manifest":494,"on.draw":565,"Viewport":604,"approximate_up":583,"y_of_schema1":364,"Ticks_font":594,"on.mouse_release":554,"update_editor_box":570,"on_text":539,"on.keychord_press":569,"load_manifest":496,"get_manifest":497,"Page":475,"schema1_of_y":467,"vx":545,"Definitions":503,"on.update":561,"new_definition":504,"on.key_release":552,"on.code_change":306,"vy":546,"Manifest_navigator":495,"Cursor_node":172,"on.mouse_press":556,"on.initialize":506,"on_handle":547,"maybe_update_key_in_definitions":529,"mouse_cursor":558,"add_thick_line":400,"Mouse_cursor":559,"copy_shape":396,"scale":7,"font":353,"set_mouse_cursor":562,"sx":544,"draw_ticks":607,"B":379,"line_height":365,"compute_layout":385,"box_height":345,"on":1,"on.text_input":521,"sy":469,"fw_parent":606}
{"order_of_magnitude":573,"initialize_editor":450,"A":507,"Surface":422,"approximate":579,"Manifest":494,"on.draw":565,"Viewport":604,"approximate_up":583,"y_of_schema1":364,"Ticks_font":594,"on.mouse_release":554,"update_editor_box":570,"on_text":539,"on.keychord_press":569,"load_manifest":496,"get_manifest":497,"Page":475,"schema1_of_y":467,"vx":545,"Definitions":503,"on.update":561,"new_definition":504,"on.key_release":552,"on.code_change":306,"vy":546,"Manifest_navigator":495,"Cursor_node":172,"on.mouse_press":556,"on.initialize":506,"on_handle":547,"maybe_update_key_in_definitions":529,"mouse_cursor":558,"add_thick_line":400,"Mouse_cursor":559,"copy_shape":396,"scale":7,"font":353,"set_mouse_cursor":562,"sx":544,"draw_ticks":606,"B":379,"line_height":365,"compute_layout":385,"box_height":345,"on":1,"on.text_input":521,"sy":469,"fw_parent":605}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
end
node.editor.top = node.editor.top
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
{"order_of_magnitude":573,"initialize_editor":450,"A":507,"Surface":422,"approximate":579,"Manifest":494,"on.draw":565,"Viewport":604,"approximate_up":583,"y_of_schema1":364,"Ticks_font":594,"on.mouse_release":554,"update_editor_box":570,"on_text":539,"on.keychord_press":569,"load_manifest":496,"get_manifest":497,"Page":475,"schema1_of_y":467,"vx":545,"Definitions":503,"on.update":561,"new_definition":504,"on.key_release":552,"on.code_change":306,"vy":546,"Manifest_navigator":495,"Cursor_node":172,"on.mouse_press":556,"on.initialize":506,"on_handle":547,"maybe_update_key_in_definitions":529,"mouse_cursor":558,"add_thick_line":400,"Mouse_cursor":559,"copy_shape":396,"scale":7,"font":353,"set_mouse_cursor":562,"sx":544,"draw_ticks":605,"B":379,"line_height":365,"compute_layout":385,"box_height":345,"on":1,"on.text_input":521,"sy":469,"fw_parent":604}
definition_background_color = function(name)
print('definition_background_color', name)
if starts_with(name, 'test_') then
return Test_definition_background_color
else
return Definition_background_color
end
end
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":603,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":603,"Ticks_font":594,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":604,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":602,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":603,"Ticks_font":594,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":601,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":602,"Ticks_font":594,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":600,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":601,"Ticks_font":594,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
get_manifest = function()
live.send_to_app('MANIFEST')
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
local result = {}
if #response_string == 0 then
-- error; retry
return result
else
-- stop retrying
Manifest_navigator.reload = false
end
local app_name
local response = json.decode(response_string)
for name, value in pairs(response) do
if not starts_with(name, 'fw_') then
table.insert(result, name)
elseif name == 'fw_app' then
print('get manifest: app_name', value)
app_name = value
end
end
return result, app
end
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":599,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":600,"Ticks_font":594,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":598,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":599,"Ticks_font":594,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":597,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":598,"Ticks_font":594,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
on.save_settings = function()
for key,node in pairs(Definitions) do
if type(key) == 'number' then
-- can't save the array side for now because of a limitation in the
Definitions[key] = nil
else
node.data = nil -- don't save uncommitted data for now
node.editor = nil -- TODO: check for hierarchy
end
end
return {
viewport=Viewport,
definitions=Definitions,
}
end
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":596,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":597,"Ticks_font":594,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":595,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":596,"Ticks_font":594,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":594,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":595,"Ticks_font":594,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":593,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":593,"Ticks_font":594,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"Ticks_font":669,"new_definition":848,"table_and_array_both_empty":689,"draw_run_time_error":808,"maybe_update_key_in_definitions":529,"y_of_schema1":364,"animate_next":841,"Menu_background_color":611,"Menu_border_color":612,"animate_next_frame":825,"Menu_command_color":613,"vx":545,"Menu_highlight_color":614,"Viewport":604,"draw_menu_bar":641,"vy":546,"surface_bounds":814,"Cursor_node":172,"num_lines_for_manifest_navigator":676,"on.mouse_release":836,"reset_manifest_navigator":772,"load_from_iterator":670,"Spawn_point":822,"get_definition_from_app":784,"from_viewport":823,"Page":475,"interpolate_viewport":843,"add_thick_line":400,"manifest_navigator_up":628,"copy_shape":396,"manifest_navigator_down":635,"Animating":842,"B":830,"Num_animation_frames":840,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"on_handle":547,"text_input_on_manifest_navigator":634,"A":831,"on":1,"on.code_change":820,"manifest_index":637,"on.mouse_press":722,"manifest_navigator_candidates":638,"on.update":835,"sx":544,"on.draw":797,"scale":712,"manifest_coord":636,"on.key_release":720,"fw_parent":861,"wait_for_response":781,"Surface":422,"sy":469,"compute_layout":385,"get_multiple_definitions_from_app":783,"initialize_manifest_navigator":773,"delete_definition":673,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"tick_spec":660,"font":353,"fw_app":"driver","set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":844,"line_height":365,"on.initialize":807,"on.code_submit":787,"initialize_editor":678,"on.text_input":855,"survey_animation":860,"on_text":539,"approximate_up":658,"order_of_magnitude":573,"load_definition":854,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.keychord_press":828,"approximate":579,"Manifest":769,"update_editor_box":711,"box_height":680,"load_manifest":694,"definition_background_color":859,"get_manifest":768,"Test_definition_background_color":858,"on.save_settings":742,"schema1_of_y":667,"on.load_settings":782,"Definition_background_color":849,"add_def_to_menu":640,"draw_cursor":639}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":592,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":593,"Ticks_font":589,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":591,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":592,"Ticks_font":589,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":994,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":995,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":992,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":590,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":591,"Ticks_font":589,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":589,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":590,"Ticks_font":589,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
if vy(node.y) > 0 then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, -vy(node.y))
end
if node.editor.font_height ~= scale(20) then
edit.update_font_settings(node.editor, scale(20))
end
node.editor.left = math.floor(vx(node.x)) + Line_number_width*App.width(node.editor.em)
node.editor.right = math.ceil(vx(node.x+node.w))
end
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":588,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":588,"Ticks_font":589,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":587,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":588,"Ticks_font":587,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"B":830,"Menu_background_color":611,"vy":546,"Definitions":503,"Menu_command_color":613,"new_definition":848,"box_height":680,"draw_run_time_error":808,"draw_menu_bar":861,"on.mouse_release":836,"add_hotkey_to_menu":616,"on.save_settings":742,"survey_animation":863,"on.keychord_press":828,"animate_next":841,"num_lines_for_manifest_navigator":676,"Page":475,"reset_manifest_navigator":772,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"get_definition_from_app":784,"Zoomed_out":869,"manifest_navigator_up":628,"surface_bounds":814,"on.draw":797,"Num_animation_frames":840,"Spawn_point":822,"update_editor_box":711,"on_text":539,"Save_viewport":865,"on.mouse_press":722,"Definition_background_color":849,"Animating":842,"schema1_of_y":667,"vx":545,"scale":712,"definition_background_color":859,"y_of_schema1":364,"on.key_release":720,"copy_viewport":866,"Viewport":604,"mouse_cursor":558,"Mouse_cursor":559,"zoom_out":870,"delete_definition":673,"initialize_editor":678,"set_mouse_cursor":562,"from_viewport":823,"draw_ticks":862,"draw_cursor":639,"sy":469,"move_candidate_to_front_of_manifest":632,"font":353,"keychord_press_on_manifest_navigator":765,"manifest_navigator_down":635,"text_input_on_manifest_navigator":634,"manifest_index":637,"order_of_magnitude":573,"fw_parent":869,"on.code_change":820,"fw_app":"driver","add_thick_line":400,"manifest_navigator_candidates":638,"copy_shape":396,"approximate":579,"add_def_to_menu":640,"draw_manifest_navigator":677,"Test_definition_background_color":858,"snapshot_canvas":867,"manifest_coord":636,"Menu_highlight_color":614,"approximate_up":658,"wait_for_response":781,"Menu_border_color":612,"on.code_submit":787,"Cursor_node":172,"Ticks_font":669,"Manifest_navigator":495,"on":1,"on.initialize":807,"load_definition":854,"sx":544,"initialize_manifest_navigator":773,"on_handle":547,"on.update":835,"interpolate_viewport":843,"tick_spec":660,"line_height":365,"get_multiple_definitions_from_app":783,"on.text_input":855,"animate_next_frame":825,"compute_layout":385,"Manifest":769,"Surface":422,"A":831,"load_manifest":694,"on.load_settings":782,"get_manifest":768}
on.save_settings = function()
if Settings == nil then
Settings = {} -- just for initial schema migration
end
for key,node in pairs(Definitions) do
if type(key) == 'number' then
-- can't save the array side for now because of a limitation in the
Definitions[key] = nil
else
node.data = nil -- don't save uncommitted data for now
node.editor = nil -- TODO: check for hierarchy
end
end
Settings[App_name] = {
viewport=Viewport,
definitions=Definitions,
}
return Settings
end
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":586,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":586,"Ticks_font":587,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":585,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":586,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"Manifest":769,"Viewport":604,"approximate":579,"snapshot_canvas":913,"get_manifest":768,"copy_viewport":866,"on.save_settings":742,"sy":469,"approximate_up":658,"Definitions":503,"update_editor_box":711,"new_definition":848,"on.code_submit":787,"table_and_array_both_empty":689,"zoom_in":895,"Page":475,"schema1_of_y":667,"initialize_manifest_navigator":773,"y_of_schema1":364,"get_multiple_definitions_from_app":783,"wait_for_response":781,"Menu_background_color":611,"Menu_border_color":612,"on.text_input":855,"box_height":680,"fw_parent":918,"compute_layout":385,"fw_app":"driver","on.code_change":820,"on_text":539,"survey_animation":906,"animate_next":914,"scale":712,"sx":544,"vx":545,"load_from_iterator":670,"from_viewport":823,"get_definition_from_app":784,"Surface":422,"on_handle":547,"Ticks_font":669,"draw_menu_bar":861,"manifest_navigator_up":628,"copy_shape":396,"manifest_navigator_down":635,"surface_bounds":814,"Save_viewport":865,"delete_definition":673,"font":353,"move_candidate_to_front_of_manifest":632,"draw_cursor":639,"keychord_press_on_manifest_navigator":765,"on.update":900,"text_input_on_manifest_navigator":634,"Spawn_point":822,"zoom_out":908,"manifest_coord":636,"on.mouse_release":836,"manifest_index":637,"animate_next_frame":915,"manifest_navigator_candidates":638,"initialize_editor":678,"interpolate_viewport":843,"add_def_to_menu":640,"on.load_settings":782,"A":831,"maybe_update_key_in_definitions":529,"order_of_magnitude":573,"on.initialize":807,"on":1,"add_thick_line":400,"load_manifest":694,"on.key_release":720,"on.keychord_press":919,"Menu_highlight_color":614,"Num_animation_frames":840,"draw_run_time_error":808,"reset_manifest_navigator":772,"on.mouse_press":916,"num_lines_for_manifest_navigator":676,"draw_manifest_navigator":677,"mouse_cursor":558,"add_hotkey_to_menu":616,"Mouse_cursor":559,"tick_spec":660,"Definition_background_color":849,"Manifest_navigator":495,"set_mouse_cursor":562,"vy":546,"draw_ticks":862,"Test_definition_background_color":858,"Cursor_node":172,"definition_background_color":859,"Animating":842,"Menu_command_color":613,"Zoomed_out":869,"line_height":365,"B":830,"on.draw":917,"load_definition":854}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":584,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":585,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":583,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":584,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
on.text_input = function(t)
print('text input', t)
if Manifest_navigator.show then
text_input_on_manifest_navigator(t)
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.text_input(Cursor_node.editor, t)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
Cursor_node.bg = definition_background_color(definition_name)
B(--[[preserve screen_top of cursor node]] true)
end
end
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":582,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":582,"approximate_up":583,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
maybe_update_key_in_definitions = function(old_definition_name, definition_name, Cursor_node)
print(old_definition_name, definition_name)
if old_definition_name ~= definition_name then
if old_definition_name == nil or Definitions[old_definition_name] ~= Cursor_node then
local pos = array.find(Definitions, Cursor_node)
print('found at index', pos)
assert(pos)
table.remove(Definitions, pos)
elseif Definitions[old_definition_name] == Cursor_node then
print('found at key', old_definition_name)
Definitions[old_definition] = nil
end
if definition_name and Definitions[definition_name] == nil then
print('moving to key', definition_name)
Definitions[definition_name] = Cursor_node
elseif Definitions[definition_name] then
-- temporary collision; try again later
-- deleting and reinserting is inefficient, but hopefully rare
print('moving to index', #Definitions)
table.insert(Definitions, definition_name)
end
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
end
end
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":581,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":582,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":580,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":581,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":579,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":580,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"undo_zoom_out":921,"approximate":579,"initialize_manifest_navigator":773,"update_editor_box":711,"get_multiple_definitions_from_app":783,"draw_load_time_error":929,"approximate_up":658,"draw_test_failure_indicator":935,"wait_for_response":781,"schema1_of_y":667,"Ticks_font":669,"Manifest_navigator":495,"y_of_schema1":364,"on.save_settings":742,"on.load_settings":938,"Manifest":769,"survey_animation":906,"load_manifest":694,"animate_next":914,"get_manifest":768,"on.code_submit":927,"animate_next_frame":915,"Definitions":503,"scale":712,"new_definition":848,"get_default_map":937,"delete_definition":673,"Menu_command_color":613,"Definition_background_color":849,"Test_definition_background_color":858,"add_thick_line":400,"definition_background_color":859,"copy_shape":396,"Num_animation_frames":840,"draw_run_time_error":808,"Surface":422,"on.code_change":924,"interpolate_viewport":843,"Menu_background_color":611,"Spawn_point":822,"Menu_border_color":612,"from_viewport":823,"Viewport":604,"snapshot_canvas":913,"Menu_highlight_color":614,"Save_viewport":865,"draw_menu_bar":861,"copy_viewport":866,"add_hotkey_to_menu":616,"fw_app":"driver","zoom_out":908,"draw_manifest_navigator":677,"on.mouse_release":836,"num_lines_for_manifest_navigator":676,"on.update":900,"table_and_array_both_empty":689,"on.keychord_press":919,"on_handle":547,"on.text_input":855,"draw_cursor":639,"Page":475,"on.initialize":807,"on_text":539,"A":831,"on.mouse_press":916,"fw_parent":937,"manifest_navigator_up":628,"B":830,"manifest_navigator_down":635,"sx":544,"vy":546,"vx":545,"zoom_in":920,"move_candidate_to_front_of_manifest":632,"Cursor_node":172,"keychord_press_on_manifest_navigator":765,"surface_bounds":814,"on.key_release":720,"sy":469,"get_definition_from_app":784,"manifest_coord":636,"load_from_iterator":670,"manifest_index":637,"maybe_update_key_in_definitions":529,"manifest_navigator_candidates":638,"reset_manifest_navigator":772,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"compute_layout":385,"Failing_test_definition_background_color":925,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"Animating":842,"draw_ticks":862,"on.draw":932,"font":353,"Zoomed_out":869,"line_height":365,"on":1,"add_def_to_menu":640,"load_definition":854,"initialize_editor":678,"order_of_magnitude":573,"tick_spec":660}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":578,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":576,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":579,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
on.keychord_press = function(chord, key)
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if Viewport.zoom > 0.1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":577,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":576,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":578,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":576,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":576,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":577,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"get_default_map":937,"get_multiple_definitions_from_app":783,"wait_for_response":781,"draw_ticks":997,"schema1_of_y":667,"add_thick_line":400,"compute_layout":385,"on.draw":986,"iscale":953,"sy":954,"sx":955,"vy":956,"on.load_settings":940,"survey_animation":1012,"table_and_array_both_empty":689,"test_approximate_up":983,"approximate_up":985,"fw_parent":1011,"on":1,"fw_app":"driver","Ticks_font":669,"Cursor_node":172,"reset_manifest_navigator":772,"add_def_to_menu":640,"on.keychord_press":919,"Definition_background_color":849,"load_manifest":694,"maybe_update_key_in_definitions":529,"surface_bounds":814,"Mouse_cursor":559,"animate_next_frame":915,"Viewport":604,"add_hotkey_to_menu":616,"set_mouse_cursor":562,"Page":475,"line_height":365,"Manifest_navigator":495,"Spawn_point":822,"scale":712,"from_viewport":823,"Menu_background_color":611,"interpolate_viewport":843,"Menu_command_color":613,"order_of_magnitude":573,"get_manifest":768,"on_handle":547,"Menu_border_color":612,"on.mouse_release":836,"approximate":579,"B":830,"on_text":539,"Menu_highlight_color":614,"new_definition":848,"draw_menu_bar":861,"on.text_input":855,"box_height":680,"on.code_change":924,"on.mouse_press":916,"Definitions":503,"draw_manifest_navigator":677,"Num_animation_frames":840,"num_lines_for_manifest_navigator":676,"Animating":842,"vx":545,"font":353,"A":831,"on.save_settings":742,"load_from_iterator":670,"load_definition":854,"get_definition_from_app":784,"mouse_cursor":558,"draw_run_time_error":808,"on.initialize":948,"Surface":422,"manifest_navigator_up":628,"Test_definition_background_color":858,"manifest_navigator_down":635,"definition_background_color":859,"initialize_editor":678,"delete_definition":673,"on.update":945,"move_candidate_to_front_of_manifest":632,"update_editor_box":711,"keychord_press_on_manifest_navigator":765,"draw_cursor":639,"text_input_on_manifest_navigator":634,"copy_shape":396,"animate_next":914,"manifest_coord":636,"snapshot_canvas":913,"y_of_schema1":364,"Save_viewport":865,"manifest_navigator_candidates":638,"copy_viewport":866,"undo_zoom_out":921,"Failing_test_definition_background_color":925,"zoom_out":908,"manifest_index":637,"Zoomed_out":869,"on.code_submit":947,"draw_load_time_error":929,"tick_spec":998,"draw_test_failure_indicator":935,"on.key_release":720,"zoom_in":920,"Manifest":769,"initialize_manifest_navigator":773}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":575,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":576,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":575,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
end
node.editor.top = node.editor.top
print(node.y, Viewport.y, node.editor.top)
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":574,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":574,"on_text":539,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"approximate":575,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":573,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":574,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"on_text":539,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
on.draw = function()
if Animating then
local q = love.graphics.newQuad((Viewport.x-Global_viewport.x)*Viewport.zoom,(Viewport.y-Global_viewport.y)*Viewport.zoom, App.screen.width, App.screen.height, Global_viewport.w*Viewport.zoom, Global_viewport.h*Viewport.zoom)
App.color{r=1,g=1,b=1}
love.graphics.draw(Canvas, q, 0,0)
return
end
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
draw_load_time_error(obj)
end
end
end
draw_run_time_error()
draw_test_failure_indicator()
draw_ticks()
draw_menu_bar()
end
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":572,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":572,"order_of_magnitude":573,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"on_text":539,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":571,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":572,"order_of_magnitude":571,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"on_text":539,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
{"on.keychord_press":569,"on.text_input":521,"Manifest":494,"fw_parent":570,"schema1_of_y":467,"Surface":422,"sy":469,"on.mouse_press":556,"scale":7,"on.initialize":506,"y_of_schema1":364,"A":507,"sx":544,"font":353,"vx":545,"B":379,"load_manifest":496,"get_manifest":497,"box_height":345,"Definitions":503,"compute_layout":385,"Mouse_cursor":559,"on":1,"set_mouse_cursor":562,"Manifest_navigator":495,"draw_ticks":566,"order_of_magnitude":571,"on.draw":565,"add_thick_line":400,"on.mouse_release":554,"copy_shape":396,"maybe_update_key_in_definitions":529,"Viewport":567,"mouse_cursor":558,"on.key_release":552,"vy":546,"on_handle":547,"line_height":365,"Cursor_node":172,"on_text":539,"on.code_change":306,"update_editor_box":570,"Page":475,"initialize_editor":450,"on.update":561,"new_definition":504}
definition_file = function(name, manifest_version)
local client_app_save_dir = love.filesystem.getSaveDirectory():gsub(love.filesystem.getIdentity()..'$', App_name)
print(name, manifest_version[name])
local filename = live.versioned_filename(manifest_version[name], name)
return client_app_save_dir..'/'..filename
end
{"y_of_schema1":364,"set_mouse_cursor":562,"on.text_input":521,"draw_ticks":566,"font":353,"vy":546,"maybe_update_key_in_definitions":529,"on.keychord_press":569,"on":1,"sy":469,"Manifest_navigator":495,"line_height":365,"Cursor_node":172,"fw_parent":569,"add_thick_line":400,"copy_shape":396,"B":379,"compute_layout":385,"on.code_change":306,"Mouse_cursor":559,"A":507,"Definitions":503,"on.initialize":506,"Manifest":494,"sx":544,"Surface":422,"vx":545,"Page":475,"on.draw":565,"new_definition":504,"update_editor_box":570,"on.update":561,"Viewport":567,"load_manifest":496,"box_height":345,"get_manifest":497,"on_text":539,"on_handle":547,"on.key_release":552,"schema1_of_y":467,"on.mouse_press":556,"mouse_cursor":558,"on.mouse_release":554,"initialize_editor":450,"scale":7}
{"on.initialize":506,"Viewport":567,"A":507,"y_of_schema1":364,"maybe_update_key_in_definitions":529,"on":1,"sy":469,"Cursor_node":172,"box_height":345,"line_height":365,"Manifest":494,"on_handle":547,"Surface":422,"on.draw":565,"initialize_editor":450,"new_definition":504,"sx":544,"on.key_release":552,"vx":545,"font":353,"on_text":539,"scale":7,"on.mouse_press":556,"fw_parent":568,"on.mouse_release":554,"load_manifest":496,"copy_shape":396,"get_manifest":497,"on.keychord_press":569,"update_editor_box":479,"on.update":561,"on.code_change":306,"Page":475,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"compute_layout":385,"on.text_input":521,"B":379,"add_thick_line":400,"Manifest_navigator":495,"draw_ticks":566,"vy":546,"set_mouse_cursor":562,"schema1_of_y":467}
{"Manifest":494,"maybe_update_key_in_definitions":529,"on_handle":547,"scale":7,"on_text":539,"on.mouse_press":556,"box_height":345,"on.initialize":506,"compute_layout":385,"vx":545,"line_height":365,"on.code_change":306,"on":1,"on.key_release":552,"sy":469,"Surface":422,"A":507,"on.text_input":521,"B":379,"Manifest_navigator":495,"mouse_cursor":558,"Viewport":567,"copy_shape":396,"update_editor_box":479,"vy":546,"set_mouse_cursor":562,"add_thick_line":400,"draw_ticks":566,"Cursor_node":172,"on.draw":565,"load_manifest":496,"on.mouse_release":554,"get_manifest":497,"on.update":561,"Mouse_cursor":559,"on.keychord_press":568,"fw_parent":567,"Page":475,"Definitions":503,"new_definition":504,"y_of_schema1":364,"sx":544,"schema1_of_y":467,"font":353,"initialize_editor":450}
get_default_map = function()
-- Suggest a map for one's own code.
-- Mostly the driver manages its map of an app's code outside the app. However, an app can suggest a default map for people who haven't created one.
live.send_to_app('DEFAULT_MAP')
local response
repeat
love.timer.sleep(0.01)
response = live.receive_from_app()
until response
local result = {}
if #response == 0 then
return result
end
return json.decode(response)
end
{"draw_ticks":566,"on_text":539,"Viewport":567,"sx":544,"vx":545,"update_editor_box":479,"on.mouse_press":556,"font":353,"initialize_editor":450,"fw_parent":566,"Manifest":494,"schema1_of_y":467,"Page":475,"on.text_input":521,"mouse_cursor":558,"y_of_schema1":364,"Mouse_cursor":559,"set_mouse_cursor":562,"load_manifest":496,"get_manifest":497,"on.initialize":506,"on.mouse_release":554,"on.keychord_press":553,"on":1,"Surface":422,"Definitions":503,"sy":469,"new_definition":504,"scale":7,"box_height":345,"vy":546,"compute_layout":385,"A":507,"Manifest_navigator":495,"on.code_change":306,"on.draw":565,"on.key_release":552,"line_height":365,"add_thick_line":400,"Cursor_node":172,"copy_shape":396,"on_handle":547,"maybe_update_key_in_definitions":529,"B":379,"on.update":561}
{"draw_ticks":566,"on_text":539,"Viewport":505,"sx":544,"vx":545,"update_editor_box":479,"on.mouse_press":556,"font":353,"initialize_editor":450,"fw_parent":565,"Manifest":494,"schema1_of_y":467,"Page":475,"on.text_input":521,"mouse_cursor":558,"y_of_schema1":364,"Mouse_cursor":559,"set_mouse_cursor":562,"load_manifest":496,"get_manifest":497,"on.initialize":506,"on.mouse_release":554,"on.keychord_press":553,"on":1,"Surface":422,"Definitions":503,"sy":469,"new_definition":504,"scale":7,"box_height":345,"vy":546,"compute_layout":385,"A":507,"Manifest_navigator":495,"on.code_change":306,"on.draw":565,"on.key_release":552,"line_height":365,"add_thick_line":400,"Cursor_node":172,"copy_shape":396,"on_handle":547,"maybe_update_key_in_definitions":529,"B":379,"on.update":561}
on.keychord_press = function(chord, key)
print('a')
if Cursor_node then
print(Cursor_node.editor.line_cache[1])
end
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"draw_ticks":564,"on_text":539,"Viewport":505,"sx":544,"vx":545,"update_editor_box":479,"on.mouse_press":556,"font":353,"initialize_editor":450,"fw_parent":564,"Manifest":494,"schema1_of_y":467,"Page":475,"on.text_input":521,"mouse_cursor":558,"y_of_schema1":364,"Mouse_cursor":559,"set_mouse_cursor":562,"load_manifest":496,"get_manifest":497,"on.initialize":506,"on.mouse_release":554,"on.keychord_press":553,"on":1,"Surface":422,"Definitions":503,"sy":469,"new_definition":504,"scale":7,"box_height":345,"vy":546,"compute_layout":385,"A":507,"Manifest_navigator":495,"on.code_change":306,"on.draw":565,"on.key_release":552,"line_height":365,"add_thick_line":400,"Cursor_node":172,"copy_shape":396,"on_handle":547,"maybe_update_key_in_definitions":529,"B":379,"on.update":561}
{"draw_ticks":564,"on_text":539,"Viewport":505,"sx":544,"vx":545,"update_editor_box":479,"on.mouse_press":556,"font":353,"initialize_editor":450,"fw_parent":563,"Manifest":494,"schema1_of_y":467,"Page":475,"on.text_input":521,"mouse_cursor":558,"y_of_schema1":364,"Mouse_cursor":559,"set_mouse_cursor":562,"load_manifest":496,"get_manifest":497,"on.initialize":506,"on.mouse_release":554,"on.keychord_press":553,"on":1,"Surface":422,"Definitions":503,"sy":469,"new_definition":504,"scale":7,"box_height":345,"vy":546,"compute_layout":385,"A":507,"Manifest_navigator":495,"on.code_change":306,"on.draw":538,"on.key_release":552,"line_height":365,"add_thick_line":400,"Cursor_node":172,"copy_shape":396,"on_handle":547,"maybe_update_key_in_definitions":529,"B":379,"on.update":561}
on.load_settings = function(settings)
App_name = load_manifest()
print('app name', App_name, settings)
if settings == nil then return end
Settings = settings -- stash all settings into a global for on.save_settings
if settings[App_name] == nil then
return
end
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
local names = {}
for name, _ in pairs(Definitions) do
table.insert(names, name)
end
print(get_multiple_definitions_from_app)
for name, def_editor in pairs(Definitions) do
local def = get_definition_from_app(name)
if def == '' then
-- app doesn't know about this definition
-- just delete it from the driver for now
Definitions[name] = nil
else
def_editor.data = load_from_iterator(def:gmatch("[^\r\n]+"))
end
end
end
{"draw_ticks":563,"on_text":539,"Viewport":505,"sx":544,"vx":545,"update_editor_box":479,"on.mouse_press":556,"font":353,"initialize_editor":450,"fw_parent":562,"Manifest":494,"schema1_of_y":467,"Page":475,"on.text_input":521,"mouse_cursor":558,"y_of_schema1":364,"Mouse_cursor":559,"set_mouse_cursor":562,"load_manifest":496,"get_manifest":497,"on.initialize":506,"on.mouse_release":554,"on.keychord_press":553,"on":1,"Surface":422,"Definitions":503,"sy":469,"new_definition":504,"scale":7,"box_height":345,"vy":546,"compute_layout":385,"A":507,"Manifest_navigator":495,"on.code_change":306,"on.draw":538,"on.key_release":552,"line_height":365,"add_thick_line":400,"Cursor_node":172,"copy_shape":396,"on_handle":547,"maybe_update_key_in_definitions":529,"B":379,"on.update":561}
manifest_navigator_candidates = function()
if Manifest_navigator.filter == '' then
return Manifest
end
local result = {}
for _,def in ipairs(Manifest) do
if starts_with(def, Manifest_navigator.filter) then
table.insert(result, def)
end
end
return result
end
{"schema1_of_y":667,"draw_ticks":663,"Cursor_node":172,"y_of_schema1":364,"on.text_input":829,"order_of_magnitude":573,"load_definition":716,"approximate":579,"on.save_settings":742,"box_height":680,"on.load_settings":782,"approximate_up":658,"table_and_array_both_empty":689,"on.code_change":820,"scale":712,"Ticks_font":669,"initialize_manifest_navigator":773,"get_multiple_definitions_from_app":783,"add_thick_line":400,"copy_shape":396,"Manifest":769,"load_manifest":694,"initialize_editor":678,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"font":353,"draw_menu_bar":641,"animate_next":809,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"animate_next_frame":825,"A":713,"reset_manifest_navigator":772,"survey_animation":827,"B":379,"maybe_update_key_in_definitions":529,"get_definition_from_app":784,"add_def_to_menu":640,"surface_bounds":814,"on.keychord_press":828,"compute_layout":385,"manifest_navigator_up":628,"fw_app":"driver","manifest_navigator_down":635,"wait_for_response":781,"new_definition":821,"delete_definition":673,"Spawn_point":822,"move_candidate_to_front_of_manifest":632,"from_viewport":823,"keychord_press_on_manifest_navigator":765,"interpolate_viewport":824,"text_input_on_manifest_navigator":634,"on_handle":547,"get_manifest":768,"manifest_coord":636,"Viewport":604,"Surface":422,"draw_cursor":639,"manifest_navigator_candidates":638,"on.draw":797,"manifest_index":637,"vx":545,"on":1,"sx":544,"load_from_iterator":670,"set_mouse_cursor":562,"vy":546,"on.code_submit":787,"on.initialize":807,"draw_run_time_error":808,"on.key_release":720,"on.mouse_press":722,"Mouse_cursor":559,"on.mouse_release":721,"line_height":365,"on.update":802,"sy":469,"update_editor_box":711,"Animating":813,"mouse_cursor":558,"num_lines_for_manifest_navigator":676,"Page":475,"tick_spec":660,"fw_parent":828,"on_text":539,"Manifest_navigator":495}
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":991,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":990,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":992,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
{"on.initialize":506,"y_of_schema1":364,"B":379,"on.keychord_press":553,"on_handle":547,"Cursor_node":172,"on_text":539,"get_manifest":497,"on.mouse_press":556,"on.text_input":521,"sx":544,"Definitions":503,"vx":545,"new_definition":504,"fw_parent":561,"vy":546,"on.key_release":552,"Page":475,"on.draw":538,"add_thick_line":400,"copy_shape":396,"on.update":561,"maybe_update_key_in_definitions":529,"line_height":365,"on.code_change":306,"Mouse_cursor":559,"mouse_cursor":558,"font":353,"initialize_editor":450,"load_manifest":496,"update_editor_box":479,"on.mouse_release":554,"sy":469,"on":1,"A":507,"schema1_of_y":467,"Manifest":494,"Viewport":505,"set_mouse_cursor":562,"scale":7,"box_height":345,"compute_layout":385,"Manifest_navigator":495,"Surface":422}
{"on.initialize":506,"y_of_schema1":364,"B":379,"on.keychord_press":553,"on_handle":547,"Cursor_node":172,"on_text":539,"get_manifest":497,"on.mouse_press":556,"on.text_input":521,"sx":544,"Definitions":503,"vx":545,"new_definition":504,"fw_parent":560,"vy":546,"on.key_release":552,"Page":475,"on.draw":538,"add_thick_line":400,"copy_shape":396,"maybe_update_key_in_definitions":529,"line_height":365,"on.code_change":306,"Mouse_cursor":559,"mouse_cursor":558,"font":353,"initialize_editor":450,"load_manifest":496,"update_editor_box":479,"on.mouse_release":554,"sy":469,"on":1,"A":507,"schema1_of_y":467,"Manifest":494,"Viewport":505,"on.update":561,"scale":7,"box_height":345,"compute_layout":385,"Manifest_navigator":495,"Surface":422}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
-- print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
-- print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-100, vy+2)
end
love.graphics.setFont(old_font)
end
{"on.initialize":506,"y_of_schema1":364,"B":379,"on.keychord_press":553,"on_handle":547,"Cursor_node":172,"on_text":539,"get_manifest":497,"on.mouse_press":556,"on.text_input":521,"sx":544,"Definitions":503,"vx":545,"new_definition":504,"fw_parent":559,"vy":546,"on.key_release":552,"Page":475,"on.draw":538,"add_thick_line":400,"copy_shape":396,"maybe_update_key_in_definitions":529,"line_height":365,"on.code_change":306,"Mouse_cursor":559,"mouse_cursor":558,"font":353,"initialize_editor":450,"load_manifest":496,"update_editor_box":479,"on.mouse_release":554,"sy":469,"on":1,"A":507,"schema1_of_y":467,"Manifest":494,"Viewport":505,"on.update":560,"scale":7,"box_height":345,"compute_layout":385,"Manifest_navigator":495,"Surface":422}
animate_next_frame = function(state, dt)
if state.initial == nil then
state.initial = from_viewport(state)
-- once we've checked keys, pollute the keyspace
state.step = 0
state.frame_time = 0
return
end
state.frame_time = state.frame_time + dt
if state.frame_time > 0.01 then
state.frame_time = state.frame_time - 0.01
state.step = state.step+1
Viewport[state.viewport_key] = (state.initial * (10 - state.step) + state.final * state.step) / 10
B()
end
end
{"on.initialize":506,"y_of_schema1":364,"B":379,"on.keychord_press":553,"on_handle":547,"Cursor_node":172,"on_text":539,"get_manifest":497,"on.mouse_press":556,"on.text_input":521,"sx":544,"Definitions":503,"vx":545,"new_definition":504,"fw_parent":558,"vy":546,"on.key_release":552,"Page":475,"on.draw":538,"add_thick_line":400,"copy_shape":396,"maybe_update_key_in_definitions":529,"line_height":365,"on.code_change":306,"Mouse_cursor":559,"mouse_cursor":558,"font":353,"initialize_editor":450,"load_manifest":496,"update_editor_box":479,"on.mouse_release":554,"sy":469,"on":1,"A":507,"schema1_of_y":467,"Manifest":494,"Viewport":505,"on.update":557,"scale":7,"box_height":345,"compute_layout":385,"Manifest_navigator":495,"Surface":422}
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
end
end
end
draw_menu_bar()
end
{"vy":546,"mouse_cursor":558,"Mouse_cursor":559,"on.save_settings":742,"on.load_settings":782,"set_mouse_cursor":562,"draw_ticks":663,"animate_next":837,"table_and_array_both_empty":689,"animate_next_frame":825,"order_of_magnitude":573,"sy":469,"update_editor_box":711,"approximate":579,"surface_bounds":814,"schema1_of_y":667,"approximate_up":658,"Manifest_navigator":495,"Cursor_node":172,"Spawn_point":822,"Ticks_font":669,"from_viewport":823,"interpolate_viewport":839,"Animating":838,"font":353,"draw_menu_bar":641,"add_hotkey_to_menu":616,"Manifest":769,"draw_manifest_navigator":677,"load_manifest":694,"num_lines_for_manifest_navigator":676,"get_manifest":768,"reset_manifest_navigator":772,"on.text_input":834,"load_from_iterator":670,"get_definition_from_app":784,"Menu_background_color":611,"on.draw":797,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"new_definition":821,"Menu_highlight_color":614,"delete_definition":673,"copy_shape":396,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"on.mouse_release":836,"manifest_coord":636,"on.keychord_press":828,"maybe_update_key_in_definitions":529,"B":830,"Page":475,"add_def_to_menu":640,"y_of_schema1":364,"draw_cursor":639,"scale":712,"A":831,"manifest_navigator_up":628,"on.update":835,"tick_spec":660,"vx":545,"survey_animation":827,"Surface":422,"get_multiple_definitions_from_app":783,"on.code_submit":787,"manifest_navigator_candidates":638,"on_handle":547,"add_thick_line":400,"draw_run_time_error":808,"move_candidate_to_front_of_manifest":632,"line_height":365,"on_text":539,"initialize_manifest_navigator":773,"on.mouse_press":722,"box_height":680,"manifest_navigator_down":635,"initialize_editor":678,"fw_parent":838,"sx":544,"fw_app":"driver","compute_layout":385,"manifest_index":637,"wait_for_response":781,"on.code_change":820,"on.initialize":807,"on":1,"on.key_release":720,"Viewport":604,"load_definition":716}
{"on.initialize":506,"y_of_schema1":364,"B":379,"on.keychord_press":553,"on_handle":547,"Cursor_node":172,"on_text":539,"get_manifest":497,"on.mouse_press":556,"on.text_input":521,"sx":544,"Definitions":503,"vx":545,"new_definition":504,"fw_parent":557,"vy":546,"on.key_release":552,"Page":475,"on.draw":538,"add_thick_line":400,"copy_shape":396,"maybe_update_key_in_definitions":529,"line_height":365,"on.code_change":306,"mouse_cursor":558,"font":353,"initialize_editor":450,"load_manifest":496,"update_editor_box":479,"on.mouse_release":554,"sy":469,"on":1,"A":507,"schema1_of_y":467,"Manifest":494,"Viewport":505,"on.update":557,"scale":7,"box_height":345,"compute_layout":385,"Manifest_navigator":495,"Surface":422}
{"on.initialize":506,"y_of_schema1":364,"B":379,"on.keychord_press":553,"on_handle":547,"Cursor_node":172,"on_text":539,"get_manifest":497,"on.mouse_press":556,"on.text_input":521,"sx":544,"Definitions":503,"vx":545,"new_definition":504,"fw_parent":556,"vy":546,"on.key_release":552,"Page":475,"on.draw":538,"add_thick_line":400,"copy_shape":396,"maybe_update_key_in_definitions":529,"line_height":365,"on.code_change":306,"font":353,"initialize_editor":450,"load_manifest":496,"update_editor_box":479,"on.mouse_release":554,"sy":469,"on":1,"A":507,"schema1_of_y":467,"Manifest":494,"Viewport":505,"on.update":557,"scale":7,"box_height":345,"compute_layout":385,"Manifest_navigator":495,"Surface":422}
{"Mouse_cursor":559,"definition_background_color":859,"set_mouse_cursor":562,"tick_spec":660,"draw_ticks":862,"Surface":422,"on.draw":797,"snapshot_canvas":872,"order_of_magnitude":573,"Save_viewport":865,"A":831,"copy_viewport":866,"approximate":579,"B":830,"Zoomed_out":869,"on.mouse_release":836,"on":1,"approximate_up":658,"on.save_settings":742,"on.load_settings":782,"Page":475,"table_and_array_both_empty":689,"get_multiple_definitions_from_app":783,"vy":546,"fw_parent":875,"fw_app":"driver","zoom_in":876,"get_manifest":768,"load_manifest":694,"Manifest":769,"compute_layout":385,"Definitions":503,"Menu_background_color":611,"draw_run_time_error":808,"box_height":680,"Test_definition_background_color":858,"Menu_command_color":613,"sy":469,"survey_animation":863,"on.code_change":820,"animate_next":841,"line_height":365,"add_hotkey_to_menu":616,"interpolate_viewport":843,"on.update":835,"draw_cursor":639,"animate_next_frame":825,"num_lines_for_manifest_navigator":676,"initialize_manifest_navigator":773,"Manifest_navigator":495,"reset_manifest_navigator":772,"new_definition":848,"load_definition":854,"y_of_schema1":364,"on.initialize":807,"get_definition_from_app":784,"surface_bounds":814,"Ticks_font":669,"Cursor_node":172,"on.code_submit":787,"manifest_navigator_up":628,"font":353,"maybe_update_key_in_definitions":529,"Menu_border_color":612,"initialize_editor":678,"Spawn_point":822,"wait_for_response":781,"move_candidate_to_front_of_manifest":632,"Menu_highlight_color":614,"keychord_press_on_manifest_navigator":765,"add_def_to_menu":640,"text_input_on_manifest_navigator":634,"on.text_input":855,"draw_manifest_navigator":677,"manifest_coord":636,"Num_animation_frames":840,"manifest_index":637,"schema1_of_y":667,"manifest_navigator_candidates":638,"draw_menu_bar":861,"on_handle":547,"Animating":842,"load_from_iterator":670,"on.keychord_press":871,"delete_definition":673,"on_text":539,"add_thick_line":400,"on.mouse_press":875,"copy_shape":396,"scale":712,"on.key_release":720,"Viewport":604,"sx":544,"update_editor_box":711,"vx":545,"zoom_out":870,"Definition_background_color":849,"from_viewport":823,"manifest_navigator_down":635,"mouse_cursor":558}
{"Surface":422,"initialize_editor":450,"vx":545,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":547,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":555,"Definitions":503,"Manifest_navigator":495,"B":379,"on.key_release":552,"Page":475,"on":1,"sx":544,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":546,"on.keychord_press":553,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":555,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":554,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":556,"on.draw":538}
on.load_settings = function(settings)
local manifest_version
App_name, manifest_version = load_manifest()
print('app name', App_name, settings)
if settings == nil then return end
Settings = settings -- stash all settings into a global for on.save_settings
if settings[App_name] == nil then
return
end
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
for name, def in pairs(Definitions) do
print(name, definition_file(name, manifest_version))
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
{"Surface":422,"initialize_editor":450,"vx":545,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":547,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":555,"Definitions":503,"Manifest_navigator":495,"B":379,"on.key_release":552,"Page":475,"on":1,"sx":544,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":546,"on.keychord_press":553,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":554,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":554,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":551,"on.draw":538}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), vy(y)+2, 5)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-30, vy(y)+2)
end
love.graphics.setFont(old_font)
end
{"Surface":422,"initialize_editor":450,"vx":545,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":547,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":543,"Definitions":503,"Manifest_navigator":495,"B":379,"on.key_release":552,"Page":475,"on":1,"sx":544,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":546,"on.keychord_press":553,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":553,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":554,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":551,"on.draw":538}
{"Surface":422,"initialize_editor":450,"vx":545,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":547,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":543,"Definitions":503,"Manifest_navigator":495,"B":379,"on.key_release":552,"Page":475,"on":1,"sx":544,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":546,"on.keychord_press":553,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":552,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":548,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":551,"on.draw":538}
{"Surface":422,"initialize_editor":450,"vx":545,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":547,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":543,"Definitions":503,"Manifest_navigator":495,"B":379,"on.key_release":552,"Page":475,"on":1,"sx":544,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":546,"on.keychord_press":549,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":551,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":548,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":551,"on.draw":538}
{"Surface":422,"initialize_editor":450,"vx":545,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":547,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":543,"Definitions":503,"Manifest_navigator":495,"B":379,"on.key_release":550,"Page":475,"on":1,"sx":544,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":546,"on.keychord_press":549,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":550,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":548,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":551,"on.draw":538}
{"A":831,"move_candidate_to_front_of_manifest":632,"Spawn_point":822,"keychord_press_on_manifest_navigator":765,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"Mouse_cursor":559,"manifest_coord":636,"manifest_index":637,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":862,"add_def_to_menu":640,"line_height":365,"Definition_background_color":849,"box_height":680,"order_of_magnitude":573,"compute_layout":385,"definition_background_color":859,"on.code_change":924,"approximate":579,"load_manifest":694,"on":1,"get_manifest":768,"approximate_up":658,"snapshot_canvas":913,"Save_viewport":865,"draw_cursor":639,"Ticks_font":669,"zoom_out":908,"Zoomed_out":869,"update_editor_box":711,"initialize_editor":678,"zoom_in":920,"get_default_map":937,"on.mouse_press":916,"fw_app":"driver","on.save_settings":742,"num_lines_for_manifest_navigator":676,"Manifest_navigator":495,"on.code_submit":927,"initialize_manifest_navigator":773,"Menu_background_color":611,"animate_next_frame":915,"Menu_border_color":612,"y_of_schema1":364,"Menu_command_color":613,"Manifest":769,"Menu_highlight_color":614,"copy_viewport":866,"draw_menu_bar":861,"font":353,"add_hotkey_to_menu":616,"animate_next":914,"get_multiple_definitions_from_app":783,"Num_animation_frames":840,"survey_animation":906,"on.load_settings":940,"wait_for_response":781,"on.text_input":855,"fw_parent":941,"sx":544,"maybe_update_key_in_definitions":529,"vx":545,"sy":469,"load_definition":854,"scale":712,"Animating":842,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":660,"on.key_release":720,"on.draw":932,"Page":475,"draw_run_time_error":808,"new_definition":848,"undo_zoom_out":921,"add_thick_line":400,"B":830,"copy_shape":396,"on_handle":547,"Failing_test_definition_background_color":925,"vy":546,"draw_manifest_navigator":677,"draw_test_failure_indicator":935,"on_text":539,"draw_load_time_error":929,"table_and_array_both_empty":689,"reset_manifest_navigator":772,"Cursor_node":172,"on.mouse_release":836,"load_from_iterator":670,"on.update":942,"get_definition_from_app":784,"on.keychord_press":919,"Viewport":604,"Test_definition_background_color":858,"surface_bounds":814,"manifest_navigator_up":628,"Definitions":503,"manifest_navigator_down":635,"Surface":422,"on.initialize":807,"delete_definition":673}
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+2,maxy+1 -- maxy+19 works, +15 doesn't
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"Surface":422,"initialize_editor":450,"vx":545,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":547,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":543,"Definitions":503,"Manifest_navigator":495,"B":379,"on.key_release":550,"Page":475,"on":1,"sx":544,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":546,"on.keychord_press":549,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":549,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":548,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":542,"on.draw":538}
on.save_settings = function()
for key,node in pairs(Definitions) do
if type(key) == 'number' then
-- can't save the array side for now because of a limitation in the
Definitions[key] = nil
else
node.editor = nil -- TODO: check for hierarchy
end
end
return {
viewport=Viewport,
definitions=Definitions,
}
end
{"Surface":422,"initialize_editor":450,"vx":545,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":547,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":543,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"sx":544,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":546,"on.keychord_press":549,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":548,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":548,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":542,"on.draw":538}
{"Surface":422,"initialize_editor":450,"vx":545,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":547,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":543,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"sx":544,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":546,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":547,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":548,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":542,"on.draw":538}
{"Surface":422,"initialize_editor":450,"vx":545,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":547,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":543,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"sx":544,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":546,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":546,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":542,"on.draw":538}
survey_animation = function()
--[[
local minx, miny, maxx, maxy = surface_bounds(Definitions)
local zoom = math.min(App.screen.width/(maxx-minx), App.screen.height/(maxy-miny))
Animating = {
{x=minx, y=miny, w=maxx-minx, h=maxy-miny, zoom=zoom},
{x=Viewport.x, y=Viewport.y, w=Viewport.w, h=Viewport.h, zoom=Viewport.zoom},
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"Surface":422,"initialize_editor":450,"vx":545,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":535,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":543,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"sx":544,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":546,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":545,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":542,"on.draw":538}
{"Surface":422,"initialize_editor":450,"vx":545,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":535,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":543,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"sx":544,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":544,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":542,"on.draw":538}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y - Menu_bar_height)
end
node.editor.top = node.editor.top
print(node.y, Viewport.y, node.editor.top)
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
on.keychord_press = function(chord, key)
if Move_node then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":535,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":543,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"sx":544,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":543,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":542,"on.draw":538}
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":535,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":543,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":542,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":542,"on.draw":538}
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":535,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":368,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":541,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":542,"on.draw":538}
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":535,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":368,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"on_text":539,"line_height":365,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":540,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":540,"on.draw":538}
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":535,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":368,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"on_text":539,"line_height":365,"to_text":180,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":539,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":540,"on.draw":538}
maybe_update_key_in_definitions = function(old_definition_name, definition_name, Cursor_node)
print(old_definition_name, definition_name)
if old_definition_name ~= definition_name then
if old_definition_name == nil or Definitions[old_definition_name] ~= Cursor_node then
local pos = array.find(Definitions, Cursor_node)
print('found at index', pos)
assert(pos)
table.remove(Definitions, pos)
elseif Definitions[old_definition_name] == Cursor_node then
print('found at key', old_definition_name)
Definitions[old_definition] = nil
end
if definition_name and Definitions[definition_name] == nil then
print('moving to key', definition_name)
Definitions[definition_name] = Cursor_node
elseif Definitions[definition_name] the
-- temporary collision; try again later
-- deleting and reinserting is inefficient, but hopefully rare
print('moving to index', #Definitions)
table.insert(Definitions, definition_name)
end
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
end
end
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":535,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":368,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"on_text":539,"line_height":365,"to_text":180,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":538,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":179,"on.draw":538}
on.mouse_press = function(x,y, mouse_button)
if Animating then return end
if Zoomed_out then
zoom_in(x,y)
Zoomed_out = nil
Saved_viewport = nil
return
end
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
if mouse_press_consumed_by_any_button_handler(HUD, x,y, mouse_button) then
return
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
on.update = function(dt)
if Animating then
animate_next(dt)
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-sx(Move.xoff)
Move.node.y = sy(App.mouse_y())-sy(Move.yoff)
B()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":535,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":368,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"line_height":365,"to_text":180,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":537,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":179,"on.draw":538}
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":535,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":368,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"line_height":365,"to_text":180,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":536,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":179,"on.draw":537}
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":535,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":368,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"line_height":365,"to_text":180,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":535,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":179,"on.draw":536}
on.save_settings = function()
if Settings == nil then
Settings = {}
end
for key,node in pairs(Definitions) do
if type(key) == 'number' then
-- can't save the array side for now because of a limitation in the
Definitions[key] = nil
else
node.data = nil -- don't save uncommitted data for now
node.editor = nil -- TODO: check for hierarchy
end
end
Settings[App_name] = {
viewport=Viewport,
definitions=Definitions,
}
return Settings
end
{"B":830,"Menu_background_color":611,"vy":546,"Definitions":503,"Menu_command_color":613,"new_definition":848,"box_height":680,"draw_run_time_error":808,"draw_menu_bar":861,"on.mouse_release":836,"add_hotkey_to_menu":616,"on.save_settings":742,"survey_animation":863,"on.keychord_press":828,"animate_next":841,"num_lines_for_manifest_navigator":676,"Page":475,"reset_manifest_navigator":772,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"get_definition_from_app":784,"Zoomed_out":869,"manifest_navigator_up":628,"surface_bounds":814,"on.draw":797,"Num_animation_frames":840,"Spawn_point":822,"update_editor_box":711,"on_text":539,"Save_viewport":865,"on.mouse_press":722,"Definition_background_color":849,"Animating":842,"schema1_of_y":667,"vx":545,"scale":712,"definition_background_color":859,"y_of_schema1":364,"on.key_release":720,"copy_viewport":866,"Viewport":604,"mouse_cursor":558,"Mouse_cursor":559,"zoom_out":868,"delete_definition":673,"initialize_editor":678,"set_mouse_cursor":562,"from_viewport":823,"draw_ticks":862,"draw_cursor":639,"sy":469,"move_candidate_to_front_of_manifest":632,"font":353,"keychord_press_on_manifest_navigator":765,"manifest_navigator_down":635,"text_input_on_manifest_navigator":634,"manifest_index":637,"order_of_magnitude":573,"fw_parent":868,"on.code_change":820,"fw_app":"driver","add_thick_line":400,"manifest_navigator_candidates":638,"copy_shape":396,"approximate":579,"add_def_to_menu":640,"draw_manifest_navigator":677,"Test_definition_background_color":858,"snapshot_canvas":867,"manifest_coord":636,"Menu_highlight_color":614,"approximate_up":658,"wait_for_response":781,"Menu_border_color":612,"on.code_submit":787,"Cursor_node":172,"Ticks_font":669,"Manifest_navigator":495,"on":1,"on.initialize":807,"load_definition":854,"sx":544,"initialize_manifest_navigator":773,"on_handle":547,"on.update":835,"interpolate_viewport":843,"tick_spec":660,"line_height":365,"get_multiple_definitions_from_app":783,"on.text_input":855,"animate_next_frame":825,"compute_layout":385,"Manifest":769,"Surface":422,"A":831,"load_manifest":694,"on.load_settings":782,"get_manifest":768}
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"on_handle":535,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":368,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"line_height":365,"to_text":180,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":534,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":179,"on.draw":534}
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 4 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 8 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":368,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"line_height":365,"to_text":180,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":533,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":179,"on.draw":534}
{"on_handle":547,"definition_background_color":853,"draw_run_time_error":808,"survey_animation":847,"sx":544,"animate_next":841,"on.update":835,"load_definition":854,"on.keychord_press":828,"animate_next_frame":825,"box_height":680,"schema1_of_y":667,"on.save_settings":742,"surface_bounds":814,"Ticks_font":669,"y_of_schema1":364,"set_mouse_cursor":562,"font":353,"table_and_array_both_empty":689,"Spawn_point":822,"from_viewport":823,"load_manifest":694,"interpolate_viewport":843,"order_of_magnitude":573,"on.text_input":855,"Manifest":769,"B":830,"on.code_change":820,"get_manifest":768,"Cursor_node":172,"manifest_index":637,"approximate_up":658,"manifest_navigator_candidates":638,"Num_animation_frames":840,"new_definition":848,"add_thick_line":400,"update_editor_box":711,"copy_shape":396,"sy":469,"draw_manifest_navigator":677,"on.mouse_press":722,"Surface":422,"Test_definition_background_color":852,"draw_cursor":639,"Definition_background_color":849,"Viewport":604,"add_hotkey_to_menu":616,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"draw_ticks":844,"approximate":579,"tick_spec":660,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"vy":546,"Menu_command_color":613,"Mouse_cursor":559,"Menu_highlight_color":614,"mouse_cursor":558,"draw_menu_bar":641,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"Page":475,"on.code_submit":787,"Manifest_navigator":495,"fw_app":"driver","line_height":365,"on.initialize":807,"Definitions":503,"delete_definition":673,"keychord_press_on_manifest_navigator":765,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"get_multiple_definitions_from_app":783,"manifest_navigator_down":635,"on":1,"compute_layout":385,"on.key_release":720,"move_candidate_to_front_of_manifest":632,"Animating":842,"wait_for_response":781,"text_input_on_manifest_navigator":634,"fw_parent":854,"A":831,"manifest_coord":636,"scale":712,"on.mouse_release":836,"reset_manifest_navigator":772,"on.draw":797,"vx":545}
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":368,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"line_height":365,"to_text":180,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":532,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":179,"on.draw":533}
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":368,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"line_height":365,"to_text":180,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":531,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":179,"on.draw":532}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
if vy(node.y) > 0 then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, -vy(node.y))
end
if nonde.editor.font_height ~= scale(20) then
edit.update_font_settings(node.editor, scale(20))
end
node.editor.left = math.floor(vx(node.x)) + Line_number_width*App.width(node.editor.em)
node.editor.right = math.ceil(vx(node.x+node.w))
end
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
if obj.editor.load_time_error then
print('load time error found')
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, 0)
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(5*20*Viewport.zoom))
love.graphics.setColor(0,0,0)
love.graphics.print(obj.editor.load_time_error, vx(obj.x), error_y)
end
end
end
end
draw_ticks()
draw_menu_bar()
end
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":368,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"line_height":365,"to_text":180,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":530,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":179,"on.draw":531}
{"Surface":422,"initialize_editor":450,"vx":5,"Viewport":505,"schema1_of_y":467,"load_manifest":496,"get_manifest":497,"y_of_schema1":364,"Cursor_node":172,"scale":7,"on.update":368,"Definitions":503,"Manifest_navigator":495,"B":379,"Page":475,"on":1,"line_height":365,"to_text":180,"update_editor_box":479,"maybe_update_key_in_definitions":529,"new_definition":504,"vy":462,"on.keychord_press":522,"A":507,"box_height":345,"sy":469,"compute_layout":385,"fw_parent":529,"add_thick_line":400,"on.code_change":306,"on.initialize":506,"on.mouse_release":367,"Manifest":494,"font":353,"on.text_input":521,"copy_shape":396,"on.mouse_press":179,"on.draw":530}
{"on.code_change":306,"box_height":345,"font":353,"compute_layout":385,"Definitions":503,"fw_parent":528,"scale":7,"Surface":422,"A":507,"add_thick_line":400,"on.draw":452,"vx":5,"copy_shape":396,"vy":462,"update_editor_box":479,"sy":469,"on.initialize":506,"on.mouse_release":367,"initialize_editor":450,"on.update":368,"schema1_of_y":467,"on.keychord_press":522,"B":379,"Page":475,"Cursor_node":172,"Manifest":494,"Manifest_navigator":495,"on.mouse_press":179,"Viewport":505,"on":1,"load_manifest":496,"on.text_input":521,"maybe_update_key_in_definitions":529,"y_of_schema1":364,"new_definition":504,"to_text":180,"get_manifest":497,"line_height":365}
{"Viewport":505,"line_height":365,"vy":462,"on.initialize":506,"update_editor_box":479,"Manifest":494,"load_manifest":496,"on":1,"copy_shape":396,"A":507,"schema1_of_y":467,"Definitions":503,"B":379,"fw_parent":527,"on.code_change":306,"maybe_update_key_in_definitions":528,"Surface":422,"on.text_input":521,"Cursor_node":172,"vx":5,"sy":469,"y_of_schema1":364,"to_text":180,"new_definition":504,"compute_layout":385,"on.mouse_release":367,"initialize_editor":450,"get_manifest":497,"scale":7,"Page":475,"font":353,"add_thick_line":400,"on.keychord_press":522,"on.update":368,"on.mouse_press":179,"on.draw":452,"Manifest_navigator":495,"box_height":345}
{"on.update":368,"on.keychord_press":522,"load_manifest":496,"Page":475,"scale":7,"add_thick_line":400,"copy_shape":396,"to_text":180,"initialize_editor":450,"sy":469,"Manifest_navigator":495,"fw_parent":526,"font":353,"maybe_update_key_in_definitions":527,"box_height":345,"compute_layout":385,"on":1,"on.code_change":306,"vx":5,"Surface":422,"Definitions":503,"schema1_of_y":467,"on.draw":452,"line_height":365,"Manifest":494,"on.mouse_release":367,"Viewport":505,"B":379,"Cursor_node":172,"y_of_schema1":364,"A":507,"vy":462,"get_manifest":497,"new_definition":504,"on.mouse_press":179,"on.initialize":506,"on.text_input":521,"update_editor_box":479}
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"get_manifest":497,"on.keychord_press":522,"on.text_input":521,"update_editor_box":479,"line_height":365,"on.initialize":506,"Definitions":503,"to_text":180,"new_definition":504,"fw_parent":525,"on":1,"schema1_of_y":467,"on.draw":452,"scale":7,"box_height":345,"vx":5,"compute_layout":385,"Manifest":494,"y_of_schema1":364,"on.code_change":306,"initialize_editor":450,"maybe_update_key_in_definitions":526}
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"get_manifest":497,"on.keychord_press":522,"on.text_input":521,"update_editor_box":479,"line_height":365,"on.initialize":506,"Definitions":503,"to_text":180,"new_definition":504,"fw_parent":524,"on":1,"schema1_of_y":467,"on.draw":452,"scale":7,"box_height":345,"vx":5,"compute_layout":385,"Manifest":494,"y_of_schema1":364,"on.code_change":306,"initialize_editor":450,"maybe_update_key_in_definitions":525}
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"get_manifest":497,"on.keychord_press":522,"on.text_input":521,"update_editor_box":479,"line_height":365,"on.initialize":506,"Definitions":503,"to_text":180,"new_definition":504,"fw_parent":522,"on":1,"schema1_of_y":467,"on.draw":452,"scale":7,"box_height":345,"vx":5,"compute_layout":385,"Manifest":494,"y_of_schema1":364,"on.code_change":306,"initialize_editor":450,"maybe_update_key_in_definitions":524}
load_from_iterator = function(f)
local result = {}
local i,line,drawing = 0, ''
while true do
local line = f()
if line == nil then break end
table.insert(result, line)
end
if #result == 0 then
table.insert(result, '')
end
return result
end
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"initialize_editor":450,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"get_manifest":497,"on.keychord_press":522,"on.text_input":521,"fw_parent":522,"line_height":365,"on.initialize":506,"Definitions":503,"font":353,"new_definition":504,"update_editor_box":479,"on":1,"schema1_of_y":467,"Manifest":494,"scale":7,"box_height":345,"compute_layout":385,"y_of_schema1":364,"vx":5,"on.draw":452,"on.code_change":306,"to_text":180,"maybe_update_key_in_definitions":523}
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"initialize_editor":450,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"get_manifest":497,"on.keychord_press":522,"on.text_input":521,"fw_parent":521,"line_height":365,"on.initialize":506,"Definitions":503,"font":353,"new_definition":504,"update_editor_box":479,"on":1,"schema1_of_y":467,"Manifest":494,"scale":7,"box_height":345,"compute_layout":385,"y_of_schema1":364,"vx":5,"on.draw":452,"on.code_change":306,"to_text":180,"maybe_update_key_in_definitions":519}
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"initialize_editor":450,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"get_manifest":497,"on.keychord_press":513,"on.text_input":521,"fw_parent":519,"line_height":365,"on.initialize":506,"Definitions":503,"font":353,"new_definition":504,"update_editor_box":479,"on":1,"schema1_of_y":467,"Manifest":494,"scale":7,"box_height":345,"compute_layout":385,"y_of_schema1":364,"vx":5,"on.draw":452,"on.code_change":306,"to_text":180,"maybe_update_key_in_definitions":519}
on.mouse_release = function(x,y, mouse_button)
if Pan then
Pan = nil
elseif Move_node then
Move_node = nil
elseif Cursor_node then
Cursor_node.show_cursor = true
edit.mouse_release(Cursor_node.editor, x,y, mouse_button)
end
end
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"initialize_editor":450,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"on.draw":452,"Cursor_node":172,"load_manifest":496,"sy":469,"fw_parent":519,"on.keychord_press":513,"on.text_input":520,"y_of_schema1":364,"to_text":180,"on.initialize":506,"Definitions":503,"get_manifest":497,"new_definition":504,"update_editor_box":479,"on":1,"schema1_of_y":467,"Manifest_navigator":495,"scale":7,"box_height":345,"line_height":365,"compute_layout":385,"vx":5,"Manifest":494,"on.code_change":306,"font":353,"maybe_update_key_in_definitions":519}
on.keychord_press = function(chord, key)
print('key', chord)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-g' then
-- special Expose-like 'global zoom' mode
if Zoomed_out == nil then
zoom_out()
else
Animation = {
Save_viewport,
}
Save_viewport = nil
Zoomed_out = nil
end
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"initialize_editor":450,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"on.draw":452,"Cursor_node":172,"load_manifest":496,"sy":469,"fw_parent":517,"on.keychord_press":513,"on.text_input":517,"y_of_schema1":364,"to_text":180,"on.initialize":506,"Definitions":503,"get_manifest":497,"new_definition":504,"update_editor_box":479,"on":1,"schema1_of_y":467,"Manifest_navigator":495,"scale":7,"box_height":345,"line_height":365,"compute_layout":385,"vx":5,"Manifest":494,"on.code_change":306,"font":353,"maybe_update_key_in_definitions":519}
load_definition = function(name)
move_candidate_to_front_of_manifest(name)
if Cursor_node then
Cursor_node.show_cursor = false
end
-- just one copy per definition for now
if Definitions[name] == nil then
Definitions[name] = {
type='text',
data=load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+")),
x=0, y=0,
width=600,
bg=definition_background_color(name),
}
end
Viewport.x = Definitions[name].x-30
Viewport.y = Definitions[name].y-30
Cursor_node = Definitions[name]
Cursor_node.show_cursor = true
end
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"fw_parent":517,"on.keychord_press":513,"on.text_input":517,"get_manifest":497,"to_text":180,"on.initialize":506,"Definitions":503,"vx":5,"new_definition":504,"on.draw":452,"on":1,"schema1_of_y":467,"y_of_schema1":364,"scale":7,"box_height":345,"initialize_editor":450,"compute_layout":385,"Manifest":494,"line_height":365,"on.code_change":306,"update_editor_box":479,"maybe_update_key_in_definitions":518}
{"on.update":900,"Test_definition_background_color":858,"sx":544,"definition_background_color":859,"on.mouse_release":836,"add_thick_line":400,"on.key_release":720,"copy_shape":396,"manifest_navigator_up":628,"snapshot_canvas":913,"manifest_navigator_down":635,"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"move_candidate_to_front_of_manifest":632,"zoom_out":908,"keychord_press_on_manifest_navigator":765,"Zoomed_out":869,"set_mouse_cursor":562,"draw_load_time_error":929,"draw_ticks":862,"draw_test_failure_indicator":931,"manifest_index":637,"font":353,"manifest_navigator_candidates":638,"Surface":422,"add_def_to_menu":640,"order_of_magnitude":573,"on.draw":932,"vx":545,"approximate":579,"Viewport":604,"line_height":365,"Page":475,"approximate_up":658,"on":1,"Manifest_navigator":495,"on.keychord_press":919,"draw_run_time_error":808,"draw_cursor":639,"manifest_coord":636,"schema1_of_y":667,"survey_animation":906,"on.initialize":807,"animate_next":914,"A":831,"on.code_submit":927,"on.mouse_press":916,"Manifest":769,"load_definition":854,"animate_next_frame":915,"load_manifest":694,"update_editor_box":711,"get_manifest":768,"initialize_editor":678,"compute_layout":385,"box_height":680,"tick_spec":660,"Menu_background_color":611,"initialize_manifest_navigator":773,"Definitions":503,"on.save_settings":742,"new_definition":848,"on.load_settings":782,"Menu_highlight_color":614,"get_multiple_definitions_from_app":783,"draw_menu_bar":861,"text_input_on_manifest_navigator":634,"add_hotkey_to_menu":616,"Spawn_point":822,"Failing_test_definition_background_color":925,"from_viewport":823,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"vy":546,"wait_for_response":781,"reset_manifest_navigator":772,"maybe_update_key_in_definitions":529,"scale":712,"load_from_iterator":670,"B":830,"get_definition_from_app":784,"y_of_schema1":364,"Ticks_font":669,"sy":469,"surface_bounds":814,"Cursor_node":172,"zoom_in":920,"undo_zoom_out":921,"mouse_cursor":558,"fw_parent":931,"Num_animation_frames":840,"fw_app":"driver","table_and_array_both_empty":689,"Mouse_cursor":559,"on_handle":547,"Menu_command_color":613,"draw_manifest_navigator":677,"on.code_change":924,"Animating":842,"on_text":539,"Definition_background_color":849,"Menu_border_color":612,"delete_definition":673}
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"fw_parent":516,"on.keychord_press":513,"on.text_input":517,"to_text":180,"on.initialize":506,"Definitions":503,"vx":5,"new_definition":504,"on.draw":452,"on":1,"schema1_of_y":467,"y_of_schema1":364,"scale":7,"box_height":345,"initialize_editor":450,"compute_layout":385,"Manifest":494,"line_height":365,"on.code_change":306,"update_editor_box":479,"get_manifest":497}
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"fw_parent":515,"on.keychord_press":513,"on.text_input":516,"to_text":180,"on.initialize":506,"Definitions":503,"vx":5,"new_definition":504,"on.draw":452,"on":1,"schema1_of_y":467,"y_of_schema1":364,"scale":7,"box_height":345,"initialize_editor":450,"compute_layout":385,"Manifest":494,"line_height":365,"on.code_change":306,"update_editor_box":479,"get_manifest":497}
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"fw_parent":514,"on.keychord_press":513,"on.text_input":515,"to_text":180,"on.initialize":506,"Definitions":503,"vx":5,"new_definition":504,"on.draw":452,"on":1,"schema1_of_y":467,"y_of_schema1":364,"scale":7,"box_height":345,"initialize_editor":450,"compute_layout":385,"Manifest":494,"line_height":365,"on.code_change":306,"update_editor_box":479,"get_manifest":497}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y + Menu_bar_height)
end
node.editor.top = node.editor.top
print(node.y, Viewport.y, node.editor.top)
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"fw_parent":513,"on.keychord_press":513,"on.text_input":514,"to_text":180,"on.initialize":506,"Definitions":503,"vx":5,"new_definition":504,"on.draw":452,"on":1,"schema1_of_y":467,"y_of_schema1":364,"scale":7,"box_height":345,"initialize_editor":450,"compute_layout":385,"Manifest":494,"line_height":365,"on.code_change":306,"update_editor_box":479,"get_manifest":497}
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"fw_parent":512,"on.keychord_press":513,"on.text_input":511,"to_text":180,"on.initialize":506,"Definitions":503,"vx":5,"new_definition":504,"on.draw":452,"on":1,"schema1_of_y":467,"y_of_schema1":364,"scale":7,"box_height":345,"initialize_editor":450,"compute_layout":385,"Manifest":494,"line_height":365,"on.code_change":306,"update_editor_box":479,"get_manifest":497}
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"fw_parent":511,"on.keychord_press":512,"on.text_input":511,"to_text":180,"on.initialize":506,"Definitions":503,"vx":5,"new_definition":504,"on.draw":452,"on":1,"schema1_of_y":467,"y_of_schema1":364,"scale":7,"box_height":345,"initialize_editor":450,"compute_layout":385,"Manifest":494,"line_height":365,"on.code_change":306,"update_editor_box":479,"get_manifest":497}
{"vy":546,"mouse_cursor":558,"Mouse_cursor":559,"on.save_settings":742,"on.load_settings":782,"set_mouse_cursor":562,"draw_ticks":663,"animate_next":837,"table_and_array_both_empty":689,"animate_next_frame":825,"order_of_magnitude":573,"sy":469,"update_editor_box":711,"approximate":579,"surface_bounds":814,"schema1_of_y":667,"approximate_up":658,"Manifest_navigator":495,"Cursor_node":172,"Spawn_point":822,"Ticks_font":669,"from_viewport":823,"interpolate_viewport":824,"Animating":838,"font":353,"draw_menu_bar":641,"add_hotkey_to_menu":616,"Manifest":769,"draw_manifest_navigator":677,"load_manifest":694,"num_lines_for_manifest_navigator":676,"get_manifest":768,"reset_manifest_navigator":772,"on.text_input":834,"load_from_iterator":670,"get_definition_from_app":784,"Menu_background_color":611,"on.draw":797,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"new_definition":821,"Menu_highlight_color":614,"delete_definition":673,"copy_shape":396,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"on.mouse_release":836,"manifest_coord":636,"on.keychord_press":828,"maybe_update_key_in_definitions":529,"B":830,"Page":475,"add_def_to_menu":640,"y_of_schema1":364,"draw_cursor":639,"scale":712,"A":831,"manifest_navigator_up":628,"on.update":835,"tick_spec":660,"vx":545,"survey_animation":827,"Surface":422,"get_multiple_definitions_from_app":783,"on.code_submit":787,"manifest_navigator_candidates":638,"on_handle":547,"add_thick_line":400,"draw_run_time_error":808,"move_candidate_to_front_of_manifest":632,"line_height":365,"on_text":539,"initialize_manifest_navigator":773,"on.mouse_press":722,"box_height":680,"manifest_navigator_down":635,"initialize_editor":678,"fw_parent":837,"sx":544,"fw_app":"driver","compute_layout":385,"manifest_index":637,"wait_for_response":781,"on.code_change":820,"on.initialize":807,"on":1,"on.key_release":720,"Viewport":604,"load_definition":716}
{"undo_zoom_out":921,"approximate":579,"initialize_manifest_navigator":773,"update_editor_box":711,"get_multiple_definitions_from_app":783,"draw_load_time_error":929,"approximate_up":658,"draw_test_failure_indicator":935,"wait_for_response":781,"schema1_of_y":667,"Ticks_font":669,"Manifest_navigator":495,"y_of_schema1":364,"on.save_settings":742,"on.load_settings":782,"Manifest":769,"survey_animation":906,"load_manifest":694,"animate_next":914,"get_manifest":768,"on.code_submit":927,"animate_next_frame":915,"Definitions":503,"scale":712,"new_definition":848,"get_default_map":937,"delete_definition":673,"Menu_command_color":613,"Definition_background_color":849,"Test_definition_background_color":858,"add_thick_line":400,"definition_background_color":859,"copy_shape":396,"Num_animation_frames":840,"draw_run_time_error":808,"Surface":422,"on.code_change":924,"interpolate_viewport":843,"Menu_background_color":611,"Spawn_point":822,"Menu_border_color":612,"from_viewport":823,"Viewport":604,"snapshot_canvas":913,"Menu_highlight_color":614,"Save_viewport":865,"draw_menu_bar":861,"copy_viewport":866,"add_hotkey_to_menu":616,"fw_app":"driver","zoom_out":908,"draw_manifest_navigator":677,"on.mouse_release":836,"num_lines_for_manifest_navigator":676,"on.update":900,"table_and_array_both_empty":689,"on.keychord_press":919,"on_handle":547,"on.text_input":855,"draw_cursor":639,"Page":475,"on.initialize":807,"on_text":539,"A":831,"on.mouse_press":916,"fw_parent":936,"manifest_navigator_up":628,"B":830,"manifest_navigator_down":635,"sx":544,"vy":546,"vx":545,"zoom_in":920,"move_candidate_to_front_of_manifest":632,"Cursor_node":172,"keychord_press_on_manifest_navigator":765,"surface_bounds":814,"on.key_release":720,"sy":469,"get_definition_from_app":784,"manifest_coord":636,"load_from_iterator":670,"manifest_index":637,"maybe_update_key_in_definitions":529,"manifest_navigator_candidates":638,"reset_manifest_navigator":772,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"compute_layout":385,"Failing_test_definition_background_color":925,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"Animating":842,"draw_ticks":862,"on.draw":932,"font":353,"Zoomed_out":869,"line_height":365,"on":1,"add_def_to_menu":640,"load_definition":854,"initialize_editor":678,"order_of_magnitude":573,"tick_spec":660}
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"fw_parent":510,"on.keychord_press":510,"on.text_input":511,"to_text":180,"on.initialize":506,"Definitions":503,"vx":5,"new_definition":504,"on.draw":452,"on":1,"schema1_of_y":467,"y_of_schema1":364,"scale":7,"box_height":345,"initialize_editor":450,"compute_layout":385,"Manifest":494,"line_height":365,"on.code_change":306,"update_editor_box":479,"get_manifest":497}
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"fw_parent":509,"on.keychord_press":510,"on.text_input":487,"to_text":180,"on.initialize":506,"Definitions":503,"vx":5,"new_definition":504,"on.draw":452,"on":1,"schema1_of_y":467,"y_of_schema1":364,"scale":7,"box_height":345,"initialize_editor":450,"compute_layout":385,"Manifest":494,"line_height":365,"on.code_change":306,"update_editor_box":479,"get_manifest":497}
manifest_index = function(fy, fx, fwidth)
local y,x = Menu_bar_height, 5
local best_guess, best_guess_x, best_guess_width
for i,definition in ipairs(Manifest_navigator.candidates) do
if x + width > App.screen.width - 5 then
y = y + HUD_line_height
x = 5
end
if y == fy then
if best_guess == nil then
best_guess = i
best_guess_x = x
best_guess_width = width
elseif math.abs(fx + fwidth/2 - x - width/2) < math.abs(fx + fwidth/2 - best_guess_x - best_guess_width/2) then
best_guess = i
best_guess_x = x
best_guess_width = width
end
end
x = x + width + 30
end
return best_guess
end
local width = to_hud_text(definition):getWidth()
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"fw_parent":508,"on.keychord_press":509,"on.text_input":487,"to_text":180,"on.initialize":506,"Definitions":503,"vx":5,"new_definition":504,"on.draw":452,"on":1,"schema1_of_y":467,"y_of_schema1":364,"scale":7,"box_height":345,"initialize_editor":450,"compute_layout":385,"Manifest":494,"line_height":365,"on.code_change":306,"update_editor_box":479,"get_manifest":497}
{"A":507,"B":379,"Viewport":505,"vy":462,"on.mouse_press":179,"on.mouse_release":367,"font":353,"on.update":368,"add_thick_line":400,"Surface":422,"copy_shape":396,"Page":475,"Manifest_navigator":495,"Cursor_node":172,"load_manifest":496,"sy":469,"fw_parent":507,"on.keychord_press":508,"on.text_input":487,"to_text":180,"on.initialize":506,"Definitions":503,"vx":5,"new_definition":504,"on.draw":452,"on":1,"schema1_of_y":467,"y_of_schema1":364,"scale":7,"box_height":345,"initialize_editor":450,"compute_layout":385,"Manifest":494,"line_height":365,"on.code_change":306,"update_editor_box":479,"get_manifest":497}
{"Cursor_node":172,"line_height":365,"on":1,"sy":469,"initialize_editor":450,"fw_parent":506,"Surface":422,"compute_layout":385,"Page":475,"on.code_change":306,"scale":7,"Viewport":505,"vy":462,"Manifest":494,"on.mouse_press":179,"to_text":180,"on.keychord_press":502,"update_editor_box":479,"load_manifest":496,"get_manifest":497,"font":353,"box_height":345,"schema1_of_y":467,"on.initialize":506,"add_thick_line":400,"A":507,"copy_shape":396,"on.text_input":487,"on.mouse_release":367,"on.update":368,"Manifest_navigator":495,"new_definition":504,"Definitions":503,"B":379,"y_of_schema1":364,"on.draw":452,"vx":5}
{"Cursor_node":172,"line_height":365,"on":1,"sy":469,"initialize_editor":450,"fw_parent":505,"Surface":422,"compute_layout":385,"Page":475,"on.code_change":306,"scale":7,"Viewport":505,"vy":462,"Manifest":494,"on.mouse_press":179,"to_text":180,"on.keychord_press":502,"update_editor_box":479,"load_manifest":496,"get_manifest":497,"font":353,"box_height":345,"schema1_of_y":467,"on.initialize":506,"add_thick_line":400,"A":433,"copy_shape":396,"on.text_input":487,"on.mouse_release":367,"on.update":368,"Manifest_navigator":495,"new_definition":504,"Definitions":503,"B":379,"y_of_schema1":364,"on.draw":452,"vx":5}
{"Cursor_node":172,"line_height":365,"on":1,"sy":469,"initialize_editor":450,"fw_parent":504,"Surface":422,"compute_layout":385,"Page":475,"on.code_change":306,"scale":7,"Viewport":505,"vy":462,"Manifest":494,"on.mouse_press":179,"to_text":180,"on.keychord_press":502,"update_editor_box":479,"load_manifest":496,"get_manifest":497,"font":353,"box_height":345,"schema1_of_y":467,"on.initialize":500,"add_thick_line":400,"A":433,"copy_shape":396,"on.text_input":487,"on.mouse_release":367,"on.update":368,"Manifest_navigator":495,"new_definition":504,"Definitions":503,"B":379,"y_of_schema1":364,"on.draw":452,"vx":5}
{"Cursor_node":172,"line_height":365,"on":1,"sy":469,"initialize_editor":450,"fw_parent":503,"Surface":422,"compute_layout":385,"Page":475,"on.code_change":306,"scale":7,"Viewport":459,"vy":462,"Manifest":494,"on.mouse_press":179,"to_text":180,"on.keychord_press":502,"update_editor_box":479,"load_manifest":496,"get_manifest":497,"font":353,"box_height":345,"schema1_of_y":467,"on.initialize":500,"add_thick_line":400,"A":433,"copy_shape":396,"on.text_input":487,"on.mouse_release":367,"on.update":368,"Manifest_navigator":495,"new_definition":504,"Definitions":503,"B":379,"y_of_schema1":364,"on.draw":452,"vx":5}
{"Cursor_node":172,"line_height":365,"on":1,"sy":469,"initialize_editor":450,"fw_parent":502,"Surface":422,"compute_layout":385,"Page":475,"on.code_change":306,"scale":7,"Viewport":459,"vy":462,"Manifest":494,"on.mouse_press":179,"to_text":180,"on.keychord_press":502,"update_editor_box":479,"load_manifest":496,"get_manifest":497,"font":353,"box_height":345,"schema1_of_y":467,"on.initialize":500,"add_thick_line":400,"A":433,"copy_shape":396,"on.text_input":487,"on.mouse_release":367,"on.update":368,"Manifest_navigator":495,"Definitions":503,"B":379,"y_of_schema1":364,"on.draw":452,"vx":5}
Animating = nil -- set this to enable animation
-- When enabled, animation should consist of a series of viewport states that we animate into.
-- Each viewport state will be attained in 20 frames, each of 0.01 ms or 1 Love frame.
-- Each state will specify the final state of various viewport keys. Keys not mentioned will remain unchanged.
{"on.initialize":500,"vx":5,"scale":7,"on.mouse_press":179,"to_text":180,"Viewport":459,"get_manifest":497,"compute_layout":385,"A":433,"Cursor_node":172,"vy":462,"on.keychord_press":502,"line_height":365,"add_thick_line":400,"copy_shape":396,"y_of_schema1":364,"fw_parent":501,"Page":475,"box_height":345,"update_editor_box":479,"on.mouse_release":367,"initialize_editor":450,"sy":469,"font":353,"Manifest":494,"on.update":368,"on.text_input":487,"on.draw":452,"Manifest_navigator":495,"load_manifest":496,"on.code_change":306,"Surface":422,"schema1_of_y":467,"B":379,"on":1}
on.keychord_press = function(chord, key)
print('key', chord)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"on.code_change":306,"Manifest_navigator":495,"Viewport":459,"compute_layout":385,"line_height":365,"vy":462,"vx":5,"y_of_schema1":364,"Manifest":494,"copy_shape":396,"on.mouse_press":179,"on.text_input":487,"on.mouse_release":367,"on.update":368,"schema1_of_y":467,"sy":469,"on.draw":452,"Surface":422,"load_manifest":496,"A":433,"initialize_editor":450,"B":379,"on.initialize":500,"get_manifest":497,"add_thick_line":400,"on":1,"fw_parent":500,"update_editor_box":479,"on.keychord_press":501,"scale":7,"font":353,"to_text":180,"box_height":345,"Page":475,"Cursor_node":172}
{"Viewport":459,"scale":7,"schema1_of_y":467,"compute_layout":385,"on.mouse_press":179,"y_of_schema1":364,"font":353,"Manifest_navigator":495,"load_manifest":496,"get_manifest":497,"on.keychord_press":492,"line_height":365,"on.text_input":487,"vx":5,"to_text":180,"on.update":368,"fw_parent":499,"Page":475,"on.initialize":500,"box_height":345,"A":433,"copy_shape":396,"on":1,"B":379,"initialize_editor":450,"add_thick_line":400,"Manifest":494,"update_editor_box":479,"Cursor_node":172,"on.code_change":306,"sy":469,"on.draw":452,"Surface":422,"vy":462,"on.mouse_release":367}
get_default_map = function()
-- Suggest a map for one's own code.
-- Mostly the driver manages its map of an app's code outside the app. However, an app can suggest a default map for people who haven't created one.
live.send_to_app('DEFAULT_MAP')
local response
repeat
love.timer.sleep(0.01)
response = live.receive_from_app()
until response
local result = {}
if #response == 0 then
return result
end
return json.decode(response)
end
{"on.mouse_press":179,"on.mouse_release":367,"on.update":368,"to_text":180,"Manifest":494,"on":1,"schema1_of_y":467,"sy":469,"B":379,"on.draw":452,"Surface":422,"Cursor_node":172,"on.initialize":499,"box_height":345,"on.text_input":487,"update_editor_box":479,"on.code_change":306,"Page":475,"load_manifest":496,"get_manifest":497,"y_of_schema1":364,"scale":7,"Manifest_navigator":495,"vy":462,"on.keychord_press":492,"font":353,"Viewport":459,"vx":5,"A":433,"compute_layout":385,"fw_parent":498,"initialize_editor":450,"add_thick_line":400,"line_height":365,"copy_shape":396}
{"Surface":422,"on.initialize":498,"on.draw":452,"on":1,"Viewport":459,"y_of_schema1":364,"vx":5,"on.mouse_press":179,"add_thick_line":400,"B":379,"copy_shape":396,"on.mouse_release":367,"on.update":368,"on.keychord_press":492,"Page":475,"box_height":345,"compute_layout":385,"font":353,"update_editor_box":479,"on.code_change":306,"load_manifest":496,"scale":7,"schema1_of_y":467,"Manifest_navigator":495,"A":433,"on.text_input":487,"line_height":365,"vy":462,"Cursor_node":172,"to_text":180,"get_manifest":497,"Manifest":494,"fw_parent":497,"initialize_editor":450,"sy":469}
{"Surface":422,"on.initialize":493,"on.draw":452,"on":1,"Viewport":459,"y_of_schema1":364,"vx":5,"on.mouse_press":179,"add_thick_line":400,"B":379,"copy_shape":396,"on.mouse_release":367,"on.update":368,"on.keychord_press":492,"Page":475,"box_height":345,"compute_layout":385,"font":353,"update_editor_box":479,"on.code_change":306,"load_manifest":496,"scale":7,"schema1_of_y":467,"Manifest_navigator":495,"A":433,"on.text_input":487,"line_height":365,"vy":462,"Cursor_node":172,"to_text":180,"get_manifest":497,"Manifest":494,"fw_parent":496,"initialize_editor":450,"sy":469}
{"Surface":422,"on.initialize":493,"on.draw":452,"on":1,"Viewport":459,"y_of_schema1":364,"vx":5,"on.mouse_press":179,"add_thick_line":400,"B":379,"copy_shape":396,"on.mouse_release":367,"on.update":368,"on.keychord_press":492,"Page":475,"box_height":345,"compute_layout":385,"font":353,"update_editor_box":479,"on.code_change":306,"load_manifest":496,"scale":7,"schema1_of_y":467,"Manifest_navigator":495,"A":433,"on.text_input":487,"line_height":365,"vy":462,"Cursor_node":172,"to_text":180,"Manifest":494,"fw_parent":495,"initialize_editor":450,"sy":469}
{"Surface":422,"on.initialize":493,"on.draw":452,"on":1,"Viewport":459,"y_of_schema1":364,"vx":5,"on.mouse_press":179,"add_thick_line":400,"B":379,"copy_shape":396,"on.mouse_release":367,"on.update":368,"on.keychord_press":492,"Page":475,"box_height":345,"compute_layout":385,"font":353,"update_editor_box":479,"on.code_change":306,"scale":7,"schema1_of_y":467,"Manifest_navigator":495,"A":433,"on.text_input":487,"line_height":365,"vy":462,"Cursor_node":172,"to_text":180,"Manifest":494,"fw_parent":494,"initialize_editor":450,"sy":469}
{"Surface":422,"on.initialize":493,"on.draw":452,"on":1,"Viewport":459,"y_of_schema1":364,"vx":5,"on.mouse_press":179,"add_thick_line":400,"B":379,"copy_shape":396,"on.mouse_release":367,"on.update":368,"on.keychord_press":492,"Page":475,"box_height":345,"compute_layout":385,"font":353,"update_editor_box":479,"on.code_change":306,"scale":7,"schema1_of_y":467,"Manifest_navigator":480,"A":433,"on.text_input":487,"line_height":365,"vy":462,"Cursor_node":172,"to_text":180,"Manifest":494,"fw_parent":493,"initialize_editor":450,"sy":469}
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":492,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":493,"A":433,"on":1,"on.text_input":487,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":492,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
{"load_from_iterator":670,"Manifest":769,"draw_load_time_error":929,"draw_test_failure_indicator":935,"manifest_navigator_up":628,"on_handle":547,"surface_bounds":814,"compute_layout":385,"on_text":539,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"Spawn_point":822,"manifest_coord":636,"Viewport":604,"manifest_index":637,"interpolate_viewport":843,"manifest_navigator_candidates":638,"on.code_submit":947,"iscale":953,"on.text_input":855,"sy":954,"B":830,"sx":955,"mouse_cursor":558,"vy":956,"Mouse_cursor":559,"set_mouse_cursor":562,"get_multiple_definitions_from_app":783,"on.mouse_release":836,"Num_animation_frames":840,"approximate":579,"wait_for_response":781,"on.keychord_press":919,"tick_spec":998,"order_of_magnitude":573,"on.draw":986,"y_of_schema1":364,"fw_parent":1010,"Test_definition_background_color":858,"fw_app":"driver","definition_background_color":859,"move_candidate_to_front_of_manifest":632,"draw_run_time_error":808,"on.save_settings":742,"box_height":680,"on.load_settings":940,"delete_definition":673,"survey_animation":1011,"draw_ticks":997,"animate_next":914,"manifest_navigator_down":635,"table_and_array_both_empty":689,"snapshot_canvas":913,"on.mouse_press":916,"Save_viewport":865,"on.initialize":948,"copy_viewport":866,"approximate_up":985,"font":353,"zoom_out":908,"get_definition_from_app":784,"Zoomed_out":869,"Ticks_font":669,"on.code_change":924,"get_default_map":937,"undo_zoom_out":921,"add_thick_line":400,"zoom_in":920,"copy_shape":396,"draw_cursor":639,"update_editor_box":711,"schema1_of_y":667,"on.update":945,"initialize_editor":678,"Surface":422,"on.key_release":720,"load_definition":854,"A":831,"vx":545,"on":1,"Animating":842,"load_manifest":694,"animate_next_frame":915,"Definitions":503,"Failing_test_definition_background_color":925,"from_viewport":823,"line_height":365,"Menu_background_color":611,"scale":712,"Menu_border_color":612,"get_manifest":768,"Menu_command_color":613,"new_definition":848,"Menu_highlight_color":614,"Manifest_navigator":495,"draw_menu_bar":861,"Page":475,"add_hotkey_to_menu":616,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"draw_manifest_navigator":677,"test_approximate_up":983,"num_lines_for_manifest_navigator":676,"Definition_background_color":849,"add_def_to_menu":640,"reset_manifest_navigator":772,"Cursor_node":172}
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":491,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":482,"A":433,"on":1,"on.text_input":487,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":492,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":490,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":482,"A":433,"on":1,"on.text_input":487,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":491,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":489,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":482,"A":433,"on":1,"on.text_input":487,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":490,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":488,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":482,"A":433,"on":1,"on.text_input":487,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":489,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
survey_animation = function()
local minx, miny, maxx, maxy = surface_bounds(Definitions)
local zoom = math.min(App.screen.width/(maxx-minx), App.screen.height/(maxy-miny))
Animating = {
{x=minx, y=miny, w=maxx-minx, h=maxy-miny, zoom=zoom},
{x=Viewport.x, y=Viewport.y, w=Viewport.w, h=Viewport.h, zoom=Viewport.zoom},
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0
end
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":487,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":482,"A":433,"on":1,"on.text_input":487,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":488,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":486,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":482,"A":433,"on":1,"on.text_input":487,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":486,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":485,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":482,"A":433,"on":1,"on.text_input":388,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":486,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
{"Mouse_cursor":559,"definition_background_color":859,"set_mouse_cursor":562,"tick_spec":660,"draw_ticks":862,"Surface":422,"on.draw":797,"snapshot_canvas":872,"order_of_magnitude":573,"Save_viewport":865,"A":831,"copy_viewport":866,"approximate":579,"B":830,"Zoomed_out":869,"on.mouse_release":836,"on":1,"approximate_up":658,"on.save_settings":742,"on.load_settings":782,"Page":475,"table_and_array_both_empty":689,"get_multiple_definitions_from_app":783,"vy":546,"fw_parent":874,"fw_app":"driver","zoom_in":874,"get_manifest":768,"load_manifest":694,"Manifest":769,"compute_layout":385,"Definitions":503,"Menu_background_color":611,"draw_run_time_error":808,"box_height":680,"Test_definition_background_color":858,"Menu_command_color":613,"sy":469,"survey_animation":863,"on.code_change":820,"animate_next":841,"line_height":365,"add_hotkey_to_menu":616,"interpolate_viewport":843,"on.update":835,"draw_cursor":639,"animate_next_frame":825,"num_lines_for_manifest_navigator":676,"initialize_manifest_navigator":773,"Manifest_navigator":495,"reset_manifest_navigator":772,"new_definition":848,"load_definition":854,"y_of_schema1":364,"on.initialize":807,"get_definition_from_app":784,"surface_bounds":814,"Ticks_font":669,"Cursor_node":172,"on.code_submit":787,"manifest_navigator_up":628,"font":353,"maybe_update_key_in_definitions":529,"Menu_border_color":612,"initialize_editor":678,"Spawn_point":822,"wait_for_response":781,"move_candidate_to_front_of_manifest":632,"Menu_highlight_color":614,"keychord_press_on_manifest_navigator":765,"add_def_to_menu":640,"text_input_on_manifest_navigator":634,"on.text_input":855,"draw_manifest_navigator":677,"manifest_coord":636,"Num_animation_frames":840,"manifest_index":637,"schema1_of_y":667,"manifest_navigator_candidates":638,"draw_menu_bar":861,"on_handle":547,"Animating":842,"load_from_iterator":670,"on.keychord_press":871,"delete_definition":673,"on_text":539,"add_thick_line":400,"on.mouse_press":875,"copy_shape":396,"scale":712,"on.key_release":720,"Viewport":604,"sx":544,"update_editor_box":711,"vx":545,"zoom_out":870,"Definition_background_color":849,"from_viewport":823,"manifest_navigator_down":635,"mouse_cursor":558}
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":484,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":482,"A":433,"on":1,"on.text_input":388,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":485,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), vy(y)+2, 5)
love.graphics.line(vx(x), App.screen.width, vy(y), App.screen.width-5)
love.graphics.print(('%2.0f'):format(y), App.screen.width-30, vy(y)+2)
end
love.graphics.setFont(old_font)
end
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":483,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":482,"A":433,"on":1,"on.text_input":388,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":484,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
on.load_settings = function(settings)
App_name = load_manifest()
print('app name', App_name, settings)
if settings == nil then return end
Settings = settings -- stash all settings into a global for on.save_settings
if settings[App_name] == nil then
return
end
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
for name, def in pairs(Definitions) do
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":482,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":482,"A":433,"on":1,"on.text_input":388,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":483,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":481,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":482,"A":433,"on":1,"on.text_input":388,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":481,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
{"A":831,"move_candidate_to_front_of_manifest":632,"Spawn_point":822,"keychord_press_on_manifest_navigator":765,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"Mouse_cursor":559,"manifest_coord":636,"manifest_index":637,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":862,"add_def_to_menu":640,"line_height":365,"Definition_background_color":849,"box_height":680,"order_of_magnitude":573,"compute_layout":385,"definition_background_color":859,"on.code_change":924,"approximate":579,"load_manifest":694,"on":1,"get_manifest":768,"approximate_up":658,"snapshot_canvas":913,"Save_viewport":865,"draw_cursor":639,"Ticks_font":669,"zoom_out":908,"Zoomed_out":869,"update_editor_box":711,"initialize_editor":678,"zoom_in":920,"get_default_map":937,"on.mouse_press":916,"fw_app":"driver","on.save_settings":742,"num_lines_for_manifest_navigator":676,"Manifest_navigator":495,"on.code_submit":927,"initialize_manifest_navigator":773,"Menu_background_color":611,"animate_next_frame":915,"Menu_border_color":612,"y_of_schema1":364,"Menu_command_color":613,"Manifest":769,"Menu_highlight_color":614,"copy_viewport":866,"draw_menu_bar":861,"font":353,"add_hotkey_to_menu":616,"animate_next":914,"get_multiple_definitions_from_app":783,"Num_animation_frames":840,"survey_animation":906,"on.load_settings":940,"wait_for_response":781,"on.text_input":855,"fw_parent":940,"sx":544,"maybe_update_key_in_definitions":529,"vx":545,"sy":469,"load_definition":854,"scale":712,"Animating":842,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":660,"on.key_release":720,"on.draw":932,"Page":475,"draw_run_time_error":808,"new_definition":848,"undo_zoom_out":921,"add_thick_line":400,"B":830,"copy_shape":396,"on_handle":547,"Failing_test_definition_background_color":925,"vy":546,"draw_manifest_navigator":677,"draw_test_failure_indicator":935,"on_text":539,"draw_load_time_error":929,"table_and_array_both_empty":689,"reset_manifest_navigator":772,"Cursor_node":172,"on.mouse_release":836,"load_from_iterator":670,"on.update":941,"get_definition_from_app":784,"on.keychord_press":919,"Viewport":604,"Test_definition_background_color":858,"surface_bounds":814,"manifest_navigator_up":628,"Definitions":503,"manifest_navigator_down":635,"Surface":422,"on.initialize":807,"delete_definition":673}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, sx(App.screen.width))
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, sy(App.screen.height))
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":480,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":350,"A":433,"on":1,"on.text_input":388,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":481,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"fw_parent":479,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":350,"A":433,"on":1,"on.text_input":388,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":391,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
{"Page":475,"initialize_editor":450,"sy":469,"fw_parent":478,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":479,"y_of_schema1":364,"vy":462,"on.initialize":350,"A":433,"on":1,"on.text_input":388,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":391,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
{"Page":475,"initialize_editor":450,"sy":469,"fw_parent":477,"add_thick_line":400,"line_height":365,"Surface":422,"copy_shape":396,"schema1_of_y":467,"Cursor_node":172,"to_text":180,"vx":5,"on.draw":452,"Viewport":459,"update_editor_box":478,"y_of_schema1":364,"vy":462,"on.initialize":350,"A":433,"on":1,"on.text_input":388,"on.mouse_press":179,"on.mouse_release":367,"B":379,"on.keychord_press":391,"on.update":368,"box_height":345,"scale":7,"font":353,"on.code_change":306,"compute_layout":385}
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":990,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":990,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":991,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
{"vy":462,"on.initialize":350,"on.update":368,"fw_parent":476,"Cursor_node":172,"Page":475,"on.mouse_release":367,"scale":7,"update_editor_box":477,"box_height":345,"line_height":365,"compute_layout":385,"A":433,"to_text":180,"on.code_change":306,"font":353,"B":379,"schema1_of_y":467,"y_of_schema1":364,"on.mouse_press":179,"on.keychord_press":391,"on.text_input":388,"on":1,"add_thick_line":400,"on.draw":452,"copy_shape":396,"vx":5,"initialize_editor":450,"Viewport":459,"sy":469,"Surface":422}
{"B":830,"Menu_background_color":611,"vy":546,"Definitions":503,"Menu_command_color":613,"new_definition":848,"box_height":680,"draw_run_time_error":808,"draw_menu_bar":861,"on.mouse_release":836,"add_hotkey_to_menu":616,"on.save_settings":742,"survey_animation":863,"on.keychord_press":828,"animate_next":841,"num_lines_for_manifest_navigator":676,"Page":475,"reset_manifest_navigator":772,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"get_definition_from_app":784,"manifest_navigator_up":628,"surface_bounds":814,"on.draw":797,"Num_animation_frames":840,"Spawn_point":822,"update_editor_box":711,"on_text":539,"Save_viewport":865,"on.mouse_press":722,"Definition_background_color":849,"Animating":842,"schema1_of_y":667,"vx":545,"scale":712,"definition_background_color":859,"y_of_schema1":364,"on.key_release":720,"copy_viewport":866,"Viewport":604,"mouse_cursor":558,"Mouse_cursor":559,"zoom_out":868,"delete_definition":673,"initialize_editor":678,"set_mouse_cursor":562,"from_viewport":823,"draw_ticks":862,"draw_cursor":639,"sy":469,"move_candidate_to_front_of_manifest":632,"font":353,"keychord_press_on_manifest_navigator":765,"manifest_navigator_down":635,"text_input_on_manifest_navigator":634,"manifest_index":637,"order_of_magnitude":573,"fw_parent":867,"on.code_change":820,"fw_app":"driver","add_thick_line":400,"manifest_navigator_candidates":638,"copy_shape":396,"approximate":579,"add_def_to_menu":640,"draw_manifest_navigator":677,"Test_definition_background_color":858,"snapshot_canvas":867,"manifest_coord":636,"Menu_highlight_color":614,"approximate_up":658,"wait_for_response":781,"Menu_border_color":612,"on.code_submit":787,"Cursor_node":172,"Ticks_font":669,"Manifest_navigator":495,"on":1,"on.initialize":807,"load_definition":854,"sx":544,"initialize_manifest_navigator":773,"on_handle":547,"on.update":835,"interpolate_viewport":843,"tick_spec":660,"line_height":365,"get_multiple_definitions_from_app":783,"on.text_input":855,"animate_next_frame":825,"compute_layout":385,"Manifest":769,"Surface":422,"A":831,"load_manifest":694,"on.load_settings":782,"get_manifest":768}
{"vy":462,"on.initialize":350,"on.update":368,"fw_parent":475,"Cursor_node":172,"Page":475,"on.mouse_release":367,"scale":7,"update_editor_box":476,"box_height":345,"line_height":365,"compute_layout":385,"A":433,"to_text":180,"on.code_change":306,"font":353,"B":379,"schema1_of_y":467,"y_of_schema1":364,"on.mouse_press":179,"on.keychord_press":391,"on.text_input":388,"on":1,"add_thick_line":400,"on.draw":452,"copy_shape":396,"vx":5,"initialize_editor":450,"Viewport":459,"sy":469,"Surface":422}
{"B":379,"Viewport":459,"schema1_of_y":467,"A":433,"update_editor_box":473,"sy":469,"Cursor_node":172,"on.draw":452,"add_thick_line":400,"to_text":180,"line_height":365,"on.code_change":306,"Surface":422,"vy":462,"fw_parent":474,"on.text_input":388,"initialize_editor":450,"vx":5,"box_height":345,"on.update":368,"on":1,"scale":7,"on.keychord_press":391,"font":353,"on.mouse_press":179,"y_of_schema1":364,"on.initialize":350,"copy_shape":396,"Page":475,"on.mouse_release":367,"compute_layout":385}
{"B":379,"Viewport":459,"schema1_of_y":467,"A":433,"update_editor_box":473,"sy":469,"Cursor_node":172,"on.draw":452,"add_thick_line":400,"to_text":180,"line_height":365,"on.code_change":306,"Surface":422,"vy":462,"fw_parent":473,"on.text_input":388,"initialize_editor":450,"vx":5,"box_height":345,"on.update":368,"on":1,"scale":7,"on.keychord_press":391,"font":353,"on.mouse_press":179,"y_of_schema1":364,"on.initialize":350,"copy_shape":396,"Page":474,"on.mouse_release":367,"compute_layout":385}
zoom_in = function(x,y)
-- precondition: Zoomed_out
-- precondition: Viewport == Global_viewport
-- precondition: Saved_viewport exists
-- center Viewport on x,y at zoom level Saved_viewport.zoom
local sx, sy = sx(x), sy(y)
Viewport = {
x=sx(x)-App.screen.width/Saved_viewport.zoom/2,
y=sy(y)-App.screen.height/Saved_viewport.zoom/2,
w=App.screen.width/Saved_viewport.zoom,
h=App.screen.height/Saved_viewport.zoom,
zoom=Saved_viewport.zoom,
}
end
{"scale":7,"on.mouse_press":179,"on.mouse_release":367,"font":353,"initialize_editor":450,"copy_shape":396,"box_height":345,"on.keychord_press":391,"compute_layout":385,"on":1,"on.draw":452,"Page":444,"vx":5,"on.initialize":350,"Viewport":459,"update_editor_box":473,"vy":462,"on.update":368,"y_of_schema1":364,"on.text_input":388,"fw_parent":472,"Surface":422,"on.code_change":306,"sy":469,"B":379,"line_height":365,"to_text":180,"add_thick_line":400,"Cursor_node":172,"schema1_of_y":467,"A":433}
{"A":433,"on.draw":452,"B":379,"y_of_schema1":364,"font":353,"copy_shape":396,"Cursor_node":172,"scale":7,"add_thick_line":400,"fw_parent":471,"Viewport":459,"on":1,"on.update":368,"schema1_of_y":467,"on.mouse_press":179,"on.mouse_release":367,"initialize_editor":450,"Page":444,"box_height":345,"on.keychord_press":391,"compute_layout":385,"sy":469,"vx":5,"on.code_change":306,"update_editor_box":472,"on.text_input":388,"line_height":365,"to_text":180,"vy":462,"Surface":422,"on.initialize":350}
{"A":433,"on.draw":452,"B":379,"y_of_schema1":364,"font":353,"copy_shape":396,"Cursor_node":172,"scale":7,"add_thick_line":400,"fw_parent":470,"Viewport":459,"on":1,"on.update":368,"schema1_of_y":467,"on.mouse_press":179,"on.mouse_release":367,"initialize_editor":450,"Page":444,"box_height":345,"on.keychord_press":391,"compute_layout":385,"sy":469,"vx":5,"on.code_change":306,"update_editor_box":471,"on.text_input":388,"line_height":365,"to_text":180,"vy":462,"Surface":422,"on.initialize":350}
{"line_height":365,"on.text_input":388,"box_height":345,"compute_layout":385,"font":353,"on.code_change":306,"sy":469,"Surface":422,"Page":444,"fw_parent":469,"to_text":180,"update_editor_box":470,"on.initialize":350,"y_of_schema1":364,"initialize_editor":450,"on.draw":452,"copy_shape":396,"vx":5,"Viewport":459,"vy":462,"schema1_of_y":467,"on.mouse_press":179,"on.mouse_release":367,"on.update":368,"on":1,"on.keychord_press":391,"add_thick_line":400,"A":433,"scale":7,"Cursor_node":172,"B":379}
{"line_height":365,"on.text_input":388,"box_height":345,"compute_layout":385,"font":353,"on.code_change":306,"sy":469,"Surface":422,"Page":444,"fw_parent":468,"to_text":180,"update_editor_box":468,"on.initialize":350,"y_of_schema1":364,"initialize_editor":450,"on.draw":452,"copy_shape":396,"vx":5,"Viewport":459,"vy":462,"schema1_of_y":467,"on.mouse_press":179,"on.mouse_release":367,"on.update":368,"on":1,"on.keychord_press":391,"add_thick_line":400,"A":433,"scale":7,"Cursor_node":172,"B":379}
{"line_height":365,"on.text_input":388,"box_height":345,"compute_layout":385,"font":353,"on.code_change":306,"Surface":422,"Page":444,"fw_parent":467,"to_text":180,"update_editor_box":468,"on.initialize":350,"y_of_schema1":364,"initialize_editor":450,"on.draw":452,"copy_shape":396,"vx":5,"Viewport":459,"vy":462,"schema1_of_y":467,"on.mouse_press":179,"on.mouse_release":367,"on.update":368,"on":1,"on.keychord_press":391,"add_thick_line":400,"A":433,"scale":7,"Cursor_node":172,"B":379}
{"on_handle":547,"definition_background_color":853,"draw_run_time_error":808,"survey_animation":847,"sx":544,"animate_next":841,"on.update":835,"load_definition":854,"on.keychord_press":828,"animate_next_frame":825,"box_height":680,"schema1_of_y":667,"on.save_settings":742,"surface_bounds":814,"Ticks_font":669,"y_of_schema1":364,"set_mouse_cursor":562,"font":353,"table_and_array_both_empty":689,"Spawn_point":822,"from_viewport":823,"load_manifest":694,"interpolate_viewport":843,"order_of_magnitude":573,"on.text_input":834,"Manifest":769,"B":830,"on.code_change":820,"get_manifest":768,"Cursor_node":172,"manifest_index":637,"approximate_up":658,"manifest_navigator_candidates":638,"Num_animation_frames":840,"new_definition":848,"add_thick_line":400,"update_editor_box":711,"copy_shape":396,"sy":469,"draw_manifest_navigator":677,"on.mouse_press":722,"Surface":422,"Test_definition_background_color":852,"draw_cursor":639,"Definition_background_color":849,"Viewport":604,"add_hotkey_to_menu":616,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"draw_ticks":844,"approximate":579,"tick_spec":660,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"vy":546,"Menu_command_color":613,"Mouse_cursor":559,"Menu_highlight_color":614,"mouse_cursor":558,"draw_menu_bar":641,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"Page":475,"on.code_submit":787,"Manifest_navigator":495,"fw_app":"driver","line_height":365,"on.initialize":807,"Definitions":503,"delete_definition":673,"keychord_press_on_manifest_navigator":765,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"get_multiple_definitions_from_app":783,"manifest_navigator_down":635,"on":1,"compute_layout":385,"on.key_release":720,"move_candidate_to_front_of_manifest":632,"Animating":842,"wait_for_response":781,"text_input_on_manifest_navigator":634,"fw_parent":853,"A":831,"manifest_coord":636,"scale":712,"on.mouse_release":836,"reset_manifest_navigator":772,"on.draw":797,"vx":545}
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"line_height":365,"on.text_input":388,"box_height":345,"compute_layout":385,"font":353,"on.code_change":306,"Surface":422,"Page":444,"fw_parent":466,"to_text":180,"update_editor_box":466,"on.initialize":350,"y_of_schema1":364,"initialize_editor":450,"on.draw":452,"copy_shape":396,"vx":5,"Viewport":459,"vy":462,"schema1_of_y":467,"on.mouse_press":179,"on.mouse_release":367,"on.update":368,"on":1,"on.keychord_press":391,"add_thick_line":400,"A":433,"scale":7,"Cursor_node":172,"B":379}
{"Manifest":769,"Viewport":604,"approximate":579,"snapshot_canvas":913,"get_manifest":768,"copy_viewport":866,"on.save_settings":742,"sy":469,"approximate_up":658,"Definitions":503,"update_editor_box":711,"new_definition":848,"on.code_submit":787,"table_and_array_both_empty":689,"zoom_in":895,"Page":475,"schema1_of_y":667,"initialize_manifest_navigator":773,"y_of_schema1":364,"get_multiple_definitions_from_app":783,"wait_for_response":781,"Menu_background_color":611,"Menu_border_color":612,"on.text_input":855,"box_height":680,"fw_parent":917,"compute_layout":385,"fw_app":"driver","on.code_change":820,"on_text":539,"survey_animation":906,"animate_next":914,"scale":712,"sx":544,"vx":545,"load_from_iterator":670,"from_viewport":823,"get_definition_from_app":784,"Surface":422,"on_handle":547,"Ticks_font":669,"draw_menu_bar":861,"manifest_navigator_up":628,"copy_shape":396,"manifest_navigator_down":635,"surface_bounds":814,"Save_viewport":865,"delete_definition":673,"font":353,"move_candidate_to_front_of_manifest":632,"draw_cursor":639,"keychord_press_on_manifest_navigator":765,"on.update":900,"text_input_on_manifest_navigator":634,"Spawn_point":822,"zoom_out":908,"manifest_coord":636,"on.mouse_release":836,"manifest_index":637,"animate_next_frame":915,"manifest_navigator_candidates":638,"initialize_editor":678,"interpolate_viewport":843,"add_def_to_menu":640,"on.load_settings":782,"A":831,"maybe_update_key_in_definitions":529,"order_of_magnitude":573,"on.initialize":807,"on":1,"add_thick_line":400,"load_manifest":694,"on.key_release":720,"on.keychord_press":918,"Menu_highlight_color":614,"Num_animation_frames":840,"draw_run_time_error":808,"reset_manifest_navigator":772,"on.mouse_press":916,"num_lines_for_manifest_navigator":676,"draw_manifest_navigator":677,"mouse_cursor":558,"add_hotkey_to_menu":616,"Mouse_cursor":559,"tick_spec":660,"Definition_background_color":849,"Manifest_navigator":495,"set_mouse_cursor":562,"vy":546,"draw_ticks":862,"Test_definition_background_color":858,"Cursor_node":172,"definition_background_color":859,"Animating":842,"Menu_command_color":613,"Zoomed_out":869,"line_height":365,"B":830,"on.draw":917,"load_definition":854}
manifest_coord = function(index)
local y,x = Menu_bar_height, 5
for i,definition in ipairs(Manifest_navigator.candidates) do
if x + width > App.screen.width - 5 then
y = y + HUD_line_height
x = 5
end
if i == index then
return y, x, width
end
x = x + width + 30
end
end
local width = to_hud_text(definition):getWidth()
{"line_height":365,"on.text_input":388,"box_height":345,"compute_layout":385,"font":353,"on.code_change":306,"Surface":422,"Page":444,"fw_parent":465,"to_text":180,"update_editor_box":466,"on.initialize":350,"y_of_schema1":364,"initialize_editor":450,"on.draw":452,"copy_shape":396,"vx":5,"Viewport":459,"vy":462,"schema1_of_y":366,"on.mouse_press":179,"on.mouse_release":367,"on.update":368,"on":1,"on.keychord_press":391,"add_thick_line":400,"A":433,"scale":7,"Cursor_node":172,"B":379}
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+10,maxy+1 -- maxy+19 works, +15 doesn't
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
get_multiple_definitions_from_app = function(defs)
-- batch interface for speed
-- turn an array of string names into a table of string definitions corresponding to them
if #defs == 0 then return {} end
live.send_to_app('GET* '..table.concat(defs, ' '))
local response = wait_for_response()
local result = {}
for def in response:gmatch('(.-)\n==fw: definition boundary==\n') do
print("=== "..def)
local name = live.get_cmd_from_buffer(def)
result[name] = def
end
return result
end
{"line_height":365,"on.text_input":388,"box_height":345,"compute_layout":385,"font":353,"on.code_change":306,"Surface":422,"Page":444,"fw_parent":464,"to_text":180,"update_editor_box":465,"on.initialize":350,"y_of_schema1":364,"initialize_editor":450,"on.draw":452,"copy_shape":396,"vx":5,"Viewport":459,"vy":462,"schema1_of_y":366,"on.mouse_press":179,"on.mouse_release":367,"on.update":368,"on":1,"on.keychord_press":391,"add_thick_line":400,"A":433,"scale":7,"Cursor_node":172,"B":379}
on.keychord_press = function(chord, key)
if Cursor_node then
print('a', Cursor_node.editor.line_cache[1])
end
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"line_height":365,"on.text_input":388,"box_height":345,"compute_layout":385,"font":353,"on.code_change":306,"Surface":422,"Page":444,"fw_parent":463,"to_text":180,"update_editor_box":464,"on.initialize":350,"y_of_schema1":364,"initialize_editor":450,"on.draw":452,"copy_shape":396,"vx":5,"Viewport":459,"vy":462,"schema1_of_y":366,"on.mouse_press":179,"on.mouse_release":367,"on.update":368,"on":1,"on.keychord_press":391,"add_thick_line":400,"A":433,"scale":7,"Cursor_node":172,"B":379}
definition_file = function(name, manifest_version)
local client_app_save_dir = love.filesystem.getSaveDirectory():gsub(love.filesystem.getIdentity()..'$', App_name)
print(name, manifest_version[name])
-- local filename = live.versioned_filename(manifest_version[name], name)
-- return client_app_save_dir..'/'..filename
end
{"line_height":365,"on.text_input":388,"box_height":345,"compute_layout":385,"font":353,"on.code_change":306,"Surface":422,"Page":444,"fw_parent":462,"to_text":180,"update_editor_box":463,"on.initialize":350,"y_of_schema1":364,"initialize_editor":450,"on.draw":452,"copy_shape":396,"vx":5,"Viewport":459,"vy":462,"schema1_of_y":366,"on.mouse_press":179,"on.mouse_release":367,"on.update":368,"on":1,"on.keychord_press":391,"add_thick_line":400,"A":433,"scale":7,"Cursor_node":172,"B":379}
snapshot_canvas = function()
-- Render the canvas at pixel perfect resolution.
local winw,winh = App.screen.width, App.screen.height
App.screen.width,App.screen.height = Global_viewport.w, Global_viewport.h
Viewport = copy_viewport(Global_viewport)
Vieport.zoom = 1.0
A()
Canvas = love.graphics.newCanvas(cw,ch)
love.graphics.setCanvas(Canvas)
App.fake_key_press = true -- Hack; disable drawing the menu and ticks
on.draw()
App.fake_key_press = nil
love.graphics.setCanvas()
App.screen.width,App.screen.height = winw,winh
end
{"line_height":365,"on.text_input":388,"box_height":345,"compute_layout":385,"font":353,"on.code_change":306,"Surface":422,"Page":444,"fw_parent":461,"to_text":180,"update_editor_box":458,"on.initialize":350,"y_of_schema1":364,"initialize_editor":450,"on.draw":452,"copy_shape":396,"vx":5,"Viewport":459,"vy":462,"schema1_of_y":366,"on.mouse_press":179,"on.mouse_release":367,"on.update":368,"on":1,"on.keychord_press":391,"add_thick_line":400,"A":433,"scale":7,"Cursor_node":172,"B":379}
{"line_height":365,"on.key_release":720,"load_definition":854,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"add_thick_line":400,"Failing_test_definition_background_color":925,"survey_animation":906,"on.load_settings":782,"animate_next":914,"on":1,"num_lines_for_manifest_navigator":676,"table_and_array_both_empty":689,"animate_next_frame":915,"order_of_magnitude":573,"load_from_iterator":670,"get_definition_from_app":784,"approximate":579,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"font":353,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"Ticks_font":669,"Manifest_navigator":495,"interpolate_viewport":843,"manifest_coord":636,"manifest_index":637,"draw_test_failure_indicator":931,"draw_load_time_error":929,"Animating":842,"reset_manifest_navigator":772,"draw_run_time_error":808,"snapshot_canvas":913,"Menu_command_color":613,"draw_manifest_navigator":677,"Test_definition_background_color":858,"Surface":422,"Manifest":769,"Menu_background_color":611,"on.text_input":855,"on.code_change":924,"from_viewport":823,"get_manifest":768,"approximate_up":658,"initialize_editor":678,"on.draw":928,"draw_cursor":639,"Spawn_point":822,"Menu_border_color":612,"Definitions":503,"Definition_background_color":849,"new_definition":848,"Menu_highlight_color":614,"Save_viewport":865,"draw_menu_bar":861,"copy_viewport":866,"add_hotkey_to_menu":616,"definition_background_color":859,"zoom_out":908,"on.mouse_release":836,"Zoomed_out":869,"on.update":900,"undo_zoom_out":921,"on.keychord_press":919,"copy_shape":396,"compute_layout":385,"zoom_in":920,"Page":475,"maybe_update_key_in_definitions":529,"manifest_navigator_candidates":638,"Cursor_node":172,"surface_bounds":814,"add_def_to_menu":640,"sy":469,"Num_animation_frames":840,"fw_parent":930,"fw_app":"driver","draw_ticks":862,"load_manifest":694,"schema1_of_y":667,"update_editor_box":711,"on.code_submit":927,"wait_for_response":781,"vy":546,"on_handle":547,"y_of_schema1":364,"set_mouse_cursor":562,"text_input_on_manifest_navigator":634,"on.initialize":807,"initialize_manifest_navigator":773,"A":831,"on.mouse_press":916,"on_text":539,"tick_spec":660,"B":830,"get_multiple_definitions_from_app":783,"sx":544,"Viewport":604,"vx":545,"scale":712,"on.save_settings":742}
{"line_height":365,"on.text_input":388,"box_height":345,"compute_layout":385,"font":353,"on.code_change":306,"Surface":422,"Page":444,"fw_parent":460,"to_text":180,"update_editor_box":458,"on.initialize":350,"y_of_schema1":364,"initialize_editor":450,"on.draw":452,"copy_shape":396,"vx":5,"Viewport":459,"vy":461,"schema1_of_y":366,"on.mouse_press":179,"on.mouse_release":367,"on.update":368,"on":1,"on.keychord_press":391,"add_thick_line":400,"A":433,"scale":7,"Cursor_node":172,"B":379}
{"line_height":365,"on.mouse_press":179,"Viewport":459,"on.text_input":388,"on":1,"on.mouse_release":367,"box_height":345,"on.update":368,"scale":7,"Cursor_node":172,"on.code_change":306,"B":379,"update_editor_box":458,"vy":460,"A":433,"schema1_of_y":366,"on.keychord_press":391,"compute_layout":385,"on.draw":452,"add_thick_line":400,"Page":444,"copy_shape":396,"initialize_editor":450,"y_of_schema1":364,"Surface":422,"on.initialize":350,"to_text":180,"fw_parent":459,"font":353,"vx":5}
{"line_height":365,"on.mouse_press":179,"Viewport":459,"on.text_input":388,"on":1,"on.mouse_release":367,"box_height":345,"on.update":368,"scale":7,"Cursor_node":172,"on.code_change":306,"B":379,"update_editor_box":458,"vy":457,"A":433,"schema1_of_y":366,"on.keychord_press":391,"compute_layout":385,"on.draw":452,"add_thick_line":400,"Page":444,"copy_shape":396,"initialize_editor":450,"y_of_schema1":364,"Surface":422,"on.initialize":350,"to_text":180,"fw_parent":458,"font":353,"vx":5}
{"y_of_schema1":364,"A":433,"line_height":365,"scale":7,"B":379,"on.text_input":388,"on.mouse_release":367,"copy_shape":396,"to_text":180,"box_height":345,"fw_parent":457,"on":1,"on.keychord_press":391,"on.update":368,"Page":444,"on.code_change":306,"update_editor_box":458,"font":353,"on.mouse_press":179,"compute_layout":385,"vy":457,"Surface":422,"add_thick_line":400,"initialize_editor":450,"on.draw":452,"schema1_of_y":366,"vx":5,"Cursor_node":172,"Viewport":439,"on.initialize":350}
{"y_of_schema1":364,"A":433,"line_height":365,"scale":7,"B":379,"on.text_input":388,"on.mouse_release":367,"copy_shape":396,"to_text":180,"box_height":345,"fw_parent":456,"on":1,"on.keychord_press":391,"on.update":368,"Page":444,"on.code_change":306,"update_editor_box":456,"font":353,"on.mouse_press":179,"compute_layout":385,"vy":457,"Surface":422,"add_thick_line":400,"initialize_editor":450,"on.draw":452,"schema1_of_y":366,"vx":5,"Cursor_node":172,"Viewport":439,"on.initialize":350}
{"y_of_schema1":364,"A":433,"line_height":365,"scale":7,"B":379,"on.text_input":388,"on.mouse_release":367,"copy_shape":396,"to_text":180,"box_height":345,"fw_parent":455,"on":1,"on.keychord_press":391,"on.update":368,"Page":444,"on.code_change":306,"update_editor_box":456,"font":353,"on.mouse_press":179,"compute_layout":385,"vy":448,"Surface":422,"add_thick_line":400,"initialize_editor":450,"on.draw":452,"schema1_of_y":366,"vx":5,"Cursor_node":172,"Viewport":439,"on.initialize":350}
{"vy":546,"mouse_cursor":558,"Mouse_cursor":559,"on.save_settings":742,"on.load_settings":782,"set_mouse_cursor":562,"draw_ticks":663,"animate_next":837,"table_and_array_both_empty":689,"animate_next_frame":825,"order_of_magnitude":573,"sy":469,"update_editor_box":711,"approximate":579,"surface_bounds":814,"schema1_of_y":667,"approximate_up":658,"Manifest_navigator":495,"Cursor_node":172,"Spawn_point":822,"Ticks_font":669,"from_viewport":823,"interpolate_viewport":824,"Animating":813,"font":353,"draw_menu_bar":641,"add_hotkey_to_menu":616,"Manifest":769,"draw_manifest_navigator":677,"load_manifest":694,"num_lines_for_manifest_navigator":676,"get_manifest":768,"reset_manifest_navigator":772,"on.text_input":834,"load_from_iterator":670,"get_definition_from_app":784,"Menu_background_color":611,"on.draw":797,"Menu_border_color":612,"Definitions":503,"Menu_command_color":613,"new_definition":821,"Menu_highlight_color":614,"delete_definition":673,"copy_shape":396,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"on.mouse_release":836,"manifest_coord":636,"on.keychord_press":828,"maybe_update_key_in_definitions":529,"B":830,"Page":475,"add_def_to_menu":640,"y_of_schema1":364,"draw_cursor":639,"scale":712,"A":831,"manifest_navigator_up":628,"on.update":835,"tick_spec":660,"vx":545,"survey_animation":827,"Surface":422,"get_multiple_definitions_from_app":783,"on.code_submit":787,"manifest_navigator_candidates":638,"on_handle":547,"add_thick_line":400,"draw_run_time_error":808,"move_candidate_to_front_of_manifest":632,"line_height":365,"on_text":539,"initialize_manifest_navigator":773,"on.mouse_press":722,"box_height":680,"manifest_navigator_down":635,"initialize_editor":678,"fw_parent":836,"sx":544,"fw_app":"driver","compute_layout":385,"manifest_index":637,"wait_for_response":781,"on.code_change":820,"on.initialize":807,"on":1,"on.key_release":720,"Viewport":604,"load_definition":716}
{"y_of_schema1":364,"A":433,"line_height":365,"scale":7,"B":379,"on.text_input":388,"on.mouse_release":367,"copy_shape":396,"to_text":180,"box_height":345,"fw_parent":454,"on":1,"on.keychord_press":391,"on.update":368,"Page":444,"on.code_change":306,"update_editor_box":455,"font":353,"on.mouse_press":179,"compute_layout":385,"vy":448,"Surface":422,"add_thick_line":400,"initialize_editor":450,"on.draw":452,"schema1_of_y":366,"vx":5,"Cursor_node":172,"Viewport":439,"on.initialize":350}
{"schema1_of_y":667,"draw_ticks":663,"Cursor_node":172,"y_of_schema1":364,"on.text_input":521,"order_of_magnitude":573,"load_definition":716,"approximate":579,"on.save_settings":742,"box_height":680,"on.load_settings":782,"approximate_up":658,"table_and_array_both_empty":689,"on.code_change":820,"scale":712,"Ticks_font":669,"initialize_manifest_navigator":773,"get_multiple_definitions_from_app":783,"add_thick_line":400,"copy_shape":396,"Manifest":769,"load_manifest":694,"initialize_editor":678,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"font":353,"draw_menu_bar":641,"animate_next":809,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"animate_next_frame":825,"A":713,"reset_manifest_navigator":772,"survey_animation":827,"B":379,"maybe_update_key_in_definitions":529,"get_definition_from_app":784,"add_def_to_menu":640,"surface_bounds":814,"on.keychord_press":828,"compute_layout":385,"manifest_navigator_up":628,"fw_app":"driver","manifest_navigator_down":635,"wait_for_response":781,"new_definition":821,"delete_definition":673,"Spawn_point":822,"move_candidate_to_front_of_manifest":632,"from_viewport":823,"keychord_press_on_manifest_navigator":765,"interpolate_viewport":824,"text_input_on_manifest_navigator":634,"on_handle":547,"get_manifest":768,"manifest_coord":636,"Viewport":604,"Surface":422,"draw_cursor":639,"manifest_navigator_candidates":638,"on.draw":797,"manifest_index":637,"vx":545,"on":1,"sx":544,"load_from_iterator":670,"set_mouse_cursor":562,"vy":546,"on.code_submit":787,"on.initialize":807,"draw_run_time_error":808,"on.key_release":720,"on.mouse_press":722,"Mouse_cursor":559,"on.mouse_release":721,"line_height":365,"on.update":802,"sy":469,"update_editor_box":711,"Animating":813,"mouse_cursor":558,"num_lines_for_manifest_navigator":676,"Page":475,"tick_spec":660,"fw_parent":827,"on_text":539,"Manifest_navigator":495}
{"y_of_schema1":364,"A":433,"line_height":365,"scale":7,"B":379,"on.text_input":388,"on.mouse_release":367,"copy_shape":396,"to_text":180,"box_height":345,"fw_parent":453,"on":1,"on.keychord_press":391,"on.update":368,"Page":444,"on.code_change":306,"update_editor_box":454,"font":353,"on.mouse_press":179,"compute_layout":385,"vy":448,"Surface":422,"add_thick_line":400,"initialize_editor":450,"on.draw":452,"schema1_of_y":366,"vx":5,"Cursor_node":172,"Viewport":439,"on.initialize":350}
{"y_of_schema1":364,"A":433,"line_height":365,"scale":7,"B":379,"on.text_input":388,"on.mouse_release":367,"copy_shape":396,"to_text":180,"box_height":345,"fw_parent":452,"on":1,"on.keychord_press":391,"on.update":368,"Page":444,"on.code_change":306,"update_editor_box":453,"font":353,"on.mouse_press":179,"compute_layout":385,"vy":448,"Surface":422,"add_thick_line":400,"initialize_editor":450,"on.draw":452,"schema1_of_y":366,"vx":5,"Cursor_node":172,"Viewport":439,"on.initialize":350}
{"line_height":365,"y_of_schema1":364,"on":1,"Page":444,"Surface":422,"fw_parent":451,"add_thick_line":400,"A":433,"copy_shape":396,"font":353,"on.mouse_release":367,"on.text_input":388,"Cursor_node":172,"box_height":345,"on.initialize":350,"Viewport":439,"B":379,"initialize_editor":450,"to_text":180,"on.draw":452,"vx":5,"vy":448,"compute_layout":385,"update_editor_box":451,"on.mouse_press":179,"schema1_of_y":366,"on.code_change":306,"on.update":368,"scale":7,"on.keychord_press":391}
{"on.code_change":306,"Cursor_node":172,"Viewport":439,"add_thick_line":400,"copy_shape":396,"on.keychord_press":391,"update_editor_box":451,"Page":444,"on.text_input":388,"on":1,"vy":448,"on.mouse_release":367,"on.update":368,"fw_parent":450,"scale":7,"schema1_of_y":366,"Surface":422,"on.draw":443,"vx":5,"to_text":180,"on.initialize":350,"y_of_schema1":364,"B":379,"initialize_editor":450,"box_height":345,"compute_layout":385,"on.mouse_press":179,"font":353,"line_height":365,"A":433}
{"Surface":422,"vy":448,"Page":444,"Cursor_node":172,"to_text":180,"add_thick_line":400,"A":433,"copy_shape":396,"line_height":365,"fw_parent":449,"schema1_of_y":366,"on.initialize":350,"on.code_change":306,"on.mouse_press":179,"vx":5,"on.keychord_press":391,"Viewport":439,"on.draw":443,"y_of_schema1":364,"font":353,"update_editor_box":449,"compute_layout":385,"initialize_editor":450,"on.text_input":388,"B":379,"scale":7,"on.update":368,"on.mouse_release":367,"on":1,"box_height":345}
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
if obj.editor.load_time_error then
print('load time error found')
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h/2), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, 0)
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(obj.h/2))
end
end
end
end
draw_ticks()
draw_menu_bar()
end
{"Surface":422,"vy":448,"Page":444,"Cursor_node":172,"to_text":180,"add_thick_line":400,"A":433,"copy_shape":396,"line_height":365,"fw_parent":448,"schema1_of_y":366,"on.initialize":350,"on.code_change":306,"on.mouse_press":179,"vx":5,"on.keychord_press":391,"Viewport":439,"on.draw":443,"y_of_schema1":364,"font":353,"update_editor_box":449,"compute_layout":385,"initialize_editor":338,"on.text_input":388,"B":379,"scale":7,"on.update":368,"on.mouse_release":367,"on":1,"box_height":345}
draw_test_failure_indicator = function()
if next(Client_app_test_failures, nil) == nil then
return
end
App.color(Failing_test_definition_background_color)
local border_width = App.screen.width/40, App.screen.height
love.graphics.rectangle('fill', 0,0, border_width,App.screen.height)
love.graphics.rectangle('fill', App.screen.width-border_width, 0, border_width, App.screen.height)
love.graphics.rectangle('fill', 0,App.screen.height-border_width, App.screen.width, border_width)
end
animate_next = function(dt)
if Animating[1].step and Animating[1].step >= 20 then
table.remove(Animating, 1)
if #Animating == 0 then
Animating = nil
Canvas = nil
A()
return
end
end
animate_next_frame(Animating[1], dt)
end
{"add_thick_line":400,"on":1,"on.initialize":350,"Viewport":439,"A":433,"box_height":345,"scale":7,"line_height":365,"B":379,"on.mouse_release":367,"copy_shape":396,"on.mouse_press":179,"vy":448,"Cursor_node":172,"initialize_editor":338,"on.update":368,"update_editor_box":446,"on.keychord_press":391,"compute_layout":385,"on.text_input":388,"y_of_schema1":364,"on.code_change":306,"on.draw":443,"vx":5,"font":353,"schema1_of_y":366,"fw_parent":447,"Page":444,"Surface":422,"to_text":180}
{"on.code_change":306,"on.mouse_release":367,"on.update":368,"on":1,"on.keychord_press":391,"schema1_of_y":366,"update_editor_box":446,"initialize_editor":338,"Page":444,"fw_parent":446,"scale":7,"Surface":422,"Cursor_node":172,"on.initialize":350,"to_text":180,"A":433,"add_thick_line":400,"vx":5,"on.text_input":388,"B":379,"on.draw":443,"Viewport":439,"y_of_schema1":364,"font":353,"vy":8,"box_height":345,"copy_shape":396,"compute_layout":385,"line_height":365,"on.mouse_press":179}
{"on.mouse_press":179,"copy_shape":396,"on.mouse_release":367,"on.update":368,"line_height":365,"on.keychord_press":391,"A":433,"Line_number_width":440,"Page":444,"scale":7,"on.text_input":388,"compute_layout":385,"fw_parent":445,"y_of_schema1":364,"box_height":345,"font":353,"Surface":422,"Cursor_node":172,"on.code_change":306,"on.draw":443,"B":379,"vx":5,"on.initialize":350,"Viewport":439,"schema1_of_y":366,"add_thick_line":400,"vy":8,"initialize_editor":338,"update_editor_box":446,"to_text":180,"on":1}
{"line_height":365,"fw_parent":444,"scale":7,"on":1,"Surface":422,"on.initialize":350,"on.draw":443,"B":379,"vx":5,"y_of_schema1":364,"Viewport":439,"copy_shape":396,"add_thick_line":400,"vy":8,"initialize_editor":338,"to_text":180,"update_editor_box":445,"on.code_change":306,"on.mouse_press":179,"font":353,"on.mouse_release":367,"Cursor_node":172,"on.update":368,"box_height":345,"on.keychord_press":391,"schema1_of_y":366,"compute_layout":385,"on.text_input":388,"Page":444,"Line_number_width":440,"A":433}
{"Surface":422,"update_editor_box":441,"Line_number_width":440,"fw_parent":443,"vy":8,"vx":5,"line_height":365,"initialize_editor":338,"on.draw":443,"box_height":345,"schema1_of_y":366,"compute_layout":385,"Viewport":439,"Cursor_node":172,"Page":444,"on.mouse_press":179,"y_of_schema1":364,"on.mouse_release":367,"on.update":368,"on.text_input":388,"font":353,"on.keychord_press":391,"on":1,"on.code_change":306,"to_text":180,"B":379,"A":433,"copy_shape":396,"scale":7,"add_thick_line":400,"on.initialize":350}
{"Surface":422,"on.text_input":388,"schema1_of_y":366,"on.initialize":350,"on.mouse_press":179,"line_height":365,"on.mouse_release":367,"add_thick_line":400,"A":433,"copy_shape":396,"on.keychord_press":391,"compute_layout":385,"B":379,"scale":7,"Page":442,"vx":5,"to_text":180,"Line_number_width":440,"on.code_change":306,"fw_parent":442,"box_height":345,"on":1,"initialize_editor":338,"vy":8,"update_editor_box":441,"on.update":368,"Cursor_node":172,"font":353,"Viewport":439,"on.draw":443,"y_of_schema1":364}
{"undo_zoom_out":921,"approximate":579,"initialize_manifest_navigator":773,"update_editor_box":711,"get_multiple_definitions_from_app":783,"draw_load_time_error":929,"approximate_up":658,"draw_test_failure_indicator":935,"wait_for_response":781,"schema1_of_y":667,"Ticks_font":669,"Manifest_navigator":495,"y_of_schema1":364,"on.save_settings":742,"on.load_settings":782,"Manifest":769,"survey_animation":906,"load_manifest":694,"animate_next":914,"get_manifest":768,"on.code_submit":927,"animate_next_frame":915,"Definitions":503,"scale":712,"new_definition":848,"get_default_map":936,"delete_definition":673,"Menu_command_color":613,"Definition_background_color":849,"Test_definition_background_color":858,"add_thick_line":400,"definition_background_color":859,"copy_shape":396,"Num_animation_frames":840,"draw_run_time_error":808,"Surface":422,"on.code_change":924,"interpolate_viewport":843,"Menu_background_color":611,"Spawn_point":822,"Menu_border_color":612,"from_viewport":823,"Viewport":604,"snapshot_canvas":913,"Menu_highlight_color":614,"Save_viewport":865,"draw_menu_bar":861,"copy_viewport":866,"add_hotkey_to_menu":616,"fw_app":"driver","zoom_out":908,"draw_manifest_navigator":677,"on.mouse_release":836,"num_lines_for_manifest_navigator":676,"on.update":900,"table_and_array_both_empty":689,"on.keychord_press":919,"on_handle":547,"on.text_input":855,"draw_cursor":639,"Page":475,"on.initialize":807,"on_text":539,"A":831,"on.mouse_press":916,"fw_parent":935,"manifest_navigator_up":628,"B":830,"manifest_navigator_down":635,"sx":544,"vy":546,"vx":545,"zoom_in":920,"move_candidate_to_front_of_manifest":632,"Cursor_node":172,"keychord_press_on_manifest_navigator":765,"surface_bounds":814,"on.key_release":720,"sy":469,"get_definition_from_app":784,"manifest_coord":636,"load_from_iterator":670,"manifest_index":637,"maybe_update_key_in_definitions":529,"manifest_navigator_candidates":638,"reset_manifest_navigator":772,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"compute_layout":385,"Failing_test_definition_background_color":925,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"Animating":842,"draw_ticks":862,"on.draw":932,"font":353,"Zoomed_out":869,"line_height":365,"on":1,"add_def_to_menu":640,"load_definition":854,"initialize_editor":678,"order_of_magnitude":573,"tick_spec":660}
{"font":353,"scale":7,"schema1_of_y":366,"line_height":365,"on.draw":418,"on.text_input":388,"Surface":422,"Viewport":439,"y_of_schema1":364,"on.initialize":350,"update_editor_box":441,"on.keychord_press":391,"compute_layout":385,"add_thick_line":400,"A":433,"Page":442,"fw_parent":441,"initialize_editor":338,"vy":8,"box_height":345,"to_text":180,"on.mouse_release":367,"on.code_change":306,"on.update":368,"B":379,"copy_shape":396,"on.mouse_press":179,"vx":5,"Cursor_node":172,"Line_number_width":440,"on":1}
{"A":433,"Line_number_width":440,"box_height":345,"update_editor_box":441,"on.mouse_press":179,"font":353,"on.mouse_release":367,"y_of_schema1":364,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"compute_layout":385,"on":1,"schema1_of_y":366,"Page":438,"on.text_input":388,"initialize_editor":338,"vy":8,"add_thick_line":400,"fw_parent":440,"copy_shape":396,"Surface":422,"B":379,"on.code_change":306,"on.draw":418,"to_text":180,"vx":5,"line_height":365,"Viewport":439,"on.initialize":350,"scale":7}
{"A":433,"Line_number_width":440,"box_height":345,"update_editor_box":430,"on.mouse_press":179,"font":353,"on.mouse_release":367,"y_of_schema1":364,"on.update":368,"Cursor_node":172,"on.keychord_press":391,"compute_layout":385,"on":1,"schema1_of_y":366,"Page":438,"on.text_input":388,"initialize_editor":338,"vy":8,"add_thick_line":400,"fw_parent":439,"copy_shape":396,"Surface":422,"B":379,"on.code_change":306,"on.draw":418,"to_text":180,"vx":5,"line_height":365,"Viewport":439,"on.initialize":350,"scale":7}
{"on":1,"on.keychord_press":391,"Page":438,"on.text_input":388,"Cursor_node":172,"on.code_change":306,"A":433,"fw_parent":438,"add_thick_line":400,"copy_shape":396,"B":379,"Viewport":439,"on.mouse_press":179,"on.draw":418,"scale":7,"update_editor_box":430,"y_of_schema1":364,"on.initialize":350,"line_height":365,"to_text":180,"box_height":345,"vy":8,"initialize_editor":338,"on.mouse_release":367,"schema1_of_y":366,"Surface":422,"vx":5,"on.update":368,"font":353,"compute_layout":385}
{"on":1,"on.keychord_press":391,"Page":438,"on.text_input":388,"Cursor_node":172,"on.code_change":306,"A":433,"fw_parent":437,"add_thick_line":400,"copy_shape":396,"B":379,"Viewport":303,"on.mouse_press":179,"on.draw":418,"scale":7,"update_editor_box":430,"y_of_schema1":364,"on.initialize":350,"line_height":365,"to_text":180,"box_height":345,"vy":8,"initialize_editor":338,"on.mouse_release":367,"schema1_of_y":366,"Surface":422,"vx":5,"on.update":368,"font":353,"compute_layout":385}
{"on":1,"on.keychord_press":391,"Page":437,"on.text_input":388,"Cursor_node":172,"on.code_change":306,"A":433,"fw_parent":436,"add_thick_line":400,"copy_shape":396,"B":379,"Viewport":303,"on.mouse_press":179,"on.draw":418,"scale":7,"update_editor_box":430,"y_of_schema1":364,"on.initialize":350,"line_height":365,"to_text":180,"box_height":345,"vy":8,"initialize_editor":338,"on.mouse_release":367,"schema1_of_y":366,"Surface":422,"vx":5,"on.update":368,"font":353,"compute_layout":385}
{"on":1,"on.keychord_press":391,"Page":436,"on.text_input":388,"Cursor_node":172,"on.code_change":306,"A":433,"fw_parent":435,"add_thick_line":400,"copy_shape":396,"B":379,"Viewport":303,"on.mouse_press":179,"on.draw":418,"scale":7,"update_editor_box":430,"y_of_schema1":364,"on.initialize":350,"line_height":365,"to_text":180,"box_height":345,"vy":8,"initialize_editor":338,"on.mouse_release":367,"schema1_of_y":366,"Surface":422,"vx":5,"on.update":368,"font":353,"compute_layout":385}
on.load_settings = function(settings)
App_name = load_manifest()
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
for name, def in pairs(Definitions) do
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
{"on":1,"on.keychord_press":391,"Page":435,"on.text_input":388,"Cursor_node":172,"on.code_change":306,"A":433,"fw_parent":434,"add_thick_line":400,"copy_shape":396,"B":379,"Viewport":303,"on.mouse_press":179,"on.draw":418,"scale":7,"update_editor_box":430,"y_of_schema1":364,"on.initialize":350,"line_height":365,"to_text":180,"box_height":345,"vy":8,"initialize_editor":338,"on.mouse_release":367,"schema1_of_y":366,"Surface":422,"vx":5,"on.update":368,"font":353,"compute_layout":385}
{"on":1,"on.keychord_press":391,"Page":381,"on.text_input":388,"Cursor_node":172,"on.code_change":306,"A":433,"fw_parent":433,"add_thick_line":400,"copy_shape":396,"B":379,"Viewport":303,"on.mouse_press":179,"on.draw":418,"scale":7,"update_editor_box":430,"y_of_schema1":364,"on.initialize":350,"line_height":365,"to_text":180,"box_height":345,"vy":8,"initialize_editor":338,"on.mouse_release":367,"schema1_of_y":366,"Surface":422,"vx":5,"on.update":368,"font":353,"compute_layout":385}
{"on":1,"on.keychord_press":391,"Page":381,"on.text_input":388,"Cursor_node":172,"on.code_change":306,"A":433,"fw_parent":432,"add_thick_line":400,"copy_shape":396,"B":379,"Viewport":303,"on.mouse_press":179,"on.draw":418,"scale":7,"update_editor_box":430,"y_of_schema1":364,"on.initialize":350,"line_height":365,"to_text":180,"box_height":345,"vy":8,"initialize_editor":338,"on.mouse_release":367,"schema1_of_y":366,"Surface":422,"vx":5,"on.update":368,"font":353,"Page2":429,"compute_layout":385}
surface_bounds = function(nodes)
local minx,miny,maxx,maxy
for _,node in pairs(nodes) do
if minx == nil or node.x < minx then
minx = node.x
end
maxx = node.x
end
if miny == nil or node.y < miny then
miny = node.y
end
maxy = node.y
end
end
return minx,miny,maxx+600,maxy+600
end
if maxy == nil or node.y > maxy then
if maxx == nil or node.x > maxx then
{"on":1,"on.keychord_press":391,"Page":381,"on.text_input":388,"Cursor_node":172,"on.code_change":306,"A":432,"fw_parent":431,"add_thick_line":400,"copy_shape":396,"B":379,"Viewport":303,"on.mouse_press":179,"on.draw":418,"scale":7,"update_editor_box":430,"y_of_schema1":364,"on.initialize":350,"line_height":365,"to_text":180,"box_height":345,"vy":8,"initialize_editor":338,"on.mouse_release":367,"schema1_of_y":366,"Surface":422,"vx":5,"on.update":368,"font":353,"Page2":429,"compute_layout":385}
on.text_input = function(t)
if Manifest_navigator.show then
text_input_on_manifest_navigator(t)
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.text_input(Cursor_node.editor, t)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
end
end
{"on":1,"on.keychord_press":391,"Page":381,"on.text_input":388,"Cursor_node":172,"on.code_change":306,"A":431,"fw_parent":430,"add_thick_line":400,"copy_shape":396,"B":379,"Viewport":303,"on.mouse_press":179,"on.draw":418,"scale":7,"update_editor_box":430,"y_of_schema1":364,"on.initialize":350,"line_height":365,"to_text":180,"box_height":345,"vy":8,"initialize_editor":338,"on.mouse_release":367,"schema1_of_y":366,"Surface":422,"vx":5,"on.update":368,"font":353,"Page2":429,"compute_layout":385}
manifest_navigator_down = function()
local y, x, width = manifest_coord(Manifest_navigator.index)
local index = manifest_index(y+HUD_line_height, x, width)
if index then
Manifest_navigator.index = index
end
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
end
node.editor.top = node.editor.top
print(node.y, Viewport.y, node.editor.top)
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
{"Mouse_cursor":559,"definition_background_color":859,"set_mouse_cursor":562,"tick_spec":660,"draw_ticks":862,"Surface":422,"on.draw":797,"snapshot_canvas":872,"order_of_magnitude":573,"Save_viewport":865,"A":831,"copy_viewport":866,"approximate":579,"B":830,"Zoomed_out":869,"on.mouse_release":836,"on":1,"approximate_up":658,"on.save_settings":742,"on.load_settings":782,"Page":475,"table_and_array_both_empty":689,"get_multiple_definitions_from_app":783,"vy":546,"fw_parent":873,"fw_app":"driver","zoom_in":874,"get_manifest":768,"load_manifest":694,"Manifest":769,"compute_layout":385,"Definitions":503,"Menu_background_color":611,"draw_run_time_error":808,"box_height":680,"Test_definition_background_color":858,"Menu_command_color":613,"sy":469,"survey_animation":863,"on.code_change":820,"animate_next":841,"line_height":365,"add_hotkey_to_menu":616,"interpolate_viewport":843,"on.update":835,"draw_cursor":639,"animate_next_frame":825,"num_lines_for_manifest_navigator":676,"initialize_manifest_navigator":773,"Manifest_navigator":495,"reset_manifest_navigator":772,"new_definition":848,"load_definition":854,"y_of_schema1":364,"on.initialize":807,"get_definition_from_app":784,"surface_bounds":814,"Ticks_font":669,"Cursor_node":172,"on.code_submit":787,"manifest_navigator_up":628,"font":353,"maybe_update_key_in_definitions":529,"Menu_border_color":612,"initialize_editor":678,"Spawn_point":822,"wait_for_response":781,"move_candidate_to_front_of_manifest":632,"Menu_highlight_color":614,"keychord_press_on_manifest_navigator":765,"add_def_to_menu":640,"text_input_on_manifest_navigator":634,"on.text_input":855,"draw_manifest_navigator":677,"manifest_coord":636,"Num_animation_frames":840,"manifest_index":637,"schema1_of_y":667,"manifest_navigator_candidates":638,"draw_menu_bar":861,"on_handle":547,"Animating":842,"load_from_iterator":670,"on.keychord_press":871,"delete_definition":673,"on_text":539,"add_thick_line":400,"on.mouse_press":873,"copy_shape":396,"scale":712,"on.key_release":720,"Viewport":604,"sx":544,"update_editor_box":711,"vx":545,"zoom_out":870,"Definition_background_color":849,"from_viewport":823,"manifest_navigator_down":635,"mouse_cursor":558}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, sx(App.screen.width))
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, sy(App.screen.height))
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":989,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":990,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":987,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
on.draw = function()
if Animating then
local q = love.graphics.newQuad((Viewport.x-Global_viewport.x)*Viewport.zoom,(Viewport.y-Global_viewport.y)*Viewport.zoom, App.screen.width, App.screen.height, Global_viewport.w*Viewport.zoom, Global_viewport.h*Viewport.zoom)
App.color{r=1,g=1,b=1}
love.graphics.draw(Canvas, q, 0,0)
return
end
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
if obj.editor.load_time_error then
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, vy(obj.y))
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(5*20*Viewport.zoom))
love.graphics.setColor(0,0,0)
love.graphics.print(obj.editor.load_time_error, vx(obj.x), error_y)
end
end
end
end
draw_run_time_error()
draw_ticks()
draw_menu_bar()
end
{"on_handle":547,"definition_background_color":853,"draw_run_time_error":808,"survey_animation":847,"sx":544,"animate_next":841,"on.update":835,"load_definition":716,"on.keychord_press":828,"animate_next_frame":825,"box_height":680,"schema1_of_y":667,"on.save_settings":742,"surface_bounds":814,"Ticks_font":669,"y_of_schema1":364,"set_mouse_cursor":562,"font":353,"table_and_array_both_empty":689,"Spawn_point":822,"from_viewport":823,"load_manifest":694,"interpolate_viewport":843,"order_of_magnitude":573,"on.text_input":834,"Manifest":769,"B":830,"on.code_change":820,"get_manifest":768,"Cursor_node":172,"manifest_index":637,"approximate_up":658,"manifest_navigator_candidates":638,"Num_animation_frames":840,"new_definition":848,"add_thick_line":400,"update_editor_box":711,"copy_shape":396,"sy":469,"draw_manifest_navigator":677,"on.mouse_press":722,"Surface":422,"Test_definition_background_color":852,"draw_cursor":639,"Definition_background_color":849,"Viewport":604,"add_hotkey_to_menu":616,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"draw_ticks":844,"approximate":579,"tick_spec":660,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"vy":546,"Menu_command_color":613,"Mouse_cursor":559,"Menu_highlight_color":614,"mouse_cursor":558,"draw_menu_bar":641,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"Page":475,"on.code_submit":787,"Manifest_navigator":495,"fw_app":"driver","line_height":365,"on.initialize":807,"Definitions":503,"delete_definition":673,"keychord_press_on_manifest_navigator":765,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"get_multiple_definitions_from_app":783,"manifest_navigator_down":635,"on":1,"compute_layout":385,"on.key_release":720,"move_candidate_to_front_of_manifest":632,"Animating":842,"wait_for_response":781,"text_input_on_manifest_navigator":634,"fw_parent":852,"A":831,"manifest_coord":636,"scale":712,"on.mouse_release":836,"reset_manifest_navigator":772,"on.draw":797,"vx":545}
get_definition_from_app = function(name)
-- return definition for a name
-- if no such definition, return ''
live.send_to_app('GET '..name)
local response
repeat
love.timer.sleep(0.01)
response = live.receive_from_app()
until response
return response
end
{"B":830,"Menu_background_color":611,"vy":546,"Definitions":503,"Menu_command_color":613,"new_definition":848,"box_height":680,"draw_run_time_error":808,"draw_menu_bar":861,"on.mouse_release":836,"add_hotkey_to_menu":616,"on.save_settings":742,"survey_animation":863,"on.keychord_press":828,"animate_next":841,"num_lines_for_manifest_navigator":676,"Page":475,"reset_manifest_navigator":772,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"get_definition_from_app":784,"manifest_navigator_up":628,"surface_bounds":814,"on.draw":797,"Num_animation_frames":840,"Spawn_point":822,"update_editor_box":711,"on_text":539,"Save_viewport":865,"on.mouse_press":722,"Definition_background_color":849,"Animating":842,"schema1_of_y":667,"vx":545,"scale":712,"definition_background_color":859,"y_of_schema1":364,"on.key_release":720,"copy_viewport":866,"Viewport":604,"mouse_cursor":558,"Mouse_cursor":559,"delete_definition":673,"initialize_editor":678,"set_mouse_cursor":562,"from_viewport":823,"draw_ticks":862,"draw_cursor":639,"sy":469,"move_candidate_to_front_of_manifest":632,"font":353,"keychord_press_on_manifest_navigator":765,"manifest_navigator_down":635,"text_input_on_manifest_navigator":634,"manifest_index":637,"order_of_magnitude":573,"fw_parent":866,"on.code_change":820,"fw_app":"driver","add_thick_line":400,"manifest_navigator_candidates":638,"copy_shape":396,"approximate":579,"add_def_to_menu":640,"draw_manifest_navigator":677,"Test_definition_background_color":858,"snapshot_canvas":867,"manifest_coord":636,"Menu_highlight_color":614,"approximate_up":658,"wait_for_response":781,"Menu_border_color":612,"on.code_submit":787,"Cursor_node":172,"Ticks_font":669,"Manifest_navigator":495,"on":1,"on.initialize":807,"load_definition":854,"sx":544,"initialize_manifest_navigator":773,"on_handle":547,"on.update":835,"interpolate_viewport":843,"tick_spec":660,"line_height":365,"get_multiple_definitions_from_app":783,"on.text_input":855,"animate_next_frame":825,"compute_layout":385,"Manifest":769,"Surface":422,"A":831,"load_manifest":694,"on.load_settings":782,"get_manifest":768}
on.update = function(dt)
if Pan then
B()
return
end
if Move_node then
Move_node.x = sx(App.mouse_x())
Move_node.y = sy(App.mouse_y())
A()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
love.graphics.setColor(0.6,0.6,0.6)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
{"B":830,"text_input_on_manifest_navigator":634,"sy":954,"sx":955,"vy":956,"order_of_magnitude":573,"manifest_navigator_candidates":638,"scale":712,"add_def_to_menu":640,"approximate":579,"test_approximate_up":983,"vx":545,"Viewport":604,"draw_ticks":997,"Definition_background_color":849,"Test_definition_background_color":858,"definition_background_color":859,"approximate_up":985,"Page":475,"tick_spec":998,"update_editor_box":711,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"Menu_background_color":611,"add_thick_line":400,"zoom_out":908,"copy_shape":396,"load_definition":854,"Zoomed_out":869,"Menu_border_color":612,"zoom_in":920,"Menu_command_color":613,"draw_load_time_error":929,"Menu_highlight_color":614,"compute_layout":385,"initialize_manifest_navigator":773,"num_lines_for_manifest_navigator":676,"on.save_settings":742,"initialize_editor":678,"on.load_settings":940,"reset_manifest_navigator":772,"get_multiple_definitions_from_app":783,"on_handle":547,"on.keychord_press":919,"on.code_submit":947,"wait_for_response":781,"on.mouse_release":836,"on_text":539,"get_manifest":768,"draw_manifest_navigator":677,"iscale":953,"draw_cursor":639,"Num_animation_frames":840,"on.draw":986,"Surface":422,"Manifest_navigator":495,"set_mouse_cursor":562,"new_definition":848,"Manifest":769,"Definitions":503,"Ticks_font":669,"A":831,"draw_run_time_error":808,"table_and_array_both_empty":689,"fw_app":"driver","maybe_update_key_in_definitions":529,"line_height":365,"survey_animation":1010,"interpolate_viewport":843,"animate_next":914,"from_viewport":823,"load_manifest":694,"Spawn_point":822,"schema1_of_y":667,"Failing_test_definition_background_color":925,"animate_next_frame":915,"Animating":842,"on.mouse_press":916,"add_hotkey_to_menu":616,"on.key_release":720,"Cursor_node":172,"draw_test_failure_indicator":935,"manifest_index":637,"fw_parent":1009,"on.update":945,"surface_bounds":814,"y_of_schema1":364,"undo_zoom_out":921,"get_default_map":937,"load_from_iterator":670,"on.code_change":924,"get_definition_from_app":784,"font":353,"manifest_coord":636,"on.initialize":948,"on":1,"manifest_navigator_up":628,"mouse_cursor":558,"manifest_navigator_down":635,"Mouse_cursor":559,"draw_menu_bar":861,"delete_definition":673,"box_height":680,"move_candidate_to_front_of_manifest":632,"on.text_input":855,"keychord_press_on_manifest_navigator":765}
load_manifest = function()
-- Connect to an app and load its manifest into global Manifest.
-- Also return the name of the app we have connected to.
local new_manifest, app_name, manifest_version = get_manifest()
-- preserve existing order
-- 1. add new definitions in front
for _,name in ipairs(new_manifest) do
if not array.find(Manifest, name) then
table.insert(Manifest, 1, name)
end
end
-- 2. remove missing definitions
for idx=#Manifest,1,-1 do
local name = Manifest[idx]
if not array.find(new_manifest, name) then
table.remove(Manifest, idx)
end
end
print('load_manifest', manifest_version)
return app_name, manifest_version
end
on.mouse_press = function(x,y, mouse_button)
if Animating then return end
if Zoomed_out then
zoom_in_on_viewport(x,y)
Zoomed_out = nil
Saved_viewport = nil
return
end
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
if mouse_press_consumed_by_any_button_handler(HUD, x,y, mouse_button) then
return
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
on.text_input = function(t)
if Manifest_navigator.show then
text_input_on_manifest_navigator(t)
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.text_input(Cursor_node.editor, t)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
end
A(--[[preserve screen_top of cursor node]] true)
end
end
{"line_height":365,"on.key_release":720,"load_definition":854,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"add_thick_line":400,"Failing_test_definition_background_color":925,"survey_animation":906,"on.load_settings":782,"animate_next":914,"on":1,"num_lines_for_manifest_navigator":676,"table_and_array_both_empty":689,"animate_next_frame":915,"order_of_magnitude":573,"load_from_iterator":670,"get_definition_from_app":784,"approximate":579,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"font":353,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"Ticks_font":669,"Manifest_navigator":495,"interpolate_viewport":843,"manifest_coord":636,"manifest_index":637,"draw_test_failure_indicator":930,"draw_load_time_error":929,"Animating":842,"reset_manifest_navigator":772,"draw_run_time_error":808,"snapshot_canvas":913,"Menu_command_color":613,"draw_manifest_navigator":677,"Test_definition_background_color":858,"Surface":422,"Manifest":769,"Menu_background_color":611,"on.text_input":855,"on.code_change":924,"from_viewport":823,"get_manifest":768,"approximate_up":658,"initialize_editor":678,"on.draw":928,"draw_cursor":639,"Spawn_point":822,"Menu_border_color":612,"Definitions":503,"Definition_background_color":849,"new_definition":848,"Menu_highlight_color":614,"Save_viewport":865,"draw_menu_bar":861,"copy_viewport":866,"add_hotkey_to_menu":616,"definition_background_color":859,"zoom_out":908,"on.mouse_release":836,"Zoomed_out":869,"on.update":900,"undo_zoom_out":921,"on.keychord_press":919,"copy_shape":396,"compute_layout":385,"zoom_in":920,"Page":475,"maybe_update_key_in_definitions":529,"manifest_navigator_candidates":638,"Cursor_node":172,"surface_bounds":814,"add_def_to_menu":640,"sy":469,"Num_animation_frames":840,"fw_parent":929,"fw_app":"driver","draw_ticks":862,"load_manifest":694,"schema1_of_y":667,"update_editor_box":711,"on.code_submit":927,"wait_for_response":781,"vy":546,"on_handle":547,"y_of_schema1":364,"set_mouse_cursor":562,"text_input_on_manifest_navigator":634,"on.initialize":807,"initialize_manifest_navigator":773,"A":831,"on.mouse_press":916,"on_text":539,"tick_spec":660,"B":830,"get_multiple_definitions_from_app":783,"sx":544,"Viewport":604,"vx":545,"scale":712,"on.save_settings":742}
on.load_settings = function(settings)
App_name = load_manifest()
Viewport = settings[app_name].viewport
Definitions = settings[app_name].definitions
for name, def in pairs(Definitions) do
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
print(Viewport.zoom, Viewport.x, Viewport.x+iscale(App.screen.width))
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
on.mouse_press = function(x,y, mouse_button)
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move_node = node
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+100,maxy+1 -- maxy+19 works, +15 doesn't
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
end
node.editor.top = node.editor.top + Menu_bar_height
print(node.y, Viewport.y, node.editor.top)
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
if edit.load_time_error then
print('load time error found')
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h/2), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, 0)
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(obj.h/2))
end
end
end
end
draw_ticks()
draw_menu_bar()
end
{"Manifest":769,"Viewport":604,"approximate":579,"snapshot_canvas":913,"get_manifest":768,"copy_viewport":866,"on.save_settings":742,"sy":469,"approximate_up":658,"Definitions":503,"update_editor_box":711,"new_definition":848,"on.code_submit":787,"table_and_array_both_empty":689,"zoom_in":895,"Page":475,"schema1_of_y":667,"initialize_manifest_navigator":773,"y_of_schema1":364,"get_multiple_definitions_from_app":783,"wait_for_response":781,"Menu_background_color":611,"Menu_border_color":612,"on.text_input":855,"box_height":680,"fw_parent":916,"compute_layout":385,"fw_app":"driver","on.code_change":820,"on_text":539,"survey_animation":906,"animate_next":914,"scale":712,"sx":544,"vx":545,"load_from_iterator":670,"from_viewport":823,"get_definition_from_app":784,"Surface":422,"on_handle":547,"Ticks_font":669,"draw_menu_bar":861,"manifest_navigator_up":628,"copy_shape":396,"manifest_navigator_down":635,"surface_bounds":814,"Save_viewport":865,"delete_definition":673,"font":353,"move_candidate_to_front_of_manifest":632,"draw_cursor":639,"keychord_press_on_manifest_navigator":765,"on.update":900,"text_input_on_manifest_navigator":634,"Spawn_point":822,"zoom_out":908,"manifest_coord":636,"on.mouse_release":836,"manifest_index":637,"animate_next_frame":915,"manifest_navigator_candidates":638,"initialize_editor":678,"interpolate_viewport":843,"add_def_to_menu":640,"on.load_settings":782,"A":831,"maybe_update_key_in_definitions":529,"order_of_magnitude":573,"on.initialize":807,"on":1,"add_thick_line":400,"load_manifest":694,"on.key_release":720,"on.keychord_press":912,"Menu_highlight_color":614,"Num_animation_frames":840,"draw_run_time_error":808,"reset_manifest_navigator":772,"on.mouse_press":916,"num_lines_for_manifest_navigator":676,"draw_manifest_navigator":677,"mouse_cursor":558,"add_hotkey_to_menu":616,"Mouse_cursor":559,"tick_spec":660,"Definition_background_color":849,"Manifest_navigator":495,"set_mouse_cursor":562,"vy":546,"draw_ticks":862,"Test_definition_background_color":858,"Cursor_node":172,"definition_background_color":859,"Animating":842,"Menu_command_color":613,"Zoomed_out":869,"line_height":365,"B":830,"on.draw":917,"load_definition":854}
maybe_update_key_in_definitions = function(old_definition_name, definition_name, Cursor_node)
print(old_definition_name, definition_name)
if old_definition_name ~= definition_name then
if old_definition_name == nil or Definitions[old_definition_name] ~= Cursor_node then
local pos = array.find(Definitions, Cursor_node)
print('found at index', pos)
elseif Definitions[old_definition_name] == Cursor_node then
print('found at key', old_definition_name)
-- Definitions[old_definition] = nil
end
print('current definition name', definition_name)
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
end
end
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
print('AAA', chord, Manifest_navigator.show)
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
print('CCC')
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-l' then
print('BBB')
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"on_handle":547,"draw_run_time_error":808,"survey_animation":847,"sx":544,"animate_next":841,"on.update":835,"load_definition":716,"on.keychord_press":828,"animate_next_frame":825,"box_height":680,"schema1_of_y":667,"on.save_settings":742,"surface_bounds":814,"Ticks_font":669,"y_of_schema1":364,"set_mouse_cursor":562,"font":353,"table_and_array_both_empty":689,"Spawn_point":822,"from_viewport":823,"load_manifest":694,"interpolate_viewport":843,"order_of_magnitude":573,"on.text_input":834,"Manifest":769,"B":830,"on.code_change":820,"get_manifest":768,"Cursor_node":172,"manifest_index":637,"approximate_up":658,"manifest_navigator_candidates":638,"Num_animation_frames":840,"new_definition":848,"add_thick_line":400,"update_editor_box":711,"copy_shape":396,"sy":469,"draw_manifest_navigator":677,"on.mouse_press":722,"Surface":422,"Test_definition_background_color":852,"draw_cursor":639,"Definition_background_color":849,"Viewport":604,"add_hotkey_to_menu":616,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"draw_ticks":844,"approximate":579,"tick_spec":660,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"vy":546,"Menu_command_color":613,"Mouse_cursor":559,"Menu_highlight_color":614,"mouse_cursor":558,"draw_menu_bar":641,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"Page":475,"on.code_submit":787,"Manifest_navigator":495,"fw_app":"driver","line_height":365,"on.initialize":807,"Definitions":503,"delete_definition":673,"keychord_press_on_manifest_navigator":765,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"get_multiple_definitions_from_app":783,"manifest_navigator_down":635,"on":1,"compute_layout":385,"on.key_release":720,"move_candidate_to_front_of_manifest":632,"Animating":842,"wait_for_response":781,"text_input_on_manifest_navigator":634,"fw_parent":851,"A":831,"manifest_coord":636,"scale":712,"on.mouse_release":836,"reset_manifest_navigator":772,"on.draw":797,"vx":545}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
love.graphics.setColor(0.6,0.6,0.6)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
print('draw', vx(x)+2,5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, sx(App.screen.width))
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, sy(App.screen.height))
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
{"B":830,"Menu_background_color":611,"vy":546,"Definitions":503,"Menu_command_color":613,"new_definition":848,"box_height":680,"draw_run_time_error":808,"draw_menu_bar":861,"on.mouse_release":836,"add_hotkey_to_menu":616,"on.save_settings":742,"survey_animation":863,"on.keychord_press":828,"animate_next":841,"num_lines_for_manifest_navigator":676,"Page":475,"reset_manifest_navigator":772,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"get_definition_from_app":784,"manifest_navigator_up":628,"surface_bounds":814,"on.draw":797,"Num_animation_frames":840,"Spawn_point":822,"update_editor_box":711,"on_text":539,"Save_viewport":865,"on.mouse_press":722,"Definition_background_color":849,"Animating":842,"schema1_of_y":667,"vx":545,"scale":712,"definition_background_color":859,"y_of_schema1":364,"on.key_release":720,"copy_viewport":866,"Viewport":604,"mouse_cursor":558,"Mouse_cursor":559,"delete_definition":673,"initialize_editor":678,"set_mouse_cursor":562,"from_viewport":823,"draw_ticks":862,"draw_cursor":639,"sy":469,"move_candidate_to_front_of_manifest":632,"font":353,"keychord_press_on_manifest_navigator":765,"manifest_navigator_down":635,"text_input_on_manifest_navigator":634,"manifest_index":637,"order_of_magnitude":573,"fw_parent":865,"on.code_change":820,"fw_app":"driver","add_thick_line":400,"manifest_navigator_candidates":638,"copy_shape":396,"approximate":579,"add_def_to_menu":640,"draw_manifest_navigator":677,"Test_definition_background_color":858,"snapshot_canvas":864,"manifest_coord":636,"Menu_highlight_color":614,"approximate_up":658,"wait_for_response":781,"Menu_border_color":612,"on.code_submit":787,"Cursor_node":172,"Ticks_font":669,"Manifest_navigator":495,"on":1,"on.initialize":807,"load_definition":854,"sx":544,"initialize_manifest_navigator":773,"on_handle":547,"on.update":835,"interpolate_viewport":843,"tick_spec":660,"line_height":365,"get_multiple_definitions_from_app":783,"on.text_input":855,"animate_next_frame":825,"compute_layout":385,"Manifest":769,"Surface":422,"A":831,"load_manifest":694,"on.load_settings":782,"get_manifest":768}
{"Mouse_cursor":559,"definition_background_color":859,"set_mouse_cursor":562,"tick_spec":660,"draw_ticks":862,"Surface":422,"on.draw":797,"snapshot_canvas":872,"order_of_magnitude":573,"Save_viewport":865,"A":831,"copy_viewport":866,"approximate":579,"B":830,"Zoomed_out":869,"on.mouse_release":836,"on":1,"approximate_up":658,"on.save_settings":742,"on.load_settings":782,"Page":475,"table_and_array_both_empty":689,"get_multiple_definitions_from_app":783,"vy":546,"fw_parent":872,"fw_app":"driver","get_manifest":768,"load_manifest":694,"Manifest":769,"compute_layout":385,"Definitions":503,"Menu_background_color":611,"draw_run_time_error":808,"box_height":680,"Test_definition_background_color":858,"Menu_command_color":613,"sy":469,"survey_animation":863,"on.code_change":820,"animate_next":841,"line_height":365,"add_hotkey_to_menu":616,"interpolate_viewport":843,"on.update":835,"draw_cursor":639,"animate_next_frame":825,"num_lines_for_manifest_navigator":676,"initialize_manifest_navigator":773,"Manifest_navigator":495,"reset_manifest_navigator":772,"new_definition":848,"load_definition":854,"y_of_schema1":364,"on.initialize":807,"get_definition_from_app":784,"surface_bounds":814,"Ticks_font":669,"Cursor_node":172,"on.code_submit":787,"manifest_navigator_up":628,"font":353,"maybe_update_key_in_definitions":529,"Menu_border_color":612,"initialize_editor":678,"Spawn_point":822,"wait_for_response":781,"move_candidate_to_front_of_manifest":632,"Menu_highlight_color":614,"keychord_press_on_manifest_navigator":765,"add_def_to_menu":640,"text_input_on_manifest_navigator":634,"on.text_input":855,"draw_manifest_navigator":677,"manifest_coord":636,"Num_animation_frames":840,"manifest_index":637,"schema1_of_y":667,"manifest_navigator_candidates":638,"draw_menu_bar":861,"on_handle":547,"Animating":842,"load_from_iterator":670,"on.keychord_press":871,"delete_definition":673,"on_text":539,"add_thick_line":400,"on.mouse_press":873,"copy_shape":396,"scale":712,"on.key_release":720,"Viewport":604,"sx":544,"update_editor_box":711,"vx":545,"zoom_out":870,"Definition_background_color":849,"from_viewport":823,"manifest_navigator_down":635,"mouse_cursor":558}
on.mouse_press = function(x,y, mouse_button)
if Animating then return end
if Zoomed_out then
zoom_in(x,y)
return
end
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
if mouse_press_consumed_by_any_button_handler(HUD, x,y, mouse_button) then
return
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
end
node.editor.top = node.editor.top + Menu_bar_height
print(node.y, node.editor.top)
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
on.load_settings = function(settings)
local app_name = load_manifest()
Viewport = settings[app_name].viewport
Definitions = settings[app_name].definitions
for name, def in pairs(Definitions) do
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
on.mouse_press = function(x,y, mouse_button)
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
local node = on_text(x,y)
if node then
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
else
end
end
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
keychord_press_on_manifest_navigator = function(chord, key)
if chord == 'escape' then
reset_manifest_navigator()
elseif chord == 'return' then
if Manifest_navigator.for_delete then
delete_definition(Manifest_navigator.candidates[Manifest_navigator.index])
else
load_definition(Manifest_navigator.candidates[Manifest_navigator.index])
end
A()
reset_manifest_navigator()
elseif chord == 'backspace' then
local len = utf8.len(Manifest_navigator.filter)
local byte_offset = Text.offset(Manifest_navigator.filter, len)
Manifest_navigator.filter = string.sub(Manifest_navigator.filter, 1, byte_offset-1)
Manifest_navigator.index = 1
Manifest_navigator.candidates = manifest_navigator_candidates()
elseif chord == 'left' then
if Manifest_navigator.index > 1 then
Manifest_navigator.index = Manifest_navigator.index-1
end
elseif chord == 'right' then
if Manifest_navigator.index < #Manifest_navigator.candidates then
Manifest_navigator.index = Manifest_navigator.index+1
end
elseif chord == 'down' then
manifest_navigator_down()
elseif chord == 'up' then
manifest_navigator_up()
end
end
on.update = function(dt)
if Animating then
Animating.frame_time = Animating.frame_time + dt
print(Animating.frame_time)
if Animating.frame_time > 0.01 then
Animating.frame_time = Animating.frame_time - 0.01
Animating.step = Animating.step+1
if Animating.step >= 10 then
Animating = nil
return
end
Viewport[Animating.viewport_key] = Animating.start + Animating.step * Animating.step_increment
end
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
A()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
{"line_height":365,"on.key_release":720,"load_definition":854,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"add_thick_line":400,"Failing_test_definition_background_color":925,"survey_animation":906,"on.load_settings":782,"animate_next":914,"on":1,"num_lines_for_manifest_navigator":676,"table_and_array_both_empty":689,"animate_next_frame":915,"order_of_magnitude":573,"load_from_iterator":670,"get_definition_from_app":784,"approximate":579,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"font":353,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"Ticks_font":669,"Manifest_navigator":495,"interpolate_viewport":843,"manifest_coord":636,"manifest_index":637,"draw_load_time_error":929,"Animating":842,"reset_manifest_navigator":772,"draw_run_time_error":808,"snapshot_canvas":913,"Menu_command_color":613,"draw_manifest_navigator":677,"Test_definition_background_color":858,"Surface":422,"Manifest":769,"Menu_background_color":611,"on.text_input":855,"on.code_change":924,"from_viewport":823,"get_manifest":768,"approximate_up":658,"initialize_editor":678,"on.draw":928,"draw_cursor":639,"Spawn_point":822,"Menu_border_color":612,"Definitions":503,"Definition_background_color":849,"new_definition":848,"Menu_highlight_color":614,"Save_viewport":865,"draw_menu_bar":861,"copy_viewport":866,"add_hotkey_to_menu":616,"definition_background_color":859,"zoom_out":908,"on.mouse_release":836,"Zoomed_out":869,"on.update":900,"undo_zoom_out":921,"on.keychord_press":919,"copy_shape":396,"compute_layout":385,"zoom_in":920,"Page":475,"maybe_update_key_in_definitions":529,"manifest_navigator_candidates":638,"Cursor_node":172,"surface_bounds":814,"add_def_to_menu":640,"sy":469,"Num_animation_frames":840,"fw_parent":928,"fw_app":"driver","draw_ticks":862,"load_manifest":694,"schema1_of_y":667,"update_editor_box":711,"on.code_submit":927,"wait_for_response":781,"vy":546,"on_handle":547,"y_of_schema1":364,"set_mouse_cursor":562,"text_input_on_manifest_navigator":634,"on.initialize":807,"initialize_manifest_navigator":773,"A":831,"on.mouse_press":916,"on_text":539,"tick_spec":660,"B":830,"get_multiple_definitions_from_app":783,"sx":544,"Viewport":604,"vx":545,"scale":712,"on.save_settings":742}
Animating = nil -- set this to enable animation
-- When enabled, animation should consist of a series of viewport states that we animate into.
-- Each viewport state will be attained in 10 frames, each of 0.01 ms or 1 Love frame.
-- Each state will specify the final state of various viewport keys. Keys not mentioned will remain unchanged.
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
-- print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
-- print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
-- print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
-- print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
-- print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
maybe_update_key_in_definitions = function(old_definition_name, definition_name, )
print(old_definition_name, definition_name)
if old_definition_name ~= definition_name then
if old_definition_name == nil or Definitions[old_definition_name] ~= Cursor_node then
local pos = array.find(Definitions, Cursor_node)
print('found at index', pos)
elseif Definitions[old_definition_name] == Cursor_node then
print('found at key', old_definition_name)
-- Definitions[old_definition] = nil
end
print('current definition name', definition_name)
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
end
end
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":988,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":989,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":987,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
{"Menu_border_color":612,"Menu_command_color":613,"Page":475,"Menu_highlight_color":614,"add_hotkey_to_menu":616,"keychord_press_on_manifest_navigator":765,"undo_zoom_out":921,"initialize_manifest_navigator":773,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_cursor":639,"manifest_navigator_up":628,"draw_test_failure_indicator":935,"manifest_navigator_down":635,"maybe_update_key_in_definitions":529,"move_candidate_to_front_of_manifest":632,"on.initialize":948,"get_default_map":937,"on.key_release":720,"compute_layout":385,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"add_def_to_menu":640,"y_of_schema1":364,"tick_spec":998,"on_handle":547,"iscale":953,"draw_ticks":997,"sy":954,"sx":955,"vy":956,"Zoomed_out":869,"Manifest_navigator":495,"snapshot_canvas":913,"draw_run_time_error":808,"wait_for_response":781,"on.draw":986,"Test_definition_background_color":858,"test_approximate_up":983,"survey_animation":1009,"delete_definition":673,"animate_next":914,"load_definition":854,"copy_viewport":866,"fw_parent":1008,"update_editor_box":711,"fw_app":"driver","animate_next_frame":915,"box_height":680,"on":1,"add_thick_line":400,"draw_menu_bar":861,"on.update":945,"on.save_settings":742,"on.keychord_press":919,"on.load_settings":940,"get_definition_from_app":784,"surface_bounds":814,"Animating":842,"zoom_out":908,"Save_viewport":865,"table_and_array_both_empty":689,"order_of_magnitude":573,"on.mouse_press":916,"schema1_of_y":667,"approximate_up":985,"Spawn_point":822,"load_manifest":694,"from_viewport":823,"Definition_background_color":849,"interpolate_viewport":843,"on.mouse_release":836,"font":353,"get_manifest":768,"approximate":579,"definition_background_color":859,"Mouse_cursor":559,"B":830,"on.code_change":924,"A":831,"Ticks_font":669,"Definitions":503,"Manifest":769,"initialize_editor":678,"set_mouse_cursor":562,"on.text_input":855,"copy_shape":396,"Surface":422,"Num_animation_frames":840,"Cursor_node":172,"draw_manifest_navigator":677,"vx":545,"num_lines_for_manifest_navigator":676,"line_height":365,"on.code_submit":947,"reset_manifest_navigator":772,"new_definition":848,"on_text":539,"load_from_iterator":670,"Viewport":604,"draw_load_time_error":929,"zoom_in":920,"text_input_on_manifest_navigator":634,"mouse_cursor":558,"Menu_background_color":611,"scale":712}
draw_load_time_error = function(obj)
if not obj.editor.load_time_error then return end
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, vy(obj.y))
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(5*20*Viewport.zoom))
love.graphics.setColor(0,0,0)
love.graphics.print(obj.editor.load_time_error, vx(obj.x), error_y)
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y > Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
end
node.editor.top = node.editor.top + Menu_bar_height
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
on_text = function(x,y)
for _,node in ipairs(Surface) do
if node.type == 'text' then
if x >= vx(node.x) and node.w and x < vx(node.x + node.w) then
if y >= vy(node.y) and node.h and y < vy(node.y + node.h) then
return node
end
end
end
end
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
love.graphics.setColor(0.6,0.6,0.6)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
print('draw', vx(x)+2,5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
{"on_handle":547,"draw_run_time_error":808,"survey_animation":847,"sx":544,"animate_next":841,"on.update":835,"load_definition":716,"on.keychord_press":828,"animate_next_frame":825,"box_height":680,"schema1_of_y":667,"on.save_settings":742,"surface_bounds":814,"Ticks_font":669,"y_of_schema1":364,"set_mouse_cursor":562,"font":353,"table_and_array_both_empty":689,"Spawn_point":822,"from_viewport":823,"load_manifest":694,"interpolate_viewport":843,"order_of_magnitude":573,"on.text_input":834,"Manifest":769,"B":830,"on.code_change":820,"get_manifest":768,"Cursor_node":172,"manifest_index":637,"approximate_up":658,"manifest_navigator_candidates":638,"Num_animation_frames":840,"new_definition":848,"add_thick_line":400,"update_editor_box":711,"copy_shape":396,"sy":469,"draw_manifest_navigator":677,"on.mouse_press":722,"Surface":422,"draw_cursor":639,"Definition_background_color":849,"Viewport":604,"add_hotkey_to_menu":616,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"draw_ticks":844,"approximate":579,"tick_spec":660,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"vy":546,"Menu_command_color":613,"Mouse_cursor":559,"Menu_highlight_color":614,"mouse_cursor":558,"draw_menu_bar":641,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"Page":475,"on.code_submit":787,"Manifest_navigator":495,"fw_app":"driver","line_height":365,"on.initialize":807,"Definitions":503,"delete_definition":673,"keychord_press_on_manifest_navigator":765,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"get_multiple_definitions_from_app":783,"manifest_navigator_down":635,"on":1,"compute_layout":385,"on.key_release":720,"move_candidate_to_front_of_manifest":632,"Animating":842,"wait_for_response":781,"text_input_on_manifest_navigator":634,"fw_parent":850,"A":831,"manifest_coord":636,"scale":712,"on.mouse_release":836,"reset_manifest_navigator":772,"on.draw":797,"vx":545}
{"B":830,"Menu_background_color":611,"vy":546,"Definitions":503,"Menu_command_color":613,"new_definition":848,"box_height":680,"draw_run_time_error":808,"draw_menu_bar":861,"on.mouse_release":836,"add_hotkey_to_menu":616,"on.save_settings":742,"survey_animation":863,"on.keychord_press":828,"animate_next":841,"num_lines_for_manifest_navigator":676,"Page":475,"reset_manifest_navigator":772,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"get_definition_from_app":784,"manifest_navigator_up":628,"surface_bounds":814,"on.draw":797,"Num_animation_frames":840,"Spawn_point":822,"update_editor_box":711,"on_text":539,"Save_viewport":865,"on.mouse_press":722,"Definition_background_color":849,"Animating":842,"schema1_of_y":667,"vx":545,"scale":712,"definition_background_color":859,"y_of_schema1":364,"on.key_release":720,"Viewport":604,"mouse_cursor":558,"Mouse_cursor":559,"delete_definition":673,"initialize_editor":678,"set_mouse_cursor":562,"from_viewport":823,"draw_ticks":862,"draw_cursor":639,"sy":469,"move_candidate_to_front_of_manifest":632,"font":353,"keychord_press_on_manifest_navigator":765,"manifest_navigator_down":635,"text_input_on_manifest_navigator":634,"manifest_index":637,"order_of_magnitude":573,"fw_parent":864,"on.code_change":820,"fw_app":"driver","add_thick_line":400,"manifest_navigator_candidates":638,"copy_shape":396,"approximate":579,"add_def_to_menu":640,"draw_manifest_navigator":677,"Test_definition_background_color":858,"snapshot_canvas":864,"manifest_coord":636,"Menu_highlight_color":614,"approximate_up":658,"wait_for_response":781,"Menu_border_color":612,"on.code_submit":787,"Cursor_node":172,"Ticks_font":669,"Manifest_navigator":495,"on":1,"on.initialize":807,"load_definition":854,"sx":544,"initialize_manifest_navigator":773,"on_handle":547,"on.update":835,"interpolate_viewport":843,"tick_spec":660,"line_height":365,"get_multiple_definitions_from_app":783,"on.text_input":855,"animate_next_frame":825,"compute_layout":385,"Manifest":769,"Surface":422,"A":831,"load_manifest":694,"on.load_settings":782,"get_manifest":768}
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
print('AAA', chord, Manifest_navigator.show)
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
print('CCC')
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-l' then
print('BBB')
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxy+19
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"Manifest":769,"Viewport":604,"approximate":579,"snapshot_canvas":913,"get_manifest":768,"copy_viewport":866,"on.save_settings":742,"sy":469,"approximate_up":658,"Definitions":503,"update_editor_box":711,"new_definition":848,"on.code_submit":787,"table_and_array_both_empty":689,"zoom_in":895,"Page":475,"schema1_of_y":667,"initialize_manifest_navigator":773,"y_of_schema1":364,"get_multiple_definitions_from_app":783,"wait_for_response":781,"Menu_background_color":611,"Menu_border_color":612,"on.text_input":855,"box_height":680,"fw_parent":915,"compute_layout":385,"fw_app":"driver","on.code_change":820,"on_text":539,"survey_animation":906,"animate_next":914,"scale":712,"sx":544,"vx":545,"load_from_iterator":670,"from_viewport":823,"get_definition_from_app":784,"Surface":422,"on_handle":547,"Ticks_font":669,"draw_menu_bar":861,"manifest_navigator_up":628,"copy_shape":396,"manifest_navigator_down":635,"surface_bounds":814,"Save_viewport":865,"delete_definition":673,"font":353,"move_candidate_to_front_of_manifest":632,"draw_cursor":639,"keychord_press_on_manifest_navigator":765,"on.update":900,"text_input_on_manifest_navigator":634,"Spawn_point":822,"zoom_out":908,"manifest_coord":636,"on.mouse_release":836,"manifest_index":637,"animate_next_frame":915,"manifest_navigator_candidates":638,"initialize_editor":678,"interpolate_viewport":843,"add_def_to_menu":640,"on.load_settings":782,"A":831,"maybe_update_key_in_definitions":529,"order_of_magnitude":573,"on.initialize":807,"on":1,"add_thick_line":400,"load_manifest":694,"on.key_release":720,"on.keychord_press":912,"Menu_highlight_color":614,"Num_animation_frames":840,"draw_run_time_error":808,"reset_manifest_navigator":772,"on.mouse_press":916,"num_lines_for_manifest_navigator":676,"draw_manifest_navigator":677,"mouse_cursor":558,"add_hotkey_to_menu":616,"Mouse_cursor":559,"tick_spec":660,"Definition_background_color":849,"Manifest_navigator":495,"set_mouse_cursor":562,"vy":546,"draw_ticks":862,"Test_definition_background_color":858,"Cursor_node":172,"definition_background_color":859,"Animating":842,"Menu_command_color":613,"Zoomed_out":869,"line_height":365,"B":830,"on.draw":885,"load_definition":854}
on.load_settings = function(settings)
local app_name = load_manifest()
Viewport = settings.viewport
Definitions = settings.definitions
for name, def in pairs(Definitions) do
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
keychord_press_on_manifest_navigator = function(chord, key)
if chord == 'escape' then
reset_manifest_navigator()
elseif chord == 'return' then
if Manifest_navigator.delete then
delete_definition(Manifest_navigator.candidates[Manifest_navigator.index])
else
load_definition(Manifest_navigator.candidates[Manifest_navigator.index])
end
elseif chord == 'backspace' then
local len = utf8.len(Manifest_navigator.filter)
local byte_offset = Text.offset(Manifest_navigator.filter, len)
Manifest_navigator.filter = string.sub(Manifest_navigator.filter, 1, byte_offset-1)
Manifest_navigator.index = 1
Manifest_navigator.candidates = manifest_navigator_candidates()
elseif chord == 'left' then
if Manifest_navigator.index > 1 then
Manifest_navigator.index = Manifest_navigator.index-1
end
elseif chord == 'right' then
if Manifest_navigator.index < #Manifest_navigator.candidates then
Manifest_navigator.index = Manifest_navigator.index+1
end
elseif chord == 'down' then
manifest_navigator_down()
elseif chord == 'up' then
manifest_navigator_up()
end
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
if node.y >= Viewport.y then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
end
node.editor.top = node.editor.top + Menu_bar_height
node.editor.left = math.floor(vx(node.x+Line_number_width))
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
if edit.load_time_error then
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h/2), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, 0)
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(obj.h/2))
end
end
end
end
draw_ticks()
draw_menu_bar()
end
on.text_input = function(t)
if Manifest_navigator.show then
text_input_on_manifest_navigator(t)
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.text_input(Cursor_node.editor, t)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
print(old_definition_name, definition_name)
if old_definition_name ~= definition_name then
if old_definition_name == nil or Definitions[old_definition_name] ~= Cursor_node then
local pos = array.find(Definitions, Cursor_node)
print('found at index', pos)
elseif Definitions[old_definition_name] == Cursor_node then
print('found at key', old_definition_name)
-- Definitions[old_definition] = nil
end
print('current definition name', definition_name)
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
end
A(--[[preserve screen_top of cursor node]] true)
end
end
on.draw = function()
if Animating then
local q = love.graphics.newQuad((Viewport.x-Global_viewport.x)*Viewport.zoom,(Viewport.y-Global_viewport.y)*Viewport.zoom, App.screen.width, App.screen.height, Global_viewport.w*Viewport.zoom, Global_viewport.h*Viewport.zoom)
App.color{r=1,g=1,b=1}
love.graphics.draw(Canvas, q, 0,0)
return
end
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
draw_load_time_error(obj)
end
end
end
draw_run_time_error()
draw_ticks()
draw_menu_bar()
end
load_manifest = function()
-- Connect to an app and load its manifest into global Manifest.
-- Also return the name of the app we have connected to.
local new_manifest, app_name, manifest_version = get_manifest()
-- preserve existing order
-- 1. add new definitions in front
for _,name in ipairs(new_manifest) do
if not array.find(Manifest, name) then
table.insert(Manifest, 1, name)
end
end
-- 2. remove missing definitions
for idx=#Manifest,1,-1 do
local name = Manifest[idx]
if not array.find(new_manifest, name) then
table.remove(Manifest, idx)
end
end
print('load_manifest', manifest_version)
return app_name, manifest_version
end
on.update = function(dt)
--[[
if Animating then
Animating.frame_time = Animating.frame_time + dt
print(Animating.frame_time)
if Animating.frame_time > 0.01 then
Animating.frame_time = Animating.frame_time - 0.01
Animating.step = Animating.step+1
if Animating.step >= 10 then
Animating = false
return
end
Viewport[Animating.viewport_key] = Animating.start +
end
return
end
-- ]]
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
A()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(0.6,0.6,0.6)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
print('draw', vx(x)+2,5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
end
end
end
draw_menu_bar()
end
on.load_settings = function(settings)
local manifest_version
App_name, manifest_version = load_manifest()
print('app name', App_name, settings)
if settings == nil then return end
Settings = settings -- stash all settings into a global for on.save_settings
if settings[App_name] == nil then
return
end
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
for name, def in pairs(Definitions) do
--print(name, definition_file(name, manifest_version))
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
{"on_handle":547,"draw_run_time_error":808,"survey_animation":847,"sx":544,"animate_next":841,"on.update":835,"load_definition":716,"on.keychord_press":828,"animate_next_frame":825,"box_height":680,"schema1_of_y":667,"on.save_settings":742,"surface_bounds":814,"Ticks_font":669,"y_of_schema1":364,"set_mouse_cursor":562,"font":353,"table_and_array_both_empty":689,"Spawn_point":822,"from_viewport":823,"load_manifest":694,"interpolate_viewport":843,"order_of_magnitude":573,"on.text_input":834,"Manifest":769,"B":830,"Test_definition_color":850,"on.code_change":820,"get_manifest":768,"Cursor_node":172,"manifest_index":637,"approximate_up":658,"manifest_navigator_candidates":638,"Num_animation_frames":840,"new_definition":848,"add_thick_line":400,"update_editor_box":711,"copy_shape":396,"sy":469,"draw_manifest_navigator":677,"on.mouse_press":722,"Surface":422,"draw_cursor":639,"Definition_background_color":849,"Viewport":604,"add_hotkey_to_menu":616,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"draw_ticks":844,"approximate":579,"tick_spec":660,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"vy":546,"Menu_command_color":613,"Mouse_cursor":559,"Menu_highlight_color":614,"mouse_cursor":558,"draw_menu_bar":641,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"Page":475,"on.code_submit":787,"Manifest_navigator":495,"fw_app":"driver","line_height":365,"on.initialize":807,"Definitions":503,"delete_definition":673,"keychord_press_on_manifest_navigator":765,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"get_multiple_definitions_from_app":783,"manifest_navigator_down":635,"on":1,"compute_layout":385,"on.key_release":720,"move_candidate_to_front_of_manifest":632,"Animating":842,"wait_for_response":781,"text_input_on_manifest_navigator":634,"fw_parent":849,"A":831,"manifest_coord":636,"scale":712,"on.mouse_release":836,"reset_manifest_navigator":772,"on.draw":797,"vx":545}
{"Manifest":769,"Viewport":604,"approximate":579,"snapshot_canvas":913,"get_manifest":768,"copy_viewport":866,"on.save_settings":742,"sy":469,"approximate_up":658,"Definitions":503,"update_editor_box":711,"new_definition":848,"on.code_submit":787,"table_and_array_both_empty":689,"zoom_in":895,"Page":475,"schema1_of_y":667,"initialize_manifest_navigator":773,"y_of_schema1":364,"get_multiple_definitions_from_app":783,"wait_for_response":781,"Menu_background_color":611,"Menu_border_color":612,"on.text_input":855,"box_height":680,"fw_parent":914,"compute_layout":385,"fw_app":"driver","on.code_change":820,"on_text":539,"survey_animation":906,"animate_next":914,"scale":712,"sx":544,"vx":545,"load_from_iterator":670,"from_viewport":823,"get_definition_from_app":784,"Surface":422,"on_handle":547,"Ticks_font":669,"draw_menu_bar":861,"manifest_navigator_up":628,"copy_shape":396,"manifest_navigator_down":635,"surface_bounds":814,"Save_viewport":865,"delete_definition":673,"font":353,"move_candidate_to_front_of_manifest":632,"draw_cursor":639,"keychord_press_on_manifest_navigator":765,"on.update":900,"text_input_on_manifest_navigator":634,"Spawn_point":822,"zoom_out":908,"manifest_coord":636,"on.mouse_release":836,"manifest_index":637,"animate_next_frame":915,"manifest_navigator_candidates":638,"initialize_editor":678,"interpolate_viewport":843,"add_def_to_menu":640,"on.load_settings":782,"A":831,"maybe_update_key_in_definitions":529,"order_of_magnitude":573,"on.initialize":807,"on":1,"add_thick_line":400,"load_manifest":694,"on.key_release":720,"on.keychord_press":912,"Menu_highlight_color":614,"Num_animation_frames":840,"draw_run_time_error":808,"reset_manifest_navigator":772,"on.mouse_press":911,"num_lines_for_manifest_navigator":676,"draw_manifest_navigator":677,"mouse_cursor":558,"add_hotkey_to_menu":616,"Mouse_cursor":559,"tick_spec":660,"Definition_background_color":849,"Manifest_navigator":495,"set_mouse_cursor":562,"vy":546,"draw_ticks":862,"Test_definition_background_color":858,"Cursor_node":172,"definition_background_color":859,"Animating":842,"Menu_command_color":613,"Zoomed_out":869,"line_height":365,"B":830,"on.draw":885,"load_definition":854}
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":988,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":987,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":987,"zoom_out":908,"test_approximate_up":983,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":986,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":985,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
{"draw_cursor":639,"Manifest":769,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Cursor_node":172,"Surface":422,"add_thick_line":400,"Menu_highlight_color":614,"copy_shape":396,"vx":545,"add_hotkey_to_menu":616,"on.code_submit":947,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"on.load_settings":940,"maybe_update_key_in_definitions":529,"sy":954,"initialize_manifest_navigator":773,"load_from_iterator":670,"Page":475,"get_definition_from_app":784,"box_height":680,"draw_ticks":997,"get_multiple_definitions_from_app":783,"Definition_background_color":849,"manifest_navigator_up":628,"tick_spec":998,"manifest_navigator_down":635,"font":353,"Viewport":604,"delete_definition":673,"undo_zoom_out":921,"move_candidate_to_front_of_manifest":632,"on_handle":547,"keychord_press_on_manifest_navigator":765,"on.draw":986,"text_input_on_manifest_navigator":634,"on.mouse_press":916,"on_text":539,"manifest_coord":636,"test_approximate_up":983,"draw_load_time_error":929,"fw_parent":1007,"manifest_navigator_candidates":638,"draw_run_time_error":808,"Num_animation_frames":840,"add_def_to_menu":640,"compute_layout":385,"zoom_in":920,"survey_animation":1008,"get_default_map":937,"on.update":945,"y_of_schema1":364,"load_definition":854,"zoom_out":908,"on.key_release":720,"load_manifest":694,"on.keychord_press":919,"mouse_cursor":558,"scale":712,"Mouse_cursor":559,"B":830,"fw_app":"driver","on.text_input":855,"set_mouse_cursor":562,"initialize_editor":678,"interpolate_viewport":843,"iscale":953,"on":1,"from_viewport":823,"update_editor_box":711,"Definitions":503,"sx":955,"Ticks_font":669,"vy":956,"schema1_of_y":667,"animate_next":914,"A":831,"Menu_command_color":613,"on.code_change":924,"new_definition":848,"order_of_magnitude":573,"animate_next_frame":915,"Animating":842,"definition_background_color":859,"manifest_index":637,"approximate":579,"get_manifest":768,"on.mouse_release":836,"Failing_test_definition_background_color":925,"draw_test_failure_indicator":935,"reset_manifest_navigator":772,"surface_bounds":814,"wait_for_response":781,"on.save_settings":742,"approximate_up":985,"snapshot_canvas":913,"Test_definition_background_color":858,"Save_viewport":865,"draw_menu_bar":861,"copy_viewport":866,"Spawn_point":822,"table_and_array_both_empty":689,"Manifest_navigator":495,"on.initialize":948,"Zoomed_out":869}
on.text_input = function(t)
if Manifest_navigator.show then
text_input_on_manifest_navigator(t)
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.text_input(Cursor_node.editor, t)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
print(old_definition_name, definition_name)
if old_definition_name ~= definition_name or Definitions[old_definition_name] ~= Cursor_node then
if old_definition_name == nil then
local pos = array.find(Definitions, Cursor_node)
print('found at index', pos)
elseif Definitions[old_definition_name] == Cursor_node then
print('found at key', old_definition_name)
-- Definitions[old_definition] = nil
end
print('current definition name', definition_name)
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
end
A(--[[preserve screen_top of cursor node]] true)
end
end
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
print('AAA', chord)
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
print('CCC')
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-l' then
print('BBB')
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
animate_next_frame = function(state, dt)
if state.initial == nil then
state.initial = from_viewport(state)
-- once we've checked keys, pollute the keyspace
state.step = 0
state.frame_time = 0
return
end
state.frame_time = state.frame_time + dt
if state.frame_time > 0.01 then
state.frame_time = state.frame_time - 0.01
state.step = state.step+1
interpolate_viewport(state.initial, state, state.step)
B()
end
end
{"line_height":365,"on.key_release":720,"load_definition":854,"mouse_cursor":558,"box_height":680,"Mouse_cursor":559,"add_thick_line":400,"Failing_test_definition_background_color":925,"survey_animation":906,"on.load_settings":782,"animate_next":914,"on":1,"num_lines_for_manifest_navigator":676,"table_and_array_both_empty":689,"animate_next_frame":915,"order_of_magnitude":573,"load_from_iterator":670,"get_definition_from_app":784,"approximate":579,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"font":353,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"Ticks_font":669,"Manifest_navigator":495,"interpolate_viewport":843,"manifest_coord":636,"manifest_index":637,"Animating":842,"reset_manifest_navigator":772,"draw_run_time_error":808,"snapshot_canvas":913,"Menu_command_color":613,"draw_manifest_navigator":677,"Test_definition_background_color":858,"Surface":422,"Manifest":769,"Menu_background_color":611,"on.text_input":855,"on.code_change":924,"from_viewport":823,"get_manifest":768,"approximate_up":658,"initialize_editor":678,"on.draw":928,"draw_cursor":639,"Spawn_point":822,"Menu_border_color":612,"Definitions":503,"Definition_background_color":849,"new_definition":848,"Menu_highlight_color":614,"Save_viewport":865,"draw_menu_bar":861,"copy_viewport":866,"add_hotkey_to_menu":616,"definition_background_color":859,"zoom_out":908,"on.mouse_release":836,"Zoomed_out":869,"on.update":900,"undo_zoom_out":921,"on.keychord_press":919,"copy_shape":396,"compute_layout":385,"zoom_in":920,"Page":475,"maybe_update_key_in_definitions":529,"manifest_navigator_candidates":638,"Cursor_node":172,"surface_bounds":814,"add_def_to_menu":640,"sy":469,"Num_animation_frames":840,"fw_parent":927,"fw_app":"driver","draw_ticks":862,"load_manifest":694,"schema1_of_y":667,"update_editor_box":711,"on.code_submit":927,"wait_for_response":781,"vy":546,"on_handle":547,"y_of_schema1":364,"set_mouse_cursor":562,"text_input_on_manifest_navigator":634,"on.initialize":807,"initialize_manifest_navigator":773,"A":831,"on.mouse_press":916,"on_text":539,"tick_spec":660,"B":830,"get_multiple_definitions_from_app":783,"sx":544,"Viewport":604,"vx":545,"scale":712,"on.save_settings":742}
animate_next_frame = function(state, dt)
if state.initial == nil then
state.initial = Viewport[state.viewport_key]
state.step = 0
state.frame_time = 0
return
end
state.frame_time = state.frame_time + dt
if state.frame_time > 0.01 then
state.frame_time = state.frame_time - 0.01
state.step = state.step+1
Viewport[state.viewport_key] = (state.initial * (10 - state.step) + state.final * state.step) / 10
B()
end
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(0.6,0.6,0.6)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
print('draw', vx(x)+2,5)
love.graphics.print(('%2f'):format(x), vx(x)+2, Menu_bar_height+5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), 20)
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
end
end
end
draw_menu_bar()
end
on.update = function(dt)
--[[
if Animating then
if Animating.
Viewport[Animating.viewport_key] = Animating
return
end
-- ]]
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
A()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
on.code_change = function()
print('code changed')
--[[
Animating = {
step = 0, frame_time = 0,
step_increment = -0.05,
start = Viewport.zoom,
viewport_key = 'zoom',
} --]]
A() -- just in case we edited Page
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxy+19
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, iscale(App.screen.width))
print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, iscale(App.screen.height))
print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
{"on_handle":547,"draw_run_time_error":808,"survey_animation":847,"sx":544,"animate_next":841,"on.update":835,"load_definition":716,"on.keychord_press":828,"animate_next_frame":825,"box_height":680,"schema1_of_y":667,"on.save_settings":742,"surface_bounds":814,"Ticks_font":669,"y_of_schema1":364,"set_mouse_cursor":562,"font":353,"table_and_array_both_empty":689,"Spawn_point":822,"from_viewport":823,"load_manifest":694,"interpolate_viewport":843,"order_of_magnitude":573,"on.text_input":834,"Manifest":769,"B":830,"on.code_change":820,"get_manifest":768,"Cursor_node":172,"manifest_index":637,"approximate_up":658,"manifest_navigator_candidates":638,"Num_animation_frames":840,"new_definition":848,"add_thick_line":400,"update_editor_box":711,"copy_shape":396,"sy":469,"draw_manifest_navigator":677,"on.mouse_press":722,"Surface":422,"draw_cursor":639,"Definition_background_color":849,"Viewport":604,"add_hotkey_to_menu":616,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"draw_ticks":844,"approximate":579,"tick_spec":660,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"vy":546,"Menu_command_color":613,"Mouse_cursor":559,"Menu_highlight_color":614,"mouse_cursor":558,"draw_menu_bar":641,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"Page":475,"on.code_submit":787,"Manifest_navigator":495,"fw_app":"driver","line_height":365,"on.initialize":807,"Definitions":503,"delete_definition":673,"keychord_press_on_manifest_navigator":765,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"get_multiple_definitions_from_app":783,"manifest_navigator_down":635,"on":1,"compute_layout":385,"on.key_release":720,"move_candidate_to_front_of_manifest":632,"Animating":842,"wait_for_response":781,"text_input_on_manifest_navigator":634,"fw_parent":848,"A":831,"manifest_coord":636,"scale":712,"on.mouse_release":836,"reset_manifest_navigator":772,"on.draw":797,"vx":545}
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
if edit.load_time_error then
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h/2), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, 0)
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(obj.h/2))
end
end
end
draw_ticks()
draw_menu_bar()
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---', lo, hi, anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
--- -50 998.88888888889 3 1000 0 1000
print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
new_definition = function()
if Cursor_node then
Cursor_node.show_cursor = false
end
table.insert(Definitions, {
type='text',
data={''},
x=Spawn_point.x, y=Spawn_point.y,
width=600,
bg=Definition_background_color,
})
Viewport.x = Spawn_point.x-30
Viewport.y = Spawn_point.y-30
Cursor_node = Definitions[#Definitions]
Cursor_node.show_cursor = true
end
on.text_input = function(t)
if Manifest_navigator.show then
text_input_on_manifest_navigator(t)
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.text_input(Cursor_node.editor, t)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
print(old_definition_name, definition_name)
if old_definition_name ~= definition_name then
if old_definition_name == nil then
local pos = array.find(Definitions, Cursor_node)
print('found at index', pos)
elseif Definitions[old_definition_name] == Cursor_node then
print('found at key', old_definition_name)
-- Definitions[old_definition] = nil
end
print('current definition name', definition_name)
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
end
A(--[[preserve screen_top of cursor node]] true)
end
end
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
manifest_navigator_down = function()
local y, x, width = manifest_coord(Manifest_navigator.index)
local index = manifest_index(y+HUD_line_height, x, width)
if index then
Manifest_navigator.index = index
end
end
{"Manifest":769,"Viewport":604,"approximate":579,"snapshot_canvas":913,"get_manifest":768,"copy_viewport":866,"on.save_settings":742,"sy":469,"approximate_up":658,"Definitions":503,"update_editor_box":711,"new_definition":848,"on.code_submit":787,"table_and_array_both_empty":689,"zoom_in":895,"Page":475,"schema1_of_y":667,"initialize_manifest_navigator":773,"y_of_schema1":364,"get_multiple_definitions_from_app":783,"wait_for_response":781,"Menu_background_color":611,"Menu_border_color":612,"on.text_input":855,"box_height":680,"fw_parent":913,"compute_layout":385,"fw_app":"driver","on.code_change":820,"on_text":539,"survey_animation":906,"animate_next":914,"scale":712,"sx":544,"vx":545,"load_from_iterator":670,"from_viewport":823,"get_definition_from_app":784,"Surface":422,"on_handle":547,"Ticks_font":669,"draw_menu_bar":861,"manifest_navigator_up":628,"copy_shape":396,"manifest_navigator_down":635,"surface_bounds":814,"Save_viewport":865,"delete_definition":673,"font":353,"move_candidate_to_front_of_manifest":632,"draw_cursor":639,"keychord_press_on_manifest_navigator":765,"on.update":900,"text_input_on_manifest_navigator":634,"Spawn_point":822,"zoom_out":908,"manifest_coord":636,"on.mouse_release":836,"manifest_index":637,"animate_next_frame":902,"manifest_navigator_candidates":638,"initialize_editor":678,"interpolate_viewport":843,"add_def_to_menu":640,"on.load_settings":782,"A":831,"maybe_update_key_in_definitions":529,"order_of_magnitude":573,"on.initialize":807,"on":1,"add_thick_line":400,"load_manifest":694,"on.key_release":720,"on.keychord_press":912,"Menu_highlight_color":614,"Num_animation_frames":840,"draw_run_time_error":808,"reset_manifest_navigator":772,"on.mouse_press":911,"num_lines_for_manifest_navigator":676,"draw_manifest_navigator":677,"mouse_cursor":558,"add_hotkey_to_menu":616,"Mouse_cursor":559,"tick_spec":660,"Definition_background_color":849,"Manifest_navigator":495,"set_mouse_cursor":562,"vy":546,"draw_ticks":862,"Test_definition_background_color":858,"Cursor_node":172,"definition_background_color":859,"Animating":842,"Menu_command_color":613,"Zoomed_out":869,"line_height":365,"B":830,"on.draw":885,"load_definition":854}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(0.6,0.6,0.6)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
print('draw', vx(x)+2,5)
love.graphics.print(('%2.1f'):format(x), vx(x)+2, Menu_bar_height+5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
end
end
end
draw_menu_bar()
end
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
print('AAA', chord)
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-l' then
print('BBB')
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
animate_next = function(dt)
if Animating[1].step and Animating[1].step >= Num_animation_frames then
table.remove(Animating, 1)
if #Animating == 0 then
Animating = nil
Canvas = nil
A()
return
end
end
animate_next_frame(Animating[1], dt)
end
animate_next_frame = function(state, dt)
if state.start == nil then
state.initial = Viewport[state.viewport_key]
state.step = 0
state.frame_time = 0
return
end
state.frame_time = state.frame_time + dt
if state.frame_time > 0.01 then
state.frame_time = state.frame_time - 0.01
state.step = state.step+1
Viewport[state.viewport_key] = (state.initial * (10 - state.step) + state.final * state.step) / 10
B()
end
end
on.mouse_press = function(x,y, mouse_button)
if Animating then return end
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
if mouse_press_consumed_by_any_button_handler(HUD, x,y, mouse_button) then
return
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
local magnitude = 1
for i=1,zeros do
magnitude = magnitude*10
end
n = n + magnitude/2
for i=1,zeros do
n = n/10
end
n= math.ceil(n)
for i=1,zeros do
n = n*10
end
return n, magnitude
end
{"draw_cursor":639,"Manifest":769,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Cursor_node":172,"Surface":422,"add_thick_line":400,"Menu_highlight_color":614,"copy_shape":396,"vx":545,"add_hotkey_to_menu":616,"on.code_submit":947,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"on.load_settings":940,"maybe_update_key_in_definitions":529,"sy":954,"initialize_manifest_navigator":773,"load_from_iterator":670,"Page":475,"get_definition_from_app":784,"box_height":680,"draw_ticks":997,"get_multiple_definitions_from_app":783,"Definition_background_color":849,"manifest_navigator_up":628,"tick_spec":998,"manifest_navigator_down":635,"font":353,"Viewport":604,"delete_definition":673,"undo_zoom_out":921,"move_candidate_to_front_of_manifest":632,"on_handle":547,"keychord_press_on_manifest_navigator":765,"on.draw":986,"text_input_on_manifest_navigator":634,"on.mouse_press":916,"on_text":539,"manifest_coord":636,"test_approximate_up":983,"draw_load_time_error":929,"fw_parent":1006,"manifest_navigator_candidates":638,"draw_run_time_error":808,"Num_animation_frames":840,"add_def_to_menu":640,"compute_layout":385,"zoom_in":920,"survey_animation":1007,"get_default_map":937,"on.update":945,"y_of_schema1":364,"load_definition":854,"zoom_out":908,"on.key_release":720,"load_manifest":694,"on.keychord_press":919,"mouse_cursor":558,"scale":712,"Mouse_cursor":559,"B":830,"fw_app":"driver","on.text_input":855,"set_mouse_cursor":562,"initialize_editor":678,"interpolate_viewport":843,"iscale":953,"on":1,"from_viewport":823,"update_editor_box":711,"Definitions":503,"sx":955,"Ticks_font":669,"vy":956,"schema1_of_y":667,"animate_next":914,"A":831,"Menu_command_color":613,"on.code_change":924,"new_definition":848,"order_of_magnitude":573,"animate_next_frame":915,"Animating":842,"definition_background_color":859,"manifest_index":637,"approximate":579,"get_manifest":768,"on.mouse_release":836,"Failing_test_definition_background_color":925,"draw_test_failure_indicator":935,"reset_manifest_navigator":772,"surface_bounds":814,"wait_for_response":781,"on.save_settings":742,"approximate_up":985,"snapshot_canvas":913,"Test_definition_background_color":858,"Save_viewport":865,"draw_menu_bar":861,"copy_viewport":866,"Spawn_point":822,"table_and_array_both_empty":689,"Manifest_navigator":495,"on.initialize":948,"Zoomed_out":869}
load_manifest = function()
-- Connect to an app and load its manifest into global Manifest.
-- Also return the name of the app we have connected to.
local new_manifest, app_name = get_manifest()
-- preserve existing order
-- 1. add new definitions in front
for _,name in ipairs(new_manifest) do
if not array.find(Manifest, name) then
table.insert(Manifest, 1, name)
end
end
-- 2. remove missing definitions
for idx=#Manifest,1,-1 do
local name = Manifest[idx]
if not array.find(new_manifest, name) then
table.remove(Manifest, idx)
end
end
return app_name
end
snapshot_canvas = function()
-- Render the canvas at pixel perfect resolution.
local winw,winh = App.screen.width, App.screen.height
App.screen.width,App.screen.height = Global_viewport.w, Global_viewport.h
local saved_viewport = Viewport
Viewport = copy_viewport(Global_viewport)
Viewport.zoom = 1.0
A()
love.graphics.setCanvas(Canvas)
App.fake_key_press = true -- Hack; disable drawing the menu and ticks
on.draw()
App.fake_key_press = nil
love.graphics.setCanvas()
Viewport = saved_viewport
App.screen.width,App.screen.height = winw,winh
end
Canvas = love.graphics.newCanvas(Global_viewport.w, Global_viewport.h)
{"on_handle":547,"draw_run_time_error":808,"survey_animation":847,"sx":544,"animate_next":841,"on.update":835,"load_definition":716,"on.keychord_press":828,"animate_next_frame":825,"box_height":680,"schema1_of_y":667,"on.save_settings":742,"surface_bounds":814,"Ticks_font":669,"y_of_schema1":364,"set_mouse_cursor":562,"font":353,"table_and_array_both_empty":689,"Spawn_point":822,"from_viewport":823,"load_manifest":694,"interpolate_viewport":843,"order_of_magnitude":573,"on.text_input":834,"Manifest":769,"B":830,"on.code_change":820,"get_manifest":768,"Cursor_node":172,"manifest_index":637,"approximate_up":658,"manifest_navigator_candidates":638,"Num_animation_frames":840,"new_definition":848,"add_thick_line":400,"update_editor_box":711,"copy_shape":396,"sy":469,"draw_manifest_navigator":677,"on.mouse_press":722,"Surface":422,"draw_cursor":639,"Viewport":604,"add_hotkey_to_menu":616,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"draw_ticks":844,"approximate":579,"tick_spec":660,"Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"vy":546,"Menu_command_color":613,"Mouse_cursor":559,"Menu_highlight_color":614,"mouse_cursor":558,"draw_menu_bar":641,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"initialize_editor":678,"Page":475,"on.code_submit":787,"Manifest_navigator":495,"fw_app":"driver","line_height":365,"on.initialize":807,"Definitions":503,"delete_definition":673,"keychord_press_on_manifest_navigator":765,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"get_multiple_definitions_from_app":783,"manifest_navigator_down":635,"on":1,"compute_layout":385,"on.key_release":720,"move_candidate_to_front_of_manifest":632,"Animating":842,"wait_for_response":781,"text_input_on_manifest_navigator":634,"fw_parent":847,"A":831,"manifest_coord":636,"scale":712,"on.mouse_release":836,"reset_manifest_navigator":772,"on.draw":797,"vx":545}
on.text_input = function(t)
if Manifest_navigator.show then
text_input_on_manifest_navigator(t)
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.text_input(Cursor_node.editor, t)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
if old_definition_name ~= definition_name then
if old_definition_name == nil then
local pos = array.find(Definitions, Cursor_node)
print('found at index', pos)
elseif Definitions[old_definition_name] == Cursor_node then
print('found at key', old_definition_name)
-- Definitions[old_definition] = nil
end
print('current definition name', definition_name)
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
end
A(--[[preserve screen_top of cursor node]] true)
end
end
on_handle = function(x,y)
for _,node in ipairs(Surface) do
if node.type == 'text' then
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), obj.w/2-5, 20)
if x >= vx(node.x) and node.w and x < vx(node.x + node.w/2-5) then
if y >= vy(node.y-30) and node.h and y < vy(node.y-10) then
return node
end
end
end
end
end
manifest_navigator_up = function()
local y, x, width = manifest_coord(Manifest_navigator.index)
local index = manifest_index(y-HUD_line_height, x, width)
if index then
Manifest_navigator.index = index
end
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(0.6,0.6,0.6)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
print('draw', vx(x)+2,5)
love.graphics.print(('%2.1e'):format(x), vx(x)+2, Menu_bar_height+5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxy+20
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
definition_file = function(name, manifest_version)
return love.filesystem.getSaveDirectory():gsub(love.filesystem.getIdentity()..'$', App_name)..'/'..live.versioned_filename(manifest_version[name], name)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":986,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":987,"zoom_out":908,"test_approximate_up":983,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":986,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":985,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
on.mouse_release = function(x,y, mouse_button)
if Animating then return end
if Pan then
Pan = nil
elseif Move then
Move = nil
elseif Cursor_node then
Cursor_node.show_cursor = true
edit.mouse_release(Cursor_node.editor, x,y, mouse_button)
end
end
animate_next = function(dt)
if Animating[1].step and Animating[1].step >= 10 then
table.remove(Animating, 1)
if #Animating == 0 then
Animating = nil
return
end
end
animate_next_frame(Animating[1], dt)
end
Canvas = nil
A()
on.load_settings = function(settings)
local manifest_version
App_name, manifest_version = load_manifest()
print('app name', App_name, settings)
if settings == nil then return end
Settings = settings -- stash all settings into a global for on.save_settings
if settings[App_name] == nil then
return
end
Viewport = settings[App_name].viewport
Definitions = settings[App_name].definitions
for name, def in pairs(Definitions) do
def.data = load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+"))
end
end
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
print('AAA', chord)
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"on_text":539,"approximate":579,"on.mouse_press":911,"on.code_submit":787,"vx":545,"approximate_up":658,"on.key_release":720,"box_height":680,"compute_layout":385,"get_multiple_definitions_from_app":783,"on.code_change":820,"mouse_cursor":558,"wait_for_response":781,"vy":546,"draw_cursor":639,"load_definition":854,"on.text_input":855,"Menu_background_color":611,"draw_run_time_error":808,"Menu_border_color":612,"A":831,"Menu_command_color":613,"Menu_highlight_color":614,"B":830,"animate_next":910,"sy":469,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"Cursor_node":172,"num_lines_for_manifest_navigator":676,"initialize_manifest_navigator":773,"Animating":842,"reset_manifest_navigator":772,"draw_ticks":862,"line_height":365,"load_from_iterator":670,"survey_animation":906,"snapshot_canvas":913,"manifest_coord":636,"Test_definition_background_color":858,"y_of_schema1":364,"manifest_navigator_up":628,"tick_spec":660,"manifest_navigator_down":635,"add_def_to_menu":640,"fw_parent":912,"delete_definition":673,"fw_app":"driver","move_candidate_to_front_of_manifest":632,"scale":712,"Manifest":769,"on.save_settings":742,"text_input_on_manifest_navigator":634,"load_manifest":694,"sx":544,"get_manifest":768,"Manifest_navigator":495,"manifest_index":637,"on":1,"Mouse_cursor":559,"Definition_background_color":849,"Zoomed_out":869,"Definitions":503,"set_mouse_cursor":562,"new_definition":848,"update_editor_box":711,"manifest_navigator_candidates":638,"definition_background_color":859,"surface_bounds":814,"Num_animation_frames":840,"keychord_press_on_manifest_navigator":765,"on.draw":885,"add_thick_line":400,"on.initialize":807,"schema1_of_y":667,"Viewport":604,"order_of_magnitude":573,"Spawn_point":822,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"on.load_settings":782,"interpolate_viewport":843,"initialize_editor":678,"copy_viewport":866,"animate_next_frame":902,"on.mouse_release":836,"zoom_out":908,"on.update":900,"get_definition_from_app":784,"on.keychord_press":912,"font":353,"Save_viewport":865,"copy_shape":396,"Page":475,"zoom_in":895,"draw_menu_bar":861,"Ticks_font":669,"on_handle":547,"Surface":422,"from_viewport":823}
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), obj.w/2-5, 20)
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
end
end
end
draw_menu_bar()
end
get_manifest = function()
live.send_to_app('MANIFEST')
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
local result = {}
if #response_string == 0 then
-- error; retry
return result
else
-- stop retrying
Manifest_navigator.reload = false
end
local app_name
local response = json.decode(response_string)
for name, value in pairs(response) do
if not starts_with(name, 'fw_') then
table.insert(result, name)
elseif name == 'fw_app' then
app_name = value
end
end
return result, app
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(0.6,0.6,0.6)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
print('draw', vx(x)+2,5)
love.graphics.print(('%2.1f'):format(x), vx(x)+2, Menu_bar_height+5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
on.draw = function()
if Animating then
local q = love.graphics.newQuad((Viewport.x-Global_viewport.x)*Viewport.zoom,(Viewport.y-Global_viewport.y)*Viewport.zoom, App.screen.width, App.screen.height, Global_viewport.w*Viewport.zoom, Global_viewport.h*Viewport.zoom)
App.color{r=1,g=1,b=1}
love.graphics.draw(Canvas, q, 0,0)
return
end
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
draw_load_time_error(obj)
end
end
end
draw_run_time_error()
draw_test_failure_indicator()
draw_ticks()
draw_menu_bar()
end
on.text_input = function(t)
if Manifest_navigator.show then
text_input_on_manifest_navigator(t)
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.text_input(Cursor_node.editor, t)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
end
end
function manifest_navigator_up()
local y, x, width = manifest_coord(Manifest_navigator.index)
local index = manifest_index(y-HUD_line_height, x, width)
if index then
Manifest_navigator.index = index
end
end
{"Menu_background_color":611,"on.code_change":924,"Menu_border_color":612,"table_and_array_both_empty":689,"Test_definition_background_color":858,"definition_background_color":859,"add_hotkey_to_menu":616,"Surface":422,"maybe_update_key_in_definitions":529,"vx":545,"Save_viewport":865,"manifest_navigator_down":635,"initialize_editor":678,"zoom_out":908,"move_candidate_to_front_of_manifest":632,"Zoomed_out":869,"text_input_on_manifest_navigator":634,"line_height":365,"manifest_coord":636,"Page":475,"manifest_index":637,"manifest_navigator_candidates":638,"scale":712,"on_text":539,"add_def_to_menu":640,"get_multiple_definitions_from_app":783,"Manifest":769,"undo_zoom_out":921,"wait_for_response":781,"fw_parent":1005,"get_manifest":768,"Failing_test_definition_background_color":925,"on":1,"Animating":842,"on.draw":986,"draw_load_time_error":929,"draw_run_time_error":808,"draw_test_failure_indicator":935,"new_definition":848,"draw_menu_bar":861,"mouse_cursor":558,"Menu_highlight_color":614,"Mouse_cursor":559,"compute_layout":385,"get_default_map":937,"on.code_submit":947,"num_lines_for_manifest_navigator":676,"Menu_command_color":613,"survey_animation":1006,"Definitions":503,"animate_next":914,"reset_manifest_navigator":772,"load_from_iterator":670,"approximate":579,"get_definition_from_app":784,"draw_manifest_navigator":677,"order_of_magnitude":573,"on.initialize":948,"Manifest_navigator":495,"fw_app":"driver","initialize_manifest_navigator":773,"iscale":953,"animate_next_frame":915,"on_handle":547,"delete_definition":673,"set_mouse_cursor":562,"sx":955,"manifest_navigator_up":628,"keychord_press_on_manifest_navigator":765,"copy_viewport":866,"draw_cursor":639,"font":353,"y_of_schema1":364,"on.key_release":720,"Ticks_font":669,"Spawn_point":822,"surface_bounds":814,"from_viewport":823,"snapshot_canvas":913,"interpolate_viewport":843,"on.save_settings":742,"copy_shape":396,"load_manifest":694,"on.mouse_press":916,"add_thick_line":400,"on.text_input":855,"approximate_up":985,"B":830,"on.mouse_release":836,"on.keychord_press":919,"Viewport":604,"vy":956,"update_editor_box":711,"Cursor_node":172,"load_definition":854,"schema1_of_y":667,"on.update":945,"zoom_in":920,"Num_animation_frames":840,"test_approximate_up":983,"A":831,"tick_spec":998,"Definition_background_color":849,"draw_ticks":997,"box_height":680,"sy":954,"on.load_settings":940}
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
if old_definition_name ~= definition_name then
if old_definition_name == nil then
local pos = array.find(Definitions, Cursor_node)
print('found at index', pos)
elseif Definitions[old_definition_name] == Cursor_node then
print('found at key', old_definition_name)
-- Definitions[old_definition] = nil
end
print('current definition name', definition_name)
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---', lo, hi, anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
draw_run_time_error = function()
if Run_time_error == nil then return end
local height = math.min(20*HUD_line_height, App.screen.height*0.2)
App.color{r=0.8,g=0,b=0}
love.graphics.rectangle('fill', 0, App.screen.height - height-10, App.screen.width, height+10)
App.color{r=0,g=0,b=0}
love.graphics.print(Run_time_error, 30, App.screen.height - height)
end
on.initialize = function()
if table_and_array_both_empty(Definitions) then
new_definition()
else
end
end
survey_animation() -- calls A internally
A()
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), obj.w, 20)
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
end
end
end
draw_menu_bar()
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxy+15
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(0.7,0.7,0.7)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
print('draw', vx(x)+2,5)
love.graphics.print(('%2.1f'):format(x), vx(x)+2, Menu_bar_height+5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
on.keychord_press = function(chord, key)
print('key', chord)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-g' then
-- special Expose-like 'global zoom' mode
-- if Zoomed_out == nil then
print('C-g 1', Viewport.x)
zoom_out()
print(Animating)
-- else
-- Animation = {
-- Save_viewport,
-- }
-- Save_viewport = nil
-- Zoomed_out = nil
-- end
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":985,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":983,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":986,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":985,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
get_manifest = function()
live.send_to_app('MANIFEST')
local response
repeat
love.timer.sleep(0.01)
response = live.receive_from_app()
until response
local result = {}
if #response == 0 then
-- error; retry
return result
else
-- stop retrying
Manifest_navigator.reload = false
end
local app_name
local manifest_version = json.decode(response)
for name, value in pairs(manifest_version) do
if not starts_with(name, 'fw_') then
table.insert(result, name)
elseif name == 'fw_app' then
app_name = value
end
end
print('get manifest', manifest_version)
return result, app_name, manifest_version
end
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
print(obj.x, obj.y)
love.graphics.rectangle('fill', obj.x,obj.y-30, obj.w, 20)
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
end
end
end
draw_menu_bar()
end
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
print('current definition name', definition_name)
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"add_hotkey_to_menu":616,"iscale":953,"on.update":945,"sy":954,"reset_manifest_navigator":772,"survey_animation":1005,"load_from_iterator":670,"animate_next":914,"get_definition_from_app":784,"Viewport":604,"line_height":365,"add_thick_line":400,"test_approximate_up":983,"copy_shape":396,"manifest_navigator_down":635,"Manifest":769,"fw_parent":1004,"on.mouse_press":916,"load_manifest":694,"on.mouse_release":836,"keychord_press_on_manifest_navigator":765,"surface_bounds":814,"on.keychord_press":919,"manifest_coord":636,"Save_viewport":865,"new_definition":848,"manifest_navigator_candidates":638,"Spawn_point":822,"add_def_to_menu":640,"Zoomed_out":869,"zoom_in":920,"B":830,"initialize_editor":678,"maybe_update_key_in_definitions":529,"scale":712,"on.draw":986,"box_height":680,"move_candidate_to_front_of_manifest":632,"Num_animation_frames":840,"tick_spec":998,"vy":956,"manifest_index":637,"Surface":422,"schema1_of_y":667,"on.code_change":924,"on.text_input":855,"vx":545,"order_of_magnitude":573,"Definitions":503,"Definition_background_color":849,"on_handle":547,"update_editor_box":711,"Test_definition_background_color":858,"interpolate_viewport":843,"load_definition":854,"on_text":539,"definition_background_color":859,"font":353,"on":1,"from_viewport":823,"Page":475,"sx":955,"delete_definition":673,"on.load_settings":940,"zoom_out":908,"on.save_settings":742,"snapshot_canvas":913,"approximate_up":985,"num_lines_for_manifest_navigator":676,"Failing_test_definition_background_color":925,"mouse_cursor":558,"on.key_release":720,"Ticks_font":669,"table_and_array_both_empty":689,"undo_zoom_out":921,"on.initialize":948,"draw_cursor":639,"Mouse_cursor":559,"copy_viewport":866,"get_manifest":768,"manifest_navigator_up":628,"set_mouse_cursor":562,"draw_ticks":997,"animate_next_frame":915,"draw_load_time_error":929,"initialize_manifest_navigator":773,"draw_test_failure_indicator":935,"text_input_on_manifest_navigator":634,"compute_layout":385,"fw_app":"driver","Manifest_navigator":495,"get_multiple_definitions_from_app":783,"y_of_schema1":364,"get_default_map":937,"draw_manifest_navigator":677,"wait_for_response":781,"approximate":579,"Menu_background_color":611,"Cursor_node":172,"Menu_border_color":612,"A":831,"Menu_command_color":613,"on.code_submit":947,"Menu_highlight_color":614,"draw_run_time_error":808,"draw_menu_bar":861,"Animating":842}
{"initialize_manifest_navigator":773,"mouse_cursor":558,"Mouse_cursor":559,"tick_spec":660,"copy_shape":396,"get_multiple_definitions_from_app":783,"set_mouse_cursor":562,"Cursor_node":172,"wait_for_response":781,"order_of_magnitude":573,"load_definition":854,"font":353,"approximate":579,"box_height":680,"draw_run_time_error":808,"compute_layout":385,"on":1,"survey_animation":906,"on.load_settings":782,"animate_next":910,"Save_viewport":865,"copy_viewport":866,"Ticks_font":669,"table_and_array_both_empty":689,"zoom_out":908,"Zoomed_out":869,"zoom_in":895,"surface_bounds":814,"initialize_editor":678,"get_manifest":768,"Spawn_point":822,"animate_next_frame":902,"from_viewport":823,"manifest_navigator_up":628,"interpolate_viewport":843,"Definitions":503,"Menu_border_color":612,"new_definition":848,"Menu_command_color":613,"maybe_update_key_in_definitions":529,"Animating":842,"B":830,"draw_menu_bar":861,"fw_app":"driver","add_hotkey_to_menu":616,"Menu_background_color":611,"Menu_highlight_color":614,"draw_manifest_navigator":677,"Manifest":769,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"on.code_change":820,"reset_manifest_navigator":772,"sy":469,"fw_parent":911,"load_from_iterator":670,"update_editor_box":711,"get_definition_from_app":784,"on.draw":885,"on.key_release":720,"y_of_schema1":364,"approximate_up":658,"Definition_background_color":849,"Surface":422,"manifest_navigator_down":635,"Manifest_navigator":495,"on.code_submit":787,"delete_definition":673,"on.initialize":807,"move_candidate_to_front_of_manifest":632,"on_handle":547,"keychord_press_on_manifest_navigator":765,"vy":546,"text_input_on_manifest_navigator":634,"Num_animation_frames":840,"on_text":539,"manifest_coord":636,"on.mouse_press":911,"manifest_index":637,"draw_cursor":639,"manifest_navigator_candidates":638,"on.update":900,"Viewport":604,"sx":544,"load_manifest":694,"vx":545,"on.save_settings":742,"scale":712,"add_def_to_menu":640,"on.mouse_release":836,"Test_definition_background_color":858,"definition_background_color":859,"on.text_input":855,"snapshot_canvas":872,"on.keychord_press":912,"line_height":365,"draw_ticks":862,"A":831,"Page":475,"add_thick_line":400}
get_definition_from_app = function(name)
live.send_to_app('GET '..name)
local response_string
repeat
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
return response_string
end
on.keychord_press = function(chord, key)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---', lo, hi, anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---', lo, hi, order_of_magniude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(1,0,0)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
print('draw', vx(x)+2,5)
love.graphics.print(('%2.1f'):format(x), vx(x)+2, Menu_bar_height+5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":984,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":983,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":985,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
on.text_input = function(t)
if Manifest_navigator.show then
text_input_on_manifest_navigator(t)
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.text_input(Cursor_node.editor, t)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
print('current definition name', definition_name)
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
A(--[[preserve screen_top of cursor node]] true)
end
end
on.mouse_press = function(x,y, mouse_button)
if Animating then return end
print('mouse press')
if Zoomed_out then
print('zoom out', Viewport.zoom)
zoom_in(x,y)
return
end
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
if mouse_press_consumed_by_any_button_handler(HUD, x,y, mouse_button) then
return
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', obj.x,obj.y-30, obj.w, 20)
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
end
end
end
draw_menu_bar()
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxy+25
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
-- step 1: scale down
for i=1,zeros do
n = n/10
end
n = math.ceil(n)
if n == 0 then n = 1 end
-- step 2: scale back up
local magnitude = 1
for i=1,zeros do
n = n*10
magnitude = magnitude*10
end
return n, magnitude
end
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
load_from_iterator = function(f)
local result = {}
local i,line,drawing = 0, ''
while true do
local line = f()
if line == nil then break end
table.insert(result, {data=line})
end
if #result == 0 then
table.insert(result, {data=''})
end
return result
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(1,0,0)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
print('draw', vx(x)+2,5)
love.graphics.print(('%2.1f'):format(x), vx(x)+2, 5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
on.draw = function()
love.graphics.setColor(1,0,0)
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle(obj.x,obj.y-30, obj.w, 20)
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
end
end
end
draw_menu_bar()
end
on.code_change = function()
print('code changed')
--print(definition_file('Angle'))
--[[
Animating = {
step = 0, frame_time = 0,
step_increment = -0.05,
start = Viewport.zoom,
viewport_key = 'zoom',
} --]]
A() -- just in case we edited Page
end
{"on.save_settings":742,"on.load_settings":782,"add_thick_line":400,"copy_shape":396,"compute_layout":385,"survey_animation":906,"draw_menu_bar":861,"animate_next":910,"on.initialize":807,"draw_manifest_navigator":677,"load_manifest":694,"reset_manifest_navigator":772,"on_handle":547,"load_from_iterator":670,"fw_app":"driver","get_definition_from_app":784,"on_text":539,"on":1,"update_editor_box":711,"manifest_navigator_down":635,"sx":544,"Cursor_node":172,"delete_definition":673,"on.mouse_release":836,"move_candidate_to_front_of_manifest":632,"from_viewport":823,"keychord_press_on_manifest_navigator":765,"get_manifest":768,"text_input_on_manifest_navigator":634,"Animating":842,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on.mouse_press":911,"Definition_background_color":849,"add_def_to_menu":640,"set_mouse_cursor":562,"Test_definition_background_color":858,"on.code_change":820,"definition_background_color":859,"Num_animation_frames":840,"zoom_in":895,"schema1_of_y":667,"snapshot_canvas":872,"scale":712,"Save_viewport":865,"tick_spec":660,"copy_viewport":866,"draw_cursor":639,"zoom_out":908,"on.keychord_press":897,"Zoomed_out":869,"sy":469,"font":353,"table_and_array_both_empty":689,"interpolate_viewport":843,"Page":475,"Menu_highlight_color":614,"draw_ticks":862,"Manifest":769,"on.update":900,"Mouse_cursor":559,"Manifest_navigator":495,"mouse_cursor":558,"Viewport":604,"order_of_magnitude":573,"on.text_input":855,"vy":546,"on.code_submit":787,"Surface":422,"approximate_up":658,"initialize_editor":678,"y_of_schema1":364,"Spawn_point":822,"on.key_release":720,"Ticks_font":669,"initialize_manifest_navigator":773,"on.draw":885,"Menu_border_color":612,"fw_parent":910,"Menu_command_color":613,"vx":545,"line_height":365,"surface_bounds":814,"A":831,"add_hotkey_to_menu":616,"Definitions":503,"draw_run_time_error":808,"load_definition":854,"Menu_background_color":611,"approximate":579,"num_lines_for_manifest_navigator":676,"wait_for_response":781,"new_definition":848,"get_multiple_definitions_from_app":783,"box_height":680,"B":830,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"animate_next_frame":902}
animate_next_frame = function(state, dt)
if state.start == nil then
state.start = Viewport[state.viewport_key]
state.step = 0
state.frame_time = 0
return
end
state.frame_time = state.frame_time + dt
if state.frame_time > 0.01 then
state.frame_time = state.frame_time - 0.01
state.step = state.step+1
Viewport[state.viewport_key] = (state.initial * (10 - state.step) + state.final * state.step) / 10
B()
end
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":983,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":983,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":984,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
{"approximate_up":985,"iscale":953,"Viewport":604,"sy":954,"Ticks_font":669,"Manifest_navigator":495,"Definition_background_color":849,"on.mouse_release":836,"test_approximate_up":983,"on.keychord_press":919,"definition_background_color":859,"on.code_submit":947,"tick_spec":998,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Surface":422,"Menu_highlight_color":614,"schema1_of_y":667,"draw_menu_bar":861,"Zoomed_out":869,"add_hotkey_to_menu":616,"new_definition":848,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"load_definition":854,"get_multiple_definitions_from_app":783,"reset_manifest_navigator":772,"add_thick_line":400,"maybe_update_key_in_definitions":529,"load_from_iterator":670,"Page":475,"get_definition_from_app":784,"vx":545,"on.mouse_press":916,"initialize_manifest_navigator":773,"on.save_settings":742,"manifest_navigator_up":628,"on.load_settings":940,"manifest_navigator_down":635,"Manifest":769,"Cursor_node":172,"delete_definition":673,"fw_parent":1003,"move_candidate_to_front_of_manifest":632,"fw_app":"driver","on.initialize":948,"on_handle":547,"text_input_on_manifest_navigator":634,"add_def_to_menu":640,"get_manifest":768,"manifest_coord":636,"load_manifest":694,"draw_run_time_error":808,"sx":955,"manifest_navigator_candidates":638,"Save_viewport":865,"on.update":945,"survey_animation":1004,"compute_layout":385,"animate_next":914,"font":353,"zoom_in":920,"Mouse_cursor":559,"table_and_array_both_empty":689,"get_default_map":937,"animate_next_frame":915,"y_of_schema1":364,"zoom_out":908,"wait_for_response":781,"copy_viewport":866,"on_text":539,"undo_zoom_out":921,"draw_cursor":639,"on.key_release":720,"mouse_cursor":558,"surface_bounds":814,"Failing_test_definition_background_color":925,"Animating":842,"snapshot_canvas":913,"scale":712,"set_mouse_cursor":562,"draw_load_time_error":929,"draw_ticks":997,"draw_test_failure_indicator":935,"Spawn_point":822,"copy_shape":396,"from_viewport":823,"on":1,"interpolate_viewport":843,"Test_definition_background_color":858,"update_editor_box":711,"Definitions":503,"order_of_magnitude":573,"B":830,"on.text_input":855,"on.code_change":924,"initialize_editor":678,"approximate":579,"manifest_index":637,"vy":956,"line_height":365,"Num_animation_frames":840,"A":831,"box_height":680,"on.draw":986,"keychord_press_on_manifest_navigator":765}
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
-- step 1: scale down
for i=1,zeros do
n = n/10
end
n = math.ceil(n)
if n == 0 then n = 1 end
-- step 2: scale back up
for i=1,zeros do
n = n*10
magnitude = magnitude*10
end
return n, magnitude
end
test_approximate_up = function()
check_eq(approximate_up(12, 1), 20, 'easy case')
-- when scale down ends up at 0
check_eq(approximate_up(2, 1), 10, 'below 5')
check_eq(approximate_up(7, 1), 10, 'above 5')
end
function keychord_press_on_manifest_navigator(chord, key)
if chord == 'escape' then
reset_manifest_navigator()
elseif chord == 'return' then
if Manifest_navigator.delete then
delete_definition(Manifest_navigator.candidates[Manifest_navigator.index])
else
load_definition(Manifest_navigator.candidates[Manifest_navigator.index])
end
elseif chord == 'backspace' then
local len = utf8.len(Manifest_navigator.filter)
local byte_offset = Text.offset(Manifest_navigator.filter, len)
Manifest_navigator.filter = string.sub(Manifest_navigator.filter, 1, byte_offset-1)
Manifest_navigator.index = 1
Manifest_navigator.candidates = manifest_navigator_candidates()
elseif chord == 'left' then
if Manifest_navigator.index > 1 then
Manifest_navigator.index = Manifest_navigator.index-1
end
elseif chord == 'right' then
if Manifest_navigator.index < #Manifest_navigator.candidates then
Manifest_navigator.index = Manifest_navigator.index+1
end
elseif chord == 'down' then
manifest_navigator_down()
elseif chord == 'up' then
manifest_navigator_up()
end
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(0.7,0.7,0.7)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
print('draw', vx(x)+2,5)
love.graphics.print(('%2.1f'):format(x), vx(x)+2, 5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---', lo, hi, anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---', lo, hi, anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
reset_manifest_navigator = function()
Manifest_navigator.show = false
Manifest_navigator.index = 1
Manifest_navigator.filter = ''
Manifest_navigator.candidates = Manifest
Manifest_navigator.num_lines = num_lines_for_manifest_navigator(Manifest_navigator.candidates)
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxy+50
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"Cursor_node":172,"load_definition":854,"approximate":579,"Definition_background_color":849,"update_editor_box":711,"on.code_submit":787,"Test_definition_background_color":858,"on.load_settings":782,"approximate_up":658,"sy":469,"initialize_manifest_navigator":773,"schema1_of_y":667,"box_height":680,"compute_layout":385,"get_multiple_definitions_from_app":783,"snapshot_canvas":872,"Save_viewport":865,"wait_for_response":781,"on.mouse_release":836,"on.text_input":855,"zoom_out":908,"Zoomed_out":869,"zoom_in":895,"Viewport":604,"Menu_background_color":611,"Menu_border_color":612,"load_manifest":694,"Menu_command_color":613,"get_manifest":768,"initialize_editor":678,"draw_menu_bar":861,"scale":712,"Definitions":503,"draw_manifest_navigator":677,"new_definition":848,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"copy_viewport":866,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":784,"copy_shape":396,"sx":544,"Manifest_navigator":495,"draw_run_time_error":808,"manifest_navigator_up":628,"maybe_update_key_in_definitions":529,"manifest_navigator_down":635,"line_height":365,"survey_animation":906,"delete_definition":673,"animate_next":910,"move_candidate_to_front_of_manifest":632,"B":830,"keychord_press_on_manifest_navigator":765,"on_handle":547,"text_input_on_manifest_navigator":634,"animate_next_frame":902,"on.code_change":820,"manifest_coord":636,"on_text":539,"manifest_index":637,"on.mouse_press":893,"manifest_navigator_candidates":638,"A":831,"Surface":422,"add_def_to_menu":640,"surface_bounds":814,"on.initialize":807,"vx":545,"fw_parent":909,"Ticks_font":669,"fw_app":"driver","on.draw":885,"draw_cursor":639,"on.key_release":720,"Spawn_point":822,"Animating":842,"from_viewport":823,"y_of_schema1":364,"interpolate_viewport":843,"add_hotkey_to_menu":616,"on":1,"order_of_magnitude":573,"mouse_cursor":558,"definition_background_color":859,"Mouse_cursor":559,"tick_spec":660,"on.update":900,"set_mouse_cursor":562,"on.keychord_press":897,"Manifest":769,"draw_ticks":862,"Menu_highlight_color":614,"Page":475,"on.save_settings":742,"vy":546,"Num_animation_frames":840,"table_and_array_both_empty":689,"font":353}
animate_next_frame(state, dt)
if state.start == nil then
state.start = Viewport[state.viewport_key]
state.step = 0
state.frame_time = 0
return
end
state.frame_time = state.frame_time + dt
if state.frame_time > 0.01 then
state.frame_time = state.frame_time - 0.01
state.step = state.step+1
Viewport[state.viewport_key] = (state.initial * (10 - state.step) + state.final * state.step) / 10
B()
end
end
animate_next = function(dt)
print('animate_next', Animating[1].step)
if Animating[1].step and Animating[1].step >= Num_animation_frames then
print('animate_next A')
table.remove(Animating, 1)
if #Animating == 0 then
Animating = nil
Canvas = nil
A()
return
end
end
print('animate_next B', Viewport.x, Viewport.zoom)
animate_next_frame(Animating[1], dt)
end
get_definition_from_app = function(name)
live.send_to_app('GET '..name)
local response_string
repeat
print('a')
love.timer.sleep(0.01)
response_string = live.receive_from_app()
until response_string
return response_string
end
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(0.7,0.7,0.7)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.1f'):format(x), vx(x)+2, 5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":982,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":983,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
on.keychord_press = function(chord, key)
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
print('current definition name', definition_name)
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"copy_shape":396,"load_definition":854,"Animating":842,"approximate":579,"initialize_editor":678,"box_height":680,"on.save_settings":742,"draw_cursor":639,"sy":954,"Ticks_font":669,"draw_run_time_error":808,"survey_animation":1003,"animate_next":914,"animate_next_frame":915,"on.text_input":855,"undo_zoom_out":921,"load_manifest":694,"on.initialize":948,"get_manifest":768,"A":831,"Failing_test_definition_background_color":925,"fw_app":"driver","surface_bounds":814,"Menu_background_color":611,"Definitions":503,"iscale":953,"draw_test_failure_indicator":935,"Menu_command_color":613,"on.code_submit":947,"Menu_highlight_color":614,"draw_load_time_error":929,"Spawn_point":822,"B":830,"from_viewport":823,"vy":956,"interpolate_viewport":843,"draw_manifest_navigator":677,"test_approximate_up":983,"num_lines_for_manifest_navigator":676,"on.code_change":924,"manifest_navigator_candidates":638,"maybe_update_key_in_definitions":529,"manifest_index":637,"Viewport":604,"load_from_iterator":670,"approximate_up":985,"get_definition_from_app":784,"manifest_coord":636,"line_height":365,"Surface":422,"Num_animation_frames":840,"manifest_navigator_up":628,"Manifest_navigator":495,"manifest_navigator_down":635,"on.draw":986,"keychord_press_on_manifest_navigator":765,"delete_definition":673,"on.keychord_press":919,"move_candidate_to_front_of_manifest":632,"new_definition":848,"on_handle":547,"Page":475,"text_input_on_manifest_navigator":634,"fw_parent":1002,"on":1,"Test_definition_background_color":858,"update_editor_box":711,"definition_background_color":859,"order_of_magnitude":573,"compute_layout":385,"on.mouse_release":836,"on.update":945,"add_def_to_menu":640,"sx":955,"Menu_border_color":612,"schema1_of_y":667,"add_hotkey_to_menu":616,"on.load_settings":940,"scale":712,"snapshot_canvas":913,"get_default_map":937,"on.key_release":720,"on_text":539,"copy_viewport":866,"wait_for_response":781,"font":353,"zoom_out":908,"reset_manifest_navigator":772,"Zoomed_out":869,"y_of_schema1":364,"mouse_cursor":558,"table_and_array_both_empty":689,"Mouse_cursor":559,"tick_spec":998,"zoom_in":920,"Save_viewport":865,"set_mouse_cursor":562,"draw_menu_bar":861,"draw_ticks":997,"Cursor_node":172,"Manifest":769,"initialize_manifest_navigator":773,"on.mouse_press":916,"vx":545,"Definition_background_color":849,"add_thick_line":400,"get_multiple_definitions_from_app":783}
new_definition = function()
table.insert(Definitions, {
type='text',
data={''},
x=0, y=0,
width=600,
bg={r=0.7,g=0.7,b=1},
})
Viewport.x = Definitions[name].x-30
Viewport.y = Definitions[name].y-30
Cursor_node = Definitions[name]
Cursor_node.show_cursor = true
end
num_lines_for_manifest_navigator = function(candidates)
local result = 1
local x = 5
for i,def in ipairs(candidates) do
local width = App.width(to_hud_text(def))
if x + width > App.screen.width - 5 then
result = result+1
x = 5 + width
else
x = x + width + 30
end
end
return result
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxy+10
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"Definition_background_color":849,"fw_parent":908,"Test_definition_background_color":858,"definition_background_color":859,"Menu_background_color":611,"snapshot_canvas":872,"Manifest":769,"Save_viewport":865,"Menu_command_color":613,"load_manifest":694,"Menu_highlight_color":614,"get_manifest":768,"zoom_out":908,"on.text_input":855,"on.mouse_release":836,"draw_manifest_navigator":677,"Definitions":503,"num_lines_for_manifest_navigator":676,"new_definition":848,"reset_manifest_navigator":772,"draw_cursor":639,"load_from_iterator":670,"on.code_submit":787,"get_definition_from_app":784,"add_thick_line":400,"copy_shape":396,"update_editor_box":711,"font":353,"initialize_manifest_navigator":773,"maybe_update_key_in_definitions":529,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"get_multiple_definitions_from_app":783,"keychord_press_on_manifest_navigator":765,"schema1_of_y":667,"text_input_on_manifest_navigator":634,"wait_for_response":781,"Cursor_node":172,"manifest_index":637,"manifest_navigator_candidates":638,"box_height":680,"compute_layout":385,"load_definition":854,"on":1,"draw_run_time_error":808,"on.save_settings":742,"sx":544,"on.load_settings":782,"animate_next":909,"table_and_array_both_empty":689,"on.key_release":720,"Num_animation_frames":840,"animate_next_frame":902,"fw_app":"driver","set_mouse_cursor":562,"on.keychord_press":897,"draw_ticks":862,"approximate_up":658,"initialize_editor":678,"mouse_cursor":558,"surface_bounds":814,"Mouse_cursor":559,"vy":546,"on.update":900,"scale":712,"order_of_magnitude":573,"manifest_coord":636,"Page":475,"draw_menu_bar":861,"Spawn_point":822,"approximate":579,"from_viewport":823,"add_def_to_menu":640,"interpolate_viewport":843,"add_hotkey_to_menu":616,"survey_animation":906,"y_of_schema1":364,"sy":469,"on.mouse_press":893,"Animating":842,"Menu_border_color":612,"Viewport":604,"on.draw":885,"manifest_navigator_up":628,"Ticks_font":669,"on_text":539,"tick_spec":660,"on.initialize":807,"Surface":422,"A":831,"on.code_change":820,"on_handle":547,"manifest_navigator_down":635,"B":830,"line_height":365,"zoom_in":895,"Manifest_navigator":495,"vx":545,"Zoomed_out":869,"copy_viewport":866}
animate_next_frame(state, dt)
if state.start == nil then
state.start = Viewport[state.viewport_key]
state.step = 0
state.frame_time = 0
return
end
state.frame_time = state.frame_time + dt
if state.frame_time > 0.01 then
state.frame_time = state.frame_time - 0.01
state.step = state.step+1
Viewport[state.viewport_key] = (state.start * (10 - state.step) + state.end * state.step) / 10
B()
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---', lo, hi, anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---')
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
animate_next = function(dt)
print('animate_next', Animating[1].step)
if Animating[1].step and Animating[1].step >= Num_animation_frames then
print('animate_next A')
table.remove(Animating, 1)
if #Animating == 0 then
Animating = nil
Canvas = nil
A()
return
end
end
print('animate_next B', Viewport.zoom)
animate_next_frame(Animating[1], dt)
end
on.update = function(dt)
if Animating then
animate_next(dt)
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
A()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(0.7,0.7,0.7)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.1f'):format(x), x+2, 5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
on.keychord_press = function(chord, key)
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":981,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":982,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
-- handle when scale-down ends up at 0
check_eq(approximate_up(2, 1), 10, 'approximate_up/1')
-- scale-down doesn't end at 0
check_eq(approximate_up(7, 1), 10, 'approximate_up/2')
end
on.keychord_press = function(chord, key)
print('-- definition keys')
for k in pairs(Definitions) do
print(k)
end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
Viewport.zoom = Viewport.zoom-0.1
B()
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
A(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"draw_test_failure_indicator":935,"interpolate_viewport":843,"on.code_submit":947,"Manifest":769,"compute_layout":385,"load_manifest":694,"get_manifest":768,"initialize_manifest_navigator":773,"on.text_input":855,"update_editor_box":711,"Definitions":503,"Num_animation_frames":840,"wait_for_response":781,"schema1_of_y":667,"Definition_background_color":849,"y_of_schema1":364,"test_approximate_up":983,"scale":712,"Cursor_node":172,"Test_definition_background_color":858,"box_height":680,"draw_run_time_error":808,"sx":955,"Menu_border_color":612,"load_definition":854,"Menu_command_color":613,"survey_animation":1002,"Menu_highlight_color":614,"animate_next":914,"draw_menu_bar":861,"sy":954,"add_hotkey_to_menu":616,"snapshot_canvas":913,"table_and_array_both_empty":689,"Save_viewport":865,"num_lines_for_manifest_navigator":676,"copy_viewport":866,"animate_next_frame":915,"iscale":953,"reset_manifest_navigator":772,"Menu_background_color":611,"Zoomed_out":869,"load_from_iterator":670,"on.mouse_press":916,"surface_bounds":814,"tick_spec":998,"add_thick_line":400,"zoom_in":920,"copy_shape":396,"manifest_navigator_up":628,"vx":545,"manifest_navigator_down":635,"draw_cursor":639,"Spawn_point":822,"delete_definition":673,"from_viewport":823,"on.key_release":720,"definition_background_color":859,"Mouse_cursor":559,"on_handle":547,"fw_app":"driver","maybe_update_key_in_definitions":529,"get_multiple_definitions_from_app":783,"Animating":842,"font":353,"mouse_cursor":558,"on_text":539,"line_height":365,"get_default_map":937,"on.draw":986,"on.load_settings":940,"set_mouse_cursor":562,"move_candidate_to_front_of_manifest":632,"draw_ticks":997,"on.code_change":924,"get_definition_from_app":784,"text_input_on_manifest_navigator":634,"B":830,"initialize_editor":678,"A":831,"on":1,"on.mouse_release":836,"order_of_magnitude":573,"on.update":945,"fw_parent":1001,"on.keychord_press":919,"undo_zoom_out":921,"approximate":579,"new_definition":848,"Page":475,"keychord_press_on_manifest_navigator":765,"Manifest_navigator":495,"Surface":422,"Viewport":604,"on.save_settings":742,"manifest_coord":636,"approximate_up":985,"manifest_index":637,"draw_manifest_navigator":677,"manifest_navigator_candidates":638,"Failing_test_definition_background_color":925,"Ticks_font":669,"add_def_to_menu":640,"vy":956,"on.initialize":948,"draw_load_time_error":929,"zoom_out":908}
draw_manifest_navigator = function()
App.color(Menu_command_color)
local filter_text = to_hud_text(Manifest_navigator.filter)
App.screen.draw(filter_text, 5, 5)
draw_cursor(5 + App.width(filter_text), 5)
if Manifest_navigator.num_lines == nil then
Manifest_navigator.num_lines = num_lines_for_manifest_navigator(Manifest_navigator.candidates)
end
App.color(Menu_background_color)
love.graphics.rectangle('fill', 0,Menu_bar_height, App.screen.width, Manifest_navigator.num_lines * (HUD_line_height + --[[highlight padding]]5) + --[[extra highlight padding for bottom]] 2)
local x,y = 5, Menu_bar_height
for i,definition in ipairs(Manifest_navigator.candidates) do
x,y = add_def_to_menu(x,y, definition, i == Manifest_navigator.index)
if Menu_cursor >= App.screen.width - 5 then
break
end
end
Manifest_navigator.bottom_y = y + HUD_line_height + --[[highlight padding]] 5
end
{"initialize_manifest_navigator":773,"manifest_navigator_up":628,"manifest_navigator_down":635,"get_multiple_definitions_from_app":783,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"Manifest":769,"keychord_press_on_manifest_navigator":765,"load_manifest":694,"fw_parent":907,"get_manifest":768,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"Definitions":503,"new_definition":848,"scale":712,"A":831,"font":353,"Surface":422,"animate_next_frame":902,"on.text_input":855,"maybe_update_key_in_definitions":529,"surface_bounds":814,"Ticks_font":669,"draw_run_time_error":808,"tick_spec":660,"copy_shape":396,"Animating":842,"add_thick_line":400,"update_editor_box":711,"on_handle":547,"from_viewport":823,"table_and_array_both_empty":689,"interpolate_viewport":843,"vy":546,"on_text":539,"Cursor_node":172,"on.code_submit":787,"schema1_of_y":667,"zoom_in":895,"on.update":900,"zoom_out":908,"sx":544,"animate_next":903,"vx":545,"initialize_editor":678,"Zoomed_out":869,"box_height":680,"on.mouse_release":836,"on":1,"on.code_change":820,"on.key_release":720,"on.save_settings":742,"snapshot_canvas":872,"on.load_settings":782,"definition_background_color":859,"copy_viewport":866,"load_definition":854,"Save_viewport":865,"compute_layout":385,"mouse_cursor":558,"Definition_background_color":849,"Mouse_cursor":559,"text_input_on_manifest_navigator":634,"draw_ticks":862,"Spawn_point":822,"Test_definition_background_color":858,"B":830,"on.draw":885,"get_definition_from_app":784,"wait_for_response":781,"load_from_iterator":670,"Viewport":604,"set_mouse_cursor":562,"Menu_background_color":611,"draw_cursor":639,"Menu_border_color":612,"order_of_magnitude":573,"Menu_command_color":613,"Menu_highlight_color":614,"on.mouse_press":893,"sy":469,"y_of_schema1":364,"survey_animation":906,"add_hotkey_to_menu":616,"add_def_to_menu":640,"approximate_up":658,"draw_manifest_navigator":677,"draw_menu_bar":861,"num_lines_for_manifest_navigator":676,"Page":475,"line_height":365,"reset_manifest_navigator":772,"Manifest_navigator":495,"approximate":579,"on.keychord_press":897,"fw_app":"driver","on.initialize":807,"Num_animation_frames":840}
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
if vy(node.y) > 0 then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, -vy(node.y))
end
node.editor.left = math.floor(vx(node.x)) + Line_number_width*App.width(node.editor.em)
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
on.mouse_press = function(x,y, mouse_button)
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
if mouse_press_consumed_by_any_button_handler(HUD, x,y, mouse_button) then
return
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxy+100
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":980,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":981,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(8)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(0.7,0.7,0.7)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.1f'):format(x), x+2, 5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
love.graphics.setFont(old_font)
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---')
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---')
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
test_approximate_up = function()
-- scale-down ends up at 0
check_eq(approximate_up(7, 1), 10, 'approximate_up/1')
-- scale-down doesn't end at 0
check_eq(approximate_up(17, 1), 20, 'approximate_up/2')
end
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
if node.editor == nil then return end
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
if vy(node.y) > 0 then
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
node.editor.screen_top1.line = 1
node.editor.screen_top1.pos = 1
end
node.editor.top = vy(node.y)
else
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, -vy(node.y))
end
node.editor.left = math.floor(vx(node.x))+Line_number_width*App.width(node.editor.em)
node.editor.right = math.ceil(vx(node.x+node.w))
edit.update_font_settings(node.editor, scale(20))
Text.redraw_all(node.editor)
end
animate_next = function(dt)
Animating.frame_time = Animating.frame_time + dt
print(Animating.frame_time)
if Animating.frame_time > 0.01 then
Animating.frame_time = Animating.frame_time - 0.01
Animating.step = Animating.step+1
if Animating.step >= 10 then
Animating = nil
return
end
Viewport[Animating.viewport_key] = Animating.start + Animating.step * Animating.step_increment
B()
end
end
on.save_settings = function()
if Settings == nil then
Settings = {} -- just for initial schema migration
end
for key,node in pairs(Definitions) do
if type(key) == 'number' then
-- can't save the array side for now because of a limitation in the
Definitions[key] = nil
else
node.data = nil -- don't save uncommitted data for now
node.show_cursor = nil
node.editor = nil -- TODO: check for hierarchy
end
end
Settings[App_name] = {
viewport=Viewport,
definitions=Definitions,
}
return Settings
end
{"on_handle":547,"wait_for_response":781,"on_text":539,"on.mouse_press":893,"sx":544,"font":353,"vx":545,"draw_cursor":639,"on.key_release":720,"Animating":842,"survey_animation":906,"on.initialize":807,"scale":712,"A":831,"Menu_highlight_color":614,"draw_menu_bar":861,"B":830,"animate_next_frame":902,"Mouse_cursor":559,"reset_manifest_navigator":772,"set_mouse_cursor":562,"load_from_iterator":670,"get_definition_from_app":784,"surface_bounds":814,"load_manifest":694,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.draw":885,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"Viewport":604,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"manifest_coord":636,"approximate_up":658,"manifest_navigator_candidates":638,"on.update":900,"add_def_to_menu":640,"on.keychord_press":897,"on":1,"maybe_update_key_in_definitions":529,"num_lines_for_manifest_navigator":676,"Num_animation_frames":840,"from_viewport":823,"draw_manifest_navigator":677,"update_editor_box":711,"new_definition":848,"Manifest_navigator":495,"add_hotkey_to_menu":616,"fw_parent":906,"approximate":579,"fw_app":"driver","Definition_background_color":849,"Menu_command_color":613,"schema1_of_y":667,"order_of_magnitude":573,"line_height":365,"Test_definition_background_color":858,"tick_spec":660,"Surface":422,"y_of_schema1":364,"Page":475,"Menu_background_color":611,"sy":469,"on.mouse_release":836,"Manifest":769,"Spawn_point":822,"draw_ticks":862,"Menu_border_color":612,"box_height":680,"definition_background_color":859,"compute_layout":385,"Save_viewport":865,"load_definition":854,"on.code_change":820,"copy_viewport":866,"interpolate_viewport":843,"mouse_cursor":558,"zoom_out":907,"snapshot_canvas":872,"on.text_input":855,"Ticks_font":669,"Zoomed_out":869,"on.save_settings":742,"animate_next":903,"on.load_settings":782,"zoom_in":895,"manifest_index":637,"on.code_submit":787,"Cursor_node":172,"vy":546,"table_and_array_both_empty":689,"initialize_manifest_navigator":773,"Definitions":503,"add_thick_line":400,"get_manifest":768,"copy_shape":396,"get_multiple_definitions_from_app":783,"draw_run_time_error":808,"initialize_editor":678}
draw_ticks = function()
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(0.7,0.7,0.7)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
end
add_hotkey_to_menu = function(s)
local s_text = to_hud_text(s)
if Menu_cursor > App.screen.width - 30 then
return
end
App.color(Menu_command_color)
App.screen.draw(s_text, Menu_cursor,5)
Menu_cursor = Menu_cursor + width + 30
end
local width = s_text:getWidth()
{"vy":956,"surface_bounds":814,"on.save_settings":742,"test_approximate_up":983,"on.load_settings":940,"order_of_magnitude":573,"Spawn_point":822,"from_viewport":823,"schema1_of_y":667,"interpolate_viewport":843,"approximate_up":985,"on.text_input":855,"Ticks_font":669,"B":830,"draw_cursor":639,"table_and_array_both_empty":689,"Num_animation_frames":840,"on.mouse_press":916,"new_definition":848,"Manifest_navigator":495,"fw_parent":1000,"font":353,"line_height":365,"on.keychord_press":919,"box_height":680,"load_manifest":694,"Definition_background_color":849,"get_manifest":768,"on.key_release":720,"Surface":422,"vx":545,"draw_manifest_navigator":677,"on.update":945,"definition_background_color":859,"Test_definition_background_color":858,"Viewport":604,"on.initialize":948,"Manifest":769,"A":831,"add_hotkey_to_menu":616,"set_mouse_cursor":562,"get_definition_from_app":784,"add_thick_line":400,"Definitions":503,"on.code_change":924,"snapshot_canvas":913,"manifest_navigator_up":628,"Save_viewport":865,"Page":475,"copy_viewport":866,"manifest_navigator_down":635,"scale":712,"zoom_out":908,"on.code_submit":947,"Zoomed_out":869,"Menu_border_color":612,"manifest_coord":636,"Menu_command_color":613,"manifest_index":637,"Menu_highlight_color":614,"reset_manifest_navigator":772,"copy_shape":396,"initialize_manifest_navigator":773,"Animating":842,"manifest_navigator_candidates":638,"undo_zoom_out":921,"draw_test_failure_indicator":935,"add_def_to_menu":640,"get_multiple_definitions_from_app":783,"draw_menu_bar":861,"Failing_test_definition_background_color":925,"initialize_editor":678,"wait_for_response":781,"keychord_press_on_manifest_navigator":765,"text_input_on_manifest_navigator":634,"draw_load_time_error":929,"compute_layout":385,"on_handle":547,"move_candidate_to_front_of_manifest":632,"on":1,"on.draw":986,"get_default_map":937,"on_text":539,"delete_definition":673,"approximate":579,"on.mouse_release":836,"maybe_update_key_in_definitions":529,"fw_app":"driver","update_editor_box":711,"draw_run_time_error":808,"Cursor_node":172,"draw_ticks":997,"Mouse_cursor":559,"mouse_cursor":558,"survey_animation":1001,"num_lines_for_manifest_navigator":676,"animate_next":914,"y_of_schema1":364,"tick_spec":998,"Menu_background_color":611,"load_from_iterator":670,"iscale":953,"animate_next_frame":915,"zoom_in":920,"sy":954,"load_definition":854,"sx":955}
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxx+1
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
copy_viewport(Viewport),
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":979,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":980,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
-- scale-down ends up at 0
check_eq(approximate_up(2, 1), 10, 'approximate_up/1')
-- scale-down doesn't end at 0
check_eq(approximate_up(12, 1), 20, 'approximate_up/2')
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxy+1
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
draw_ticks = function()
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
love.graphics.setColor(0.7,0.7,0.7)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), 0, vx(x), 5)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
end
draw_menu_bar = function()
if App.run_tests then return end -- disable in tests
App.color(Menu_background_color)
love.graphics.rectangle('fill', 0,0, App.screen.width, Menu_bar_height)
App.color(Menu_border_color)
love.graphics.rectangle('line', 0,0, App.screen.width, Menu_bar_height)
App.color(Menu_command_color)
Menu_cursor = 5
add_hotkey_to_menu('ctrl+l: load definition')
add_hotkey_to_menu('ctrl+n: new definition')
add_hotkey_to_menu('ctrl+d: delete definition')
add_hotkey_to_menu('ctrl+f: find')
add_hotkey_to_menu('ctrl+left ctrl+right: prev/next word')
add_hotkey_to_menu('ctrl+z ctrl+y: undo/redo')
add_hotkey_to_menu('ctrl+x ctrl+c ctrl+v: cut/copy/paste')
add_hotkey_to_menu('ctrl+= ctrl+- ctrl+0: zoom')
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---')
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---')
while (anchorhi-anchorlo)/scale < 2 do
print('a', scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
on.update = function(dt)
if Animating then
Animating.frame_time = Animating.frame_time + dt
print(Animating.frame_time)
if Animating.frame_time > 0.01 then
Animating.frame_time = Animating.frame_time - 0.01
Animating.step = Animating.step+1
if Animating.step >= 10 then
Animating = nil
return
end
Viewport[Animating.viewport_key] = Animating.start + Animating.step * Animating.step_increment
B()
end
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
A()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
for i=1,zeros do
n = n/10
end
n= math.ceil(n)
local magnitude = 1
for i=1,zeros do
n = n*10
magnitude = magnitude*10
end
return n, magnitude
end
{"approximate_up":658,"reset_manifest_navigator":772,"schema1_of_y":667,"Cursor_node":172,"load_from_iterator":670,"font":353,"get_definition_from_app":784,"y_of_schema1":364,"Manifest":769,"manifest_navigator_up":628,"load_manifest":694,"manifest_navigator_down":635,"get_manifest":768,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"Definitions":503,"text_input_on_manifest_navigator":634,"new_definition":848,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on.code_submit":787,"add_def_to_menu":640,"on.draw":885,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"copy_shape":396,"get_multiple_definitions_from_app":783,"on.mouse_release":836,"wait_for_response":781,"on.update":900,"on.code_change":820,"tick_spec":660,"Page":475,"on_handle":547,"Surface":422,"on_text":539,"draw_run_time_error":808,"Num_animation_frames":840,"on.text_input":855,"load_definition":854,"survey_animation":906,"on.initialize":807,"animate_next":903,"A":831,"on.mouse_press":893,"B":830,"animate_next_frame":902,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":782,"on.keychord_press":897,"box_height":680,"Test_definition_background_color":858,"compute_layout":385,"sx":544,"table_and_array_both_empty":689,"surface_bounds":814,"on.key_release":720,"scale":712,"draw_cursor":639,"vx":545,"Zoomed_out":869,"Ticks_font":669,"snapshot_canvas":872,"maybe_update_key_in_definitions":529,"Save_viewport":865,"mouse_cursor":558,"copy_viewport":866,"Mouse_cursor":559,"interpolate_viewport":843,"zoom_out":905,"definition_background_color":859,"set_mouse_cursor":562,"Menu_border_color":612,"draw_ticks":862,"fw_parent":905,"fw_app":"driver","Spawn_point":822,"zoom_in":895,"sy":469,"Menu_background_color":611,"initialize_editor":678,"line_height":365,"order_of_magnitude":573,"Menu_command_color":613,"Animating":842,"Menu_highlight_color":614,"add_hotkey_to_menu":616,"approximate":579,"Definition_background_color":849,"update_editor_box":711,"Manifest_navigator":495,"vy":546,"draw_manifest_navigator":677,"from_viewport":823,"num_lines_for_manifest_navigator":676,"on":1}
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":978,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":979,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
-- scale-down ends up at 0
check_eq(10, approximate_up(2, 1), 'approximate_up/1')
-- scale-down doesn't end at 0
check_eq(2000, approximate_up(12, 1), 'approximate_up/2')
end
{"sy":954,"mouse_cursor":558,"sx":955,"Mouse_cursor":559,"vy":956,"draw_ticks":997,"Definition_background_color":849,"test_approximate_up":983,"draw_cursor":639,"update_editor_box":711,"order_of_magnitude":573,"approximate":579,"schema1_of_y":667,"snapshot_canvas":913,"scale":712,"Save_viewport":865,"on.code_submit":947,"Ticks_font":669,"fw_parent":999,"Zoomed_out":869,"tick_spec":998,"initialize_manifest_navigator":773,"zoom_in":920,"get_multiple_definitions_from_app":783,"A":831,"Manifest_navigator":495,"on.save_settings":742,"wait_for_response":781,"font":353,"on":1,"load_definition":854,"Surface":422,"Num_animation_frames":840,"Page":475,"Viewport":604,"on.draw":986,"y_of_schema1":364,"Menu_background_color":611,"survey_animation":1000,"Menu_border_color":612,"line_height":365,"Menu_command_color":613,"on.mouse_press":916,"Menu_highlight_color":614,"draw_run_time_error":808,"draw_menu_bar":861,"on.update":945,"add_hotkey_to_menu":616,"on.keychord_press":919,"Definitions":503,"draw_manifest_navigator":677,"animate_next":914,"num_lines_for_manifest_navigator":676,"on.initialize":948,"get_manifest":768,"reset_manifest_navigator":772,"load_manifest":694,"animate_next_frame":915,"load_from_iterator":670,"definition_background_color":859,"get_definition_from_app":784,"on_text":539,"from_viewport":823,"on.text_input":855,"fw_app":"driver","maybe_update_key_in_definitions":529,"on.mouse_release":836,"copy_shape":396,"undo_zoom_out":921,"on_handle":547,"delete_definition":673,"get_default_map":937,"move_candidate_to_front_of_manifest":632,"Failing_test_definition_background_color":925,"keychord_press_on_manifest_navigator":765,"initialize_editor":678,"text_input_on_manifest_navigator":634,"compute_layout":385,"draw_load_time_error":929,"manifest_coord":636,"draw_test_failure_indicator":935,"manifest_index":637,"Animating":842,"manifest_navigator_candidates":638,"interpolate_viewport":843,"on.key_release":720,"add_def_to_menu":640,"Cursor_node":172,"B":830,"manifest_navigator_down":635,"Spawn_point":822,"new_definition":848,"on.load_settings":940,"surface_bounds":814,"vx":545,"on.code_change":924,"add_thick_line":400,"set_mouse_cursor":562,"zoom_out":908,"approximate_up":985,"Manifest":769,"Test_definition_background_color":858,"manifest_navigator_up":628,"box_height":680,"iscale":953,"copy_viewport":866,"table_and_array_both_empty":689}
draw_ticks = function()
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
end
on.update = function(dt)
print(dt)
if Animating then
Animating.frame_time = Animating.frame_time + dt
print(Animating.frame_time)
if Animating.frame_time > 0.01 then
Animating.frame_time = Animating.frame_time - 0.01
Animating.step = Animating.step+1
if Animating.step >= 10 then
Animating = nil
return
end
Viewport[Animating.viewport_key] = Animating.start + Animating.step * Animating.step_increment
B()
end
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
A()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxx+100
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
print('bounds 2', minx, miny, cw, ch)
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"approximate_up":658,"reset_manifest_navigator":772,"schema1_of_y":667,"Cursor_node":172,"load_from_iterator":670,"font":353,"get_definition_from_app":784,"y_of_schema1":364,"Manifest":769,"manifest_navigator_up":628,"load_manifest":694,"manifest_navigator_down":635,"get_manifest":768,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"Definitions":503,"text_input_on_manifest_navigator":634,"new_definition":848,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on.code_submit":787,"add_def_to_menu":640,"on.draw":885,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"copy_shape":396,"get_multiple_definitions_from_app":783,"on.mouse_release":836,"wait_for_response":781,"on.update":900,"on.code_change":820,"tick_spec":660,"Page":475,"on_handle":547,"Surface":422,"on_text":539,"draw_run_time_error":808,"Num_animation_frames":840,"on.text_input":855,"load_definition":854,"survey_animation":863,"on.initialize":807,"animate_next":903,"A":831,"on.mouse_press":893,"B":830,"animate_next_frame":902,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":782,"on.keychord_press":897,"box_height":680,"Test_definition_background_color":858,"compute_layout":385,"sx":544,"table_and_array_both_empty":689,"surface_bounds":814,"on.key_release":720,"scale":712,"draw_cursor":639,"vx":545,"Zoomed_out":869,"Ticks_font":669,"snapshot_canvas":872,"maybe_update_key_in_definitions":529,"Save_viewport":865,"mouse_cursor":558,"copy_viewport":866,"Mouse_cursor":559,"interpolate_viewport":843,"zoom_out":905,"definition_background_color":859,"set_mouse_cursor":562,"Menu_border_color":612,"draw_ticks":862,"fw_parent":904,"fw_app":"driver","Spawn_point":822,"zoom_in":895,"sy":469,"Menu_background_color":611,"initialize_editor":678,"line_height":365,"order_of_magnitude":573,"Menu_command_color":613,"Animating":842,"Menu_highlight_color":614,"add_hotkey_to_menu":616,"approximate":579,"Definition_background_color":849,"update_editor_box":711,"Manifest_navigator":495,"vy":546,"draw_manifest_navigator":677,"from_viewport":823,"num_lines_for_manifest_navigator":676,"on":1}
draw_ticks = function()
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate(lo, order_of_magnitude(hi-lo))
print('anchor is', anchorlo, anchorhi, scale)
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---')
while (anchorhi-anchorlo)/scale < 2 do
print('a', scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---')
while (anchorhi-anchorlo)/scale < 2 do
print('a', scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":977,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":978,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
-- scale-down ends up at 0
check_eq(10, approximate_up(5, 1), 'approximate_up/1')
-- scale-down doesn't end at 0
local result = approximate_up(1700, 3)
print(result)
check_eq(2000, result, 'approximate_up/2')
end
draw_ticks = function()
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchor, scale = approximate(hi, order_of_magnitude(hi-lo))
print('anchor is', anchor, scale)
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
end
{"vy":956,"on.mouse_press":916,"compute_layout":385,"Definition_background_color":849,"draw_cursor":639,"on.keychord_press":919,"test_approximate_up":983,"approximate_up":985,"on.update":945,"Ticks_font":669,"on.code_change":924,"on.key_release":720,"font":353,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"zoom_out":908,"Zoomed_out":869,"Manifest":769,"fw_app":"driver","Mouse_cursor":559,"zoom_in":920,"set_mouse_cursor":562,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":861,"order_of_magnitude":573,"add_hotkey_to_menu":616,"copy_shape":396,"update_editor_box":711,"draw_manifest_navigator":677,"approximate":579,"num_lines_for_manifest_navigator":676,"maybe_update_key_in_definitions":529,"box_height":680,"reset_manifest_navigator":772,"on.code_submit":947,"Test_definition_background_color":858,"load_from_iterator":670,"tick_spec":998,"get_definition_from_app":784,"add_def_to_menu":640,"scale":712,"Cursor_node":172,"initialize_manifest_navigator":773,"manifest_navigator_up":628,"manifest_navigator_candidates":638,"manifest_navigator_down":635,"schema1_of_y":667,"Definitions":503,"get_multiple_definitions_from_app":783,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"manifest_index":637,"wait_for_response":781,"draw_ticks":997,"load_definition":854,"animate_next_frame":915,"text_input_on_manifest_navigator":634,"manifest_coord":636,"table_and_array_both_empty":689,"load_manifest":694,"on.draw":986,"undo_zoom_out":921,"keychord_press_on_manifest_navigator":765,"add_thick_line":400,"vx":545,"surface_bounds":814,"Failing_test_definition_background_color":925,"delete_definition":673,"on.load_settings":940,"draw_run_time_error":808,"new_definition":848,"draw_load_time_error":929,"Animating":842,"draw_test_failure_indicator":935,"Spawn_point":822,"iscale":953,"animate_next":914,"from_viewport":823,"interpolate_viewport":843,"initialize_editor":678,"get_default_map":937,"on_handle":547,"Manifest_navigator":495,"on.mouse_release":836,"on.text_input":855,"B":830,"on_text":539,"definition_background_color":859,"Viewport":604,"fw_parent":998,"y_of_schema1":364,"on.initialize":948,"line_height":365,"Surface":422,"survey_animation":999,"get_manifest":768,"Page":475,"Num_animation_frames":840,"on":1,"on.save_settings":742,"sy":954,"A":831,"sx":955}
{"approximate_up":658,"reset_manifest_navigator":772,"schema1_of_y":667,"Cursor_node":172,"load_from_iterator":670,"font":353,"get_definition_from_app":784,"y_of_schema1":364,"Manifest":769,"manifest_navigator_up":628,"load_manifest":694,"manifest_navigator_down":635,"get_manifest":768,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"Definitions":503,"text_input_on_manifest_navigator":634,"new_definition":848,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on.code_submit":787,"add_def_to_menu":640,"on.draw":885,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"copy_shape":396,"get_multiple_definitions_from_app":783,"on.mouse_release":836,"wait_for_response":781,"on.update":900,"on.code_change":820,"tick_spec":660,"Page":475,"on_handle":547,"Surface":422,"on_text":539,"draw_run_time_error":808,"Num_animation_frames":840,"on.text_input":855,"load_definition":854,"survey_animation":863,"on.initialize":807,"animate_next":903,"A":831,"on.mouse_press":893,"B":830,"animate_next_frame":902,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":782,"on.keychord_press":897,"box_height":680,"Test_definition_background_color":858,"compute_layout":385,"sx":544,"table_and_array_both_empty":689,"surface_bounds":814,"on.key_release":720,"scale":712,"draw_cursor":639,"vx":545,"Zoomed_out":869,"Ticks_font":669,"snapshot_canvas":872,"maybe_update_key_in_definitions":529,"Save_viewport":865,"mouse_cursor":558,"copy_viewport":866,"Mouse_cursor":559,"interpolate_viewport":843,"zoom_out":904,"definition_background_color":859,"set_mouse_cursor":562,"Menu_border_color":612,"draw_ticks":862,"fw_parent":903,"fw_app":"driver","Spawn_point":822,"zoom_in":895,"sy":469,"Menu_background_color":611,"initialize_editor":678,"line_height":365,"order_of_magnitude":573,"Menu_command_color":613,"Animating":842,"Menu_highlight_color":614,"add_hotkey_to_menu":616,"approximate":579,"Definition_background_color":849,"update_editor_box":711,"Manifest_navigator":495,"vy":546,"draw_manifest_navigator":677,"from_viewport":823,"num_lines_for_manifest_navigator":676,"on":1}
approximate = function(n, zeros)
-- turn n into a number with n zeros
for i=1,zeros do
n = n/10
end
n= math.floor(n)
local magnitude = 1
for i=1,zeros do
n = n*10
magnitude = magnitude*10
end
return n, magnitude
end
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
-- print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 4 do
-- print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 8 do
-- print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
-- print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
-- print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":976,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":977,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---')
while (anchorhi-anchorlo)/scale < 2 do
print('a', scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
{"approximate_up":658,"reset_manifest_navigator":772,"schema1_of_y":667,"Cursor_node":172,"load_from_iterator":670,"font":353,"get_definition_from_app":784,"y_of_schema1":364,"Manifest":769,"manifest_navigator_up":628,"load_manifest":694,"manifest_navigator_down":635,"get_manifest":768,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"Definitions":503,"text_input_on_manifest_navigator":634,"new_definition":848,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on.code_submit":787,"add_def_to_menu":640,"on.draw":885,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"copy_shape":396,"get_multiple_definitions_from_app":783,"on.mouse_release":836,"wait_for_response":781,"on.update":900,"on.code_change":820,"tick_spec":660,"Page":475,"on_handle":547,"Surface":422,"on_text":539,"draw_run_time_error":808,"Num_animation_frames":840,"on.text_input":855,"load_definition":854,"survey_animation":863,"on.initialize":807,"animate_next":903,"A":831,"on.mouse_press":893,"B":830,"animate_next_frame":902,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":782,"on.keychord_press":897,"box_height":680,"Test_definition_background_color":858,"compute_layout":385,"sx":544,"table_and_array_both_empty":689,"surface_bounds":814,"on.key_release":720,"scale":712,"draw_cursor":639,"vx":545,"Zoomed_out":869,"Ticks_font":669,"snapshot_canvas":872,"maybe_update_key_in_definitions":529,"Save_viewport":865,"mouse_cursor":558,"copy_viewport":866,"Mouse_cursor":559,"interpolate_viewport":843,"zoom_out":888,"definition_background_color":859,"set_mouse_cursor":562,"Menu_border_color":612,"draw_ticks":862,"fw_parent":902,"fw_app":"driver","Spawn_point":822,"zoom_in":895,"sy":469,"Menu_background_color":611,"initialize_editor":678,"line_height":365,"order_of_magnitude":573,"Menu_command_color":613,"Animating":842,"Menu_highlight_color":614,"add_hotkey_to_menu":616,"approximate":579,"Definition_background_color":849,"update_editor_box":711,"Manifest_navigator":495,"vy":546,"draw_manifest_navigator":677,"from_viewport":823,"num_lines_for_manifest_navigator":676,"on":1}
animate_next = function(dt)
print('animate_next', Animating[1].step)
if Animating[1].step and Animating[1].step >= Num_animation_frames then
print('animate_next A')
table.remove(Animating, 1)
if #Animating == 0 then
Animating = nil
Canvas = nil
A()
return
end
end
print('animate_next B')
animate_next_frame(Animating[1], dt)
end
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":997,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":997,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":998,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
draw_ticks = function()
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchor = approximate(hi, order_of_magnitude(hi-lo))
print('anchor is', anchor)
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":975,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
local magnitude = 1
for i=1,zeros do
magnitude = magnitude*10
end
n = n + magnitude/2
print('a', n)
-- step 1: scale down
for i=1,zeros do
n = n/10
end
n = math.ceil(n)
-- step 2: scale back up
for i=1,zeros do
n = n*10
end
return n, magnitude
end
{"approximate_up":658,"reset_manifest_navigator":772,"schema1_of_y":667,"Cursor_node":172,"load_from_iterator":670,"font":353,"get_definition_from_app":784,"y_of_schema1":364,"Manifest":769,"manifest_navigator_up":628,"load_manifest":694,"manifest_navigator_down":635,"get_manifest":768,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"Definitions":503,"text_input_on_manifest_navigator":634,"new_definition":848,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on.code_submit":787,"add_def_to_menu":640,"on.draw":885,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"copy_shape":396,"get_multiple_definitions_from_app":783,"on.mouse_release":836,"wait_for_response":781,"on.update":900,"on.code_change":820,"tick_spec":660,"Page":475,"on_handle":547,"Surface":422,"on_text":539,"draw_run_time_error":808,"Num_animation_frames":840,"on.text_input":855,"load_definition":854,"survey_animation":863,"on.initialize":807,"animate_next":901,"A":831,"on.mouse_press":893,"B":830,"animate_next_frame":902,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":782,"on.keychord_press":897,"box_height":680,"Test_definition_background_color":858,"compute_layout":385,"sx":544,"table_and_array_both_empty":689,"surface_bounds":814,"on.key_release":720,"scale":712,"draw_cursor":639,"vx":545,"Zoomed_out":869,"Ticks_font":669,"snapshot_canvas":872,"maybe_update_key_in_definitions":529,"Save_viewport":865,"mouse_cursor":558,"copy_viewport":866,"Mouse_cursor":559,"interpolate_viewport":843,"zoom_out":888,"definition_background_color":859,"set_mouse_cursor":562,"Menu_border_color":612,"draw_ticks":862,"fw_parent":901,"fw_app":"driver","Spawn_point":822,"zoom_in":895,"sy":469,"Menu_background_color":611,"initialize_editor":678,"line_height":365,"order_of_magnitude":573,"Menu_command_color":613,"Animating":842,"Menu_highlight_color":614,"add_hotkey_to_menu":616,"approximate":579,"Definition_background_color":849,"update_editor_box":711,"Manifest_navigator":495,"vy":546,"draw_manifest_navigator":677,"from_viewport":823,"num_lines_for_manifest_navigator":676,"on":1}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---')
while (anchorhi-anchorlo)/scale < 2 do
print('a', scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
animate_next_frame = function(state, dt)
if state.initial == nil then
print('animate_next_frame A')
state.initial = from_viewport(state)
-- once we've checked keys, pollute the keyspace
state.step = 0
state.frame_time = 0
return
end
print('animate_next_frame B')
state.frame_time = state.frame_time + dt
if state.frame_time > 0.01 then
print('animate_next_frame C')
state.frame_time = state.frame_time - 0.01
state.step = state.step+1
interpolate_viewport(state.initial, state, state.step)
B()
end
end
draw_ticks = function()
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
local anchor = 0
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":974,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":975,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
local magnitude = 1
for i=1,zeros do
magnitude = magnitude*10
end
n = n + magnitude/2
print('a', n)
for i=1,zeros do
n = n/10
end
n = math.ceil(n)
for i=1,zeros do
n = n*10
end
return n, magnitude
end
{"approximate_up":658,"reset_manifest_navigator":772,"schema1_of_y":667,"Cursor_node":172,"load_from_iterator":670,"font":353,"get_definition_from_app":784,"y_of_schema1":364,"Manifest":769,"manifest_navigator_up":628,"load_manifest":694,"manifest_navigator_down":635,"get_manifest":768,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"Definitions":503,"text_input_on_manifest_navigator":634,"new_definition":848,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on.code_submit":787,"add_def_to_menu":640,"on.draw":885,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"copy_shape":396,"get_multiple_definitions_from_app":783,"on.mouse_release":836,"wait_for_response":781,"on.update":900,"on.code_change":820,"tick_spec":660,"Page":475,"on_handle":547,"Surface":422,"on_text":539,"draw_run_time_error":808,"Num_animation_frames":840,"on.text_input":855,"load_definition":854,"survey_animation":863,"on.initialize":807,"animate_next":901,"A":831,"on.mouse_press":893,"B":830,"animate_next_frame":825,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":782,"on.keychord_press":897,"box_height":680,"Test_definition_background_color":858,"compute_layout":385,"sx":544,"table_and_array_both_empty":689,"surface_bounds":814,"on.key_release":720,"scale":712,"draw_cursor":639,"vx":545,"Zoomed_out":869,"Ticks_font":669,"snapshot_canvas":872,"maybe_update_key_in_definitions":529,"Save_viewport":865,"mouse_cursor":558,"copy_viewport":866,"Mouse_cursor":559,"interpolate_viewport":843,"zoom_out":888,"definition_background_color":859,"set_mouse_cursor":562,"Menu_border_color":612,"draw_ticks":862,"fw_parent":900,"fw_app":"driver","Spawn_point":822,"zoom_in":895,"sy":469,"Menu_background_color":611,"initialize_editor":678,"line_height":365,"order_of_magnitude":573,"Menu_command_color":613,"Animating":842,"Menu_highlight_color":614,"add_hotkey_to_menu":616,"approximate":579,"Definition_background_color":849,"update_editor_box":711,"Manifest_navigator":495,"vy":546,"draw_manifest_navigator":677,"from_viewport":823,"num_lines_for_manifest_navigator":676,"on":1}
draw_ticks = function()
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
print('viewport width scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
print('viewport height scale is', hi-lo, lo, hi, order_of_magnitude(hi-lo))
end
animate_next = function(dt)
print('animate_next')
if Animating[1].step and Animating[1].step >= Num_animation_frames then
print('animate_next A')
table.remove(Animating, 1)
if #Animating == 0 then
Animating = nil
Canvas = nil
A()
return
end
end
print('animate_next B')
animate_next_frame(Animating[1], dt)
end
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---')
while (anchorhi-anchorlo)/scale < 2 do
print('a', scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
on.update = function(dt)
if Animating then
animate_next(dt)
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
B()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":973,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":974,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
local magnitude = 1
for i=1,zeros do
magnitude = magnitude*10
end
n = n + magnitude/2
print('a', n)
for i=1,zeros do
n = n/10
end
n= math.ceil(n)
for i=1,zeros do
n = n*10
end
return n, magnitude
end
{"approximate_up":658,"reset_manifest_navigator":772,"schema1_of_y":667,"Cursor_node":172,"load_from_iterator":670,"font":353,"get_definition_from_app":784,"y_of_schema1":364,"Manifest":769,"manifest_navigator_up":628,"load_manifest":694,"manifest_navigator_down":635,"get_manifest":768,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"Definitions":503,"text_input_on_manifest_navigator":634,"new_definition":848,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on.code_submit":787,"add_def_to_menu":640,"on.draw":885,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"copy_shape":396,"get_multiple_definitions_from_app":783,"on.mouse_release":836,"wait_for_response":781,"on.update":900,"on.code_change":820,"tick_spec":660,"Page":475,"on_handle":547,"Surface":422,"on_text":539,"draw_run_time_error":808,"Num_animation_frames":840,"on.text_input":855,"load_definition":854,"survey_animation":863,"on.initialize":807,"animate_next":882,"A":831,"on.mouse_press":893,"B":830,"animate_next_frame":825,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":782,"on.keychord_press":897,"box_height":680,"Test_definition_background_color":858,"compute_layout":385,"sx":544,"table_and_array_both_empty":689,"surface_bounds":814,"on.key_release":720,"scale":712,"draw_cursor":639,"vx":545,"Zoomed_out":869,"Ticks_font":669,"snapshot_canvas":872,"maybe_update_key_in_definitions":529,"Save_viewport":865,"mouse_cursor":558,"copy_viewport":866,"Mouse_cursor":559,"interpolate_viewport":843,"zoom_out":888,"definition_background_color":859,"set_mouse_cursor":562,"Menu_border_color":612,"draw_ticks":862,"fw_parent":899,"fw_app":"driver","Spawn_point":822,"zoom_in":895,"sy":469,"Menu_background_color":611,"initialize_editor":678,"line_height":365,"order_of_magnitude":573,"Menu_command_color":613,"Animating":842,"Menu_highlight_color":614,"add_hotkey_to_menu":616,"approximate":579,"Definition_background_color":849,"update_editor_box":711,"Manifest_navigator":495,"vy":546,"draw_manifest_navigator":677,"from_viewport":823,"num_lines_for_manifest_navigator":676,"on":1}
on.draw = function()
if Animating then
local q = love.graphics.newQuad((Viewport.x-Global_viewport.x)*Viewport.zoom,(Viewport.y-Global_viewport.y)*Viewport.zoom, App.screen.width, App.screen.height, Global_viewport.w*Viewport.zoom, Global_viewport.h*Viewport.zoom)
App.color{r=1,g=1,b=1}
love.graphics.draw(Canvas, q, 0,0)
return
end
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
draw_load_time_error(obj)
end
end
end
draw_run_time_error()
draw_test_failure_indicator()
--draw_ticks()
draw_menu_bar()
end
on.update = function(dt)
if Animating then
print('on.update: animating')
animate_next(dt)
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
B()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
print('---')
while (anchorhi-anchorlo)/scale < 2 do
print('a', scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale)
scale = scale*2
end
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":972,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":972,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
{"approximate_up":658,"reset_manifest_navigator":772,"schema1_of_y":667,"Cursor_node":172,"load_from_iterator":670,"font":353,"get_definition_from_app":784,"y_of_schema1":364,"Manifest":769,"manifest_navigator_up":628,"load_manifest":694,"manifest_navigator_down":635,"get_manifest":768,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"Definitions":503,"text_input_on_manifest_navigator":634,"new_definition":848,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on.code_submit":787,"add_def_to_menu":640,"on.draw":885,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"copy_shape":396,"get_multiple_definitions_from_app":783,"on.mouse_release":836,"wait_for_response":781,"on.update":899,"on.code_change":820,"tick_spec":660,"Page":475,"on_handle":547,"Surface":422,"on_text":539,"draw_run_time_error":808,"Num_animation_frames":840,"on.text_input":855,"load_definition":854,"survey_animation":863,"on.initialize":807,"animate_next":882,"A":831,"on.mouse_press":893,"B":830,"animate_next_frame":825,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":782,"on.keychord_press":897,"box_height":680,"Test_definition_background_color":858,"compute_layout":385,"sx":544,"table_and_array_both_empty":689,"surface_bounds":814,"on.key_release":720,"scale":712,"draw_cursor":639,"vx":545,"Zoomed_out":869,"Ticks_font":669,"snapshot_canvas":872,"maybe_update_key_in_definitions":529,"Save_viewport":865,"mouse_cursor":558,"copy_viewport":866,"Mouse_cursor":559,"interpolate_viewport":843,"zoom_out":888,"definition_background_color":859,"set_mouse_cursor":562,"Menu_border_color":612,"draw_ticks":862,"fw_parent":898,"fw_app":"driver","Spawn_point":822,"zoom_in":895,"sy":469,"Menu_background_color":611,"initialize_editor":678,"line_height":365,"order_of_magnitude":573,"Menu_command_color":613,"Animating":842,"Menu_highlight_color":614,"add_hotkey_to_menu":616,"approximate":579,"Definition_background_color":849,"update_editor_box":711,"Manifest_navigator":495,"vy":546,"draw_manifest_navigator":677,"from_viewport":823,"num_lines_for_manifest_navigator":676,"on":1}
on.update = function(dt)
print('on.update')
if Animating then
print('on.update: animating')
animate_next(dt)
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x())-Move.xoff
Move.node.y = sy(App.mouse_y())-Move.yoff
B()
return
end
end
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
while (anchorhi-anchorlo)/scale < 2 do
print('a', scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale)
scale = scale*2
end
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":971,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":932,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":972,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
local magnitude = 1
for i=1,zeros do
magnitude = magnitude*10
end
n = n + magnitude/2
for i=1,zeros do
n = n/10
end
n= math.ceil(n)
for i=1,zeros do
n = n*10
end
return n, magnitude
end
{"add_hotkey_to_menu":616,"on.mouse_press":893,"survey_animation":863,"draw_manifest_navigator":677,"Cursor_node":172,"num_lines_for_manifest_navigator":676,"Page":475,"on_handle":547,"line_height":365,"animate_next_frame":825,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"on.code_submit":787,"sx":544,"surface_bounds":814,"initialize_manifest_navigator":773,"delete_definition":673,"Viewport":604,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"get_multiple_definitions_from_app":783,"text_input_on_manifest_navigator":634,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"manifest_index":637,"on.update":898,"on.keychord_press":897,"add_def_to_menu":640,"B":830,"on.key_release":720,"Num_animation_frames":840,"animate_next":882,"tick_spec":660,"set_mouse_cursor":562,"Definition_background_color":849,"draw_ticks":862,"manifest_coord":636,"sy":469,"A":831,"Test_definition_background_color":858,"vy":546,"definition_background_color":859,"manifest_navigator_down":635,"update_editor_box":711,"new_definition":848,"order_of_magnitude":573,"manifest_navigator_up":628,"reset_manifest_navigator":772,"load_definition":854,"Manifest_navigator":495,"approximate":579,"on.draw":885,"scale":712,"snapshot_canvas":872,"box_height":680,"Save_viewport":865,"draw_run_time_error":808,"copy_viewport":866,"manifest_navigator_candidates":638,"on.save_settings":742,"zoom_out":888,"on.load_settings":782,"Zoomed_out":869,"schema1_of_y":667,"on.mouse_release":836,"Spawn_point":822,"approximate_up":658,"table_and_array_both_empty":689,"zoom_in":895,"on.initialize":807,"compute_layout":385,"fw_app":"driver","on.code_change":820,"get_manifest":768,"fw_parent":897,"load_manifest":694,"Menu_border_color":612,"y_of_schema1":364,"Mouse_cursor":559,"on.text_input":855,"Animating":842,"wait_for_response":781,"Definitions":503,"maybe_update_key_in_definitions":529,"add_thick_line":400,"Ticks_font":669,"copy_shape":396,"Surface":422,"Manifest":769,"Menu_background_color":611,"font":353,"vx":545,"draw_cursor":639,"Menu_command_color":613,"initialize_editor":678,"Menu_highlight_color":614,"on":1,"draw_menu_bar":861}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
while (anchorhi-anchorlo)/scale < 2 do
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
scale = scale*2
end
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":970,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":932,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":971,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
local magnitude = 1
for i=1,zeros do
magnitude = magnitude*10
end
n = n + magnitude/2
print('a', n)
for i=1,zeros do
n = n/10
end
n= math.ceil(n)
for i=1,zeros do
n = n*10
end
return n, magnitude
end
on.keychord_press = function(chord, key)
print('key', chord)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-g' then
-- special Expose-like 'global zoom' mode
-- if Zoomed_out == nil then
zoom_out()
print(Animating)
-- else
-- Animation = {
-- Save_viewport,
-- }
-- Save_viewport = nil
-- Zoomed_out = nil
-- end
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"add_hotkey_to_menu":616,"on.mouse_press":893,"survey_animation":863,"draw_manifest_navigator":677,"Cursor_node":172,"num_lines_for_manifest_navigator":676,"Page":475,"on_handle":547,"line_height":365,"animate_next_frame":825,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"on.code_submit":787,"sx":544,"surface_bounds":814,"initialize_manifest_navigator":773,"delete_definition":673,"Viewport":604,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"get_multiple_definitions_from_app":783,"text_input_on_manifest_navigator":634,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"manifest_index":637,"on.update":835,"on.keychord_press":897,"add_def_to_menu":640,"B":830,"on.key_release":720,"Num_animation_frames":840,"animate_next":882,"tick_spec":660,"set_mouse_cursor":562,"Definition_background_color":849,"draw_ticks":862,"manifest_coord":636,"sy":469,"A":831,"Test_definition_background_color":858,"vy":546,"definition_background_color":859,"manifest_navigator_down":635,"update_editor_box":711,"new_definition":848,"order_of_magnitude":573,"manifest_navigator_up":628,"reset_manifest_navigator":772,"load_definition":854,"Manifest_navigator":495,"approximate":579,"on.draw":885,"scale":712,"snapshot_canvas":872,"box_height":680,"Save_viewport":865,"draw_run_time_error":808,"copy_viewport":866,"manifest_navigator_candidates":638,"on.save_settings":742,"zoom_out":888,"on.load_settings":782,"Zoomed_out":869,"schema1_of_y":667,"on.mouse_release":836,"Spawn_point":822,"approximate_up":658,"table_and_array_both_empty":689,"zoom_in":895,"on.initialize":807,"compute_layout":385,"fw_app":"driver","on.code_change":820,"get_manifest":768,"fw_parent":896,"load_manifest":694,"Menu_border_color":612,"y_of_schema1":364,"Mouse_cursor":559,"on.text_input":855,"Animating":842,"wait_for_response":781,"Definitions":503,"maybe_update_key_in_definitions":529,"add_thick_line":400,"Ticks_font":669,"copy_shape":396,"Surface":422,"Manifest":769,"Menu_background_color":611,"font":353,"vx":545,"draw_cursor":639,"Menu_command_color":613,"initialize_editor":678,"Menu_highlight_color":614,"on":1,"draw_menu_bar":861}
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":969,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":932,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":658,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
while (anchorhi-anchorlo)/scale < 2 then
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 then
scale = scale*2
end
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
on.keychord_press = function(chord, key)
print('key', chord)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-g' then
-- special Expose-like 'global zoom' mode
-- if Zoomed_out == nil then
zoom_out()
-- else
-- Animation = {
-- Save_viewport,
-- }
-- Save_viewport = nil
-- Zoomed_out = nil
-- end
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":968,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":969,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":932,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":658,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
draw_ticks = function()
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local lo, hi = Viewport.x, sx(App.screen.width)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
if (anchorhi-anchorlo)/scale < 5 then
scale = scale/4
elseif (anchorhi-anchorlo)/scale > 10 then
scale = scale*2.5
end
while vx(anchorlo-scale) > 0 do
anchorlo = anchorlo-scale
end
while vx(anchorhi+scale) < App.screen.width-20 do
anchorhi = anchorhi+scale
end
for x=anchorlo,anchorhi,scale do
love.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)
love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)
end
-- y axis
local lo, hi = Viewport.y, sy(App.screen.height)
local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))
local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))
if (anchorhi-anchorlo)/scale < 2 then
scale = scale/2
elseif (anchorhi-anchorlo)/scale > 4 then
scale = scale*2
end
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
for y=anchorlo,anchorhi,scale do
love.graphics.line(0, vy(y), 5, vy(y))
love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)
love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)
end
love.graphics.setFont(old_font)
end
{"add_hotkey_to_menu":616,"on.mouse_press":893,"survey_animation":863,"draw_manifest_navigator":677,"Cursor_node":172,"num_lines_for_manifest_navigator":676,"Page":475,"on_handle":547,"line_height":365,"animate_next_frame":825,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"on.code_submit":787,"sx":544,"surface_bounds":814,"initialize_manifest_navigator":773,"delete_definition":673,"Viewport":604,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"get_multiple_definitions_from_app":783,"text_input_on_manifest_navigator":634,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"manifest_index":637,"on.update":835,"on.keychord_press":896,"add_def_to_menu":640,"B":830,"on.key_release":720,"Num_animation_frames":840,"animate_next":882,"tick_spec":660,"set_mouse_cursor":562,"Definition_background_color":849,"draw_ticks":862,"manifest_coord":636,"sy":469,"A":831,"Test_definition_background_color":858,"vy":546,"definition_background_color":859,"manifest_navigator_down":635,"update_editor_box":711,"new_definition":848,"order_of_magnitude":573,"manifest_navigator_up":628,"reset_manifest_navigator":772,"load_definition":854,"Manifest_navigator":495,"approximate":579,"on.draw":885,"scale":712,"snapshot_canvas":872,"box_height":680,"Save_viewport":865,"draw_run_time_error":808,"copy_viewport":866,"manifest_navigator_candidates":638,"on.save_settings":742,"zoom_out":888,"on.load_settings":782,"Zoomed_out":869,"schema1_of_y":667,"on.mouse_release":836,"Spawn_point":822,"approximate_up":658,"table_and_array_both_empty":689,"zoom_in":895,"on.initialize":807,"compute_layout":385,"fw_app":"driver","on.code_change":820,"get_manifest":768,"fw_parent":895,"load_manifest":694,"Menu_border_color":612,"y_of_schema1":364,"Mouse_cursor":559,"on.text_input":855,"Animating":842,"wait_for_response":781,"Definitions":503,"maybe_update_key_in_definitions":529,"add_thick_line":400,"Ticks_font":669,"copy_shape":396,"Surface":422,"Manifest":769,"Menu_background_color":611,"font":353,"vx":545,"draw_cursor":639,"Menu_command_color":613,"initialize_editor":678,"Menu_highlight_color":614,"on":1,"draw_menu_bar":861}
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":967,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":968,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":932,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":658,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
zoom_in = function(x,y)
-- precondition: Zoomed_out
-- precondition: Viewport == Global_viewport
-- precondition: Save_viewport exists
-- center Viewport on x,y at zoom level Saved_viewport.zoom
print('zoom in')
snapshot_canvas()
Animating = {
{
x=sx(x)-App.screen.width/Save_viewport.zoom/2,
y=sy(y)-App.screen.height/Save_viewport.zoom/2,
w=App.screen.width/Save_viewport.zoom,
h=App.screen.height/Save_viewport.zoom,
zoom=Save_viewport.zoom,
},
}
Zoomed_out = nil
Save_viewport = nil
end
{"add_hotkey_to_menu":616,"on.mouse_press":893,"survey_animation":863,"draw_manifest_navigator":677,"Cursor_node":172,"num_lines_for_manifest_navigator":676,"Page":475,"on_handle":547,"line_height":365,"animate_next_frame":825,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"on.code_submit":787,"sx":544,"surface_bounds":814,"initialize_manifest_navigator":773,"delete_definition":673,"Viewport":604,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"get_multiple_definitions_from_app":783,"text_input_on_manifest_navigator":634,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"manifest_index":637,"on.update":835,"on.keychord_press":892,"add_def_to_menu":640,"B":830,"on.key_release":720,"Num_animation_frames":840,"animate_next":882,"tick_spec":660,"set_mouse_cursor":562,"Definition_background_color":849,"draw_ticks":862,"manifest_coord":636,"sy":469,"A":831,"Test_definition_background_color":858,"vy":546,"definition_background_color":859,"manifest_navigator_down":635,"update_editor_box":711,"new_definition":848,"order_of_magnitude":573,"manifest_navigator_up":628,"reset_manifest_navigator":772,"load_definition":854,"Manifest_navigator":495,"approximate":579,"on.draw":885,"scale":712,"snapshot_canvas":872,"box_height":680,"Save_viewport":865,"draw_run_time_error":808,"copy_viewport":866,"manifest_navigator_candidates":638,"on.save_settings":742,"zoom_out":888,"on.load_settings":782,"Zoomed_out":869,"schema1_of_y":667,"on.mouse_release":836,"Spawn_point":822,"approximate_up":658,"table_and_array_both_empty":689,"zoom_in":895,"on.initialize":807,"compute_layout":385,"fw_app":"driver","on.code_change":820,"get_manifest":768,"fw_parent":894,"load_manifest":694,"Menu_border_color":612,"y_of_schema1":364,"Mouse_cursor":559,"on.text_input":855,"Animating":842,"wait_for_response":781,"Definitions":503,"maybe_update_key_in_definitions":529,"add_thick_line":400,"Ticks_font":669,"copy_shape":396,"Surface":422,"Manifest":769,"Menu_background_color":611,"font":353,"vx":545,"draw_cursor":639,"Menu_command_color":613,"initialize_editor":678,"Menu_highlight_color":614,"on":1,"draw_menu_bar":861}
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":965,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":967,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":932,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":658,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
zoom_in = function(x,y)
-- precondition: Zoomed_out
-- precondition: Viewport == Global_viewport
-- precondition: Save_viewport exists
-- center Viewport on x,y at zoom level Saved_viewport.zoom
snapshot_canvas()
Animating = {
{
x=sx(x)-App.screen.width/Save_viewport.zoom/2,
y=sy(y)-App.screen.height/Save_viewport.zoom/2,
w=App.screen.width/Save_viewport.zoom,
h=App.screen.height/Save_viewport.zoom,
zoom=Save_viewport.zoom,
},
}
Zoomed_out = nil
Save_viewport = nil
end
{"add_hotkey_to_menu":616,"on.mouse_press":893,"survey_animation":863,"draw_manifest_navigator":677,"Cursor_node":172,"num_lines_for_manifest_navigator":676,"Page":475,"on_handle":547,"line_height":365,"animate_next_frame":825,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"on.code_submit":787,"sx":544,"surface_bounds":814,"initialize_manifest_navigator":773,"delete_definition":673,"Viewport":604,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"get_multiple_definitions_from_app":783,"text_input_on_manifest_navigator":634,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"manifest_index":637,"on.update":835,"on.keychord_press":892,"add_def_to_menu":640,"B":830,"on.key_release":720,"Num_animation_frames":840,"animate_next":882,"tick_spec":660,"set_mouse_cursor":562,"Definition_background_color":849,"draw_ticks":862,"manifest_coord":636,"sy":469,"A":831,"Test_definition_background_color":858,"vy":546,"definition_background_color":859,"manifest_navigator_down":635,"update_editor_box":711,"new_definition":848,"order_of_magnitude":573,"manifest_navigator_up":628,"reset_manifest_navigator":772,"load_definition":854,"Manifest_navigator":495,"approximate":579,"on.draw":885,"scale":712,"snapshot_canvas":872,"box_height":680,"Save_viewport":865,"draw_run_time_error":808,"copy_viewport":866,"manifest_navigator_candidates":638,"on.save_settings":742,"zoom_out":888,"on.load_settings":782,"Zoomed_out":869,"schema1_of_y":667,"on.mouse_release":836,"Spawn_point":822,"approximate_up":658,"table_and_array_both_empty":689,"zoom_in":894,"on.initialize":807,"compute_layout":385,"fw_app":"driver","on.code_change":820,"get_manifest":768,"fw_parent":893,"load_manifest":694,"Menu_border_color":612,"y_of_schema1":364,"Mouse_cursor":559,"on.text_input":855,"Animating":842,"wait_for_response":781,"Definitions":503,"maybe_update_key_in_definitions":529,"add_thick_line":400,"Ticks_font":669,"copy_shape":396,"Surface":422,"Manifest":769,"Menu_background_color":611,"font":353,"vx":545,"draw_cursor":639,"Menu_command_color":613,"initialize_editor":678,"Menu_highlight_color":614,"on":1,"draw_menu_bar":861}
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":965,"wait_for_response":781,"load_definition":854,"get_default_map":937,"schema1_of_y":667,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":962,"num_lines_for_manifest_navigator":676,"test_approximate_up":966,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
on.mouse_press = function(x,y, mouse_button)
if Animating then return end
print('mouse press')
if Zoomed_out then
zoom_in(x,y)
return
end
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
if mouse_press_consumed_by_any_button_handler(HUD, x,y, mouse_button) then
return
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":964,"wait_for_response":781,"load_definition":854,"get_default_map":937,"schema1_of_y":667,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":962,"num_lines_for_manifest_navigator":676,"test_approximate_up":964,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
{"add_hotkey_to_menu":616,"on.mouse_press":893,"survey_animation":863,"draw_manifest_navigator":677,"Cursor_node":172,"num_lines_for_manifest_navigator":676,"Page":475,"on_handle":547,"line_height":365,"animate_next_frame":825,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"on.code_submit":787,"sx":544,"surface_bounds":814,"initialize_manifest_navigator":773,"delete_definition":673,"Viewport":604,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"get_multiple_definitions_from_app":783,"text_input_on_manifest_navigator":634,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"manifest_index":637,"on.update":835,"on.keychord_press":892,"add_def_to_menu":640,"B":830,"on.key_release":720,"Num_animation_frames":840,"animate_next":882,"tick_spec":660,"set_mouse_cursor":562,"Definition_background_color":849,"draw_ticks":862,"manifest_coord":636,"sy":469,"A":831,"Test_definition_background_color":858,"vy":546,"definition_background_color":859,"manifest_navigator_down":635,"update_editor_box":711,"new_definition":848,"order_of_magnitude":573,"manifest_navigator_up":628,"reset_manifest_navigator":772,"load_definition":854,"Manifest_navigator":495,"approximate":579,"on.draw":885,"scale":712,"snapshot_canvas":872,"box_height":680,"Save_viewport":865,"draw_run_time_error":808,"copy_viewport":866,"manifest_navigator_candidates":638,"on.save_settings":742,"zoom_out":888,"on.load_settings":782,"Zoomed_out":869,"schema1_of_y":667,"on.mouse_release":836,"Spawn_point":822,"approximate_up":658,"table_and_array_both_empty":689,"zoom_in":889,"on.initialize":807,"compute_layout":385,"fw_app":"driver","on.code_change":820,"get_manifest":768,"fw_parent":892,"load_manifest":694,"Menu_border_color":612,"y_of_schema1":364,"Mouse_cursor":559,"on.text_input":855,"Animating":842,"wait_for_response":781,"Definitions":503,"maybe_update_key_in_definitions":529,"add_thick_line":400,"Ticks_font":669,"copy_shape":396,"Surface":422,"Manifest":769,"Menu_background_color":611,"font":353,"vx":545,"draw_cursor":639,"Menu_command_color":613,"initialize_editor":678,"Menu_highlight_color":614,"on":1,"draw_menu_bar":861}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, iscale(App.screen.width))
-- print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, iscale(App.screen.height))
-- print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
on.keychord_press = function(chord, key)
print('key', chord)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-g' then
-- special Expose-like 'global zoom' mode
-- if Zoomed_out == nil then
print('foo')
zoom_out()
-- else
-- Animation = {
-- Save_viewport,
-- }
-- Save_viewport = nil
-- Zoomed_out = nil
-- end
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":957,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":963,"wait_for_response":781,"load_definition":854,"get_default_map":937,"schema1_of_y":667,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":962,"num_lines_for_manifest_navigator":676,"test_approximate_up":964,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
{"add_hotkey_to_menu":616,"on.mouse_press":890,"survey_animation":863,"draw_manifest_navigator":677,"Cursor_node":172,"num_lines_for_manifest_navigator":676,"Page":475,"on_handle":547,"line_height":365,"animate_next_frame":825,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"on.code_submit":787,"sx":544,"surface_bounds":814,"initialize_manifest_navigator":773,"delete_definition":673,"Viewport":604,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"get_multiple_definitions_from_app":783,"text_input_on_manifest_navigator":634,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"manifest_index":637,"on.update":835,"on.keychord_press":892,"add_def_to_menu":640,"B":830,"on.key_release":720,"Num_animation_frames":840,"animate_next":882,"tick_spec":660,"set_mouse_cursor":562,"Definition_background_color":849,"draw_ticks":862,"manifest_coord":636,"sy":469,"A":831,"Test_definition_background_color":858,"vy":546,"definition_background_color":859,"manifest_navigator_down":635,"update_editor_box":711,"new_definition":848,"order_of_magnitude":573,"manifest_navigator_up":628,"reset_manifest_navigator":772,"load_definition":854,"Manifest_navigator":495,"approximate":579,"on.draw":885,"scale":712,"snapshot_canvas":872,"box_height":680,"Save_viewport":865,"draw_run_time_error":808,"copy_viewport":866,"manifest_navigator_candidates":638,"on.save_settings":742,"zoom_out":888,"on.load_settings":782,"Zoomed_out":869,"schema1_of_y":667,"on.mouse_release":836,"Spawn_point":822,"approximate_up":658,"table_and_array_both_empty":689,"zoom_in":889,"on.initialize":807,"compute_layout":385,"fw_app":"driver","on.code_change":820,"get_manifest":768,"fw_parent":891,"load_manifest":694,"Menu_border_color":612,"y_of_schema1":364,"Mouse_cursor":559,"on.text_input":855,"Animating":842,"wait_for_response":781,"Definitions":503,"maybe_update_key_in_definitions":529,"add_thick_line":400,"Ticks_font":669,"copy_shape":396,"Surface":422,"Manifest":769,"Menu_background_color":611,"font":353,"vx":545,"draw_cursor":639,"Menu_command_color":613,"initialize_editor":678,"Menu_highlight_color":614,"on":1,"draw_menu_bar":861}
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":957,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":962,"wait_for_response":781,"load_definition":854,"get_default_map":937,"schema1_of_y":667,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":962,"num_lines_for_manifest_navigator":676,"test_approximate_up":963,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
-- print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
-- print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
-- print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
-- print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
-- print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
on.keychord_press = function(chord, key)
print('key', chord)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-g' then
-- special 'global zoom' mode
-- if Zoomed_out == nil then
print('foo')
zoom_out()
-- else
-- Animation = {
-- Save_viewport,
-- }
-- Save_viewport = nil
-- Zoomed_out = nil
-- end
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":957,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":961,"wait_for_response":781,"load_definition":854,"get_default_map":937,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":962,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
{"add_hotkey_to_menu":616,"on.mouse_press":890,"survey_animation":863,"draw_manifest_navigator":677,"Cursor_node":172,"num_lines_for_manifest_navigator":676,"Page":475,"on_handle":547,"line_height":365,"animate_next_frame":825,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"on.code_submit":787,"sx":544,"surface_bounds":814,"initialize_manifest_navigator":773,"delete_definition":673,"Viewport":604,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"get_multiple_definitions_from_app":783,"text_input_on_manifest_navigator":634,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"manifest_index":637,"on.update":835,"on.keychord_press":891,"add_def_to_menu":640,"B":830,"on.key_release":720,"Num_animation_frames":840,"animate_next":882,"tick_spec":660,"set_mouse_cursor":562,"Definition_background_color":849,"draw_ticks":862,"manifest_coord":636,"sy":469,"A":831,"Test_definition_background_color":858,"vy":546,"definition_background_color":859,"manifest_navigator_down":635,"update_editor_box":711,"new_definition":848,"order_of_magnitude":573,"manifest_navigator_up":628,"reset_manifest_navigator":772,"load_definition":854,"Manifest_navigator":495,"approximate":579,"on.draw":885,"scale":712,"snapshot_canvas":872,"box_height":680,"Save_viewport":865,"draw_run_time_error":808,"copy_viewport":866,"manifest_navigator_candidates":638,"on.save_settings":742,"zoom_out":888,"on.load_settings":782,"Zoomed_out":869,"schema1_of_y":667,"on.mouse_release":836,"Spawn_point":822,"approximate_up":658,"table_and_array_both_empty":689,"zoom_in":889,"on.initialize":807,"compute_layout":385,"fw_app":"driver","on.code_change":820,"get_manifest":768,"fw_parent":890,"load_manifest":694,"Menu_border_color":612,"y_of_schema1":364,"Mouse_cursor":559,"on.text_input":855,"Animating":842,"wait_for_response":781,"Definitions":503,"maybe_update_key_in_definitions":529,"add_thick_line":400,"Ticks_font":669,"copy_shape":396,"Surface":422,"Manifest":769,"Menu_background_color":611,"font":353,"vx":545,"draw_cursor":639,"Menu_command_color":613,"initialize_editor":678,"Menu_highlight_color":614,"on":1,"draw_menu_bar":861}
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
print(lo, hi, hi-lo)
print(order_of_magnitude(hi-lo))
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
print('lo', anchorlo, scale)
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
on.mouse_press = function(x,y, mouse_button)
if Animating then return end
print('mouse press')
if Zoomed_out then
print('zoomed out')
zoom_in(x,y)
Zoomed_out = nil
Save_viewport = nil
return
end
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
if mouse_press_consumed_by_any_button_handler(HUD, x,y, mouse_button) then
return
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
{"add_hotkey_to_menu":616,"on.mouse_press":890,"survey_animation":863,"draw_manifest_navigator":677,"Cursor_node":172,"num_lines_for_manifest_navigator":676,"Page":475,"on_handle":547,"line_height":365,"animate_next_frame":825,"load_from_iterator":670,"on_text":539,"get_definition_from_app":784,"on.code_submit":787,"sx":544,"surface_bounds":814,"initialize_manifest_navigator":773,"delete_definition":673,"Viewport":604,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":765,"get_multiple_definitions_from_app":783,"text_input_on_manifest_navigator":634,"from_viewport":823,"mouse_cursor":558,"interpolate_viewport":843,"manifest_index":637,"on.update":835,"on.keychord_press":886,"add_def_to_menu":640,"B":830,"on.key_release":720,"Num_animation_frames":840,"animate_next":882,"tick_spec":660,"set_mouse_cursor":562,"Definition_background_color":849,"draw_ticks":862,"manifest_coord":636,"sy":469,"A":831,"Test_definition_background_color":858,"vy":546,"definition_background_color":859,"manifest_navigator_down":635,"update_editor_box":711,"new_definition":848,"order_of_magnitude":573,"manifest_navigator_up":628,"reset_manifest_navigator":772,"load_definition":854,"Manifest_navigator":495,"approximate":579,"on.draw":885,"scale":712,"snapshot_canvas":872,"box_height":680,"Save_viewport":865,"draw_run_time_error":808,"copy_viewport":866,"manifest_navigator_candidates":638,"on.save_settings":742,"zoom_out":888,"on.load_settings":782,"Zoomed_out":869,"schema1_of_y":667,"on.mouse_release":836,"Spawn_point":822,"approximate_up":658,"table_and_array_both_empty":689,"zoom_in":889,"on.initialize":807,"compute_layout":385,"fw_app":"driver","on.code_change":820,"get_manifest":768,"fw_parent":889,"load_manifest":694,"Menu_border_color":612,"y_of_schema1":364,"Mouse_cursor":559,"on.text_input":855,"Animating":842,"wait_for_response":781,"Definitions":503,"maybe_update_key_in_definitions":529,"add_thick_line":400,"Ticks_font":669,"copy_shape":396,"Surface":422,"Manifest":769,"Menu_background_color":611,"font":353,"vx":545,"draw_cursor":639,"Menu_command_color":613,"initialize_editor":678,"Menu_highlight_color":614,"on":1,"draw_menu_bar":861}
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":957,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":960,"wait_for_response":781,"load_definition":854,"get_default_map":937,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":961,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
zoom_in = function(x,y)
-- precondition: Zoomed_out
-- precondition: Viewport == Global_viewport
-- precondition: Save_viewport exists
-- center Viewport on x,y at zoom level Saved_viewport.zoom
snapshot_canvas()
Animating = {
{
x=sx(x)-App.screen.width/Save_viewport.zoom/2,
y=sy(y)-App.screen.height/Save_viewport.zoom/2,
w=App.screen.width/Save_viewport.zoom,
h=App.screen.height/Save_viewport.zoom,
zoom=Save_viewport.zoom,
},
}
end
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
{"on.mouse_release":836,"text_input_on_manifest_navigator":634,"on.update":835,"on.keychord_press":886,"on_text":539,"manifest_index":637,"on.mouse_press":884,"scale":712,"copy_viewport":866,"Surface":422,"zoom_out":888,"Manifest":769,"Zoomed_out":869,"load_manifest":694,"update_editor_box":711,"get_manifest":768,"on.key_release":720,"table_and_array_both_empty":689,"Definitions":503,"schema1_of_y":667,"new_definition":848,"Num_animation_frames":840,"mouse_cursor":558,"Mouse_cursor":559,"y_of_schema1":364,"set_mouse_cursor":562,"draw_ticks":862,"Definition_background_color":849,"on.code_change":820,"line_height":365,"maybe_update_key_in_definitions":529,"Test_definition_background_color":858,"definition_background_color":859,"order_of_magnitude":573,"approximate":579,"Animating":842,"snapshot_canvas":872,"Cursor_node":172,"approximate_up":658,"add_thick_line":400,"Ticks_font":669,"font":353,"tick_spec":660,"copy_shape":396,"initialize_manifest_navigator":773,"on.text_input":855,"Save_viewport":865,"draw_cursor":639,"on.code_submit":787,"compute_layout":385,"vx":545,"on.load_settings":782,"on.save_settings":742,"zoom_in":889,"on":1,"initialize_editor":678,"on.initialize":807,"surface_bounds":814,"load_definition":854,"wait_for_response":781,"box_height":680,"fw_app":"driver","Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"fw_parent":888,"Menu_command_color":613,"Viewport":604,"Menu_highlight_color":614,"Spawn_point":822,"draw_menu_bar":861,"Page":475,"B":830,"from_viewport":823,"manifest_navigator_candidates":638,"draw_run_time_error":808,"on_handle":547,"num_lines_for_manifest_navigator":676,"interpolate_viewport":843,"sx":544,"survey_animation":863,"on.draw":885,"animate_next":882,"load_from_iterator":670,"draw_manifest_navigator":677,"get_definition_from_app":784,"sy":469,"reset_manifest_navigator":772,"animate_next_frame":825,"get_multiple_definitions_from_app":783,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"manifest_navigator_down":635,"vy":546,"A":831,"delete_definition":673,"manifest_coord":636,"move_candidate_to_front_of_manifest":632,"Manifest_navigator":495,"keychord_press_on_manifest_navigator":765}
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":957,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":959,"wait_for_response":781,"load_definition":854,"get_default_map":937,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":960,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
-- print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
-- print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
-- print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
-- print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
-- print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
{"on.mouse_release":836,"text_input_on_manifest_navigator":634,"on.update":835,"on.keychord_press":886,"on_text":539,"manifest_index":637,"on.mouse_press":884,"scale":712,"copy_viewport":866,"Surface":422,"zoom_out":888,"Manifest":769,"Zoomed_out":869,"load_manifest":694,"update_editor_box":711,"get_manifest":768,"on.key_release":720,"table_and_array_both_empty":689,"Definitions":503,"schema1_of_y":667,"new_definition":848,"Num_animation_frames":840,"mouse_cursor":558,"Mouse_cursor":559,"y_of_schema1":364,"set_mouse_cursor":562,"draw_ticks":862,"Definition_background_color":849,"on.code_change":820,"line_height":365,"maybe_update_key_in_definitions":529,"Test_definition_background_color":858,"definition_background_color":859,"order_of_magnitude":573,"approximate":579,"Animating":842,"snapshot_canvas":872,"Cursor_node":172,"approximate_up":658,"add_thick_line":400,"Ticks_font":669,"font":353,"tick_spec":660,"copy_shape":396,"initialize_manifest_navigator":773,"on.text_input":855,"Save_viewport":865,"draw_cursor":639,"on.code_submit":787,"compute_layout":385,"vx":545,"on.load_settings":782,"on.save_settings":742,"zoom_in":887,"on":1,"initialize_editor":678,"on.initialize":807,"surface_bounds":814,"load_definition":854,"wait_for_response":781,"box_height":680,"fw_app":"driver","Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"fw_parent":887,"Menu_command_color":613,"Viewport":604,"Menu_highlight_color":614,"Spawn_point":822,"draw_menu_bar":861,"Page":475,"B":830,"from_viewport":823,"manifest_navigator_candidates":638,"draw_run_time_error":808,"on_handle":547,"num_lines_for_manifest_navigator":676,"interpolate_viewport":843,"sx":544,"survey_animation":863,"on.draw":885,"animate_next":882,"load_from_iterator":670,"draw_manifest_navigator":677,"get_definition_from_app":784,"sy":469,"reset_manifest_navigator":772,"animate_next_frame":825,"get_multiple_definitions_from_app":783,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"manifest_navigator_down":635,"vy":546,"A":831,"delete_definition":673,"manifest_coord":636,"move_candidate_to_front_of_manifest":632,"Manifest_navigator":495,"keychord_press_on_manifest_navigator":765}
zoom_in = function(x,y)
-- precondition: Zoomed_out
-- precondition: Viewport == Global_viewport
-- precondition: Save_viewport exists
-- center Viewport on x,y at zoom level Saved_viewport.zoom
Animating = {
{
x=sx(x)-App.screen.width/Save_viewport.zoom/2,
y=sy(y)-App.screen.height/Save_viewport.zoom/2,
w=App.screen.width/Save_viewport.zoom,
h=App.screen.height/Save_viewport.zoom,
zoom=Save_viewport.zoom,
},
}
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":957,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":958,"wait_for_response":781,"load_definition":854,"get_default_map":937,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":959,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
{"on.mouse_release":836,"text_input_on_manifest_navigator":634,"on.update":835,"on.keychord_press":886,"on_text":539,"manifest_index":637,"on.mouse_press":884,"scale":712,"copy_viewport":866,"Surface":422,"zoom_out":870,"Manifest":769,"Zoomed_out":869,"load_manifest":694,"update_editor_box":711,"get_manifest":768,"on.key_release":720,"table_and_array_both_empty":689,"Definitions":503,"schema1_of_y":667,"new_definition":848,"Num_animation_frames":840,"mouse_cursor":558,"Mouse_cursor":559,"y_of_schema1":364,"set_mouse_cursor":562,"draw_ticks":862,"Definition_background_color":849,"on.code_change":820,"line_height":365,"maybe_update_key_in_definitions":529,"Test_definition_background_color":858,"definition_background_color":859,"order_of_magnitude":573,"approximate":579,"Animating":842,"snapshot_canvas":872,"Cursor_node":172,"approximate_up":658,"add_thick_line":400,"Ticks_font":669,"font":353,"tick_spec":660,"copy_shape":396,"initialize_manifest_navigator":773,"on.text_input":855,"Save_viewport":865,"draw_cursor":639,"on.code_submit":787,"compute_layout":385,"vx":545,"on.load_settings":782,"on.save_settings":742,"zoom_in":887,"on":1,"initialize_editor":678,"on.initialize":807,"surface_bounds":814,"load_definition":854,"wait_for_response":781,"box_height":680,"fw_app":"driver","Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"fw_parent":886,"Menu_command_color":613,"Viewport":604,"Menu_highlight_color":614,"Spawn_point":822,"draw_menu_bar":861,"Page":475,"B":830,"from_viewport":823,"manifest_navigator_candidates":638,"draw_run_time_error":808,"on_handle":547,"num_lines_for_manifest_navigator":676,"interpolate_viewport":843,"sx":544,"survey_animation":863,"on.draw":885,"animate_next":882,"load_from_iterator":670,"draw_manifest_navigator":677,"get_definition_from_app":784,"sy":469,"reset_manifest_navigator":772,"animate_next_frame":825,"get_multiple_definitions_from_app":783,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"manifest_navigator_down":635,"vy":546,"A":831,"delete_definition":673,"manifest_coord":636,"move_candidate_to_front_of_manifest":632,"Manifest_navigator":495,"keychord_press_on_manifest_navigator":765}
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
on.keychord_press = function(chord, key)
print('key', chord)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-g' then
-- special 'global zoom' mode
-- if Zoomed_out == nil then
zoom_out()
-- else
-- Animation = {
-- Save_viewport,
-- }
-- Save_viewport = nil
-- Zoomed_out = nil
-- end
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"zoom_in":920,"initialize_manifest_navigator":773,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"get_multiple_definitions_from_app":783,"text_input_on_manifest_navigator":634,"on_handle":547,"on.draw":932,"manifest_index":637,"manifest_navigator_candidates":638,"Manifest_navigator":495,"update_editor_box":711,"vy":956,"on.mouse_press":916,"y_of_schema1":364,"draw_run_time_error":808,"on.key_release":720,"on.keychord_press":919,"survey_animation":950,"animate_next":914,"mouse_cursor":558,"Mouse_cursor":559,"animate_next_frame":915,"set_mouse_cursor":562,"draw_ticks":957,"tick_spec":958,"undo_zoom_out":921,"Save_viewport":865,"surface_bounds":814,"Page":475,"Cursor_node":172,"Failing_test_definition_background_color":925,"order_of_magnitude":573,"copy_viewport":866,"load_definition":854,"add_thick_line":400,"draw_load_time_error":929,"Spawn_point":822,"draw_test_failure_indicator":935,"initialize_editor":678,"Test_definition_background_color":858,"box_height":680,"wait_for_response":781,"on":1,"on_text":539,"get_default_map":937,"on.save_settings":742,"Definition_background_color":849,"on.load_settings":940,"Animating":842,"snapshot_canvas":913,"Ticks_font":669,"Viewport":604,"from_viewport":823,"table_and_array_both_empty":689,"vx":545,"Num_animation_frames":840,"font":353,"copy_shape":396,"get_manifest":768,"get_definition_from_app":784,"load_manifest":694,"iscale":953,"approximate_up":658,"on.code_change":924,"sy":954,"definition_background_color":859,"B":830,"interpolate_viewport":843,"on.text_input":855,"approximate":579,"Definitions":503,"Surface":422,"Manifest":769,"manifest_navigator_down":635,"on.initialize":948,"Menu_background_color":611,"A":831,"Menu_border_color":612,"line_height":365,"Menu_command_color":613,"on.update":945,"Menu_highlight_color":614,"compute_layout":385,"draw_cursor":639,"sx":955,"add_hotkey_to_menu":616,"new_definition":848,"add_def_to_menu":640,"draw_manifest_navigator":677,"schema1_of_y":667,"num_lines_for_manifest_navigator":676,"keychord_press_on_manifest_navigator":765,"fw_parent":957,"reset_manifest_navigator":772,"fw_app":"driver","on.mouse_release":836,"load_from_iterator":670,"zoom_out":908,"maybe_update_key_in_definitions":529,"Zoomed_out":869,"draw_menu_bar":861,"on.code_submit":947,"manifest_coord":636,"manifest_navigator_up":628,"scale":712}
{"on.mouse_release":836,"text_input_on_manifest_navigator":634,"on.update":835,"on.keychord_press":886,"on_text":539,"manifest_index":637,"on.mouse_press":884,"scale":712,"copy_viewport":866,"Surface":422,"zoom_out":870,"Manifest":769,"Zoomed_out":869,"load_manifest":694,"update_editor_box":711,"get_manifest":768,"on.key_release":720,"table_and_array_both_empty":689,"Definitions":503,"schema1_of_y":667,"new_definition":848,"Num_animation_frames":840,"mouse_cursor":558,"Mouse_cursor":559,"y_of_schema1":364,"set_mouse_cursor":562,"draw_ticks":862,"Definition_background_color":849,"on.code_change":820,"line_height":365,"maybe_update_key_in_definitions":529,"Test_definition_background_color":858,"definition_background_color":859,"order_of_magnitude":573,"approximate":579,"Animating":842,"snapshot_canvas":872,"Cursor_node":172,"approximate_up":658,"add_thick_line":400,"Ticks_font":669,"font":353,"tick_spec":660,"copy_shape":396,"initialize_manifest_navigator":773,"on.text_input":855,"Save_viewport":865,"draw_cursor":639,"on.code_submit":787,"compute_layout":385,"vx":545,"on.load_settings":782,"on.save_settings":742,"zoom_in":880,"on":1,"initialize_editor":678,"on.initialize":807,"surface_bounds":814,"load_definition":854,"wait_for_response":781,"box_height":680,"fw_app":"driver","Menu_background_color":611,"add_def_to_menu":640,"Menu_border_color":612,"fw_parent":885,"Menu_command_color":613,"Viewport":604,"Menu_highlight_color":614,"Spawn_point":822,"draw_menu_bar":861,"Page":475,"B":830,"from_viewport":823,"manifest_navigator_candidates":638,"draw_run_time_error":808,"on_handle":547,"num_lines_for_manifest_navigator":676,"interpolate_viewport":843,"sx":544,"survey_animation":863,"on.draw":885,"animate_next":882,"load_from_iterator":670,"draw_manifest_navigator":677,"get_definition_from_app":784,"sy":469,"reset_manifest_navigator":772,"animate_next_frame":825,"get_multiple_definitions_from_app":783,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"manifest_navigator_down":635,"vy":546,"A":831,"delete_definition":673,"manifest_coord":636,"move_candidate_to_front_of_manifest":632,"Manifest_navigator":495,"keychord_press_on_manifest_navigator":765}
{"draw_menu_bar":861,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"zoom_out":908,"Definitions":503,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.code_submit":947,"num_lines_for_manifest_navigator":676,"zoom_in":920,"new_definition":848,"box_height":680,"initialize_manifest_navigator":773,"compute_layout":385,"manifest_navigator_up":628,"table_and_array_both_empty":689,"manifest_navigator_down":635,"get_multiple_definitions_from_app":783,"reset_manifest_navigator":772,"move_candidate_to_front_of_manifest":632,"load_from_iterator":670,"get_definition_from_app":784,"scale":712,"update_editor_box":711,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"on.draw":932,"add_def_to_menu":640,"schema1_of_y":667,"draw_run_time_error":808,"keychord_press_on_manifest_navigator":765,"fw_parent":956,"y_of_schema1":364,"survey_animation":950,"sx":955,"animate_next":914,"on.mouse_press":916,"on.mouse_release":836,"on.update":945,"animate_next_frame":915,"on.keychord_press":919,"draw_cursor":639,"undo_zoom_out":921,"iscale":953,"on.save_settings":742,"Failing_test_definition_background_color":925,"on.key_release":720,"Mouse_cursor":559,"surface_bounds":814,"snapshot_canvas":913,"draw_load_time_error":929,"set_mouse_cursor":562,"draw_test_failure_indicator":935,"get_manifest":768,"maybe_update_key_in_definitions":529,"Manifest":769,"on.initialize":948,"Spawn_point":822,"on.load_settings":940,"get_default_map":937,"add_thick_line":400,"order_of_magnitude":573,"copy_shape":396,"draw_ticks":957,"initialize_editor":678,"fw_app":"driver","approximate":579,"on.text_input":855,"interpolate_viewport":843,"B":830,"definition_background_color":859,"A":831,"Cursor_node":172,"text_input_on_manifest_navigator":634,"on.code_change":924,"approximate_up":658,"Zoomed_out":869,"sy":954,"Surface":422,"font":353,"Ticks_font":669,"Num_animation_frames":840,"vx":545,"from_viewport":823,"Viewport":604,"mouse_cursor":558,"load_manifest":694,"vy":956,"Animating":842,"Manifest_navigator":495,"delete_definition":673,"Definition_background_color":849,"on_text":539,"load_definition":854,"on":1,"wait_for_response":781,"Test_definition_background_color":858,"copy_viewport":866,"Page":475,"Save_viewport":865,"tick_spec":660}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, iscale(App.screen.width))
print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, iscale(App.screen.height))
print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
on.draw = function()
if Animating then
print('animating')
local q = love.graphics.newQuad((Viewport.x-Global_viewport.x)*Viewport.zoom,(Viewport.y-Global_viewport.y)*Viewport.zoom, App.screen.width, App.screen.height, Global_viewport.w*Viewport.zoom, Global_viewport.h*Viewport.zoom)
App.color{r=1,g=1,b=1}
love.graphics.draw(Canvas, q, 0,0)
return
end
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
if obj.editor.load_time_error then
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, vy(obj.y))
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(5*20*Viewport.zoom))
love.graphics.setColor(0,0,0)
love.graphics.print(obj.editor.load_time_error, vx(obj.x), error_y)
end
end
end
end
draw_run_time_error()
draw_ticks()
draw_menu_bar()
end
{"draw_menu_bar":861,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"zoom_out":908,"Definitions":503,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.code_submit":947,"num_lines_for_manifest_navigator":676,"zoom_in":920,"new_definition":848,"box_height":680,"initialize_manifest_navigator":773,"compute_layout":385,"manifest_navigator_up":628,"table_and_array_both_empty":689,"manifest_navigator_down":635,"get_multiple_definitions_from_app":783,"reset_manifest_navigator":772,"move_candidate_to_front_of_manifest":632,"load_from_iterator":670,"get_definition_from_app":784,"scale":712,"update_editor_box":711,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"on.draw":932,"add_def_to_menu":640,"schema1_of_y":667,"draw_run_time_error":808,"keychord_press_on_manifest_navigator":765,"fw_parent":955,"y_of_schema1":364,"survey_animation":950,"sx":955,"animate_next":914,"on.mouse_press":916,"on.mouse_release":836,"on.update":945,"animate_next_frame":915,"on.keychord_press":919,"draw_cursor":639,"undo_zoom_out":921,"iscale":953,"on.save_settings":742,"Failing_test_definition_background_color":925,"on.key_release":720,"Mouse_cursor":559,"surface_bounds":814,"snapshot_canvas":913,"draw_load_time_error":929,"set_mouse_cursor":562,"draw_test_failure_indicator":935,"get_manifest":768,"maybe_update_key_in_definitions":529,"Manifest":769,"on.initialize":948,"Spawn_point":822,"on.load_settings":940,"get_default_map":937,"add_thick_line":400,"order_of_magnitude":573,"copy_shape":396,"draw_ticks":951,"initialize_editor":678,"fw_app":"driver","approximate":579,"on.text_input":855,"interpolate_viewport":843,"B":830,"definition_background_color":859,"A":831,"Cursor_node":172,"text_input_on_manifest_navigator":634,"on.code_change":924,"approximate_up":658,"Zoomed_out":869,"sy":954,"Surface":422,"font":353,"Ticks_font":669,"Num_animation_frames":840,"vx":545,"from_viewport":823,"Viewport":604,"mouse_cursor":558,"load_manifest":694,"vy":956,"Animating":842,"Manifest_navigator":495,"delete_definition":673,"Definition_background_color":849,"on_text":539,"load_definition":854,"on":1,"wait_for_response":781,"Test_definition_background_color":858,"copy_viewport":866,"Page":475,"Save_viewport":865,"tick_spec":660}
{"maybe_update_key_in_definitions":529,"get_multiple_definitions_from_app":783,"schema1_of_y":667,"on.mouse_press":884,"wait_for_response":781,"line_height":365,"y_of_schema1":364,"Surface":422,"on.mouse_release":836,"on_handle":547,"Cursor_node":172,"draw_run_time_error":808,"on_text":539,"on.keychord_press":881,"survey_animation":863,"animate_next":882,"sx":544,"vx":545,"on.initialize":807,"on.draw":885,"A":831,"on.key_release":720,"scale":712,"B":830,"Menu_background_color":611,"Menu_border_color":612,"copy_viewport":866,"Menu_highlight_color":614,"zoom_out":870,"draw_menu_bar":861,"Zoomed_out":869,"add_hotkey_to_menu":616,"set_mouse_cursor":562,"draw_manifest_navigator":677,"draw_ticks":862,"zoom_in":880,"Page":475,"interpolate_viewport":843,"reset_manifest_navigator":772,"load_from_iterator":670,"get_definition_from_app":784,"Animating":842,"manifest_navigator_up":628,"approximate":579,"manifest_navigator_down":635,"font":353,"sy":469,"delete_definition":673,"Num_animation_frames":840,"move_candidate_to_front_of_manifest":632,"approximate_up":658,"keychord_press_on_manifest_navigator":765,"Ticks_font":669,"text_input_on_manifest_navigator":634,"Mouse_cursor":559,"manifest_index":637,"manifest_coord":636,"Definitions":503,"Manifest_navigator":495,"table_and_array_both_empty":689,"manifest_navigator_candidates":638,"from_viewport":823,"on.code_change":820,"Menu_command_color":613,"Spawn_point":822,"on.update":835,"Viewport":604,"definition_background_color":859,"fw_parent":884,"add_def_to_menu":640,"Manifest":769,"surface_bounds":814,"box_height":680,"load_definition":854,"fw_app":"driver","vy":546,"load_manifest":694,"on":1,"get_manifest":768,"order_of_magnitude":573,"initialize_editor":678,"animate_next_frame":825,"Definition_background_color":849,"on.save_settings":742,"Test_definition_background_color":858,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"new_definition":848,"compute_layout":385,"on.code_submit":787,"mouse_cursor":558,"snapshot_canvas":872,"draw_cursor":639,"Save_viewport":865,"on.text_input":855,"update_editor_box":711,"add_thick_line":400,"initialize_manifest_navigator":773,"copy_shape":396,"tick_spec":660}
on.mouse_press = function(x,y, mouse_button)
if Animating then return end
if Zoomed_out then
print('zoomed out')
zoom_in(x,y)
Zoomed_out = nil
Save_viewport = nil
return
end
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
if mouse_press_consumed_by_any_button_handler(HUD, x,y, mouse_button) then
return
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
{"draw_menu_bar":861,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"zoom_out":908,"Definitions":503,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.code_submit":947,"num_lines_for_manifest_navigator":676,"zoom_in":920,"new_definition":848,"box_height":680,"initialize_manifest_navigator":773,"compute_layout":385,"manifest_navigator_up":628,"table_and_array_both_empty":689,"manifest_navigator_down":635,"get_multiple_definitions_from_app":783,"reset_manifest_navigator":772,"move_candidate_to_front_of_manifest":632,"load_from_iterator":670,"get_definition_from_app":784,"scale":712,"update_editor_box":711,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"on.draw":932,"add_def_to_menu":640,"schema1_of_y":667,"draw_run_time_error":808,"keychord_press_on_manifest_navigator":765,"fw_parent":954,"y_of_schema1":364,"survey_animation":950,"sx":955,"animate_next":914,"on.mouse_press":916,"on.mouse_release":836,"on.update":945,"animate_next_frame":915,"on.keychord_press":919,"draw_cursor":639,"undo_zoom_out":921,"iscale":953,"on.save_settings":742,"Failing_test_definition_background_color":925,"on.key_release":720,"Mouse_cursor":559,"surface_bounds":814,"snapshot_canvas":913,"draw_load_time_error":929,"set_mouse_cursor":562,"draw_test_failure_indicator":935,"get_manifest":768,"maybe_update_key_in_definitions":529,"Manifest":769,"on.initialize":948,"Spawn_point":822,"on.load_settings":940,"get_default_map":937,"add_thick_line":400,"order_of_magnitude":573,"copy_shape":396,"draw_ticks":951,"initialize_editor":678,"fw_app":"driver","approximate":579,"on.text_input":855,"interpolate_viewport":843,"B":830,"definition_background_color":859,"A":831,"Cursor_node":172,"text_input_on_manifest_navigator":634,"on.code_change":924,"approximate_up":658,"Zoomed_out":869,"sy":954,"Surface":422,"font":353,"Ticks_font":669,"Num_animation_frames":840,"vx":545,"from_viewport":823,"Viewport":604,"mouse_cursor":558,"load_manifest":694,"vy":546,"Animating":842,"Manifest_navigator":495,"delete_definition":673,"Definition_background_color":849,"on_text":539,"load_definition":854,"on":1,"wait_for_response":781,"Test_definition_background_color":858,"copy_viewport":866,"Page":475,"Save_viewport":865,"tick_spec":660}
{"maybe_update_key_in_definitions":529,"get_multiple_definitions_from_app":783,"schema1_of_y":667,"on.mouse_press":884,"wait_for_response":781,"line_height":365,"y_of_schema1":364,"Surface":422,"on.mouse_release":836,"on_handle":547,"Cursor_node":172,"draw_run_time_error":808,"on_text":539,"on.keychord_press":881,"survey_animation":863,"animate_next":882,"sx":544,"vx":545,"on.initialize":807,"on.draw":797,"A":831,"on.key_release":720,"scale":712,"B":830,"Menu_background_color":611,"Menu_border_color":612,"copy_viewport":866,"Menu_highlight_color":614,"zoom_out":870,"draw_menu_bar":861,"Zoomed_out":869,"add_hotkey_to_menu":616,"set_mouse_cursor":562,"draw_manifest_navigator":677,"draw_ticks":862,"zoom_in":880,"Page":475,"interpolate_viewport":843,"reset_manifest_navigator":772,"load_from_iterator":670,"get_definition_from_app":784,"Animating":842,"manifest_navigator_up":628,"approximate":579,"manifest_navigator_down":635,"font":353,"sy":469,"delete_definition":673,"Num_animation_frames":840,"move_candidate_to_front_of_manifest":632,"approximate_up":658,"keychord_press_on_manifest_navigator":765,"Ticks_font":669,"text_input_on_manifest_navigator":634,"Mouse_cursor":559,"manifest_index":637,"manifest_coord":636,"Definitions":503,"Manifest_navigator":495,"table_and_array_both_empty":689,"manifest_navigator_candidates":638,"from_viewport":823,"on.code_change":820,"Menu_command_color":613,"Spawn_point":822,"on.update":835,"Viewport":604,"definition_background_color":859,"fw_parent":883,"add_def_to_menu":640,"Manifest":769,"surface_bounds":814,"box_height":680,"load_definition":854,"fw_app":"driver","vy":546,"load_manifest":694,"on":1,"get_manifest":768,"order_of_magnitude":573,"initialize_editor":678,"animate_next_frame":825,"Definition_background_color":849,"on.save_settings":742,"Test_definition_background_color":858,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"new_definition":848,"compute_layout":385,"on.code_submit":787,"mouse_cursor":558,"snapshot_canvas":872,"draw_cursor":639,"Save_viewport":865,"on.text_input":855,"update_editor_box":711,"add_thick_line":400,"initialize_manifest_navigator":773,"copy_shape":396,"tick_spec":660}
on.mouse_press = function(x,y, mouse_button)
if Animating then return end
if Zoomed_out then
zoom_in(x,y)
Zoomed_out = nil
Save_viewport = nil
return
end
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
if mouse_press_consumed_by_any_button_handler(HUD, x,y, mouse_button) then
return
end
local node = on_text(x,y)
if node then
-- position cursor in node
Cursor_node = node
edit.mouse_press(node.editor, x,y, mouse_button)
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
end
-- pan surface
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
end
{"draw_menu_bar":861,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"zoom_out":908,"Definitions":503,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.code_submit":947,"num_lines_for_manifest_navigator":676,"zoom_in":920,"new_definition":848,"box_height":680,"initialize_manifest_navigator":773,"compute_layout":385,"manifest_navigator_up":628,"table_and_array_both_empty":689,"manifest_navigator_down":635,"get_multiple_definitions_from_app":783,"reset_manifest_navigator":772,"move_candidate_to_front_of_manifest":632,"load_from_iterator":670,"get_definition_from_app":784,"scale":712,"update_editor_box":711,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"on.draw":932,"add_def_to_menu":640,"schema1_of_y":667,"draw_run_time_error":808,"keychord_press_on_manifest_navigator":765,"fw_parent":953,"y_of_schema1":364,"survey_animation":950,"sx":544,"animate_next":914,"on.mouse_press":916,"on.mouse_release":836,"on.update":945,"animate_next_frame":915,"on.keychord_press":919,"draw_cursor":639,"undo_zoom_out":921,"iscale":953,"on.save_settings":742,"Failing_test_definition_background_color":925,"on.key_release":720,"Mouse_cursor":559,"surface_bounds":814,"snapshot_canvas":913,"draw_load_time_error":929,"set_mouse_cursor":562,"draw_test_failure_indicator":935,"get_manifest":768,"maybe_update_key_in_definitions":529,"Manifest":769,"on.initialize":948,"Spawn_point":822,"on.load_settings":940,"get_default_map":937,"add_thick_line":400,"order_of_magnitude":573,"copy_shape":396,"draw_ticks":951,"initialize_editor":678,"fw_app":"driver","approximate":579,"on.text_input":855,"interpolate_viewport":843,"B":830,"definition_background_color":859,"A":831,"Cursor_node":172,"text_input_on_manifest_navigator":634,"on.code_change":924,"approximate_up":658,"Zoomed_out":869,"sy":954,"Surface":422,"font":353,"Ticks_font":669,"Num_animation_frames":840,"vx":545,"from_viewport":823,"Viewport":604,"mouse_cursor":558,"load_manifest":694,"vy":546,"Animating":842,"Manifest_navigator":495,"delete_definition":673,"Definition_background_color":849,"on_text":539,"load_definition":854,"on":1,"wait_for_response":781,"Test_definition_background_color":858,"copy_viewport":866,"Page":475,"Save_viewport":865,"tick_spec":660}
{"maybe_update_key_in_definitions":529,"get_multiple_definitions_from_app":783,"schema1_of_y":667,"on.mouse_press":883,"wait_for_response":781,"line_height":365,"y_of_schema1":364,"Surface":422,"on.mouse_release":836,"on_handle":547,"Cursor_node":172,"draw_run_time_error":808,"on_text":539,"on.keychord_press":881,"survey_animation":863,"animate_next":882,"sx":544,"vx":545,"on.initialize":807,"on.draw":797,"A":831,"on.key_release":720,"scale":712,"B":830,"Menu_background_color":611,"Menu_border_color":612,"copy_viewport":866,"Menu_highlight_color":614,"zoom_out":870,"draw_menu_bar":861,"Zoomed_out":869,"add_hotkey_to_menu":616,"set_mouse_cursor":562,"draw_manifest_navigator":677,"draw_ticks":862,"zoom_in":880,"Page":475,"interpolate_viewport":843,"reset_manifest_navigator":772,"load_from_iterator":670,"get_definition_from_app":784,"Animating":842,"manifest_navigator_up":628,"approximate":579,"manifest_navigator_down":635,"font":353,"sy":469,"delete_definition":673,"Num_animation_frames":840,"move_candidate_to_front_of_manifest":632,"approximate_up":658,"keychord_press_on_manifest_navigator":765,"Ticks_font":669,"text_input_on_manifest_navigator":634,"Mouse_cursor":559,"manifest_index":637,"manifest_coord":636,"Definitions":503,"Manifest_navigator":495,"table_and_array_both_empty":689,"manifest_navigator_candidates":638,"from_viewport":823,"on.code_change":820,"Menu_command_color":613,"Spawn_point":822,"on.update":835,"Viewport":604,"definition_background_color":859,"fw_parent":882,"add_def_to_menu":640,"Manifest":769,"surface_bounds":814,"box_height":680,"load_definition":854,"fw_app":"driver","vy":546,"load_manifest":694,"on":1,"get_manifest":768,"order_of_magnitude":573,"initialize_editor":678,"animate_next_frame":825,"Definition_background_color":849,"on.save_settings":742,"Test_definition_background_color":858,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"new_definition":848,"compute_layout":385,"on.code_submit":787,"mouse_cursor":558,"snapshot_canvas":872,"draw_cursor":639,"Save_viewport":865,"on.text_input":855,"update_editor_box":711,"add_thick_line":400,"initialize_manifest_navigator":773,"copy_shape":396,"tick_spec":660}
{"draw_menu_bar":861,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"zoom_out":908,"Definitions":503,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.code_submit":947,"num_lines_for_manifest_navigator":676,"zoom_in":920,"new_definition":848,"box_height":680,"initialize_manifest_navigator":773,"compute_layout":385,"manifest_navigator_up":628,"table_and_array_both_empty":689,"manifest_navigator_down":635,"get_multiple_definitions_from_app":783,"reset_manifest_navigator":772,"move_candidate_to_front_of_manifest":632,"load_from_iterator":670,"get_definition_from_app":784,"scale":712,"update_editor_box":711,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"on.draw":932,"add_def_to_menu":640,"schema1_of_y":667,"draw_run_time_error":808,"keychord_press_on_manifest_navigator":765,"fw_parent":951,"y_of_schema1":364,"survey_animation":950,"sx":544,"animate_next":914,"on.mouse_press":916,"on.mouse_release":836,"on.update":945,"animate_next_frame":915,"on.keychord_press":919,"draw_cursor":639,"undo_zoom_out":921,"iscale":953,"on.save_settings":742,"Failing_test_definition_background_color":925,"on.key_release":720,"Mouse_cursor":559,"surface_bounds":814,"snapshot_canvas":913,"draw_load_time_error":929,"set_mouse_cursor":562,"draw_test_failure_indicator":935,"get_manifest":768,"maybe_update_key_in_definitions":529,"Manifest":769,"on.initialize":948,"Spawn_point":822,"on.load_settings":940,"get_default_map":937,"add_thick_line":400,"order_of_magnitude":573,"copy_shape":396,"draw_ticks":951,"initialize_editor":678,"fw_app":"driver","approximate":579,"on.text_input":855,"interpolate_viewport":843,"B":830,"definition_background_color":859,"A":831,"Cursor_node":172,"text_input_on_manifest_navigator":634,"on.code_change":924,"approximate_up":658,"Zoomed_out":869,"sy":469,"Surface":422,"font":353,"Ticks_font":669,"Num_animation_frames":840,"vx":545,"from_viewport":823,"Viewport":604,"mouse_cursor":558,"load_manifest":694,"vy":546,"Animating":842,"Manifest_navigator":495,"delete_definition":673,"Definition_background_color":849,"on_text":539,"load_definition":854,"on":1,"wait_for_response":781,"Test_definition_background_color":858,"copy_viewport":866,"Page":475,"Save_viewport":865,"tick_spec":660}
{"maybe_update_key_in_definitions":529,"get_multiple_definitions_from_app":783,"schema1_of_y":667,"on.mouse_press":879,"wait_for_response":781,"line_height":365,"y_of_schema1":364,"Surface":422,"on.mouse_release":836,"on_handle":547,"Cursor_node":172,"draw_run_time_error":808,"on_text":539,"on.keychord_press":881,"survey_animation":863,"animate_next":882,"sx":544,"vx":545,"on.initialize":807,"on.draw":797,"A":831,"on.key_release":720,"scale":712,"B":830,"Menu_background_color":611,"Menu_border_color":612,"copy_viewport":866,"Menu_highlight_color":614,"zoom_out":870,"draw_menu_bar":861,"Zoomed_out":869,"add_hotkey_to_menu":616,"set_mouse_cursor":562,"draw_manifest_navigator":677,"draw_ticks":862,"zoom_in":880,"Page":475,"interpolate_viewport":843,"reset_manifest_navigator":772,"load_from_iterator":670,"get_definition_from_app":784,"Animating":842,"manifest_navigator_up":628,"approximate":579,"manifest_navigator_down":635,"font":353,"sy":469,"delete_definition":673,"Num_animation_frames":840,"move_candidate_to_front_of_manifest":632,"approximate_up":658,"keychord_press_on_manifest_navigator":765,"Ticks_font":669,"text_input_on_manifest_navigator":634,"Mouse_cursor":559,"manifest_index":637,"manifest_coord":636,"Definitions":503,"Manifest_navigator":495,"table_and_array_both_empty":689,"manifest_navigator_candidates":638,"from_viewport":823,"on.code_change":820,"Menu_command_color":613,"Spawn_point":822,"on.update":835,"Viewport":604,"definition_background_color":859,"fw_parent":881,"add_def_to_menu":640,"Manifest":769,"surface_bounds":814,"box_height":680,"load_definition":854,"fw_app":"driver","vy":546,"load_manifest":694,"on":1,"get_manifest":768,"order_of_magnitude":573,"initialize_editor":678,"animate_next_frame":825,"Definition_background_color":849,"on.save_settings":742,"Test_definition_background_color":858,"on.load_settings":782,"num_lines_for_manifest_navigator":676,"new_definition":848,"compute_layout":385,"on.code_submit":787,"mouse_cursor":558,"snapshot_canvas":872,"draw_cursor":639,"Save_viewport":865,"on.text_input":855,"update_editor_box":711,"add_thick_line":400,"initialize_manifest_navigator":773,"copy_shape":396,"tick_spec":660}
animate_next = function(dt)
if Animating[1].step and Animating[1].step >= Num_animation_frames then
table.remove(Animating, 1)
if #Animating == 0 then
Animating = nil
Canvas = nil
A()
return
end
end
animate_next_frame(Animating[1], dt)
end
{"draw_menu_bar":861,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"zoom_out":908,"Definitions":503,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.code_submit":947,"num_lines_for_manifest_navigator":676,"zoom_in":920,"new_definition":848,"box_height":680,"initialize_manifest_navigator":773,"compute_layout":385,"manifest_navigator_up":628,"table_and_array_both_empty":689,"manifest_navigator_down":635,"get_multiple_definitions_from_app":783,"reset_manifest_navigator":772,"move_candidate_to_front_of_manifest":632,"load_from_iterator":670,"get_definition_from_app":784,"scale":712,"update_editor_box":711,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"on.draw":932,"add_def_to_menu":640,"schema1_of_y":667,"draw_run_time_error":808,"keychord_press_on_manifest_navigator":765,"fw_parent":951,"y_of_schema1":364,"survey_animation":950,"sx":544,"animate_next":914,"on.mouse_press":916,"on.mouse_release":836,"on.update":945,"animate_next_frame":915,"on.keychord_press":919,"draw_cursor":639,"undo_zoom_out":921,"iscale":952,"on.save_settings":742,"Failing_test_definition_background_color":925,"on.key_release":720,"Mouse_cursor":559,"surface_bounds":814,"snapshot_canvas":913,"draw_load_time_error":929,"set_mouse_cursor":562,"draw_test_failure_indicator":935,"get_manifest":768,"maybe_update_key_in_definitions":529,"Manifest":769,"on.initialize":948,"Spawn_point":822,"on.load_settings":940,"get_default_map":937,"add_thick_line":400,"order_of_magnitude":573,"copy_shape":396,"draw_ticks":951,"initialize_editor":678,"fw_app":"driver","approximate":579,"on.text_input":855,"interpolate_viewport":843,"B":830,"definition_background_color":859,"A":831,"Cursor_node":172,"text_input_on_manifest_navigator":634,"on.code_change":924,"approximate_up":658,"Zoomed_out":869,"sy":469,"Surface":422,"font":353,"Ticks_font":669,"Num_animation_frames":840,"vx":545,"from_viewport":823,"Viewport":604,"mouse_cursor":558,"load_manifest":694,"vy":546,"Animating":842,"Manifest_navigator":495,"delete_definition":673,"Definition_background_color":849,"on_text":539,"load_definition":854,"on":1,"wait_for_response":781,"Test_definition_background_color":858,"copy_viewport":866,"Page":475,"Save_viewport":865,"tick_spec":660}
on.keychord_press = function(chord, key)
print('key', chord)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-g' then
-- special 'global zoom' mode
if Zoomed_out == nil then
zoom_out()
else
Animation = {
Save_viewport,
}
Save_viewport = nil
Zoomed_out = nil
end
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
B(--[[preserve screen_top of cursor node]] true)
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"Save_viewport":865,"y_of_schema1":364,"copy_viewport":866,"get_manifest":768,"zoom_out":908,"load_manifest":694,"Zoomed_out":869,"on.code_change":924,"scale":712,"undo_zoom_out":921,"zoom_in":920,"Failing_test_definition_background_color":925,"draw_load_time_error":929,"Menu_border_color":612,"Manifest":769,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":861,"get_default_map":937,"Animating":842,"B":830,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"load_from_iterator":670,"get_definition_from_app":784,"on.draw":932,"Surface":422,"manifest_navigator_up":628,"on.code_submit":947,"manifest_navigator_down":635,"add_hotkey_to_menu":616,"delete_definition":673,"schema1_of_y":667,"move_candidate_to_front_of_manifest":632,"on.text_input":855,"keychord_press_on_manifest_navigator":765,"on.mouse_press":916,"text_input_on_manifest_navigator":634,"on.mouse_release":836,"Spawn_point":822,"draw_cursor":639,"get_multiple_definitions_from_app":783,"manifest_index":637,"Menu_background_color":611,"on":1,"wait_for_response":781,"box_height":680,"add_def_to_menu":640,"on_handle":547,"sx":544,"sy":469,"draw_ticks":951,"Page":475,"initialize_manifest_navigator":773,"line_height":365,"on_text":539,"on.key_release":720,"approximate_up":658,"Definition_background_color":849,"draw_test_failure_indicator":935,"new_definition":848,"draw_run_time_error":808,"Manifest_navigator":495,"add_thick_line":400,"compute_layout":385,"mouse_cursor":558,"survey_animation":950,"Mouse_cursor":559,"animate_next":914,"manifest_coord":636,"tick_spec":660,"set_mouse_cursor":562,"from_viewport":823,"Num_animation_frames":840,"animate_next_frame":915,"update_editor_box":711,"Cursor_node":172,"on.keychord_press":919,"on.update":945,"fw_parent":950,"table_and_array_both_empty":689,"fw_app":"driver","order_of_magnitude":573,"load_definition":854,"font":353,"vy":546,"surface_bounds":814,"approximate":579,"Test_definition_background_color":858,"Viewport":604,"definition_background_color":859,"interpolate_viewport":843,"vx":545,"initialize_editor":678,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"on.initialize":948,"A":831,"maybe_update_key_in_definitions":529,"manifest_navigator_candidates":638,"Ticks_font":669,"snapshot_canvas":913,"copy_shape":396}
{"compute_layout":385,"on.code_change":820,"maybe_update_key_in_definitions":529,"add_thick_line":400,"copy_shape":396,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Definition_background_color":849,"Menu_highlight_color":614,"draw_menu_bar":861,"add_hotkey_to_menu":616,"on_handle":547,"num_lines_for_manifest_navigator":676,"font":353,"reset_manifest_navigator":772,"load_from_iterator":670,"get_definition_from_app":784,"sx":544,"vx":545,"manifest_navigator_up":628,"on.mouse_release":836,"on.key_release":720,"on.code_submit":787,"keychord_press_on_manifest_navigator":765,"Test_definition_background_color":858,"Page":475,"definition_background_color":859,"mouse_cursor":558,"initialize_manifest_navigator":773,"Mouse_cursor":559,"y_of_schema1":364,"manifest_navigator_candidates":638,"on.text_input":855,"set_mouse_cursor":562,"get_multiple_definitions_from_app":783,"scale":712,"snapshot_canvas":872,"wait_for_response":781,"Save_viewport":865,"initialize_editor":678,"copy_viewport":866,"zoom_out":870,"text_input_on_manifest_navigator":634,"Zoomed_out":869,"on.draw":797,"schema1_of_y":667,"move_candidate_to_front_of_manifest":632,"Num_animation_frames":840,"on.mouse_press":879,"zoom_in":880,"update_editor_box":711,"draw_run_time_error":808,"tick_spec":660,"add_def_to_menu":640,"on.keychord_press":881,"manifest_navigator_down":635,"survey_animation":863,"draw_ticks":862,"animate_next":841,"on.update":835,"Manifest_navigator":495,"line_height":365,"draw_manifest_navigator":677,"on.initialize":807,"animate_next_frame":825,"manifest_coord":636,"order_of_magnitude":573,"load_definition":854,"Viewport":604,"on":1,"fw_parent":880,"vy":546,"fw_app":"driver","box_height":680,"surface_bounds":814,"sy":469,"Manifest":769,"delete_definition":673,"on.save_settings":742,"load_manifest":694,"on.load_settings":782,"get_manifest":768,"Surface":422,"Spawn_point":822,"draw_cursor":639,"from_viewport":823,"table_and_array_both_empty":689,"interpolate_viewport":843,"Definitions":503,"manifest_index":637,"new_definition":848,"Cursor_node":172,"Ticks_font":669,"Animating":842,"B":830,"approximate_up":658,"approximate":579,"A":831,"on_text":539}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, sx(App.screen.width))
print('x ticks', Viewport.x, App.screen.width, sx(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, sy(App.screen.height))
print('y ticks', Viewport.y, App.screen.height, sx(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
zoom_in = function(x,y)
-- precondition: Zoomed_out
-- precondition: Viewport == Global_viewport
-- precondition: Save_viewport exists
-- center Viewport on x,y at zoom level Saved_viewport.zoom
Animation = {
{
x=sx(x)-App.screen.width/Save_viewport.zoom/2,
y=sy(y)-App.screen.height/Save_viewport.zoom/2,
w=App.screen.width/Save_viewport.zoom,
h=App.screen.height/Save_viewport.zoom,
zoom=Save_viewport.zoom,
},
}
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxx+100
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"compute_layout":385,"on.code_change":820,"maybe_update_key_in_definitions":529,"add_thick_line":400,"copy_shape":396,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Definition_background_color":849,"Menu_highlight_color":614,"draw_menu_bar":861,"add_hotkey_to_menu":616,"on_handle":547,"num_lines_for_manifest_navigator":676,"font":353,"reset_manifest_navigator":772,"load_from_iterator":670,"get_definition_from_app":784,"sx":544,"vx":545,"manifest_navigator_up":628,"on.mouse_release":836,"on.key_release":720,"on.code_submit":787,"keychord_press_on_manifest_navigator":765,"Test_definition_background_color":858,"Page":475,"definition_background_color":859,"mouse_cursor":558,"initialize_manifest_navigator":773,"Mouse_cursor":559,"y_of_schema1":364,"manifest_navigator_candidates":638,"on.text_input":855,"set_mouse_cursor":562,"get_multiple_definitions_from_app":783,"scale":712,"snapshot_canvas":872,"wait_for_response":781,"Save_viewport":865,"initialize_editor":678,"copy_viewport":866,"zoom_out":870,"text_input_on_manifest_navigator":634,"Zoomed_out":869,"on.draw":797,"schema1_of_y":667,"move_candidate_to_front_of_manifest":632,"Num_animation_frames":840,"on.mouse_press":879,"zoom_in":880,"update_editor_box":711,"draw_run_time_error":808,"tick_spec":660,"add_def_to_menu":640,"on.keychord_press":871,"manifest_navigator_down":635,"survey_animation":863,"draw_ticks":862,"animate_next":841,"on.update":835,"Manifest_navigator":495,"line_height":365,"draw_manifest_navigator":677,"on.initialize":807,"animate_next_frame":825,"manifest_coord":636,"order_of_magnitude":573,"load_definition":854,"Viewport":604,"on":1,"fw_parent":879,"vy":546,"fw_app":"driver","box_height":680,"surface_bounds":814,"sy":469,"Manifest":769,"delete_definition":673,"on.save_settings":742,"load_manifest":694,"on.load_settings":782,"get_manifest":768,"Surface":422,"Spawn_point":822,"draw_cursor":639,"from_viewport":823,"table_and_array_both_empty":689,"interpolate_viewport":843,"Definitions":503,"manifest_index":637,"new_definition":848,"Cursor_node":172,"Ticks_font":669,"Animating":842,"B":830,"approximate_up":658,"approximate":579,"A":831,"on_text":539}
{"survey_animation":950,"approximate_up":658,"animate_next":914,"sy":469,"animate_next_frame":915,"draw_cursor":639,"Failing_test_definition_background_color":925,"undo_zoom_out":921,"draw_load_time_error":929,"font":353,"surface_bounds":814,"on.save_settings":742,"on.load_settings":940,"initialize_editor":678,"get_default_map":937,"table_and_array_both_empty":689,"Ticks_font":669,"Menu_background_color":611,"interpolate_viewport":843,"get_manifest":768,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"on.text_input":855,"manifest_index":637,"Definitions":503,"manifest_navigator_candidates":638,"Surface":422,"add_def_to_menu":640,"vx":545,"Manifest":769,"Viewport":604,"Num_animation_frames":840,"load_manifest":694,"vy":546,"manifest_navigator_up":628,"on":1,"manifest_navigator_down":635,"maybe_update_key_in_definitions":529,"move_candidate_to_front_of_manifest":632,"on.initialize":948,"new_definition":848,"A":831,"copy_shape":396,"Test_definition_background_color":858,"B":830,"definition_background_color":859,"num_lines_for_manifest_navigator":676,"load_definition":854,"reset_manifest_navigator":772,"on_handle":547,"Animating":842,"load_from_iterator":670,"draw_menu_bar":861,"get_definition_from_app":784,"on_text":539,"delete_definition":673,"snapshot_canvas":913,"sx":544,"Save_viewport":865,"copy_viewport":866,"on.mouse_press":916,"on.code_change":924,"on.mouse_release":836,"zoom_out":908,"on.update":945,"Zoomed_out":869,"on.keychord_press":919,"keychord_press_on_manifest_navigator":765,"Menu_border_color":612,"draw_run_time_error":808,"Cursor_node":172,"zoom_in":920,"draw_test_failure_indicator":935,"from_viewport":823,"draw_manifest_navigator":677,"mouse_cursor":558,"manifest_coord":636,"Mouse_cursor":559,"tick_spec":660,"schema1_of_y":667,"y_of_schema1":364,"set_mouse_cursor":562,"compute_layout":385,"scale":712,"add_thick_line":400,"on.code_submit":947,"update_editor_box":711,"Manifest_navigator":495,"on.key_release":720,"Definition_background_color":849,"on.draw":932,"order_of_magnitude":573,"Page":475,"initialize_manifest_navigator":773,"line_height":365,"draw_ticks":862,"approximate":579,"box_height":680,"add_hotkey_to_menu":616,"get_multiple_definitions_from_app":783,"fw_parent":949,"Spawn_point":822,"fw_app":"driver","wait_for_response":781}
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxx+100
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"font":353,"Surface":422,"mouse_cursor":558,"Mouse_cursor":559,"surface_bounds":814,"y_of_schema1":364,"Viewport":604,"set_mouse_cursor":562,"on.initialize":948,"A":831,"Spawn_point":822,"from_viewport":823,"interpolate_viewport":843,"Page":475,"approximate":579,"B":830,"draw_ticks":862,"sy":469,"Num_animation_frames":840,"add_thick_line":400,"copy_shape":396,"fw_parent":948,"on.text_input":855,"add_def_to_menu":640,"get_manifest":768,"Manifest_navigator":495,"on.update":945,"compute_layout":385,"Definition_background_color":849,"undo_zoom_out":921,"Test_definition_background_color":858,"approximate_up":658,"definition_background_color":859,"draw_cursor":639,"vx":545,"reset_manifest_navigator":772,"Ticks_font":669,"order_of_magnitude":573,"on.key_release":720,"Menu_background_color":611,"load_definition":854,"Menu_border_color":612,"initialize_editor":678,"Menu_command_color":613,"snapshot_canvas":913,"Menu_highlight_color":614,"Save_viewport":865,"on":1,"add_hotkey_to_menu":616,"Definitions":503,"on.save_settings":742,"zoom_out":908,"on.load_settings":940,"Zoomed_out":869,"on.code_submit":947,"on.mouse_release":836,"tick_spec":660,"load_manifest":694,"table_and_array_both_empty":689,"on.keychord_press":919,"update_editor_box":711,"manifest_navigator_up":628,"initialize_manifest_navigator":773,"manifest_navigator_down":635,"scale":712,"fw_app":"driver","get_multiple_definitions_from_app":783,"move_candidate_to_front_of_manifest":632,"new_definition":848,"draw_menu_bar":861,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"wait_for_response":781,"manifest_coord":636,"draw_manifest_navigator":677,"manifest_index":637,"num_lines_for_manifest_navigator":676,"manifest_navigator_candidates":638,"draw_load_time_error":929,"Failing_test_definition_background_color":925,"on.draw":932,"zoom_in":920,"load_from_iterator":670,"on_handle":547,"get_definition_from_app":784,"vy":546,"draw_test_failure_indicator":935,"Cursor_node":172,"on_text":539,"draw_run_time_error":808,"box_height":680,"get_default_map":937,"survey_animation":949,"on.mouse_press":916,"sx":544,"on.code_change":924,"animate_next":914,"copy_viewport":866,"keychord_press_on_manifest_navigator":765,"delete_definition":673,"maybe_update_key_in_definitions":529,"Animating":842,"animate_next_frame":915,"line_height":365,"Manifest":769}
{"font":353,"Surface":422,"mouse_cursor":558,"Mouse_cursor":559,"surface_bounds":814,"y_of_schema1":364,"Viewport":604,"set_mouse_cursor":562,"on.initialize":948,"A":831,"Spawn_point":822,"from_viewport":823,"interpolate_viewport":843,"Page":475,"approximate":579,"B":830,"draw_ticks":862,"sy":469,"Num_animation_frames":840,"add_thick_line":400,"copy_shape":396,"fw_parent":947,"on.text_input":855,"add_def_to_menu":640,"get_manifest":768,"Manifest_navigator":495,"on.update":945,"compute_layout":385,"Definition_background_color":849,"undo_zoom_out":921,"Test_definition_background_color":858,"approximate_up":658,"definition_background_color":859,"draw_cursor":639,"vx":545,"reset_manifest_navigator":772,"Ticks_font":669,"order_of_magnitude":573,"on.key_release":720,"Menu_background_color":611,"load_definition":854,"Menu_border_color":612,"initialize_editor":678,"Menu_command_color":613,"snapshot_canvas":913,"Menu_highlight_color":614,"Save_viewport":865,"on":1,"add_hotkey_to_menu":616,"Definitions":503,"on.save_settings":742,"zoom_out":908,"on.load_settings":940,"Zoomed_out":869,"on.code_submit":947,"on.mouse_release":836,"tick_spec":660,"load_manifest":694,"table_and_array_both_empty":689,"on.keychord_press":919,"update_editor_box":711,"manifest_navigator_up":628,"initialize_manifest_navigator":773,"manifest_navigator_down":635,"scale":712,"fw_app":"driver","get_multiple_definitions_from_app":783,"move_candidate_to_front_of_manifest":632,"new_definition":848,"draw_menu_bar":861,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"wait_for_response":781,"manifest_coord":636,"draw_manifest_navigator":677,"manifest_index":637,"num_lines_for_manifest_navigator":676,"manifest_navigator_candidates":638,"draw_load_time_error":929,"Failing_test_definition_background_color":925,"on.draw":932,"zoom_in":920,"load_from_iterator":670,"on_handle":547,"get_definition_from_app":784,"vy":546,"draw_test_failure_indicator":935,"Cursor_node":172,"on_text":539,"draw_run_time_error":808,"box_height":680,"get_default_map":937,"survey_animation":906,"on.mouse_press":916,"sx":544,"on.code_change":924,"animate_next":914,"copy_viewport":866,"keychord_press_on_manifest_navigator":765,"delete_definition":673,"maybe_update_key_in_definitions":529,"Animating":842,"animate_next_frame":915,"line_height":365,"Manifest":769}
Now try pressing `ctrl+l` in this driver app. Select `on` by some combination
of typing letters and moving the arrow keys. It provides a useful orientation
of available hooks when programming live, and also mentions an important
gotcha.
Each definition lives in a blue box. You have to follow a specific Lua syntax
where the name of the definition comes first: `foo = function(...) ... end`
rather than `function foo(...) ... end`. The driver treats the first word in a
definition is its name.
Functions that start with `test_` are tests, and run any time you hit `f4`.
The driver will highlight them in green or red when they fail.
* This app encourages a style of development that requires top-level
definitions to be decoupled from each other. No live functions load until
all definitions have been run. However top-level globals are initialized as
they're loaded. This makes a definition like this a very bad idea, assuming
`Foo` and `Bar` are top-level variables:
Foo = {
Bar
}
Don't assume that Bar will exist when Foo is defined. We don't currently
have any checks for this.
elseif chord == 'C-g' then
-- special Expose-like 'global zoom' mode
if Zoomed_out == nil then
zoom_out()
else
undo_zoom_out()
end
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
A(--[[preserve screen_top of cursor node]] true)
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
if chord == 'return' then
A(--[[preserve screen_top of cursor node]] true)
else
B(--[[preserve screen_top of cursor node]] true)
end
on.load_settings = function(settings)
App_name = load_manifest()
print('app name', App_name, settings)
-- backstop any default settings for this app, and stash everything to a global for on.save_settings
if settings == nil then
Settings = {}
else
Settings = settings
end
if Settings[App_name] == nil then
Settings[App_name] = {}
Settings[App_name].viewport = Viewport
Settings[App_name].definitions = get_default_map()
end
Viewport = Settings[App_name].viewport
Definitions = Settings[App_name].definitions
local names = {}
for name, _ in pairs(Definitions) do
table.insert(names, name)
end
local defs = get_multiple_definitions_from_app(names)
for name, def_editor in pairs(Definitions) do
if def_editor.type == nil then
def_editor.type = 'text'
end
if def_editor.bg == nil then
def_editor.bg = definition_background_color(name)
end
if def_editor.width == nil then
def_editor.width = 600
end
if defs[name] then
def_editor.data = load_from_iterator(defs[name]:gmatch("[^\r\n]+"))
else
-- app doesn't know about this definition
-- just delete it from the driver for now
print('deleting', name)
Definitions[name] = nil
end
end
end
A = function(preserve_screen_top_of_cursor_node)
-- print('A')
love.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current font
-- translate Definitions to Surface
Surface = {}
for _,node in pairs(Definitions) do
compute_layout(node, node.x,node.y, Surface, preserve_screen_top_of_cursor_node)
end
-- continue the pipeline
B(preserve_screen_top_of_cursor_node)
-- TODO: ugly that we're manipulating editor objects twice
end
get_multiple_definitions_from_app = function(defs)
-- batch interface for speed
-- turn an array of string names into a table of string definitions corresponding to them
if #defs == 0 then return {} end
live.send_to_app('GET* '..table.concat(defs, ' '))
local response = wait_for_response()
local result = {}
for def in response:gmatch('(.-)\n==fw: definition boundary==\n') do
local name = live.get_cmd_from_buffer(def)
if name == nil then
print('failed to get cmd from buffer', def)
end
result[name] = def
end
return result
end
definition_background_color = function(name)
if name and starts_with(name, 'test_') then
return Test_definition_background_color
else
return Definition_background_color
end
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+2,maxy+1
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
-- print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 4 do
-- print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 8 do
-- print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
-- print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
-- print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
-- print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
-- print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-40, vy+2)
end
love.graphics.setFont(old_font)
end
love.graphics.setColor(1,0,0)
if Animating then
local q = love.graphics.newQuad((Viewport.x-Global_viewport.x)*Viewport.zoom,(Viewport.y-Global_viewport.y)*Viewport.zoom, App.screen.width, App.screen.height, Global_viewport.w*Viewport.zoom, Global_viewport.h*Viewport.zoom)
App.color{r=1,g=1,b=1}
love.graphics.draw(Canvas, q, 0,0)
return
end
edit.draw(obj.editor, obj.fg or {r=0,g=0,b=0}, not obj.show_cursor)
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
draw_load_time_error(obj)
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
-- step 1: scale down
for i=1,zeros do
n = n/10
end
n = math.ceil(n)
if n == 0 then n = 1 end
-- step 2: scale back up
local magnitude = 1
for i=1,zeros do
n = n*10
magnitude = magnitude*10
end
return n, magnitude
end
test_approximate_up = function()
check_eq(approximate_up(12, 1), 20, 'easy case')
-- when scale down ends up at 0
check_eq(approximate_up(2, 1), 10, 'below 5')
check_eq(approximate_up(7, 1), 10, 'above 5')
end
vy = function(sy)
-- turn surface coordinates into viewport coordinates
return Menu_bar_height + scale(sy-Viewport.y)
end
sx = function(vx)
-- turn viewport coordinates into surface coordinates
return iscale(vx) + Viewport.x
end
iscale = function(vd)
return vd/Viewport.zoom
end
on.code_submit = function(editor)
if not editor.load_time_error then
Manifest_navigator.reload = true
end
-- update definition backgrounds of failing tests
for name,node in pairs(Definitions) do
-- ignore temporary definitions with numeric indices; they haven't been saved yet
if type(name) == 'string' and starts_with(name, 'test_') then
if Client_app_test_failures[name] then
node.bg = Failing_test_definition_background_color
else
node.bg = Test_definition_background_color
end
end
end
A()
end
on.update = function(dt)
if Animating then
animate_next(dt)
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x()-Move.xoff)
Move.node.y = sy(App.mouse_y()-Move.yoff)
B()
return
end
end
get_default_map = function()
-- Suggest a map for one's own code.
-- Mostly the driver manages its map of an app's code outside the app. However, an app can suggest a default map for people who haven't created one.
live.send_to_app('DEFAULT_MAP')
local response
repeat
love.timer.sleep(0.01)
response = live.receive_from_app()
until response
local result = {}
if #response == 0 then
return result
end
return json.decode(response)
end
draw_test_failure_indicator = function()
if Client_app_test_failures == nil then
return
end
if next(Client_app_test_failures, nil) == nil then
return
end
App.color(Failing_test_definition_background_color)
local border_width = App.screen.width/40, App.screen.height
love.graphics.rectangle('fill', 0,0, border_width,App.screen.height)
love.graphics.rectangle('fill', App.screen.width-border_width, 0, border_width, App.screen.height)
love.graphics.rectangle('fill', 0,App.screen.height-border_width, App.screen.width, border_width)
end
draw_load_time_error = function(obj)
if not obj.editor.load_time_error then return end
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, vy(obj.y))
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(5*20*Viewport.zoom))
love.graphics.setColor(0,0,0)
love.graphics.print(obj.editor.load_time_error, vx(obj.x), error_y)
end
Failing_test_definition_background_color = {r=1,g=0.7,b=0.7}
undo_zoom_out = function()
snapshot_canvas()
Animating = {
Save_viewport,
}
Save_viewport = nil
Zoomed_out = nil
end
zoom_in = function(x,y)
-- precondition: Zoomed_out
-- precondition: Viewport == Global_viewport
-- precondition: Save_viewport exists
-- center Viewport on x,y at zoom level Saved_viewport.zoom
snapshot_canvas()
Animating = {
{
x=sx(x)-App.screen.width/Save_viewport.zoom/2,
y=sy(y)-App.screen.height/Save_viewport.zoom/2,
w=App.screen.width/Save_viewport.zoom,
h=App.screen.height/Save_viewport.zoom,
zoom=Save_viewport.zoom,
},
}
Zoomed_out = nil
Save_viewport = nil
end
else
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
return
end
local node = on_handle(x,y)
if node then
-- move node
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}
return
animate_next_frame = function(state, dt)
if state.initial == nil then
state.initial = from_viewport(state)
-- once we've checked keys, pollute the keyspace
state.step = 0
state.frame_time = 0
return
end
state.frame_time = state.frame_time + dt
if state.frame_time > 0.01 then
state.frame_time = state.frame_time - 0.01
state.step = state.step+1
interpolate_viewport(state.initial, state, state.step)
B()
end
end
animate_next = function(dt)
if Animating[1].step and Animating[1].step >= Num_animation_frames then
table.remove(Animating, 1)
if #Animating == 0 then
Animating = nil
Canvas = nil
A()
return
end
end
animate_next_frame(Animating[1], dt)
end
snapshot_canvas = function()
-- Render the canvas at pixel perfect resolution.
local winw,winh = App.screen.width, App.screen.height
App.screen.width,App.screen.height = Global_viewport.w, Global_viewport.h
local saved_viewport = Viewport
Viewport = copy_viewport(Global_viewport)
Viewport.zoom = 1.0
A()
Canvas = love.graphics.newCanvas(Global_viewport.w, Global_viewport.h)
love.graphics.setCanvas(Canvas)
App.fake_key_press = true -- Hack; disable drawing the menu and ticks
on.draw()
App.fake_key_press = nil
love.graphics.setCanvas()
Viewport = saved_viewport
App.screen.width,App.screen.height = winw,winh
end
zoom_out = function()
Save_viewport = copy_viewport(Viewport)
snapshot_canvas()
Animating = {
copy_viewport(Global_viewport),
}
Zoomed_out = true
end
Zoomed_out = nil -- special mode when set
copy_viewport = function(v)
return {x=v.x, y=v.y, w=v.w, h=v.h, zoom=v.zoom}
end
Save_viewport = nil -- save one previous position sometimes
draw_menu_bar = function()
if App.fake_key_press then return end -- disable in tests
App.color(Menu_background_color)
love.graphics.rectangle('fill', 0,0, App.screen.width, Menu_bar_height)
App.color(Menu_border_color)
love.graphics.rectangle('line', 0,0, App.screen.width, Menu_bar_height)
App.color(Menu_command_color)
Menu_cursor = 5
if Manifest_navigator.show then
draw_manifest_navigator()
return
end
add_hotkey_to_menu('ctrl+l: load definition')
add_hotkey_to_menu('ctrl+n: new definition')
add_hotkey_to_menu('ctrl+d: delete definition')
add_hotkey_to_menu('ctrl+f: find')
add_hotkey_to_menu('ctrl+left ctrl+right: prev/next word')
add_hotkey_to_menu('ctrl+z ctrl+y: undo/redo')
add_hotkey_to_menu('ctrl+x ctrl+c ctrl+v: cut/copy/paste')
add_hotkey_to_menu('ctrl+= ctrl+- ctrl+0: zoom')
end
Test_definition_background_color = {r=0.7,g=0.9,b=0.7}
A(--[[preserve screen_top of cursor node]] true)
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
Cursor_node.bg = definition_background_color(definition_name)
B(--[[preserve screen_top of cursor node]] true)
load_definition = function(name)
move_candidate_to_front_of_manifest(name)
if Cursor_node then
Cursor_node.show_cursor = false
end
-- just one copy per definition for now
if Definitions[name] == nil then
Definitions[name] = {
type='text',
data=load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+")),
x=0, y=0,
width=600,
bg=definition_background_color(name),
}
end
Viewport.x = Definitions[name].x-30
Viewport.y = Definitions[name].y-30
Cursor_node = Definitions[name]
Cursor_node.show_cursor = true
end
Definition_background_color = {r=0.7, g=0.7, b=1}
new_definition = function()
if Cursor_node then
Cursor_node.show_cursor = false
end
table.insert(Definitions, {
type='text',
data={''},
x=Spawn_point.x, y=Spawn_point.y,
width=600,
bg=Definition_background_color,
})
Viewport.x = Spawn_point.x-30
Viewport.y = Spawn_point.y-30
Cursor_node = Definitions[#Definitions]
Cursor_node.show_cursor = true
end
interpolate_viewport = function(initial, final, step)
for k,v in pairs(initial) do
Viewport[k] = (initial[k]*(Num_animation_frames - step) + final[k]*step) / Num_animation_frames
end
end
Animating = nil -- set this to enable animation
-- When enabled, animation should consist of a series of viewport states that we animate into.
-- Each viewport state will be attained in Num_animation_frames frames, each of 0.01 ms or 1 Love frame.
-- Each state will specify the final state of various viewport keys. Keys not mentioned will remain unchanged.
Num_animation_frames = 20
from_viewport = function(state)
local result = {}
for k,v in pairs(state) do
if Viewport[k] then
result[k] = Viewport[k]
end
end
return result
end
Spawn_point = {x=0, y=0}
surface_bounds = function(nodes)
local minx,miny,maxx,maxy
for _,node in pairs(nodes) do
if minx == nil or node.x < minx then
minx = node.x
end
if maxx == nil or node.x > maxx then
maxx = node.x
end
if miny == nil or node.y < miny then
miny = node.y
end
if maxy == nil or node.y > maxy then
maxy = node.y
end
end
return minx,miny,maxx+600,maxy+600
end
draw_run_time_error = function()
if Run_time_error == nil then return end
local height = math.min(20*HUD_line_height, App.screen.height*0.2)
App.color{r=0.8,g=0,b=0}
love.graphics.rectangle('fill', 0, App.screen.height - height-10, App.screen.width, height+10)
App.color{r=0,g=0,b=0}
love.graphics.print(Run_time_error, 30, App.screen.height - height)
end
get_definition_from_app = function(name)
-- return definition for a name
-- if no such definition, return ''
live.send_to_app('GET '..name)
return wait_for_response()
end
wait_for_response = function()
local response
repeat
love.timer.sleep(0.01)
response = live.receive_from_app()
until response
return response
end
initialize_manifest_navigator = function()
Manifest_navigator.candidates = Manifest
Manifest_navigator.num_lines = num_lines_for_manifest_navigator(Manifest_navigator.candidates)
end
reset_manifest_navigator = function()
Manifest_navigator.show = false
Manifest_navigator.index = 1
Manifest_navigator.filter = ''
end
Manifest = {
-- list of definitions to display in command palette
-- Don't confuse this with Live.manifest, the manifest for the current (driver) app.
-- Manifest is for the client app.
}
local response = json.decode(response_string)
for name in pairs(response) do
if name ~= 'parent' then
local app_name
local manifest_version = json.decode(response)
for name, value in pairs(manifest_version) do
if not starts_with(name, 'fw_') then
keychord_press_on_manifest_navigator = function(chord, key)
if chord == 'escape' then
reset_manifest_navigator()
elseif chord == 'return' then
if Manifest_navigator.for_delete then
delete_definition(Manifest_navigator.candidates[Manifest_navigator.index])
else
load_definition(Manifest_navigator.candidates[Manifest_navigator.index])
end
A()
reset_manifest_navigator()
elseif chord == 'backspace' then
local len = utf8.len(Manifest_navigator.filter)
local byte_offset = Text.offset(Manifest_navigator.filter, len)
Manifest_navigator.filter = string.sub(Manifest_navigator.filter, 1, byte_offset-1)
Manifest_navigator.index = 1
Manifest_navigator.candidates = manifest_navigator_candidates()
elseif chord == 'left' then
if Manifest_navigator.index > 1 then
Manifest_navigator.index = Manifest_navigator.index-1
end
elseif chord == 'right' then
if Manifest_navigator.index < #Manifest_navigator.candidates then
Manifest_navigator.index = Manifest_navigator.index+1
end
elseif chord == 'down' then
manifest_navigator_down()
elseif chord == 'up' then
manifest_navigator_up()
end
end
on.save_settings = function()
if Settings == nil then
Settings = {} -- just for initial schema migration
end
for key,node in pairs(Definitions) do
if type(key) == 'number' then
-- can't save the array side for now because of a limitation in the
Definitions[key] = nil
else
node.data = nil -- don't save uncommitted data for now
node.show_cursor = nil
node.editor = nil -- TODO: check for hierarchy
end
end
Settings[App_name] = {
viewport=Viewport,
definitions=Definitions,
}
return Settings
end
on.key_release = function(key)
if Animating then return end
if Move then return end
end
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, Viewport.y - node.y)
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, -vy(node.y))
end
if node.editor.font_height ~= scale(20) then
edit.update_font_settings(node.editor, scale(20))
table_and_array_both_empty = function(x)
for _,_ in pairs(x) do
return false
end
return true
end
-- return the height of a node. The result is scaled.
local y = 0
for i=1,#node.editor.lines do
local line = node.editor.lines[i]
if node.editor.line_cache[i] == nil then
node.editor.line_cache[i] = {}
end
node.editor.line_cache[i].fragments = nil
node.editor.line_cache[i].screen_line_starting_pos = nil
Text.populate_screen_line_starting_pos(node.editor, i)
y = y + node.editor.line_height*#node.editor.line_cache[i].screen_line_starting_pos
Text.clear_screen_line_cache(node.editor, i)
end
return y
-- return the height of a text editor node (explicit width). The result is unscaled.
local y = 0
for i=1,#node.editor.lines do
local line = node.editor.lines[i]
if node.editor.line_cache[i] == nil then
node.editor.line_cache[i] = {}
end
node.editor.line_cache[i].fragments = nil
node.editor.line_cache[i].screen_line_starting_pos = nil
Text.populate_screen_line_starting_pos(node.editor, i)
y = y + 20*1.3*#node.editor.line_cache[i].screen_line_starting_pos
Text.clear_screen_line_cache(node.editor, i)
end
return y
obj.editor = edit.initialize_state(vy(obj.y), math.floor(vx(obj.x)), math.ceil(vx(obj.x+obj.w)), scaled_fontsize, scaled_lineheight)
-- HACK: modify obj.editor.left after initialization
obj.editor = edit.initialize_state(Menu_bar_height + vy(obj.y), math.floor(vx(obj.x)), math.ceil(vx(obj.x+obj.w)), scaled_fontsize, scaled_lineheight)
obj.editor.left = obj.editor.left + Line_number_width*App.width('m')
obj.editor.width = obj.editor.right - obj.editor.left
draw_manifest_navigator = function()
App.color(Menu_command_color)
local filter_text = to_hud_text(Manifest_navigator.filter)
App.screen.draw(filter_text, 5, 5)
draw_cursor(5 + filter_text:getWidth(), 5)
App.color(Menu_background_color)
love.graphics.rectangle('fill', 0,Menu_bar_height, App.screen.width, Manifest_navigator.num_lines * (HUD_line_height + --[[highlight padding]]5))
local x,y = 5, Menu_bar_height
for i,definition in ipairs(Manifest_navigator.candidates) do
x,y = add_def_to_menu(x,y, definition, i == Manifest_navigator.index)
if Menu_cursor >= App.screen.width - 5 then
break
end
end
Manifest_navigator.bottom_y = y + HUD_line_height + --[[highlight padding]] 5
end
num_lines_for_manifest_navigator = function(candidates)
local result = 1
local x = 5
for i,def in ipairs(candidates) do
local width = to_hud_text(def):getWidth()
if x + width > App.screen.width - 5 then
result = result+1
x = 5
end
x = x + width + 30
end
return result
end
delete_definition = function(name)
live.send_to_app('DELETE '..name)
Manifest_navigator.reload = true
end
load_from_iterator = function(f)
local result = {}
local i,line,drawing = 0, ''
while true do
local line = f()
if line == nil then break end
table.insert(result, line)
end
if #result == 0 then
table.insert(result, '')
end
return result
end
Ticks_font = love.graphics.newFont(12)
add_def_to_menu = function(x,y, s, cursor_highlight)
local s_text = to_hud_text(s)
local width = s_text:getWidth()
if x + width > App.screen.width - 5 then
y = y + HUD_line_height + --[[highlight padding]] 5
x = 5
end
local color = Menu_background_color
if cursor_highlight then
color = Menu_highlight_color
end
button(HUD, 'menu', {x=x-5, y=y-2, w=width+5*2, h=HUD_line_height+2*2, color=colortable(color),
onpress1 = function()
load_definition(s)
end
})
App.color(Menu_command_color)
App.screen.draw(s_text, x,y)
x = x + width + 30
return x,y
end
draw_cursor = function(x, y)
-- blink every 0.5s
if math.floor(Cursor_time*2)%2 == 0 then
App.color(Cursor_color)
love.graphics.rectangle('fill', x,y, 3,HUD_line_height)
end
end
manifest_navigator_candidates = function()
if Manifest_navigator.filter == '' then
return Manifest
end
local result = {}
for _,def in ipairs(Manifest) do
if starts_with(def, Manifest_navigator.filter) then
table.insert(result, def)
end
end
return result
end
manifest_index = function(fy, fx, fwidth)
local y,x = Menu_bar_height, 5
local best_guess, best_guess_x, best_guess_width
for i,definition in ipairs(Manifest_navigator.candidates) do
local width = to_hud_text(definition):getWidth()
if x + width > App.screen.width - 5 then
y = y + HUD_line_height
x = 5
end
if y == fy then
if best_guess == nil then
best_guess = i
best_guess_x = x
best_guess_width = width
elseif math.abs(fx + fwidth/2 - x - width/2) < math.abs(fx + fwidth/2 - best_guess_x - best_guess_width/2) then
best_guess = i
best_guess_x = x
best_guess_width = width
end
end
x = x + width + 30
end
return best_guess
end
manifest_coord = function(index)
local y,x = Menu_bar_height, 5
for i,definition in ipairs(Manifest_navigator.candidates) do
local width = to_hud_text(definition):getWidth()
if x + width > App.screen.width - 5 then
y = y + HUD_line_height
x = 5
end
if i == index then
return y, x, width
end
x = x + width + 30
end
end
manifest_navigator_down = function()
local y, x, width = manifest_coord(Manifest_navigator.index)
local index = manifest_index(y+HUD_line_height, x, width)
if index then
Manifest_navigator.index = index
end
end
text_input_on_manifest_navigator = function(t)
Manifest_navigator.filter = Manifest_navigator.filter..t
Manifest_navigator.candidates = manifest_navigator_candidates()
Manifest_navigator.index = 1
end
move_candidate_to_front_of_manifest = function(name)
local index = array.find(Manifest, name)
if index then
table.remove(Manifest, index)
table.insert(Manifest, 1, name)
end
end
manifest_navigator_up = function()
local y, x, width = manifest_coord(Manifest_navigator.index)
local index = manifest_index(y-HUD_line_height, x, width)
if index then
Manifest_navigator.index = index
end
end
add_hotkey_to_menu = function(s)
local s_text = to_hud_text(s)
local width = s_text:getWidth()
if Menu_cursor > App.screen.width - 30 then
return
end
App.color(Menu_command_color)
App.screen.draw(s_text, Menu_cursor,5)
Menu_cursor = Menu_cursor + width + 30
end
Menu_highlight_color = {r=0.5, g=0.7, b=0.3}
Menu_command_color = {r=0.2, g=0.2, b=0.2}
Menu_border_color = {r=0.6, g=0.7, b=0.6}
Menu_background_color = {r=0.6, g=0.8, b=0.6}
approximate = function(n, zeros)
-- turn n into a number with n zeros
for i=1,zeros do
n = n/10
end
n= math.floor(n)
local magnitude = 1
for i=1,zeros do
n = n*10
magnitude = magnitude*10
end
return n, magnitude
end
order_of_magnitude = function(n)
return math.floor(math.log(n)/math.log(10))
end
Mouse_cursor = 'arrow'
mouse_cursor = function(name)
return love.mouse.getSystemCursor(name)
end
vx = function(sx)
-- turn surface coordinates into viewport coordinates
return scale(sx-Viewport.x)
end
maybe_update_key_in_definitions = function(old_definition_name, definition_name, Cursor_node)
--print(old_definition_name, definition_name)
if old_definition_name ~= definition_name then
if old_definition_name == nil or Definitions[old_definition_name] ~= Cursor_node then
local pos = array.find(Definitions, Cursor_node)
--print('found at index', pos)
assert(pos)
table.remove(Definitions, pos)
elseif Definitions[old_definition_name] == Cursor_node then
--print('found at key', old_definition_name)
Definitions[old_definition_name] = nil
end
if definition_name and Definitions[definition_name] == nil then
--print('moving to key', definition_name)
Definitions[definition_name] = Cursor_node
elseif definition_name == nil or Definitions[definition_name] then
-- temporary collision; try again later
-- deleting and reinserting is inefficient, but hopefully rare
--print('moving to index', #Definitions+1)
table.insert(Definitions, Cursor_node)
end
--print('-- definition keys')
--for k in pairs(Definitions) do
--print(k)
--end
end
end
Definitions = {
-- table mapping names to boxes where we edit their definitions
}