B2016-058 Context menu at the procedure level will read “Collapse Procedure”, at the section level it will read “Collapse Section”, at the step and sub step levels will read “Collapse”.
This commit is contained in:
parent
d0ce429883
commit
e5938b1815
@ -620,6 +620,11 @@ namespace Volian.Controls.Library
|
||||
OwnerInfoList oil = null;
|
||||
OwnerInfo oi = null;
|
||||
FolderInfo fi = null;
|
||||
// B2016-058 so we can customize the "collapse" menu item text
|
||||
bool isProcNode = false;
|
||||
bool isSectNode = false;
|
||||
bool isFolderNode = false;
|
||||
bool isWrkDftNode = false;
|
||||
VETreeNode tn = this.GetNodeAt(new Point(e.X, e.Y)) as VETreeNode;
|
||||
if (tn != null)
|
||||
{
|
||||
@ -641,6 +646,7 @@ namespace Volian.Controls.Library
|
||||
#region Menu_New
|
||||
if (tn.VEObject as FolderInfo != null)
|
||||
{
|
||||
isFolderNode = true;
|
||||
// For Folders, if no children, can add either docversion or folder. If children are
|
||||
// folders then can only add another folder, and if children are docversions can only
|
||||
// add docversion.
|
||||
@ -672,6 +678,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else if (tn.VEObject as DocVersionInfo != null) // DocVersions can only contain procs
|
||||
{
|
||||
isWrkDftNode = true;
|
||||
//_MyLog.WarnFormat("Context Menu 1c - {0}", GC.GetTotalMemory(true));
|
||||
DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
|
||||
if (ui.IsAdministrator() || ui.IsSetAdministrator(dvi))
|
||||
@ -771,6 +778,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else if (tn.VEObject as ProcedureInfo != null) // Procs can only contain sections
|
||||
{
|
||||
isProcNode = true;
|
||||
ProcedureInfo pri = tn.VEObject as ProcedureInfo;
|
||||
oi = OwnerInfo.GetByItemID(pri.ItemID, CheckOutType.Procedure);
|
||||
if (ui.IsAdministrator() || ui.IsSetAdministrator(pri.MyDocVersion))
|
||||
@ -852,6 +860,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else if (tn.VEObject as SectionInfo != null)
|
||||
{
|
||||
isSectNode = true;
|
||||
// A step Section can contain other steps or can contain subsections (either step section
|
||||
// or word doc section). Also note that there can be a mix.
|
||||
// A word doc section can contain another subsection (either step section or word doc section),
|
||||
@ -914,7 +923,16 @@ namespace Volian.Controls.Library
|
||||
else if (!tn.IsExpanded)
|
||||
cm.MenuItems.Add("Open", new EventHandler(mi_Click));
|
||||
else
|
||||
cm.MenuItems.Add("Collapse Procedures", new EventHandler(mi_Click));
|
||||
{ // B2016-058 customize the "Collapse" menu text based on tree node type
|
||||
string mtext = "Collapse"; // only the step or substep (RNOs, Cautions, Notes as well) will be collapsed
|
||||
if (isFolderNode || isWrkDftNode)
|
||||
mtext += " All Procedures"; // all expanded procedure nodes in all procedure sets are collapsed (folder and working draft nodes remain expanded)
|
||||
else if (isProcNode)
|
||||
mtext += " Procedure"; // only the current procedure node is collapsed
|
||||
else if (isSectNode)
|
||||
mtext += " Section"; // only the current section node is collapsed
|
||||
cm.MenuItems.Add(mtext, new EventHandler(mi_Click));
|
||||
}
|
||||
#endregion
|
||||
//_MyLog.WarnFormat("Context Menu 3 - {0}", GC.GetTotalMemory(true));
|
||||
|
||||
@ -1640,7 +1658,7 @@ namespace Volian.Controls.Library
|
||||
OnNodeSI(this, new vlnTreeEventArgs(tn, null, 0));
|
||||
return;
|
||||
}
|
||||
if (mi.Text == "Collapse Procedures")
|
||||
if (mi.Text.StartsWith("Collapse"))
|
||||
{
|
||||
CollapseProcedures();
|
||||
return;
|
||||
@ -1815,6 +1833,7 @@ namespace Volian.Controls.Library
|
||||
break;
|
||||
}
|
||||
}
|
||||
private bool _doingCollapseNode = false; // B2016-058 when collapse is done, it always calls the drag node event which doesn't appear to be needed
|
||||
private void CollapseProcedures()
|
||||
{
|
||||
CollapseProcedures(SelectedNode as VETreeNode);
|
||||
@ -1826,10 +1845,14 @@ namespace Volian.Controls.Library
|
||||
if (tn.VEObject.GetType() == typeof(ProcedureInfo))
|
||||
{
|
||||
tn.Collapse();
|
||||
_doingCollapseNode = true; // B2016-058 this will prevent a Drag Node error when collapsing an RNOs, Cautions, or Notes tree node
|
||||
return;
|
||||
}
|
||||
foreach (VETreeNode tnc in tn.Nodes)
|
||||
CollapseProcedures(tnc);
|
||||
if (tn.VEObject as DocVersionInfo == null && tn.VEObject as FolderInfo == null)
|
||||
tn.Collapse();
|
||||
_doingCollapseNode = true; // B2016-058 this will prevent a Drag Node error when collapsing an RNOs, Cautions, or Notes tree node
|
||||
}
|
||||
private void tv_RemoveChgIds()
|
||||
{
|
||||
@ -3177,6 +3200,11 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
private void tv_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
|
||||
{
|
||||
if (_doingCollapseNode)
|
||||
{
|
||||
_doingCollapseNode = false;
|
||||
return;
|
||||
}
|
||||
// Get drag node and select it
|
||||
try
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user