Author: mordante
Date: Thu May 21 21:12:44 2009
New Revision: 35808
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35808&view=rev
Log:
Remove the unused function twidget::layout_use_vertical_scrollbar.
Also remove some exta helpers in tgrid and tgrid::tchild.
Modified:
trunk/src/gui/widgets/container.cpp
trunk/src/gui/widgets/container.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=35808&r1=35807&r2=35808&view=diff
==============================================================================
--- trunk/src/gui/widgets/container.cpp (original)
+++ trunk/src/gui/widgets/container.cpp Thu May 21 21:12:44 2009
@@ -85,40 +85,6 @@
DBG_GUI_L << "tcontainer(" + get_control_type() + "):"
<< " maximum_width " << maximum_width
- << " border size " << border_size
- << " returning " << size
- << ".\n";
-
- set_layout_size(size);
-}
-
-void tcontainer_::layout_use_vertical_scrollbar(const unsigned maximum_height)
-{
- // Inherited.
- twidget::layout_use_vertical_scrollbar(maximum_height);
-
- 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_use_vertical_scrollbar(maximum_height - border_space().y);
- 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_height " << maximum_height
<< " border size " << border_size
<< " returning " << size
<< ".\n";
Modified: trunk/src/gui/widgets/container.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/container.hpp?rev=35808&r1=35807&r2=35808&view=diff
==============================================================================
--- trunk/src/gui/widgets/container.hpp (original)
+++ trunk/src/gui/widgets/container.hpp Thu May 21 21:12:44 2009
@@ -101,9 +101,6 @@
bool has_vertical_scrollbar() const
{ return grid_.has_vertical_scrollbar(); }
- /** Inherited from twidget. */
- void layout_use_vertical_scrollbar(const unsigned maximum_height);
-
/**
* Inherited from twidget.
*
Modified: trunk/src/gui/widgets/grid.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.cpp?rev=35808&r1=35807&r2=35808&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.cpp (original)
+++ trunk/src/gui/widgets/grid.cpp Thu May 21 21:12:44 2009
@@ -512,74 +512,6 @@
return twidget::has_vertical_scrollbar();
}
-void tgrid::layout_use_vertical_scrollbar(const unsigned maximum_height)
-{
- // Inherited.
- twidget::layout_use_vertical_scrollbar(maximum_height);
-
- log_scope2(log_gui_layout, std::string("tgrid ") + __func__);
- DBG_GUI_L << "tgrid: maximum height " << maximum_height << ".\n";
-
- tpoint size = get_best_size();
-
- // If we honoured the size or can't resize return the result.
- if(size.y <= static_cast<int>(maximum_height) ||
!has_vertical_scrollbar()) {
- DBG_GUI_L << "tgrid: maximum height "
- << maximum_height << " returning " << size << ".\n";
- return;
- }
-
- // Try to resize.
-
- // The amount we're too high.
- const unsigned too_high = size.y - maximum_height;
- // The amount we reduced
- unsigned reduced = 0;
- for(size_t y = 0; y < rows_; ++y) {
-
- if(too_high - reduced >= row_height_[y]) {
- DBG_GUI_L << "tgrid: row " << y << " is too small to be
reduced.\n";
- continue;
- }
-
- const unsigned wanted_height = row_height_[y] - (too_high -
reduced);
-
- const unsigned height = row_use_vertical_scrollbar(y,
wanted_height);
-
- if(height < row_height_[y]) {
- DBG_GUI_L << "tgrid: reduced " << row_height_[y] -
height
- << " pixels for row " << y << ".\n";
-
- reduced += row_height_[y] - height;
- row_height_[y] = height;
- }
-
- if(reduced >= too_high) {
- break;
- }
- }
-
- size.y -= reduced;
- if(reduced >= too_high) {
- DBG_GUI_L << "tgrid: maximum height " << maximum_height
- << " need to reduce " << too_high
- << " reduced " << reduced
- << " resizing succeeded returning " << size.y << ".\n";
- } else if(reduced == 0) {
- DBG_GUI_L << "tgrid: maximum height " << maximum_height
- << " need to reduce " << too_high
- << " reduced " << reduced
- << " resizing completely failed returning " << size.y
<< ".\n";
- } else {
- DBG_GUI_L << "tgrid: maximum height " << maximum_height
- << " need to reduce " << too_high
- << " reduced " << reduced
- << " resizing partly failed returning " << size.y <<
".\n";
- }
-
- set_layout_size(calculate_best_size());
-}
-
bool tgrid::has_horizontal_scrollbar() const
{
foreach(const tchild& child, children_) {
@@ -1056,19 +988,6 @@
widget_->layout_wrap(maximum_width - border_space().x);
}
-
-void tgrid::tchild::layout_use_vertical_scrollbar(const unsigned
maximum_height)
-{
-
- assert(widget_);
-
- if(! widget_->has_vertical_scrollbar()) {
- return;
- }
-
- widget_->layout_use_vertical_scrollbar(maximum_height -
border_space().y);
-}
-
void tgrid::tchild::layout_use_horizontal_scrollbar(
const unsigned maximum_width)
{
@@ -1146,31 +1065,6 @@
widget->draw_foreground(frame_buffer);
widget->set_dirty(false);
}
-}
-
-unsigned tgrid::row_use_vertical_scrollbar(
- const unsigned row, const unsigned maximum_height)
-{
- // The minimum height required.
- unsigned required_height = 0;
-
- for(size_t x = 0; x < cols_; ++x) {
- tchild& cell = child(row, x);
- cell.layout_use_vertical_scrollbar(maximum_height);
-
- const tpoint size(cell.get_best_size());
-
- if(required_height == 0
- || static_cast<size_t>(size.y) >
required_height) {
-
- required_height = size.y;
- }
- }
-
- DBG_GUI_L << "tgrid: maximum row height " << maximum_height
- << " returning " << required_height << ".\n";
-
- return required_height;
}
unsigned tgrid::column_use_horizontal_scrollbar(
Modified: trunk/src/gui/widgets/grid.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.hpp?rev=35808&r1=35807&r2=35808&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.hpp (original)
+++ trunk/src/gui/widgets/grid.hpp Thu May 21 21:12:44 2009
@@ -229,9 +229,6 @@
bool has_vertical_scrollbar() const;
/** Inherited from twidget. */
- void layout_use_vertical_scrollbar(const unsigned maximum_height);
-
- /** Inherited from twidget. */
bool has_horizontal_scrollbar() const;
/** Inherited from twidget. */
@@ -325,9 +322,6 @@
/** Forwards layout_wrap() to the cell. */
void layout_wrap(const unsigned maximum_width);
- /** Forwards layout_use_vertical_scrollbar() to the cell. */
- void layout_use_vertical_scrollbar(const unsigned
maximum_height);
-
/** Forwards layout_use_horizontal_scrollbar() to the cell. */
void layout_use_horizontal_scrollbar(const unsigned
maximum_width);
@@ -436,18 +430,6 @@
void impl_draw_children(surface& frame_buffer);
/**
- * Gets the best height for a row.
- *
- * @param row The row to get the best height for.
- * @param maximum_height The wanted maximum height.
- *
- * @returns The best height for a row, if possible
- * smaller as the maximum.
- */
- unsigned row_use_vertical_scrollbar(
- const unsigned row, const unsigned maximum_height);
-
- /**
* Gets the best width for a column.
*
* @param column The column to get the best width for.
Modified: trunk/src/gui/widgets/scrollbar_container.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/scrollbar_container.cpp?rev=35808&r1=35807&r2=35808&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar_container.cpp (original)
+++ trunk/src/gui/widgets/scrollbar_container.cpp Thu May 21 21:12:44 2009
@@ -257,31 +257,6 @@
}
void tscrollbar_container::
- layout_use_vertical_scrollbar(const unsigned maximum_height)
-{
- assert(vertical_scrollbar_grid_);
-
- // Inherited.
- twidget::layout_use_vertical_scrollbar(maximum_height);
-
- tpoint size = get_best_size();
- if(static_cast<unsigned>(size.y) < maximum_height) {
- return;
- }
-
- const tpoint scrollbar_size = vertical_scrollbar_grid_->get_best_size();
- if(maximum_height > static_cast<unsigned>(scrollbar_size.y)) {
- size.y = maximum_height;
- } else {
- size.y = scrollbar_size.y;
- }
-
- // FIXME adjust for the step size of the scrollbar
-
- set_layout_size(size);
-}
-
-void tscrollbar_container::
layout_use_horizontal_scrollbar(const unsigned maximum_width)
{
// Inherited.
Modified: trunk/src/gui/widgets/scrollbar_container.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/scrollbar_container.hpp?rev=35808&r1=35807&r2=35808&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar_container.hpp (original)
+++ trunk/src/gui/widgets/scrollbar_container.hpp Thu May 21 21:12:44 2009
@@ -97,9 +97,6 @@
/** Inherited from twidget (not tcontainer_). */
bool has_vertical_scrollbar() const;
- /** Inherited from tcontainer_. */
- void layout_use_vertical_scrollbar(const unsigned maximum_height);
-
/** Inherited from twidget (not tcontainer_). */
bool has_horizontal_scrollbar() const;
Modified: trunk/src/gui/widgets/widget.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/widget.hpp?rev=35808&r1=35807&r2=35808&view=diff
==============================================================================
--- trunk/src/gui/widgets/widget.hpp (original)
+++ trunk/src/gui/widgets/widget.hpp Thu May 21 21:12:44 2009
@@ -294,18 +294,6 @@
virtual bool has_vertical_scrollbar() const { return false; }
/**
- * Tries to use a vertical scrollbar with the widget.
- *
- * @todo implement this function properly.
- *
- * @param maximum_height The wanted maximum height of the widget.
- *
- * @pre has_vertical_scrollbar() == true.
- */
- virtual void layout_use_vertical_scrollbar(const unsigned
/*maximum_height*/)
- { assert(has_vertical_scrollbar()); }
-
- /**
* 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