GUI2: removed legacy DescriptionWML parser
It's no longer needed.
This commit is contained in:
parent
5c860aee48
commit
15917733e0
6 changed files with 0 additions and 192 deletions
|
@ -1310,13 +1310,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>
|
||||
|
@ -3688,7 +3681,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" />
|
||||
|
|
|
@ -803,9 +803,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>
|
||||
|
@ -2232,9 +2229,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>
|
||||
|
|
|
@ -143,7 +143,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
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2008 - 2018 by Mark de Wever <koraq@xs4all.nl>
|
||||
Part of the Battle for Wesnoth Project http://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 "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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2008 - 2018 by Mark de Wever <koraq@xs4all.nl>
|
||||
Part of the Battle for Wesnoth Project http://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_;
|
||||
}
|
||||
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_;
|
||||
};
|
||||
}
|
|
@ -16,7 +16,6 @@
|
|||
#include "gui/dialogs/multiplayer/faction_select.hpp"
|
||||
|
||||
#include "gui/auxiliary/find_widget.hpp"
|
||||
#include "gui/auxiliary/old_markup.hpp"
|
||||
#include "gui/core/log.hpp"
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
#include "gui/widgets/list.hpp"
|
||||
|
|
Loading…
Add table
Reference in a new issue