add lots of buttons to the toolbar
Dependencies
- [2]
2Q437U4Fstarting to experiment with animated pane transitions - [3]
UPQJIFDPhide file numbers in output editor - [4]
FPSPT5TMshow current pane number - [5]
I52S4E5Frunning `print` now appends to output editor - [6]
VUF2SX7Bimplement carousel buttons for inserting/switching current pane - [7]
PRE6XPRNresponsively increase/decrease font height - [8]
5RUFNRJOstart of the visual skeleton - [9]
WR2WMEPEimplement 'Run' button - [10]
4QFVRJ5Uget rid of pane transition animations - [11]
OV6FE23RMerge text0 - [12]
MZ3DMYPDstart sketching out a scrollbar - [13]
R2ASHK5Cfix a bad merge - [14]
4GX6NAY4some very basic animations for switching panes - [15]
Z5M23NTKimplement second, 'output' editor - [16]
6RYGW5H3bugfix: output border color - [17]
ZM7NOBRMnew fork: carousel shell - [18]
VAVXKWZVaggregate global state inside a 'pane' object - [*]
2L5MEZV3experiment: new edit namespace - [*]
R5QXEHUIsomebody stop me
Change contents
- replacement in edit.lua at line 372
for _,code in utf8.codes(clipboard_data) dolocal c = utf8.char(code)if c == '\n' thenText.insert_return(State)elseText.insert_at_cursor(State, c)endendText.insert_text(State, clipboard_data) - edit in edit.lua at line 382
endendfunction Text.insert_text(State, d)for _,code in utf8.codes(d) dolocal c = utf8.char(code)if c == '\n' thenText.insert_return(State)elseText.insert_at_cursor(State, c)end - file addition: 0076-delete_pane_button[21.2]
delete_pane_button = function(x)local w = App.width('delete')+10button(Global_state, 'delete', {x=x, y=Menu_top+5, 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('delete', p.x+5,p.y+2)end,onpress1 = function()table.remove(Panes, Current_pane_index)if #Panes == 0 thentable.insert(Panes, new_pane())endif Current_pane_index > #Panes thenCurrent_pane_index = Current_pane_index-1endCurrent_pane = Panes[Current_pane_index]end,})return x+w+10end - file addition: 0075-clear_pane[21.2]
clear_pane = function()Current_pane.editor_state.lines = {{data=''}}Current_pane.editor_state.screen_top1 = {line=1, pos=1}Current_pane.editor_state.cursor1 = {line=1, pos=1}Text.redraw_all(Current_pane.editor_state)end - file addition: 0074-clear_pane_button[21.2]
clear_pane_button = function(x)local w = App.width('clear')+10button(Global_state, 'clear', {x=x, y=Menu_top+5, 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('clear', p.x+5,p.y+2)end,onpress1 = clear_pane,})return x+w+10end - file addition: 0072-settings_button[21.2]
settings_button = function(x, w)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()print('settings')end,})return x+w+10end - file addition: 0071-duplicate_pane_button[21.2]
duplicate_pane_button = function(x)local w = App.width('dup')+10button(Global_state, 'duplicate', {x=x, y=Menu_top+5, 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('dup', p.x+5,p.y+2)end,onpress1 = function()local new_pane = {editor_state = copy_editor(Current_pane.editor_state)}new_pane.output_editor_state = output_editor_state(new_pane.editor_state)Current_pane_index = Current_pane_index+1table.insert(Panes, Current_pane_index, new_pane)Current_pane = Panes[Current_pane_index]end,})return x+w+10end - file addition: 0070-code_editor_state[21.2]
code_editor_state = function()local result = edit.initialize_state(Menu_bottom + 20, -- topSafe_height/2-Line_height, -- bottomMenu_left + 50 + Line_number_padding, -- leftmath.min(100+30*App.width('m'), Safe_width*2/3), -- rightlove.graphics.getFont():getHeight(), Line_height)Text.redraw_all(result)return resultend - file addition: 0069-output_editor_state[21.2]
output_editor_state = function(editor_state)local result = edit.initialize_state(editor_state.bottom+5+10+5, -- topnil, -- buttomeditor_state.left, editor_state.right,love.graphics.getFont():getHeight(), Line_height)Text.redraw_all(result)return resultend - file addition: 0068-copy_editor[21.2]
copy_editor = function(state)local new_state = edit.initialize_state(Menu_bottom + 20, -- topSafe_height/2-Line_height, -- bottomMenu_left + 50 + Line_number_padding, -- leftmath.min(100+30*App.width('m'), Safe_width*2/3), -- rightlove.graphics.getFont():getHeight(), Line_height)new_state.lines = map(state.lines,function(line)return {data=line.data}end)Text.redraw_all(new_state)return new_stateend - file addition: 0067-paste_button[21.2]
paste_button = function(x)local w = App.width('paste')+10button(Global_state, 'paste', {x=x, y=Menu_top+5, 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('paste', p.x+5,p.y+2)end,onpress1 = function()local s = App.get_clipboard()Text.insert_text(Current_pane.editor_state, s)end,})return x+w+10end - file addition: 0066-copy_button[21.2]
copy_button = function(x)local w = App.width('copy')+10button(Global_state, 'copy', {x=x, y=Menu_top+5, 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('copy', p.x+5,p.y+2)end,onpress1 = function()local s = Text.selection(Current_pane.editor_state)if s then App.set_clipboard(s) endend,})return x+w+10end - file addition: 0065-hide_code_button[21.2]
hide_code_button = function(x)local w = App.width('hide')+10button(Global_state, 'hide', {x=x, y=Menu_top+5, 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('hide', p.x+5,p.y+2)end,onpress1 = function()Show_code = falseend,})return x+w+10end - file addition: 0064-show_code_button[21.2]
show_code_button = function(x)local w = App.width('show')+10button(Global_state, 'show', {x=x, y=Menu_top+5, 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('show', p.x+5,p.y+2)end,onpress1 = function()Show_code = trueend,})return x+w+10end - file addition: 0063-Show_code[21.2]
Show_code = true - file addition: 0061-new_pane_button[21.2]
new_pane_button = function(x)local w = App.width('new')+10button(Global_state, 'new', {x=x, y=Menu_top+5, 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('new', p.x+5,p.y+2)end,onpress1 = function()Current_pane_index = Current_pane_index+1table.insert(Panes, Current_pane_index, new_pane())Current_pane = Panes[Current_pane_index]end,})return x+w+10end - file addition: 0060-next_pane_button[21.2]
next_pane_button = function(r)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+1Current_pane = Panes[Current_pane_index]end,})end - file addition: 0059-previous_pane_button[21.2]
previous_pane_button = function()button(Global_state, 'previous_pane', {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-1Current_pane = Panes[Current_pane_index]end,})end - replacement in 0051-run_button at line 38
return x+wreturn x+w+10 - replacement in 0049-new_pane at line 3
result.editor_state = edit.initialize_state(Menu_bottom + 20, -- topSafe_height/2-Line_height, -- bottomMenu_left + 50 + Line_number_padding, -- leftmath.min(100+30*App.width('m'), Safe_width*2/3), -- rightlove.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, -- topnil, -- buttomresult.editor_state.left, result.editor_state.right,love.graphics.getFont():getHeight(), Line_height)Text.redraw_all(result.output_editor_state)result.editor_state = code_editor_state()result.output_editor_state = output_editor_state(result.editor_state) - replacement in 0021-draw_menu at line 6
love.graphics.print(Current_pane_index, x, Menu_top+5)x = x + App.width(tostring(Current_pane_index)) + 5love.graphics.print(Current_pane_index, x+5, Menu_top+5+2)x = x+5 + App.width(tostring(Current_pane_index)) + 10 - edit in 0021-draw_menu at line 10
if Show_code thenx = hide_code_button(x)elsex = show_code_button(x)endx = copy_button(x)x = paste_button(x)x = new_pane_button(x)x = duplicate_pane_button(x)x = clear_pane_button(x)x = delete_pane_button(x) - replacement in 0021-draw_menu at line 23[5.1019]→[5.1863:1982](∅→∅),[5.1982]→[5.1138:1159](∅→∅),[5.1138]→[5.1138:1159](∅→∅),[5.1159]→[5.166:193](∅→∅),[5.193]→[5.1185:1343](∅→∅),[5.1185]→[5.1185:1343](∅→∅),[5.1343]→[5.1085:1096](∅→∅),[5.1085]→[5.1085:1096](∅→∅)
button(Global_state, 'settings', {x=Safe_width-w-10-5, 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()print('settings')end,})settings_button(Safe_width-w-10-5, w) - replacement in 0021-draw_menu at line 26
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-1Current_pane = Panes[Current_pane_index]end,})previous_pane_button() - replacement in 0021-draw_menu at line 28[5.1354]→[5.1700:1734](∅→∅),[5.1700]→[5.1700:1734](∅→∅),[5.1734]→[5.1355:1784](∅→∅),[2.2123]→[5.1784:2220](∅→∅),[5.1784]→[5.1784:2220](∅→∅),[2.2180]→[5.2220:2233](∅→∅),[5.2220]→[5.2220:2233](∅→∅)
local r = Menu_left + Safe_widthif Current_pane_index == #Panes thenbutton(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+1Current_pane = Panes[Current_pane_index]end,})elsebutton(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+1Current_pane = Panes[Current_pane_index]end,})if Current_pane_index < #Panes thennext_pane_button(Menu_left + Safe_width) - replacement in 0012-on.draw at line 4[5.905]→[5.905:934](∅→∅),[5.934]→[5.1793:1924](∅→∅),[5.1793]→[5.1793:1924](∅→∅),[5.1924]→[3.961:1066](∅→∅),[3.1066]→[5.4152:4195](∅→∅),[5.4152]→[5.4152:4195](∅→∅),[5.3146]→[5.1925:1947](∅→∅),[5.4195]→[5.1925:1947](∅→∅),[5.3033]→[5.1925:1947](∅→∅),[5.1947]→[5.4196:4329](∅→∅)
--if Canvas then return enddraw_editor_border()-- love.graphics.rectangle('line', 100-5-Line_number_padding,100-5, 300+Line_number_padding+10, 200+10, 5,5)edit.draw(Current_pane.editor_state, --[[fg]] nil, --[[hide_cursor]] nil, --[[show_line_numbers]] true)draw_scrollbar(Current_pane.editor_state)draw_output_border()edit.draw(Current_pane.output_editor_state, Normal_color, --[[hide cursor]] true)draw_scrollbar(Current_pane.output_editor_state)if Show_code thendraw_editor_border()edit.draw(Current_pane.editor_state, --[[fg]] nil, --[[hide_cursor]] nil, --[[show_line_numbers]] true)draw_scrollbar(Current_pane.editor_state)draw_output_border()edit.draw(Current_pane.output_editor_state, Normal_color, --[[hide cursor]] true)draw_scrollbar(Current_pane.output_editor_state)end