This commit is contained in:
Kathy Ruffing 2012-02-15 15:02:06 +00:00
parent 92adada4fb
commit 09b1cce695

View File

@ -161,7 +161,7 @@ namespace Volian.Controls.Library
cbTranProcsFillIn(_CurrentProcedure); cbTranProcsFillIn(_CurrentProcedure);
if (_CurrentProcedure.Sections != null) if (_CurrentProcedure.Sections != null)
{ {
cbTranSectsFillIn(secitm, secitm == null ? -1 : secitm.ItemID); cbTranSectsFillIn(secitm, secitm == null ? -1 : secitm.ItemID, true);
// 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;
@ -415,6 +415,14 @@ namespace Volian.Controls.Library
tvTran.Nodes.Clear(); tvTran.Nodes.Clear();
groupPanelTranstionSteps.Style.BackColor = _OrigGroupPanelSteps; groupPanelTranstionSteps.Style.BackColor = _OrigGroupPanelSteps;
if (startitm == null) return; if (startitm == null) return;
// if metasections, and the selected section's config item has noneditable data, then don't
// display any steps.
ItemInfo secitm = (ItemInfo)cbTranSects.SelectedItem;
bool hasMetaSubs = secitm.IsSection && secitm.Sections != null && secitm.Sections.Count > 0;
bool editSteps = !hasMetaSubs || (secitm.MyConfig is SectionConfig && (secitm.MyConfig as SectionConfig).SubSection_Edit == "Y");
if (!editSteps) return;
// if the transition to point is a section or procedure, just return // if the transition to point is a section or procedure, just return
if (startitm.MyContent.Type < 20000) return; if (startitm.MyContent.Type < 20000) return;
groupPanelTranstionSteps.Style.BackColor = Color.Cornsilk; groupPanelTranstionSteps.Style.BackColor = Color.Cornsilk;
@ -445,15 +453,16 @@ namespace Volian.Controls.Library
tvTran.ItemHeight++; tvTran.ItemHeight++;
tvTran.ItemHeight--; tvTran.ItemHeight--;
} }
private void cbTranSectsFillIn(ItemInfo secitm, int secstart) private int savSecStart;
private void cbTranSectsFillIn(ItemInfo secitm, int secstart, bool clear)
{ {
cbTranSects.Items.Clear(); if (clear) cbTranSects.Items.Clear();
// if the transition points 'to' procedure, don't list the sections yet. // if the transition points 'to' procedure, don't list the sections yet.
if (secitm == null || secitm.MyContent.Type < 10000) return; if (secitm == null || secitm.MyContent.Type < 10000) return;
// if sectstart is not -1, then use this as the section to select, otherwise // if sectstart is not -1, then use this as the section to select, otherwise
// use the id for the item passed in. // use the id for the item passed in.
int startitm = secstart; int startitm = secstart;
if (secstart < 0) secstart = secitm.ItemID; if (clear && secstart < 0) secstart = secitm.ItemID;
ItemInfo selitm = secitm; // this is the selected 'section' ItemInfo selitm = secitm; // this is the selected 'section'
secitm = secitm.FirstSibling; secitm = secitm.FirstSibling;
while (secitm != null) while (secitm != null)
@ -466,6 +475,7 @@ namespace Volian.Controls.Library
int active = cbTranSects.Items.Add(secitm); int active = cbTranSects.Items.Add(secitm);
if (secitm.ItemID == secstart) cbTranSects.SelectedIndex = active; if (secitm.ItemID == secstart) cbTranSects.SelectedIndex = active;
} }
if (secitm.Sections != null && secitm.Sections.Count > 0) cbTranSectsFillIn(secitm.Sections[0], -1, false);
secitm = (secitm.NextItem != null && secitm.NextItems.Count > 0 ? secitm.NextItems[0] : null); secitm = (secitm.NextItem != null && secitm.NextItems.Count > 0 ? secitm.NextItems[0] : null);
} }
@ -697,7 +707,7 @@ namespace Volian.Controls.Library
} }
int sectstartid = FindSectionStart(_CurrentProcedure); int sectstartid = FindSectionStart(_CurrentProcedure);
IList chldrn = _CurrentProcedure.GetChildren(); IList chldrn = _CurrentProcedure.GetChildren();
if (chldrn != null && chldrn.Count > 0) cbTranSectsFillIn((ItemInfo)chldrn[0], secitm==null?sectstartid:secitm.ItemID); //sectstartid); if (chldrn != null && chldrn.Count > 0) cbTranSectsFillIn((ItemInfo)chldrn[0], secitm==null?sectstartid:secitm.ItemID, true); //sectstartid);
} }
_TranFmtIndx = listBoxTranFmt.SelectedIndex; _TranFmtIndx = listBoxTranFmt.SelectedIndex;
groupPanelTranFmt.Style.BackColor = (_CurTrans == null && _TranFmtIndx == 0) ? Color.Yellow : Color.Orange; groupPanelTranFmt.Style.BackColor = (_CurTrans == null && _TranFmtIndx == 0) ? Color.Yellow : Color.Orange;
@ -792,7 +802,7 @@ namespace Volian.Controls.Library
} }
int sectstartid = FindSectionStart(prcitm); int sectstartid = FindSectionStart(prcitm);
IList chldrn = prcitm.GetChildren(); IList chldrn = prcitm.GetChildren();
cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid); cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid, true);
} }
private void tvTran_AfterSelect(object sender, TreeViewEventArgs e) private void tvTran_AfterSelect(object sender, TreeViewEventArgs e)
{ {