snapshot as I try to get the command palette working
Things are a hot mess right now. Perhaps pulling commands.lua directly in was a bad idea and I should have added them gradually into the editor. However, it's nice to see multiple definitions and I don't have that yet in the driver. We'll eventually decontruct commands.lua away into nothing. The major issue I'm stuck on is the representation of definitions in memory. Each needs to be an editor buffer. I'd like to be able to get to each by name. However, what should happen if I edit a buffer to change the code inside it?
This commit is contained in:
parent
d96dc5efef
commit
faa8ff4e77
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -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
|
|
@ -0,0 +1,6 @@
|
|||
Manifest_navigator = {
|
||||
-- state for the command palette
|
||||
display = false,
|
||||
for_delete = false,
|
||||
reload = false,
|
||||
}
|
|
@ -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}
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -0,0 +1,4 @@
|
|||
on.initialize = function()
|
||||
load_manifest()
|
||||
A()
|
||||
end
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -0,0 +1,3 @@
|
|||
on.initialize = function()
|
||||
A()
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
Manifest = {
|
||||
-- list of definitions to display
|
||||
-- TODO: can we just reuse Live.manifest here?
|
||||
}
|
|
@ -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}
|
|
@ -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
|
||||
}
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -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}
|
|
@ -0,0 +1,4 @@
|
|||
on.initialize = function()
|
||||
load_manifest
|
||||
A()
|
||||
end
|
|
@ -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}
|
|
@ -0,0 +1,4 @@
|
|||
on.initialize = function()
|
||||
load_manifest()
|
||||
A()
|
||||
end
|
|
@ -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}
|
|
@ -0,0 +1,5 @@
|
|||
on.initialize = function()
|
||||
load_manifest()
|
||||
print('on.initialize', Manifest_navigator.show)
|
||||
A()
|
||||
end
|
|
@ -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}
|
|
@ -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
|
|
@ -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}
|
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
Definitions = {
|
||||
-- table mapping names to boxes where we edit their definitions
|
||||
}
|
|
@ -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}
|
|
@ -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}
|
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
Viewport = {x=-50, y=-50, w=800,h=600, zoom=1.0}
|
|
@ -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}
|
|
@ -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}
|
|
@ -0,0 +1,5 @@
|
|||
on.initialize = function()
|
||||
load_manifest()
|
||||
new_definition()
|
||||
A()
|
||||
end
|
|
@ -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
|
|
@ -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}
|
27
commands.lua
27
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
|
||||
|
|
Loading…
Reference in New Issue