static void Update() { WndProperty* wp; TCHAR Text[100]; double teammateBearing = XCSoarInterface::Calculated().TeammateBearing; double teammateRange = XCSoarInterface::Calculated().TeammateRange; if (XCSoarInterface::SettingsComputer().TeamCodeRefWaypoint >= 0) { double Value = XCSoarInterface::Calculated().TeammateBearing - XCSoarInterface::Basic().TrackBearing; if (Value < -180.0) Value += 360.0; else if (Value > 180.0) Value -= 360.0; if (Value > 1) _stprintf(Text, TEXT("%2.0f")TEXT(DEG)TEXT(">"), Value); else if (Value < -1) _stprintf(Text, TEXT("<%2.0f")TEXT(DEG), -Value); else _tcscpy(Text, TEXT("<>")); } else { _tcscpy(Text, TEXT("---")); } wp = (WndProperty*)wf->FindByName(TEXT("prpRelBearing")); if (wp) { wp->SetText(Text); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpBearing")); if (wp) { wp->GetDataField()->SetAsFloat(teammateBearing); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpRange")); if (wp) { wp->GetDataField()->SetAsFloat(teammateRange*DISTANCEMODIFY); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpOwnCode")); if (wp) { _tcsncpy(Text,XCSoarInterface::Calculated().OwnTeamCode,5); Text[5] = '\0'; wp->SetText(Text); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpMateCode")); if (wp) { wp->SetText(XCSoarInterface::SettingsComputer().TeammateCode); wp->RefreshDisplay(); } }
static void UpdateValuesTimes(void) { WndProperty *wp; TCHAR Temp[1000]; double sunsettime; int sunsethours; int sunsetmins; sunsettime = DoSunEphemeris(GPS_INFO.Longitude, GPS_INFO.Latitude); sunsethours = (int)sunsettime; sunsetmins = (int)((sunsettime-sunsethours)*60); wp = (WndProperty*)wf->FindByName(TEXT("prpSunset")); if (wp) { _stprintf(Temp, TEXT("%02d:%02d"), sunsethours,sunsetmins); wp->SetText(Temp); } wp = (WndProperty*)wf->FindByName(TEXT("prpLocalTime")); if (wp) { Units::TimeToText(Temp, (int)DetectCurrentTime()); wp->SetText(Temp); } wp = (WndProperty*)wf->FindByName(TEXT("prpTakeoffTime")); if (wp) { if (CALCULATED_INFO.FlightTime>0) { Units::TimeToText(Temp, (int)TimeLocal((long)CALCULATED_INFO.TakeOffTime)); wp->SetText(Temp); } else { wp->SetText(TEXT("")); } } wp = (WndProperty*)wf->FindByName(TEXT("prpLandingTime")); if (wp) { if (!CALCULATED_INFO.Flying) { Units::TimeToText(Temp, (int)TimeLocal((long)(CALCULATED_INFO.TakeOffTime +CALCULATED_INFO.FlightTime))); wp->SetText(Temp); } else { wp->SetText(TEXT("")); } } wp = (WndProperty*)wf->FindByName(TEXT("prpFlightTime")); if (wp) { if (CALCULATED_INFO.FlightTime > 0){ Units::TimeToText(Temp, (int)CALCULATED_INFO.FlightTime); wp->SetText(Temp); } else { wp->SetText(TEXT("")); } } }
static void UpdateValuesTimes(void) { WndProperty *wp; TCHAR Temp[1000]; double sunsettime; int sunsethours; int sunsetmins; sunsettime = XCSoarInterface::Calculated().TimeSunset; sunsethours = (int)sunsettime; sunsetmins = (int)((sunsettime-sunsethours)*60); wp = (WndProperty*)wf->FindByName(TEXT("prpSunset")); if (wp) { _stprintf(Temp, TEXT("%02d:%02d"), sunsethours,sunsetmins); wp->SetText(Temp); } wp = (WndProperty*)wf->FindByName(TEXT("prpLocalTime")); if (wp) { Units::TimeToText(Temp, (int)DetectCurrentTime(&XCSoarInterface::Basic())); wp->SetText(Temp); } wp = (WndProperty*)wf->FindByName(TEXT("prpTakeoffTime")); if (wp) { if (XCSoarInterface::Calculated().FlightTime>0) { Units::TimeToText(Temp, (int)TimeLocal((long)XCSoarInterface::Calculated().TakeOffTime)); wp->SetText(Temp); } else { wp->SetText(TEXT("")); } } wp = (WndProperty*)wf->FindByName(TEXT("prpLandingTime")); if (wp) { if (!XCSoarInterface::Calculated().Flying) { Units::TimeToText(Temp, (int)TimeLocal((long)(XCSoarInterface::Calculated().TakeOffTime +XCSoarInterface::Calculated().FlightTime))); wp->SetText(Temp); } else { wp->SetText(TEXT("")); } } wp = (WndProperty*)wf->FindByName(TEXT("prpFlightTime")); if (wp) { if (XCSoarInterface::Calculated().FlightTime > 0){ Units::TimeToText(Temp, (int)XCSoarInterface::Calculated().FlightTime); wp->SetText(Temp); } else { wp->SetText(TEXT("")); } } }
static void UpdateTextboxProp(void) { WndProperty *wp; wp = (WndProperty*)wf->FindByName(TEXT("prpText")); if (wp) { wp->SetText(edittext); } }
void RowFormWidget::AddReadOnly(const TCHAR *label, const TCHAR *help, const TCHAR *text) { WndProperty *control = Add(label, help, true); if (text != NULL) control->SetText(text); }
static void Update() { tstring metar_taf = _T(""); ParsedMETAR parsed; if (NOAAStore::GetParsedMETAR(station_index, parsed)) { TCHAR buffer[256]; if (parsed.temperatures_available) { _stprintf(buffer, _T("%s: %.1f %s\n"), _("Temperature"), (double)Units::ToUserTemperature(parsed.temperature), Units::GetTemperatureName()); metar_taf += buffer; _stprintf(buffer, _T("%s: %.1f %s\n\n"), _("Dew point"), (double)Units::ToUserTemperature(parsed.dew_point), Units::GetTemperatureName()); metar_taf += buffer; } if (parsed.wind_available) { TCHAR buffer2[16]; Units::FormatUserWindSpeed(parsed.wind.norm, buffer2, 16); _stprintf(buffer, _T("%s: %.0f" DEG " %s\n\n"), _("Wind"), (double)parsed.wind.bearing.value_degrees(), buffer2); metar_taf += buffer; } if (parsed.qnh_available) { _stprintf(buffer, _T("%s: %.0f hPa\n\n"), _("QNH"), (double)parsed.qnh.GetQNH()); metar_taf += buffer; } } METAR metar; if (!NOAAStore::GetMETAR(station_index, metar)) { metar_taf += _("No METAR available!"); } else { metar_taf += metar.content.c_str(); } metar_taf += _T("\n\n"); TAF taf; if (!NOAAStore::GetTAF(station_index, taf)) { metar_taf += _("No TAF available!"); } else { metar_taf += taf.content.c_str(); } WndProperty* wp = (WndProperty*)wf->FindByName(_T("DetailsText")); wp->SetText(metar_taf.c_str()); }
static void SetValues(void) { assert(airspace); WndProperty* wp; wp = (WndProperty*)wf->FindByName(_T("prpName")); if (wp) { wp->SetText(airspace->get_name_text(true).c_str()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpType")); if (wp) { wp->SetText(airspace->get_type_text()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpTop")); if (wp) { wp->SetText(airspace->get_top_text().c_str()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpBase")); if (wp) { wp->SetText(airspace->get_base_text().c_str()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpRange")); if (wp) { const GeoPoint &ac_loc = XCSoarInterface::Basic().Location; const GeoPoint closest_loc = airspace->closest_point(ac_loc); const GeoVector vec(ac_loc, closest_loc); TCHAR buf[80]; _stprintf(buf, _T("%d%s"), (int)Units::ToUserUnit(vec.Distance, Units::DistanceUnit), Units::GetDistanceName()); wp->SetText(buf); wp->RefreshDisplay(); } }
void dlgStartTaskShowModal(bool *validStart, double Time, double Speed, double Altitude){ char filename[MAX_PATH]; LocalPathS(filename, TEXT("dlgStartTask.xml")); wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_STARTTASK")); if (wf) { WndProperty* wp; TCHAR Temp[80]; wp = (WndProperty*)wf->FindByName(TEXT("prpTime")); if (wp) { Units::TimeToText(Temp, (int)TimeLocal((int)Time)); wp->SetText(Temp); } wp = (WndProperty*)wf->FindByName(TEXT("prpSpeed")); if (wp) { _stprintf(Temp, TEXT("%.0f %s"), (double) TASKSPEEDMODIFY * Speed, Units::GetTaskSpeedName()); wp->SetText(Temp); } wp = (WndProperty*)wf->FindByName(TEXT("prpAltitude")); if (wp) { _stprintf(Temp, TEXT("%.0f %s"), (double) Altitude*ALTITUDEMODIFY, Units::GetAltitudeName()); wp->SetText(Temp); } wf->ShowModal(); delete wf; } wf = NULL; *validStart = startIsValid; }
void SiteConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { buttonWaypoints = ((WndButton *)ConfigPanel::GetForm().FindByName(_T("cmdWaypoints"))); assert (buttonWaypoints); buttonWaypoints->SetOnClickNotify(OnWaypoints); WndProperty *wp = Add(_T(""), 0, true); wp->SetText(GetPrimaryDataPath()); wp->SetEnabled(false); AddFileReader(_("Map database"), _("The name of the file (.xcm) containing terrain, topography, and optionally " "waypoints, their details and airspaces."), szProfileMapFile, _T("*.xcm\0*.lkm\0")); AddFileReader(_("Waypoints"), _("Primary waypoints file. Supported file types are Cambridge/WinPilot files (.dat), " "Zander files (.wpz) or SeeYou files (.cup)."), szProfileWaypointFile, _T("*.dat\0*.xcw\0*.cup\0*.wpz\0*.wpt\0")); AddFileReader(_("More waypoints"), _("Secondary waypoints file. This may be used to add waypoints for a competition."), szProfileAdditionalWaypointFile, _T("*.dat\0*.xcw\0*.cup\0*.wpz\0*.wpt\0")); SetExpertRow(AdditionalWaypointFile); AddFileReader(_("Watched waypoints"), _("Waypoint file containing special waypoints for which additional computations like " "calculation of arrival height in map display always takes place. Useful for " "waypoints like known reliable thermal sources (e.g. powerplants) or mountain passes."), szProfileWatchedWaypointFile, _T("*.dat\0*.xcw\0*.cup\0*.wpz\0*.wpt\0")); SetExpertRow(WatchedWaypointFile); AddFileReader(_("Airspaces"), _("The file name of the primary airspace file."), szProfileAirspaceFile, _T("*.txt\0*.air\0*.sua\0")); AddFileReader(_("More airspaces"), _("The file name of the secondary airspace file."), szProfileAdditionalAirspaceFile, _T("*.txt\0*.air\0*.sua\0")); SetExpertRow(AdditionalAirspaceFile); AddFileReader(_("Terrain file"), _("The name of the file containing digital elevation terrain data."), szProfileTerrainFile, _T("*.jp2\0")); SetExpertRow(TerrainFile); AddFileReader(_("Topography file"), _("Specifies the file defining the topographical features."), szProfileTopographyFile, _T("*.tpl\0")); SetExpertRow(TopographyFile); AddFileReader(_("Waypoint details"), _("The file may contain extracts from enroute supplements or other contributed " "information about individual waypoints and airfields."), szProfileAirfieldFile, _T("*.txt\0")); SetExpertRow(AirfieldFile); }
void SetFormValue(SubForm &form, const TCHAR *control_name, const TCHAR *value) { assert(control_name != NULL); assert(value != NULL); WndProperty *ctl = (WndProperty *)form.FindByName(control_name); assert(ctl != NULL); ctl->SetText(value); }
static void UpdateTextboxProp(void) { WndProperty *wp; wp = (WndProperty*)wf->FindByName(_T("prpText")); if (!wp) return; wp->SetText(edittext); UpdateAllowedCharacters(); }
void TimeConfigPanel::SetLocalTime(int utc_offset) { WndProperty* wp; TCHAR temp[20]; int time(XCSoarInterface::Basic().time); Units::TimeToTextHHMMSigned(temp, TimeLocal(time, utc_offset)); wp = (WndProperty*)form.FindByName(_T("prpLocalTime")); assert(wp != NULL); wp->SetText(temp); wp->RefreshDisplay(); }
static void UpdateTextboxProp(void) { WndProperty *wp; wp = (WndProperty*)wf->FindByName(TEXT("prpText")); if (wp) { wp->SetText(edittext); if(WaypointKeyRed) wp->SetCaption(MsgToken(949)); else wp->SetCaption(TEXT("Text")); } wp = (WndProperty*)wf->FindByName(TEXT("prpUnit")); if(wp && wKeyboardPopupWndProperty) { DataField* pField = wKeyboardPopupWndProperty->GetDataField(); if(pField) { wp->SetCaption(pField->GetUnits()); wp->RefreshDisplay(); wp->Redraw(); } } { WndButton *wb; if(WaypointKeyRed) { ReduceKeysByWaypointList(); wb = (WndButton*) wf->FindByName(TEXT("prpDate")); if(wb != NULL) wb->SetVisible(false); wb = (WndButton*) wf->FindByName(TEXT("prpTime")); if(wb != NULL) wb->SetVisible(false); } wp = (WndProperty*)wf->FindByName(TEXT("prpMatch"));; if(wp != NULL) wp->SetVisible(WaypointKeyRed); /* CharUpper(szLanguageFile); BOOL bGerChar = false; if( _tcscmp(szLanguageFile,_T("GERMAN.LNG"))==0) bGerChar = true; wb = (WndButton*) wf->FindByName(TEXT("prpAe")); if(wb != NULL) wb->SetVisible(bGerChar); wb = (WndButton*) wf->FindByName(TEXT("prpOe")); if(wb != NULL) wb->SetVisible(bGerChar); wb = (WndButton*) wf->FindByName(TEXT("prpUe")); if(wb != NULL) wb->SetVisible(bGerChar); */ } }
void SiteConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { WndProperty *wp = Add(_T(""), 0, true); wp->SetText(GetPrimaryDataPath().c_str()); wp->SetEnabled(false); AddFile(_("Map database"), _("The name of the file (.xcm) containing terrain, topography, and optionally " "waypoints, their details and airspaces."), ProfileKeys::MapFile, _T("*.xcm\0*.lkm\0"), FileType::MAP); AddFile(_("Waypoints"), _("Primary waypoints file. Supported file types are Cambridge/WinPilot files (.dat), " "Zander files (.wpz) or SeeYou files (.cup)."), ProfileKeys::WaypointFile, WAYPOINT_FILE_PATTERNS, FileType::WAYPOINT); AddFile(_("More waypoints"), _("Secondary waypoints file. This may be used to add waypoints for a competition."), ProfileKeys::AdditionalWaypointFile, WAYPOINT_FILE_PATTERNS, FileType::WAYPOINT); SetExpertRow(AdditionalWaypointFile); AddFile(_("Watched waypoints"), _("Waypoint file containing special waypoints for which additional computations like " "calculation of arrival height in map display always takes place. Useful for " "waypoints like known reliable thermal sources (e.g. powerplants) or mountain passes."), ProfileKeys::WatchedWaypointFile, WAYPOINT_FILE_PATTERNS, FileType::WAYPOINT); SetExpertRow(WatchedWaypointFile); AddFile(_("Airspaces"), _("The file name of the primary airspace file."), ProfileKeys::AirspaceFile, _T("*.txt\0*.air\0*.sua\0"), FileType::AIRSPACE); AddFile(_("More airspaces"), _("The file name of the secondary airspace file."), ProfileKeys::AdditionalAirspaceFile, _T("*.txt\0*.air\0*.sua\0"), FileType::AIRSPACE); SetExpertRow(AdditionalAirspaceFile); AddFile(_("Waypoint details"), _("The file may contain extracts from enroute supplements or other contributed " "information about individual waypoints and airfields."), ProfileKeys::AirfieldFile, _T("*.txt\0")); SetExpertRow(AirfieldFile); }
static void UpdateTextboxProp(void) { WndProperty *wp; wp = (WndProperty*)wf->FindByName(TEXT("prpText")); if (wp) { wp->SetText(edittext); } wp = (WndProperty*)wf->FindByName(TEXT("prpUnit")); if(wp && wKeyboardPopupWndProperty) { DataField* pField = wKeyboardPopupWndProperty->GetDataField(); if(pField) { wp->SetCaption(pField->GetUnits()); wp->RefreshDisplay(); wp->Redraw(); } } }
void dlgHelpShowModal(const TCHAR* Caption, const TCHAR* HelpText) { if (!Caption || !HelpText) { return; } if (!ScreenLandscape) { char filename[MAX_PATH]; LocalPathS(filename, TEXT("dlgHelp_L.xml")); wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_HELP_L")); } else { char filename[MAX_PATH]; LocalPathS(filename, TEXT("dlgHelp.xml")); wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_HELP")); } WndProperty* wp; if (wf) { TCHAR fullcaption[100]; _stprintf(fullcaption,TEXT("%s: %s"), gettext(TEXT("_@M336_")), Caption); // Help wf->SetCaption(fullcaption); wp = (WndProperty*)wf->FindByName(TEXT("prpHelpText")); if (wp) { wp->SetText(LKgethelptext(HelpText)); wp->RefreshDisplay(); } wf->ShowModal(); delete wf; } wf = NULL; }
void dlgHelpShowModal(ContainerWindow &parent, const TCHAR* Caption, const TCHAR* HelpText) { if (!Caption || !HelpText) { return; } if (!InfoBoxLayout::landscape) { wf = dlgLoadFromXML(CallBackTable, TEXT("dlgHelp_L.xml"), parent, TEXT("IDR_XML_HELP_L")); } else { wf = dlgLoadFromXML(CallBackTable, TEXT("dlgHelp.xml"), parent, TEXT("IDR_XML_HELP")); } WndProperty* wp; if (wf) { TCHAR fullcaption[100]; _stprintf(fullcaption,TEXT("Help: %s"), Caption); wf->SetCaption(fullcaption); wp = (WndProperty*)wf->FindByName(TEXT("prpHelpText")); if (wp) { wp->SetText(HelpText); wp->RefreshDisplay(); } wf->ShowModal(); delete wf; } wf = NULL; }
static void Update() { tstring metar_taf = _T(""); NOAAFormatter::Format(*station_iterator, metar_taf); WndProperty* wp = (WndProperty*)wf->FindByName(_T("DetailsText")); wp->SetText(metar_taf.c_str()); StaticString<100> caption; caption.Format(_T("%s: "), _("METAR and TAF")); ParsedMETAR parsed; if (!station_iterator->GetParsedMETAR(parsed) || !parsed.name_available) caption += station_iterator->GetCodeT(); else caption.AppendFormat(_T("%s (%s)"), parsed.name.c_str(), station_iterator->GetCodeT()); wf->SetCaption(caption); }
static void SetValues() { assert(airspace); WndProperty* wp; wp = (WndProperty*)wf->FindByName(_T("prpName")); assert(wp != NULL); wp->SetText(airspace->GetName()); wp->RefreshDisplay(); wp = (WndProperty*)wf->FindByName(_T("prpRadio")); assert(wp != NULL); wp->SetText(airspace->GetRadioText().c_str()); wp->RefreshDisplay(); wp = (WndProperty*)wf->FindByName(_T("prpType")); assert(wp != NULL); wp->SetText(AirspaceFormatter::GetClass(*airspace)); wp->RefreshDisplay(); wp = (WndProperty*)wf->FindByName(_T("prpTop")); assert(wp != NULL); wp->SetText(AirspaceFormatter::GetTop(*airspace).c_str()); wp->RefreshDisplay(); wp = (WndProperty*)wf->FindByName(_T("prpBase")); assert(wp != NULL); wp->SetText(AirspaceFormatter::GetBase(*airspace).c_str()); wp->RefreshDisplay(); if (airspace_warnings != NULL) { wp = (WndProperty*)wf->FindByName(_T("prpRange")); assert(wp != NULL); const GeoPoint &ac_loc = XCSoarInterface::Basic().location; const GeoPoint closest_loc = airspace->ClosestPoint(ac_loc, airspace_warnings->GetProjection()); const GeoVector vec(ac_loc, closest_loc); StaticString<80> buf; buf.Format(_T("%d%s"), (int)Units::ToUserDistance(vec.distance), Units::GetDistanceName()); wp->SetText(buf); wp->RefreshDisplay(); } }
void RowFormWidget::AddMultiLine(const TCHAR *label, const TCHAR *help, const TCHAR *text) { assert(IsDefined()); const PixelRect edit_rc = InitialControlRect(Layout::GetMinimumControlHeight()); WindowStyle style; EditWindowStyle edit_style; edit_style.SetMultiLine(); edit_style.VerticalScroll(); edit_style.SetReadOnly(); if (IsEmbedded() || Layout::scale_1024 < 2048) /* sunken edge doesn't fit well on the tiny screen of an embedded device */ edit_style.Border(); else edit_style.SunkenEdge(); PanelControl &panel = *(PanelControl *)GetWindow(); WndProperty *edit = new WndProperty(panel, look, label, edit_rc, (*label == '\0') ? 0 : 100, style, edit_style, NULL); if (help != NULL) edit->SetHelpText(help); if (text != NULL) edit->SetText(text); Add(Row::Type::MULTI_LINE, edit); }
void SiteConfigPanel::Init(WndForm *_wf) { assert(_wf != NULL); wf = _wf; buttonWaypoints = ((WndButton *)wf->FindByName(_T("cmdWaypoints"))); if (buttonWaypoints) buttonWaypoints->SetOnClickNotify(OnWaypoints); InitFileField(*wf, _T("prpAirspaceFile"), szProfileAirspaceFile, _T("*.txt\0*.air\0*.sua\0")); InitFileField(*wf, _T("prpAdditionalAirspaceFile"), szProfileAdditionalAirspaceFile, _T("*.txt\0*.air\0*.sua\0")); InitFileField(*wf, _T("prpWaypointFile"), szProfileWayPointFile, _T("*.dat\0*.xcw\0*.cup\0*.wpz\0*.wpt\0")); InitFileField(*wf, _T("prpAdditionalWaypointFile"), szProfileAdditionalWayPointFile, _T("*.dat\0*.xcw\0*.cup\0*.wpz\0*.wpt\0")); InitFileField(*wf, _T("prpWatchedWaypointFile"), szProfileWatchedWayPointFile, _T("*.dat\0*.xcw\0*.cup\0*.wpz\0*.wpt\0")); WndProperty *wp = (WndProperty *)wf->FindByName(_T("prpDataPath")); wp->set_enabled(false); wp->SetText(GetPrimaryDataPath()); InitFileField(*wf, _T("prpMapFile"), szProfileMapFile, _T("*.xcm\0*.lkm\0")); InitFileField(*wf, _T("prpTerrainFile"), szProfileTerrainFile, _T("*.jp2\0")); InitFileField(*wf, _T("prpTopographyFile"), szProfileTopographyFile, _T("*.tpl\0")); InitFileField(*wf, _T("prpAirfieldFile"), szProfileAirfieldFile, _T("*.txt\0")); }
void dlgHelpShowModal(SingleWindow &parent, const TCHAR* Caption, const TCHAR* HelpText) { if (!Caption || !HelpText) { return; } if (!Layout::landscape) { wf = LoadDialog(CallBackTable, parent, _T("IDR_XML_HELP_L")); } else { wf = LoadDialog(CallBackTable, parent, _T("IDR_XML_HELP")); } if (wf == NULL) return; WndProperty* wp; TCHAR fullcaption[100]; _stprintf(fullcaption,_T("Help: %s"), Caption); wf->SetCaption(fullcaption); wp = (WndProperty*)wf->FindByName(_T("prpHelpText")); if (wp) { wp->SetText(HelpText); wp->RefreshDisplay(); } wf->ShowModal(); delete wf; }
static void SetValues(void) { int atype = 0; AIRSPACE_ALT* top = NULL; AIRSPACE_ALT* base = NULL; TCHAR *name = 0; WndProperty* wp; TCHAR buffer[80]; TCHAR buffer2[80]; bool inside = false; double range = 0.0; double bearing; if (index_area >=0) { atype = AirspaceArea[index_area].Type; top = &AirspaceArea[index_area].Top; base = &AirspaceArea[index_area].Base; name = AirspaceArea[index_area].Name; inside = InsideAirspaceArea(GPS_INFO.Longitude, GPS_INFO.Latitude, index_area); range = RangeAirspaceArea(GPS_INFO.Longitude, GPS_INFO.Latitude, index_area, &bearing); } if (index_circle >=0) { atype = AirspaceCircle[index_circle].Type; top = &AirspaceCircle[index_circle].Top; base = &AirspaceCircle[index_circle].Base; name = AirspaceCircle[index_circle].Name; inside = InsideAirspaceCircle(GPS_INFO.Longitude, GPS_INFO.Latitude, index_circle); range = RangeAirspaceCircle(GPS_INFO.Longitude, GPS_INFO.Latitude, index_circle); DistanceBearing(GPS_INFO.Latitude, GPS_INFO.Longitude, AirspaceCircle[index_circle].Latitude, AirspaceCircle[index_circle].Longitude, NULL, &bearing); if (inside) { bearing = AngleLimit360(bearing+180); } } if (range<0) { range = -range; } wp = (WndProperty*)wf->FindByName(TEXT("prpName")); if (wp) { wp->SetText(name); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpType")); if (wp) { switch (atype) { case RESTRICT: // LKTOKEN _@M565_ = "Restricted" wp->SetText(gettext(TEXT("_@M565_"))); break; case PROHIBITED: // LKTOKEN _@M537_ = "Prohibited" wp->SetText(gettext(TEXT("_@M537_"))); break; case DANGER: // LKTOKEN _@M213_ = "Danger Area" wp->SetText(gettext(TEXT("_@M213_"))); break; case CLASSA: wp->SetText(TEXT("Class A")); break; case CLASSB: wp->SetText(TEXT("Class B")); break; case CLASSC: wp->SetText(TEXT("Class C")); break; case CLASSD: wp->SetText(TEXT("Class D")); break; case CLASSE: wp->SetText(TEXT("Class E")); break; case CLASSF: wp->SetText(TEXT("Class F")); break; case CLASSG: wp->SetText(TEXT("Class G")); break; case NOGLIDER: // LKTOKEN _@M464_ = "No Glider" wp->SetText(gettext(TEXT("_@M464_"))); break; case CTR: wp->SetText(TEXT("CTR")); break; case WAVE: // LKTOKEN _@M794_ = "Wave" wp->SetText(gettext(TEXT("_@M794_"))); break; default: // LKTOKEN _@M765_ = "Unknown" wp->SetText(gettext(TEXT("_@M765_"))); } wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTop")); if (wp) { switch (top->Base){ case abUndef: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, TEXT("%.0f[m] %.0f[ft] [?]"), (top->Altitude), (top->Altitude*TOFEET)); } else { _stprintf(buffer, TEXT("%.0f ft [?]"), (top->Altitude*TOFEET)); } break; case abMSL: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, TEXT("%.0f[m] %.0f[ft] MSL"), top->Altitude, top->Altitude*TOFEET); } else { _stprintf(buffer, TEXT("%.0f ft MSL"), top->Altitude*TOFEET); } break; case abAGL: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, TEXT("%.0f[m] %.0f[ft] AGL"), top->AGL, top->AGL*TOFEET); } else { _stprintf(buffer, TEXT("%.0f ft AGL"), top->AGL*TOFEET); } break; case abFL: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, TEXT("FL%.0f (%.0f[m] %.0f[ft])"), top->FL, FLAltRounded(top->Altitude), FLAltRounded(top->Altitude*TOFEET)); } else { _stprintf(buffer, TEXT("FL%.0f (%.0f ft)"), top->FL, FLAltRounded(top->Altitude*TOFEET)); } break; } wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpBase")); if (wp) { switch (base->Base){ case abUndef: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, TEXT("%.0f[m] %.0f[ft] [?]"), base->Altitude, base->Altitude*TOFEET); } else { _stprintf(buffer, TEXT("%.0f ft [?]"), base->Altitude*TOFEET); } break; case abMSL: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, TEXT("%.0f[m] %.0f[ft] MSL"), base->Altitude, base->Altitude*TOFEET); } else { _stprintf(buffer, TEXT("%.0f ft MSL"), base->Altitude*TOFEET); } break; case abAGL: if (base->Altitude == 0) { _stprintf(buffer, TEXT("SFC")); } else { if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, TEXT("%.0f[m] %.0f[ft] AGL"), base->AGL, base->AGL*TOFEET); } else { _stprintf(buffer, TEXT("%.0f ft AGL"), base->AGL*TOFEET); } } break; case abFL: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, TEXT("FL %.0f (%.0f[m] %.0f[ft])"), base->FL, FLAltRounded(base->Altitude), FLAltRounded(base->Altitude*TOFEET)); } else { _stprintf(buffer, TEXT("FL%.0f (%.0f ft)"), base->FL, FLAltRounded(base->Altitude*TOFEET)); } break; } wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpRange")); if (wp) { if (inside) { // LKTOKEN _@M359_ = "Inside" wp->SetCaption(gettext(TEXT("_@M359_"))); } Units::FormatUserDistance(range, buffer, 20); _stprintf(buffer2, TEXT(" %d")TEXT(DEG), iround(bearing)); _tcscat(buffer, buffer2); wp->SetText(buffer); wp->RefreshDisplay(); } }
void dlgLKAirspaceFill() { if (msg.warnlevel != airspace_copy.WarningLevel()) { // we can automatically close the dialog when the warning level changes, probably new msg waiting in the queue dlg->SetModalResult(mrOK); } //Fill up dialog data WndProperty* wp; WndButton* wb; wp = (WndProperty*)dlg->FindByName(TEXT("prpReason")); if (wp) { switch (msg.event) { default: // Normally not show // LKTOKEN _@M765_ "Unknown" wp->SetText(gettext(TEXT("_@M765_"))); break; case aweNone: // LKTOKEN _@M479_ "None" wp->SetText(gettext(TEXT("_@M479_"))); break; case aweMovingInsideFly: // LKTOKEN _@M1242_ "Flying inside FLY zone" wp->SetText(gettext(TEXT("_@M1242_"))); break; case awePredictedLeavingFly: // LKTOKEN _@M1243_ "Predicted leaving FLY zone" wp->SetText(gettext(TEXT("_@M1243_"))); break; case aweNearOutsideFly: // LKTOKEN _@M1244_ "Near leaving FLY zone" wp->SetText(gettext(TEXT("_@M1244_"))); break; case aweLeavingFly: // LKTOKEN _@M1245_ "Leaving FLY zone" wp->SetText(gettext(TEXT("_@M1245_"))); break; case awePredictedEnteringFly: // LKTOKEN _@M1246_ "Predicted entering FLY zone" wp->SetText(gettext(TEXT("_@M1246_"))); break; case aweEnteringFly: // LKTOKEN _@M1247_ "Entering FLY zone" wp->SetText(gettext(TEXT("_@M1247_"))); break; case aweMovingOutsideFly: // LKTOKEN _@M1248_ "Flying outside FLY zone" wp->SetText(gettext(TEXT("_@M1248_"))); break; // Events for NON-FLY zones case aweMovingOutsideNonfly: // LKTOKEN _@M1249_ "Flying outside NOFLY zone" wp->SetText(gettext(TEXT("_@M1249_"))); break; case awePredictedEnteringNonfly: // LKTOKEN _@M1250_ "Predicted entering NOFLY zone" wp->SetText(gettext(TEXT("_@M1250_"))); break; case aweNearInsideNonfly: // LKTOKEN _@M1251_ "Near entering NOFLY zone" wp->SetText(gettext(TEXT("_@M1251_"))); break; case aweEnteringNonfly: // LKTOKEN _@M1252_ "Entering NOFLY zone" wp->SetText(gettext(TEXT("_@M1252_"))); break; case aweMovingInsideNonfly: // LKTOKEN _@M1253_ "Flying inside NOFLY zone" wp->SetText(gettext(TEXT("_@M1253_"))); break; case aweLeavingNonFly: // LKTOKEN _@M1254_ "Leaving NOFLY zone" wp->SetText(gettext(TEXT("_@M1254_"))); break; }//sw switch (airspace_copy.WarningLevel()) { case awYellow: wp->SetBackColor(RGB_YELLOW); wp->SetForeColor(RGB_BLACK); break; case awRed: wp->SetBackColor(RGB_RED); break; default: break; } wp->RefreshDisplay(); } #if 0 // unused but available for sometime wp = (WndProperty*)dlg->FindByName(TEXT("prpState")); if (wp) { switch (airspace_copy.WarningLevel()) { default: // LKTOKEN _@M765_ "Unknown" wp->SetText(gettext(TEXT("_@M765_"))); break; case awNone: // LKTOKEN _@M479_ "None" wp->SetText(gettext(TEXT("_@M479_"))); break; case awYellow: // LKTOKEN _@M1255_ "YELLOW WARNING" wp->SetText(gettext(TEXT("_@M1255_"))); wp->SetBackColor(RGB_YELLOW); wp->SetForeColor(RGB_BLACK); break; case awRed: // LKTOKEN _@M1256_ "RED WARNING" wp->SetText(gettext(TEXT("_@M1256_"))); wp->SetBackColor(RGB_RED); break; }//sw wp->RefreshDisplay(); } wp = (WndProperty*)dlg->FindByName(TEXT("prpName")); if (wp) { wp->SetText(airspace_copy.Name()); wp->RefreshDisplay(); } #endif int hdist; int vdist; int bearing; bool inside; TCHAR stmp[21]; TCHAR buffer[80]; wp = (WndProperty*)dlg->FindByName(TEXT("prpType")); if (wp) { if (airspace_copy.Flyzone()) { wsprintf(buffer,TEXT("%s %s"), gettext(TEXT("FLY")), airspace_copy.TypeName()); } else { wsprintf(buffer,TEXT("%s %s"), gettext(TEXT("NOFLY")), airspace_copy.TypeName()); } wp->SetText( buffer ); // wp->SetBackColor( airspace_copy.TypeColor()); // wp->SetForeColor( ContrastTextColor(airspace_copy.TypeColor())); wp->RefreshDisplay(); } // Unfortunatelly virtual methods don't work on copied instances // we have to ask airspacemanager to perform the required calculations //inside = airspace_copy.CalculateDistance(&hdist, &bearing, &vdist); //inside = CAirspaceManager::Instance().AirspaceCalculateDistance(msg.originator, &hdist, &bearing, &vdist); bool distances_ready = airspace_copy.GetDistanceInfo(inside, hdist, bearing, vdist); wp = (WndProperty*)dlg->FindByName(TEXT("prpHDist")); if (wp) { TCHAR stmp2[40]; if (distances_ready) { Units::FormatUserDistance((double)abs(hdist),stmp, 10); if (hdist<0) { // LKTOKEN _@M1257_ "to leave" wsprintf(stmp2, TEXT("%s %s"), stmp, gettext(TEXT("_@M1257_"))); } else { // LKTOKEN _@M1258_ "to enter" wsprintf(stmp2,TEXT("%s %s"), stmp, gettext(TEXT("_@M1258_"))); } } else { // no distance info calculated // LKTOKEN _@M1259_ "Too far, not calculated" wsprintf(stmp2,gettext(TEXT("_@M1259_"))); } wp->SetText(stmp2); wp->RefreshDisplay(); } wp = (WndProperty*)dlg->FindByName(TEXT("prpVDist")); if (wp) { TCHAR stmp2[40]; if (distances_ready) { Units::FormatUserAltitude((double)abs(vdist),stmp, 10); if (vdist<0) { // LKTOKEN _@M1260_ "below" wsprintf(stmp2,TEXT("%s %s"), stmp, gettext(TEXT("_@M1260_"))); } else { // LKTOKEN _@M1261_ "above" wsprintf(stmp2,TEXT("%s %s"), stmp, gettext(TEXT("_@M1261_"))); } } else { // no distance info calculated // LKTOKEN _@M1259_ "Too far, not calculated" wsprintf(stmp2,gettext(TEXT("_@M1259_"))); } wp->SetText(stmp2); wp->RefreshDisplay(); } wp = (WndProperty*)dlg->FindByName(TEXT("prpTopAlt")); if (wp) { TCHAR stmp2[40]; CAirspaceManager::Instance().GetAirspaceAltText(stmp2, 40, airspace_copy.Top()); wp->SetText(stmp2); wp->RefreshDisplay(); } wp = (WndProperty*)dlg->FindByName(TEXT("prpBaseAlt")); if (wp) { TCHAR stmp2[40]; CAirspaceManager::Instance().GetAirspaceAltText(stmp2, 40, airspace_copy.Base()); wp->SetText(stmp2); wp->RefreshDisplay(); } wb = (WndButton*)dlg->FindByName(TEXT("cmdClose")); if (wb) { TCHAR stmp2[40]; wsprintf(stmp2,TEXT("%s (%d)"), gettext(TEXT("_@M186_")), timer_counter); wb->SetCaption(stmp2); } }
static void SetValues(int indexid) { WndProperty* wp; TCHAR buffer[80]; if (indexid<0 || indexid>MAXTHISTORY) { // TODO check StartupStore(_T("... LK thermal setvalues invalid indexid=%d%s"),indexid,NEWLINE); DoStatusMessage(_T("ERR-216 INVALID THERMAL INDEXID")); return; } if ( !ThermalHistory[indexid].Valid ) { DoStatusMessage(_T("ERR-217 INVALID THERMAL INDEXID")); return; } wp = (WndProperty*)wf->FindByName(TEXT("prpName")); if (wp) { wcscpy(buffer,ThermalHistory[indexid].Name); ConvToUpper(buffer); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpHTop")); if (wp) { _stprintf(buffer,_T("%.0f %s"),ThermalHistory[indexid].HTop*ALTITUDEMODIFY, Units::GetAltitudeName()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpHBase")); if (wp) { _stprintf(buffer,_T("%.0f %s"),ThermalHistory[indexid].HBase*ALTITUDEMODIFY, Units::GetAltitudeName()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpLift")); if (wp) { _stprintf(buffer,_T("%+.1f %s"),ThermalHistory[indexid].Lift*LIFTMODIFY, Units::GetVerticalSpeedName()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTeamCode")); if (wp) { // Taken from CalculateTeamBear.. if (!WayPointList) return; if (TeamCodeRefWaypoint < 0) return; double distance=0, bearing=0; LL_to_BearRange( WayPointList[TeamCodeRefWaypoint].Latitude, WayPointList[TeamCodeRefWaypoint].Longitude, ThermalHistory[indexid].Latitude, ThermalHistory[indexid].Longitude, &bearing, &distance); GetTeamCode(buffer, bearing, distance); buffer[5]='\0'; wp->SetText(buffer); wp->RefreshDisplay(); } }
static void SetValues(void) { int atype = 0; AIRSPACE_ALT* top = NULL; AIRSPACE_ALT* base = NULL; TCHAR *name = 0; WndProperty* wp; TCHAR buffer[80]; TCHAR buffer2[80]; bool inside = false; double range = 0.0; double bearing; if (index_area >=0) { AIRSPACE_AREA &area = airspace_database.AirspaceArea[index_area]; MapWindow &map_window = XCSoarInterface::main_window.map; atype = area.Type; top = &area.Top; base = &area.Base; name = area.Name; inside = airspace_database.InsideArea(XCSoarInterface::Basic().Location, index_area); range = airspace_database.RangeArea(XCSoarInterface::Basic().Location, index_area, &bearing, map_window); } if (index_circle >=0) { AIRSPACE_CIRCLE &circle = airspace_database.AirspaceCircle[index_circle]; atype = circle.Type; top = &circle.Top; base = &circle.Base; name = circle.Name; inside = airspace_database.InsideCircle(XCSoarInterface::Basic().Location, index_circle); range = airspace_database.CircleDistance(XCSoarInterface::Basic().Location, index_circle); DistanceBearing(XCSoarInterface::Basic().Location, circle.Location, NULL, &bearing); if (inside) { bearing = AngleLimit360(bearing+180); } } if (range<0) { range = -range; } wp = (WndProperty*)wf->FindByName(_T("prpName")); if (wp) { wp->SetText(name); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpType")); if (wp) { switch (atype) { case RESTRICT: wp->SetText(gettext(_T("Restricted"))); break; case PROHIBITED: wp->SetText(gettext(_T("Prohibited"))); break; case DANGER: wp->SetText(gettext(_T("Danger Area"))); break; case CLASSA: wp->SetText(gettext(_T("Class A"))); break; case CLASSB: wp->SetText(gettext(_T("Class B"))); break; case CLASSC: wp->SetText(gettext(_T("Class C"))); break; case CLASSD: wp->SetText(gettext(_T("Class D"))); break; case CLASSE: wp->SetText(gettext(_T("Class E"))); break; case CLASSF: wp->SetText(gettext(_T("Class F"))); break; case NOGLIDER: wp->SetText(gettext(_T("No Glider"))); break; case CTR: wp->SetText(gettext(_T("CTR"))); break; case WAVE: wp->SetText(gettext(_T("Wave"))); break; default: wp->SetText(gettext(_T("Unknown"))); } wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpTop")); if (wp) { switch (top->Base){ case abUndef: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, _T("%.0f[m] %.0f[ft] [?]"), (top->Altitude), (top->Altitude*TOFEET)); } else { _stprintf(buffer, _T("%.0f ft [?]"), (top->Altitude*TOFEET)); } break; case abMSL: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, _T("%.0f[m] %.0f[ft] MSL"), top->Altitude, top->Altitude*TOFEET); } else { _stprintf(buffer, _T("%.0f ft MSL"), top->Altitude*TOFEET); } break; case abAGL: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, _T("%.0f[m] %.0f[ft] AGL"), top->AGL, top->AGL*TOFEET); } else { _stprintf(buffer, _T("%.0f ft AGL"), top->AGL*TOFEET); } break; case abFL: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, _T("FL%.0f (%.0f[m] %.0f[ft])"), top->FL, FLAltRounded(top->Altitude), FLAltRounded(top->Altitude*TOFEET)); } else { _stprintf(buffer, _T("FL%.0f (%.0f ft)"), top->FL, FLAltRounded(top->Altitude*TOFEET)); } break; } wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpBase")); if (wp) { switch (base->Base){ case abUndef: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, _T("%.0f[m] %.0f[ft] [?]"), base->Altitude, base->Altitude*TOFEET); } else { _stprintf(buffer, _T("%.0f ft [?]"), base->Altitude*TOFEET); } break; case abMSL: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, _T("%.0f[m] %.0f[ft] MSL"), base->Altitude, base->Altitude*TOFEET); } else { _stprintf(buffer, _T("%.0f ft MSL"), base->Altitude*TOFEET); } break; case abAGL: if (base->Altitude == 0) { _stprintf(buffer, _T("SFC")); } else { if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, _T("%.0f[m] %.0f[ft] AGL"), base->AGL, base->AGL*TOFEET); } else { _stprintf(buffer, _T("%.0f ft AGL"), base->AGL*TOFEET); } } break; case abFL: if (Units::GetUserAltitudeUnit() == unMeter) { _stprintf(buffer, _T("FL %.0f (%.0f[m] %.0f[ft])"), base->FL, FLAltRounded(base->Altitude), FLAltRounded(base->Altitude*TOFEET)); } else { _stprintf(buffer, _T("FL%.0f (%.0f ft)"), base->FL, FLAltRounded(base->Altitude*TOFEET)); } break; } wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpRange")); if (wp) { if (inside) { wp->SetCaption(gettext(_T("Inside"))); } Units::FormatUserDistance(range, buffer, 20); _stprintf(buffer2, _T(" %d")_T(DEG), iround(bearing)); _tcscat(buffer, buffer2); wp->SetText(buffer); wp->RefreshDisplay(); } }
static void SetValues(int indexid) { //TCHAR *name = 0; //TCHAR *cn = 0; WndProperty* wp; TCHAR buffer[80]; //TCHAR status[10]; //static TCHAR Name[MAXFLARMNAME+1]; //static TCHAR Cn[MAXFLARMCN+1]; int wlen; if (indexid<0 || indexid>MAXTRAFFIC) { StartupStore(_T("--- LK setvalues invalid indexid=%d%s"),indexid,NEWLINE); // DoStatusMessage(_T("ERR-216 INVALID INDEXID")); return; } if ( LKTraffic[indexid].ID <=0 || LKTraffic[indexid].Status <LKT_REAL) { StartupStore(_T("--- LK setvalues invalid indexid=%d%s"),indexid,NEWLINE); // DoStatusMessage(_T("ERR-217 INVALID INDEXID")); return; } wp = (WndProperty*)wf->FindByName(TEXT("prpRegName")); if (wp) { wlen=wcslen(LKTraffic[indexid].Name); // a ? probably if (wlen==1) { _stprintf(buffer,_T("%06x"),LKTraffic[indexid].ID); buffer[MAXFLARMNAME]='\0'; } else { _tcsncpy(buffer,LKTraffic[indexid].Name,MAXFLARMNAME); buffer[MAXFLARMNAME]='\0'; ConvToUpper(buffer); } //name=Name; wp->SetText(buffer); wp->RefreshDisplay(); } #if 0 wp = (WndProperty*)wf->FindByName(TEXT("prpStatus")); if (wp) { switch(LKTraffic[indexid].Status) { case LKT_REAL: _tcscpy(status,_T("LIVE")); break; case LKT_GHOST: _tcscpy(status,_T("GHOST")); break; case LKT_ZOMBIE: _tcscpy(status,_T("ZOMBIE")); break; default: _tcscpy(status,_T("UNKNOWN")); break; } wp->SetText(status); wp->RefreshDisplay(); } #endif wp = (WndProperty*)wf->FindByName(TEXT("prpCn")); if (wp) { if ( _tcslen(LKTraffic[indexid].Cn) == 1 ) { if (LKTraffic[indexid].Cn[0] == _T('?')) { _tcscpy(buffer,_T("")); } else { _tcsncpy(buffer,LKTraffic[indexid].Cn,MAXFLARMCN); buffer[MAXFLARMCN]='\0'; } } else { _tcsncpy(buffer,LKTraffic[indexid].Cn,MAXFLARMCN); buffer[MAXFLARMCN]='\0'; } wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpDistance")); if (wp) { _stprintf(buffer,_T("%.1f %s"),LKTraffic[indexid].Distance*DISTANCEMODIFY, Units::GetDistanceName()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAltitude")); if (wp) { _stprintf(buffer,_T("%.0f %s"),LKTraffic[indexid].Altitude*ALTITUDEMODIFY, Units::GetAltitudeName()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAltDiff")); if (wp) { // this has to be reverted, because it is a relative altitude to us _stprintf(buffer,_T("%+.0f %s"),(CALCULATED_INFO.NavAltitude - LKTraffic[indexid].Altitude)*ALTITUDEMODIFY*-1, Units::GetAltitudeName()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpSpeed")); if (wp) { _stprintf(buffer,_T("%.0f %s"),LKTraffic[indexid].Speed*SPEEDMODIFY, Units::GetHorizontalSpeedName()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpVario")); if (wp) { _stprintf(buffer,_T("%+.1f %s"),LKTraffic[indexid].Average30s*LIFTMODIFY, Units::GetVerticalSpeedName()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpBearing")); if (wp) { _stprintf(buffer, TEXT(" %d")TEXT(DEG), iround(LKTraffic[indexid].Bearing)); wp->SetText(buffer); wp->RefreshDisplay(); } FlarmId* flarmId = file.GetFlarmIdItem(LKTraffic[indexid].ID); if (flarmId != NULL) { wp = (WndProperty*)wf->FindByName(TEXT("prpName")); if (wp) { _stprintf(buffer,_T("%s"),flarmId->name); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAirfield")); if (wp) { _stprintf(buffer,_T("%s"),flarmId->airfield); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpType")); if (wp) { _stprintf(buffer,_T("%s"),flarmId->type); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFreq")); if (wp) { _stprintf(buffer,_T("%s"),flarmId->freq); wp->SetText(buffer); wp->RefreshDisplay(); } } }
void ReduceKeysByWaypointList(void) { #define MAX_SEL_LIST_SIZE 60 char SelList[MAX_SEL_LIST_SIZE]={""}; unsigned int NumChar=0; bool CharEqual = true; char Charlist[MAX_SEL_LIST_SIZE]={"ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.@-_ \xD6\xDC\xC4"}; unsigned int i,j,EqCnt=WayPointList.size(); WndProperty *wp; TCHAR Found[NAME_SIZE + 1]; SelList[0] = '\0'; unsigned int NameLen=0; int Offset=0; unsigned int k =0; IdenticalOffset =999; IdenticalIndex = -1; if(cursor < GC_SUB_STRING_THRESHOLD/*1*/) /* enable all keys if no char entered */ { RemoveKeys((char*)Charlist, sizeof(Charlist)); } else { EqCnt=0; /* reset number of found waypoints */ NumChar =0; for (i=NUMRESWP; i< WayPointList.size(); i++) { NameLen = _tcslen(WayPointList[i].Name); Offset = 0; if(cursor > NameLen) CharEqual = false; else { do { k=0; CharEqual = true; while((k < (cursor)) && ((k+Offset) < NameLen) && CharEqual) { LKASSERT(k < MAX_TEXTENTRY); LKASSERT((k+Offset) < NameLen); char ac = (char)WayPointList[i].Name[k+Offset]; char bc = (char)edittext[k]; if( ToUpper(ac) != ToUpper(bc) ) /* waypoint has string ?*/ { CharEqual = false; } k++; } Offset++; } while(((Offset-1+cursor) < NameLen) && !CharEqual ); Offset--; } if(CharEqual) { if(Offset < IdenticalOffset) { IdenticalIndex = i; /* remember first found equal name */ IdenticalOffset = Offset; /* remember first found equal name */ // StartupStore(_T("Found Best Fit %i Idx %i %s\n"), i, IdenticalIndex, WayPointList[IdenticalIndex].Name); } EqCnt++; LKASSERT((cursor+Offset)<=NAME_SIZE); LKASSERT(i<=WayPointList.size()); TCHAR newChar = ToUpper(WayPointList[i].Name[cursor+Offset]); bool existing = false; j=0; while(( j < NumChar) && (!existing)) /* new character already in list? */ { // StartupStore(_T(". j=%i MAX_SEL_LIST_SIZE= %i\n"),j,MAX_SEL_LIST_SIZE); LKASSERT(j<MAX_SEL_LIST_SIZE); if(SelList[j] == (unsigned char)newChar) existing = true; j++; } if(!existing && (NumChar <MAX_SEL_LIST_SIZE)) /* add new character to key enable list */ { // StartupStore(_T(". j=%i MAX_SEL_LIST_SIZE= %i\n"),j,MAX_SEL_LIST_SIZE); LKASSERT(NumChar<MAX_SEL_LIST_SIZE); SelList[NumChar++] = newChar; } } } SelList[NumChar++] = '\0'; RemoveKeys((char*)SelList, NumChar); wp = (WndProperty*)wf->FindByName(TEXT("prpText")); if (wp) { if(EqCnt ==1) { LKASSERT(IdenticalIndex<= (int)WayPointList.size()); wp->SetText(WayPointList[IdenticalIndex].Name); } else { if((cursor >0) && (EqCnt >0)) { LKASSERT(cursor < NAME_SIZE); LKASSERT(IdenticalIndex<=(int)WayPointList.size()); _stprintf(Found,_T("%s"),WayPointList[IdenticalIndex].Name); for( i = 0; i < cursor; i++) Found[i+IdenticalOffset] = toupper(WayPointList[IdenticalIndex].Name[i+IdenticalOffset]); wp->SetText(Found); } } } } wp = (WndProperty*)wf->FindByName(TEXT("prpMatch")); if (wp) { _stprintf(Found,_T("%s:%i"),MsgToken(948),EqCnt); /* _@M948_ Found */ wp->SetCaption(Found); } }
static void UpdateValuesTask(void) { WndProperty *wp; TCHAR Temp[80]; wp = (WndProperty*)wf->FindByName(TEXT("prpTaskTime")); Units::TimeToText(Temp, (int)AATTaskLength*60); if (wp) { if (!AATEnabled) { wp->SetVisible(false); } else { wp->SetText(Temp); } } double dd = CALCULATED_INFO.TaskTimeToGo; if (CALCULATED_INFO.TaskStartTime>0.0) { dd += GPS_INFO.Time-CALCULATED_INFO.TaskStartTime; } wp = (WndProperty*)wf->FindByName(TEXT("prpETETime")); if (wp) { Units::TimeToText(Temp, (int)dd); wp->SetText(Temp); } wp = (WndProperty*)wf->FindByName(TEXT("prpRemainingTime")); if (wp) { Units::TimeToText(Temp, (int)CALCULATED_INFO.TaskTimeToGo); wp->SetText(Temp); } wp = (WndProperty*)wf->FindByName(TEXT("prpTaskDistance")); if (wp) { _stprintf(Temp, TEXT("%.0f %s"), DISTANCEMODIFY* (CALCULATED_INFO.TaskDistanceToGo +CALCULATED_INFO.TaskDistanceCovered), Units::GetDistanceName()); wp->SetText(Temp); } wp = (WndProperty*)wf->FindByName(TEXT("prpRemainingDistance")); if (wp) { if (AATEnabled) { _stprintf(Temp, TEXT("%.0f %s"), DISTANCEMODIFY*CALCULATED_INFO.AATTargetDistance, Units::GetDistanceName()); } else { _stprintf(Temp, TEXT("%.0f %s"), DISTANCEMODIFY*CALCULATED_INFO.TaskDistanceToGo, Units::GetDistanceName()); } wp->SetText(Temp); } double d1 = (CALCULATED_INFO.TaskDistanceToGo +CALCULATED_INFO.TaskDistanceCovered)/dd; // TODO bug: this fails for OLC wp = (WndProperty*)wf->FindByName(TEXT("prpEstimatedSpeed")); if (wp) { _stprintf(Temp, TEXT("%.0f %s"), TASKSPEEDMODIFY*d1, Units::GetTaskSpeedName()); wp->SetText(Temp); } wp = (WndProperty*)wf->FindByName(TEXT("prpAverageSpeed")); if (wp) { _stprintf(Temp, TEXT("%.0f %s"), TASKSPEEDMODIFY*CALCULATED_INFO.TaskSpeed, Units::GetTaskSpeedName()); wp->SetText(Temp); } }
static void UpdateValuesRules(void) { WndProperty *wp; TCHAR Temp[80]; wp = (WndProperty*)wf->FindByName(TEXT("prpValidStart")); if (wp) { if (CALCULATED_INFO.ValidStart) { // LKTOKEN _@M677_ = "TRUE" wp->SetText(gettext(TEXT("_@M677_"))); } else { // LKTOKEN _@M278_ = "FALSE" wp->SetText(gettext(TEXT("_@M278_"))); } } wp = (WndProperty*)wf->FindByName(TEXT("prpValidFinish")); if (wp) { if (CALCULATED_INFO.ValidFinish) { // LKTOKEN _@M677_ = "TRUE" wp->SetText(gettext(TEXT("_@M677_"))); } else { // LKTOKEN _@M278_ = "FALSE" wp->SetText(gettext(TEXT("_@M278_"))); } } wp = (WndProperty*)wf->FindByName(TEXT("prpStartTime")); if (wp) { if (CALCULATED_INFO.TaskStartTime>0) { Units::TimeToText(Temp, (int)TimeLocal((int)(CALCULATED_INFO.TaskStartTime))); wp->SetText(Temp); } else { wp->SetText(TEXT("")); } } wp = (WndProperty*)wf->FindByName(TEXT("prpStartSpeed")); if (wp) { if (CALCULATED_INFO.TaskStartTime>0) { _stprintf(Temp, TEXT("%.0f %s"), TASKSPEEDMODIFY*CALCULATED_INFO.TaskStartSpeed, Units::GetTaskSpeedName()); wp->SetText(Temp); } else { wp->SetText(TEXT("")); } } // StartMaxHeight, StartMaxSpeed; // double start_h; LockTaskData(); wp = (WndProperty*)wf->FindByName(TEXT("prpStartPoint")); if (ValidTaskPoint(0)) { // start_h = WayPointList[Task[0].Index].Altitude; if (wp) { wp->SetText(WayPointList[Task[0].Index].Name); } } else { // start_h = 0; if (wp) { wp->SetText(TEXT("")); } } wp = (WndProperty*)wf->FindByName(TEXT("prpStartHeight")); if (wp) { if (CALCULATED_INFO.TaskStartTime>0) { _stprintf(Temp, TEXT("%.0f %s"), (CALCULATED_INFO.TaskStartAltitude)*ALTITUDEMODIFY, Units::GetAltitudeName()); wp->SetText(Temp); } else { wp->SetText(TEXT("")); } } wp = (WndProperty*)wf->FindByName(TEXT("prpFinishAlt")); if (wp) { double finish_min = FAIFinishHeight(&GPS_INFO, &CALCULATED_INFO, -1); _stprintf(Temp, TEXT("%.0f %s"), finish_min*ALTITUDEMODIFY, Units::GetAltitudeName()); wp->SetText(Temp); } UnlockTaskData(); }