void TaskPointWidget::RefreshView() { map.Invalidate(); OrderedTaskPoint &tp = ordered_task.GetPoint(active_index); properties_dock.DeleteWidget(); ObservationZonePoint &oz = tp.GetObservationZone(); const bool is_fai_general = ordered_task.GetFactoryType() == TaskFactoryType::FAI_GENERAL; auto *properties_widget = CreateObservationZoneEditWidget(oz, is_fai_general); if (properties_widget != nullptr) { properties_widget->SetListener(this); properties_dock.SetWidget(properties_widget); } else properties_dock.SetWidget(new PanelWidget()); type_label.SetCaption(OrderedTaskPointName(ordered_task.GetFactory().GetType(tp))); previous_button->SetEnabled(active_index > 0); next_button->SetEnabled(active_index < (ordered_task.TaskSize() - 1)); optional_starts.SetVisible(active_index == 0); if (!ordered_task.HasOptionalStarts()) optional_starts.SetCaption(_("Enable Alternate Starts")); else { StaticString<50> tmp; tmp.Format(_T("%s (%d)"), _("Edit Alternates"), ordered_task.GetOptionalStartPointCount()); optional_starts.SetCaption(tmp); } if (tp.GetType() == TaskPointType::AST) { const ASTPoint &ast = (const ASTPoint &)tp; score_exit.Show(); score_exit.SetState(ast.GetScoreExit()); } else score_exit.Hide(); StaticString<100> name_prefix_buffer, type_buffer; switch (tp.GetType()) { case TaskPointType::START: type_buffer = _("Start point"); name_prefix_buffer = _T("Start: "); break; case TaskPointType::AST: type_buffer = _("Task point"); name_prefix_buffer.Format(_T("%d: "), active_index); break; case TaskPointType::AAT: type_buffer = _("Assigned area point"); name_prefix_buffer.Format(_T("%d: "), active_index); break; case TaskPointType::FINISH: type_buffer = _("Finish point"); name_prefix_buffer = _T("Finish: "); break; default: gcc_unreachable(); } dialog.SetCaption(type_buffer); { StaticString<100> buffer; buffer.Format(_T("%s %s"), name_prefix_buffer.c_str(), tp.GetWaypoint().name.c_str()); waypoint_name.SetCaption(buffer); } }
static void RefreshView() { wTaskView->Invalidate(); OrderedTaskPoint &tp = ordered_task->GetPoint(active_index); dock->SetWidget(new PanelWidget()); ObservationZonePoint &oz = tp.GetObservationZone(); const bool is_fai_general = ordered_task->GetFactoryType() == TaskFactoryType::FAI_GENERAL; properties_widget = CreateObservationZoneEditWidget(oz, is_fai_general); if (properties_widget != nullptr) { properties_widget->SetListener(&listener); dock->SetWidget(properties_widget); } WndFrame* wfrm = nullptr; wfrm = ((WndFrame*)wf->FindByName(_T("lblType"))); if (wfrm) wfrm->SetCaption(OrderedTaskPointName(ordered_task->GetFactory().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->SetVisible(active_index == 0); if (!ordered_task->HasOptionalStarts()) wb->SetCaption(_("Enable Alternate Starts")); else { StaticString<50> tmp; tmp.Format(_T("%s (%d)"), _("Edit Alternates"), ordered_task->GetOptionalStartPointCount()); wb->SetCaption(tmp); } CheckBoxControl &score_exit = *(CheckBoxControl *) wf->FindByName(_T("ScoreExit")); if (tp.GetType() == TaskPointType::AST) { const ASTPoint &ast = (const ASTPoint &)tp; score_exit.Show(); score_exit.SetState(ast.GetScoreExit()); } else score_exit.Hide(); StaticString<100> name_prefix_buffer, type_buffer; switch (tp.GetType()) { case TaskPointType::START: type_buffer = _("Start point"); name_prefix_buffer = _T("Start: "); break; case TaskPointType::AST: type_buffer = _("Task point"); name_prefix_buffer.Format(_T("%d: "), active_index); break; case TaskPointType::AAT: type_buffer = _("Assigned area point"); name_prefix_buffer.Format(_T("%d: "), active_index); break; case TaskPointType::FINISH: type_buffer = _("Finish point"); name_prefix_buffer = _T("Finish: "); break; default: gcc_unreachable(); } wf->SetCaption(type_buffer); wfrm = ((WndFrame*)wf->FindByName(_T("lblLocation"))); if (wfrm) { StaticString<100> buffer; buffer.Format(_T("%s %s"), name_prefix_buffer.c_str(), tp.GetWaypoint().name.c_str()); wfrm->SetCaption(buffer); } }