mail[Wesnoth-commits] r28341 - in /trunk/src/gui: dialogs/mp_create_game.cpp widgets/grid.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by koraq on August 06, 2008 - 16:06:
Author: mordante
Date: Wed Aug  6 14:20:21 2008
New Revision: 28341

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28341&view=rev
Log:
Make the grid handle multiple columns with 1 resizable item better.
The limit for the mp_create_game dialog is the width of the name of a map.

Modified:
    trunk/src/gui/dialogs/mp_create_game.cpp
    trunk/src/gui/widgets/grid.cpp

Modified: trunk/src/gui/dialogs/mp_create_game.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/mp_create_game.cpp?rev=28341&r1=28340&r2=28341&view=diff
==============================================================================
--- trunk/src/gui/dialogs/mp_create_game.cpp (original)
+++ trunk/src/gui/dialogs/mp_create_game.cpp Wed Aug  6 14:20:21 2008
@@ -134,10 +134,9 @@
                        item.insert(std::make_pair("tooltip", 
(*map)["name"]));
                        list->add_row(item);
 
-                       // This hack is needed since the resize code can't 
handle this
-                       // window properly, it has 3 columns which seems to 
fail in the
-                       // resize code.
-                       if(++i == 10) {
+                       // This hack is needed since the next item is too 
wide to fit.
+                       // and the scrollbar can't truncate text yet.
+                       if(++i == 46) {
                                break;
                        }
                }

Modified: trunk/src/gui/widgets/grid.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.cpp?rev=28341&r1=28340&r2=28341&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.cpp (original)
+++ trunk/src/gui/widgets/grid.cpp Wed Aug  6 14:20:21 2008
@@ -475,24 +475,11 @@
        if((best_size.x <= size.x /*|| has_horizontal_scrollbar()*/) 
                        && (best_size.y <= size.y || 
has_vertical_scrollbar())) {
 
-               // FIXME we only do the height atm, the width will be added 
when needed.
-               const unsigned over_shoot = best_size.y - size.y;
-
-               bool set = false;
+               tpoint new_size = get_best_size(size);
+               assert(new_size <= size);
+
                row_height_ = best_row_height_;
                col_width_ = best_col_width_;
-               // FIXME we assume 1 item per row.
-               for(unsigned i = 0; i < rows_; ++i) {
-                       twidget* row = widget(i, 0);
-                       if(row && row->has_vertical_scrollbar()) {
-                               row_height_[i] -= over_shoot; // Assume this 
row can be resized enough
-                               set = true;
-                               break;
-                       }
-                       
-               }
-
-               assert(set);
                layout(orig);
                return;
        }




Related Messages


Powered by MHonArc, Updated Thu Aug 07 08:01:35 2008