const Waypoint* dlgWaypointSelect(SingleWindow &parent, const GeoPoint &_location, OrderedTask *ordered_task, const unsigned ordered_task_index) { dialog = LoadDialog(callback_table, parent, Layout::landscape ? _T("IDR_XML_WAYPOINTSELECT_L") : _T("IDR_XML_WAYPOINTSELECT")); assert(dialog != NULL); #ifdef GNAV dialog->SetKeyDownNotify(FormKeyDown); #endif const DialogLook &dialog_look = UIGlobals::GetDialogLook(); waypoint_list = (ListControl*)dialog->FindByName(_T("frmWaypointList")); assert(waypoint_list != NULL); waypoint_list->SetActivateCallback(OnWaypointListEnter); waypoint_list->SetPaintItemCallback(OnPaintListItem); waypoint_list->SetItemHeight(WaypointListRenderer::GetHeight(dialog_look)); name_button = (WndButton*)dialog->FindByName(_T("cmdFltName")); name_button->SetOnLeftNotify(OnFilterNameButtonLeft); name_button->SetOnRightNotify(OnFilterNameButtonRight); distance_filter = (WndProperty*)dialog->FindByName(_T("prpFltDistance")); direction_filter = (WndProperty*)dialog->FindByName(_T("prpFltDirection")); type_filter = (WndProperty *)dialog->FindByName(_T("prpFltType")); location = _location; triangle_validator = new FAITrianglePointValidator(ordered_task, ordered_task_index); last_heading = CommonInterface::Calculated().heading; PrepareData(); UpdateList(); dialog->SetTimerNotify(OnTimerNotify); if (dialog->ShowModal() != mrOK) { delete dialog; delete triangle_validator; return NULL; } unsigned index = waypoint_list->GetCursorIndex(); delete dialog; delete triangle_validator; const Waypoint* retval = NULL; if (index < waypoint_select_info.size()) retval = waypoint_select_info[index].waypoint; if (retval != NULL) dlgWaypointSelectAddToLastUsed(*retval); return retval; }
/** * 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; }