Author: mordante
Date: Sat Nov 22 23:11:42 2008
New Revision: 30983
URL: http://svn.gna.org/viewcvs/wesnoth?rev=30983&view=rev
Log:
Remove the caching of the widget id.
The widget can change it's id without notifying the parent container and
thus getting the ids out of sync. To avoid that the caching has been
removed.
Modified:
trunk/src/gui/widgets/grid.cpp
trunk/src/gui/widgets/grid.hpp
Modified: trunk/src/gui/widgets/grid.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.cpp?rev=30983&r1=30982&r2=30983&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.cpp (original)
+++ trunk/src/gui/widgets/grid.cpp Sat Nov 22 23:11:42 2008
@@ -80,7 +80,6 @@
cell.set_widget(widget);
if(cell.widget()) {
// make sure the new child is valid before deferring
- cell.set_id(cell.widget()->id());
cell.widget()->set_parent(this);
// Init the easy close state here, normally when put in a grid
the grid
@@ -92,8 +91,6 @@
&& control->get_active()
&& control->does_block_easy_close());
}
- } else {
- cell.set_id("");
}
clear_cache();
@@ -130,7 +127,6 @@
widget->set_parent(this);
child.set_widget(widget);
- child.set_id(widget->id());
return old;
}
@@ -144,7 +140,6 @@
tchild& cell = child(row, col);
- cell.set_id("");
if(cell.widget()) {
delete cell.widget();
}
@@ -158,7 +153,6 @@
itor != children_.end(); ++itor) {
if(itor->id() == id) {
- itor->set_id("");
if(itor->widget()) {
delete itor->widget();
}
@@ -891,6 +885,12 @@
widget_->layout_use_vertical_scrollbar(maximum_height -
border_space().y);
+}
+
+const std::string& tgrid::tchild::id() const
+{
+ assert(widget_);
+ return widget_->id();
}
tpoint tgrid::tchild::border_space() const
Modified: trunk/src/gui/widgets/grid.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.hpp?rev=30983&r1=30982&r2=30983&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.hpp (original)
+++ trunk/src/gui/widgets/grid.hpp Sat Nov 22 23:11:42 2008
@@ -254,7 +254,6 @@
{
public:
tchild() :
- id_(),
flags_(0),
border_size_(0),
widget_(0),
@@ -284,8 +283,8 @@
/** Forwards layout_use_vertical_scrollbar() to the cell. */
void layout_use_vertical_scrollbar(const unsigned
maximum_height);
- const std::string& id() const { return id_; }
- void set_id(const std::string& id) { id_ = id; }
+ /** Returns the id of the widget/ */
+ const std::string& id() const;
unsigned get_flags() const { return flags_; }
void set_flags(const unsigned flags) { flags_ = flags;
set_dirty(); }
@@ -300,9 +299,6 @@
void set_widget(twidget* widget) { widget_ = widget;
set_dirty(); }
private:
- /** The id of the widget if it has a widget. */
- std::string id_;
-
/** The flags for the border and cell setup. */
unsigned flags_;
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits