private void btnLPDel_Click(object sender, EventArgs e) { if (currentLPEntry == -1) { return; } tlpLinkedParts.Controls.Remove(lbLPCurrent); VPXY.Entry00 e00 = ltbc[currentPartEntry].Tag as VPXY.Entry00; e00.TGIIndexes.RemoveAt(currentLPEntry); Control c1 = tlpLinkedParts.GetControlFromPosition(0, currentLPEntry + 1); tlpLinkedParts.Controls.Remove(c1); c1 = tlpLinkedParts.GetControlFromPosition(2, currentLPEntry + 1); tlpLinkedParts.Controls.Remove(c1); lLPtbc.Remove(c1 as TGIBlockCombo); for (int row = currentLPEntry + 1; row < tlpLinkedParts.RowCount - 2; row++) { c1 = tlpLinkedParts.GetControlFromPosition(0, row + 1); c1.TabIndex--; tlpLinkedParts.Controls.Add(c1, 0, row); c1 = tlpLinkedParts.GetControlFromPosition(2, row + 1); c1.TabIndex--; tlpLinkedParts.Controls.Add(c1, 2, row); } tlpLinkedParts.RowCount--; currentLPEntry = -1; LPRenumberTLP(); }
private void btnAddLinked_Click(object sender, EventArgs e) { VPXY.Entry00 e00 = new VPXY.Entry00(0, null, 0, (byte)vpxy.Entries.Count, new List <int>()); vpxy.Entries.Insert(currentVPXYEntry + 1, e00); ltbc[currentVPXYEntry].Tag = e00; RenumberTLP(); btnAddLinked.Enabled = false; FillLinkedPartsTLP(currentVPXYEntry, e00); }
private void btnLPAdd_Click(object sender, EventArgs e) { int tabindex = tlpLinkedParts.RowCount; VPXY.Entry00 e00 = ltbc[currentPartEntry].Tag as VPXY.Entry00; e00.TGIIndexes.Add(); AddTableRowTBC(tlpLinkedParts, currentVPXYEntry + e00.TGIIndexes.Count, -1, ref tabindex); tbc_Enter(lLPtbc[lLPtbc.Count - 1], EventArgs.Empty); LPRenumberTLP(); }
void saveVPXY() { rcol.ResourceChanged -= new EventHandler(rcol_ResourceChanged); try { ClearLinkedPartsTLP(true); CountedTGIBlockList ltgib = new CountedTGIBlockList(null); vpxy.Entries.Clear(); int count = 0; byte count00 = 1; for (int row = 1; row < tlpParts.RowCount - 1; row++) { TGIBlockCombo c = tlpParts.GetControlFromPosition(2, row) as TGIBlockCombo; if (ltbc.IndexOf(c) < 0) { continue; } if (c.SelectedIndex < 0) { continue; } ltgib.Add(vpxy.TGIBlocks[c.SelectedIndex]); vpxy.Entries.Add(new VPXY.Entry01(0, null, 1, count++)); if (c.Tag != null) { VPXY.Entry00 e00 = c.Tag as VPXY.Entry00; if (e00.TGIIndexes.Count <= 0) { continue; } e00.EntryID = count00++; e00.TGIIndexes.ForEach(elem => { ltgib.Add(vpxy.TGIBlocks[elem]); elem = count++; }); if (e00.TGIIndexes.Count > 0) { vpxy.Entries.Add(e00); } } } if (vpxy.Modular) { ltgib.Add(vpxy.TGIBlocks[tbcFTPT.SelectedIndex]); vpxy.FTPTIndex = count++; } vpxy.TGIBlocks.Clear(); vpxy.TGIBlocks.AddRange(ltgib); result = (byte[])rcol.AsBytes.Clone(); } finally { rcol.ResourceChanged -= new EventHandler(rcol_ResourceChanged); } }
void FillLinkedPartsTLP(int offset, VPXY.Entry00 entry) { tlpLinkedParts.SuspendLayout(); //ClearLinkedPartsTLP(false);// should never be needed lLPtbc = new List <TGIBlockCombo>(); int tabindex = 1; for (int i = 0; i < entry.TGIIndexes.Count; i++) { AddTableRowTBC(tlpLinkedParts, offset + 1 + i, entry.TGIIndexes[i], ref tabindex); } tlpLPControls.Enabled = tlpLinkedParts.Enabled = true; tlpLinkedParts.ResumeLayout(); }
void ClearLinkedPartsTLP(bool saving) { if (currentPartEntry != -1) { VPXY.Entry00 e00 = ltbc[currentPartEntry].Tag as VPXY.Entry00; if (e00 != null) { e00.TGIIndexes.Clear(); for (int row = 1; row < tlpLinkedParts.RowCount - 1; row++) { TGIBlockCombo c = tlpLinkedParts.GetControlFromPosition(2, row) as TGIBlockCombo; if (lLPtbc.IndexOf(c) < 0) { continue; } if (c.SelectedIndex < 0) { continue; } e00.TGIIndexes.Add(c.SelectedIndex); } if (saving && e00.TGIIndexes.Count == 0) { vpxy.Entries.Remove(e00); ltbc[currentPartEntry].Tag = null; RenumberTLP(); } } } currentLPEntry = -1; lLPtbc = null; for (int i = 0; i < tlpLinkedParts.Controls.Count; i++) { if (!tlpLinkedParts.Controls[i].Equals(lbLPTitle)) { tlpLinkedParts.Controls.Remove(tlpLinkedParts.Controls[i--]); } } while (tlpLinkedParts.RowStyles.Count > 2) { tlpLinkedParts.RowStyles.RemoveAt(1); } tlpLinkedParts.RowCount = 2; tlpLPControls.Enabled = tlpLinkedParts.Enabled = false; }
void LPRenumberTLP() { tlpLinkedParts.SuspendLayout(); RenumberTLP(); VPXY.Entry00 entry = vpxy.Entries[currentVPXYEntry + 1] as VPXY.Entry00; int count = currentVPXYEntry + 1; int row = 1; for (int i = 0; i < entry.TGIIndexes.Count; i++) { Label lb = tlpLinkedParts.GetControlFromPosition(0, row++) as Label; lb.Text = count.ToString("X"); lb.Tag = lLPtbc[row - 2]; lb.TabIndex = (tlpLinkedParts.GetControlFromPosition(2, row - 1) as TGIBlockCombo).TabIndex - 1; count++; } tlpLinkedParts.ResumeLayout(); }
private void btnLPDown_Click(object sender, EventArgs e) { if (currentPartEntry == -1) { return; } VPXY.Entry00 e00 = ltbc[currentPartEntry].Tag as VPXY.Entry00; if (currentLPEntry == e00.TGIIndexes.Count - 1 || e00.TGIIndexes.Count < 2) { return; } int val = e00.TGIIndexes[currentLPEntry]; e00.TGIIndexes.RemoveAt(currentLPEntry); e00.TGIIndexes.Insert(currentLPEntry + 1, val); moveDown(tlpLinkedParts, lLPtbc, lbLPCurrent, LPRenumberTLP, ref currentLPEntry); }
void tbc_SelectedIndexChanged(object sender, EventArgs e) { TGIBlockCombo tbc = sender as TGIBlockCombo; if (ltbc.Contains(tbc)) { int i = int.Parse(((Label)tlpParts.GetControlFromPosition(0, tlpParts.GetCellPosition(tbc).Row)).Text, System.Globalization.NumberStyles.HexNumber); VPXY.Entry01 e01 = vpxy.Entries[i] as VPXY.Entry01; e01.TGIIndex = (tbc.SelectedIndex >= 0) ? tbc.SelectedIndex : 0; } else { if (currentPartEntry == -1) { return; } VPXY.Entry00 e00 = ltbc[currentPartEntry].Tag as VPXY.Entry00; int i = lLPtbc.IndexOf(tbc); e00.TGIIndexes[i] = (tbc.SelectedIndex >= 0) ? tbc.SelectedIndex : 0; } }
private void btnAddLinked_Click(object sender, EventArgs e) { VPXY.Entry00 e00 = new VPXY.Entry00(0, null, 0, (byte)vpxy.Entries.Count, new List<int>()); vpxy.Entries.Insert(currentVPXYEntry + 1, e00); ltbc[currentVPXYEntry].Tag = e00; RenumberTLP(); btnAddLinked.Enabled = false; FillLinkedPartsTLP(currentVPXYEntry, e00); }