void DrawSystem() // draw showing_system (may be null), showing_matcomds (may be null) { panelStars.HideInfo(); StarScan.SystemNode data = panelStars.FindSystem(showing_system, discoveryform.history); string control_text = "No System"; if (showing_system != null) { control_text = showing_system.Name; if (data != null) { long value = data.ScanValue(checkBoxEDSM.Checked); control_text += " ~ " + value.ToString("N0") + " cr"; int scanned = data.StarPlanetsScanned(); if (scanned > 0) { control_text += " " + "Scan".T(EDTx.UserControlSurveyor_Scan) + " " + scanned.ToString() + (data.FSSTotalBodies != null ? (" / " + data.FSSTotalBodies.Value.ToString()) : ""); } } else { control_text += " " + "No Scan".T(EDTx.NoScan); } } panelStars.DrawSystem(data, showing_matcomds, discoveryform.history, (HasControlTextArea() && !extCheckBoxDisplaySystemAlways.Checked) ? null : control_text, bodyfilters); SetControlText(control_text); }
void DrawSystem() // draw showing_system (may be null), showing_matcomds (may be null) { panelStars.HideInfo(); StarScan.SystemNode data = panelStars.FindSystem(showing_system, discoveryform.history); string control_text = "No System"; if (showing_system != null) { control_text = showing_system.Name; if (data != null) { long value = data.ScanValue(checkBoxEDSM.Checked); control_text += " ~ " + value.ToString("N0") + " cr"; } else { control_text += " " + "No Scan".T(EDTx.NoScan); } } panelStars.DrawSystem(data, showing_matcomds, discoveryform.history, (HasControlTextArea() && !extCheckBoxDisplaySystemAlways.Checked) ? null : control_text, bodyfilters); SetControlText(control_text); }
async void DrawSystem() // draw showing_system (may be null), showing_matcomds (may be null) { panelStars.HideInfo(); // showing_system = new SystemClass("Qi Lieh"); //showing_system = new SystemClass("Pallaeni"); - problem with shrinking lines // showing_system = new SystemClass("Borann"); //showing_system = new SystemClass("Skaudai AM-B d14-138"); //showing_system = new SystemClass("Eorgh Prou JH-V e2-1979"); // showing_system = new SystemClass("HYPAA FLYIAE CB-O D6-8"); #if PLAYTHRU StarScan.SystemNode data = showing_system != null ? await discoveryform.history.starscan.FindSystemAsync(showing_system, false, byname : true) : null; #else StarScan.SystemNode data = showing_system != null ? await discoveryform.history.StarScan.FindSystemAsync(showing_system, checkBoxEDSM.Checked) : null; #endif string control_text = "No System"; if (showing_system != null) { control_text = showing_system.Name; if (data != null) { long value = data.ScanValue(checkBoxEDSM.Checked); control_text += " ~ " + value.ToString("N0") + " cr"; int scanned = data.StarPlanetsScanned(); if (scanned > 0) { control_text += " " + "Scan".T(EDTx.UserControlSurveyor_Scan) + " " + scanned.ToString() + (data.FSSTotalBodies != null ? (" / " + data.FSSTotalBodies.Value.ToString()) : ""); } int fsssignals = data.FSSSignalList.Count; if (fsssignals > 0) { control_text += " " + " Signals " + fsssignals.ToString(); } } else { control_text += " " + "No Scan".T(EDTx.NoScan); } } var curmats = discoveryform.history.MaterialCommoditiesMicroResources.GetLast(); panelStars.DrawSystem(data, showing_matcomds, curmats, (HasControlTextArea() && !displayfilters.Contains("sys")) ? null : control_text, bodyfilters); SetControlText(control_text); }
void DrawSystem() // draw showing_system (may be null), showing_matcomds (may be null) { panelStars.HideInfo(); StarScan.SystemNode data = panelStars.DrawSystem(showing_system, showing_matcomds, discoveryform.history); if (showing_system == null) { SetControlText("No System"); } else { if (data != null) { long value = data.ScanValue(checkBoxEDSM.Checked); SetControlText(data.system.Name + " (~" + value.ToString() + " cr)"); } else { SetControlText(data == null ? "No Scan".Tx() : data.system.Name); } } }
public static async void ShowScanOrMarketForm(Form parent, Object tag, bool checkedsm, HistoryList hl) // tag can be a Isystem or an He.. output depends on it. { if (tag == null) { return; } ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm(); Size infosize = parent.SizeWithinScreen(new Size(parent.Width * 6 / 8, parent.Height * 6 / 8), 128, 128 + 100); // go for this, but allow this around window int topmargin = 40; HistoryEntry he = tag as HistoryEntry; // is tag HE? ISystem sys = he != null ? he.System : tag as ISystem; // if so, sys is he.system, else its a direct sys ScanDisplayUserControl sd = null; string title = "System".T(EDTx.ScanDisplayForm_Sys) + ": " + sys.Name; AutoScaleMode asm = AutoScaleMode.Font; if (he != null && (he.EntryType == JournalTypeEnum.Market || he.EntryType == JournalTypeEnum.EDDCommodityPrices)) // station data.. { he.FillInformation(out string info, out string detailed); f.Add(new ExtendedControls.ConfigurableForm.Entry("RTB", typeof(ExtendedControls.ExtRichTextBox), detailed, new Point(0, topmargin), infosize, null)); JournalCommodityPricesBase jm = he.journalEntry as JournalCommodityPricesBase; title += ", " + "Station".T(EDTx.ScanDisplayForm_Station) + ": " + jm.Station; } else { sd = new ScanDisplayUserControl(); sd.CheckEDSM = checkedsm; int selsize = (int)(EDDTheme.Instance.GetFont.Height / 16.0f * 48.0f); sd.SetSize(selsize); sd.Size = infosize; StarScan.SystemNode data = await hl.StarScan.FindSystemAsync(sys, sd.CheckEDSM); // look up system async if (data != null) { long value = data.ScanValue(sd.CheckEDSM); title += " ~ " + value.ToString("N0") + " cr"; } sd.BackColor = EDDTheme.Instance.Form; sd.DrawSystem(data, null, hl); int wastedh = infosize.Height - sd.DisplayAreaUsed.Y - 10 - 40; if (wastedh > 0) { infosize.Height -= wastedh; } asm = AutoScaleMode.None; // because we are using a picture box, it does not autoscale, so we can't use that logic on it. f.Add(new ExtendedControls.ConfigurableForm.Entry("Sys", null, null, new Point(0, topmargin), infosize, null) { control = sd }); } f.AddOK(new Point(infosize.Width - 120, topmargin + infosize.Height + 10)); f.Trigger += (dialogname, controlname, ttag) => { if (controlname == "OK") { f.ReturnResult(DialogResult.OK); } else if (controlname == "Close") { f.ReturnResult(DialogResult.Cancel); } }; f.InitCentred(parent, parent.Icon, title, null, null, asm, closeicon: true); f.Show(parent); }
private async void DrawSystem(HistoryEntry he, bool force) { var samesys = last_he?.System != null && he?.System != null && he.System.Name == last_he.System.Name; //System.Diagnostics.Debug.WriteLine("Scan grid " + samesys + " F:" + force); StarScan.SystemNode scannode = null; if (he == null) // no he, no display { last_he = he; dataGridViewScangrid.Rows.Clear(); SetControlText("No Scan".T(EDTx.NoScan)); return; } else { scannode = await discoveryform.history.StarScan.FindSystemAsync(he.System, checkBoxEDSM.Checked); // get data with EDSM maybe if (scannode == null) // no data, clear display, clear any last_he so samesys is false next time { last_he = null; dataGridViewScangrid.Rows.Clear(); SetControlText("No Scan".T(EDTx.NoScan)); return; } if (samesys && !force) // same system, no force, no redisplay { return; } } last_he = he; // only record first row if same system var firstdisplayedrow = (dataGridViewScangrid.RowCount > 0 && samesys) ? dataGridViewScangrid.SafeFirstDisplayedScrollingRowIndex() : -1; toolStripJumponiumProgressBar.Visible = false; toolStripJumponiumProgressBar.Value = 0; // reset the jumponium progress dataGridViewScangrid.RowTemplate.MinimumHeight = Font.ScalePixels(64); // based on icon size bodysize = dataGridViewScangrid.RowTemplate.MinimumHeight; iconsize = bodysize / 4; dataGridViewScangrid.Rows.Clear(); var all_nodes = scannode.Bodies.ToList(); // flatten tree of scan nodes to prepare for listing var stars = 0; var planets = 0; var terrestrial = 0; var gasgiants = 0; var moons = 0; List <MaterialCommodityMicroResource> historicmcl = discoveryform.history.MaterialCommoditiesMicroResources.Get(last_he.MaterialCommodity); List <MaterialCommodityMicroResource> curmcl = discoveryform.history.MaterialCommoditiesMicroResources.GetLast(); HashSet <string> jumponiums = new HashSet <string>(); foreach (StarScan.ScanNode sn in all_nodes) { // define strings to be populated var bdClass = new StringBuilder(); var bdDist = new StringBuilder(); var bdDetails = new StringBuilder(); if (sn.NodeType == StarScan.ScanNodeType.ring) { // do nothing, by now } else if (sn.NodeType == StarScan.ScanNodeType.beltcluster) { // if have a scan, we show belts, and its not edsm body, or getting edsm if (sn.ScanData?.BodyName != null && IsSet(CtrlList.showBelts) && (!sn.ScanData.IsEDSMBody || checkBoxEDSM.Checked)) { bdClass.Clear(); bdClass.Append("Belt Cluster"); if (sn.ScanData.ScanType == "Detailed") { bdDetails.Append("Scanned"); } else { bdDetails.Append("No scan data available"); } if (Math.Abs(sn.ScanData.DistanceFromArrivalLS) > 0) { bdDist.AppendFormat("{0:0.00}AU ({1:0.0}ls)", sn.ScanData.DistanceFromArrivalLS / JournalScan.oneAU_LS, sn.ScanData.DistanceFromArrivalLS); } var img = global::EDDiscovery.Icons.Controls.Belt; dataGridViewScangrid.Rows.Add(new object[] { null, sn.ScanData.BodyDesignationOrName, bdClass, bdDist, bdDetails }); var cur = dataGridViewScangrid.Rows[dataGridViewScangrid.Rows.Count - 1]; cur.Tag = img; cur.Cells[0].Tag = null; cur.Cells[4].Tag = cur.Cells[0].ToolTipText = cur.Cells[1].ToolTipText = cur.Cells[2].ToolTipText = cur.Cells[3].ToolTipText = cur.Cells[4].ToolTipText = sn.ScanData.DisplayString(0, historicmcl, curmcl); } } // must have scan data and a name to be good, and either not edsm body or edsm check else if (sn.ScanData?.BodyName != null && (!sn.ScanData.IsEDSMBody || checkBoxEDSM.Checked)) { var overlays = new StarColumnOverlays(); if (sn.ScanData.IsStar) { // is a star, so populate its information field with relevant data stars++; // star class if (sn.ScanData.StarTypeText != null) { bdClass.Append(sn.ScanData.StarTypeText); } // is the main star? if (sn.ScanData.BodyName.EndsWith(" A", StringComparison.Ordinal)) { bdDist.AppendFormat("Main Star".T(EDTx.UserControlScanGrid_MainStar)); } // if not, then tell us its hierarchy leveland distance from main star else if (sn.ScanData.nSemiMajorAxis.HasValue) { if (sn.ScanData.IsStar || sn.ScanData.nSemiMajorAxis.Value > JournalScan.oneAU_m / 10) { bdDist.AppendFormat("{0:0.00}AU ({1:0.00}ls)", (sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneAU_m), sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneLS_m); } else { bdDist.AppendFormat("{0}km", (sn.ScanData.nSemiMajorAxis.Value / 1000).ToString("N1")); } } // display stellar bodies mass, in sols if (sn.ScanData.nStellarMass.HasValue) { bdDetails.Append("Mass".T(EDTx.UserControlScanGrid_Mass)).Append(": ").Append(sn.ScanData.nStellarMass.Value.ToString("N2")).Append(", "); } // display stellar bodies radius in sols if (sn.ScanData.nRadius.HasValue) { bdDetails.Append("Radius".T(EDTx.UserControlScanGrid_Radius)).Append(": ").Append((sn.ScanData.nRadius.Value / JournalScan.oneSolRadius_m).ToString("N2")).Append(", "); } // show the temperature if (sn.ScanData.nSurfaceTemperature.HasValue) { bdDetails.Append("Temperature".T(EDTx.UserControlScanGrid_Temperature)).Append(": ").Append((sn.ScanData.nSurfaceTemperature.Value)).Append("K."); } // habitable zone for stars - do not display for black holes. if (sn.ScanData.StarTypeID != EDStar.H) { if (IsSet(CtrlList.showHabitable)) { string hz = sn.ScanData.CircumstellarZonesString(false, JournalScan.CZPrint.CZHab); bdDetails.AppendFormat(Environment.NewLine + hz); } if (IsSet(CtrlList.showMetalRich)) { string hz = sn.ScanData.CircumstellarZonesString(false, JournalScan.CZPrint.CZMR); bdDetails.AppendFormat(Environment.NewLine + hz); } if (IsSet(CtrlList.showWaterWorlds)) { string hz = sn.ScanData.CircumstellarZonesString(false, JournalScan.CZPrint.CZWW); bdDetails.AppendFormat(Environment.NewLine + hz); } if (IsSet(CtrlList.showEarthLike)) { string hz = sn.ScanData.CircumstellarZonesString(false, JournalScan.CZPrint.CZEL); bdDetails.AppendFormat(Environment.NewLine + hz); } if (IsSet(CtrlList.showAmmonia)) { string hz = sn.ScanData.CircumstellarZonesString(false, JournalScan.CZPrint.CZAW); bdDetails.AppendFormat(Environment.NewLine + hz); } if (IsSet(CtrlList.showIcyBodies)) { string hz = sn.ScanData.CircumstellarZonesString(false, JournalScan.CZPrint.CZIP); bdDetails.AppendFormat(Environment.NewLine + hz); } } } else { // is a non-stellar body // is terraformable? If so, prepend it to the body class if (sn.ScanData.Terraformable) { bdClass.Append("Terraformable".T(EDTx.UserControlScanGrid_Terraformable)).Append(", "); } if (sn.NodeType == StarScan.ScanNodeType.body) // Planet, not barycenter/belt { bdClass.Append(sn.ScanData.PlanetTypeText); if (sn.Level <= 1) // top level planet { planets++; if (sn.ScanData.GasWorld) { gasgiants++; } else { terrestrial++; } bdDist.AppendFormat("{0:0.00}AU ({1:0.0}ls)", sn.ScanData.DistanceFromArrivalLS / JournalScan.oneAU_LS, sn.ScanData.DistanceFromArrivalLS); } else { moons++; bdClass.Append(" ").Append("Moon".T(EDTx.UserControlScanGrid_Moon)); // moon distances from center body are measured from in SemiMajorAxis if (sn.ScanData.nSemiMajorAxis.HasValue) { bdDist.AppendFormat("{0:0.0}ls ({1:0}km)", sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneLS_m, sn.ScanData.nSemiMajorAxis.Value / 1000); } } } // Details // display non-stellar bodies radius in earth radiuses if (sn.ScanData.nRadius.HasValue) { bdDetails.Append("Radius".T(EDTx.UserControlScanGrid_Radius)).Append(": ").Append((sn.ScanData.nRadius.Value / 1000.0).ToString("N0") + "km ("). Append((sn.ScanData.nRadius.Value / JournalScan.oneEarthRadius_m).ToString("N2")).Append("ER), "); } // show the temperature, both in K and C degrees if (sn.ScanData.nSurfaceTemperature.HasValue) { bdDetails.Append("Temperature".T(EDTx.UserControlScanGrid_Temperature)).Append(": ").Append((sn.ScanData.nSurfaceTemperature.Value).ToString("N2")).Append("K, (").Append((sn.ScanData.nSurfaceTemperature.Value - 273).ToString("N2")).Append("C)."); } // print the main atmospheric composition and pressure, if presents if (sn.ScanData.Atmosphere != "none") { bdDetails.Append(Environment.NewLine).Append(sn.ScanData.Atmosphere); if (sn.ScanData.nSurfacePressure.HasValue) { bdDetails.Append(", ").Append((sn.ScanData.nSurfacePressure.Value / JournalScan.oneAtmosphere_Pa).ToString("N3")).Append("Pa."); } } // tell us that a bodie is landable, and shows its gravity if (sn.ScanData.IsLandable) { var Gg = ""; if (sn.ScanData.nSurfaceGravity.HasValue) { var g = sn.ScanData.nSurfaceGravity / JournalScan.oneGee_m_s2; Gg = " (G: " + g.Value.ToString("N1") + ")"; } bdDetails.Append(Environment.NewLine).Append("Landable".T(EDTx.UserControlScanGrid_Landable)).Append(Gg).Append(". "); overlays.landable = true; } // tell us that there is some volcanic activity if (sn.ScanData.Volcanism.HasChars()) { bdDetails.Append(Environment.NewLine).Append("Geological activity".T(EDTx.UserControlScanGrid_Geologicalactivity)).Append(": ").Append(sn.ScanData.Volcanism).Append(". "); overlays.volcanism = true; } if (sn.ScanData.Mapped) { bdDetails.Append(Environment.NewLine).Append("Surface mapped".T(EDTx.UserControlScanGrid_Surfacemapped)).Append(". "); overlays.mapped = true; } if (sn.Organics != null) { string ol = JournalScanOrganic.OrganicList(sn.Organics); bdDetails.Append(Environment.NewLine).Append(ol); } // materials if (sn.ScanData.HasMaterials) { var ret = ""; foreach (KeyValuePair <string, double> mat in sn.ScanData.Materials) { var mc = MaterialCommodityMicroResourceType.GetByFDName(mat.Key); if (mc?.IsJumponium == true) { ret = ret.AppendPrePad(mc.Name, ", "); overlays.materials = true; } } if (ret.Length > 0 && IsSet(CtrlList.showMaterials)) { bdDetails.Append(Environment.NewLine).Append("This body contains: ".T(EDTx.UserControlScanGrid_BC)).Append(ret); } } } // have some belt, ring or other special structure? if (sn.ScanData.HasRings) { for (int r = 0; r < sn.ScanData.Rings.Length; r++) { if (sn.ScanData.Rings[r].Name.EndsWith("Belt", StringComparison.Ordinal)) { if (IsSet(CtrlList.showBelts)) { // is a belt bdDetails.Append(Environment.NewLine).Append("Belt: ".T(EDTx.UserControlScanGrid_Belt)); var RingName = sn.ScanData.Rings[r].Name; bdDetails.Append(JournalScan.StarPlanetRing.DisplayStringFromRingClass(sn.ScanData.Rings[r].RingClass)).Append(" "); bdDetails.Append((sn.ScanData.Rings[r].InnerRad / JournalScan.oneLS_m).ToString("N2")).Append("ls to ").Append((sn.ScanData.Rings[r].OuterRad / JournalScan.oneLS_m).ToString("N2")).Append("ls. "); } } else { if (IsSet(CtrlList.showRings)) { // is a ring bdDetails.Append(Environment.NewLine).Append("Ring: ".T(EDTx.UserControlScanGrid_Ring)); var RingName = sn.ScanData.Rings[r].Name; bdDetails.Append(JournalScan.StarPlanetRing.DisplayStringFromRingClass(sn.ScanData.Rings[r].RingClass)).Append(" "); bdDetails.Append((sn.ScanData.Rings[r].InnerRad / JournalScan.oneLS_m).ToString("N2")).Append("ls to ").Append((sn.ScanData.Rings[r].OuterRad / JournalScan.oneLS_m).ToString("N2")).Append("ls. "); } } } } // give estimated value if (IsSet(CtrlList.showValues)) { var value = sn.ScanData.EstimatedValue; bdDetails.Append(Environment.NewLine).Append("Value".T(EDTx.UserControlScanGrid_Value)).Append(" ").Append(value.ToString("N0")); } if (sn.ScanData.IsEDSMBody) { bdDetails.Append(Environment.NewLine).Append("EDSM"); } // pick an image Bitmap img = (Bitmap)BaseUtils.Icons.IconSet.GetIcon(sn.ScanData.GetStarPlanetTypeImageName()); dataGridViewScangrid.Rows.Add(new object[] { null, sn.ScanData.BodyDesignationOrName, bdClass, bdDist, bdDetails }); var cur = dataGridViewScangrid.Rows[dataGridViewScangrid.Rows.Count - 1]; cur.Tag = img; cur.Cells[0].Tag = overlays; cur.Cells[4].Tag = cur.Cells[0].ToolTipText = cur.Cells[1].ToolTipText = cur.Cells[2].ToolTipText = cur.Cells[3].ToolTipText = cur.Cells[4].ToolTipText = sn.ScanData.DisplayString(0, historicmcl, curmcl); sn.ScanData.Jumponium(jumponiums); // add to jumponiums hash any seen } } toolStripJumponiumProgressBar.Value = jumponiums.Count; toolStripJumponiumProgressBar.Visible = toolStripJumponiumProgressBar.Value > 0; //System.Diagnostics.Debug.WriteLine("Jumponiums " + toolStripJumponiumProgressBar.Value + " " + toolStripJumponiumProgressBar.Visible); if (toolStripJumponiumProgressBar.Value == 8) { toolStripJumponiumProgressBar.ToolTipText = "This is a green system, as it has all existing jumponium materials available!".T(EDTx.UserControlScanGrid_GS); } else { toolStripJumponiumProgressBar.ToolTipText = toolStripJumponiumProgressBar.Value + " jumponium materials found in system.".T(EDTx.UserControlScanGrid_JS); } string report = string.Format("Scan Summary for {0}: {1} stars; {2} planets ({3} terrestrial, {4} gas giants), {5} moons".T(EDTx.UserControlScanGrid_ScanSummaryfor), scannode.System.Name, stars, planets, terrestrial, gasgiants, moons); report = "~" + scannode.ScanValue(checkBoxEDSM.Checked).ToString() + " cr " + report; SetControlText(scannode.System.Name); toolStripStatusTotalValue.Text = report; if (firstdisplayedrow >= 0 && firstdisplayedrow < dataGridViewScangrid.RowCount) { dataGridViewScangrid.SafeFirstDisplayedScrollingRowIndex(firstdisplayedrow); } }
async private void DrawSystem(ISystem sys, string tt = null) { if (tt != null) { titletext = tt; SetControlText(tt); } pictureBoxSurveyor.ClearImageList(); // if system, and we are in no focus or don't care if (sys != null && (uistate == EliteDangerousCore.UIEvents.UIGUIFocus.Focus.NoFocus || !autoHideToolStripMenuItem.Checked || (uistate == EliteDangerousCore.UIEvents.UIGUIFocus.Focus.FSSMode && dontHideInFSSModeToolStripMenuItem.Checked))) { int vpos = 0; StringFormat frmt = new StringFormat(wordWrapToolStripMenuItem.Checked ? 0: StringFormatFlags.NoWrap); frmt.Alignment = alignment; var textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor; var backcolour = IsTransparent ? Color.Transparent : this.BackColor; if (!IsControlTextVisible() && showSystemInfoOnScreenWhenInTransparentModeToolStripMenuItem.Checked) { var i = pictureBoxSurveyor.AddTextAutoSize( new Point(3, vpos), new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 1000), titletext, Font, textcolour, backcolour, 1.0F, frmt: frmt); vpos += i.Location.Height; } StarScan.SystemNode systemnode = await discoveryform.history.starscan.FindSystemAsync(sys, checkEDSMForInformationToolStripMenuItem.Checked); // get data with EDSM if (systemnode != null) // no data, clear display, clear any last_he so samesys is false next time { string infoline = ""; int scanned = systemnode.StarPlanetsScanned(); if (scanned > 0) { infoline = "Scan".T(EDTx.UserControlSurveyor_Scan) + " " + scanned.ToString() + (systemnode.FSSTotalBodies != null ? (" / " + systemnode.FSSTotalBodies.Value.ToString()) : ""); } long value = systemnode.ScanValue(false); if (value > 0 && showValuesToolStripMenuItem.Checked) { infoline = infoline.AppendPrePad("~ " + value.ToString("N0") + " cr", "; "); } if (infoline.HasChars()) { var i = pictureBoxSurveyor.AddTextAutoSize( new Point(3, vpos), new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 1000), infoline, Font, textcolour, backcolour, 1.0F, frmt: frmt); vpos += i.Location.Height; } var all_nodes = systemnode.Bodies.ToList(); if (all_nodes != null) { value = 0; foreach (StarScan.ScanNode sn in all_nodes) { if (sn.ScanData != null && sn.ScanData?.BodyName != null) { var sd = sn.ScanData; if ((sd.AmmoniaWorld && ammoniaWorldToolStripMenuItem.Checked) || (sd.Earthlike && earthlikeWorldToolStripMenuItem.Checked) || (sd.WaterWorld && waterWorldToolStripMenuItem.Checked) || (sd.HasRings && !sd.AmmoniaWorld && !sd.Earthlike && !sd.WaterWorld && hasRingsToolStripMenuItem.Checked) || (sd.HasMeaningfulVolcanism && hasVolcanismToolStripMenuItem.Checked) || (sd.Terraformable && terraformableToolStripMenuItem.Checked) || (lowRadiusToolStripMenuItem.Checked && sd.nRadius.HasValue && sd.nRadius < lowRadiusLimit) || (sn.Signals != null && hasSignalsToolStripMenuItem.Checked) || (sd.IsStar && showAllStarsToolStripMenuItem.Checked) || (sd.IsPlanet && showAllPlanetsToolStripMenuItem.Checked) || (sd.IsBeltCluster && showBeltClustersToolStripMenuItem.Checked) ) { if (!sd.Mapped || hideAlreadyMappedBodiesToolStripMenuItem.Checked == false) // if not mapped, or show mapped { var i = pictureBoxSurveyor.AddTextAutoSize( new Point(3, vpos), new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 1000), InfoLine(last_sys, sn, sd), Font, textcolour, backcolour, 1.0F, frmt: frmt); vpos += i.Location.Height; value += sd.EstimatedValue; } } } } if (value > 0 && showValuesToolStripMenuItem.Checked) { var i = pictureBoxSurveyor.AddTextAutoSize( new Point(3, vpos), new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 1000), "^^ ~ " + value.ToString("N0") + " cr", Font, textcolour, backcolour, 1.0F, frmt: frmt); vpos += i.Location.Height; } } } } pictureBoxSurveyor.Render(); }
private async void DrawSystem(HistoryEntry he, bool force) { StarScan.SystemNode scannode = null; var samesys = last_he?.System != null && he?.System != null && he.System.Name == last_he.System.Name; //System.Diagnostics.Debug.WriteLine("Scan grid " + samesys + " F:" + force); if (he == null) // no he, no display { last_he = he; dataGridViewScangrid.Rows.Clear(); SetControlText("No Scan".T(EDTx.NoScan)); return; } else { scannode = await discoveryform.history.starscan.FindSystemAsync(he.System, true); // get data with EDSM if (scannode == null) // no data, clear display, clear any last_he so samesys is false next time { last_he = null; dataGridViewScangrid.Rows.Clear(); SetControlText("No Scan".T(EDTx.NoScan)); return; } if (samesys && !force) // same system, no force, no redisplay { return; } } last_he = he; // only record first row if same system var firstdisplayedrow = (dataGridViewScangrid.RowCount > 0 && samesys) ? dataGridViewScangrid.FirstDisplayedScrollingRowIndex : -1; dataGridViewScangrid.RowTemplate.MinimumHeight = Font.ScalePixels(64); // based on icon size bodysize = dataGridViewScangrid.RowTemplate.MinimumHeight; iconsize = bodysize / 4; dataGridViewScangrid.Rows.Clear(); var all_nodes = scannode.Bodies.ToList(); // flatten tree of scan nodes to prepare for listing var stars = 0; var planets = 0; var terrestrial = 0; var gasgiants = 0; var moons = 0; foreach (StarScan.ScanNode sn in all_nodes) { // define strings to be populated var bdClass = new StringBuilder(); var bdDist = new StringBuilder(); var bdDetails = new StringBuilder(); if (sn.type == StarScan.ScanNodeType.ring) { // do nothing, by now } else if (sn.type == StarScan.ScanNodeType.beltcluster) { if (showStructures && sn.ScanData?.BodyName != null) { if (showBelts) { bdClass.Clear(); bdClass.Append("Belt Cluster"); if (sn.ScanData.ScanType == "Detailed") { bdDetails.Append("Scanned"); } else { bdDetails.Append("No scan data available"); } if (Math.Abs(sn.ScanData.DistanceFromArrivalLS) > 0) { bdDist.AppendFormat("{0:0.00}AU ({1:0.0}ls)", sn.ScanData.DistanceFromArrivalLS / JournalScan.oneAU_LS, sn.ScanData.DistanceFromArrivalLS); } var img = global::EDDiscovery.Icons.Controls.ScanGrid_Belt; dataGridViewScangrid.Rows.Add(new object[] { null, sn.ScanData.BodyName, bdClass, bdDist, bdDetails }); var cur = dataGridViewScangrid.Rows[dataGridViewScangrid.Rows.Count - 1]; cur.Tag = img; cur.Cells[0].Tag = null; cur.Cells[4].Tag = cur.Cells[0].ToolTipText = cur.Cells[1].ToolTipText = cur.Cells[2].ToolTipText = cur.Cells[3].ToolTipText = cur.Cells[4].ToolTipText = sn.ScanData.DisplayString(historicmatlist: last_he.MaterialCommodity, currentmatlist: discoveryform.history.GetLast?.MaterialCommodity); } } } else { var overlays = new Overlays(); // check for null data if (sn.ScanData?.BodyName != null) { // check for body class if (sn.ScanData.IsStar) { // is a star, so populate its information field with relevant data stars++; // star class if (sn.ScanData.StarTypeText != null) { bdClass.Append(sn.ScanData.StarTypeText); } // is the main star? if (sn.ScanData.BodyName.EndsWith(" A", StringComparison.Ordinal)) { bdDist.AppendFormat("Main Star".T(EDTx.UserControlScanGrid_MainStar)); } // if not, then tell us its hierarchy leveland distance from main star else if (sn.ScanData.nSemiMajorAxis.HasValue) { if (sn.ScanData.IsStar || sn.ScanData.nSemiMajorAxis.Value > JournalScan.oneAU_m / 10) { bdDist.AppendFormat("{0:0.00}AU ({1:0.00}ls)", (sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneAU_m), sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneLS_m); } else { bdDist.AppendFormat("{0}km", (sn.ScanData.nSemiMajorAxis.Value / 1000).ToString("N1")); } } // display stellar bodies mass, in sols if (sn.ScanData.nStellarMass.HasValue) { bdDetails.Append("Mass".T(EDTx.UserControlScanGrid_Mass)).Append(": ").Append(sn.ScanData.nStellarMass.Value.ToString("N2")).Append(", "); } // display stellar bodies radius in sols if (sn.ScanData.nRadius.HasValue) { bdDetails.Append("Radius".T(EDTx.UserControlScanGrid_Radius)).Append(": ").Append((sn.ScanData.nRadius.Value / JournalScan.oneSolRadius_m).ToString("N2")).Append(", "); } // show the temperature if (sn.ScanData.nSurfaceTemperature.HasValue) { bdDetails.Append("Temperature".T(EDTx.UserControlScanGrid_Temperature)).Append(": ").Append((sn.ScanData.nSurfaceTemperature.Value)).Append("K."); } // habitable zone for stars - do not display for black holes. if (showStellarZones) { if (showHabitable && sn.ScanData.HabitableZoneInner != null && sn.ScanData.HabitableZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H) { bdDetails.AppendFormat(Environment.NewLine + "Habitable Zone".T(EDTx.UserControlScanGrid_HabitableZone) + ": {0}-{1}AU ({2}). ", (sn.ScanData.HabitableZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.HabitableZoneOuter.Value / JournalScan.oneAU_LS).ToString("N2"), sn.ScanData.GetHabZoneStringLs()); } if (showMetalRich && sn.ScanData.MetalRichZoneInner != null && sn.ScanData.MetalRichZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H) { bdDetails.AppendFormat(Environment.NewLine + "Metal Rich bodies".T(EDTx.UserControlScanGrid_MetalRichbodies) + ": {0}-{1}AU ({2}). ", (sn.ScanData.MetalRichZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.MetalRichZoneOuter.Value / JournalScan.oneAU_LS).ToString("N2"), sn.ScanData.GetMetalRichZoneStringLs()); } if (showWaterWorlds && sn.ScanData.WaterWrldZoneInner != null && sn.ScanData.WaterWrldZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H) { bdDetails.AppendFormat(Environment.NewLine + "Water worlds".T(EDTx.UserControlScanGrid_Waterworlds) + ": {0}-{1}AU ({2}). ", (sn.ScanData.WaterWrldZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.WaterWrldZoneOuter.Value / JournalScan.oneAU_LS).ToString("N2"), sn.ScanData.GetWaterWorldZoneStringLs()); } if (showEarthLike && sn.ScanData.EarthLikeZoneInner != null && sn.ScanData.EarthLikeZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H) { bdDetails.AppendFormat(Environment.NewLine + "Earth likes planets".T(EDTx.UserControlScanGrid_Earthlikesplanets) + ": {0}-{1}AU ({2}). ", (sn.ScanData.EarthLikeZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.EarthLikeZoneOuter.Value / JournalScan.oneAU_LS).ToString("N2"), sn.ScanData.GetEarthLikeZoneStringLs()); } if (showAmmonia && sn.ScanData.AmmonWrldZoneInner != null && sn.ScanData.AmmonWrldZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H) { bdDetails.AppendFormat(Environment.NewLine + "Ammonia worlds".T(EDTx.UserControlScanGrid_Ammoniaworlds) + ": {0}-{1}AU ({2}). ", (sn.ScanData.AmmonWrldZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.AmmonWrldZoneOuter.Value / JournalScan.oneAU_LS).ToString("N2"), sn.ScanData.GetAmmoniaWorldZoneStringLs()); } if (showIcyBodies && sn.ScanData.IcyPlanetZoneInner != null && sn.ScanData.IcyPlanetZoneOuter != null && sn.ScanData.StarTypeID != EDStar.H) { bdDetails.AppendFormat(Environment.NewLine + "Habitable Zone".T(EDTx.UserControlScanGrid_HabitableZone) + ": {0}AU-{1} ({2}). ", (sn.ScanData.IcyPlanetZoneInner.Value / JournalScan.oneAU_LS).ToString("N2"), (sn.ScanData.IcyPlanetZoneOuter), sn.ScanData.GetIcyPlanetsZoneStringLs()); } } } else { // is a non-stellar body // is terraformable? If so, prepend it to the body class if (sn.ScanData.Terraformable) { bdClass.Append("Terraformable".T(EDTx.UserControlScanGrid_Terraformable)).Append(", "); } // is a planet?... if (sn.ScanData.PlanetClass != null) { bdClass.Append(sn.ScanData.PlanetClass); } planets++; // tell us the distance from the arrivals in both AU and LS if (sn.level <= 1 && sn.type == StarScan.ScanNodeType.body) { bdDist.AppendFormat("{0:0.00}AU ({1:0.0}ls)", sn.ScanData.DistanceFromArrivalLS / JournalScan.oneAU_LS, sn.ScanData.DistanceFromArrivalLS); } // ...or a moon? if (sn.level >= 2 && sn.type == StarScan.ScanNodeType.body) { if (sn.ScanData.PlanetClass != null) { moons++; } bdClass.Append(" ").Append("Moon".T(EDTx.UserControlScanGrid_Moon)); // moon distances from center body are measured from in SemiMajorAxis if (sn.ScanData.nSemiMajorAxis.HasValue) { bdDist.AppendFormat("{0:0.0}ls ({1:0}km)", sn.ScanData.nSemiMajorAxis.Value / JournalScan.oneLS_m, sn.ScanData.nSemiMajorAxis.Value / 1000); } } if (sn.ScanData.PlanetClass != null && sn.ScanData.PlanetClass.Contains("Giant")) { gasgiants++; } else { terrestrial++; } // Details // display non-stellar bodies radius in earth radiuses if (sn.ScanData.nRadius.HasValue) { bdDetails.Append("Radius".T(EDTx.UserControlScanGrid_Radius)).Append(": ").Append((sn.ScanData.nRadius.Value / JournalScan.oneEarthRadius_m).ToString("N2")).Append(", "); } // show the temperature, both in K and C degrees if (sn.ScanData.nSurfaceTemperature.HasValue) { bdDetails.Append("Temperature".T(EDTx.UserControlScanGrid_Temperature)).Append(": ").Append((sn.ScanData.nSurfaceTemperature.Value).ToString("N2")).Append("K, (").Append((sn.ScanData.nSurfaceTemperature.Value - 273).ToString("N2")).Append("C)."); } // print the main atmospheric composition and pressure, if presents if (!String.IsNullOrEmpty(sn.ScanData.Atmosphere) && sn.ScanData.Atmosphere != "None") { bdDetails.Append(Environment.NewLine).Append(sn.ScanData.Atmosphere); if (sn.ScanData.nSurfacePressure.HasValue) { bdDetails.Append(", ").Append((sn.ScanData.nSurfacePressure.Value / JournalScan.oneAtmosphere_Pa).ToString("N3")).Append("Pa."); } } // tell us that a bodie is landable, and shows its gravity if (sn.ScanData.IsLandable) { var Gg = ""; if (sn.ScanData.nSurfaceGravity.HasValue) { var g = sn.ScanData.nSurfaceGravity / JournalScan.oneGee_m_s2; Gg = " (G: " + g.Value.ToString("N1") + ")"; } bdDetails.Append(Environment.NewLine).Append("Landable".T(EDTx.UserControlScanGrid_Landable)).Append(Gg).Append(". "); overlays.landable = true; } // tell us that there is some volcanic activity if (sn.ScanData.Volcanism != null) { bdDetails.Append(Environment.NewLine).Append("Geological activity".T(EDTx.UserControlScanGrid_Geologicalactivity)).Append(": ").Append(sn.ScanData.Volcanism).Append(". "); overlays.volcanism = true; } if (sn.ScanData.Mapped) { bdDetails.Append(Environment.NewLine).Append("Surface mapped".T(EDTx.UserControlScanGrid_Surfacemapped)).Append(". "); overlays.mapped = true; } // materials if (sn.ScanData.HasMaterials) { toolStripProgressBar.Visible = true; var ret = ""; foreach (KeyValuePair <string, double> mat in sn.ScanData.Materials) { var mc = MaterialCommodityData.GetByFDName(mat.Key); if (mc?.IsJumponium == true) { ret = ret.AppendPrePad(mc.Name, ", "); overlays.materials = true; } } if (ret.Length > 0 && showMaterials) { bdDetails.Append(Environment.NewLine).Append("This body contains: ".T(EDTx.UserControlScanGrid_BC)).Append(ret); } ReportJumponium(ret); } } // have some belt, ring or other special structure? if (showStructures) { if (sn.ScanData.HasRings) { for (int r = 0; r < sn.ScanData.Rings.Length; r++) { if (sn.ScanData.Rings[r].Name.EndsWith("Belt", StringComparison.Ordinal)) { if (showBelts) { // is a belt bdDetails.Append(Environment.NewLine).Append("Belt: ".T(EDTx.UserControlScanGrid_Belt)); var RingName = sn.ScanData.Rings[r].Name; bdDetails.Append(JournalScan.StarPlanetRing.DisplayStringFromRingClass(sn.ScanData.Rings[r].RingClass)).Append(" "); bdDetails.Append((sn.ScanData.Rings[r].InnerRad / JournalScan.oneLS_m).ToString("N2")).Append("ls to ").Append((sn.ScanData.Rings[r].OuterRad / JournalScan.oneLS_m).ToString("N2")).Append("ls. "); } } else { if (showRings) { // is a ring bdDetails.Append(Environment.NewLine).Append("Ring: ".T(EDTx.UserControlScanGrid_Ring)); var RingName = sn.ScanData.Rings[r].Name; bdDetails.Append(JournalScan.StarPlanetRing.DisplayStringFromRingClass(sn.ScanData.Rings[r].RingClass)).Append(" "); bdDetails.Append((sn.ScanData.Rings[r].InnerRad / JournalScan.oneLS_m).ToString("N2")).Append("ls to ").Append((sn.ScanData.Rings[r].OuterRad / JournalScan.oneLS_m).ToString("N2")).Append("ls. "); } } } } } //! for all relevant bodies: // give estimated value if (showValues) { var value = sn.ScanData.EstimatedValue; bdDetails.Append(Environment.NewLine).Append("Value".T(EDTx.UserControlScanGrid_Value)).Append(" ").Append(value.ToString("N0")); } // pick an image var img = sn.ScanData.IsStar ? sn.ScanData.GetStarTypeImage() : sn.ScanData.GetPlanetClassImage(); dataGridViewScangrid.Rows.Add(new object[] { null, sn.ScanData.BodyName, bdClass, bdDist, bdDetails }); var cur = dataGridViewScangrid.Rows[dataGridViewScangrid.Rows.Count - 1]; cur.Tag = img; cur.Cells[0].Tag = overlays; cur.Cells[4].Tag = cur.Cells[0].ToolTipText = cur.Cells[1].ToolTipText = cur.Cells[2].ToolTipText = cur.Cells[3].ToolTipText = cur.Cells[4].ToolTipText = sn.ScanData.DisplayString(historicmatlist: last_he.MaterialCommodity, currentmatlist: discoveryform.history.GetLast?.MaterialCommodity); } } // check if it's a green system isGreenSystem |= (hasArsenic && hasCadmium && hasCarbon && hasGermanium && hasNiobium && hasPopolonium && hasVanadium && hasYttrium); if (isGreenSystem) { toolStripProgressBar.ToolTipText = "This is a green system, as it has all existing jumponium materials available!".T(EDTx.UserControlScanGrid_GS); toolStripStatusGreen.Visible = true; } else if (!isGreenSystem) { toolStripProgressBar.ToolTipText = toolStripProgressBar.Value + " jumponium materials found in system.".T(EDTx.UserControlScanGrid_JS); } // set a meaningful title for the controller SetControlText(string.Format("Scan Summary for {0}: {1} stars; {2} planets ({3} terrestrial, {4} gas giants), {5} moons".T(EDTx.UserControlScanGrid_ScanSummaryfor), scannode.system.Name, stars, planets, terrestrial, gasgiants, moons)); if (firstdisplayedrow >= 0 && firstdisplayedrow < dataGridViewScangrid.RowCount) { dataGridViewScangrid.SafeFirstDisplayedScrollingRowIndex(firstdisplayedrow); } toolStripStatusTotalValue.Text = "~" + scannode.ScanValue(true).ToString() + " cr"; } }
async private void DrawSystem(ISystem sys, string tt = null) { if (tt != null) { titletext = tt; SetControlText(tt); } pictureBoxSurveyor.ClearImageList(); // if system, and we are in no focus or don't care if (sys != null && (uistate == EliteDangerousCore.UIEvents.UIGUIFocus.Focus.NoFocus || !autoHideToolStripMenuItem.Checked || (uistate == EliteDangerousCore.UIEvents.UIGUIFocus.Focus.FSSMode && dontHideInFSSModeToolStripMenuItem.Checked))) { int vpos = 0; StringFormat frmt = new StringFormat(wordWrapToolStripMenuItem.Checked ? 0: StringFormatFlags.NoWrap); frmt.Alignment = alignment; var textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor; var backcolour = IsTransparent ? Color.Transparent : this.BackColor; if (!IsControlTextVisible() && showSystemInfoOnScreenWhenInTransparentModeToolStripMenuItem.Checked) { var i = pictureBoxSurveyor.AddTextAutoSize( new Point(3, vpos), new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 10000), titletext, Font, textcolour, backcolour, 1.0F, frmt: frmt); vpos += i.Location.Height; } StarScan.SystemNode systemnode = await discoveryform.history.StarScan.FindSystemAsync(sys, checkEDSMForInformationToolStripMenuItem.Checked); // get data with EDSM if (systemnode != null) // no data, clear display, clear any last_he so samesys is false next time { string infoline = ""; int scanned = systemnode.StarPlanetsScanned(); if (scanned > 0) { infoline = "Scan".T(EDTx.UserControlSurveyor_Scan) + " " + scanned.ToString() + (systemnode.FSSTotalBodies != null ? (" / " + systemnode.FSSTotalBodies.Value.ToString()) : ""); } long value = systemnode.ScanValue(false); if (value > 0 && showValuesToolStripMenuItem.Checked) { infoline = infoline.AppendPrePad("~ " + value.ToString("N0") + " cr", "; "); } if (infoline.HasChars()) { //System.Diagnostics.Debug.WriteLine("Draw " + infoline); var i = pictureBoxSurveyor.AddTextAutoSize( new Point(3, vpos), new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 10000), infoline, Font, textcolour, backcolour, 1.0F, frmt: frmt); vpos += i.Location.Height; } var all_nodes = systemnode.Bodies.ToList(); if (all_nodes != null) { value = 0; foreach (StarScan.ScanNode sn in all_nodes) { if (sn.ScanData != null && sn.ScanData?.BodyName != null && (!sn.ScanData.IsEDSMBody || checkEDSMForInformationToolStripMenuItem.Checked)) { var sd = sn.ScanData; if ( (sd.IsLandable && landableToolStripMenuItem.Checked) || (sd.IsLandable && sd.HasAtmosphericComposition && landableWithAtmosphereToolStripMenuItem.Checked) || (sd.IsLandable && sd.HasMeaningfulVolcanism && landableWithVolcanismToolStripMenuItem.Checked) || (sd.IsLandable && sd.nRadius.HasValue && sd.nRadius >= largeRadiusLimit && landableAndLargeToolStripMenuItem.Checked) || (sd.AmmoniaWorld && ammoniaWorldToolStripMenuItem.Checked) || (sd.Earthlike && earthlikeWorldToolStripMenuItem.Checked) || (sd.WaterWorld && waterWorldToolStripMenuItem.Checked) || (sd.PlanetTypeID == EDPlanet.High_metal_content_body && highMetalContentBodyToolStripMenuItem.Checked) || (sd.PlanetTypeID == EDPlanet.Metal_rich_body && metalToolStripMenuItem.Checked) || (sd.HasRings && hasRingsToolStripMenuItem.Checked) || (sd.HasMeaningfulVolcanism && hasVolcanismToolStripMenuItem.Checked) || (sd.nEccentricity.HasValue && sd.nEccentricity >= eccentricityLimit && highEccentricityToolStripMenuItem.Checked) || (sd.CanBeTerraformable && terraformableToolStripMenuItem.Checked) || (sd.IsPlanet && lowRadiusToolStripMenuItem.Checked && sd.nRadius.HasValue && sd.nRadius < lowRadiusLimit) || (sn.Signals != null && hasSignalsToolStripMenuItem.Checked) || (sd.IsStar && showAllStarsToolStripMenuItem.Checked) || (sd.IsPlanet && showAllPlanetsToolStripMenuItem.Checked) || (sd.IsBeltCluster && showBeltClustersToolStripMenuItem.Checked)) { if (!sd.Mapped || hideAlreadyMappedBodiesToolStripMenuItem.Checked == false) // if not mapped, or show mapped { var il = InfoLine(last_sys, sn, sd, hasVolcanismToolStripMenuItem.Checked, showValuesToolStripMenuItem.Checked, showMoreInformationToolStripMenuItem.Checked, showGravityToolStripMenuItem.Checked); //System.Diagnostics.Debug.WriteLine("Display " + il); var i = pictureBoxSurveyor.AddTextAutoSize( new Point(3, vpos), new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 10000), il, Font, textcolour, backcolour, 1.0F, frmt: frmt); vpos += i.Location.Height; value += sd.EstimatedValue; } } } } if (value > 0 && showValuesToolStripMenuItem.Checked) { var i = pictureBoxSurveyor.AddTextAutoSize( new Point(3, vpos), new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 10000), "^^ ~ " + value.ToString("N0") + " cr", Font, textcolour, backcolour, 1.0F, frmt: frmt); vpos += i.Location.Height; } } if (fsssignalsdisplayed.HasChars()) { string siglist = ""; string[] filter = fsssignalsdisplayed.Split(';'); // mirrors scandisplaynodes var notexpired = systemnode.FSSSignalList.Where(x => !x.TimeRemaining.HasValue || x.ExpiryUTC >= DateTime.UtcNow).ToList(); notexpired.Sort(delegate(JournalFSSSignalDiscovered.FSSSignal l, JournalFSSSignalDiscovered.FSSSignal r) { return(l.ClassOfSignal.CompareTo(r.ClassOfSignal)); }); var expired = systemnode.FSSSignalList.Where(x => x.TimeRemaining.HasValue && x.ExpiryUTC < DateTime.UtcNow).ToList(); expired.Sort(delegate(JournalFSSSignalDiscovered.FSSSignal l, JournalFSSSignalDiscovered.FSSSignal r) { return(r.ExpiryUTC.CompareTo(l.ExpiryUTC)); }); int expiredpos = notexpired.Count; notexpired.AddRange(expired); int pos = 0; foreach (var fsssig in notexpired) { if (filter.ComparisionContains(fsssig.SignalName.Alt("!~~"), StringComparison.InvariantCultureIgnoreCase) >= 0 || filter.ComparisionContains(fsssig.SignalName_Localised.Alt("!~~"), StringComparison.InvariantCultureIgnoreCase) >= 0 || filter.ComparisionContains(fsssig.SpawningState_Localised.Alt("!~~"), StringComparison.InvariantCultureIgnoreCase) >= 0 || filter.ComparisionContains(fsssig.SpawningFaction_Localised.Alt("!~~"), StringComparison.InvariantCultureIgnoreCase) >= 0 || filter.ComparisionContains(fsssig.USSTypeLocalised.Alt("!~~"), StringComparison.InvariantCultureIgnoreCase) >= 0 || filter.ComparisionContains(fsssig.ClassOfSignal.ToString(), StringComparison.InvariantCultureIgnoreCase) >= 0 || fsssignalsdisplayed.Equals("*")) { if (pos++ == expiredpos) { siglist = siglist.AppendPrePad("Expired:".T(EDTx.UserControlScan_Expired), Environment.NewLine + Environment.NewLine); } siglist = siglist.AppendPrePad(fsssig.ToString(true), Environment.NewLine); } } if (siglist.HasChars()) { //System.Diagnostics.Debug.WriteLine("Display " + siglist); pictureBoxSurveyor.AddTextAutoSize(new Point(3, vpos), new Size(Math.Max(pictureBoxSurveyor.Width - 6, 24), 10000), siglist, Font, textcolour, backcolour, 1.0F, frmt: frmt); } } } } extPictureBoxScroll.Render(); }
public static void ShowScanOrMarketForm(Form parent, Object tag, bool checkedsm, HistoryList hl) // tag can be a Isystem or an He.. output depends on it. { Type ty = typeof(ScanDisplayForm); if (tag == null) { return; } ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm(); int width = Math.Max(250, parent.Width * 4 / 5); int height = 800; HistoryEntry he = tag as HistoryEntry; // is tag HE? ISystem sys = he != null ? he.System : tag as ISystem; // if so, sys is he.system, else its a direct sys ScanDisplayControl sd = null; string title = "System".Tx(ty, "Sys") + ": " + sys.Name; if (he != null && (he.EntryType == JournalTypeEnum.Market || he.EntryType == JournalTypeEnum.EDDCommodityPrices)) // station data.. { JournalCommodityPricesBase jm = he.journalEntry as JournalCommodityPricesBase; jm.FillInformation(out string info, out string detailed, 1); f.Add(new ExtendedControls.ConfigurableForm.Entry("RTB", typeof(ExtendedControls.ExtRichTextBox), detailed, new Point(0, 40), new Size(width - 20, height - 85), null)); title += ", " + "Station".Tx(ty) + ": " + jm.Station; } else { sd = new ScanDisplayControl(); sd.CheckEDSM = checkedsm; sd.ShowMoons = sd.ShowMaterials = sd.ShowOverlays = true; sd.SetSize(48); sd.Size = new Size(width - 20, 1024); StarScan.SystemNode data = sd.FindSystem(sys, hl); if (data != null) { long value = data.ScanValue(sd.CheckEDSM); title += " ~ " + value.ToString("N0") + " cr"; } sd.BackColor = EDDTheme.Instance.Form; sd.DrawSystem(data, null, hl); height = Math.Min(800, Math.Max(400, sd.DisplayAreaUsed.Y)) + 100; f.Add(new ExtendedControls.ConfigurableForm.Entry("Sys", null, null, new Point(0, 40), new Size(width - 20, height - 85), null) { control = sd }); } f.Add(new ExtendedControls.ConfigurableForm.Entry("OK", typeof(ExtendedControls.ExtButton), "OK".Tx(), new Point(width - 20 - 80, height - 40), new Size(80, 24), "")); f.Trigger += (dialogname, controlname, ttag) => { if (controlname == "OK" || controlname == "Cancel") { f.Close(); } }; f.Init(parent.Icon, new Size(width, height), new Point(-999, -999), title, null, null); f.Show(parent); }
public static void ShowScanOrMarketForm(Form parent, Object tag, bool checkedsm, HistoryList hl) // tag can be a Isystem or an He.. output depends on it. { Type ty = typeof(ScanDisplayForm); if (tag == null) { return; } ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm(); Size infosize = parent.SizeWithinScreen(new Size(parent.Width * 2 / 4, parent.Height * 2 / 4), 128, 128 + 100); // go for this, but allow this around window int topmargin = 40; HistoryEntry he = tag as HistoryEntry; // is tag HE? ISystem sys = he != null ? he.System : tag as ISystem; // if so, sys is he.system, else its a direct sys ScanDisplayUserControl sd = null; string title = "System".Tx(ty, "Sys") + ": " + sys.Name; AutoScaleMode asm = AutoScaleMode.Font; if (he != null && (he.EntryType == JournalTypeEnum.Market || he.EntryType == JournalTypeEnum.EDDCommodityPrices)) // station data.. { JournalCommodityPricesBase jm = he.journalEntry as JournalCommodityPricesBase; jm.FillInformation(out string info, out string detailed, 1); f.Add(new ExtendedControls.ConfigurableForm.Entry("RTB", typeof(ExtendedControls.ExtRichTextBox), detailed, new Point(0, topmargin), infosize, null)); title += ", " + "Station".Tx(ty) + ": " + jm.Station; } else { sd = new ScanDisplayUserControl(); sd.CheckEDSM = checkedsm; sd.ShowMoons = sd.ShowMaterials = sd.ShowOverlays = true; int selsize = (int)(EDDTheme.Instance.GetFont.Height / 16.0f * 48.0f); sd.SetSize(selsize); sd.Size = infosize; StarScan.SystemNode data = sd.FindSystem(sys, hl); if (data != null) { long value = data.ScanValue(sd.CheckEDSM); title += " ~ " + value.ToString("N0") + " cr"; } sd.BackColor = EDDTheme.Instance.Form; sd.DrawSystem(data, null, hl); infosize = new Size(Math.Max(400, sd.DisplayAreaUsed.X), Math.Max(200, sd.DisplayAreaUsed.Y)); asm = AutoScaleMode.None; // because we are using a picture box, it does not autoscale, so we can't use that logic on it. f.Add(new ExtendedControls.ConfigurableForm.Entry("Sys", null, null, new Point(0, topmargin), infosize, null) { control = sd }); } f.Add(new ExtendedControls.ConfigurableForm.Entry("OK", typeof(ExtendedControls.ExtButton), "OK".Tx(), new Point(infosize.Width - 120, topmargin + infosize.Height + 10), new Size(100, 24), "")); f.Trigger += (dialogname, controlname, ttag) => { if (controlname == "OK" || controlname == "Cancel") { f.Close(); } }; f.InitCentred(parent, parent.Icon, title, null, null, asm); f.Show(parent); }