add keyboard shortcuts for common operations
Dependencies
- [2]
ZGPYJMP3bugfix: crash when saving to empty file - [3]
DZLFYLDUmanually save settings on change to loaded filenames - [4]
AZMYKWMHresolve conflicts - [5]
OGDDLU5Bclose all menus when tapping any button - [6]
W3RRTO4Pextract a second helper for buttons - [7]
6DJMOJKEsupport event handlers - [8]
PRE6XPRNresponsively increase/decrease font height - [9]
4QFVRJ5Uget rid of pane transition animations - [10]
X2YWEIZSbugfix: missing variable in a button - [11]
W4EQ6IW4simplify state management for menus - [12]
5MEJ7XNHlay out buttons based on device dimensions - [13]
I27BLL75new car.quit callback for user scripts - [14]
PN6VP3LVescape hatch when print is overridden - [15]
4GX6NAY4some very basic animations for switching panes - [16]
RK2ASPN7add lots of buttons to the toolbar - [17]
6VPJTZFSreset file system state with everything else - [18]
HVXZLNCCsend errors from event handlers to output editor - [19]
SIJ5I4NZextract a helper for buttons - [20]
FIUQJVL2first draft of load/save buttons - [21]
JV27LDDKsliders for font size and color settings - [22]
GAKJROFZahh, got the background color sliders working - [23]
NV4WC3K4new example: interactivity - [24]
V2G455IRclean up a debug print - [25]
GWLETNMWMike's suggested button layout - [26]
I52S4E5Frunning `print` now appends to output editor - [*]
R5QXEHUIsomebody stop me - [*]
ZM7NOBRMnew fork: carousel shell
Change contents
- file addition: 0168-press_previous_pane_button[28.2]
press_previous_pane_button = function()Show_menu = nilCurrent_pane.car = carCurrent_pane_index = Current_pane_index-1Current_pane = Panes[Current_pane_index]car = Current_pane.car or {}end - file addition: 0167-press_next_pane_button[28.2]
press_next_pane_button = function()Show_menu = nilCurrent_pane.car = carCurrent_pane_index = Current_pane_index+1Current_pane = Panes[Current_pane_index]car = Current_pane.car or {}end - file addition: 0166-press_load_button[28.2]
press_load_button = function()Show_menu = nilShow_file_dialog = trueFile_dialog_callback = function(filename)if filename == '' then-- clear filenameCurrent_pane.filename = nilreturnendCurrent_pane.filename = filenameone_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()))endend - file addition: 0165-press_save_button[28.2]
press_save_button = function()Show_menu = nilif Current_pane.filename == nil thenShow_file_dialog = trueFile_dialog_callback = function(filename)if filename == '' then return endCurrent_pane.filename = filenameone_time_save()-- 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()))endelseone_time_save()endend - file addition: 0164-press_hide_button[28.2]
press_hide_button = function()Show_menu = nilShow_code = falseend - file addition: 0163-press_show_button[28.2]
press_show_button = function()Show_menu = nilShow_code = trueend - file addition: 0162-press_stop_button[28.2]
press_stop_button = function()if car.quit thencall_protected(car.quit)endShow_menu = nilclear_handlers()end - file addition: 0161-press_run_button[28.2]
press_run_button = function()Show_menu = nil-- ## run: initializeclear_handlers()local buf = table.concat(map(Current_pane.editor_state.lines, function(line) return line.data end), '\n')Current_pane.canvas = love.graphics.newCanvas()love.graphics.setCanvas(Current_pane.canvas)love.graphics.push('all')love.graphics.setBackgroundColor(1,1,1)edit.clear(Current_pane.output_editor_state)print = print_to_output-- ## runlocal status, result = live.eval(buf, 'editor')-- ## run: save some stuff, clean up the restprint = Real_printif result then-- could be either output or errortable.insert(Current_pane.output_editor_state.lines, {data=tostring(result)})endif #Current_pane.output_editor_state.lines == 0 thentable.insert(Current_pane.output_editor_state.lines, {data=''})endText.redraw_all(Current_pane.output_editor_state)love.graphics.pop()love.graphics.setCanvas()end - replacement in 0116-save_button at line 2[5.2791]→[5.2791:2849](∅→∅),[5.2849]→[5.60:79](∅→∅),[5.79]→[5.2866:2906](∅→∅),[5.105]→[5.2866:2906](∅→∅),[5.2866]→[5.2866:2906](∅→∅),[5.2964]→[5.2964:3038](∅→∅),[5.3038]→[2.0:39](∅→∅),[2.39]→[5.3038:3097](∅→∅),[5.3038]→[5.3038:3097](∅→∅),[5.3097]→[3.253:446](∅→∅),[3.446]→[5.3097:3147](∅→∅),[5.3097]→[5.3097:3147](∅→∅)
return overflowable_button('save', x, y, r,function()Show_menu = nilif Current_pane.filename == nil thenShow_file_dialog = trueFile_dialog_callback = function(filename)if filename == '' then return endCurrent_pane.filename = filenameone_time_save()-- 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()))endelseone_time_save()endend)return overflowable_button('save', x, y, r, press_save_button) - replacement in 0106-stop_button at line 2[5.1362]→[5.132:173](∅→∅),[5.173]→[5.0:56](∅→∅),[5.56]→[5.188:207](∅→∅),[5.173]→[5.188:207](∅→∅),[5.207]→[5.223:250](∅→∅),[5.223]→[5.223:250](∅→∅)
styled_button('stop', x,y,function()if car.quit thencall_protected(car.quit)endShow_menu = nilclear_handlers()end)styled_button('stop', x,y, press_stop_button) - replacement in 0106-stop_button at line 5
end[5.1469]end - replacement in 0065-hide_code_button at line 2[5.3098]→[5.918:976](∅→∅),[5.976]→[5.472:491](∅→∅),[5.491]→[5.5069:5090](∅→∅),[5.575]→[5.5069:5090](∅→∅),[5.976]→[5.5069:5090](∅→∅),[5.5069]→[5.5069:5090](∅→∅),[5.5090]→[5.977:984](∅→∅),[5.984]→[5.492:496](∅→∅)
return overflowable_button('hide', x, y, r,function()Show_menu = nilShow_code = falseend)end[5.3098]return overflowable_button('hide', x, y, r, press_hide_button)end - replacement in 0064-show_code_button at line 2[5.109]→[5.985:1043](∅→∅),[5.1043]→[5.497:516](∅→∅),[5.516]→[5.5508:5528](∅→∅),[5.626]→[5.5508:5528](∅→∅),[5.1043]→[5.5508:5528](∅→∅),[5.5508]→[5.5508:5528](∅→∅),[5.5528]→[5.1044:1051](∅→∅),[5.1051]→[5.517:521](∅→∅)
return overflowable_button('show', x, y, r,function()Show_menu = nilShow_code = trueend)end[5.109]return overflowable_button('show', x, y, r, press_show_button)end - edit in 0060-next_pane_button at line 6[5.6541]→[5.6541:6572](∅→∅),[5.6572]→[5.547:566](∅→∅),[5.566]→[5.1388:1414](∅→∅),[5.728]→[5.1388:1414](∅→∅),[5.6572]→[5.1388:1414](∅→∅),[5.1414]→[5.6572:6661](∅→∅),[5.6572]→[5.6572:6661](∅→∅),[5.6661]→[5.1415:1447](∅→∅)
end,onpress1 = function()Show_menu = nilCurrent_pane.car = carCurrent_pane_index = Current_pane_index+1Current_pane = Panes[Current_pane_index]car = Current_pane.car or {} - edit in 0060-next_pane_button at line 7
onpress1 = press_next_pane_button, - replacement in 0060-next_pane_button at line 9
end[5.6672]end - edit in 0059-previous_pane_button at line 6[5.7084]→[5.7084:7115](∅→∅),[5.7115]→[5.572:591](∅→∅),[5.591]→[5.1448:1474](∅→∅),[5.779]→[5.1448:1474](∅→∅),[5.7115]→[5.1448:1474](∅→∅),[5.1474]→[5.7115:7204](∅→∅),[5.7115]→[5.7115:7204](∅→∅),[5.7204]→[5.1475:1507](∅→∅)
end,onpress1 = function()Show_menu = nilCurrent_pane.car = carCurrent_pane_index = Current_pane_index-1Current_pane = Panes[Current_pane_index]car = Current_pane.car or {} - edit in 0059-previous_pane_button at line 7
onpress1 = press_previous_pane_button, - replacement in 0059-previous_pane_button at line 9
end[5.7215]end - replacement in 0051-run_button at line 2[5.3980]→[5.764:804](∅→∅),[5.804]→[5.597:616](∅→∅),[5.616]→[5.329:354](∅→∅),[5.804]→[5.329:354](∅→∅),[5.830]→[5.329:354](∅→∅),[5.329]→[5.329:354](∅→∅),[5.354]→[5.1072:1092](∅→∅),[5.1092]→[5.354:591](∅→∅),[5.354]→[5.354:591](∅→∅),[5.591]→[5.0:43](∅→∅),[5.43]→[5.1093:1141](∅→∅),[5.795]→[5.795:835](∅→∅),[5.835]→[5.1142:1193](∅→∅),[5.1193]→[5.876:925](∅→∅),[5.876]→[5.876:925](∅→∅),[5.925]→[5.193:215](∅→∅),[5.215]→[5.972:1354](∅→∅),[5.972]→[5.972:1354](∅→∅),[5.1354]→[5.805:812](∅→∅)
styled_button('run', x,y,function()Show_menu = nil-- ## run: initializeclear_handlers()local buf = table.concat(map(Current_pane.editor_state.lines, function(line) return line.data end), '\n')Current_pane.canvas = love.graphics.newCanvas()love.graphics.setCanvas(Current_pane.canvas)love.graphics.push('all')love.graphics.setBackgroundColor(1,1,1)edit.clear(Current_pane.output_editor_state)print = print_to_output-- ## runlocal status, result = live.eval(buf, 'editor')-- ## run: save some stuff, clean up the restprint = Real_printif result then-- could be either output or errortable.insert(Current_pane.output_editor_state.lines, {data=tostring(result)})endif #Current_pane.output_editor_state.lines == 0 thentable.insert(Current_pane.output_editor_state.lines, {data=''})endText.redraw_all(Current_pane.output_editor_state)love.graphics.pop()love.graphics.setCanvas()end)styled_button('run', x,y, press_run_button) - replacement in 0051-run_button at line 5
end[5.4086]end - edit in 0013-on.keychord_press at line 12
elseif not Show_code and chord == 'f3' thenpress_show_button() - replacement in 0013-on.keychord_press at line 15
if Current_pane.editor_state.cursor_x thenif chord == 'C-left' then press_previous_pane_button()elseif chord == 'C-right' then press_next_pane_button()elseif chord == 'f1' then press_run_button()elseif chord == 'f2' then press_stop_button()elseif chord == 'f3' then press_hide_button()elseif chord == 'f4' then press_save_button()elseif chord == 'f5' then press_load_button()elseif Current_pane.editor_state.cursor_x then