Ejemplo n.º 1
0
void
TaskPropertiesPanel::ReadValues()
{
  OrderedTaskBehaviour &p = ordered_task->GetOrderedTaskBehaviour();

  TaskFactoryType newtype = ordered_task->GetFactoryType();
  *task_changed |= SaveFormPropertyEnum(form, _T("prpTaskType"), newtype);

  int min_time = GetFormValueInteger(form, _T("prpMinTime"));
  if (min_time != (int)p.aat_min_time) {
    p.aat_min_time = fixed(min_time);
    *task_changed = true;
  }

  unsigned max_height =
    iround(Units::ToSysAltitude(GetFormValueFixed(form, _T("prpStartMaxHeight"))));
  if (max_height != p.start_max_height) {
    p.start_max_height = max_height;
    *task_changed = true;
  }

  fixed max_speed =
    Units::ToSysSpeed(GetFormValueFixed(form, _T("prpStartMaxSpeed")));
  if (max_speed != p.start_max_speed) {
    p.start_max_speed = max_speed;
    *task_changed = true;
  }

  unsigned min_height =
    iround(Units::ToSysAltitude(GetFormValueFixed(form, _T("prpFinishMinHeight"))));
  if (min_height != p.finish_min_height) {
    p.finish_min_height = min_height;
    *task_changed = true;
  }

  HeightReferenceType height_ref_start = (HeightReferenceType)
      GetFormValueInteger(form, _T("prpStartHeightRef"));
  if (height_ref_start != p.start_max_height_ref) {
    p.start_max_height_ref = height_ref_start;
    *task_changed = true;
  }

  HeightReferenceType height_ref_finish = (HeightReferenceType)
      GetFormValueInteger(form, _T("prpFinishHeightRef"));
  if (height_ref_finish != p.finish_min_height_ref) {
    p.finish_min_height_ref = height_ref_finish;
    *task_changed = true;
  }
}
Ejemplo n.º 2
0
static void 
ReadValues()
{
  OrderedTaskBehaviour &p = ordered_task->get_ordered_task_behaviour();

  TaskBehaviour::Factory_t newtype = ordered_task->get_factory_type();
  *task_changed |= SaveFormPropertyEnum(*wf, _T("prpTaskType"), newtype);

  fixed min_time = GetFormValueFixed(*wf, _T("prpMinTime")) * 60;
  if (min_time != p.aat_min_time) {
    p.aat_min_time = min_time;
    *task_changed = true;
  }

  unsigned max_height =
    iround(Units::ToSysAltitude(GetFormValueFixed(*wf, _T("prpStartMaxHeight"))));
  if (max_height != p.start_max_height) {
    p.start_max_height = max_height;
    *task_changed = true;
  }

  fixed max_speed =
    Units::ToSysSpeed(GetFormValueFixed(*wf, _T("prpStartMaxSpeed")));
  if (max_speed != p.start_max_speed) {
    p.start_max_speed = max_speed;
    *task_changed = true;
  }

  unsigned min_height =
    iround(Units::ToSysAltitude(GetFormValueFixed(*wf, _T("prpFinishMinHeight"))));
  if (min_height != p.finish_min_height) {
    p.finish_min_height = min_height;
    *task_changed = true;
  }

  HeightReferenceType height_ref_start = (HeightReferenceType)
      GetFormValueInteger(*wf, _T("prpStartHeightRef"));
  if (height_ref_start != p.start_max_height_ref) {
    p.start_max_height_ref = height_ref_start;
    *task_changed = true;
  }

  HeightReferenceType height_ref_finish = (HeightReferenceType)
      GetFormValueInteger(*wf, _T("prpFinishHeightRef"));
  if (height_ref_finish != p.finish_min_height_ref) {
    p.finish_min_height_ref = height_ref_finish;
    *task_changed = true;
  }
}
 void
 Visit(CylinderZone& oz)
 {
   fixed radius =
     Units::ToSysDistance(GetFormValueFixed(*wf, _T("prpOZCylinderRadius")));
   if (fabs(radius - oz.getRadius()) > fixed(49)) {
     oz.setRadius(radius);
     task_modified = true;
   }
 }
 void
 Visit(LineSectorZone& oz)
 {
   fixed line_length =
     Units::ToSysDistance(GetFormValueFixed(*wf, _T("prpOZLineLength")));
   if (fabs(line_length - oz.getLength()) > fixed(49)) {
     oz.setLength(line_length);
     task_modified = true;
   }
 }
Ejemplo n.º 5
0
bool
SaveFormProperty(SubForm &form, const TCHAR *control_name, double &value)
{
  double new_value = (double)GetFormValueFixed(form, control_name);
  if (new_value == value)
    return false;

  value = new_value;
  return true;
}
Ejemplo n.º 6
0
bool
SaveFormProperty(SubForm &form, const TCHAR *control_name, fixed &value)
{
  fixed new_value = GetFormValueFixed(form, control_name);
  if (new_value == value)
    return false;

  value = new_value;
  return true;
}
  void
  Visit(AnnularSectorZone& oz)
  {
    Visit((SectorZone&)oz);

    fixed radius =
      Units::ToSysDistance(GetFormValueFixed(*wf, _T("prpOZSectorInnerRadius")));
    if (fabs(radius - oz.getInnerRadius()) > fixed(49)) {
      oz.setInnerRadius(radius);
      task_modified = true;
    }
  }
  void
  Visit(SectorZone& oz)
  {
    fixed radius =
      Units::ToSysDistance(GetFormValueFixed(*wf, _T("prpOZSectorRadius")));
    if (fabs(radius - oz.getRadius()) > fixed(49)) {
      oz.setRadius(radius);
      task_modified = true;
    }

    fixed start_radial = GetFormValueFixed(*wf, _T("prpOZSectorStartRadial"));
    if (start_radial != oz.getStartRadial().value_degrees()) {
      oz.setStartRadial(Angle::degrees(start_radial));
      task_modified = true;
    }

    fixed finish_radial = GetFormValueFixed(*wf, _T("prpOZSectorFinishRadial"));
    if (finish_radial != oz.getEndRadial().value_degrees()) {
      oz.setEndRadial(Angle::degrees(finish_radial));
      task_modified = true;
    }
  }
Ejemplo n.º 9
0
bool
SaveFormProperty(const WndForm &form, const TCHAR *control_name,
                 UnitGroup_t unit_group, fixed &value)
{
  assert(control_name != NULL);

  fixed new_value = GetFormValueFixed(form, control_name);
  Units_t unit = Units::GetUserUnitByGroup(unit_group);
  new_value = Units::ToSysUnit(new_value, unit);
  if (new_value == value)
    return false;

  value = new_value;
  return true;
}
Ejemplo n.º 10
0
void
PolarConfigPanel::UpdatePolarInvalidLabel()
{
  fixed v1 = GetFormValueFixed(form, _T("prpPolarV1"));
  fixed v2 = GetFormValueFixed(form, _T("prpPolarV2"));
  fixed v3 = GetFormValueFixed(form, _T("prpPolarV3"));
  fixed w1 = GetFormValueFixed(form, _T("prpPolarW1"));
  fixed w2 = GetFormValueFixed(form, _T("prpPolarW2"));
  fixed w3 = GetFormValueFixed(form, _T("prpPolarW3"));

  PolarCoefficients coeff = PolarCoefficients::From3VW(v1, v2, v3, w1, w2, w3);
  ((WndFrame *)form.FindByName(_T("lblPolarInvalid")))->set_visible(!coeff.IsValid());
}
Ejemplo n.º 11
0
bool
TimeConfigPanel::Save(bool &_changed, bool &_require_restart)
{
  bool changed = false, require_restart = false;

  ComputerSettings &settings_computer = XCSoarInterface::SetComputerSettings();
  int ival = iround(GetFormValueFixed(form, _T("prpUTCOffset")) * 3600);
  if (settings_computer.utc_offset != ival) {
    settings_computer.utc_offset = ival;

    // have to do this because registry variables can't be negative!
    if (ival < 0)
      ival += 24 * 3600;

    Profile::Set(szProfileUTCOffset, ival);
    changed = true;
  }
  _changed |= changed;
  _require_restart |= require_restart;

  return true;
}
Ejemplo n.º 12
0
static void
ReadValues()
{
  OrderedTaskPoint* tp = ordered_task->get_tp(active_index);
  ObservationZonePoint &oz = *tp->get_oz();

  switch (oz.shape) {
  case ObservationZonePoint::ANNULAR_SECTOR: {
    fixed radius = Units::ToSysDistance(
        GetFormValueFixed(*wf, _T("prpOZSectorInnerRadius")));

    if (fabs(radius - ((AnnularSectorZone &)oz).getInnerRadius()) > fixed(49)) {
      ((AnnularSectorZone &)oz).setInnerRadius(radius);
      task_modified = true;
    }
  }
  case ObservationZonePoint::SECTOR: {
    fixed radius =
      Units::ToSysDistance(
          GetFormValueFixed(*wf, _T("prpOZSectorRadius")));

    if (fabs(radius - ((SectorZone &)oz).getRadius()) > fixed(49)) {
      ((SectorZone &)oz).setRadius(radius);
      task_modified = true;
    }

    fixed start_radial = GetFormValueFixed(*wf, _T("prpOZSectorStartRadial"));
    if (start_radial != ((SectorZone &)oz).getStartRadial().value_degrees()) {
      ((SectorZone &)oz).setStartRadial(Angle::degrees(start_radial));
      task_modified = true;
    }

    fixed finish_radial = GetFormValueFixed(*wf, _T("prpOZSectorFinishRadial"));
    if (finish_radial != ((SectorZone &)oz).getEndRadial().value_degrees()) {
      ((SectorZone &)oz).setEndRadial(Angle::degrees(finish_radial));
      task_modified = true;
    }
    break;
  }
  case ObservationZonePoint::LINE: {
    fixed line_length = Units::ToSysDistance(
        GetFormValueFixed(*wf, _T("prpOZLineLength")));

    if (fabs(line_length - ((LineSectorZone &)oz).getLength()) > fixed(49)) {
      ((LineSectorZone &)oz).setLength(line_length);
      task_modified = true;
    }
    break;
  }

  case ObservationZonePoint::CYLINDER: {
    fixed radius = Units::ToSysDistance(
        GetFormValueFixed(*wf, _T("prpOZCylinderRadius")));

    if (fabs(radius - ((CylinderZone &)oz).getRadius()) > fixed(49)) {
      ((CylinderZone &)oz).setRadius(radius);
      task_modified = true;
    }
    break;
  }

  default:
    break;
  }
}