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); } }