WC: Convert invest dialog to WML

This commit is contained in:
Celtic Minstrel 2021-03-31 01:27:06 -04:00
parent ea2d74580f
commit a51271670c
4 changed files with 340 additions and 344 deletions

View file

@ -0,0 +1,337 @@
#textdomain wesnoth-wc
# Since this file is loaded standalone, we need to manually include these
{gui/macros}
[resolution]
maximum_width = 1200
maximum_height = 700
[helptip]
id = "tooltip_large"
[/helptip]
[tooltip]
id = "tooltip_large"
[/tooltip]
[linked_group]
id = "list_image"
fixed_width = true
[/linked_group]
[linked_group]
id = "unit_panel"
fixed_width = true
[/linked_group]
[grid]
[row]
grow_factor = 1
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
definition = "title"
label = _"Invest"
id = "title"
[/label]
[/column]
[/row]
[row]
grow_factor = 1
[column]
horizontal_grow = true
vertical_grow = true
[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_grow = true
vertical_grow = true
[tree_view]
id = "left_tree"
definition = "default"
horizontal_scrollbar_mode = "never"
vertical_scrollbar_mode = "initial_auto"
indentation_step_size = 30
[node]
id = "category"
[node_definition]
[row]
[column]
grow_factor = 0
horizontal_alignment = "left"
border = "top,bottom"
border_size = 5
[toggle_button]
id = "tree_view_node_toggle"
definition = "tree_view_node"
[/toggle_button]
[/column]
[column]
grow_factor = 1
horizontal_grow = true
border = "all"
border_size = 5
[grid]
[row]
[column]
horizontal_alignment = "left"
[label]
definition = "gold"
id = "category_name"
[/label]
[/column]
[/row]
[/grid]
[/column]
[/row]
[/node_definition]
[/node]
[node]
id = "item_desc"
[node_definition]
[row]
[column]
grow_factor = 1
horizontal_grow = true
[toggle_panel]
id = "tree_view_node_label"
[grid]
[row]
[column]
grow_factor = 0
horizontal_alignment = "left"
[image]
id = "image"
linked_group = "list_image"
[/image]
[/column]
[column]
horizontal_grow = true
grow_factor = 1
[grid]
[row]
[column]
grow_factor = 1
horizontal_alignment = "left"
[label]
id = "name"
[/label]
[/column]
[/row]
[row]
[column]
grow_factor = 1
horizontal_alignment = "left"
[label]
use_markup = true
id = "desc"
[/label]
[/column]
[/row]
[/grid]
[/column]
[/row]
[/grid]
[/toggle_panel]
[/column]
[/row]
[/node_definition]
[/node]
[node]
id = "item"
[node_definition]
[row]
[column]
grow_factor = 1
horizontal_grow = true
[toggle_panel]
id = "tree_view_node_label"
[grid]
[row]
[column]
grow_factor = 0
[image]
id = "image"
linked_group = "list_image"
[/image]
[/column]
[column]
horizontal_alignment = "left"
grow_factor = 1
[grid]
[row]
[column]
horizontal_alignment = "left"
[label]
id = "name"
use_markup = true
[/label]
[/column]
[/row]
[/grid]
[/column]
[/row]
[/grid]
[/toggle_panel]
[/column]
[/row]
[/node_definition]
[/node]
[/tree_view]
[/column]
[column]
vertical_grow = true
[grid]
[row]
[column]
vertical_grow = true
border = "all"
border_size = 5
[multi_page]
id = "details"
definition = "default"
horizontal_scrollbar_mode = "never"
vertical_grow = true
[page_definition]
[row]
[column]
horizontal_grow = true
vertical_grow = true
[scroll_label]
id = "info_label"
label = "Text"
use_markup = true
[/scroll_label]
[/column]
[/row]
[/page_definition]
[page_definition]
id = "hero"
[row]
[column]
vertical_grow = true
[unit_preview_pane]
definition = "default"
id = "unit_info"
linked_group = "unit_panel"
[/unit_preview_pane]
[/column]
[/row]
[/page_definition]
[page_definition]
id = "trailing"
#ifdef COMMENTED_OUT
[row]
[column]
[size_lock]
width = 600
height = 900
[widget]
[grid]
#endif
#ifdef COMMENTED_OUT
[row]
[column]
horizontal_grow = true
vertical_grow = true
[label]
label = "Before:"
[/label]
[/column]
[/row]
[row]
[column]
horizontal_grow = true
vertical_grow = true
[scroll_label]
id = "training_before"
use_markup = true
[/scroll_label]
[/column]
[/row]
[row]
[column]
horizontal_grow = true
vertical_grow = true
[label]
label = "After:"
[/label]
[/column]
[/row]
[row]
[column]
horizontal_grow = true
vertical_grow = true
[scroll_label]
id = "training_after"
use_markup = true
[/scroll_label]
[/column]
[/row]
#endif
[row]
[column]
horizontal_grow = true
vertical_grow = true
[scroll_label]
id = "details"
use_markup = true
[/scroll_label]
[/column]
[/row]
#ifdef COMMENTED_OUT
[/grid]
[/widget]
[/size_lock]
[/column]
[/row]
#endif
[/page_definition]
[/multi_page]
[/column]
[/row]
[row]
[column]
horizontal_alignment = "center"
border = "all"
border_size = 5
[button]
definition = "really_large"
label = "Get This Item"
id = "ok"
[/button]
[/column]
[/row]
[/grid]
[/column]
[/row]
[/grid]
[/column]
[/row]
#ifdef COMMENTED_OUT
[row]
[column]
horizontal_grow = true
[grid]
[row]
[column]
grow_factor = 1
[spacer]
[/spacer]
[/column]
[column]
horizontal_alignment = "right"
[button]
label = "Ok"
id = "ok"
[/button]
[/column]
[/row]
[/grid]
[/column]
[/row]
#endif
[/grid]
[/resolution]

View file

@ -22,7 +22,6 @@ wc2_wiki_dialog = wesnoth.require("./wocopedia/help_dialog.lua")
wc2_wiki = wesnoth.require("./wocopedia/help.lua")
wc2_invest = wesnoth.require("./invest/invest.lua")
wc2_invest_dialog = wesnoth.require("./invest/invest_dialog.lua")
wc2_invest_show_dialog = wesnoth.require("./invest/invest_show_dialog.lua")
wc2_invest_tellunit = wesnoth.require("./invest/invest_tellunit.lua")

View file

@ -1,340 +0,0 @@
local _ = wesnoth.textdomain 'wesnoth-wc'
local T = wml.tag
local function GUI_FORCE_WIDGET_MINIMUM_SIZE(w,h, content)
return T.stacked_widget {
definition = "default",
T.stack {
T.layer {
T.row {
T.column {
T.spacer {
definition = "default",
width = w,
height = h
}
}
}
},
T.layer {
T.row {
grow_factor = 1,
T.column {
grow_factor = 1,
horizontal_grow = "true",
vertical_grow = "true",
content
}
}
}
}
}
end
local dialog_wml = {
maximum_width = 1200,
maximum_height = 700,
T.helptip { id = "tooltip_large" }, -- mandatory field
T.tooltip { id = "tooltip_large" }, -- mandatory field
T.linked_group { id = "list_image", fixed_width = true },
T.linked_group { id = "unit_panel", fixed_width = true },
T.grid {
T.row {
grow_factor = 1,
T.column {
border = "all",
border_size = 5,
horizontal_alignment = "left",
T.label {
definition = "title",
label = _"Invest",
id = "title"
}
}
},
T.row {
grow_factor = 1,
T.column {
horizontal_grow = true,
vertical_grow = true,
T.grid {
T.row {
T.column {
border = "all",
border_size = 5,
horizontal_grow = true,
vertical_grow = true,
T.tree_view {
id = "left_tree",
definition = "default",
horizontal_scrollbar_mode = "never",
vertical_scrollbar_mode = "initial_auto",
indentation_step_size = 30,
T.node {
id = "category",
T.node_definition {
T.row {
T.column {
grow_factor = 0,
horizontal_alignment = "left",
border = "top,bottom",
border_size = 5,
T.toggle_button {
id = "tree_view_node_toggle",
definition = "tree_view_node",
},
},
T.column {
grow_factor = 1,
horizontal_grow = true,
border = "all",
border_size = 5,
T.grid {
T.row {
T.column {
horizontal_alignment = "left",
T.label {
definition = "gold",
id = "category_name",
},
},
},
},
},
},
},
},
T.node {
id = "item_desc",
T.node_definition {
T.row {
T.column {
grow_factor = 1,
horizontal_grow = true,
T.toggle_panel {
id = "tree_view_node_label",
T.grid {
T.row {
T.column {
grow_factor = 0,
horizontal_alignment = "left",
T.image {
id = "image",
linked_group = "list_image",
},
},
T.column {
horizontal_grow = true,
grow_factor = 1,
T.grid {
T.row {
T.column {
grow_factor = 1,
horizontal_alignment = "left",
T.label {
id = "name",
},
},
},
T.row {
T.column {
grow_factor = 1,
horizontal_alignment = "left",
T.label {
use_markup = true,
id = "desc",
},
},
},
},
},
},
},
},
},
},
},
},
T.node {
id = "item",
T.node_definition {
T.row {
T.column {
grow_factor = 1,
horizontal_grow = true,
T.toggle_panel {
id = "tree_view_node_label",
T.grid {
T.row {
T.column {
grow_factor = 0,
T.image {
id = "image",
linked_group = "list_image",
},
},
T.column {
horizontal_alignment = "left",
grow_factor = 1,
T.grid {
T.row {
T.column {
horizontal_alignment = "left",
T.label {
id = "name",
use_markup = true,
},
},
},
},
},
},
},
},
},
},
},
},
},
},
T.column { vertical_grow = true, T.grid { T.row {
T.column {
vertical_grow = true,
border = "all",
border_size = 5,
T.multi_page {
id = "details",
definition = "default",
horizontal_scrollbar_mode = "never",
vertical_grow = true,
T.page_definition {
T.row {
T.column {
horizontal_grow = true,
vertical_grow = true,
T.scroll_label {
id = "info_label",
label = "Text",
use_markup = true,
},
},
},
},
T.page_definition {
id = "hero",
T.row {
T.column {
vertical_grow = true,
T.unit_preview_pane {
definition = "default",
id = "unit_info",
linked_group = "unit_panel",
} ,
},
},
},
T.page_definition {
id = "trailing",
--T.row { T.column { T.size_lock { width = 600, height = 900, T.widget { T.grid {
--[[
T.row {
T.column {
horizontal_grow = true,
vertical_grow = true,
T.label {
label = "Before:",
},
},
},
T.row {
T.column {
horizontal_grow = true,
vertical_grow = true,
T.scroll_label {
id = "training_before",
use_markup = true,
},
},
},
T.row {
T.column {
horizontal_grow = true,
vertical_grow = true,
T.label {
label = "After:",
},
},
},
T.row {
T.column {
horizontal_grow = true,
vertical_grow = true,
T.scroll_label {
id = "training_after",
use_markup = true,
},
},
},
--]]
T.row {
T.column {
horizontal_grow = true,
vertical_grow = true,
T.scroll_label {
id = "details",
use_markup = true,
},
},
},
--},},},},},
},
},
},
},
T.row {
T.column {
horizontal_alignment = "center",
border = "all",
border_size = 5,
T.button {
definition = "really_large",
label = "Get This Item",
id = "ok",
}
}
}
},},
},
},
},
},
--[[
T.row {
T.column {
horizontal_grow = true,
T.grid {
T.row {
T.column {
grow_factor = 1,
T.spacer {
}
},
T.column {
horizontal_alignment = "right",
T.button {
label = "Ok",
id = "ok",
}
}
}
}
}
}
--]]
}
}
return dialog_wml

View file

@ -1,7 +1,6 @@
local _ = wesnoth.textdomain 'wesnoth-wc'
local dialog_wml = wc2_invest_dialog
local dialog_wml = wml.load "campaigns/World_Conquest/gui/invest_dialog.cfg"
function wc2_show_invest_dialog_impl(args)
local side_num = wesnoth.current.side
@ -166,7 +165,8 @@ function wc2_show_invest_dialog_impl(args)
root_node.on_modified = set_result
set_result()
end
local d_res = gui.show_dialog(dialog_wml, preshow)
local d_wml = wml.get_child(dialog_wml, 'resolution')
local d_res = gui.show_dialog(d_wml, preshow)
return d_res, res
end