bool RASPSettingsPanel::Save(bool &_changed) { RASP.SetParameter(GetValueInteger(ITEM)); RASP.SetTime(GetValueInteger(TIME)); return true; }
bool WaypointEditWidget::Save(bool &_changed) { bool changed = false; value.name = GetValueString(NAME); value.comment = GetValueString(COMMENT); value.location = ((GeoPointDataField &)GetDataField(LOCATION)).GetValue(); changed |= SaveValue(ELEVATION, UnitGroup::ALTITUDE, value.elevation); _changed |= changed; switch (GetValueInteger(TYPE)) { case 1: value.flags.turn_point = true; value.type = Waypoint::Type::AIRFIELD; break; case 2: value.type = Waypoint::Type::OUTLANDING; break; default: value.type = Waypoint::Type::NORMAL; value.flags.turn_point = true; break; }; return true; }
void TerrainDisplayConfigPanel::UpdateTerrainPreview() { terrain_settings.slope_shading = (SlopeShading) GetValueInteger(TerrainSlopeShading); terrain_settings.contrast = PercentToByte(GetValueInteger(TerrainContrast)); terrain_settings.brightness = PercentToByte(GetValueInteger(TerrainBrightness)); terrain_settings.ramp = GetValueInteger(TerrainColors); terrain_settings.contours = (Contours) GetValueInteger(TerrainContours); // Invalidate terrain preview if (terrain != nullptr) ((TerrainPreviewWindow &)GetRow(TerrainPreview)).SetSettings(terrain_settings); }
void MapDisplayConfigPanel::UpdateVisibilities() { bool northup = GetValueInteger(OrientationCruise) == NORTHUP; GetControl(MapShiftBias).set_visible(northup); }
bool VegaParametersWidget::Save(bool &changed_r) { bool changed = false; /* see which parameters have been edited by the user */ PopupOperationEnvironment env; for (unsigned i = 0, end = parameters.size(); i != end; ++i) { Parameter ¶meter = parameters[i]; const int ui_value = GetValueInteger(i); if (ui_value == parameter.value) /* not modified */ continue; /* value has been changed by the user */ if (!device.SendSetting(parameter.name, ui_value, env)) /* error; should this be told to the user? */ return false; parameter.value = ui_value; changed = true; } changed_r = changed; return true; }
void MapDisplayConfigPanel::UpdateVisibilities() { auto orientation = (MapOrientation)GetValueInteger(OrientationCruise); SetRowVisible(MAP_SHIFT_BIAS, orientation == MapOrientation::NORTH_UP || orientation == MapOrientation::WIND_UP); }
void TaskDefaultsConfigPanel::SetFinishLabel() { WndProperty &wp = GetControl(FinishRadius); if (GetValueInteger(FinishType) == AbstractTaskFactory::FINISH_LINE) wp.SetCaption(gettext(Caption_GateWidth)); else wp.SetCaption(gettext(Caption_Radius)); }
void TaskDefaultsConfigPanel::SetStartLabel() { WndProperty &wp = GetControl(StartRadius); if (GetValueInteger(StartType) == AbstractTaskFactory::START_LINE) wp.SetCaption(gettext(Caption_GateWidth)); else wp.SetCaption(gettext(Caption_Radius)); }
bool RowFormWidget::SaveValue(unsigned i, uint16_t &value) const { int new_value = GetValueInteger(i); if (new_value == value || new_value < 0) return false; value = (uint16_t)new_value; return true; }
bool RowFormWidget::SaveValue(unsigned i, int &value) const { int new_value = GetValueInteger(i); if (new_value == value) return false; value = new_value; return true; }
inline void FontEditWidget::SaveValues() { #ifdef USE_GDI CopyString(data.lfFaceName, GetDataField(FACE).GetAsString(), LF_FACESIZE); #endif data.lfHeight = GetValueInteger(HEIGHT); data.lfWeight = GetValueBoolean(WEIGHT) ? 700 : 500; data.lfItalic = GetValueBoolean(ITALIC); }
void TerrainDisplayConfigPanel::OnModified(DataField &df) { if (IsDataField(EnableTerrain, df)) { const DataFieldBoolean &dfb = (const DataFieldBoolean &)df; terrain_settings.enable = dfb.GetAsBoolean(); ShowTerrainControls(); } else { terrain_settings.slope_shading = (SlopeShading) GetValueInteger(TerrainSlopeShading); terrain_settings.contrast = PercentToByte(GetValueInteger(TerrainContrast)); terrain_settings.brightness = PercentToByte(GetValueInteger(TerrainBrightness)); terrain_settings.ramp = GetValueInteger(TerrainColors); // Invalidate terrain preview if (terrain != NULL) ((WndOwnerDrawFrame &)GetRow(TerrainPreview)).Invalidate(); } }
void UnitsConfigPanel::PresetCheck() { UnitSetting current_dlg_set; current_dlg_set.speed_unit = (Unit)GetValueInteger((unsigned)UnitsSpeed); current_dlg_set.wind_speed_unit = current_dlg_set.speed_unit; current_dlg_set.distance_unit = (Unit)GetValueInteger((unsigned)UnitsDistance); current_dlg_set.vertical_speed_unit = (Unit)GetValueInteger((unsigned)UnitsLift); current_dlg_set.altitude_unit = (Unit)GetValueInteger((unsigned)UnitsAltitude); current_dlg_set.temperature_unit = (Unit)GetValueInteger((unsigned)UnitsTemperature); current_dlg_set.task_speed_unit = (Unit)GetValueInteger((unsigned)UnitsTaskSpeed); current_dlg_set.pressure_unit = (Unit)GetValueInteger((unsigned)UnitsPressure); current_dlg_set.mass_unit = (Unit)GetValueInteger((unsigned)UnitsMass); current_dlg_set.wing_loading_unit = (Unit)GetValueInteger((unsigned)UnitsWingLoading); LoadValueEnum(UnitsPreset, Units::Store::EqualsPresetUnits(current_dlg_set)); }
bool RASPSettingsPanel::Save(bool &_changed) { WeatherUIState &state = CommonInterface::SetUIState().weather; state.map = GetValueInteger(ITEM); state.time = time; ActionInterface::SendUIState(true); return true; }
// Done bool OTVariable::Compare(OTVariable & rhs) { if (!(GetName().Compare(rhs.GetName()))) { OTLog::vOutput(0, "OTVariable::Compare: Names don't match: %s / %s \n", GetName().Get(), rhs.GetName().Get()); return false; } if ( ! (GetType() == rhs.GetType()) ) { OTLog::vOutput(0, "OTVariable::Compare: Type doesn't match: %s \n", GetName().Get()); return false; } if ( ! (GetAccess() == rhs.GetAccess()) ) { OTLog::vOutput(0, "OTVariable::Compare: Access types don't match: %s \n", GetName().Get()); return false; } // ------------------------------- bool bMatch = false; switch (GetType()) { case OTVariable::Var_Integer: bMatch = (GetValueInteger() == rhs.GetValueInteger()); break; case OTVariable::Var_Bool: bMatch = (GetValueBool() == rhs.GetValueBool()); break; case OTVariable::Var_String: bMatch = (GetValueString().compare(rhs.GetValueString()) == 0); break; default: OTLog::vError("OTVariable::Compare: Unknown type in variable %s.\n", m_strName.Get()); break; } return bMatch; }
void VegaParametersWidget::UpdateUI() { for (unsigned i = 0, end = parameters.size(); i != end; ++i) { Parameter ¶meter = parameters[i]; if (loaded) { const int ui_value = GetValueInteger(i); if (ui_value != parameter.value) /* don't update parameters that were changed by the user */ continue; } auto x = device.GetSetting(parameter.name); if (x.first) { parameter.value = x.second; GetDataField(i).SetAsInteger(x.second); GetControl(i).RefreshDisplay(); } } loaded = 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); }
bool TimeConfigPanel::Save(bool &_changed, bool &_require_restart) { bool changed = false, require_restart = false; ComputerSettings &settings_computer = XCSoarInterface::SetComputerSettings(); int ival = GetValueInteger(UTCOffset); if (settings_computer.utc_offset != ival) { settings_computer.utc_offset = ival; Profile::Set(szProfileUTCOffsetSigned, ival); changed = true; } changed |= SaveValue(SystemTimeFromGPS, szProfileSetSystemTimeFromGPS, settings_computer.set_system_time_from_gps); _changed |= changed; _require_restart |= require_restart; return true; }
bool TimeConfigPanel::Save(bool &_changed) { bool changed = false; ComputerSettings &settings_computer = CommonInterface::SetComputerSettings(); int ival = GetValueInteger(UTCOffset); const RoughTimeDelta new_utc_offset = RoughTimeDelta::FromSeconds(ival); if (new_utc_offset != settings_computer.utc_offset) { settings_computer.utc_offset = new_utc_offset; Profile::Set(ProfileKeys::UTCOffsetSigned, ival); changed = true; } changed |= SaveValue(SystemTimeFromGPS, ProfileKeys::SetSystemTimeFromGPS, settings_computer.set_system_time_from_gps); _changed |= changed; return true; }
void MapDisplayConfigPanel::UpdateVisibilities() { SetRowVisible(MapShiftBias, GetValueInteger(OrientationCruise) == NORTHUP); }
bool InterfaceConfigPanel::Save(bool &_changed) { UISettings &settings = CommonInterface::SetUISettings(); bool changed = false;; #ifdef HAVE_BLANK changed |= SaveValue(AutoBlank, ProfileKeys::AutoBlank, settings.display.enable_auto_blank); #endif if (SaveValueFileReader(InputFile, ProfileKeys::InputFile)) require_restart = changed = true; #ifndef HAVE_NATIVE_GETTEXT WndProperty *wp = (WndProperty *)&GetControl(LanguageFile); if (wp != NULL) { DataFieldEnum &df = *(DataFieldEnum *)wp->GetDataField(); TCHAR old_value[MAX_PATH]; if (!Profile::GetPath(ProfileKeys::LanguageFile, old_value)) old_value[0] = _T('\0'); const TCHAR *old_base = BaseName(old_value); if (old_base == NULL) old_base = old_value; TCHAR buffer[MAX_PATH]; const TCHAR *new_value, *new_base; switch (df.GetValue()) { case 0: new_value = new_base = _T("auto"); break; case 1: new_value = new_base = _T("none"); break; default: _tcscpy(buffer, df.GetAsString()); ContractLocalPath(buffer); new_value = buffer; new_base = BaseName(new_value); if (new_base == NULL) new_base = new_value; break; } if (_tcscmp(old_value, new_value) != 0 && _tcscmp(old_base, new_base) != 0) { Profile::Set(ProfileKeys::LanguageFile, new_value); LanguageChanged = changed = true; } } #endif if (SaveValueFileReader(StatusFile, ProfileKeys::StatusFile)) require_restart = changed = true; unsigned menu_timeout = GetValueInteger(MenuTimeout) * 2; if (settings.menu_timeout != menu_timeout) { settings.menu_timeout = menu_timeout; Profile::Set(ProfileKeys::MenuTimeout, menu_timeout); changed = true; } #ifdef HAVE_VIBRATOR changed |= SaveValueEnum(HapticFeedback, ProfileKeys::HapticFeedback, settings.haptic_feedback); #endif _changed |= changed; return true; }
bool InterfaceConfigPanel::Save(bool &_changed) { UISettings &settings = CommonInterface::SetUISettings(); bool changed = false;; if (SaveValueEnum(UIScale, ProfileKeys::UIScale, settings.scale)) require_restart = changed = true; if (SaveValueFileReader(InputFile, ProfileKeys::InputFile)) require_restart = changed = true; #ifndef HAVE_NATIVE_GETTEXT WndProperty *wp = (WndProperty *)&GetControl(LanguageFile); if (wp != nullptr) { DataFieldEnum &df = *(DataFieldEnum *)wp->GetDataField(); const auto old_value_buffer = Profile::GetPath(ProfileKeys::LanguageFile); Path old_value = old_value_buffer; if (old_value == nullptr) old_value = Path(_T("")); auto old_base = old_value.GetBase(); if (old_base == nullptr) old_base = old_value; AllocatedPath buffer = nullptr; const TCHAR *new_value, *new_base; switch (df.GetValue()) { case 0: new_value = new_base = _T("auto"); break; case 1: new_value = new_base = _T("none"); break; default: new_value = df.GetAsString(); buffer = ContractLocalPath(Path(new_value)); if (!buffer.IsNull()) new_value = buffer.c_str(); new_base = Path(new_value).GetBase().c_str(); if (new_base == nullptr) new_base = new_value; break; } if (old_value != Path(new_value) && old_base != Path(new_base)) { Profile::Set(ProfileKeys::LanguageFile, new_value); LanguageChanged = changed = true; } } #endif unsigned menu_timeout = GetValueInteger(MenuTimeout) * 2; if (settings.menu_timeout != menu_timeout) { settings.menu_timeout = menu_timeout; Profile::Set(ProfileKeys::MenuTimeout, menu_timeout); changed = true; } if (HasPointer()) changed |= SaveValueEnum(TextInput, ProfileKeys::AppTextInputStyle, settings.dialog.text_input_style); #ifdef HAVE_VIBRATOR changed |= SaveValueEnum(HapticFeedback, ProfileKeys::HapticFeedback, settings.haptic_feedback); #endif _changed |= changed; return true; }