widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #11118
[Merge] lp:~widelands-dev/widelands/add_animation_option into lp:widelands
SirVer has proposed merging lp:~widelands-dev/widelands/add_animation_option into lp:widelands.
Commit message:
Adds a new option "animate_map_paning".
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1658533 in widelands: "Issues with the new map-movement feature"
https://bugs.launchpad.net/widelands/+bug/1658533
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/add_animation_option/+merge/330126
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/add_animation_option into lp:widelands.
=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc 2017-08-08 17:39:40 +0000
+++ src/ui_fsmenu/options.cc 2017-09-03 19:55:20 +0000
@@ -150,7 +150,8 @@
// Windows options
snap_win_overlap_only_(
&box_windows_, Vector2i::zero(), _("Snap windows only when overlapping"), "", 0),
- dock_windows_to_edges_(&box_windows_, Vector2i::zero(), _("Dock windows to edges"), "", 0),
+ dock_windows_to_edges_(&box_windows_, Vector2i::zero(), _("Dock windows to edges"), "", 0),
+ animate_map_paning_(&box_windows_, Vector2i::zero(), _("Animate automatic map movements"), "", 0),
sb_dis_panel_(&box_windows_,
0,
@@ -266,6 +267,7 @@
// Windows
box_windows_.add(&snap_win_overlap_only_);
box_windows_.add(&dock_windows_to_edges_);
+ box_windows_.add(&animate_map_paning_);
box_windows_.add(&sb_dis_panel_);
box_windows_.add(&sb_dis_border_);
@@ -336,6 +338,7 @@
// Windows options
snap_win_overlap_only_.set_state(opt.snap_win_overlap_only);
dock_windows_to_edges_.set_state(opt.dock_windows_to_edges);
+ animate_map_paning_.set_state(opt.animate_map_paning);
// Sound options
music_.set_state(opt.music);
@@ -399,6 +402,7 @@
// Windows options
snap_win_overlap_only_.set_desired_size(column_width_, snap_win_overlap_only_.get_h());
dock_windows_to_edges_.set_desired_size(column_width_, dock_windows_to_edges_.get_h());
+ animate_map_paning_.set_desired_size(column_width_, animate_map_paning_.get_h());
sb_dis_panel_.set_unit_width(200);
sb_dis_panel_.set_desired_size(column_width_, sb_dis_panel_.get_h());
sb_dis_border_.set_unit_width(200);
@@ -501,6 +505,7 @@
// Windows options
os_.snap_win_overlap_only = snap_win_overlap_only_.get_state();
os_.dock_windows_to_edges = dock_windows_to_edges_.get_state();
+ os_.animate_map_paning = animate_map_paning_.get_state();
os_.panel_snap_distance = sb_dis_panel_.get_value();
os_.border_snap_distance = sb_dis_border_.get_value();
@@ -561,6 +566,7 @@
// Windows options
opt.snap_win_overlap_only = opt_section_.get_bool("snap_windows_only_when_overlapping", false);
opt.dock_windows_to_edges = opt_section_.get_bool("dock_windows_to_edges", false);
+ opt.animate_map_paning = opt_section_.get_bool("animate_map_paning", true);
opt.panel_snap_distance = opt_section_.get_int("panel_snap_distance", 0);
opt.border_snap_distance = opt_section_.get_int("border_snap_distance", 0);
@@ -602,6 +608,7 @@
// Windows options
opt_section_.set_bool("snap_windows_only_when_overlapping", opt.snap_win_overlap_only);
opt_section_.set_bool("dock_windows_to_edges", opt.dock_windows_to_edges);
+ opt_section_.set_bool("animate_map_paning", opt.animate_map_paning);
opt_section_.set_int("panel_snap_distance", opt.panel_snap_distance);
opt_section_.set_int("border_snap_distance", opt.border_snap_distance);
=== modified file 'src/ui_fsmenu/options.h'
--- src/ui_fsmenu/options.h 2017-06-24 08:47:46 +0000
+++ src/ui_fsmenu/options.h 2017-09-03 19:55:20 +0000
@@ -54,6 +54,7 @@
bool dock_windows_to_edges;
int32_t panel_snap_distance;
int32_t border_snap_distance;
+ bool animate_map_paning;
// Sound options
bool music;
@@ -137,6 +138,7 @@
// Windows options
UI::Checkbox snap_win_overlap_only_;
UI::Checkbox dock_windows_to_edges_;
+ UI::Checkbox animate_map_paning_;
UI::SpinBox sb_dis_panel_;
UI::SpinBox sb_dis_border_;
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2017-08-15 20:37:51 +0000
+++ src/wlapplication.cc 2017-09-03 19:55:20 +0000
@@ -734,6 +734,7 @@
// Profile needs support for a Syntax definition to solve this in a
// sensible way
s.get_bool("fullscreen");
+ s.get_bool("animate_map_paning");
s.get_int("xres");
s.get_int("yres");
s.get_int("border_snap_distance");
=== modified file 'src/wlapplication_messages.cc'
--- src/wlapplication_messages.cc 2017-08-17 06:21:30 +0000
+++ src/wlapplication_messages.cc 2017-09-03 19:55:20 +0000
@@ -130,6 +130,9 @@
textdomain */
<< endl
<< _("Options for the internal window manager:") << endl
+ << _(" --animate_map_paning=[yes|no]\n"
+ " Should automatic map movements be animated.")
+ << endl
<< _(" --border_snap_distance=[0 ...]\n"
" Move a window to the edge of the screen\n"
" when the edge of the window comes within\n"
=== modified file 'src/wui/mapview.cc'
--- src/wui/mapview.cc 2017-09-01 18:59:42 +0000
+++ src/wui/mapview.cc 2017-09-03 19:55:20 +0000
@@ -25,6 +25,7 @@
#include "base/math.h"
#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
+#include "profile/profile.h"
#include "wlapplication.h"
#include "wui/mapviewpixelfunctions.h"
@@ -291,6 +292,7 @@
MapView::MapView(
UI::Panel* parent, const Widelands::Map& map, int32_t x, int32_t y, uint32_t w, uint32_t h)
: UI::Panel(parent, x, y, w, h),
+ animate_map_paning_(g_options.pull_section("global").get_bool("animate_map_paning", true)),
map_(map),
view_(),
last_mouse_pos_(Vector2i::zero()),
@@ -382,7 +384,8 @@
return &fields_to_draw_;
}
-void MapView::set_view(const View& target_view, const Transition& transition) {
+void MapView::set_view(const View& target_view, const Transition& passed_transition) {
+ const Transition transition = animate_map_paning_ ? passed_transition : Transition::Jump;
switch (transition) {
case Transition::Jump: {
view_ = target_view;
=== modified file 'src/wui/mapview.h'
--- src/wui/mapview.h 2017-08-28 07:35:34 +0000
+++ src/wui/mapview.h 2017-09-03 19:55:20 +0000
@@ -187,6 +187,7 @@
Vector2f to_panel(const Vector2f& map_pixel) const;
Vector2f to_map(const Vector2i& panel_pixel) const;
+ const bool animate_map_paning_;
const Widelands::Map& map_;
// This is owned and handled by us, but handed to the RenderQueue, so we
References