1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

GUIFormSpecMenu focus fixes

This commit is contained in:
Kahrl 2013-08-19 11:26:51 +02:00
parent 72b9b0fe3a
commit 8548bb75b6
6 changed files with 232 additions and 66 deletions

View file

@ -329,6 +329,8 @@ function modmgr.render_modlist(render_list)
if retval ~= "" then
retval = retval ..","
end
local color = ""
if v.is_modpack then
local rawlist = filterlist.get_raw_list(render_list)
@ -343,19 +345,21 @@ function modmgr.render_modlist(render_list)
end
if all_enabled == false then
retval = retval .. mt_color_grey
color = mt_color_grey
else
retval = retval .. mt_color_dark_green
color = mt_color_dark_green
end
end
if v.typ == "game_mod" then
retval = retval .. mt_color_blue
color = mt_color_blue
else
if v.enabled then
retval = retval .. mt_color_green
color = mt_color_green
end
end
retval = retval .. color
if v.modpack ~= nil then
retval = retval .. " "
end
@ -401,7 +405,7 @@ function modmgr.dialog_configure_world()
"button[9.25,6.35;2,0.5;btn_config_world_save;" .. fgettext("Save") .. "]" ..
"button[7.4,6.35;2,0.5;btn_config_world_cancel;" .. fgettext("Cancel") .. "]"
if mod ~= nil and mod.name ~= "" then
if mod ~= nil and mod.name ~= "" and mod.typ ~= "game_mod" then
if mod.is_modpack then
local rawlist = filterlist.get_raw_list(modmgr.modlist)
@ -662,57 +666,23 @@ function modmgr.handle_configure_world_buttons(fields)
modmgr.world_config_selected_mod = event.index
if event.typ == "DCL" then
local mod = filterlist.get_list(modmgr.modlist)[event.index]
if mod.typ == "game_mod" then
return nil
end
if not mod.is_modpack then
mod.enabled = not mod.enabled
else
local list = filterlist.get_raw_list(modmgr.modlist)
local toset = nil
for i=1,#list,1 do
if list[i].modpack == mod.name then
if toset == nil then
toset = not list[i].enabled
end
list[i].enabled = toset
end
end
end
modmgr.world_config_enable_mod(nil)
end
end
if fields["key_enter"] ~= nil then
modmgr.world_config_enable_mod(nil)
end
if fields["cb_mod_enable"] ~= nil then
local mod = filterlist.get_list(modmgr.modlist)
[engine.get_textlist_index("world_config_modlist")]
if fields["cb_mod_enable"] == "true" then
mod.enabled = true
else
mod.enabled = false
end
local toset = (fields["cb_mod_enable"] == "true")
modmgr.world_config_enable_mod(toset)
end
if fields["btn_mp_enable"] ~= nil or
fields["btn_mp_disable"] then
local mod = filterlist.get_list(modmgr.modlist)
[engine.get_textlist_index("world_config_modlist")]
local toset=false
if fields["btn_mp_enable"] ~= nil then
toset = true
end
local list = filterlist.get_raw_list(modmgr.modlist)
for i=1,#list,1 do
if list[i].modpack == mod.name then
list[i].enabled = toset
end
end
local toset = (fields["btn_mp_enable"] ~= nil)
modmgr.world_config_enable_mod(toset)
end
if fields["cb_hide_gamemods"] ~= nil then
@ -818,6 +788,31 @@ function modmgr.handle_configure_world_buttons(fields)
return nil
end
--------------------------------------------------------------------------------
function modmgr.world_config_enable_mod(toset)
local mod = filterlist.get_list(modmgr.modlist)
[engine.get_textlist_index("world_config_modlist")]
if mod.typ == "game_mod" then
-- game mods can't be enabled or disabled
elseif not mod.is_modpack then
if toset == nil then
mod.enabled = not mod.enabled
else
mod.enabled = toset
end
else
local list = filterlist.get_raw_list(modmgr.modlist)
for i=1,#list,1 do
if list[i].modpack == mod.name then
if toset == nil then
toset = not list[i].enabled
end
list[i].enabled = toset
end
end
end
end
--------------------------------------------------------------------------------
function modmgr.handle_delete_mod_buttons(fields)
local mod = filterlist.get_list(modmgr.global_mods)[modmgr.selected_mod]