From 4b7a168dbdab8468bb1ae68e3132713104356764 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 1 Mar 2011 13:28:18 +0000 Subject: [PATCH] --- .../Volian.Controls.Library/StepTabRibbon.cs | 99 ++++++++++++++---- .../StepTabRibbon.designer.cs | Bin 376958 -> 376958 bytes 2 files changed, 76 insertions(+), 23 deletions(-) diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index 709d1c1f..251cc51f 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -251,19 +251,27 @@ namespace Volian.Controls.Library } else { - //// Maybe someday for Grid Tables - //bool addchild = true; - //if (InsertingTable(contenttype)) - //{ - // VlnFlexGrid grd = CreateNewTable(); - // // if (grd == null) // if null grd, then user changed mind, abort insert of table - // addchild = false; - //} - //if (addchild) - _MyEditItem.AddChild((E_FromType)fromtype, contenttype); + if (InsertingTable(contenttype)) + { + if (MessageBox.Show("Do you want to insert an RO Table?", "Table Insert", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + VlnFlexGrid grd = new VlnFlexGrid(); + grd.Rows.Count = 1; + grd.Cols.Count = 1; + grd.IsRoTable = true; + _MyEditItem.AddChild((E_FromType)fromtype, contenttype, grd); + StepTabPanel tmp = Parent as StepTabPanel; + tmp.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(null)); + } + else + { + VlnFlexGrid grd = CreateNewTable(); + if (grd != null) _MyEditItem.AddChild((E_FromType)fromtype, contenttype, grd); + } + } } } - // Future Table Grid? + // Table Grid private bool InsertingTable(int contenttype) { bool rtnval = false; @@ -404,11 +412,17 @@ namespace Volian.Controls.Library btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnPasteReplace.Enabled = (MyItemInfo.IsCautionPart || MyItemInfo.IsNotePart); else if (tmp.MyDisplayTabControl.MyCopyStep.IsRNOPart || tmp.MyDisplayTabControl.MyCopyStep.IsStepPart) btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnPasteReplace.Enabled = (MyItemInfo.IsRNOPart || MyItemInfo.IsStepPart); - else if (tmp.MyDisplayTabControl.MyCopyStep.IsTablePart == MyItemInfo.IsTablePart) + else if (tmp.MyDisplayTabControl.MyCopyStep.IsTable && MyItemInfo.IsTable) { btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnCMPasteBefore.Enabled = btnCMPasteAfter.Enabled = false; btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = true; } + else if (tmp.MyDisplayTabControl.MyCopyStep.IsTable && !MyItemInfo.IsTable) + { + btnPasteBefore.Enabled = btnPasteAfter.Enabled = btnCMPasteBefore.Enabled = btnCMPasteAfter.Enabled = false; + btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false; + } + // Can't replace step with same step if (tmp.MyDisplayTabControl.MyCopyStep.ItemID == MyItemInfo.ItemID) btnPasteReplace.Enabled = false; @@ -441,7 +455,9 @@ namespace Volian.Controls.Library { rtabHome.Select(); } - rtabTableGridTools.Visible = MyEditItem is GridItem; // turn on/off Table Design (Grid) ribbon tab grouping + // Only display the table edit tools if in a grid (table) and that grid (table) is not an RO Table. + GridItem tmpGridItm = MyEditItem as GridItem; + rtabTableGridTools.Visible = tmpGridItm != null && !tmpGridItm.MyFlexGrid.IsRoTable; // if on procedure or section, 'change type' & 'insert' buttons should be disabled. if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) @@ -910,7 +926,9 @@ namespace Volian.Controls.Library using (DocVersion dv = DocVersion.Get(MyDVI.VersionID)) { + roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); ROFst newrofst = ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv.DocVersionAssociations[0], dv, roFstInfo); + roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("DisplayROUpdateROFST"); MyEditItem.MyStepPanel.OnTabDisplay(sender, args); btnUpdROVal.Enabled = false; @@ -918,6 +936,42 @@ namespace Volian.Controls.Library Cursor = Cursors.Default; } + public List roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args) + { + string xml = null; + string srchtxt = null; + using (VlnFlexGrid myGrid = new VlnFlexGrid()) + { + using (StringReader sr = new StringReader(args.OldGridXml)) + { + myGrid.ReadXml(sr); + sr.Close(); + } + string roid = myGrid.ROID; + int rodbid = myGrid.RODbId; + Font GridFont = myGrid.Font; + myGrid.Clear(); + myGrid.ParseTableFromText(args.ROText); + myGrid.AutoSizeCols(); + myGrid.AutoSizeRows(); + myGrid.MakeRTFcells(); + myGrid.RODbId = rodbid; + myGrid.ROID = roid; + myGrid.IsRoTable = true; + using (StringWriter sw = new StringWriter()) + { + myGrid.WriteXml(sw); + xml = sw.GetStringBuilder().ToString(); + sw.Close(); + } + srchtxt = myGrid.GetSearchableText(); + } + List retlist = new List(); + retlist.Add(srchtxt); + retlist.Add(xml); + return retlist; + } + private void rtabAdmin_Click(object sender, EventArgs e) { btnUpdROVal.Enabled = false; @@ -1341,16 +1395,15 @@ namespace Volian.Controls.Library TablePicker tpdlg = new TablePicker(); tpdlg.Location = pt; tpdlg.Left = left; - DialogResult dr = tpdlg.ShowDialog(); - //tpdlg.Show(); - //while (tpdlg.Visible) - //{ - // Application.DoEvents(); - // System.Threading.Thread.Sleep(0); - //} - if (dr == DialogResult.OK) + tpdlg.Show(); + while (tpdlg.Visible) { - // Creat a new grid + Application.DoEvents(); + System.Threading.Thread.Sleep(0); + } + if (!tpdlg.Cancel) + { + // Create a new grid to store the selected size grd = new VlnFlexGrid(); grd.Rows.Count = tpdlg.SelectedRows; grd.Cols.Count = tpdlg.SelectedColumns; @@ -1508,7 +1561,7 @@ namespace Volian.Controls.Library private void btnTblDgnAdjustSize_Click(object sender, EventArgs e) { - if (MyFlexGrid.Cols.Fixed == 0) + if (MyFlexGrid.Cols.Fixed == 0) // allow change of size. { // set all the rows and columns to Fixed so that user can adjust the row/column size MyFlexGrid.Cols.Fixed = MyFlexGrid.Cols.Count; diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs index b1103fbe632d03ccd0d3072b2dd7c97eeecd3348..aae0dfa24bad47984b9bc52d866288acb7921d03 100644 GIT binary patch delta 244 zcmey@ApWmGd;<%|^aIlw`8My;$P$?>Fh^{&6vqsO=^I*^cqX5V^V-~CJ0T9FKwxs- z95bMN2uO-=@s2sX(+`-iT5SHXQjK@I!gnUN?GL6gu6wgtZ2K41=`(&a`Alxur!;+D z7n2^C!IRCnV{^m4bKKK!?P8Rh{Nbd?=7v)R7GU1=2~3P))7f@2_H5t4%;=;yJ;#n& zZo7aH;~eSfHC4=V(;v7p3T?mR%jh6IJ>fBse;@N f@?s;{t<&F`vf2S1D=~e6DXR04D zCZWma;=DFD*iMK8X^@zlH^&C3mTR)Y9JA>ST})z|cg^|7!)QAB;{x-|A6BaIZa=k{ z@e3=X(d5K;s*@)ikeX)8$OG0necftCuIcl-nDh|b?KP_y+jtl)rf=NJs6X9%poGG(+l1)@@&8Mp7DYnP{dJ&Nq_q_Ii@aYMvLu4VcpF#+tu|BZkhl9