Author: mordante
Date: Thu May 21 21:13:05 2009
New Revision: 35812
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35812&view=rev
Log:
Remove the unused function twidget::layout_wrap.
Also remove the forwarded function in tgrid::tchild.
Modified:
trunk/src/gui/widgets/container.cpp
trunk/src/gui/widgets/container.hpp
trunk/src/gui/widgets/control.cpp
trunk/src/gui/widgets/control.hpp
trunk/src/gui/widgets/grid.cpp
trunk/src/gui/widgets/grid.hpp
trunk/src/gui/widgets/scrollbar_container.cpp
trunk/src/gui/widgets/scrollbar_container.hpp
trunk/src/gui/widgets/widget.hpp
Modified: trunk/src/gui/widgets/container.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/container.cpp?rev=35812&r1=35811&r2=35812&view=diff
==============================================================================
--- trunk/src/gui/widgets/container.cpp (original)
+++ trunk/src/gui/widgets/container.cpp Thu May 21 21:13:05 2009
@@ -56,40 +56,6 @@
void tcontainer_::NEW_demand_reduce_height(const unsigned maximum_height)
{
grid_.NEW_demand_reduce_height(maximum_height - border_space().y);
-}
-
-void tcontainer_::layout_wrap(const unsigned maximum_width)
-{
- // Inherited.
- twidget::layout_wrap(maximum_width);
-
- log_scope2(log_gui_layout, "tcontainer(" + get_control_type() + ") " +
__func__);
-
- // We need a copy and adjust if for the borders, no use to ask the grid
for
- // the best size if it won't fit in the end due to our borders.
- const tpoint border_size = border_space();
-
- // Calculate the best size
- grid_.layout_wrap(maximum_width - border_space().x);
- tpoint size = grid_.get_best_size();
-
- // If the best size has a value of 0 it's means no limit so don't add
the
- // border_size might set a very small best size.
- if(size.x) {
- size.x += border_size.x;
- }
-
- if(size.y) {
- size.y += border_size.y;
- }
-
- DBG_GUI_L << "tcontainer(" + get_control_type() + "):"
- << " maximum_width " << maximum_width
- << " border size " << border_size
- << " returning " << size
- << ".\n";
-
- set_layout_size(size);
}
void tcontainer_::set_size(const tpoint& origin, const tpoint& size)
Modified: trunk/src/gui/widgets/container.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/container.hpp?rev=35812&r1=35811&r2=35812&view=diff
==============================================================================
--- trunk/src/gui/widgets/container.hpp (original)
+++ trunk/src/gui/widgets/container.hpp Thu May 21 21:13:05 2009
@@ -89,9 +89,6 @@
bool can_wrap() const { return grid_.can_wrap() || twidget::can_wrap();
}
/** Inherited from twidget. */
- void layout_wrap(const unsigned maximum_width);
-
- /** Inherited from twidget. */
void set_size(const tpoint& origin, const tpoint& size);
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
Modified: trunk/src/gui/widgets/control.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/control.cpp?rev=35812&r1=35811&r2=35812&view=diff
==============================================================================
--- trunk/src/gui/widgets/control.cpp (original)
+++ trunk/src/gui/widgets/control.cpp Thu May 21 21:13:05 2009
@@ -155,35 +155,6 @@
} else {
DBG_GUI_L << "tcontrol(" + get_control_type() + ") " + __func__
+ ":"
<< " failed; either no label or wrapping not
allowed.\n";
- }
-}
-
-void tcontrol::layout_wrap(const unsigned maximum_width)
-{
- // Inherited.
- twidget::layout_wrap(maximum_width);
-
- assert(config_);
-
- if(label_.empty()) {
- // FIXME see what to do on an empty label later.
- return;
- } else {
-
- tpoint size = get_best_text_size(
- tpoint(0,0),
- tpoint(maximum_width -
config_->text_extra_width, 0));
-
- size.x += config_->text_extra_width;
- size.y += config_->text_extra_height;
-
- set_layout_size(size);
-
- DBG_GUI_L << "tcontrol(" + get_control_type() + ") " + __func__
+ ":"
- << " maximum_width " << maximum_width
- << " result " << size
- << ".\n";
-
}
}
Modified: trunk/src/gui/widgets/control.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/control.hpp?rev=35812&r1=35811&r2=35812&view=diff
==============================================================================
--- trunk/src/gui/widgets/control.hpp (original)
+++ trunk/src/gui/widgets/control.hpp Thu May 21 21:13:05 2009
@@ -155,9 +155,6 @@
/** Inherited from twidget. */
void NEW_request_reduce_width(const unsigned maximum_width);
- /** Inherited from twidget. */
- void layout_wrap(const unsigned maximum_width);
-
protected:
/** Inherited from twidget. */
tpoint calculate_best_size() const;
Modified: trunk/src/gui/widgets/grid.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.cpp?rev=35812&r1=35811&r2=35812&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.cpp (original)
+++ trunk/src/gui/widgets/grid.cpp Thu May 21 21:13:05 2009
@@ -396,106 +396,6 @@
// Inherited.
return twidget::can_wrap();
-}
-
-void tgrid::layout_wrap(const unsigned maximum_width)
-{
- // Inherited.
- twidget::layout_wrap(maximum_width);
-
- /*
- * 1. Test the width of (every) row.
- * 2. Row wider as wanted?
- * - No goto 3
- * - Yes
- * 2.1 Test every column in the row.
- * 2.2 Can be resized?
- * - No goto 2.1.
- * - Yes can be sized small enough?
- * - No FAILURE.
- * - Yes goto 3.
- * 2.3 Last column?
- * - No goto 2.1
- * - Yes FAILURE.
- * 3. Last row?
- * - No goto 1.
- * - Yes SUCCESS.
- */
-
- log_scope2(log_gui_layout, std::string("tgrid ") + __func__);
- DBG_GUI_L << "tgrid: maximum_width " << maximum_width << ".\n";
-
- std::vector<int> widths(cols_);
- for(unsigned row = 0; row < rows_; ++row) {
-
- for(unsigned col = 0; col < cols_; ++col) {
-
- widths[col] = (child(row, col).get_best_size()).x;
- }
-
- if(std::accumulate(widths.begin(), widths.end(), 0) >
- static_cast<int>(maximum_width)) {
-
- DBG_GUI_L << "tgrid: row " << row << " out of bounds
needs "
- << std::accumulate(widths.begin(),
widths.end(), 0)
- << " available " << maximum_width
- << ", try to resize.\n";
- log_scope2(log_gui_layout, "tgrid: testing all
columns");
-
- int width = 0;
- for(unsigned col = 0; col < cols_; ++col) {
-
- log_scope2(log_gui_layout, "tgrid: column "
- + lexical_cast<std::string>(col));
-
- tchild& chld = child(row, col);
-
- if(!chld.can_wrap()) {
- DBG_GUI_L << "tgrid: column can't wrap,
skip.\n";
- continue;
- }
-
- if(widths[col] == 0) {
- DBG_GUI_L << "tgrid: column has zero
width, skip.\n";
- }
-
- width = widths[col];
- widths[col] = 0;
-
- const int widget_width = maximum_width
- - std::accumulate(widths.begin(),
widths.end(), 0);
-
- if(widget_width <=0) {
-
- DBG_GUI_L << "tgrid: column is too
small to resize, skip.\n";
- widths[col] = width;
- width = 0;
- continue;
- }
-
- chld.layout_wrap(widget_width);
-
- if(chld.get_best_size().x <= widget_width) {
-
- DBG_GUI_L << "tgrid: column resize
succeeded.\n";
- break;
- }
-
- DBG_GUI_L << "tgrid: column resize failed.\n";
- widths[col] = width;
- width = 0;
- }
-
- if(width == 0) {
- DBG_GUI_L << "tgrid: no solution found.\n";
- return;
- }
- } else {
- DBG_GUI_L << "tgrid: row " << row << " in bounds.\n";
- }
- }
-
- DBG_GUI_L << "tgrid: found solution.\n";
}
void tgrid::set_size(const tpoint& origin, const tpoint& size)
@@ -880,17 +780,6 @@
if(widget_->get_visible() != twidget::INVISIBLE) {
widget_->NEW_layout_init(full_initialization);
}
-}
-
-void tgrid::tchild::layout_wrap(const unsigned maximum_width)
-{
- assert(widget_);
-
- if(! widget_->can_wrap()) {
- return;
- }
-
- widget_->layout_wrap(maximum_width - border_space().x);
}
const std::string& tgrid::tchild::id() const
Modified: trunk/src/gui/widgets/grid.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.hpp?rev=35812&r1=35811&r2=35812&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.hpp (original)
+++ trunk/src/gui/widgets/grid.hpp Thu May 21 21:13:05 2009
@@ -222,9 +222,6 @@
/** Inherited from twidget. */
bool can_wrap() const;
- /** Inherited from twidget. */
- void layout_wrap(const unsigned maximum_width);
-
public:
/** Inherited from twidget. */
void set_size(const tpoint& origin, const tpoint& size);
@@ -310,9 +307,6 @@
bool can_wrap() const
{ return widget_ ? widget_->can_wrap() : false; }
- /** Forwards layout_wrap() to the cell. */
- void layout_wrap(const unsigned maximum_width);
-
/** Returns the id of the widget/ */
const std::string& id() const;
Modified: trunk/src/gui/widgets/scrollbar_container.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/scrollbar_container.cpp?rev=35812&r1=35811&r2=35812&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar_container.cpp (original)
+++ trunk/src/gui/widgets/scrollbar_container.cpp Thu May 21 21:13:05 2009
@@ -229,19 +229,6 @@
set_layout_size(size);
}
-void tscrollbar_container::layout_wrap(const unsigned maximum_width)
-{
- // Inherited.
- twidget::layout_wrap(maximum_width);
-
- assert(content_grid_ && vertical_scrollbar_grid_);
- const unsigned offset = vertical_scrollbar_mode_ == always_invisible
- ? 0
- : vertical_scrollbar_grid_->get_best_size().x;
-
- content_grid_->layout_wrap(maximum_width - offset);
-}
-
tpoint tscrollbar_container::calculate_best_size() const
{
log_scope2(log_gui_layout,
Modified: trunk/src/gui/widgets/scrollbar_container.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/scrollbar_container.hpp?rev=35812&r1=35811&r2=35812&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar_container.hpp (original)
+++ trunk/src/gui/widgets/scrollbar_container.hpp Thu May 21 21:13:05 2009
@@ -91,9 +91,6 @@
: false;
}
- /** Inherited from twidget (not tcontainer_). */
- void layout_wrap(const unsigned maximum_width);
-
private:
/** Inherited from tcontainer_. */
tpoint calculate_best_size() const;
Modified: trunk/src/gui/widgets/widget.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/widget.hpp?rev=35812&r1=35811&r2=35812&view=diff
==============================================================================
--- trunk/src/gui/widgets/widget.hpp (original)
+++ trunk/src/gui/widgets/widget.hpp Thu May 21 21:13:05 2009
@@ -250,18 +250,6 @@
virtual bool can_wrap() const { return false; }
/**
- * Wraps the contents of the widget.
- *
- * @todo implement this function properly.
- *
- * @param maximum_width The wanted maximum width of the widget.
- *
- * @pre can_wrap() == true.
- */
- virtual void layout_wrap(const unsigned /*maximum_width*/)
- { assert(can_wrap()); }
-
- /**
* Sets the size of the widget.
*
* @param origin The position of top left of the widget.
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits