mail[Wesnoth-commits] r28380 - in /trunk: data/gui/default/window/ src/editor2/ src/gui/dialogs/


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

Header


Content

Posted by kailoran on August 08, 2008 - 19:23:
Author: ilor
Date: Fri Aug  8 19:23:13 2008
New Revision: 28380

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28380&view=rev
Log:
editor2 resize dialog update, some misc cleanup. The dialog is not stable atm.

Modified:
    trunk/data/gui/default/window/editor_resize_map.cfg
    trunk/src/editor2/editor_controller.cpp
    trunk/src/editor2/editor_map.cpp
    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=28380&r1=28379&r2=28380&view=diff
==============================================================================
--- trunk/data/gui/default/window/editor_resize_map.cfg (original)
+++ trunk/data/gui/default/window/editor_resize_map.cfg Fri Aug  8 19:23:13 
2008
@@ -53,6 +53,7 @@
                                                                [slider]
                                                                    id = 
"width"
                                                                    
definition = "default"
+                                                                   
best_slider_length = 200
                                                                    
minimum_value = 1
                                                                    
maximum_value = 200
                                                                    step_size 
= 1
@@ -76,6 +77,7 @@
                                                                [label]
                                                                        id = 
"old_width"
                                                                        
definition = "default"
+                                                                       
size_text = _ "2000"
                                                                        label 
= _ "-1"
                                                                [/label]
                                                        [/column]             
                                                                          
@@ -100,6 +102,7 @@
                                                                [slider]
                                                                    id = 
"height"
                                                                    
definition = "default"
+                                                                   
best_slider_length = 200
                                                                    
minimum_value = 1
                                                                    
maximum_value = 200
                                                                    step_size 
= 1
@@ -123,6 +126,7 @@
                                                                [label]
                                                                        id = 
"old_height"
                                                                        
definition = "default"
+                                                                       
size_text = _ "2000"
                                                                        label 
= _ "-1"
                                                                [/label]
                                                        [/column]             
                                                                              
                                                    

Modified: trunk/src/editor2/editor_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.cpp?rev=28380&r1=28379&r2=28380&view=diff
==============================================================================
--- trunk/src/editor2/editor_controller.cpp (original)
+++ trunk/src/editor2/editor_controller.cpp Fri Aug  8 19:23:13 2008
@@ -220,7 +220,6 @@
                }
        }
        if (!confirm_discard()) return;
-       if (!confirm_discard()) return;
        gui2::teditor_generate_map dialog;
        dialog.show(gui().video());
        if (map_generator_->allow_user_config()) {
@@ -233,6 +232,8 @@
        gui2::teditor_resize_map dialog;
        dialog.set_map_width(get_map().total_width());
        dialog.set_map_height(get_map().total_height());
+       dialog.set_old_map_width(get_map().total_width());
+       dialog.set_old_map_height(get_map().total_height());
        
        dialog.show(gui().video());
        int res = dialog.get_retval();
@@ -489,7 +490,6 @@
                        generate_map_dialog();
                        return true;
                case HOTKEY_EDITOR_MAP_RESIZE:
-                       std::cerr << "A";
                        resize_map_dialog();
                        return true;
                case HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS:

Modified: trunk/src/editor2/editor_map.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_map.cpp?rev=28380&r1=28379&r2=28380&view=diff
==============================================================================
--- trunk/src/editor2/editor_map.cpp (original)
+++ trunk/src/editor2/editor_map.cpp Fri Aug  8 19:23:13 2008
@@ -153,8 +153,8 @@
 void editor_map::resize(int width, int height, int x_offset, int y_offset,
        t_translation::t_terrain filler)
 {
-       int old_w = w();
-       int old_h = h();
+       int old_w = total_width();
+       int old_h = total_height();
        if (old_w == width && old_h == height && x_offset == 0 && y_offset == 
0) {
                return;
        }

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=28380&r1=28379&r2=28380&view=diff
==============================================================================
--- trunk/src/gui/dialogs/editor_resize_map.cpp (original)
+++ trunk/src/gui/dialogs/editor_resize_map.cpp Fri Aug  8 19:23:13 2008
@@ -17,6 +17,7 @@
 #include "foreach.hpp"
 #include "gui/dialogs/field.hpp"
 #include "gui/widgets/button.hpp"
+#include "gui/widgets/label.hpp"
 #include "gui/widgets/listbox.hpp"
 #include "gui/widgets/settings.hpp"
 #include "gui/widgets/text_box.hpp"
@@ -62,9 +63,29 @@
        return map_height_->get_value();
 }
 
+void teditor_resize_map::set_old_map_width(int value) 
+{ 
+       old_width_ = value;
+}
+
+void teditor_resize_map::set_old_map_height(int value)
+{ 
+       old_height_ = value;
+}
+
 twindow teditor_resize_map::build_window(CVideo& video)
 {
        return build(video, get_id(EDITOR_RESIZE_MAP));
 }
 
+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"));
+       old_width->set_label(lexical_cast<std::string>(old_width_));
+       old_height->set_label(lexical_cast<std::string>(old_height_));
+}
+
 } // namespace gui2

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=28380&r1=28379&r2=28380&view=diff
==============================================================================
--- trunk/src/gui/dialogs/editor_resize_map.hpp (original)
+++ trunk/src/gui/dialogs/editor_resize_map.hpp Fri Aug  8 19:23:13 2008
@@ -28,7 +28,10 @@
        int map_width() const;
        void set_map_height(int value);
        int map_height() const;
-
+       void set_old_map_width(int value);
+       int old_map_width() const;
+       void set_old_map_height(int value);
+       int old_map_height() const;
        enum EXPAND_DIRECTION {
                EXPAND_BOTTOM_RIGHT,
                EXPAND_BOTTOM,
@@ -50,9 +53,14 @@
         */
        tfield_integer* map_width_;
        tfield_integer* map_height_;
+       
+       int old_width_;
+       int old_height_;
 
        /** Inherited from tdialog. */
        twindow build_window(CVideo& video);
+       
+       void pre_show(CVideo& video, twindow& window);
 };
 
 } // namespace gui2




Related Messages


Powered by MHonArc, Updated Fri Aug 08 19:41:33 2008