← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/fh1-sub2div into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/fh1-sub2div into lp:widelands.

Commit message:
Renamed "sub" tag to "div" in new font renderer.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/fh1-sub2div/+merge/318138

A simple renaming of a font renderer tag.

I agreed with SirVer on this renaming when I first started working on the new font renderer. Since I've started working on the renderer again, I'd like this in before I start changing any markup.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fh1-sub2div into lp:widelands.
=== modified file 'src/graphic/text/rt_parse.cc'
--- src/graphic/text/rt_parse.cc	2017-01-25 18:55:59 +0000
+++ src/graphic/text/rt_parse.cc	2017-02-23 17:31:14 +0000
@@ -189,7 +189,7 @@
 		tc.allowed_children.insert("p");
 		tc.allowed_children.insert("vspace");
 		tc.allowed_children.insert("font");
-		tc.allowed_children.insert("sub");
+		tc.allowed_children.insert("div");
 		tc.text_allowed = false;
 		tc.has_closing_tag = true;
 		tag_constraints_["rt"] = tc;
@@ -223,7 +223,7 @@
 		tc.has_closing_tag = false;
 		tag_constraints_["space"] = tc;
 	}
-	{  // sub tag
+	{  // div tag
 		TagConstraint tc;
 		tc.allowed_attrs.insert("padding");
 		tc.allowed_attrs.insert("padding_r");
@@ -239,11 +239,11 @@
 		tc.allowed_children.insert("p");
 		tc.allowed_children.insert("vspace");
 		tc.allowed_children.insert("font");
-		tc.allowed_children.insert("sub");
+		tc.allowed_children.insert("div");
 
 		tc.text_allowed = false;
 		tc.has_closing_tag = true;
-		tag_constraints_["sub"] = tc;
+		tag_constraints_["div"] = tc;
 	}
 	{  // p tag
 		TagConstraint tc;
@@ -256,7 +256,7 @@
 		tc.allowed_children.insert("space");
 		tc.allowed_children.insert("br");
 		tc.allowed_children.insert("img");
-		tc.allowed_children.insert("sub");
+		tc.allowed_children.insert("div");
 		tc.text_allowed = true;
 		tc.has_closing_tag = true;
 		tag_constraints_["p"] = tc;
@@ -277,7 +277,7 @@
 		tc.allowed_children.insert("vspace");
 		tc.allowed_children.insert("p");
 		tc.allowed_children.insert("font");
-		tc.allowed_children.insert("sub");
+		tc.allowed_children.insert("div");
 		tc.text_allowed = true;
 		tc.has_closing_tag = true;
 		tag_constraints_["font"] = tc;

=== modified file 'src/graphic/text/rt_render.cc'
--- src/graphic/text/rt_render.cc	2017-01-25 18:55:59 +0000
+++ src/graphic/text/rt_render.cc	2017-02-23 17:31:14 +0000
@@ -652,17 +652,17 @@
 };
 
 /*
- * This is a sub tag node. It is also the same as a full rich text render node.
+ * This is a div tag node. It is also the same as a full rich text render node.
  */
-class SubTagRenderNode : public RenderNode {
+class DivTagRenderNode : public RenderNode {
 public:
-	SubTagRenderNode(NodeStyle& ns)
+	DivTagRenderNode(NodeStyle& ns)
 	   : RenderNode(ns),
 	     background_color_(0, 0, 0),
 	     is_background_color_set_(false),
 	     background_image_(nullptr) {
 	}
-	virtual ~SubTagRenderNode() {
+	virtual ~DivTagRenderNode() {
 		for (RenderNode* n : nodes_to_render_) {
 			delete n;
 		}
@@ -1140,9 +1140,9 @@
 	}
 };
 
-class SubTagHandler : public TagHandler {
+class DivTagHandler : public TagHandler {
 public:
-	SubTagHandler(Tag& tag,
+	DivTagHandler(Tag& tag,
 	              FontCache& fc,
 	              NodeStyle ns,
 	              ImageCache* image_cache,
@@ -1153,7 +1153,7 @@
 	   : TagHandler(tag, fc, ns, image_cache, init_renderer_style, fontsets),
 	     shrink_to_fit_(shrink_to_fit),
 	     w_(max_w),
-	     render_node_(new SubTagRenderNode(ns)) {
+		  render_node_(new DivTagRenderNode(ns)) {
 	}
 
 	void enter() override {
@@ -1238,7 +1238,7 @@
 		nodes.push_back(render_node_);
 	}
 
-	// Handle attributes that are in sub, but not in rt.
+	// Handle attributes that are in div, but not in rt.
 	virtual void handle_unique_attributes() {
 		const AttrMap& a = tag_.attrs();
 		if (a.has("width")) {
@@ -1278,10 +1278,10 @@
 
 private:
 	uint16_t w_;
-	SubTagRenderNode* render_node_;
+	DivTagRenderNode* render_node_;
 };
 
-class RTTagHandler : public SubTagHandler {
+class RTTagHandler : public DivTagHandler {
 public:
 	RTTagHandler(Tag& tag,
 	             FontCache& fc,
@@ -1290,10 +1290,10 @@
 	             RendererStyle& init_renderer_style,
 	             const UI::FontSets& fontsets,
 	             uint16_t w)
-	   : SubTagHandler(tag, fc, ns, image_cache, init_renderer_style, fontsets, w, true) {
+		: DivTagHandler(tag, fc, ns, image_cache, init_renderer_style, fontsets, w, true) {
 	}
 
-	// Handle attributes that are in rt, but not in sub.
+	// Handle attributes that are in rt, but not in div.
 	void handle_unique_attributes() override {
 		const AttrMap& a = tag_.attrs();
 		WordSpacerNode::show_spaces(a.has("db_show_spaces") ? a["db_show_spaces"].get_bool() : 0);
@@ -1329,7 +1329,7 @@
 	if (map.empty()) {
 		map["br"] = &create_taghandler<BrTagHandler>;
 		map["font"] = &create_taghandler<FontTagHandler>;
-		map["sub"] = &create_taghandler<SubTagHandler>;
+		map["div"] = &create_taghandler<DivTagHandler>;
 		map["p"] = &create_taghandler<PTagHandler>;
 		map["img"] = &create_taghandler<ImgTagHandler>;
 		map["vspace"] = &create_taghandler<VspaceTagHandler>;

=== modified file 'src/graphic/text/test/data/bullet_point/input00.txt'
--- src/graphic/text/test/data/bullet_point/input00.txt	2014-07-14 10:45:44 +0000
+++ src/graphic/text/test/data/bullet_point/input00.txt	2017-02-23 17:31:14 +0000
@@ -1,30 +1,30 @@
 <rt>
 <p><font size=20 underline=1>A bullet list</font></p>
-<sub padding=10 width=490>
+<div padding=10 width=490>
 <p>
-<sub valign=top><p><space><img src="pics/bullet.png"></p></sub><sub width=450>
+<div valign=top><p><space><img src="pics/bullet.png"></p></div><div width=450>
 <p>
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
 tempor.
 </p>
-</sub>
+</div>
 
-<sub valign=top><p><space ><img src="pics/bullet.png"></p></sub><sub width=450>
+<div valign=top><p><space ><img src="pics/bullet.png"></p></div><div width=450>
 <p>
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
 tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
 vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
 gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
 </p>
-</sub>
+</div>
 
-<sub valign=top><p><space><img src="pics/bullet.png"></p></sub><sub width=450>
+<div valign=top><p><space><img src="pics/bullet.png"></p></div><div width=450>
 <p>
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
 tempor.
 </p>
-</sub>
+</div>
 </p>
 
-</sub>
+</div>
 </rt>

=== renamed directory 'src/graphic/text/test/data/sub_autowidth_floatleftimg' => 'src/graphic/text/test/data/div_autowidth_floatleftimg'
=== modified file 'src/graphic/text/test/data/div_autowidth_floatleftimg/input00.txt'
--- src/graphic/text/test/data/sub_autowidth_floatleftimg/input00.txt	2016-02-02 06:13:58 +0000
+++ src/graphic/text/test/data/div_autowidth_floatleftimg/input00.txt	2017-02-23 17:31:14 +0000
@@ -1,9 +1,9 @@
 <rt>
-<sub float=left background=00ff00>
+<div float=left background=00ff00>
    <p>
    <img src="images/logos/wl-ico-128.png">
    </p>
-</sub>
+</div>
 <p>
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
 tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At

=== renamed directory 'src/graphic/text/test/data/sub_background_img' => 'src/graphic/text/test/data/div_background_img'
=== modified file 'src/graphic/text/test/data/div_background_img/input00.txt'
--- src/graphic/text/test/data/sub_background_img/input00.txt	2014-07-14 10:45:44 +0000
+++ src/graphic/text/test/data/div_background_img/input00.txt	2017-02-23 17:31:14 +0000
@@ -1,10 +1,10 @@
 <rt>
-<sub padding=16 background="pics/chessboard.png" width=380>
+<div padding=16 background="pics/chessboard.png" width=380>
 <p><font color=ff0000 bold=true>
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
 tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
 vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
 no sea takimata sanctus est Lorem ipsum dolor sit amet.
 </font></p>
-</sub>
+</div>
 </rt>

=== renamed directory 'src/graphic/text/test/data/sub_fixedwidth_floatbothsides' => 'src/graphic/text/test/data/div_fixedwidth_floatbothsides'
=== modified file 'src/graphic/text/test/data/div_fixedwidth_floatbothsides/input00.txt'
--- src/graphic/text/test/data/sub_fixedwidth_floatbothsides/input00.txt	2012-06-20 09:59:07 +0000
+++ src/graphic/text/test/data/div_fixedwidth_floatbothsides/input00.txt	2017-02-23 17:31:14 +0000
@@ -6,7 +6,7 @@
 vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
 no sea takimata sanctus est Lorem ipsum dolor sit amet.
 </p>
-<sub width=100 float=right background=ff0000>
+<div width=100 float=right background=ff0000>
    <p>
 Hello World
 Hello World
@@ -14,11 +14,11 @@
 Hello World
 Hello World
    </p>
-</sub>
+</div>
 <p>
 Lorem ipsum dolor sit amet, consetetur sadipscing
 </p>
-<sub width=100 float=left background=00ff00>
+<div width=100 float=left background=00ff00>
    <p>
 Hello World
 Hello World
@@ -26,7 +26,7 @@
 Hello World
 Hello World
    </p>
-</sub>
+</div>
 <p>elitr, sed diam nonumy eir mod tem por invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
 vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
 no sea takimata sanctus est Lorem ipsum dolor sit amet.

=== renamed directory 'src/graphic/text/test/data/sub_fixedwidth_floatleft' => 'src/graphic/text/test/data/div_fixedwidth_floatleft'
=== modified file 'src/graphic/text/test/data/div_fixedwidth_floatleft/input00.txt'
--- src/graphic/text/test/data/sub_fixedwidth_floatleft/input00.txt	2012-06-20 09:59:07 +0000
+++ src/graphic/text/test/data/div_fixedwidth_floatleft/input00.txt	2017-02-23 17:31:14 +0000
@@ -1,9 +1,9 @@
 <rt>
-<sub width=93 float=left background=00ff00>
+<div width=93 float=left background=00ff00>
    <p><font color=ff0000 size=21>
    This text is inside Sub
    </font></p>
-</sub>
+</div>
 <p>
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
 tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At

=== renamed directory 'src/graphic/text/test/data/sub_fixedwidth_floatleftimg' => 'src/graphic/text/test/data/div_fixedwidth_floatleftimg'
=== modified file 'src/graphic/text/test/data/div_fixedwidth_floatleftimg/input00.txt'
--- src/graphic/text/test/data/sub_fixedwidth_floatleftimg/input00.txt	2016-02-02 06:13:58 +0000
+++ src/graphic/text/test/data/div_fixedwidth_floatleftimg/input00.txt	2017-02-23 17:31:14 +0000
@@ -1,9 +1,9 @@
 <rt>
-<sub float=left background=00ff00>
+<div float=left background=00ff00>
    <p>
    <img src="images/logos/wl-ico-128.png">
    </p>
-</sub>
+</div>
 <p>
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
 tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At

=== renamed directory 'src/graphic/text/test/data/sub_fixedwidth_floatright' => 'src/graphic/text/test/data/div_fixedwidth_floatright'
=== modified file 'src/graphic/text/test/data/div_fixedwidth_floatright/input00.txt'
--- src/graphic/text/test/data/sub_fixedwidth_floatright/input00.txt	2012-06-20 09:59:07 +0000
+++ src/graphic/text/test/data/div_fixedwidth_floatright/input00.txt	2017-02-23 17:31:14 +0000
@@ -1,9 +1,9 @@
 <rt>
-<sub width=106 float=right background=00ff00>
+<div width=106 float=right background=00ff00>
    <p><font color=ff0000 size=21>
    This text is inside Sub
    </font></p>
-</sub>
+</div>
 <p>
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
 tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At

=== renamed directory 'src/graphic/text/test/data/sub_margin_bgclr' => 'src/graphic/text/test/data/div_margin_bgclr'
=== modified file 'src/graphic/text/test/data/div_margin_bgclr/input00.txt'
--- src/graphic/text/test/data/sub_margin_bgclr/input00.txt	2012-06-20 09:59:07 +0000
+++ src/graphic/text/test/data/div_margin_bgclr/input00.txt	2017-02-23 17:31:14 +0000
@@ -1,12 +1,12 @@
 <rt>
-<sub background="ff0000">
-<sub margin=2 padding=16 background=00ff00 width=370>
+<div background="ff0000">
+<div margin=2 padding=16 background=00ff00 width=370>
 <p><font color=ff0000 bold=true>
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
 tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
 vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
 no sea takimata sanctus est Lorem ipsum dolor sit amet.
 </font></p>
-</sub>
-</sub>
+</div>
+</div>
 </rt>

=== renamed directory 'src/graphic/text/test/data/sub_margin_bgimg' => 'src/graphic/text/test/data/div_margin_bgimg'
=== modified file 'src/graphic/text/test/data/div_margin_bgimg/input00.txt'
--- src/graphic/text/test/data/sub_margin_bgimg/input00.txt	2014-07-14 10:45:44 +0000
+++ src/graphic/text/test/data/div_margin_bgimg/input00.txt	2017-02-23 17:31:14 +0000
@@ -1,12 +1,12 @@
 <rt>
-<sub background="ff0000">
-<sub margin=5 padding=16 background=pics/chessboard.png width=370>
+<div background="ff0000">
+<div margin=5 padding=16 background=pics/chessboard.png width=370>
 <p><font color=ff0000 bold=true>
 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
 tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
 vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
 no sea takimata sanctus est Lorem ipsum dolor sit amet.
 </font></p>
-</sub>
-</sub>
+</div>
+</div>
 </rt>

=== renamed directory 'src/graphic/text/test/data/sub_nonfloating_valign' => 'src/graphic/text/test/data/div_nonfloating_valign'
=== modified file 'src/graphic/text/test/data/div_nonfloating_valign/input00.txt'
--- src/graphic/text/test/data/sub_nonfloating_valign/input00.txt	2016-02-02 06:13:58 +0000
+++ src/graphic/text/test/data/div_nonfloating_valign/input00.txt	2017-02-23 17:31:14 +0000
@@ -1,7 +1,7 @@
 <rt db_show_spaces=1>
-<p><img src="images/logos/wl-ico-128.png"><sub valign=center width=100 padding=5 background="ffffff">
+<p><img src="images/logos/wl-ico-128.png"><div valign=center width=100 padding=5 background="ffffff">
    <p align=center>
 		<font size=10>lorem larum loeffestiel blad lorem lorem loerm ljsdf kljs df</font>
 	</p>
-</sub><img src="images/logos/wl-ico-128.png"></p>
+</div><img src="images/logos/wl-ico-128.png"></p>
 </rt>

=== renamed directory 'src/graphic/text/test/data/sub_padding' => 'src/graphic/text/test/data/div_padding'
=== modified file 'src/graphic/text/test/data/div_padding/input00.txt'
--- src/graphic/text/test/data/sub_padding/input00.txt	2014-07-14 10:45:44 +0000
+++ src/graphic/text/test/data/div_padding/input00.txt	2017-02-23 17:31:14 +0000
@@ -1,7 +1,7 @@
 <rt padding=5>
-<sub padding=7 background=00ff00>
+<div padding=7 background=00ff00>
 <p>
 <img src="pics/red_box.png">
 </p>
-</sub>
+</div>
 </rt>

=== modified file 'src/graphic/text/test/data/font_shadow/input00.txt'
--- src/graphic/text/test/data/font_shadow/input00.txt	2012-06-21 13:06:00 +0000
+++ src/graphic/text/test/data/font_shadow/input00.txt	2017-02-23 17:31:14 +0000
@@ -1,2 +1,2 @@
-<rt><sub width=130><p><font color=ff0000>Hello <font shadow=yes>some shadow</font> World</font></p></sub></rt>
+<rt><div width=130><p><font color=ff0000>Hello <font shadow=yes>some shadow</font> World</font></p></div></rt>
 

=== modified file 'src/graphic/text/test/data/table_like/input00.txt'
--- src/graphic/text/test/data/table_like/input00.txt	2012-06-20 09:59:07 +0000
+++ src/graphic/text/test/data/table_like/input00.txt	2017-02-23 17:31:14 +0000
@@ -1,16 +1,16 @@
 <rt>
-<sub width=10></sub><sub width=240>
+<div width=10></div><div width=240>
 <p>
-<sub width=80 background=638c57><p>Hello</p></sub><space><sub
-width=80 background=42deb7><p>Nice</p></sub><space><sub
-width=80 background=43f447><p>World</p></sub>
+<div width=80 background=638c57><p>Hello</p></div><space><div
+width=80 background=42deb7><p>Nice</p></div><space><div
+width=80 background=43f447><p>World</p></div>
 <br>
 
-<sub width=80 background=404542 valign=center><p align=center>Upsy</p></sub><space><sub
-width=80 background=e21038><p>And more</p></sub><space><sub
-width=80 background=0c7e8f valign=center><p>Thats all</p></sub>
+<div width=80 background=404542 valign=center><p align=center>Upsy</p></div><space><div
+width=80 background=e21038><p>And more</p></div><space><div
+width=80 background=0c7e8f valign=center><p>Thats all</p></div>
 <br>
 
 </p>
-</sub>
+</div>
 </rt>

=== modified file 'src/wui/waresdisplay.cc'
--- src/wui/waresdisplay.cc	2017-01-25 18:55:59 +0000
+++ src/wui/waresdisplay.cc	2017-02-23 17:31:14 +0000
@@ -426,12 +426,12 @@
 	for (i = order.begin(); i != order.end(); ++i)
 		for (j = i->begin(); j != i->end(); ++j)
 			if ((c = map.find(*j)) != map.end()) {
-				ret += "<sub width=30 padding=2><p align=center>"
-				       "<sub width=26 background=454545><p align=center><img src=\"" +
+				ret += "<div width=30 padding=2><p align=center>"
+				       "<div width=26 background=454545><p align=center><img src=\"" +
 				       tribe.get_ware_descr(c->first)->icon_filename() +
-				       "\"></p></sub><sub width=26 background=000000><p><font size=9>" +
+				       "\"></p></div><div width=26 background=000000><p><font size=9>" +
 				       boost::lexical_cast<std::string>(static_cast<int32_t>(c->second)) +
-				       "</font></p></sub></p></sub>";
+				       "</font></p></div></p></div>";
 			}
 	return ret;
 }


Follow ups