Skip to content

Commit

Permalink
tpreferences: disable Animate Water when deselecting Animate Map
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Mar 4, 2016
1 parent 89e0520 commit dc8e937
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/gui/dialogs/preferences_dialog.cpp
Expand Up @@ -571,8 +571,18 @@ void tpreferences::initialize_members(twindow& window)
grid(), set_grid, window);

/* ANIMATE MAP */
setup_single_toggle("animate_terrains",
animate_map(), set_animate_map, window);
ttoggle_button& animate_map_toggle =
find_widget<ttoggle_button>(&window, "animate_terrains", false);

ttoggle_button& animate_water_toggle =
find_widget<ttoggle_button>(&window, "animate_water", false);

animate_map_toggle.set_value(animate_map());
animate_water_toggle.set_active(animate_map_toggle.get_value_bool());

connect_signal_mouse_left_click(animate_map_toggle, boost::bind(
&tpreferences::animate_map_toggle_callback,
this, boost::ref(animate_map_toggle), boost::ref(animate_water_toggle)));

/* ANIMATE WATER */
setup_single_toggle("animate_water",
Expand Down Expand Up @@ -1248,6 +1258,14 @@ void tpreferences::font_scaling_slider_callback(tslider& slider)
font_scaling_ = slider.get_value();
}

void tpreferences::animate_map_toggle_callback(ttoggle_button& toggle,
ttoggle_button& toggle_water)
{
const bool value = toggle.get_value_bool();
set_animate_map(value);
toggle_water.set_active(value);
}

template <typename T>
void tpreferences::toggle_radio_callback(
tgroup<T>& group,
Expand Down
1 change: 1 addition & 0 deletions src/gui/dialogs/preferences_dialog.hpp
Expand Up @@ -97,6 +97,7 @@ class tpreferences : public tdialog
void accl_speed_slider_callback(tslider& slider);
void max_autosaves_slider_callback(tslider& slider, tcontrol& status_label);
void font_scaling_slider_callback(tslider& slider);
void animate_map_toggle_callback(ttoggle_button& toggle, ttoggle_button& toggle_water);
void add_hotkey_callback(tlistbox& hotkeys);
void remove_hotkey_callback(tlistbox& hotkeys);
void default_hotkey_callback(twindow& window);
Expand Down

0 comments on commit dc8e937

Please sign in to comment.