static void RefreshView() { wTaskView->invalidate(); OrderedTaskPoint* tp = ordered_task->get_tp(active_index); if (!tp) return; Refreshing = true; // tell onChange routines not to save form! TPLabelObservationZone ozv; ObservationZoneConstVisitor &visitor = ozv; visitor.Visit(*tp->get_oz()); WndFrame* wfrm = NULL; wfrm = ((WndFrame*)wf->FindByName(_T("lblType"))); if (wfrm) wfrm->SetCaption(OrderedTaskPointName(ordered_task->get_factory().getType(*tp))); WndButton* wb; wb = ((WndButton*)wf->FindByName(_T("butPrevious"))); if (wb) wb->set_enabled(active_index > 0); wb = ((WndButton*)wf->FindByName(_T("butNext"))); if (wb) wb->set_enabled(active_index < (ordered_task->task_size() - 1)); wb = (WndButton*)wf->FindByName(_T("cmdOptionalStarts")); assert(wb); wb->set_visible(active_index == 0); if (ordered_task->optional_start_points_size() == 0) wb->SetCaption(_("Enable Alternate Starts")); else { TCHAR tmp[50]; _stprintf(tmp, _T("%s (%d)"), _("Edit Alternates"), ordered_task->optional_start_points_size()); wb->SetCaption(tmp); } EnableSizeEdit(ordered_task->get_factory_type() != TaskBehaviour::FACTORY_FAI_GENERAL); TCHAR bufType[100]; TCHAR bufNamePrefix[100]; TPLabelTaskPoint tpv(bufType, bufNamePrefix); TaskPointConstVisitor &tp_visitor = tpv; tp_visitor.Visit(*tp); wf->SetCaption(tpv.textType); wfrm = ((WndFrame*)wf->FindByName(_T("lblLocation"))); if (wfrm) { TCHAR buff[100]; _stprintf(buff, _T("%s %s"), tpv.textNamePrefix, tp->get_waypoint().Name.c_str()); wfrm->SetCaption(buff); } Refreshing = false; // reactivate onChange routines }
static void RefreshView() { wTaskView->invalidate(); OrderedTaskPoint* tp = ordered_task->get_tp(active_index); if (!tp) return; Refreshing = true; // tell onChange routines not to save form! ShowFormControl(*wf, _T("frmOZLine"), false); ShowFormControl(*wf, _T("frmOZSector"), false); ShowFormControl(*wf, _T("frmOZCylinder"), false); const ObservationZonePoint &oz = *tp->get_oz(); switch (oz.shape) { case ObservationZonePoint::SECTOR: case ObservationZonePoint::ANNULAR_SECTOR: ShowFormControl(*wf, _T("frmOZSector"), true); LoadFormProperty(*wf, _T("prpOZSectorRadius"), ugDistance, ((const SectorZone &)oz).getRadius()); LoadFormProperty(*wf, _T("prpOZSectorStartRadial"), ((const SectorZone &)oz).getStartRadial().value_degrees()); LoadFormProperty(*wf, _T("prpOZSectorFinishRadial"), ((const SectorZone &)oz).getEndRadial().value_degrees()); if (oz.shape == ObservationZonePoint::ANNULAR_SECTOR) { LoadFormProperty(*wf, _T("prpOZSectorInnerRadius"), ugDistance, ((const AnnularSectorZone &)oz).getInnerRadius()); ShowFormControl(*wf, _T("prpOZSectorInnerRadius"), true); } else ShowFormControl(*wf, _T("prpOZSectorInnerRadius"), false); break; case ObservationZonePoint::LINE: ShowFormControl(*wf, _T("frmOZLine"), true); LoadFormProperty(*wf, _T("prpOZLineLength"), ugDistance, ((const LineSectorZone &)oz).getLength()); break; case ObservationZonePoint::CYLINDER: ShowFormControl(*wf, _T("frmOZCylinder"), true); LoadFormProperty(*wf, _T("prpOZCylinderRadius"), ugDistance, ((const CylinderZone &)oz).getRadius()); break; default: break; } WndFrame* wfrm = NULL; wfrm = ((WndFrame*)wf->FindByName(_T("lblType"))); if (wfrm) wfrm->SetCaption(OrderedTaskPointName(ordered_task->get_factory().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->set_visible(active_index == 0); if (ordered_task->optional_start_points_size() == 0) wb->SetCaption(_("Enable Alternate Starts")); else { TCHAR tmp[50]; _stprintf(tmp, _T("%s (%d)"), _("Edit Alternates"), ordered_task->optional_start_points_size()); wb->SetCaption(tmp); } EnableSizeEdit(ordered_task->get_factory_type() != TaskBehaviour::FACTORY_FAI_GENERAL); TCHAR bufType[100]; TCHAR bufNamePrefix[100]; switch (tp->GetType()) { case TaskPoint::START: _tcscpy(bufType, _T("Start point")); _tcscpy(bufNamePrefix, _T("Start: ")); break; case TaskPoint::AST: _tcscpy(bufType, _T("Task point")); _stprintf(bufNamePrefix, _T("%d: "), active_index); break; case TaskPoint::AAT: _tcscpy(bufType, _T("Assigned area point")); _stprintf(bufNamePrefix, _T("%d: "), active_index); break; case TaskPoint::FINISH: _tcscpy(bufType, _T("Finish point")); _tcscpy(bufNamePrefix, _T("Finish: ")); break; default: assert(true); break; } wf->SetCaption(bufType); wfrm = ((WndFrame*)wf->FindByName(_T("lblLocation"))); if (wfrm) { TCHAR buff[100]; _stprintf(buff, _T("%s %s"), bufNamePrefix, tp->GetWaypoint().name.c_str()); wfrm->SetCaption(buff); } Refreshing = false; // reactivate onChange routines }