diff --git a/PROMS/LBWordLibrary/LBObjectExtension.cs b/PROMS/LBWordLibrary/LBObjectExtension.cs index 1d99d387..6b2724a5 100644 --- a/PROMS/LBWordLibrary/LBObjectExtension.cs +++ b/PROMS/LBWordLibrary/LBObjectExtension.cs @@ -325,7 +325,106 @@ namespace LBWordLibrary return null; } } - + /// + /// Debug Tool - Return a string containing a list of the fonts that have symbol characters. + /// + public string FontsHaveSymbolCharacters + { + get + { + string sep = ""; + StringBuilder sb = new StringBuilder(); + List fonts=new List(); + LBRange myRange = Range(); + myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100); + myRange.Start = 0; + int end = myRange.End; + string myText = GetRangeText(myRange); + //return _RegFindSymbol.IsMatch(myText); + MatchCollection problems = _RegFindSymbol.Matches(myText); + int offset = 0; + foreach (Match problem in problems) + { + myRange.Start = problem.Index + offset; + myRange.End = problem.Index + problem.Length + offset; + int newOffset = FindRangeOffset(myRange, problem, offset, end); + if (!fonts.Contains(myRange.Font.Name)) + { + fonts.Add(myRange.Font.Name); + sb.Append(sep + "'" + myRange.Font.Name + "'"); + sep = ","; + } + offset = newOffset; + } + if (sb.Length > 0) return sb.ToString(); + return null; + } + } + /// + /// Debug Tool - Return a list of symbol characters using VESYMB font. + /// + public string FontsHaveSymbolCharacters2 + { + get + { + try + { + Dictionary> fonts = new Dictionary>(); + LBRange myRange = Range(); + myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100); + myRange.Start = 0; + int end = myRange.End; + string myText = GetRangeText(myRange); + //return _RegFindSymbol.IsMatch(myText); + MatchCollection problems = _RegFindSymbol.Matches(myText); + int offset = 0; + foreach (Match problem in problems) + { + myRange.Start = problem.Index + offset; + myRange.End = problem.Index + problem.Length + offset; + int newOffset = FindRangeOffset(myRange, problem, offset, end); + string sFont = myRange.Font.Name; + if (sFont.ToUpper().StartsWith("VESYM")) + { + if (!fonts.ContainsKey(sFont)) + { + fonts.Add(sFont, new List()); + } + List symbols = fonts[sFont]; + string myTextSymb = GetRangeText(myRange); + foreach (char c in myTextSymb) + { + if (!symbols.Contains((int)c)) + symbols.Add((int)c); + } + } + offset = newOffset; + } + if (fonts.Count > 0) + { + string sep = ""; + StringBuilder sb = new StringBuilder(); + foreach (string font in fonts.Keys) + { + sb.Append(sep + "'" + font + "'"); + sep = ","; + foreach (int i in fonts[font]) + { + sb.Append(sep); + sb.Append(i); + } + } + return sb.ToString(); + } + } + catch (Exception ex) + { + Console.WriteLine("{0},{1},{2}", ex.GetType().Name, ex.Message, ex.StackTrace); + } + return null; + } + } + /// /// Checks to see if the document contains symbol characters /// @@ -429,7 +528,10 @@ namespace LBWordLibrary string text=""; try { - text = myRange.Text; + if (myRange.Start == myRange.End)// If Start and End equal return an empty string. + text = ""; + else + text = myRange.Text; } catch (Exception ex) { diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index ec6206c7..f5a2d154 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -241,6 +241,7 @@ namespace VEPROMS ctrlAnnotationDetails.SetupAnnotations(displaySearch1); SetupButtons(); displayBookMarks.MyDisplayTabControl = tc; // allows bookmark selection to bring up steps/docs + office2007StartButton1.MouseDown +=new MouseEventHandler(office2007StartButton1_MouseDown); } void _MyMRIList_AfterRemove(object sender) @@ -1402,6 +1403,11 @@ namespace VEPROMS { lblResolution.Text = string.Format("Resolution {0} x {1}", Size.Width, Size.Height); } - + private void office2007StartButton1_MouseDown(object sender, MouseEventArgs e) + { + // Refresh the MostRecentlyUsedList + _MyMRIList.Refresh(); + SetupMRU(); + } } } diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index c58cabf4..2684eaf4 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -297,7 +297,19 @@ namespace VEPROMS.CSLA.Library // return ii._ItemID == _ItemID; // return false; //} - + public event ItemInfoEvent OrdinalChanged; + private void OnOrdinalChange() + { + if (OrdinalChanged != null) OrdinalChanged(this); + } + public static void OnOrdinalChange(int itemID) + { + ConvertListToDictionary(); + string key = itemID.ToString(); + if (_CacheByPrimaryKey.ContainsKey(key)) + foreach (ItemInfo item in _CacheByPrimaryKey[key]) + item.OnOrdinalChange(); + } public bool IsFirstSubStep { get diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs index 3ecd3586..da0d468e 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs @@ -749,13 +749,13 @@ namespace VEPROMS.CSLA.Library key = null; foreach (ItemInfo item in items) { - //Console.WriteLine("ResetOrdinal item = {0}, ordinal = {1}", item, item.Ordinal); item._Ordinal = null; item._TagsSetup = false; - item.MyContent.ShowChange(); + //item.MyContent.ShowChange(); // Replaced with OnOrdinalChange below if (key == null && item.NextItem != null) key = item.NextItem.ItemID.ToString(); } + ItemInfo.OnOrdinalChange(items[0].ItemID); // After _Ordinal reset trigger event } } public void ResetOrdinal() diff --git a/PROMS/VEPROMS.CSLA.Library/VEObjects/VETreeNode.cs b/PROMS/VEPROMS.CSLA.Library/VEObjects/VETreeNode.cs index d5a54b3b..359f1f0a 100644 --- a/PROMS/VEPROMS.CSLA.Library/VEObjects/VETreeNode.cs +++ b/PROMS/VEPROMS.CSLA.Library/VEObjects/VETreeNode.cs @@ -342,12 +342,18 @@ namespace VEPROMS.CSLA.Library { myItemInfo.Deleted += new ItemInfoEvent(myItemInfo_Deleted); myItemInfo.ChildrenDeleted += new ItemInfoEvent(myItemInfo_ChildrenDeleted); - myItemInfo.MyContent.Changed += new ContentInfoEvent(MyContent_Changed); + myItemInfo.MyContent.Changed += new ContentInfoEvent(NodeText_Changed); + myItemInfo.OrdinalChanged += new ItemInfoEvent(NodeText_Changed); myItemInfo.NewSiblingAfter += new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter); myItemInfo.NewSiblingBefore += new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore); myItemInfo.NewChild += new ItemInfoInsertEvent(myItemInfo_NewChild); } } + void NodeText_Changed(object sender) + { + //ItemInfo myItemInfo = sender as ItemInfo; + Text = _VEObject.ToString(); + } public VETreeNode(IVEDrillDownReadOnly o) : base(o.ToString()) { @@ -358,7 +364,8 @@ namespace VEPROMS.CSLA.Library { myItemInfo.Deleted += new ItemInfoEvent(myItemInfo_Deleted); myItemInfo.ChildrenDeleted += new ItemInfoEvent(myItemInfo_ChildrenDeleted); - myItemInfo.MyContent.Changed += new ContentInfoEvent(MyContent_Changed); + myItemInfo.MyContent.Changed += new ContentInfoEvent(NodeText_Changed); + myItemInfo.OrdinalChanged += new ItemInfoEvent(NodeText_Changed); myItemInfo.NewSiblingAfter += new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter); myItemInfo.NewSiblingBefore += new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore); myItemInfo.NewChild += new ItemInfoInsertEvent(myItemInfo_NewChild); @@ -438,12 +445,6 @@ namespace VEPROMS.CSLA.Library if (this.Parent != null) // Only do this if the node has a parent - RHM 20100106 this.Parent.Nodes.Insert(Index + 1, (new VETreeNode(args.ItemInserted))); } - void MyContent_Changed(object sender) - { - ContentInfo myContent = sender as ContentInfo; - ItemInfo myItemInfo = myContent.ContentItems[0]; - Text = _VEObject.ToString(); - } public VETreeNode(string s) : base(s) { diff --git a/PROMS/Volian.Controls.Library/MostRecentItem.cs b/PROMS/Volian.Controls.Library/MostRecentItem.cs index 624e6b01..bc77ab57 100644 --- a/PROMS/Volian.Controls.Library/MostRecentItem.cs +++ b/PROMS/Volian.Controls.Library/MostRecentItem.cs @@ -23,6 +23,7 @@ namespace Volian.Controls.Library } public new MostRecentItem Add(MostRecentItem myMRI) { + Refresh(); MostRecentItem tmp = null; // Look for the ItemID foreach (MostRecentItem mri in this) @@ -42,6 +43,11 @@ namespace Volian.Controls.Library myMRI.MyItemInfo.BeforeDelete += new ItemInfoEvent(MyItemInfo_BeforeDelete); return myMRI; } + public void Refresh() + { + foreach (MostRecentItem mri in this) + mri.Refresh(); + } // delete the item from the most recently used list. This event gets handled // when a delete item occurs. @@ -105,6 +111,7 @@ namespace Volian.Controls.Library public System.Collections.Specialized.StringCollection ToSettings() { if (Count == 0) return null; + Refresh(); System.Collections.Specialized.StringCollection retval = new System.Collections.Specialized.StringCollection(); foreach (MostRecentItem mri in this) retval.Add(mri.ToString()); @@ -131,6 +138,10 @@ namespace Volian.Controls.Library _ToolTip = GetToolTip(_MyItemInfo); } } + internal void Refresh() + { + MyItemInfo = MyItemInfo; + } private int _ItemID; public int ItemID { diff --git a/PROMS/Volian.Controls.Library/StepItem.cs b/PROMS/Volian.Controls.Library/StepItem.cs index 9fb3bcbe..c28e650f 100644 --- a/PROMS/Volian.Controls.Library/StepItem.cs +++ b/PROMS/Volian.Controls.Library/StepItem.cs @@ -149,9 +149,13 @@ namespace Volian.Controls.Library if (VlnSettings.StepTypeToolType)SetToolTip(_MyItemInfo.ToolTip); ChangeBar = _MyItemInfo.HasChangeBar(); value.MyContent.Changed += new ContentInfoEvent(MyContent_Changed); + value.OrdinalChanged += new ItemInfoEvent(value_OrdinalChanged); } } - + void value_OrdinalChanged(object sender) + { + TabFormat = null; // Reset Tab + } private void SetToolTip(string tip) { DevComponents.DotNetBar.SuperTooltipInfo tpi = new DevComponents.DotNetBar.SuperTooltipInfo("", "", tip, null, null, DevComponents.DotNetBar.eTooltipColor.Lemon); @@ -169,7 +173,6 @@ namespace Volian.Controls.Library // Update the text to reflect the content change MyStepRTB.MyItemInfo.RefreshItemAnnotations(); MyStepRTB.MyItemInfo=MyStepRTB.MyItemInfo; // Reset Text - TabFormat = null; // Reset Tab SetExpandAndExpander(MyItemInfo); // TODO: Need code to update tabs ? not sure what this is - maybe for // transitions? diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index 83d7b63b..61665cf2 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -201,7 +201,6 @@ namespace Volian.Controls.Library } } _InitializingRTB = true; - _SelectedRtfSB.Remove(0, _SelectedRtfSB.Length); DisplayText vlntxt = new DisplayText(_MyItemInfo, EpMode, VwMode, !edit, FieldToEdit, true); //if (_origDisplayText != null && vlntxt.StartText == _origDisplayText.StartText) //{ @@ -222,9 +221,12 @@ namespace Volian.Controls.Library // TODO: Release Mode //Font = _origDisplayText.TextFont.WindowsFont; // font defined in plant's format } - Text = ""; // Initialize text before add text + // RHM 20101201 - Don't reset the text. Calculate the text and compare it with the existing text in AddRTFText + //Text = ""; // Initialize text before add text // IMPORTANT: SetLineSpacing must be set before Links, otherwise it // was confusing the 'handle' of the rtf box. + //Console.WriteLine("'font',{0}", Font); + if(Text == "")SelectionFont = Font; // Initialize SelectionFont RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT); AddRtfText(vlntxt.StartText); //AddRtfStyles(); @@ -714,14 +716,18 @@ namespace Volian.Controls.Library #region AddRtfTextAndStyles private void AddRtfText(string txt) { - AddFontTable(); - _RtfPrefix = _SelectedRtfSB.ToString(); - _SelectedRtfSB.Append(txt); - SelectedRtf = _SelectedRtfSB.ToString() + "}"; + StringBuilder selectedRtfSB = new StringBuilder(); + AddFontTable(selectedRtfSB); + _RtfPrefix = selectedRtfSB.ToString(); + selectedRtfSB.Append(txt); + string newRTF = selectedRtfSB.ToString() + "}"; + SelectAll(); + if (SelectedRtf != newRTF) + SelectedRtf = newRTF; + //SelectedRtf = selectedRtfSB.ToString() + "}"; FindAllLinks(); } - private StringBuilder _SelectedRtfSB = new StringBuilder(); - private void AddFontTable() + private void AddFontTable(StringBuilder selectedRtfSB) { StringBuilder sbbeg = new StringBuilder(); StringBuilder sbend = new StringBuilder(); @@ -740,14 +746,14 @@ namespace Volian.Controls.Library sbbeg.Append(@"\i"); sbend.Insert(0, @"\i0"); } - _SelectedRtfSB.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 " + this.Font.FontFamily.Name + @";}"); //}\f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}}"; + selectedRtfSB.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 " + this.Font.FontFamily.Name + @";}"); //}\f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}}"; if (!FontIsFixed()) - _SelectedRtfSB.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}{\colortbl ;\red255\green0\blue0;}"); + selectedRtfSB.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}{\colortbl ;\red255\green0\blue0;}"); else - _SelectedRtfSB.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}{\colortbl ;\red255\green0\blue0;}"); - _SelectedRtfSB.Append("\r\n"); + selectedRtfSB.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}{\colortbl ;\red255\green0\blue0;}"); + selectedRtfSB.Append("\r\n"); // use styles to construct rtf commands to insert into next line (where \b, etc is) - _SelectedRtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(this.Font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}"; + selectedRtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(this.Font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}"; } private bool FontIsFixed() @@ -906,8 +912,10 @@ namespace Volian.Controls.Library Size szNew = new Size(((Text != "" && adjustWidth) ? widthNew : (widthNew > Width ? widthNew : Width)), heightNew); if (this.Size != szNew) { + int heightOld = Height; this.Size = szNew; - OnHeightChanged(this, new EventArgs()); + if (heightOld != Height) + OnHeightChanged(this, new EventArgs()); } } } diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs index 0bdae1c1..7b49104a 100644 --- a/PROMS/Volian.Controls.Library/vlnTreeView.cs +++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs @@ -999,6 +999,7 @@ namespace Volian.Controls.Library ShowBrokenRules(step.BrokenRulesCollection); SetLastValues(StepInfo.Get(step.ItemID)); tn = new VETreeNode(_LastStepInfo); + _LastStepInfo.UpdateTransitionText(); TreeNode par = SelectedNode.Parent; par.Nodes.Insert(tvindex + ((newtype == MenuSelections.StepBefore) ? 0 : 1), tn); }