Author: mordante
Date: Thu May 21 18:49:59 2009
New Revision: 35798

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35798&view=rev
Log:
Remove the unused function twindow::layout.

Modified:
    trunk/src/gui/widgets/window.cpp
    trunk/src/gui/widgets/window.hpp

Modified: trunk/src/gui/widgets/window.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/window.cpp?rev=35798&r1=35797&r2=35798&view=diff
==============================================================================
--- trunk/src/gui/widgets/window.cpp (original)
+++ trunk/src/gui/widgets/window.cpp Thu May 21 18:49:59 2009
@@ -622,194 +622,6 @@
        assert(linked_size_.find(id) != linked_size_.end());
 
        linked_size_[id].widgets.push_back(widget);
-}
-
-void twindow::layout()
-{
-       /**** Initialize and get initial size. *****/
-
-       boost::intrusive_ptr<const twindow_definition::tresolution> conf =
-               boost::dynamic_pointer_cast<const 
twindow_definition::tresolution>
-               (config());
-       assert(conf);
-
-       log_scope2(log_gui_layout, "Window: Recalculate size");
-
-       layout_init();
-       generate_dot_file("layout_init", LAYOUT);
-
-       const game_logic::map_formula_callable variables =
-               get_screen_size_variables();
-
-       const int maximum_width = automatic_placement_ ?
-                       settings::screen_width :  w_(variables);
-
-       const int maximum_height = automatic_placement_ ?
-                       settings::screen_height :  h_(variables);
-
-       /**
-        * @todo Need to document this new feature in the size algorithm. Also 
the
-        * fixed size only works when a widget doesn't get a second layout 
phase.
-        */
-       // evaluate the group sizes
-       typedef std::pair<const std::string, tlinked_size> hack;
-       foreach(hack& linked_size, linked_size_) {
-
-               tpoint max_size(0, 0);
-
-               // Determine the maximum size.
-               foreach(twidget* widget, linked_size.second.widgets) {
-
-                       const tpoint size = widget->get_best_size();
-
-                       if(size.x > max_size.x) {
-                               max_size.x = size.x;
-                       }
-                       if(size.y > max_size.y) {
-                               max_size.y = size.y;
-                       }
-               }
-
-               // Set the maximum size.
-               foreach(twidget* widget, linked_size.second.widgets) {
-
-                       tpoint size = widget->get_best_size();
-
-                       if(linked_size.second.width) {
-                               size.x = max_size.x;
-                       }
-                       if(linked_size.second.height) {
-                               size.y = max_size.y;
-                       }
-
-                       widget->set_layout_size(size);
-               }
-       }
-
-       tpoint size = get_best_size();
-       generate_dot_file("get_initial_best_size", LAYOUT);
-
-       DBG_GUI_L << "twindow " << __func__ << ": " << size << " maximum size "
-                       << maximum_width << ',' << maximum_height << ".\n";
-
-       /***** Does the width fit in the available width? *****/
-
-       // *** wrap (can change height)
-       if(size.x > maximum_width && can_wrap()) {
-               layout_wrap(maximum_width);
-               size = get_best_size();
-               generate_dot_file("wrapped", LAYOUT);
-       }
-
-       // *** scrollbar (leaves height untouched)
-       if(size.x > maximum_width && has_horizontal_scrollbar()) {
-               layout_use_horizontal_scrollbar(maximum_width);
-               size = get_best_size();
-               generate_dot_file("horizontal_scrollbar", LAYOUT);
-       }
-
-       // *** failed?
-       if(size.x > maximum_width) {
-               ERR_GUI_L << "Failed to resize window, wanted width "
-                       << size.x << " available width "
-                       << maximum_width << ".\n";
-
-               // Fall back to the new layout engine.
-               layout2(maximum_width, maximum_height);
-               size = get_best_size();
-       }
-
-       /***** Does the height fit in the available height? ******/
-
-       // *** scrollbar (leaves width untouched)
-       if(size.y > maximum_height && has_vertical_scrollbar()) {
-               layout_use_vertical_scrollbar(maximum_height);
-               size = get_best_size();
-               generate_dot_file("vertical_scrollbar", LAYOUT);
-       }
-
-       // *** shrink (can change width)
-       if(size.y > maximum_height) {
-               layout_shrink_height(maximum_height);
-               size = get_best_size();
-               generate_dot_file("shrink_height", LAYOUT);
-       }
-
-       // *** failed?
-       if(size.y > maximum_height) {
-               ERR_GUI_L << "Failed to resize window, wanted height "
-                       << size.y << " available height "
-                       << maximum_height << ".\n";
-
-               // Fall back to the new layout engine.
-               layout2(maximum_width, maximum_height);
-               size = get_best_size();
-       }
-
-       if(size.x > maximum_width || size.y > maximum_height) {
-
-               std::stringstream sstr;
-               sstr << __FILE__ << ":" << __LINE__ << " in function '" << 
__func__
-                               << "' found the following problem: Failed to 
size window;"
-                               << " wanted size " << size
-                               << " available size "
-                               << maximum_width << ',' << maximum_height
-                               << " screen size "
-                               << settings::screen_width << ',' << 
settings::screen_height
-                               << '.';
-
-               throw twml_exception(_("Failed to show a dialog, "
-                               "which doesn't fit on the screen."), 
sstr.str());
-       }
-
-       /***** Get the best location for the window *****/
-
-       tpoint origin(0, 0);
-
-       if(automatic_placement_) {
-
-               switch(horizontal_placement_) {
-                       case tgrid::HORIZONTAL_ALIGN_LEFT :
-                               // Do nothing
-                               break;
-                       case tgrid::HORIZONTAL_ALIGN_CENTER :
-                               origin.x = (settings::screen_width - size.x) / 
2;
-                               break;
-                       case tgrid::HORIZONTAL_ALIGN_RIGHT :
-                               origin.x = settings::screen_width - size.x;
-                               break;
-                       default :
-                               assert(false);
-               }
-               switch(vertical_placement_) {
-                       case tgrid::VERTICAL_ALIGN_TOP :
-                               // Do nothing
-                               break;
-                       case tgrid::VERTICAL_ALIGN_CENTER :
-                               origin.y = (settings::screen_height - size.y) / 
2;
-                               break;
-                       case tgrid::VERTICAL_ALIGN_BOTTOM :
-                               origin.y = settings::screen_height - size.y;
-                               break;
-                       default :
-                               assert(false);
-               }
-       } else {
-               origin.x = x_(variables);
-               origin.y = y_(variables);
-
-               size.x = w_(variables);
-               size.y = h_(variables);
-       }
-
-       /***** Set the window size *****/
-       set_size(origin, size);
-
-       generate_dot_file("layout_finished", LAYOUT);
-       need_layout_ = false;
-
-       // The widgets might have moved so set the mouse location properly.
-       init_mouse_location();
 }
 
 void twindow::layout2(

Modified: trunk/src/gui/widgets/window.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/window.hpp?rev=35798&r1=35797&r2=35798&view=diff
==============================================================================
--- trunk/src/gui/widgets/window.hpp (original)
+++ trunk/src/gui/widgets/window.hpp Thu May 21 18:49:59 2009
@@ -456,14 +456,6 @@
        /**
         * Layouts the window.
         *
-        * @deprecated Will be removed after the new layout algorithm is
-        * implemented.
-        */
-       void layout();
-
-       /**
-        * Layouts the window.
-        *
         * This is a new routine which will be used as fallback when the normal
         * layout engine fails. In 1.7 this will become the real layout engine.
         *


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to