This commit is contained in:
@@ -338,7 +338,7 @@ namespace VEPROMS
|
||||
tn.LoadingChildernMax += new VETreeNodeEvent(tn_LoadingChildernMax);
|
||||
tn.LoadingChildernValue += new VETreeNodeEvent(tn_LoadingChildernValue);
|
||||
tn.LoadingChildrenSQL += new VETreeNodeEvent(tn_LoadingChildrenSQL);
|
||||
tn.LoadChildren();
|
||||
tn.LoadChildren(true);
|
||||
|
||||
}
|
||||
private void tv_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
@@ -1071,284 +1071,52 @@ namespace VEPROMS
|
||||
this.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ROTab
|
||||
private void tvROFST_BeforeExpand(object sender, TreeViewCancelEventArgs e)
|
||||
{
|
||||
LoadChildren(e.Node);
|
||||
}
|
||||
private void tvROFST_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
if (e.Node.Tag is ROFST.rochild)
|
||||
{
|
||||
ROFST.rochild chld = (ROFST.rochild)e.Node.Tag;
|
||||
if (chld.type == 1 && chld.value != null) tbROValue.Text = chld.value;
|
||||
else tbROValue.Text = null;
|
||||
}
|
||||
else
|
||||
tbROValue.Text = null;
|
||||
}
|
||||
private void LoadChildren(TreeNode tn)
|
||||
{
|
||||
object tag = tn.Tag;
|
||||
if (tn.FirstNode != null && tn.FirstNode.Text == "VLN_DUMMY_FOR_TREE") tn.FirstNode.Remove();
|
||||
ROFST.rochild[] chld = null;
|
||||
|
||||
if (tn.Tag is ROFST.rodbi)
|
||||
{
|
||||
ROFST.rodbi db = (ROFST.rodbi)tn.Tag;
|
||||
chld = db.children;
|
||||
}
|
||||
else if (tn.Tag is ROFST.rochild)
|
||||
{
|
||||
ROFST.rochild ch = (ROFST.rochild)tn.Tag;
|
||||
chld = ch.children;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("error - no type");
|
||||
return;
|
||||
}
|
||||
// if children, add dummy node
|
||||
if (chld != null && chld.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < chld.Length; i++)
|
||||
{
|
||||
TreeNode tmp = null;
|
||||
// if this is a group, i.e. type 0, add a dummy node
|
||||
if (chld[i].type == 0 && chld[i].children == null)
|
||||
//skip it.
|
||||
Console.WriteLine("ro junk");
|
||||
else if (chld[i].type == 1 && chld[i].value == null)
|
||||
{
|
||||
tmp = new TreeNode(chld[i].title);
|
||||
tmp.Tag = chld[i];
|
||||
tn.Nodes.Add(tmp);
|
||||
TreeNode sub = new TreeNode("VLN_DUMMY_FOR_TREE");
|
||||
tmp.Nodes.Add(sub);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = new TreeNode(chld[i].title);
|
||||
tmp.Tag = chld[i];
|
||||
tn.Nodes.Add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void LoadTree(ROFST rofst)
|
||||
{
|
||||
for (int i = 0; i < rofst.myHdr.myDbs.Length; i++)
|
||||
{
|
||||
TreeNode tn = new TreeNode(rofst.myHdr.myDbs[i].dbiTitle);
|
||||
tn.Tag = rofst.myHdr.myDbs[i];
|
||||
tvROFST.Nodes.Add(tn);
|
||||
AddDummyGroup(rofst.myHdr.myDbs[i], tn);
|
||||
}
|
||||
}
|
||||
private void AddDummyGroup(ROFST.rodbi rodbi, TreeNode tn)
|
||||
{
|
||||
if (rodbi.children != null && rodbi.children.Length > 0)
|
||||
{
|
||||
TreeNode tmp = new TreeNode("VLN_DUMMY_FOR_TREE");
|
||||
tn.Nodes.Add(tmp);
|
||||
}
|
||||
}
|
||||
#region InfoTabRO
|
||||
private void infotabRO_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
//ItemInfo curitm = dtp.ItemSelected;
|
||||
//DisplayRO dr = new DisplayRO(rofst, curitm, false, _MyRTB);
|
||||
//infotabControlPanelRO.Controls.Add(dr);
|
||||
infoPanel.Expanded = true;
|
||||
infoTabs.SelectedTab = infotabRO;
|
||||
|
||||
DisplayTabPanel dtp = ((DisplayTabItem)tc.SelectedTab).MyTabPanel;
|
||||
// if dtp == null, disable the ro & tran info tabs.
|
||||
if (dtp == null) return;
|
||||
|
||||
//ItemInfo curitm = dtp.ItemSelected;
|
||||
ROFST rofst = new ROFST("g:\\vehlp\\ro\\ro.fst");
|
||||
LoadTree(rofst);
|
||||
displayRO.MyROFST = rofst;
|
||||
displayRO.CurItem = dtp.ItemSelected;
|
||||
displayRO.MyRTB = _MyRTB;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region TransitionTab
|
||||
private int TranFmtIndx = -1;
|
||||
#region InfoTabTransition
|
||||
private void infotabTransition_Click(object sender, EventArgs e)
|
||||
{
|
||||
TranFmtIndx = -1;
|
||||
if (tc == null || tc.SelectedTab == null) return;
|
||||
DisplayTabPanel dtp = ((DisplayTabItem)tc.SelectedTab).MyTabPanel;
|
||||
if (dtp == null) return;
|
||||
btnInsTrans_Click(sender, e);
|
||||
}
|
||||
// infotabTransitionFillIn uses other methods to fill in all controls on the
|
||||
// insert/modify transition tab. Note that, for now, curitm just be a 'step'
|
||||
// item (not a section or procedure).
|
||||
private bool _InitializingTrans;
|
||||
private void infotabTransitionFillIn(ItemInfo curitm)
|
||||
{
|
||||
btnTranInsert.Text = "Select Transition";
|
||||
_InitializingTrans = true;
|
||||
//if (curitm.MyContent.Type < 20000) return;
|
||||
listBoxTranFmtFillIn(curitm);
|
||||
|
||||
// use curitm to find section level and procedure level.
|
||||
ItemInfo tmpitm = curitm;
|
||||
while (tmpitm.MyContent.Type >= 20000)
|
||||
{
|
||||
tmpitm = tmpitm.MyParent;
|
||||
}
|
||||
ItemInfo secitm = tmpitm;
|
||||
listBoxTranSectsFillIn(secitm, secitm.ItemID);
|
||||
ItemInfo prcitm = secitm.MyParent;
|
||||
listBoxTranProcsFillIn(prcitm);
|
||||
|
||||
tvTranFillIn(curitm);
|
||||
_InitializingTrans = false;
|
||||
}
|
||||
private void listBoxTranFmtFillIn(ItemInfo curitm)
|
||||
{
|
||||
TransTypeList ttl = curitm.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList;
|
||||
listBoxTranFmt.Items.Clear();
|
||||
for (int i = 0; i < ttl.Count; i++)
|
||||
listBoxTranFmt.Items.Add(ttl[i].TransMenu);
|
||||
bool modify = false; // this flags modify vs new - where can I get this?
|
||||
if (!modify) listBoxTranFmt.SelectedIndex = 0;
|
||||
}
|
||||
private void tvTranFillIn(ItemInfo curitm)
|
||||
{
|
||||
tvTran.Nodes.Clear();
|
||||
// For the tree view, use parent, unless already at HLS. If at HLS, use this level.
|
||||
ItemInfo selitm = curitm;
|
||||
if (!curitm.IsHigh)
|
||||
{
|
||||
curitm = curitm.MyParent;
|
||||
selitm = curitm;
|
||||
}
|
||||
curitm = curitm.FirstSibling;
|
||||
while (curitm != null)
|
||||
{
|
||||
VETreeNode tvn = new VETreeNode(curitm);
|
||||
tvn.Tag = curitm;
|
||||
int active = this.tvTran.Nodes.Add(tvn); //new VETreeNode(curitm));
|
||||
if (curitm.ItemID == selitm.ItemID) tvTran.SelectedNode = tvTran.Nodes[active];
|
||||
curitm = (curitm.NextItemCount > 0 ? curitm.NextItems[0] : null);
|
||||
}
|
||||
tvTran.BeforeExpand += new TreeViewCancelEventHandler(tvTran_BeforeExpand);
|
||||
}
|
||||
private void listBoxTranSectsFillIn(ItemInfo secitm, int sectstart)
|
||||
{
|
||||
listBoxTranSects.Items.Clear();
|
||||
// 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;
|
||||
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;
|
||||
secitm = (secitm.NextItemCount > 0 ? secitm.NextItems[0] : null);
|
||||
}
|
||||
}
|
||||
private void listBoxTranProcsFillIn(ItemInfo prcitm)
|
||||
{
|
||||
listBoxTranProcs.Items.Clear();
|
||||
ItemInfo selitm = prcitm; // this is the selected 'section'
|
||||
prcitm = prcitm.FirstSibling;
|
||||
while (prcitm != null)
|
||||
{
|
||||
int active = listBoxTranProcs.Items.Add(prcitm);
|
||||
if (prcitm.MyContent.ContentID == selitm.MyContent.ContentID) listBoxTranProcs.SelectedIndex = active;
|
||||
prcitm = (prcitm.NextItemCount > 0 ? prcitm.NextItems[0] : null);
|
||||
}
|
||||
}
|
||||
#region TransitionTabEvents
|
||||
private void btnInsTrans_Click(object sender, EventArgs e)
|
||||
{
|
||||
infoPanel.Expanded = true;
|
||||
infoTabs.SelectedTab = infotabTransition;
|
||||
|
||||
|
||||
DisplayTabPanel dtp = ((DisplayTabItem)tc.SelectedTab).MyTabPanel;
|
||||
// if dtp == null, disable the ro & tran info tabs.
|
||||
if (dtp == null) return;
|
||||
|
||||
ItemInfo curitm = dtp.ItemSelected;
|
||||
// - kbr - do I need this? curitm = curitm.FirstSibling;
|
||||
infotabTransitionFillIn(curitm);
|
||||
//ItemInfo curitm = dtp.ItemSelected;
|
||||
displayTransition.CurItem = dtp.ItemSelected;
|
||||
displayTransition.MyRTB = _MyRTB;
|
||||
//DisplayTransition dt = new DisplayTransition(curitm, false, _MyRTB);
|
||||
//infotabControlPanelTransitions.Controls.Add(dt);
|
||||
//dt.Dock = DockStyle.Fill;
|
||||
}
|
||||
private void btnUp1_Click(object sender, EventArgs e)
|
||||
{
|
||||
// if at HLS, don't do anything.
|
||||
ItemInfo curitm = (ItemInfo)((VETreeNode)tvTran.Nodes[0]).VEObject;
|
||||
if (curitm.IsHigh) return;
|
||||
tvTranFillIn(curitm);
|
||||
}
|
||||
private void tvTran_BeforeExpand(object sender, TreeViewCancelEventArgs e)
|
||||
{
|
||||
VETreeNode tn = ((VETreeNode)e.Node);
|
||||
tn.LoadChildren();
|
||||
}
|
||||
private void listBoxTranFmt_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_InitializingTrans) return;
|
||||
// depending on the selected format's type , display associated list/tree boxes...
|
||||
//
|
||||
// <TransTypes TransType="0" TransFormat="{Proc. Number}, {Proc. Title}, Step {First Step}" />
|
||||
// <TransTypes TransType="1" TransFormat="{First Step}" />
|
||||
// <TransTypes TransType="2" TransFormat="{First Step}, {.}, {.}, {.} and {LastStep}" />
|
||||
// <TransTypes TransType="3" TransFormat="{First Step} thru {LastStep} of {Proc. Number}, {Proc. Title}, {Section Header}" />
|
||||
// <TransTypes TransType="4" TransFormat="{Section Title}, Step {First Step}" />
|
||||
// <TransTypes TransType="5" TransFormat="{Proc. Number}, {Proc. Title}, {Section Header}, Step {First Step}" />
|
||||
//
|
||||
if (listBoxTranFmt.SelectedIndex == TranFmtIndx) return;
|
||||
TranFmtIndx = listBoxTranFmt.SelectedIndex;
|
||||
|
||||
DisplayTabPanel dtp = ((DisplayTabItem)tc.SelectedTab).MyTabPanel;
|
||||
ItemInfo curitm = dtp.ItemSelected;
|
||||
//int selitm = listBoxTranFmt.SelectedIndex;
|
||||
int type = (int)(curitm.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].Type);
|
||||
if (type == 0 || type == 3 || type == 5) // show & allow selections for procedures.
|
||||
listBoxTranProcs.Enabled = true;
|
||||
else
|
||||
listBoxTranProcs.Enabled = false;
|
||||
|
||||
bool stpsct = true;
|
||||
|
||||
if (type == 0 || type == 3 || type == 4 || type == 5)
|
||||
{
|
||||
// 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;
|
||||
|
||||
tvTran.Enabled = true;
|
||||
}
|
||||
private void listBoxTranSects_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;
|
||||
if (!secitm.IsStepSection)
|
||||
{
|
||||
tvTran.Nodes.Clear();
|
||||
tvTran.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
tvTranFillIn(secitm.Steps[0]);
|
||||
tvTran.Enabled = true;
|
||||
}
|
||||
}
|
||||
private void listBoxTranProcs_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
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);
|
||||
// get default step section and fill it in, depending on format type....
|
||||
// kbr - for now, use first
|
||||
IList chldrn = prcitm.GetChildren();
|
||||
|
||||
listBoxTranSectsFillIn((ItemInfo)chldrn[0], sectstartid);
|
||||
}
|
||||
|
||||
#endregion
|
||||
private void tc_ItemSelectedChanged(object sender, DisplayPanelEventArgs args)
|
||||
{
|
||||
if (args == null)
|
||||
@@ -1356,12 +1124,13 @@ namespace VEPROMS
|
||||
else
|
||||
{
|
||||
itemAnnotationsBindingSource.DataSource = args.MyVlnCSLARTB.MyItem.ItemAnnotations;
|
||||
this._MyRTB = args.MyVlnCSLARTB.MyDisplayRTB;
|
||||
|
||||
//_MyRTB = args.MyVlnCSLARTB.MyDisplayRTB;
|
||||
DisplayTabPanel dtp = ((DisplayTabItem)tc.SelectedTab).MyTabPanel;
|
||||
if (dtp == null) return;
|
||||
displayTransition.CurItem = dtp.ItemSelected;
|
||||
displayTransition.MyRTB = _MyRTB;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void itemAnnotationsBindingSource_DataSourceChanged(object sender, EventArgs e)
|
||||
{
|
||||
AnnotationInfoList myAnnotations = itemAnnotationsBindingSource.DataSource as AnnotationInfoList;
|
||||
@@ -1377,54 +1146,10 @@ namespace VEPROMS
|
||||
epComments.Expanded = false;
|
||||
rtxbComment.Text = null;
|
||||
}
|
||||
|
||||
}
|
||||
private ItemInfo _tranitem1;
|
||||
private ItemInfo _tranitem2;
|
||||
|
||||
private void btnTranInsert_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (btnTranInsert.Text == "Select Transition")
|
||||
{
|
||||
_tranitem1 = null;
|
||||
_tranitem1 = (ItemInfo)listBoxTranSects.SelectedItem;
|
||||
if (tvTran.Enabled == false || _tranitem1.IsAccPages)
|
||||
_tranitem1 = (ItemInfo)listBoxTranSects.SelectedItem;
|
||||
else
|
||||
_tranitem1 = (ItemInfo)tvTran.SelectedNode.Tag;
|
||||
|
||||
// if range, set text on button to state to select 2nd trans.
|
||||
DisplayTabPanel dtp = ((DisplayTabItem)tc.SelectedTab).MyTabPanel;
|
||||
ItemInfo curitm = dtp.ItemSelected;
|
||||
//int selitm = listBoxTranFmt.SelectedIndex;
|
||||
int type = (int)(curitm.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].Type);
|
||||
if (type == 2 || type == 3)
|
||||
{
|
||||
this.btnTranInsert.Text = "Select 2nd Transition";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
string linktxt = string.Format("#Link:Transition: {0} xx {1}", type, curitm.ItemID);
|
||||
_MyRTB.InsertTran("(Resolved Transition Text)", linktxt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_tranitem2 = null;
|
||||
_tranitem2 = (ItemInfo)listBoxTranSects.SelectedItem;
|
||||
if (tvTran.Enabled == false || _tranitem2.IsAccPages)
|
||||
_tranitem2 = (ItemInfo)listBoxTranSects.SelectedItem;
|
||||
else
|
||||
_tranitem2 = (ItemInfo)tvTran.SelectedNode.Tag;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
_MyRTB.Save();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user