Added logic to use the CautionNoteOrder format variable
This commit is contained in:
parent
68121c1b79
commit
192b212472
@ -681,6 +681,7 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
void btnInsStep_Click(object sender, EventArgs e)
|
void btnInsStep_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
string cautNoteOrder = _MyEditItem.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.CautionNoteOrder;
|
||||||
DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender;
|
DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender;
|
||||||
if (b.Tag == null) return;
|
if (b.Tag == null) return;
|
||||||
char[] sep = { ' ' };
|
char[] sep = { ' ' };
|
||||||
@ -689,10 +690,24 @@ namespace Volian.Controls.Library
|
|||||||
int fromtype = Convert.ToInt32(insdata[0]);
|
int fromtype = Convert.ToInt32(insdata[0]);
|
||||||
int contenttype = Convert.ToInt32(insdata[1]) + 20000;
|
int contenttype = Convert.ToInt32(insdata[1]) + 20000;
|
||||||
string tabletype = (insdata.Length == 3)? insdata[2]:null;
|
string tabletype = (insdata.Length == 3)? insdata[2]:null;
|
||||||
|
// if CautionNoteOrder format variable is set then use it to determine the placement of the
|
||||||
|
// Caution, Note, Warning, or Message (calvert format)
|
||||||
|
if (cautNoteOrder != null && (","+cautNoteOrder+",").Contains(","+(contenttype % 10000).ToString() + ",") && (_MyEditItem.MyItemInfo.Cautions != null || _MyEditItem.MyItemInfo.Notes != null))
|
||||||
|
{
|
||||||
|
EditItem stepBefore = FindStepBefore(cautNoteOrder, contenttype);
|
||||||
|
if (stepBefore != null)
|
||||||
|
stepBefore.AddSiblingAfter((int?)contenttype, true);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EditItem stepAfter = FindStepAfter(cautNoteOrder, contenttype);
|
||||||
|
if (stepAfter != null)
|
||||||
|
stepAfter.AddSiblingBefore((int?)contenttype, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
// if from type == 0, we've inserted a hls.
|
// if from type == 0, we've inserted a hls.
|
||||||
// if inserting from section, insert first child
|
// if inserting from section, insert first child
|
||||||
// else do a after from current HLS - if not at HLS, go up parents until find it.
|
// else do a after from current HLS - if not at HLS, go up parents until find it.
|
||||||
if (fromtype == 0 && !_MyEditItem.MyItemInfo.IsStepSection)
|
else if (fromtype == 0 && !_MyEditItem.MyItemInfo.IsStepSection)
|
||||||
{
|
{
|
||||||
EditItem hlsEditItem = _MyEditItem;
|
EditItem hlsEditItem = _MyEditItem;
|
||||||
while (!hlsEditItem.MyItemInfo.IsHigh)
|
while (!hlsEditItem.MyItemInfo.IsHigh)
|
||||||
@ -722,6 +737,67 @@ namespace Volian.Controls.Library
|
|||||||
_MyEditItem.AddChild((E_FromType)fromtype, contenttype);
|
_MyEditItem.AddChild((E_FromType)fromtype, contenttype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private EditItem FindStepAfter(string types, int contenttype)
|
||||||
|
{
|
||||||
|
string[] order = types.Split(",".ToCharArray()); //"29,7,6,22"
|
||||||
|
bool found = false;
|
||||||
|
List<int> lOrder = new List<int>();
|
||||||
|
foreach (string type in order)
|
||||||
|
{
|
||||||
|
if (found)
|
||||||
|
lOrder.Add(int.Parse(type));
|
||||||
|
if (int.Parse(type) == contenttype % 10000) found = true;
|
||||||
|
}
|
||||||
|
//_MyEditItem.MyItemInfo.RefreshItemParts();
|
||||||
|
_MyEditItem.MyItemInfo.ResetParts();
|
||||||
|
if (_MyEditItem.MyItemInfo.Cautions != null)
|
||||||
|
foreach (ItemInfo ii in _MyEditItem.MyItemInfo.Cautions)
|
||||||
|
{
|
||||||
|
if (lOrder.Contains((int)ii.MyContent.Type % 10000))
|
||||||
|
return _MyEditItem.MyStepPanel.FindItem(ii);
|
||||||
|
}
|
||||||
|
if (_MyEditItem.MyItemInfo.Notes != null)
|
||||||
|
foreach (ItemInfo ii in _MyEditItem.MyItemInfo.Notes)
|
||||||
|
{
|
||||||
|
if (lOrder.Contains((int)ii.MyContent.Type % 10000))
|
||||||
|
return _MyEditItem.MyStepPanel.FindItem(ii);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private EditItem FindStepBefore(string types, int contenttype)
|
||||||
|
{
|
||||||
|
string[] order = types.Split(",".ToCharArray()); //"29,7,6,22"
|
||||||
|
List<int> lOrder = new List<int>();
|
||||||
|
foreach (string type in order)
|
||||||
|
{
|
||||||
|
lOrder.Add(int.Parse(type));
|
||||||
|
if (lOrder.Contains(contenttype % 10000))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ItemInfo itemBefore = null;
|
||||||
|
//_MyEditItem.MyItemInfo.RefreshItemParts();
|
||||||
|
_MyEditItem.MyItemInfo.ResetParts();
|
||||||
|
if (_MyEditItem.MyItemInfo.Cautions != null)
|
||||||
|
foreach (ItemInfo ii in _MyEditItem.MyItemInfo.Cautions)
|
||||||
|
{
|
||||||
|
if (lOrder.Contains((int)ii.MyContent.Type % 10000))
|
||||||
|
itemBefore = ii;
|
||||||
|
}
|
||||||
|
if (_MyEditItem.MyItemInfo.Notes != null)
|
||||||
|
foreach (ItemInfo ii in _MyEditItem.MyItemInfo.Notes)
|
||||||
|
{
|
||||||
|
if (lOrder.Contains((int)ii.MyContent.Type % 10000))
|
||||||
|
itemBefore = ii;
|
||||||
|
}
|
||||||
|
if (itemBefore != null)
|
||||||
|
{
|
||||||
|
Console.WriteLine("findStepBefore {0}", itemBefore.DisplayText);
|
||||||
|
return _MyEditItem.MyStepPanel.FindItem(itemBefore);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
// Table Grid
|
// Table Grid
|
||||||
private bool InsertingTable(int contenttype)
|
private bool InsertingTable(int contenttype)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user