static void SetValues(void) { WndProperty* wp; if(Units::CoordinateFormat==4) { int utmXZone; char utmYZone; double easting, northing; LatLonToUtmWGS84(utmXZone, utmYZone, easting, northing, global_wpt->Latitude, global_wpt->Longitude ); wp = (WndProperty*)wf->FindByName(TEXT("prpUTMzoneX")); if (wp) { wp->GetDataField()->SetAsInteger(utmXZone); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpUTMzoneY")); if (wp) { DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField(); if(dfe){ std::for_each(std::begin(cYZone), std::end(cYZone), std::bind(&DataFieldEnum::addEnumText, dfe, _1)); dfe->Set(YZoneToenum(utmYZone)); } wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpUTMeast")); if (wp) { wp->GetDataField()->SetAsFloat(easting); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpUTMnorth")); if (wp) { wp->GetDataField()->SetAsFloat(northing); wp->RefreshDisplay(); } } else { bool sign; int dd,mm,ss; Units::LongitudeToDMS(global_wpt->Longitude, &dd, &mm, &ss, &sign); wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeSign")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText((TEXT("W"))); dfe->addEnumText((TEXT("E"))); dfe->Set(sign); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeD")); if (wp) { wp->GetDataField()->SetAsFloat(dd); wp->RefreshDisplay(); } switch (Units::CoordinateFormat) { case 0: // ("DDMMSS"); case 1: // ("DDMMSS.ss"); wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeM")); if (wp) { wp->GetDataField()->SetAsFloat(mm); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeS")); if (wp) { wp->GetDataField()->SetAsFloat(ss); wp->RefreshDisplay(); } break; case 2: // ("DDMM.mmm"); wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeM")); if (wp) { wp->GetDataField()->SetAsFloat(mm); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudemmm")); if (wp) { wp->GetDataField()->SetAsFloat(1000.0*ss/60.0); wp->RefreshDisplay(); } break; case 3: // ("DD.dddd"); wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeDDDD")); if (wp) { wp->GetDataField()->SetAsFloat(10000.0*(mm+ss/60.0)/60.0); wp->RefreshDisplay(); } break; case 4: break; } Units::LatitudeToDMS(global_wpt->Latitude, &dd, &mm, &ss, &sign); wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeSign")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText((TEXT("S"))); dfe->addEnumText((TEXT("N"))); dfe->Set(sign); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeD")); if (wp) { wp->GetDataField()->SetAsFloat(dd); wp->RefreshDisplay(); } switch (Units::CoordinateFormat) { case 0: // ("DDMMSS"); case 1: // ("DDMMSS.ss"); wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeM")); if (wp) { wp->GetDataField()->SetAsFloat(mm); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeS")); if (wp) { wp->GetDataField()->SetAsFloat(ss); wp->RefreshDisplay(); } break; case 2: // ("DDMM.mmm"); wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeM")); if (wp) { wp->GetDataField()->SetAsFloat(mm); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudemmm")); if (wp) { wp->GetDataField()->SetAsFloat(1000.0*ss/60.0); wp->RefreshDisplay(); } break; case 3: // ("DD.dddd"); wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeDDDD")); if (wp) { wp->GetDataField()->SetAsFloat(10000.0*(mm+ss/60.0)/60.0); wp->RefreshDisplay(); } break; case 4: break; } } wp = (WndProperty*)wf->FindByName(TEXT("prpAltitude")); if (wp) { wp->GetDataField()->SetAsFloat( iround(global_wpt->Altitude *ALTITUDEMODIFY)); wp->GetDataField()->SetUnits(Units::GetAltitudeName()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFlags")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); // LKTOKEN _@M1226_ "Turnpoint" dfe->addEnumText(gettext(TEXT("_@M1226_"))); // LKTOKEN _@M1224_ "Airport" dfe->addEnumText(gettext(TEXT("_@M1224_"))); // LKTOKEN _@M1225_ "Landable" dfe->addEnumText(gettext(TEXT("_@M1225_"))); dfe->Set(0); if ((global_wpt->Flags & LANDPOINT)==LANDPOINT) { dfe->Set(2); } if ((global_wpt->Flags & AIRPORT)==AIRPORT) { dfe->Set(1); } wp->RefreshDisplay(); } }
static void SetWaypointValues(bool first=false) { WndProperty* wp; wp = (WndProperty*)wf->FindByName(TEXT("prpAATType")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (first) { // LKTOKEN _@M210_ = "Cylinder" dfe->addEnumText(gettext(TEXT("_@M210_"))); // LKTOKEN _@M590_ = "Sector" dfe->addEnumText(gettext(TEXT("_@M590_"))); } dfe->SetDetachGUI(true); // disable call to OnAATEnabled dfe->Set(Task[twItemIndex].AATType); dfe->SetDetachGUI(false); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAATCircleRadius")); if (wp) { wp->GetDataField()->SetAsFloat(lround(Task[twItemIndex].AATCircleRadius *DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING); wp->GetDataField()->SetUnits(Units::GetDistanceName()); wp->SetVisible(Task[twItemIndex].AATType==0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAATSectorRadius")); if (wp) { wp->GetDataField()->SetAsFloat(lround(Task[twItemIndex].AATSectorRadius *DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING); wp->GetDataField()->SetUnits(Units::GetDistanceName()); wp->SetVisible(Task[twItemIndex].AATType>0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAATStartRadial")); if (wp) { wp->GetDataField()->SetAsFloat(Task[twItemIndex].AATStartRadial); wp->SetVisible(Task[twItemIndex].AATType>0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAATFinishRadial")); if (wp) { wp->GetDataField()->SetAsFloat(Task[twItemIndex].AATFinishRadial); wp->SetVisible(Task[twItemIndex].AATType>0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpOutCircle")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (dfe) { if (first) { // LKTOKEN _@M2226_ = "Enter" dfe->addEnumText(gettext(TEXT("_@M2145_"))); // LKTOKEN _@M2227_ = "Exit" dfe->addEnumText(gettext(TEXT("_@M2146_"))); } dfe->Set(Task[twItemIndex].OutCircle); } wp->SetVisible(Task[twItemIndex].AATType==0 && DoOptimizeRoute()); wp->RefreshDisplay(); } }
void dlgWeatherShowModal(void){ if (!InfoBoxLayout::landscape) { char filename[MAX_PATH]; LocalPathS(filename, TEXT("dlgWeather_L.xml")); wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_WEATHER_L")); } else { char filename[MAX_PATH]; LocalPathS(filename, TEXT("dlgWeather.xml")); wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_WEATHER")); } WndProperty* wp; if (wf) { wp = (WndProperty*)wf->FindByName(TEXT("prpTime")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(TEXT("Now")); for (int i=1; i<MAX_WEATHER_TIMES; i++) { if (RASP.weather_available[i]) { TCHAR timetext[10]; _stprintf(timetext,TEXT("%04d"), RASP.IndexToTime(i)); dfe->addEnumText(timetext); } } RASPGetTime(dfe); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpDisplayItem")); DataFieldEnum* dfe; if (wp) { dfe = (DataFieldEnum*)wp->GetDataField(); // LKTOKEN _@M708_ = "Terrain" dfe->addEnumText(gettext(TEXT("_@M708_"))); TCHAR Buffer[20]; for (int i=1; i<=15; i++) { RASP.ItemLabel(i, Buffer); if (_tcslen(Buffer)) { dfe->addEnumText(Buffer); } } dfe->Set(RasterTerrain::render_weather); wp->RefreshDisplay(); } wf->ShowModal(); wp = (WndProperty*)wf->FindByName(TEXT("prpTime")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); RASPSetTime(dfe); } wp = (WndProperty*)wf->FindByName(TEXT("prpDisplayItem")); if (wp) { RasterTerrain::render_weather = wp->GetDataField()->GetAsInteger(); } delete wf; } wf = NULL; }
int Show(DeviceDescriptor_t *d) { int nRet = IdCancel; TCHAR filename[MAX_PATH]; const TCHAR *resName = NULL; pDevice = d; Init = true; if (ScreenLandscape) { LocalPathS(filename, TEXT("dlgBlueFlyConfig.xml")); resName = TEXT("IDR_XML_BLUEFLYCONFIG"); } else { LocalPathS(filename, TEXT("dlgBlueFlyConfig_L.xml")); resName = TEXT("IDR_XML_BLUEFLYCONFIG_L"); } wfDlg = dlgLoadFromXML(CallBackTable, filename, resName); if (wfDlg) { // build list of page WindowConrol* lstPageWnd.clear(); lstPageWnd.reserve(std::distance(std::begin(lstPageName), std::end(lstPageName))); std::transform(std::begin(lstPageName), std::end(lstPageName), std::inserter(lstPageWnd, lstPageWnd.begin()), std::bind(&WndForm::FindByName, wfDlg, _1)); if(!lstPageWnd.empty()) { // Show First Page CurrentPage=0; NextPage(0); // Hide All Next Page std::for_each(++lstPageWnd.begin(), lstPageWnd.end(), std::bind(&WindowControl::Close, _1)); } // Init Enum WndProperty WndProperty* pWnd = (WndProperty*)wfDlg->FindByName(_T("BOM")); if(pWnd) { DataFieldEnum* pData =(DataFieldEnum*)pWnd->GetDataField(); if(pData) { pData->addEnumText(_T("BlueFlyVario")); pData->addEnumText(_T("LK8EX1")); pData->addEnumText(_T("LX")); pData->addEnumText(_T("FlyNet")); } } // Set Value to all WndProperty CHardwareParameters& HardwareParameters = gHardwareParameters[pDevice]; AssocFieldParam.clear(); std::for_each(HardwareParameters.begin(), HardwareParameters.end(), std::ptr_fun(FillProperty)); Init = false; if (wfDlg->ShowModal(true)) { nRet = IdOk; } AssocFieldParam.clear(); lstPageWnd.clear(); delete wfDlg; wfDlg = NULL; pDevice = NULL; } return nRet; }
static void SetValues() { WndProperty* wp; bool sign; int dd,mm,ss; global_wpt->location.longitude.ToDMS(dd, mm, ss, sign); wp = (WndProperty*)wf->FindByName(_T("prpLongitudeSign")); assert(wp != NULL); DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText((_T("W"))); dfe->addEnumText((_T("E"))); dfe->Set(sign); wp->RefreshDisplay(); LoadFormProperty(*wf, _T("prpLongitudeD"), dd); switch (CommonInterface::GetUISettings().coordinate_format) { case CoordinateFormat::DDMMSS: // ("DDMMSS"); case CoordinateFormat::DDMMSS_SS: // ("DDMMSS.ss"); LoadFormProperty(*wf, _T("prpLongitudeM"), mm); LoadFormProperty(*wf, _T("prpLongitudeS"), ss); break; case CoordinateFormat::DDMM_MMM: // ("DDMM.mmm"); LoadFormProperty(*wf, _T("prpLongitudeM"), mm); LoadFormProperty(*wf, _T("prpLongitudemmm"), 1000 * fixed(ss) / 60); break; case CoordinateFormat::DD_DDDD: // ("DD.dddd"); LoadFormProperty(*wf, _T("prpLongitudeDDDD"), 10000 * (fixed)(mm + ss) / 3600); break; case CoordinateFormat::UTM: break; } global_wpt->location.latitude.ToDMS(dd, mm, ss, sign); LoadFormProperty(*wf, _T("prpLatitudeD"), dd); wp = (WndProperty*)wf->FindByName(_T("prpLatitudeSign")); assert(wp != NULL); dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText((_T("S"))); dfe->addEnumText((_T("N"))); dfe->Set(sign); wp->RefreshDisplay(); wp = (WndProperty*)wf->FindByName(_T("prpLatitudeD")); assert(wp != NULL); wp->GetDataField()->SetAsInteger(dd); wp->RefreshDisplay(); switch (CommonInterface::GetUISettings().coordinate_format) { case CoordinateFormat::DDMMSS: // ("DDMMSS"); case CoordinateFormat::DDMMSS_SS: // ("DDMMSS.ss"); LoadFormProperty(*wf, _T("prpLatitudeM"), mm); LoadFormProperty(*wf, _T("prpLatitudeS"), ss); break; case CoordinateFormat::DDMM_MMM: // ("DDMM.mmm"); LoadFormProperty(*wf, _T("prpLatitudeM"), mm); LoadFormProperty(*wf, _T("prpLatitudemmm"), 1000 * fixed(ss) / 60); break; case CoordinateFormat::DD_DDDD: // ("DD.dddd"); LoadFormProperty(*wf, _T("prpLatitudeDDDD"), 10000 * (fixed)(mm + ss) / 3600); break; case CoordinateFormat::UTM: break; } LoadFormProperty(*wf, _T("prpAltitude"), UnitGroup::ALTITUDE, global_wpt->elevation); wp = (WndProperty*)wf->FindByName(_T("prpFlags")); assert(wp != NULL); dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T("Turnpoint")); dfe->addEnumText(_T("Airport")); dfe->addEnumText(_T("Landpoint")); if (global_wpt->IsAirport()) dfe->Set(1); else if (global_wpt->IsLandable()) dfe->Set(2); else dfe->Set(0); wp->RefreshDisplay(); }
void LayoutConfigPanel::Init(WndForm *_wf) { assert(_wf != NULL); wf = _wf; WndProperty *wp; if (Display::RotateSupported()) { wp = (WndProperty*)wf->FindByName(_T("prpDisplayOrientation")); assert(wp != NULL); DataFieldEnum *dfe = (DataFieldEnum *)wp->GetDataField(); dfe->addEnumText(_("Default")); dfe->addEnumText(_("Portrait")); dfe->addEnumText(_("Landscape")); dfe->Set(Profile::GetDisplayOrientation()); wp->RefreshDisplay(); } else { wp = (WndProperty*)wf->FindByName(_T("prpDisplayOrientation")); assert(wp != NULL); wp->hide(); } wp = (WndProperty*)wf->FindByName(_T("prpAppInfoBoxGeom")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("8 Top + Bottom (Portrait)"), InfoBoxLayout::ibTop4Bottom4); dfe->addEnumText(_("8 Bottom (Portrait)"), InfoBoxLayout::ibBottom8); dfe->addEnumText(_("8 Top (Portrait)"), InfoBoxLayout::ibTop8); dfe->addEnumText(_("8 Left + Right (Landscape)"), InfoBoxLayout::ibLeft4Right4); dfe->addEnumText(_("8 Left (Landscape)"), InfoBoxLayout::ibLeft8); dfe->addEnumText(_("8 Right (Landscape)"), InfoBoxLayout::ibRight8); dfe->addEnumText(_("9 Right + Vario (Landscape)"), InfoBoxLayout::ibGNav); dfe->addEnumText(_("5 Right (Square)"), InfoBoxLayout::ibSquare); dfe->addEnumText(_("12 Right (Landscape)"), InfoBoxLayout::ibRight12); dfe->addEnumText(_("12 Bottom (Portrait)"), InfoBoxLayout::ibBottom12); dfe->addEnumText(_("24 Right (Landscape)"), InfoBoxLayout::ibRight24); dfe->Set(InfoBoxLayout::InfoBoxGeometry); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpAppStatusMessageAlignment")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("Center")); dfe->addEnumText(_("Topleft")); dfe->Set(Appearance.StateMessageAlign); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpDialogStyle")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("Full width")); dfe->addEnumText(_("Scaled")); dfe->addEnumText(_("Scaled centered")); dfe->addEnumText(_("Fixed")); dfe->Set(DialogStyleSetting); wp->RefreshDisplay(); } LoadFormProperty(*wf, _T("prpAppInverseInfoBox"), Appearance.InverseInfoBox); LoadFormProperty(*wf, _T("prpAppInfoBoxColors"), Appearance.InfoBoxColors); wp = (WndProperty*)wf->FindByName(_T("prpAppInfoBoxBorder")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("Box")); dfe->addEnumText(_("Tab")); dfe->Set(Appearance.InfoBoxBorder); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpTabDialogStyle")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("Text")); dfe->addEnumText(_("Icons")); dfe->Set(Appearance.DialogTabStyle); wp->RefreshDisplay(); } }
void dlgWindSettingsShowModal(void) { wf = LoadDialog(CallBackTable, XCSoarInterface::main_window, _T("IDR_XML_WINDSETTINGS")); if (wf == NULL) return; const bool external_wind = XCSoarInterface::Basic().ExternalWindAvailable && XCSoarInterface::SettingsComputer().ExternalWind; WndProperty* wp; wp = (WndProperty*)wf->FindByName(_T("prpSpeed")); if (wp) { wp->set_enabled(!external_wind); DataFieldFloat &df = *(DataFieldFloat *)wp->GetDataField(); df.SetMax(Units::ToUserWindSpeed(Units::ToSysUnit(fixed(200), unKiloMeterPerHour))); df.SetUnits(Units::GetSpeedName()); df.Set(Units::ToUserWindSpeed(CommonInterface::Calculated().wind.norm)); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpDirection")); if (wp) { wp->set_enabled(!external_wind); DataFieldFloat &df = *(DataFieldFloat *)wp->GetDataField(); df.Set(CommonInterface::Calculated().wind.bearing.value_degrees()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpAutoWind")); assert(wp != NULL); if (external_wind) { wp->set_enabled(false); DataFieldEnum &df = *(DataFieldEnum *)wp->GetDataField(); df.addEnumText(_("External")); df.Set(0); wp->RefreshDisplay(); } else { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("Manual")); dfe->addEnumText(_("Circling")); dfe->addEnumText(_("ZigZag")); dfe->addEnumText(_("Both")); dfe->Set(XCSoarInterface::SettingsComputer().AutoWindMode); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpTrailDrift")); if (wp) { DataFieldBoolean &df = *(DataFieldBoolean *)wp->GetDataField(); df.Set(XCSoarInterface::SettingsMap().EnableTrailDrift); wp->RefreshDisplay(); } if (wf->ShowModal() != mrOK) { delete wf; return; } if (!external_wind) { wp = (WndProperty*)wf->FindByName(_T("prpSpeed")); if (wp != NULL) { DataFieldFloat &df = *(DataFieldFloat *)wp->GetDataField(); XCSoarInterface::SetSettingsComputer().ManualWind.norm = Units::ToSysWindSpeed(df.GetAsFixed()); XCSoarInterface::SetSettingsComputer().ManualWindAvailable.Update(XCSoarInterface::Basic().clock); } wp = (WndProperty*)wf->FindByName(_T("prpDirection")); if (wp != NULL) { DataFieldFloat &df = *(DataFieldFloat *)wp->GetDataField(); XCSoarInterface::SetSettingsComputer().ManualWind.bearing = Angle::degrees(df.GetAsFixed()); XCSoarInterface::SetSettingsComputer().ManualWindAvailable.Update(XCSoarInterface::Basic().clock); } SaveFormProperty(*wf, _T("prpAutoWind"), szProfileAutoWind, XCSoarInterface::SetSettingsComputer().AutoWindMode); } SaveFormProperty(*wf, _T("prpTrailDrift"), XCSoarInterface::SetSettingsMap().EnableTrailDrift); ActionInterface::SendSettingsMap(); delete wf; }
void TaskDefaultsConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { WndProperty *wp; const ComputerSettings &settings_computer = XCSoarInterface::GetComputerSettings(); const TaskBehaviour &task_behaviour = settings_computer.task; OrderedTask temptask(task_behaviour); temptask.SetFactory(TaskFactoryType::RACING); RowFormWidget::Prepare(parent, rc); wp = AddEnum(_("Start point"), _("Default start type for new tasks you create."), this); if (wp) { const auto point_types = temptask.GetFactory().GetValidStartTypes(); DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField(); dfe->EnableItemHelp(true); for (auto i = point_types.begin(), end = point_types.end(); i != end; ++i) { const AbstractTaskFactory::LegalPointType type = *i; dfe->addEnumText(OrderedTaskPointName(type), (unsigned)type, OrderedTaskPointDescription(type)); if (type == task_behaviour.sector_defaults.start_type) dfe->Set((unsigned)type); } wp->RefreshDisplay(); } AddFloat(Caption_GateWidth, _("Default radius or gate width of the start zone for new tasks."), _T("%.1f %s"), _T("%.1f"), fixed(0.1), fixed(100), fixed(1.0), true, UnitGroup::DISTANCE, task_behaviour.sector_defaults.start_radius); AddSpacer(); wp = AddEnum(_("Finish point"), _("Default finish type for new tasks you create."), this); if (wp) { const auto point_types = temptask.GetFactory().GetValidFinishTypes(); DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField(); dfe->EnableItemHelp(true); for (auto i = point_types.begin(), end = point_types.end(); i != end; ++i) { const AbstractTaskFactory::LegalPointType type = *i; dfe->addEnumText(OrderedTaskPointName(type), (unsigned)type, OrderedTaskPointDescription(type)); if (type == task_behaviour.sector_defaults.finish_type) dfe->Set((unsigned)type); } wp->RefreshDisplay(); } AddFloat(Caption_GateWidth, _("Default radius or gate width of the finish zone in new tasks."), _T("%.1f %s"), _T("%.1f"), fixed(0.1), fixed(100), fixed(1.0), true, UnitGroup::DISTANCE, task_behaviour.sector_defaults.finish_radius); AddSpacer(); wp = AddEnum(_("Turn point"), _("Default turn point type for new tasks you create.")); if (wp) { const auto point_types = temptask.GetFactory().GetValidIntermediateTypes(); DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField(); dfe->EnableItemHelp(true); for (auto i = point_types.begin(), end = point_types.end(); i != end; ++i) { const AbstractTaskFactory::LegalPointType type = *i; dfe->addEnumText(OrderedTaskPointName(type), (unsigned)type, OrderedTaskPointDescription(type)); if (type == task_behaviour.sector_defaults.turnpoint_type) { dfe->Set((unsigned)type); } } wp->RefreshDisplay(); } AddFloat(Caption_Radius, _("Default radius of turnpoint cylinders and sectors in new tasks."), _T("%.1f %s"), _T("%.1f"), fixed(0.1), fixed(100), fixed(1.0), true, UnitGroup::DISTANCE, task_behaviour.sector_defaults.turnpoint_radius); AddSpacer(); wp = AddEnum(_("Task"), _("Default task type for new tasks you create.")); if (wp) { const std::vector<TaskFactoryType> factory_types = temptask.GetFactoryTypes(); DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField(); dfe->EnableItemHelp(true); for (unsigned i = 0; i < factory_types.size(); i++) { dfe->addEnumText(OrderedTaskFactoryName(factory_types[i]), (unsigned)factory_types[i], OrderedTaskFactoryDescription( factory_types[i])); if (factory_types[i] == task_behaviour.task_type_default) dfe->Set((unsigned)factory_types[i]); } wp->RefreshDisplay(); } AddTime(_("AAT min. time"), _("Default AAT min. time for new AAT tasks."), 60, 10 * 60 * 60, 60, (unsigned)task_behaviour.ordered_defaults.aat_min_time); AddTime(_("Optimisation margin"), _("Safety margin for AAT task optimisation. Optimisation " "seeks to complete the task at the minimum time plus this margin time."), 0, 30 * 60, 60, (unsigned)task_behaviour.optimise_targets_margin); SetExpertRow(AATTimeMargin); SetStartLabel(); SetFinishLabel(); }
void dlgTarget(void) { if (!ValidTaskPoint(ActiveWayPoint)) { return; } ActiveWayPointOnEntry = ActiveWayPoint; #if USEIBOX if (!InfoBoxLayout::landscape) { #else if (!ScreenLandscape) { #endif char filename[MAX_PATH]; LocalPathS(filename, TEXT("dlgTarget_L.xml")); wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_TARGET_L")); } else { char filename[MAX_PATH]; LocalPathS(filename, TEXT("dlgTarget.xml")); wf = dlgLoadFromXML(CallBackTable, filename, hWndMainWindow, TEXT("IDR_XML_TARGET")); } if (!wf) return; TargetDialogOpen = true; TargetMoveMode = false; WndFrame *wf2 = (WndFrame*)wf->FindByName(TEXT("frmTarget")); if (wf2) { #if USEIBOX if (InfoBoxLayout::landscape) #else if (ScreenLandscape) #endif {// make flush right in landscape mode (at top in portrait mode) dlgSize = wf2->GetWidth(); #if USEIBOX wf->SetLeft(MapWindow::MapRectBig.right- dlgSize); #else wf->SetLeft(MapWindow::MapRect.right- dlgSize); #endif } else { dlgSize = wf2->GetHeight(); } } btnMove = (WindowControl*)wf->FindByName(TEXT("btnMove")); wf->SetKeyDownNotify(FormKeyDown); WndProperty *wp; wp = (WndProperty*)wf->FindByName(TEXT("prpTaskPoint")); DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); TCHAR tp_label[80]; TCHAR tp_short[21]; LockTaskData(); if (!ValidTaskPoint(target_point)) { target_point = ActiveWayPointOnEntry; } else { target_point = max(target_point, ActiveWayPointOnEntry); } for (int i=ActiveWayPointOnEntry; i<MAXTASKPOINTS; i++) { if (ValidTaskPoint(i)) { _tcsncpy(tp_short, WayPointList[Task[i].Index].Name, 20); tp_short[20] = 0; _stprintf(tp_label, TEXT("%d %s"), i, tp_short); dfe->addEnumText(tp_label); } else { if (target_point>= i) { target_point= ActiveWayPointOnEntry; } } } dfe->Set(max(0,target_point-ActiveWayPointOnEntry)); UnlockTaskData(); wp->RefreshDisplay(); RefreshTargetPoint(); wf->SetTimerNotify(OnTimerNotify); wf->ShowModal(true); // enable map MapWindow::SetTargetPan(false, 0); TargetDialogOpen = false; delete wf; wf = NULL; }
void TaskDefaultsConfigPanel::Init(WndForm *_wf) { assert(_wf != NULL); wf = _wf; WndProperty *wp; const SETTINGS_COMPUTER &settings_computer = XCSoarInterface::SettingsComputer(); OrderedTask* temptask = protected_task_manager->task_blank(); temptask->set_factory(TaskBehaviour::FACTORY_RT); wp = (WndProperty*)wf->FindByName(_T("prpStartType")); if (wp) { const AbstractTaskFactory::LegalPointVector point_types = temptask->get_factory().getValidStartTypes(); DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField(); dfe->EnableItemHelp(true); for (unsigned i = 0; i < point_types.size(); i++) { dfe->addEnumText(OrderedTaskPointName(point_types[i]), (unsigned)point_types[i], OrderedTaskPointDescription(point_types[i])); if (point_types[i] == settings_computer.sector_defaults.start_type) dfe->Set((unsigned)point_types[i]); } wp->RefreshDisplay(); } LoadFormProperty(*wf, _T("prpStartRadius"), ugDistance, settings_computer.sector_defaults.start_radius); wp = (WndProperty*)wf->FindByName(_T("prpFinishType")); if (wp) { const AbstractTaskFactory::LegalPointVector point_types = temptask->get_factory().getValidFinishTypes(); DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField(); dfe->EnableItemHelp(true); for (unsigned i = 0; i < point_types.size(); i++) { dfe->addEnumText(OrderedTaskPointName(point_types[i]), (unsigned)point_types[i], OrderedTaskPointDescription(point_types[i])); if (point_types[i] == settings_computer.sector_defaults.finish_type) dfe->Set((unsigned)point_types[i]); } wp->RefreshDisplay(); } LoadFormProperty(*wf, _T("prpFinishRadius"), ugDistance, settings_computer.sector_defaults.finish_radius); wp = (WndProperty*)wf->FindByName(_T("prpTurnpointType")); if (wp) { const AbstractTaskFactory::LegalPointVector point_types = temptask->get_factory().getValidIntermediateTypes(); DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField(); dfe->EnableItemHelp(true); for (unsigned i = 0; i < point_types.size(); i++) { dfe->addEnumText(OrderedTaskPointName(point_types[i]), (unsigned)point_types[i], OrderedTaskPointDescription(point_types[i])); if (point_types[i] == settings_computer.sector_defaults.turnpoint_type) { dfe->Set((unsigned)point_types[i]); } } wp->RefreshDisplay(); } LoadFormProperty(*wf, _T("prpTurnpointRadius"), ugDistance, settings_computer.sector_defaults.turnpoint_radius); wp = (WndProperty*)wf->FindByName(_T("prpTaskType")); if (wp) { const std::vector<TaskBehaviour::Factory_t> factory_types = temptask->get_factory_types(); DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField(); dfe->EnableItemHelp(true); for (unsigned i = 0; i < factory_types.size(); i++) { dfe->addEnumText(OrderedTaskFactoryName(factory_types[i]), (unsigned)factory_types[i], OrderedTaskFactoryDescription( factory_types[i])); if (factory_types[i] == settings_computer.task_type_default) dfe->Set((unsigned)factory_types[i]); } wp->RefreshDisplay(); } LoadFormProperty(*wf, _T("prpAATMinTime"), (unsigned)(settings_computer.ordered_defaults.aat_min_time / 60)); LoadFormProperty(*wf, _T("prpAATTimeMargin"), (unsigned)(settings_computer.optimise_targets_margin / 60)); delete temptask; }
static void SetValues(bool first=false) { WndProperty* wp; wp = (WndProperty*)wf->FindByName(TEXT("prpTaskFinishLine")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (first) { // LKTOKEN _@M210_ = "Cylinder" dfe->addEnumText(gettext(TEXT("_@M210_"))); // LKTOKEN _@M393_ = "Line" dfe->addEnumText(gettext(TEXT("_@M393_"))); // LKTOKEN _@M274_ = "FAI Sector" dfe->addEnumText(gettext(TEXT("_@M274_"))); } dfe->Set(FinishLine); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTaskFinishRadius")); if (wp) { wp->GetDataField()->SetAsFloat(lround(FinishRadius*DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING); wp->GetDataField()->SetUnits(Units::GetDistanceName()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTaskStartLine")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (first) { // LKTOKEN _@M210_ = "Cylinder" dfe->addEnumText(gettext(TEXT("_@M210_"))); // LKTOKEN _@M393_ = "Line" dfe->addEnumText(gettext(TEXT("_@M393_"))); // LKTOKEN _@M274_ = "FAI Sector" dfe->addEnumText(gettext(TEXT("_@M274_"))); } dfe->SetDetachGUI(true); // disable call to OnAATEnabled dfe->Set(StartLine); dfe->SetDetachGUI(false); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTaskStartRadius")); if (wp) { wp->GetDataField()->SetAsFloat(lround(StartRadius*DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING); wp->GetDataField()->SetUnits(Units::GetDistanceName()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTaskFAISector")); if (wp) { wp->SetVisible(AATEnabled==0); DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (first) { // LKTOKEN _@M210_ = "Cylinder" dfe->addEnumText(gettext(TEXT("_@M210_"))); // LKTOKEN _@M274_ = "FAI Sector" dfe->addEnumText(gettext(TEXT("_@M274_"))); dfe->addEnumText(gettext(TEXT("DAe 0.5/10"))); } dfe->SetDetachGUI(true); // disable call to OnAATEnabled dfe->Set(SectorType); dfe->SetDetachGUI(false); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTaskSectorRadius")); if (wp) { wp->SetVisible(AATEnabled==0); wp->GetDataField()->SetAsFloat(lround(SectorRadius*DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING); wp->GetDataField()->SetUnits(Units::GetDistanceName()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAutoAdvance")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (first) { // LKTOKEN _@M418_ = "Manual" dfe->addEnumText(gettext(TEXT("_@M418_"))); // LKTOKEN _@M897_ "Auto" dfe->addEnumText(gettext(TEXT("_@M897_"))); // LKTOKEN _@M97_ = "Arm" dfe->addEnumText(gettext(TEXT("_@M97_"))); // LKTOKEN _@M96_ = "Arm start" dfe->addEnumText(gettext(TEXT("_@M96_"))); } dfe->Set(AutoAdvance); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpMinTime")); if (wp) { wp->SetVisible(AATEnabled>0); wp->GetDataField()->SetAsFloat(AATTaskLength); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpEnableMultipleStartPoints")); if (wp) { wp->GetDataField()->Set(EnableMultipleStartPoints); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAATEnabled")); if (wp) { bool aw = (AATEnabled != 0); wp->GetDataField()->Set(aw); wp->RefreshDisplay(); } WndButton* wb; wb = (WndButton *)wf->FindByName(TEXT("EditStartPoints")); if (wb) { wb->SetVisible(EnableMultipleStartPoints!=0); } }
bool dlgConfigInfoboxesShowModal(SingleWindow &parent, const DialogLook &dialog_look, const InfoBoxLook &_look, InfoBoxSettings::Geometry geometry, InfoBoxSettings::Panel &data_r, bool allow_name_change) { current_preview = 0; look = &_look; data = data_r; PixelRect rc = parent.GetClientRect(); wf = new WndForm(parent, dialog_look, rc); #ifdef _WIN32_WCE if (IsAltair()) wf->SetKeyDownFunction(OnKeyDown); #endif ContainerWindow &client_area = wf->GetClientAreaWindow(); rc = client_area.GetClientRect(); rc.Grow(Layout::FastScale(-2)); info_box_layout = InfoBoxLayout::Calculate(rc, geometry); WindowStyle preview_style; preview_style.EnableDoubleClicks(); for (unsigned i = 0; i < info_box_layout.count; ++i) { rc = info_box_layout.positions[i]; previews[i].Create(client_area, rc, preview_style); } rc = info_box_layout.remaining; WindowStyle style; style.TabStop(); PixelRect control_rc = rc; control_rc.right -= Layout::FastScale(2); const UPixelScalar height = Layout::Scale(22); const UPixelScalar caption_width = Layout::Scale(60); ButtonWindowStyle button_style; button_style.TabStop(); control_rc.bottom = control_rc.top + height; edit_name = new WndProperty(client_area, dialog_look, _("Name"), control_rc, caption_width, style); DataFieldString *dfs = new DataFieldString(allow_name_change ? (const TCHAR *)data.name : gettext(data.name)); edit_name->SetDataField(dfs); edit_name->SetReadOnly(!allow_name_change); control_rc.top = control_rc.bottom; control_rc.bottom = control_rc.top + height; edit_select = new WndProperty(client_area, dialog_look, _("InfoBox"), control_rc, caption_width, style); DataFieldEnum *dfe = new DataFieldEnum(OnSelectAccess); for (unsigned i = 0; i < info_box_layout.count; ++i) { TCHAR label[32]; _stprintf(label, _T("%u"), i + 1); dfe->addEnumText(label, i); } edit_select->SetDataField(dfe); control_rc.top += height; control_rc.bottom += height; edit_content = new WndProperty(client_area, dialog_look, _("Content"), control_rc, caption_width, style); dfe = new DataFieldEnum(OnContentAccess); for (unsigned i = InfoBoxFactory::MIN_TYPE_VAL; i < InfoBoxFactory::NUM_TYPES; i++) { const TCHAR *name = InfoBoxFactory::GetName((InfoBoxFactory::Type) i); const TCHAR *desc = InfoBoxFactory::GetDescription((InfoBoxFactory::Type) i); if (name != NULL) dfe->addEnumText(gettext(name), i, desc != NULL ? gettext(desc) : NULL); } dfe->EnableItemHelp(true); dfe->Sort(0); edit_content->SetDataField(dfe); control_rc.top += height; control_rc.bottom += height * 5; edit_content_description = new WndFrame(client_area, dialog_look, control_rc, style); RefreshEditContent(); const UPixelScalar button_width = Layout::Scale(60); const UPixelScalar button_height = Layout::Scale(28); PixelRect button_rc = rc; button_rc.right = button_rc.left + button_width; button_rc.top = button_rc.bottom - button_height; WndButton *close_button = new WndButton(client_area, dialog_look.button, _("Close"), button_rc, button_style, *wf, mrOK); button_rc.left += button_width + Layout::Scale(2); button_rc.right += button_width + Layout::Scale(2); WndButton *copy_button = new WndButton(client_area, dialog_look.button, _("Copy"), button_rc, button_style, OnCopy); button_rc.left += button_width + Layout::Scale(2); button_rc.right += button_width + Layout::Scale(2); buttonPaste = new WndButton(client_area, dialog_look.button, _("Paste"), button_rc, button_style, OnPaste); RefreshPasteButton(); int result = wf->ShowModal(); if (result == mrOK && allow_name_change) data.name = edit_name->GetDataField()->GetAsString(); delete wf; delete edit_name; delete edit_select; delete edit_content; delete close_button; delete copy_button; delete buttonPaste; bool changed = false; if (result == mrOK) { for (unsigned i = 0; i < InfoBoxSettings::Panel::MAX_CONTENTS; ++i) if (data.contents[i] != data_r.contents[i]) changed = true; changed |= (_tcscmp(data.name, data_r.name) != 0); if (changed) data_r = data; } return changed; }
void WaypointDisplayConfigPanel::Init(WndForm *_wf) { assert(_wf != NULL); wf = _wf; WndProperty *wp; const WaypointRendererSettings &settings = CommonInterface::SettingsMap().waypoint; wp = (WndProperty*)wf->FindByName(_T("prpWaypointLabels")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->EnableItemHelp(true); dfe->addEnumText(_("Full name"), DISPLAYNAME, _("The full name of each waypoint is displayed.")); dfe->addEnumText(_("First word of name"), DISPLAYUNTILSPACE, _("The first word of the waypoint name is displayed.")); dfe->addEnumText(_("First 3 letters"), DISPLAYFIRSTTHREE, _("The first 3 letters of the waypoint name are displayed.")); dfe->addEnumText(_("First 5 letters"), DISPLAYFIRSTFIVE, _("The first 5 letters of the waypoint name are displayed.")); dfe->addEnumText(_("None"), DISPLAYNONE, _("No waypoint name is displayed.")); dfe->Set(settings.display_text_type); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpWaypointArrivalHeightDisplay")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->EnableItemHelp(true); dfe->addEnumText(_("None"), WP_ARRIVAL_HEIGHT_NONE, _("No arrival height is displayed.")); dfe->addEnumText(_("Straight glide"), WP_ARRIVAL_HEIGHT_GLIDE, _("Straight glide arrival height (no terrain is considered).")); dfe->addEnumText(_("Terrain avoidance glide"), WP_ARRIVAL_HEIGHT_TERRAIN, _("Arrival height considering terrain avoidance")); dfe->addEnumText(_("Straight & terrain glide"), WP_ARRIVAL_HEIGHT_GLIDE_AND_TERRAIN, _("Both arrival heights are displayed.")); dfe->Set(settings.arrival_height_display); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpWaypointLabelStyle")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("Rounded rectangle"), RoundedBlack); dfe->addEnumText(_("Outlined"), OutlinedInverted); dfe->Set(settings.landable_render_mode); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpWaypointLabelSelection")); if (wp) { //Determines what waypoint labels are displayed for each waypoint (space permitting): DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->EnableItemHelp(true); dfe->addEnumText(_("All"), wlsAllWaypoints, _("All waypoint labels will be displayed.")); dfe->addEnumText(_("Task waypoints & landables"), wlsTaskAndLandableWaypoints, _("All waypoints part of a task and all landables will be displayed.")); dfe->addEnumText(_("Task waypoints"), wlsTaskWaypoints, _("All waypoints part of a task will be displayed.")); dfe->addEnumText(_("None"), wlsNoWaypoints, _("No waypoint labels will be displayed.")); dfe->Set(settings.label_selection); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpAppIndLandable")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->EnableItemHelp(true); dfe->addEnumText(_("Purple circle"), wpLandableWinPilot, _("Airports and outlanding fields are displayed as purple circles. If the waypoint is reachable a bigger green circle is added behind the purple one. If the waypoint is blocked by a mountain the green circle will be red instead.")); dfe->addEnumText(_("B/W"), wpLandableAltA, _("Airports and outlanding fields are displayed in white/grey. If the waypoint is reachable the color is changed to green. If the waypoint is blocked by a mountain the color is changed to red instead.")); dfe->addEnumText(_("Traffic lights"), wpLandableAltB, _("Airports and outlanding fields are displayed in the colors of a traffic light. Green if reachable, Orange if blocked by mountain and red if not reachable at all.")); dfe->Set(settings.landable_style); wp->RefreshDisplay(); } LoadFormProperty(*wf, _T("prpAppUseSWLandablesRendering"), settings.vector_landable_rendering); LoadFormProperty(*wf, _T("prpAppLandableRenderingScale"), settings.landable_rendering_scale); LoadFormProperty(*wf, _T("prpAppScaleRunwayLength"), settings.scale_runway_length); UpdateVisibilities(); }
void TaskPropertiesPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { AddTime(_("AAT min. time"), _("Minimum AAT task time in minutes."), 0, 36000, 60, 180); AddFloat(_("Start max. speed"), _("Maximum speed allowed in start observation zone. Set to 0 for no limit."), _T("%.0f %s"), _T("%.0f"), fixed_zero, fixed(300), fixed(5), false, fixed_zero); AddFloat(_("Start max. height"), _("Maximum height based on start height reference (AGL or MSL) while starting the task. Set to 0 for no limit."), _T("%.0f %s"), _T("%.0f"), fixed_zero, fixed(10000), fixed(25), false, fixed_zero); static gcc_constexpr_data StaticEnumChoice start_max_height_ref_list[] = { { (unsigned)HeightReferenceType::AGL, N_("AGL"), N_("Reference AGL for start maximum height rule (above start point).") }, { (unsigned)HeightReferenceType::MSL, N_("MSL"), N_("Reference MSL for start maximum height rule (above sea level).") }, { 0 } }; AddEnum(_("Start height ref."), _("Reference used for start max height rule\n" "[MSL] Reference is altitude above mean sea level\n" "[AGL] Reference is the height above the start point"), start_max_height_ref_list); AddFloat(_("Finish min. height"), _("Minimum height based on finish height reference (AGL or MSL) while finishing the task. Set to 0 for no limit."), _T("%.0f %s"), _T("%.0f"), fixed_zero, fixed(10000), fixed(25), false, fixed_zero); static gcc_constexpr_data StaticEnumChoice finish_min_height_ref_list[] = { { (unsigned)HeightReferenceType::AGL, N_("AGL"), N_("Reference AGL for finish minimum height rule (above finish point).") }, { (unsigned)HeightReferenceType::MSL, N_("MSL"), N_("Reference MSL for finish minimum height rule (above sea level).") }, { 0 } }; AddEnum(_("Finish height ref."), _("Reference used for finish min height rule\n" "[MSL] Reference is altitude above mean sea level\n" "[AGL] Reference is the height above the finish point"), finish_min_height_ref_list); AddBoolean(_("FAI start / finish rules"), _("If enabled, has no max start height or max start speed and requires the minimum height above ground for finish to be greater than 1000m below the start height."), false, this); DataFieldEnum *dfe = new DataFieldEnum(NULL); dfe->SetListener(this); dfe->EnableItemHelp(true); const std::vector<TaskFactoryType> factory_types = ordered_task->GetFactoryTypes(); for (unsigned i = 0; i < factory_types.size(); i++) { dfe->addEnumText(OrderedTaskFactoryName(factory_types[i]), (unsigned)factory_types[i], OrderedTaskFactoryDescription(factory_types[i])); if (factory_types[i] == ordered_task->GetFactoryType()) dfe->Set((unsigned)factory_types[i]); } Add(_("Task type"), _("Sets the behaviour for the current task."), dfe); }
void RouteConfigPanel::Init(WndForm *_wf) { assert(_wf != NULL); wf = _wf; WndProperty *wp; const SETTINGS_COMPUTER &settings_computer = XCSoarInterface::SettingsComputer(); wp = (WndProperty*)wf->FindByName(_T("prpFinalGlideTerrain")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("Off"), SETTINGS_COMPUTER::FGT_OFF); dfe->addEnumText(_("Line"), SETTINGS_COMPUTER::FGT_LINE); dfe->addEnumText(_("Shade"), SETTINGS_COMPUTER::FGT_SHADE); dfe->Set(settings_computer.FinalGlideTerrain); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpRoutePlannerMode")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("None")); dfe->addEnumText(_("Terrain")); dfe->addEnumText(_("Airspace")); dfe->addEnumText(_("Both")); dfe->Set(settings_computer.route_planner.mode); wp->RefreshDisplay(); } LoadFormProperty(*wf, _T("prpRoutePlannerAllowClimb"), settings_computer.route_planner.allow_climb); LoadFormProperty(*wf, _T("prpRoutePlannerUseCeiling"), settings_computer.route_planner.use_ceiling); wp = (WndProperty*)wf->FindByName(_T("prpTurningReach")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("Off")); dfe->addEnumText(_("Straight")); dfe->addEnumText(_("Turning")); dfe->Set(settings_computer.route_planner.reach_calc_mode); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpReachPolarMode")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("Task")); dfe->addEnumText(_("Safety MC")); dfe->Set(settings_computer.route_planner.reach_polar_mode); wp->RefreshDisplay(); } }
static void SetValues() { WndProperty* wp; bool sign; int dd,mm,ss; Units::LongitudeToDMS(global_wpt->location.Longitude, &dd, &mm, &ss, &sign); wp = (WndProperty*)wf->FindByName(_T("prpLongitudeSign")); assert(wp != NULL); DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText((_T("W"))); dfe->addEnumText((_T("E"))); dfe->Set(sign); wp->RefreshDisplay(); LoadFormProperty(*wf, _T("prpLongitudeD"), dd); switch (Units::GetCoordinateFormat()) { case cfDDMMSS: // ("DDMMSS"); case cfDDMMSSss: // ("DDMMSS.ss"); LoadFormProperty(*wf, _T("prpLongitudeM"), mm); LoadFormProperty(*wf, _T("prpLongitudeS"), ss); break; case cfDDMMmmm: // ("DDMM.mmm"); LoadFormProperty(*wf, _T("prpLongitudeM"), mm); LoadFormProperty(*wf, _T("prpLongitudemmm"), 1000 * fixed(ss) / 60); break; case cfDDdddd: // ("DD.dddd"); LoadFormProperty(*wf, _T("prpLongitudeDDDD"), 10000 * (fixed)(mm + ss) / 3600); break; } Units::LatitudeToDMS(global_wpt->location.Latitude, &dd, &mm, &ss, &sign); LoadFormProperty(*wf, _T("prpLatitudeD"), dd); wp = (WndProperty*)wf->FindByName(_T("prpLatitudeSign")); assert(wp != NULL); dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText((_T("S"))); dfe->addEnumText((_T("N"))); dfe->Set(sign); wp->RefreshDisplay(); wp = (WndProperty*)wf->FindByName(_T("prpLatitudeD")); assert(wp != NULL); wp->GetDataField()->SetAsInteger(dd); wp->RefreshDisplay(); switch (Units::GetCoordinateFormat()) { case cfDDMMSS: // ("DDMMSS"); case cfDDMMSSss: // ("DDMMSS.ss"); LoadFormProperty(*wf, _T("prpLatitudeM"), mm); LoadFormProperty(*wf, _T("prpLatitudeS"), ss); break; case cfDDMMmmm: // ("DDMM.mmm"); LoadFormProperty(*wf, _T("prpLatitudeM"), mm); LoadFormProperty(*wf, _T("prpLatitudemmm"), 1000 * fixed(ss) / 60); break; case cfDDdddd: // ("DD.dddd"); LoadFormProperty(*wf, _T("prpLatitudeDDDD"), 10000 * (fixed)(mm + ss) / 3600); break; } LoadFormProperty(*wf, _T("prpAltitude"), ugAltitude, global_wpt->altitude); wp = (WndProperty*)wf->FindByName(_T("prpFlags")); assert(wp != NULL); dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T("Turnpoint")); dfe->addEnumText(_T("Airport")); dfe->addEnumText(_T("Landpoint")); if (global_wpt->IsAirport()) dfe->Set(1); else if (global_wpt->IsLandable()) dfe->Set(2); else dfe->Set(0); wp->RefreshDisplay(); }
void LoadGUI() { #define MAX_ENUM 10 IsInitialized=false; int i=0; WndProperty* wp; wp = (WndProperty*)wf->FindByName(TEXT("prpFontName")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (dfe) { for (i=0 ;i < MAX_ENUM ; i++) { dfe->Dec(); } // rewind bool bFound=false; for (i=0 ;i < MAX_ENUM ; i++ ) { if (_tcsncmp(dfe->GetAsString(), NewLogFont.lfFaceName, LF_FACESIZE) == 0) { bFound=true; break; } dfe->Inc(); } if (!bFound) { dfe->addEnumText(NewLogFont.lfFaceName); for (i=0 ;i < MAX_ENUM ; i++) { dfe->Dec(); } // rewind for (i=0 ;i < MAX_ENUM ; i++ ) { if (_tcsncmp(dfe->GetAsString(), NewLogFont.lfFaceName,LF_FACESIZE) == 0) { break; } dfe->Inc(); } } } wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFontHeight")); if (wp) { DataFieldInteger * dfi; dfi = (DataFieldInteger*)wp->GetDataField(); if (dfi) { dfi->Set(NewLogFont.lfHeight); } wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFontWeight")); if (wp) { DataFieldInteger* dfi; dfi = (DataFieldInteger*)wp->GetDataField(); if (dfi) { dfi->Set(NewLogFont.lfWeight); } wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFontItalic")); if (wp) { DataFieldBoolean* dfb; dfb = (DataFieldBoolean*)wp->GetDataField(); if (dfb) { dfb->Set(NewLogFont.lfItalic); } wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFontPitchAndFamily")); if (wp) { DataFieldEnum * dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (dfe) { dfe->SetAsInteger(NewLogFont.lfPitchAndFamily); } wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFontTrueType")); if (wp) { DataFieldBoolean* dfb; dfb = (DataFieldBoolean*)wp->GetDataField(); if (dfb) { dfb->Set(NewLogFont.lfQuality != NONANTIALIASED_QUALITY); //was dfb->Set(NewLogFont.lfQuality == LKFONT_QUALITY); dont know why } wp->RefreshDisplay(); } IsInitialized=true; RedrawSampleFont(); }
void OnSend(WndButton* pWnd) { if(ItemIndex < FileList.size()) { StartHourglassCursor(); //Start Bluetooth if needed... #ifdef UNDER_CE CObexPush Obex; if(Obex.Startup()) { StartupStore(_T("Startup OK \n")); size_t nDevice = Obex.LookupDevice(); StartupStore(_T("LookupDevice OK \n")); if(nDevice == 0) { StopHourglassCursor(); MessageBoxX(_T("No Device"), _T("Error"), mbOk); StartHourglassCursor(); } else { WndProperty* wp = (WndProperty*)wfDlg->FindByName(TEXT("prpDeviceList")); DataFieldEnum* dfe = NULL; if (wp) { dfe = (DataFieldEnum*)wp->GetDataField(); } if(dfe) { dfe->Clear(); dfe->addEnumText(_T("none")); } for(size_t i = 0; i < nDevice; ++i) { TCHAR szDeviceName[100] = {0}; if(!Obex.GetDeviceName(i, szDeviceName, array_size(szDeviceName))) { _stprintf(szDeviceName, _T("Unknown device <%d>"), i); } StartupStore(_T("GetDeviceName <%d><%s> \n"), i, szDeviceName); if(dfe) { dfe->addEnumText(szDeviceName); } } if(wp) { if(dfe) { dfe->SetAsInteger(0); } wp->SetReadOnly(false); wp->RefreshDisplay(); } StopHourglassCursor(); size_t DeviceIndex = 0; if(dfe && wp) { dlgComboPicker(wp); DeviceIndex = dfe->GetAsInteger(); } StartHourglassCursor(); if(DeviceIndex != 0) { DeviceIndex--; TCHAR szFileFullPath[MAX_PATH] = _T("\0"); LocalPath(szFileFullPath, _T(LKD_LOGS)); size_t nLen = _tcslen(szFileFullPath); if (szFileFullPath[nLen - 1] != _T('\\')) { _tcscat(szFileFullPath, _T("\\")); } FileList_t::const_iterator ItFileName = FileList.begin(); std::advance(ItFileName, ItemIndex); _tcscat(szFileFullPath, ItFileName->c_str()); if(!Obex.SendFile(DeviceIndex, szFileFullPath)) { StopHourglassCursor(); MessageBoxX(_T("Send Failed"), _T("Error"), mbOk); StartHourglassCursor(); } else { StopHourglassCursor(); MessageBoxX(_T("File sent!"), _T("Success"), mbOk); StartHourglassCursor(); } } } Obex.Shutdown(); } else { MessageBoxX(_T("Unsupported on this device"), _T("Error"), mbOk); } #else MessageBoxX(_T("Unsupported on this device"), _T("Error"), mbOk); #endif StopHourglassCursor(); } }
static void FillEnums(void) { WndProperty *wp; wp = (WndProperty*)wf->FindByName(_T("prpBaudRateA")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T("Auto")); dfe->addEnumText(_T("4800")); dfe->addEnumText(_T("9600")); dfe->addEnumText(_T("19200")); dfe->addEnumText(_T("38400")); dfe->addEnumText(_T("57600")); dfe->addEnumText(_T("115200")); dfe->Set(0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpHasTemperature")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T("OFF")); dfe->addEnumText(_T("ON")); dfe->addEnumText(_T("AUTO")); dfe->Set(0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpToneClimbComparisonType")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T("None")); dfe->addEnumText(_T("Gross>MacCready")); dfe->addEnumText(_T("Gross>Average")); dfe->Set(0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpToneCruiseLiftDetectionType")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T("Disabled")); dfe->addEnumText(_T("Relative>0")); dfe->addEnumText(_T("Relative>MacCready/2")); dfe->addEnumText(_T("Gross>0")); dfe->addEnumText(_T("Net>MacCready/2")); dfe->addEnumText(_T("Relative>MacCready")); dfe->addEnumText(_T("Net>MacCready")); dfe->Set(0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpVarioTimeConstantCircling")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T(" 1.0s")); dfe->addEnumText(_T(" 1.3s")); dfe->addEnumText(_T(" 1.8s")); dfe->addEnumText(_T(" 2.7s")); dfe->Set(0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpVarioTimeConstantCruise")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T(" 1.0s")); dfe->addEnumText(_T(" 1.3s")); dfe->addEnumText(_T(" 1.8s")); dfe->addEnumText(_T(" 2.7s")); dfe->Set(0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpToneAveragerVarioTimeScale")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T(" 0.0s")); dfe->addEnumText(_T(" 0.8s")); dfe->addEnumText(_T(" 1.7s")); dfe->addEnumText(_T(" 3.5s")); dfe->addEnumText(_T(" 7.5s")); dfe->addEnumText(_T("15.0s")); dfe->addEnumText(_T("30.0s")); dfe->Set(0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpToneAveragerCruiseTimeScale")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T(" 0.0s")); dfe->addEnumText(_T(" 0.8s")); dfe->addEnumText(_T(" 1.7s")); dfe->addEnumText(_T(" 3.5s")); dfe->addEnumText(_T(" 7.5s")); dfe->addEnumText(_T("15.0s")); dfe->addEnumText(_T("30.0s")); dfe->Set(0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpToneDeadbandCirclingType")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T("Step")); dfe->addEnumText(_T("Ramp")); dfe->Set(0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpToneDeadbandCruiseType")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T("Step")); dfe->addEnumText(_T("Ramp")); dfe->Set(0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpFlarmUserInterface")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumTexts(flarm_user_interfaces); dfe->Set(0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpFlarmAircraftType")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumTexts(flarm_aircraft_types); dfe->Set(0); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpNeedleGaugeType")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumTexts(needle_gauge_types); dfe->Set(0); wp->RefreshDisplay(); } FillAllAudioEnums(); }
static void SetValues(void) { WndProperty* wp; bool sign; int dd,mm,ss; Units::LongitudeToDMS(global_wpt->Longitude, &dd, &mm, &ss, &sign); wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeSign")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText((TEXT("W"))); dfe->addEnumText((TEXT("E"))); dfe->Set(sign); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeD")); if (wp) { wp->GetDataField()->SetAsFloat(dd); wp->RefreshDisplay(); } switch (Units::CoordinateFormat) { case 0: // ("DDMMSS"); case 1: // ("DDMMSS.ss"); wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeM")); if (wp) { wp->GetDataField()->SetAsFloat(mm); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeS")); if (wp) { wp->GetDataField()->SetAsFloat(ss); wp->RefreshDisplay(); } break; case 2: // ("DDMM.mmm"); wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeM")); if (wp) { wp->GetDataField()->SetAsFloat(mm); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudemmm")); if (wp) { wp->GetDataField()->SetAsFloat(1000.0*ss/60.0); wp->RefreshDisplay(); } break; case 3: // ("DD.dddd"); wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeDDDD")); if (wp) { wp->GetDataField()->SetAsFloat(10000.0*(mm+ss/60.0)/60.0); wp->RefreshDisplay(); } break; #ifdef NEWUTM case 4: wp = (WndProperty*)wf->FindByName(TEXT("prpUTMeast")); if (wp) { wp->GetDataField()->SetAsFloat(mm); wp->RefreshDisplay(); } break; #endif } Units::LatitudeToDMS(global_wpt->Latitude, &dd, &mm, &ss, &sign); wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeSign")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText((TEXT("S"))); dfe->addEnumText((TEXT("N"))); dfe->Set(sign); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeD")); if (wp) { wp->GetDataField()->SetAsFloat(dd); wp->RefreshDisplay(); } switch (Units::CoordinateFormat) { case 0: // ("DDMMSS"); case 1: // ("DDMMSS.ss"); wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeM")); if (wp) { wp->GetDataField()->SetAsFloat(mm); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeS")); if (wp) { wp->GetDataField()->SetAsFloat(ss); wp->RefreshDisplay(); } break; case 2: // ("DDMM.mmm"); wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeM")); if (wp) { wp->GetDataField()->SetAsFloat(mm); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudemmm")); if (wp) { wp->GetDataField()->SetAsFloat(1000.0*ss/60.0); wp->RefreshDisplay(); } break; case 3: // ("DD.dddd"); wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeDDDD")); if (wp) { wp->GetDataField()->SetAsFloat(10000.0*(mm+ss/60.0)/60.0); wp->RefreshDisplay(); } break; } wp = (WndProperty*)wf->FindByName(TEXT("prpAltitude")); if (wp) { wp->GetDataField()->SetAsFloat( iround(global_wpt->Altitude *ALTITUDEMODIFY)); wp->GetDataField()->SetUnits(Units::GetAltitudeName()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFlags")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); // LKTOKEN _@M1226_ "Turnpoint" dfe->addEnumText(gettext(TEXT("_@M1226_"))); // LKTOKEN _@M1224_ "Airport" dfe->addEnumText(gettext(TEXT("_@M1224_"))); // LKTOKEN _@M1225_ "Landable" dfe->addEnumText(gettext(TEXT("_@M1225_"))); dfe->Set(0); if ((global_wpt->Flags & LANDPOINT)==LANDPOINT) { dfe->Set(2); } if ((global_wpt->Flags & AIRPORT)==AIRPORT) { dfe->Set(1); } wp->RefreshDisplay(); } }
static void SetupDeviceFields(const DeviceConfig &config, WndProperty *port_field, WndProperty *speed_field, WndProperty *driver_field, WndButton *setup_button) { #ifndef ANDROID static const TCHAR *const COMMPort[] = { _T("COM1"), _T("COM2"), _T("COM3"), _T("COM4"), _T("COM5"), _T("COM6"), _T("COM7"), _T("COM8"), _T("COM9"), _T("COM10"), _T("COM0"), NULL }; static const TCHAR *const tSpeed[] = { _T("1200"), _T("2400"), _T("4800"), _T("9600"), _T("19200"), _T("38400"), _T("57600"), _T("115200"), NULL }; #endif if (port_field != NULL) { DataFieldEnum *dfe = (DataFieldEnum *)port_field->GetDataField(); for (unsigned i = 0; port_types[i].label != NULL; i++) { dfe->addEnumText(gettext(port_types[i].label)); if (port_types[i].type == config.port_type) dfe->Set(i); } #ifdef ANDROID JNIEnv *env = Java::GetEnv(); jobjectArray bonded = BluetoothHelper::list(env); if (bonded != NULL) { jsize n = env->GetArrayLength(bonded) / 2; for (jsize i = 0; i < n; ++i) { jstring address = (jstring)env->GetObjectArrayElement(bonded, i * 2); if (address == NULL) continue; const char *address2 = env->GetStringUTFChars(address, NULL); if (address2 == NULL) continue; jstring name = (jstring)env->GetObjectArrayElement(bonded, i * 2 + 1); const char *name2 = name != NULL ? env->GetStringUTFChars(name, NULL) : NULL; dfe->addEnumText(address2, name2); env->ReleaseStringUTFChars(address, address2); if (name2 != NULL) env->ReleaseStringUTFChars(name, name2); } env->DeleteLocalRef(bonded); if (config.port_type == DeviceConfig::RFCOMM && !config.bluetooth_mac.empty()) { if (!dfe->Exists(config.bluetooth_mac)) dfe->addEnumText(config.bluetooth_mac); dfe->SetAsString(config.bluetooth_mac); } } #else dfe->addEnumTexts(COMMPort); switch (config.port_type) { case DeviceConfig::SERIAL: dfe->Set(config.port_index + num_port_types); break; case DeviceConfig::DISABLED: case DeviceConfig::RFCOMM: case DeviceConfig::AUTO: case DeviceConfig::INTERNAL: case DeviceConfig::TCP_LISTENER: break; } #endif port_field->RefreshDisplay(); } if (speed_field != NULL) { #ifdef ANDROID speed_field->hide(); #else DataFieldEnum *dfe = (DataFieldEnum *)speed_field->GetDataField(); dfe->addEnumTexts(tSpeed); dfe->Set(config.speed_index); speed_field->RefreshDisplay(); #endif } if (driver_field) { DataFieldEnum *dfe = (DataFieldEnum *)driver_field->GetDataField(); const TCHAR *DeviceName; for (unsigned i = 0; (DeviceName = devRegisterGetName(i)) != NULL; i++) dfe->addEnumText(DeviceName); dfe->Sort(1); dfe->SetAsString(config.driver_name); driver_field->RefreshDisplay(); } if (setup_button != NULL) setup_button->set_visible(config.IsVega()); UpdateDeviceControlVisibility(*port_field, *speed_field, *driver_field); }
static void SetValues(bool first=false) { WndProperty* wp; wp = (WndProperty*)wf->FindByName(_T("prpTaskFinishLine")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (first) { dfe->addEnumText(gettext(_T("Cylinder"))); dfe->addEnumText(gettext(_T("Line"))); dfe->addEnumText(gettext(_T("FAI Sector"))); } dfe->Set(settings_task.FinishType); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpTaskFinishRadius")); if (wp) { wp->GetDataField()->SetAsFloat(lround(settings_task.FinishRadius*DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING); wp->GetDataField()->SetUnits(Units::GetDistanceName()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpTaskStartLine")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (first) { dfe->addEnumText(gettext(_T("Cylinder"))); dfe->addEnumText(gettext(_T("Line"))); dfe->addEnumText(gettext(_T("FAI Sector"))); } dfe->SetDetachGUI(true); // disable call to OnAATEnabled dfe->Set(settings_task.StartType); dfe->SetDetachGUI(false); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpTaskStartRadius")); if (wp) { wp->GetDataField()->SetAsFloat(lround(settings_task.StartRadius*DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING); wp->GetDataField()->SetUnits(Units::GetDistanceName()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpTaskFAISector")); if (wp) { wp->set_visible(settings_task.AATEnabled == 0); DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (first) { dfe->addEnumText(gettext(_T("Cylinder"))); dfe->addEnumText(gettext(_T("FAI Sector"))); dfe->addEnumText(gettext(_T("DAe 0.5/10"))); } dfe->SetDetachGUI(true); // disable call to OnAATEnabled dfe->Set(settings_task.SectorType); dfe->SetDetachGUI(false); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpTaskSectorRadius")); if (wp) { wp->set_visible(settings_task.AATEnabled == 0); wp->GetDataField()->SetAsFloat(lround(settings_task.SectorRadius*DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING); wp->GetDataField()->SetUnits(Units::GetDistanceName()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpAutoAdvance")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (first) { dfe->addEnumText(gettext(_T("Manual"))); dfe->addEnumText(gettext(_T("Auto"))); dfe->addEnumText(gettext(_T("Arm"))); dfe->addEnumText(gettext(_T("Arm start"))); } dfe->Set(settings_task.AutoAdvance); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpMinTime")); if (wp) { wp->set_visible(settings_task.AATEnabled > 0); wp->GetDataField()->SetAsFloat(settings_task.AATTaskLength); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpEnableMultipleStartPoints")); if (wp) { wp->GetDataField()->Set(settings_task.EnableMultipleStartPoints); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpAATEnabled")); if (wp) { bool aw = (settings_task.AATEnabled != 0); wp->GetDataField()->Set(aw); wp->RefreshDisplay(); } WndButton* wb; wb = (WndButton *)wf->FindByName(_T("EditStartPoints")); if (wb) { wb->set_visible(settings_task.EnableMultipleStartPoints != 0); } }
void InfoBoxesConfigWidget::Prepare(ContainerWindow &parent, const PixelRect &rc) { const Layout layout(rc, geometry); AddText(_("Name"), nullptr, allow_name_change ? (const TCHAR *)data.name : gettext(data.name)); SetReadOnly(NAME, !allow_name_change); DataFieldEnum *dfe = new DataFieldEnum(this); for (unsigned i = 0; i < layout.info_boxes.count; ++i) { TCHAR label[32]; _stprintf(label, _T("%u"), i + 1); dfe->addEnumText(label, i); } Add(_("InfoBox"), nullptr, dfe); dfe = new DataFieldEnum(this); for (unsigned i = InfoBoxFactory::MIN_TYPE_VAL; i < InfoBoxFactory::NUM_TYPES; i++) { const TCHAR *name = InfoBoxFactory::GetName((InfoBoxFactory::Type) i); const TCHAR *desc = InfoBoxFactory::GetDescription((InfoBoxFactory::Type) i); if (name != NULL) dfe->addEnumText(gettext(name), i, desc != NULL ? gettext(desc) : NULL); } dfe->EnableItemHelp(true); dfe->Sort(0); Add(_("Content"), nullptr, dfe); ContainerWindow &form_parent = (ContainerWindow &)RowFormWidget::GetWindow(); AddRemaining(new WndFrame(form_parent, GetLook(), rc)); WindowStyle button_style; button_style.Hide(); button_style.TabStop(); const auto &button_look = GetLook().button; copy_button.Create(parent, button_look, _("Copy"), layout.copy_button, button_style, *this, COPY); paste_button.Create(parent, button_look, _("Paste"), layout.paste_button, button_style, *this, PASTE); close_button.Create(parent, button_look, _("Close"), layout.close_button, button_style, dialog, mrOK); WindowStyle preview_style; preview_style.EnableDoubleClicks(); preview_style.Hide(); previews.resize(layout.info_boxes.count); for (unsigned i = 0; i < layout.info_boxes.count; ++i) { previews[i].SetParent(*this, i); previews[i].Create(parent, layout.info_boxes.positions[i], preview_style); } current_preview = 0; RefreshEditContent(); RefreshPasteButton(); }
void LoadGUI() { #define MAX_ENUM 10 IsInitialized=false; int i=0; WndProperty* wp; wp = (WndProperty*)wf->FindByName(TEXT("prpFontName")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (dfe) { for (i=0 ;i < MAX_ENUM ; i++) { dfe->Dec(); } // rewind bool bFound=false; for (i=0 ;i < MAX_ENUM ; i++ ) { if (_tcsncmp(dfe->GetAsString(), NewLogFont.lfFaceName, LF_FACESIZE) == 0) { bFound=true; break; } dfe->Inc(); } if (!bFound) { dfe->addEnumText(NewLogFont.lfFaceName); for (i=0 ;i < MAX_ENUM ; i++) { dfe->Dec(); } // rewind for (i=0 ;i < MAX_ENUM ; i++ ) { if (_tcsncmp(dfe->GetAsString(), NewLogFont.lfFaceName,LF_FACESIZE) == 0) { break; } dfe->Inc(); } } } wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFontHeight")); if (wp) { DataFieldInteger * dfi; dfi = (DataFieldInteger*)wp->GetDataField(); if (dfi) { dfi->Set(NewLogFont.lfHeight); } wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFontWeight")); if (wp) { DataFieldInteger* dfi; dfi = (DataFieldInteger*)wp->GetDataField(); if (dfi) { dfi->Set(NewLogFont.lfWeight); } wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFontItalic")); if (wp) { DataFieldBoolean* dfb; dfb = (DataFieldBoolean*)wp->GetDataField(); if (dfb) { dfb->Set(NewLogFont.lfItalic); } wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpFontPitchAndFamily")); if (wp) { DataFieldEnum * dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (dfe) { dfe->SetAsInteger(NewLogFont.lfPitchAndFamily); } wp->RefreshDisplay(); } // This is useless, because we ApplyClearType later on. We always use a general common quality. ApplyClearType(&NewLogFont); IsInitialized=true; RedrawSampleFont(); }
static void FillTCPPorts(DataFieldEnum &dfe) { dfe.addEnumText(_T("4353"), 4353); dfe.addEnumText(_T("10110"), 10110); }
bool dlgConfigInfoboxesShowModal(SingleWindow &parent, const DialogLook &dialog_look, InfoBoxLayout::Geometry geometry, InfoBoxSettings::Panel &data_r, bool allow_name_change) { current_preview = 0; data = data_r; PixelRect rc = parent.get_client_rect(); wf = new WndForm(parent, dialog_look, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); #ifdef _WIN32_WCE if (is_altair()) wf->SetKeyDownNotify(OnKeyDown); #endif ContainerWindow &client_area = wf->GetClientAreaWindow(); rc = client_area.get_client_rect(); InflateRect(&rc, Layout::FastScale(-2), Layout::FastScale(-2)); info_box_layout = InfoBoxLayout::Calculate(rc, geometry); WindowStyle preview_style; preview_style.enable_double_clicks(); for (unsigned i = 0; i < info_box_layout.count; ++i) { rc = info_box_layout.positions[i]; previews[i].set(client_area, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, preview_style); } rc = info_box_layout.remaining; WindowStyle style; style.control_parent(); EditWindowStyle edit_style; edit_style.tab_stop(); if (is_embedded() || Layout::scale_1024 < 2048) /* sunken edge doesn't fit well on the tiny screen of an embedded device */ edit_style.border(); else edit_style.sunken_edge(); const int x = rc.left; const unsigned width = rc.right - rc.left - Layout::FastScale(2); const unsigned height = Layout::Scale(22); const unsigned caption_width = Layout::Scale(60); int y = rc.top; ButtonWindowStyle button_style; button_style.tab_stop(); buttonPanelName = new WndButton(client_area, dialog_look, _T(""), x, y, width, height, button_style, OnNameAccess); buttonPanelName->set_enabled(allow_name_change); UpdatePanelName(); y += height; edit_select = new WndProperty(client_area, dialog_look, _("InfoBox"), x, y, width, height, caption_width, style, edit_style, NULL); DataFieldEnum *dfe = new DataFieldEnum(OnSelectAccess); for (unsigned i = 0; i < info_box_layout.count; ++i) { TCHAR label[32]; _stprintf(label, _T("%u"), i + 1); dfe->addEnumText(label, i); } edit_select->SetDataField(dfe); y += height; edit_content = new WndProperty(client_area, dialog_look, _("Content"), x, y, width, height, caption_width, style, edit_style, NULL); dfe = new DataFieldEnum(OnContentAccess); for (unsigned i = 0; i < InfoBoxFactory::NUM_TYPES; ++i) { const TCHAR *name = InfoBoxFactory::GetName(i); if (name != NULL) dfe->addEnumText(gettext(name), i); } dfe->Sort(0); edit_content->SetDataField(dfe); edit_content->SetOnHelpCallback(OnContentHelp); RefreshEditContent(); const unsigned button_width = Layout::Scale(60); const unsigned button_height = Layout::Scale(28); const int button_y = rc.bottom - button_height; int button_x = rc.left; WndButton *close_button = new WndButton(client_area, dialog_look, _("Close"), button_x, button_y, button_width, button_height, button_style, OnCloseClicked); button_x += button_width + Layout::Scale(2); WndButton *copy_button = new WndButton(client_area, dialog_look, _("Copy"), button_x, button_y, button_width, button_height, button_style, OnCopy); button_x += button_width + Layout::Scale(2); buttonPaste = new WndButton(client_area, dialog_look, _("Paste"), button_x, button_y, button_width, button_height, button_style, OnPaste); RefreshPasteButton(); int result = wf->ShowModal(); delete wf; delete buttonPanelName; delete edit_select; delete edit_content; delete close_button; delete copy_button; delete buttonPaste; bool changed = false; if (result == mrOK) { for (unsigned i = 0; i < InfoBoxSettings::Panel::MAX_CONTENTS; ++i) if (data.contents[i] != data_r.contents[i]) changed = true; changed |= (_tcscmp(data.name, data_r.name) != 0); if (changed) data_r = data; } return changed; }
static void SetValues(bool first=false) { WndProperty* wp; wp = (WndProperty*)wf->FindByName(TEXT("prpTaskFinishLine")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (first) { // LKTOKEN _@M210_ = "Cylinder" dfe->addEnumText(gettext(TEXT("_@M210_"))); // LKTOKEN _@M393_ = "Line" dfe->addEnumText(gettext(TEXT("_@M393_"))); // LKTOKEN _@M274_ = "FAI Sector" dfe->addEnumText(gettext(TEXT("_@M274_"))); } dfe->Set(FinishLine); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTaskFinishRadius")); if (wp) { wp->GetDataField()->SetAsFloat(lround(FinishRadius*DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING); wp->GetDataField()->SetUnits(Units::GetDistanceName()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTaskStartLine")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (first) { // LKTOKEN _@M210_ = "Cylinder" dfe->addEnumText(gettext(TEXT("_@M210_"))); // LKTOKEN _@M393_ = "Line" dfe->addEnumText(gettext(TEXT("_@M393_"))); // LKTOKEN _@M274_ = "FAI Sector" dfe->addEnumText(gettext(TEXT("_@M274_"))); } dfe->SetDetachGUI(true); // disable call to OnAATEnabled dfe->Set(StartLine); dfe->SetDetachGUI(false); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTaskStartRadius")); if (wp) { wp->GetDataField()->SetAsFloat(lround(StartRadius*DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING); wp->GetDataField()->SetUnits(Units::GetDistanceName()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTaskFAISector")); if (wp) { // 110223 CAN ANYONE PLEASE CHECK WHAT THE HACK IS A BOOL FOR BILL GATES? BECAUSE IF FALSE IS -1 THEN // WE HAVE MANY PROBLEMS! I THINK IT IS TIME TO GO BACK TO bool AND GET RID OF MS BOOLS!! wp->SetVisible(AATEnabled==0); DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (first) { // LKTOKEN _@M210_ = "Cylinder" dfe->addEnumText(gettext(TEXT("_@M210_"))); // LKTOKEN _@M274_ = "FAI Sector" dfe->addEnumText(gettext(TEXT("_@M274_"))); dfe->addEnumText(gettext(TEXT("DAe 0.5/10"))); } dfe->SetDetachGUI(true); // disable call to OnAATEnabled dfe->Set(SectorType); dfe->SetDetachGUI(false); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpTaskSectorRadius")); if (wp) { wp->SetVisible(AATEnabled==0); wp->GetDataField()->SetAsFloat(lround(SectorRadius*DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING); wp->GetDataField()->SetUnits(Units::GetDistanceName()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAutoAdvance")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); if (first) { // LKTOKEN _@M418_ = "Manual" dfe->addEnumText(gettext(TEXT("_@M418_"))); // LKTOKEN _@M897_ "Auto" dfe->addEnumText(gettext(TEXT("_@M897_"))); // LKTOKEN _@M97_ = "Arm" dfe->addEnumText(gettext(TEXT("_@M97_"))); // LKTOKEN _@M96_ = "Arm start" dfe->addEnumText(gettext(TEXT("_@M96_"))); // LKTOKEN _@M1798_ = "Arm TPs" dfe->addEnumText(gettext(TEXT("_@M1798_"))); } dfe->Set(AutoAdvance); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpMinTime")); if (wp) { wp->SetVisible(AATEnabled>0 && !ISPARAGLIDER); wp->GetDataField()->SetAsFloat(AATTaskLength); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpEnableMultipleStartPoints")); if (wp) { wp->SetVisible(!ISPARAGLIDER); wp->GetDataField()->Set(EnableMultipleStartPoints); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpAATEnabled")); if (wp) { if (ISPARAGLIDER && PGOptimizeRoute) { wp->SetVisible(false); AATEnabled=true; wp->RefreshDisplay(); } else { bool aw = (AATEnabled != 0); wp->GetDataField()->Set(aw); wp->RefreshDisplay(); } } WndButton* wb; wb = (WndButton *)wf->FindByName(TEXT("EditStartPoints")); if (wb) { wb->SetVisible(EnableMultipleStartPoints!=0 && !ISPARAGLIDER); } }
static void SetValues(void) { WndProperty* wp; bool sign; int dd,mm,ss; Units::LongitudeToDMS(global_wpt->Location.Longitude, &dd, &mm, &ss, &sign); wp = (WndProperty*)wf->FindByName(_T("prpLongitudeSign")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText((_T("W"))); dfe->addEnumText((_T("E"))); dfe->Set(sign); wp->RefreshDisplay(); } LoadFormProperty(*wf, _T("prpLongitudeD"), dd); switch (Units::GetCoordinateFormat()) { case 0: // ("DDMMSS"); case 1: // ("DDMMSS.ss"); LoadFormProperty(*wf, _T("prpLongitudeM"), mm); LoadFormProperty(*wf, _T("prpLongitudeS"), ss); break; case 2: // ("DDMM.mmm"); LoadFormProperty(*wf, _T("prpLongitudeM"), mm); LoadFormProperty(*wf, _T("prpLongitudemmm"), 1000 * fixed(ss) / 60); break; case 3: // ("DD.dddd"); LoadFormProperty(*wf, _T("prpLongitudeDDDD"), 10000 * (fixed)(mm + ss) / 3600); break; } Units::LatitudeToDMS(global_wpt->Location.Latitude, &dd, &mm, &ss, &sign); LoadFormProperty(*wf, _T("prpLatitudeD"), dd); wp = (WndProperty*)wf->FindByName(_T("prpLatitudeSign")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText((_T("S"))); dfe->addEnumText((_T("N"))); dfe->Set(sign); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpLatitudeD")); if (wp) { wp->GetDataField()->SetAsInteger(dd); wp->RefreshDisplay(); } switch (Units::GetCoordinateFormat()) { case 0: // ("DDMMSS"); case 1: // ("DDMMSS.ss"); LoadFormProperty(*wf, _T("prpLatitudeM"), mm); LoadFormProperty(*wf, _T("prpLatitudeS"), ss); break; case 2: // ("DDMM.mmm"); LoadFormProperty(*wf, _T("prpLatitudeM"), mm); LoadFormProperty(*wf, _T("prpLatitudemmm"), 1000 * fixed(ss) / 60); break; case 3: // ("DD.dddd"); LoadFormProperty(*wf, _T("prpLatitudeDDDD"), 10000 * (fixed)(mm + ss) / 3600); break; } wp = (WndProperty*)wf->FindByName(_T("prpAltitude")); if (wp) { wp->GetDataField()->SetAsInteger(iround( Units::ToUserUnit(global_wpt->Altitude, Units::AltitudeUnit))); wp->GetDataField()->SetUnits(Units::GetAltitudeName()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpFlags")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T("Turnpoint")); dfe->addEnumText(_T("Airport")); dfe->addEnumText(_T("Landpoint")); if (global_wpt->Flags.Airport) { dfe->Set(1); } else if (global_wpt->Flags.LandPoint) { dfe->Set(2); } else { dfe->Set(0); } wp->RefreshDisplay(); } }