//============================================================================*
        // Populate()
        //============================================================================*

        public void Populate(cFirearm.eFireArmType eFireArmType, cCaliber Caliber, cBullet Bullet, cPowder Powder)
        {
            if (Populating)
            {
                return;
            }

            Populating = true;

            Items.Clear();

            ListViewItem SelectItem = null;

            foreach (cBatch Batch in m_DataFiles.BatchList)
            {
                if (Batch.Archived && !m_DataFiles.Preferences.ShowArchivedBatches)
                {
                    continue;
                }

                if (m_DataFiles.Preferences.HideUncheckedCalibers && !Batch.Load.Caliber.Checked)
                {
                    continue;
                }

                if (m_DataFiles.Preferences.HideUncheckedSupplies && (!Batch.Load.Bullet.Checked || !Batch.Load.Case.Checked || !Batch.Load.Powder.Checked || !Batch.Load.Primer.Checked))
                {
                    continue;
                }

                ListViewItem Item = AddBatch(Batch, eFireArmType, Caliber, Bullet, Powder);

                if (Item != null && m_DataFiles.Preferences.LastBatchSelected != null && m_DataFiles.Preferences.LastBatchSelected.CompareTo(Batch) == 0)
                {
                    SelectItem = Item;
                }
            }

            Focus();

            if (SelectItem != null && SelectItem.Index >= 0)
            {
                SelectItem.Selected = true;

                EnsureVisible(SelectItem.Index);
            }
            else
            {
                if (Items.Count > 0)
                {
                    Items[0].Selected = true;

                    m_DataFiles.Preferences.LastBatchSelected = (cBatch)Items[0].Tag;

                    EnsureVisible(Items[0].Index);
                }
            }

            Populating = false;
        }
Esempio n. 2
0
        //============================================================================*
        // Copy()
        //============================================================================*

        public void Copy(cBullet Bullet, bool fCopyBase = true)
        {
            if (fCopyBase)
            {
                base.Copy(Bullet);
            }

            m_strPartNumber         = Bullet.m_strPartNumber;
            m_strType               = Bullet.m_strType;
            m_dDiameter             = Bullet.m_dDiameter;
            m_dLength               = Bullet.m_dLength;
            m_dWeight               = Bullet.m_dWeight;
            m_dBallisticCoefficient = Bullet.m_dBallisticCoefficient;

            m_fSelfCast = Bullet.m_fSelfCast;
            m_nTopPunch = Bullet.m_nTopPunch;

            if (Bullet.BulletCaliberList != null)
            {
                m_BulletCaliberList = new cBulletCaliberList(Bullet.BulletCaliberList);
            }
            else
            {
                m_BulletCaliberList = new cBulletCaliberList();
            }
        }
Esempio n. 3
0
        //============================================================================*
        // OnBulletSelected()
        //============================================================================*

        private void OnBulletSelected(Object sender, EventArgs e)
        {
            if (!m_fInitialized || m_fPopulating)
            {
                return;
            }

            if (BulletCombo.SelectedIndex > 0 || BulletCombo.SelectedItem is cBullet)
            {
                cBullet Bullet = (cBullet)BulletCombo.SelectedItem;

                m_StabilityData.Bullet = Bullet;
            }

            PopulateLoadCombo();
            PopulateFirearmCombo();

            PopulateData();

            SetMinMax();

            UpdateButtons();

            SetStabilityFactor();
        }
Esempio n. 4
0
        //============================================================================*
        // PopulateFirearmCombo()
        //============================================================================*

        private void PopulateFirearmCombo()
        {
            m_fPopulating = true;

            //----------------------------------------------------------------------------*
            // Get the currently selected firearm
            //----------------------------------------------------------------------------*

            cFirearm SelectedFirearm = null;

            if (FirearmCombo.SelectedIndex > 0 || FirearmCombo.SelectedItem is cFirearm)
            {
                SelectedFirearm = (cFirearm)FirearmCombo.SelectedItem;
            }

            //----------------------------------------------------------------------------*
            // Reset the firearm combo
            //----------------------------------------------------------------------------*

            FirearmCombo.Items.Clear();

            //----------------------------------------------------------------------------*
            // Get the selected Bullet
            //----------------------------------------------------------------------------*

            cBullet Bullet = null;

            if (BulletCombo.SelectedIndex > 0 || BulletCombo.SelectedItem is cBullet)
            {
                Bullet = (cBullet)BulletCombo.SelectedItem;
            }

            //----------------------------------------------------------------------------*
            // Populate the firearm combo
            //----------------------------------------------------------------------------*

            FirearmCombo.Items.Add("No Specific Firearm");

            foreach (cFirearm Firearm in m_DataFiles.FirearmList)
            {
                if (Firearm.FirearmType == cFirearm.eFireArmType.Rifle &&
                    (Bullet == null || Firearm.CanUseBullet(Bullet)))
                {
                    FirearmCombo.Items.Add(Firearm);
                }
            }

            if (SelectedFirearm != null)
            {
                FirearmCombo.SelectedItem = SelectedFirearm;
            }

            if (FirearmCombo.SelectedIndex == -1)
            {
                FirearmCombo.SelectedIndex = 0;
            }

            m_fPopulating = false;
        }
Esempio n. 5
0
        //============================================================================*
        // OnBulletSelected()
        //============================================================================*

        private void OnBulletSelected(object sender, EventArgs e)
        {
            m_Bullet = (cBullet)BulletCombo.SelectedItem;

            SetBulletImage();

            UpdateButtons();
        }
        //============================================================================*
        // Copy()
        //============================================================================*

        public void Copy(cFirearmBullet FirearmBullet)
        {
            m_Caliber = FirearmBullet.m_Caliber;
            m_Bullet  = FirearmBullet.m_Bullet;

            m_dCOL  = FirearmBullet.m_dCOL;
            m_dCBTO = FirearmBullet.m_dCBTO;
            m_dJump = FirearmBullet.m_dJump;
        }
Esempio n. 7
0
        //============================================================================*
        // Append()
        //============================================================================*

        public int Append(cBullet Bullet, bool fCountOnly = false)
        {
            int nUpdateCount = base.Append(Bullet, fCountOnly);

            if (String.IsNullOrEmpty(m_strType) && !String.IsNullOrEmpty(Bullet.m_strType))
            {
                m_strType = Bullet.m_strType;

                nUpdateCount++;
            }

            if (m_dDiameter == 0.0 && m_dDiameter != 0.0)
            {
                m_dDiameter = Bullet.m_dDiameter;

                nUpdateCount++;
            }

            if (m_dLength == 0.0 && Bullet.m_dLength != 0.0)
            {
                m_dLength = Bullet.m_dLength;

                nUpdateCount++;
            }

            if (m_dWeight == 0.0 && Bullet.m_dWeight != 0.0)
            {
                m_dWeight = Bullet.m_dWeight;

                nUpdateCount++;
            }

            if (m_dBallisticCoefficient == 0.0 && Bullet.m_dBallisticCoefficient != 0.0)
            {
                m_dBallisticCoefficient = Bullet.m_dBallisticCoefficient;

                nUpdateCount++;
            }

            if (!m_fSelfCast && Bullet.m_fSelfCast)
            {
                m_fSelfCast = Bullet.m_fSelfCast;

                nUpdateCount++;
            }

            if (m_nTopPunch == 0 && Bullet.m_nTopPunch != 0)
            {
                m_nTopPunch = Bullet.m_nTopPunch;

                nUpdateCount++;
            }

            return(nUpdateCount);
        }
        //============================================================================*
        // Synch() - Bullet
        //============================================================================*

        public bool Synch(cBullet Bullet)
        {
            if (m_Bullet != null && m_Bullet.CompareTo(Bullet) == 0)
            {
                m_Bullet = Bullet;

                return(true);
            }

            return(false);
        }
Esempio n. 9
0
        //============================================================================*
        // Populate()
        //============================================================================*

        public void Populate(cFirearm.eFireArmType eFirearmType, cCaliber Caliber, cBullet Bullet, double dBulletWeight, cPowder Powder, cPrimer Primer, cCase Case)
        {
            Populating = true;

            //----------------------------------------------------------------------------*
            // LoadsListView Items
            //----------------------------------------------------------------------------*

            Items.Clear();

            while (Columns.Count > 3)
            {
                Columns.RemoveAt(3);
            }

            ListViewItem SelectItem = null;

            foreach (cLoad Load in m_DataFiles.LoadList)
            {
                if (Load.FirearmType == eFirearmType &&
                    (Caliber == null || Load.Caliber.CompareTo(Caliber) == 0) &&
                    (Bullet == null || Load.Bullet.CompareTo(Bullet) == 0) &&
                    (Load.Bullet.Weight == dBulletWeight) &&
                    (Powder == null || Load.Powder.CompareTo(Powder) == 0) &&
                    (Case == null || Load.Case.CompareTo(Case) == 0) &&
                    (Primer == null || Load.Primer.CompareTo(Primer) == 0))
                {
                    ListViewItem Item = AddLoad(Load);

                    if (Item != null && Load.CompareTo(m_DataFiles.Preferences.LastCopyLoadSelected) == 0)
                    {
                        SelectItem = Item;
                    }
                }
            }

            if (SelectItem != null)
            {
                SelectItem.Selected = true;
            }
            else
            {
                if (Items.Count > 0)
                {
                    Items[0].Selected = true;

                    m_DataFiles.Preferences.LastCopyLoadSelected = (cLoad)Items[0].Tag;

                    Items[0].EnsureVisible();
                }
            }

            Populating = false;
        }
Esempio n. 10
0
        //============================================================================*
        // Synch() - Bullet
        //============================================================================*

        public bool Synch(cBullet Bullet)
        {
            bool fFound = false;

            foreach (cFirearmBullet CheckFirearmBullet in m_FirearmBulletList)
            {
                fFound = CheckFirearmBullet.Synch(Bullet);
            }

            return(fFound);
        }
Esempio n. 11
0
        //============================================================================*
        // cLoad() - Copy Constructor
        //============================================================================*

        public cLoad(cLoad Load)
        {
            m_eFirearmType = Load.m_eFirearmType;
            m_Caliber      = Load.m_Caliber;
            m_Bullet       = Load.m_Bullet;
            m_Powder       = Load.m_Powder;
            m_Case         = Load.m_Case;
            m_Primer       = Load.m_Primer;
            m_fChecked     = Load.m_fChecked;
            m_fIdentity    = Load.m_fIdentity;

            m_ChargeList = new cChargeList(Load.m_ChargeList);
        }
Esempio n. 12
0
        //============================================================================*
        // CompareTo()
        //============================================================================*

        public override int CompareTo(Object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            //----------------------------------------------------------------------------*
            // Base Class
            //----------------------------------------------------------------------------*

            cSupply Supply = (cSupply)obj;

            int rc = base.CompareTo(Supply);

            //----------------------------------------------------------------------------*
            // Compare Part Numbers
            //----------------------------------------------------------------------------*

            if (rc == 0)
            {
                cBullet Bullet = (cBullet)Supply;

                if (string.IsNullOrEmpty(m_strPartNumber))
                {
                    if (!string.IsNullOrEmpty(Bullet.m_strPartNumber))
                    {
                        rc = -1;
                    }
                    else
                    {
                        rc = 0;
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(Bullet.m_strPartNumber))
                    {
                        rc = 1;
                    }
                    else
                    {
                        rc = cDataFiles.ComparePartNumbers(m_strPartNumber, Bullet.m_strPartNumber);
                    }
                }
            }

            return(rc);
        }
Esempio n. 13
0
        //============================================================================*
        // CanUseBullet()
        //============================================================================*

        public bool CanUseBullet(cBullet Bullet)
        {
            if (Bullet != null)
            {
                foreach (cFirearmCaliber FirearmCaliber in m_FirearmCaliberList)
                {
                    if (Bullet.HasCaliber(FirearmCaliber.Caliber))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 14
0
        //============================================================================*
        // OnBulletSelected()
        //============================================================================*

        private void OnBulletSelected(object sender, EventArgs e)
        {
            if (!m_fInitialized)
            {
                return;
            }

            m_Bullet = (cBullet)BulletCombo.SelectedItem;

            SetBulletImage();

            m_fChanged = true;

            UpdateButtons();
        }
        //============================================================================*
        // Populate()
        //============================================================================*

        public void Populate(cFirearm.eFireArmType eFirearmType, cCaliber Caliber, cBullet Bullet, cPowder Powder)
        {
            Populating = true;

            //----------------------------------------------------------------------------*
            // LoadsListView Items
            //----------------------------------------------------------------------------*

            Items.Clear();

            while (Columns.Count > 5)
            {
                Columns.RemoveAt(5);
            }

            ListViewItem SelectItem = null;

            foreach (cLoad Load in m_DataFiles.LoadList)
            {
                ListViewItem Item = AddLoad(Load, eFirearmType, Caliber, Bullet, Powder);

                if (Item != null && Load.CompareTo(m_DataFiles.Preferences.LastLoadSelected) == 0)
                {
                    SelectItem = Item;
                }
            }

            if (SelectItem != null)
            {
                SelectItem.Selected = true;
            }
            else
            {
                if (Items.Count > 0)
                {
                    Items[0].Selected = true;

                    m_DataFiles.Preferences.LastLoadSelected = (cLoad)Items[0].Tag;
                }
            }

            if (SelectedItems.Count > 0)
            {
                SelectedItems[0].EnsureVisible();
            }

            Populating = false;
        }
Esempio n. 16
0
        //============================================================================*
        // Synch() - Bullet
        //============================================================================*

        public bool Synch(cBullet Bullet)
        {
            if (m_Supply.SupplyType != cSupply.eSupplyTypes.Bullets)
            {
                return(false);
            }

            if ((m_Supply as cBullet).CompareTo(Bullet) == 0)
            {
                m_Supply = Bullet;

                return(true);
            }

            return(false);
        }
Esempio n. 17
0
        //============================================================================*
        // HasBullet()
        //============================================================================*

        public bool HasBullet(cBullet Bullet, cCaliber Caliber)
        {
            if (Bullet == null || Caliber == null)
            {
                return(false);
            }

            foreach (cFirearmBullet CheckBullet in m_FirearmBulletList)
            {
                if (CheckBullet.Bullet.CompareTo(Bullet) == 0 && CheckBullet.Caliber.CompareTo(Caliber) == 0)
                {
                    return(true);
                }
            }

            return(false);
        }
        //============================================================================*
        // PopulateChargeListView()
        //============================================================================*

        private void PopulateChargeListView()
        {
            //----------------------------------------------------------------------------*
            // ChargeListView Data
            //----------------------------------------------------------------------------*

            cFirearm.eFireArmType FirearmType = m_Load.FirearmType;
            cCaliber Caliber = m_Load.Caliber;
            cPowder  Powder  = m_Load.Powder;

            cBullet Bullet = MatchBulletRadioButton.Checked ? m_Load.Bullet : null;
            cPrimer Primer = MatchPrimerRadioButton.Checked ? m_Load.Primer : null;
            cCase   Case   = MatchCaseRadioButton.Checked ? m_Load.Case : null;

            m_ChargeListView.Populate(FirearmType, Caliber, Bullet, m_Load.Bullet.Weight, Powder, Primer, Case);

            UpdateButtons();
        }
        //============================================================================*
        // Populate()
        //============================================================================*

        public void Populate(cBullet Bullet)
        {
            Populating = true;

            m_strDimensionFormat = m_DataFiles.Preferences.FormatString(cDataFiles.eDataType.Dimension);

            Items.Clear();

            ListViewItem SelectItem = null;

            foreach (cBulletCaliber BulletCaliber in Bullet.BulletCaliberList)
            {
                ListViewItem Item = AddBulletCaliber(BulletCaliber);

                if (Item != null && m_DataFiles.Preferences.LastBulletCaliberSelected != null && m_DataFiles.Preferences.LastBulletCaliberSelected.CompareTo(BulletCaliber) == 0)
                {
                    SelectItem = Item;
                }
            }

            Focus();

            if (SelectItem != null)
            {
                SelectItem.Selected = true;

                EnsureVisible(SelectItem.Index);
            }
            else
            {
                if (Items.Count > 0)
                {
                    Items[0].Selected = true;

                    m_DataFiles.Preferences.LastBulletCaliberSelected = (cBulletCaliber)Items[0].Tag;

                    EnsureVisible(Items[0].Index);
                }
            }

            Populating = false;
        }
Esempio n. 20
0
        //============================================================================*
        // Populate()
        //============================================================================*

        public void Populate(cFirearm.eFireArmType eFirearmType, cCaliber Caliber, cBullet Bullet, cPowder Powder)
        {
            Populating = true;

            Items.Clear();

            ListViewItem SelectItem = null;

            foreach (cLoad CheckLoad in m_DataFiles.LoadList)
            {
                ListViewItem Item = AddLoad(CheckLoad, eFirearmType, Caliber, Bullet, Powder);

                if (Item != null && m_Batch.Load != null && m_Batch.Load.CompareTo(CheckLoad) == 0)
                {
                    SelectItem = Item;
                }
            }

            Focus();

            if (SelectItem != null)
            {
                SelectItem.Selected = true;

                EnsureVisible(SelectItem.Index);
            }
            else
            {
                if (Items.Count > 0)
                {
                    Items[0].Selected = true;

                    m_DataFiles.Preferences.LastBatchLoadSelected = (cLoad)Items[0].Tag;

                    EnsureVisible(Items[0].Index);
                }
            }

            Populating = false;
        }
Esempio n. 21
0
        //============================================================================*
        // Comparer()
        //============================================================================*

        public static int Comparer(cBullet Bullet1, cBullet Bullet2)
        {
            if (Bullet1 == null)
            {
                if (Bullet2 != null)
                {
                    return(-1);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                if (Bullet2 == null)
                {
                    return(1);
                }
            }

            return(Bullet1.CompareTo(Bullet2));
        }
Esempio n. 22
0
        //============================================================================*
        // cBullet() - Copy Constructor
        //============================================================================*

        public cBullet(cBullet Bullet)
            : base(Bullet)
        {
            Copy(Bullet, false);
        }
Esempio n. 23
0
        //============================================================================*
        // AddBatch()
        //============================================================================*

        public ListViewItem AddBatch(cBatch Batch, cFirearm.eFireArmType eFireArmType, cCaliber Caliber, cBullet Bullet, cPowder Powder, bool fSelect = false)
        {
            if (!VerifyBatch(Batch, eFireArmType, Caliber, Bullet, Powder))
            {
                return(null);
            }

            //----------------------------------------------------------------------------*
            // Create the ListViewItem
            //----------------------------------------------------------------------------*

            ListViewItem Item = new ListViewItem();

            SetBatchData(Item, Batch);

            //----------------------------------------------------------------------------*
            // Add the item and exit
            //----------------------------------------------------------------------------*

            AddItem(Item, fSelect);

            return(Item);
        }
Esempio n. 24
0
        //============================================================================*
        // VerifyBatch()
        //============================================================================*

        public bool VerifyBatch(cBatch Batch, cFirearm.eFireArmType eFirearmType, cCaliber Caliber, cBullet Bullet, cPowder Powder)
        {
            //----------------------------------------------------------------------------*
            // Make sure the batch shouldn't be hidden
            //----------------------------------------------------------------------------*

            /*
             *                      if ((m_DataFiles.Preferences.HideUncheckedCalibers && !Batch.Load.Caliber.Checked) ||
             *                              (m_DataFiles.Preferences.HideUncheckedSupplies && !Batch.Load.Bullet.Checked) ||
             *                              (m_DataFiles.Preferences.HideUncheckedSupplies && !Batch.Load.Powder.Checked) ||
             *                              (m_DataFiles.Preferences.HideUncheckedSupplies && !Batch.Load.Primer.Checked) ||
             *                              (m_DataFiles.Preferences.HideUncheckedSupplies && !Batch.Load.Case.Checked) ||
             *                              Batch.Archived)
             *                              return (false);
             */
            //----------------------------------------------------------------------------*
            // Check the filters
            //----------------------------------------------------------------------------*

            if (Batch.Load.FirearmType != eFirearmType)
            {
                return(false);
            }

            if (Caliber != null && Batch.Load.Caliber != Caliber)
            {
                return(false);
            }

            if (Bullet != null && Batch.Load.Bullet != Bullet)
            {
                return(false);
            }

            if (Powder != null && Batch.Load.Powder != Powder)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 25
0
        //============================================================================*
        // UpdateBatch()
        //============================================================================*

        public ListViewItem UpdateBatch(cBatch Batch, cFirearm.eFireArmType eFirearmType, cCaliber Caliber, cBullet Bullet, cPowder Powder, bool fSelect = false)
        {
            //----------------------------------------------------------------------------*
            // Find the Item
            //----------------------------------------------------------------------------*

            ListViewItem Item = null;

            foreach (ListViewItem CheckItem in Items)
            {
                if ((CheckItem.Tag as cBatch).CompareTo(Batch) == 0)
                {
                    Item = CheckItem;

                    break;
                }
            }

            //----------------------------------------------------------------------------*
            // If the item was not found, add it
            //----------------------------------------------------------------------------*

            if (Item == null)
            {
                return(null);
            }

            //----------------------------------------------------------------------------*
            // Otherwise, update the Item Data
            //----------------------------------------------------------------------------*

            SetBatchData(Item, Batch);

            Item.Selected = fSelect;

            if (SelectedItems.Count > 0)
            {
                SelectedItems[0].EnsureVisible();
            }

            Focus();

            return(Item);
        }
Esempio n. 26
0
        //============================================================================*
        // Compare()
        //============================================================================*

        public override int Compare(Object Object1, Object Object2)
        {
            if (Object1 == null)
            {
                if (Object2 == null)
                {
                    return(0);
                }
                else
                {
                    return(-1);
                }
            }
            else
            {
                if (Object2 == null)
                {
                    return(1);
                }
            }

            cBullet Bullet1 = (cBullet)(Object1 as ListViewItem).Tag;
            cBullet Bullet2 = (cBullet)(Object2 as ListViewItem).Tag;

            if (Bullet1 == null)
            {
                if (Bullet2 == null)
                {
                    return(0);
                }
                else
                {
                    return(-1);
                }
            }
            else
            {
                if (Bullet2 == null)
                {
                    return(1);
                }
            }

            bool fSpecial = false;
            int  rc       = 0;

            string strPart1 = "";
            string strPart2 = "";

            switch (SortColumn)
            {
            //----------------------------------------------------------------------------*
            // Manufacturer
            //----------------------------------------------------------------------------*

            case 0:
                rc = Bullet1.Manufacturer.CompareTo(Bullet2.Manufacturer);

                if (rc == 0)
                {
                    rc = cDataFiles.ComparePartNumbers(Bullet1.PartNumber, Bullet2.PartNumber);
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Part Number
            //----------------------------------------------------------------------------*

            case 1:
                strPart1 = Bullet1.PartNumber;
                strPart2 = Bullet2.PartNumber;

                rc = cDataFiles.ComparePartNumbers(Bullet1.PartNumber, Bullet2.PartNumber);

                if (rc == 0)
                {
                    rc = Bullet1.Manufacturer.CompareTo(Bullet2.Manufacturer);
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Diameter
            //----------------------------------------------------------------------------*

            case 4:
                double dDiameter1 = Bullet1.Diameter;
                double dDiameter2 = Bullet2.Diameter;

                rc = dDiameter1.CompareTo(dDiameter2);

                if (rc == 0)
                {
                    rc = Bullet1.Manufacturer.CompareTo(Bullet2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Bullet1.PartNumber, Bullet2.PartNumber);
                    }
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Weight
            //----------------------------------------------------------------------------*

            case 5:
                double nWeight1 = Bullet1.Weight;
                double nWeight2 = Bullet2.Weight;

                rc = nWeight1.CompareTo(nWeight2);

                if (rc == 0)
                {
                    rc = Bullet1.Manufacturer.CompareTo(Bullet2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Bullet1.PartNumber, Bullet2.PartNumber);
                    }
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Length
            //----------------------------------------------------------------------------*

            case 6:
                double nLength1 = Bullet1.Length;
                double nLength2 = Bullet2.Length;

                rc = nLength1.CompareTo(nLength2);

                if (rc == 0)
                {
                    rc = Bullet1.Manufacturer.CompareTo(Bullet2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Bullet1.PartNumber, Bullet2.PartNumber);
                    }
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // BC
            //----------------------------------------------------------------------------*

            case 7:
                double dBC1 = Bullet1.BallisticCoefficient;
                double dBC2 = Bullet2.BallisticCoefficient;

                rc = dBC1.CompareTo(dBC2);

                if (rc == 0)
                {
                    rc = Bullet1.Manufacturer.CompareTo(Bullet2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Bullet1.PartNumber, Bullet2.PartNumber);
                    }
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // SD
            //----------------------------------------------------------------------------*

            case 8:
                double dSD1 = Bullet1.SectionalDensity;
                double dSD2 = Bullet2.SectionalDensity;

                rc = dSD1.CompareTo(dSD2);

                if (rc == 0)
                {
                    rc = Bullet1.Manufacturer.CompareTo(Bullet2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Bullet1.PartNumber, Bullet2.PartNumber);
                    }
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Num Calibers
            //----------------------------------------------------------------------------*

            case 9:
                double dNumCalibers1 = Bullet1.BulletCaliberList.Count;
                double dNumCalibers2 = Bullet2.BulletCaliberList.Count;

                rc = dNumCalibers1.CompareTo(dNumCalibers2);

                if (rc == 0)
                {
                    rc = Bullet1.Manufacturer.CompareTo(Bullet2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Bullet1.PartNumber, Bullet2.PartNumber);
                    }
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Top Punch
            //----------------------------------------------------------------------------*

            case 11:
                int nPunch1 = Bullet1.TopPunch;
                int nPunch2 = Bullet2.TopPunch;

                rc = nPunch1.CompareTo(nPunch2);

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Quantity
            //----------------------------------------------------------------------------*

            case 12:
                double dQuantity1 = Bullet1.Quantity;
                double dQuantity2 = Bullet2.Quantity;

                if (m_DataFiles.Preferences.TrackInventory)
                {
                    dQuantity1 = Bullet1.QuantityOnHand;
                    dQuantity2 = Bullet2.QuantityOnHand;
                }

                rc = dQuantity1.CompareTo(dQuantity2);

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Cost
            //----------------------------------------------------------------------------*

            case 13:
                double dCost1 = 0.0;

                if ((Object1 as ListViewItem).Text != "-")
                {
                    Double.TryParse((Object1 as ListViewItem).SubItems[13].Text, out dCost1);
                }

                double dCost2 = 0.0;

                if ((Object2 as ListViewItem).Text != "-")
                {
                    Double.TryParse((Object2 as ListViewItem).SubItems[13].Text, out dCost2);
                }

                rc = dCost1.CompareTo(dCost2);

                fSpecial = true;

                break;
            }

            //----------------------------------------------------------------------------*
            // Return results
            //----------------------------------------------------------------------------*

            if (fSpecial)
            {
                if (SortingOrder == SortOrder.Descending)
                {
                    return(0 - rc);
                }

                return(rc);
            }

            return(base.Compare(Object1, Object2));
        }
Esempio n. 27
0
        //============================================================================*
        // AddLoad()
        //============================================================================*

        public ListViewItem AddLoad(cLoad Load, cFirearm.eFireArmType eFirearmType, cCaliber Caliber, cBullet Bullet, cPowder Powder)
        {
            //----------------------------------------------------------------------------*
            // Verify that the load should be added
            //----------------------------------------------------------------------------*

            if (!VerifyLoad(Load, eFirearmType, Caliber, Bullet, Powder))
            {
                return(null);
            }

            //----------------------------------------------------------------------------*
            // Create the Item
            //----------------------------------------------------------------------------*

            ListViewItem Item = new ListViewItem();

            SetLoadData(Item, Load);

            //----------------------------------------------------------------------------*
            // Add the item and exit
            //----------------------------------------------------------------------------*

            AddItem(Item);

            return(Item);
        }
Esempio n. 28
0
        //============================================================================*
        // VerifyLoad()
        //============================================================================*

        public bool VerifyLoad(cLoad Load, cFirearm.eFireArmType eFirearmType, cCaliber Caliber, cBullet Bullet, cPowder Powder)
        {
            if (Load == null)
            {
                return(false);
            }

            //----------------------------------------------------------------------------*
            // See if we need to show this load regardless of other considerations
            //----------------------------------------------------------------------------*

            if (m_fShowBatchLoad && m_Batch.Load.CompareTo(Load) == 0)
            {
                return(true);
            }

            //----------------------------------------------------------------------------*
            // Check Filters
            //----------------------------------------------------------------------------*

            if ((eFirearmType != cFirearm.eFireArmType.None && Load.FirearmType != eFirearmType) ||
                (Caliber != null && Load.Caliber.CompareTo(Caliber) != 0) ||
                (Bullet != null && Load.Bullet.CompareTo(Bullet) != 0) ||
                (Powder != null && Load.Powder.CompareTo(Powder) != 0))
            {
                return(false);
            }

            //----------------------------------------------------------------------------*
            // Check Inventory
            //----------------------------------------------------------------------------*

            if (!m_DataFiles.VerifyLoadQuantities(m_Batch, Load))
            {
                return(false);
            }

            //----------------------------------------------------------------------------*
            // Make sure the caliber is not hidden
            //----------------------------------------------------------------------------*

            if (m_DataFiles.Preferences.HideUncheckedCalibers && !Load.Caliber.Checked)
            {
                return(false);
            }

            //----------------------------------------------------------------------------*
            // Make sure the supplies are not hidden
            //----------------------------------------------------------------------------*

            if (m_DataFiles.Preferences.HideUncheckedSupplies)
            {
                if (!Load.Bullet.Checked || !Load.Powder.Checked || !Load.Primer.Checked || !Load.Case.Checked)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 29
0
        //============================================================================*
        // PopulateLoadDataPowderCombo()
        //============================================================================*

        private void PopulateLoadDataPowderCombo()
        {
            cCaliber.CurrentFirearmType = LoadDataFirearmTypeCombo.Value;

            m_fPopulating = true;

            LoadDataPowderCombo.Items.Clear();

            cFirearm.eFireArmType eFirearmType = LoadDataFirearmTypeCombo.Value;

            cCaliber Caliber = null;

            if (LoadDataCaliberCombo.SelectedIndex > 0)
            {
                Caliber = (cCaliber)LoadDataCaliberCombo.SelectedItem;
            }

            cBullet Bullet = null;

            if (LoadDataBulletCombo.SelectedIndex > 0)
            {
                Bullet = (cBullet)LoadDataBulletCombo.SelectedItem;
            }

            LoadDataPowderCombo.Items.Add("Any Powder");

            cPowder SelectPowder = null;

            foreach (cLoad Load in m_DataFiles.LoadList)
            {
                if ((Caliber == null || Load.Caliber.CompareTo(Caliber) == 0) &&
                    (eFirearmType == cFirearm.eFireArmType.None || Load.FirearmType == eFirearmType) &&
                    (Bullet == null || Load.Bullet.CompareTo(Bullet) == 0))
                {
                    if (Load.Powder.CrossUse || Load.Powder.FirearmType == eFirearmType)
                    {
                        if (LoadDataPowderCombo.Items.IndexOf(Load.Powder) < 0)
                        {
                            LoadDataPowderCombo.Items.Add(Load.Powder);

                            if (Load.Powder.CompareTo(m_DataFiles.Preferences.LastLoadDataPowderSelected) == 0)
                            {
                                SelectPowder = Load.Powder;
                            }
                        }
                    }
                }
            }

            if (SelectPowder != null)
            {
                LoadDataPowderCombo.SelectedItem = SelectPowder;
            }
            else
            {
                if (LoadDataPowderCombo.Items.Count > 0)
                {
                    LoadDataPowderCombo.SelectedIndex = 0;
                }
            }

            if (LoadDataPowderCombo.SelectedIndex < 0)
            {
                LoadDataPowderCombo.SelectedIndex = 0;
            }

            m_fPopulating = false;

            PopulateLoadDataListView();
        }
Esempio n. 30
0
        //============================================================================*
        // OnPrintPage()
        //============================================================================*

        private void OnPrintPage(object sender, PrintPageEventArgs e)
        {
            //----------------------------------------------------------------------------*
            // Create the fonts
            //----------------------------------------------------------------------------*

//			Font TitleFont = new Font("Trebuchet MS", 16, FontStyle.Bold);
            Font SupplyTypeFont = new Font("Trebuchet MS", 14, FontStyle.Bold);
            Font HeaderFont     = new Font("Trebuchet MS", 10, FontStyle.Bold);
            Font DataFont       = new Font("Trebuchet MS", 8, FontStyle.Regular);

            //----------------------------------------------------------------------------*
            // Calculate Column Header Name Widths
            //----------------------------------------------------------------------------*

            string strText;
            SizeF  TextSize;

            foreach (cPrintColumn PrintColumn in m_BulletColumns)
            {
                TextSize = e.Graphics.MeasureString(PrintColumn.Name, HeaderFont);

                if (TextSize.Width > PrintColumn.Width)
                {
                    PrintColumn.Width = TextSize.Width;
                }
            }

            foreach (cPrintColumn PrintColumn in m_PowderColumns)
            {
                TextSize = e.Graphics.MeasureString(PrintColumn.Name, HeaderFont);

                if (TextSize.Width > PrintColumn.Width)
                {
                    PrintColumn.Width = TextSize.Width;
                }
            }

            foreach (cPrintColumn PrintColumn in m_CaseColumns)
            {
                TextSize = e.Graphics.MeasureString(PrintColumn.Name, HeaderFont);

                if (TextSize.Width > PrintColumn.Width)
                {
                    PrintColumn.Width = TextSize.Width;
                }
            }

            foreach (cPrintColumn PrintColumn in m_PrimerColumns)
            {
                TextSize = e.Graphics.MeasureString(PrintColumn.Name, HeaderFont);

                if (TextSize.Width > PrintColumn.Width)
                {
                    PrintColumn.Width = TextSize.Width;
                }
            }

            //----------------------------------------------------------------------------*
            // Calculate Header Widths for Supplies
            //----------------------------------------------------------------------------*

            foreach (cSupply Supply in m_SupplyList)
            {
                switch (Supply.SupplyType)
                {
                case cSupply.eSupplyTypes.Bullets:
                    TextSize = e.Graphics.MeasureString((Supply as cBullet).ToString(), DataFont);

                    if (TextSize.Width > m_BulletColumns[0].Width)
                    {
                        m_BulletColumns[0].Width = TextSize.Width;
                    }

                    break;

                case cSupply.eSupplyTypes.Powder:
                    TextSize = e.Graphics.MeasureString((Supply as cPowder).ToString(), DataFont);

                    if (TextSize.Width > m_PowderColumns[0].Width)
                    {
                        m_PowderColumns[0].Width = TextSize.Width;
                    }

                    break;

                case cSupply.eSupplyTypes.Primers:
                    TextSize = e.Graphics.MeasureString((Supply as cPrimer).ToShortString(), DataFont);

                    if (TextSize.Width > m_PrimerColumns[0].Width)
                    {
                        m_PrimerColumns[0].Width = TextSize.Width;
                    }

                    TextSize = e.Graphics.MeasureString((Supply as cPrimer).SizeString, DataFont);

                    if (TextSize.Width > m_PrimerColumns[1].Width)
                    {
                        m_PrimerColumns[1].Width = TextSize.Width;
                    }

                    TextSize = e.Graphics.MeasureString("0.00/1000", DataFont);

                    if (TextSize.Width > m_PrimerColumns[3].Width)
                    {
                        m_PrimerColumns[3].Width = TextSize.Width;
                    }
                    break;

                case cSupply.eSupplyTypes.Cases:
                    TextSize = e.Graphics.MeasureString((Supply as cCase).Manufacturer.Name, DataFont);

                    if (TextSize.Width > m_CaseColumns[0].Width)
                    {
                        m_CaseColumns[0].Width = TextSize.Width;
                    }

                    TextSize = e.Graphics.MeasureString((Supply as cCase).Caliber.ToString(), DataFont);

                    if (TextSize.Width > m_CaseColumns[2].Width)
                    {
                        m_CaseColumns[2].Width = TextSize.Width;
                    }

                    break;
                }
            }

            //----------------------------------------------------------------------------*
            // Loop through the supply types
            //----------------------------------------------------------------------------*

            Rectangle PageRect = e.PageBounds;

            int nXDPI = (int)((double)PageRect.Width / 8.5);
            int nYDPI = (int)((double)PageRect.Height / 11);

            PageRect.X     += (int)((double)nXDPI * 0.5);
            PageRect.Width -= ((int)((double)nXDPI * 0.5) * 2);

            PageRect.Y      += (int)((double)nYDPI * 0.5);
            PageRect.Height -= ((int)((double)nYDPI * 0.5) * 2);

            float nY = PageRect.Top;
            float nX = PageRect.Left;

            bool fPageHeader = false;

            for (int nSupplyType = 0; nSupplyType < (int)cSupply.eSupplyTypes.NumSupplyTypes; nSupplyType++)
            {
                cSupply.eSupplyTypes eSupplyType = (cSupply.eSupplyTypes)nSupplyType;

                //----------------------------------------------------------------------------*
                // Loop through the supplies in the list
                //----------------------------------------------------------------------------*

                bool fHeader = false;

                foreach (cSupply Supply in m_SupplyList)
                {
                    if (nY > PageRect.Bottom)
                    {
                        e.HasMorePages = true;

                        return;
                    }

                    //----------------------------------------------------------------------------*
                    // If this supply is not the right type, or has already been printed, skip
                    // to the next supply in the list
                    //----------------------------------------------------------------------------*

                    if (Supply.Printed || Supply.SupplyType != eSupplyType)
                    {
                        continue;
                    }

                    Supply.Printed = true;

                    //----------------------------------------------------------------------------*
                    // Draw the page header if needed
                    //----------------------------------------------------------------------------*

                    if (!fPageHeader)
                    {
                        //----------------------------------------------------------------------------*
                        // Draw the Title
                        //----------------------------------------------------------------------------*

                        nY = cPrintObject.PrintReportTitle("Load Shopping List", e, PageRect);

                        if (m_DataFiles.Preferences.TrackInventory)
                        {
                            strText = m_DataFiles.CostText;

                            TextSize = e.Graphics.MeasureString(strText, HeaderFont);

                            e.Graphics.DrawString(strText, HeaderFont, Brushes.Black, (PageRect.Width / 2) - (TextSize.Width / 2), nY);

                            nY += TextSize.Height;
                        }

                        nY += HeaderFont.Height;

                        fPageHeader = true;
                        fHeader     = false;
                    }

                    //----------------------------------------------------------------------------*
                    // Draw the supply type header if needed
                    //----------------------------------------------------------------------------*

                    if (!fHeader)
                    {
                        //----------------------------------------------------------------------------*
                        // Draw the supply type
                        //----------------------------------------------------------------------------*

                        switch (eSupplyType)
                        {
                        //----------------------------------------------------------------------------*
                        // Bullets
                        //----------------------------------------------------------------------------*

                        case cSupply.eSupplyTypes.Bullets:
                            strText = "Bullets";

                            TextSize = e.Graphics.MeasureString(strText, SupplyTypeFont);

                            nY += (TextSize.Height * (float)0.5);

                            e.Graphics.DrawString(strText, SupplyTypeFont, Brushes.Black, nX, nY);

                            nY += (TextSize.Height * (float)1.5);
                            nX  = PageRect.Left;

                            foreach (cPrintColumn PrintColumn in m_BulletColumns)
                            {
                                e.Graphics.DrawString(PrintColumn.Name, HeaderFont, Brushes.Black, nX, nY);

                                nX += (PrintColumn.Width + 20);
                            }

                            TextSize = e.Graphics.MeasureString(m_BulletColumns[0].Name, HeaderFont);

                            nY += TextSize.Height;

                            e.Graphics.DrawLine(Pens.Black, PageRect.Left, nY, nX, nY);

                            nX = PageRect.Left;

                            break;

                        //----------------------------------------------------------------------------*
                        // Powder
                        //----------------------------------------------------------------------------*

                        case cSupply.eSupplyTypes.Powder:
                            strText = "Powder";

                            TextSize = e.Graphics.MeasureString(strText, SupplyTypeFont);

                            nY += (TextSize.Height * (float)0.5);

                            e.Graphics.DrawString(strText, SupplyTypeFont, Brushes.Black, nX, nY);

                            nY += (TextSize.Height * (float)1.5);
                            nX  = PageRect.Left;

                            foreach (cPrintColumn PrintColumn in m_PowderColumns)
                            {
                                e.Graphics.DrawString(PrintColumn.Name, HeaderFont, Brushes.Black, nX, nY);

                                nX += (PrintColumn.Width + 20);
                            }

                            TextSize = e.Graphics.MeasureString(m_PowderColumns[0].Name, HeaderFont);

                            nY += TextSize.Height;

                            e.Graphics.DrawLine(Pens.Black, PageRect.Left, nY, nX, nY);

                            nX = PageRect.Left;

                            break;

                        //----------------------------------------------------------------------------*
                        // Primers
                        //----------------------------------------------------------------------------*

                        case cSupply.eSupplyTypes.Primers:
                            strText = "Primers";

                            TextSize = e.Graphics.MeasureString(strText, SupplyTypeFont);

                            nY += (TextSize.Height * (float)0.5);

                            e.Graphics.DrawString(strText, SupplyTypeFont, Brushes.Black, nX, nY);

                            nY += (TextSize.Height * (float)1.5);
                            nX  = PageRect.Left;

                            foreach (cPrintColumn PrintColumn in m_PrimerColumns)
                            {
                                e.Graphics.DrawString(PrintColumn.Name, HeaderFont, Brushes.Black, nX, nY);

                                nX += (PrintColumn.Width + 20);
                            }

                            TextSize = e.Graphics.MeasureString(m_PrimerColumns[0].Name, HeaderFont);

                            nY += TextSize.Height;

                            e.Graphics.DrawLine(Pens.Black, PageRect.Left, nY, nX, nY);

                            nX = PageRect.Left;


                            break;

                        //----------------------------------------------------------------------------*
                        // Cases
                        //----------------------------------------------------------------------------*

                        case cSupply.eSupplyTypes.Cases:
                            strText = "Cases";

                            TextSize = e.Graphics.MeasureString(strText, SupplyTypeFont);

                            nY += (TextSize.Height * (float)0.5);

                            e.Graphics.DrawString(strText, SupplyTypeFont, Brushes.Black, nX, nY);

                            nY += (TextSize.Height * (float)1.5);
                            nX  = PageRect.Left;

                            foreach (cPrintColumn PrintColumn in m_CaseColumns)
                            {
                                e.Graphics.DrawString(PrintColumn.Name, HeaderFont, Brushes.Black, nX, nY);

                                nX += (PrintColumn.Width + 20);
                            }

                            TextSize = e.Graphics.MeasureString(m_CaseColumns[0].Name, HeaderFont);

                            nY += TextSize.Height;

                            e.Graphics.DrawLine(Pens.Black, PageRect.Left, nY, nX, nY);

                            nX = PageRect.Left;

                            break;
                        }

                        fHeader = true;
                    }

                    //----------------------------------------------------------------------------*
                    // Draw the supply info
                    //----------------------------------------------------------------------------*

                    switch (eSupplyType)
                    {
                    //----------------------------------------------------------------------------*
                    // Bullets
                    //----------------------------------------------------------------------------*

                    case cSupply.eSupplyTypes.Bullets:
                        cBullet Bullet = (cBullet)Supply;

                        //----------------------------------------------------------------------------*
                        // Bullet Name
                        //----------------------------------------------------------------------------*

                        strText = Bullet.ToString();

                        nX = PageRect.Left;

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX, nY);

                        nX += (m_BulletColumns[0].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Bullet Diameter
                        //----------------------------------------------------------------------------*

                        strText = String.Format("{0:F3}", Bullet.Diameter);

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX + (m_BulletColumns[1].Width / 2) - (TextSize.Width / 2), nY);

                        nX += (m_BulletColumns[1].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Bullet Weight
                        //----------------------------------------------------------------------------*

                        strText = String.Format("{0:G0}", Bullet.Weight);

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX + (m_BulletColumns[2].Width / 2) - (TextSize.Width / 2), nY);

                        nX += (m_BulletColumns[2].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Qty on Hand
                        //----------------------------------------------------------------------------*

                        double dQuantity = m_DataFiles.SupplyQuantity(Supply);

                        if (m_DataFiles.Preferences.TrackInventory)
                        {
                            if (dQuantity != 0.0)
                            {
                                strText = String.Format("{0:G0}", dQuantity);
                            }
                            else
                            {
                                strText = "-";
                            }
                        }
                        else
                        {
                            strText = "-";
                        }

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX + (m_BulletColumns[3].Width / 2) - (TextSize.Width / 2), nY);

                        nX += (m_BulletColumns[3].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Estimated Cost
                        //----------------------------------------------------------------------------*

                        if (dQuantity != 0.0)
                        {
                            strText = String.Format("{0}{1:F2}/100", m_DataFiles.Preferences.Currency, m_DataFiles.SupplyCostEach(Supply) * 100.0);
                        }
                        else
                        {
                            strText = "-";
                        }

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX + m_BulletColumns[4].Width - TextSize.Width, nY);

                        nX = PageRect.Left;

                        nY += TextSize.Height;

                        break;

                    //----------------------------------------------------------------------------*
                    // Powder
                    //----------------------------------------------------------------------------*

                    case cSupply.eSupplyTypes.Powder:
                        cPowder Powder = (cPowder)Supply;

                        //----------------------------------------------------------------------------*
                        // Powder Name
                        //----------------------------------------------------------------------------*

                        strText = Powder.ToString();

                        nX = PageRect.Left;

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX, nY);

                        nX += (m_PowderColumns[0].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Powder Type
                        //----------------------------------------------------------------------------*

                        strText = Powder.FirearmType.ToString();

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX, nY);

                        nX += (m_PowderColumns[1].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Powder shape
                        //----------------------------------------------------------------------------*

                        strText = Powder.Shape.ToString();

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX, nY);

                        nX += (m_PowderColumns[2].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Qty on Hand
                        //----------------------------------------------------------------------------*

                        dQuantity = cDataFiles.StandardToMetric(m_DataFiles.SupplyQuantity(Powder) / 7000.0, cDataFiles.eDataType.CanWeight);

                        if (m_DataFiles.Preferences.TrackInventory)
                        {
                            if (dQuantity != 0.0)
                            {
                                strText = String.Format("{0:F3}", dQuantity);
                            }
                            else
                            {
                                strText = "-";
                            }
                        }
                        else
                        {
                            strText = "-";
                        }

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX + (m_PowderColumns[3].Width / 2) - (TextSize.Width / 2), nY);

                        nX += (m_PowderColumns[3].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Estimated Cost
                        //----------------------------------------------------------------------------*

                        if (dQuantity != 0.0)
                        {
                            strText = String.Format("{0}{1:F2}/{2}", m_DataFiles.Preferences.Currency, cDataFiles.StandardToMetric(m_DataFiles.SupplyCostEach(Powder) * 7000.0, cDataFiles.eDataType.CanWeight), cDataFiles.MetricString(cDataFiles.eDataType.CanWeight));
                        }
                        else
                        {
                            strText = "-";
                        }

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX + m_PowderColumns[4].Width - TextSize.Width, nY);

                        nX = PageRect.Left;

                        nY += TextSize.Height;

                        break;

                    //----------------------------------------------------------------------------*
                    // Primers
                    //----------------------------------------------------------------------------*

                    case cSupply.eSupplyTypes.Primers:
                        cPrimer Primer = (cPrimer)Supply;

                        //----------------------------------------------------------------------------*
                        // Primer
                        //----------------------------------------------------------------------------*

                        strText = Primer.ToShortString();

                        nX = PageRect.Left;

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX, nY);

                        nX += (m_PrimerColumns[0].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Size
                        //----------------------------------------------------------------------------*

                        strText = Primer.Size.ToString();

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX, nY);

                        nX += (m_PrimerColumns[1].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Magnum
                        //----------------------------------------------------------------------------*

                        strText = Primer.Magnum ? "Yes" : "No";

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX + (m_PrimerColumns[2].Width / 2) - (TextSize.Width / 2), nY);

                        nX += (m_PrimerColumns[2].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Qty on Hand
                        //----------------------------------------------------------------------------*

                        dQuantity = m_DataFiles.SupplyQuantity(Supply);

                        if (m_DataFiles.Preferences.TrackInventory)
                        {
                            if (dQuantity != 0.0)
                            {
                                strText = String.Format("{0:G0}", dQuantity);
                            }
                            else
                            {
                                strText = "-";
                            }
                        }
                        else
                        {
                            strText = "-";
                        }

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX + (m_PrimerColumns[3].Width / 2) - (TextSize.Width / 2), nY);

                        nX += (m_PrimerColumns[3].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Estimated Cost
                        //----------------------------------------------------------------------------*

                        if (dQuantity != 0.0)
                        {
                            strText = String.Format("{0}{1:F2}/1000", m_DataFiles.Preferences.Currency, m_DataFiles.SupplyCostEach(Supply) * 1000);
                        }
                        else
                        {
                            strText = "-";
                        }

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX + m_PrimerColumns[4].Width - TextSize.Width, nY);

                        nX = PageRect.Left;

                        nY += TextSize.Height;

                        break;

                    //----------------------------------------------------------------------------*
                    // Cases
                    //----------------------------------------------------------------------------*

                    case cSupply.eSupplyTypes.Cases:
                        cCase Case = (cCase)Supply;

                        //----------------------------------------------------------------------------*
                        // Manufacturer
                        //----------------------------------------------------------------------------*

                        strText = Case.Manufacturer.ToString();

                        nX = PageRect.Left;

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX, nY);

                        nX += (m_CaseColumns[0].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Match
                        //----------------------------------------------------------------------------*

                        strText = "Y";

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        if (Case.Match)
                        {
                            e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX + (m_CaseColumns[1].Width / 2) - (TextSize.Width / 2), nY);
                        }

                        nX += (m_CaseColumns[1].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Caliber
                        //----------------------------------------------------------------------------*

                        strText = Case.Caliber.ToString();

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX, nY);

                        nX += (m_CaseColumns[2].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Qty on Hand
                        //----------------------------------------------------------------------------*

                        dQuantity = m_DataFiles.SupplyQuantity(Supply);

                        if (m_DataFiles.Preferences.TrackInventory)
                        {
                            if (dQuantity != 0.0)
                            {
                                strText = String.Format("{0:G0}", dQuantity);
                            }
                            else
                            {
                                strText = "-";
                            }
                        }
                        else
                        {
                            strText = "-";
                        }

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX + (m_CaseColumns[3].Width / 2) - (TextSize.Width / 2), nY);

                        nX += (m_CaseColumns[3].Width + 20);

                        //----------------------------------------------------------------------------*
                        // Estimated Cost
                        //----------------------------------------------------------------------------*

                        if (dQuantity != 0.0)
                        {
                            strText = String.Format("{0}{1:F2}/100", m_DataFiles.Preferences.Currency, m_DataFiles.SupplyCostEach(Supply) * 100);
                        }
                        else
                        {
                            strText = "-";
                        }

                        TextSize = e.Graphics.MeasureString(strText, DataFont);

                        e.Graphics.DrawString(strText, DataFont, Brushes.Black, nX + m_CaseColumns[4].Width - TextSize.Width, nY);

                        nX = PageRect.Left;

                        nY += TextSize.Height;

                        break;
                    }
                }
            }

            e.HasMorePages = false;

            ResetPrintedFlag();
        }