RK2ASPN7A55RCEG2YRFZLFXNPSME2VKBE2ZXO257DYZPS5TPXC5QC
2Q437U4FVEYO3Y22OC3NC5MAYVEDTTCWCRJHBKHKWA4WZSPWYUDQC
UPQJIFDPMKMUFFUKCDXNB3X64U4TCKLVXQGI6OQW2N7A7RSF54XAC
FPSPT5TMWUJXWC4GYWRXHS3ZB6MBLRJACIRMGE3ACQI75CV72X4AC
R2ASHK5CEE3PTRLS37GP4PXJ7HIGJ6UD72KKBI57UDJI7VRROQGQC
2L5MEZV344TOZLVY3432RHJFIRVXFD6O3GWLL5O4CV66BGAFTURQC
OV6FE23R76E357CRUDGHKSXYF5N3KO5NE62QL6OECX5SV3V4JCYQC
R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC
I52S4E5FT6E6FHH3QEDJPWO7C6W7AIMAFDP2KQ5FEWXFQX7RY6CAC
VUF2SX7BSB6DYFUCIS24UAMIQB4F3FLYSDLS5UXDCKIKPTWH4WWQC
5RUFNRJOK3PXQKJTPDEN5K5PI67MGB25QUA44WOCCH2O5KHXT45QC
PRE6XPRNICDCHMF7C45A6DRPVT47IPAIWW6Q7AHNGW3D2PBGOPNAC
VAVXKWZVOFJGWHCWYLTPDKSKKMSJEBKXNKXUW3T6IZAC3HE6HOIQC
6RYGW5H3J44O73WFXGFVTBW5N5UEQ4E732AJJUZNBVQLYDA5LGLAC
WR2WMEPEKNFAB4CAUBVFBACAJJSX2VX5B2VHKKSNTJSJBIIXFVZQC
ZM7NOBRMD5HHA35Y4JDC76EOA2RD4KQOQCPURXYKXA6ABMKOJIGQC
MZ3DMYPD4LSSQKEA3GNI5MK2QNTJ523DTNG6DUPWEWLH4FLUIQSAC
delete_pane_button = function(x)
local w = App.width('delete')+10
button(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 then
table.insert(Panes, new_pane())
end
if Current_pane_index > #Panes then
Current_pane_index = Current_pane_index-1
end
Current_pane = Panes[Current_pane_index]
end,
})
return x+w+10
end
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
clear_pane_button = function(x)
local w = App.width('clear')+10
button(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+10
end
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+10
end
duplicate_pane_button = function(x)
local w = App.width('dup')+10
button(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+1
table.insert(Panes, Current_pane_index, new_pane)
Current_pane = Panes[Current_pane_index]
end,
})
return x+w+10
end
code_editor_state = function()
local result = edit.initialize_state(
Menu_bottom + 20, -- top
Safe_height/2-Line_height, -- bottom
Menu_left + 50 + Line_number_padding, -- left
math.min(100+30*App.width('m'), Safe_width*2/3), -- right
love.graphics.getFont():getHeight(), Line_height)
Text.redraw_all(result)
return result
end
output_editor_state = function(editor_state)
local result = edit.initialize_state(
editor_state.bottom+5+10+5, -- top
nil, -- buttom
editor_state.left, editor_state.right,
love.graphics.getFont():getHeight(), Line_height)
Text.redraw_all(result)
return result
end
copy_editor = function(state)
local new_state = edit.initialize_state(
Menu_bottom + 20, -- top
Safe_height/2-Line_height, -- bottom
Menu_left + 50 + Line_number_padding, -- left
math.min(100+30*App.width('m'), Safe_width*2/3), -- right
love.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_state
end
paste_button = function(x)
local w = App.width('paste')+10
button(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+10
end
copy_button = function(x)
local w = App.width('copy')+10
button(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) end
end,
})
return x+w+10
end
hide_code_button = function(x)
local w = App.width('hide')+10
button(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 = false
end,
})
return x+w+10
end
show_code_button = function(x)
local w = App.width('show')+10
button(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 = true
end,
})
return x+w+10
end
Show_code = true
new_pane_button = function(x)
local w = App.width('new')+10
button(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+1
table.insert(Panes, Current_pane_index, new_pane())
Current_pane = Panes[Current_pane_index]
end,
})
return x+w+10
end
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+1
Current_pane = Panes[Current_pane_index]
end,
})
end
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-1
Current_pane = Panes[Current_pane_index]
end,
})
end
result.editor_state = edit.initialize_state(
Menu_bottom + 20, -- top
Safe_height/2-Line_height, -- bottom
Menu_left + 50 + Line_number_padding, -- left
math.min(100+30*App.width('m'), Safe_width*2/3), -- right
love.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, -- top
nil, -- buttom
result.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)
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)
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-1
Current_pane = Panes[Current_pane_index]
end,
})
previous_pane_button()
local r = Menu_left + Safe_width
if Current_pane_index == #Panes then
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.print('+', r-25, App.screen.height/2-10)
end,
onpress1 = function()
table.insert(Panes, new_pane())
Current_pane_index = Current_pane_index+1
Current_pane = Panes[Current_pane_index]
end,
})
else
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+1
Current_pane = Panes[Current_pane_index]
end,
})
if Current_pane_index < #Panes then
next_pane_button(Menu_left + Safe_width)
--if Canvas then return end
draw_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 then
draw_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