some keyboard shortcuts on non-mobile devices

akkartik
Feb 23, 2024, 2:32 AM
Q3EQI5LIQVRRX234KDA4WBAAQFVER4F2DQLS62AO4B7F42N7ODFQC

Dependencies

  • [2] KCFQO6K5 clean up some debug drawing
  • [3] YR7AXEYB add keyboard shortcuts for common operations
  • [4] LGIEVJE6 activate buttons for some time
  • [5] OGDDLU5B close all menus when tapping any button
  • [6] FIUQJVL2 first draft of load/save buttons
  • [7] SJXIMERS type out a filename to load/save
  • [8] W3RRTO4P extract a second helper for buttons
  • [9] SIJ5I4NZ extract a helper for buttons
  • [10] AZMYKWMH resolve conflicts
  • [11] 5MEJ7XNH lay out buttons based on device dimensions
  • [12] DZLFYLDU manually save settings on change to loaded filenames
  • [13] GWLETNMW Mike's suggested button layout
  • [14] 6ARK6HWF bugfix: avoid overflowing 'delete' button in some situations
  • [15] X2YWEIZS bugfix: missing variable in a button
  • [16] 6VPJTZFS reset file system state with everything else
  • [17] I52S4E5F running `print` now appends to output editor
  • [18] RK2ASPN7 add lots of buttons to the toolbar
  • [19] W4EQ6IW4 simplify state management for menus
  • [*] XX7G2FFJ intermingle freehand line drawings with text
  • [*] LJUJH5GP bugfix: propagate mouse press if any button would
  • [*] R5QXEHUI somebody stop me
  • [*] ZM7NOBRM new fork: carousel shell
  • [*] 2Q437U4F starting to experiment with animated pane transitions

Change contents

  • edit in button.lua at line 35
    [22.214]
    [21.2671]
    end
    function draw_button_tooltips(State)
    if App.mouse_down(1) then return end
    local x,y = love.mouse.getPosition()
    for _,ev in ipairs(State.button_handlers) do
    if ev.tooltip then
    if x>ev.x and x<ev.x+ev.w and y>ev.y and y<ev.y+ev.h then
    ev.tooltip(x,y)
    end
    end
    end
  • file addition: 0175-show_tooltip (----------)
    [23.2]
    show_tooltip = function(x,y, tooltip_text)
    if not tooltip_text then return end
    App.color(Tooltip_background)
    local w = App.width(tooltip_text)
    love.graphics.rectangle('fill', x,y, w+10, Line_height+10, 2,2)
    App.color(Tooltip_foreground)
    love.graphics.print(tooltip_text, x+5, y+5)
    end
  • file addition: 0174-Is_mobile (----------)
    [23.2]
    Is_mobile = (OS == 'Android' or OS == 'iOS')
  • file addition: 0173-Tooltip_foreground (----------)
    [23.2]
    Tooltip_foreground = {r=0, g=0, b=0}
  • file addition: 0172-Tooltip_background (----------)
    [23.2]
    Tooltip_background = {r=0.8, g=0.8, b=0.8}
  • edit in 0168-press_previous_pane_button at line 3
    [3.59]
    [3.59]
    if Current_pane_index <=1 then return end
  • edit in 0167-press_next_pane_button at line 3
    [3.313]
    [3.313]
    if Current_pane_index >= #Panes then return end
  • replacement in 0124-styled_button at line 1
    [4.1][4.2:49]()
    styled_button = function(name, x, y, onpress1)
    [4.1]
    [4.583]
    styled_button = function(name, x, y, onpress1, tooltip_text)
  • edit in 0124-styled_button at line 20
    [4.514]
    [4.342]
    tooltip = function(x,y)
    show_tooltip(x,y+20, tooltip_text)
    end,
  • replacement in 0124-styled_button at line 24
    [4.346][4.618:622]()
    end
    [4.346]
    end
  • replacement in 0118-overflowable_button at line 3
    [4.515][4.51:121]()
    overflowable_button = function(name, x, y, r, onpress1, final_button)
    [4.515]
    [4.677]
    overflowable_button = function(name, x, y, r, onpress1, final_button, tooltip_text)
  • replacement in 0118-overflowable_button at line 14
    [4.301][4.516:552]()
    styled_button(name, x,y, onpress1)
    [4.301]
    [4.568]
    styled_button(name, x,y, onpress1, tooltip_text)
  • replacement in 0118-overflowable_button at line 20
    [4.649][4.192:196]()
    end
    [4.649]
    end
  • replacement in 0117-load_button at line 3
    [4.2500][4.2500:2513](),[4.2513][4.35:54](),[4.54][4.2570:2642](),[4.54][4.2570:2642](),[4.2570][4.2570:2642](),[4.2642][4.2721:2824](),[4.2824][4.2642:2699](),[4.2642][4.2642:2699](),[4.2699][4.57:247](),[4.247][4.2699:2713](),[4.2699][4.2699:2713]()
    function()
    Show_menu = nil
    Show_file_dialog = true
    File_dialog_callback = function(filename)
    if filename == '' then
    -- clear filename
    Current_pane.filename = nil
    return
    end
    Current_pane.filename = filename
    one_time_load()
    -- Load new filename in future sessions.
    -- On mobile devices, we can't depend on on.save_settings() triggering on quit.
    love.filesystem.write('config', json.encode(settings()))
    end
    end)
    [4.2500]
    [4.248]
    press_load_button, --[[final button?]] false, not Is_mobile and Show_code and 'F5')
  • replacement in 0116-save_button at line 2
    [4.2791][3.2981:3045]()
    return overflowable_button('save', x, y, r, press_save_button)
    [4.2791]
    [4.447]
    return overflowable_button('save', x, y, r, press_save_button, --[[final button?]] false, not Is_mobile and Show_code and 'F4')
  • replacement in 0106-stop_button at line 2
    [4.1362][3.3055:3102]()
    styled_button('stop', x,y, press_stop_button)
    [4.1362]
    [4.760]
    styled_button('stop', x,y, press_stop_button, not Is_mobile and Show_code and 'F2')
  • replacement in 0065-hide_code_button at line 2
    [4.3098][3.3139:3203]()
    return overflowable_button('hide', x, y, r, press_hide_button)
    [4.3098]
    [3.3203]
    return overflowable_button('hide', x, y, r, press_hide_button, nil, not Is_mobile and 'F3')
  • replacement in 0064-show_code_button at line 2
    [4.109][3.3208:3272]()
    return overflowable_button('show', x, y, r, press_show_button)
    [4.109]
    [3.3272]
    return overflowable_button('show', x, y, r, press_show_button, nil, not Is_mobile and 'F3')
  • edit in 0060-next_pane_button at line 8
    [3.3316]
    [4.6668]
    tooltip = function(x,y)
    local w = App.width('ctrl+right')
    show_tooltip(x-w-10,y+20, not Is_mobile and Show_code and 'ctrl+right')
    end,
  • edit in 0059-previous_pane_button at line 8
    [3.3363]
    [4.7211]
    tooltip = function(x,y)
    show_tooltip(x,y+20, not Is_mobile and Show_code and 'ctrl+left')
    end,
  • replacement in 0051-run_button at line 2
    [4.3980][3.3373:3418]()
    styled_button('run', x,y, press_run_button)
    [4.3980]
    [4.981]
    styled_button('run', x,y, press_run_button, not Is_mobile and Show_code and 'F1')
  • edit in 0012-on.draw at line 27
    [25.2223]
    [2.146]
    draw_button_tooltips(Global_state)