diff --git a/features/gui/rich_text.lua b/features/gui/rich_text.lua index 7363d4aa..a4478425 100644 --- a/features/gui/rich_text.lua +++ b/features/gui/rich_text.lua @@ -9,12 +9,17 @@ local rich_text_image_type = Gui.uid_name() local close_rich_text = Gui.uid_name() local choices = { - 'tile', 'item', + 'tile', 'entity', - 'fluid', 'signal', - 'recipe' + 'fluid', + 'recipe', + 'decorative', + 'item-group', + 'achievement', + 'equipment', + 'technology' } local function draw_rich_text(event) local spirte_type @@ -42,7 +47,15 @@ local function draw_rich_text(event) selection_flow.style.top_margin = 7 local focus + local count = 0 for _, value in ipairs(choices) do + count = count + 1 + if count > 6 then + count = 0 + icons_flow = main_table.add {type = 'flow', direction = 'horizontal'} + selection_flow = icons_flow.add {type = 'flow'} + selection_flow.style.top_margin = 7 + end local radio = selection_flow.add({type = 'flow'}).add { type = 'radiobutton', @@ -158,19 +171,29 @@ Gui.on_elem_changed( local sprite = choose.elem_value local path + local text if not sprite or sprite == '' then - path = 'Pick an image' + text = 'Pick an image' elseif type == 'signal' then - path = 'virtual-signal/' .. choose.elem_value.name + local name = sprite.name + if string.sub(name, 1, 6) == 'signal' then + path = 'virtual-signal/' .. name + else + text = 'Pick a signal or another image type' + end else - path = type .. '/' .. choose.elem_value + path = type .. '/' .. sprite + end + + if not text then + text = '[img=' .. path .. '] | ' .. path end local string_box = frame_data.string_box Gui.remove_data_recursively(string_box) string_box.destroy() - string_box = frame_data.string_flow.add {type = 'text-box', text = ' [img=' .. path .. '] | ' .. path} + string_box = frame_data.string_flow.add {type = 'text-box', text = text} string_box.read_only = true string_box.word_wrap = false string_box.style.width = 352