WCNCKL: added length of smart template HLS (for wrapping)
WCNCKL: Set length of smart template HLS (for wrapping) Moved ‘SplitText’ from vlnSvgPageHelper so that it can be accessible from DisplayText (Volian.Controls.Library) and VlnSvgPageHelper (print) Calvert: use item’s format to determine if change id tab should be visible rather than top folder (top folder was used when user was prompted to enter change id for session). WCNCKL: use ‘SplitText’ to handle split/wrap of HLS checklist text
This commit is contained in:
parent
d6aae18a46
commit
aa264a4e5d
@ -3886,6 +3886,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return LazyLoad(ref _UseSmartTemplate, "@UseSmartTemplate");
|
return LazyLoad(ref _UseSmartTemplate, "@UseSmartTemplate");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private LazyLoad<bool> _UseOldTemplate;
|
private LazyLoad<bool> _UseOldTemplate;
|
||||||
public bool UseOldTemplate
|
public bool UseOldTemplate
|
||||||
{
|
{
|
||||||
@ -4708,6 +4709,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return LazyLoad(ref _PosAdjust, "StepPrintData/@PosAdjust");
|
return LazyLoad(ref _PosAdjust, "StepPrintData/@PosAdjust");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private LazyLoad<int?> _HLSLength;
|
||||||
|
public int? HLSLength
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return LazyLoad(ref _HLSLength, "StepPrintData/@HLSLength");
|
||||||
|
}
|
||||||
|
}
|
||||||
private LazyLoad<string> _Justify;
|
private LazyLoad<string> _Justify;
|
||||||
public string Justify
|
public string Justify
|
||||||
{
|
{
|
||||||
|
118
PROMS/Volian.Base.Library/RtfTools.cs
Normal file
118
PROMS/Volian.Base.Library/RtfTools.cs
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace Volian.Base.Library
|
||||||
|
{
|
||||||
|
public class RtfTools
|
||||||
|
{
|
||||||
|
public static List<string> SplitText(string text, int len)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
List<string> results = new List<string>();
|
||||||
|
if (text.Contains("\\LINE ") || text.Contains("\r\n"))
|
||||||
|
{
|
||||||
|
string[] mySplit = { "\\LINE ", "\r\n" };
|
||||||
|
return new List<string>(text.Split(mySplit, StringSplitOptions.None));
|
||||||
|
|
||||||
|
}
|
||||||
|
int width = 0; // width of text, non-rtf
|
||||||
|
int start = 0; // start of line (index into string 'text'), includes rtf
|
||||||
|
int lastspace = 0; // location of lastspace (index into string 'text'), includes rtf
|
||||||
|
int startNonRtf = 0; // start of line, non-rtf (used for determining starting position to determine width if there was a break)
|
||||||
|
string rtfprefix = "";
|
||||||
|
string nextprefix = "";
|
||||||
|
for (int indx = 0; indx < text.Length; indx++)
|
||||||
|
{
|
||||||
|
if (text[indx] == '\\') //rtf command
|
||||||
|
{
|
||||||
|
// look for three things at beginning of string: hex, unicode, rtfcommand.
|
||||||
|
Match m = Regex.Match(text.Substring(indx), @"^\\'[a-fA-F0-9][a-fA-F0-9]"); //hex
|
||||||
|
if (m.Success)
|
||||||
|
{
|
||||||
|
indx += m.Length - 1;
|
||||||
|
width++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m = Regex.Match(text.Substring(indx), @"^\\[uU][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][?]"); // 3 char unicode, for example \u160? (hardspace)
|
||||||
|
if (m.Success)
|
||||||
|
{
|
||||||
|
indx += m.Length - 1;
|
||||||
|
width++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m = Regex.Match(text.Substring(indx), @"^\\[uU][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][?]");
|
||||||
|
if (m.Success)
|
||||||
|
{
|
||||||
|
indx += m.Length - 1;
|
||||||
|
width++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m = Regex.Match(text.Substring(indx), @"^\\[^ ]*? ");
|
||||||
|
if (m.Success)
|
||||||
|
{
|
||||||
|
indx += m.Length - 1;
|
||||||
|
rtfprefix = AdjustRtfPrefix(rtfprefix, m.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (text[indx] == ' ')
|
||||||
|
{
|
||||||
|
lastspace = indx;
|
||||||
|
startNonRtf = width;
|
||||||
|
}
|
||||||
|
width++;
|
||||||
|
if (width > len)
|
||||||
|
{
|
||||||
|
// what should be done if lastspace == 0
|
||||||
|
// cannot find space char to split on, so break the word
|
||||||
|
// not ideal but PROMS was bombing otherwise - jsj 7/7/2014
|
||||||
|
if (lastspace == 0)
|
||||||
|
{
|
||||||
|
lastspace = indx;
|
||||||
|
startNonRtf = width - 1;
|
||||||
|
}
|
||||||
|
results.Add(nextprefix + text.Substring(start, lastspace - start).Trim(" ".ToCharArray()));
|
||||||
|
nextprefix = rtfprefix;
|
||||||
|
if (nextprefix != "") nextprefix += " ";
|
||||||
|
start = lastspace + 1;
|
||||||
|
width = (width - startNonRtf - 1) > 0 ? width - startNonRtf - 1 : 0;
|
||||||
|
lastspace = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (width > 0 || start < text.Length) results.Add(nextprefix + text.Substring(start).Trim(" ".ToCharArray()));
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static string AdjustRtfPrefix(string rtfprefix, string rtfcommand)
|
||||||
|
{
|
||||||
|
if (rtfcommand.Contains(@"\ulnone") || rtfcommand.Contains(@"\ul0")) // off
|
||||||
|
rtfprefix = rtfprefix.Replace(@"\ul", "");
|
||||||
|
else if (rtfcommand.Contains(@"\ul"))
|
||||||
|
rtfprefix += @"\ul";
|
||||||
|
if (rtfcommand.Contains(@"\up0") || rtfcommand.Contains(@"\dn0")) rtfprefix = rtfprefix.Replace(@"\up2", "").Replace(@"\dn2", "");
|
||||||
|
else if (rtfcommand.Contains(@"\up")) rtfprefix += @"\up2";
|
||||||
|
else if (rtfcommand.Contains(@"\dn")) rtfprefix += @"\dn2";
|
||||||
|
if (rtfcommand.Contains(@"\b0"))
|
||||||
|
rtfprefix = rtfprefix.Replace(@"\b", "");
|
||||||
|
else if (rtfcommand.Contains(@"\b"))
|
||||||
|
rtfprefix += @"\b";
|
||||||
|
if (rtfcommand.Contains(@"\i0"))
|
||||||
|
rtfprefix = rtfprefix.Replace(@"\i", "");
|
||||||
|
else if (rtfcommand.Contains(@"\i"))
|
||||||
|
rtfprefix += @"\i";
|
||||||
|
return rtfprefix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -868,7 +868,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
if (myItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds)
|
if (myItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds)
|
||||||
{
|
{
|
||||||
if (ItemsChangeIds.ContainsKey(myItemInfo.MyProcedure.ItemID)) SetChangeId(ItemsChangeIds[myItemInfo.MyProcedure.ItemID], pg);
|
if (ItemsChangeIds.ContainsKey(myItemInfo.MyProcedure.ItemID)) SetChangeId(ItemsChangeIds[myItemInfo.MyProcedure.ItemID], pg, myItemInfo);
|
||||||
else PromptForChangeId(myItemInfo, pg);
|
else PromptForChangeId(myItemInfo, pg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -877,17 +877,17 @@ namespace Volian.Controls.Library
|
|||||||
dlgChgId dlgCI = new dlgChgId(this);
|
dlgChgId dlgCI = new dlgChgId(this);
|
||||||
dlgCI.ShowDialog(this);
|
dlgCI.ShowDialog(this);
|
||||||
ItemsChangeIds.Add(myItemInfo.MyProcedure.ItemID, ChgId);
|
ItemsChangeIds.Add(myItemInfo.MyProcedure.ItemID, ChgId);
|
||||||
SetChangeId(ChgId, pg);
|
SetChangeId(ChgId, pg, myItemInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetChangeId(string chgid, DisplayTabItem pg)
|
private void SetChangeId(string chgid, DisplayTabItem pg, ItemInfo ii)
|
||||||
{
|
{
|
||||||
if (pg == null || pg.MyStepTabPanel == null)
|
if (pg == null || pg.MyStepTabPanel == null)
|
||||||
{
|
{
|
||||||
ChgId = null;
|
ChgId = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pg.MyStepTabPanel.MyStepTabRibbon.SetChangeId(chgid);
|
pg.MyStepTabPanel.MyStepTabRibbon.SetChangeId(chgid, ii);
|
||||||
ChgId = chgid;
|
ChgId = chgid;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -5,6 +5,7 @@ using System.Windows.Forms;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using VEPROMS.CSLA.Library;
|
using VEPROMS.CSLA.Library;
|
||||||
|
using Volian.Base.Library;
|
||||||
|
|
||||||
namespace Volian.Controls.Library
|
namespace Volian.Controls.Library
|
||||||
{
|
{
|
||||||
@ -121,11 +122,21 @@ namespace Volian.Controls.Library
|
|||||||
if (OriginalText.Contains("Prerequisite"))
|
if (OriginalText.Contains("Prerequisite"))
|
||||||
OriginalText = Regex.Replace(OriginalText, @"\\{Prerequisite Step: .*?\\}", "");
|
OriginalText = Regex.Replace(OriginalText, @"\\{Prerequisite Step: .*?\\}", "");
|
||||||
TextFont = itemInfo.GetItemFont();//GetItemFont();
|
TextFont = itemInfo.GetItemFont();//GetItemFont();
|
||||||
// if in print mode, and this is the HLS of a smart template (checklist formats), add a space before and
|
// if in print mode, and this is the HLS of a smart template (checklist formats) see if the hls
|
||||||
// after the HLS text - this allows for the vertical bar characters to be added.
|
// splits across 2 lines.
|
||||||
//if (itemInfo.IsStep && itemInfo.FormatStepData.UseSmartTemplate && epMode == E_EditPrintMode.Print) Console.WriteLine("here");
|
if (itemInfo.IsStep && itemInfo.FormatStepData.UseSmartTemplate && epMode == E_EditPrintMode.Print)
|
||||||
string addSpace = (itemInfo.IsStep && itemInfo.FormatStepData.UseSmartTemplate && epMode == E_EditPrintMode.Print) ? " " : "";
|
{
|
||||||
string text = prefix + addSpace + OriginalText + addSpace + suffix;
|
int hlslen = (int)(itemInfo.FormatStepData.StepPrintData.HLSLength ?? 66);
|
||||||
|
List<string> titleLines = Volian.Base.Library.RtfTools.SplitText(OriginalText, hlslen);
|
||||||
|
if (titleLines.Count > 1)
|
||||||
|
{
|
||||||
|
string tmporig = titleLines[0];
|
||||||
|
for (int ix = 1; ix < titleLines.Count; ix++)
|
||||||
|
tmporig = tmporig + @"\par " + titleLines[ix];
|
||||||
|
OriginalText = tmporig;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string text = prefix + OriginalText + suffix;
|
||||||
_MyFormat = itemInfo.ActiveFormat;
|
_MyFormat = itemInfo.ActiveFormat;
|
||||||
|
|
||||||
bool tableShouldBeOutlined = (epMode == E_EditPrintMode.Print || vwMode == E_ViewMode.View || noEdit) &&
|
bool tableShouldBeOutlined = (epMode == E_EditPrintMode.Print || vwMode == E_ViewMode.View || noEdit) &&
|
||||||
|
@ -63,9 +63,10 @@ namespace Volian.Controls.Library
|
|||||||
// txtBxChgId.Text = (this.Parent as StepTabPanel).MyDisplayTabControl.ChgId;
|
// txtBxChgId.Text = (this.Parent as StepTabPanel).MyDisplayTabControl.ChgId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void SetChangeId(string chgid)
|
public void SetChangeId(string chgid, ItemInfo ii)
|
||||||
{
|
{
|
||||||
txtBxChgId.Text = chgid;
|
txtBxChgId.Text = chgid;
|
||||||
|
rtabChgId.Visible = (ii != null) ? ii.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds : false;
|
||||||
}
|
}
|
||||||
// added jcb 20121221 to support set ro from word doc
|
// added jcb 20121221 to support set ro from word doc
|
||||||
private ROFSTLookup MyLookup;
|
private ROFSTLookup MyLookup;
|
||||||
|
@ -1044,6 +1044,7 @@ public struct Print
|
|||||||
public string ForeColor; // Doesn't exist in old format - See StepLayoutData
|
public string ForeColor; // Doesn't exist in old format - See StepLayoutData
|
||||||
public string BackColor; // Doesn't exist in old format - See StepLayoutData
|
public string BackColor; // Doesn't exist in old format - See StepLayoutData
|
||||||
public string PosAdjust;
|
public string PosAdjust;
|
||||||
|
public string HLSLength; // added for wolf creek checklist to define max string len of HLS (checklist steps)
|
||||||
public string Justify; // added for wolf creek checklist procedures.
|
public string Justify; // added for wolf creek checklist procedures.
|
||||||
}
|
}
|
||||||
[Serializable]
|
[Serializable]
|
||||||
@ -5408,6 +5409,7 @@ namespace fmtxml
|
|||||||
private string StepPartPrintForeColor(Step stp) { return stp.StepPrintData.ForeColor; }
|
private string StepPartPrintForeColor(Step stp) { return stp.StepPrintData.ForeColor; }
|
||||||
private string StepPartPrintBackColor(Step stp) { return stp.StepPrintData.BackColor; }
|
private string StepPartPrintBackColor(Step stp) { return stp.StepPrintData.BackColor; }
|
||||||
private string StepPartPrintPosAdjust(Step stp) { return stp.StepPrintData.PosAdjust; }
|
private string StepPartPrintPosAdjust(Step stp) { return stp.StepPrintData.PosAdjust; }
|
||||||
|
private string StepPartPrintHLSLength(Step stp) { return stp.StepPrintData.HLSLength; }
|
||||||
|
|
||||||
private string StepPartTabIdentEdit(Step stp) { return stp.TabData.IdentEdit; }
|
private string StepPartTabIdentEdit(Step stp) { return stp.TabData.IdentEdit; }
|
||||||
private string StepPartTabIdent(Step stp) { return stp.TabData.Ident; }
|
private string StepPartTabIdent(Step stp) { return stp.TabData.Ident; }
|
||||||
@ -5627,6 +5629,8 @@ namespace fmtxml
|
|||||||
if (CheckInheritedStr(new StepPartStr(StepPartPrintForeColor), step, dicParents)) step.StepPrintData.ForeColor = null;
|
if (CheckInheritedStr(new StepPartStr(StepPartPrintForeColor), step, dicParents)) step.StepPrintData.ForeColor = null;
|
||||||
if (CheckInheritedStr(new StepPartStr(StepPartPrintBackColor), step, dicParents)) step.StepPrintData.BackColor = null;
|
if (CheckInheritedStr(new StepPartStr(StepPartPrintBackColor), step, dicParents)) step.StepPrintData.BackColor = null;
|
||||||
if (CheckInheritedStr(new StepPartStr(StepPartPrintPosAdjust), step, dicParents)) step.StepPrintData.PosAdjust = NullString;
|
if (CheckInheritedStr(new StepPartStr(StepPartPrintPosAdjust), step, dicParents)) step.StepPrintData.PosAdjust = NullString;
|
||||||
|
if (CheckInheritedStr(new StepPartStr(StepPartPrintHLSLength), step, dicParents)) step.StepPrintData.HLSLength = NullString;
|
||||||
|
|
||||||
// substructure - TabData
|
// substructure - TabData
|
||||||
|
|
||||||
//RHM/KBR added this - not sure: if (mstp.TabData.IdentEdit == sstp.TabData.IdentEdit) subFmt.StepData[i].TabData.IdentEdit = null;
|
//RHM/KBR added this - not sure: if (mstp.TabData.IdentEdit == sstp.TabData.IdentEdit) subFmt.StepData[i].TabData.IdentEdit = null;
|
||||||
|
@ -136,6 +136,8 @@ namespace fmtxml
|
|||||||
fmtdata.StepData[30].StepLayoutData.AlignWithParentTab = "True";
|
fmtdata.StepData[30].StepLayoutData.AlignWithParentTab = "True";
|
||||||
fmtdata.StepData[2].StepPrintData.Justify = "Center";
|
fmtdata.StepData[2].StepPrintData.Justify = "Center";
|
||||||
fmtdata.StepData[9].StepPrintData.Justify = "Center";
|
fmtdata.StepData[9].StepPrintData.Justify = "Center";
|
||||||
|
fmtdata.StepData[2].StepPrintData.HLSLength = "66";
|
||||||
|
fmtdata.StepData[9].StepPrintData.HLSLength = "66";
|
||||||
fmtdata.ROData.UpRoAftrDash = "False";
|
fmtdata.ROData.UpRoAftrDash = "False";
|
||||||
fmtdata.ROData.UpRoImmAftrDashSpace = "True";
|
fmtdata.ROData.UpRoImmAftrDashSpace = "True";
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user