diff --git a/0011-on.initialize b/0011-on.initialize index 456329f..b35d3a7 100644 --- a/0011-on.initialize +++ b/0011-on.initialize @@ -5,17 +5,7 @@ on.initialize = function() Menu_left, Menu_top, Safe_width, Safe_height = love.window.getSafeArea() Menu_height = 5 + Line_height + 5 Menu_bottom = Menu_top + Menu_height - Current_pane.editor_state = edit.initialize_state( - Menu_bottom + 20, -- top - Safe_height/2-Line_height, -- bottom - Menu_left + 50 + Line_number_padding, -- left - math.min(100+30*App.width('m'), Safe_width*2/3), -- right - love.graphics.getFont():getHeight(), Line_height) - Text.redraw_all(Current_pane.editor_state) - Current_pane.output_editor_state = edit.initialize_state( - Current_pane.editor_state.bottom+5+10+5, -- top - nil, -- buttom - Current_pane.editor_state.left, Current_pane.editor_state.right, - love.graphics.getFont():getHeight(), Line_height) - Text.redraw_all(Current_pane.output_editor_state) + table.insert(Panes, new_pane()) + Current_pane_index = 1 + Current_pane = Panes[Current_pane_index] end \ No newline at end of file diff --git a/0021-draw_menu b/0021-draw_menu index 6ee2bbb..f73586d 100644 --- a/0021-draw_menu +++ b/0021-draw_menu @@ -42,17 +42,41 @@ draw_menu = function() end, }) -- nav buttons along sides - button(Global_state, 'left', {x=0, y=Menu_bottom, w=Menu_left+30, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2}, - icon = function(p) - App.color{r=0.4,g=0.4,b=0.4} - love.graphics.polygon('fill', Menu_left+5, App.screen.height/2, Menu_left+25, App.screen.height/2-10, Menu_left+25, App.screen.height/2+10) - end, - }) + if Current_pane_index > 1 then + button(Global_state, 'left', {x=0, y=Menu_bottom, w=Menu_left+30, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2}, + icon = function(p) + App.color{r=0.4,g=0.4,b=0.4} + love.graphics.polygon('fill', Menu_left+5, App.screen.height/2, Menu_left+25, App.screen.height/2-10, Menu_left+25, App.screen.height/2+10) + end, + onpress1 = function() + Current_pane_index = Current_pane_index-1 + Current_pane = Panes[Current_pane_index] + end, + }) + end local r = Menu_left + Safe_width - button(Global_state, 'left', {x=r-30, y=Menu_bottom, w=100, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2}, - icon = function(p) - App.color{r=0.4,g=0.4,b=0.4} - love.graphics.polygon('fill', r-25, App.screen.height/2-10, r-25, App.screen.height/2+10, r-5, App.screen.height/2) - end, - }) + if Current_pane_index == #Panes then + button(Global_state, 'right', {x=r-30, y=Menu_bottom, w=100, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2}, + icon = function(p) + App.color{r=0.4,g=0.4,b=0.4} + love.graphics.print('+', r-25, App.screen.height/2-10) + end, + onpress1 = function() + table.insert(Panes, new_pane()) + Current_pane_index = Current_pane_index+1 + Current_pane = Panes[Current_pane_index] + end, + }) + else + button(Global_state, 'right', {x=r-30, y=Menu_bottom, w=100, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2}, + icon = function(p) + App.color{r=0.4,g=0.4,b=0.4} + love.graphics.polygon('fill', r-25, App.screen.height/2-10, r-25, App.screen.height/2+10, r-5, App.screen.height/2) + end, + onpress1 = function() + Current_pane_index = Current_pane_index+1 + Current_pane = Panes[Current_pane_index] + end, + }) + end end \ No newline at end of file diff --git a/0047-Current_pane_index b/0047-Current_pane_index new file mode 100644 index 0000000..d565b4e --- /dev/null +++ b/0047-Current_pane_index @@ -0,0 +1 @@ +Current_pane_index = 0 \ No newline at end of file diff --git a/0048-Panes b/0048-Panes new file mode 100644 index 0000000..f1e0c80 --- /dev/null +++ b/0048-Panes @@ -0,0 +1 @@ +Panes = {} \ No newline at end of file diff --git a/0049-new_pane b/0049-new_pane new file mode 100644 index 0000000..65240ee --- /dev/null +++ b/0049-new_pane @@ -0,0 +1,17 @@ +new_pane = function() + local result = {} + result.editor_state = edit.initialize_state( + Menu_bottom + 20, -- top + Safe_height/2-Line_height, -- bottom + Menu_left + 50 + Line_number_padding, -- left + math.min(100+30*App.width('m'), Safe_width*2/3), -- right + love.graphics.getFont():getHeight(), Line_height) + Text.redraw_all(result.editor_state) + result.output_editor_state = edit.initialize_state( + result.editor_state.bottom+5+10+5, -- top + nil, -- buttom + result.editor_state.left, result.editor_state.right, + love.graphics.getFont():getHeight(), Line_height) + Text.redraw_all(result.output_editor_state) + return result +end \ No newline at end of file