Merge branch 'Development' into C2022-003-Change-Textboxes-to-RTF-3
This commit is contained in:
@@ -11,7 +11,7 @@ using System.Text.RegularExpressions;
|
||||
using JR.Utils.GUI.Forms;
|
||||
using Volian.Base.Library;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
public partial class DisplayHistory : UserControl
|
||||
|
||||
BIN
PROMS/Volian.Controls.Library/DisplayHistory.designer.cs
generated
BIN
PROMS/Volian.Controls.Library/DisplayHistory.designer.cs
generated
Binary file not shown.
@@ -112,13 +112,13 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="myVFG.MyBorderDetailString" xml:space="preserve">
|
||||
<value><?xml version="1.0" encoding="utf-8"?>
|
||||
<value><?xml version="1.0" encoding="utf-16"?>
|
||||
<VlnBorders Rows="4" Columns="3">
|
||||
<VerticalLines Rows="4" Columns="4">
|
||||
<Lines>
|
||||
@@ -161,7 +161,31 @@
|
||||
</HorizontalLines>
|
||||
</VlnBorders></value>
|
||||
</data>
|
||||
<data name="myVFG.StyleInfo" xml:space="preserve">
|
||||
<value>Normal{Font:Microsoft Sans Serif, 8.25pt;BackColor:White;TextAlign:LeftTop;Border:Flat,1,Black,Both;} Alternate{BackColor:White;} Fixed{BackColor:Control;ForeColor:ControlText;Border:Flat,1,ControlDark,Both;BackgroundImageLayout:Hide;} Highlight{BackColor:LightCyan;ForeColor:Black;} Focus{BackColor:LightCyan;} Editor{} Search{BackColor:Highlight;ForeColor:HighlightText;} Frozen{BackColor:Beige;} NewRow{ForeColor:GrayText;} EmptyArea{BackColor:Transparent;Border:None,1,Black,Both;} SelectedColumnHeader{} SelectedRowHeader{} GrandTotal{BackColor:Black;ForeColor:White;} Subtotal0{BackColor:ControlDarkDark;ForeColor:White;} Subtotal1{BackColor:ControlDarkDark;ForeColor:White;} Subtotal2{BackColor:ControlDarkDark;ForeColor:White;} Subtotal3{BackColor:ControlDarkDark;ForeColor:White;} Subtotal4{BackColor:ControlDarkDark;ForeColor:White;} Subtotal5{BackColor:ControlDarkDark;ForeColor:White;} FilterEditor{} FirstCustomStyle{} </value>
|
||||
<data name="myVFG.MyShadingDetailString" xml:space="preserve">
|
||||
<value><?xml version="1.0" encoding="utf-16"?>
|
||||
<VlnGridCellShading Rows="4" Columns="3">
|
||||
<TableShadingInfo Rows="4" Columns="3">
|
||||
<CellShadingColor>
|
||||
<string>[A=255, R=255, G=255, B=255]</string>
|
||||
<string>[A=255, R=255, G=255, B=255]</string>
|
||||
<string>[A=255, R=255, G=255, B=255]</string>
|
||||
<string>[A=255, R=255, G=255, B=255]</string>
|
||||
<string>[A=255, R=255, G=255, B=255]</string>
|
||||
<string>[A=255, R=255, G=255, B=255]</string>
|
||||
<string>[A=255, R=255, G=255, B=255]</string>
|
||||
<string>[A=255, R=255, G=255, B=255]</string>
|
||||
<string>[A=255, R=255, G=255, B=255]</string>
|
||||
<string>[A=255, R=255, G=255, B=255]</string>
|
||||
<string>[A=255, R=255, G=255, B=255]</string>
|
||||
<string>[A=255, R=255, G=255, B=255]</string>
|
||||
</CellShadingColor>
|
||||
</TableShadingInfo>
|
||||
</VlnGridCellShading></value>
|
||||
</data>
|
||||
<data name="myVFG.StyleInfo" xml:space="preserve">
|
||||
<value>Normal{Font:Microsoft Sans Serif, 8.25pt;BackColor:White;TextAlign:LeftTop;Border:Flat,1,Black,Both;} Alternate{BackColor:White;} Fixed{BackColor:Control;ForeColor:ControlText;Border:Flat,1,ControlDark,Both;BackgroundImageLayout:Hide;} Highlight{BackColor:LightCyan;ForeColor:Black;} Focus{BackColor:LightCyan;} Editor{} Search{BackColor:Highlight;ForeColor:HighlightText;} Frozen{BackColor:Beige;} FrozenAlternate{} NewRow{ForeColor:GrayText;} EmptyArea{BackColor:Transparent;Border:None,1,Black,Both;} SelectedColumnHeader{} SelectedRowHeader{} GrandTotal{BackColor:Black;ForeColor:White;} Subtotal0{BackColor:ControlDarkDark;ForeColor:White;} Subtotal1{BackColor:ControlDarkDark;ForeColor:White;} Subtotal2{BackColor:ControlDarkDark;ForeColor:White;} Subtotal3{BackColor:ControlDarkDark;ForeColor:White;} Subtotal4{BackColor:ControlDarkDark;ForeColor:White;} Subtotal5{BackColor:ControlDarkDark;ForeColor:White;} FilterEditor{} FirstCustomStyle{} </value>
|
||||
</data>
|
||||
<metadata name="myTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -647,6 +647,10 @@ namespace Volian.Controls.Library
|
||||
MyEditItem.ChangeBarForConfigItemChange = false;
|
||||
sc.Step_CAS = (cbCAS.Checked) ? "True" : "False";
|
||||
MyEditItem.ChangeBarForConfigItemChange = true;
|
||||
// C2026-003 (put in for Vogtle 3&4) refresh the RNO step tab if including it on the Continuous Action Summary
|
||||
if (MyEditItem.MyItemInfo.ActiveFormat.MyStepSectionLayoutData.AddContActTagToHighLevelRNOWhenIncludedOnCAS &&
|
||||
MyEditItem.MyItemInfo.IsInRNO && !MyEditItem.MyItemInfo.MyParent.IsInRNO)
|
||||
MyEditItem.RefreshTab();
|
||||
}
|
||||
private void cbTCAS_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -537,6 +537,10 @@ namespace Volian.Controls.Library
|
||||
// if it is a modify and there will be no usages if it is new (the usage gets created on the save)
|
||||
if (!MyFlexGrid.IsRoTable)
|
||||
{
|
||||
// B2026-003 we where using a string.format on this inside the while loop - allocating memory each time
|
||||
// so I move it outside the while loop and did a simple assigment of text
|
||||
string lookForLinks = @"<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v '?{{}}~\\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>";
|
||||
|
||||
while (r < h)
|
||||
{
|
||||
CellRange cr = MyFlexGrid.GetMergedRange(r, c);
|
||||
@@ -546,8 +550,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
// see if there are any links and save these so that any deleted ROs or transitions in the
|
||||
// steprtb can have associated usages/transitions records removed from the database.
|
||||
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v '?{{}}~\\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>");
|
||||
MatchCollection matches = Regex.Matches((string)MyFlexGrid[r, c], lookFor);
|
||||
MatchCollection matches = Regex.Matches((string)MyFlexGrid[r, c], lookForLinks);
|
||||
for (int i = matches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
Match m = matches[i];
|
||||
@@ -569,15 +572,15 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
int tid = int.Parse(myMatch.Groups[2].Value);
|
||||
RtfTransList.Add(tid);
|
||||
int myIndex = m.Groups[4].Index;
|
||||
int myLength = m.Groups[4].Length;
|
||||
if (m.Groups[3].Value != " ")
|
||||
{
|
||||
myIndex = m.Groups[3].Index;
|
||||
myLength += m.Groups[3].Length;
|
||||
}
|
||||
string gg = ((string)MyFlexGrid[r, c]).Substring(myIndex, myLength);
|
||||
if (gg.ToUpper().Contains("(PAGE ~)")) RtfTransPageNumList.Add(tid); // B2020-089, check for upper case Page ~ in case step was upper cased
|
||||
int myIndex = m.Groups[4].Index;
|
||||
int myLength = m.Groups[4].Length;
|
||||
if (m.Groups[3].Value != " ")
|
||||
{
|
||||
myIndex = m.Groups[3].Index;
|
||||
myLength += m.Groups[3].Length;
|
||||
}
|
||||
string gg = ((string)MyFlexGrid[r, c]).Substring(myIndex, myLength);
|
||||
if (gg.ToUpper().Contains("(PAGE ~)")) RtfTransPageNumList.Add(tid); // B2020-089, check for upper case Page ~ in case step was upper cased
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1667,6 +1667,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
Clipboard.Clear();
|
||||
|
||||
Clipboard.SetDataObject(myDO); // this saves the cleaned up information to the Windows clipboard
|
||||
}
|
||||
iData = Clipboard.GetDataObject();
|
||||
|
||||
115
PROMS/Volian.Controls.Library/TreeViewExtensions.cs
Normal file
115
PROMS/Volian.Controls.Library/TreeViewExtensions.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Data;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
//CSM - C2025-043 report RO's that are not used in any of the PROMS data.
|
||||
// extend the TreeView class with a couple added functions
|
||||
// to allow support for what is needed for ROs
|
||||
public static class TreeViewExtensions
|
||||
{
|
||||
#region public functions
|
||||
//Returns a ROTreeView based on the data in the datatable dt
|
||||
// builds tree based on the following:
|
||||
// ParentID = 0 is top level
|
||||
// links (defined parent) based on same dbID and ID = ParentID
|
||||
// nodes will have the text of the title
|
||||
public static TreeView GetROTree(DataTable dt, bool isExpanded = false)
|
||||
{
|
||||
TreeView tv = new TreeView();
|
||||
|
||||
var tempnodes = GetTreeNodes(
|
||||
dt.AsEnumerable(),
|
||||
(r) => r.Field<int?>("ParentID") == 0, //top level of tree
|
||||
(r, s) => s.Where(x => r["ID"].Equals(x["ParentID"]) && r["dbID"].Equals(x["dbID"])), //how to match parents and children
|
||||
(r) => new TreeNode { Text = r.Field<string>("title") } //what to display in the tree
|
||||
);
|
||||
tv.Nodes.AddRange(tempnodes.ToArray());
|
||||
|
||||
//if set to expand, sets the height to the combined height of all nodes + 20
|
||||
//so will show whole tree
|
||||
if (isExpanded)
|
||||
{
|
||||
tv.ExpandAll();
|
||||
tv.SetTreeViewHeighttoFull();
|
||||
tv.Width = 1200;
|
||||
}
|
||||
|
||||
//sorts the tree in alphabetical order to match the way the tree is sorted in the RO Editor
|
||||
tv.Sorted = true;
|
||||
|
||||
return tv;
|
||||
}
|
||||
|
||||
//Saves the Tree to an Image at the specified path
|
||||
public static void SaveTreeViewAsImage(this TreeView tv, string filePath)
|
||||
{
|
||||
// Create a Bitmap with the size of the TreeView
|
||||
Bitmap bitmap = new Bitmap(tv.Width, tv.Height);
|
||||
// Draw the TreeView onto the Bitmap
|
||||
tv.DrawToBitmap(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
|
||||
// Save the Bitmap as an image file
|
||||
bitmap.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region height functions
|
||||
//This is a function to calculate and set the TreeView Height based
|
||||
//on the height of all sub nodes + 20
|
||||
public static void SetTreeViewHeighttoFull(this TreeView tv)
|
||||
{
|
||||
int totalHeight = 0;
|
||||
foreach (TreeNode node in tv.Nodes)
|
||||
{
|
||||
totalHeight += GetNodeHeight(node);
|
||||
}
|
||||
tv.Height = totalHeight + 20;
|
||||
}
|
||||
|
||||
//This function recursively adds the height of sub nodes to the running total
|
||||
private static int GetNodeHeight(TreeNode node)
|
||||
{
|
||||
int curheight = node.Bounds.Height;
|
||||
foreach (TreeNode child in node.Nodes)
|
||||
{
|
||||
curheight += GetNodeHeight(child);
|
||||
}
|
||||
return curheight;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region generic private tree structure functions
|
||||
//This is a Generic Function to help build the Tree Structure
|
||||
private static IEnumerable<TreeNode> GetTreeNodes<T>(
|
||||
IEnumerable<T> source,
|
||||
Func<T, Boolean> isRoot,
|
||||
Func<T, IEnumerable<T>, IEnumerable<T>> getChilds,
|
||||
Func<T, TreeNode> getItem)
|
||||
{
|
||||
IEnumerable<T> roots = source.Where(x => isRoot(x));
|
||||
foreach (T root in roots)
|
||||
yield return ConvertEntityToTreeNode(root, source, getChilds, getItem); ;
|
||||
}
|
||||
|
||||
//This is a Generic Function to help build the Tree Structure
|
||||
private static TreeNode ConvertEntityToTreeNode<T>(
|
||||
T entity,
|
||||
IEnumerable<T> source,
|
||||
Func<T, IEnumerable<T>, IEnumerable<T>> getChilds,
|
||||
Func<T, TreeNode> getItem)
|
||||
{
|
||||
TreeNode node = getItem(entity);
|
||||
var childs = getChilds(entity, source);
|
||||
foreach (T child in childs)
|
||||
node.Nodes.Add(ConvertEntityToTreeNode(child, source, getChilds, getItem));
|
||||
return node;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -272,21 +272,24 @@ namespace Volian.Controls.Library
|
||||
for (int i = 0; i < rows * cols; i++)
|
||||
datum.Add("|");
|
||||
XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Cells/Cell/Data");
|
||||
string data = string.Empty;
|
||||
// B2026-003 use StringBuilder a "using" statement around the RichTextBox for better mememory management
|
||||
StringBuilder data = new StringBuilder();
|
||||
foreach (XmlNode xn in nl)
|
||||
{
|
||||
RichTextBox rtb = new RichTextBox();
|
||||
rtb.Rtf = xn.InnerText;
|
||||
XmlAttribute xa = xn.ParentNode.Attributes.GetNamedItem("index") as XmlAttribute;
|
||||
string[] rc = xa.InnerText.Split(',');
|
||||
int r = int.Parse(rc[0]);
|
||||
int c = int.Parse(rc[1]);
|
||||
int index = r * cols + c;
|
||||
datum[index] = "|" + (rtb.Text == "" ? "" : rtb.Text);
|
||||
using (RichTextBox rtb = new RichTextBox())
|
||||
{
|
||||
rtb.Rtf = xn.InnerText;
|
||||
XmlAttribute xa = xn.ParentNode.Attributes.GetNamedItem("index") as XmlAttribute;
|
||||
string[] rc = xa.InnerText.Split(',');
|
||||
int r = int.Parse(rc[0]);
|
||||
int c = int.Parse(rc[1]);
|
||||
int index = r * cols + c;
|
||||
datum[index] = "|" + (rtb.Text == "" ? "" : rtb.Text);
|
||||
}
|
||||
}
|
||||
foreach (string s in datum)
|
||||
data += s;
|
||||
return data;
|
||||
data.Append(s);
|
||||
return data.ToString();
|
||||
}
|
||||
private string GetCellFormatString(XmlDocument xd)
|
||||
{
|
||||
|
||||
@@ -118,6 +118,7 @@
|
||||
<HintPath>..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Design" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
@@ -295,6 +296,7 @@
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TreeViewExtensions.cs" />
|
||||
<Compile Include="RTBItem.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
@@ -458,6 +460,7 @@
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="DisplayHistory.resx">
|
||||
<DependentUpon>DisplayHistory.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="DisplayLibDocs.resx">
|
||||
<DependentUpon>DisplayLibDocs.cs</DependentUpon>
|
||||
|
||||
Reference in New Issue
Block a user