bool WindSettingsPanel::Save(bool &_changed, bool &_require_restart) { const NMEAInfo &basic = CommonInterface::Basic(); WindSettings &settings = CommonInterface::SetComputerSettings().wind; MapSettings &map_settings = CommonInterface::SetMapSettings(); bool changed = false; unsigned auto_wind_mode = settings.GetLegacyAutoWindMode(); if (SaveValueEnum(AutoWind, szProfileAutoWind, auto_wind_mode)) { settings.SetLegacyAutoWindMode(auto_wind_mode); changed = true; } changed |= SaveValue(ExternalWind, szProfileExternalWind, settings.use_external_wind); changed |= SaveValue(TrailDrift, szProfileTrailDrift, map_settings.trail_drift_enabled); if (edit_manual_wind && !external_wind) { settings.manual_wind.norm = Units::ToSysWindSpeed(GetValueFloat(Speed)); settings.manual_wind.bearing = Angle::Degrees(GetValueFloat(Direction)); settings.manual_wind_available.Update(basic.clock); } _changed |= changed; return true; }
bool RowFormWidget::SaveValue(unsigned i, fixed &value) const { fixed new_value = GetValueFloat(i); if (new_value == value) return false; value = new_value; return true; }
bool RowFormWidget::SaveValue(unsigned i, double &value) const { auto new_value = GetValueFloat(i); if (new_value == value) return false; value = new_value; return true; }
void TaskPropertiesPanel::ReadValues() { OrderedTaskBehaviour &p = ordered_task->GetOrderedTaskBehaviour(); TaskFactoryType newtype = ordered_task->GetFactoryType(); *task_changed |= SaveValueEnum(TASK_TYPE, newtype); int min_time = GetValueInteger(MIN_TIME); if (min_time != (int)p.aat_min_time) { p.aat_min_time = fixed(min_time); *task_changed = true; } fixed max_speed = Units::ToSysSpeed(GetValueFloat(START_MAX_SPEED)); if (max_speed != p.start_max_speed) { p.start_max_speed = max_speed; *task_changed = true; } unsigned max_height = iround(Units::ToSysAltitude(GetValueFloat(START_MAX_HEIGHT))); if (max_height != p.start_max_height) { p.start_max_height = max_height; *task_changed = true; } *task_changed |= SaveValueEnum(START_HEIGHT_REF, p.start_max_height_ref); unsigned min_height = iround(Units::ToSysAltitude(GetValueFloat(FINISH_MIN_HEIGHT))); if (min_height != p.finish_min_height) { p.finish_min_height = min_height; *task_changed = true; } *task_changed |= SaveValueEnum(FINISH_HEIGHT_REF, p.finish_min_height_ref); }
void WindSettingsPanel::OnModified(DataField &df) { if (!edit_manual_wind) return; const NMEAInfo &basic = CommonInterface::Basic(); WindSettings &settings = CommonInterface::SetComputerSettings().wind; if (&df == &GetDataField(Speed) || &df == &GetDataField(Direction)) { settings.manual_wind.norm = Units::ToSysWindSpeed(GetValueFloat(Speed)); settings.manual_wind.bearing = GetValueAngle(Direction); settings.manual_wind_available.Update(basic.clock); manual_modified = true; } UpdateVector(); }