Пример #1
0
void
dlgAlternatesListShowModal(SingleWindow &parent)
{
  if (protected_task_manager == NULL)
    return;

  UpdateAlternates();
  UPixelScalar line_height = Fonts::map_bold.GetHeight() + Layout::Scale(6) +
                         Fonts::map_label.GetHeight();
  int i = ListPicker(parent, _("Alternates"), alternates.size(), 0,
                     line_height, PaintListItem, true);

  if (i < 0 || (unsigned)i >= alternates.size())
    return;

  dlgWaypointDetailsShowModal(parent, alternates[i].waypoint);
}
Пример #2
0
void
InfoBoxContentAlternateGR::Update(InfoBoxWindow &infobox)
{
  if (protected_task_manager == NULL) {
    infobox.SetInvalid();
    return;
  }

  const AbortTask::AlternateVector alternates =
    protected_task_manager->getAlternates();

  if (alternates.size() > 0 && index >= alternates.size())
    index = alternates.size() - 1;

  TCHAR tmp[32];
  _stprintf(tmp, _T("Altrn %d GR"), index+1);
  infobox.SetTitle(tmp);

  const Waypoint* way_point = (alternates.size()>index) ? &alternates[index].first : NULL;

  SetCommentFromWaypointName(infobox, way_point);
  if (!way_point) {
    infobox.SetInvalid();
    return;
  }

  const GlideResult& solution = alternates[index].second;
  fixed gradient = ::AngleToGradient(solution.destination_angle_ground());

  if (negative(gradient)) {
    infobox.SetColor(0);
    infobox.SetValue(_T("+++"));
    return;
  }
  if (::GradientValid(gradient)) {
    TCHAR tmp[32];
    _stprintf(tmp, _T("%d"), (int)gradient);
    infobox.SetValue(tmp);
  } else {
    infobox.SetInvalid();
  }

  // Set Color (blue/black)
  infobox.SetColor(solution.glide_reachable(true) ? 2 : 0);
}
Пример #3
0
void
dlgAlternatesListShowModal(SingleWindow &parent)
{
  if (protected_task_manager == NULL)
    return;

  UpdateAlternates();

  const DialogLook &look = UIGlobals::GetDialogLook();
  int i = ListPicker(parent, _("Alternates"), alternates.size(), 0,
                     WaypointListRenderer::GetHeight(look),
                     PaintListItem, true);

  if (i < 0 || (unsigned)i >= alternates.size())
    return;

  dlgWaypointDetailsShowModal(parent, alternates[i].waypoint);
}
Пример #4
0
void
AlternatesListWidget::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  UPixelScalar item_height = dialog_look.list.font_bold->GetHeight()
    + Layout::Scale(6) + dialog_look.small_font->GetHeight();
  assert(item_height > 0);

  CreateList(parent, dialog_look, rc, item_height);

  GetList().SetLength(alternates.size());
}
Пример #5
0
static void
PaintListItem(Canvas &canvas, const PixelRect rc, unsigned index)
{
  assert(index < alternates.size());

  const Waypoint &waypoint = alternates[index].waypoint;
  const GlideResult& solution = alternates[index].solution;

  WaypointListRenderer::Draw(canvas, rc, waypoint, solution.vector.distance,
                             solution.altitude_difference,
                             CommonInterface::main_window.GetLook().map.waypoint,
                             CommonInterface::GetMapSettings().waypoint);
}
Пример #6
0
  /* virtual methods from class List::Handler */
  virtual void OnPaintItem(Canvas &canvas, const PixelRect rc,
                           unsigned index) override {
    assert(index < alternates.size());

    const ComputerSettings &settings = CommonInterface::GetComputerSettings();
    const Waypoint &waypoint = alternates[index].waypoint;
    const GlideResult& solution = alternates[index].solution;

    WaypointListRenderer::Draw(canvas, rc, waypoint, solution.vector.distance,
                               solution.SelectAltitudeDifference(settings.task.glide),
                               UIGlobals::GetDialogLook(),
                               UIGlobals::GetMapLook().waypoint,
                               CommonInterface::GetMapSettings().waypoint);
  }
Пример #7
0
void
InfoBoxContentAlternateName::Update(InfoBoxWindow &infobox)
{
  if (protected_task_manager == NULL) {
    infobox.SetInvalid();
    return;
  }

  const AbortTask::AlternateVector alternates =
    protected_task_manager->getAlternates();

  if (alternates.size() > 0 && index >= alternates.size())
    index = alternates.size() - 1;

  TCHAR tmp[32];
  _stprintf(tmp, _T("Altrn %d"), index+1);
  infobox.SetTitle(tmp);

  const Waypoint* way_point = (alternates.size()>index) ? &alternates[index].first : NULL;

  SetCommentFromWaypointName(infobox, way_point);
  if (!way_point) {
    infobox.SetInvalid();
    return;
  }

  const GlideResult& solution = alternates[index].second;

  // Set Value
  Angle Value = solution.Vector.Bearing -
    XCSoarInterface::Basic().track;

  SetValueBearingDifference(infobox, Value);

  // Set Color (blue/black)
  infobox.SetColor(solution.glide_reachable(true) ? 2 : 0);
}