static void setVariables(void) { WndProperty *wp; TCHAR temptext[MAX_PATH]; TCHAR tmp[MAX_PATH]; for (unsigned int i=0 ; i < NO_WP_FILES; i++) { _tcscpy(temptext,szWaypointFile[i]); _sntprintf(tmp,MAX_PATH,_T("prpFile%1u"),i+1); wp = (WndProperty*)wf->FindByName(tmp); if (wp) { DataFieldFileReader* dfe = static_cast<DataFieldFileReader*>(wp->GetDataField()); if(dfe) { dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_WP_WINPILOT)); dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_WP_XCSOAR)); dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_WP_CUP)); dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_WP_COMPE)); dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_OPENAIP)); dfe->Lookup(temptext); _sntprintf(tmp,MAX_PATH,_T("%s %1u "), MsgToken(2341),i+1); // _@M2341_ "Waypoint File" wp->SetCaption(tmp); } wp->RefreshDisplay(); } } }
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(); } } }
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(); } }
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(); } }
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 RedrawSampleFont(void) { if (!IsInitialized) { return; } WndProperty* wp; wp = (WndProperty*)wf->FindByName(TEXT("prpFontName")); if(wp) { _tcsncpy(NewLogFont.lfFaceName,wp->GetDataField()->GetAsString(), LF_FACESIZE-1); } wp = (WndProperty*)wf->FindByName(TEXT("prpFontHeight")); if(wp) { NewLogFont.lfHeight = wp->GetDataField()->GetAsInteger(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFontWeight")); if(wp) { NewLogFont.lfWeight= wp->GetDataField()->GetAsInteger(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFontItalic")); if(wp) { if ( wp->GetDataField()->GetAsInteger() ) { NewLogFont.lfItalic=1; } else { NewLogFont.lfItalic=0; } } wp = (WndProperty*)wf->FindByName(TEXT("prpFontPitchAndFamily")); if (wp) { NewLogFont.lfPitchAndFamily=wp->GetDataField()->GetAsInteger(); } //KT wp = (WndProperty*)wf->FindByName(TEXT("prpFontTrueType")); if(wp) { if ( wp->GetDataField()->GetAsBoolean() ) { wp = (WndProperty*)wf->FindByName(TEXT("prpFontRenderer")); if(wp) { if ( wp->GetDataField()->GetAsInteger() ) { NewLogFont.lfQuality = CLEARTYPE_COMPAT_QUALITY; } else { NewLogFont.lfQuality = ANTIALIASED_QUALITY; } } } else { NewLogFont.lfQuality = NONANTIALIASED_QUALITY; } } DeleteObject(NewFont); NewFont = CreateFontIndirect (&NewLogFont); if ( _tcscmp(OriginalFontRegKey, szRegistryFontMapWindowBoldFont) == 0 ) { wf->SetFont(NewFont); wf->SetTitleFont(NewFont); wf->SetVisible(false); wf->SetVisible(true); } wp = (WndProperty*)wf->FindByName(TEXT("prpFontSample")); if(wp) { if (GetObjectType(NewFont) == OBJ_FONT) { wp->SetFont(NewFont); wp->SetCaption(TEXT("<AbCdEfGh1234>")); wp->SetVisible(false); wp->SetVisible(true); wp->RefreshDisplay(); } else { wp->SetCaption(TEXT("Error Creating Font!")); wp->RefreshDisplay(); } } }
static void SetValues(WndForm* wf) { WndProperty* wp; WndButton *wb; TCHAR buffer[80]; TCHAR buffer2[160]; // must contain buffer int bearing; int hdist; int vdist; bool inside = false; { ScopeLock guard(CAirspaceManager::Instance().MutexRef()); CAirspace* airspace = CAirspaceManager::Instance().GetAirspacesForDetails(); if(airspace) { // Get an object instance copy with actual values airspace_copy = CAirspaceManager::Instance().GetAirspaceCopy(airspace); inside = CAirspaceManager::Instance().AirspaceCalculateDistance( airspace, &hdist, &bearing, &vdist); } else { // error : CAirspaceManager are closed ? return; } } if (wf!=NULL) { TCHAR capbuffer[250]; _stprintf(capbuffer,_T("%s ("),airspace_copy.Name()); if (airspace_copy.Enabled()) { _tcscat(capbuffer,MsgToken(1643)); // ENABLED } else { _tcscat(capbuffer,MsgToken(1600)); // DISABLED } _tcscat(capbuffer,_T(")")); // DISABLED wf->SetCaption(capbuffer); } wp = (WndProperty*)wf->FindByName(TEXT("prpType")); if (wp) { if (airspace_copy.Flyzone()) { _stprintf(buffer,TEXT("%s %s"), CAirspaceManager::GetAirspaceTypeText(airspace_copy.Type()), TEXT("FLY")); /* if( _tcsnicmp( airspace_copy.Name(), airspace_copy.TypeName() ,_tcslen(airspace_copy.TypeName())) == 0) _stprintf(buffer,TEXT("%s"),airspace_copy.Name()); else _stprintf(buffer,TEXT("%s %s"),airspace_copy.TypeName() // fixed strings max. 20 ,airspace_copy.Name()); // NAME_SIZE 30 => max. 30 char */ } else { _stprintf(buffer,TEXT("%s %s"), TEXT("NOFLY"), CAirspaceManager::GetAirspaceTypeText(airspace_copy.Type())); } wp->SetText( buffer ); // wp->SetBackColor( airspace_copy.TypeColor()); // wp->SetForeColor( ContrastTextColor(airspace_copy.TypeColor())); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTop")); if (wp) { CAirspaceManager::Instance().GetAirspaceAltText(buffer, sizeof(buffer)/sizeof(buffer[0]), airspace_copy.Top()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpBase")); if (wp) { CAirspaceManager::Instance().GetAirspaceAltText(buffer, sizeof(buffer)/sizeof(buffer[0]), airspace_copy.Base()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpRange")); if (wp) { Units::FormatUserDistance(abs(hdist), buffer, 20); if (inside) { // LKTOKEN _@M359_ = "Inside" wp->SetCaption(MsgToken(359)); } if (hdist < 0) { // LKTOKEN _@M1257_ "to leave" _stprintf(buffer2, TEXT("%s %d%s %s"), buffer, iround(bearing), MsgToken(2179), MsgToken(1257)); } else { // LKTOKEN _@M1258_ "to enter" _stprintf(buffer2, TEXT("%s %d%s %s"), buffer, iround(bearing), MsgToken(2179), MsgToken(1258)); } wp->SetText(buffer2); wp->RefreshDisplay(); } WindowControl* wDetails = wf->FindByName(TEXT("cmdDetails")); { ScopeLock guard(CAirspaceManager::Instance().MutexRef()); CAirspace* airspace = CAirspaceManager::Instance().GetAirspacesForDetails(); if(airspace->Comment() != NULL) { if(_tcslen(airspace->Comment()) > 10 ) { WindowControl* wSelect = wf->FindByName(TEXT("cmdSelect")); if(wSelect) { wSelect->SetLeft(IBLSCALE(155)); wSelect->SetWidth(IBLSCALE(80)); } wDetails->SetLeft(IBLSCALE(80)); wDetails->SetWidth(IBLSCALE(75)); wDetails->Enable(true); } else wDetails->Enable(false); } } #ifdef RADIO_ACTIVE WindowControl* wFreq = wf->FindByName(TEXT("cmdSFrequency")); if (wFreq) { bool bRadio = false; if(RadioPara.Enabled) { double fASFrequency = ExtractFrequency((TCHAR*)airspace_copy.Name()); if(!ValidFrequency(fASFrequency)) { fASFrequency = ExtractFrequency((TCHAR*)airspace_copy.Comment()); } if(ValidFrequency(fASFrequency)) { WindowControl* wClose = wf->FindByName(TEXT("cmdClose")); if(wClose) { wClose->SetLeft(IBLSCALE(115)); wClose->SetWidth(IBLSCALE(120)); } wFreq->SetLeft(IBLSCALE(3)); wFreq->SetWidth(IBLSCALE(110)); _stprintf(buffer2,_T("%7.3fMHz"),fASFrequency); wFreq->SetCaption(buffer2); wFreq->Redraw(); bRadio = true; } } wFreq->SetVisible(bRadio); } #else WndProperty* wFreq = wf->FindByName(TEXT("cmdSFrequency")); if (wFreq) { wFreq->Hide(); } #endif // RADIO_ACTIVE // ONLY for DIAGNOSTICS- ENABLE ALSO XML #if 0 wp = (WndProperty*)wf->FindByName(TEXT("prpWarnLevel")); if (wp) { switch (airspace_copy.WarningLevel()) { default: // LKTOKEN _@M765_ "Unknown" wp->SetText(MsgToken(765)); break; case awNone: // LKTOKEN _@M479_ "None" wp->SetText(MsgToken(479)); break; case awYellow: // LKTOKEN _@M1255_ "YELLOW WARNING" wp->SetText(MsgToken(1255)); break; case awRed: // LKTOKEN _@M1256_ "RED WARNING" wp->SetText(MsgToken(1256)); break; }//sw wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAckLevel")); if (wp) { if (airspace_copy.Enabled()) { switch (airspace_copy.WarningAckLevel()) { default: // LKTOKEN _@M765_ "Unknown" wp->SetText(MsgToken(765)); break; case awNone: // LKTOKEN _@M479_ "None" wp->SetText(MsgToken(479)); break; case awYellow: // LKTOKEN _@M1267_ "Yellow acknowledged" wp->SetText(MsgToken(1267)); break; case awRed: // LKTOKEN _@M1268_ "Red acknowledged" wp->SetText(MsgToken(1268)); break; }//sw } else { // LKTOKEN _@M1269_ "Disabled" wp->SetText(MsgToken(1269)); } wp->RefreshDisplay(); } #endif wb = (WndButton*)wf->FindByName(TEXT("cmdFly")); if (wb) { if (airspace_copy.Flyzone()) { // LKTOKEN _@M1271_ "NOFLY" wb->SetCaption(MsgToken(1271)); } else { // LKTOKEN _@M1270_ "FLY" wb->SetCaption(MsgToken(1270)); } wb->Redraw(); } wb = (WndButton*)wf->FindByName(TEXT("cmdSelect")); if (wb) { if (airspace_copy.Selected()) { wb->SetCaption(MsgToken(1656)); // SELECTED! } else { wb->SetCaption(MsgToken(1654)); // SELECT } wb->Redraw(); } wb = (WndButton*)wf->FindByName(TEXT("cmdAcknowledge")); if (wb) { if (airspace_copy.Enabled()) { // LKTOKEN _@M1283_ "Disable" wb->SetCaption(MsgToken(1283)); } else { // LKTOKEN _@M1282_ "Enable" wb->SetCaption(MsgToken(1282)); } wb->Redraw(); } }
static void SetValues(void) { WndProperty* wp; WndButton *wb; TCHAR buffer[80]; TCHAR buffer2[160]; // must contain buffer int bearing; int hdist; int vdist; bool inside = false; { CCriticalSection::CGuard guard(CAirspaceManager::Instance().MutexRef()); CAirspace* airspace = CAirspaceManager::Instance().GetAirspacesForDetails(); if(airspace) { // Get an object instance copy with actual values airspace_copy = CAirspaceManager::Instance().GetAirspaceCopy(airspace); inside = CAirspaceManager::Instance().AirspaceCalculateDistance( airspace, &hdist, &bearing, &vdist); } else { // error : CAirspaceManager are closed ? return; } } if (wf!=NULL) { TCHAR capbuffer[250]; _stprintf(capbuffer,_T("%s ("),airspace_copy.Name()); if (airspace_copy.Enabled()) { _tcscat(capbuffer,gettext(TEXT("_@M1643_"))); // ENABLED } else { _tcscat(capbuffer,gettext(TEXT("_@M1600_"))); // DISABLED } _tcscat(capbuffer,_T(")")); // DISABLED wf->SetCaption(capbuffer); } wp = (WndProperty*)wf->FindByName(TEXT("prpType")); if (wp) { if (airspace_copy.Flyzone()) { _stprintf(buffer,TEXT("%s %s"), CAirspaceManager::Instance().GetAirspaceTypeText(airspace_copy.Type()), gettext(TEXT("FLY"))); /* if( _tcsnicmp( airspace_copy.Name(), airspace_copy.TypeName() ,_tcslen(airspace_copy.TypeName())) == 0) _stprintf(buffer,TEXT("%s"),airspace_copy.Name()); else _stprintf(buffer,TEXT("%s %s"),airspace_copy.TypeName() // fixed strings max. 20 ,airspace_copy.Name()); // NAME_SIZE 30 => max. 30 char */ } else { _stprintf(buffer,TEXT("%s %s"), gettext(TEXT("NOFLY")), CAirspaceManager::Instance().GetAirspaceTypeText(airspace_copy.Type())); } wp->SetText( buffer ); // wp->SetBackColor( airspace_copy.TypeColor()); // wp->SetForeColor( ContrastTextColor(airspace_copy.TypeColor())); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTop")); if (wp) { CAirspaceManager::Instance().GetAirspaceAltText(buffer, sizeof(buffer)/sizeof(buffer[0]), airspace_copy.Top()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpBase")); if (wp) { CAirspaceManager::Instance().GetAirspaceAltText(buffer, sizeof(buffer)/sizeof(buffer[0]), airspace_copy.Base()); wp->SetText(buffer); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpRange")); if (wp) { Units::FormatUserDistance(abs(hdist), buffer, 20); if (inside) { // LKTOKEN _@M359_ = "Inside" wp->SetCaption(gettext(TEXT("_@M359_"))); } if (hdist < 0) { // LKTOKEN _@M1257_ "to leave" _stprintf(buffer2, TEXT("%s %d%s %s"), buffer, iround(bearing), gettext(_T("_@M2179_")), gettext(TEXT("_@M1257_"))); } else { // LKTOKEN _@M1258_ "to enter" _stprintf(buffer2, TEXT("%s %d%s %s"), buffer, iround(bearing), gettext(_T("_@M2179_")), gettext(TEXT("_@M1258_"))); } wp->SetText(buffer2); wp->RefreshDisplay(); } // ONLY for DIAGNOSTICS- ENABLE ALSO XML #if 0 wp = (WndProperty*)wf->FindByName(TEXT("prpWarnLevel")); 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_"))); break; case awRed: // LKTOKEN _@M1256_ "RED WARNING" wp->SetText(gettext(TEXT("_@M1256_"))); break; }//sw wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAckLevel")); if (wp) { if (airspace_copy.Enabled()) { switch (airspace_copy.WarningAckLevel()) { default: // LKTOKEN _@M765_ "Unknown" wp->SetText(gettext(TEXT("_@M765_"))); break; case awNone: // LKTOKEN _@M479_ "None" wp->SetText(gettext(TEXT("_@M479_"))); break; case awYellow: // LKTOKEN _@M1267_ "Yellow acknowledged" wp->SetText(gettext(TEXT("_@M1267_"))); break; case awRed: // LKTOKEN _@M1268_ "Red acknowledged" wp->SetText(gettext(TEXT("_@M1268_"))); break; }//sw } else { // LKTOKEN _@M1269_ "Disabled" wp->SetText(gettext(TEXT("_@M1269_"))); } wp->RefreshDisplay(); } #endif wb = (WndButton*)wf->FindByName(TEXT("cmdFly")); if (wb) { if (airspace_copy.Flyzone()) { // LKTOKEN _@M1271_ "NOFLY" wb->SetCaption(gettext(TEXT("_@M1271_"))); } else { // LKTOKEN _@M1270_ "FLY" wb->SetCaption(gettext(TEXT("_@M1270_"))); } wb->Redraw(); } wb = (WndButton*)wf->FindByName(TEXT("cmdSelect")); if (wb) { if (airspace_copy.Selected()) { wb->SetCaption(gettext(TEXT("_@M1656_"))); // SELECTED! } else { wb->SetCaption(gettext(TEXT("_@M1654_"))); // SELECT } wb->Redraw(); } wb = (WndButton*)wf->FindByName(TEXT("cmdAcknowledge")); if (wb) { if (airspace_copy.Enabled()) { // LKTOKEN _@M1283_ "Disable" wb->SetCaption(gettext(TEXT("_@M1283_"))); } else { // LKTOKEN _@M1282_ "Enable" wb->SetCaption(gettext(TEXT("_@M1282_"))); } wb->Redraw(); } }