Пример #1
0
static void
ShowMapItemDialog(const MapItem &item,
                  ProtectedAirspaceWarningManager *airspace_warnings)
{
  switch (item.type) {
  case MapItem::LOCATION:
  case MapItem::ARRIVAL_ALTITUDE:
  case MapItem::SELF:
  case MapItem::THERMAL:
#ifdef HAVE_SKYLINES_TRACKING_HANDLER
  case MapItem::SKYLINES_TRAFFIC:
#endif
    break;

  case MapItem::AIRSPACE:
    dlgAirspaceDetails(*((const AirspaceMapItem &)item).airspace,
                       airspace_warnings);
    break;
  case MapItem::WAYPOINT:
    dlgWaypointDetailsShowModal(((const WaypointMapItem &)item).waypoint);
    break;
  case MapItem::TASK_OZ:
    dlgTargetShowModal(((const TaskOZMapItem &)item).index);
    break;
  case MapItem::TRAFFIC:
    dlgFlarmTrafficDetailsShowModal(((const TrafficMapItem &)item).id);
    break;

#ifdef HAVE_NOAA
  case MapItem::WEATHER:
    dlgNOAADetailsShowModal(((const WeatherStationMapItem &)item).station);
    break;
#endif
  }
}
static void
OnDetailsClicked(gcc_unused WndButton &Sender)
{
  OrderedTaskPoint* task_point = ordered_task->get_tp(active_index);
  if (task_point)
    dlgWaypointDetailsShowModal(wf->GetMainWindow(), task_point->get_waypoint(), false);
}
Пример #3
0
static void
ShowMapItemDialog(const MapItem &item, SingleWindow &parent,
                  ProtectedAirspaceWarningManager *airspace_warnings)
{
  switch (item.type) {
  case MapItem::LOCATION:
  case MapItem::ARRIVAL_ALTITUDE:
  case MapItem::SELF:
  case MapItem::MARKER:
  case MapItem::THERMAL:
    break;

  case MapItem::AIRSPACE:
    dlgAirspaceDetails(*((const AirspaceMapItem &)item).airspace,
                       airspace_warnings);
    break;
  case MapItem::WAYPOINT:
    dlgWaypointDetailsShowModal(parent,
                                ((const WaypointMapItem &)item).waypoint);
    break;
  case MapItem::TASK_OZ:
    dlgTargetShowModal(((const TaskOZMapItem &)item).index);
    break;
  case MapItem::TRAFFIC:
    dlgFlarmTrafficDetailsShowModal(((const TrafficMapItem &)item).traffic.id);
    break;
  }
}
Пример #4
0
// WaypointDetails
// Displays waypoint details
//         current: the current active waypoint
//          select: brings up the waypoint selector, if the user then
//                  selects a waypoint, then the details dialog is shown.
//  See the waypoint dialog section of the reference manual
// for more info.
void
InputEvents::eventWaypointDetails(const TCHAR *misc)
{
  const NMEAInfo &basic = CommonInterface::Basic();
  WaypointPtr wp;

  bool allow_navigation = true;
  bool allow_edit = true;

  if (StringIsEqual(misc, _T("current"))) {
    if (protected_task_manager == NULL)
      return;

    wp = protected_task_manager->GetActiveWaypoint();
    if (!wp) {
      Message::AddMessage(_("No active waypoint!"));
      return;
    }

    /* due to a code limitation, we can't currently manipulate
       Waypoint instances taken from the task, because it would
       require updating lots of internal task state, and the waypoint
       editor doesn't know how to do that */
    allow_navigation = false;
    allow_edit = false;
  } else if (StringIsEqual(misc, _T("select"))) {
    wp = ShowWaypointListDialog(basic.location);
  }
  if (wp)
    dlgWaypointDetailsShowModal(std::move(wp),
                                allow_navigation, allow_edit);
}
Пример #5
0
bool
InfoBoxContentNextWaypoint::HandleKey(const InfoBoxKeyCodes keycode)
{
  if (protected_task_manager == NULL)
    return false;

  switch (keycode) {
  case ibkRight:
  case ibkUp:
    protected_task_manager->incrementActiveTaskPoint(1);
    return true;

  case ibkLeft:
  case ibkDown:
    protected_task_manager->incrementActiveTaskPoint(-1);
    return true;

  case ibkEnter:
    const Waypoint *wp = protected_task_manager->getActiveWaypoint();
    if (wp) {
      dlgWaypointDetailsShowModal(XCSoarInterface::main_window, *wp);
      return true;
    }
  }

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

  const DialogLook &dialog_look = UIGlobals::GetDialogLook();

  AlternatesListWidget widget(dialog_look);
  widget.Update();

  WidgetDialog dialog(dialog_look);
  dialog.CreateFull(parent, _("Alternates"), &widget);
  widget.CreateButtons(dialog);

  int i = dialog.ShowModal() == mrOK
    ? (int)widget.GetCursorIndex()
    : -1;
  dialog.StealWidget();

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

  dlgWaypointDetailsShowModal(parent, widget.alternates[i].waypoint);
}
Пример #7
0
void
dlgAlternatesListShowModal()
{
  if (protected_task_manager == nullptr)
    return;

  const DialogLook &dialog_look = UIGlobals::GetDialogLook();

  AlternatesListWidget widget(dialog_look);
  if (!widget.Update())
    /* no alternates: don't show the dialog */
    return;

  WidgetDialog dialog(dialog_look);
  dialog.CreateFull(UIGlobals::GetMainWindow(), _("Alternates"), &widget);
  widget.CreateButtons(dialog);
  dialog.EnableCursorSelection();

  int i = dialog.ShowModal() == mrOK
    ? (int)widget.GetCursorIndex()
    : -1;
  dialog.StealWidget();

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

  dlgWaypointDetailsShowModal(widget.alternates[i].waypoint);
}
Пример #8
0
static void
ShowNextWaypointDetails()
{
  if (protected_task_manager == nullptr)
    return;

  const Waypoint *wp = protected_task_manager->GetActiveWaypoint();
  if (wp == nullptr)
    return;

  dlgWaypointDetailsShowModal(*wp);
}
Пример #9
0
static void
ShowNextWaypointDetails()
{
  if (protected_task_manager == nullptr)
    return;

  auto wp = protected_task_manager->GetActiveWaypoint();
  if (wp == nullptr)
    return;

  dlgWaypointDetailsShowModal(std::move(wp));
}
Пример #10
0
static void
OnNameClicked()
{
  Waypoint waypoint;

  {
    ProtectedTaskManager::Lease lease(*protected_task_manager);
    const OrderedTask &task = lease->GetOrderedTask();
    if (target_point >= task.TaskSize())
      return;

    const OrderedTaskPoint &tp = task.GetTaskPoint(target_point);
    waypoint = tp.GetWaypoint();
  }

  dlgWaypointDetailsShowModal(waypoint);
}
Пример #11
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);
}
Пример #12
0
/**
 * Opens up the WaypointDetails window of the nearest
 * waypoint to location
 * @param way_points Waypoints including all possible
 * waypoints for the calculation
 * @param location Location where to search
 * @param range Maximum range to search
 * @param pan True if in Pan mode
 * @return True if a waypoint was found
 */
bool
PopupNearestWaypointDetails(const Waypoints &way_points,
                            const GeoPoint &location,
                            double range, bool scalefilter)
{
  const Waypoint *way_point;
  way_point = way_points.lookup_location(location, fixed(range));

  if (way_point &&
      (!scalefilter ||
       XCSoarInterface::main_window.map->VisibleProjection().WaypointInScaleFilter(*way_point))) {
    dlgWaypointSelectAddToLastUsed(*way_point);
    dlgWaypointDetailsShowModal(XCSoarInterface::main_window, *way_point);
    return true;
  }
  return false;
}
Пример #13
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);
}
Пример #14
0
// WaypointDetails
// Displays waypoint details
//         current: the current active waypoint
//          select: brings up the waypoint selector, if the user then
//                  selects a waypoint, then the details dialog is shown.
//  See the waypoint dialog section of the reference manual
// for more info.
void
InputEvents::eventWaypointDetails(const TCHAR *misc)
{
  const NMEAInfo &basic = CommonInterface::Basic();
  WaypointPtr wp;

  if (StringIsEqual(misc, _T("current"))) {
    if (protected_task_manager == NULL)
      return;

    wp = protected_task_manager->GetActiveWaypoint();
    if (!wp) {
      Message::AddMessage(_("No active waypoint!"));
      return;
    }
  } else if (StringIsEqual(misc, _T("select"))) {
    wp = ShowWaypointListDialog(basic.location);
  }
  if (wp)
    dlgWaypointDetailsShowModal(std::move(wp));
}
Пример #15
0
inline void
TaskPointWidget::OnDetailsClicked()
{
  const OrderedTaskPoint &task_point = ordered_task.GetPoint(active_index);
  dlgWaypointDetailsShowModal(task_point.GetWaypointPtr(), false);
}
Пример #16
0
static void
OnDetailsClicked()
{
  const OrderedTaskPoint &task_point = ordered_task->GetPoint(active_index);
  dlgWaypointDetailsShowModal(task_point.GetWaypoint(), false);
}