C2025-023 Electronic Procedures - Modifications to PROMS (Phase 1)
This commit is contained in:
@@ -166,6 +166,13 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (this.TableCellEditor.Text.Contains("<NewID>"))
|
||||
return false;
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//To handle if EP designation changed so will save in the DB
|
||||
if (IsUserDataDirty)
|
||||
{
|
||||
IsUserDataDirty = false;
|
||||
return true;
|
||||
}
|
||||
XmlDocument XdOld = new XmlDocument();
|
||||
oldXml = _ReplaceTextFont.Replace(oldXml, "$1" + FontChangeFmt + "$4"); // B2021-032: use original font
|
||||
XdOld.LoadXml(AdjustHeightAndWidthForDPI(oldXml));
|
||||
@@ -328,7 +335,7 @@ namespace Volian.Controls.Library
|
||||
XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Styles/Style/Definition");
|
||||
string data = string.Empty;
|
||||
foreach (XmlNode xn in nl)
|
||||
{
|
||||
{
|
||||
string str = xn.InnerText;
|
||||
string[] splStr = str.Split(';');
|
||||
foreach (string s in splStr)
|
||||
@@ -852,7 +859,10 @@ namespace Volian.Controls.Library
|
||||
if (Row >= cr.r1 && Row <= cr.r2)
|
||||
{
|
||||
int cellHeight = GetCellHeight(Row, c);
|
||||
int dataHeight = (cr.UserData == null) ? cellHeight : (int)cr.UserData;
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
string tmpUD = $"{cr.UserData}";
|
||||
int dataHeight = (cr.UserData == null) ? cellHeight : int.Parse(tmpUD.Split(',')[0]);
|
||||
int ud = dataHeight / (Rows.DefaultSize - 3);
|
||||
//if (cellHeight < dataHeight)
|
||||
// Console.WriteLine("r {0}, c {1}, cell{2}, data{3}", Row, c, cellHeight, dataHeight);
|
||||
@@ -1243,11 +1253,24 @@ namespace Volian.Controls.Library
|
||||
if (_tableCellEditor._initializingEdit || !_tableCellEditor.Visible) return;
|
||||
int curHeight = GetCellHeight(Row, Col);//(Rows[Row].Height == -1) ? Rows.DefaultSize : Rows[Row].Height;
|
||||
CellRange cr = GetMergedRange(Row, Col);
|
||||
int oH = cr.UserData == null ? curHeight : (int)cr.UserData;
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
string tmpUD = $"{cr.UserData}";
|
||||
int oH = cr.UserData == null ? curHeight : int.Parse(tmpUD.Split(',')[0]);
|
||||
int nH = _tableCellEditor.Height; //.ContentsRectangle.Height;
|
||||
int nW = _tableCellEditor.Width; // Width
|
||||
int Hadj = (nH - curHeight);//oH);
|
||||
cr.UserData = _tableCellEditor.Height; //.ContentsRectangle.Height;
|
||||
string tmp = $"{cr.UserData}";
|
||||
int comma = tmp.IndexOf(',');
|
||||
if (comma != -1)
|
||||
{
|
||||
cr.UserData = $"{_tableCellEditor.Height},{tmp.Substring(comma + 1)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
cr.UserData = _tableCellEditor.Height;
|
||||
}
|
||||
|
||||
//int cellHeight = GetCellHeight(Row, Col);
|
||||
//int cellheightNLines = cellHeight / (Rows.DefaultSize - 3);
|
||||
//int nHNLines = nH / (Rows.DefaultSize - 3);
|
||||
@@ -1371,7 +1394,18 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_rtf.Width = e.Bounds.Width - 1; // This has also been -3 which matchs the rener command
|
||||
CellRange cr = GetMergedRange(e.Row, e.Col);
|
||||
cr.UserData = _rtf.Height;
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
string tmp = $"{cr.UserData}";
|
||||
int comma = tmp.IndexOf(',');
|
||||
if (comma != -1)
|
||||
{
|
||||
cr.UserData = $"{_rtf.Height},{tmp.Substring(comma + 1)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
cr.UserData = _rtf.Height;
|
||||
}
|
||||
int hAdjust = 0;
|
||||
int hDiff = e.Bounds.Height - _rtf.Height;
|
||||
if (hDiff < 0)
|
||||
@@ -2612,6 +2646,84 @@ namespace Volian.Controls.Library
|
||||
CellRange cr = this.Selection;
|
||||
cr.Clear(ClearFlags.Content);
|
||||
}
|
||||
|
||||
public enum EPinputtype
|
||||
{
|
||||
none,
|
||||
textbox,
|
||||
checkbox,
|
||||
multi
|
||||
};
|
||||
private bool IsUserDataDirty = false;
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
//For Electronic Procedures to set the Electronic Procedure input type
|
||||
//for when cells in a table will need a textbox or checkbox in the EP viewer
|
||||
public void SetEPinputtype(EPinputtype EPtype)
|
||||
{
|
||||
CellRange cr = this.Selection;
|
||||
|
||||
for (int r = cr.r1; r <= cr.r2; r++)
|
||||
for (int c = cr.c1; c <= cr.c2; c++)
|
||||
{
|
||||
CellRange cr_single = GetCellRange(r, c);
|
||||
string tmpUD = $"{cr_single.UserData}";
|
||||
string height = cr_single.UserData == null ? $"{GetCellHeight(r, c)}" : tmpUD.Split(',')[0];
|
||||
|
||||
if (EPtype == EPinputtype.none)
|
||||
cr_single.UserData = int.Parse(height);
|
||||
else
|
||||
cr_single.UserData = $"{height},{EPtype}";
|
||||
}
|
||||
|
||||
//save the changes
|
||||
Select(cr);
|
||||
IsUserDataDirty = true;
|
||||
}
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
//For Electronic Procedures get the Electronic Procedure input type
|
||||
//for when cells in a table will need a textbox or checkbox in the EP viewer
|
||||
public EPinputtype GetEPinputtype()
|
||||
{
|
||||
EPinputtype result = EPinputtype.none;
|
||||
|
||||
CellRange cr = this.Selection;
|
||||
|
||||
for (int r = cr.r1; r <= cr.r2; r++)
|
||||
for (int c = cr.c1; c <= cr.c2; c++)
|
||||
{
|
||||
CellRange cr_single = GetCellRange(r, c);
|
||||
string tmpUD = $"{cr_single.UserData}";
|
||||
int comma = tmpUD.IndexOf(',');
|
||||
if (comma != -1)
|
||||
{
|
||||
EPinputtype newresult = (EPinputtype) Enum.Parse(typeof(EPinputtype), tmpUD.Substring(comma + 1));
|
||||
//if first cell, overwrite none
|
||||
if (result == EPinputtype.none && r == cr.r1 && c == cr.c1)
|
||||
{
|
||||
result = newresult;
|
||||
}
|
||||
else if (result != newresult)
|
||||
{
|
||||
result = EPinputtype.multi;
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
else if (result != EPinputtype.none)
|
||||
{
|
||||
result = EPinputtype.multi;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public void SetupCellUserData()
|
||||
{
|
||||
for (int r = 0; r < Rows.Count; r++)
|
||||
@@ -2625,7 +2737,19 @@ namespace Volian.Controls.Library
|
||||
_rtf.Width = Cols[c].Width;
|
||||
_rtf.Rtf = rtfText;
|
||||
CellRange cr = GetCellRange(r, c);
|
||||
cr.UserData = _rtf.ContentsRectangle.Height;
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
string tmp = $"{cr.UserData}";
|
||||
int comma = tmp.IndexOf(',');
|
||||
if (comma != -1)
|
||||
{
|
||||
cr.UserData = $"{_rtf.ContentsRectangle.Height},{tmp.Substring(comma + 1)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
cr.UserData = _rtf.ContentsRectangle.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user