From 30083d1e0070d0f86337a57ea36b6bba7fd52572 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sun, 24 Apr 2016 15:44:10 +0200 Subject: [PATCH] Mainmenu: Standardize the menu button order and sizes --- builtin/mainmenu/dlg_config_world.lua | 38 ++++++++++++------------- builtin/mainmenu/dlg_create_world.lua | 6 ++-- builtin/mainmenu/dlg_delete_mod.lua | 9 +++--- builtin/mainmenu/dlg_delete_world.lua | 8 +++--- builtin/mainmenu/dlg_rename_modpack.lua | 12 ++++---- src/guiKeyChangeMenu.cpp | 4 +-- 6 files changed, 38 insertions(+), 39 deletions(-) diff --git a/builtin/mainmenu/dlg_config_world.lua b/builtin/mainmenu/dlg_config_world.lua index 4d13faea8..eb0319ba0 100644 --- a/builtin/mainmenu/dlg_config_world.lua +++ b/builtin/mainmenu/dlg_config_world.lua @@ -25,20 +25,20 @@ local function get_formspec(data) local mod = data.list:get_list()[data.selected_mod] local retval = - "size[11,6.5,true]" .. - "label[0.5,-0.25;" .. fgettext("World:") .. "]" .. - "label[1.75,-0.25;" .. data.worldspec.name .. "]" + "size[11.5,7.5,true]" .. + "label[0.5,0;" .. fgettext("World:") .. "]" .. + "label[1.75,0;" .. data.worldspec.name .. "]" if data.hide_gamemods then - retval = retval .. "checkbox[0,5.75;cb_hide_gamemods;" .. fgettext("Hide Game") .. ";true]" + retval = retval .. "checkbox[1,6;cb_hide_gamemods;" .. fgettext("Hide Game") .. ";true]" else - retval = retval .. "checkbox[0,5.75;cb_hide_gamemods;" .. fgettext("Hide Game") .. ";false]" + retval = retval .. "checkbox[1,6;cb_hide_gamemods;" .. fgettext("Hide Game") .. ";false]" end if data.hide_modpackcontents then - retval = retval .. "checkbox[2,5.75;cb_hide_mpcontent;" .. fgettext("Hide mp content") .. ";true]" + retval = retval .. "checkbox[6,6;cb_hide_mpcontent;" .. fgettext("Hide mp content") .. ";true]" else - retval = retval .. "checkbox[2,5.75;cb_hide_mpcontent;" .. fgettext("Hide mp content") .. ";false]" + retval = retval .. "checkbox[6,6;cb_hide_mpcontent;" .. fgettext("Hide mp content") .. ";false]" end if mod == nil then @@ -46,13 +46,13 @@ local function get_formspec(data) end retval = retval .. - "label[0,0.45;" .. fgettext("Mod:") .. "]" .. - "label[0.75,0.45;" .. mod.name .. "]" .. - "label[0,1;" .. fgettext("Depends:") .. "]" .. - "textlist[0,1.5;5,4.25;world_config_depends;" .. + "label[0,0.7;" .. fgettext("Mod:") .. "]" .. + "label[0.75,0.7;" .. mod.name .. "]" .. + "label[0,1.25;" .. fgettext("Depends:") .. "]" .. + "textlist[0,1.75;5,4.25;world_config_depends;" .. modmgr.get_dependencies(mod.path) .. ";0]" .. - "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") .. "]" + "button[3.25,7;2.5,0.5;btn_config_world_save;" .. fgettext("Save") .. "]" .. + "button[5.75,7;2.5,0.5;btn_config_world_cancel;" .. fgettext("Cancel") .. "]" if mod ~= nil and mod.name ~= "" and mod.typ ~= "game_mod" then if mod.is_modpack then @@ -68,22 +68,22 @@ local function get_formspec(data) end if all_enabled == false then - retval = retval .. "button[5.5,-0.125;2,0.5;btn_mp_enable;" .. fgettext("Enable MP") .. "]" + retval = retval .. "button[5.5,0.125;2.5,0.5;btn_mp_enable;" .. fgettext("Enable MP") .. "]" else - retval = retval .. "button[5.5,-0.125;2,0.5;btn_mp_disable;" .. fgettext("Disable MP") .. "]" + retval = retval .. "button[5.5,0.125;2.5,0.5;btn_mp_disable;" .. fgettext("Disable MP") .. "]" end else if mod.enabled then - retval = retval .. "checkbox[5.5,-0.375;cb_mod_enable;" .. fgettext("enabled") .. ";true]" + retval = retval .. "checkbox[5.5,-0.125;cb_mod_enable;" .. fgettext("enabled") .. ";true]" else - retval = retval .. "checkbox[5.5,-0.375;cb_mod_enable;" .. fgettext("enabled") .. ";false]" + retval = retval .. "checkbox[5.5,-0.125;cb_mod_enable;" .. fgettext("enabled") .. ";false]" end end end retval = retval .. - "button[8.5,-0.125;2.5,0.5;btn_all_mods;" .. fgettext("Enable all") .. "]" .. - "textlist[5.5,0.5;5.5,5.75;world_config_modlist;" + "button[8.75,0.125;2.5,0.5;btn_all_mods;" .. fgettext("Enable all") .. "]" .. + "textlist[5.5,0.75;5.75,5.25;world_config_modlist;" retval = retval .. modmgr.render_modlist(data.list) retval = retval .. ";" .. data.selected_mod .."]" diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index b42d119e0..477b8bcb9 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -46,7 +46,7 @@ local function create_world_formspec(dialogdata) current_seed = core.formspec_escape(current_seed) local retval = - "size[12,6,true]" .. + "size[11.5,6.5,true]" .. "label[2,0;" .. fgettext("World name") .. "]".. "field[4.5,0.4;6,0.5;te_world_name;;]" .. @@ -60,8 +60,8 @@ local function create_world_formspec(dialogdata) "textlist[4.2,3;5.8,2.3;games;" .. gamemgr.gamelist() .. ";" .. gameidx .. ";true]" .. - "button[5,5.5;2.6,0.5;world_create_confirm;" .. fgettext("Create") .. "]" .. - "button[7.5,5.5;2.8,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]" + "button[3.25,6;2.5,0.5;world_create_confirm;" .. fgettext("Create") .. "]" .. + "button[5.75,6;2.5,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]" if #gamemgr.games == 0 then retval = retval .. "box[2,4;8,1;#ff8800]label[2.25,4;" .. diff --git a/builtin/mainmenu/dlg_delete_mod.lua b/builtin/mainmenu/dlg_delete_mod.lua index 6e00b8045..2efd70414 100644 --- a/builtin/mainmenu/dlg_delete_mod.lua +++ b/builtin/mainmenu/dlg_delete_mod.lua @@ -22,10 +22,11 @@ local function delete_mod_formspec(dialogdata) dialogdata.mod = modmgr.global_mods:get_list()[dialogdata.selected] local retval = - "size[12.4,5,true]" .. - "field[1.75,1;10,3;;" .. fgettext("Are you sure you want to delete \"$1\"?", dialogdata.mod.name) .. ";]".. - "button[4,4.2;1,0.5;dlg_delete_mod_confirm;" .. fgettext("Yes") .. "]" .. - "button[6.5,4.2;3,0.5;dlg_delete_mod_cancel;" .. fgettext("No of course not!") .. "]" + "size[11.5,4.5,true]" .. + "label[2,2;" .. + fgettext("Are you sure you want to delete \"$1\"?", dialogdata.mod.name) .. "]".. + "button[3.25,3.5;2.5,0.5;dlg_delete_mod_confirm;" .. fgettext("Delete") .. "]" .. + "button[5.75,3.5;2.5,0.5;dlg_delete_mod_cancel;" .. fgettext("Cancel") .. "]" return retval end diff --git a/builtin/mainmenu/dlg_delete_world.lua b/builtin/mainmenu/dlg_delete_world.lua index aa710ef3b..1e5af1feb 100644 --- a/builtin/mainmenu/dlg_delete_world.lua +++ b/builtin/mainmenu/dlg_delete_world.lua @@ -19,11 +19,11 @@ local function delete_world_formspec(dialogdata) local retval = - "size[12,6,true]" .. + "size[11.5,4.5,true]" .. "label[2,2;" .. - fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]".. - "button[3.5,4.2;2.6,0.5;world_delete_confirm;" .. fgettext("Yes").. "]" .. - "button[6,4.2;2.8,0.5;world_delete_cancel;" .. fgettext("No") .. "]" + fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]" .. + "button[3.25,3.5;2.5,0.5;world_delete_confirm;" .. fgettext("Delete") .. "]" .. + "button[5.75,3.5;2.5,0.5;world_delete_cancel;" .. fgettext("Cancel") .. "]" return retval end diff --git a/builtin/mainmenu/dlg_rename_modpack.lua b/builtin/mainmenu/dlg_rename_modpack.lua index 9e252408a..959c65d9b 100644 --- a/builtin/mainmenu/dlg_rename_modpack.lua +++ b/builtin/mainmenu/dlg_rename_modpack.lua @@ -22,14 +22,12 @@ local function rename_modpack_formspec(dialogdata) dialogdata.mod = modmgr.global_mods:get_list()[dialogdata.selected] local retval = - "size[12.4,5,true]" .. - "label[1.75,1;".. fgettext("Rename Modpack:") .. "]".. - "field[4.5,1.4;6,0.5;te_modpack_name;;" .. - dialogdata.mod.name .. - "]" .. - "button[5,4.2;2.6,0.5;dlg_rename_modpack_confirm;".. + "size[11.5,4.5,true]" .. + "field[2.5,2;7,0.5;te_modpack_name;".. fgettext("Rename Modpack:") .. ";" .. + dialogdata.mod.name .. "]" .. + "button[3.25,3.5;2.5,0.5;dlg_rename_modpack_confirm;".. fgettext("Accept") .. "]" .. - "button[7.5,4.2;2.8,0.5;dlg_rename_modpack_cancel;".. + "button[5.75,3.5;2.5,0.5;dlg_rename_modpack_cancel;".. fgettext("Cancel") .. "]" return retval diff --git a/src/guiKeyChangeMenu.cpp b/src/guiKeyChangeMenu.cpp index bb878d6ef..b05818256 100644 --- a/src/guiKeyChangeMenu.cpp +++ b/src/guiKeyChangeMenu.cpp @@ -187,7 +187,7 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize) { core::rect < s32 > rect(0, 0, 100, 30); - rect += topleft + v2s32(size.X - 100 - 20, size.Y - 40); + rect += topleft + v2s32(size.X / 2 - 105, size.Y - 40); const wchar_t *text = wgettext("Save"); Environment->addButton(rect, this, GUI_ID_BACK_BUTTON, text); @@ -195,7 +195,7 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize) } { core::rect < s32 > rect(0, 0, 100, 30); - rect += topleft + v2s32(size.X - 100 - 20 - 100 - 20, size.Y - 40); + rect += topleft + v2s32(size.X / 2 + 5, size.Y - 40); const wchar_t *text = wgettext("Cancel"); Environment->addButton(rect, this, GUI_ID_ABORT_BUTTON, text);