Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gui2/twml_error: New GUI2 dialog to be used for WML parser/pp errors
This dialog features separate summary and detail sections along with a small heading for the latter in bold face. More features may be added later as part of my work on improving WML diagnostics, but for now we have the bare minimum for better message formatting with a content structure more or less identical to the current one.
- Loading branch information
Showing
5 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
#textdomain wesnoth-lib | ||
### | ||
### Dialog used to report WML parser or preprocessor errors. | ||
### | ||
|
||
[window] | ||
id = "wml_error" | ||
description = "WML preprocessor/parser error report dialog." | ||
|
||
[resolution] | ||
definition = "default" | ||
|
||
#click_dismiss = "true" | ||
maximum_width = 800 | ||
|
||
automatic_placement = "true" | ||
vertical_placement = "center" | ||
horizontal_placement = "center" | ||
|
||
[tooltip] | ||
id = "tooltip_large" | ||
[/tooltip] | ||
|
||
[helptip] | ||
id = "tooltip_large" | ||
[/helptip] | ||
|
||
[grid] | ||
|
||
[row] | ||
|
||
[column] | ||
border = "all" | ||
border_size = 5 | ||
horizontal_alignment = "left" | ||
|
||
[label] | ||
definition = "title" | ||
label = _ "Error" | ||
[/label] | ||
[/column] | ||
|
||
[/row] | ||
|
||
[row] | ||
|
||
[column] | ||
border = "all" | ||
border_size = 5 | ||
horizontal_alignment = "left" | ||
|
||
[label] | ||
id = "summary" | ||
definition = "default" | ||
wrap = true | ||
[/label] | ||
[/column] | ||
|
||
[/row] | ||
|
||
[row] | ||
|
||
[column] | ||
border = "all" | ||
border_size = 5 | ||
horizontal_alignment = "left" | ||
|
||
[label] | ||
id = "details_heading" | ||
definition = "default_bold" | ||
label = _ "Details:" | ||
[/label] | ||
[/column] | ||
|
||
[/row] | ||
|
||
[row] | ||
|
||
[column] | ||
border = "all" | ||
border_size = 5 | ||
horizontal_grow = "true" | ||
|
||
[scroll_label] | ||
id = "details" | ||
definition = "default" | ||
[/scroll_label] | ||
[/column] | ||
|
||
[/row] | ||
|
||
[row] | ||
|
||
[column] | ||
border = "all" | ||
border_size = 5 | ||
horizontal_alignment = "right" | ||
|
||
[button] | ||
id = "ok" | ||
definition = "default" | ||
label = _ "OK" | ||
[/button] | ||
|
||
[/column] | ||
|
||
[/row] | ||
|
||
[/grid] | ||
|
||
[/resolution] | ||
|
||
[/window] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
Copyright (C) 2014 by Ignacio R. Morelle <shadowm2006@gmail.com> | ||
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/dialogs/wml_error.hpp" | ||
|
||
#include "gui/widgets/settings.hpp" | ||
|
||
namespace gui2 | ||
{ | ||
|
||
/*WIKI | ||
* @page = GUIWindowDefinitionWML | ||
* @order = 2_wml_error | ||
* | ||
* == WML error == | ||
* | ||
* Dialog used to report WML parser or preprocessor errors. | ||
* | ||
* @begin{table}{dialog_widgets} | ||
* | ||
* summary & & control & m & | ||
* Label used for displaying a brief summary of the error(s). $ | ||
* | ||
* details & & control & m & | ||
* Full report of the parser or preprocessor error(s) found. $ | ||
* | ||
* @end{table} | ||
*/ | ||
|
||
REGISTER_DIALOG(wml_error) | ||
|
||
twml_error::twml_error(const std::string& summary, const std::string& details) | ||
{ | ||
register_label("summary", true, summary); | ||
register_label("details", true, details); | ||
} | ||
|
||
} // end namespace gui2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
Copyright (C) 2014 by Ignacio R. Morelle <shadowm2006@gmail.com> | ||
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. | ||
*/ | ||
|
||
#ifndef GUI_DIALOGS_WML_ERROR_HPP_INCLUDED | ||
#define GUI_DIALOGS_WML_ERROR_HPP_INCLUDED | ||
|
||
#include "gui/dialogs/dialog.hpp" | ||
|
||
namespace gui2 { | ||
|
||
class twml_error : public tdialog | ||
{ | ||
public: | ||
twml_error(const std::string& summary, const std::string& details); | ||
|
||
/** The display function; see @ref tdialog for more information. */ | ||
static void display(const std::string& summary, | ||
const std::string& details, | ||
CVideo& video) | ||
{ | ||
twml_error(summary, details).show(video); | ||
} | ||
|
||
private: | ||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */ | ||
virtual const std::string& window_id() const; | ||
}; | ||
|
||
} // end namespace gui2 | ||
|
||
#endif |