Exemplo n.º 1
0
        //have to add new entry for GL Circle to draw sensor bubbles around taskgroups/populations/missile contacts
        //CircleElement has the circle in it already, but that might be inappropriate for what I want
        //SceenElement has the lable properly done.

        public SensorElement(GLEffect a_oDefaultEffect, Vector3 a_oPosition, float a_fRadius, System.Drawing.Color a_oColor, String LabelText, GameEntity Ent,  ComponentTypeTN SType, Sceen ParentSceenArg)
            : base()
        {
            _ParentSceen = ParentSceenArg;

            _DisplayRadius = a_fRadius;

            m_oPrimaryPrimitive = new GLCircle(a_oDefaultEffect,
                        a_oPosition,
                        a_fRadius,
                        a_oColor,
                        UIConstants.Textures.DEFAULT_TEXTURE);

            m_lPrimitives.Add(m_oPrimaryPrimitive);

            int LabelMid = LabelText.Length / 4;
            float xAdjust = -LabelMid * (UIConstants.DEFAULT_TEXT_SIZE.X / _ParentSceen.ZoomSclaer);
            float yAdjust = 10.0f / ParentSceenArg.ZoomSclaer;
            Vector3 LPos = new Vector3(xAdjust, (a_fRadius + yAdjust), 0.0f);
            LPos = LPos + a_oPosition;
            Lable = new GLUtilities.GLFont(a_oDefaultEffect, LPos, UIConstants.DEFAULT_TEXT_SIZE, a_oColor, UIConstants.Textures.DEFAULT_GLFONT2, LabelText);
            Lable.Size = UIConstants.DEFAULT_TEXT_SIZE / ParentSceenArg.ZoomSclaer;
            SetActualPosition(a_oPosition);

            SceenEntity = Ent;
            _SensorType = SType;
        }
Exemplo n.º 2
0
        public Sceen(StarSystem a_oStarSystem, GLEffect a_oDefaultEffect, Pulsar4X.UI.Handlers.SystemMap ParentSM)
        {
            // set member vars:
            m_v3ViewOffset = Vector3.Zero;
            MeasureMode = false;

            ParentSystemMap = ParentSM;
            SceenDefaultEffect = a_oDefaultEffect;

            /// <summary>
            /// These have to be initialized before the contactElements are created as contactElement uses these.
            /// </summary>
            ShowActives = true;
            ShowPassives = true;
            ShowPassiveSignatureRange = (int)Constants.SensorTN.DefaultPassiveSignature;

            // Set Sceen Vars:
            m_oSceenEntity = a_oStarSystem;
            SceenID = a_oStarSystem.Id;

            // Create measurement element:
            m_oMeasurementElement = new MeasurementElement();
            m_oMeasurementElement.PrimaryPrimitive = new GLLine(a_oDefaultEffect, Vector3.Zero, new Vector2(1.0f, 1.0f), Color.Yellow, UIConstants.Textures.DEFAULT_TEXTURE);
            m_oMeasurementElement.AddPrimitive(m_oMeasurementElement.PrimaryPrimitive);
            m_oMeasurementElement.Lable = new GLUtilities.GLFont(a_oDefaultEffect, Vector3.Zero, UIConstants.DEFAULT_TEXT_SIZE, Color.Yellow, UIConstants.Textures.DEFAULT_GLFONT2, "");

            // Creat Working Vars:
            //double dKMperAUdevby10 = (Pulsar4X.Constants.Units.KmPerAu / 10); // we scale everthing down by 10 to avoid float buffer overflows.
            int iStarCounter = 0;                                               // Keeps track of the number of stars.
            int iPlanetCounter = 0;                                             // Keeps track of the number of planets around the current star
            int iMoonCounter = 0;                                               // Keeps track of the number of moons around the current planet.
            double dMaxOrbitDist = 0;                                           // used for fit to zoom.
            Vector3 v3StarPos = new Vector3(0, 0, 0);                           // used for storing the psoition of the current star in the system
            float fStarSize = 0.0f;                                             // Size of a star
            double dPlanetOrbitRadius = 0;                                      // used for holding the orbit in Km for a planet.
            Vector3 v3PlanetPos = new Vector3(0, 0, 0);                         // Used to store the planet Pos.
            float fPlanetSize = 0;                                              // used to hold the planets size.
            double dMoonOrbitRadius = 0;                                        // used for holding the orbit in Km for a Moon.
            float fMoonSize = 0;                                                // used to hold the Moons size.
            Vector3 v3MoonPos = Vector3.Zero;                                   // Used to store the Moons Position.

            // start creating star branches in the sceen graph:
            SceenElement oRootStar;
            SceenElement oCurrStar;
            foreach (Pulsar4X.Entities.Star oStar in a_oStarSystem.Stars)
            {

                if (iStarCounter <= 0)
                {
                    // then we have a secondary, etc star give random position around its orbit!
                    oRootStar = new StarElement(oStar, a_oDefaultEffect, Vector3.Zero, Pulsar4X.Constants.StarColor.LookupColor(oStar), true);
                    oCurrStar = oRootStar;
                }
                else
                {
                    Random rnd = new Random();
                    v3StarPos.X = (float)(oStar.Position.X);
                    v3StarPos.Y = (float)(oStar.Position.Y);    
                    MaxOrbitDistTest(ref dMaxOrbitDist, oStar.Orbit.SemiMajorAxis);
                    oCurrStar = new StarElement(oStar, a_oDefaultEffect, v3StarPos, Pulsar4X.Constants.StarColor.LookupColor(oStar), false);
                }


                fStarSize = (float)(oStar.Radius * 2.0 * (Constants.Units.SolarRadiusInAu));

                GLUtilities.GLQuad oStarQuad = new GLUtilities.GLQuad(a_oDefaultEffect,
                                                                        v3StarPos,
                                                                        new Vector2(fStarSize, fStarSize),
                                                                        Pulsar4X.Constants.StarColor.LookupColor(oStar),
                                                                        UIConstants.Textures.DEFAULT_PLANET_ICON);
                // create name lable:
                GLUtilities.GLFont oNameLable = new GLUtilities.GLFont(a_oDefaultEffect,
                    new Vector3((float)(v3StarPos.X), (float)(v3StarPos.Y - (oStar.Radius / Constants.Units.KmPerAu)), 0),
                    UIConstants.DEFAULT_TEXT_SIZE, Color.White, UIConstants.Textures.DEFAULT_GLFONT2, oStar.Name);

                oCurrStar.AddPrimitive(oStarQuad); // Add star icon to the Sceen element.
                oCurrStar.Lable = oNameLable;
                oCurrStar.PrimaryPrimitive = oStarQuad;
                oCurrStar.RealSize = new Vector2(fStarSize, fStarSize);
                this.AddElement(oCurrStar);

                // now go though and add each planet to render list.
                foreach (Pulsar4X.Entities.SystemBody oPlanet in oStar.Planets)
                {
                    SceenElement oPlanetElement = new PlanetElement(a_oDefaultEffect, v3StarPos, oPlanet, Color.FromArgb(255, 0, 205, 0));
                    oPlanetElement.EntityID = oPlanet.Id;

                    if (iPlanetCounter == 0)
                    {
                        oCurrStar.SmallestOrbit = (float)(oPlanet.Orbit.SemiMajorAxis * 2);
                    }
                    dPlanetOrbitRadius = oPlanet.Orbit.SemiMajorAxis;

                    fPlanetSize = (float)((oPlanet.Radius * 2.0) / Constants.Units.KmPerAu);
                    MaxOrbitDistTest(ref dMaxOrbitDist, dPlanetOrbitRadius);

                    GLUtilities.GLQuad oPlanetQuad = new GLUtilities.GLQuad(a_oDefaultEffect,
                        v3PlanetPos,
                        new Vector2(fPlanetSize, fPlanetSize),
                        Color.FromArgb(255, 0, 255, 0),  // lime green
                        UIConstants.Textures.DEFAULT_PLANET_ICON);

                    // create name lable:
                    GLUtilities.GLFont oPlanetNameLable = new GLUtilities.GLFont(a_oDefaultEffect,
                        new Vector3((float)(v3PlanetPos.X), (float)(v3PlanetPos.Y - (oPlanet.Radius / Constants.Units.KmPerAu)), 0),
                        UIConstants.DEFAULT_TEXT_SIZE, Color.AntiqueWhite, UIConstants.Textures.DEFAULT_GLFONT2, oPlanet.Name);

                    oPlanetElement.AddPrimitive(oPlanetQuad);

                    oPlanetElement.Lable = oPlanetNameLable;
                    oPlanetElement.PrimaryPrimitive = oPlanetQuad;
                    oPlanetElement.RealSize = new Vector2(fPlanetSize, fPlanetSize);
                    oCurrStar.AddChildElement(oPlanetElement);

                    iPlanetCounter++;

                    // now again for the moons:
                    foreach (Pulsar4X.Entities.SystemBody oMoon in oPlanet.Moons)
                    {
                        SceenElement oMoonElement = new PlanetElement(a_oDefaultEffect, v3PlanetPos, oMoon, Color.FromArgb(255, 0, 205, 0));
                        oMoonElement.EntityID = oMoon.Id;

                        if (iMoonCounter == 0)
                        {
                            oPlanetElement.SmallestOrbit = (float)(oMoon.Orbit.SemiMajorAxis);
                        }

                        dMoonOrbitRadius = oMoon.Orbit.SemiMajorAxis;
                        fMoonSize = (float)((oMoon.Radius * 2.0) / Constants.Units.KmPerAu);
                        v3MoonPos = new Vector3((float)(oMoon.Position.X), (float)(oMoon.Position.Y), 0);
                        oMoon.Position.X = oMoon.Position.X + v3PlanetPos.X;
                        oMoon.Position.Y = oMoon.Position.Y + v3PlanetPos.Y;

                        GLUtilities.GLQuad oMoonQuad = new GLUtilities.GLQuad(a_oDefaultEffect,
                            v3MoonPos,                                    // offset Pos by parent planet pos
                            new Vector2(fMoonSize, fMoonSize),
                            Color.FromArgb(255, 0, 205, 0),  // lime green
                            UIConstants.Textures.DEFAULT_PLANET_ICON);

                        GLUtilities.GLFont oMoonNameLable = new GLUtilities.GLFont(a_oDefaultEffect,
                        new Vector3((float)(v3MoonPos.X), (float)(v3MoonPos.Y - (oMoon.Radius / Constants.Units.KmPerAu)), 0),
                        UIConstants.DEFAULT_TEXT_SIZE, Color.AntiqueWhite, UIConstants.Textures.DEFAULT_GLFONT2, oMoon.Name);

                        oMoonElement.AddPrimitive(oMoonQuad);

                        oMoonElement.Lable = oMoonNameLable;
                        oMoonElement.PrimaryPrimitive = oMoonQuad;
                        oMoonElement.RealSize = new Vector2(fMoonSize, fMoonSize);
                        oPlanetElement.AddChildElement(oMoonElement);

                        iMoonCounter++;
                    }
                    iMoonCounter = 0;
                }
                iPlanetCounter = 0;
                foreach (Pulsar4X.Entities.JumpPoint oJumpPoint in a_oStarSystem.JumpPoints)
                {
                    CreateJumpPoint(oCurrStar, oJumpPoint);
                }

                iStarCounter++;
            }

            foreach (Pulsar4X.Entities.SystemContact systemContact in a_oStarSystem.SystemContactList)
            {
                AddContactElement(SceenDefaultEffect, systemContact);
            }

            a_oStarSystem.JumpPoints.ListChanged += JumpPoints_ListChanged;
            a_oStarSystem.SystemContactList.ListChanging += SystemContactList_ListChanging;

            // Set Sceen Size basd on Max Orbit:
            m_v2SceenSize = new Vector2d(dMaxOrbitDist * 2, dMaxOrbitDist * 2);
        }
Exemplo n.º 3
0
 public BuildListObject(ListEntityType entityType, GameEntity entity)
 {
     Entity = entity;
     EntityType = entityType;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="a_GameEntity">The Game Entity this Sceen Element Repesents</param>
 public SceenElement(GameEntity a_oGameEntity)
 {
     // set some defaults:
     MinimumSize = new Vector2(8, 8);
     RenderChildren = true;
     SceenEntity = a_oGameEntity;
     EntityID = a_oGameEntity.Id;
 }
Exemplo n.º 5
0
        /// <summary>
        /// Refresh industrial tab updates the display for the various industrial tab items.
        /// </summary>
        private void RefreshIndustryTab()
        {
#warning Add an entry for Unused Construction, Unused Fighter Capacity, and Unused Ordnance Capacity here.
            /// <summary>
            /// Clear the dictionary for the build list grid
            /// </summary>
            BuildLocationDict.Clear();
            BuildLocationDisplayDict.Clear();

            /// <summary>
            /// Check if there is a valid selected index.
            /// </summary>
            if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex != -1)
            {
                #region Installations
                /// <summary>
                /// Check the selected index against the construction ID for the build grid.
                /// </summary>
                if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.Installations)
                {
                    int row = 0;
                    /// <summary>
                    /// Loop through every installation.
                    /// </summary>
                    foreach (Installation Install in CurrentFaction.InstallationTypes)
                    {
                        /// <summary>
                        /// can this installation be built?
                        /// </summary>
                        if (Install.IsBuildable(CurrentFaction, CurrentPopulation) == true)
                        {
                            /// <summary>
                            /// do we not need to add a row?
                            /// </summary>
                            if (row < BuildTabMaxRows)
                            {
                                /// <summary>
                                /// add to the build location dictionary and print to the build data grid.
                                /// </summary>
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Installation, Install);
                                BuildLocationDisplayDict.Add(Install.Id, Install.Name);
                                BuildLocationDict.Add(Install.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Install.Name;
                                row++;

                            }
                            else
                            {
                                /// <summary>
                                /// create a row.
                                /// </summary>
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Installation, Install);
                                BuildLocationDisplayDict.Add(Install.Id, Install.Name);
                                BuildLocationDict.Add(Install.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Install.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }

                    }

                    /// <summary>
                    /// Set all unused rows to not visible.
                    /// </summary>
                    for (int RowIterator = row; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
                }
                #endregion
                #region Missiles
                else if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.Missiles)
                {
                    int row = 0;
                    foreach (OrdnanceDefTN Missile in CurrentFaction.ComponentList.MissileDef)
                    {
                        if (Missile.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Missile, Missile);
                                BuildLocationDisplayDict.Add(Missile.Id, Missile.Name);
                                BuildLocationDict.Add(Missile.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Missile.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Missile, Missile);
                                BuildLocationDisplayDict.Add(Missile.Id, Missile.Name);
                                BuildLocationDict.Add(Missile.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Missile.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    for (int RowIterator = row; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
                }
                #endregion
                #region Fighters
                else if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.Fighters)
                {
                    int row = 0;
                    for (int RowIterator = row; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
#warning do fighter list here.
                }
                #endregion
                #region Basic Components
                else if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.BasicComponents)
                {
                    int row = 0;
                    foreach (GeneralComponentDefTN Crew in CurrentFaction.ComponentList.CrewQuarters)
                    {
                        if (Crew.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Crew);
                                BuildLocationDisplayDict.Add(Crew.Id, Crew.Name);
                                BuildLocationDict.Add(Crew.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Crew.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Crew);
                                BuildLocationDisplayDict.Add(Crew.Id, Crew.Name);
                                BuildLocationDict.Add(Crew.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Crew.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    foreach (GeneralComponentDefTN Fuel in CurrentFaction.ComponentList.FuelStorage)
                    {
                        if (Fuel.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Fuel);
                                BuildLocationDisplayDict.Add(Fuel.Id, Fuel.Name);
                                BuildLocationDict.Add(Fuel.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Fuel.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Fuel);
                                BuildLocationDisplayDict.Add(Fuel.Id, Fuel.Name);
                                BuildLocationDict.Add(Fuel.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Fuel.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    foreach (GeneralComponentDefTN EBay in CurrentFaction.ComponentList.EngineeringSpaces)
                    {
                        if (EBay.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, EBay);
                                BuildLocationDisplayDict.Add(EBay.Id, EBay.Name);
                                BuildLocationDict.Add(EBay.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = EBay.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, EBay);
                                BuildLocationDisplayDict.Add(EBay.Id, EBay.Name);
                                BuildLocationDict.Add(EBay.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = EBay.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    foreach (GeneralComponentDefTN Other in CurrentFaction.ComponentList.OtherComponents)
                    {
                        if (Other.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Other);
                                BuildLocationDisplayDict.Add(Other.Id, Other.Name);
                                BuildLocationDict.Add(Other.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Other.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Other);
                                BuildLocationDisplayDict.Add(Other.Id, Other.Name);
                                BuildLocationDict.Add(Other.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Other.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    for (int RowIterator = row; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
                }
                #endregion
                #region Electronics and Shields
                else if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.ElectronicShieldComponents)
                {
                    int row = 0;
                    foreach (ShieldDefTN Shield in CurrentFaction.ComponentList.ShieldDef)
                    {
                        if (Shield.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Shield);
                                BuildLocationDisplayDict.Add(Shield.Id, Shield.Name);
                                BuildLocationDict.Add(Shield.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Shield.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Shield);
                                BuildLocationDisplayDict.Add(Shield.Id, Shield.Name);
                                BuildLocationDict.Add(Shield.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Shield.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    for (int RowIterator = row; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
                }
                #endregion
                #region Engines and Jump Engines
                else if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.EngineComponents)
                {
                    int row = 0;

                    /// <summary>
                    /// loop through each engine.
                    /// </summary>
                    foreach (EngineDefTN Engine in CurrentFaction.ComponentList.Engines)
                    {
                        /// <summary>
                        /// Don't display obsolete engines.
                        /// </summary>
                        if (Engine.isObsolete == false)
                        {
                            /// <summary>
                            /// if current row is less than the current max row count set the row to visible and put the name of the engine component into the cell.
                            /// </summary>
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Engine);
                                BuildLocationDisplayDict.Add(Engine.Id, Engine.Name);
                                BuildLocationDict.Add(Engine.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Engine.Name;
                                row++;

                            }
                            /// <summary>
                            /// add a new row, and increment the current max row count.
                            /// </summary>
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Engine);
                                BuildLocationDisplayDict.Add(Engine.Id, Engine.Name);
                                BuildLocationDict.Add(Engine.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Engine.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    /// <summary>
                    /// Iterate through the Jump engines.
                    foreach (JumpEngineDefTN JumpEngine in CurrentFaction.ComponentList.JumpEngineDef)
                    {
                        /// <summary>
                        /// No obsolete components.
                        /// </summary>
                        if (JumpEngine.isObsolete == false)
                        {
                            /// <summary>
                            /// if current row is less than the current max row count set the row to visible and put the name of the engine component into the cell.
                            /// </summary>
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, JumpEngine);
                                BuildLocationDisplayDict.Add(JumpEngine.Id, JumpEngine.Name);
                                BuildLocationDict.Add(JumpEngine.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = JumpEngine.Name;
                                row++;

                            }
                        }
                        /// <summary>
                        /// add a new row, and increment the current max row count.
                        /// </summary>
                        else
                        {
                            using (DataGridViewRow Row = new DataGridViewRow())
                            {
                                // setup row height. note that by default they are 22 pixels in height!
                                Row.Height = 17;
                                m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                            }// make new rows and add items.

                            BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, JumpEngine);
                            BuildLocationDisplayDict.Add(JumpEngine.Id, JumpEngine.Name);
                            BuildLocationDict.Add(JumpEngine.Id, Temp);

                            m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                            m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = JumpEngine.Name;
                            row++;
                            BuildTabMaxRows++;
                        }
                    }

                    /// <summary>
                    /// set all other rows to not visible
                    /// </summary>
                    for (int RowIterator = row; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
                }
                #endregion
                #region Sensors and Fire Controls
                else if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.SensorsFCComponents)
                {
                    int row = 0;
                    foreach (PassiveSensorDefTN Passive in CurrentFaction.ComponentList.PassiveSensorDef)
                    {
                        if (Passive.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Passive);
                                BuildLocationDisplayDict.Add(Passive.Id, Passive.Name);
                                BuildLocationDict.Add(Passive.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Passive.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Passive);
                                BuildLocationDisplayDict.Add(Passive.Id, Passive.Name);
                                BuildLocationDict.Add(Passive.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Passive.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    foreach (ActiveSensorDefTN Active in CurrentFaction.ComponentList.ActiveSensorDef)
                    {
                        if (Active.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Active);
                                BuildLocationDisplayDict.Add(Active.Id, Active.Name);
                                BuildLocationDict.Add(Active.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Active.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Active);
                                BuildLocationDisplayDict.Add(Active.Id, Active.Name);
                                BuildLocationDict.Add(Active.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Active.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }
                    foreach (BeamFireControlDefTN BFC in CurrentFaction.ComponentList.BeamFireControlDef)
                    {
                        if (BFC.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, BFC);
                                BuildLocationDisplayDict.Add(BFC.Id, BFC.Name);
                                BuildLocationDict.Add(BFC.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = BFC.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, BFC);
                                BuildLocationDisplayDict.Add(BFC.Id, BFC.Name);
                                BuildLocationDict.Add(BFC.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = BFC.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    foreach (ActiveSensorDefTN MFC in CurrentFaction.ComponentList.MissileFireControlDef)
                    {
                        if (MFC.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, MFC);
                                BuildLocationDisplayDict.Add(MFC.Id, MFC.Name);
                                BuildLocationDict.Add(MFC.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = MFC.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, MFC);
                                BuildLocationDisplayDict.Add(MFC.Id, MFC.Name);
                                BuildLocationDict.Add(MFC.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = MFC.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    for (int RowIterator = row; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
                }
                #endregion
                #region Transport and Industry
                else if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.TransportIndustryComponents)
                {
                    int row = 0;
                    foreach (CargoDefTN Hold in CurrentFaction.ComponentList.CargoHoldDef)
                    {
                        if (Hold.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Hold);
                                BuildLocationDisplayDict.Add(Hold.Id, Hold.Name);
                                BuildLocationDict.Add(Hold.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Hold.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Hold);
                                BuildLocationDisplayDict.Add(Hold.Id, Hold.Name);
                                BuildLocationDict.Add(Hold.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Hold.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    foreach (ColonyDefTN Bay in CurrentFaction.ComponentList.ColonyBayDef)
                    {
                        if (Bay.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Bay);
                                BuildLocationDisplayDict.Add(Bay.Id, Bay.Name);
                                BuildLocationDict.Add(Bay.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Bay.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Bay);
                                BuildLocationDisplayDict.Add(Bay.Id, Bay.Name);
                                BuildLocationDict.Add(Bay.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Bay.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    foreach (CargoHandlingDefTN CHS in CurrentFaction.ComponentList.CargoHandleSystemDef)
                    {
                        if (CHS.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, CHS);
                                BuildLocationDisplayDict.Add(CHS.Id, CHS.Name);
                                BuildLocationDict.Add(CHS.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = CHS.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, CHS);
                                BuildLocationDisplayDict.Add(CHS.Id, CHS.Name);
                                BuildLocationDict.Add(CHS.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = CHS.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    for (int RowIterator = row; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
                }
                #endregion
                #region Weapon and Support Components
                else if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.WeaponsSupportComponents)
                {
                    int row = 0;
                    foreach (BeamDefTN Beam in CurrentFaction.ComponentList.BeamWeaponDef)
                    {
                        if (Beam.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Beam);
                                BuildLocationDisplayDict.Add(Beam.Id, Beam.Name);
                                BuildLocationDict.Add(Beam.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Beam.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Beam);
                                BuildLocationDisplayDict.Add(Beam.Id, Beam.Name);
                                BuildLocationDict.Add(Beam.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Beam.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    foreach (TurretDefTN Turret in CurrentFaction.ComponentList.TurretDef)
                    {
                        if (Turret.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Turret);
                                BuildLocationDisplayDict.Add(Turret.Id, Turret.Name);
                                BuildLocationDict.Add(Turret.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Turret.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Turret);
                                BuildLocationDisplayDict.Add(Turret.Id, Turret.Name);
                                BuildLocationDict.Add(Turret.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Turret.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    foreach (CIWSDefTN CIWS in CurrentFaction.ComponentList.CIWSDef)
                    {
                        if (CIWS.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, CIWS);
                                BuildLocationDisplayDict.Add(CIWS.Id, CIWS.Name);
                                BuildLocationDict.Add(CIWS.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = CIWS.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, CIWS);
                                BuildLocationDisplayDict.Add(CIWS.Id, CIWS.Name);
                                BuildLocationDict.Add(CIWS.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = CIWS.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    foreach (MissileLauncherDefTN Tube in CurrentFaction.ComponentList.MLauncherDef)
                    {
                        if (Tube.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Tube);
                                BuildLocationDisplayDict.Add(Tube.Id, Tube.Name);
                                BuildLocationDict.Add(Tube.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Tube.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Tube);
                                BuildLocationDisplayDict.Add(Tube.Id, Tube.Name);
                                BuildLocationDict.Add(Tube.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Tube.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    foreach (ReactorDefTN Reactor in CurrentFaction.ComponentList.ReactorDef)
                    {
                        if (Reactor.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Reactor);
                                BuildLocationDisplayDict.Add(Reactor.Id, Reactor.Name);
                                BuildLocationDict.Add(Reactor.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Reactor.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Reactor);
                                BuildLocationDisplayDict.Add(Reactor.Id, Reactor.Name);
                                BuildLocationDict.Add(Reactor.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Reactor.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    foreach (MagazineDefTN Mag in CurrentFaction.ComponentList.MagazineDef)
                    {
                        if (Mag.isObsolete == false)
                        {
                            if (row < BuildTabMaxRows)
                            {
                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Mag);
                                BuildLocationDisplayDict.Add(Mag.Id, Mag.Name);
                                BuildLocationDict.Add(Mag.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Mag.Name;
                                row++;

                            }
                            else
                            {
                                using (DataGridViewRow Row = new DataGridViewRow())
                                {
                                    // setup row height. note that by default they are 22 pixels in height!
                                    Row.Height = 17;
                                    m_oSummaryPanel.BuildDataGrid.Rows.Add(Row);
                                }// make new rows and add items.

                                BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.Component, Mag);
                                BuildLocationDisplayDict.Add(Mag.Id, Mag.Name);
                                BuildLocationDict.Add(Mag.Id, Temp);

                                m_oSummaryPanel.BuildDataGrid.Rows[row].Visible = true;
                                m_oSummaryPanel.BuildDataGrid.Rows[row].Cells[0].Value = Mag.Name;
                                row++;
                                BuildTabMaxRows++;
                            }
                        }
                    }

                    for (int RowIterator = row; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
                }
                #endregion
                #region Build PDC
                else if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.BuildPDCOrbitalHabitat)
                {
                    int row = 0;
                    for (int RowIterator = row; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
#warning do Industrial PDC orbhab build here
                }
                #endregion
                #region Prefab PDC
                else if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.PrefabPDC)
                {
                    int row = 0;
                    for (int RowIterator = row; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
#warning do Industrial PDC Prefab here
                }
                #endregion
                #region Assemble PDC
                else if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.AssemblePDC)
                {
                    int row = 0;
                    for (int RowIterator = row; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
#warning do Industrial PDC assembly here
                }
                #endregion
                #region Refit PDC
                else if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.RefitPDC)
                {
                    int row = 0;
                    for (int RowIterator = row; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
#warning do Industrial PDC refit here
                }
                #endregion
                #region Maintenance Supplies
                else if (m_oSummaryPanel.InstallationTypeComboBox.SelectedIndex == (int)UIConstants.EconomicsPage.ConstructionID.MaintenanceSupplies)
                {
                    /// <summary>
                    /// Maintenance supplies don't have a game entity, so this is a kludge to make that work within the confines of the existing build location dictionary.
                    /// </summary>
                    GameEntity Placeholder = new GameEntity();
                    Placeholder.Id = Guid.NewGuid();
                    BuildListObject Temp = new BuildListObject(BuildListObject.ListEntityType.MaintenanceSupplies, Placeholder);
                    BuildLocationDisplayDict.Add(Placeholder.Id, "Maintenance Supplies");
                    BuildLocationDict.Add(Placeholder.Id, Temp);

                    m_oSummaryPanel.BuildDataGrid.Rows[0].Visible = true;
                    m_oSummaryPanel.BuildDataGrid.Rows[0].Cells[0].Value = "Maintenance Supplies";

                    for (int RowIterator = 1; RowIterator < BuildTabMaxRows; RowIterator++)
                    {
                        m_oSummaryPanel.BuildDataGrid.Rows[RowIterator].Visible = false;
                    }
                }
                #endregion
            }

            BuildCostListBox();

            BuildStockListBoxes();

            Build_BuildQueue();

            BuildConstructionLabel();
            BuildRefiningLabel();

            UpdateBuildTexts();

            if (CurrentPopulation != null)
            {
                if (CurrentPopulation.IsRefining == false)
                {
                    m_oSummaryPanel.StopRefiningButton.Enabled = false;
                    m_oSummaryPanel.StartRefiningButton.Enabled = true;
                }
                else
                {
                    m_oSummaryPanel.StopRefiningButton.Enabled = true;
                    m_oSummaryPanel.StartRefiningButton.Enabled = false;
                }
            }
        }