implement carousel buttons for inserting/switching current pane
Dependencies
- [2]
CAKSFMAVbugfix: stay within window boundaries - [3]
VAVXKWZVaggregate global state inside a 'pane' object - [4]
6RYGW5H3bugfix: output border color - [5]
Z5M23NTKimplement second, 'output' editor - [6]
VEAVIL4Xresize handler - [7]
PRE6XPRNresponsively increase/decrease font height - [8]
5RUFNRJOstart of the visual skeleton - [9]
ZM7NOBRMnew fork: carousel shell - [*]
R5QXEHUIsomebody stop me
Change contents
- file addition: 0049-new_pane[11.2]
new_pane = function()local result = {}result.editor_state = edit.initialize_state(Menu_bottom + 20, -- topSafe_height/2-Line_height, -- bottomMenu_left + 50 + Line_number_padding, -- leftmath.min(100+30*App.width('m'), Safe_width*2/3), -- rightlove.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, -- topnil, -- buttomresult.editor_state.left, result.editor_state.right,love.graphics.getFont():getHeight(), Line_height)Text.redraw_all(result.output_editor_state)return resultend - file addition: 0048-Panes[11.2]
Panes = {} - file addition: 0047-Current_pane_index[11.2]
Current_pane_index = 0 - replacement in 0021-draw_menu at line 45
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 thenbutton(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-1Current_pane = Panes[Current_pane_index]end,})end - replacement in 0021-draw_menu at line 58
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 thenbutton(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+1Current_pane = Panes[Current_pane_index]end,})elsebutton(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+1Current_pane = Panes[Current_pane_index]end,})end - replacement in 0011-on.initialize at line 8[4.2084]→[3.4330:4382](∅→∅),[3.4382]→[4.522:550](∅→∅),[4.2123]→[4.522:550](∅→∅),[4.550]→[2.0:40](∅→∅),[2.40]→[4.2304:2353](∅→∅),[4.580]→[4.2304:2353](∅→∅),[4.2353]→[4.596:657](∅→∅),[4.596]→[4.596:657](∅→∅),[4.657]→[4.2224:2276](∅→∅),[4.2224]→[4.2224:2276](∅→∅),[4.2276]→[3.4383:4537](∅→∅),[3.4537]→[4.2688:2706](∅→∅),[4.2688]→[4.2688:2706](∅→∅),[4.2706]→[3.4538:4605](∅→∅),[3.4605]→[4.2747:2799](∅→∅),[4.2747]→[4.2747:2799](∅→∅),[4.2799]→[3.4606:4657](∅→∅)
Current_pane.editor_state = edit.initialize_state(Menu_bottom + 20, -- topSafe_height/2-Line_height, -- bottomMenu_left + 50 + Line_number_padding, -- leftmath.min(100+30*App.width('m'), Safe_width*2/3), -- rightlove.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, -- topnil, -- buttomCurrent_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 = 1Current_pane = Panes[Current_pane_index]