Development #16

Merged
djankowski merged 4 commits from Development into master 2023-07-10 15:55:43 -04:00
3 changed files with 104 additions and 78 deletions

2
.gitignore vendored
View File

@ -401,4 +401,4 @@ FodyWeavers.xsd
/fmtall
/genmacall
AssemblyInfo.cs
*AssemblyInfo.cs

Binary file not shown.

View File

@ -40,6 +40,9 @@ namespace Volian.Controls.Library
// B2022-026 RO Memeory reduction logic change - defined dummy node text variable to ensure consistancy
private const string DummyNodeText = "VLN_DUMMY_NODE";
// B2023-076: Adding option to select all procedure sets
private const string SelectAllProcedureSetsText = "Select All Procedure Sets";
// B2019-161 When tracking timing time this action
private static VolianTimer _TimeActivity = new VolianTimer("DisplaySearch _TmrRefresh_Tick", 399);
private Timer _TmrRefresh = null;
@ -107,9 +110,9 @@ namespace Volian.Controls.Library
{
_SearchIncTransII = value;
if (_SearchIncTransII != null)
if (_SearchIncTransII != null)
lblSrchIncTran.Text = _SearchIncTransII.Path;
else
else
lblSrchIncTran.Text = string.Empty;
}
}
@ -402,7 +405,7 @@ namespace Volian.Controls.Library
public void tabSearchTypes_SelectedTabChanged(object sender, TabStripTabChangedEventArgs e)
{
if(wordSectionTreeNode != null) //B2020-070 NULL reference check
if (wordSectionTreeNode != null) //B2020-070 NULL reference check
wordSectionTreeNode.Enabled = true;
btnSearch.Enabled = true;
xpSetToSearch.Enabled = true;
@ -433,7 +436,7 @@ namespace Volian.Controls.Library
wordSectionTreeNode.Checked = false;
}
btnSearch.Enabled = (cbxTranCategory.Items.Count > 0); // B2017-038 disable search button if no format selected
//enable-disable doc version nodes based on version type if selected
//enable-disable doc version nodes based on version type if selected
if (cbxTranVersion.SelectedIndex > -1)
{
if (dicExpandedFolderNodes.Count > 0)
@ -570,12 +573,12 @@ namespace Volian.Controls.Library
List<DevComponents.AdvTree.Node> uncheckNodes = new List<Node>();
foreach (DevComponents.AdvTree.Node n in dicSelectedFolderNodes.Keys)
{
FolderInfo fi = (FolderInfo)n.Tag; // this was crashing in old version of code
// if this folder has a docversion, use its id:
FolderInfo fi = (FolderInfo)n.Tag; // this was crashing in old version of code
// if this folder has a docversion, use its id:
string svid = null;
if (fi.FolderDocVersionCount > 0)
svid = fi.FolderDocVersions[0].VersionID.ToString();
if (svid !=null && !versionList.Contains(svid))
if (svid != null && !versionList.Contains(svid))
uncheckNodes.Add(n);
else
n.Enabled = true;
@ -780,6 +783,16 @@ namespace Volian.Controls.Library
buildStepTypePannelTitle();
}
private void AllProcedureSets_clicked(object sender, EventArgs e)
{
Node pNode = sender as Node;
foreach (Node node in advTreeProcSets.Nodes)
{
node.Checked = pNode.Checked;
CheckTreeNodeChildren(node.Nodes);
}
}
private void AllSectionTypes_clicked(object sender, EventArgs e)
{
Node pNode = sender as Node;
@ -816,6 +829,14 @@ namespace Volian.Controls.Library
advTreeProcSets.Nodes.Add(topnode);
//advTreeProcSets.AfterNodeInsert += new TreeNodeCollectionEventHandler(advTreeProcSets_AfterNodeInsert);
//B2023-076: Adding option to select all procedure sets
DevComponents.AdvTree.Node selectAllNode = new Node();
selectAllNode.Text = SelectAllProcedureSetsText;
selectAllNode.Tag = SelectAllProcedureSetsText;
selectAllNode.CheckBoxVisible = true;
selectAllNode.NodeClick += new EventHandler(AllProcedureSets_clicked);
topnode.Nodes.Add(selectAllNode);
if (fi.SortedChildFolders != null)
{
foreach (FolderInfo fic in fi.SortedChildFolders)
@ -1087,7 +1108,7 @@ namespace Volian.Controls.Library
newnode.CheckBoxVisible = chxbxvisable;
// Set newnode.Checked = parent.Checked
if(newnode.Parent != null)
if (newnode.Parent != null)
newnode.Checked = newnode.Parent.Checked;
}
@ -1313,9 +1334,9 @@ namespace Volian.Controls.Library
private void LoadROComboTree()
{
lblSrchRoMsg.Visible = false; // C2019-041: start out with no message about rofsts and folder(s) compatibility
// if only one docversion selected, this RoFst can be used. If more than one or none (none is all docversions), then check if they
// use the same RO fst. If not, put a message as the first tree node and return, otherwise, load the tree.
lblSrchRoMsg.Visible = false; // C2019-041: start out with no message about rofsts and folder(s) compatibility
// if only one docversion selected, this RoFst can be used. If more than one or none (none is all docversions), then check if they
// use the same RO fst. If not, put a message as the first tree node and return, otherwise, load the tree.
List<DocVersionInfo> dvilTmp = new List<DocVersionInfo>();
if (lstCheckedDocVersions == null || lstCheckedDocVersions.Count == 0)
@ -1330,7 +1351,7 @@ namespace Volian.Controls.Library
bool same = true;
// get the first rofstId for comparing to the rest:
int rofstId = (dvilTmp.Count > 0)? (dvilTmp[0].DocVersionAssociations != null && dvilTmp[0].DocVersionAssociations.Count > 0) ? dvilTmp[0].DocVersionAssociations[0].ROFstID: -1 : -1;
int rofstId = (dvilTmp.Count > 0) ? (dvilTmp[0].DocVersionAssociations != null && dvilTmp[0].DocVersionAssociations.Count > 0) ? dvilTmp[0].DocVersionAssociations[0].ROFstID : -1 : -1;
// for remaining folder/docversions in the list, check if they have an associated rofst & if so, if it is the same as the first in list.
for (int i = 1; i < dvilTmp.Count; i++)
@ -1356,7 +1377,7 @@ namespace Volian.Controls.Library
lblSrchRoMsg.Text = "RO values are incompatible between the folders. This may be due to the RO values needing to be updated.";
else
lblSrchRoMsg.Text = "This folder(s) RO values are incompatible with the currently selected folder(s). This may be due to the RO values needing to be updated.";
lblSrchRoMsg.Visible = true;
_lastRoFstId = -1;
return;
@ -1387,7 +1408,7 @@ namespace Volian.Controls.Library
if (_MyDocVersion.DocVersionAssociations != null && _MyDocVersion.DocVersionAssociations.Count > 0)
{
_MyROFSTLookup = _MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(_MyDocVersion);
ROFSTLookup.rodbi[] dbs = _MyROFSTLookup.GetRODatabaseList(true);
if (dbs != null && dbs.Length > 0)
@ -1703,7 +1724,7 @@ namespace Volian.Controls.Library
btnSaveSearchResults.Enabled = false;
cmbResultsStyle.Enabled = false;
}
// B2021-076: Proms search results are not presented in order when printed to PDF
if (_DisplayMember == "SearchPath" || _DisplayMember == "ShortSearchPath")
{
@ -1874,10 +1895,10 @@ namespace Volian.Controls.Library
string rtnVal = str;
rtnVal = rtnVal.Replace("\u00A0", @"\u160?"); //convert \u00A0 to a hard space (\u00A0 shows as a blank in the search text field)
rtnVal = rtnVal.Replace("\n", @"\line "); //B2018-020 SQL content record has "\line " for the hard return
// Bug fix B2014-057
// if we are searching for a symbol character in all procedure sets MyDocVersion is null
// when MyDocVersion is null, get the symbol list directly from the PROMS base format (BaseAll.xml)
FormatData fmtdata = (_MyDocVersion != null) ? _MyDocVersion.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData;
// Bug fix B2014-057
// if we are searching for a symbol character in all procedure sets MyDocVersion is null
// when MyDocVersion is null, get the symbol list directly from the PROMS base format (BaseAll.xml)
FormatData fmtdata = (_MyDocVersion != null) ? _MyDocVersion.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData;
if (fmtdata != null && fmtdata.SymbolList != null)
{
SymbolList sl = fmtdata.SymbolList;
@ -1928,7 +1949,7 @@ namespace Volian.Controls.Library
Cursor savcursor = Cursor;
// keeps track of index into combo box for results style. This combo box may have 3 or 4
// items depending on whether annotations exist.
int cmbResultsStyleIndex = -1;
int cmbResultsStyleIndex = -1;
try
{
LastSearchWasAnnotations = false; // B2019-119 only refresh annotation search results if an annotation search was done
@ -1937,7 +1958,7 @@ namespace Volian.Controls.Library
SearchResults = null;
bool includeRTFformat = false;
bool includeSpecialChars = (TextSearchString != @"\?"); // true;
// Build list of selected types that were searched
// Build list of selected types that were searched
string typstr = null;
foreach (string s in lstCheckedStepTypesStr) typstr = typstr == null ? s : typstr + ", " + s;
TypesSelected = "Filtered By: " + ((typstr != null) ? typstr : "All Step Types");
@ -1945,7 +1966,7 @@ namespace Volian.Controls.Library
//TypesSelected = "Searched Step Types: " + ((typstr != null) ? typstr : "all step types");
//TypesSelected = (typstr != null) ? "Searched Step Types: " + typstr : "Searched All Step Types";
string unitPrefix = string.Empty;
if(Mydocversion != null)
if (Mydocversion != null)
unitPrefix = Mydocversion.DocVersionConfig.Unit_ProcedureNumber;
if (unitPrefix.EndsWith("#"))
unitPrefix = unitPrefix.Replace("#", string.Empty);
@ -2017,7 +2038,7 @@ namespace Volian.Controls.Library
//TypesSelected = "Searched Step Types: " + ((typstr != null) ? typstr : "All Step Types");
SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, TextSearchString /*.Replace(@"\",@"\u9586?")*/, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, byWordPrefix, byWordSuffix);
cmbResultsStyleIndex = 3; // display step text in results
//}
//}
}
// C2019-001: Search in RNO steps only
if (cbxRnoOnly.Checked) GetInRNOResults();
@ -2044,7 +2065,7 @@ namespace Volian.Controls.Library
SearchResults = ItemInfoList.GetListFromAnnotationSearch(DVISearchList, TypeSearchList, AnnotationSearchType, cbxTextSearchAnnotation.Text, cbxCaseSensitiveAnnoText.Checked, unitPrefix);
//UpdateAnnotationSearchResults();
cmbResultsStyleIndex = 2; // display annotation text in results
// C2019-001: Search in RNO steps only
// C2019-001: Search in RNO steps only
if (cbxRnoOnlyAnnot.Checked) GetInRNOResults();
}
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[2]) // RO Search
@ -2088,7 +2109,7 @@ namespace Volian.Controls.Library
// added TypeSearchList for bug fix B2015-055
SearchResults = ItemInfoList.GetListFromTransitionSearch(docVersionList, cbxTranFormat.SelectedIndex - 1, cbxTranCategory.SelectedItem.ToString() == "All" ? string.Empty : cbxTranCategory.SelectedItem.ToString(), TypeSearchList);
cmbResultsStyleIndex = 3; // display step text in results
// C2019-001: Search in RNO steps only
// C2019-001: Search in RNO steps only
if (cbxRnoOnlyTrans.Checked) GetInRNOResults();
}
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4])
@ -2116,7 +2137,7 @@ namespace Volian.Controls.Library
FlexibleMessageBox.Show("No Matches Found.", "Search");
}
}
btnTranCvtAllToTxt.Enabled = IncTransCvtAllToTextPerm(); // C2020-033: does user have access to at least one item
btnTranCvtAllToTxt.Enabled = IncTransCvtAllToTextPerm(); // C2020-033: does user have access to at least one item
}
catch (Exception ex)
{
@ -2136,8 +2157,8 @@ namespace Volian.Controls.Library
//if (VlnSettings.DebugMode)
// MessageBox.Show(string.Format("{0} Milliseconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalMilliseconds));
}
private void ClearResults() // B2021-103 if no results when RNO only, clear results list. (moved from btnSearch_Click)
private void ClearResults() // B2021-103 if no results when RNO only, clear results list. (moved from btnSearch_Click)
{
if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4])
{
@ -2179,7 +2200,7 @@ namespace Volian.Controls.Library
if (SearchResults == null || SearchResults.Count == 0)
{
FlexibleMessageBox.Show("No Matches Found.", "Search");
ClearResults(); // B2021-103 Clear results list if none found.
ClearResults(); // B2021-103 Clear results list if none found.
}
}
@ -2289,8 +2310,8 @@ namespace Volian.Controls.Library
private void advTreeProcSets_AfterCheck(object sender, DevComponents.AdvTree.AdvTreeCellEventArgs e)
{
// this method gets called if child nodes get checked by the code, return if doing this process.
if (checkingChildren)
return;
if (checkingChildren)
return;
DevComponents.AdvTree.Node n = advTreeProcSets.SelectedNode;
dicSelectedFolderNodes[n] = n.Checked;
@ -2304,14 +2325,17 @@ namespace Volian.Controls.Library
}
// if the selected folder has a docversion, handle it:
FolderInfo fi = (FolderInfo)n.Tag;
RefreshLstCheckedDocVersions();
RefreshStepTypes();// Refresh Step Types after Working Draft is checked.
if (lstCheckedDocVersions.Count == 1 && fi.FolderDocVersions != null && fi.FolderDocVersions.Count > 0)
if (n.Tag != SelectAllProcedureSetsText)
{
Mydocversion = fi.FolderDocVersions[0];
StartAdvTreeStepTypesFillIn();// B2016-258 Hang after selecting a procedure if the Step Type panel is open on the search panel
FolderInfo fi = (FolderInfo)n.Tag;
RefreshLstCheckedDocVersions();
RefreshStepTypes();// Refresh Step Types after Working Draft is checked.
if (lstCheckedDocVersions.Count == 1 && fi.FolderDocVersions != null && fi.FolderDocVersions.Count > 0)
{
Mydocversion = fi.FolderDocVersions[0];
StartAdvTreeStepTypesFillIn();// B2016-258 Hang after selecting a procedure if the Step Type panel is open on the search panel
}
}
SetupContextMenu();
@ -2325,7 +2349,7 @@ namespace Volian.Controls.Library
{
tn.Checked = tn.Parent.Checked;
if (tn.Nodes != null && tn.Nodes.Count > 0 && tn.Nodes[0].Text != DummyNodeText)
if (tn.Nodes != null && tn.Nodes.Count > 0 && tn.Nodes[0].Text != DummyNodeText)
CheckTreeNodeChildren(tn.Nodes);
}
}
@ -2335,8 +2359,8 @@ namespace Volian.Controls.Library
private void RefreshLstCheckedDocVersions()
{
lstCheckedDocVersions.Clear();
AddFromTreeNodes(advTreeProcSets.Nodes); // add docversions to the list
LoadROComboTree(); // reset the ro tree based on docversion selections.
AddFromTreeNodes(advTreeProcSets.Nodes); // add docversions to the list
LoadROComboTree(); // reset the ro tree based on docversion selections.
}
private void AddFromTreeNodes(NodeCollection nodeCollection)
@ -2361,7 +2385,9 @@ namespace Volian.Controls.Library
}
else // it has not been expanded process all below.
{
AddAllChildVersions(fi);
//B2023-076: Do not process the "Select All" node
if (tn.Text != SelectAllProcedureSetsText)
AddAllChildVersions(fi);
}
}
else // not checked, set style so no background color
@ -2369,7 +2395,7 @@ namespace Volian.Controls.Library
tn.Style = null;
}
if (tn.Nodes != null)
if (tn.Nodes != null)
AddFromTreeNodes(tn.Nodes);
}
@ -2488,7 +2514,7 @@ namespace Volian.Controls.Library
{
cbxTranFormat.Items.Add(new TransItem(ttl[i].TransMenu.Replace("?.", string.Empty), ttl[i].TransFormat.Replace("?.", string.Empty)));
}
cbxTranFormat.SelectedIndex = 0;
cbxTranCategory.Items.Clear();
cbxTranCategory.Items.Add("All");
@ -2512,7 +2538,7 @@ namespace Volian.Controls.Library
btnSearch.Enabled = true;
tabSearchTypes.Enabled = true; // enable all the search tabs
}
else
else
{
// display the number of selected procedure sets whether panel is expanded or not
xpSetToSearch.TitleText = string.Format("{0} Procedure Sets Selected", lstCheckedDocVersions.Count);
@ -2545,7 +2571,7 @@ namespace Volian.Controls.Library
xpStepTypes.TitleStyle.BackColor1.Color = saveXpStepTypeTitleColor;
DevComponents.AdvTree.Node n = advTreeStepTypes.SelectedNode;
if (n == null)
if (n == null)
return;
StepData sd = (StepData)n.Tag;
@ -2614,7 +2640,7 @@ namespace Volian.Controls.Library
// The only time the RNO Only checkbox is disabled is if the only selection in Step Elements to Search is WORD Sections.
cbxRnoOnly.Enabled = true;
if (OnlyWordSectTypeSel())
if (OnlyWordSectTypeSel())
cbxRnoOnly.Checked = cbxRnoOnly.Enabled = false;
}
@ -2643,7 +2669,7 @@ namespace Volian.Controls.Library
else //lstCheckedStepTypes.Count > 0
{
// show how many selected whether panel is expanded or not
xpStepTypes.TitleText = string.Format("{0} Step Element{1} Selected", lstCheckedStepTypes.Count, (lstCheckedStepTypes.Count > 1)?"s":string.Empty); // B2018-132 changed second {0} to {1}
xpStepTypes.TitleText = string.Format("{0} Step Element{1} Selected", lstCheckedStepTypes.Count, (lstCheckedStepTypes.Count > 1) ? "s" : string.Empty); // B2018-132 changed second {0} to {1}
xpStepTypes.TitleStyle.BackColor1.Color = Color.PapayaWhip;
}
}
@ -2679,7 +2705,7 @@ namespace Volian.Controls.Library
cbxTextSearchText.SelectedText = "\u00A0";
}
}
private void cmFndTxtCut_Click(object sender, EventArgs e)
{
Clipboard.Clear();
@ -2701,7 +2727,7 @@ namespace Volian.Controls.Library
{
// Need to check which combo box activated the context menu so that we know where to take/put selected text
DataObject myDO = new DataObject(DataFormats.Text, cbxTextSearchAnnotation.Focused ? cbxTextSearchAnnotation.SelectedText : cbxTextSearchText.SelectedText);
if (cbxTextSearchText.Focused || cbxTextSearchAnnotation.Focused)
{
Clipboard.Clear();
@ -2713,7 +2739,7 @@ namespace Volian.Controls.Library
{
// B2021-100: Enable/disable the RNO Only checkbox & WORD Sections tree node in Step Elements to Search.
// lstCheckedStepTypes[x] = 0 for Word sections:
if (lstCheckedStepTypes != null && lstCheckedStepTypes.Count == 1 && lstCheckedStepTypes[0] == 0)
if (lstCheckedStepTypes != null && lstCheckedStepTypes.Count == 1 && lstCheckedStepTypes[0] == 0)
return true;
return false;
@ -2780,7 +2806,7 @@ namespace Volian.Controls.Library
#endregion
#region (Button/UI Event Handlers)
private void buttonItem2_Click(object sender, EventArgs e)
{
if (cbxTextSearchAnnotation.Focused)
@ -2797,7 +2823,7 @@ namespace Volian.Controls.Library
cbxTextSearchText.SelectedText = "?";
}
private void buttonItem4_Click(object sender, EventArgs e)
{
if (cbxTextSearchAnnotation.Focused)
@ -3278,23 +3304,23 @@ namespace Volian.Controls.Library
ICollection<ItemInfo> srchres = lbSrchResults.DataSource as ICollection<ItemInfo>;
// C2020-033: If on the Incoming Transitions tab, use that list.
if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4]) srchres = lbSrchResultsIncTrans.DataSource as ICollection<ItemInfo>;
OnPrintRequest(new DisplaySearchEventArgs(ReportTitle, TypesSelected, SearchString, srchres,sortedBy));
OnPrintRequest(new DisplaySearchEventArgs(ReportTitle, TypesSelected, SearchString, srchres, sortedBy));
}
private void panSearchButtons_Resize(object sender, EventArgs e)
{
cmbResultsStyle.Left = labelX1.Right + 3;
cmbResultsStyle.Width = btnClearSearchResults.Left - cmbResultsStyle.Left - 3;
cmbResultsStyle.Width = btnClearSearchResults.Left - cmbResultsStyle.Left - 3;
}
// C2020-033: Convert All (that have permissions) Incoming Transitions to text
private void btnTranCvtAllToTxt_Click(object sender, EventArgs e)
{
List<int> itmsEditable = TranCvtCheckPermission(true); // Get list based on permissions
List<int> itmsEditable = TranCvtCheckPermission(true); // Get list based on permissions
if (itmsEditable == null || itmsEditable.Count == 0) return;
TranCvtToTxt(itmsEditable);
fromTranCvtBtn = true;
UpdateSearchIncTransResults(); // B2021-009: Research after convert transitions to text
UpdateSearchIncTransResults(); // B2021-009: Research after convert transitions to text
fromTranCvtBtn = false;
}
@ -3322,31 +3348,31 @@ namespace Volian.Controls.Library
// this class is used to generate the list of annotations to search.
// this also allow us to add a dummy type which is used to search for all annotations
public class AnnotationTypeSearch
{
private string _Name;
public string Name
{
get { return _Name; }
set { _Name = value; }
}
private string _ID;
public string ID
{
get { return _ID; }
set { _ID = value; }
}
public AnnotationTypeSearch(string name, string id)
{
_Name = name;
_ID = id;
}
{
private string _Name;
public string Name
{
get { return _Name; }
set { _Name = value; }
}
private string _ID;
public string ID
{
get { return _ID; }
set { _ID = value; }
}
public AnnotationTypeSearch(string name, string id)
{
_Name = name;
_ID = id;
}
}
}
#endregion
#region DisplaySearchEventArgs Class
public class DisplaySearchEventArgs
{
private string _ReportTitle;