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TB7TEFJRL7P6PQWO5ZG3F2BVA7DIDFHBPJQ7KAC
T77LAUSGBIU6OIYGUO2L3CF435D5GS2U6AHA25L3DVOIMKIVCG6QC
7LQMQIZ6BU35DDK4NKT3TP52VPSNUIIZERR5ZKK42HYR4J7X5C4AC
F4LHH2ZI56NF2YUFLTQKSUN55XRL32L2RJTLFNO56EMWMO6YAHZQC
TBWAE64A6IIDDXKB6LXDI6WQYAAUYP2QRH3KLM3PUILMVL2BFTTAC
T7QIIGQ6YYTTYCVHVEAZSUQ3O4LYBHGPFL4K6D5TA4BA7PND4EJQC
QJAYOFWY7V4BWVLJMEDCCBC2HX4BDAZI6PQVLWCLYRHWGMOBFTVAC
JIBCE66ZTWM5WEHEHNKKTRWBJQSQWBDDWPMOJIJR5Q676OSHYCNAC
K6ZDYZKXSLTLCCHWYK6K6WOCNXBZOXEDKDVNNJVCZUFOLLSUO5UAC
TBPJ5WSRM5IKQH7FTAVYTWWUBWW7G2CLT5M6FN7CMPLD6Y77YIWQC
7KX3WBFEXMIHNKWNF4NUOBW5HO3PEL3ZEFFMTAXFOQG6V7BYXZ3AC
KV64IWA3DKR4FL6E4BIG5SFCRQJ3DZFEJOUELCD5TC7DDVJQ6SWAC
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
-- print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
-- print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-40, vy+2)
end
love.graphics.setFont(old_font)
end
draw_test_failure_indicator = function()
if Client_app_test_failures == nil then
return
end
if next(Client_app_test_failures, nil) == nil then
return
end
App.color(Failing_test_definition_background_color)
local border_width = App.screen.width/40, App.screen.height
love.graphics.rectangle('fill', 0,0, border_width,App.screen.height)
love.graphics.rectangle('fill', App.screen.width-border_width, 0, border_width, App.screen.height)
love.graphics.rectangle('fill', 0,App.screen.height-border_width, App.screen.width, border_width)
end
draw_load_time_error = function(obj)
if not obj.editor.load_time_error then return end
love.graphics.setColor(0.8,0,0)
local error_y = math.min(vy(obj.y+obj.h), App.screen.height-20*5*Viewport.zoom)
error_y = math.max(error_y, vy(obj.y))
love.graphics.rectangle('fill', vx(obj.x), error_y, scale(obj.w), scale(5*20*Viewport.zoom))
love.graphics.setColor(0,0,0)
love.graphics.print(obj.editor.load_time_error, vx(obj.x), error_y)
end
draw_run_time_error = function()
if Run_time_error == nil then return end
local height = math.min(20*HUD_line_height, App.screen.height*0.2)
App.color{r=0.8,g=0,b=0}
love.graphics.rectangle('fill', 0, App.screen.height - height-10, App.screen.width, height+10)
App.color{r=0,g=0,b=0}
love.graphics.print(Run_time_error, 30, App.screen.height - height)
end
Border_color = {r=0.5, g=0.5, b=0.5}
end
if Settings[App_name] == nil then
Settings[App_name] = {}
Settings[App_name].viewport = Viewport
Settings[App_name].definitions = get_default_map()
end
Viewport = Settings[App_name].viewport
Definitions = Settings[App_name].definitions
local names = {}
for name, _ in pairs(Definitions) do
table.insert(names, name)
local defs = get_multiple_definitions_from_app(names)
for name, def_editor in pairs(Definitions) do
if def_editor.type == nil then
def_editor.type = 'text'
end
if def_editor.bg == nil then
def_editor.bg = definition_background_color(name)
end
if def_editor.width == nil then
def_editor.width = 600
end
if defs[name] then
def_editor.data = load_from_iterator(defs[name]:gmatch("[^\r\n]+"))
else
-- app doesn't know about this definition
-- just delete it from the driver for now
print('deleting', name)
Definitions[name] = nil
end
end
end
end
end
for key,node in pairs(Definitions) do
if type(key) == 'number' then
-- can't save the array side for now because of a limitation in the
Definitions[key] = nil
else
node.data = nil -- don't save uncommitted data for now
node.show_cursor = nil
node.editor = nil -- TODO: check for hierarchy
end