- 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)
{
// 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
if (ROsShouldBeAdjusted)
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:
if (colorLinks)
text = DoColorLinks(text);
@@ -196,7 +199,6 @@ namespace Volian.Controls.Library
}
return text;
}
private static string DoColorLinks(string text)
{
text = Regex.Replace(text, @"(<START\](\\[^v \\]+)*\\v0)((?= |\\))", @"$1\cf1");
@@ -212,7 +214,13 @@ namespace Volian.Controls.Library
}
private int NextUnicode(string text, int offset)
{
// Skip Hard Spaces
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)
return m.Index + offset;
return -1;
@@ -231,14 +239,73 @@ namespace Volian.Controls.Library
string beforeRO = StaticStripRtfCommands(text.Substring(0, g.Index));
string afterRO = StaticStripRtfCommands(text.Substring(g.Index + g.Length));
string newvalue = DoROFormatFlags(g.ToString(), beforeRO, afterRO);
newvalue = newvalue.Replace(" ", @"\u160?");
newvalue = ReplaceSpaceWithHardspace(newvalue);
if (g.ToString() != newvalue)
text = text.Substring(0, g.Index) + newvalue + text.Substring(g.Index + g.Length);
}
}
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)
{
if (text.IndexOf(@".E") < 0) return text;
@@ -1005,8 +1072,11 @@ namespace Volian.Controls.Library
private string DoROFormatFlags(string roText, string beforeRO, string afterRO)
{
string rtnstr = roText;
beforeRO = Regex.Replace(beforeRO, @"(\\[^v \\]+)*\\v(\\[^v \\]+)* .*?\\v0(\\[^v \\]+)*( |$)", "");
afterRO = Regex.Replace(afterRO, @"(\\[^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
// 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
if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.UnderlineRo)
@@ -1025,7 +1095,7 @@ namespace Volian.Controls.Library
// Caps ROs anywhere if no lower case text follows
// 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 indx2 = endLinkText + 1;
@@ -1095,11 +1165,24 @@ namespace Volian.Controls.Library
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)
{
// Uppercase Units
rtnstr = _RegExUppercaseROUnits.Replace(rtnstr, new MatchEvaluator(MatchEvaluatorUppercaseROUnits));
// 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
@@ -1197,7 +1280,8 @@ namespace Volian.Controls.Library
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.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;
if (replaceit)
@@ -1230,7 +1314,8 @@ namespace Volian.Controls.Library
string pat = @"(?<=\W|^)(?<![\\u160?])" + replaceWord + @"(?![\\u160?])(?=\W|$)";
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)
{
@@ -1259,7 +1344,8 @@ namespace Volian.Controls.Library
string pat = @"(?<=\W|^)(?<![\\u160?])" + replaceWord + @"(?![\\u160?])(?=\W|$)";
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)
{
@@ -1274,6 +1360,116 @@ namespace Volian.Controls.Library
//Console.WriteLine("--- After '{0}'", 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
}
#region displayTextElementClass
@@ -1341,5 +1537,71 @@ namespace Volian.Controls.Library
}
}
#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.btnTranSave = new DevComponents.DotNetBar.ButtonX();
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.groupPanelTransitionSets = new DevComponents.DotNetBar.Controls.GroupPanel();
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.Margin = new System.Windows.Forms.Padding(4);
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.CornerType = DevComponents.DotNetBar.eCornerType.Square;
//
//
//
this.groupPanelBtns.StyleMouseOver.Class = "";
this.groupPanelBtns.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelBtns.TabIndex = 25;
//
// btnTranCancel
@@ -134,12 +138,14 @@ namespace Volian.Controls.Library
//
this.groupPanelTranFmt.CanvasColor = System.Drawing.SystemColors.Control;
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.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.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.CornerType = DevComponents.DotNetBar.eCornerType.Square;
//
//
//
this.groupPanelTranFmt.StyleMouseOver.Class = "";
this.groupPanelTranFmt.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelTranFmt.TabIndex = 27;
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
//
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.Margin = new System.Windows.Forms.Padding(4);
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.listBoxTranFmt.TabIndex = 13;
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.Controls.Add(this.vlnTreeComboSets);
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.Name = "groupPanelTransitionSets";
this.groupPanelTransitionSets.Size = new System.Drawing.Size(501, 59);
@@ -221,10 +253,12 @@ namespace Volian.Controls.Library
//
//
this.groupPanelTransitionSets.StyleMouseDown.Class = "";
this.groupPanelTransitionSets.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
//
//
//
this.groupPanelTransitionSets.StyleMouseOver.Class = "";
this.groupPanelTransitionSets.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelTransitionSets.TabIndex = 31;
this.groupPanelTransitionSets.Text = "Select Procedure Set";
//
@@ -246,7 +280,7 @@ namespace Volian.Controls.Library
this.groupPanelTransitionProcs.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTransitionProcs.Controls.Add(this.cbTranProcs);
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.Name = "groupPanelTransitionProcs";
this.groupPanelTransitionProcs.Size = new System.Drawing.Size(501, 57);
@@ -275,10 +309,12 @@ namespace Volian.Controls.Library
//
//
this.groupPanelTransitionProcs.StyleMouseDown.Class = "";
this.groupPanelTransitionProcs.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
//
//
//
this.groupPanelTransitionProcs.StyleMouseOver.Class = "";
this.groupPanelTransitionProcs.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelTransitionProcs.TabIndex = 32;
this.groupPanelTransitionProcs.Text = "Select Procedure";
//
@@ -300,7 +336,7 @@ namespace Volian.Controls.Library
this.groupPanelTransitionSect.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanelTransitionSect.Controls.Add(this.cbTranSects);
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.Name = "groupPanelTransitionSect";
this.groupPanelTransitionSect.Size = new System.Drawing.Size(501, 60);
@@ -329,10 +365,12 @@ namespace Volian.Controls.Library
//
//
this.groupPanelTransitionSect.StyleMouseDown.Class = "";
this.groupPanelTransitionSect.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
//
//
//
this.groupPanelTransitionSect.StyleMouseOver.Class = "";
this.groupPanelTransitionSect.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelTransitionSect.TabIndex = 33;
this.groupPanelTransitionSect.Text = "Select Section";
//
@@ -356,10 +394,10 @@ namespace Volian.Controls.Library
this.groupPanelTranstionSteps.Controls.Add(this.tvTran);
this.groupPanelTranstionSteps.Controls.Add(this.pnlTranStepBtns);
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.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.CornerType = DevComponents.DotNetBar.eCornerType.Square;
//
//
//
this.groupPanelTranstionSteps.StyleMouseOver.Class = "";
this.groupPanelTranstionSteps.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanelTranstionSteps.TabIndex = 34;
this.groupPanelTranstionSteps.Text = "Select Step";
//
@@ -399,7 +439,7 @@ namespace Volian.Controls.Library
this.tvTran.Location = new System.Drawing.Point(0, 57);
this.tvTran.Margin = new System.Windows.Forms.Padding(4);
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.tvTran.TabIndex = 31;
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.CornerType = DevComponents.DotNetBar.eCornerType.Square;
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.Location = new System.Drawing.Point(355, 0);
@@ -482,6 +523,7 @@ namespace Volian.Controls.Library
this.groupPanelBtns.ResumeLayout(false);
this.groupPanelBtns.PerformLayout();
this.groupPanelTranFmt.ResumeLayout(false);
this.groupPanelTranFmt.PerformLayout();
this.groupPanelTransitionSets.ResumeLayout(false);
this.groupPanelTransitionProcs.ResumeLayout(false);
this.groupPanelTransitionSect.ResumeLayout(false);
@@ -511,5 +553,7 @@ namespace Volian.Controls.Library
private DevComponents.DotNetBar.LabelX lblxTranRangeTip;
private vlnTreeView3 tvTran;
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;
}
toItem = (ItemInfo)_RangeNode1.VEObject;
// Get the second item in the range, based on current tree view selection.
if (_RangeNode2 == null && tvTran.SelectedNode == null)
// If this is Transition type 2, then make 'rangenode2' same as rangenode1
// 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'");
return;
rangeItem = toItem;
}
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.
if (toItem.MyContent.Type < 20000 || rangeItem.MyContent.Type < 20000)
{

View File

@@ -119,21 +119,7 @@ namespace Volian.Controls.Library
set
{
_MyItemInfo = value;
int typ = (int)value.MyContent.Type;
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");
}
SetToolTip(_MyItemInfo.ToolTip);
ChangeBar = _MyItemInfo.HasChangeBar();
value.MyContent.Changed += new ContentInfoEvent(MyContent_Changed);
}
@@ -795,7 +781,7 @@ namespace Volian.Controls.Library
if (itemInfo != null)
{
//// TIMING: DisplayItem.TimeIt("CSLARTB before _Layout");
_MyStepSectionLayoutData = itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData;
_MyStepSectionLayoutData = itemInfo.ActiveFormat.MyStepSectionLayoutData;
//// TIMING: DisplayItem.TimeIt("CSLARTB _Layout");
if (myParentStepItem != null)
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)
{
Console.WriteLine("Left {0} Width {1}", Left, Width);
// Console.WriteLine("Left {0} Width {1}", Left, Width);
}
private Label lblHeader = null;

View File

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