implement carousel buttons for inserting/switching current pane

akkartik
Nov 19, 2023, 9:37 PM
VUF2SX7BSB6DYFUCIS24UAMIQB4F3FLYSDLS5UXDCKIKPTWH4WWQC

Dependencies

  • [2] CAKSFMAV bugfix: stay within window boundaries
  • [3] VAVXKWZV aggregate global state inside a 'pane' object
  • [4] 6RYGW5H3 bugfix: output border color
  • [5] Z5M23NTK implement second, 'output' editor
  • [6] VEAVIL4X resize handler
  • [7] PRE6XPRN responsively increase/decrease font height
  • [8] 5RUFNRJO start of the visual skeleton
  • [9] ZM7NOBRM new fork: carousel shell
  • [*] R5QXEHUI somebody 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, -- 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
  • 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
    [4.1372][3.1983:2104](),[3.2104][4.1493:1700](),[4.1493][4.1493:1700]()
    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,
    })
    [4.1372]
    [4.1700]
    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
  • replacement in 0021-draw_menu at line 58
    [4.1734][3.2105:2220](),[3.2220][4.1849:2033](),[4.1849][4.1849:2033]()
    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,
    })
    [4.1734]
    [4.1096]
    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
  • 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, -- 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)
    [4.2084]
    [4.2277]
    table.insert(Panes, new_pane())
    Current_pane_index = 1
    Current_pane = Panes[Current_pane_index]