- Put RO Adjustment code prior to Replace Words - Match 16 Bit

- Replaced logic for Replace Words so that they are replaced sequentially through  the text rather than sequentially through the word list.
- Added DoTransitionAdjustments that adds hardspaces to Transitions.
- Changed the NextUnicode module to ignore Hard Spaces
- Added logic to find 'real' spaces in ROs and replace only them.  Spaces are  also used to terminate RTF commands.
Added code to handle "AND Range" Transitions
- Use new ToolTip property
- Use new MyStepSectionLayoutData
- Remove Debug
Remove unused code
Renamed TwipsPerPage to PointsPerPage
Adjusted Superscript offset to match 16-Bit
- Added Debug Code to compare 16-Bit and 32-Bit text
- Added Debug Code forr Pagination
- Added optional code to match 16-Bit pagination
Added Ruler for 6 and 7 lines per inch.
This commit is contained in:
Rich 2010-09-06 19:39:44 +00:00
parent cfedc831ba
commit d739a72c7b
9 changed files with 490 additions and 70 deletions

View File

@ -141,13 +141,16 @@ namespace Volian.Controls.Library
} }
private string CreateRtf(bool colorLinks, string text, bool tableShouldBeOutlined, bool wordsShouldBeReplaced, bool numbersShouldBeFormated, bool tableHasBorder, bool ROsShouldBeAdjusted) private string CreateRtf(bool colorLinks, string text, bool tableShouldBeOutlined, bool wordsShouldBeReplaced, bool numbersShouldBeFormated, bool tableHasBorder, bool ROsShouldBeAdjusted)
{ {
// if in print mode, view mode, or non-active richtextbox do replace words. Only if in
// actual edit mode are replace words left as is.
if (wordsShouldBeReplaced)
text = DoReplaceWords(text);
// Adjust RO display // Adjust RO display
if (ROsShouldBeAdjusted) if (ROsShouldBeAdjusted)
text = DoROAdjustments(text); text = DoROAdjustments(text);
// if in print mode, view mode, or non-active richtextbox do replace words. Only if in
// actual edit mode are replace words left as is.
if (wordsShouldBeReplaced)
text = DoReplaceWords2(text);
// Adjust RO display
if (ROsShouldBeAdjusted)
text = DoTransitionAdjustments(text);
// add colors around links: // add colors around links:
if (colorLinks) if (colorLinks)
text = DoColorLinks(text); text = DoColorLinks(text);
@ -196,7 +199,6 @@ namespace Volian.Controls.Library
} }
return text; return text;
} }
private static string DoColorLinks(string text) private static string DoColorLinks(string text)
{ {
text = Regex.Replace(text, @"(<START\](\\[^v \\]+)*\\v0)((?= |\\))", @"$1\cf1"); text = Regex.Replace(text, @"(<START\](\\[^v \\]+)*\\v0)((?= |\\))", @"$1\cf1");
@ -212,7 +214,13 @@ namespace Volian.Controls.Library
} }
private int NextUnicode(string text, int offset) private int NextUnicode(string text, int offset)
{ {
// Skip Hard Spaces
Match m = Regex.Match(text.Substring(offset), @"\\u[0-9a-fA-F]"); Match m = Regex.Match(text.Substring(offset), @"\\u[0-9a-fA-F]");
while(m.Success && text.Substring(offset+m.Index).StartsWith(@"\u160"))
{
offset += m.Index + 5;
m = Regex.Match(text.Substring(offset), @"\\u[0-9a-fA-F]");
}
if (m.Success) if (m.Success)
return m.Index + offset; return m.Index + offset;
return -1; return -1;
@ -231,14 +239,73 @@ namespace Volian.Controls.Library
string beforeRO = StaticStripRtfCommands(text.Substring(0, g.Index)); string beforeRO = StaticStripRtfCommands(text.Substring(0, g.Index));
string afterRO = StaticStripRtfCommands(text.Substring(g.Index + g.Length)); string afterRO = StaticStripRtfCommands(text.Substring(g.Index + g.Length));
string newvalue = DoROFormatFlags(g.ToString(), beforeRO, afterRO); string newvalue = DoROFormatFlags(g.ToString(), beforeRO, afterRO);
newvalue = newvalue.Replace(" ", @"\u160?"); newvalue = ReplaceSpaceWithHardspace(newvalue);
if (g.ToString() != newvalue) if (g.ToString() != newvalue)
text = text.Substring(0, g.Index) + newvalue + text.Substring(g.Index + g.Length); text = text.Substring(0, g.Index) + newvalue + text.Substring(g.Index + g.Length);
} }
} }
return text; return text;
} }
private static Regex _RegExReplaceSpaceWithHardspace = new Regex(@"((\\[^\\ \?]+)*\\[^\\ \?]+[ ?])?( )");
private string ReplaceSpaceWithHardspace(string newvalue)
{
return _RegExReplaceSpaceWithHardspace.Replace(newvalue, @"$1\u160?");
}
private string DoTransitionAdjustments(string text)
{
if (_MyItemInfo.ItemID == 230 || _MyItemInfo.ItemID == 154 || _MyItemInfo.ItemID == 1932)
Console.Write("");
string strippedText = StaticStripRtfCommands(text);
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v \\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):[0-9]* ([0-9]*).*?\[END>");
MatchCollection matches = Regex.Matches(text, lookFor);
for (int i = matches.Count - 1; i >= 0; i--)
{
Match m = matches[i];
if (m != null && m.Groups.Count > 7 && m.Groups[6].ToString().StartsWith("Transition"))
{
if (StepTransition(int.Parse(m.Groups[7].Value)))
{
System.Text.RegularExpressions.Group g = m.Groups[3];
string beforeTran = text.Substring(0, g.Index);
string afterTran = text.Substring(g.Index + g.Length);
string newvalue = g.ToString();
int indexLastSpace = newvalue.LastIndexOf(' ');
if (indexLastSpace >= 0)
text = beforeTran + newvalue.Substring(0, indexLastSpace) + @"\u160?" + newvalue.Substring(indexLastSpace + 1) + afterTran;
else
if (beforeTran.EndsWith(" "))
text = ReplaceLastSpaceWithHardSpace(beforeTran) + newvalue + afterTran;
else
Console.Write("");// Don't know where to put the Hard Space
}
}
}
return text;
}
private string ReplaceLastSpaceWithHardSpace(string str)
{
int ind =str.LastIndexOf("<START]");
ind = str.LastIndexOf(@"\", ind);
while (ind >= 0 && str[ind - 1] != ' ')
{
if (ind > 5 && str.Substring(0, ind).EndsWith(@"\u160?") || str.Substring(0, ind).ToLower().EndsWith(@"\'a0"))
return str;//Already has a Hard Space
ind = str.LastIndexOf(@"\", ind - 1);
}
// If the previous character is a comma or a space then don't add a Hard Space
if (ind > 1 && (str[ind - 2] == ',' || str[ind - 2] == ' ')) return str;
if (ind == -1)
return str;
return str.Substring(0,ind - 1) + @"\u160?" + str.Substring(ind);
}
private bool StepTransition(int TransId)
{
if (_MyItemInfo == null) return false;
foreach (TransitionInfo trans in _MyItemInfo.MyContent.ContentTransitions)
if (trans.TransitionID == TransId)
return trans.MyItemToID.IsStep;
return false;
}
private string DoFortranFormat(string text) private string DoFortranFormat(string text)
{ {
if (text.IndexOf(@".E") < 0) return text; if (text.IndexOf(@".E") < 0) return text;
@ -1005,8 +1072,11 @@ namespace Volian.Controls.Library
private string DoROFormatFlags(string roText, string beforeRO, string afterRO) private string DoROFormatFlags(string roText, string beforeRO, string afterRO)
{ {
string rtnstr = roText; string rtnstr = roText;
beforeRO = Regex.Replace(beforeRO, @"(\\[^v \\]+)*\\v(\\[^v \\]+)* .*?\\v0(\\[^v \\]+)*( |$)", ""); // The RO text is being changed to match it's context. Since it is changed in reverse order, the text before the RO
afterRO = Regex.Replace(afterRO, @"(\\[^v \\]+)*\\v(\\[^v \\]+)* .*?\\v0(\\[^v \\]+)*( |$)", ""); // should ignore other RO text.
beforeRO = Regex.Replace(beforeRO, @"(\\[^v \\]+)*\\v0[^v\\]*\\v(\\[^v \\]+)* #Link:Refer", ""); // Remove any RO Values.
beforeRO = Regex.Replace(beforeRO, @"(\\[^v \\]+)*\\v(\\[^v \\]+)* .*?\\v0(\\[^v \\]+)*( |$)", ""); // Remove Comments
afterRO = Regex.Replace(afterRO, @"(\\[^v \\]+)*\\v(\\[^v \\]+)* .*?\\v0(\\[^v \\]+)*( |$)", ""); // Remove Comments
// Underline all ROs, values and Units // Underline all ROs, values and Units
if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.UnderlineRo) if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.UnderlineRo)
@ -1025,7 +1095,7 @@ namespace Volian.Controls.Library
// Caps ROs anywhere if no lower case text follows // Caps ROs anywhere if no lower case text follows
// and an upper case letter immediately precedes the RO. // and an upper case letter immediately precedes the RO.
if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.CapRoIfLastLower && Regex.IsMatch(afterRO,".*[a-z].*") && char.IsUpper(LastAlpha(beforeRO))) if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.CapRoIfLastLower && !Regex.IsMatch(afterRO,"[a-z]") && char.IsUpper(LastAlpha(beforeRO)))
{ {
//int indx = startLinkText - 1; //int indx = startLinkText - 1;
//int indx2 = endLinkText + 1; //int indx2 = endLinkText + 1;
@ -1095,11 +1165,24 @@ namespace Volian.Controls.Library
return rtnstr; return rtnstr;
} }
/// <summary>
/// Uppercase alphabetical strings excluding any RTF token
/// </summary>
/// <param name="match"></param>
/// <returns></returns>
private string MatchEvaluatorUppercaseROUnits(Match match)
{
if (match.Value[0] == '\\') // If the previous character is a backslash then this is an RTF token
return match.Value;
return match.Value.ToUpper();
}
Regex _RegExUppercaseROUnits = new Regex("(^|[^a-zA-Z])[a-zA-Z]+");
private string UpperCaseUnits(string rtnstr) private string UpperCaseUnits(string rtnstr)
{ {
// Uppercase Units
rtnstr = _RegExUppercaseROUnits.Replace(rtnstr, new MatchEvaluator(MatchEvaluatorUppercaseROUnits));
// After converting the value to uppercase, change X10 to x10 to handle Fortran Formatted numbers // After converting the value to uppercase, change X10 to x10 to handle Fortran Formatted numbers
return rtnstr.ToUpper().Replace("X10", "x10"); return rtnstr.Replace("X10", "x10");
} }
// Find the last Alphabetical character // Find the last Alphabetical character
@ -1197,7 +1280,8 @@ namespace Volian.Controls.Library
else if (_MyItemInfo.IsInRNO && (rs.Flag & E_ReplaceFlags.RNO) > 0) replaceit = true; else if (_MyItemInfo.IsInRNO && (rs.Flag & E_ReplaceFlags.RNO) > 0) replaceit = true;
else if (_MyItemInfo.IsCaution && (rs.Flag & E_ReplaceFlags.Caution) > 0) replaceit = true; else if (_MyItemInfo.IsCaution && (rs.Flag & E_ReplaceFlags.Caution) > 0) replaceit = true;
else if (_MyItemInfo.IsNote && (rs.Flag & E_ReplaceFlags.Note) > 0) replaceit = true; else if (_MyItemInfo.IsNote && (rs.Flag & E_ReplaceFlags.Note) > 0) replaceit = true;
else if (_MyItemInfo.IsInFirstLevelSubStep && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true; else if (_MyItemInfo.IsStepPart && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true;
//else if (_MyItemInfo.IsInFirstLevelSubStep && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true;
else if (_MyItemInfo.IsAccPages & (rs.Flag & E_ReplaceFlags.Attach) > 0) replaceit = true; else if (_MyItemInfo.IsAccPages & (rs.Flag & E_ReplaceFlags.Attach) > 0) replaceit = true;
if (replaceit) if (replaceit)
@ -1230,7 +1314,8 @@ namespace Volian.Controls.Library
string pat = @"(?<=\W|^)(?<![\\u160?])" + replaceWord + @"(?![\\u160?])(?=\W|$)"; string pat = @"(?<=\W|^)(?<![\\u160?])" + replaceWord + @"(?![\\u160?])(?=\W|$)";
try try
{ {
Text = Regex.Replace(Text, pat, rs.ReplaceWith, RegexOptions.IgnoreCase); Text = ReplaceWord(Text, pat, rs.ReplaceWith, RegexOptions.IgnoreCase);
//Text = Regex.Replace(Text, pat, rs.ReplaceWith, RegexOptions.IgnoreCase);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1259,7 +1344,8 @@ namespace Volian.Controls.Library
string pat = @"(?<=\W|^)(?<![\\u160?])" + replaceWord + @"(?![\\u160?])(?=\W|$)"; string pat = @"(?<=\W|^)(?<![\\u160?])" + replaceWord + @"(?![\\u160?])(?=\W|$)";
try try
{ {
Text = Regex.Replace(Text, pat, rs.ReplaceWith); Text = ReplaceWord(Text, pat, rs.ReplaceWith, RegexOptions.None);
//Text = Regex.Replace(Text, pat, rs.ReplaceWith);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1274,6 +1360,116 @@ namespace Volian.Controls.Library
//Console.WriteLine("--- After '{0}'", Text); //Console.WriteLine("--- After '{0}'", Text);
return Text; return Text;
} }
private string DoReplaceWords1(string Text)
{
if (_MyItemInfo.MyContent.Type < 20000) return Text; // for now only replace in steps.
ReplaceStrList rsl = _MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList;
// Loop through text looking for words to be replaced
foreach (ReplaceStr rs in rsl)
{
bool replaceit = false;
// note that the order of this check is important. Check in this order...
// background here
if (_MyItemInfo.IsHigh && (rs.Flag & E_ReplaceFlags.High) > 0) replaceit = true;
else if ((_MyItemInfo.IsTable || _MyItemInfo.IsFigure) && (rs.Flag & E_ReplaceFlags.Table) > 0) replaceit = true;
else if (_MyItemInfo.IsInRNO && (rs.Flag & E_ReplaceFlags.RNO) > 0) replaceit = true;
else if (_MyItemInfo.IsCaution && (rs.Flag & E_ReplaceFlags.Caution) > 0) replaceit = true;
else if (_MyItemInfo.IsNote && (rs.Flag & E_ReplaceFlags.Note) > 0) replaceit = true;
else if (_MyItemInfo.IsStepPart && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true;
//else if (_MyItemInfo.IsInFirstLevelSubStep && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true;
else if (_MyItemInfo.IsAccPages & (rs.Flag & E_ReplaceFlags.Attach) > 0) replaceit = true;
if (replaceit)
{
// CASEINSENS: Do ReplaceWords for all words that match, regardless of case, and replace with the ReplaceWith string as is
RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
string replaceWord = Regex.Replace(rs.ReplaceWord, @"[[\]\\()]", @"\$0");
string pat = @"(?<=\W|^)(?<![\\u160?])" + replaceWord + @"(?![\\u160?])(?=\W|$)";
try
{
Text = ReplaceWord(Text, pat, rs.ReplaceWith, myOptions);
}
catch (Exception ex)
{
Console.WriteLine("{0},'{1}',{2},'{3}'", _MyItemInfo.ActiveFormat.Name, replaceWord, ex.GetType().Name, ex.Message);
}
}
}
Text = Text.Replace(@"\xA0", @"\u160?"); //replace hard space
return Text;
}
private Dictionary<ReplaceStr, Regex> dicReplaceRegex = new Dictionary<ReplaceStr, Regex>();
private string DoReplaceWords2(string Text)
{
if (_MyItemInfo.MyContent.Type < 20000) return Text; // for now only replace in steps.
FoundMatches myMatches = new FoundMatches(Text);
myMatches.Add(regFindLink, null);
ReplaceStrList rsl = _MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList;
// Loop through text looking for words to be replaced
foreach (ReplaceStr rs in rsl)
{
bool replaceit = false;
// note that the order of this check is important. Check in this order...
// background here
if (_MyItemInfo.IsHigh && (rs.Flag & E_ReplaceFlags.High) > 0) replaceit = true;
else if ((_MyItemInfo.IsTable || _MyItemInfo.IsFigure) && (rs.Flag & E_ReplaceFlags.Table) > 0) replaceit = true;
else if (_MyItemInfo.IsInRNO && (rs.Flag & E_ReplaceFlags.RNO) > 0) replaceit = true;
else if (_MyItemInfo.IsCaution && (rs.Flag & E_ReplaceFlags.Caution) > 0) replaceit = true;
else if (_MyItemInfo.IsNote && (rs.Flag & E_ReplaceFlags.Note) > 0) replaceit = true;
else if (_MyItemInfo.IsStepPart && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true;
//else if (_MyItemInfo.IsInFirstLevelSubStep && (rs.Flag & E_ReplaceFlags.Substep) > 0) replaceit = true;
else if (_MyItemInfo.IsAccPages & (rs.Flag & E_ReplaceFlags.Attach) > 0) replaceit = true;
if (replaceit)
{
if (!dicReplaceRegex.ContainsKey(rs))
{
// CASEINSENS: Do ReplaceWords for all words that match, regardless of case, and replace with the ReplaceWith string as is
RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
string replaceWord = Regex.Replace(rs.ReplaceWord, @"[[\]\\()]", @"\$0");
string pat = @"(?<=\W|^)(?<!\\u160\?)" + replaceWord + @"(?!\\u160\?)(?=\W|$)";
dicReplaceRegex.Add(rs, new Regex(pat, myOptions));
}
try
{
myMatches.Add(dicReplaceRegex[rs], rs);
}
catch (Exception ex)
{
Console.WriteLine("{0},'{1}',{2},'{3}'", _MyItemInfo.ActiveFormat.Name, rs.ReplaceWord, ex.GetType().Name, ex.Message);
}
}
}
Text = myMatches.ReplaceMatches();
Text = Text.Replace(@"\xA0", @"\u160?"); //replace hard space
return Text;
}
static Regex regFindLink = new Regex(@"\<START\].*?\[END\>", RegexOptions.Singleline);
private string ReplaceWord(string text, string replace, string with, RegexOptions regexOptions)
{
MatchCollection myMatches = Regex.Matches(text, replace ,regexOptions);
MatchCollection myLinks = regFindLink.Matches(text);
for (int i = myMatches.Count - 1; i >= 0; i--)
{
Match myMatch = myMatches[i];
if(!PartOfLinkText(myMatch,myLinks))
text = text.Substring(0, myMatch.Index) + with + text.Substring(myMatch.Index + myMatch.Length);
}
return text;
}
private bool PartOfLinkText(Match myMatch, MatchCollection myLinks)
{
if (_MyItemInfo.ItemID == 152)
Console.Write("");
foreach (Match myLink in myLinks)
if (myMatch.Index > myLink.Index && myMatch.Index < (myLink.Index + myLink.Length))
return true;
return false;
}
#endregion #endregion
} }
#region displayTextElementClass #region displayTextElementClass
@ -1341,5 +1537,71 @@ namespace Volian.Controls.Library
} }
} }
#endregion #endregion
public class FoundMatches : SortedList<int, FoundMatch>
{
private string _Text;
public FoundMatches(string text)
: base()
{
_Text = text;
}
public void Add(Regex myRegEx, ReplaceStr myWord)
{
MatchCollection myMatches = myRegEx.Matches(_Text);
foreach (Match myMatch in myMatches)
Add(myMatch, myWord);
}
public void Add(Match myMatch, ReplaceStr myWord)
{
// If one already exists for this location, then don't add another.
if (ContainsKey(myMatch.Index)) return;
// Start by Adding it.
base.Add(myMatch.Index, new FoundMatch(myMatch, myWord));
// Now see what I can do with it.
int index = this.IndexOfKey(myMatch.Index);
if (index > 0) // If this match is contained within the previous match remove it
{
FoundMatch previousMatch = Values[index - 1];
if (previousMatch.MyMatch.Index + previousMatch.MyMatch.Length > myMatch.Index)
Remove(myMatch.Index);
} // If the next match is contained within this match, remove the next match
while (index < Count - 1 && Values[index + 1].MyMatch.Index < (myMatch.Index + myMatch.Length))
Remove(Values[index + 1].MyMatch.Index);
}
public string ReplaceMatches()
{
int offset = 0;
string text = _Text;
foreach (FoundMatch foundMatch in Values)
{
if (foundMatch.MyWord != null)
{
text = text.Substring(0, offset + foundMatch.MyMatch.Index) + foundMatch.MyWord.ReplaceWith + text.Substring(offset + foundMatch.MyMatch.Index + foundMatch.MyMatch.Length);
offset += foundMatch.MyWord.ReplaceWith.Length - foundMatch.MyMatch.Length;
}
}
return text;
}
}
public class FoundMatch
{
private Match _MyMatch;
public Match MyMatch
{
get { return _MyMatch; }
set { _MyMatch = value; }
}
private ReplaceStr _MyWord;
public ReplaceStr MyWord
{
get { return _MyWord; }
set { _MyWord = value; }
}
public FoundMatch(Match myMatch, ReplaceStr myWord)
{
_MyMatch = myMatch;
_MyWord = myWord;
}
}
} }

View File

@ -33,6 +33,8 @@ namespace Volian.Controls.Library
this.btnTranCancel = new DevComponents.DotNetBar.ButtonX(); this.btnTranCancel = new DevComponents.DotNetBar.ButtonX();
this.btnTranSave = new DevComponents.DotNetBar.ButtonX(); this.btnTranSave = new DevComponents.DotNetBar.ButtonX();
this.groupPanelTranFmt = new DevComponents.DotNetBar.Controls.GroupPanel(); this.groupPanelTranFmt = new DevComponents.DotNetBar.Controls.GroupPanel();
this.rbEntireSec = new System.Windows.Forms.RadioButton();
this.rbEntireProc = new System.Windows.Forms.RadioButton();
this.listBoxTranFmt = new System.Windows.Forms.ListBox(); this.listBoxTranFmt = new System.Windows.Forms.ListBox();
this.groupPanelTransitionSets = new DevComponents.DotNetBar.Controls.GroupPanel(); this.groupPanelTransitionSets = new DevComponents.DotNetBar.Controls.GroupPanel();
this.vlnTreeComboSets = new Volian.Controls.Library.vlnTreeCombo(); this.vlnTreeComboSets = new Volian.Controls.Library.vlnTreeCombo();
@ -66,7 +68,7 @@ namespace Volian.Controls.Library
this.groupPanelBtns.Location = new System.Drawing.Point(0, 0); this.groupPanelBtns.Location = new System.Drawing.Point(0, 0);
this.groupPanelBtns.Margin = new System.Windows.Forms.Padding(4); this.groupPanelBtns.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelBtns.Name = "groupPanelBtns"; this.groupPanelBtns.Name = "groupPanelBtns";
this.groupPanelBtns.Size = new System.Drawing.Size(501, 52); this.groupPanelBtns.Size = new System.Drawing.Size(501, 44);
// //
// //
// //
@ -92,10 +94,12 @@ namespace Volian.Controls.Library
// //
// //
this.groupPanelBtns.StyleMouseDown.Class = ""; this.groupPanelBtns.StyleMouseDown.Class = "";
this.groupPanelBtns.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
// //
// //
// //
this.groupPanelBtns.StyleMouseOver.Class = ""; this.groupPanelBtns.StyleMouseOver.Class = "";
this.groupPanelBtns.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelBtns.TabIndex = 25; this.groupPanelBtns.TabIndex = 25;
// //
// btnTranCancel // btnTranCancel
@ -134,12 +138,14 @@ namespace Volian.Controls.Library
// //
this.groupPanelTranFmt.CanvasColor = System.Drawing.SystemColors.Control; this.groupPanelTranFmt.CanvasColor = System.Drawing.SystemColors.Control;
this.groupPanelTranFmt.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; this.groupPanelTranFmt.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTranFmt.Controls.Add(this.rbEntireSec);
this.groupPanelTranFmt.Controls.Add(this.rbEntireProc);
this.groupPanelTranFmt.Controls.Add(this.listBoxTranFmt); this.groupPanelTranFmt.Controls.Add(this.listBoxTranFmt);
this.groupPanelTranFmt.Dock = System.Windows.Forms.DockStyle.Top; this.groupPanelTranFmt.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelTranFmt.Location = new System.Drawing.Point(0, 52); this.groupPanelTranFmt.Location = new System.Drawing.Point(0, 44);
this.groupPanelTranFmt.Margin = new System.Windows.Forms.Padding(4); this.groupPanelTranFmt.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTranFmt.Name = "groupPanelTranFmt"; this.groupPanelTranFmt.Name = "groupPanelTranFmt";
this.groupPanelTranFmt.Size = new System.Drawing.Size(501, 138); this.groupPanelTranFmt.Size = new System.Drawing.Size(501, 182);
// //
// //
// //
@ -165,13 +171,39 @@ namespace Volian.Controls.Library
// //
// //
this.groupPanelTranFmt.StyleMouseDown.Class = ""; this.groupPanelTranFmt.StyleMouseDown.Class = "";
this.groupPanelTranFmt.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
// //
// //
// //
this.groupPanelTranFmt.StyleMouseOver.Class = ""; this.groupPanelTranFmt.StyleMouseOver.Class = "";
this.groupPanelTranFmt.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelTranFmt.TabIndex = 27; this.groupPanelTranFmt.TabIndex = 27;
this.groupPanelTranFmt.Text = "Select Format"; this.groupPanelTranFmt.Text = "Select Format";
// //
// rbEntireSec
//
this.rbEntireSec.AutoSize = true;
this.rbEntireSec.Dock = System.Windows.Forms.DockStyle.Right;
this.rbEntireSec.Location = new System.Drawing.Point(419, 116);
this.rbEntireSec.Name = "rbEntireSec";
this.rbEntireSec.Size = new System.Drawing.Size(76, 43);
this.rbEntireSec.TabIndex = 15;
this.rbEntireSec.TabStop = true;
this.rbEntireSec.Text = "Entire\r\nSection";
this.rbEntireSec.UseVisualStyleBackColor = true;
//
// rbEntireProc
//
this.rbEntireProc.AutoSize = true;
this.rbEntireProc.Dock = System.Windows.Forms.DockStyle.Left;
this.rbEntireProc.Location = new System.Drawing.Point(0, 116);
this.rbEntireProc.Name = "rbEntireProc";
this.rbEntireProc.Size = new System.Drawing.Size(95, 43);
this.rbEntireProc.TabIndex = 14;
this.rbEntireProc.TabStop = true;
this.rbEntireProc.Text = "Entire\r\nProcedure";
this.rbEntireProc.UseVisualStyleBackColor = true;
//
// listBoxTranFmt // listBoxTranFmt
// //
this.listBoxTranFmt.Dock = System.Windows.Forms.DockStyle.Top; this.listBoxTranFmt.Dock = System.Windows.Forms.DockStyle.Top;
@ -181,7 +213,7 @@ namespace Volian.Controls.Library
this.listBoxTranFmt.Location = new System.Drawing.Point(0, 0); this.listBoxTranFmt.Location = new System.Drawing.Point(0, 0);
this.listBoxTranFmt.Margin = new System.Windows.Forms.Padding(4); this.listBoxTranFmt.Margin = new System.Windows.Forms.Padding(4);
this.listBoxTranFmt.Name = "listBoxTranFmt"; this.listBoxTranFmt.Name = "listBoxTranFmt";
this.listBoxTranFmt.Size = new System.Drawing.Size(495, 100); this.listBoxTranFmt.Size = new System.Drawing.Size(495, 116);
this.superToolTipDispTran.SetSuperTooltip(this.listBoxTranFmt, new DevComponents.DotNetBar.SuperTooltipInfo("", "", resources.GetString("listBoxTranFmt.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); this.superToolTipDispTran.SetSuperTooltip(this.listBoxTranFmt, new DevComponents.DotNetBar.SuperTooltipInfo("", "", resources.GetString("listBoxTranFmt.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.listBoxTranFmt.TabIndex = 13; this.listBoxTranFmt.TabIndex = 13;
this.listBoxTranFmt.SelectedIndexChanged += new System.EventHandler(this.listBoxTranFmt_Click); this.listBoxTranFmt.SelectedIndexChanged += new System.EventHandler(this.listBoxTranFmt_Click);
@ -192,7 +224,7 @@ namespace Volian.Controls.Library
this.groupPanelTransitionSets.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; this.groupPanelTransitionSets.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTransitionSets.Controls.Add(this.vlnTreeComboSets); this.groupPanelTransitionSets.Controls.Add(this.vlnTreeComboSets);
this.groupPanelTransitionSets.Dock = System.Windows.Forms.DockStyle.Top; this.groupPanelTransitionSets.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelTransitionSets.Location = new System.Drawing.Point(0, 190); this.groupPanelTransitionSets.Location = new System.Drawing.Point(0, 226);
this.groupPanelTransitionSets.Margin = new System.Windows.Forms.Padding(4); this.groupPanelTransitionSets.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTransitionSets.Name = "groupPanelTransitionSets"; this.groupPanelTransitionSets.Name = "groupPanelTransitionSets";
this.groupPanelTransitionSets.Size = new System.Drawing.Size(501, 59); this.groupPanelTransitionSets.Size = new System.Drawing.Size(501, 59);
@ -221,10 +253,12 @@ namespace Volian.Controls.Library
// //
// //
this.groupPanelTransitionSets.StyleMouseDown.Class = ""; this.groupPanelTransitionSets.StyleMouseDown.Class = "";
this.groupPanelTransitionSets.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
// //
// //
// //
this.groupPanelTransitionSets.StyleMouseOver.Class = ""; this.groupPanelTransitionSets.StyleMouseOver.Class = "";
this.groupPanelTransitionSets.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelTransitionSets.TabIndex = 31; this.groupPanelTransitionSets.TabIndex = 31;
this.groupPanelTransitionSets.Text = "Select Procedure Set"; this.groupPanelTransitionSets.Text = "Select Procedure Set";
// //
@ -246,7 +280,7 @@ namespace Volian.Controls.Library
this.groupPanelTransitionProcs.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; this.groupPanelTransitionProcs.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTransitionProcs.Controls.Add(this.cbTranProcs); this.groupPanelTransitionProcs.Controls.Add(this.cbTranProcs);
this.groupPanelTransitionProcs.Dock = System.Windows.Forms.DockStyle.Top; this.groupPanelTransitionProcs.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelTransitionProcs.Location = new System.Drawing.Point(0, 249); this.groupPanelTransitionProcs.Location = new System.Drawing.Point(0, 285);
this.groupPanelTransitionProcs.Margin = new System.Windows.Forms.Padding(4); this.groupPanelTransitionProcs.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTransitionProcs.Name = "groupPanelTransitionProcs"; this.groupPanelTransitionProcs.Name = "groupPanelTransitionProcs";
this.groupPanelTransitionProcs.Size = new System.Drawing.Size(501, 57); this.groupPanelTransitionProcs.Size = new System.Drawing.Size(501, 57);
@ -275,10 +309,12 @@ namespace Volian.Controls.Library
// //
// //
this.groupPanelTransitionProcs.StyleMouseDown.Class = ""; this.groupPanelTransitionProcs.StyleMouseDown.Class = "";
this.groupPanelTransitionProcs.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
// //
// //
// //
this.groupPanelTransitionProcs.StyleMouseOver.Class = ""; this.groupPanelTransitionProcs.StyleMouseOver.Class = "";
this.groupPanelTransitionProcs.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelTransitionProcs.TabIndex = 32; this.groupPanelTransitionProcs.TabIndex = 32;
this.groupPanelTransitionProcs.Text = "Select Procedure"; this.groupPanelTransitionProcs.Text = "Select Procedure";
// //
@ -300,7 +336,7 @@ namespace Volian.Controls.Library
this.groupPanelTransitionSect.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; this.groupPanelTransitionSect.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTransitionSect.Controls.Add(this.cbTranSects); this.groupPanelTransitionSect.Controls.Add(this.cbTranSects);
this.groupPanelTransitionSect.Dock = System.Windows.Forms.DockStyle.Top; this.groupPanelTransitionSect.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanelTransitionSect.Location = new System.Drawing.Point(0, 306); this.groupPanelTransitionSect.Location = new System.Drawing.Point(0, 342);
this.groupPanelTransitionSect.Margin = new System.Windows.Forms.Padding(4); this.groupPanelTransitionSect.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTransitionSect.Name = "groupPanelTransitionSect"; this.groupPanelTransitionSect.Name = "groupPanelTransitionSect";
this.groupPanelTransitionSect.Size = new System.Drawing.Size(501, 60); this.groupPanelTransitionSect.Size = new System.Drawing.Size(501, 60);
@ -329,10 +365,12 @@ namespace Volian.Controls.Library
// //
// //
this.groupPanelTransitionSect.StyleMouseDown.Class = ""; this.groupPanelTransitionSect.StyleMouseDown.Class = "";
this.groupPanelTransitionSect.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
// //
// //
// //
this.groupPanelTransitionSect.StyleMouseOver.Class = ""; this.groupPanelTransitionSect.StyleMouseOver.Class = "";
this.groupPanelTransitionSect.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelTransitionSect.TabIndex = 33; this.groupPanelTransitionSect.TabIndex = 33;
this.groupPanelTransitionSect.Text = "Select Section"; this.groupPanelTransitionSect.Text = "Select Section";
// //
@ -356,10 +394,10 @@ namespace Volian.Controls.Library
this.groupPanelTranstionSteps.Controls.Add(this.tvTran); this.groupPanelTranstionSteps.Controls.Add(this.tvTran);
this.groupPanelTranstionSteps.Controls.Add(this.pnlTranStepBtns); this.groupPanelTranstionSteps.Controls.Add(this.pnlTranStepBtns);
this.groupPanelTranstionSteps.Dock = System.Windows.Forms.DockStyle.Fill; this.groupPanelTranstionSteps.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupPanelTranstionSteps.Location = new System.Drawing.Point(0, 366); this.groupPanelTranstionSteps.Location = new System.Drawing.Point(0, 402);
this.groupPanelTranstionSteps.Margin = new System.Windows.Forms.Padding(4); this.groupPanelTranstionSteps.Margin = new System.Windows.Forms.Padding(4);
this.groupPanelTranstionSteps.Name = "groupPanelTranstionSteps"; this.groupPanelTranstionSteps.Name = "groupPanelTranstionSteps";
this.groupPanelTranstionSteps.Size = new System.Drawing.Size(501, 466); this.groupPanelTranstionSteps.Size = new System.Drawing.Size(501, 430);
// //
// //
// //
@ -385,10 +423,12 @@ namespace Volian.Controls.Library
// //
// //
this.groupPanelTranstionSteps.StyleMouseDown.Class = ""; this.groupPanelTranstionSteps.StyleMouseDown.Class = "";
this.groupPanelTranstionSteps.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
// //
// //
// //
this.groupPanelTranstionSteps.StyleMouseOver.Class = ""; this.groupPanelTranstionSteps.StyleMouseOver.Class = "";
this.groupPanelTranstionSteps.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelTranstionSteps.TabIndex = 34; this.groupPanelTranstionSteps.TabIndex = 34;
this.groupPanelTranstionSteps.Text = "Select Step"; this.groupPanelTranstionSteps.Text = "Select Step";
// //
@ -399,7 +439,7 @@ namespace Volian.Controls.Library
this.tvTran.Location = new System.Drawing.Point(0, 57); this.tvTran.Location = new System.Drawing.Point(0, 57);
this.tvTran.Margin = new System.Windows.Forms.Padding(4); this.tvTran.Margin = new System.Windows.Forms.Padding(4);
this.tvTran.Name = "tvTran"; this.tvTran.Name = "tvTran";
this.tvTran.Size = new System.Drawing.Size(495, 386); this.tvTran.Size = new System.Drawing.Size(495, 350);
this.superToolTipDispTran.SetSuperTooltip(this.tvTran, new DevComponents.DotNetBar.SuperTooltipInfo("", "", resources.GetString("tvTran.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); this.superToolTipDispTran.SetSuperTooltip(this.tvTran, new DevComponents.DotNetBar.SuperTooltipInfo("", "", resources.GetString("tvTran.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.tvTran.TabIndex = 31; this.tvTran.TabIndex = 31;
this.tvTran.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvTran_AfterSelect); this.tvTran.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvTran_AfterSelect);
@ -422,6 +462,7 @@ namespace Volian.Controls.Library
// //
// //
this.lblxTranRangeTip.BackgroundStyle.Class = ""; this.lblxTranRangeTip.BackgroundStyle.Class = "";
this.lblxTranRangeTip.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lblxTranRangeTip.Dock = System.Windows.Forms.DockStyle.Right; this.lblxTranRangeTip.Dock = System.Windows.Forms.DockStyle.Right;
this.lblxTranRangeTip.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblxTranRangeTip.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblxTranRangeTip.Location = new System.Drawing.Point(355, 0); this.lblxTranRangeTip.Location = new System.Drawing.Point(355, 0);
@ -482,6 +523,7 @@ namespace Volian.Controls.Library
this.groupPanelBtns.ResumeLayout(false); this.groupPanelBtns.ResumeLayout(false);
this.groupPanelBtns.PerformLayout(); this.groupPanelBtns.PerformLayout();
this.groupPanelTranFmt.ResumeLayout(false); this.groupPanelTranFmt.ResumeLayout(false);
this.groupPanelTranFmt.PerformLayout();
this.groupPanelTransitionSets.ResumeLayout(false); this.groupPanelTransitionSets.ResumeLayout(false);
this.groupPanelTransitionProcs.ResumeLayout(false); this.groupPanelTransitionProcs.ResumeLayout(false);
this.groupPanelTransitionSect.ResumeLayout(false); this.groupPanelTransitionSect.ResumeLayout(false);
@ -511,5 +553,7 @@ namespace Volian.Controls.Library
private DevComponents.DotNetBar.LabelX lblxTranRangeTip; private DevComponents.DotNetBar.LabelX lblxTranRangeTip;
private vlnTreeView3 tvTran; private vlnTreeView3 tvTran;
private DevComponents.DotNetBar.SuperTooltip superToolTipDispTran; private DevComponents.DotNetBar.SuperTooltip superToolTipDispTran;
private System.Windows.Forms.RadioButton rbEntireSec;
private System.Windows.Forms.RadioButton rbEntireProc;
} }
} }

View File

@ -783,15 +783,24 @@ namespace Volian.Controls.Library
return; return;
} }
toItem = (ItemInfo)_RangeNode1.VEObject; toItem = (ItemInfo)_RangeNode1.VEObject;
// Get the second item in the range, based on current tree view selection. // If this is Transition type 2, then make 'rangenode2' same as rangenode1
if (_RangeNode2 == null && tvTran.SelectedNode == null) // This will get resolved when transition text is resolved. This case represents
// range from rangenode1 to last sibling. Otherwise, get the second item in the
// range, based on current tree view selection.
if (listBoxTranFmt.SelectedIndex == 2)
{ {
MessageBox.Show("Must 'Select Step' for range transition 'to'"); rangeItem = toItem;
return; }
else
{
if (_RangeNode2 == null && tvTran.SelectedNode == null)
{
MessageBox.Show("Must 'Select Step' for range transition 'to'");
return;
}
if (_RangeNode2 == null) _RangeNode2 = (VETreeNode)tvTran.SelectedNode;
rangeItem = (ItemInfo)_RangeNode2.VEObject;
} }
if (_RangeNode2 == null) _RangeNode2 = (VETreeNode)tvTran.SelectedNode;
rangeItem = (ItemInfo)_RangeNode2.VEObject;
// Check that the two items are of the below the section type. // Check that the two items are of the below the section type.
if (toItem.MyContent.Type < 20000 || rangeItem.MyContent.Type < 20000) if (toItem.MyContent.Type < 20000 || rangeItem.MyContent.Type < 20000)
{ {

View File

@ -119,21 +119,7 @@ namespace Volian.Controls.Library
set set
{ {
_MyItemInfo = value; _MyItemInfo = value;
int typ = (int)value.MyContent.Type; SetToolTip(_MyItemInfo.ToolTip);
int subType = typ % 10000;
if (MyItemInfo.IsStep)
{
_MyStepData = value.ActiveFormat.PlantFormat.FormatData.StepDataList[subType];
SetToolTip(_MyStepData.Type);
}
else if (MyItemInfo.IsSection)
{
SetToolTip(value.ActiveFormat.PlantFormat.DocStyles.DocStyleList[subType].Name);
}
else if (MyItemInfo.IsProcedure)
{
SetToolTip("Procedure Title");
}
ChangeBar = _MyItemInfo.HasChangeBar(); ChangeBar = _MyItemInfo.HasChangeBar();
value.MyContent.Changed += new ContentInfoEvent(MyContent_Changed); value.MyContent.Changed += new ContentInfoEvent(MyContent_Changed);
} }
@ -795,7 +781,7 @@ namespace Volian.Controls.Library
if (itemInfo != null) if (itemInfo != null)
{ {
//// TIMING: DisplayItem.TimeIt("CSLARTB before _Layout"); //// TIMING: DisplayItem.TimeIt("CSLARTB before _Layout");
_MyStepSectionLayoutData = itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData; _MyStepSectionLayoutData = itemInfo.ActiveFormat.MyStepSectionLayoutData;
//// TIMING: DisplayItem.TimeIt("CSLARTB _Layout"); //// TIMING: DisplayItem.TimeIt("CSLARTB _Layout");
if (myParentStepItem != null) if (myParentStepItem != null)
SeqLevel = myParentStepItem.SeqLevel + ((myChildRelation == ChildRelation.After || myChildRelation == ChildRelation.Before) && itemInfo.IsSequential ? 1 : 0); SeqLevel = myParentStepItem.SeqLevel + ((myChildRelation == ChildRelation.After || myChildRelation == ChildRelation.Before) && itemInfo.IsSequential ? 1 : 0);
@ -905,7 +891,7 @@ namespace Volian.Controls.Library
} }
void _MyStepRTB_Resize(object sender, EventArgs e) void _MyStepRTB_Resize(object sender, EventArgs e)
{ {
Console.WriteLine("Left {0} Width {1}", Left, Width); // Console.WriteLine("Left {0} Width {1}", Left, Width);
} }
private Label lblHeader = null; private Label lblHeader = null;

View File

@ -20,7 +20,6 @@ namespace Volian.Controls.Library
/// </summary> /// </summary>
private ItemInfo _MyProcedureItemInfo; private ItemInfo _MyProcedureItemInfo;
// TODO: This is not correct. There should be a dictionary of Section Layouts // TODO: This is not correct. There should be a dictionary of Section Layouts
private StepSectionLayoutData _MyStepSectionLayoutData;
/// <summary> /// <summary>
/// Lookup Table to convert ItemInfo.ItemID to StepItem /// Lookup Table to convert ItemInfo.ItemID to StepItem
/// </summary> /// </summary>
@ -304,8 +303,6 @@ namespace Volian.Controls.Library
{ {
//// TIMING: DisplayItem.TimeIt("pMyItem Start"); //// TIMING: DisplayItem.TimeIt("pMyItem Start");
_MyProcedureItemInfo = value; _MyProcedureItemInfo = value;
if(value != null)
_MyStepSectionLayoutData = _MyProcedureItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData;
//// TIMING: DisplayItem.TimeIt("pMyItem Layout"); //// TIMING: DisplayItem.TimeIt("pMyItem Layout");
//this.Layout += new LayoutEventHandler(DisplayPanel_Layout); //this.Layout += new LayoutEventHandler(DisplayPanel_Layout);
//this.Scroll += new ScrollEventHandler(DisplayPanel_Scroll); //this.Scroll += new ScrollEventHandler(DisplayPanel_Scroll);

View File

@ -372,8 +372,8 @@ namespace Volian.Print.Library
iTextSharp.text.pdf.PdfWriter writer = cb.PdfWriter; iTextSharp.text.pdf.PdfWriter writer = cb.PdfWriter;
ItemInfo myItemInfo = section as ItemInfo; ItemInfo myItemInfo = section as ItemInfo;
// 792: 72 * 11 inches - TopRow - Top is high value // 792: 72 * 11 inches - TopRow - Top is high value
float _TwipsPerPage = 792; float _PointsPerPage = 792;
float yTopMargin = _TwipsPerPage - (float)myItemInfo.MyDocStyle.Layout.TopRow; float yTopMargin = _PointsPerPage - (float)myItemInfo.MyDocStyle.Layout.TopRow;
float yBottomMargin = yTopMargin - (float)myItemInfo.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch; float yBottomMargin = yTopMargin - (float)myItemInfo.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch;
vlnParagraph.Prefix = myItemInfo.Path; vlnParagraph.Prefix = myItemInfo.Path;
Rtf2Pdf.PdfDebug = true; Rtf2Pdf.PdfDebug = true;

View File

@ -214,9 +214,11 @@ namespace Volian.Print.Library
if (visualText.Format.IsUnderline) if (visualText.Format.IsUnderline)
chk.SetUnderline(font.Color, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size chk.SetUnderline(font.Color, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size
if (visualText.Format.SuperScript > 0) if (visualText.Format.SuperScript > 0)
chk.SetTextRise(.45F * chk.Font.Size); chk.SetTextRise(.25F * chk.Font.Size);
else if (visualText.Format.SuperScript < 0) else if (visualText.Format.SuperScript < 0)
chk.SetTextRise(-.25F * chk.Font.Size); chk.SetTextRise(-.25F * chk.Font.Size);
else
chk.SetTextRise(0);
if (_MyFont == null) if (_MyFont == null)
{ {

View File

@ -84,6 +84,43 @@ namespace Volian.Print.Library
base.OnEndPage(writer, document); base.OnEndPage(writer, document);
DrawChangeBars(writer.DirectContent); DrawChangeBars(writer.DirectContent);
DrawMessages(writer.DirectContent); DrawMessages(writer.DirectContent);
DrawRuler(writer.DirectContent);
}
private void DrawRuler(PdfContentByte cb)
{
if (DebugLayer == null) return;
cb.SaveState();
cb.BeginLayer(DebugLayer);
float x = (cb.PdfWriter.PageSize.Left + cb.PdfWriter.PageSize.Right) / 2;
cb.SetLineWidth(.1F);
cb.SetColorStroke(new Color(System.Drawing.Color.CornflowerBlue));
float yTop = 648;
float yBottom = 48;
cb.MoveTo(x, yTop);
cb.LineTo(x, yBottom);
int i = 0;
for (float y = yTop; y >= yBottom; y -= 12)
{
float w = 10;
if (i % 10 == 0) w = 30;
else if (i % 5 == 0) w = 20;
i++;
cb.MoveTo(x - w, y);
cb.LineTo(x, y);
}
i = 0;
for (float y = yTop; y >= yBottom; y -= 10.1F)
{
float w = 10;
if (i % 10 == 0) w = 30;
else if (i % 5 == 0) w = 20;
i++;
cb.MoveTo(x + w, y-1);
cb.LineTo(x, y-1);
}
cb.Stroke();
cb.EndLayer();
cb.RestoreState();
} }
private void AddBookmarks(PdfWriter writer) private void AddBookmarks(PdfWriter writer)
{ {

View File

@ -99,6 +99,10 @@ namespace Volian.Print.Library
} }
public partial class vlnParagraph : vlnPrintObject public partial class vlnParagraph : vlnPrintObject
{ {
/// <summary>
/// This variable is used to match 16 bit pagaination
/// </summary>
private bool _Match16BitPagination = false;
public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{ {
if (Processed) return yPageStart; if (Processed) return yPageStart;
@ -137,6 +141,9 @@ namespace Volian.Print.Library
private float DrawText(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) private float DrawText(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation)
{ {
if (_TextDebug)
Console.WriteLine("{0},{1},'{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText);
//Console.WriteLine("{0},{1},'{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, IParagraph.Content);
float retval = yLocation; float retval = yLocation;
if (MyItemInfo.FormatStepData.CenterOneLineOnly && MyItemInfo.MyPrevious == null && MyItemInfo.NextItem == null && Height<(1.01F*IParagraph.Leading)) if (MyItemInfo.FormatStepData.CenterOneLineOnly && MyItemInfo.MyPrevious == null && MyItemInfo.NextItem == null && Height<(1.01F*IParagraph.Leading))
IParagraph.Alignment = Element.ALIGN_CENTER; IParagraph.Alignment = Element.ALIGN_CENTER;
@ -147,12 +154,78 @@ namespace Volian.Print.Library
yPageStart = yTopMargin + YVeryTop; yPageStart = yTopMargin + YVeryTop;
yLocation = yPageStart - YOffset; yLocation = yPageStart - YOffset;
//MyItemInfo.ItemID, YSize, yPageSize, yLocation //MyItemInfo.ItemID, YSize, yPageSize, yLocation
Console.WriteLine("-1,'Yes','Forced Pagination',{0},{1},,{3},{4}", MyItemInfo.ItemID, YSize, 0, yLocation, MyItemInfo.DBSequence); if(_PaginationDebug) Console.WriteLine("-1,'Yes','Forced Pagination',{0},{1},,{3},{4}", MyItemInfo.ItemID, YSize, 0, yLocation, MyItemInfo.DBSequence);
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugText, yBottomMargin); retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugText, yBottomMargin);
} }
return retval; return retval;
} }
private static List<string> myAttributes =new List<string>();
private static void AddAttribute(string attr)
{
if (myAttributes.Contains(attr))
return;
//Console.WriteLine("Attribute = \"{0}\"", attr);
myAttributes.Add(attr);
}
private void CheckAttributes(System.Collections.Hashtable attributes)
{
foreach (string attr in attributes.Keys)
{
AddAttribute(attr);
}
}
private string FormattedText
{
get
{
bool subscript = false;
//if (_MyItemInfo.ItemID == 467)
// Console.Write("");
StringBuilder sb = new StringBuilder();
//if (IParagraph.Chunks.Count > 1)
// Console.WriteLine("{0} Chunks", IParagraph.Chunks.Count);
foreach (Chunk chk in IParagraph.Chunks)
{
string prefix = "";
string suffix = "";
CheckAttributes(chk.Attributes);
if (chk.Font.BaseFont != null && chk.Font.BaseFont.PostscriptFontName.ToUpper().Contains("BOLD"))
{
prefix += "\xD5";
suffix = "\xD6" + suffix;
}
if (chk.Attributes.ContainsKey("SUBSUPSCRIPT"))
{
float sup = (float)(chk.Attributes["SUBSUPSCRIPT"]);
if (sup > 0)
{
prefix += "\xA6";
suffix = "\xD1" + suffix;
}
else if (sup < 0)
{
prefix += "\xD1";
suffix = "\xA6" + suffix;
}
}
if (chk.Attributes.ContainsKey("UNDERLINE"))
{
prefix += "\x16";
suffix = "\x16" + suffix; ;
}
sb.Append(prefix + chk.Content + suffix);
}
string retval = sb.ToString();
retval = retval.Replace("\xD1\xA6", "");// Remove Multiple Superscript commands in a row
retval = retval.Replace("\xA6\xD1", "");// Remove Multiple Superscript commands in a row
retval = retval.Replace("\xD6\xD5", "");
retval = retval.Replace("\xD6\x16\xD5", "\x16");
return retval;
}
}
private bool _PaginationDebug = false;
private bool _TextDebug = true; // false;
private float DrawFigure(PdfContentByte cb, float yBottomMargin, float yLocation) private float DrawFigure(PdfContentByte cb, float yBottomMargin, float yLocation)
{ {
float retval = yLocation; float retval = yLocation;
@ -288,8 +361,11 @@ namespace Volian.Print.Library
ItemInfo parent = item.ActiveParent as ItemInfo; ItemInfo parent = item.ActiveParent as ItemInfo;
//if (para.MyItemInfo.ItemID == 205) //if (para.MyItemInfo.ItemID == 205)
// Console.Write(""); // Console.Write("");
Console.WriteLine("'StepLevel',{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", YVeryTop - yTopMost, YSize, YBottomMost-yTopMost, item.ItemID, item.DBSequence, item.StepLevel, item.MyContent.Type % 10000, if (_PaginationDebug)
{
Console.WriteLine("'StepLevel',{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", YVeryTop - yTopMost, YSize, YBottomMost - yTopMost, item.ItemID, item.DBSequence, item.StepLevel, item.MyContent.Type % 10000,
parent.MyContent.Type % 10000, item.HasCautionOrNote ? 1 : 0, parent.Cautions == null ? 0 : 1); parent.MyContent.Type % 10000, item.HasCautionOrNote ? 1 : 0, parent.Cautions == null ? 0 : 1);
}
} }
private float _YVeryTop = -1; private float _YVeryTop = -1;
public float YVeryTop public float YVeryTop
@ -336,6 +412,9 @@ namespace Volian.Print.Library
if (!MyItemInfo.IsHigh) return 0; // Don't Paginate on a Substep level if (!MyItemInfo.IsHigh) return 0; // Don't Paginate on a Substep level
bool ManualPageBreak = (MyItemInfo.MyConfig as StepConfig).Step_ManualPagebreak; bool ManualPageBreak = (MyItemInfo.MyConfig as StepConfig).Step_ManualPagebreak;
float mySize = YSize * MyPageHelper.YMultiplier; float mySize = YSize * MyPageHelper.YMultiplier;
if (_Match16BitPagination) mySize = YSize;
float ySize7LPI = YSize + SixLinesPerInch;
if (_Match16BitPagination) ySize7LPI += SixLinesPerInch;
string firstStep = "No"; string firstStep = "No";
if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null) if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null)
firstStep = "Yes"; firstStep = "Yes";
@ -352,16 +431,18 @@ namespace Volian.Print.Library
ShowPageBreak(5, "HLS will fit on 1 Page at 6 LPI", "Yes", YSize, yPageSize, yWithinMargins); ShowPageBreak(5, "HLS will fit on 1 Page at 6 LPI", "Yes", YSize, yPageSize, yWithinMargins);
return 1; return 1;
} }
else if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CompressSteps && (YSize + SixLinesPerInch) < (yPageSize * SixLinesPerInch / _SevenLinesPerInch)) else if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CompressSteps && (ySize7LPI) < (yPageSize * SixLinesPerInch / _SevenLinesPerInch))
{ {
//Console.WriteLine("'PageBreak',3,'Yes','HLS will fit on 1 Page at 7 LPI',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath); //Console.WriteLine("'PageBreak',3,'Yes','HLS will fit on 1 Page at 7 LPI',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
ShowPageBreak(7, "HLS will fit on 1 Page at 7 LPI", "Yes", YSize, yPageSize, yWithinMargins); ShowPageBreak(7, "HLS will fit on 1 Page at 7 LPI", "Yes", YSize, yPageSize, yWithinMargins);
//Console.WriteLine("'7LPI',{0},{1}", MyItemInfo.DBSequence, YSize);
return 3; // High Level Step can fit at SevenLinesPerInch return 3; // High Level Step can fit at SevenLinesPerInch
} }
else // The entire step cannot fit on a blank page. else // The entire step cannot fit on a blank page.
{ {
// if there is more than half a page left, then start to print on the current page // if there is more than half a page left, then start to print on the current page
float myFirstPieceSize = GetFirstPieceSize(); //Case 0 float myFirstPieceSize = GetFirstPieceSize(); //Case 0
if (_Match16BitPagination) myFirstPieceSize += 2 * SixLinesPerInch;
// TODO: Put this line back to case 0, i.e. previous line. This fixes a 16-bit vs 32-bit pagination diff in EO30 Step 20. // TODO: Put this line back to case 0, i.e. previous line. This fixes a 16-bit vs 32-bit pagination diff in EO30 Step 20.
//float myFirstPieceSize = GetFirstPieceSize() + 2 * SixLinesPerInch; //Case 10 - this is to match 16bit //float myFirstPieceSize = GetFirstPieceSize() + 2 * SixLinesPerInch; //Case 10 - this is to match 16bit
if (!ManualPageBreak && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.SpecialPageBreakFlag && yWithinMargins > yPageSize / 2 && if (!ManualPageBreak && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.SpecialPageBreakFlag && yWithinMargins > yPageSize / 2 &&
@ -440,8 +521,9 @@ namespace Volian.Print.Library
} }
private void ShowPageBreak(int instance, string message, string breakOrNot, float YSize, float yPageSize, float yWithinMargins) private void ShowPageBreak(int instance, string message, string breakOrNot, float YSize, float yPageSize, float yWithinMargins)
{ {
if (breakOrNot == "Yes") if(_PaginationDebug)
Console.WriteLine("{0}", MyItemInfo.DBSequence); //,instance); if (breakOrNot == "Yes")
Console.WriteLine("{0}", MyItemInfo.DBSequence); //,instance);
// Console.WriteLine("{0},{1}", MyItemInfo.DBSequence, IsFirstSubStep(MyItemInfo)); //,instance); // Console.WriteLine("{0},{1}", MyItemInfo.DBSequence, IsFirstSubStep(MyItemInfo)); //,instance);
// Console.WriteLine("{0},'{1}','{2}',{3},{4},{5},{6},{7},'{8}'", instance, message, breakOrNot, // Console.WriteLine("{0},'{1}','{2}',{3},{4},{5},{6},{7},'{8}'", instance, message, breakOrNot,
// MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.DBSequence); // MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.DBSequence);
@ -458,10 +540,12 @@ namespace Volian.Print.Library
//Console.WriteLine("'yStart',{0},{1}", MyItemInfo.DBSequence, yStart); //Console.WriteLine("'yStart',{0},{1}", MyItemInfo.DBSequence, yStart);
// The following three lines make page breaking match 16-bit: // The following three lines make page breaking match 16-bit:
//yLowerLimit = yStart - SixLinesPerInch + ySpaceOnCurPage / 2; if (_Match16BitPagination)
//if ((yStart + MyItemInfo.MyDocStyle.Layout.TopRow + 2 * SixLinesPerInch)>((MyItemInfo.MyDocStyle.Layout.TopRow+yPageSize-2*SixLinesPerInch)/2)) {
// yLowerLimit = yStart + 2 * SixLinesPerInch; yLowerLimit = yStart - SixLinesPerInch + ySpaceOnCurPage / 2;
if ((yStart + MyItemInfo.MyDocStyle.Layout.TopRow + 2 * SixLinesPerInch) > ((MyItemInfo.MyDocStyle.Layout.TopRow + yPageSize - 2 * SixLinesPerInch) / 2))
yLowerLimit = yStart + 2 * SixLinesPerInch;
}
// Make sure that the FirstPiece (Caution Note HLS and First Substeps) fit // Make sure that the FirstPiece (Caution Note HLS and First Substeps) fit
float myFirstPieceSize = GetFirstPieceSize(); //Case 0 float myFirstPieceSize = GetFirstPieceSize(); //Case 0
if (myFirstPieceSize < ySpaceOnCurPage) yLowerLimit = Math.Max(myFirstPieceSize + yStart, yLowerLimit); if (myFirstPieceSize < ySpaceOnCurPage) yLowerLimit = Math.Max(myFirstPieceSize + yStart, yLowerLimit);
@ -475,6 +559,7 @@ namespace Volian.Print.Library
MyPageHelper.ParaBreaks.Add(paraBreak); MyPageHelper.ParaBreaks.Add(paraBreak);
ySpaceOnCurPage = yPageSize - 2 * SixLinesPerInch; // Allow for continue message and blank line. ySpaceOnCurPage = yPageSize - 2 * SixLinesPerInch; // Allow for continue message and blank line.
yLowerLimit = ySpaceOnCurPage / 2; yLowerLimit = ySpaceOnCurPage / 2;
if(_Match16BitPagination)yLowerLimit -= 1.5F * SixLinesPerInch; // 276 for HLP
yStart = 0; yStart = 0;
} }
} }
@ -541,7 +626,7 @@ namespace Volian.Print.Library
{ {
//ItemInfo prev = myList[stepLevel][yLocation].MyItemInfo.MyPrevious; //ItemInfo prev = myList[stepLevel][yLocation].MyItemInfo.MyPrevious;
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 5609) Console.WriteLine("aer"); //if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 5609) Console.WriteLine("aer");
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 5613) Console.WriteLine("rno"); //if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 4312) Console.WriteLine("rno");
// The top of this step is more than 1/2 way down the page // The top of this step is more than 1/2 way down the page
if ((-yLocation + yStart) >= yLowerLimit) if ((-yLocation + yStart) >= yLowerLimit)
{ {
@ -595,7 +680,7 @@ namespace Volian.Print.Library
MyTopRNO = this; MyTopRNO = this;
else else
MyTopRNO = MyParent.MyTopRNO; MyTopRNO = MyParent.MyTopRNO;
MyTopRNO.LastRNO = this; if(MyTopRNO != null) MyTopRNO.LastRNO = this;
} }
MyContentByte = cb; MyContentByte = cb;
MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this); MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this);
@ -749,8 +834,6 @@ namespace Volian.Print.Library
private string cbMess = null; private string cbMess = null;
private vlnChangeBar DoChangeBar(PdfContentByte cb, ItemInfo itemInfo, VlnSvgPageHelper myPageHelper, float xoff, float yoff, int maxRNO, FormatInfo formatInfo) //, vlnChangeBar myCB) private vlnChangeBar DoChangeBar(PdfContentByte cb, ItemInfo itemInfo, VlnSvgPageHelper myPageHelper, float xoff, float yoff, int maxRNO, FormatInfo formatInfo) //, vlnChangeBar myCB)
{ {
if (myPageHelper.ChangeBarDefinition.MyChangeBarType == PrintChangeBar.Without) return null;
// find column for the change bar based on format flags - this is code from 16-bit // find column for the change bar based on format flags - this is code from 16-bit
// if AbsoluteFixedChangeColumn // if AbsoluteFixedChangeColumn
// if FixedAERChangeColumn // if FixedAERChangeColumn