always show line numbers in source editor
The drawing buttons are now absolutely positioned, which is a horrible hack. But for just the source editor it seems good enough. The alternative is to modify magic constants in all the tests :/
This commit is contained in:
parent
7062963888
commit
1fd30c0462
|
@ -1,6 +1,7 @@
|
|||
source = {}
|
||||
|
||||
Editor_state = {}
|
||||
Line_number_width = 3 -- in ems
|
||||
|
||||
-- called both in tests and real run
|
||||
function source.initialize_globals()
|
||||
|
@ -125,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, right, settings.font_height, math.floor(settings.font_height*1.3))
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left + Line_number_width*App.width('m'), right, settings.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
|
||||
|
@ -153,7 +154,7 @@ function source.initialize_default_settings()
|
|||
local font_height = 20
|
||||
love.graphics.setFont(love.graphics.newFont(font_height))
|
||||
source.initialize_window_geometry()
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right)
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left + Line_number_width*App.width('m'), App.screen.width-Margin_right)
|
||||
Editor_state.filename = 'run.lua'
|
||||
Editor_state.font_height = font_height
|
||||
Editor_state.line_height = math.floor(font_height*1.3)
|
||||
|
|
|
@ -7,6 +7,7 @@ Current_stroke_color = {r=0.7, g=0.7, b=0.7} -- in process of being drawn
|
|||
Current_name_background_color = {r=1, g=0, b=0, a=0.1} -- name currently being edited
|
||||
Focus_stroke_color = {r=1, g=0, b=0} -- what mouse is hovering over
|
||||
Highlight_color = {r=0.7, g=0.7, b=0.9} -- selected text
|
||||
Line_number_color = {r=0.6, g=0.6, b=0.6}
|
||||
Icon_color = {r=0.7, g=0.7, b=0.7} -- color of current mode icon in drawings
|
||||
Help_color = {r=0, g=0.5, b=0}
|
||||
Help_background_color = {r=0, g=0.5, b=0, a=0.1}
|
||||
|
@ -168,7 +169,7 @@ function edit.draw(State, hide_cursor)
|
|||
end
|
||||
if line.data == '' then
|
||||
-- button to insert new drawing
|
||||
button(State, 'draw', {x=State.left-Margin_left+4, y=y+4, w=12,h=12, color={1,1,0},
|
||||
button(State, 'draw', {x=4, y=y+4, w=12,h=12, color={1,1,0},
|
||||
icon = icon.insert_drawing,
|
||||
onpress1 = function()
|
||||
Drawing.before = snapshot(State, line_index-1, line_index)
|
||||
|
|
|
@ -12,6 +12,8 @@ function Text.draw(State, line_index, y, startpos, hide_cursor)
|
|||
local final_screen_line_starting_pos = startpos -- track value to return
|
||||
Text.populate_screen_line_starting_pos(State, line_index)
|
||||
Text.populate_link_offsets(State, line_index)
|
||||
App.color(Line_number_color)
|
||||
love.graphics.print(line_index, State.left-Line_number_width*App.width('m')+10,y)
|
||||
initialize_color()
|
||||
assert(#line_cache.screen_line_starting_pos >= 1)
|
||||
for i=1,#line_cache.screen_line_starting_pos do
|
||||
|
|
Loading…
Reference in New Issue