mirror of
https://github.com/specht/champ.git
synced 2025-01-02 13:30:40 +00:00
specify highlight color via 'highlight' key in config in HTML notation
This commit is contained in:
parent
de423e7148
commit
95832e74cd
32
champ.rb
32
champ.rb
@ -73,6 +73,10 @@ class Champ
|
|||||||
@config['load'].each_pair do |address, path|
|
@config['load'].each_pair do |address, path|
|
||||||
@source_files << {:path => File.absolute_path(path), :address => address}
|
@source_files << {:path => File.absolute_path(path), :address => address}
|
||||||
end
|
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? })
|
@keywords = Set.new(KEYWORDS.split(/\s/).map { |x| x.strip }.reject { |x| x.empty? })
|
||||||
@global_variables = {}
|
@global_variables = {}
|
||||||
@ -427,21 +431,27 @@ class Champ
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if component_index == 0
|
(0..1).each do |offset|
|
||||||
print_s(pixels, width, height,
|
if component_index == 0
|
||||||
(canvas_left + canvas_width * 0.5 - component[:name].size * 3).to_i,
|
print_s(pixels, width, height,
|
||||||
canvas_top + canvas_height + 18,
|
(canvas_left + canvas_width * 0.5 - component[:name].size * 3 + offset).to_i,
|
||||||
component[:name], 63)
|
canvas_top + canvas_height + 18,
|
||||||
else
|
|
||||||
print_s_r(pixels, width, height,
|
|
||||||
canvas_left - 22,
|
|
||||||
(canvas_top + canvas_height * 0.5 - component[:name].size * 3).to_i,
|
|
||||||
component[:name], 63)
|
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
|
||||||
end
|
end
|
||||||
label = "#{watch[:path]}:#{watch[:line_number]}"
|
label = "#{watch[:path]}:#{watch[:line_number]}"
|
||||||
print_s(pixels, width, height, width - 6 * label.size - 3, height - 10, label, 63)
|
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
|
if pixels
|
||||||
gi, go, gt = Open3.popen2("./pgif #{width} #{height} 128")
|
gi, go, gt = Open3.popen2("./pgif #{width} #{height} 128")
|
||||||
palette = [''] * 128
|
palette = [''] * 128
|
||||||
@ -452,10 +462,6 @@ class Champ
|
|||||||
b = 0xff
|
b = 0xff
|
||||||
else
|
else
|
||||||
l = (((63 - i) + 1) << 2) - 1
|
l = (((63 - i) + 1) << 2) - 1
|
||||||
# fce98d
|
|
||||||
tr = 0xfc
|
|
||||||
tg = 0xe9
|
|
||||||
tb = 0x8d
|
|
||||||
r = l * tr / 255
|
r = l * tr / 255
|
||||||
g = l * tg / 255
|
g = l * tg / 255
|
||||||
b = l * tb / 255
|
b = l * tb / 255
|
||||||
|
@ -8,5 +8,6 @@ load:
|
|||||||
0x9500: plot3d/FONT
|
0x9500: plot3d/FONT
|
||||||
0xb600: plot3d/projtab.s
|
0xb600: plot3d/projtab.s
|
||||||
entry: ENTRY
|
entry: ENTRY
|
||||||
|
# highlight: '#c3def1'
|
||||||
instant_rts:
|
instant_rts:
|
||||||
- LOAD1
|
- LOAD1
|
||||||
|
Loading…
Reference in New Issue
Block a user