specify highlight color via 'highlight' key in config in HTML notation

This commit is contained in:
Michael Specht 2018-02-15 12:20:22 +01:00
parent de423e7148
commit 95832e74cd
2 changed files with 20 additions and 13 deletions

View File

@ -73,6 +73,10 @@ class Champ
@config['load'].each_pair do |address, path|
@source_files << {:path => File.absolute_path(path), :address => address}
end
@highlight_color = '#fce98d'
if @config['highlight']
@highlight_color = @config['highlight']
end
@keywords = Set.new(KEYWORDS.split(/\s/).map { |x| x.strip }.reject { |x| x.empty? })
@global_variables = {}
@ -427,21 +431,27 @@ class Champ
end
end
end
if component_index == 0
print_s(pixels, width, height,
(canvas_left + canvas_width * 0.5 - component[:name].size * 3).to_i,
canvas_top + canvas_height + 18,
component[:name], 63)
else
print_s_r(pixels, width, height,
canvas_left - 22,
(canvas_top + canvas_height * 0.5 - component[:name].size * 3).to_i,
(0..1).each do |offset|
if component_index == 0
print_s(pixels, width, height,
(canvas_left + canvas_width * 0.5 - component[:name].size * 3 + offset).to_i,
canvas_top + canvas_height + 18,
component[:name], 63)
else
print_s_r(pixels, width, height,
canvas_left - 22,
(canvas_top + canvas_height * 0.5 - component[:name].size * 3 + offset).to_i,
component[:name], 63)
end
end
end
label = "#{watch[:path]}:#{watch[:line_number]}"
print_s(pixels, width, height, width - 6 * label.size - 3, height - 10, label, 63)
tr = @highlight_color[1, 2].to_i(16)
tg = @highlight_color[3, 2].to_i(16)
tb = @highlight_color[5, 2].to_i(16)
if pixels
gi, go, gt = Open3.popen2("./pgif #{width} #{height} 128")
palette = [''] * 128
@ -452,10 +462,6 @@ class Champ
b = 0xff
else
l = (((63 - i) + 1) << 2) - 1
# fce98d
tr = 0xfc
tg = 0xe9
tb = 0x8d
r = l * tr / 255
g = l * tg / 255
b = l * tb / 255

View File

@ -8,5 +8,6 @@ load:
0x9500: plot3d/FONT
0xb600: plot3d/projtab.s
entry: ENTRY
# highlight: '#c3def1'
instant_rts:
- LOAD1