This commit is contained in:
parent
c26e539b15
commit
d19352acb6
@ -55,7 +55,7 @@ namespace Volian.Controls.Library
|
|||||||
private VETreeNode _RangeNode2;
|
private VETreeNode _RangeNode2;
|
||||||
// Use _RangeColor to show highlighting for steps selected in range. This is set from
|
// Use _RangeColor to show highlighting for steps selected in range. This is set from
|
||||||
// calling methods from application settings. If not default to aquamarine.
|
// calling methods from application settings. If not default to aquamarine.
|
||||||
private Color _RangeColor = Color.LightGreen;
|
private Color _RangeColor = Color.LightGray;
|
||||||
public Color RangeColor
|
public Color RangeColor
|
||||||
{
|
{
|
||||||
get { return _RangeColor; }
|
get { return _RangeColor; }
|
||||||
@ -161,114 +161,117 @@ namespace Volian.Controls.Library
|
|||||||
if (_CurrentProcedure.Sections != null)
|
if (_CurrentProcedure.Sections != null)
|
||||||
{
|
{
|
||||||
cbTranSectsFillIn(secitm, secitm == null ? -1 : secitm.ItemID);
|
cbTranSectsFillIn(secitm, secitm == null ? -1 : secitm.ItemID);
|
||||||
|
|
||||||
// Fill step items, passing in the active step to the selected item, or the first
|
// Fill step items, passing in the active step to the selected item, or the first
|
||||||
// step if the selection was not at the step level.
|
// step if the selection was not at the step level.
|
||||||
ItemInfo stpitm = null;
|
ItemInfo stpitm = null;
|
||||||
ItemInfo rngitm = null;
|
|
||||||
bool rangeSameLevel = true;
|
|
||||||
int i1 = 0;
|
|
||||||
int i2 = 0;
|
|
||||||
if (selitm.MyContent.Type >= 20000)
|
if (selitm.MyContent.Type >= 20000)
|
||||||
{
|
{
|
||||||
// if this is a range, find the 'outermost' range step, i.e. the highest level
|
|
||||||
// in the tree.
|
|
||||||
if (_DoingRange)
|
if (_DoingRange)
|
||||||
{
|
{
|
||||||
ItemInfo itm1 = selitm;
|
tvInitHiliteRange(); //rangeSameLevel, stpitm, rngitm, (i1 < i2) ? i2 : i1);
|
||||||
ItemInfo itm2 = _CurTrans.MyItemRangeID;
|
|
||||||
while (!itm1.IsHigh)
|
|
||||||
{
|
|
||||||
i1++;
|
|
||||||
itm1 = itm1.MyParent;
|
|
||||||
}
|
|
||||||
while (!itm2.IsHigh)
|
|
||||||
{
|
|
||||||
i2++;
|
|
||||||
itm2 = itm2.MyParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i1 != i2) rangeSameLevel = false;
|
|
||||||
stpitm = (i1 <= i2) ? selitm : _CurTrans.MyItemRangeID;
|
|
||||||
rngitm = (stpitm == selitm) ? _CurTrans.MyItemRangeID : selitm;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
stpitm = selitm;
|
stpitm = selitm;
|
||||||
}
|
}
|
||||||
else if (secitm != null && secitm.Steps != null && secitm.Steps.Count > 0)
|
else if (secitm != null && secitm.Steps != null && secitm.Steps.Count > 0)
|
||||||
stpitm = selitm.Steps[0];
|
stpitm = selitm.Steps[0];
|
||||||
tvTranFillIn(stpitm);
|
if (!_DoingRange) tvTranFillIn(stpitm); // range code fills in tree.
|
||||||
if (_DoingRange) tvInitHiliteRange(rangeSameLevel, stpitm, rngitm, (i1 < i2) ? i2 : i1);
|
//if (_DoingRange) tvInitHiliteRange(rangeSameLevel, stpitm, rngitm, (i1 < i2) ? i2 : i1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cbTranSects.Items.Clear();
|
cbTranSects.Items.Clear();
|
||||||
tvTran.Nodes.Clear();
|
tvTran.Nodes.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetControlsEnabling();
|
SetControlsEnabling();
|
||||||
}
|
}
|
||||||
private void tvInitHiliteRange(bool rangeSameLevel, ItemInfo stpitm, ItemInfo rngitm, int uplevel)
|
private void tvInitHiliteRange() //bool rangeSameLevel, ItemInfo stpitm, ItemInfo rngitm, int uplevel)
|
||||||
{
|
{
|
||||||
_RangeNode1 = _CurTrans != null ? (VETreeNode)tvTran.SelectedNode : null;
|
ItemInfo toItm = _CurTrans.MyItemToID;
|
||||||
_RangeNode2 = null;
|
ItemInfo rngItm = null;
|
||||||
// get first treenode at this level
|
// figure out whether at same level, have same parent and have same HLS:
|
||||||
VETreeNode tn = (VETreeNode)tvTran.Nodes[0];
|
ItemInfo itm1 = _CurTrans.MyItemToID;
|
||||||
|
ItemInfo itm2 = _CurTrans.MyItemRangeID;
|
||||||
if (rangeSameLevel)
|
bool samHLS = itm1.MyHLS.ItemID == itm2.MyHLS.ItemID;
|
||||||
|
int lev1 = 0;
|
||||||
|
int lev2 = 0;
|
||||||
|
while (!itm1.IsHigh)
|
||||||
{
|
{
|
||||||
// look at all children looking for the 'rngitm'.
|
lev1++;
|
||||||
while (_RangeNode2 == null)
|
itm1 = itm1.MyParent;
|
||||||
{
|
}
|
||||||
ItemInfo ii = (ItemInfo)tn.VEObject;
|
while (!itm2.IsHigh)
|
||||||
if (ii.ItemID == rngitm.ItemID) _RangeNode2 = tn;
|
{
|
||||||
tn = (VETreeNode)tn.NextNode;
|
lev2++;
|
||||||
}
|
itm2 = itm2.MyParent;
|
||||||
|
}
|
||||||
|
bool samLevel = lev1 == lev2;
|
||||||
|
// For each range item, go to common level's parent.
|
||||||
|
int cnt = lev1+1;
|
||||||
|
ItemInfo sameParent1 = _CurTrans.MyItemToID;
|
||||||
|
ItemInfo sameParent2 = _CurTrans.MyItemRangeID;
|
||||||
|
while (cnt != 0)
|
||||||
|
{
|
||||||
|
if (sameParent1.IsHigh) break;
|
||||||
|
sameParent1 = sameParent1.MyParent;
|
||||||
|
}
|
||||||
|
cnt = lev2+1;
|
||||||
|
while (cnt != 0)
|
||||||
|
{
|
||||||
|
if (sameParent2.IsHigh) break;
|
||||||
|
sameParent2 = sameParent2.MyParent;
|
||||||
|
}
|
||||||
|
tvTranFillIn(sameParent1); // if HLS, fill in from there, or it will fill in from common parent
|
||||||
|
|
||||||
|
// now add nodes for the subtrees so that highlighting can be done. Do 'to' item
|
||||||
|
// first. If 'range' item is at same level, won't need to do anymore processing.
|
||||||
|
ItemInfo toItem = sameParent1.Ordinal<=sameParent2.Ordinal?_CurTrans.MyItemToID:_CurTrans.MyItemRangeID;
|
||||||
|
ItemInfo rngItem = sameParent1.Ordinal<=sameParent2.Ordinal?_CurTrans.MyItemRangeID:_CurTrans.MyItemToID;
|
||||||
|
|
||||||
|
List<ItemInfo> path = new List<ItemInfo>();
|
||||||
|
ItemInfo parRng = toItem;
|
||||||
|
for (int i = 0; i < lev1+1; i++)
|
||||||
|
{
|
||||||
|
path.Insert(i, parRng);
|
||||||
|
parRng = (ItemInfo)parRng.ActiveParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find sameParent1 in tree, expand down to toItem:
|
||||||
|
tvFillInRangeNodes(path, (VETreeNode)tvTran.Nodes[0], lev1, true);
|
||||||
|
path.Clear();
|
||||||
|
parRng = rngItem;
|
||||||
|
for (int i = 0; i < lev2 + 1; i++)
|
||||||
|
{
|
||||||
|
path.Insert(i, parRng);
|
||||||
|
parRng = (ItemInfo)parRng.ActiveParent;
|
||||||
|
}
|
||||||
|
tvFillInRangeNodes(path, (VETreeNode)tvTran.Nodes[0], lev2, false);
|
||||||
|
tvTranRangeHilites(true, _RangeNode1, _RangeNode2);
|
||||||
|
tvTran.SelectedNode = _RangeNode1;
|
||||||
|
}
|
||||||
|
private void tvFillInRangeNodes(List<ItemInfo> path, VETreeNode tn, int level, bool to)
|
||||||
|
{
|
||||||
|
VETreeNode tnExpand = null;
|
||||||
|
while (tnExpand == null && tn != null)
|
||||||
|
{
|
||||||
|
ItemInfo ii = (ItemInfo)tn.VEObject;
|
||||||
|
if (ii.ItemID == path[level].ItemID) tnExpand = tn;
|
||||||
|
tn = (VETreeNode)tn.NextNode;
|
||||||
|
}
|
||||||
|
tnExpand.LoadChildren(false);
|
||||||
|
if (level > 0)
|
||||||
|
{
|
||||||
|
tnExpand.Expand();
|
||||||
|
tvFillInRangeNodes(path, (VETreeNode)tnExpand.Nodes[0], level - 1, to);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Node that is outermost in tree between the two range items is 'stpitm', so need to expand tree from
|
if (to)
|
||||||
// 'rngitm's parents down to rngitm. Make a list with the path from the range item to the selected item.
|
_RangeNode1 = tnExpand;
|
||||||
List<ItemInfo> path = new List<ItemInfo>();
|
else
|
||||||
ItemInfo parRng = rngitm;
|
_RangeNode2 = tnExpand;
|
||||||
for (int i = 0; i < uplevel+1; i++)
|
|
||||||
{
|
|
||||||
path.Insert(i, parRng);
|
|
||||||
parRng = (ItemInfo)parRng.ActiveParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find each node to expand in the tree. look at all children looking for the items in the path list
|
|
||||||
|
|
||||||
VETreeNode tnExpand = null;
|
|
||||||
while (tnExpand == null && tn != null)
|
|
||||||
{
|
|
||||||
ItemInfo ii = (ItemInfo)tn.VEObject;
|
|
||||||
if (ii.ItemID == path[uplevel].ItemID) tnExpand = tn;
|
|
||||||
tn = (VETreeNode)tn.NextNode;
|
|
||||||
}
|
|
||||||
if (tnExpand == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error in highlighting step range.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
VETreeNode tmp = null;
|
|
||||||
// Expand levels of subtree until second node in range.
|
|
||||||
for (int i = uplevel-1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
tnExpand.Expand();
|
|
||||||
foreach (VETreeNode ctn in tnExpand.Nodes)
|
|
||||||
{
|
|
||||||
ItemInfo ii = (ItemInfo)ctn.VEObject;
|
|
||||||
if (ii.ItemID == path[i].ItemID)
|
|
||||||
{
|
|
||||||
tmp = ctn;
|
|
||||||
if (i == 0) _RangeNode2 = tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tnExpand = tmp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tvTranRangeHilites(true, _RangeNode1, _RangeNode2);
|
|
||||||
}
|
}
|
||||||
private void vlnTreeComboSetsFillIn(ItemInfo prcitm)
|
private void vlnTreeComboSetsFillIn(ItemInfo prcitm)
|
||||||
{
|
{
|
||||||
@ -411,15 +414,16 @@ namespace Volian.Controls.Library
|
|||||||
ItemInfo selitm = startitm;
|
ItemInfo selitm = startitm;
|
||||||
if (!nostep)
|
if (!nostep)
|
||||||
{
|
{
|
||||||
if (_CurTrans == null)
|
if (_CurTrans == null)
|
||||||
{
|
|
||||||
if (!startitm.IsHigh)
|
|
||||||
{
|
{
|
||||||
startitm = startitm.MyParent;
|
//if (!startitm.IsHigh)
|
||||||
selitm = startitm;
|
//{
|
||||||
|
// startitm = startitm.MyParent;
|
||||||
|
// selitm = startitm;
|
||||||
|
//}
|
||||||
|
selitm = startitm.MyHLS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
selitm = null;
|
selitm = null;
|
||||||
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
|
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
|
||||||
@ -431,10 +435,13 @@ namespace Volian.Controls.Library
|
|||||||
tvTran.Nodes.Add(tvn);
|
tvTran.Nodes.Add(tvn);
|
||||||
nost = tvn;
|
nost = tvn;
|
||||||
}
|
}
|
||||||
startitm = startitm.FirstSibling;
|
if (startitm.IsInRNO)
|
||||||
|
startitm = selitm.FirstSibling; // if in RNO tree, start out with HLS
|
||||||
|
else
|
||||||
|
startitm = selitm!=null? selitm.FirstSibling:startitm.FirstSibling;
|
||||||
while (startitm != null)
|
while (startitm != null)
|
||||||
{
|
{
|
||||||
VETreeNode tvn = new VETreeNode(startitm);
|
VETreeNode tvn = new VETreeNode(startitm, false);
|
||||||
tvn.Tag = startitm;
|
tvn.Tag = startitm;
|
||||||
int active = this.tvTran.Nodes.Add(tvn);
|
int active = this.tvTran.Nodes.Add(tvn);
|
||||||
if (nost == null && startitm.ItemID == selitm.ItemID) tvTran.SelectedNode = tvTran.Nodes[active];
|
if (nost == null && startitm.ItemID == selitm.ItemID) tvTran.SelectedNode = tvTran.Nodes[active];
|
||||||
@ -468,6 +475,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
secitm = (secitm.NextItemCount > 0 ? secitm.NextItems[0] : null);
|
secitm = (secitm.NextItemCount > 0 ? secitm.NextItems[0] : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private void cbTranProcsFillIn(ItemInfo prcitm)
|
private void cbTranProcsFillIn(ItemInfo prcitm)
|
||||||
{
|
{
|
||||||
@ -703,7 +711,7 @@ namespace Volian.Controls.Library
|
|||||||
// true fixes empty expand, but allows for transitions 'way down' in RNO tree. HVJ & PAL wanted to
|
// true fixes empty expand, but allows for transitions 'way down' in RNO tree. HVJ & PAL wanted to
|
||||||
// allow this (12/2/09)
|
// allow this (12/2/09)
|
||||||
tn.ChildrenLoaded = false;
|
tn.ChildrenLoaded = false;
|
||||||
tn.LoadChildren(true);
|
tn.LoadChildren(false);
|
||||||
}
|
}
|
||||||
private void cbTranSects_SelectedIndexChanged(object sender, EventArgs e)
|
private void cbTranSects_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -964,9 +972,9 @@ namespace Volian.Controls.Library
|
|||||||
node1.BackColor = on ? _RangeColor : tvTran.BackColor;
|
node1.BackColor = on ? _RangeColor : tvTran.BackColor;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If node2 is below node1 in the tree switch them... get to high level step &
|
// If node2 is below node1 in the tree switch them... get to high level step &
|
||||||
// then just walk down tree.
|
// then just walk down tree - this happens when user is making selection, not when
|
||||||
|
// selected transitions is being highlighted.
|
||||||
ItemInfo itm1 = (ItemInfo)node1.VEObject;
|
ItemInfo itm1 = (ItemInfo)node1.VEObject;
|
||||||
ItemInfo itm2 = (ItemInfo)node2.VEObject;
|
ItemInfo itm2 = (ItemInfo)node2.VEObject;
|
||||||
while (!itm1.IsHigh) itm1 = itm1.MyParent;
|
while (!itm1.IsHigh) itm1 = itm1.MyParent;
|
||||||
@ -991,7 +999,6 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
// Turn Hilighting on/off (depending on bool argument) between the two nodes
|
// Turn Hilighting on/off (depending on bool argument) between the two nodes
|
||||||
// they may be at different tree levels.
|
// they may be at different tree levels.
|
||||||
|
|
||||||
// find common parent level first and save the 'top parent' node for each selection.
|
// find common parent level first and save the 'top parent' node for each selection.
|
||||||
VETreeNode top1 = node1;
|
VETreeNode top1 = node1;
|
||||||
VETreeNode top2 = node2;
|
VETreeNode top2 = node2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user