Remove support for legacy menu markup

This commit is contained in:
Celtic Minstrel 2019-09-15 13:33:12 -04:00 committed by Celtic Minstrel
parent 9fd59ebcda
commit 7c07cc71c0
16 changed files with 1229 additions and 297 deletions

View file

@ -23,6 +23,7 @@
* This tag is supported both in `[unit]` and in `[unit_type]`. If used in `[unit]`, it will override the type's notes.
* Standard special notes should now be added with `{NOTE_*}` instead of `{SPECIAL_NOTES_*}`.
* In `[effect]apply_to=profile`, `[add_special_note]` and `[remove_special_note]` are supported.
* Support for the deprecated "&image.png=text" syntax has been removed in all contexts - use the DescriptionWML attributes instead.
### Miscellaneous and bug fixes
* Fixed :droid's arguments not all being optional (Issue#4308)
* Chat is now enable in single-player and hotseat multiplayer. (Issue#1111)

View file

@ -445,8 +445,6 @@
<Unit filename="../../src/gui/auxiliary/iterator/walker_tree_node.hpp" />
<Unit filename="../../src/gui/auxiliary/iterator/walker_widget.cpp" />
<Unit filename="../../src/gui/auxiliary/iterator/walker_widget.hpp" />
<Unit filename="../../src/gui/auxiliary/old_markup.cpp" />
<Unit filename="../../src/gui/auxiliary/old_markup.hpp" />
<Unit filename="../../src/gui/auxiliary/tips.cpp" />
<Unit filename="../../src/gui/auxiliary/tips.hpp" />
<Unit filename="../../src/gui/auxiliary/typed_formula.hpp" />

File diff suppressed because it is too large Load diff

View file

@ -494,8 +494,6 @@
<Unit filename="../../src/gui/auxiliary/iterator/walker_tree_node.hpp" />
<Unit filename="../../src/gui/auxiliary/iterator/walker_widget.cpp" />
<Unit filename="../../src/gui/auxiliary/iterator/walker_widget.hpp" />
<Unit filename="../../src/gui/auxiliary/old_markup.cpp" />
<Unit filename="../../src/gui/auxiliary/old_markup.hpp" />
<Unit filename="../../src/gui/auxiliary/tips.cpp" />
<Unit filename="../../src/gui/auxiliary/tips.hpp" />
<Unit filename="../../src/gui/auxiliary/typed_formula.hpp" />

View file

@ -1351,13 +1351,6 @@
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Test_Debug|Win32'">$(IntDir)Gui\Auxiliary\Iterator\</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Test_Release|Win32'">$(IntDir)Gui\Auxiliary\Iterator\</ObjectFileName>
</ClCompile>
<ClCompile Include="..\..\src\gui\auxiliary\old_markup.cpp">
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='ReleaseDEBUG|Win32'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Test_Debug|Win32'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Test_Release|Win32'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
</ClCompile>
<ClCompile Include="..\..\src\gui\auxiliary\tips.cpp">
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='ReleaseDEBUG|Win32'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
@ -3724,7 +3717,6 @@
<ClInclude Include="..\..\src\gui\auxiliary\iterator\walker_grid.hpp" />
<ClInclude Include="..\..\src\gui\auxiliary\iterator\walker_tree_node.hpp" />
<ClInclude Include="..\..\src\gui\auxiliary\iterator\walker_widget.hpp" />
<ClInclude Include="..\..\src\gui\auxiliary\old_markup.hpp" />
<ClInclude Include="..\..\src\gui\auxiliary\tips.hpp" />
<ClInclude Include="..\..\src\gui\auxiliary\typed_formula.hpp" />
<ClInclude Include="..\..\src\gui\core\canvas.hpp" />

View file

@ -782,9 +782,6 @@
<ClCompile Include="..\..\src\gui\dialogs\multiplayer\synced_choice_wait.cpp">
<Filter>Gui\Dialogs\Multiplayer</Filter>
</ClCompile>
<ClCompile Include="..\..\src\gui\auxiliary\old_markup.cpp">
<Filter>Gui\Auxiliary</Filter>
</ClCompile>
<ClCompile Include="..\..\src\gui\auxiliary\tips.cpp">
<Filter>Gui\Auxiliary</Filter>
</ClCompile>
@ -2225,9 +2222,6 @@
<ClInclude Include="..\..\src\gui\auxiliary\find_widget.hpp">
<Filter>Gui\Auxiliary</Filter>
</ClInclude>
<ClInclude Include="..\..\src\gui\auxiliary\old_markup.hpp">
<Filter>Gui\Auxiliary</Filter>
</ClInclude>
<ClInclude Include="..\..\src\gui\auxiliary\tips.hpp">
<Filter>Gui\Auxiliary</Filter>
</ClInclude>

View file

@ -1358,13 +1358,6 @@
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Test_Debug|x64'">$(IntDir)Gui\Auxiliary\Iterator\</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Test_Release|x64'">$(IntDir)Gui\Auxiliary\Iterator\</ObjectFileName>
</ClCompile>
<ClCompile Include="..\..\src\gui\auxiliary\old_markup.cpp">
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='ReleaseDEBUG|x64'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Test_Debug|x64'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Test_Release|x64'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
</ClCompile>
<ClCompile Include="..\..\src\gui\auxiliary\tips.cpp">
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='ReleaseDEBUG|x64'">$(IntDir)Gui\Auxiliary\</ObjectFileName>
@ -3751,7 +3744,6 @@
<ClInclude Include="..\..\src\gui\auxiliary\iterator\walker_grid.hpp" />
<ClInclude Include="..\..\src\gui\auxiliary\iterator\walker_tree_node.hpp" />
<ClInclude Include="..\..\src\gui\auxiliary\iterator\walker_widget.hpp" />
<ClInclude Include="..\..\src\gui\auxiliary\old_markup.hpp" />
<ClInclude Include="..\..\src\gui\auxiliary\tips.hpp" />
<ClInclude Include="..\..\src\gui\auxiliary\typed_formula.hpp" />
<ClInclude Include="..\..\src\gui\core\canvas.hpp" />

View file

@ -785,9 +785,6 @@
<ClCompile Include="..\..\src\gui\dialogs\multiplayer\synced_choice_wait.cpp">
<Filter>Gui\Dialogs\Multiplayer</Filter>
</ClCompile>
<ClCompile Include="..\..\src\gui\auxiliary\old_markup.cpp">
<Filter>Gui\Auxiliary</Filter>
</ClCompile>
<ClCompile Include="..\..\src\gui\auxiliary\tips.cpp">
<Filter>Gui\Auxiliary</Filter>
</ClCompile>
@ -2231,9 +2228,6 @@
<ClInclude Include="..\..\src\gui\auxiliary\find_widget.hpp">
<Filter>Gui\Auxiliary</Filter>
</ClInclude>
<ClInclude Include="..\..\src\gui\auxiliary\old_markup.hpp">
<Filter>Gui\Auxiliary</Filter>
</ClInclude>
<ClInclude Include="..\..\src\gui\auxiliary\tips.hpp">
<Filter>Gui\Auxiliary</Filter>
</ClInclude>

View file

@ -344,8 +344,6 @@
46F92E402174F6A400602C1C /* generate_map.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CF32174F6A300602C1C /* generate_map.cpp */; };
46F92E412174F6A400602C1C /* chat_log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CF92174F6A300602C1C /* chat_log.cpp */; };
46F92E422174F6A400602C1C /* chat_log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CF92174F6A300602C1C /* chat_log.cpp */; };
46F92E432174F6A400602C1C /* old_markup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CFB2174F6A300602C1C /* old_markup.cpp */; };
46F92E442174F6A400602C1C /* old_markup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CFB2174F6A300602C1C /* old_markup.cpp */; };
46F92E452174F6A400602C1C /* tips.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CFC2174F6A300602C1C /* tips.cpp */; };
46F92E462174F6A400602C1C /* tips.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92CFC2174F6A300602C1C /* tips.cpp */; };
46F92E472174F6A400602C1C /* walker_tree_node.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F92D012174F6A300602C1C /* walker_tree_node.cpp */; };
@ -1760,10 +1758,8 @@
46F92CF72174F6A300602C1C /* core_selection.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = core_selection.hpp; sourceTree = "<group>"; };
46F92CF82174F6A300602C1C /* help_browser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = help_browser.hpp; sourceTree = "<group>"; };
46F92CF92174F6A300602C1C /* chat_log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chat_log.cpp; sourceTree = "<group>"; };
46F92CFB2174F6A300602C1C /* old_markup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = old_markup.cpp; sourceTree = "<group>"; };
46F92CFC2174F6A300602C1C /* tips.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tips.cpp; sourceTree = "<group>"; };
46F92CFD2174F6A300602C1C /* field.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = field.hpp; sourceTree = "<group>"; };
46F92CFE2174F6A300602C1C /* old_markup.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = old_markup.hpp; sourceTree = "<group>"; };
46F92CFF2174F6A300602C1C /* typed_formula.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = typed_formula.hpp; sourceTree = "<group>"; };
46F92D012174F6A300602C1C /* walker_tree_node.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = walker_tree_node.cpp; sourceTree = "<group>"; };
46F92D022174F6A300602C1C /* walker_widget.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = walker_widget.hpp; sourceTree = "<group>"; };
@ -3626,10 +3622,8 @@
46F92CFA2174F6A300602C1C /* auxiliary */ = {
isa = PBXGroup;
children = (
46F92CFB2174F6A300602C1C /* old_markup.cpp */,
46F92CFC2174F6A300602C1C /* tips.cpp */,
46F92CFD2174F6A300602C1C /* field.hpp */,
46F92CFE2174F6A300602C1C /* old_markup.hpp */,
46F92CFF2174F6A300602C1C /* typed_formula.hpp */,
46F92D002174F6A300602C1C /* iterator */,
46F92D0D2174F6A300602C1C /* find_widget.hpp */,
@ -5297,7 +5291,6 @@
B5599B230EC62181008DD061 /* mouse_handler_base.cpp in Sources */,
46F92E2B2174F6A400602C1C /* synced_choice_wait.cpp in Sources */,
B52EE91A12135AC300CFBDAB /* move.cpp in Sources */,
46F92E432174F6A400602C1C /* old_markup.cpp in Sources */,
620A387115E9364F00A4F513 /* move.cpp in Sources */,
46F92E132174F6A400602C1C /* player_list_helper.cpp in Sources */,
F468E6AD16DF872200A31A5A /* movetype.cpp in Sources */,
@ -5794,7 +5787,6 @@
91E356BD1CACC8A100774252 /* engine_cpp.cpp in Sources */,
46F92DB62174F6A300602C1C /* message.cpp in Sources */,
91E356BE1CACC8A100774252 /* recruitment.cpp in Sources */,
46F92E442174F6A400602C1C /* old_markup.cpp in Sources */,
46F92E562174F6A400602C1C /* vertical_scrollbar.cpp in Sources */,
91E356BF1CACC8A100774252 /* ca_move_to_targets.cpp in Sources */,
91E356C01CACC8A100774252 /* stage_rca.cpp in Sources */,

View file

@ -145,7 +145,6 @@ gui/auxiliary/iterator/iterator.cpp
gui/auxiliary/iterator/walker_grid.cpp
gui/auxiliary/iterator/walker_tree_node.cpp
gui/auxiliary/iterator/walker_widget.cpp
gui/auxiliary/old_markup.cpp
gui/auxiliary/tips.cpp
gui/core/canvas.cpp
gui/core/event/dispatcher.cpp

View file

@ -31,7 +31,6 @@
#include "synced_context.hpp"
#include "terrain/filter.hpp"
#include "deprecation.hpp"
#include "gui/auxiliary/old_markup.hpp"
static lg::log_domain log_engine("engine");
#define ERR_NG LOG_STREAM(err, log_engine)
@ -85,13 +84,6 @@ wml_menu_item::wml_menu_item(const std::string& id, const config& cfg)
if(cfg.has_attribute("needs_select")) {
deprecated_message("needs_select", DEP_LEVEL::INDEFINITE, {1, 15, 0});
}
gui2::legacy_menu_item parsed(cfg["description"].str(), "Multiple columns in [set_menu_item] are no longer supported; the image is specified by image=.");
if(parsed.contained_markup()) {
description_ = parsed.label();
if(!parsed.description().empty()) {
description_ += " " + parsed.description();
}
}
}
// Constructor for items defined in an event.
@ -277,15 +269,7 @@ void wml_menu_item::update(const vconfig& vcfg)
}
if(vcfg.has_attribute("description")) {
gui2::legacy_menu_item parsed(vcfg["description"].str(), "Multiple columns in [set_menu_item] are no longer supported; the image is specified by image=.");
if(parsed.contained_markup()) {
description_ = parsed.label();
if(!parsed.description().empty()) {
description_ += " " + parsed.description();
}
} else {
description_ = vcfg["description"].t_str();
}
description_ = vcfg["description"].t_str();
hotkey_updated = true;
}

View file

@ -1,74 +0,0 @@
/*
Copyright (C) 2008 - 2018 by Mark de Wever <koraq@xs4all.nl>
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#include "gui/auxiliary/old_markup.hpp"
#include "deprecation.hpp"
#include "game_version.hpp"
namespace gui2
{
legacy_menu_item::legacy_menu_item(const std::string& str, const std::string deprecation_msg)
: icon_(), label_(str), desc_(), default_(false), contained_markup_(false)
{
if(label_.empty()) {
return;
}
// Handle selection.
if(label_[0] == '*') {
default_ = true;
label_.erase(0, 1);
contained_markup_ = true;
}
// Handle the special case with an image.
// 99.9% of uses put the image in the first column, so we ignore the slim possibility of it going in a different column
std::string::size_type pos = label_.find('=');
if(pos != std::string::npos && (label_[0] == '&' || pos == 0)) {
if(pos)
icon_ = label_.substr(1, pos - 1);
label_.erase(0, pos + 1);
contained_markup_ = true;
}
// Search for an '=' symbol that is not inside markup.
std::string::size_type prev = 0;
bool open = false;
while((pos = label_.find('=', prev)) != std::string::npos) {
for(std::string::size_type i = prev; i != pos; ++i) {
switch(label_[i]) {
case '<':
open = true;
break;
case '>':
open = false;
break;
}
}
if(!open)
break;
prev = pos + 1;
}
if(pos != std::string::npos) {
desc_ = label_.substr(pos + 1);
label_.erase(pos);
contained_markup_ = true;
}
if(contained_markup_) {
deprecated_message("Legacy DescriptionWML markup (&img=col1=col2)", DEP_LEVEL::FOR_REMOVAL, {1, 15, 0}, deprecation_msg);
}
}
}

View file

@ -1,103 +0,0 @@
/*
Copyright (C) 2008 - 2018 by Mark de Wever <koraq@xs4all.nl>
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#pragma once
#include <string>
namespace gui2
{
/**
* Implements simple parsing of legacy GUI1 item markup.
*/
class legacy_menu_item
{
/*
* Legacy options/menu items have some special markup:
* A line starting with a * is selected by default.
* A line starting with a & enables the following markup:
* - The part until the = is the name of an image.
* - The part until the second = is the first column.
* - The rest is the third column (the wiki only specifies two columns
* so only two of them are implemented).
*/
/**
* @todo This syntax looks like a bad hack, it would be nice to write
* a new syntax which doesn't use those hacks (also avoids the problem
* with special meanings for certain characters.
*/
public:
explicit legacy_menu_item(const std::string& str = "", const std::string deprecation_msg = "");
const std::string& icon() const
{
return icon_;
}
const std::string& label() const
{
return label_;
}
const std::string& description() const
{
return desc_;
}
bool is_default() const
{
return default_;
}
bool contained_markup() const
{
return contained_markup_;
}
legacy_menu_item& operator=(const legacy_menu_item& rhs)
{
if(&rhs != this) {
icon_ = rhs.icon_;
label_ = rhs.label_;
desc_ = rhs.desc_;
default_ = rhs.default_;
contained_markup_ = rhs.contained_markup_;
}
return *this;
}
private:
/** The icon for the menu item. */
std::string icon_;
/** The first text item of the menu item, normally a short string. */
std::string label_;
/** The second text item of the menu item, normally a longer string. */
std::string desc_;
/**
* Is the item the default item and thus initially selected.
*
* It's unspecified what happens if multiple items in a menu are selected.
*/
bool default_;
/**
* Was any old markup actually parsed?
*/
bool contained_markup_;
};
}

View file

@ -20,7 +20,6 @@
#include "font/text_formatting.hpp"
#include "formatter.hpp"
#include "gui/auxiliary/find_widget.hpp"
#include "gui/auxiliary/old_markup.hpp"
#include "preferences/game.hpp"
#include "gui/widgets/listbox.hpp"
#include "gui/widgets/window.hpp"
@ -77,35 +76,6 @@ config generate_difficulty_config(const config& source)
// Populate local config with difficulty children
result.append_children(source, "difficulty");
// Convert legacy format to new-style config if latter not present
if(result.empty() && source.has_attribute("difficulties")) {
deprecated_message("[campaign]difficulties", DEP_LEVEL::FOR_REMOVAL, {1, 15, 0}, "Use [difficulty] instead.");
if(source.has_attribute("difficulty_descriptions")) {
deprecated_message("[campaign]difficulty_descriptions", DEP_LEVEL::FOR_REMOVAL, {1, 15, 0}, "Use [difficulty] instead.");
}
std::vector<std::string> difficulty_list = utils::split(source["difficulties"]);
std::vector<std::string> difficulty_opts = utils::split(source["difficulty_descriptions"], ';');
if(difficulty_opts.size() != difficulty_list.size()) {
difficulty_opts = difficulty_list;
}
for(std::size_t i = 0; i < difficulty_opts.size(); ++i) {
config temp;
gui2::legacy_menu_item parsed(difficulty_opts[i], "Use [difficulty] instead.");
temp["define"] = difficulty_list[i];
temp["image"] = parsed.icon();
temp["label"] = parsed.label();
temp["description"] = parsed.description();
temp["default"] = parsed.is_default();
temp["old_markup"] = true; // To prevent double parentheses in the dialog
result.add_child("difficulty", std::move(temp));
}
}
return result;
}

View file

@ -17,7 +17,6 @@
#include "game_config_manager.hpp"
#include "gui/auxiliary/find_widget.hpp"
#include "gui/auxiliary/old_markup.hpp"
#include "gui/core/log.hpp"
#include "gui/widgets/listbox.hpp"
#include "gui/widgets/settings.hpp"
@ -102,27 +101,11 @@ void faction_select::pre_show(window& window)
// flag_rgb here is unrelated to any handling in the unit class
const std::string flag_rgb = !side["flag_rgb"].empty() ? side["flag_rgb"].str() : "magenta";
// Handle legacy DescriptionWML format.
if(name.find_first_of("=") != std::string::npos) {
gui2::legacy_menu_item parsed(name, "Use separate name= and image= keys. Multiple text columns are no longer supported.");
item["label"] = (formatter() << side["image"] << "~RC(" << flag_rgb << ">" << tc_color_ << ")").str();
data.emplace("faction_image", item);
if(!side.has_attribute("image")) {
item["label"] = (formatter() << parsed.icon() << "~RC(" << flag_rgb << ">" << tc_color_ << ")").str();
data.emplace("faction_image", item);
}
item["label"] = parsed.label();
if(!parsed.description().empty()) {
item["label"] += " " + parsed.description();
}
data.emplace("faction_name", item);
} else {
item["label"] = (formatter() << side["image"] << "~RC(" << flag_rgb << ">" << tc_color_ << ")").str();
data.emplace("faction_image", item);
item["label"] = name;
data.emplace("faction_name", item);
}
item["label"] = name;
data.emplace("faction_name", item);
list.add_row(data);
}

View file

@ -14,7 +14,6 @@
#include "scripting/lua_gui2.hpp"
#include "gui/auxiliary/old_markup.hpp"
#include "gui/core/canvas.hpp"
#include "gui/core/gui_definition.hpp"
#include "gui/core/window_builder.hpp"
@ -282,16 +281,7 @@ int show_message_dialog(lua_State* L)
t_string short_opt;
config opt;
if(luaW_totstring(L, -1, short_opt)) {
// Note: Although this currently uses the legacy_menu_item class
// for the deprecated syntax, this branch should still be retained
// when the deprecated syntax is removed, as a simpler method
// of specifying options when only a single string is needed.
const std::string& opt_str = short_opt;
gui2::legacy_menu_item item(opt_str, "Use image=, label=, description=, default= instead.");
opt["image"] = item.icon();
opt["label"] = item.label();
opt["description"] = item.description();
opt["default"] = item.is_default();
opt["description"] = short_opt;
} else if(!luaW_toconfig(L, -1, opt)) {
std::ostringstream error;
error << "expected array of config and/or translatable strings, but index ";