This commit is contained in:
@@ -7,6 +7,7 @@ using System.Data;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Text.RegularExpressions;
|
||||
using AT.STO.UI.Win;
|
||||
using VEPROMS.CSLA.Library;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
@@ -14,15 +15,10 @@ namespace Volian.Controls.Library
|
||||
public partial class DisplayTransition : UserControl
|
||||
{
|
||||
#region Properties
|
||||
private bool _CurProcSet = true;
|
||||
public bool CurProcSet
|
||||
{
|
||||
get { return _CurProcSet; }
|
||||
set { _CurProcSet = value; }
|
||||
}
|
||||
private int _TranFmtIndx = -1;
|
||||
private ItemInfo _CurItemFrom;
|
||||
private TransitionInfo _CurTrans;
|
||||
|
||||
private int _TranFmtIndx = -1; // stores selected transition format
|
||||
private ItemInfo _CurItemFrom; // stores what item transition is 'from'
|
||||
private TransitionInfo _CurTrans; // if modify, this is transition to modify
|
||||
public TransitionInfo CurTrans
|
||||
{
|
||||
get { return _CurTrans; }
|
||||
@@ -33,26 +29,42 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (MyRTB == null) return;
|
||||
_CurItemFrom = MyRTB.MyItem;
|
||||
ClearControls();
|
||||
DetermineCurProcSet();
|
||||
return;
|
||||
_TranFmtIndx = 0;
|
||||
}
|
||||
_TranFmtIndx = _CurTrans.TranType;
|
||||
_CurItemFrom = ItemInfo.Get(_CurTrans.FromID);
|
||||
else
|
||||
{
|
||||
_TranFmtIndx = _CurTrans.TranType;
|
||||
_CurItemFrom = ItemInfo.Get(_CurTrans.FromID);
|
||||
}
|
||||
_SavCurItemFrom = _CurItemFrom;
|
||||
_SavTranFmtIndx = _TranFmtIndx;
|
||||
TransitionFillIn();
|
||||
}
|
||||
}
|
||||
// use the following if user selects 'cancel' button
|
||||
private ItemInfo _SavCurItemFrom;
|
||||
private int _SavTranFmtIndx;
|
||||
|
||||
private bool _DoingRange = false; // flags if in 'range' transition mode
|
||||
private VETreeNode _RangeNode1;
|
||||
private ItemInfo _tranitem1;
|
||||
private ItemInfo _tranitem2;
|
||||
private DisplayRTB _MyRTB;
|
||||
private VETreeNode _RangeNode2;
|
||||
// Use _RangeColor to show highlighting for steps selected in range. This is set from
|
||||
// calling methods from application settings. If not default to aquamarine.
|
||||
private Color _RangeColor = Color.Aquamarine;
|
||||
public Color RangeColor
|
||||
{
|
||||
get { return _RangeColor; }
|
||||
set { _RangeColor = value; }
|
||||
}
|
||||
private DisplayRTB _MyRTB; // Current RichTextBox, i.e. insert transition to it.
|
||||
public DisplayRTB MyRTB
|
||||
{
|
||||
get { return _MyRTB; }
|
||||
set { _MyRTB = value; }
|
||||
}
|
||||
private ItemInfo _CurrentProcedure;
|
||||
private ItemInfo _CurrentProcedure; // current procedure flags
|
||||
private int _CurrentProcIndex;
|
||||
private bool _AlwaysDisableSets; // true if there is only 1 item in tree/combo for sets
|
||||
#endregion
|
||||
#region Constructors
|
||||
public DisplayTransition()
|
||||
@@ -61,66 +73,172 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
#endregion
|
||||
#region LoadControlData
|
||||
// TransitionFillIn uses other methods to fill in all controls on the
|
||||
// insert/modify transition tab.
|
||||
// TransitionFillIn uses other methods to fill in all controls on the transition tab.
|
||||
private bool _InitializingTrans;
|
||||
private void TransitionFillIn()
|
||||
{
|
||||
//if (_CurItem == null) return;
|
||||
btnTranInsert.Text = "Select Transition";
|
||||
_InitializingTrans = true;
|
||||
|
||||
if (_RangeNode1!= null) _RangeNode1.BackColor = tvTran.BackColor;
|
||||
// first see if transition is within same set, this determines what
|
||||
// controls & settings are used.
|
||||
DetermineCurProcSet();
|
||||
if (!CurProcSet)
|
||||
return;
|
||||
else
|
||||
CurrentProcSetFillIn();
|
||||
|
||||
if (_RangeNode1 != null || _RangeNode2 != null) ClearRangeTransition();
|
||||
InitControls();
|
||||
_InitializingTrans = false;
|
||||
}
|
||||
|
||||
private void CurrentProcSetFillIn()
|
||||
private void InitControls()
|
||||
{
|
||||
ListBoxTranFmtFillIn();
|
||||
|
||||
// if new, use _CurItemFrom to find the section level & procedure level,
|
||||
// if new, use _CurItemFrom to setup the initial selections in the controls,
|
||||
// if modify, use the first transition to, _CurTrans
|
||||
//ItemInfo tmpitm = _ToModify!=null?_tranitem1:_CurItem;
|
||||
ItemInfo tmpitm = _CurTrans==null?_CurItemFrom:_CurTrans.MyItemToID;
|
||||
ItemInfo selstpitm = tmpitm;
|
||||
while (tmpitm.MyContent.Type >= 20000)
|
||||
// This item will be either a procedure, section or step, never a docversion
|
||||
ItemInfo selitm = _CurTrans==null?_CurItemFrom:_CurTrans.MyItemToID;
|
||||
|
||||
ItemInfo tmpitm = selitm;
|
||||
ItemInfo secitm = null;
|
||||
|
||||
// Find the procedure level first.
|
||||
while (tmpitm.MyContent.Type != 0)
|
||||
{
|
||||
if (tmpitm.MyContent.Type >=10000 && tmpitm.MyContent.Type<20000) secitm = tmpitm;
|
||||
tmpitm = tmpitm.MyParent;
|
||||
}
|
||||
ItemInfo secitm = tmpitm;
|
||||
listBoxTranSectsFillIn(secitm, secitm.ItemID);
|
||||
ItemInfo prcitm = secitm.MyParent;
|
||||
_CurrentProcedure = prcitm;
|
||||
listBoxTranProcsFillIn(prcitm);
|
||||
tvTranFillIn(selstpitm);
|
||||
SetControlsEnabling();
|
||||
}
|
||||
private void DetermineCurProcSet()
|
||||
{
|
||||
// If a current transition exists then check if current from item is in same set
|
||||
// as transition to item. If no current transition (new), initialize to current
|
||||
// set. Different controls are used for same set (list view) versus different
|
||||
// set (tree view).
|
||||
if (_CurTrans != null)
|
||||
_CurrentProcedure = tmpitm;
|
||||
vlnTreeComboSetsFillIn(_CurrentProcedure);
|
||||
cbTranProcsFillIn(_CurrentProcedure);
|
||||
if (_CurrentProcedure.Sections != null)
|
||||
{
|
||||
DocVersionInfo dv = _CurItemFrom.MyProcedure.ActiveParent as DocVersionInfo;
|
||||
if (dv == null) return; // what to do if null?
|
||||
DocVersionInfo dvto = _CurTrans.MyItemToID.MyProcedure.ActiveParent as DocVersionInfo;
|
||||
if (dv.VersionID != dvto.VersionID) CurProcSet = false;
|
||||
else CurProcSet = true;
|
||||
cbCurProcSet.Checked = CurProcSet;
|
||||
cbTranSectsFillIn(secitm, secitm == null ? -1 : secitm.ItemID);
|
||||
|
||||
// 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.
|
||||
ItemInfo stpitm = null;
|
||||
if (selitm.MyContent.Type >= 20000)
|
||||
stpitm = selitm;
|
||||
else if (secitm != null && secitm.Steps != null && secitm.Steps.Count > 0)
|
||||
stpitm = selitm.Steps[0];
|
||||
tvTranFillIn(stpitm);
|
||||
}
|
||||
else
|
||||
CurProcSet = cbCurProcSet.Checked;
|
||||
|
||||
{
|
||||
cbTranSects.Items.Clear();
|
||||
tvTran.Nodes.Clear();
|
||||
}
|
||||
|
||||
SetControlsEnabling();
|
||||
}
|
||||
private void vlnTreeComboSetsFillIn(ItemInfo prcitm)
|
||||
{
|
||||
// from this procedure, walk up the tree storing the FolderInfos. This is done
|
||||
// so that the tree can be expanded highlighting (selecting) the current set.
|
||||
List<FolderInfo> filist = new List<FolderInfo>();
|
||||
DocVersionInfo mydocversion = prcitm.ActiveParent as DocVersionInfo;
|
||||
FolderInfo tmpfi = mydocversion.ActiveParent as FolderInfo;
|
||||
while (tmpfi != null)
|
||||
{
|
||||
if (tmpfi.FolderID != 1) filist.Add(tmpfi); // don't add top folder
|
||||
tmpfi = tmpfi.ActiveParent as FolderInfo;
|
||||
}
|
||||
|
||||
// Now start at the top folder. Continue to get children using the filist to determine
|
||||
// the expanded part of the tree. Note that if there is only 1 item at a level,
|
||||
// the level is not added to the tree, except if there are no sub-folders, i.e.
|
||||
// right before the docversion. Also note that docversions are not displayed
|
||||
// (at least for now - as of 2/14/08), this may change and if so uncomment (& fix/test)
|
||||
// the next section of code where docversions are processed.
|
||||
FolderInfo fi = FolderInfo.Get(1);
|
||||
DropDownNode topnode = null;
|
||||
int cntnd = 0;
|
||||
while (fi.ChildFolderCount > 0)
|
||||
{
|
||||
// if there is more than 1 child, add this level of children to the
|
||||
// to the tree. The second part of the 'if' covers the last level of
|
||||
// folder.
|
||||
if ((fi.ChildFolders.Count > 1) ||
|
||||
(fi.ChildFolders.Count==1 && fi.ChildFolders[0].FolderDocVersionCount>0))
|
||||
{
|
||||
int indx = -1;
|
||||
int pathid = filist[filist.Count - 1].FolderID;
|
||||
foreach (FolderInfo fic in fi.ChildFolders)
|
||||
{
|
||||
DropDownNode newnode = new DropDownNode(fic.FolderID, fic.ToString());
|
||||
int tmp = topnode==null?vlnTreeComboSets.DropDownControl.Nodes.Add(newnode):topnode.Nodes.Add(newnode);
|
||||
cntnd++;
|
||||
newnode.Tag = fic;
|
||||
if (fic.FolderID == pathid)
|
||||
indx = tmp; // flag the path to expand.
|
||||
else if (fic.ChildFolders.Count > 0) // allow for '+' for tree expansion
|
||||
{
|
||||
DropDownNode tnt = new DropDownNode(0, "VLN_DUMMY");
|
||||
newnode.Nodes.Add(tnt);
|
||||
}
|
||||
}
|
||||
topnode = topnode==null?(DropDownNode)vlnTreeComboSets.DropDownControl.Nodes[indx]:(DropDownNode)topnode.Nodes[indx];
|
||||
}
|
||||
fi = (filist.Count > 0) ? FolderInfo.Get(filist[filist.Count - 1].FolderID) : null;
|
||||
if (filist.Count > 0) filist.RemoveAt(filist.Count - 1);
|
||||
}
|
||||
// if nothing was added to the tree, just put in the node above the docversions...
|
||||
if (vlnTreeComboSets.DropDownControl.Nodes.Count == 0)
|
||||
{
|
||||
cntnd++;
|
||||
fi = mydocversion.MyFolder;
|
||||
topnode = new DropDownNode(fi.FolderID, fi.ToString());
|
||||
vlnTreeComboSets.DropDownControl.Nodes.Add(topnode);
|
||||
topnode.Tag = fi;
|
||||
}
|
||||
// if there is only one node in entire tree, disable selection...
|
||||
if (cntnd == 1) _AlwaysDisableSets = true;
|
||||
else _AlwaysDisableSets = false;
|
||||
|
||||
// the following selects the set & displays its value in the combo box portion
|
||||
// of the tree combo control.
|
||||
vlnTreeComboSets.Value = topnode;
|
||||
vlnTreeComboSets.DropDownControl.SelectedNode = topnode;
|
||||
vlnTreeComboSets.DropDownControl.BeforeExpand += new TreeViewCancelEventHandler(vlnTreeComboSets_BeforeExpand);
|
||||
|
||||
#region CheckIfNeeded Commented Out
|
||||
//vlnTreeComboSets.DropDownControl. = vlnTreeComboSets.Width;
|
||||
// The DropDownNode should be at a DocVersion now. The expanded DocVersion
|
||||
// is the one that matches mydocversion
|
||||
//tmpfi = mydocversion.ActiveParent as FolderInfo;
|
||||
//DocVersionInfoList dvlist = tmpfi.FolderDocVersions;
|
||||
//DropDownNode tnDV = null;
|
||||
// Once at a docversions, only allow working
|
||||
// draft sets. Use DocVersion that we're in, to expand it showing the active procedure.
|
||||
// first count how many versions can be displayed, i.e. only workingdraft?
|
||||
// if more than one, put out a tree node for them.
|
||||
//int cntdocv = 0;
|
||||
//foreach (DocVersionInfo dv in dvlist)
|
||||
//{
|
||||
// if ((VersionTypeEnum)dv.VersionType == VersionTypeEnum.WorkingDraft) cntdocv++;
|
||||
|
||||
//}
|
||||
//if (cntdocv>1)
|
||||
//{
|
||||
// foreach (DocVersionInfo dv in dvlist)
|
||||
// {
|
||||
// if ((VersionTypeEnum)dv.VersionType == VersionTypeEnum.WorkingDraft)
|
||||
// {
|
||||
// DropDownNode tn = new DropDownNode(dv.VersionID, dv.ToString());
|
||||
// tn.Tag = dv;
|
||||
// if (topnode != null)
|
||||
// topnode.Nodes.Add(tn);
|
||||
// else
|
||||
// vlnTreeComboSets.DropDownControl.Nodes.Add(tn);
|
||||
// if (dv.VersionID == mydocversion.VersionID)
|
||||
// {
|
||||
// tnDV = tn;
|
||||
// vlnTreeComboSets.Value = tnDV;
|
||||
// vlnTreeComboSets.DropDownControl.SelectedNode = tnDV;
|
||||
|
||||
// }
|
||||
// //else if (dv.HasChildren) // allow for '+' for tree expansion
|
||||
// //{
|
||||
// // DropDownNode tnt = new DropDownNode(0,"VLN_DUMMY");
|
||||
// // tn.Nodes.Add(tnt);
|
||||
// //}
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
private void ListBoxTranFmtFillIn()
|
||||
{
|
||||
@@ -133,6 +251,7 @@ namespace Volian.Controls.Library
|
||||
private void tvTranFillIn(ItemInfo startitm)
|
||||
{
|
||||
tvTran.Nodes.Clear();
|
||||
if (startitm == null) return;
|
||||
// if the transition to point is a section or procedure, just return
|
||||
if (startitm.MyContent.Type < 20000) return;
|
||||
|
||||
@@ -151,120 +270,221 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
VETreeNode tvn = new VETreeNode(startitm);
|
||||
tvn.Tag = startitm;
|
||||
int active = this.tvTran.Nodes.Add(tvn); //new VETreeNode(curitm));
|
||||
int active = this.tvTran.Nodes.Add(tvn);
|
||||
if (startitm.ItemID == selitm.ItemID) tvTran.SelectedNode = tvTran.Nodes[active];
|
||||
startitm = (startitm.NextItemCount > 0 ? startitm.NextItems[0] : null);
|
||||
}
|
||||
tvTran.BeforeExpand += new TreeViewCancelEventHandler(tvTran_BeforeExpand);
|
||||
}
|
||||
private void listBoxTranSectsFillIn(ItemInfo secitm, int sectstart)
|
||||
private void cbTranSectsFillIn(ItemInfo secitm, int secstart)
|
||||
{
|
||||
listBoxTranSects.Items.Clear();
|
||||
// if the transition point 'to' is a procedure, don't list sections yet.
|
||||
if (secitm.MyContent.Type < 10000) return;
|
||||
cbTranSects.Items.Clear();
|
||||
// if the transition points 'to' procedure, don't list the sections yet.
|
||||
if (secitm == null || secitm.MyContent.Type < 10000) return;
|
||||
// if sectstart is not -1, then use this as the section to select, otherwise
|
||||
// use the id for the item passed in.
|
||||
int startitm = sectstart;
|
||||
if (sectstart < 0) sectstart = secitm.ItemID;
|
||||
int startitm = secstart;
|
||||
if (secstart < 0) secstart = secitm.ItemID;
|
||||
ItemInfo selitm = secitm; // this is the selected 'section'
|
||||
secitm = secitm.FirstSibling;
|
||||
while (secitm != null)
|
||||
{
|
||||
int active = listBoxTranSects.Items.Add(secitm);
|
||||
if (secitm.ItemID == sectstart) listBoxTranSects.SelectedIndex = active;
|
||||
// if the selected transition format requires a step be selected (show only step sections), only add step sections
|
||||
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
|
||||
if (((!((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) && secitm.IsStepSection) ||
|
||||
((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone))
|
||||
{
|
||||
int active = cbTranSects.Items.Add(secitm);
|
||||
if (secitm.ItemID == secstart) cbTranSects.SelectedIndex = active;
|
||||
}
|
||||
secitm = (secitm.NextItemCount > 0 ? secitm.NextItems[0] : null);
|
||||
}
|
||||
}
|
||||
private void listBoxTranProcsFillIn(ItemInfo prcitm)
|
||||
private void cbTranProcsFillIn(ItemInfo prcitm)
|
||||
{
|
||||
listBoxTranProcs.Items.Clear();
|
||||
cbTranProcs.Items.Clear();
|
||||
ItemInfo selitm = prcitm; // this is the selected 'section'
|
||||
prcitm = prcitm.FirstSibling;
|
||||
while (prcitm != null)
|
||||
{
|
||||
int active = listBoxTranProcs.Items.Add(prcitm);
|
||||
int active = cbTranProcs.Items.Add(prcitm);
|
||||
if (_CurrentProcedure.ContentID == prcitm.MyContent.ContentID) _CurrentProcIndex = active;
|
||||
if (prcitm.MyContent.ContentID == selitm.MyContent.ContentID) listBoxTranProcs.SelectedIndex = active;
|
||||
if (prcitm.MyContent.ContentID == selitm.MyContent.ContentID) cbTranProcs.SelectedIndex = active;
|
||||
prcitm = (prcitm.NextItemCount > 0 ? prcitm.NextItems[0] : null);
|
||||
}
|
||||
}
|
||||
private void SetControlsEnabling()
|
||||
{
|
||||
if (CurProcSet)
|
||||
{
|
||||
groupPanelTranFmt.Visible = true;
|
||||
groupPanelTransitionProcs.Visible = true;
|
||||
groupPanelTransitionSect.Visible = true;
|
||||
groupPanelTranstionSteps.Visible = true;
|
||||
groupPanelProcSets.Visible = false;
|
||||
tvProcSets.Visible = false;
|
||||
// Based on selection & enum representing the transition format, determine the enabling of associated controls
|
||||
if (_CurItemFrom == null) return;
|
||||
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;
|
||||
|
||||
// Determine, based on selection, i.e. select proc/section and disable associated list boxes if
|
||||
// enum representing the transition restricts the selection.
|
||||
if (_CurItemFrom == null) return;
|
||||
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 procedure list box. (in 16-bit system it was types 0, 3, 5
|
||||
if ((etm & E_TransUI.ProcMenu) == E_TransUI.ProcMenu)
|
||||
listBoxTranProcs.Enabled = true;
|
||||
else
|
||||
{
|
||||
listBoxTranProcs.SelectedIndex = _CurrentProcIndex > 0 ? _CurrentProcIndex : 0;
|
||||
listBoxTranProcs.Enabled = false;
|
||||
}
|
||||
|
||||
// in 16-bit system it was types 0, 3, 4, 5
|
||||
if (((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault) ||
|
||||
((etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny) ||
|
||||
((etm & E_TransUI.SectMenuStep) == E_TransUI.SectMenuStep))
|
||||
{
|
||||
// find default step section and make it the selected item - then disable from further selection.
|
||||
//listBoxTranSects.SelectedIndex = 1; // TEMP until default step section found.
|
||||
listBoxTranSects.Enabled = true;
|
||||
}
|
||||
else
|
||||
listBoxTranSects.Enabled = false;
|
||||
// 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)
|
||||
{
|
||||
if (!_AlwaysDisableSets)vlnTreeComboSets.Enabled = true;
|
||||
cbTranProcs.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
groupPanelTranFmt.Visible = false;
|
||||
groupPanelTransitionProcs.Visible = false;
|
||||
groupPanelTransitionSect.Visible = false;
|
||||
groupPanelTranstionSteps.Visible = false;
|
||||
groupPanelProcSets.Visible = true;
|
||||
tvProcSets.Visible = true;
|
||||
tvProcSets.Dock = DockStyle.Top;
|
||||
return;
|
||||
cbTranProcs.SelectedIndex = _CurrentProcIndex > 0 ? _CurrentProcIndex : 0;
|
||||
cbTranProcs.Enabled = false;
|
||||
}
|
||||
}
|
||||
private void ClearControls()
|
||||
{
|
||||
listBoxTranFmt.Items.Clear();
|
||||
listBoxTranProcs.Items.Clear();
|
||||
listBoxTranSects.Items.Clear();
|
||||
tvTran.Nodes.Clear();
|
||||
_TranFmtIndx = 0;
|
||||
|
||||
// Do section combo, in 16-bit system it was types 0, 3, 4, 5
|
||||
if (cbTranSects.Items.Count>0 &&
|
||||
(((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault) ||
|
||||
((etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny) ||
|
||||
((etm & E_TransUI.SectMenuStep) == E_TransUI.SectMenuStep)))
|
||||
{
|
||||
cbTranSects.Enabled = true;
|
||||
}
|
||||
else
|
||||
cbTranSects.Enabled = false;
|
||||
|
||||
// check for range - if no range, then range button/label & step tree selections should be
|
||||
// 'cleared/invisble'.
|
||||
_DoingRange = false;
|
||||
if ((etm & E_TransUI.StepLast) == E_TransUI.StepLast) _DoingRange = true;
|
||||
btnTranRangeClear.Visible = _DoingRange;
|
||||
lblxTranRangeTip.Visible = _DoingRange;
|
||||
lblxTranRangeTip.BackColor = _RangeColor;
|
||||
// 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;
|
||||
}
|
||||
#endregion
|
||||
#region Events
|
||||
private void vlnTreeComboSets_BeforeExpand(object sender, TreeViewCancelEventArgs e)
|
||||
{
|
||||
DropDownNode par = ((DropDownNode)e.Node);
|
||||
// get first child's text, if it has one & if the text is VLN_DUMMY, load children
|
||||
DropDownNode tn = null;
|
||||
if (par.Nodes.Count > 0) tn = (DropDownNode)par.Nodes[0];
|
||||
if (tn.Text == "VLN_DUMMY") // expand this
|
||||
{
|
||||
par.Nodes.Clear();
|
||||
Object obj = par.Tag;
|
||||
if (!(obj is FolderInfo)) return; // should always be folderinfo on expand
|
||||
FolderInfo fi = (FolderInfo)obj;
|
||||
if (fi.ChildFolderCount > 0)
|
||||
{
|
||||
foreach (FolderInfo fic in fi.ChildFolders)
|
||||
{
|
||||
DropDownNode newnode = new DropDownNode(fic.FolderID, fic.ToString());
|
||||
par.Nodes.Add(newnode);
|
||||
newnode.Tag = fic;
|
||||
if (fic.HasChildren) // allow for '+' for tree expansion
|
||||
{
|
||||
DropDownNode tnt = new DropDownNode(0, "VLN_DUMMY");
|
||||
newnode.Nodes.Add(tnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (fi.FolderDocVersionCount > 0)
|
||||
{
|
||||
foreach (DocVersionInfo dv in fi.FolderDocVersions)
|
||||
{
|
||||
if ((VersionTypeEnum)dv.VersionType == VersionTypeEnum.WorkingDraft)
|
||||
{
|
||||
DropDownNode newnode = new DropDownNode(dv.VersionID, dv.ToString());
|
||||
newnode.Tag = dv;
|
||||
par.Nodes.Add(newnode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
vlnTreeComboSets.Value = par;
|
||||
vlnTreeComboSets.DropDownControl.SelectedNode = par;
|
||||
}
|
||||
private void DropDown_FinishEditing(object sender, DropDownValueChangedEventArgs e)
|
||||
{
|
||||
DropDownNode selnd = (DropDownNode)vlnTreeComboSets.DropDownControl.SelectedNode;
|
||||
Object obj = selnd.Tag;
|
||||
// only allow selections from proc, sect & step controls if the user has
|
||||
// selected a folder with only 1 working draft docversion or has
|
||||
// selected the docversion itself....
|
||||
bool defines_set = false;
|
||||
FolderInfo fi = null;
|
||||
if (obj is FolderInfo)
|
||||
{
|
||||
fi = (FolderInfo)obj;
|
||||
if (fi.ChildFolderCount == 0)
|
||||
{
|
||||
// note that the folder may contain more than one docversion, check for
|
||||
// only 1 working draft.
|
||||
int cntwd = 0;
|
||||
foreach (DocVersionInfo dvt in fi.FolderDocVersions)
|
||||
{
|
||||
if ((VersionTypeEnum)dvt.VersionType == VersionTypeEnum.WorkingDraft) cntwd++;
|
||||
}
|
||||
if (cntwd == 1) defines_set = true;
|
||||
}
|
||||
}
|
||||
else if (obj is DocVersionInfo)
|
||||
defines_set = true;
|
||||
if (!defines_set)
|
||||
{
|
||||
MessageBox.Show("Based on your selection, cannot get list of procedures, narrow the procedure set selection.");
|
||||
// disable ALL other controls
|
||||
cbTranProcs.Enabled = false;
|
||||
cbTranSects.Enabled = false;
|
||||
tvTran.Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// get to DocVersion node, if at folder... If there are no procedures, notify
|
||||
// the user and return (a transition must at least go to a procedure).
|
||||
// Otherwise, enable/disable controls based on format type of transition.
|
||||
DocVersionInfo dv = null;
|
||||
if (fi != null)
|
||||
{
|
||||
foreach (DocVersionInfo dvt in fi.FolderDocVersions)
|
||||
{
|
||||
if ((VersionTypeEnum)dvt.VersionType == VersionTypeEnum.WorkingDraft)
|
||||
{
|
||||
dv = dvt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
dv = (DocVersionInfo)obj;
|
||||
if (dv.Procedures.Count < 1)
|
||||
{
|
||||
MessageBox.Show("There are no procedures in this set. Cannot insert a transition within it.");
|
||||
cbTranProcs.Enabled = false;
|
||||
cbTranSects.Enabled = false;
|
||||
tvTran.Enabled = false;
|
||||
return;
|
||||
}
|
||||
cbTranProcsFillIn(dv.Procedures[0]);
|
||||
cbTranProcs.SelectedIndex = 0;
|
||||
SetControlsEnabling();
|
||||
}
|
||||
private void listBoxTranFmt_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_InitializingTrans) return;
|
||||
if (listBoxTranFmt.SelectedIndex == _TranFmtIndx) return;
|
||||
// if resetting format selection, null out the selected transitions.
|
||||
_tranitem1 = null;
|
||||
_tranitem2 = null;
|
||||
if (_RangeNode1 != null)
|
||||
|
||||
if (_RangeNode1 != null) ClearRangeTransition();
|
||||
// if this selection needs a step, the section list may need to updated with step only sections,
|
||||
// list the step sections of the current procedure.....
|
||||
E_TransUI etmprev = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI;
|
||||
E_TransUI etmnew = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
|
||||
if (((etmnew & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone) != ((etmprev & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone))
|
||||
{
|
||||
_RangeNode1.BackColor = tvTran.BackColor;
|
||||
_RangeNode1 = null;
|
||||
int sectstartid = FindSectionStart(_CurrentProcedure);
|
||||
IList chldrn = _CurrentProcedure.GetChildren();
|
||||
if (chldrn != null && chldrn.Count > 0) cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid);
|
||||
}
|
||||
_TranFmtIndx = listBoxTranFmt.SelectedIndex;
|
||||
|
||||
SetControlsEnabling();
|
||||
|
||||
tvTran.Enabled = true;
|
||||
}
|
||||
private void btnUp1_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -278,12 +498,12 @@ namespace Volian.Controls.Library
|
||||
VETreeNode tn = ((VETreeNode)e.Node);
|
||||
tn.LoadChildren(false);
|
||||
}
|
||||
private void listBoxTranSects_SelectedIndexChanged(object sender, EventArgs e)
|
||||
private void cbTranSects_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_InitializingTrans) return;
|
||||
// a different section was selected, if step section, update step list, otherwise, empty
|
||||
// it & disable.
|
||||
ItemInfo secitm = (ItemInfo)listBoxTranSects.SelectedItem;
|
||||
ItemInfo secitm = (ItemInfo)cbTranSects.SelectedItem;
|
||||
if (!secitm.IsStepSection)
|
||||
{
|
||||
tvTran.Nodes.Clear();
|
||||
@@ -291,28 +511,73 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
_InitializingTrans = true; // just initializing now, don't set any ranges, etc.
|
||||
tvTranFillIn(secitm.Steps[0]);
|
||||
tvTran.Enabled = true;
|
||||
_InitializingTrans = false;
|
||||
}
|
||||
}
|
||||
private void listBoxTranProcs_SelectedIndexChanged(object sender, EventArgs e)
|
||||
private int FindSectionStart(ItemInfo prcitm)
|
||||
{
|
||||
if (_InitializingTrans) return;
|
||||
ItemInfo prcitm = (ItemInfo)listBoxTranProcs.SelectedItem;
|
||||
|
||||
ProcedureConfig pc = (ProcedureConfig)prcitm.MyConfig;
|
||||
int sectstartid = -1;
|
||||
if (pc != null) sectstartid = System.Convert.ToInt32(pc.SectionStart);
|
||||
IList chldrn = prcitm.GetChildren();
|
||||
listBoxTranSectsFillIn((ItemInfo)chldrn[0], sectstartid);
|
||||
string ss = pc == null ? null : pc.SectionStart;
|
||||
if (ss != null) sectstartid = System.Convert.ToInt32(ss);
|
||||
return sectstartid;
|
||||
}
|
||||
private void btnTranInsert_Click(object sender, EventArgs e)
|
||||
private void cbTranProcs_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_InitializingTrans) return;
|
||||
ItemInfo prcitm = (ItemInfo)cbTranProcs.SelectedItem;
|
||||
if (prcitm == null || prcitm.Sections == null || prcitm.Sections.Count < 1)
|
||||
{
|
||||
cbTranSects.Items.Clear();
|
||||
tvTran.Nodes.Clear();
|
||||
return;
|
||||
}
|
||||
int sectstartid = FindSectionStart(prcitm);
|
||||
IList chldrn = prcitm.GetChildren();
|
||||
cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid);
|
||||
}
|
||||
private void tvTran_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
if (_InitializingTrans) return;
|
||||
if (_DoingRange)
|
||||
{
|
||||
if (_RangeNode1 == null || (_RangeNode1 != null && _RangeNode2 != null))
|
||||
{
|
||||
if (_RangeNode1 != null) tvTranRangeHilites(false, _RangeNode1, _RangeNode2);
|
||||
tvTran.SelectedNode.BackColor = _RangeColor;
|
||||
_RangeNode1 = (VETreeNode)tvTran.SelectedNode;
|
||||
_RangeNode2 = null;
|
||||
lblxTranRangeTip.Text = "Select Last Step \r\nfor Range";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_RangeNode2 != null) tvTranRangeHilites(false, _RangeNode1, _RangeNode2);
|
||||
_RangeNode2 = (VETreeNode)tvTran.SelectedNode;
|
||||
tvTran.SelectedNode.BackColor = _RangeColor;
|
||||
tvTranRangeHilites(true, _RangeNode1, _RangeNode2);
|
||||
lblxTranRangeTip.Text = "Select First Transition\r\nfor Range";
|
||||
}
|
||||
}
|
||||
}
|
||||
private void btnTranCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
_CurItemFrom = _SavCurItemFrom;
|
||||
_TranFmtIndx = _SavTranFmtIndx;
|
||||
TransitionFillIn();
|
||||
}
|
||||
private void btnTranRangeClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClearRangeTransition();
|
||||
}
|
||||
private void btnTranSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
string trantxt = "{Resolved Transition Text}";
|
||||
string linktxt = null;
|
||||
//int type = (int)(_CurItem.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].Type);
|
||||
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
|
||||
// do the procedure list box. (in 16-bit system it was types 0, 3, 5
|
||||
// if must have a step, test for this first.
|
||||
if (!((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) // _tranitem1 is set from step tree node.
|
||||
{
|
||||
if (tvTran.SelectedNode==null)
|
||||
@@ -320,25 +585,26 @@ namespace Volian.Controls.Library
|
||||
MessageBox.Show("Must 'Select Step' for transition 'to'");
|
||||
return;
|
||||
}
|
||||
VETreeNode vtn = (VETreeNode)tvTran.SelectedNode;
|
||||
_tranitem1 = (ItemInfo) vtn.VEObject; // is this cast valid?
|
||||
linktxt = string.Format("#Link:Transition: {0} xx {1}", listBoxTranFmt.SelectedIndex, _tranitem1.ItemID);
|
||||
}
|
||||
else if ((etm & E_TransUI.StepLast) == E_TransUI.StepLast) //range
|
||||
ItemInfo _tranitem1 = null;
|
||||
ItemInfo _tranitem2 = null;
|
||||
if ((etm & E_TransUI.StepLast) == E_TransUI.StepLast) //range
|
||||
{
|
||||
if (_tranitem1==null)
|
||||
if (_RangeNode1==null)
|
||||
{
|
||||
MessageBox.Show("Must 'Select Step' for transition 'to'");
|
||||
return;
|
||||
}
|
||||
_tranitem1 = (ItemInfo)_RangeNode1.VEObject;
|
||||
// Get the second item in the range, based on current tree view selection.
|
||||
if (tvTran.SelectedNode == null)
|
||||
if (_RangeNode2 == null && tvTran.SelectedNode == null)
|
||||
{
|
||||
MessageBox.Show("Must 'Select Step' for range transition 'to'");
|
||||
return;
|
||||
}
|
||||
VETreeNode vtn = (VETreeNode)tvTran.SelectedNode;
|
||||
_tranitem2 = (ItemInfo)vtn.VEObject; // is this cast valid?
|
||||
if (_RangeNode2 == null) _RangeNode2 = (VETreeNode)tvTran.SelectedNode;
|
||||
_tranitem2 = (ItemInfo)_RangeNode2.VEObject;
|
||||
|
||||
// Check that the two items are of the below the section type.
|
||||
if (_tranitem1.MyContent.Type < 20000 || _tranitem2.MyContent.Type < 20000)
|
||||
{
|
||||
@@ -346,142 +612,138 @@ namespace Volian.Controls.Library
|
||||
return;
|
||||
}
|
||||
linktxt = string.Format("#Link:Transition: {0} xx {1} {2}", listBoxTranFmt.SelectedIndex, _tranitem1.ItemID, _tranitem2.ItemID);
|
||||
|
||||
}
|
||||
else if ((etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny)
|
||||
else if ((etm & E_TransUI.StepFirst) == E_TransUI.StepFirst)
|
||||
{
|
||||
VETreeNode vtn = (VETreeNode)tvTran.SelectedNode;
|
||||
if (vtn != null)
|
||||
{
|
||||
_tranitem1 = (ItemInfo)vtn.VEObject; // is this cast valid?
|
||||
linktxt = string.Format("#Link:Transition: {0} xx {1}", listBoxTranFmt.SelectedIndex, _tranitem1.ItemID);
|
||||
}
|
||||
}
|
||||
if (_tranitem1 == null && (etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny)
|
||||
{
|
||||
if (tvTran.Enabled == false || _tranitem1.IsAccPages)
|
||||
_tranitem1 = (ItemInfo)listBoxTranSects.SelectedItem;
|
||||
_tranitem1 = (ItemInfo)cbTranSects.SelectedItem;
|
||||
else
|
||||
{
|
||||
VETreeNode vtn = (VETreeNode)tvTran.SelectedNode;
|
||||
_tranitem1 = (ItemInfo)vtn.VEObject; // is this cast valid?
|
||||
_tranitem1 = (ItemInfo)vtn.VEObject;
|
||||
}
|
||||
if (_tranitem1==null)
|
||||
{
|
||||
MessageBox.Show("Must 'Select Section' or 'Select Step' for transition 'to'");
|
||||
return;
|
||||
}
|
||||
// check that item is a valid type based on transition type selected from format, i.e. section versus step, etc.
|
||||
//if (type < 4 && _tranitem1.MyContent.Type < 20000)
|
||||
//{
|
||||
// MessageBox.Show("Must select a step type item for this transition format type");
|
||||
// return;
|
||||
//}
|
||||
linktxt = string.Format("#Link:Transition: {0} xx {1}", listBoxTranFmt.SelectedIndex, _tranitem1.ItemID);
|
||||
}
|
||||
if (_tranitem1 == null && (((etm & E_TransUI.ProcCur) == E_TransUI.ProcCur) || ((etm & E_TransUI.ProcMenu) == E_TransUI.ProcMenu)))
|
||||
{
|
||||
_tranitem1 = (ItemInfo)cbTranProcs.SelectedItem;
|
||||
if (_tranitem1 == null)
|
||||
{
|
||||
MessageBox.Show("Must select an item for transition 'to'");
|
||||
return;
|
||||
}
|
||||
linktxt = string.Format("#Link:Transition: {0} xx {1}", listBoxTranFmt.SelectedIndex, _tranitem1.ItemID);
|
||||
}
|
||||
_MyRTB.InsertTran(trantxt, linktxt);
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void tvTran_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
#region VariousSupportMethods
|
||||
private void ClearRangeTransition()
|
||||
{
|
||||
if (_InitializingTrans) return;
|
||||
if (_RangeNode1 == null)
|
||||
if (_RangeNode1 == null && _RangeNode2 == null) return;
|
||||
tvTranRangeHilites(false, _RangeNode1, _RangeNode2);
|
||||
lblxTranRangeTip.Text = "Select First Transition\r\nfor Range";
|
||||
_RangeNode1 = _RangeNode2 = null;
|
||||
}
|
||||
private void tvTranRangeHilites(bool on, VETreeNode node1, VETreeNode node2)
|
||||
{
|
||||
if (node1==null && node2==null) return;
|
||||
if (node1 != null && node2 == null)
|
||||
{
|
||||
VETreeNode vtn = (VETreeNode)tvTran.SelectedNode;
|
||||
_tranitem1 = (ItemInfo)vtn.VEObject; // is this cast valid?
|
||||
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
|
||||
node1.BackColor = on ? _RangeColor : tvTran.BackColor;
|
||||
return;
|
||||
}
|
||||
|
||||
// if this is a range, we'll denote the first 'to' item with color on the
|
||||
// tree view.
|
||||
if ((etm & E_TransUI.StepLast) == E_TransUI.StepLast)
|
||||
// If node2 is below node1 in the tree switch them... get to high level step &
|
||||
// then just walk down tree.
|
||||
ItemInfo itm1 = (ItemInfo)node1.VEObject;
|
||||
ItemInfo itm2 = (ItemInfo)node2.VEObject;
|
||||
while (!itm1.IsHigh) itm1 = itm1.MyParent;
|
||||
while (!itm2.IsHigh) itm2 = itm2.MyParent;
|
||||
ItemInfoList itmlst = (ItemInfoList)itm1.MyParent.GetChildren();
|
||||
int i1 = -1;
|
||||
int i2 = -1;
|
||||
int cnt = 1;
|
||||
foreach (ItemInfo chld in itmlst)
|
||||
{
|
||||
if (chld.ItemID == itm1.ItemID) i1 = cnt;
|
||||
if (chld.ItemID == itm2.ItemID) i2 = cnt;
|
||||
cnt++;
|
||||
if (i1 != -1 && i2 != -1) break;
|
||||
}
|
||||
if (i1 > i2)
|
||||
{
|
||||
VETreeNode t = node2;
|
||||
node2 = node1;
|
||||
node1 = t;
|
||||
}
|
||||
// Turn Hilighting on/off (depending on bool argument) between the two nodes
|
||||
// they may be at different tree levels.
|
||||
|
||||
// find common parent level first and save the 'top parent' node for each selection.
|
||||
VETreeNode tmp1 = node1;
|
||||
VETreeNode tmp2 = node2;
|
||||
// loop, walking up node2's tree checking against node1. If not found, go to node1
|
||||
// parent, etc.
|
||||
bool foundcommon = false;
|
||||
while (!foundcommon && tmp1 != null)
|
||||
{
|
||||
while (!foundcommon & tmp2 != null)
|
||||
{
|
||||
tvTran.SelectedNode.BackColor = Color.Aquamarine;
|
||||
_RangeNode1 = vtn;
|
||||
return;
|
||||
if (tmp1.Parent == tmp2.Parent) foundcommon = true;
|
||||
else tmp2 = (VETreeNode)tmp2.Parent;
|
||||
}
|
||||
else
|
||||
if (!foundcommon)
|
||||
{
|
||||
return;
|
||||
tmp2 = node2;
|
||||
tmp1 = (VETreeNode)tmp1.Parent;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
// work down from node1.
|
||||
VETreeNode cur = node1;
|
||||
while (cur != null)
|
||||
{
|
||||
_tranitem2 = (ItemInfo)listBoxTranSects.SelectedItem;
|
||||
if (tvTran.Enabled == false || _tranitem2.IsAccPages)
|
||||
_tranitem2 = (ItemInfo)listBoxTranSects.SelectedItem;
|
||||
else
|
||||
_tranitem2 = (ItemInfo)tvTran.SelectedNode.Tag;
|
||||
cur.BackColor = on ? _RangeColor : tvTran.BackColor;
|
||||
cur = (VETreeNode)(cur.NextNode == null ? cur.Parent : cur.NextNode);
|
||||
// if these nodes were at the same level, then stop after the current node = range2
|
||||
if (cur == tmp1) cur = null; // stop at top
|
||||
if (cur == tmp2) tmp1 = cur = null;
|
||||
}
|
||||
TreeNode tn = tvTran.SelectedNode;
|
||||
tn.BackColor = Color.Aquamarine;
|
||||
}
|
||||
|
||||
private void tvTran_NodeSelectionChange(object sender, vlnTreeEventArgs args)
|
||||
{
|
||||
if (_InitializingTrans) return;
|
||||
if (_RangeNode1 == null)
|
||||
// set background for highest level between two nodes.
|
||||
cur = tmp1==null?null:(VETreeNode)tmp1.NextNode;
|
||||
while (cur != null)
|
||||
{
|
||||
VETreeNode vtn = (VETreeNode)tvTran.SelectedNode;
|
||||
_tranitem1 = (ItemInfo)vtn.VEObject; // is this cast valid?
|
||||
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
|
||||
// if this is a range, we'll denote the first 'to' item with color on the
|
||||
// tree view.
|
||||
if ((etm & E_TransUI.StepLast) == E_TransUI.StepLast)
|
||||
{
|
||||
tvTran.SelectedNode.BackColor = Color.Aquamarine;
|
||||
_RangeNode1 = vtn;
|
||||
return;
|
||||
}
|
||||
cur.BackColor = on ? _RangeColor : tvTran.BackColor;
|
||||
cur = (VETreeNode)cur.NextNode;
|
||||
if (cur == tmp2) cur = null;
|
||||
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void tvTran_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (_InitializingTrans) return;
|
||||
if (_RangeNode1 == null)
|
||||
// finish subtree of second node in range.
|
||||
cur = tmp2==node2?null:node2;
|
||||
while (cur != null)
|
||||
{
|
||||
VETreeNode vtn = (VETreeNode)tvTran.SelectedNode;
|
||||
_tranitem1 = (ItemInfo)vtn.VEObject; // is this cast valid?
|
||||
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
|
||||
// if this is a range, we'll denote the first 'to' item with color on the
|
||||
// tree view.
|
||||
if ((etm & E_TransUI.StepLast) == E_TransUI.StepLast)
|
||||
{
|
||||
tvTran.SelectedNode.BackColor = Color.Aquamarine;
|
||||
_RangeNode1 = vtn;
|
||||
return;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
cur.BackColor = on ? _RangeColor : tvTran.BackColor;
|
||||
cur = (VETreeNode)(cur.PrevNode == null ? cur.Parent : cur.PrevNode);
|
||||
if (cur == tmp2) cur = null; // stop at top
|
||||
}
|
||||
// hilite last selection..
|
||||
tmp2.BackColor = on ? _RangeColor : tvTran.BackColor;
|
||||
}
|
||||
|
||||
private void btnNewTrans_Click(object sender, EventArgs e)
|
||||
{
|
||||
_CurItemFrom = _MyRTB.MyItem;
|
||||
_CurTrans = null;
|
||||
_TranFmtIndx = 0;
|
||||
TransitionFillIn();
|
||||
}
|
||||
private void LoadProcSetTree()
|
||||
{
|
||||
VETreeNode tn = VETreeNode.GetFolder(1);
|
||||
tvProcSets.Nodes.Add(tn);
|
||||
tn.LoadChildren(true);
|
||||
tvProcSets.BeforeExpand += new TreeViewCancelEventHandler(tvProcSet_BeforeExpand);
|
||||
}
|
||||
private void tvProcSet_BeforeExpand(object sender, TreeViewCancelEventArgs e)
|
||||
{
|
||||
VETreeNode tn = ((VETreeNode)e.Node);
|
||||
tn.LoadChildren(true);
|
||||
}
|
||||
private void cbCurProcSet_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
CurProcSet = cbCurProcSet.Checked;
|
||||
if (!CurProcSet && tvProcSets.Nodes.Count == 0) LoadProcSetTree();
|
||||
SetControlsEnabling();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user