diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs index 9ba61f6e..0d40aaef 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SqlClient; +using System.Text.RegularExpressions; using Csla; using Csla.Data; @@ -856,6 +857,8 @@ namespace VEPROMS.CSLA.Library { string tmpStr = tb.ToString(); if (tmpStr.ToUpper().EndsWith(", STEP ")) tb.Remove(tb.Length - 7, 7); // 7 is length of ", Step " + else if (tb.Prefix != null && tb.Prefix.StartsWith(")")) + tb.Append(")"); return true; } string retstr = TranGetSectionNumber(tb._ToItem); @@ -872,10 +875,20 @@ namespace VEPROMS.CSLA.Library tb.ReplaceToken(retstr); return (retstr != null && retstr != ""); } + private static string FixTitleCase(Match m) + { + if (Regex.IsMatch(m.Value, @"^[A-Za-z]+\.?$")) + { + string part1 = m.Value.Substring(0, 1); + string part2 = m.Value.Substring(1); + return part1.ToUpper() + part2.ToLower(); + } + return m.Value; + } private static string CapFirstLetterOnly(string retstr, int p) { - string lretstr = retstr; // LATER: write code to capitalize first letter (active plants) + string lretstr = Regex.Replace(retstr, @"([^ ,]+)", new MatchEvaluator(FixTitleCase)); return lretstr; } // TODO: Section methods are not complete.... @@ -897,7 +910,11 @@ namespace VEPROMS.CSLA.Library if (tb._FormatData.TransData.UseSecTitles) { ItemInfo tmpitm = TranGetSectionItem(itminfo); - return (tmpitm.MyContent.Text); + string sectionTitle = tmpitm.MyContent.Text; + sectionTitle = (tb._FormatData.TransData.CapsTransitionsSection ? sectionTitle.ToUpper().Replace(@"\U", @"\u") : + tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle, 0) : + sectionTitle); + return (sectionTitle); } return null; } diff --git a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs index f6582616..640a7856 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs @@ -4926,6 +4926,14 @@ namespace VEPROMS.CSLA.Library return LazyLoad(ref _CapsTransitions, "@CapsTransitions"); } } + private LazyLoad _CapsTransitionsSection; + public bool CapsTransitionsSection + { + get + { + return LazyLoad(ref _CapsTransitionsSection, "@CapsTransitionsSection"); + } + } private LazyLoad _CapTranStep; public bool CapTranStep { @@ -4974,6 +4982,14 @@ namespace VEPROMS.CSLA.Library return LazyLoad(ref _Cap1stCharTrans, "@Cap1stCharTrans"); } } + private LazyLoad _Cap1stCharTransSection; + public bool Cap1stCharTransSection + { + get + { + return LazyLoad(ref _Cap1stCharTransSection, "@Cap1stCharTransSection"); + } + } private LazyLoad _UseTransitionModifier; public bool UseTransitionModifier { diff --git a/PROMS/Volian.Controls.Library/DisplayText.cs b/PROMS/Volian.Controls.Library/DisplayText.cs index 52018a71..5f0ba8f5 100644 --- a/PROMS/Volian.Controls.Library/DisplayText.cs +++ b/PROMS/Volian.Controls.Library/DisplayText.cs @@ -400,7 +400,7 @@ namespace Volian.Controls.Library private string DoTransitionAdjustments(string text, bool boldTran) { string strippedText = StaticStripRtfCommands(text); - string lookFor = string.Format(@""); + string lookFor = string.Format(@""); MatchCollection matches = Regex.Matches(text, lookFor); if (matches.Count == 0) return text; string retstr = text; @@ -413,7 +413,7 @@ namespace Volian.Controls.Library //if (!Char.IsDigit(m.Groups[3].Value[0])) continue; if (m != null && m.Groups.Count > 7 && m.Groups[6].ToString().StartsWith("Transition")) { - if (m.Groups[7].Value != "" && StepTransition(int.Parse(m.Groups[7].Value))) + if (m.Groups[7].Value != "") // && StepTransition(int.Parse(m.Groups[7].Value))) { System.Text.RegularExpressions.Group g = m.Groups[3]; string beforeTran = retstr.Substring(0, g.Index); @@ -423,19 +423,27 @@ namespace Volian.Controls.Library // i.e. there is a format flag 'BeforeTrans' that bolds text before the transition // (in wst formats). beforeTran = DoBeforeTransFlagSupport(beforeTran, _MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.ReplaceStrList); - string newvalue = g.ToString(); - int indexLastSpace = newvalue.LastIndexOf(' '); - if (indexLastSpace >= 0) - // Use a "\x1" as a token to replace later. Insert the unicode char, whose length is - // more than 1 character was throwing of the regexp Matches index, so that the resulting - // string may have been incorrect. - retstr = beforeTran + (boldTran ? @"\b " : null) + newvalue.Substring(0, indexLastSpace) + "\x1" + newvalue.Substring(indexLastSpace + 1) + (boldTran ? @"\b0" : null) + afterTran; - else - if (beforeTran.EndsWith(" ") ) - retstr = ReplaceLastSpaceWithHardSpace(beforeTran) + (boldTran ? @"\b " : null) + newvalue + (boldTran ? @"\b0" : null) + afterTran; + // if this is a 'step transition' type, i.e. includes a step number, in addition to other replacements, + // we want to change a space to a hardspace. + if (StepTransition(int.Parse(m.Groups[7].Value))) + { + int indexLastSpace = newvalue.LastIndexOf(' '); + if (indexLastSpace >= 0) + // Use a "\x1" as a token to replace later. Insert the unicode char, whose length is + // more than 1 character was throwing of the regexp Matches index, so that the resulting + // string may have been incorrect. + retstr = beforeTran + (boldTran ? @"\b " : null) + newvalue.Substring(0, indexLastSpace) + "\x1" + newvalue.Substring(indexLastSpace + 1) + (boldTran ? @"\b0" : null) + afterTran; else - Console.Write("");// Don't know where to put the Hard Space + if (beforeTran.EndsWith(" ")) + retstr = ReplaceLastSpaceWithHardSpace(beforeTran) + (boldTran ? @"\b " : null) + newvalue + (boldTran ? @"\b0" : null) + afterTran; + else + Console.Write("");// Don't know where to put the Hard Space + } + else if (boldTran) + { + retstr = beforeTran + @"\b " + newvalue + @"\b0" + afterTran; + } } } } diff --git a/PROMS/fmtxml/WST1all.xml b/PROMS/fmtxml/WST1all.xml index 5e783a1d..096b0dda 100644 Binary files a/PROMS/fmtxml/WST1all.xml and b/PROMS/fmtxml/WST1all.xml differ diff --git a/PROMS/fmtxml/WST2all.xml b/PROMS/fmtxml/WST2all.xml index 0f89543d..d2b6ac6f 100644 Binary files a/PROMS/fmtxml/WST2all.xml and b/PROMS/fmtxml/WST2all.xml differ diff --git a/PROMS/fmtxml/WSTALRall.xml b/PROMS/fmtxml/WSTALRall.xml index 8016e939..05836de4 100644 Binary files a/PROMS/fmtxml/WSTALRall.xml and b/PROMS/fmtxml/WSTALRall.xml differ diff --git a/PROMS/fmtxml/WSTBCKall.xml b/PROMS/fmtxml/WSTBCKall.xml index 5d5ed407..12c87acc 100644 Binary files a/PROMS/fmtxml/WSTBCKall.xml and b/PROMS/fmtxml/WSTBCKall.xml differ diff --git a/PROMS/fmtxml/WSTCKLall.xml b/PROMS/fmtxml/WSTCKLall.xml index 26c3a653..73a308da 100644 Binary files a/PROMS/fmtxml/WSTCKLall.xml and b/PROMS/fmtxml/WSTCKLall.xml differ diff --git a/PROMS/fmtxml/WSTDCSall.xml b/PROMS/fmtxml/WSTDCSall.xml index e903a388..4aade44b 100644 Binary files a/PROMS/fmtxml/WSTDCSall.xml and b/PROMS/fmtxml/WSTDCSall.xml differ