Fix some build issues and minor cleanup of dialog field registration API

This commit is contained in:
Celtic Minstrel 2016-09-07 00:41:19 -04:00
parent 6aee108298
commit b4daf7e1dd
3 changed files with 20 additions and 28 deletions

View file

@ -88,9 +88,9 @@ bool tdialog::show(CVideo& video, const unsigned auto_close_time)
tfield_bool* tdialog::register_bool(
const std::string& id,
const bool mandatory,
const std::function<bool()>& callback_load_value,
const std::function<void(const bool)>& callback_save_value,
const std::function<void(twidget&)>& callback_change,
const std::function<bool()> callback_load_value,
const std::function<void(bool)> callback_save_value,
const std::function<void(twidget&)> callback_change,
const bool initial_fire)
{
tfield_bool* field = new tfield_bool(id,
@ -108,7 +108,7 @@ tfield_bool*
tdialog::register_bool(const std::string& id,
const bool mandatory,
bool& linked_variable,
const std::function<void(twidget&)>& callback_change,
const std::function<void(twidget&)> callback_change,
const bool initial_fire)
{
tfield_bool* field
@ -121,8 +121,8 @@ tdialog::register_bool(const std::string& id,
tfield_integer* tdialog::register_integer(
const std::string& id,
const bool mandatory,
const std::function<int()>& callback_load_value,
const std::function<void(const int)>& callback_save_value)
const std::function<int()> callback_load_value,
const std::function<void(const int)> callback_save_value)
{
tfield_integer* field = new tfield_integer(
id, mandatory, callback_load_value, callback_save_value);
@ -144,8 +144,8 @@ tfield_integer* tdialog::register_integer(const std::string& id,
tfield_text* tdialog::register_text(
const std::string& id,
const bool mandatory,
const std::function<std::string()>& callback_load_value,
const std::function<void(const std::string&)>& callback_save_value,
const std::function<std::string()> callback_load_value,
const std::function<void(const std::string&)> callback_save_value,
const bool capture_focus)
{
tfield_text* field = new tfield_text(

View file

@ -196,12 +196,9 @@ protected:
tfield_bool*
register_bool(const std::string& id,
const bool mandatory,
const std::function<bool()>& callback_load_value
= std::function<bool()>(),
const std::function<void(const bool)>& callback_save_value
= std::function<void(const bool)>(),
const std::function<void(twidget&)>& callback_change
= std::function<void(twidget&)>(),
const std::function<bool()> callback_load_value = nullptr,
const std::function<void(bool)> callback_save_value = nullptr,
const std::function<void(twidget&)> callback_change = nullptr,
const bool initial_fire = false);
/**
@ -223,8 +220,7 @@ protected:
register_bool(const std::string& id,
const bool mandatory,
bool& linked_variable,
const std::function<void(twidget&)>& callback_change
= std::function<void(twidget&)>(),
const std::function<void(twidget&)> callback_change = nullptr,
const bool initial_fire = false);
/**
@ -235,10 +231,8 @@ protected:
tfield_integer*
register_integer(const std::string& id,
const bool mandatory,
const std::function<int()>& callback_load_value
= std::function<int()>(),
const std::function<void(const int)>& callback_save_value
= std::function<void(const int)>());
const std::function<int()> callback_load_value = nullptr,
const std::function<void(int)> callback_save_value = nullptr);
/**
* Creates a new integer field.
@ -256,10 +250,8 @@ protected:
tfield_text* register_text(
const std::string& id,
const bool mandatory,
const std::function<std::string()>& callback_load_value
= std::function<std::string()>(),
const std::function<void(const std::string&)>& callback_save_value
= std::function<void(const std::string&)>(),
const std::function<std::string()> callback_load_value = nullptr,
const std::function<void(const std::string&)> callback_save_value = nullptr,
const bool capture_focus = false);
/**

View file

@ -399,14 +399,14 @@ void tpreferences::post_build(twindow& window)
//
/* SOUND FX */
register_bool("sound_toggle_sfx", true, sound_on, set_sound,
register_bool("sound_toggle_sfx", true, sound_on, bind_void(set_sound, _1),
[&](twidget& w) { disable_widget_on_toggle<tslider>(window, w, "sound_volume_sfx"); }, true);
register_integer("sound_volume_sfx", true,
sound_volume, set_sound_volume);
/* MUSIC */
register_bool("sound_toggle_music", true, music_on, set_music,
register_bool("sound_toggle_music", true, music_on, bind_void(set_music, _1),
[&](twidget& w) { disable_widget_on_toggle<tslider>(window, w, "sound_volume_music"); }, true);
register_integer("sound_volume_music", true,
@ -416,14 +416,14 @@ void tpreferences::post_build(twindow& window)
stop_music_in_background, set_stop_music_in_background);
/* TURN BELL */
register_bool("sound_toggle_bell", true, turn_bell, set_turn_bell,
register_bool("sound_toggle_bell", true, turn_bell, bind_void(set_turn_bell, _1),
[&](twidget& w) { disable_widget_on_toggle<tslider>(window, w, "sound_volume_bell"); }, true);
register_integer("sound_volume_bell", true,
bell_volume, set_bell_volume);
/* UI FX */
register_bool("sound_toggle_uisfx", true, UI_sound_on, set_UI_sound,
register_bool("sound_toggle_uisfx", true, UI_sound_on, bind_void(set_UI_sound, _1),
[&](twidget& w) { disable_widget_on_toggle<tslider>(window, w, "sound_volume_uisfx"); }, true);
register_integer("sound_volume_uisfx", true,