Author: mordante
Date: Sat Jul 12 18:54:13 2008
New Revision: 27940

URL: http://svn.gna.org/viewcvs/wesnoth?rev=27940&view=rev
Log:
The bug fixed in r27911 uncovered some other listbox related bugs. 
This commit fixes the showing of the server list which died of an assertion
failure due to alignment flags missing. Also if set to grow alignment for that
direction is no longer needed.

The bug loonycyborg discovered with the language selection isn't fixed yet.

Modified:
    trunk/src/gui/widgets/grid.cpp
    trunk/src/gui/widgets/window_builder.cpp

Modified: trunk/src/gui/widgets/grid.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.cpp?rev=27940&r1=27939&r2=27940&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.cpp (original)
+++ trunk/src/gui/widgets/grid.cpp Sat Jul 12 18:54:13 2008
@@ -614,6 +614,35 @@
        tpoint widget_size = best_size;
        tpoint widget_orig = orig;
 
+       if(flags_ & VERTICAL_GROW_SEND_TO_CLIENT) {
+               if(maximum_size.y) {
+                       widget_size.y = std::min(size.y, maximum_size.y);
+               } else {
+                       widget_size.y = size.y;
+               }
+               DBG_G << "Grid cell: vertical growing from " 
+                       << best_size.y << " to " << widget_size.y << ".\n";
+
+       } else if((flags_ & VERTICAL_ALIGN_TOP) == VERTICAL_ALIGN_TOP) {
+               // Do nothing.
+               
+               DBG_G << "Grid cell: vertically aligned at the top.\n";
+
+       } else if((flags_ & VERTICAL_ALIGN_CENTER) == VERTICAL_ALIGN_CENTER) {
+               
+               widget_orig.y += (size.y - widget_size.y) / 2;
+               DBG_G << "Grid cell: vertically centred.\n";
+
+       } else if((flags_ & VERTICAL_ALIGN_BOTTOM) == VERTICAL_ALIGN_BOTTOM) {
+
+               widget_orig.y += (size.y - widget_size.y);
+               DBG_G << "Grid cell: vertically aligned at the bottom.\n";
+
+       } else {
+               ERR_G << "Grid cell: No vertical alignment specified.\n";
+               assert(false);
+       }
+       
        if(flags_ & HORIZONTAL_GROW_SEND_TO_CLIENT) {
                if(maximum_size.x) {
                        widget_size.x = std::min(size.x, maximum_size.x);
@@ -622,38 +651,8 @@
                }
                DBG_G << "Grid cell: horizontal growing from " 
                        << best_size.x << " to " << widget_size.x << ".\n";
-       }
-
-       if(flags_ & VERTICAL_GROW_SEND_TO_CLIENT) {
-               if(maximum_size.y) {
-                       widget_size.y = std::min(size.y, maximum_size.y);
-               } else {
-                       widget_size.y = size.y;
-               }
-               DBG_G << "Grid cell: vertical growing from " 
-                       << best_size.y << " to " << widget_size.y << ".\n";
-       }
-
-       if((flags_ & VERTICAL_ALIGN_TOP) == VERTICAL_ALIGN_TOP) {
-               // Do nothing.
-               
-               DBG_G << "Grid cell: vertically aligned at the top.\n";
-
-       } else if((flags_ & VERTICAL_ALIGN_CENTER) == VERTICAL_ALIGN_CENTER) {
-               
-               widget_orig.y += (size.y - widget_size.y) / 2;
-               DBG_G << "Grid cell: vertically centred.\n";
-
-       } else if((flags_ & VERTICAL_ALIGN_BOTTOM) == VERTICAL_ALIGN_BOTTOM) {
-
-               widget_orig.y += (size.y - widget_size.y);
-               DBG_G << "Grid cell: vertically aligned at the bottom.\n";
-
-       } else {
-               assert(false);
-       }
-       
-       if((flags_ & HORIZONTAL_ALIGN_LEFT) == HORIZONTAL_ALIGN_LEFT) {
+
+       } else if((flags_ & HORIZONTAL_ALIGN_LEFT) == HORIZONTAL_ALIGN_LEFT) {
                // Do nothing.
                DBG_G << "Grid cell: horizontally aligned at the left.\n";
 
@@ -668,6 +667,7 @@
                DBG_G << "Grid cell: horizontally aligned at the right.\n";
 
        } else {
+               ERR_G << "Grid cell: No horizontal alignment specified.\n";
                assert(false);
        }
 

Modified: trunk/src/gui/widgets/window_builder.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/window_builder.cpp?rev=27940&r1=27939&r2=27940&view=diff
==============================================================================
--- trunk/src/gui/widgets/window_builder.cpp (original)
+++ trunk/src/gui/widgets/window_builder.cpp Sat Jul 12 18:54:13 2008
@@ -907,7 +907,8 @@
                         * We need sort indicators, which are tristat_buttons;
                         * none, acending, decending. Once we have them we can 
write them in.
                         */
-                       grid->set_child(widget, 0, 0, 
tgrid::HORIZONTAL_GROW_SEND_TO_CLIENT, 0);
+                       grid->set_child(widget, 0, 0, 
tgrid::HORIZONTAL_GROW_SEND_TO_CLIENT 
+                               | tgrid::VERTICAL_ALIGN_TOP, 0);
                }
 
                // Create and add the footer.
@@ -916,13 +917,14 @@
                        assert(widget);
 
                        grid->set_child(widget, header && footer ? 2 : 1, 0, 
-                               tgrid::HORIZONTAL_GROW_SEND_TO_CLIENT, 0);
+                               tgrid::HORIZONTAL_GROW_SEND_TO_CLIENT
+                               | tgrid::VERTICAL_ALIGN_BOTTOM, 0);
                }
 
                // Add the list itself.
                grid->set_child(list_area, header ? 1 : 0, 0, 
                        tgrid::HORIZONTAL_GROW_SEND_TO_CLIENT 
-                       | tgrid::HORIZONTAL_GROW_SEND_TO_CLIENT
+                       | tgrid::VERTICAL_GROW_SEND_TO_CLIENT
                        , 0);
 
                // Now make the list_area the grid so the code with and without 
a header
@@ -934,13 +936,10 @@
        listbox->grid().set_child(list_area, 0, 0, 
                tgrid::VERTICAL_GROW_SEND_TO_CLIENT 
                | tgrid::HORIZONTAL_GROW_SEND_TO_CLIENT 
-               | tgrid::VERTICAL_ALIGN_CENTER
-               | tgrid::HORIZONTAL_ALIGN_CENTER
                , 0);
        listbox->grid().set_col_grow_factor(0, 1);
        listbox->grid().set_child(scrollbar, 0, 1, 
                tgrid::VERTICAL_GROW_SEND_TO_CLIENT
-               | tgrid::VERTICAL_ALIGN_CENTER
                | tgrid::HORIZONTAL_ALIGN_CENTER
                , 0);
 


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

Reply via email to