extract a second helper for buttons

akkartik
Nov 26, 2023, 7:14 AM
W3RRTO4PYRYYWVCL5FZFD7646E4WVPYAUVPCSCPI545EM74GY7EQC

Dependencies

  • [2] 5JMR2IJS bugfix: save settings on mobile devices
  • [3] SIJ5I4NZ extract a helper for buttons
  • [4] YS4AQXJC hide other menus when opening one
  • [5] I52S4E5F running `print` now appends to output editor
  • [6] FPSPT5TM show current pane number
  • [7] GWLETNMW Mike's suggested button layout
  • [8] 5MEJ7XNH lay out buttons based on device dimensions
  • [9] RK2ASPN7 add lots of buttons to the toolbar
  • [10] JV27LDDK sliders for font size and color settings
  • [11] QGSOEM7Z bugfix: 'show' button layout
  • [*] R5QXEHUI somebody stop me

Change contents

  • file addition: 0124-styled_button (----------)
    [13.2]
    styled_button = function(name, x, y, onpress1)
    local w = App.width(name)+10
    button(Global_state, name, {x=x, y=y, w=w, h=Line_height, bg={r=0.6, g=0.8, b=0.6},
    icon = function(p)
    App.color(Normal_color)
    love.graphics.rectangle('line', p.x,p.y, p.w,p.h, 2,2)
    love.graphics.print(name, p.x+5,p.y+2)
    end,
    onpress1 = onpress1,
    })
    end
  • edit in 0118-overflowable_button at line 1
    [3.49]
    [3.50]
    -- draw a button in the menu if possible
    -- if not, stash it behind an overflow ('>>') button
  • replacement in 0118-overflowable_button at line 14
    [3.301][3.301:568]()
    button(Global_state, name, {x=x, y=y, w=w, h=Line_height, bg={r=0.6, g=0.8, b=0.6},
    icon = function(p)
    App.color(Normal_color)
    love.graphics.rectangle('line', p.x,p.y, p.w,p.h, 2,2)
    love.graphics.print(name, p.x+5,p.y+2)
    end,
    onpress1 = onpress1,
    })
    [3.301]
    [3.568]
    styled_button(name, x,y, onpress1)
  • replacement in 0109-overflow_button at line 2
    [4.575][4.575:875]()
    local w = App.width('>>')+10
    button(Global_state, 'overflow', {x=x, y=y, w=w, h=Line_height, bg={r=0.6, g=0.8, b=0.6},
    icon = function(p)
    App.color(Normal_color)
    love.graphics.rectangle('line', p.x,p.y, p.w,p.h, 2,2)
    love.graphics.print('>>', p.x+5,p.y+2)
    end,
    onpress1 = function()
    [4.575]
    [4.875]
    styled_button('>>', x,y,
    function()
  • replacement in 0109-overflow_button at line 6
    [4.84][4.912:923](),[4.912][4.912:923]()
    end,
    })
    [4.84]
    [4.29]
    end)
  • edit in 0106-stop_button at line 2
    [4.1362]
    [4.68]
    styled_button('stop', x,y, clear_handlers)
  • edit in 0106-stop_button at line 4
    [4.100][4.1363:1450](),[4.1450][4.196:386](),[4.196][4.196:386]()
    button(Global_state, 'stop', {x=x, y=y, w=w, h=Line_height, bg={r=0.6, g=0.8, b=0.6},
    icon = function(p)
    App.color(Normal_color)
    love.graphics.rectangle('line', p.x,p.y, p.w,p.h, 2,2)
    love.graphics.print('stop', p.x+5,p.y+2)
    end,
    onpress1 = clear_handlers,
    })
  • replacement in 0072-settings_button at line 2
    [4.1396][4.1396:1684]()
    button(Global_state, 'settings', {x=x, y=Menu_top+5, w=w+10, h=Line_height, bg={r=0.6, g=0.8, b=0.6},
    icon = function(p)
    App.color(Normal_color)
    love.graphics.rectangle('line', p.x,p.y, p.w,p.h, 2,2)
    love.graphics.print('settings', p.x+5,p.y+2)
    end,
    onpress1 = function()
    [4.1396]
    [4.5520]
    styled_button('settings', x, Menu_top+5,
    function()
  • replacement in 0072-settings_button at line 10
    [4.169][4.1705:1716](),[2.180][4.1705:1716](),[4.5557][4.1705:1716](),[4.1705][4.1705:1716]()
    end,
    })
    [2.180]
    [4.1716]
    end)
  • replacement in 0051-run_button at line 2
    [4.3980][4.405:436](),[4.56][4.405:436](),[4.436][4.3981:4067](),[4.182][4.149:255](),[4.4067][4.149:255](),[4.149][4.149:255](),[4.255][4.437:480](),[4.480][4.298:329](),[4.298][4.298:329]()
    local w = App.width('run')+10
    button(Global_state, 'run', {x=x, y=y, w=w, h=Line_height, bg={r=0.6, g=0.8, b=0.6},
    icon = function(p)
    App.color(Normal_color)
    love.graphics.rectangle('line', p.x,p.y, p.w,p.h, 2,2)
    love.graphics.print('run', p.x+5,p.y+2)
    end,
    onpress1 = function()
    [4.3980]
    [4.329]
    styled_button('run', x,y,
    function()
  • replacement in 0051-run_button at line 28
    [4.1354][4.1354:1365]()
    end,
    })
    [4.1354]
    [4.4068]
    end)
    local w = App.width('run')+10