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); sd.DrawSystem(sys, 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 override bool ExecuteAction(ActionProgramRun ap) { List <string> ctrl = FromString(UserData); if (ctrl != null) { List <string> exp; if (ap.functions.ExpandStrings(ctrl, out exp) != Functions.ExpandResult.Failed) { Variables cv = ap.variables.FilterVars(exp[3] + "*"); ExtendedControls.ConfigurableForm cd = new ExtendedControls.ConfigurableForm(); foreach (string k in cv.NameList) { string errmsg = cd.Add(cv[k]); if (errmsg != null) { return(ap.ReportError(errmsg + " in " + k + " variable for Dialog")); } } StringParser sp2 = new StringParser(exp[2]); int? dw = sp2.NextWordComma().InvariantParseIntNull(); int? dh = sp2.NextWordComma().InvariantParseIntNull(); int? x = sp2.NextWordComma().InvariantParseIntNull(); int? y = sp2.NextWord().InvariantParseIntNull(); if (dw != null && dh != null && ((x == null) == (y == null))) // need w/h, must have either no pos or both pos { if (IsModalDialog()) { ap.dialogs[exp[0]] = cd; } else { ap.actionfile.dialogs[exp[0]] = cd; } cd.Trigger += Cd_Trigger; if (x != null && y != null) { cd.Init(new System.Drawing.Point(x.Value, y.Value), ap.actioncontroller.Icon, exp[1], exp[0], new List <Object>() { ap, IsModalDialog() }, // logical name and tag closeicon: true ); } else { cd.InitCentred(ap.actioncontroller.Form, ap.actioncontroller.Icon, exp[1], exp[0], new List <Object>() { ap, IsModalDialog() }, // logical name and tag closeicon: true ); } cd.Show(ap.actioncontroller.Form); return(!IsModalDialog()); // modal, return false, STOP. Non modal, continue } else { ap.ReportError("Width/Height and/or X/Y not specified correctly in Dialog"); } } else { ap.ReportError(exp[0]); } } else { ap.ReportError("Dialog command line not in correct format"); } return(true); }
public override bool ExecuteAction(ActionProgramRun ap) { List <string> ctrl = FromString(UserData); if (ctrl != null) { List <string> exp; if (ap.Functions.ExpandStrings(ctrl, out exp) != Functions.ExpandResult.Failed) { Variables cv = ap.variables.FilterVars(exp[3] + "*"); ExtendedControls.ConfigurableForm cd = new ExtendedControls.ConfigurableForm(); foreach (string k in cv.NameList) { string errmsg = cd.Add(cv[k]); if (errmsg != null) { return(ap.ReportError(errmsg + " in " + k + " variable for Dialog")); } } StringParser sp2 = new StringParser(exp[2]); int? dw = sp2.NextWordComma().InvariantParseIntNull(); int? dh = sp2.NextWordComma().InvariantParseIntNull(); int? x = sp2.NextWordComma().InvariantParseIntNull(); int? y = sp2.NextWordComma().InvariantParseIntNull(); int? mw = sp2.NextWordComma().InvariantParseIntNull(); int? mh = sp2.NextWordComma().InvariantParseIntNull(); if (dw != null && dh != null && ((x == null) == (y == null))) // need w/h, must have either no pos or both pos { bool closeicon = true, alwaysontop = false; for (int i = 4; i < exp.Count; i++) { if (exp[i].Equals("AllowResize", StringComparison.InvariantCultureIgnoreCase)) { cd.AllowResize = true; } else if (exp[i].Equals("Transparent", StringComparison.InvariantCultureIgnoreCase)) { cd.Transparent = true; } else if (exp[i].Equals("NoCloseIcon", StringComparison.InvariantCultureIgnoreCase)) { closeicon = false; } else if (exp[i].Equals("AlwaysOnTop", StringComparison.InvariantCultureIgnoreCase)) { alwaysontop = true; } else if (exp[i].Equals("NoWindowsBorder", StringComparison.InvariantCultureIgnoreCase)) { cd.ForceNoWindowsBorder = true; } else if (exp[i].Equals("NoPanelBorder", StringComparison.InvariantCultureIgnoreCase)) { cd.PanelBorderStyle = BorderStyle.None; } else if (exp[i].StartsWith("FontScale:", StringComparison.InvariantCultureIgnoreCase)) { cd.FontScale = exp[i].Substring(10).InvariantParseFloat(1.0f); } else { ap.ReportError("Unknown Dialog option " + exp[i]); return(true); } } if (IsModalDialog()) { ap.Dialogs[exp[0]] = cd; } else { ap.ActionFile.Dialogs[exp[0]] = cd; } cd.Trigger += Cd_Trigger; System.Drawing.Size minsize = new System.Drawing.Size(dw.Value, dh.Value); System.Drawing.Size maxsize = new System.Drawing.Size(mw.HasValue ? mw.Value : 50000, mh.HasValue ? mh.Value : 50000); if (x != null && y != null) { cd.Init(minsize, maxsize, new System.Drawing.Point(x.Value, y.Value), ap.ActionController.Icon, exp[1], exp[0], new List <Object>() { ap, IsModalDialog() }, // logical name and tag closeicon: closeicon ); } else { cd.InitCentred(ap.ActionController.Form, minsize, maxsize, ap.ActionController.Icon, exp[1], exp[0], new List <Object>() { ap, IsModalDialog() }, // logical name and tag closeicon: closeicon ); } cd.TopMost = alwaysontop; cd.Show(ap.ActionController.Form); return(!IsModalDialog()); // modal, return false, STOP. Non modal, continue } else { ap.ReportError("Width/Height and/or X/Y not specified correctly in Dialog"); } } else { ap.ReportError(exp[0]); } } else { ap.ReportError("Dialog command line not in correct format"); } return(true); }
void ShowScanPopOut(Object tag) // tag can be a Isystem or an He.. output depends on it. { if (tag == null) { return; } ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm(); int width = Math.Max(250, this.FindForm().Width * 4 / 5); int height = 800; HistoryEntry he = tag as HistoryEntry; ISystem sys = SysFrom(tag); ScanDisplay sd = null; string title = "System".Tx(this, "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.RichTextBoxScroll), detailed, new Point(0, 40), new Size(width - 20, height - 85), null)); title += ", " + "Station".Tx(this) + ": " + jm.Station; } else { // default is the scan display output sd = new ScanDisplay(); sd.CheckEDSM = CheckEDSM; sd.ShowMoons = sd.ShowMaterials = sd.ShowOverlays = true; sd.SetSize(48); sd.Size = new Size(width - 20, 1024); sd.DrawSystem(sys, null, discoveryform.history); 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.ButtonExt), "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(this.FindForm().Icon, new Size(width, height), new Point(-999, -999), title, null, null); if (sd != null) { sd.DrawSystem(sys, null, discoveryform.history); } f.Show(this.FindForm()); }