Merge lines.love
This commit is contained in:
commit
2f57a5b2b1
5
edit.lua
5
edit.lua
|
@ -23,7 +23,7 @@ Same_point_distance = 4 -- pixel distance at which two points are considered th
|
|||
edit = {}
|
||||
|
||||
-- run in both tests and a real run
|
||||
function edit.initialize_state(top, left, right, font, line_height) -- currently always draws to bottom of screen
|
||||
function edit.initialize_state(top, left, right, font, font_height, line_height) -- currently always draws to bottom of screen
|
||||
local result = {
|
||||
-- a line is either text or a drawing
|
||||
-- a text is a table with:
|
||||
|
@ -86,7 +86,7 @@ function edit.initialize_state(top, left, right, font, line_height) -- currentl
|
|||
previous_drawing_mode = nil, -- extra state for some ephemeral modes like moving/deleting/naming points
|
||||
|
||||
font = font,
|
||||
font_height = font:getHeight(),
|
||||
font_height = font_height,
|
||||
line_height = line_height,
|
||||
|
||||
top = top,
|
||||
|
@ -570,6 +570,7 @@ function edit.initialize_test_state()
|
|||
Test_margin_left,
|
||||
App.screen.width - Test_margin_right,
|
||||
love.graphics.getFont(),
|
||||
14,
|
||||
15) -- line height
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- functions to render them into the log_render namespace.
|
||||
|
||||
function source.initialize_log_browser_side()
|
||||
Log_browser_state = edit.initialize_state(Margin_top, Editor_state.right + Margin_right + Margin_left, (Editor_state.right+Margin_right)*2, Editor_state.font, Editor_state.line_height)
|
||||
Log_browser_state = edit.initialize_state(Margin_top, Editor_state.right + Margin_right + Margin_left, (Editor_state.right+Margin_right)*2, Editor_state.font, Editor_state.font_height, Editor_state.line_height)
|
||||
Log_browser_state.filename = 'log'
|
||||
load_from_disk(Log_browser_state) -- TODO: pay no attention to Fold
|
||||
log_browser.parse(Log_browser_state)
|
||||
|
|
|
@ -190,8 +190,8 @@ There's much more I could include here; check out [the LÖVE manual](https://lov
|
|||
The text-editor widget includes extremely thorough automated tests to give you
|
||||
early warning if you break something.
|
||||
|
||||
* `state = edit.initialize_state(top, left, right, font, line_height)` --
|
||||
returns an object that can be used to render an interactive editor widget
|
||||
* `state = edit.initialize_state(top, left, right, font, font_height, line_height)`
|
||||
-- returns an object that can be used to render an interactive editor widget
|
||||
for text and line drawings starting at `y=top` on the app window, between
|
||||
`x=left` and `x=right`. Wraps long lines at word boundaries where possible,
|
||||
or in the middle of words (no hyphenation yet) when it must.
|
||||
|
|
4
run.lua
4
run.lua
|
@ -61,7 +61,7 @@ function run.load_settings()
|
|||
App.screen.width, App.screen.height = Settings.width, Settings.height
|
||||
App.screen.resize(App.screen.width, App.screen.height, App.screen.flags)
|
||||
run.set_window_position_from_settings(Settings)
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, font, math.floor(Settings.font_height*1.3))
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, font, Settings.font_height, math.floor(Settings.font_height*1.3))
|
||||
Editor_state.filename = Settings.filename
|
||||
Editor_state.screen_top1 = Settings.screen_top
|
||||
Editor_state.cursor1 = Settings.cursor
|
||||
|
@ -81,7 +81,7 @@ function run.initialize_default_settings()
|
|||
local font_height = 20
|
||||
local font = love.graphics.newFont(font_height)
|
||||
run.initialize_window_geometry()
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, font, math.floor(font_height*1.3))
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, font, font_height, math.floor(font_height*1.3))
|
||||
Settings = run.settings()
|
||||
end
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ function source.load_settings()
|
|||
if Show_log_browser_side then
|
||||
right = App.screen.width/2 - Margin_right
|
||||
end
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left + Line_number_width*App.width('m'), right, font, math.floor(settings.font_height*1.3))
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left + Line_number_width*App.width('m'), right, font, font_height, math.floor(settings.font_height*1.3))
|
||||
Editor_state.filename = settings.filename
|
||||
Editor_state.filename = basename(Editor_state.filename) -- migrate settings that used full paths; we now support only relative paths within the app
|
||||
if settings.cursors then
|
||||
|
@ -154,7 +154,7 @@ function source.initialize_default_settings()
|
|||
local font_height = 20
|
||||
local font = love.graphics.newFont(font_height)
|
||||
source.initialize_window_geometry()
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left + Line_number_width*App.width('m'), App.screen.width-Margin_right, font, math.floor(font_height*1.3))
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left + Line_number_width*App.width('m'), App.screen.width-Margin_right, font, font_height, math.floor(font_height*1.3))
|
||||
Editor_state.filename = 'run.lua'
|
||||
end
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ Same_point_distance = 4 -- pixel distance at which two points are considered th
|
|||
edit = {}
|
||||
|
||||
-- run in both tests and a real run
|
||||
function edit.initialize_state(top, left, right, font, line_height) -- currently always draws to bottom of screen
|
||||
function edit.initialize_state(top, left, right, font, font_height, line_height) -- currently always draws to bottom of screen
|
||||
local result = {
|
||||
-- a line is either text or a drawing
|
||||
-- a text is a table with:
|
||||
|
@ -572,6 +572,7 @@ function edit.initialize_test_state()
|
|||
Test_margin_left,
|
||||
App.screen.width - Test_margin_right,
|
||||
love.graphics.getFont(),
|
||||
14,
|
||||
15) -- line height
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue