editor2 resize dialog update, some misc cleanup. The dialog is not stable atm.
This commit is contained in:
parent
36d7c8e39e
commit
f72d75a179
5 changed files with 38 additions and 5 deletions
|
@ -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]
|
||||
|
|
|
@ -220,7 +220,6 @@ void editor_controller::generate_map_dialog()
|
|||
}
|
||||
}
|
||||
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 @@ void editor_controller::resize_map_dialog()
|
|||
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 @@ bool editor_controller::execute_command(hotkey::HOTKEY_COMMAND command, int inde
|
|||
generate_map_dialog();
|
||||
return true;
|
||||
case HOTKEY_EDITOR_MAP_RESIZE:
|
||||
std::cerr << "A";
|
||||
resize_map_dialog();
|
||||
return true;
|
||||
case HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS:
|
||||
|
|
|
@ -153,8 +153,8 @@ bool editor_map::everything_selected() const
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -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 @@ int teditor_resize_map::map_height() const
|
|||
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
|
||||
|
|
|
@ -28,7 +28,10 @@ public:
|
|||
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 @@ private:
|
|||
*/
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue