Ejemplo n.º 1
0
        private void pictureBox_ClickElement(object sender, MouseEventArgs e, PictureBoxHotspot.ImageElement i, object tag)
        {
            if (i != null)
            {
                string       stag = tag as string;
                HistoryEntry he   = tag as HistoryEntry;

                if (stag != null)      // its SCAN for now
                {
                    HideScanData(null, null);
                }
                else if (he != null)
                {
                    EDDiscovery.EDSM.EDSMClass edsm = new EDDiscovery.EDSM.EDSMClass();

                    string url = edsm.GetUrlToEDSMSystem(he.System.name);

                    if (url.Length > 0)         // may pass back empty string if not known, this solves another exception
                    {
                        System.Diagnostics.Process.Start(url);
                    }
                    else
                    {
                        EDDiscovery.Forms.MessageBoxTheme.Show("System " + he.System.name + " unknown to EDSM");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public bool DrawScanText(bool attop, Color textcolour, Color backcolour)
        {
            Size maxscansize = new Size(1920, 1080);            // set arbitary large.. not important for this.

            if (scantext != null)
            {
                if (attop)
                {
                    if (Config(Configuration.showScanLeft))
                    {
                        PictureBoxHotspot.ImageElement scanimg = pictureBox.AddTextAutoSize(new Point(4, 0), maxscansize, scantext, displayfont, textcolour, backcolour, 1.0F, "SCAN");
                        scanpostextoffset = new Point(4 + scanimg.img.Width + 4, 0);
                        RequestTemporaryMinimumSize(new Size(scanimg.img.Width + 8, scanimg.img.Height + 4));
                    }
                    else if (Config(Configuration.showScanAbove))
                    {
                        PictureBoxHotspot.ImageElement scanimg = pictureBox.AddTextAutoSize(new Point(4, 0), maxscansize, scantext, displayfont, textcolour, backcolour, 1.0F, "SCAN");
                        scanpostextoffset = new Point(0, scanimg.img.Height + 4);
                        RequestTemporaryResizeExpand(new Size(0, scanimg.img.Height + 4));
                    }
                    else if (Config(Configuration.showScanOnTop))
                    {
                        PictureBoxHotspot.ImageElement scanimg = pictureBox.AddTextAutoSize(new Point(4, 0), maxscansize, scantext, displayfont, textcolour, backcolour, 1.0F, "SCAN");
#if false
                        using (Graphics gr = Graphics.FromImage(scanimg.img))
                        {
                            using (Pen p1 = new Pen(Color.Red, 1.0F))
                            {
                                for (int i = 0; i < 1000; i += 50)
                                {
                                    gr.DrawLine(p1, new Point(0, i), new Point(100, i));
                                }
                            }
                        }
#endif
                        RequestTemporaryResize(new Size(scanimg.img.Width + 8, scanimg.img.Height + 4));         // match exactly to use minimum space
                        return(true);
                    }
                }
                else // bottom chance
                {
                    if (Config(Configuration.showScanRight))
                    {
                        Size s = pictureBox.DisplaySize();
                        PictureBoxHotspot.ImageElement scanimg = pictureBox.AddTextAutoSize(new Point(s.Width + 4, 0), maxscansize, scantext, displayfont, textcolour, backcolour, 1.0F, "SCAN");
                        RequestTemporaryMinimumSize(new Size(s.Width + 4 + scanimg.img.Width + 8, scanimg.img.Height + 4));
                    }
                    else if (Config(Configuration.showScanBelow))
                    {
                        Size s = pictureBox.DisplaySize();
                        PictureBoxHotspot.ImageElement scanimg = pictureBox.AddTextAutoSize(new Point(4, s.Height + 4), maxscansize, scantext, displayfont, textcolour, backcolour, 1.0F, "SCAN");
                        RequestTemporaryResizeExpand(new Size(0, scanimg.img.Height + 4));
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 3
0
 private void ClickElement(object sender, MouseEventArgs e, PictureBoxHotspot.ImageElement i, object tag)
 {
     if (i != null)
     {
         ShowInfo((string)tag, i.pos.Location.X < panelStars.Width / 2);
     }
     else
     {
         HideInfo();
     }
 }
Ejemplo n.º 4
0
        void CreateMaterialImage(List <PictureBoxHotspot.ImageElement> pc, Point matpos, Size matsize, string text, string mattag, string mattip, Color matcolour, Color textcolour)
        {
            System.Drawing.Imaging.ColorMap colormap = new System.Drawing.Imaging.ColorMap();
            colormap.OldColor = Color.White;    // this is the marker colour to replace
            colormap.NewColor = matcolour;

            Bitmap mat = BitMapHelpers.ReplaceColourInBitmap(EDDiscovery.Properties.Resources.materialmarkerorangefilled, new System.Drawing.Imaging.ColorMap[] { colormap });

            BitMapHelpers.DrawTextCentreIntoBitmap(ref mat, text, stdfont, textcolour);

            PictureBoxHotspot.ImageElement ie = new PictureBoxHotspot.ImageElement(
                new Rectangle(matpos.X, matpos.Y, matsize.Width, matsize.Height), mat, mattag, mattip);

            pc.Add(ie);
        }
Ejemplo n.º 5
0
        void CreateMaterialImage(List <PictureBoxHotspot.ImageElement> pc, Point matpos, Size matsize, string text, string mattag, string mattip, Color matcolour, Color textcolour)
        {
            System.Drawing.Imaging.ColorMap colormap = new System.Drawing.Imaging.ColorMap();
            colormap.OldColor = Color.White;    // this is the marker colour to replace
            colormap.NewColor = matcolour;

            Bitmap mat = BaseUtils.BitMapHelpers.ReplaceColourInBitmap((Bitmap)Icons.Controls.Scan_Bodies_Material, new System.Drawing.Imaging.ColorMap[] { colormap });

            BaseUtils.BitMapHelpers.DrawTextCentreIntoBitmap(ref mat, text, stdfont, textcolour);

            PictureBoxHotspot.ImageElement ie = new PictureBoxHotspot.ImageElement(
                new Rectangle(matpos.X, matpos.Y, matsize.Width, matsize.Height), mat, mattag, mattip);

            pc.Add(ie);
        }
Ejemplo n.º 6
0
        Point CreateImageLabel(List <PictureBoxHotspot.ImageElement> c, Image i, Point postopright, Size size, string label,
                               string ttext, int labelhoff, bool fromEDSM, bool imgowned = true)
        {
            //System.Diagnostics.Debug.WriteLine("    " + label + " " + postopright + " size " + size + " hoff " + labelhoff + " laby " + (postopright.Y + size.Height + labelhoff));
            if (fromEDSM)
            {
                ttext = "From EDSM" + Environment.NewLine + ttext;
            }

            PictureBoxHotspot.ImageElement ie = new PictureBoxHotspot.ImageElement(new Rectangle(postopright.X, postopright.Y, size.Width, size.Height), i, ttext, ttext, imgowned);

            Point max = new Point(postopright.X + size.Width, postopright.Y + size.Height);

            if (label != null)
            {
                Font font = stdfont;
                if (fromEDSM)
                {
                    font = stdfontUnderline;
                }

                Point labposcenthorz = new Point(postopright.X + size.Width / 2, postopright.Y + size.Height + labelhoff);

                PictureBoxHotspot.ImageElement lab = new PictureBoxHotspot.ImageElement();
                Size maxsize = new Size(300, 20);

                lab.TextCentreAutosize(labposcenthorz, maxsize, label, font, discoveryform.theme.LabelColor, this.BackColor);

                if (lab.pos.X < postopright.X)
                {
                    int offset = postopright.X - lab.pos.X;
                    ie.Translate(offset, 0);
                    lab.Translate(offset, 0);
                }

                c.Add(lab);

                max = new Point(Math.Max(lab.pos.X + lab.pos.Width, max.X), lab.pos.Y + lab.pos.Height);
            }

            c.Add(ie);

            //System.Diagnostics.Debug.WriteLine(" ... to " + label + " " + max + " size " + (new Size(max.X-postopright.X,max.Y-postopright.Y)));
            return(max);
        }
Ejemplo n.º 7
0
        Point CreateImageLabel(List <PictureBoxHotspot.ImageElement> c, Image i, Point postopright, Size size, string label,
                               string ttext, int labelhoff)
        {
            //System.Diagnostics.Debug.WriteLine(label + " " + postopright + " size " + size);

            PictureBoxHotspot.ImageElement ie = new PictureBoxHotspot.ImageElement(new Rectangle(postopright.X, postopright.Y, size.Width, size.Height), i, ttext, ttext);

            Point max = new Point(postopright.X + size.Width, postopright.Y + size.Height);

            if (label != null)
            {
                Point labposcenthorz = new Point(postopright.X + size.Width / 2, postopright.Y + size.Height + labelhoff);

                using (Graphics gr = CreateGraphics())
                {
                    PictureBoxHotspot.ImageElement lab = new PictureBoxHotspot.ImageElement(gr, labposcenthorz, label,
                                                                                            stdfont, discoveryform.theme.LabelColor);

                    if (lab.pos.X < postopright.X)
                    {
                        int offset = postopright.X - lab.pos.X;
                        ie.Translate(offset, 0);
                        lab.Translate(offset, 0);
                    }

                    c.Add(lab);

                    max = new Point(Math.Max(lab.pos.X + lab.pos.Width, max.X), lab.pos.Y + lab.pos.Height);
                }
            }

            c.Add(ie);

            //System.Diagnostics.Debug.WriteLine(" ... to " + label + " " + max + " size " + (new Size(max.X-postopright.X,max.Y-postopright.Y)));
            return(max);
        }
Ejemplo n.º 8
0
        private void Display()
        {
            HistoryEntry last_he = userControlSynthesis.CurrentHistoryEntry;             // sync with what its showing

            if (EngineeringWanted != null && SynthesisWanted != null && last_he != null) // if we have all the ingredients (get it!)
            {
                List <MaterialCommodities> mcl = last_he.MaterialCommodity.Sort(false);
                MaterialCommoditiesList.ResetUsed(mcl);
                Color textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor;
                Color backcolour = this.BackColor;
                List <Tuple <MaterialCommoditiesList.Recipe, int> > totalWanted = EngineeringWanted.Concat(SynthesisWanted).ToList();

                List <MaterialCommodities> shoppinglist = MaterialCommoditiesList.GetShoppingList(totalWanted, mcl);

                StringBuilder wantedList = new StringBuilder();

                if (shoppinglist.Any())
                {
                    wantedList.Append("Needed Mats:\n");
                    foreach (MaterialCommodities c in shoppinglist.OrderBy(mat => mat.name))      // and add new..
                    {
                        wantedList.AppendFormat("  {0} {1}\n", c.scratchpad, c.name);
                    }

                    int currentMats = mcl.Where(m => m.category == MaterialCommodityDB.MaterialManufacturedCategory || m.category == MaterialCommodityDB.MaterialRawCategory)
                                      .Sum(i => i.count);
                    int currentData = mcl.Where(m => m.category == MaterialCommodityDB.MaterialEncodedCategory).Sum(i => i.count);
                    int neededMats  = shoppinglist.Where(m => m.category == MaterialCommodityDB.MaterialManufacturedCategory || m.category == MaterialCommodityDB.MaterialRawCategory)
                                      .Sum(i => i.scratchpad);
                    int neededData = shoppinglist.Where(m => m.category == MaterialCommodityDB.MaterialEncodedCategory).Sum(i => i.scratchpad);

                    if (currentMats + neededMats > PhysicalInventoryCapacity || currentData + neededData > DataInventoryCapacity)
                    {
                        wantedList.Append("\nNeeded capacity");
                        if (currentMats + neededMats > PhysicalInventoryCapacity)
                        {
                            wantedList.AppendFormat("\n  {0} materials", currentMats + neededMats - PhysicalInventoryCapacity);
                        }
                        if (currentData + neededData > DataInventoryCapacity)
                        {
                            wantedList.AppendFormat("\n  {0} data", currentData + neededData - DataInventoryCapacity);
                        }
                    }
                }
                else
                {
                    wantedList.Append("No materials currently required.");
                }

                if (showMaxInjections)
                {
                    MaterialCommoditiesList.ResetUsed(mcl);
                    Tuple <int, int, string> basic    = MaterialCommoditiesList.HowManyLeft(mcl, SynthesisRecipes.First(r => r.name == "FSD" && r.level == "Basic"));
                    Tuple <int, int, string> standard = MaterialCommoditiesList.HowManyLeft(mcl, SynthesisRecipes.First(r => r.name == "FSD" && r.level == "Standard"));
                    Tuple <int, int, string> premium  = MaterialCommoditiesList.HowManyLeft(mcl, SynthesisRecipes.First(r => r.name == "FSD" && r.level == "Premium"));
                    wantedList.Append($"\nMax FSD Injections\n   {basic.Item1} Basic\n   {standard.Item1} Standard\n   {premium.Item1} Premium");
                }

                Font font = discoveryform.theme.GetFont;
                pictureBoxList.ClearImageList();
                PictureBoxHotspot.ImageElement displayList = pictureBoxList.AddTextAutoSize(new Point(0, 0), new Size(1000, 1000), wantedList.ToNullSafeString(), font, textcolour, backcolour, 1.0F);
                pictureBoxList.Render();
                font.Dispose();

                // if transparent, we don't show the eng/synth panels

                userControlEngineering.Visible = userControlSynthesis.Visible = !IsTransparent;
                userControlEngineering.Enabled = userControlSynthesis.Enabled = !IsTransparent;

                splitContainerVertical.Panel1MinSize = displayList.img.Width + 8;       // panel left has minimum width to accomodate the text

                if (IsTransparent)
                {
                    RevertToNormalSize();
                    int minWidth = Math.Max(((UserControlForm)FindForm()).TitleBarMinWidth(), displayList.img.Width) + 8;
                    RequestTemporaryResize(new Size(minWidth, displayList.img.Height + 4));
                }
                else
                {
                    RevertToNormalSize();       // eng/synth is on, normal size
                }
            }
        }
Ejemplo n.º 9
0
        private void Display()
        {
            HistoryEntry last_he = userControlSynthesis.CurrentHistoryEntry;             // sync with what its showing

            if (EngineeringWanted != null && SynthesisWanted != null && last_he != null) // if we have all the ingredients (get it!)
            {
                List <MaterialCommodities> mcl = last_he.MaterialCommodity.Sort(false);
                MaterialCommoditiesList.ResetUsed(mcl);
                Color textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor;
                Color backcolour = this.BackColor;
                List <Tuple <MaterialCommoditiesList.Recipe, int> > totalWanted = EngineeringWanted.Concat(SynthesisWanted).ToList();

                List <MaterialCommodities> shoppinglist = MaterialCommoditiesList.GetShoppingList(totalWanted, mcl);
                JournalScan         sd      = null;
                StarScan.SystemNode last_sn = null;

                if (last_he.IsLanded && (showListAvailability || showPlanetMats))
                {
                    sd = discoveryform.history.GetScans(last_he.System.name).Where(sc => sc.BodyName == last_he.WhereAmI).FirstOrDefault();
                }
                if (!last_he.IsLanded && showSystemAvailability)  //replace true with a setting
                {
                    last_sn = discoveryform.history.starscan.FindSystem(last_he.System, useEDSMForSystemAvailability);
                }

                StringBuilder wantedList = new StringBuilder();

                if (shoppinglist.Any())
                {
                    double available;
                    wantedList.Append("Needed Mats:\n");
                    foreach (MaterialCommodities c in shoppinglist.OrderBy(mat => mat.name))      // and add new..
                    {
                        string present = "";
                        if (showListAvailability)
                        {
                            if (sd != null)
                            {
                                if (sd.Materials.TryGetValue(c.fdname, out available))
                                {
                                    present = $" {available.ToString("N1")}%";
                                }
                                else
                                {
                                    present = " -";
                                }
                            }
                        }
                        wantedList.Append($"  {c.scratchpad} {c.name}{present}");
                        if (!last_he.IsLanded && last_sn != null)
                        {
                            var landables = last_sn.Bodies.Where(b => b.ScanData != null && (!b.ScanData.IsEDSMBody || useEDSMForSystemAvailability) &&
                                                                 b.ScanData.HasMaterials && b.ScanData.Materials.ContainsKey(c.fdname));
                            if (landables.Count() > 0)
                            {
                                wantedList.Append("\n    ");
                                List <Tuple <string, double> > allMats = new List <Tuple <string, double> >();
                                foreach (StarScan.ScanNode sn in landables)
                                {
                                    sn.ScanData.Materials.TryGetValue(c.fdname, out available);
                                    allMats.Add(new Tuple <string, double>(sn.fullname.Replace(last_he.System.name, "", StringComparison.InvariantCultureIgnoreCase).Trim(), available));
                                }
                                allMats = allMats.OrderByDescending(m => m.Item2).ToList();
                                foreach (Tuple <string, double> m in allMats)
                                {
                                    wantedList.Append($"{m.Item1}: {m.Item2.ToString("N1")}% ");
                                }
                            }
                        }
                        wantedList.Append("\n");
                    }

                    int currentMats = mcl.Where(m => m.category == MaterialCommodityDB.MaterialManufacturedCategory || m.category == MaterialCommodityDB.MaterialRawCategory)
                                      .Sum(i => i.count);
                    int currentData = mcl.Where(m => m.category == MaterialCommodityDB.MaterialEncodedCategory).Sum(i => i.count);
                    int neededMats  = shoppinglist.Where(m => m.category == MaterialCommodityDB.MaterialManufacturedCategory || m.category == MaterialCommodityDB.MaterialRawCategory)
                                      .Sum(i => i.scratchpad);
                    int neededData = shoppinglist.Where(m => m.category == MaterialCommodityDB.MaterialEncodedCategory).Sum(i => i.scratchpad);

                    if (currentMats + neededMats > PhysicalInventoryCapacity || currentData + neededData > DataInventoryCapacity)
                    {
                        wantedList.Append("\nCapacity Warning:");
                        if (currentMats + neededMats > PhysicalInventoryCapacity)
                        {
                            wantedList.Append($"\n  {PhysicalInventoryCapacity - currentMats}/{neededMats} materials space free");
                        }
                        if (currentData + neededData > DataInventoryCapacity)
                        {
                            wantedList.Append($"\n  {DataInventoryCapacity - currentData}/{neededData} data space free");
                        }
                        wantedList.Append("\n");
                    }
                }
                else
                {
                    wantedList.Append("No materials currently required.");
                }

                if (showMaxInjections)
                {
                    MaterialCommoditiesList.ResetUsed(mcl);
                    Tuple <int, int, string> basic    = MaterialCommoditiesList.HowManyLeft(mcl, SynthesisRecipes.First(r => r.name == "FSD" && r.level == "Basic"));
                    Tuple <int, int, string> standard = MaterialCommoditiesList.HowManyLeft(mcl, SynthesisRecipes.First(r => r.name == "FSD" && r.level == "Standard"));
                    Tuple <int, int, string> premium  = MaterialCommoditiesList.HowManyLeft(mcl, SynthesisRecipes.First(r => r.name == "FSD" && r.level == "Premium"));
                    wantedList.Append($"\nMax FSD Injections\n   {basic.Item1} Basic\n   {standard.Item1} Standard\n   {premium.Item1} Premium");
                }

                if (showPlanetMats && sd != null)  //for user configurable setting
                {
                    wantedList.Append($"\n\nMaterials on {last_he.WhereAmI}\n");
                    foreach (KeyValuePair <string, double> mat in sd.Materials)
                    {
                        wantedList.AppendFormat("   {0} {1}%\n", System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(mat.Key.ToLower()),
                                                mat.Value.ToString("N1"));
                    }
                }

                Font font = discoveryform.theme.GetFont;
                pictureBoxList.ClearImageList();
                PictureBoxHotspot.ImageElement displayList = pictureBoxList.AddTextAutoSize(new Point(0, 0), new Size(1000, 1000), wantedList.ToNullSafeString(), font, textcolour, backcolour, 1.0F);
                pictureBoxList.Render();
                font.Dispose();

                // if transparent, we don't show the eng/synth panels

                userControlEngineering.Visible = userControlSynthesis.Visible = !IsTransparent;
                userControlEngineering.Enabled = userControlSynthesis.Enabled = !IsTransparent;

                splitContainerVertical.Panel1MinSize = displayList.img.Width + 8;       // panel left has minimum width to accomodate the text

                if (IsTransparent)
                {
                    RevertToNormalSize();
                    int minWidth = Math.Max(((UserControlForm)FindForm()).TitleBarMinWidth(), displayList.img.Width) + 8;
                    RequestTemporaryResize(new Size(minWidth, displayList.img.Height + 4));
                }
                else
                {
                    RevertToNormalSize();       // eng/synth is on, normal size
                }
            }
        }
Ejemplo n.º 10
0
        private void Display()
        {
            HistoryEntry last_he = userControlSynthesis.CurrentHistoryEntry;             // sync with what its showing

            if (EngineeringWanted != null && SynthesisWanted != null && last_he != null) // if we have all the ingredients (get it!)
            {
                List <MaterialCommodities> mcl = last_he.MaterialCommodity.Sort(false);
                Recipes.ResetUsed(mcl);
                Color textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor;
                Color backcolour = this.BackColor;
                List <Tuple <Recipes.Recipe, int> > totalWanted = EngineeringWanted.Concat(SynthesisWanted).ToList();
                string techBrokers = SQLiteDBClass.GetSettingString(DBTechBrokerFilterSave, "None");
                if (techBrokers != "None")
                {
                    List <string> techBrokerList = techBrokers.Split(';').ToList <string>();
                    foreach (Recipes.Recipe r in Recipes.TechBrokerUnlocks)
                    {
                        if (techBrokers == "All" || techBrokerList.Contains(r.name))
                        {
                            totalWanted.Add(new Tuple <Recipes.Recipe, int>(r, 1));
                        }
                    }
                }

                List <MaterialCommodities> shoppinglist = Recipes.GetShoppingList(totalWanted, mcl);
                JournalScan         sd      = null;
                StarScan.SystemNode last_sn = null;

                if (last_he.IsLanded && (showListAvailability || showPlanetMats))
                {
                    sd = discoveryform.history.GetScans(last_he.System.Name).Where(sc => sc.BodyName == last_he.WhereAmI).FirstOrDefault();
                }
                if (!last_he.IsLanded && showSystemAvailability)
                {
                    last_sn = discoveryform.history.starscan.FindSystem(last_he.System, useEDSMForSystemAvailability);
                }

                StringBuilder wantedList = new StringBuilder();

                if (shoppinglist.Any())
                {
                    double available;
                    wantedList.Append("Needed Mats:\n");
                    List <string> capExceededMats = new List <string>();
                    foreach (MaterialCommodities c in shoppinglist.OrderBy(mat => mat.name))      // and add new..
                    {
                        string present = "";
                        if (showListAvailability)
                        {
                            if (sd != null && sd.HasMaterials)
                            {
                                if (sd.Materials.TryGetValue(c.fdname, out available))
                                {
                                    present = $" {available.ToString("N1")}%";
                                }
                                else
                                {
                                    present = " -";
                                }
                            }
                        }
                        wantedList.Append($"  {c.scratchpad} {c.name}{present}");
                        int?onHand   = mcl.Where(m => m.shortname == c.shortname).FirstOrDefault()?.count;
                        int totalReq = c.scratchpad + (onHand.HasValue ? onHand.Value : 0);
                        if ((c.type == MaterialFreqVeryCommon && totalReq > VeryCommonCap) ||
                            (c.type == MaterialFreqCommon && totalReq > CommonCap) ||
                            (c.type == MaterialFreqStandard && totalReq > StandardCap) ||
                            (c.type == MaterialFreqRare && totalReq > RareCap) ||
                            (c.type == MaterialFreqVeryRare && totalReq > VeryRareCap))
                        {
                            capExceededMats.Add(c.name);
                        }
                        if (!last_he.IsLanded && last_sn != null)
                        {
                            var landables = last_sn.Bodies.Where(b => b.ScanData != null && (!b.ScanData.IsEDSMBody || useEDSMForSystemAvailability) &&
                                                                 b.ScanData.HasMaterials && b.ScanData.Materials.ContainsKey(c.fdname));
                            if (landables.Count() > 0)
                            {
                                wantedList.Append("\n    ");
                                List <Tuple <string, double> > allMats = new List <Tuple <string, double> >();
                                foreach (StarScan.ScanNode sn in landables)
                                {
                                    sn.ScanData.Materials.TryGetValue(c.fdname, out available);
                                    allMats.Add(new Tuple <string, double>(sn.fullname.Replace(last_he.System.Name, "", StringComparison.InvariantCultureIgnoreCase).Trim(), available));
                                }
                                allMats = allMats.OrderByDescending(m => m.Item2).ToList();
                                int n = 1;
                                foreach (Tuple <string, double> m in allMats)
                                {
                                    if (n % 6 == 0)
                                    {
                                        wantedList.Append("\n    ");
                                    }
                                    wantedList.Append($"{m.Item1.ToUpperInvariant()}: {m.Item2.ToString("N1")}% ");
                                    n++;
                                }
                            }
                        }
                        wantedList.Append("\n");
                    }

                    if (capExceededMats.Any())
                    {
                        wantedList.Append("\nFilling Shopping List would exceed capacity for:");
                        foreach (string mat in capExceededMats)
                        {
                            wantedList.Append($"\n  {mat}");
                        }
                    }
                }
                else
                {
                    wantedList.Append("No materials currently required.");
                }

                if (showMaxInjections)
                {
                    Recipes.ResetUsed(mcl);
                    Tuple <int, int, string, string> basic    = Recipes.HowManyLeft(mcl, Recipes.SynthesisRecipes.First(r => r.name == "FSD" && r.level == "Basic"));
                    Tuple <int, int, string, string> standard = Recipes.HowManyLeft(mcl, Recipes.SynthesisRecipes.First(r => r.name == "FSD" && r.level == "Standard"));
                    Tuple <int, int, string, string> premium  = Recipes.HowManyLeft(mcl, Recipes.SynthesisRecipes.First(r => r.name == "FSD" && r.level == "Premium"));
                    wantedList.Append($"\nMax FSD Injections\n   {basic.Item1} Basic\n   {standard.Item1} Standard\n   {premium.Item1} Premium");
                }

                if (showPlanetMats && sd != null && sd.HasMaterials)
                {
                    wantedList.Append($"\n\nMaterials on {last_he.WhereAmI}\n");
                    foreach (KeyValuePair <string, double> mat in sd.Materials)
                    {
                        int?onHand = mcl.Where(m => m.fdname == mat.Key).FirstOrDefault()?.count;
                        MaterialCommodityData md = GetCachedMaterial(mat.Key);
                        int max = MaterialLimit(md).Value;
                        wantedList.AppendFormat("   {0} {1}% ({2}/{3})\n", System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(mat.Key.ToLower(System.Globalization.CultureInfo.InvariantCulture)),
                                                mat.Value.ToString("N1"), (onHand.HasValue ? onHand.Value : 0), max);
                    }
                }

                Font font = discoveryform.theme.GetFont;
                pictureBoxList.ClearImageList();
                PictureBoxHotspot.ImageElement displayList = pictureBoxList.AddTextAutoSize(new Point(0, 0), new Size(1000, 1000), wantedList.ToNullSafeString(), font, textcolour, backcolour, 1.0F);
                pictureBoxList.Render();
                font.Dispose();

                // if transparent, we don't show the eng/synth panels

                userControlEngineering.Visible = userControlSynthesis.Visible = !IsTransparent;
                userControlEngineering.Enabled = userControlSynthesis.Enabled = !IsTransparent;
                buttonTechBroker.Visible       = buttonTechBroker.Enabled = !IsTransparent;

                splitContainerVertical.Panel1MinSize = displayList.img.Width + 8;       // panel left has minimum width to accomodate the text

                if (IsTransparent)
                {
                    RevertToNormalSize();
                    int minWidth = Math.Max(((UserControlForm)FindForm()).TitleBarMinWidth(), displayList.img.Width) + 8;
                    RequestTemporaryResize(new Size(minWidth, displayList.img.Height + 4));
                }
                else
                {
                    RevertToNormalSize();       // eng/synth is on, normal size
                }
            }
        }