Beispiel #1
0
        private void lbStyles_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lbStyles.SelectedIndices.Count == 0)
            {
                gbColumns.Enabled = false;
                gbRows.Enabled    = false;
                gbDisplay.Enabled = false;

                btnRemove.Enabled = false;
                btnRename.Enabled = false;
            }
            else
            {
                TableStyleCopy copy   = GetSelected();
                bool           enable = (copy != null) && !copy.IsBuiltin;

                gbColumns.Enabled = enable;
                gbRows.Enabled    = enable;
                gbDisplay.Enabled = enable;

                btnRemove.Enabled = enable;
                btnRename.Enabled = enable;

                lbStyles.LabelEdit = enable;

                SetTableStyle();
            }
        }
Beispiel #2
0
        private void lbStyles_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            if (e.Label == null)
            {
                return;
            }
            if (lbStyles.SelectedIndices.Count == 0)
            {
                e.CancelEdit = true;
                return;
            }
            foreach (ListViewItem item in lbStyles.Items)
            {
                if (item.Index != lbStyles.SelectedIndices[0] && item.Text == e.Label)
                {
                    MessageBox.Show("Bu isim zaten mevcut. Lütfen farklı bir isim seçin.", "RebarPos", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    e.CancelEdit = true;
                    return;
                }
            }
            TableStyleCopy copy = m_Copies.Find(p => p.Name == lbStyles.Items[e.Item].Text);

            if (copy == null)
            {
                e.CancelEdit = true;
                return;
            }
            copy.Name = e.Label;
        }
Beispiel #3
0
        public bool Init()
        {
            m_Styles = BOQStyle.GetAllBOQStyles();

            if (m_Styles.Count == 0)
            {
                return false;
            }

            foreach (string item in m_Styles)
            {
                TableStyleCopy copy = new TableStyleCopy();
                BOQStyle style = BOQStyle.GetBOQStyle(item);

                copy.Name = item;

                copy.IsBuiltin = style.IsBuiltIn;

                copy.Columns = style.Columns;

                copy.PosColumn = style.PosLabel;
                copy.CountColumn = style.CountLabel;
                copy.DiameterColumn = style.DiameterLabel;
                copy.LengthColumn = style.LengthLabel;
                copy.ShapeColumn = style.ShapeLabel;
                copy.TotalLengthColumn = style.TotalLengthLabel;
                copy.DiameterListColumn = style.DiameterListLabel;

                copy.TotalLengthRow = style.DiameterLengthLabel;
                copy.UnitWeightRow = style.UnitWeightLabel;
                copy.WeightRow = style.WeightLabel;
                copy.GrossWeightRow = style.GrossWeightLabel;

                copy.MultiplierHeadingLabel = style.MultiplierHeadingLabel;

                copy.TextStyleId = style.TextStyleId;
                copy.HeadingStyleId = style.HeadingStyleId;
                copy.FootingStyleId = style.FootingStyleId;

                m_Copies.Add(copy);
            }

            m_TextStyles = DWGUtility.GetTextStyles();
            foreach (string name in m_TextStyles.Keys)
            {
                cbTextStyle.Items.Add(name);
                cbHeadingStyle.Items.Add(name);
                cbFootingStyle.Items.Add(name);
            }

            PopulateList();

            return true;
        }
Beispiel #4
0
        public bool Init()
        {
            m_Styles = BOQStyle.GetAllBOQStyles();

            if (m_Styles.Count == 0)
            {
                return(false);
            }

            foreach (string item in m_Styles)
            {
                TableStyleCopy copy  = new TableStyleCopy();
                BOQStyle       style = BOQStyle.GetBOQStyle(item);

                copy.Name = item;

                copy.IsBuiltin = style.IsBuiltIn;

                copy.Columns = style.Columns;

                copy.PosColumn          = style.PosLabel;
                copy.CountColumn        = style.CountLabel;
                copy.DiameterColumn     = style.DiameterLabel;
                copy.LengthColumn       = style.LengthLabel;
                copy.ShapeColumn        = style.ShapeLabel;
                copy.TotalLengthColumn  = style.TotalLengthLabel;
                copy.DiameterListColumn = style.DiameterListLabel;

                copy.TotalLengthRow = style.DiameterLengthLabel;
                copy.UnitWeightRow  = style.UnitWeightLabel;
                copy.WeightRow      = style.WeightLabel;
                copy.GrossWeightRow = style.GrossWeightLabel;

                copy.MultiplierHeadingLabel = style.MultiplierHeadingLabel;

                copy.TextStyleId    = style.TextStyleId;
                copy.HeadingStyleId = style.HeadingStyleId;
                copy.FootingStyleId = style.FootingStyleId;

                m_Copies.Add(copy);
            }

            m_TextStyles = DWGUtility.GetTextStyles();
            foreach (string name in m_TextStyles.Keys)
            {
                cbTextStyle.Items.Add(name);
                cbHeadingStyle.Items.Add(name);
                cbFootingStyle.Items.Add(name);
            }

            PopulateList();

            return(true);
        }
Beispiel #5
0
        private void txtGrossWeightRow_Validated(object sender, EventArgs e)
        {
            TableStyleCopy copy = GetSelected();

            if (copy == null)
            {
                return;
            }
            copy.GrossWeightRow        = ((TextBox)sender).Text;
            tableView.GrossWeightLabel = ((TextBox)sender).Text;
            tableView.SetTable();
        }
Beispiel #6
0
        private void txtTotalLengthRow_Validated(object sender, EventArgs e)
        {
            TableStyleCopy copy = GetSelected();

            if (copy == null)
            {
                return;
            }
            copy.TotalLengthRow           = ((TextBox)sender).Text;
            tableView.DiameterLengthLabel = ((TextBox)sender).Text;
            tableView.SetTable();
        }
Beispiel #7
0
        private void txtMultiplierHeadingLabel_Validated(object sender, EventArgs e)
        {
            TableStyleCopy copy = GetSelected();

            if (copy == null)
            {
                return;
            }
            copy.MultiplierHeadingLabel      = ((TextBox)sender).Text;
            tableView.MultiplierHeadingLabel = ((TextBox)sender).Text;
            tableView.SetTable();
        }
Beispiel #8
0
        private void txtDiameterListColumn_Validated(object sender, EventArgs e)
        {
            TableStyleCopy copy = GetSelected();

            if (copy == null)
            {
                return;
            }
            copy.DiameterListColumn     = ((TextBox)sender).Text;
            tableView.DiameterListLabel = ((TextBox)sender).Text;
            tableView.SetTable();
        }
Beispiel #9
0
        private void txtColumns_Validated(object sender, EventArgs e)
        {
            TableStyleCopy copy = GetSelected();

            if (copy == null)
            {
                return;
            }
            copy.Columns      = txtColumns.Text;
            tableView.Columns = txtColumns.Text;
            tableView.SetTable();
        }
Beispiel #10
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            TableStyleCopy org = GetSelected();

            if (org == null)
            {
                return;
            }

            int i = 1;

            while (m_Copies.Exists(p => p.Name.ToUpperInvariant() == "TABLESTYLE" + i.ToString()))
            {
                i++;
            }

            TableStyleCopy copy = new TableStyleCopy();

            copy.Name = "TableStyle" + i.ToString();

            copy.IsBuiltin = false;

            copy.Columns = org.Columns;

            copy.PosColumn          = org.PosColumn;
            copy.CountColumn        = org.CountColumn;
            copy.DiameterColumn     = org.DiameterColumn;
            copy.LengthColumn       = org.LengthColumn;
            copy.ShapeColumn        = org.ShapeColumn;
            copy.TotalLengthColumn  = org.TotalLengthColumn;
            copy.DiameterListColumn = org.DiameterListColumn;

            copy.TotalLengthRow = org.TotalLengthRow;
            copy.UnitWeightRow  = org.UnitWeightRow;
            copy.WeightRow      = org.WeightRow;
            copy.GrossWeightRow = org.GrossWeightRow;

            copy.MultiplierHeadingLabel = org.MultiplierHeadingLabel;

            copy.TextStyleId    = org.TextStyleId;
            copy.HeadingStyleId = org.HeadingStyleId;
            copy.FootingStyleId = org.FootingStyleId;

            m_Copies.Add(copy);

            ListViewItem lv = new ListViewItem(copy.Name);

            lv.ImageIndex = 1;
            lbStyles.Items.Add(lv);
            lbStyles.SelectedIndices.Clear();
            lbStyles.SelectedIndices.Add(lbStyles.Items.Count - 1);
            lv.BeginEdit();
        }
Beispiel #11
0
        private void cbFootingStyle_SelectedIndexChanged(object sender, EventArgs e)
        {
            TableStyleCopy copy = GetSelected();

            if (copy == null)
            {
                return;
            }
            ObjectId id = m_TextStyles[(string)cbFootingStyle.SelectedItem];

            copy.FootingStyleId      = id;
            tableView.FootingStyleId = id;
            tableView.SetTable();
        }
Beispiel #12
0
 private void UpdateItemImages()
 {
     for (int i = 0; i < lbStyles.Items.Count; i++)
     {
         ListViewItem   lv   = lbStyles.Items[i];
         TableStyleCopy copy = m_Copies.Find(p => p.Name == lv.Text);
         if (copy.IsBuiltin)
         {
             lv.ImageIndex = 0;
         }
         else
         {
             lv.ImageIndex = 1;
         }
     }
 }
Beispiel #13
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            TableStyleCopy copy = GetSelected();

            if (copy == null)
            {
                return;
            }
            if (copy.IsBuiltin)
            {
                return;
            }

            m_Copies.Remove(copy);
            lbStyles.Items.Remove(lbStyles.SelectedItems[0]);
        }
Beispiel #14
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            TableStyleCopy org = GetSelected();
            if (org == null) return;

            int i = 1;
            while (m_Copies.Exists(p => p.Name.ToUpperInvariant() == "TABLESTYLE" + i.ToString()))
            {
                i++;
            }

            TableStyleCopy copy = new TableStyleCopy();

            copy.Name = "TableStyle" + i.ToString();

            copy.IsBuiltin = false;

            copy.Columns = org.Columns;

            copy.PosColumn = org.PosColumn;
            copy.CountColumn = org.CountColumn;
            copy.DiameterColumn = org.DiameterColumn;
            copy.LengthColumn = org.LengthColumn;
            copy.ShapeColumn = org.ShapeColumn;
            copy.TotalLengthColumn = org.TotalLengthColumn;
            copy.DiameterListColumn = org.DiameterListColumn;

            copy.TotalLengthRow = org.TotalLengthRow;
            copy.UnitWeightRow = org.UnitWeightRow;
            copy.WeightRow = org.WeightRow;
            copy.GrossWeightRow = org.GrossWeightRow;

            copy.MultiplierHeadingLabel = org.MultiplierHeadingLabel;

            copy.TextStyleId = org.TextStyleId;
            copy.HeadingStyleId = org.HeadingStyleId;
            copy.FootingStyleId = org.FootingStyleId;

            m_Copies.Add(copy);

            ListViewItem lv = new ListViewItem(copy.Name);
            lv.ImageIndex = 1;
            lbStyles.Items.Add(lv);
            lbStyles.SelectedIndices.Clear();
            lbStyles.SelectedIndices.Add(lbStyles.Items.Count - 1);
            lv.BeginEdit();
        }
Beispiel #15
0
        public void SetTableStyle()
        {
            TableStyleCopy copy = GetSelected();

            if (copy == null)
            {
                return;
            }

            txtColumns.Text = copy.Columns;

            txtPosColumn.Text          = copy.PosColumn;
            txtCountCoumn.Text         = copy.CountColumn;
            txtDiameterColumn.Text     = copy.DiameterColumn;
            txtLengthColumn.Text       = copy.LengthColumn;
            txtShapeColumn.Text        = copy.ShapeColumn;
            txtTotalLengthColumn.Text  = copy.TotalLengthColumn;
            txtDiameterListColumn.Text = copy.DiameterListColumn;

            txtTotalLengthRow.Text = copy.TotalLengthRow;
            txtUnitWeightRow.Text  = copy.UnitWeightRow;
            txtWeightRow.Text      = copy.WeightRow;
            txtGrossWeightRow.Text = copy.GrossWeightRow;

            txtMultiplierHeadingLabel.Text = copy.MultiplierHeadingLabel;

            int i = 0;

            foreach (KeyValuePair <string, ObjectId> item in m_TextStyles)
            {
                if (item.Value == copy.TextStyleId)
                {
                    cbTextStyle.SelectedIndex = i;
                }
                if (item.Value == copy.HeadingStyleId)
                {
                    cbHeadingStyle.SelectedIndex = i;
                }
                if (item.Value == copy.FootingStyleId)
                {
                    cbFootingStyle.SelectedIndex = i;
                }
                i++;
            }

            tableView.SuspendUpdate();

            tableView.Columns = copy.Columns;

            tableView.PosLabel          = copy.PosColumn;
            tableView.CountLabel        = copy.CountColumn;
            tableView.DiameterLabel     = copy.DiameterColumn;
            tableView.LengthLabel       = copy.LengthColumn;
            tableView.ShapeLabel        = copy.ShapeColumn;
            tableView.TotalLengthLabel  = copy.TotalLengthColumn;
            tableView.DiameterListLabel = copy.DiameterListColumn;

            tableView.DiameterLengthLabel = copy.TotalLengthRow;
            tableView.UnitWeightLabel     = copy.UnitWeightRow;
            tableView.WeightLabel         = copy.WeightRow;
            tableView.GrossWeightLabel    = copy.GrossWeightRow;

            tableView.MultiplierHeadingLabel = copy.MultiplierHeadingLabel;

            tableView.TextStyleId    = copy.TextStyleId;
            tableView.HeadingStyleId = copy.HeadingStyleId;
            tableView.FootingStyleId = copy.FootingStyleId;

            tableView.SetTable();
            tableView.ResumeUpdate();
        }