Example #1
0
 void LoadScheme(const VEGA_SCHEME::Audio &scheme) {
   LoadValueEnum(0, scheme.beep_type);
   LoadValueEnum(1, scheme.pitch_scheme);
   LoadValueEnum(2, scheme.pitch_scale);
   LoadValueEnum(3, scheme.period_scheme);
   LoadValueEnum(4, scheme.period_scale);
 }
Example #2
0
 void Update(const SwitchState &switches) {
   LoadValueEnum(AIRBRAKE_STATE, switches.airbrake_state);
   LoadValueEnum(FLAP_POSITION, (unsigned)switches.flap_position);
   LoadValue(GEAR_DOWN, switches.vega.GetGearExtended());
   LoadValue(ACKNOWLEDGE, switches.vega.GetAcknowledge());
   LoadValue(SPEED_COMMAND, switches.vega.GetSpeedCommand());
 }
void
UnitsConfigPanel::UpdateUnitFields(const UnitSetting &units)
{
  LoadValueEnum(UnitsSpeed, units.speed_unit);
  LoadValueEnum(UnitsDistance, units.distance_unit);
  LoadValueEnum(UnitsLift, units.vertical_speed_unit);
  LoadValueEnum(UnitsAltitude, units.altitude_unit);
  LoadValueEnum(UnitsTemperature, units.temperature_unit);
  LoadValueEnum(UnitsTaskSpeed, units.task_speed_unit);
  LoadValueEnum(UnitsPressure, units.pressure_unit);
  LoadValueEnum(UnitsMass, units.mass_unit);
  LoadValueEnum(UnitsWingLoading, units.wing_loading_unit);

  // Ignore the coord.format for the preset selection.
}
bool
AirspaceFilterWidget::KeyPress(unsigned key_code)
{
  switch (key_code) {
  case KEY_APP1:
    LoadValueEnum(TYPE, WILDCARD);
    return true;

  case KEY_APP2:
    LoadValueEnum(TYPE, RESTRICT);
    return true;

  case KEY_APP3:
    LoadValueEnum(TYPE, PROHIBITED);
    return true;

  default:
    return false;
  }
}
Example #5
0
bool
WaypointFilterWidget::KeyPress(unsigned key_code)
{
  switch (key_code) {
  case KEY_APP1:
    LoadValueEnum(TYPE, TypeFilter::ALL);
    return true;

  case KEY_APP2:
    LoadValueEnum(TYPE, TypeFilter::LANDABLE);
    return true;

  case KEY_APP3:
    LoadValueEnum(TYPE, TypeFilter::TURNPOINT);
    return true;

  default:
    return false;
  }
}
Example #6
0
void
PageLayoutEditWidget::SetValue(const PageLayout &_value)
{
  value = _value;

  LoadValueEnum(MAIN, value.main);
  LoadValueEnum(BOTTOM, value.bottom);

  unsigned ib = IBP_NONE;
  if (value.infobox_config.enabled) {
    if (value.infobox_config.auto_switch)
      ib = IBP_AUTO;
    else if (value.infobox_config.panel < InfoBoxSettings::MAX_PANELS)
      ib = value.infobox_config.panel;
    else
      /* fix up illegal value */
      ib = 0;
  }

  LoadValueEnum(INFO_BOX_PANEL, ib);
}
Example #7
0
void
TaskPropertiesPanel::RefreshView()
{
  const TaskFactoryType ftype = ordered_task->GetFactoryType();
  const OrderedTaskBehaviour &p = ordered_task->GetOrderedTaskBehaviour();

  bool aat_types = (ftype == TaskFactoryType::AAT);
  bool fai_start_finish = p.fai_finish;

  SetRowVisible(MIN_TIME, aat_types);
  LoadValueTime(MIN_TIME, (int)p.aat_min_time);

  SetRowVisible(START_MAX_SPEED, !fai_start_finish);
  LoadValue(START_MAX_SPEED, p.start_max_speed, UnitGroup::HORIZONTAL_SPEED);

  SetRowVisible(START_MAX_HEIGHT, !fai_start_finish);
  LoadValue(START_MAX_HEIGHT, fixed(p.start_max_height), UnitGroup::ALTITUDE);

  SetRowVisible(START_HEIGHT_REF, !fai_start_finish);
  LoadValueEnum(START_HEIGHT_REF, p.start_max_height_ref);

  SetRowVisible(FINISH_MIN_HEIGHT, !fai_start_finish);
  LoadValue(FINISH_MIN_HEIGHT, fixed(p.finish_min_height),
            UnitGroup::ALTITUDE);

  SetRowVisible(FINISH_HEIGHT_REF, !fai_start_finish);
  LoadValueEnum(FINISH_HEIGHT_REF, p.finish_min_height_ref);

  LoadValue(FAI_FINISH_HEIGHT, p.fai_finish);

  LoadValueEnum(TASK_TYPE, ftype);

  if (wTaskView != NULL)
    wTaskView->Invalidate();

  // fixed aat_min_time
  // finish_min_height
}
Example #8
0
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);

  LoadValueEnum(UnitsPreset, Units::Store::EqualsPresetUnits(current_dlg_set));
}
Example #9
0
void
InfoBoxesConfigWidget::SetCurrentInfoBox(unsigned _current_preview)
{
  assert(_current_preview < previews.size());

  if (_current_preview == current_preview)
    return;

  previews[current_preview].Invalidate();
  current_preview = _current_preview;
  previews[current_preview].Invalidate();

  LoadValueEnum(INFOBOX, current_preview);

  RefreshEditContent();
}
Example #10
0
void
InfoBoxesConfigWidget::RefreshEditContent()
{
  LoadValueEnum(CONTENT, data.contents[current_preview]);
}
Example #11
0
 void Update(const SwitchState &switches) {
   LoadValueEnum(USER_SWITCH, switches.user_switch);
   LoadValue(FLIGHT_MODE,
             switches.flight_mode == SwitchState::FlightMode::CIRCLING);
 }
Example #12
0
 void LoadValueEnum(unsigned i, T value) {
   LoadValueEnum(i, unsigned(value));
 }
Example #13
0
void
UnitsConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  const UnitSetting &config = CommonInterface::GetUISettings().format.units;
  const CoordinateFormat coordinate_format =
      CommonInterface::GetUISettings().format.coordinate_format;

  RowFormWidget::Prepare(parent, rc);

  WndProperty *wp = AddEnum(_("Preset"), _("Load a set of units."));
  DataFieldEnum &df = *(DataFieldEnum *)wp->GetDataField();

  df.addEnumText(_("Custom"), (unsigned)0, _("My individual set of units."));
  unsigned len = Units::Store::Count();
  for (unsigned i = 0; i < len; i++)
    df.addEnumText(Units::Store::GetName(i), i+1);

  LoadValueEnum(UnitsPreset, Units::Store::EqualsPresetUnits(config));
  wp->GetDataField()->SetListener(this);

  AddSpacer();
  SetExpertRow(spacer_1);

  static constexpr StaticEnumChoice units_speed_list[] = {
    { (unsigned)Unit::STATUTE_MILES_PER_HOUR, _T("mph") },
    { (unsigned)Unit::KNOTS, N_("knots") },
    { (unsigned)Unit::KILOMETER_PER_HOUR, _T("km/h") },
    { 0 }
  };
  AddEnum(_("Aircraft/Wind speed"),
          _("Units used for airspeed and ground speed.  "
            "A separate unit is available for task speeds."),
          units_speed_list,
          (unsigned int)config.speed_unit, this);
  SetExpertRow(UnitsSpeed);

  static constexpr StaticEnumChoice units_distance_list[] = {
    { (unsigned)Unit::STATUTE_MILES, _T("sm") },
    { (unsigned)Unit::NAUTICAL_MILES, _T("nm") },
    { (unsigned)Unit::KILOMETER, _T("km") },
    { 0 }
  };
  AddEnum(_("Distance"),
          _("Units used for horizontal distances e.g. "
            "range to waypoint, distance to go."),
          units_distance_list,
          (unsigned)config.distance_unit, this);
  SetExpertRow(UnitsDistance);

  static constexpr StaticEnumChoice units_lift_list[] = {
    { (unsigned)Unit::KNOTS, N_("knots") },
    { (unsigned)Unit::METER_PER_SECOND, _T("m/s") },
    { (unsigned)Unit::FEET_PER_MINUTE, _T("ft/min") },
    { 0 }
  };
  AddEnum(_("Lift"), _("Units used for vertical speeds (variometer)."),
          units_lift_list,
          (unsigned)config.vertical_speed_unit, this);
  SetExpertRow(UnitsLift);

  static constexpr StaticEnumChoice units_altitude_list[] = {
    { (unsigned)Unit::FEET,  N_("foot") },
    { (unsigned)Unit::METER, N_("meter") },
    { 0 }
  };
  AddEnum(_("Altitude"), _("Units used for altitude and heights."),
          units_altitude_list,
          (unsigned)config.altitude_unit, this);
  SetExpertRow(UnitsAltitude);

  static constexpr StaticEnumChoice units_temperature_list[] = {
    { (unsigned)Unit::DEGREES_CELCIUS, _T(DEG "C") },
    { (unsigned)Unit::DEGREES_FAHRENHEIT, _T(DEG "F") },
    { 0 }
  };
  AddEnum(_("Temperature"), _("Units used for temperature."),
          units_temperature_list,
          (unsigned)config.temperature_unit, this);
  SetExpertRow(UnitsTemperature);

  static constexpr StaticEnumChoice units_taskspeed_list[] = {
    { (unsigned)Unit::STATUTE_MILES_PER_HOUR, _T("mph") },
    { (unsigned)Unit::KNOTS, N_("knots") },
    { (unsigned)Unit::KILOMETER_PER_HOUR, _T("km/h") },
    { 0 }
  };
  AddEnum(_("Task speed"), _("Units used for task speeds."),
          units_taskspeed_list,
          (unsigned)config.task_speed_unit, this);
  SetExpertRow(UnitsTaskSpeed);

  static constexpr StaticEnumChoice pressure_labels_list[] = {
    { (unsigned)Unit::HECTOPASCAL, _T("hPa") },
    { (unsigned)Unit::MILLIBAR, _T("mb") },
    { (unsigned)Unit::INCH_MERCURY, _T("inHg") },
    { 0 }
  };
  AddEnum(_("Pressure"), _("Units used for pressures."),
          pressure_labels_list,
          (unsigned)config.pressure_unit, this);
  SetExpertRow(UnitsPressure);

  AddSpacer();
  SetExpertRow(spacer_2);

  static constexpr StaticEnumChoice units_lat_lon_list[] = {
    { (unsigned)CoordinateFormat::DDMMSS, _T("DDMMSS") },
    { (unsigned)CoordinateFormat::DDMMSS_S, _T("DDMMSS.s") },
    { (unsigned)CoordinateFormat::DDMM_MMM, _T("DDMM.mmm") },
    { (unsigned)CoordinateFormat::DD_DDDDD, _T("DD.ddddd") },
    { (unsigned)CoordinateFormat::UTM, _T("UTM") },
    { 0 }
  };
  AddEnum(_("Lat./Lon."), _("Units used for latitude and longitude."),
          units_lat_lon_list,
          (unsigned)coordinate_format);
  SetExpertRow(UnitsLatLon);
}
Example #14
0
 void LoadValueEnum(unsigned i, T value) {
   LoadValueEnum(i, (int)value);
 }