diff --git a/0478-manifest b/0478-manifest new file mode 100644 index 0000000..d1f05e6 --- /dev/null +++ b/0478-manifest @@ -0,0 +1 @@ +{"Page":475,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0478-update_editor_box b/0478-update_editor_box new file mode 100644 index 0000000..edae538 --- /dev/null +++ b/0478-update_editor_box @@ -0,0 +1,17 @@ +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 \ No newline at end of file diff --git a/0479-manifest b/0479-manifest new file mode 100644 index 0000000..cafb54a --- /dev/null +++ b/0479-manifest @@ -0,0 +1 @@ +{"Page":475,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0479-update_editor_box b/0479-update_editor_box new file mode 100644 index 0000000..50674ec --- /dev/null +++ b/0479-update_editor_box @@ -0,0 +1,17 @@ +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 \ No newline at end of file diff --git a/0480-Manifest_navigator b/0480-Manifest_navigator new file mode 100644 index 0000000..1972665 --- /dev/null +++ b/0480-Manifest_navigator @@ -0,0 +1,6 @@ +Manifest_navigator = { + -- state for the command palette + display = false, + for_delete = false, + reload = false, +} \ No newline at end of file diff --git a/0480-manifest b/0480-manifest new file mode 100644 index 0000000..8803f2b --- /dev/null +++ b/0480-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0481-manifest b/0481-manifest new file mode 100644 index 0000000..4dc596f --- /dev/null +++ b/0481-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0481-on.keychord_press b/0481-on.keychord_press new file mode 100644 index 0000000..72773ab --- /dev/null +++ b/0481-on.keychord_press @@ -0,0 +1,60 @@ +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 \ No newline at end of file diff --git a/0482-manifest b/0482-manifest new file mode 100644 index 0000000..4740596 --- /dev/null +++ b/0482-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0482-on.initialize b/0482-on.initialize new file mode 100644 index 0000000..1982793 --- /dev/null +++ b/0482-on.initialize @@ -0,0 +1,4 @@ +on.initialize = function() + load_manifest() + A() +end \ No newline at end of file diff --git a/0483-manifest b/0483-manifest new file mode 100644 index 0000000..3e06a11 --- /dev/null +++ b/0483-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0483-on.keychord_press b/0483-on.keychord_press new file mode 100644 index 0000000..364fa0d --- /dev/null +++ b/0483-on.keychord_press @@ -0,0 +1,63 @@ +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 \ No newline at end of file diff --git a/0484-manifest b/0484-manifest new file mode 100644 index 0000000..48ff730 --- /dev/null +++ b/0484-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0484-on.keychord_press b/0484-on.keychord_press new file mode 100644 index 0000000..5afd938 --- /dev/null +++ b/0484-on.keychord_press @@ -0,0 +1,65 @@ +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 \ No newline at end of file diff --git a/0485-manifest b/0485-manifest new file mode 100644 index 0000000..03b933c --- /dev/null +++ b/0485-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0485-on.keychord_press b/0485-on.keychord_press new file mode 100644 index 0000000..f02f594 --- /dev/null +++ b/0485-on.keychord_press @@ -0,0 +1,67 @@ +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 \ No newline at end of file diff --git a/0486-manifest b/0486-manifest new file mode 100644 index 0000000..19e78ba --- /dev/null +++ b/0486-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0486-on.keychord_press b/0486-on.keychord_press new file mode 100644 index 0000000..f02f594 --- /dev/null +++ b/0486-on.keychord_press @@ -0,0 +1,67 @@ +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 \ No newline at end of file diff --git a/0487-manifest b/0487-manifest new file mode 100644 index 0000000..48875ae --- /dev/null +++ b/0487-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0487-on.text_input b/0487-on.text_input new file mode 100644 index 0000000..c8ad1c4 --- /dev/null +++ b/0487-on.text_input @@ -0,0 +1,12 @@ +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 \ No newline at end of file diff --git a/0488-manifest b/0488-manifest new file mode 100644 index 0000000..b5054cc --- /dev/null +++ b/0488-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0488-on.keychord_press b/0488-on.keychord_press new file mode 100644 index 0000000..dc6425a --- /dev/null +++ b/0488-on.keychord_press @@ -0,0 +1,68 @@ +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 \ No newline at end of file diff --git a/0489-manifest b/0489-manifest new file mode 100644 index 0000000..b2ac36c --- /dev/null +++ b/0489-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0489-on.keychord_press b/0489-on.keychord_press new file mode 100644 index 0000000..477e1b3 --- /dev/null +++ b/0489-on.keychord_press @@ -0,0 +1,69 @@ +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 \ No newline at end of file diff --git a/0490-manifest b/0490-manifest new file mode 100644 index 0000000..4118761 --- /dev/null +++ b/0490-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0490-on.keychord_press b/0490-on.keychord_press new file mode 100644 index 0000000..b533d61 --- /dev/null +++ b/0490-on.keychord_press @@ -0,0 +1,70 @@ +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 \ No newline at end of file diff --git a/0491-manifest b/0491-manifest new file mode 100644 index 0000000..f4e3ac0 --- /dev/null +++ b/0491-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0491-on.keychord_press b/0491-on.keychord_press new file mode 100644 index 0000000..0dc38ba --- /dev/null +++ b/0491-on.keychord_press @@ -0,0 +1,70 @@ +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 \ No newline at end of file diff --git a/0492-manifest b/0492-manifest new file mode 100644 index 0000000..8267046 --- /dev/null +++ b/0492-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} \ No newline at end of file diff --git a/0492-on.keychord_press b/0492-on.keychord_press new file mode 100644 index 0000000..0dc38ba --- /dev/null +++ b/0492-on.keychord_press @@ -0,0 +1,70 @@ +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 \ No newline at end of file diff --git a/0493-manifest b/0493-manifest new file mode 100644 index 0000000..9f0dfb6 --- /dev/null +++ b/0493-manifest @@ -0,0 +1 @@ +{"Page":475,"Manifest_navigator":480,"initialize_editor":450,"sy":469,"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} diff --git a/0493-on.initialize b/0493-on.initialize new file mode 100644 index 0000000..4c921f5 --- /dev/null +++ b/0493-on.initialize @@ -0,0 +1,3 @@ +on.initialize = function() + A() +end diff --git a/0494-Manifest b/0494-Manifest new file mode 100644 index 0000000..5c212d8 --- /dev/null +++ b/0494-Manifest @@ -0,0 +1,4 @@ +Manifest = { + -- list of definitions to display + -- TODO: can we just reuse Live.manifest here? +} \ No newline at end of file diff --git a/0494-manifest b/0494-manifest new file mode 100644 index 0000000..225ecd6 --- /dev/null +++ b/0494-manifest @@ -0,0 +1 @@ +{"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,"parent":493,"initialize_editor":450,"sy":469} \ No newline at end of file diff --git a/0495-Manifest_navigator b/0495-Manifest_navigator new file mode 100644 index 0000000..f12851e --- /dev/null +++ b/0495-Manifest_navigator @@ -0,0 +1,11 @@ +Manifest_navigator = { + -- state for the command palette + display = false, -- display navigator on screen + for_delete = false, -- if true, delete selected definition from navigator + reload = false, -- if true, refresh manifest to display on next keystroke + num_lines = nil, -- number of screen lines of space to devote to the navigator + index = 1, -- where the cursor is right now. Modified on arrow keys, reset on any non-arrow keystroke. + filter = '', -- prefix being typed into the command palette + candidates = Manifest, -- list of candidates matching filter + bottom_y = nil, -- cache a tiny bit of state in display logic +} \ No newline at end of file diff --git a/0495-manifest b/0495-manifest new file mode 100644 index 0000000..e1ec970 --- /dev/null +++ b/0495-manifest @@ -0,0 +1 @@ +{"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,"parent":494,"initialize_editor":450,"sy":469} \ No newline at end of file diff --git a/0496-load_manifest b/0496-load_manifest new file mode 100644 index 0000000..cb507e9 --- /dev/null +++ b/0496-load_manifest @@ -0,0 +1,17 @@ +load_manifest = function() + local new_manifest = 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 +end \ No newline at end of file diff --git a/0496-manifest b/0496-manifest new file mode 100644 index 0000000..63814b2 --- /dev/null +++ b/0496-manifest @@ -0,0 +1 @@ +{"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,"parent":495,"initialize_editor":450,"sy":469} \ No newline at end of file diff --git a/0497-get_manifest b/0497-get_manifest new file mode 100644 index 0000000..ac5f436 --- /dev/null +++ b/0497-get_manifest @@ -0,0 +1,23 @@ +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 response = json.decode(response_string) + for name in pairs(response) do + if name ~= 'parent' then + table.insert(result, name) + end + end + return result +end \ No newline at end of file diff --git a/0497-manifest b/0497-manifest new file mode 100644 index 0000000..1177269 --- /dev/null +++ b/0497-manifest @@ -0,0 +1 @@ +{"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,"parent":496,"initialize_editor":450,"sy":469} \ No newline at end of file diff --git a/0498-manifest b/0498-manifest new file mode 100644 index 0000000..82fde43 --- /dev/null +++ b/0498-manifest @@ -0,0 +1 @@ +{"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,"parent":497,"initialize_editor":450,"sy":469} \ No newline at end of file diff --git a/0498-on.initialize b/0498-on.initialize new file mode 100644 index 0000000..9f82ea9 --- /dev/null +++ b/0498-on.initialize @@ -0,0 +1,4 @@ +on.initialize = function() + load_manifest + A() +end \ No newline at end of file diff --git a/0499-manifest b/0499-manifest new file mode 100644 index 0000000..5702472 --- /dev/null +++ b/0499-manifest @@ -0,0 +1 @@ +{"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,"parent":498,"initialize_editor":450,"add_thick_line":400,"line_height":365,"copy_shape":396} \ No newline at end of file diff --git a/0499-on.initialize b/0499-on.initialize new file mode 100644 index 0000000..1982793 --- /dev/null +++ b/0499-on.initialize @@ -0,0 +1,4 @@ +on.initialize = function() + load_manifest() + A() +end \ No newline at end of file diff --git a/0500-manifest b/0500-manifest new file mode 100644 index 0000000..2d1e11c --- /dev/null +++ b/0500-manifest @@ -0,0 +1 @@ +{"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,"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} \ No newline at end of file diff --git a/0500-on.initialize b/0500-on.initialize new file mode 100644 index 0000000..8f49cfa --- /dev/null +++ b/0500-on.initialize @@ -0,0 +1,5 @@ +on.initialize = function() + load_manifest() + print('on.initialize', Manifest_navigator.show) + A() +end \ No newline at end of file diff --git a/0501-manifest b/0501-manifest new file mode 100644 index 0000000..8a8e059 --- /dev/null +++ b/0501-manifest @@ -0,0 +1 @@ +{"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,"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} \ No newline at end of file diff --git a/0501-on.keychord_press b/0501-on.keychord_press new file mode 100644 index 0000000..f02f594 --- /dev/null +++ b/0501-on.keychord_press @@ -0,0 +1,67 @@ +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 \ No newline at end of file diff --git a/0502-manifest b/0502-manifest new file mode 100644 index 0000000..3541094 --- /dev/null +++ b/0502-manifest @@ -0,0 +1 @@ +{"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,"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} \ No newline at end of file diff --git a/0502-on.keychord_press b/0502-on.keychord_press new file mode 100644 index 0000000..6ad30aa --- /dev/null +++ b/0502-on.keychord_press @@ -0,0 +1,69 @@ +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 \ No newline at end of file diff --git a/0503-Definitions b/0503-Definitions new file mode 100644 index 0000000..fe72372 --- /dev/null +++ b/0503-Definitions @@ -0,0 +1,3 @@ +Definitions = { + -- table mapping names to boxes where we edit their definitions +} \ No newline at end of file diff --git a/0503-manifest b/0503-manifest new file mode 100644 index 0000000..b7dabe4 --- /dev/null +++ b/0503-manifest @@ -0,0 +1 @@ +{"Cursor_node":172,"line_height":365,"on":1,"sy":469,"initialize_editor":450,"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} \ No newline at end of file diff --git a/0504-manifest b/0504-manifest new file mode 100644 index 0000000..4bf9bf0 --- /dev/null +++ b/0504-manifest @@ -0,0 +1 @@ +{"Cursor_node":172,"line_height":365,"on":1,"sy":469,"initialize_editor":450,"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} \ No newline at end of file diff --git a/0504-new_definition b/0504-new_definition new file mode 100644 index 0000000..a8ca9be --- /dev/null +++ b/0504-new_definition @@ -0,0 +1,8 @@ +new_definition = function() + table.insert(Definitions, { + type='text', + data={''}, + x=0, y=0, + width=400, bg={r=0.7,g=0.7,b=1}, + }) +end diff --git a/0505-Viewport b/0505-Viewport new file mode 100644 index 0000000..0dc66df --- /dev/null +++ b/0505-Viewport @@ -0,0 +1 @@ +Viewport = {x=-50, y=-50, w=800,h=600, zoom=1.0} \ No newline at end of file diff --git a/0505-manifest b/0505-manifest new file mode 100644 index 0000000..b325572 --- /dev/null +++ b/0505-manifest @@ -0,0 +1 @@ +{"Cursor_node":172,"line_height":365,"on":1,"sy":469,"initialize_editor":450,"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} \ No newline at end of file diff --git a/0506-manifest b/0506-manifest new file mode 100644 index 0000000..23533ac --- /dev/null +++ b/0506-manifest @@ -0,0 +1 @@ +{"Cursor_node":172,"line_height":365,"on":1,"sy":469,"initialize_editor":450,"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} \ No newline at end of file diff --git a/0506-on.initialize b/0506-on.initialize new file mode 100644 index 0000000..1615022 --- /dev/null +++ b/0506-on.initialize @@ -0,0 +1,5 @@ +on.initialize = function() + load_manifest() + new_definition() + A() +end \ No newline at end of file diff --git a/0507-A b/0507-A new file mode 100644 index 0000000..23d826d --- /dev/null +++ b/0507-A @@ -0,0 +1,10 @@ +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 \ No newline at end of file diff --git a/0507-manifest b/0507-manifest new file mode 100644 index 0000000..3b7abac --- /dev/null +++ b/0507-manifest @@ -0,0 +1 @@ +{"Cursor_node":172,"line_height":365,"on":1,"sy":469,"initialize_editor":450,"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} \ No newline at end of file diff --git a/commands.lua b/commands.lua index 7065cd2..304e510 100644 --- a/commands.lua +++ b/commands.lua @@ -11,11 +11,12 @@ function draw_menu_bar() love.graphics.rectangle('line', 0,0, App.screen.width, Menu_bar_height) App.color(Menu_command_color) Menu_cursor = 5 - if Show_manifest_navigator then + 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') @@ -61,7 +62,7 @@ function draw_manifest_navigator() -- inefficient that we're computing this on every frame -- so look only in the topmost line local current_definition = live.get_cmd_from_buffer(Editor_state.lines[1].data) - love.graphics.rectangle('fill', 0,Menu_bar_height, App.screen.width, Manifest_navigator.num_lines * (Editor_state.line_height + --[[highlight padding]]5) + --[[extra highlight padding for bottom]] 2) + 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 if definition == current_definition then @@ -78,14 +79,14 @@ function draw_manifest_navigator() break end end - Manifest_navigator.bottom_y = y + Editor_state.line_height + --[[highlight padding]] 5 + Manifest_navigator.bottom_y = y + HUD_line_height + --[[highlight padding]] 5 end function draw_cursor(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,Editor_state.line_height) + love.graphics.rectangle('fill', x,y, 3,HUD_line_height) end end @@ -121,14 +122,14 @@ function add_def_to_menu(x,y, s, cursor_highlight) local s_text = to_hud_text(s) local width = App.width(s_text) if x + width > App.screen.width - 5 then - y = y + Editor_state.line_height + --[[highlight padding]] 5 + 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(Editor_state, 'menu', {x=x-5, y=y-2, w=width+5*2, h=Editor_state.line_height+2*2, color=colortable(color), + button(Editor_state, '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 @@ -140,7 +141,7 @@ function add_def_to_menu(x,y, s, cursor_highlight) end function reset_manifest_navigator() - Show_manifest_navigator = false + Manifest_navigator.show = false Manifest_navigator.index = 1 Manifest_navigator.filter = '' Manifest_navigator.candidates = Manifest @@ -201,7 +202,7 @@ function load_definition(name) Editor_state.saved = saved Text.redraw_all(Editor_state) Editor_state.font_height = Font_height - Editor_state.line_height = Line_height + HUD_line_height = Line_height Editor_state.em = em reset_manifest_navigator() end @@ -226,13 +227,13 @@ end function delete_definition(name) live.send_to_app('DELETE '..name) - Reload_manifest = true + Manifest_navigator.reload = true reset_manifest_navigator() end function manifest_navigator_up() local y, x, width = manifest_coord(Manifest_navigator.index) - local index = manifest_index(y-Editor_state.line_height, x, width) + local index = manifest_index(y-HUD_line_height, x, width) if index then Manifest_navigator.index = index end @@ -240,7 +241,7 @@ end function manifest_navigator_down() local y, x, width = manifest_coord(Manifest_navigator.index) - local index = manifest_index(y+Editor_state.line_height, x, width) + local index = manifest_index(y+HUD_line_height, x, width) if index then Manifest_navigator.index = index end @@ -251,7 +252,7 @@ function manifest_coord(index) for i,definition in ipairs(Manifest_navigator.candidates) do local width = App.width(to_hud_text(definition)) if x + width > App.screen.width - 5 then - y = y + Editor_state.line_height + y = y + HUD_line_height x = 5 end if i == index then @@ -267,7 +268,7 @@ function manifest_index(fy, fx, fwidth) for i,definition in ipairs(Manifest_navigator.candidates) do local width = App.width(to_hud_text(definition)) if x + width > App.screen.width - 5 then - y = y + Editor_state.line_height + y = y + HUD_line_height x = 5 end if y == fy then diff --git a/head b/head index b1eab89..5da127e 100644 --- a/head +++ b/head @@ -1 +1 @@ -477 \ No newline at end of file +507 \ No newline at end of file