diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 0443eb88..330d0c3a 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -2481,7 +2481,7 @@ namespace VEPROMS.CSLA.Library { if (ii.DisplayNumber != null && ii.DisplayNumber != "") { - SectionConfig sc = MyActiveSection.MyConfig as SectionConfig; + SectionConfig sc = ii.MyConfig as SectionConfig; if (sc != null && sc.SubSection_AutoIndent == "Y") countlev++; } diff --git a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs index 60b296e6..e325147a 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs @@ -2933,6 +2933,14 @@ namespace VEPROMS.CSLA.Library return LazyLoad(ref _NullBox, "@NullBox"); } } + private LazyLoad _AllowNoteCautionAdd; + public bool AllowNoteCautionAdd + { + get + { + return LazyLoad(ref _AllowNoteCautionAdd, "@AllowNoteCautionAdd"); + } + } } #endregion #region TopOfPage diff --git a/PROMS/Volian.Controls.Library/StepPanel.cs b/PROMS/Volian.Controls.Library/StepPanel.cs index e6393d5d..901a7af7 100644 --- a/PROMS/Volian.Controls.Library/StepPanel.cs +++ b/PROMS/Volian.Controls.Library/StepPanel.cs @@ -393,6 +393,7 @@ namespace Volian.Controls.Library ExpandAsNeeded(itemInfo); if (_SelectedItemInfo == null) _SelectedItemInfo = itemInfo; if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) Reset(); + if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) return null; return _LookupEditItems[itemInfo.ItemID]; } private bool _DisplayItemChanging = false; diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index dd2fc12f..e90d4ca8 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -544,6 +544,11 @@ namespace Volian.Controls.Library btnSpell.Enabled = setting; rtabTableGridTools.Visible = setting; btnCMGrid.Enabled = setting; + if (MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AllowNoteCautionAdd) + { + btnInsNote.Enabled = true; + btnInsCaut.Enabled = true; + } } private void SetButtonAndMenuEnabling(bool docontextmenus) { @@ -697,6 +702,21 @@ namespace Volian.Controls.Library btnInsCaut.Enabled = btnInsNote.Enabled = btnInsRNO.Enabled = btnInsFig.Enabled = btnInsTable.Enabled = btnInsSubstep.Enabled = btnInsBefore.Enabled = btnInsAfter.Enabled = false; + // if on a section, allow note/caution. May want to add condition that this is a subsection? + if (MyItemInfo.IsSection && MyItemInfo.IsStepSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AllowNoteCautionAdd) + { + btnInsNote.Enabled = true; + btnInsCaut.Enabled = true; + btnInsCaut.SubItems.Clear(); + btnInsNote.SubItems.Clear(); + if (docontextmenus) + { + btnCMInsCaution.SubItems.Clear(); + btnCMInsNote.SubItems.Clear(); + } + GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Caution, MyItemInfo.FormatStepData, btnInsCaut, (int)E_FromType.Caution, btnCMInsCaution, docontextmenus); + GalleryForSubTypes(MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Note, MyItemInfo.FormatStepData, btnInsNote, (int)E_FromType.Note, btnCMInsNote, docontextmenus); + } // if on a procedure or section title, don't allow for insert of ROs or Transitions: // disable buttons. Info panels for ROs and Transitions are made invisible in frmVEPROMS.cs btnInsTrans.Enabled = btnCMTransition.Enabled = btnInsRO.Enabled = btnCMRO.Enabled = false; @@ -797,7 +817,7 @@ namespace Volian.Controls.Library // regardless of whether in the AER or RNO column (set to true). For all types, get both except for figures // and tables. bool getall = !(btn.Name == "btnInsFig" || (btn.Name == "btnInsTable")); - List sdl = MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepGetLevelTypes(getall, sdc, ref cursel, selType.Type, MyItemInfo); + List sdl = MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepGetLevelTypes(getall, sdc, ref cursel, selType==null?"Section":selType.Type, MyItemInfo); if (sdl != null && sdl.Count > 0) { Char kt = 'A'; // start with letter A for KeyTips @@ -840,14 +860,14 @@ namespace Volian.Controls.Library bi.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; bi.Text = sdr.Name; bi.Tag = string.Format("{0} {1}", fromtype, sdr.Index); // index of type to insert it when button is clicked - bi.Checked = (sd.Type == selType.Type); + bi.Checked = (selType == null || (sd.Type == selType.Type)); if (docontextmenus) { DevComponents.DotNetBar.ButtonItem cmbi = new DevComponents.DotNetBar.ButtonItem("cmbtn" + sd.Type, sd.Type); cmbi.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.TextOnlyAlways; cmbi.Text = sdr.Name; cmbi.Tag = string.Format("{0} {1}", fromtype, sdr.Index); // index of type to insert it when button is clicked - cmbi.Checked = (sd.Type == selType.Type); + cmbi.Checked = (selType == null || (sd.Type == selType.Type)); cmbi.Click += new System.EventHandler(btnInsStep_Click); cmbtn.SubItems.Add(cmbi); }