This commit is contained in:
Kathy Ruffing 2011-03-01 13:28:18 +00:00
parent 25b9449794
commit 4b7a168dbd
2 changed files with 76 additions and 23 deletions

View File

@ -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<string> 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<string> retlist = new List<string>();
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;