mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-01-22 03:39:09 +02:00
Updated rich text generation gui
This commit is contained in:
parent
23f1f976a4
commit
268959331e
@ -9,12 +9,17 @@ local rich_text_image_type = Gui.uid_name()
|
|||||||
local close_rich_text = Gui.uid_name()
|
local close_rich_text = Gui.uid_name()
|
||||||
|
|
||||||
local choices = {
|
local choices = {
|
||||||
'tile',
|
|
||||||
'item',
|
'item',
|
||||||
|
'tile',
|
||||||
'entity',
|
'entity',
|
||||||
'fluid',
|
|
||||||
'signal',
|
'signal',
|
||||||
'recipe'
|
'fluid',
|
||||||
|
'recipe',
|
||||||
|
'decorative',
|
||||||
|
'item-group',
|
||||||
|
'achievement',
|
||||||
|
'equipment',
|
||||||
|
'technology'
|
||||||
}
|
}
|
||||||
local function draw_rich_text(event)
|
local function draw_rich_text(event)
|
||||||
local spirte_type
|
local spirte_type
|
||||||
@ -42,7 +47,15 @@ local function draw_rich_text(event)
|
|||||||
selection_flow.style.top_margin = 7
|
selection_flow.style.top_margin = 7
|
||||||
|
|
||||||
local focus
|
local focus
|
||||||
|
local count = 0
|
||||||
for _, value in ipairs(choices) do
|
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 =
|
local radio =
|
||||||
selection_flow.add({type = 'flow'}).add {
|
selection_flow.add({type = 'flow'}).add {
|
||||||
type = 'radiobutton',
|
type = 'radiobutton',
|
||||||
@ -158,19 +171,29 @@ Gui.on_elem_changed(
|
|||||||
local sprite = choose.elem_value
|
local sprite = choose.elem_value
|
||||||
|
|
||||||
local path
|
local path
|
||||||
|
local text
|
||||||
if not sprite or sprite == '' then
|
if not sprite or sprite == '' then
|
||||||
path = 'Pick an image'
|
text = 'Pick an image'
|
||||||
elseif type == 'signal' then
|
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
|
else
|
||||||
path = type .. '/' .. choose.elem_value
|
path = type .. '/' .. sprite
|
||||||
|
end
|
||||||
|
|
||||||
|
if not text then
|
||||||
|
text = '[img=' .. path .. '] | ' .. path
|
||||||
end
|
end
|
||||||
|
|
||||||
local string_box = frame_data.string_box
|
local string_box = frame_data.string_box
|
||||||
Gui.remove_data_recursively(string_box)
|
Gui.remove_data_recursively(string_box)
|
||||||
string_box.destroy()
|
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.read_only = true
|
||||||
string_box.word_wrap = false
|
string_box.word_wrap = false
|
||||||
string_box.style.width = 352
|
string_box.style.width = 352
|
||||||
|
Loading…
x
Reference in New Issue
Block a user