void TaskEditPanel::EditTaskPoint(unsigned ItemIndex) { if (ItemIndex < ordered_task->TaskSize()) { if (dlgTaskPointShowModal(*ordered_task, ItemIndex)) { *task_modified = true; ordered_task->ClearName(); ordered_task->UpdateGeometry(); RefreshView(); } } else if (!ordered_task->IsFull()) { OrderedTaskPoint* point = nullptr; AbstractTaskFactory &factory = ordered_task->GetFactory(); const Waypoint* way_point = ShowWaypointListDialog(ordered_task->TaskSize() > 0 ? ordered_task->GetPoint(ordered_task->TaskSize() - 1).GetLocation() : CommonInterface::Basic().location, ordered_task, ItemIndex); if (!way_point) return; if (ItemIndex == 0) { point = (OrderedTaskPoint*)factory.CreateStart(*way_point); } else { point = (OrderedTaskPoint*)factory.CreateIntermediate(*way_point); } if (point == nullptr) return; if (factory.Append(*point, true)) { *task_modified = true; ordered_task->ClearName(); ordered_task->UpdateGeometry(); RefreshView(); } delete point; } }
void TaskEditPanel::RefreshView() { UpdateButtons(); dialog.InvalidateTaskView(); unsigned length = ordered_task->TaskSize(); if (!ordered_task->IsFull()) ++length; GetList().SetLength(length); GetList().Invalidate(); { TCHAR text[300]; OrderedTaskSummary(ordered_task, text, false); summary.SetText(text); } if (GetList().IsVisible() && two_widgets != nullptr) two_widgets->UpdateLayout(); }