Author: mordante
Date: Thu May 21 21:12:49 2009
New Revision: 35809
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35809&view=rev
Log:
Remove the unused function twidget::layout_use_horizontal_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=35809&r1=35808&r2=35809&view=diff
==============================================================================
--- trunk/src/gui/widgets/container.cpp (original)
+++ trunk/src/gui/widgets/container.cpp Thu May 21 21:12:49 2009
@@ -92,40 +92,6 @@
set_layout_size(size);
}
-void tcontainer_::layout_use_horizontal_scrollbar(const unsigned maximum_width)
-{
- // Inherited.
- twidget::layout_use_horizontal_scrollbar(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_use_horizontal_scrollbar(maximum_width - 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_width " << maximum_width
- << " border size " << border_size
- << " returning " << size
- << ".\n";
-
- set_layout_size(size);
-}
-
void tcontainer_::set_size(const tpoint& origin, const tpoint& size)
{
tcontrol::set_size(origin, size);
Modified: trunk/src/gui/widgets/container.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/container.hpp?rev=35809&r1=35808&r2=35809&view=diff
==============================================================================
--- trunk/src/gui/widgets/container.hpp (original)
+++ trunk/src/gui/widgets/container.hpp Thu May 21 21:12:49 2009
@@ -112,9 +112,6 @@
{ return grid_.has_horizontal_scrollbar(); }
/** Inherited from twidget. */
- void layout_use_horizontal_scrollbar(const unsigned maximum_width);
-
- /** Inherited from twidget. */
void set_size(const tpoint& origin, const tpoint& size);
/***** ***** ***** ***** Inherited ***** ***** ***** *****/
Modified: trunk/src/gui/widgets/grid.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.cpp?rev=35809&r1=35808&r2=35809&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.cpp (original)
+++ trunk/src/gui/widgets/grid.cpp Thu May 21 21:12:49 2009
@@ -526,73 +526,6 @@
return twidget::has_horizontal_scrollbar();
}
-void tgrid::layout_use_horizontal_scrollbar(const unsigned maximum_width)
-{
- // Inherited.
- twidget::layout_use_horizontal_scrollbar(maximum_width);
-
- log_scope2(log_gui_layout, std::string("tgrid ") + __func__);
- DBG_GUI_L << "tgrid: maximum width " << maximum_width << ".\n";
-
- tpoint size = get_best_size();
-
- // If we honoured the size or can't resize return the result.
- if(size.x <= static_cast<int>(maximum_width) ||
!has_horizontal_scrollbar()) {
- DBG_GUI_L << "tgrid: maximum width "
- << maximum_width << " returning " << size << ".\n";
- return;
- }
-
- // Try to resize.
-
- // The amount we're too wide.
- const unsigned too_wide = size.x - maximum_width;
- // The amount we reduced
- unsigned reduced = 0;
- for(size_t x = 0; x < cols_; ++x) {
-
- if(too_wide - reduced >= col_width_[x]) {
- DBG_GUI_L << "tgrid: col " << x << " is too small to be
reduced.\n";
- continue;
- }
- const unsigned wanted_width = col_width_[x] - (too_wide -
reduced);
-
- const unsigned width = column_use_horizontal_scrollbar(x,
wanted_width);
-
- if(width < col_width_[x]) {
- DBG_GUI_L << "tgrid: reduced " << col_width_[x] - width
- << " pixels for column " << x << ".\n";
-
- reduced += col_width_[x] - width;
- col_width_[x] = width;
- }
-
- if(reduced >= too_wide) {
- break;
- }
- }
-
- size.x -= reduced;
- if(reduced >= too_wide) {
- DBG_GUI_L << "tgrid: maximum width " << maximum_width
- << " need to reduce " << too_wide
- << " reduced " << reduced
- << " resizing succeeded returning " << size.x << ".\n";
- } else if(reduced == 0) {
- DBG_GUI_L << "tgrid: maximum width " << maximum_width
- << " need to reduce " << too_wide
- << " reduced " << reduced
- << " resizing completely failed returning " << size.x
<< ".\n";
- } else {
- DBG_GUI_L << "tgrid: maximum width " << maximum_width
- << " need to reduce " << too_wide
- << " reduced " << reduced
- << " resizing partly failed returning " << size.x <<
".\n";
- }
-
- set_layout_size(calculate_best_size());
-}
-
void tgrid::set_size(const tpoint& origin, const tpoint& size)
{
log_scope2(log_gui_layout, "tgrid: set size");
@@ -988,20 +921,6 @@
widget_->layout_wrap(maximum_width - border_space().x);
}
-void tgrid::tchild::layout_use_horizontal_scrollbar(
- const unsigned maximum_width)
-{
-
- assert(widget_);
-
- if(! widget_->has_horizontal_scrollbar()) {
- return;
- }
-
- widget_->layout_use_horizontal_scrollbar(
- maximum_width - border_space().x);
-}
-
const std::string& tgrid::tchild::id() const
{
assert(widget_);
@@ -1065,31 +984,6 @@
widget->draw_foreground(frame_buffer);
widget->set_dirty(false);
}
-}
-
-unsigned tgrid::column_use_horizontal_scrollbar(
- const unsigned column, const unsigned maximum_width)
-{
- // The minimum width required.
- unsigned required_width = 0;
-
- for(size_t y = 0; y < rows_; ++y) {
- tchild& cell = child(y, column);
- cell.layout_use_horizontal_scrollbar(maximum_width);
-
- const tpoint size(cell.get_best_size());
-
- if(required_width == 0
- || static_cast<size_t>(size.x) >
required_width) {
-
- required_width = size.x;
- }
- }
-
- DBG_GUI_L << "tgrid: maximum column width " << maximum_width
- << " returning " << required_width << ".\n";
-
- return required_width;
}
unsigned tgrid_implementation::NEW_row_request_reduce_height(tgrid& grid,
Modified: trunk/src/gui/widgets/grid.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.hpp?rev=35809&r1=35808&r2=35809&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.hpp (original)
+++ trunk/src/gui/widgets/grid.hpp Thu May 21 21:12:49 2009
@@ -231,9 +231,6 @@
/** Inherited from twidget. */
bool has_horizontal_scrollbar() const;
- /** Inherited from twidget. */
- void layout_use_horizontal_scrollbar(const unsigned maximum_width);
-
public:
/** Inherited from twidget. */
void set_size(const tpoint& origin, const tpoint& size);
@@ -322,9 +319,6 @@
/** Forwards layout_wrap() to the cell. */
void layout_wrap(const unsigned maximum_width);
- /** Forwards layout_use_horizontal_scrollbar() to the cell. */
- void layout_use_horizontal_scrollbar(const unsigned
maximum_width);
-
/** Returns the id of the widget/ */
const std::string& id() const;
@@ -429,18 +423,6 @@
/** Inherited from twidget. */
void impl_draw_children(surface& frame_buffer);
- /**
- * Gets the best width for a column.
- *
- * @param column The column to get the best width for.
- * @param maximum_width The wanted maximum width.
- *
- * @returns The best width for a column, if possible
- * smaller as the maximum.
- */
- unsigned column_use_horizontal_scrollbar(
- const unsigned column, const unsigned maximum_width);
-
};
} // namespace gui2
Modified: trunk/src/gui/widgets/scrollbar_container.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/scrollbar_container.cpp?rev=35809&r1=35808&r2=35809&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar_container.cpp (original)
+++ trunk/src/gui/widgets/scrollbar_container.cpp Thu May 21 21:12:49 2009
@@ -256,19 +256,6 @@
return is_visible() && horizontal_scrollbar_mode_ != always_invisible;
}
-void tscrollbar_container::
- layout_use_horizontal_scrollbar(const unsigned maximum_width)
-{
- // Inherited.
- twidget::layout_use_horizontal_scrollbar(maximum_width);
-
- tpoint size = get_best_size();
-
- size.x = maximum_width;
-
- set_layout_size(size);
-}
-
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=35809&r1=35808&r2=35809&view=diff
==============================================================================
--- trunk/src/gui/widgets/scrollbar_container.hpp (original)
+++ trunk/src/gui/widgets/scrollbar_container.hpp Thu May 21 21:12:49 2009
@@ -100,9 +100,6 @@
/** Inherited from twidget (not tcontainer_). */
bool has_horizontal_scrollbar() const;
- /** Inherited from tcontainer_. */
- void layout_use_horizontal_scrollbar(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=35809&r1=35808&r2=35809&view=diff
==============================================================================
--- trunk/src/gui/widgets/widget.hpp (original)
+++ trunk/src/gui/widgets/widget.hpp Thu May 21 21:12:49 2009
@@ -271,16 +271,6 @@
virtual bool has_horizontal_scrollbar() const { return false; }
/**
- * Tries to use a horizontal scrollbar with the widget.
- *
- * @param maximum_width The wanted maximum width of the widget.
- *
- * @pre has_horizontal_scrollbar() == true.
- */
- virtual void layout_use_horizontal_scrollbar(const unsigned
/*maximum_width*/)
- { assert(has_horizontal_scrollbar()); }
-
- /**
* Does the widget have a vertical scrollbar.
*
* We want to use the best size for a widget, when the best size for all
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits