static void Update() { TCHAR sTmp[1000]; assert(wf != NULL); assert(wInfo != NULL); assert(wGrid != NULL); assert(csw != NULL); assert(glide_computer != NULL); const ComputerSettings &settings_computer = blackboard->GetComputerSettings(); const DerivedInfo &calculated = blackboard->Calculated(); switch (page) { case AnalysisPage::BAROGRAPH: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Barograph")); wf->SetCaption(sTmp); BarographCaption(sTmp, glide_computer->GetFlightStats()); wInfo->SetCaption(sTmp); SetCalcCaption(_("Settings")); break; case AnalysisPage::CLIMB: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Climb")); wf->SetCaption(sTmp); ClimbChartCaption(sTmp, glide_computer->GetFlightStats()); wInfo->SetCaption(sTmp); SetCalcCaption(_("Task Calc")); break; case AnalysisPage::THERMAL_BAND: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Thermal Band")); wf->SetCaption(sTmp); ClimbChartCaption(sTmp, glide_computer->GetFlightStats()); wInfo->SetCaption(sTmp); SetCalcCaption(_T("")); break; case AnalysisPage::WIND: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Wind at Altitude")); wf->SetCaption(sTmp); wInfo->SetCaption(_T("")); SetCalcCaption(_("Set Wind")); break; case AnalysisPage::POLAR: _stprintf(sTmp, _T("%s: %s (%s %d kg)"), _("Analysis"), _("Glide Polar"), _("Mass"), (int)settings_computer.polar.glide_polar_task.GetTotalMass()); wf->SetCaption(sTmp); GlidePolarCaption(sTmp, settings_computer.polar.glide_polar_task); wInfo->SetCaption(sTmp); SetCalcCaption(_("Settings")); break; case AnalysisPage::TEMPTRACE: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Temp Trace")); wf->SetCaption(sTmp); TemperatureChartCaption(sTmp, glide_computer->GetCuSonde()); wInfo->SetCaption(sTmp); SetCalcCaption(_("Settings")); break; case AnalysisPage::TASK_SPEED: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Task Speed")); wf->SetCaption(sTmp); wInfo->SetCaption(_T("")); SetCalcCaption(_("Task Calc")); break; case AnalysisPage::TASK: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Task")); wf->SetCaption(sTmp); FlightStatisticsRenderer::CaptionTask(sTmp, calculated); wInfo->SetCaption(sTmp); SetCalcCaption(_("Task calc")); break; case AnalysisPage::OLC: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), ContestToString(settings_computer.contest.contest)); wf->SetCaption(sTmp); SetCalcCaption(_T("")); FlightStatisticsRenderer::CaptionOLC(sTmp, settings_computer.contest, calculated); wInfo->SetCaption(sTmp); break; case AnalysisPage::AIRSPACE: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Airspace")); wf->SetCaption(sTmp); wInfo->SetCaption(_T("")); SetCalcCaption(_("Warnings")); break; case AnalysisPage::COUNT: gcc_unreachable(); } switch (page) { case AnalysisPage::AIRSPACE: UpdateCrossSection(); csw->Invalidate(); csw->Show(); wGrid->Hide(); break; default: csw->Hide(); wGrid->Show(); wGrid->Invalidate(); break; } }
static void Update(void) { TCHAR sTmp[1000]; assert(wf != NULL); assert(wInfo != NULL); assert(wGrid != NULL); assert(csw != NULL); assert(glide_computer != NULL); const ComputerSettings &settings_computer = blackboard->GetComputerSettings(); const DerivedInfo &calculated = blackboard->Calculated(); FlightStatisticsRenderer fs(glide_computer->GetFlightStats(), look->chart, look->map); switch (page) { case ANALYSIS_PAGE_BAROGRAPH: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Barograph")); wf->SetCaption(sTmp); fs.CaptionBarograph(sTmp); wInfo->SetCaption(sTmp); SetCalcCaption(_("Settings")); break; case ANALYSIS_PAGE_CLIMB: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Climb")); wf->SetCaption(sTmp); fs.CaptionClimb(sTmp); wInfo->SetCaption(sTmp); SetCalcCaption(_("Task Calc")); break; case ANALYSIS_PAGE_THERMAL_BAND: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Thermal Band")); wf->SetCaption(sTmp); fs.CaptionClimb(sTmp); wInfo->SetCaption(sTmp); SetCalcCaption(_T("")); break; case ANALYSIS_PAGE_WIND: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Wind At Altitude")); wf->SetCaption(sTmp); wInfo->SetCaption(_T("")); SetCalcCaption(_("Set Wind")); break; case ANALYSIS_PAGE_POLAR: _stprintf(sTmp, _T("%s: %s (%s %d kg)"), _("Analysis"), _("Glide Polar"), _("Mass"), (int)settings_computer.glide_polar_task.GetTotalMass()); wf->SetCaption(sTmp); fs.CaptionPolar(sTmp, settings_computer.glide_polar_task); wInfo->SetCaption(sTmp); SetCalcCaption(_("Settings")); break; case ANALYSIS_PAGE_TEMPTRACE: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Temp Trace")); wf->SetCaption(sTmp); fs.CaptionTempTrace(sTmp, glide_computer->GetCuSonde()); wInfo->SetCaption(sTmp); SetCalcCaption(_("Settings")); break; case ANALYSIS_PAGE_TASK_SPEED: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Task Speed")); wf->SetCaption(sTmp); wInfo->SetCaption(_T("")); SetCalcCaption(_("Task Calc")); break; case ANALYSIS_PAGE_TASK: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Task")); wf->SetCaption(sTmp); fs.CaptionTask(sTmp, calculated); wInfo->SetCaption(sTmp); SetCalcCaption(_("Task calc")); break; case ANALYSIS_PAGE_OLC: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), ContestToString(settings_computer.task.contest)); wf->SetCaption(sTmp); SetCalcCaption(_T("")); fs.CaptionOLC(sTmp, settings_computer.task, calculated); wInfo->SetCaption(sTmp); break; case ANALYSIS_PAGE_AIRSPACE: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Airspace")); wf->SetCaption(sTmp); wInfo->SetCaption(_T("")); SetCalcCaption(_("Warnings")); break; case ANALYSIS_PAGE_COUNT: assert(false); break; } switch (page) { case ANALYSIS_PAGE_AIRSPACE: UpdateCrossSection(); csw->invalidate(); csw->show(); wGrid->hide(); break; default: csw->hide(); wGrid->show(); wGrid->invalidate(); break; } }
static void Update(void) { TCHAR sTmp[1000]; FlightStatistics &fs = glide_computer.GetFlightStats(); GlidePolar polar = protected_task_manager.get_glide_polar(); const CommonStats& stats = XCSoarInterface::Calculated().common_stats; switch (page) { case ANALYSIS_PAGE_BAROGRAPH: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Barograph")); wf->SetCaption(sTmp); fs.CaptionBarograph(sTmp); wInfo->SetCaption(sTmp); SetCalcCaption(_("Settings")); break; case ANALYSIS_PAGE_CLIMB: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Climb")); wf->SetCaption(sTmp); fs.CaptionClimb(sTmp); wInfo->SetCaption(sTmp); SetCalcCaption(_("Task calc")); break; case ANALYSIS_PAGE_WIND: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Wind at Altitude")); wf->SetCaption(sTmp); wInfo->SetCaption(_T("")); SetCalcCaption(_("Set wind")); break; case ANALYSIS_PAGE_POLAR: _stprintf(sTmp, _T("%s: %s (%s %d kg)"), _("Analysis"), _("Glide Polar"), _("Mass"), (int)polar.get_all_up_weight()); wf->SetCaption(sTmp); fs.CaptionPolar(sTmp, polar); wInfo->SetCaption(sTmp); SetCalcCaption(_("Settings")); break; case ANALYSIS_PAGE_TEMPTRACE: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Temp trace")); wf->SetCaption(sTmp); fs.CaptionTempTrace(sTmp); wInfo->SetCaption(sTmp); SetCalcCaption(_("Settings")); break; case ANALYSIS_PAGE_TASK_SPEED: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Task speed")); wf->SetCaption(sTmp); wInfo->SetCaption(_T("")); SetCalcCaption(_("Task calc")); break; case ANALYSIS_PAGE_TASK: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Task")); wf->SetCaption(sTmp); fs.CaptionTask(sTmp, XCSoarInterface::Calculated()); wInfo->SetCaption(sTmp); SetCalcCaption(_("Task calc")); break; case ANALYSIS_PAGE_OLC: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("OnLine Contest")); wf->SetCaption(sTmp); TCHAR timetext1[100]; Units::TimeToText(timetext1, (int)stats.olc.time); TCHAR distance[100]; Units::FormatUserDistance(stats.olc.distance, distance, 100); _stprintf(sTmp, (Layout::landscape ? _T("%s:\r\n %s\r\n%s:\r\n %.1f %s\r\n%s: %s\r\n%s: %d %s\r\n") : _T("%s: %s\r\n%s: %.1f %s\r\n%s: %s\r\n%s: %d %s\r\n")), _("Distance"), distance, _("Score"), (double)stats.olc.score, _("pts"), _("Time"), timetext1, _("Speed"), (int)Units::ToUserUnit(stats.olc.speed, Units::TaskSpeedUnit), Units::GetTaskSpeedName()); wInfo->SetCaption(sTmp); SetCalcCaption(_T("")); break; case ANALYSIS_PAGE_AIRSPACE: _stprintf(sTmp, _T("%s: %s"), _("Analysis"), _("Airspace")); wf->SetCaption(sTmp); wInfo->SetCaption(_T("")); SetCalcCaption(_("Warnings")); break; case ANALYSIS_PAGE_COUNT: assert(false); break; } wGrid->set_visible(page < ANALYSIS_PAGE_COUNT); if (wGrid != NULL) wGrid->invalidate(); }
void AnalysisWidget::Update() { TCHAR sTmp[1000]; const ComputerSettings &settings_computer = blackboard.GetComputerSettings(); const DerivedInfo &calculated = blackboard.Calculated(); switch (page) { case AnalysisPage::BAROGRAPH: StringFormatUnsafe(sTmp, _T("%s: %s"), _("Analysis"), _("Barograph")); dialog.SetCaption(sTmp); BarographCaption(sTmp, glide_computer.GetFlightStats()); info.SetText(sTmp); SetCalcCaption(_("Settings")); break; case AnalysisPage::CLIMB: StringFormatUnsafe(sTmp, _T("%s: %s"), _("Analysis"), _("Climb")); dialog.SetCaption(sTmp); ClimbChartCaption(sTmp, glide_computer.GetFlightStats()); info.SetText(sTmp); SetCalcCaption(_("Task Calc")); break; case AnalysisPage::THERMAL_BAND: StringFormatUnsafe(sTmp, _T("%s: %s"), _("Analysis"), _("Thermal Band")); dialog.SetCaption(sTmp); ClimbChartCaption(sTmp, glide_computer.GetFlightStats()); info.SetText(sTmp); SetCalcCaption(_T("")); break; case AnalysisPage::WIND: StringFormatUnsafe(sTmp, _T("%s: %s"), _("Analysis"), _("Wind at Altitude")); dialog.SetCaption(sTmp); info.SetText(_T("")); SetCalcCaption(_("Set Wind")); break; case AnalysisPage::POLAR: StringFormatUnsafe(sTmp, _T("%s: %s (%s %d kg)"), _("Analysis"), _("Glide Polar"), _("Mass"), (int)settings_computer.polar.glide_polar_task.GetTotalMass()); dialog.SetCaption(sTmp); GlidePolarCaption(sTmp, settings_computer.polar.glide_polar_task); info.SetText(sTmp); SetCalcCaption(_("Settings")); break; case AnalysisPage::TEMPTRACE: StringFormatUnsafe(sTmp, _T("%s: %s"), _("Analysis"), _("Temp Trace")); dialog.SetCaption(sTmp); TemperatureChartCaption(sTmp, glide_computer.GetCuSonde()); info.SetText(sTmp); SetCalcCaption(_("Settings")); break; case AnalysisPage::TASK_SPEED: StringFormatUnsafe(sTmp, _T("%s: %s"), _("Analysis"), _("Task Speed")); dialog.SetCaption(sTmp); info.SetText(_T("")); SetCalcCaption(_("Task Calc")); break; case AnalysisPage::TASK: StringFormatUnsafe(sTmp, _T("%s: %s"), _("Analysis"), _("Task")); dialog.SetCaption(sTmp); FlightStatisticsRenderer::CaptionTask(sTmp, calculated); info.SetText(sTmp); SetCalcCaption(_("Task calc")); break; case AnalysisPage::OLC: StringFormatUnsafe(sTmp, _T("%s: %s"), _("Analysis"), ContestToString(settings_computer.contest.contest)); dialog.SetCaption(sTmp); SetCalcCaption(_T("")); FlightStatisticsRenderer::CaptionOLC(sTmp, settings_computer.contest, calculated); info.SetText(sTmp); break; case AnalysisPage::AIRSPACE: StringFormatUnsafe(sTmp, _T("%s: %s"), _("Analysis"), _("Airspace")); dialog.SetCaption(sTmp); info.SetText(_T("")); SetCalcCaption(_("Warnings")); break; case AnalysisPage::COUNT: gcc_unreachable(); } if (page == AnalysisPage::AIRSPACE) chart.UpdateCrossSection(blackboard.Basic(), calculated, settings_computer.task.glide, settings_computer.polar.glide_polar_task, blackboard.GetMapSettings()); chart.Invalidate(); }