This commit is contained in:
@@ -115,6 +115,7 @@ namespace Volian.Controls.Library
|
||||
if (_RangeNode1 != null || _RangeNode2 != null) ClearRangeTransition();
|
||||
InitControls();
|
||||
btnTranCancel.Enabled = false;
|
||||
|
||||
_InitializingTrans = false;
|
||||
}
|
||||
private void InitControls()
|
||||
@@ -402,51 +403,34 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
private void tvTranFillIn(ItemInfo startitm)
|
||||
{
|
||||
bool nostep = false;
|
||||
tvTran.Nodes.Clear();
|
||||
groupPanelTranstionSteps.Style.BackColor = _OrigGroupPanelSteps;
|
||||
if (startitm == null) return;
|
||||
// if the transition to point is a section or procedure, just return
|
||||
if (startitm.MyContent.Type < 20000) nostep = true;
|
||||
|
||||
if (startitm.MyContent.Type < 20000) return;
|
||||
groupPanelTranstionSteps.Style.BackColor = Color.Cornsilk;
|
||||
// For the tree view, use parent, unless already at HLS. If at HLS, use this level.
|
||||
ItemInfo selitm = startitm;
|
||||
if (!nostep)
|
||||
{
|
||||
if (_CurTrans == null)
|
||||
{
|
||||
//if (!startitm.IsHigh)
|
||||
//{
|
||||
// startitm = startitm.MyParent;
|
||||
// selitm = startitm;
|
||||
//}
|
||||
selitm = startitm.MyHLS;
|
||||
}
|
||||
}
|
||||
else
|
||||
selitm = null;
|
||||
ItemInfo selitm = startitm.MyHLS;
|
||||
//if (_CurTrans == null)selitm = startitm.MyHLS;
|
||||
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
|
||||
// no step
|
||||
VETreeNode nost = null;
|
||||
if ((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)
|
||||
{
|
||||
VETreeNode tvn = new VETreeNode("No step");
|
||||
tvTran.Nodes.Add(tvn);
|
||||
nost = tvn;
|
||||
}
|
||||
if (startitm.IsInRNO)
|
||||
startitm = selitm.FirstSibling; // if in RNO tree, start out with HLS
|
||||
else
|
||||
startitm = selitm!=null? selitm.FirstSibling:startitm.FirstSibling;
|
||||
bool setsel = false;
|
||||
while (startitm != null)
|
||||
{
|
||||
VETreeNode tvn = new VETreeNode(startitm, false);
|
||||
tvn.Tag = startitm;
|
||||
int active = this.tvTran.Nodes.Add(tvn);
|
||||
if (nost == null && startitm.ItemID == selitm.ItemID) tvTran.SelectedNode = tvTran.Nodes[active];
|
||||
if (startitm.ItemID == selitm.ItemID)
|
||||
{
|
||||
tvTran.SelectedNode = tvTran.Nodes[active];
|
||||
setsel = true;
|
||||
}
|
||||
startitm = (startitm.NextItemCount > 0 ? startitm.NextItems[0] : null);
|
||||
}
|
||||
if (!setsel) tvTran.SelectedNode = tvTran.Nodes[0];
|
||||
tvTran.BeforeExpand += new TreeViewCancelEventHandler(tvTran_BeforeExpand);
|
||||
// bug fix. TreeView needs the next two lines to properly display the bottom node. jsj 01/08/2010
|
||||
tvTran.ItemHeight++;
|
||||
@@ -500,7 +484,7 @@ namespace Volian.Controls.Library
|
||||
int indx = listBoxTranFmt.SelectedIndex;
|
||||
if (listBoxTranFmt.SelectedIndex < 0 || listBoxTranFmt.SelectedIndex > listBoxTranFmt.Items.Count) indx = 0;
|
||||
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[indx].TransUI;
|
||||
|
||||
|
||||
// do the set tree/combo & procedure combo. in 16-bit system it was types 0, 3, 5
|
||||
vlnTreeComboSets.Enabled = false;
|
||||
if ((etm & E_TransUI.ProcMenu) == E_TransUI.ProcMenu)
|
||||
@@ -532,7 +516,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
cbTranSects.Enabled = false;
|
||||
}
|
||||
|
||||
|
||||
// check for range - if no range, then range button/label & step tree selections should be
|
||||
// 'cleared/invisble'.
|
||||
btnTranRangeClear.Visible = _DoingRange;
|
||||
@@ -544,7 +528,33 @@ namespace Volian.Controls.Library
|
||||
// if any previous nodes selected for range - clear them here
|
||||
if (!_DoingRange && _RangeNode1 != null) ClearRangeTransition();
|
||||
// Always allow for step selection if there are items.
|
||||
if (tvTran.Nodes.Count>0)tvTran.Enabled = true;
|
||||
if (tvTran.Nodes.Count > 0) tvTran.Enabled = true;
|
||||
|
||||
// if a step doesn't need to be specified, then show the cbIncStepNum which allows
|
||||
// user to define whether a step number is to be included in transition.
|
||||
if ((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)
|
||||
{
|
||||
cbIncStepNum.Visible = true;
|
||||
// may or may not allow steps to be selected, i.e. if this is checked then enable
|
||||
// tree view for step selection:
|
||||
cbIncStepNum.Checked = true;
|
||||
if (_CurTrans != null && _CurTrans.MyItemToID.MyContent.Type < 20000)
|
||||
{
|
||||
cbIncStepNum.Checked = false;
|
||||
tvTran.Enabled = false;
|
||||
}
|
||||
// the following test is for Section/Optional Step (type 4 and related). If is a step section and its
|
||||
// the only step section in the procedure then a step number must be selected.
|
||||
int cntsect = 0;
|
||||
foreach (ItemInfo ii in _CurItemFrom.MyProcedure.Sections) if (ii.IsStepSection) cntsect++;
|
||||
if (((etm & E_TransUI.ProcCur) == E_TransUI.ProcCur) && ((etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny) && cntsect==1)
|
||||
{
|
||||
tvTran.Enabled = true;
|
||||
cbIncStepNum.Visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
cbIncStepNum.Visible = false;
|
||||
}
|
||||
#endregion
|
||||
#region Events
|
||||
@@ -695,21 +705,22 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
SetControlsEnabling();
|
||||
}
|
||||
private void btnUp1_Click(object sender, EventArgs e)
|
||||
{
|
||||
// if StepAllowNone, then use the second node in the tree view.
|
||||
int indx = 0;
|
||||
if (tvTran.Nodes[0].Tag == null) indx = 1;
|
||||
// if at HLS, don't do anything.
|
||||
ItemInfo curitm = (ItemInfo)((VETreeNode)tvTran.Nodes[indx]).VEObject;
|
||||
if (curitm.IsHigh) return;
|
||||
tvTranFillIn(curitm);
|
||||
}
|
||||
//private void btnUp1_Click(object sender, EventArgs e)
|
||||
//{
|
||||
// // if StepAllowNone, then use the second node in the tree view.
|
||||
// int indx = 0;
|
||||
// if (tvTran.Nodes[0].Tag == null) indx = 1;
|
||||
// // if at HLS, don't do anything.
|
||||
// ItemInfo curitm = (ItemInfo)((VETreeNode)tvTran.Nodes[indx]).VEObject;
|
||||
// if (curitm.IsHigh) return;
|
||||
// tvTranFillIn(curitm);
|
||||
//}
|
||||
private void tvTran_BeforeExpand(object sender, TreeViewCancelEventArgs e)
|
||||
{
|
||||
VETreeNode tn = ((VETreeNode)e.Node);
|
||||
// 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). Note that this was changed to not allow transitions
|
||||
// to RNOs (10/2010), this 'feature' will be added at some later date.
|
||||
tn.ChildrenLoaded = false;
|
||||
tn.LoadChildren(false);
|
||||
}
|
||||
@@ -906,12 +917,14 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else if ((etm & E_TransUI.StepFirst) == E_TransUI.StepFirst)
|
||||
{
|
||||
VETreeNode vtn = (VETreeNode)tvTran.SelectedNode;
|
||||
if (vtn != null && vtn.Tag != null)
|
||||
if (tvTran.SelectedNode != null && (cbIncStepNum.Visible == false || cbIncStepNum.Checked))
|
||||
{
|
||||
toItem = (ItemInfo)vtn.VEObject; // is this cast valid?
|
||||
linktxt = string.Format("#Link:Transition:{0} <NewID> {1}", listBoxTranFmt.SelectedIndex, toItem.ItemID);
|
||||
VETreeNode vtn = (VETreeNode)tvTran.SelectedNode;
|
||||
toItem = (ItemInfo)vtn.VEObject;
|
||||
}
|
||||
else
|
||||
toItem = (ItemInfo)cbTranSects.SelectedItem; // didn't select a step.
|
||||
linktxt = string.Format("#Link:Transition:{0} <NewID> {1}", listBoxTranFmt.SelectedIndex, toItem.ItemID);
|
||||
}
|
||||
// toItem may have been set in the 'Range' selection code above.
|
||||
if (toItem == null && (etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny)
|
||||
@@ -1048,5 +1061,10 @@ namespace Volian.Controls.Library
|
||||
top2.BackColor = on ? _RangeColor : tvTran.BackColor;
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void cbIncStepNum_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
tvTran.Enabled=cbIncStepNum.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user