From 5ce26f23508be7936eb797d27603333f7cd010dc Mon Sep 17 00:00:00 2001 From: Kathy Date: Thu, 24 Aug 2017 13:55:34 +0000 Subject: [PATCH] =?UTF-8?q?B2017-180:=20don=E2=80=99t=20allow=20paste=20re?= =?UTF-8?q?place=20on=20source/enhanced=20steps.=20B2017-181:=20fix=20cras?= =?UTF-8?q?h=20when=20select/deselect=20procedure=20sets=20in=20search=20p?= =?UTF-8?q?anel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PROMS/Volian.Controls.Library/DisplaySearch.cs | 14 ++++++++++++-- PROMS/Volian.Controls.Library/StepTabRibbon.cs | 6 ++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index 11db70da..d17e367d 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -388,8 +388,18 @@ namespace Volian.Controls.Library lstCheckedStepTypesStr.Clear(); topnode.Text = "Types"; advTreeStepTypes.Nodes.Add(topnode); - - FormatData fmtdata = _MyDocVersion.ActiveFormat.PlantFormat.FormatData; + FormatData fmtdata = null; + // B2017-181: selecting/deselecting, and no nodes are selected was causing null reference when trying + // to access the DocVersion (none are selected), use the format off of the top folder: + if (_MyDocVersion == null) + { + FolderInfo fi = FolderInfo.Get(TopFolderID); + fmtdata = fi.ActiveFormat.PlantFormat.FormatData; + } + else + { + fmtdata = _MyDocVersion.ActiveFormat.PlantFormat.FormatData; + } List lstSrchStpTypes = fmtdata.GetSearchableSteps(); // list of searchable step types if (lstSrchStpTypes != null && lstSrchStpTypes.Count > 0) { diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index a57af697..a412f8d5 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -1587,7 +1587,8 @@ namespace Volian.Controls.Library StepTabPanel tmp = Parent as StepTabPanel; if (tmp.MyDisplayTabControl.MyCopyStep != null) { - if (!tmp.MyDisplayTabControl.MyCopyStep.IsEnhancedStep) + //B2017-180: The fix for B2017-158 also needed the 'HasEnhancedLinkedStep' to check if the copied step is a source step + if (!tmp.MyDisplayTabControl.MyCopyStep.IsEnhancedStep && !tmp.MyDisplayTabControl.MyCopyStep.HasEnhancedLinkedStep) { if (MyItemInfo.IsEnhancedStep) btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = false; } @@ -1623,7 +1624,8 @@ namespace Volian.Controls.Library btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = enable; btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = enable; //B20170-158 Don't allow a step to replace a linked step - btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = enable && !MyItemInfo.IsEnhancedStep; + //B2017-180: The fix for B2017-158 also needed the 'HasEnhancedLinkedStep' to check if the copied step is a source step + btnPasteReplace.Enabled = btnCMPasteReplace.Enabled = enable && !MyItemInfo.IsEnhancedStep && !MyItemInfo.HasEnhancedLinkedStep; } private void SetPasteButtonEnabled() {