void PlaneEditWidget::Prepare(ContainerWindow &parent, const PixelRect &rc) { AddText(_("Registration"), nullptr, plane.registration, this); AddText(_("Comp. ID"), nullptr, plane.competition_id); AddButton(_("Polar"), *this, POLAR); AddText(_("Type"), nullptr, plane.type); AddInteger(_("Handicap"), nullptr, _T("%u %%"), _T("%u"), 50, 150, 1, plane.handicap); AddFloat(_("Wing Area"), nullptr, _T("%.1f m²"), _T("%.1f"), fixed(0), fixed(40), fixed(0.1), false, plane.wing_area); AddFloat(_("Max. Ballast"), nullptr, _T("%.0f l"), _T("%.0f"), fixed(0), fixed(500), fixed(5), false, plane.max_ballast); AddInteger(_("Dump Time"), nullptr, _T("%u s"), _T("%u"), 10, 300, 5, plane.dump_time); AddFloat(_("Max. Cruise Speed"), nullptr, _T("%.0f %s"), _T("%.0f"), fixed(0), fixed(300), fixed(5), false, UnitGroup::HORIZONTAL_SPEED, plane.max_speed); UpdateCaption(); UpdatePolarButton(); }
void FLARMConfigWidget::Prepare(ContainerWindow &parent, const PixelRect &rc) { RequestAllSettings(device); baud = GetUnsignedValue(device, "BAUD", 2); priv = GetUnsignedValue(device, "PRIV", 0); thre = GetUnsignedValue(device, "THRE", 2); range = GetUnsignedValue(device, "RANGE", 3000); acft = GetUnsignedValue(device, "ACFT", 0); log_int = GetUnsignedValue(device, "LOGINT", 2); notrack = GetUnsignedValue(device, "NOTRACK", 0); static constexpr StaticEnumChoice baud_list[] = { { 0, _T("4800"), NULL }, { 1, _T("9600"), NULL }, { 2, _T("19200"), NULL }, { 4, _T("38400"), NULL }, { 5, _T("57600"), NULL }, { 0 } }; AddEnum(_("Baud rate"), NULL, baud_list, baud); AddBoolean(_("Stealth mode"), NULL, priv == 1); AddInteger(_("Threshold"), NULL, _T("%d m/s"), _T("%d"), 1, 10, 1, thre); AddInteger(_("Range"), NULL, _T("%d m"), _T("%d"), 2000, 25500, 250, range); static constexpr StaticEnumChoice acft_list[] = { { (unsigned)FlarmTraffic::AircraftType::UNKNOWN, N_("Unkown") }, { (unsigned)FlarmTraffic::AircraftType::GLIDER, N_("Glider") }, { (unsigned)FlarmTraffic::AircraftType::TOW_PLANE, N_("Tow plane") }, { (unsigned)FlarmTraffic::AircraftType::HELICOPTER, N_("Helicopter") }, { (unsigned)FlarmTraffic::AircraftType::PARACHUTE, N_("Parachute") }, { (unsigned)FlarmTraffic::AircraftType::DROP_PLANE, N_("Drop plane") }, { (unsigned)FlarmTraffic::AircraftType::HANG_GLIDER, N_("Hang glider") }, { (unsigned)FlarmTraffic::AircraftType::PARA_GLIDER, N_("Paraglider") }, { (unsigned)FlarmTraffic::AircraftType::POWERED_AIRCRAFT, N_("Powered aircraft") }, { (unsigned)FlarmTraffic::AircraftType::JET_AIRCRAFT, N_("Jet aircraft") }, { (unsigned)FlarmTraffic::AircraftType::FLYING_SAUCER, N_("Flying saucer") }, { (unsigned)FlarmTraffic::AircraftType::BALLOON, N_("Balloon") }, { (unsigned)FlarmTraffic::AircraftType::AIRSHIP, N_("Airship") }, { (unsigned)FlarmTraffic::AircraftType::UAV, N_("Unmanned aerial vehicle") }, { (unsigned)FlarmTraffic::AircraftType::STATIC_OBJECT, N_("Static object") }, { 0 } }; AddEnum(_("Type"), NULL, acft_list, acft); AddInteger(_("Logger interval"), NULL, _T("%d s"), _T("%d"), 1, 8, 1, log_int); AddBoolean(_("No tracking mode"), NULL, notrack == 1); }
void FontEditWidget::Prepare(ContainerWindow &parent, const PixelRect &rc) { RowFormWidget::Prepare(parent, rc); #ifdef USE_GDI WndProperty *wp = AddEnum(_("Font face"), NULL, this); { DataFieldEnum &df = *(DataFieldEnum *)wp->GetDataField(); df.addEnumText(_T("Tahoma")); df.addEnumText(_T("TahomaBD")); df.addEnumText(_T("DejaVu Sans Condensed")); } #else /* we cannot obtain a list of fonts on SDL/OpenGL currently */ #endif AddInteger(_("Height"), NULL, _T("%d"), _T("%d"), 1, 200, 1, 0, this); AddBoolean(_("Bold"), NULL, false, this); AddBoolean(_("Italic"), NULL, false, this); PixelRect preview_rc { 0, 0, Layout::Scale(250), Layout::Scale(100) }; LargeTextWindowStyle preview_style; preview_style.Border(); LargeTextWindow *preview = new LargeTextWindow(); preview->Create((ContainerWindow &)GetWindow(), preview_rc, preview_style); Add(preview); Load(); }
void GeneratorTest() { char* string; JsonObject* root = CreateJsonObject(); JsonObject* element = CreateJsonObject(); JsonArray* array = CreateJsonArray(); AddInteger(array, 0); AddReal(array, 0.0); AddBoolean(array, FALSE); AddObject(array, element); AddString(array, "element"); AddNull(array); PutNull(root, "0"); PutInteger(root, "Year", 1970); PutInteger(root, "Month", 3); PutInteger(root, "Date", 18); PutArray(root, "Array", array); PutBoolean(root, "Proposition", TRUE); PutString(root, "Text", "Hello World"); PutReal(root, "Pi", 3.14159265358979323846264338327950288419716939937510582097494459230781640); string = ToString(root); printf("%s", string); printf("\r\n"); EXPECT_EQUAL_STRING("{\"0\":null,\"Year\":1970,\"Month\":3,\"Date\":18,\"Array\":[0,0.000000,false,{},\"element\",null],\"Proposition\":true,\"Text\":\"Hello World\",\"Pi\":3.141593}", string); free(string); ClearJsonObject(root); ClearJsonArray(array); string = ToString(root); EXPECT_EQUAL_STRING("{}", string); free(string); }
void AnnotWriter::DoFreeText(FreeTextAnnot* a){ GString appearance; char buf[250]; PDFFont* font; GfxRGB* color; // build appearance string font = a->GetFont(); color = a->GetFontColor(); appearance.clear(); // color sprintf(buf, "[%g %g %g] rg ", colToDbl(color->r), colToDbl(color->g), colToDbl(color->b)); appearance.append(buf); // font and size sprintf(buf, "/%s %g Tf", font->GetShortName(), a->GetFontSize()); appearance.append(buf); a->SetAppearance(&appearance); DoStyledAnnot(a); AddAnnotSubtype("FreeText"); AddAnnotContents(a); AddString(&mAnnot, "DA", a->GetAppearance()); if (a->GetJustification() != left_justify) { AddInteger(&mAnnot, "Q", a->GetJustification()); } WriteFont(a->GetFont()); }
void NanoConfigWidget::Prepare(ContainerWindow &parent, const PixelRect &rc) { RequestAllSettings(device); static constexpr StaticEnumChoice baud_list[] = { { 2400, _T("2400"), NULL }, { 4800, _T("4800"), NULL }, { 9600, _T("9600"), NULL }, { 19200, _T("19200"), NULL }, { 38400, _T("38400"), NULL }, { 57600, _T("57600"), NULL }, { 115200, _T("115200"), NULL }, { 0 } }; AddEnum(_("Baud rate"), NULL, baud_list, WaitUnsignedValue(device, "BAUDRATE", 115200)); AddBoolean(_("Auto off"), NULL, WaitBoolValue(device, "AUTOOFF", false)); AddBoolean(_("Auto finish flight"), NULL, WaitBoolValue(device, "OFFFIN", true)); AddBoolean(_("Always run"), NULL, WaitBoolValue(device, "ALWRUN", false)); AddBoolean(_("Enable NMEA"), NULL, WaitBoolValue(device, "NMEA", true)); AddInteger(_("Recording interval"), NULL, _T("%d s"), _T("%d"), 1, 60, 1, WaitUnsignedValue(device, "RECINT", 1)); }
void AnnotWriter::DoAnnotation(Annotation* a) { AddRect(&mAnnot, "Rect", a->GetRect()); if (a->HasColor()) { AddColor(&mAnnot, "C", a->GetColor()); } if (a->GetDate()[0] != 0) { AddString(&mAnnot, "M", (char*)a->GetDate()); } AddInteger(&mAnnot, "F", a->GetFlags()->Flags()); if (a->GetTitle() != NULL) { AddString(&mAnnot, "T", a->GetTitle()); } if (a->GetOpacity() != 1.0) { AddReal(&mAnnot, "CA", a->GetOpacity()); } PopupAnnot* popup = a->GetPopup(); if (popup != NULL) { popup->SetParentRef(a->GetRef()); if (is_empty_ref(popup->GetRef())) { popup->SetRef(mXRefTable.GetNewRef(xrefEntryUncompressed)); } AddRef(&mAnnot, "Popup", popup->GetRef()); } if (HasAppearanceStream(a)) { mASRef = mXRefTable.GetNewRef(xrefEntryUncompressed); Object ap; ap.initDict(mXRef); AddRef(&ap, "N", mASRef); AddDict(&mAnnot, "AP", &ap); } if (dynamic_cast<PopupAnnot*>(a) == NULL) { AddRef(&mAnnot, "P", mPageRef); } }
void VegaParametersWidget::AddParameter(const StaticParameter &p) { assert(p.label != NULL); const TCHAR *label = gettext(p.label); const TCHAR *help = p.help != NULL ? gettext(p.help) : NULL; switch (p.type) { case DataField::Type::BOOLEAN: assert(p.choices == NULL); assert(p.format == NULL); AddBoolean(p.name, label, help); break; case DataField::Type::INTEGER: assert(p.choices == NULL); assert(p.format != NULL); AddInteger(p.name, label, help, p.min_value, p.max_value, p.format); break; case DataField::Type::ENUM: assert(p.choices != NULL); assert(p.format == NULL); AddEnum(p.name, label, help, p.choices); break; default: gcc_unreachable(); assert(false); } }
void AnimaMappedValues::SetInteger(const AnimaString& propertyName, AInt value) { AnimaString pName = _uniqueName + propertyName; if (_integersMap.find(pName) == _integersMap.end()) AddInteger(propertyName, value); else _integersMap[pName] = value; }
void AudioConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { RowFormWidget::Prepare(parent, rc); const auto &settings = CommonInterface::GetUISettings().sound; AddInteger(_("Master Volume"), nullptr, _T("%d %%"), _T("%d"), 0, VolumeController::GetMaxValue(), 1, settings.master_volume); }
WndProperty *AddInteger(const TCHAR *label, const TCHAR *help, const TCHAR *display_format, const TCHAR *edit_format, int min_value, int max_value, int step, int value, DataFieldListener *listener) { WndProperty *control = AddInteger(label, help, display_format, edit_format, min_value, max_value, step, value); control->GetDataField()->SetListener(listener); return control; }
void AudioVarioConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { RowFormWidget::Prepare(parent, rc); if (!AudioVarioGlue::HaveAudioVario()) return; const auto &settings = CommonInterface::GetUISettings().sound.vario; AddBoolean(_("Audio vario"), _("Emulate the sound of an electronic vario."), settings.enabled); AddInteger(_("Volume"), NULL, _T("%u %%"), _T("%u"), 0, 100, 1, settings.volume); AddBoolean(_("Enable Deadband"), _("Mute the audio output in when the current lift is in a certain " "range around zero"), settings.dead_band_enabled); AddSpacer(); SetExpertRow(SPACER); AddInteger(_("Min. Frequency"), _("The tone frequency that is played at maximum sink rate."), _T("%u Hz"), _T("%u"), 50, 3000, 50, settings.min_frequency); SetExpertRow(MIN_FREQUENCY); AddInteger(_("Zero Frequency"), _("The tone frequency that is played at zero climb rate."), _T("%u Hz"), _T("%u"), 50, 3000, 50, settings.zero_frequency); SetExpertRow(ZERO_FREQUENCY); AddInteger(_("Max. Frequency"), _("The tone frequency that is played at maximum climb rate."), _T("%u Hz"), _T("%u"), 50, 3000, 50, settings.max_frequency); SetExpertRow(MAX_FREQUENCY); }
void MapDisplayConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { RowFormWidget::Prepare(parent, rc); const MapSettings &settings_map = CommonInterface::GetMapSettings(); const PageSettings &page_settings = CommonInterface::GetUISettings().pages; AddEnum(_("Cruise orientation"), _("Determines how the screen is rotated with the glider"), orientation_list, (unsigned)settings_map.cruise_orientation, this); AddEnum(_("Circling orientation"), _("Determines how the screen is rotated with the glider while circling"), orientation_list, (unsigned)settings_map.circling_orientation, this); AddBoolean(_("Circling zoom"), _("If enabled, then the map will zoom in automatically when entering circling mode and zoom out automatically when leaving circling mode."), settings_map.circle_zoom_enabled); AddEnum(_("Map shift reference"), _("Determines what is used to shift the glider from the map center"), shift_bias_list, (unsigned)settings_map.map_shift_bias, this); SetExpertRow(MAP_SHIFT_BIAS); AddInteger(_("Glider position offset"), _("Defines the location of the glider drawn on the screen in percent from the screen edge."), _T("%d %%"), _T("%d"), 10, 50, 5, settings_map.glider_screen_position); SetExpertRow(GliderScreenPosition); AddFloat(_("Max. auto zoom distance"), _("The upper limit for auto zoom distance."), _T("%.0f %s"), _T("%.0f"), fixed(20), fixed(250), fixed(10), false, UnitGroup::DISTANCE, settings_map.max_auto_zoom_distance); SetExpertRow(MaxAutoZoomDistance); AddBoolean(_("Distinct page zoom"), _("Maintain one map zoom level on each page."), page_settings.distinct_zoom); SetExpertRow(PAGES_DISTINCT_ZOOM); UpdateVisibilities(); }
void LX16xxConfigWidget::Prepare(ContainerWindow &parent, const PixelRect &rc) { RequestAllSettings(device); AddInteger(_("Avg. time"), NULL, _T("%d s"), _T("%d"), 1, 30, 1, WaitUnsignedValue(device, LX1600::Setting::VARIO_AVG_TIME, 25)); static constexpr StaticEnumChoice range_list[] = { { 25, _T("2.5 m/s"), NULL }, { 50, _T("5.0 m/s"), NULL }, { 100, _T("10 m/s"), NULL }, { 0 } }; AddEnum(_("Vario Range"), NULL, range_list, (unsigned)(WaitFixedValue(device, LX1600::Setting::VARIO_RANGE, fixed(5.0)) * 10)); AddFloat(_("Vario Filter"), NULL, _T("%.2f s"), _T("%.2f"), fixed(0.25), fixed(5), fixed(0.25), false, WaitFixedValue(device, LX1600::Setting::VARIO_FILTER, fixed(1))); static constexpr StaticEnumChoice te_level_list[] = { { 0, _T("Off"), NULL }, { 50, _T("50 %"), NULL }, { 60, _T("60 %"), NULL }, { 70, _T("70 %"), NULL }, { 80, _T("80 %"), NULL }, { 90, _T("90 %"), NULL }, { 100, _T("100 %"), NULL }, { 110, _T("110 %"), NULL }, { 120, _T("120 %"), NULL }, { 130, _T("130 %"), NULL }, { 140, _T("140 %"), NULL }, { 150, _T("150 %"), NULL }, { 0 } }; AddEnum(_("TE Level"), NULL, te_level_list, (unsigned)WaitFixedValue(device, LX1600::Setting::TE_LEVEL, fixed(50))); AddFloat(_("TE Filter"), NULL, _T("%.2f s"), _T("%.2f"), fixed(0.0), fixed(2), fixed(1), false, WaitFixedValue(device, LX1600::Setting::TE_FILTER, fixed(1.5))); AddFloat(_("SMART Filter"), NULL, _T("%.2f m/s²"), _T("%.2f"), fixed(0.5), fixed(5), fixed(0.1), false, WaitFixedValue(device, LX1600::Setting::SMART_VARIO_FILTER, fixed(1))); }
bool AnnotWriter::WriteAS(Ref& ref, Annotation* a) { if (is_empty_ref(ref)) return true; Object xobj; xobj.initDict(mXRef); // setup XObject dictionary AddName(&xobj, "Type", "XObject"); AddName(&xobj, "Subtype", "Form"); AddInteger(&xobj, "FormType", 1); PDFRectangle r = *a->GetRect(); r.x2 -= r.x1; r.y2 -= r.y1; r.x1 = r.y1 = 0; AddRect(&xobj, "BBox", &r); // setup resource dictionary Object resources, array, name; resources.initDict(mXRef); array.initArray(mXRef); name.initName("PDF"); array.arrayAdd(&name); resources.dictAdd(copyString("ProcSet"), &array); xobj.dictAdd(copyString("Resources"), &resources); // create appearance stream AnnotAppearance as; a->Visit(&as); // set length AddInteger(&xobj, "Length", as.GetLength()); ASSERT(as.GetLength() > 0); // write form XObject WriteObject(ref, &xobj, as.GetStream()); xobj.free(); ref = empty_ref; return true; }
void MapDisplayConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { instance = this; RowFormWidget::Prepare(parent, rc); const MapSettings &settings_map = CommonInterface::GetMapSettings(); AddEnum(_("Cruise orientation"), _("Determines how the screen is rotated with the glider"), orientation_list, settings_map.cruise_orientation, OnShiftTypeData); AddEnum(_("Circling orientation"), _("Determines how the screen is rotated with the glider while circling"), orientation_list, settings_map.cruise_orientation, OnShiftTypeData); AddBoolean(_("Circling zoom"), _("If enabled, then the map will zoom in automatically when entering circling mode and zoom out automatically when leaving circling mode."), settings_map.circle_zoom_enabled); AddEnum(_("Map shift reference"), _("Determines what is used to shift the glider from the map center"), shift_bias_list, settings_map.map_shift_bias, OnShiftTypeData); AddInteger(_("Glider position offset"), _("Defines the location of the glider drawn on the screen in percent from the screen edge."), _T("%d %%"), _T("%d"), 10, 50, 5, settings_map.glider_screen_position); AddFloat(_("Max. auto zoom distance"), _("The upper limit for auto zoom distance."), _T("%.0f %s"), _T("%.0f"), fixed(20), fixed(250), fixed(10), false, ugDistance, settings_map.max_auto_zoom_distance); UpdateVisibilities(); }
void AirspaceClassRendererSettingsPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { RowFormWidget::Prepare(parent, rc); // Save a working copy settings = CommonInterface::GetMapSettings().airspace.classes[type]; // Add controls AddButton(_("Change Border Color"), *this, BorderColor); AddButton(_("Change Fill Color"), *this, FillColor); #ifdef HAVE_HATCHED_BRUSH #ifdef HAVE_ALPHA_BLEND bool transparency = CommonInterface::GetMapSettings().airspace.transparency; if (!transparency || !AlphaBlendAvailable()) #endif AddButton(_("Change Fill Brush"), *this, FillBrush); #ifdef HAVE_ALPHA_BLEND else AddDummy(); #endif #else AddDummy(); #endif AddInteger(_("Border Width"), _("The width of the border drawn around each airspace. " "Set this value to zero to hide the border."), _T("%d"), _T("%d"), 0, 5, 1, settings.border_width); static constexpr StaticEnumChoice fill_mode_list[] = { { (unsigned)AirspaceClassRendererSettings::FillMode::ALL, N_("Filled"), }, { (unsigned)AirspaceClassRendererSettings::FillMode::PADDING, N_("Only padding"), }, { (unsigned)AirspaceClassRendererSettings::FillMode::NONE, N_("Not filled"), }, { 0 } }; AddEnum(_("Fill Mode"), _("Defines how the airspace is filled with the configured color."), fill_mode_list, (unsigned)settings.fill_mode); }
void AnnotWriter::DoStyledAnnot(StyledAnnot* s) { AddAnnotContents(s); // border style char* style = NULL; Object bs; bs.initDict(mXRef); AddName(&bs, "Type", "Border"); AddInteger(&bs, "W", (float)s->GetBorderStyle()->GetWidth()); // width switch (s->GetBorderStyle()->GetStyle()) { case BorderStyle::solid_style: style = "S"; case BorderStyle::dashed_style: style = "D"; case BorderStyle::beveled_style: style = "B"; case BorderStyle::inset_style: style = "I"; case BorderStyle::underline_style: style = "U"; } if (style != NULL) { AddName(&bs, "S", style); // border style } AddDict(&mAnnot, "BS", &bs); }
void AudioVarioConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { RowFormWidget::Prepare(parent, rc); if (!AudioVarioGlue::HaveAudioVario()) return; const auto &settings = CommonInterface::GetUISettings().sound.vario; AddBoolean(_("Audio vario"), _("Emulate the sound of an electronic vario."), settings.enabled); AddInteger(_("Volume"), nullptr, _T("%u %%"), _T("%u"), 0, 100, 1, settings.volume); AddBoolean(_("Enable Deadband"), _("Mute the audio output in when the current lift is in a certain " "range around zero"), settings.dead_band_enabled); AddSpacer(); SetExpertRow(SPACER); AddInteger(_("Min. Frequency"), _("The tone frequency that is played at maximum sink rate."), _T("%u Hz"), _T("%u"), 50, 3000, 50, settings.min_frequency); SetExpertRow(MIN_FREQUENCY); AddInteger(_("Zero Frequency"), _("The tone frequency that is played at zero climb rate."), _T("%u Hz"), _T("%u"), 50, 3000, 50, settings.zero_frequency); SetExpertRow(ZERO_FREQUENCY); AddInteger(_("Max. Frequency"), _("The tone frequency that is played at maximum climb rate."), _T("%u Hz"), _T("%u"), 50, 3000, 50, settings.max_frequency); SetExpertRow(MAX_FREQUENCY); AddSpacer(); SetExpertRow(SPACER2); AddFloat(_("Deadband min. lift"), _("Below this lift threshold the vario will start to play sounds if the 'Deadband' feature is enabled."), _T("%.1f %s"), _T("%.1f"), Units::ToUserVSpeed(-5), 0, GetUserVerticalSpeedStep(), false, UnitGroup::VERTICAL_SPEED, settings.min_dead); SetExpertRow(DEAD_BAND_MIN); DataFieldFloat &db_min = (DataFieldFloat &)GetDataField(DEAD_BAND_MIN); db_min.SetFormat(GetUserVerticalSpeedFormat(false, true)); AddFloat(_("Deadband max. lift"), _("Above this lift threshold the vario will start to play sounds if the 'Deadband' feature is enabled."), _T("%.1f %s"), _T("%.1f"), 0, Units::ToUserVSpeed(2), GetUserVerticalSpeedStep(), false, UnitGroup::VERTICAL_SPEED, settings.max_dead); SetExpertRow(DEAD_BAND_MAX); DataFieldFloat &db_max = (DataFieldFloat &)GetDataField(DEAD_BAND_MAX); db_max.SetFormat(GetUserVerticalSpeedFormat(false, true)); }
void CSettings::LoadDefaults(bool bClient) { CLogFile::Printf("LoadDefaultSettings: %d",bClient); if(!bClient) { AddInteger("queryport", 10000, 1024, 65534); AddInteger("port", 9999, 1024, 65535); AddInteger("httpport", 9998, 80, 65535); AddString("httpserver", ""); AddInteger("maxplayers", MAX_PLAYERS, 1, MAX_PLAYERS); AddInteger("maxvehicles", MAX_VEHICLES, 0, MAX_VEHICLES); AddString("password", ""); AddBool("query", true); AddBool("listed", false); AddBool("guinametags",false); AddBool("vehicledamage", false); AddBool("vehiclewaterdeath", true); AddBool("headmovement",true); AddBool("checkGTAFiles",true); AddString("hostname", VERSION_IDENTIFIER_2 " Server"); AddString("hostaddress", ""); AddBool("frequentevents", false); AddBool("kickoldplayers", true); AddBool("paynspray", true); AddBool("autoaim", true); AddInteger("weather", 1, 1, 10); AddFloat("wind",0.0,0.0,50.0); AddBool("silent", false); AddBool("timestamp", true); AddList("script"); AddList("clientscript"); AddList("clientresource"); AddList("module"); AddList("config"); AddList("resource"); } else { // Load client settings AddString("ip", "127.0.0.1"); AddInteger("port", 9999, 1, 65535); AddString("nick", "player"); AddString("pass", ""); AddBool("windowed", false); AddBool("fps", false); AddString("chatfont", "tahoma-bold"); AddInteger("chatsize", 10, 1, 100); AddInteger("chatbga", 0, 0, 255); AddInteger("chatbgr", 0, 0, 255); AddInteger("chatbgg", 0, 0, 255); AddInteger("chatbgb", 0, 0, 255); } }
void TerrainDisplayConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { instance = this; RowFormWidget::Prepare(parent, rc); const MapSettings &settings_map = CommonInterface::GetMapSettings(); const TerrainRendererSettings &terrain = settings_map.terrain; AddBoolean(_("Terrain display"), _("Draw a digital elevation terrain on the map."), terrain.enable); GetDataField(EnableTerrain).SetListener(this); AddBoolean(_("Topography display"), _("Draw topographical features (roads, rivers, lakes etc.) on the map."), settings_map.topography_enabled); static constexpr StaticEnumChoice terrain_ramp_list[] = { { 0, N_("Low lands"), }, { 1, N_("Mountainous"), }, { 2, N_("Imhof 7"), }, { 3, N_("Imhof 4"), }, { 4, N_("Imhof 12"), }, { 5, N_("Imhof Atlas"), }, { 6, N_("ICAO"), }, { 9, N_("Vibrant"), }, { 7, N_("Grey"), }, { 8, N_("White"), }, {10, N_("Sandstone"), }, {11, N_("Pastel"), }, {12, N_("Italian Avioportolano VFR Chart"), }, {13, N_("German DFS VFR Chart"), }, {14, N_("French SIA VFR Chart"), }, { 0 } }; AddEnum(_("Terrain colors"), _("Defines the color ramp used in terrain rendering."), terrain_ramp_list, terrain.ramp); GetDataField(TerrainColors).SetListener(this); static constexpr StaticEnumChoice slope_shading_list[] = { { (unsigned)SlopeShading::OFF, N_("Off"), }, { (unsigned)SlopeShading::FIXED, N_("Fixed"), }, { (unsigned)SlopeShading::SUN, N_("Sun"), }, { (unsigned)SlopeShading::WIND, N_("Wind"), }, { 0 } }; AddEnum(_("Slope shading"), _("The terrain can be shaded among slopes to indicate either wind direction, sun position or a fixed shading from North-West."), slope_shading_list, (unsigned)terrain.slope_shading); GetDataField(TerrainSlopeShading).SetListener(this); SetExpertRow(TerrainSlopeShading); AddInteger(_("Terrain contrast"), _("Defines the amount of Phong shading in the terrain rendering. Use large values to emphasise terrain slope, smaller values if flying in steep mountains."), _T("%d %%"), _T("%d %%"), 0, 100, 5, ByteToPercent(terrain.contrast)); GetDataField(TerrainContrast).SetListener(this); SetExpertRow(TerrainContrast); AddInteger(_("Terrain brightness"), _("Defines the brightness (whiteness) of the terrain rendering. This controls the average illumination of the terrain."), _T("%d %%"), _T("%d %%"), 0, 100, 5, ByteToPercent(terrain.brightness)); GetDataField(TerrainBrightness).SetListener(this); SetExpertRow(TerrainBrightness); // JMW using enum here instead of bool so can provide more contour rendering // options later static constexpr StaticEnumChoice contours_list[] = { { (unsigned)Contours::OFF, N_("Off"), }, { (unsigned)Contours::ON, N_("On"), }, { 0 } }; AddEnum(_("Contours"), _("If enabled, draws contour lines on the terrain."), contours_list, (unsigned)terrain.contours); GetDataField(TerrainContours).SetListener(this); SetExpertRow(TerrainContours); if (::terrain != nullptr) { WindowStyle style; style.Border(); TerrainPreviewWindow *preview = new TerrainPreviewWindow(*::terrain); preview->Create((ContainerWindow &)GetWindow(), {0, 0, 100, 100}, style); AddRemaining(preview); } terrain_settings = terrain; ShowTerrainControls(); UpdateTerrainPreview(); }
void TerrainDisplayConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { instance = this; RowFormWidget::Prepare(parent, rc); const MapSettings &settings_map = CommonInterface::GetMapSettings(); const TerrainRendererSettings &terrain = settings_map.terrain; AddBoolean(_("Terrain display"), _("Draw a digital elevation terrain on the map."), terrain.enable); GetDataField(EnableTerrain).SetListener(this); AddBoolean(_("Topography display"), _("Draw topographical features (roads, rivers, lakes etc.) on the map."), settings_map.topography_enabled); static constexpr StaticEnumChoice terrain_ramp_list[] = { { 0, N_("Low lands"), }, { 1, N_("Mountainous"), }, { 2, N_("Imhof 7"), }, { 3, N_("Imhof 4"), }, { 4, N_("Imhof 12"), }, { 5, N_("Imhof Atlas"), }, { 6, N_("ICAO"), }, { 7, N_("Grey"), }, { 0 } }; AddEnum(_("Terrain colors"), _("Defines the color ramp used in terrain rendering."), terrain_ramp_list, terrain.ramp); GetDataField(TerrainColors).SetListener(this); static constexpr StaticEnumChoice slope_shading_list[] = { { (unsigned)SlopeShading::OFF, N_("Off"), }, { (unsigned)SlopeShading::FIXED, N_("Fixed"), }, { (unsigned)SlopeShading::SUN, N_("Sun"), }, { (unsigned)SlopeShading::WIND, N_("Wind"), }, { 0 } }; AddEnum(_("Slope shading"), _("The terrain can be shaded among slopes to indicate either wind direction, sun position or a fixed shading from north-east."), slope_shading_list, (unsigned)terrain.slope_shading); GetDataField(TerrainSlopeShading).SetListener(this); SetExpertRow(TerrainSlopeShading); AddInteger(_("Terrain contrast"), _("Defines the amount of Phong shading in the terrain rendering. Use large values to emphasise terrain slope, smaller values if flying in steep mountains."), _T("%d %%"), _T("%d %%"), 0, 100, 5, ByteToPercent(terrain.contrast)); GetDataField(TerrainContrast).SetListener(this); SetExpertRow(TerrainContrast); AddInteger(_("Terrain brightness"), _("Defines the brightness (whiteness) of the terrain rendering. This controls the average illumination of the terrain."), _T("%d %%"), _T("%d %%"), 0, 100, 5, ByteToPercent(terrain.brightness)); GetDataField(TerrainBrightness).SetListener(this); SetExpertRow(TerrainBrightness); if (::terrain != NULL) { WindowStyle style; style.Border(); AddRemaining(new WndOwnerDrawFrame(*(ContainerWindow *)GetWindow(), {0, 0, 100, 100}, style, ::OnPreviewPaint)); } terrain_settings = terrain; ShowTerrainControls(); }
void WaypointDisplayConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { const WaypointRendererSettings &settings = CommonInterface::GetMapSettings().waypoint; RowFormWidget::Prepare(parent, rc); static constexpr StaticEnumChoice wp_labels_list[] = { { (unsigned)WaypointRendererSettings::DisplayTextType::NAME, N_("Full name"), N_("The full name of each waypoint is displayed.") }, { (unsigned)WaypointRendererSettings::DisplayTextType::FIRST_WORD, N_("First word of name"), N_("The first word of the waypoint name is displayed.") }, { (unsigned)WaypointRendererSettings::DisplayTextType::FIRST_THREE, N_("First 3 letters"), N_("The first 3 letters of the waypoint name are displayed.") }, { (unsigned)WaypointRendererSettings::DisplayTextType::FIRST_FIVE, N_("First 5 letters"), N_("The first 5 letters of the waypoint name are displayed.") }, { (unsigned)WaypointRendererSettings::DisplayTextType::NONE, N_("None"), N_("No waypoint name is displayed.") }, { 0 } }; AddEnum(_("Label format"), _("Determines how labels are displayed with each waypoint"), wp_labels_list, (unsigned)settings.display_text_type); static constexpr StaticEnumChoice wp_arrival_list[] = { { (unsigned)WaypointRendererSettings::ArrivalHeightDisplay::NONE, N_("None"), N_("No arrival height is displayed.") }, { (unsigned)WaypointRendererSettings::ArrivalHeightDisplay::GLIDE, N_("Straight glide"), N_("Straight glide arrival height (no terrain is considered).") }, { (unsigned)WaypointRendererSettings::ArrivalHeightDisplay::TERRAIN, N_("Terrain avoidance glide"), N_("Arrival height considering terrain avoidance. " "Requires \"Reach mode: Turning\" in \"Glide Computer > Route\" settings.") }, { (unsigned)WaypointRendererSettings::ArrivalHeightDisplay::GLIDE_AND_TERRAIN, N_("Straight & terrain glide"), N_("Both arrival heights are displayed. " "Requires \"Reach mode: Turning\" in \"Glide Computer > Route\" settings.") }, { (unsigned)WaypointRendererSettings::ArrivalHeightDisplay::REQUIRED_GR, N_("Required glide ratio") }, { 0 } }; AddEnum(_("Arrival height"), _("Determines how arrival height is displayed in waypoint labels"), wp_arrival_list, (unsigned)settings.arrival_height_display); SetExpertRow(WaypointArrivalHeightDisplay); static constexpr StaticEnumChoice wp_label_list[] = { { (unsigned)LabelShape::ROUNDED_BLACK, N_("Rounded rectangle"), nullptr }, { (unsigned)LabelShape::OUTLINED_INVERTED, N_("Outlined"), nullptr }, { 0 } }; AddEnum(_("Label style"), nullptr, wp_label_list, (unsigned)settings.landable_render_mode); SetExpertRow(WaypointLabelStyle); static constexpr StaticEnumChoice wp_selection_list[] = { { (unsigned)WaypointRendererSettings::LabelSelection::ALL, N_("All"), N_("All labels will be displayed.") }, { (unsigned)WaypointRendererSettings::LabelSelection::TASK_AND_AIRFIELD, N_("Task waypoints & airfields"), N_("All waypoints part of a task and all airfields will be displayed.") }, { (unsigned)WaypointRendererSettings::LabelSelection::TASK_AND_LANDABLE, N_("Task waypoints & landables"), N_("All waypoints part of a task and all landables will be displayed.") }, { (unsigned)WaypointRendererSettings::LabelSelection::TASK, N_("Task waypoints"), N_("All waypoints part of a task will be displayed.") }, { (unsigned)WaypointRendererSettings::LabelSelection::NONE, N_("None"), N_("No labels will be displayed.") }, { 0 } }; AddEnum(_("Label visibility"), _("Determines what labels are displayed."), wp_selection_list, (unsigned)settings.label_selection); SetExpertRow(WaypointLabelSelection); static constexpr StaticEnumChoice wp_style_list[] = { { (unsigned)WaypointRendererSettings::LandableStyle::PURPLE_CIRCLE, N_("Purple circle"), N_("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.") }, { (unsigned)WaypointRendererSettings::LandableStyle::BW, N_("B/W"), N_("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.") }, { (unsigned)WaypointRendererSettings::LandableStyle::TRAFFIC_LIGHTS, N_("Traffic lights"), N_("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.") }, { 0 } }; AddEnum(_("Landable symbols"), _("Three styles are available: Purple circles (WinPilot style), a high " "contrast (monochrome) style, or orange. The rendering differs for landable " "field and airport. All styles mark the waypoints within reach green."), wp_style_list, (unsigned)settings.landable_style); AddBoolean(_("Detailed landables"), _("[Off] Display fixed icons for landables.\n" "[On] Show landables with variable information like runway length and heading."), settings.vector_landable_rendering, this); SetExpertRow(AppUseSWLandablesRendering); AddInteger(_("Landable size"), _("A percentage to select the size landables are displayed on the map."), _T("%u %%"), _T("%u"), 50, 200, 10, settings.landable_rendering_scale); SetExpertRow(AppLandableRenderingScale); AddBoolean(_("Scale runway length"), _("[Off] Display fixed length for runways.\n" "[On] Scale displayed runway length based on real length."), settings.scale_runway_length); SetExpertRow(AppScaleRunwayLength); UpdateVisibilities(); }
GridInfoObjectType *CreateGridInfoObject( char *fileName ) { int numberGrids; int maxPossibleGrids; int gridFileID; int iret; int gridCounter; GridInfoObjectType *gio; GridType *gt; /* * Character Strings passed to GEMPAK fortran subroutines. When passing * the length of the string to GEMPAK, subtract out one for the NULL. * */ char lastTime[GEMPAKSTRING]; char time1[GEMPAKSTRING]; char time2[GEMPAKSTRING]; char gridField[GEMPAKSTRING]; int levels[2]; int jvcoordinate; /* may not be right declaration - check common */ int verbose; verbose = GetVerboseLevel(); if ( verbose > VERBOSE_0 ) printf ("CreateGridInfoObject\n" ); memset( lastTime, 0, sizeof( lastTime ) ); memset( time1, 0, sizeof( time1 ) ); memset( time2, 0, sizeof( time2 ) ); memset( gridField, 0, sizeof( gridField) ); gdinfo( fileName, lastTime, &numberGrids, &maxPossibleGrids, &gridFileID, &iret, strlen( fileName ), sizeof( lastTime ) - 1); if( iret ) return( NULL ); /* * Allocate all the memory... */ gio = (GridInfoObjectType *) malloc( sizeof(GridInfoObjectType) ); gio->gridList = (GridType *) malloc( numberGrids * sizeof( GridType) ); /* * ....and then check for errors. */ if( ! gio || ! gio->gridList ) { printf("*** CreateGridInfoObject: malloc failure.\n"); return( NULL ); } /* * Intialize the object. */ gt = gio->gridList; memset( gt, 0, numberGrids * sizeof( GridType) ); gio->fileName = strdup( fileName ); gio->lastTime = strdup( lastTime ); gio->numberOfGrids = numberGrids; gio->maxPossibleGrids = maxPossibleGrids; gio->destroyFunc = GridInfoObjectDestroy; gio->printfFunc = GridInfoObjectPrintf; gio->textFunc = GridInfoObjectToText; gio->numLevels = 0; gio->levels = NULL; gio->numTimes = 0; gio->times = NULL; gio->numVerticalCoordinates = 0; gio->verticalCoordinates = NULL; gio->numGridFields = 0; gio->gridFields = NULL; gio->numForecastIntervals = 0; gio->forecastIntervals = NULL; if ( verbose > VERBOSE_1 ) { printf(" file is %s\n", fileName ); printf(" numberGrids %d,", numberGrids ); printf(" maxPossibleGrids %d,", maxPossibleGrids ); printf(" iret %d\n", iret ); } iret = 0; for( gridCounter = 1; gridCounter <= numberGrids; gridCounter++, gt++ ){ getnxtgrd( &gridFileID, &gridCounter, gt->time1, gt->time2, gt->levels, gt->verticalCoordinate, gt->gridField, &iret, sizeof(gt->time1) - 1, sizeof(gt->time2) - 1, sizeof(gt->verticalCoordinate) - 1, sizeof(gt->gridField) - 1 ); if( iret ) { printf(" CreateGridInfoObject: getnxtgrd ret %d\n", iret ); break; } StringClean( gt->time1 ); StringClean( gt->time2 ); StringClean( gt->gridField ); StringClean( gt->verticalCoordinate ); if ( verbose > VERBOSE_3 ) { printf(" Grid # %d:\n", gridCounter ); printf(" time1 %s,", gt->time1 ); printf(" time2 %s,", gt->time2 ); printf(" lev1 %d,", gt->levels[0] ); printf(" lev2 %d,", gt->levels[1] ); printf(" jv %s,", gt->verticalCoordinate ); printf(" gridField %s\n", gt->gridField ); } AddString( gio->numberOfGrids, &gio->numForecastIntervals, &gio->forecastIntervals, ParseOffForecast(gt->time1) ); AddString( gio->numberOfGrids, &gio->numTimes, &gio->times, gt->time1 ); AddString( gio->numberOfGrids, &gio->numGridFields, &gio->gridFields, gt->gridField ); AddString( gio->numberOfGrids, &gio->numVerticalCoordinates, &gio->verticalCoordinates, gt->verticalCoordinate ); AddInteger( gio->numberOfGrids, &gio->numLevels, &gio->levels, gt->levels[0] ); } /* for(;;) */ /* * Cleanup and go home if there was an error. */ if( iret ) { (*gio->destroyFunc)( gio ); gio = NULL; } /* * Close the gridfile for next time... */ gd_clos( &gridFileID, &iret ); return( gio ); }
void CSettings::LoadDefaults() { // jenksta: HACKY, find another way #ifdef _SERVER AddString("logfile", "ivmp-svr.log"); AddInteger("port", 9999, 1024, 65535); AddInteger("httpport", 9998, 80, 65535); AddString("httpserver", ""); AddInteger("maxplayers", MAX_PLAYERS, 1, MAX_PLAYERS); AddInteger("maxvehicles", MAX_VEHICLES, 0, MAX_VEHICLES); AddString("password", ""); AddBool("query", true); AddBool("listed", false); AddBool("guinametags",false); AddBool("headmovement",true); AddString("hostname", VERSION_IDENTIFIER_2 " Server"); AddString("hostaddress", ""); AddBool("frequentevents", false); AddBool("kickoldplayers", true); AddBool("paynspray", true); AddBool("autoaim", true); AddInteger("weather", 1, 1, 10); AddFloat("wind",0.0,0.0,50.0); AddBool("silent", false); AddBool("timestamp", true); AddList("script"); AddList("clientscript"); AddList("clientresource"); AddList("module"); AddList("config"); #else AddString("ip", "127.0.0.1"); AddInteger("port", 9999, 1024, 65535); //AddString("nick", "kyefag"); //AddString("nick", "jenksta"); AddString("nick", "player"); AddString("pass", ""); AddBool("windowed", false); AddBool("fps", false); AddString("chatfont", "tahoma-bold"); AddInteger("chatsize", 10, 1, 100); AddInteger("chatbga", 0, 0, 255); AddInteger("chatbgr", 0, 0, 255); AddInteger("chatbgg", 0, 0, 255); AddInteger("chatbgb", 0, 0, 255); #endif }
void InterfaceConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { const UISettings &settings = CommonInterface::GetUISettings(); RowFormWidget::Prepare(parent, rc); AddInteger(_("Text size"), nullptr, _T("%d %%"), _T("%d"), 75, 200, 5, settings.scale); AddFile(_("Events"), _("The Input Events file defines the menu system and how XCSoar responds to " "button presses and events from external devices."), ProfileKeys::InputFile, _T("*.xci\0")); SetExpertRow(InputFile); #ifndef HAVE_NATIVE_GETTEXT WndProperty *wp; wp = AddEnum(_("Language"), _("The language options selects translations for English texts to other " "languages. Select English for a native interface or Automatic to localise " "XCSoar according to the system settings.")); if (wp != nullptr) { DataFieldEnum &df = *(DataFieldEnum *)wp->GetDataField(); df.addEnumText(_("Automatic")); df.addEnumText(_T("English")); #ifdef HAVE_BUILTIN_LANGUAGES for (const BuiltinLanguage *l = language_table; l->resource != nullptr; ++l) { StaticString<100> display_string; display_string.Format(_T("%s (%s)"), l->name, l->resource); df.addEnumText(l->resource, display_string); } #endif LanguageFileVisitor lfv(df); VisitDataFiles(_T("*.mo"), lfv); df.Sort(2); auto value_buffer = Profile::GetPath(ProfileKeys::LanguageFile); Path value = value_buffer; if (value.IsNull()) value = Path(_T("")); if (value == Path(_T("none"))) df.Set(1); else if (!value.IsEmpty() && value != Path(_T("auto"))) { const Path base = value.GetBase(); if (base != nullptr) df.Set(base.c_str()); } wp->RefreshDisplay(); } #endif /* !HAVE_NATIVE_GETTEXT */ AddTime(_("Menu timeout"), _("This determines how long menus will appear on screen if the user does not make any button " "presses or interacts with the computer."), 1, 60, 1, settings.menu_timeout / 2); SetExpertRow(MenuTimeout); static constexpr StaticEnumChoice text_input_list[] = { { (unsigned)DialogSettings::TextInputStyle::Default, N_("Default") }, { (unsigned)DialogSettings::TextInputStyle::Keyboard, N_("Keyboard") }, { (unsigned)DialogSettings::TextInputStyle::HighScore, N_("HighScore Style") }, { 0 } }; AddEnum(_("Text input style"), _("Determines how the user is prompted for text input (filename, teamcode etc.)"), text_input_list, (unsigned)settings.dialog.text_input_style); SetExpertRow(TextInput); /* on-screen keyboard doesn't work without a pointing device (mouse or touch screen) */ SetRowVisible(TextInput, HasPointer()); #ifdef HAVE_VIBRATOR static constexpr StaticEnumChoice haptic_feedback_list[] = { { (unsigned)UISettings::HapticFeedback::DEFAULT, N_("OS settings") }, { (unsigned)UISettings::HapticFeedback::OFF, N_("Off") }, { (unsigned)UISettings::HapticFeedback::ON, N_("On") }, { 0 } }; wp = AddEnum(_("Haptic feedback"), _("Determines if haptic feedback like vibration is used."), haptic_feedback_list, (unsigned)settings.haptic_feedback); SetExpertRow(HapticFeedback); #endif /* HAVE_VIBRATOR */ }