diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index 263da309..c9af7c86 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -351,10 +351,10 @@ namespace Volian.Controls.Library if (b.Tag == null) return; char[] sep = { ' ' }; string[] insdata = b.Tag.ToString().Split(sep); - if (insdata.Length != 2) return; + if (insdata.Length < 2) return; int fromtype = Convert.ToInt32(insdata[0]); int contenttype = Convert.ToInt32(insdata[1]) + 20000; - + string tabletype = (insdata.Length == 3)? insdata[2]:null; // if from type == 0, we've inserted a hls. // if inserting from section, insert first child // else do a after from current HLS - if not at HLS, go up parents until find it. @@ -365,11 +365,9 @@ namespace Volian.Controls.Library hlsEditItem = hlsEditItem.ActiveParent; hlsEditItem.AddSiblingAfter((int?)contenttype, true); } - else - { - if (InsertingTable(contenttype)) + else if (InsertingTable(contenttype)) { - if (MessageBox.Show("Do you want to insert an RO Table?", "Table Insert", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + if (tabletype.Contains("RO")) { VlnFlexGrid grd = new VlnFlexGrid(); grd.Rows.Count = 1; @@ -385,6 +383,9 @@ namespace Volian.Controls.Library if (grd != null) _MyEditItem.AddChild((E_FromType)fromtype, contenttype, grd); } } + else + { + _MyEditItem.AddChild((E_FromType)fromtype, contenttype); } } // Table Grid @@ -750,6 +751,23 @@ namespace Volian.Controls.Library btn.SubItems.Add(bi); } } + // if this is a table, then need to add RO/Text table options + if (btn.Name == "btnInsTable" && docontextmenus) + { + // If there is only one 'table' type from format under the ribbon's table item, + // eliminate that button and move up the RO & Text Table buttons. + if (btn.SubItems.Count == 1) + { + btn.Tag = btn.SubItems[0].Tag; + btn.SubItems.Clear(); + DoTableSubMenu(btn); + } + else + { + foreach (DevComponents.DotNetBar.ButtonItem tabbtn in btn.SubItems) + DoTableSubMenu(tabbtn); + } + } // if only 1, be sure event exists on button to insert item & if more than 1 remove event because // we want the drop down to appear. if (btn.Name != "btnInsRNO") @@ -778,9 +796,34 @@ namespace Volian.Controls.Library cmbtn.SubItems.Add(cmbi); } } + } rbnStepParts.Refresh(); } + + private void DoTableSubMenu(DevComponents.DotNetBar.ButtonItem tabbtn) + { + char[] sp = { ' ' }; + string[] insdata = tabbtn.Tag.ToString().Split(sp); + int ftype = Convert.ToInt32(insdata[0]); + int sdtype = Convert.ToInt32(insdata[1]); + DevComponents.DotNetBar.ButtonItem cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "RO", "RO Table"); + cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; + cmbt.Text = "RO Table"; + cmbt.Tag = string.Format("{0} {1} {2}", ftype, sdtype, "RO"); + //cmbt.Checked = (sd.Type == selType.Type); + cmbt.Click += new System.EventHandler(btnInsStep_Click); + tabbtn.SubItems.Add(cmbt); + cmbt = new DevComponents.DotNetBar.ButtonItem("cmbtnt" + sdtype + "TX", "Text Table"); + cmbt.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; + cmbt.Text = "Text Table"; + cmbt.Tag = string.Format("{0} {1} {2}", ftype, sdtype, "TX"); // Text table + //cmbt.Checked = (sd.Type == selType.Type); + cmbt.Click += new System.EventHandler(btnInsStep_Click); + tabbtn.SubItems.Add(cmbt); + tabbtn.Tag = null; + tabbtn.Click -= new System.EventHandler(btnInsStep_Click); + } #endregion #region Insert Tab private void btnSym_Click(object sender, EventArgs e)