Author: ilor
Date: Wed Aug 13 11:27:29 2008
New Revision: 28529

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28529&view=rev
Log:
editor2 resize dialog update

Modified:
    trunk/data/gui/default/window/editor_resize_map.cfg
    trunk/src/gui/dialogs/editor_resize_map.cpp
    trunk/src/gui/dialogs/editor_resize_map.hpp

Modified: trunk/data/gui/default/window/editor_resize_map.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/gui/default/window/editor_resize_map.cfg?rev=28529&r1=28528&r2=28529&view=diff
==============================================================================
--- trunk/data/gui/default/window/editor_resize_map.cfg (original)
+++ trunk/data/gui/default/window/editor_resize_map.cfg Wed Aug 13 11:27:29 2008
@@ -136,114 +136,113 @@
                        [/row]
                        [row]
                                [column]
-                                       [label]
-                                               definition = "default"
-                                               label = _ "Expand / shrink 
direction"
-                                       [/label]
-                               [/column]
-                       [/row]
-                       [row]
-                               [column]
                                        [grid]
                                                [row]
-                                                       grow_factor = 1
-                                                       [column]
-                                                               grow_factor = 0
+                                                       [column]
+                                                               border_size = 5
+                                                               border = "all"
+                                                               [label]
+                                                                       
definition = "default"
+                                                                       label = 
_ "Expand / shrink direction"
+                                                               [/label]
+                                                       [/column]
+                                                       [column]
+                                                               [grid]
+                                                                       [row]
+                                                                               
grow_factor = 1
+                                                                               
[column]
+                                                                               
        grow_factor = 0
+                                                                               
        [toggle_button]
+                                                                               
                id = "expand0"
+                                                                               
                definition = "icon"
+#                                                                              
                label = "Bottom / right"
+                                                                               
        [/toggle_button]
+                                                                               
[/column]
+                                                                               
[column]
+                                                                               
        grow_factor = 0
+                                                                               
        [toggle_button]
+                                                                               
                id = "expand1"
+                                                                               
                definition = "icon"
+#                                                                              
                label = "Bottom / center"
+                                                                               
        [/toggle_button]
+                                                                               
[/column]
+                                                                               
[column]
+                                                                               
        grow_factor = 1
+                                                                               
        horizontal_alignment = "left"
+                                                                               
        [toggle_button]
+                                                                               
                id = "expand2"
+                                                                               
                definition = "icon"
+#                                                                              
                label = "Bottom / left"
+                                                                               
        [/toggle_button]
+                                                                               
[/column]
+                                                                       [/row]
+                                                                       [row]
+                                                                               
grow_factor = 1
+                                                                               
[column]
+                                                                               
        grow_factor = 0
+                                                                               
        [toggle_button]
+                                                                               
                id = "expand3"
+                                                                               
                definition = "icon"
+#                                                                              
                label = "Center / right"
+                                                                               
        [/toggle_button]
+                                                                               
[/column]
+                                                                               
[column]
+                                                                               
        grow_factor = 0
+                                                                               
        [toggle_button]
+                                                                               
                id = "expand4"
+                                                                               
                definition = "icon"
+#                                                                              
                label = "Center"
+                                                                               
        [/toggle_button]
+                                                                               
[/column]
+                                                                               
[column]
+                                                                               
        grow_factor = 1
+                                                                               
        horizontal_alignment = "left"
+                                                                               
        [toggle_button]
+                                                                               
                id = "expand5"
+                                                                               
                definition = "icon"
+#                                                                              
                label = "Center / left"
+                                                                               
        [/toggle_button]
+                                                                               
[/column]
+                                                                       [/row]
+                                                                       [row]
+                                                                               
grow_factor = 1
+                                                                               
[column]
+                                                                               
        grow_factor = 1
+                                                                               
        horizontal_alignment = "left"
+                                                                               
        [toggle_button]
+                                                                               
                id = "expand6"
+                                                                               
                definition = "icon"
+#                                                                              
                label = "Top / right"
+                                                                               
        [/toggle_button]
+                                                                               
[/column]
+                                                                               
[column]
+                                                                               
        grow_factor = 0
+                                                                               
        [toggle_button]
+                                                                               
                id = "expand7"
+                                                                               
                definition = "icon"
+#                                                                              
                label = "Top / center"
+                                                                               
        [/toggle_button]
+                                                                               
[/column]
+                                                                               
[column]
+                                                                               
        grow_factor = 0
+                                                                               
        [toggle_button]
+                                                                               
                id = "expand8"
+                                                                               
                definition = "icon"
+#                                                                              
                label = "Top / left"
+                                                                               
        [/toggle_button]
+                                                                               
[/column]
+                                                                       [/row]
+                                                               [/grid]
+                                                       [/column]
+                                                       [column]
                                                                [toggle_button]
-                                                                       id = 
"expand0"
-                                                                       
definition = "icon"
-#                                                                      label = 
"Bottom / right"
+                                                                       id = 
"copy_edge_terrain"
+                                                                       
definition = "default"
+                                                                       label = 
_ "Copy edge terrain"
                                                                [/toggle_button]
                                                        [/column]
-                                                       [column]
-                                                               grow_factor = 0
-                                                               [toggle_button]
-                                                                       id = 
"expand1"
-                                                                       
definition = "icon"
-#                                                                      label = 
"Bottom / center"
-                                                               [/toggle_button]
-                                                       [/column]
-                                                       [column]
-                                                               grow_factor = 1
-                                                               
horizontal_alignment = "left"
-                                                               [toggle_button]
-                                                                       id = 
"expand2"
-                                                                       
definition = "icon"
-#                                                                      label = 
"Bottom / left"
-                                                               [/toggle_button]
-                                                       [/column]
-                                               [/row]
-                                               [row]
-                                                       grow_factor = 1
-                                                       [column]
-                                                               grow_factor = 0
-                                                               [toggle_button]
-                                                                       id = 
"expand3"
-                                                                       
definition = "icon"
-#                                                                      label = 
"Center / right"
-                                                               [/toggle_button]
-                                                       [/column]
-                                                       [column]
-                                                               grow_factor = 0
-                                                               [toggle_button]
-                                                                       id = 
"expand4"
-                                                                       
definition = "icon"
-#                                                                      label = 
"Center"
-                                                               [/toggle_button]
-                                                       [/column]
-                                                       [column]
-                                                               grow_factor = 1
-                                                               
horizontal_alignment = "left"
-                                                               [toggle_button]
-                                                                       id = 
"expand5"
-                                                                       
definition = "icon"
-#                                                                      label = 
"Center / left"
-                                                               [/toggle_button]
-                                                       [/column]
-                                               [/row]
-                                               [row]
-                                                       grow_factor = 1
-                                                       [column]
-                                                               grow_factor = 1
-                                                               
horizontal_alignment = "left"
-                                                               [toggle_button]
-                                                                       id = 
"expand6"
-                                                                       
definition = "icon"
-#                                                                      label = 
"Top / right"
-                                                               [/toggle_button]
-                                                       [/column]
-                                                       [column]
-                                                               grow_factor = 0
-                                                               [toggle_button]
-                                                                       id = 
"expand7"
-                                                                       
definition = "icon"
-#                                                                      label = 
"Top / center"
-                                                               [/toggle_button]
-                                                       [/column]
-                                                       [column]
-                                                               grow_factor = 0
-                                                               [toggle_button]
-                                                                       id = 
"expand8"
-                                                                       
definition = "icon"
-#                                                                      label = 
"Top / left"
-                                                               [/toggle_button]
-                                                       [/column]
                                                [/row]
                                        [/grid]
-                               [/column]
-                       [/row]                  
-                       [row]
-                               [column]
-                                       grow_factor = 1
-                                       horizontal_grow = "true"
-                                       border = "all"
-                                       border_size = 5
-                                       horizontal_alignment = "right"
-                                       [toggle_button]
-                                               id = "copy_edge_terrain"
-                                               definition = "default"
-                                               label = _ "Copy edge terrain"
-                                       [/toggle_button]
                                [/column]
                        [/row]
                        [row]
@@ -257,7 +256,7 @@
                                                        [column]
                                                                border = "all"
                                                                border_size = 5
-                                                               
horizontal_alignment = "right"
+                                                               
horizontal_alignment = "left"
                                                                [button]
                                                                        id = 
"ok"
                                                                        
definition = "default"

Modified: trunk/src/gui/dialogs/editor_resize_map.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/editor_resize_map.cpp?rev=28529&r1=28528&r2=28529&view=diff
==============================================================================
--- trunk/src/gui/dialogs/editor_resize_map.cpp (original)
+++ trunk/src/gui/dialogs/editor_resize_map.cpp Wed Aug 13 11:27:29 2008
@@ -51,6 +51,8 @@
 teditor_resize_map::teditor_resize_map() :
        map_width_(register_integer("width", false)),
        map_height_(register_integer("height", false)),
+       height_(NULL),
+       width_(NULL),
        copy_edge_terrain_(register_bool("copy_edge_terrain", false)),
        expand_direction_(EXPAND_BOTTOM_RIGHT)
 {
@@ -67,7 +69,7 @@
 }
 
 void teditor_resize_map::set_map_height(int value)
-{ 
+{
        map_height_->set_value(value);
 }
 
@@ -98,10 +100,13 @@
 
 void teditor_resize_map::pre_show(CVideo& /*video*/, twindow& window)
 {
-       tlabel* old_width = 
dynamic_cast<tlabel*>(window.find_widget("old_width", false));
-       VALIDATE(old_width, missing_widget("old_width"));
-       tlabel* old_height = 
dynamic_cast<tlabel*>(window.find_widget("old_height", false));
-       VALIDATE(old_height, missing_widget("old_height"));
+       tlabel* old_width = window.get_widget<tlabel>("old_width", false);
+       tlabel* old_height = window.get_widget<tlabel>("old_height", false);
+       height_ = window.get_widget<tslider>("height", false);
+       width_ = window.get_widget<tslider>("width", false);
+       
+       
height_->set_callback_positioner_move(dialog_callback<teditor_resize_map, 
&teditor_resize_map::update_expand_direction>);
+       
width_->set_callback_positioner_move(dialog_callback<teditor_resize_map, 
&teditor_resize_map::update_expand_direction>);
        old_width->set_label(lexical_cast<std::string>(old_width_));
        old_height->set_label(lexical_cast<std::string>(old_height_));
        
@@ -114,24 +119,16 @@
                        dialog_callback<teditor_resize_map, 
&teditor_resize_map::update_expand_direction>);
        }
        direction_buttons_[0]->set_value(true);
-       
direction_buttons_[0]->set_icon_name("buttons/resize-direction-top-left.png");
-       
direction_buttons_[1]->set_icon_name("buttons/resize-direction-top.png");
-       
direction_buttons_[2]->set_icon_name("buttons/resize-direction-top-right.png");
-       
direction_buttons_[3]->set_icon_name("buttons/resize-direction-left.png");
-       
direction_buttons_[4]->set_icon_name("buttons/resize-direction-center.png");
-       
direction_buttons_[5]->set_icon_name("buttons/resize-direction-right.png");
-       
direction_buttons_[6]->set_icon_name("buttons/resize-direction-bottom-left.png");
-       
direction_buttons_[7]->set_icon_name("buttons/resize-direction-bottom.png");
-       
direction_buttons_[8]->set_icon_name("buttons/resize-direction-bottom-right.png");
+       update_expand_direction(window);
        window.recalculate_size();
 }
 
+/** Convert a coordinate on a 3  by 3 grid to an index, return 9 for out of 
bounds */
 static int resize_grid_xy_to_idx(int x, int y)
 {
        if (x < 0 || x > 2 || y < 0 || y > 2) {
                return 9;
        } else {
-               ERR_GUI << y * 3 + x;
                return y * 3 + x;
        }
 }
@@ -162,11 +159,10 @@
                set_direction_icon(i, "none");
        }
        
-       int xdiff = map_width_->get_value() - old_width_ ;
-       int ydiff = map_height_->get_value() - old_height_ ;
+       int xdiff = map_width_->get_value(window) - old_width_ ;
+       int ydiff = map_height_->get_value(window) - old_height_ ;
        int x = static_cast<int>(expand_direction_) % 3;
        int y = static_cast<int>(expand_direction_) / 3;
-       ERR_GUI << x << " " << y << " " << xdiff << " " << ydiff << "\n";
        set_direction_icon(expand_direction_, "center");
        if (xdiff != 0) {
                int left = resize_grid_xy_to_idx(x - 1, y);
@@ -182,7 +178,7 @@
                set_direction_icon(top, "top");
                set_direction_icon(bottom, "bottom");
        }
-       if (xdiff != 0 || ydiff != 0) {
+       if (xdiff < 0 || ydiff < 0 || (xdiff > 0 && ydiff > 0)) {
                int nw = resize_grid_xy_to_idx(x - 1, y - 1);
                int ne = resize_grid_xy_to_idx(x + 1, y - 1);
                int sw = resize_grid_xy_to_idx(x - 1, y + 1);

Modified: trunk/src/gui/dialogs/editor_resize_map.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/editor_resize_map.hpp?rev=28529&r1=28528&r2=28529&view=diff
==============================================================================
--- trunk/src/gui/dialogs/editor_resize_map.hpp (original)
+++ trunk/src/gui/dialogs/editor_resize_map.hpp Wed Aug 13 11:27:29 2008
@@ -20,6 +20,7 @@
 namespace gui2 {
 
 class ttoggle_button;
+class tslider;
 
 class teditor_resize_map : public tdialog
 {
@@ -58,6 +59,8 @@
         */
        tfield_integer* map_width_;
        tfield_integer* map_height_;
+       tslider* height_;
+       tslider* width_;
        tfield_bool* copy_edge_terrain_;
        ttoggle_button* direction_buttons_[9];
        int old_width_;


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

Reply via email to