switch all handlers to run either the app or editor

akkartik
Jan 1, 2024, 12:21 AM
6RYG2FQJETRSB4HAZCURFUWAQXGMQHJPMEDWXO5LOY7HEPZNRPAAC

Dependencies

  • [2] SJXIMERS type out a filename to load/save
  • [3] VHOJIECS wire up mouse wheel
  • [4] OC4P6P36 greatly simplify slider implementation
  • [5] YSSG2JR6 merge bugfix
  • [6] I27BLL75 new car.quit callback for user scripts
  • [7] URM35DJS rip out the canvas
  • [8] KCFQO6K5 clean up some debug drawing
  • [9] IUOZ4YHC use the obvious name for the font global
  • [10] TLOAPLBJ add a license
  • [11] D2GCFTTT clean up repl functionality
  • [12] IP4LD33D mouse events for scrollbar
  • [13] VHQCNMAR several more modules
  • [14] JV27LDDK sliders for font size and color settings
  • [15] 4QFVRJ5U get rid of pane transition animations
  • [16] GFBOJWNE resolve conflicts
  • [17] CE4LZV4T drop last couple of manual tests
  • [18] LRDM35CE app running again
  • [19] 2CFLXLIE Merge text.love
  • [20] LWPFEZBI Merge lines.love
  • [21] RVJNNICY bugfix: autosave settings
  • [22] T4FRZSYL delete an ancient, unused file
  • [23] 7RIDCIVG handle scripts that change the font
  • [24] HVXZLNCC send errors from event handlers to output editor
  • [25] 5MEJ7XNH lay out buttons based on device dimensions
  • [26] VVGWHJBZ fix app identity so successive versions share data
  • [27] UEG224LH debug animations
  • [28] G42WRYFR new handler: mousemoved
  • [29] LXTTOB33 extract a couple of files
  • [30] CAG7PP5Y Merge text.love
  • [31] RSZD5A7G forgot to add json.lua
  • [32] VEAVIL4X resize handler
  • [33] BQTHWI4A check slider state more precisely
  • [34] 57HKHZ7Z include the tool that's mentioned in representation.md
  • [35] QD4LOFQR Merge text.love
  • [36] KKQKPGCI resolve conflicts
  • [37] ADXY3K5Z wire up new-style car.* handlers
  • [38] NVZTMKER partition handlers between screen regions
  • [39] 4YDBYBA4 clean up memory leak experiments
  • [40] ZLJYLPOT Merge lines.love
  • [41] 7JEYXICU resolve conflicts
  • [42] RBWTXOQS get rid of example screens
  • [43] VXRYVZ74 Merge text.love
  • [44] JOPVPUSA editing source code from within the app
  • [45] VAVXKWZV aggregate global state inside a 'pane' object
  • [46] YT7NMQ6Z delete dead code
  • [47] CZQ3NJ4N Merge text0
  • [48] LXR2FNDC resolve conflicts
  • [49] W4EQ6IW4 simplify state management for menus
  • [50] VLTU33KW resolve conflicts
  • [51] 6LJZN727 handle chords
  • [52] SIASJPGR save the list of open files across restart
  • [53] 4OMG2P5E isolate editor UI from some app changes
  • [54] OJGIQLZW bugfix: only check for settings menu when open
  • [55] 3PSFWAIL Merge lines.love
  • [56] TFUNIT6M resolve conflicts
  • [57] KMSL74GA support selections in the source editor
  • [58] VP5KC4XZ Merge lines.love
  • [59] FS2ITYYH record a known issue
  • [60] EZHO4TSW new file-system format for freewheeling apps
  • [61] 2L5MEZV3 experiment: new edit namespace
  • [62] RK2ASPN7 add lots of buttons to the toolbar
  • [63] GWLETNMW Mike's suggested button layout
  • [64] QG25UE3S bugfix: typo X-(
  • [65] VXORMHME delete experimental REPL
  • [66] 5LN2NUSE resolve conflicts
  • [67] Q6RXCILQ Merge text.love
  • [68] 2DVVKKVA flesh out Readme
  • [69] VUF2SX7B implement carousel buttons for inserting/switching current pane
  • [70] PN6VP3LV escape hatch when print is overridden
  • [71] OL7ZCZWD Merge text.love
  • [72] BLWAYPKV extract a module
  • [73] 6VJTQKW7 start supporting LÖVE v12
  • [74] AVTNUQYR basic test-enabled framework
  • [75] SIJ5I4NZ extract a helper for buttons
  • [76] XJX53BE3 bugfix: catch errors in mouse_press handlers
  • [77] VHUNJHXB Merge lines.love
  • [78] SW5GN5LP suggest a default layout for freewheeling apps
  • [79] ZOLCTAGU get rid of an assertion
  • [80] I52S4E5F running `print` now appends to output editor
  • [81] 4GX6NAY4 some very basic animations for switching panes
  • [82] GAKJROFZ ahh, got the background color sliders working
  • [83] 2Q437U4F starting to experiment with animated pane transitions
  • [84] LGIEVJE6 activate buttons for some time
  • [85] TBTRYEBP Merge lines.love
  • [86] GVX7YSQY initial script after splitting up text-zoom
  • [87] WR2WMEPE implement 'Run' button
  • [88] N2NUGNN4 include a brief reference enabling many useful apps
  • [89] 6MQCFHXM remember when someone deletes an example
  • [90] R5QXEHUI somebody stop me
  • [91] X2YWEIZS bugfix: missing variable in a button
  • [92] OGUV4HSA remove some memory leaks from rendered fragments
  • [93] 3QNOKBFM beginnings of a test harness
  • [94] ZM7NOBRM new fork: carousel shell
  • [95] ESOJS6ZW extract a function
  • [96] PJ5PQAQE record support for multiple versions
  • [97] KKMFQDR4 editing source code from within the app
  • [98] E75L5QGU ok/cancel buttons in file dialog
  • [99] 73OCE2MC after much struggle, a brute-force undo
  • [100] XX7G2FFJ intermingle freehand line drawings with text
  • [101] K2X6G75Z start writing some tests for drawings
  • [102] ORKN6EOB Merge lines.love
  • [103] TVCPXAAU rename
  • [104] SGMA5JLE save the list of tests in repo
  • [105] 6RYGW5H3 bugfix: output border color
  • [106] FPSPT5TM show current pane number
  • [107] YV2GBDNW preserve settings across restart
  • [108] 72OBZ3VM bundle support for .wav files
  • [109] MZ3DMYPD start sketching out a scrollbar
  • [110] UUAIVZ4U 2 bugfixes in font rendering
  • [111] CMZDG7CJ bugfix: tapping in scrollbar area
  • [112] QLJY3CKC bugfix: use border color in scrollbars
  • [113] 5RUFNRJO start of the visual skeleton
  • [114] ROYQO45B mount old location of screens if possible
  • [115] BULPIBEG beginnings of a module for the text editor
  • [116] ED4Z6ORC cleaner API for file-system access
  • [117] 6DJMOJKE support event handlers
  • [118] EHKB76GO UI improvement: more stable scrollbar movement
  • [119] 2CEAF7YR resolve conflicts
  • [120] 66X36NZN a little more prose describing manual_tests
  • [121] Z5M23NTK implement second, 'output' editor
  • [122] 47VXAH2H delete some old code
  • [123] PRE6XPRN responsively increase/decrease font height
  • [124] QMRQL2FO resolve conflicts
  • [125] OGDDLU5B close all menus when tapping any button
  • [126] D43U7GQ4 alter on-disk representation (manifest files)
  • [127] RJPNFXVQ new fork: a personal dashboard for mobile devices
  • [128] OTIBCAUJ love2d scaffold
  • [129] W3RRTO4P extract a second helper for buttons
  • [130] 36Z442IV back to commit 8123959e52f without code editing
  • [131] 4SR3Z4Y3 document the version of LÖVE I've been using
  • [132] VSGPLJFA resolve conflicts
  • [133] FM5LDKGT Merge text.love
  • [134] VQYLKEGD handle still narrower screens on phones
  • [135] OOSUBWKX subject people to a tutorial
  • [136] OE26XIQO bring back syntax highlighting (but so ugly)
  • [137] 5OVKHVY6 nice way to make on.* handlers more discoverable
  • [138] ZENSSO3D pass remaining love handlers through
  • [139] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing
  • [140] FIUQJVL2 first draft of load/save buttons
  • [141] RU4HIK43 Merge lines.love
  • [142] PUXFYOQ4 rename a function

Change contents

  • file deletion: 0106-stop_button (----------)
    [8.2][8.0:40](),[8.40][8.41:41]()
    stop_button = function(x, y)
    styled_button('stop', x,y,
    function()
    Show_menu = nil
    clear_handlers()
    end)
    if car.quit then
    call_protected(car.quit)
    end
    local w = App.width('stop')+10
    return x+w+10, y
    end
  • file deletion: 0065-hide_code_button (----------)
    [8.2][8.5120:5165](),[8.5165][8.4728:4728]()
    hide_code_button = function(x, y, r)
    return overflowable_button('hide', x, y, r,
    function()
    Show_menu = nil
    Show_code = false
    end)
    end
  • file deletion: 0064-show_code_button (----------)
    [8.2][8.5558:5603](),[8.5603][8.5167:5167]()
    show_code_button = function(x, y, r)
    return overflowable_button('show', x, y, r,
    function()
    Show_menu = nil
    Show_code = true
    end)
    end
  • file addition: 0158-on.quit (----------)
    [8.2]
    on.quit = function()
    call_protected(car.quit)
    end
  • replacement in 0101-on.mouse_wheel_move at line 2
    [8.88][8.88:107](),[8.107][3.71:268](),[3.268][8.124:150](),[8.124][8.124:150]()
    if Show_code then
    if App.mouse_y() < Current_pane.editor_state.bottom then
    edit.mouse_wheel_move(Current_pane.editor_state, dx,dy)
    else
    edit.mouse_wheel_move(Current_pane.output_editor_state, dx,dy)
    end
    else
    -- editors hidden
    [8.88]
    [8.915]
    if not Show_code then
  • edit in 0101-on.mouse_wheel_move at line 9
    [8.1071]
    [8.264]
    else
    if App.mouse_y() < Current_pane.editor_state.bottom then
    edit.mouse_wheel_move(Current_pane.editor_state, dx,dy)
    else
    edit.mouse_wheel_move(Current_pane.output_editor_state, dx,dy)
    end
  • edit in 0021-draw_menu at line 14
    [8.166][8.166:189](),[8.189][8.4375:4455](),[8.605][8.4375:4455](),[8.4455][8.284:501](),[8.501][8.7838:7857](),[8.605][8.7838:7857](),[8.4455][8.7838:7857](),[8.398][8.7838:7857](),[8.7857][8.4456:4491](),[8.4491][8.7883:7889](),[8.7883][8.7883:7889](),[8.7889][8.4492:4527](),[8.4527][8.7915:7920](),[8.7915][8.7915:7920]()
    x = stop_button(x, y)
    -- assume screen will always be wide enough to print this far without overflow
    if not Overflow_button then
    local w = App.width('code')+10
    local w2 = App.width('>>')+10
    if x+w+10+w2+10 < r then
    App.color{r=0.5, g=0.5, b=0.5}
    love.graphics.print('code', x, y)
    x = x+w+10
    end
    end
    if Show_code then
    x, y = hide_code_button(x, y, r)
    else
    x, y = show_code_button(x, y, r)
    end
  • edit in 0021-draw_menu at line 18
    [8.4587][8.4587:4818](),[8.4818][8.502:516](),[8.516][8.4850:4861](),[8.4850][8.4850:4861]()
    x, y = clear_pane_button(x, y, r)
    if not Overflow_button then
    local w = App.width('screen')+10
    local w2 = App.width('>>')+10
    if x+w+10+w2+10 < r then
    App.color{r=0.5, g=0.5, b=0.5}
    love.graphics.print('screen', x, y)
    x = x+w+10
    end
    end
  • replacement in 0017-on.mouse_release at line 2
    [8.2259][8.66:83](),[8.5822][8.84:166](),[8.166][4.1313:1349](),[4.1349][8.661:694](),[8.166][8.661:694](),[8.694][8.23:66](),[8.23][8.23:66]()
    -- == menu area
    if Button_pressed then
    Button_pressed = nil
    return
    end
    -- == settings area
    Global_state.selected_slider = nil
    if Show_menu == 'settings' then
    if on_area(Settings_menu_area, x,y) then
    [8.2259]
    [8.66]
    if not Show_code then
    if car.mouse_release then
    call_protected(car.mouse_release, x,y, mouse_button)
    end
    if car.mousereleased then
    call_protected(car.mousereleased, x,y, mouse_button)
    end
    else
    -- == menu area
    if Button_pressed then
    Button_pressed = nil
  • replacement in 0017-on.mouse_release at line 15
    [8.82][8.217:239](),[8.217][8.217:239](),[8.239][8.376:395](),[8.5822][8.376:395]()
    end
    -- == main area
    if Show_code then
    [8.82]
    [8.395]
    -- == settings area
    Global_state.selected_slider = nil
    if Show_menu == 'settings' then
    if on_area(Settings_menu_area, x,y) then
    return
    end
    end
    -- == main area
  • edit in 0017-on.mouse_release at line 38
    [8.1165][8.1165:1191](),[8.1191][8.1194:1374]()
    else
    -- editors hidden
    if car.mouse_release then
    call_protected(car.mouse_release, x,y, mouse_button)
    end
    if car.mousereleased then
    call_protected(car.mousereleased, x,y, mouse_button)
    end
  • replacement in 0016-on.mouse_press at line 2
    [8.2409][8.240:257](),[8.257][8.520:612](),[8.2409][8.520:612](),[8.612][5.138:215](),[5.215][8.258:282](),[8.3206][8.258:282](),[8.282][8.5824:5838](),[8.3206][8.5824:5838](),[8.4958][8.283:304](),[8.304][4.1354:1431](),[4.1431][8.700:733](),[8.304][8.700:733](),[8.733][8.327:370](),[8.327][8.327:370](),[8.370][4.1432:1497](),[8.822][8.412:419](),[4.1497][8.412:419](),[8.412][8.412:419](),[8.419][8.734:753](),[8.753][8.444:589](),[8.444][8.444:589](),[8.589][8.106:166](),[8.106][8.106:166]()
    -- == menu area
    -- some hysteresis right after a button has been pressed
    if Active_button then return end
    if mouse_press_consumed_by_any_button(Global_state, x,y, mouse_button) then
    Button_pressed = true
    return
    end
    -- == settings area
    if mouse_press_consumed_by_any_slider(Global_state, x,y) then
    return
    end
    if Show_menu == 'settings' then
    if on_area(Settings_menu_area, x,y) then
    -- nothing atm in settings menu that isn't a button or slider
    else
    Show_menu = nil
    -- On mobile devices, we can't depend on on.save_settings() triggering on quit.
    -- So save settings every time we close the settings menu.
    love.filesystem.write('config', json.encode(settings()))
    [8.2409]
    [8.166]
    if not Show_code then
    if car.mouse_press then
    call_protected(car.mouse_press, x,y, mouse_button)
    end
    if car.mousepressed then
    call_protected(car.mousepressed, x,y, mouse_button)
    end
    else
    -- == menu area
    -- some hysteresis right after a button has been pressed
    if Active_button then return end
    if mouse_press_consumed_by_any_button(Global_state, x,y, mouse_button) then
    Button_pressed = true
    return
    end
    -- == settings area
    if mouse_press_consumed_by_any_slider(Global_state, x,y) then
    return
    end
    if Show_menu == 'settings' then
    if on_area(Settings_menu_area, x,y) then
    -- nothing atm in settings menu that isn't a button or slider
    else
    Show_menu = nil
    -- On mobile devices, we can't depend on on.save_settings() triggering on quit.
    -- So save settings every time we close the settings menu.
    love.filesystem.write('config', json.encode(settings()))
    end
    return
  • replacement in 0016-on.mouse_press at line 32
    [8.172][8.590:599](),[8.599][8.5957:5962](),[8.5957][8.5957:5962](),[8.5962][8.600:617](),[8.617][8.754:771](),[8.617][8.1330:1349](),[8.771][8.1330:1349](),[8.5962][8.1330:1349]()
    return
    end
    -- == main area
    Show_menu = nil
    if Show_code then
    [8.172]
    [8.1349]
    -- == main area
    Show_menu = nil
  • edit in 0016-on.mouse_press at line 49
    [8.1985][8.1985:2017](),[8.2017][8.141:309]()
    end
    else
    -- editors hidden
    if car.mouse_press then
    call_protected(car.mouse_press, x,y, mouse_button)
    end
    if car.mousepressed then
    call_protected(car.mousepressed, x,y, mouse_button)
  • replacement in 0016-on.mouse_press at line 51
    [8.1606][5.216:220]()
    end
    [8.1606]
    end
  • edit in 0015-on.key_release at line 7
    [8.2288][8.2288:2308]()
    -- editors hidden
  • replacement in 0014-on.text_input at line 2
    [8.2676][2.2912:2992](),[2.2992][8.2450:2495](),[8.2450][8.2450:2495]()
    if Show_file_dialog then
    text_input_on_file_dialog(t)
    elseif Show_code then
    if Current_pane.editor_state.cursor_x then
    [8.2676]
    [8.2495]
    if Show_code then
    if Show_file_dialog then
    text_input_on_file_dialog(t)
    elseif Current_pane.editor_state.cursor_x then
  • edit in 0014-on.text_input at line 9
    [8.2556][8.2556:2576]()
    -- editors hidden
  • replacement in 0013-on.keychord_press at line 2
    [8.2800][8.4016:4042](),[8.4042][2.2994:3038](),[2.3038][8.4069:4083](),[8.4069][8.4069:4083](),[8.4083][8.2035:2059](),[8.2800][8.2035:2059](),[8.2059][8.3882:3946](),[8.3946][8.2110:2138](),[8.2110][8.2110:2138](),[8.2138][8.3947:4011](),[8.4011][8.2189:2244](),[8.2189][8.2189:2244](),[8.2244][8.2669:2846]()
    if Show_file_dialog then
    keychord_press_on_file_dialog(chord, key)
    return
    end
    if chord == 'C-=' then
    update_font_settings(Current_pane.editor_state.font_height+2)
    elseif chord == 'C--' then
    update_font_settings(Current_pane.editor_state.font_height-2)
    elseif chord == 'C-0' then
    update_font_settings(20)
    elseif Show_code then
    if Current_pane.editor_state.cursor_x then
    -- send keys to editor if cursor is visible
    edit.keychord_press(Current_pane.editor_state, chord, key)
    [8.2800]
    [8.2846]
    if Show_code then
    if Show_file_dialog then
    keychord_press_on_file_dialog(chord, key)
    return
    end
    if chord == 'C-=' then
    update_font_settings(Current_pane.editor_state.font_height+2)
    elseif chord == 'C--' then
    update_font_settings(Current_pane.editor_state.font_height-2)
    elseif chord == 'C-0' then
    update_font_settings(20)
    else
    if Current_pane.editor_state.cursor_x then
    -- send keys to editor if cursor is visible
    edit.keychord_press(Current_pane.editor_state, chord, key)
    end
  • edit in 0013-on.keychord_press at line 20
    [8.2858][8.2858:2878]()
    -- editors hidden
  • replacement in 0012-on.draw at line 4
    [4.1533][8.4084:4162](),[8.4113][8.4084:4162](),[8.4162][8.4963:4986](),[8.4113][8.4963:4986](),[8.4986][8.44:138](),[8.4113][8.44:138](),[8.905][8.2992:3021](),[8.3021][7.0:47](),[7.47][8.73:102](),[8.1893][8.73:102](),[8.102][8.0:56](),[8.182][8.0:56](),[8.1893][8.0:56](),[8.56][8.8224:8243](),[8.1893][8.8224:8243](),[8.3069][8.8224:8243](),[8.905][8.8224:8243]()
    -- modal dialog
    if Show_file_dialog then
    draw_file_dialog()
    return
    end
    Overflow_button = nil
    love.graphics.setBackgroundColor(Background_color.r, Background_color.g, Background_color.b)
    App.color(Foreground_color)
    if car.draw then call_protected(car.draw) end
    love.graphics.setFont(Font)
    App.color(Normal_color)
    love.graphics.setLineWidth(1)
    if Show_code then
    [4.1533]
    [8.8243]
    if not Show_code then
    if car.draw then call_protected(car.draw) end
    else
    -- modal dialog
    if Show_file_dialog then
    draw_file_dialog()
    return
    end
    Overflow_button = nil
    love.graphics.setBackgroundColor(Background_color.r, Background_color.g, Background_color.b)
    App.color(Foreground_color)
    -- code editor
    love.graphics.setFont(Font)
    App.color(Normal_color)
    love.graphics.setLineWidth(1)
  • edit in 0012-on.draw at line 22
    [8.8416]
    [8.8416]
    -- output
  • edit in 0012-on.draw at line 26
    [8.8574]
    [8.8574]
    -- menu and debug UI
    draw_menu()
    draw_next_frames_of_animations()
  • edit in 0012-on.draw at line 30
    [8.2603][8.1947:1960](),[8.4329][8.1947:1960](),[8.8579][8.1947:1960](),[8.1947][8.1947:1960](),[8.1960][8.2189:2223]()
    draw_menu()
    draw_next_frames_of_animations()
  • replacement in 0004-on.update at line 3
    [8.1760][8.618:635](),[8.635][8.613:699](),[8.1760][8.613:699]()
    -- == menu area
    if Active_button and Active_button.expire <= Current_time then
    Active_button = nil
    [8.1760]
    [8.699]
    if not Show_code then
    if car.update then call_protected(car.update, dt) end
    else
    -- == menu area
    if Active_button and Active_button.expire <= Current_time then
    Active_button = nil
    end
    -- == settings area
    update_sliders(Global_state, App.mouse_x())
    -- == main area
    if Current_pane.editor_state.scrollbar_drag then
    adjust_scrollbar(Current_pane.editor_state, App.mouse_y())
    elseif Current_pane.output_editor_state.scrollbar_drag then
    adjust_scrollbar(Current_pane.output_editor_state, App.mouse_y())
    end
  • edit in 0004-on.update at line 19
    [8.704][8.636:657](),[8.657][4.1534:1596](),[8.672][8.4658:4898](),[4.1596][8.4658:4898](),[8.6266][8.4658:4898](),[8.1760][8.4658:4898](),[8.3026][8.1672:1677](),[8.4898][8.1672:1677](),[8.1672][8.1672:1677](),[8.1677][8.1894:1949]()
    -- == settings area
    update_sliders(Global_state, App.mouse_x())
    -- == main area
    if Current_pane.editor_state.scrollbar_drag then
    adjust_scrollbar(Current_pane.editor_state, App.mouse_y())
    elseif Current_pane.output_editor_state.scrollbar_drag then
    adjust_scrollbar(Current_pane.output_editor_state, App.mouse_y())
    end
    if car.update then call_protected(car.update, dt) end