Fix compilation failure from incomplete merging in r6692

Originally committed to SVN as r6696.
This commit is contained in:
Thomas Goyne 2012-04-12 15:40:25 +00:00
parent ba7b7efc12
commit 1d15bf273a
2 changed files with 7 additions and 21 deletions

View File

@ -113,6 +113,7 @@ public:
virtual std::vector<Colour> const& GetDefaultListColour() const { throw ListTypeError("colour"); }
virtual std::vector<bool> const& GetDefaultListBool() const { throw ListTypeError("string"); }
virtual void Set(const OptionValue *new_value)=0;
DEFINE_SIGNAL_ADDERS(ValueChanged, Subscribe)
};
@ -132,6 +133,7 @@ public:
std::string GetName() const { return name; } \
void Reset() { value = value_default; NotifyChanged(); } \
bool IsDefault() const { return value == value_default; } \
void Set(const OptionValue *new_val) { Set##type_name(new_val->Get##type_name()); } \
};
CONFIG_OPTIONVALUE(String, std::string)
@ -147,7 +149,8 @@ CONFIG_OPTIONVALUE(Bool, bool)
std::string name; \
public: \
virtual std::string GetString() const { return "";} \
OptionValueList##type_name(std::string member_name): name(member_name) {} \
OptionValueList##type_name(std::string const& name, std::vector<type> const& value = std::vector<type>()) \
: array(value), array_default(value), name(name) { } \
std::vector<type> const& GetList##type_name() const { return array; } \
void SetList##type_name(const std::vector<type>& val) { array = val; NotifyChanged(); } \
std::vector<type> const& GetDefaultList##type_name() const { return array_default; } \
@ -155,6 +158,7 @@ CONFIG_OPTIONVALUE(Bool, bool)
std::string GetName() const { return name; } \
void Reset() { array = array_default; NotifyChanged(); } \
bool IsDefault() const { return array == array_default; } \
void Set(const OptionValue *nv) { SetList##type_name(nv->GetList##type_name()); } \
};

View File

@ -28,6 +28,7 @@
#include <wx/event.h>
#include <wx/filefn.h>
#include <wx/listctrl.h>
#include <wx/msgdlg.h>
#include <wx/srchctrl.h>
#include <wx/sizer.h>
#include <wx/spinctrl.h>
@ -626,26 +627,7 @@ void Preferences::OnOK(wxCommandEvent &event) {
void Preferences::OnApply(wxCommandEvent &) {
for (std::map<std::string, agi::OptionValue*>::iterator cur = pending_changes.begin(); cur != pending_changes.end(); ++cur) {
agi::OptionValue *opt = OPT_SET(cur->first);
switch (opt->GetType()) {
case agi::OptionValue::Type_Bool:
opt->SetBool(cur->second->GetBool());
break;
case agi::OptionValue::Type_Colour:
opt->SetColour(cur->second->GetColour());
break;
case agi::OptionValue::Type_Double:
opt->SetDouble(cur->second->GetDouble());
break;
case agi::OptionValue::Type_Int:
opt->SetInt(cur->second->GetInt());
break;
case agi::OptionValue::Type_String:
opt->SetString(cur->second->GetString());
break;
default:
throw PreferenceNotSupported("Unsupported type");
}
OPT_SET(cur->first)->Set(cur->second);
delete cur->second;
}
pending_changes.clear();