Esempio n. 1
0
static void
UpdateButtons()
{
  if (IsAltair()) {
    // Altair uses the rotary knob
    ShowFormControl(*wf, _T("btnNext"), false);
    ShowFormControl(*wf, _T("btnPrev"), false);
  }
}
void
WaypointDisplayConfigPanel::UpdateVisibilities()
{
  WndProperty* wp = (WndProperty*)wf->FindByName(_T("prpAppUseSWLandablesRendering"));
  assert(wp != NULL);
  bool visible = (wp->GetDataField()->GetAsInteger() != 0);

  ShowFormControl(*wf, _T("prpAppLandableRenderingScale"), visible);
  ShowFormControl(*wf, _T("prpAppScaleRunwayLength"), visible);
}
Esempio n. 3
0
static void
ShowFontEditButtons(bool bVisible)
{
  ShowFormControl(*wf, _T("cmdInfoWindowFont"), bVisible);
  ShowFormControl(*wf, _T("cmdTitleWindowFont"), bVisible);
  ShowFormControl(*wf, _T("cmdMapWindowFont"), bVisible);
  ShowFormControl(*wf, _T("cmdTitleSmallWindowFont"), bVisible);
  ShowFormControl(*wf, _T("cmdMapWindowBoldFont"), bVisible);
  ShowFormControl(*wf, _T("cmdCDIWindowFont"), bVisible);
  ShowFormControl(*wf, _T("cmdMapLabelFont"), bVisible);
  ShowFormControl(*wf, _T("cmdMapLabelImportantFont"), bVisible);
}
Esempio n. 4
0
void
TaskEditPanel::UpdateButtons()
{
  const unsigned index = wTaskPoints->GetCursorIndex();
  // Todo check if point is already finish
  ShowFormControl(form, _T("cmdMakeFinish"),
                  index > 0 &&
                  (index == ordered_task->TaskSize() - 1) &&
                  !ordered_task->HasFinish());

  ShowFormControl(form, _T("cmdDown"),
                  (int)index < ((int)(ordered_task->TaskSize()) - 1));

  ShowFormControl(form, _T("cmdUp"),
                  index > 0 && index < ordered_task->TaskSize());

  ShowFormControl(form, _T("cmdEditTurnpoint"),
                  index < ordered_task->TaskSize());
}
Esempio n. 5
0
static void
ShowAltitude(fixed altitude)
{
  static fixed last(-2);

  if (fabs(altitude - last) < fixed_one)
    return;

  last = altitude;

  LoadFormProperty(*wf, _T("prpAltitude"), ugAltitude, altitude);
  ShowFormControl(*wf, _T("prpAltitude"), true);
}
Esempio n. 6
0
void
TaskStatusPanel::Refresh()
{
  if (protected_task_manager == NULL)
    return;

  const DerivedInfo &calculated = CommonInterface::Calculated();
  const TaskStats &task_stats = calculated.task_stats;

  TCHAR Temp[80];

  FormatSignedTimeHHMM(Temp, (int)protected_task_manager->GetOrderedTaskBehaviour().aat_min_time);
  ShowFormControl(form, _T("prpTaskTime"), task_stats.has_targets);
  if (task_stats.has_targets)
    SetFormValue(form, _T("prpTaskTime"), Temp);

  int ete_time(task_stats.total.time_elapsed +
               task_stats.total.time_remaining);
  FormatSignedTimeHHMM(Temp, ete_time);
  SetFormValue(form, _T("prpETETime"), Temp);

  FormatSignedTimeHHMM(Temp, (int)task_stats.total.time_remaining);
  SetFormValue(form, _T("prpRemainingTime"), Temp);

  if (task_stats.total.planned.IsDefined()) {
    Units::FormatUserDistanceSmart(task_stats.total.planned.get_distance(),
                              Temp, ARRAY_SIZE(Temp));
    SetFormValue(form, _T("prpTaskDistance"), Temp);
  } else
    SetFormValue(form, _T("prpTaskDistance"), _T(""));

  if (task_stats.total.remaining.IsDefined()) {
    Units::FormatUserDistanceSmart(task_stats.total.remaining.get_distance(),
                              Temp, ARRAY_SIZE(Temp));
    SetFormValue(form, _T("prpRemainingDistance"), Temp);
  }

  if (task_stats.total.planned.IsDefined()) {
    Units::FormatUserTaskSpeed(task_stats.total.planned.get_speed(),
                               Temp, ARRAY_SIZE(Temp));
    SetFormValue(form, _T("prpEstimatedSpeed"), Temp);
  } else
    SetFormValue(form, _T("prpEstimatedSpeed"), _T(""));

  if (task_stats.total.travelled.IsDefined()) {
    Units::FormatUserTaskSpeed(task_stats.total.travelled.get_speed(),
                               Temp, ARRAY_SIZE(Temp));
    SetFormValue(form, _T("prpAverageSpeed"), Temp);
  } else
    SetFormValue(form, _T("prpAverageSpeed"), _T(""));
}
Esempio n. 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;

  LoadFormProperty(form, _T("prpTaskType"),(int)ftype);

  ShowFormControl(form, _T("prpMinTime"), aat_types);
  LoadFormProperty(form, _T("prpMinTime"), (int)p.aat_min_time);

  LoadFormProperty(form, _T("prpFAIFinishHeight"), p.fai_finish);

  ShowFormControl(form, _T("prpStartMaxSpeed"), !fai_start_finish);
  LoadFormProperty(form, _T("prpStartMaxSpeed"),
                   UnitGroup::HORIZONTAL_SPEED, p.start_max_speed);

  ShowFormControl(form, _T("prpStartMaxHeight"), !fai_start_finish);
  LoadFormProperty(form, _T("prpStartMaxHeight"),
                   UnitGroup::ALTITUDE, p.start_max_height);

  ShowFormControl(form, _T("prpFinishMinHeight"), !fai_start_finish);
  LoadFormProperty(form, _T("prpFinishMinHeight"),
                   UnitGroup::ALTITUDE, p.finish_min_height);

  ShowFormControl(form, _T("prpStartHeightRef"), !fai_start_finish);
  LoadFormProperty(form, _T("prpStartHeightRef"), (unsigned)p.start_max_height_ref);

  ShowFormControl(form, _T("prpFinishHeightRef"), !fai_start_finish);
  LoadFormProperty(form, _T("prpFinishHeightRef"), (unsigned)p.finish_min_height_ref);

  wTaskView->Invalidate();

  // fixed aat_min_time
  // finish_min_height
}
Esempio n. 8
0
static void 
RefreshView()
{
  const TaskBehaviour::Factory_t ftype = ordered_task->get_factory_type();
  OrderedTaskBehaviour &p = ordered_task->get_ordered_task_behaviour();

  bool aat_types = (ftype == TaskBehaviour::FACTORY_AAT);
  bool fai_start_finish = p.fai_finish;

  LoadFormProperty(*wf, _T("prpTaskType"),(int)ftype);

  ShowFormControl(*wf, _T("prpMinTime"), aat_types);
  LoadFormProperty(*wf, _T("prpMinTime"), p.aat_min_time / 60);

  LoadFormProperty(*wf, _T("prpFAIFinishHeight"), p.fai_finish);

  ShowFormControl(*wf, _T("prpStartMaxSpeed"), !fai_start_finish);
  LoadFormProperty(*wf, _T("prpStartMaxSpeed"),
                   ugHorizontalSpeed, p.start_max_speed);

  ShowFormControl(*wf, _T("prpStartMaxHeight"), !fai_start_finish);
  LoadFormProperty(*wf, _T("prpStartMaxHeight"),
                   ugAltitude, p.start_max_height);

  ShowFormControl(*wf, _T("prpFinishMinHeight"), !fai_start_finish);
  LoadFormProperty(*wf, _T("prpFinishMinHeight"),
                   ugAltitude, p.finish_min_height);

  ShowFormControl(*wf, _T("prpStartHeightRef"), !fai_start_finish);
  LoadFormProperty(*wf, _T("prpStartHeightRef"), p.start_max_height_ref);

  ShowFormControl(*wf, _T("prpFinishHeightRef"), !fai_start_finish);
  LoadFormProperty(*wf, _T("prpFinishHeightRef"), p.finish_min_height_ref);

  wTaskView->invalidate();

  // fixed aat_min_time
  // finish_min_height
}
Esempio n. 9
0
/**
 * Refreshes UI based on location of target and current task stats
 */
static void
RefreshCalculator()
{
  bool nodisplay = false;
  bool is_aat;
  fixed aat_time;

  {
    ProtectedTaskManager::Lease lease(*protected_task_manager);
    const OrderedTask &task = lease->GetOrderedTask();
    const AATPoint *ap = task.GetAATTaskPoint(target_point);

    is_aat = ap != nullptr;

    if (!is_aat) {
      nodisplay = true;
      is_locked = false;
    } else {
      range_and_radial = ap->GetTargetRangeRadial(range_and_radial.range);
      is_locked = ap->IsTargetLocked();
    }

    aat_time = task.GetOrderedTaskSettings().aat_min_time;
  }

  if (optimized_checkbox) {
    optimized_checkbox->SetVisible(is_aat);
    optimized_checkbox->SetState(!is_locked);
  }

  LockCalculatorUI();

  ShowOptionalFormControl(*wf, _T("prpRange"), !nodisplay);
  ShowOptionalFormControl(*wf, _T("prpRadial"), !nodisplay);

  if (!nodisplay)
    LoadRangeAndRadial();

  // update outputs
  const auto &calculated = CommonInterface::Calculated();
  const TaskStats &task_stats = calculated.ordered_task_stats;
  const fixed aat_time_estimated = task_stats.GetEstimatedTotalTime();

  ShowOptionalFormControl(*wf, _T("prpAATEst"), !nodisplay);
  ShowFormControl(*wf, _T("prpAATDelta"), !nodisplay);
  if (!nodisplay) {
    LoadOptionalFormProperty(*wf, _T("prpAATEst"),
                             aat_time_estimated / fixed(60));
    LoadFormProperty(*wf, _T("prpAATDelta"),
                     (aat_time_estimated - aat_time) / 60);
  }

  const ElementStat &total = task_stats.total;
  if (total.remaining_effective.IsDefined())
    LoadFormProperty(*wf, _T("prpSpeedRemaining"), UnitGroup::TASK_SPEED,
                     total.remaining_effective.GetSpeed());

  if (total.travelled.IsDefined())
    LoadOptionalFormProperty(*wf, _T("prpSpeedAchieved"), UnitGroup::TASK_SPEED,
                             total.travelled.GetSpeed());
}
Esempio n. 10
0
static void
RefreshView()
{
  wTaskView->invalidate();

  OrderedTaskPoint* tp = ordered_task->get_tp(active_index);
  if (!tp)
    return;

  Refreshing = true; // tell onChange routines not to save form!

  ShowFormControl(*wf, _T("frmOZLine"), false);
  ShowFormControl(*wf, _T("frmOZSector"), false);
  ShowFormControl(*wf, _T("frmOZCylinder"), false);

  const ObservationZonePoint &oz = *tp->get_oz();

  switch (oz.shape) {
  case ObservationZonePoint::SECTOR:
  case ObservationZonePoint::ANNULAR_SECTOR:
    ShowFormControl(*wf, _T("frmOZSector"), true);

    LoadFormProperty(*wf, _T("prpOZSectorRadius"),
                     ugDistance, ((const SectorZone &)oz).getRadius());
    LoadFormProperty(*wf, _T("prpOZSectorStartRadial"),
                     ((const SectorZone &)oz).getStartRadial().value_degrees());
    LoadFormProperty(*wf, _T("prpOZSectorFinishRadial"),
                     ((const SectorZone &)oz).getEndRadial().value_degrees());

    if (oz.shape == ObservationZonePoint::ANNULAR_SECTOR) {
      LoadFormProperty(*wf, _T("prpOZSectorInnerRadius"),
                       ugDistance, ((const AnnularSectorZone &)oz).getInnerRadius());

      ShowFormControl(*wf, _T("prpOZSectorInnerRadius"), true);
    } else
      ShowFormControl(*wf, _T("prpOZSectorInnerRadius"), false);

    break;

  case ObservationZonePoint::LINE:
    ShowFormControl(*wf, _T("frmOZLine"), true);

    LoadFormProperty(*wf, _T("prpOZLineLength"), ugDistance,
                     ((const LineSectorZone &)oz).getLength());
    break;

  case ObservationZonePoint::CYLINDER:
    ShowFormControl(*wf, _T("frmOZCylinder"), true);

    LoadFormProperty(*wf, _T("prpOZCylinderRadius"), ugDistance,
                     ((const CylinderZone &)oz).getRadius());
    break;

  default:
    break;
  }

  WndFrame* wfrm = NULL;
  wfrm = ((WndFrame*)wf->FindByName(_T("lblType")));
  if (wfrm)
    wfrm->SetCaption(OrderedTaskPointName(ordered_task->get_factory().getType(*tp)));

  SetFormControlEnabled(*wf, _T("butPrevious"), active_index > 0);
  SetFormControlEnabled(*wf, _T("butNext"),
                        active_index < (ordered_task->TaskSize() - 1));

  WndButton* wb;
  wb = (WndButton*)wf->FindByName(_T("cmdOptionalStarts"));
  assert(wb);
  wb->set_visible(active_index == 0);
  if (ordered_task->optional_start_points_size() == 0)
    wb->SetCaption(_("Enable Alternate Starts"));
  else {
    TCHAR tmp[50];
    _stprintf(tmp, _T("%s (%d)"), _("Edit Alternates"),
        ordered_task->optional_start_points_size());
    wb->SetCaption(tmp);
  }

  EnableSizeEdit(ordered_task->get_factory_type() != TaskBehaviour::FACTORY_FAI_GENERAL);

  TCHAR bufType[100];
  TCHAR bufNamePrefix[100];

  switch (tp->GetType()) {
  case TaskPoint::START:
    _tcscpy(bufType, _T("Start point"));
    _tcscpy(bufNamePrefix, _T("Start: "));
    break;

  case TaskPoint::AST:
    _tcscpy(bufType, _T("Task point"));
    _stprintf(bufNamePrefix, _T("%d: "), active_index);
    break;

  case TaskPoint::AAT:
    _tcscpy(bufType, _T("Assigned area point"));
    _stprintf(bufNamePrefix, _T("%d: "), active_index);
    break;

  case TaskPoint::FINISH:
    _tcscpy(bufType, _T("Finish point"));
    _tcscpy(bufNamePrefix, _T("Finish: "));
    break;

  default:
    assert(true);
    break;
  }

  wf->SetCaption(bufType);

  wfrm = ((WndFrame*)wf->FindByName(_T("lblLocation")));
  if (wfrm) {
    TCHAR buff[100];
    _stprintf(buff, _T("%s %s"), bufNamePrefix, tp->GetWaypoint().name.c_str());
    wfrm->SetCaption(buff);
  }

  Refreshing = false; // reactivate onChange routines
}
Esempio n. 11
0
static void
HideAltitude()
{
  ShowFormControl(*wf, _T("prpAltitude"), false);
}