void LoadOptionalFormProperty(WndForm &form, const TCHAR *control_name, fixed value) { assert(control_name != NULL); WndProperty *ctl = (WndProperty *)form.FindByName(control_name); if (ctl == NULL) return; DataFieldFloat &df = *(DataFieldFloat *)ctl->GetDataField(); assert(df.GetType() == DataField::TYPE_REAL); df.Set(value); ctl->RefreshDisplay(); }
static void RefreshFonts() { WndProperty * wp; wp = (WndProperty*)wf->FindByName(_T("prpUseCustomFonts")); if (wp) { bool bUseCustomFonts = ((DataFieldBoolean*)(wp->GetDataField()))->GetAsBoolean(); ResetFonts(bUseCustomFonts); ShowFontEditButtons(bUseCustomFonts); } // now set SampleTexts on the Fonts frame WndFrame *sample; sample = (WndFrame *)wf->FindByName(_T("prpInfoWindowFont")); if (sample) sample->SetFont(TempInfoWindowFont); sample = (WndFrame *)wf->FindByName(_T("prpTitleWindowFont")); if (sample) sample->SetFont(TempTitleWindowFont); sample = (WndFrame *)wf->FindByName(_T("prpMapWindowFont")); if (sample) sample->SetFont(TempMapWindowFont); sample = (WndFrame *)wf->FindByName(_T("prpTitleSmallWindowFont")); if (sample) sample->SetFont(TempTitleSmallWindowFont); sample = (WndFrame *)wf->FindByName(_T("prpMapWindowBoldFont")); if (sample) sample->SetFont(TempMapWindowBoldFont); sample = (WndFrame *)wf->FindByName(_T("prpCDIWindowFont")); if (sample) sample->SetFont(TempCDIWindowFont); sample = (WndFrame *)wf->FindByName(_T("prpMapLabelFont")); if (sample) sample->SetFont(TempMapLabelFont); sample = (WndFrame *)wf->FindByName(_T("prpMapLabelImportantFont")); if (sample) sample->SetFont(TempMapLabelImportantFont); }
void TaskRulesConfigPanel::Init(WndForm *_wf) { assert(_wf != NULL); wf = _wf; WndProperty *wp; const SETTINGS_COMPUTER &settings_computer = XCSoarInterface::SettingsComputer(); LoadFormProperty(*wf, _T("prpStartMaxSpeed"), ugHorizontalSpeed, settings_computer.ordered_defaults.start_max_speed); LoadFormProperty(*wf, _T("prpStartMaxSpeedMargin"), ugHorizontalSpeed, settings_computer.start_max_speed_margin); LoadFormProperty(*wf, _T("prpStartMaxHeight"), ugAltitude, settings_computer.ordered_defaults.start_max_height); LoadFormProperty(*wf, _T("prpStartMaxHeightMargin"), ugAltitude, settings_computer.start_max_height_margin); wp = (WndProperty*)wf->FindByName(_T("prpStartHeightRef")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("AGL")); dfe->addEnumText(_("MSL")); dfe->Set(settings_computer.ordered_defaults.start_max_height_ref); wp->RefreshDisplay(); } LoadFormProperty(*wf, _T("prpFinishMinHeight"), ugAltitude, settings_computer.ordered_defaults.finish_min_height); wp = (WndProperty*)wf->FindByName(_T("prpContests")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(ContestToString(OLC_FAI), OLC_FAI); dfe->addEnumText(ContestToString(OLC_Classic), OLC_Classic); dfe->addEnumText(ContestToString(OLC_League), OLC_League); dfe->addEnumText(ContestToString(OLC_Plus), OLC_Plus); dfe->addEnumText(ContestToString(OLC_XContest), OLC_XContest); dfe->addEnumText(ContestToString(OLC_DHVXC), OLC_DHVXC); dfe->addEnumText(ContestToString(OLC_SISAT), OLC_SISAT); dfe->Set(settings_computer.contest); wp->RefreshDisplay(); } }
bool dlgStartupShowModal() { LogStartUp(_T("Startup dialog")); logo = new LogoView(); wf = LoadDialog(CallBackTable, XCSoarInterface::main_window, Layout::landscape ? _T("IDR_XML_STARTUP_L") : _T("IDR_XML_STARTUP")); assert(wf != NULL); WndProperty* wp = ((WndProperty *)wf->FindByName(_T("prpProfile"))); assert(wp != NULL); DataFieldFileReader* dfe = (DataFieldFileReader*)wp->GetDataField(); assert(dfe != NULL); ((WndButton *)wf->FindByName(_T("cmdClose"))) ->SetOnClickNotify(OnCloseClicked); ((WndButton *)wf->FindByName(_T("cmdQuit")))->SetOnClickNotify(OnQuit); dfe->SetNotNullable(); dfe->ScanDirectoryTop(_T("*.prf")); dfe->Lookup(Profile::GetPath()); wp->RefreshDisplay(); if (dfe->GetNumFiles() <= 1) { SelectProfile(dfe->GetPathFile()); delete wf; delete logo; return true; } if (wf->ShowModal() != mrOK) { delete wf; delete logo; return false; } SelectProfile(dfe->GetPathFile()); delete wf; delete logo; return true; }
bool dlgStartupShowModal() { LogStartUp(_T("Startup dialog")); wf = LoadDialog(CallBackTable, XCSoarInterface::main_window, Layout::landscape ? _T("IDR_XML_STARTUP_L") : _T("IDR_XML_STARTUP")); assert(wf != NULL); WndProperty* wp = ((WndProperty *)wf->FindByName(_T("prpProfile"))); assert(wp != NULL); DataFieldFileReader* dfe = (DataFieldFileReader*)wp->GetDataField(); assert(dfe != NULL); ((WndButton *)wf->FindByName(_T("cmdClose"))) ->SetOnClickNotify(OnCloseClicked); ((WndButton *)wf->FindByName(_T("cmdQuit")))->SetOnClickNotify(OnQuit); dfe->ScanDirectoryTop(is_altair() ? _T("config/*.prf") : _T("*.prf")); dfe->Lookup(startProfileFile); wp->RefreshDisplay(); if (dfe->GetNumFiles() <= 2) { delete wf; return true; } if (wf->ShowModal() != mrOK) { delete wf; return false; } const TCHAR *path = dfe->GetPathFile(); if (!string_is_empty(path)) { _tcscpy(startProfileFile, path); /* When a profile from a secondary data path is used, this path becomes the primary data path */ TCHAR temp[MAX_PATH]; SetPrimaryDataPath(DirName(path, temp)); } delete wf; return true; }
gcc_pure static unsigned GetMinimumHeight(const WndProperty &control, const DialogLook &look, bool vertical) { const unsigned padding = Layout::GetTextPadding(); unsigned height = look.text_font.GetHeight(); if (vertical && control.HasCaption()) height *= 2; height += padding * 2; if (!control.IsReadOnly() && height < Layout::GetMinimumControlHeight()) height = Layout::GetMinimumControlHeight(); return height; }
WndProperty * RowFormWidget::AddFloat(const TCHAR *label, const TCHAR *help, const TCHAR *display_format, const TCHAR *edit_format, double min_value, double max_value, double step, bool fine, double value, DataFieldListener *listener) { WndProperty *edit = Add(label, help); DataFieldFloat *df = new DataFieldFloat(edit_format, display_format, min_value, max_value, value, step, fine, listener); edit->SetDataField(df); return edit; }
void LoadFormProperty(SubForm &form, const TCHAR *control_name, const TCHAR *value) { assert(control_name != NULL); assert(value != NULL); WndProperty *ctl = (WndProperty *)form.FindByName(control_name); assert(ctl != NULL); DataFieldString &df = *(DataFieldString *)ctl->GetDataField(); assert(df.GetType() == DataField::Type::STRING); df.Set(value); ctl->RefreshDisplay(); }
/** * @return true if the value has changed */ static bool FinishPortField(DeviceConfig &config, WndProperty &port_field) { const DataFieldEnum &df = *(const DataFieldEnum *)port_field.GetDataField(); unsigned value = df.GetAsInteger(); if (value + 1 <= num_port_types) { if (port_types[value].type == config.port_type) return false; config.port_type = port_types[value].type; return true; } else { value -= num_port_types; #ifdef ANDROID if (config.port_type == DeviceConfig::RFCOMM && _tcscmp(config.bluetooth_mac, df.GetAsString()) == 0) return false; #else if (config.port_type == DeviceConfig::SERIAL && value == config.port_index) return false; #endif #ifdef ANDROID config.port_type = DeviceConfig::RFCOMM; config.bluetooth_mac = df.GetAsString(); #else config.port_type = DeviceConfig::SERIAL; config.port_index = value; #endif return true; } }
void LoadFormProperty(WndForm &form, const TCHAR *control_name, UnitGroup_t unit_group, int value) { assert(control_name != NULL); WndProperty *ctl = (WndProperty *)form.FindByName(control_name); if (ctl == NULL) return; Units_t unit = Units::GetUserUnitByGroup(unit_group); DataField *df = ctl->GetDataField(); df->SetUnits(Units::GetUnitName(unit)); df->SetAsInteger(iround(Units::ToUserUnit(fixed(value), unit))); ctl->RefreshDisplay(); }
WndProperty * RowFormWidget::AddFloat(const TCHAR *label, const TCHAR *help, const TCHAR *display_format, const TCHAR *edit_format, fixed min_value, fixed max_value, fixed step, bool fine, fixed value, DataField::DataAccessCallback callback) { WndProperty *edit = Add(label, help); DataFieldFloat *df = new DataFieldFloat(edit_format, display_format, min_value, max_value, value, step, fine, callback); edit->SetDataField(df); return edit; }
static void setVariables(void) { WndProperty *wp; wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap1")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(MsgToken(239)); // Disabled dfe->addEnumText(MsgToken(259)); // Enabled dfe->Set(Multimap1); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap2")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(MsgToken(239)); // Disabled dfe->addEnumText(MsgToken(259)); // Enabled dfe->Set(Multimap2); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap3")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(MsgToken(239)); // Disabled dfe->addEnumText(MsgToken(259)); // Enabled dfe->Set(Multimap3); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap4")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(MsgToken(239)); // Disabled dfe->addEnumText(MsgToken(259)); // Enabled dfe->Set(Multimap4); wp->RefreshDisplay(); } }
void SiteConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { WndProperty *wp = Add(_T(""), 0, true); wp->SetText(GetPrimaryDataPath().c_str()); wp->SetEnabled(false); AddFile(_("Map database"), _("The name of the file (.xcm) containing terrain, topography, and optionally " "waypoints, their details and airspaces."), ProfileKeys::MapFile, _T("*.xcm\0*.lkm\0"), FileType::MAP); AddFile(_("Waypoints"), _("Primary waypoints file. Supported file types are Cambridge/WinPilot files (.dat), " "Zander files (.wpz) or SeeYou files (.cup)."), ProfileKeys::WaypointFile, WAYPOINT_FILE_PATTERNS, FileType::WAYPOINT); AddFile(_("More waypoints"), _("Secondary waypoints file. This may be used to add waypoints for a competition."), ProfileKeys::AdditionalWaypointFile, WAYPOINT_FILE_PATTERNS, FileType::WAYPOINT); SetExpertRow(AdditionalWaypointFile); AddFile(_("Watched waypoints"), _("Waypoint file containing special waypoints for which additional computations like " "calculation of arrival height in map display always takes place. Useful for " "waypoints like known reliable thermal sources (e.g. powerplants) or mountain passes."), ProfileKeys::WatchedWaypointFile, WAYPOINT_FILE_PATTERNS, FileType::WAYPOINT); SetExpertRow(WatchedWaypointFile); AddFile(_("Airspaces"), _("The file name of the primary airspace file."), ProfileKeys::AirspaceFile, _T("*.txt\0*.air\0*.sua\0"), FileType::AIRSPACE); AddFile(_("More airspaces"), _("The file name of the secondary airspace file."), ProfileKeys::AdditionalAirspaceFile, _T("*.txt\0*.air\0*.sua\0"), FileType::AIRSPACE); SetExpertRow(AdditionalAirspaceFile); AddFile(_("Waypoint details"), _("The file may contain extracts from enroute supplements or other contributed " "information about individual waypoints and airfields."), ProfileKeys::AirfieldFile, _T("*.txt\0")); SetExpertRow(AirfieldFile); }
void LoadFormProperty(SubForm &form, const TCHAR *control_name, UnitGroup unit_group, fixed value) { assert(control_name != NULL); WndProperty *ctl = (WndProperty *)form.FindByName(control_name); assert(ctl != nullptr); Unit unit = Units::GetUserUnitByGroup(unit_group); DataFieldFloat &df = *(DataFieldFloat *)ctl->GetDataField(); assert(df.GetType() == DataField::Type::REAL); df.SetUnits(Units::GetUnitName(unit)); df.Set(Units::ToUserUnit(value, unit)); ctl->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(); } } }
void LoadOptionalFormProperty(WndForm &form, const TCHAR *control_name, UnitGroup_t unit_group, fixed value) { assert(control_name != NULL); WndProperty *ctl = (WndProperty *)form.FindByName(control_name); if (ctl == NULL) return; Units_t unit = Units::GetUserUnitByGroup(unit_group); DataFieldFloat &df = *(DataFieldFloat *)ctl->GetDataField(); assert(df.GetType() == DataField::TYPE_REAL); df.SetUnits(Units::GetUnitName(unit)); df.SetAsInteger(iround(Units::ToUserUnit(fixed(value), unit))); ctl->RefreshDisplay(); }
void PagesConfigPanel::Init(WndForm *_wf) { assert(_wf != NULL); wf = _wf; TCHAR prpName[64]; for (unsigned i = 0; i < MAX_PAGES; i++) { _stprintf(prpName, _T("prpPageLayout%u"), i); WndProperty* wp = (WndProperty*)wf->FindByName(prpName); if (wp) { DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField(); UpdateComboBox(dfe, i); wp->RefreshDisplay(); } } }
static void SetBallast(void) { WndProperty* wp; wp = (WndProperty*)wf->FindByName(_T("prpBallast")); if (wp) { if (glide_polar.IsBallastable()) { DataFieldFloat &df = *(DataFieldFloat *)wp->GetDataField(); df.SetAsFloat(glide_polar.GetBallastLitres()); } else wp->hide(); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpWingLoading")); if (wp) { const fixed wl = glide_polar.GetWingLoading(); if (wl > fixed_zero) { DataFieldFloat &df = *(DataFieldFloat *)wp->GetDataField(); df.SetAsFloat(wl); } else wp->hide(); wp->RefreshDisplay(); } }
bool InfoBoxContentWind::PnlEditOnTabPreShow(TabBarControl::EventType EventType) { const NMEAInfo &basic = XCSoarInterface::Basic(); const SETTINGS_COMPUTER &settings_computer = XCSoarInterface::SettingsComputer(); const bool external_wind = basic.external_wind_available && settings_computer.ExternalWind; WndProperty* wp; wp = (WndProperty*)dlgInfoBoxAccess::GetWindowForm()->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*)dlgInfoBoxAccess::GetWindowForm()->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(); } return true; }
// // We cannot use setVariables from here, otherwise we would be adding more // enum text to the selection list, each time we reset. // We simply set the value, because the enum text list is already set. // static void OnResetClicked(WindowControl * Sender){ WndProperty *wp; extern void Reset_Multimap_Mode(void); Reset_Multimap_Mode(); wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap1")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->Set(Multimap1); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap2")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->Set(Multimap2); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpMultimap3")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->Set(Multimap3); wp->RefreshDisplay(); } }
static void SetBallast(bool updateDevices) { WndProperty* wp; GlidePolar::SetBallast(); if (updateDevices) { devPutBallast(devA(), BALLAST); devPutBallast(devB(), BALLAST); } wp = (WndProperty*)wf->FindByName(TEXT("prpBallastPercent")); if (wp) { wp->GetDataField()->Set(BALLAST*100); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpBallastLitres")); if (wp) { wp->GetDataField()-> SetAsFloat(GlidePolar::BallastLitres); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(TEXT("prpWingLoading")); if (wp) { wp->GetDataField()-> SetAsFloat(GlidePolar::WingLoading); wp->RefreshDisplay(); } // SetFocus( ((WndButton *)wf->FindByName(TEXT("buttonClose")))->GetHandle()); // not needed }
void ConfigPanel::InitFileField(WndProperty &wp, const TCHAR *profile_key, const TCHAR *filters) { DataFieldFileReader &df = *(DataFieldFileReader *)wp.GetDataField(); size_t length; while ((length = _tcslen(filters)) > 0) { df.ScanDirectoryTop(filters); filters += length + 1; } TCHAR path[MAX_PATH]; if (Profile::GetPath(profile_key, path)) df.Lookup(path); wp.RefreshDisplay(); }
void dlgTeamCodeShowModal(void) { WndProperty* wp = NULL; WndButton *buttonCode = NULL; wf = NULL; if (InfoBoxLayout::landscape) { wf = dlgLoadFromXML(CallBackTable, TEXT("dlgTeamCode_L.xml"), XCSoarInterface::main_window, TEXT("IDR_XML_TEAMCODE_L")); if (!wf) return; } else { wf = dlgLoadFromXML(CallBackTable, TEXT("dlgTeamCode.xml"), XCSoarInterface::main_window, TEXT("IDR_XML_TEAMCODE")); if (!wf) return; } // set event for button buttonCode = ((WndButton *)wf->FindByName(TEXT("cmdSetCode"))); if (buttonCode) { buttonCode->SetOnClickNotify(OnCodeClicked); } // Set unit for range wp = (WndProperty*)wf->FindByName(TEXT("prpRange")); if (wp) { wp->GetDataField()->SetUnits(Units::GetDistanceName()); } Update(); wf->SetTimerNotify(OnTimerNotify); wf->ShowModal(); delete wf; }
void dlgWeatherShowModal() { wf = LoadDialog(CallBackTable, UIGlobals::GetMainWindow(), _T("IDR_XML_WEATHER")); if (wf == NULL) return; WndProperty* wp; wp = (WndProperty*)wf->FindByName(_T("prpTime")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_T("Now")); for (unsigned i = 1; i < RasterWeather::MAX_WEATHER_TIMES; i++) { if (RASP.isWeatherAvailable(i)) { TCHAR timetext[10]; _stprintf(timetext, _T("%04d"), RASP.IndexToTime(i)); dfe->addEnumText(timetext, i); } } dfe->Set(RASP.GetTime()); wp->RefreshDisplay(); } wp = (WndProperty*)wf->FindByName(_T("prpDisplayItem")); DataFieldEnum* dfe; if (wp) { dfe = (DataFieldEnum*)wp->GetDataField(); dfe->addEnumText(_("Terrain")); for (int i = 1; i <= 15; i++) { const TCHAR *label = RASP.ItemLabel(i); if (label != NULL) dfe->addEnumText(label, i); } dfe->Set(RASP.GetParameter()); wp->RefreshDisplay(); } wf->ShowModal(); wp = (WndProperty*)wf->FindByName(_T("prpTime")); if (wp) { DataFieldEnum* dfe; dfe = (DataFieldEnum*)wp->GetDataField(); RASP.SetTime(dfe->GetAsInteger()); } wp = (WndProperty*)wf->FindByName(_T("prpDisplayItem")); if (wp) RASP.SetParameter(wp->GetDataField()->GetAsInteger()); delete wf; }
void TrackingConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { const TrackingSettings &settings = CommonInterface::GetComputerSettings().tracking; RowFormWidget::Prepare(parent, rc); AddBoolean(_T("SkyLines"), NULL, settings.skylines.enabled, this); AddTime(_("Tracking Interval"), NULL, 5, 1200, 5, settings.skylines.interval); #ifdef HAVE_SKYLINES_TRACKING_HANDLER AddBoolean(_("Track friends"), _("Download the position of your friends live from the SkyLines server."), settings.skylines.traffic_enabled, this); #endif StaticString<64> buffer; if (settings.skylines.key != 0) buffer.UnsafeFormat(_T("%llX"), (unsigned long long)settings.skylines.key); else buffer.clear(); AddText(_T("Key"), NULL, buffer); AddSpacer(); AddBoolean(_T("LiveTrack24"), _T(""), settings.livetrack24.enabled, this); AddTime(_("Tracking Interval"), _T(""), 5, 3600, 5, settings.interval); AddEnum(_("Vehicle Type"), _("Type of vehicle used."), vehicle_type_list, (unsigned) settings.vehicleType); WndProperty *edit = AddEnum(_("Server"), _T(""), server_list, 0); ((DataFieldEnum *)edit->GetDataField())->Set(settings.livetrack24.server); edit->RefreshDisplay(); AddText(_("Username"), _T(""), settings.livetrack24.username); AddPassword(_("Password"), _T(""), settings.livetrack24.password); SetSkyLinesEnabled(settings.skylines.enabled); SetEnabled(settings.livetrack24.enabled); }
WndProperty * RowFormWidget::AddEnum(const TCHAR *label, const TCHAR *help, const StaticEnumChoice *list, unsigned value, DataField::DataAccessCallback callback) { assert(list != NULL); WndProperty *edit = Add(label, help); DataFieldEnum *df = new DataFieldEnum(callback); if (list[0].help != NULL) df->EnableItemHelp(true); df->AddChoices(list); df->Set(value); edit->SetDataField(df); return edit; }
WndProperty * RowFormWidget::AddFloat(const TCHAR *label, const TCHAR *help, const TCHAR *display_format, const TCHAR *edit_format, fixed min_value, fixed max_value, fixed step, bool fine, UnitGroup unit_group, fixed value, DataField::DataAccessCallback callback) { WndProperty *edit = Add(label, help); const Unit unit = Units::GetUserUnitByGroup(unit_group); value = Units::ToUserUnit(value, unit); DataFieldFloat *df = new DataFieldFloat(edit_format, display_format, min_value, max_value, value, step, fine, callback); df->SetUnits(Units::GetUnitName(unit)); edit->SetDataField(df); return edit; }
static void OnWeatherHelp(WindowControl * Sender) { WndProperty *wp = (WndProperty*)Sender; int type = wp->GetDataField()->GetAsInteger(); TCHAR caption[256]; _tcscpy(caption, _("Weather parameters")); const TCHAR *label = RASP.ItemLabel(type); if (label != NULL) { _tcscat(caption, _T(": ")); _tcscat(caption, label); } const TCHAR *help = RASP.ItemHelp(type); if (help == NULL) help = _("No help available on this item"); dlgHelpShowModal(UIGlobals::GetMainWindow(), caption, help); }
void Visit(const SectorZone& oz) { hide_all(); WndFrame* wp = ((WndFrame *)wf->FindByName(_T("frmOZSector"))); if (wp) wp->show(); LoadFormProperty(*wf, _T("prpOZSectorRadius"), ugDistance, oz.getRadius()); LoadFormProperty(*wf, _T("prpOZSectorStartRadial"), oz.getStartRadial().value_degrees()); LoadFormProperty(*wf, _T("prpOZSectorFinishRadial"), oz.getEndRadial().value_degrees()); WndProperty* wap = (WndProperty*)wf->FindByName(_T("prpOZSectorInnerRadius")); if (wap) { wap->hide(); } }
void RASPSettingsPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { const WeatherUIState &state = CommonInterface::GetUIState().weather; time = state.time; WndProperty *wp; wp = AddEnum(_("Field"), nullptr, this); wp->GetDataField()->EnableItemHelp(true); FillItemControl(); wp->RefreshDisplay(); AddEnum(_("Time"), nullptr, this); UpdateTimeControl(); AddButton(_("Download"), *this, DOWNLOAD); }