Added code to remove a font command combined with a comment in a link in StripRtfCommands

The initialization code was changed so that an invalid transition will not cause a crash
If a MRU Item is deleted, and then selected from the menu, a message box will be displayed.
This commit is contained in:
Rich 2009-10-22 19:08:12 +00:00
parent b1ad83dd4e
commit 988bd786a4
3 changed files with 14 additions and 2 deletions

View File

@ -603,6 +603,7 @@ namespace Volian.Controls.Library
retval = Regex.Replace(retval, @"^\{(.*)\}$", "$1", RegexOptions.Singleline); // Strip Opening and Closing Braces retval = Regex.Replace(retval, @"^\{(.*)\}$", "$1", RegexOptions.Singleline); // Strip Opening and Closing Braces
retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
retval = Regex.Replace(retval, @"\\v\\f[0-9] ", "\\v "); // remove font command - if next to Comment keep space
retval = Regex.Replace(retval, @"\\f[0-9] ", ""); // remove font command with ending space retval = Regex.Replace(retval, @"\\f[0-9] ", ""); // remove font command with ending space
retval = Regex.Replace(retval, @"\\f[0-9]", ""); // remove font command without ending space retval = Regex.Replace(retval, @"\\f[0-9]", ""); // remove font command without ending space
retval = Regex.Replace(retval, @"\\par ", "\r\n"); retval = Regex.Replace(retval, @"\\par ", "\r\n");

View File

@ -126,7 +126,11 @@ namespace Volian.Controls.Library
// if modify, use the first transition to, _CurTrans // if modify, use the first transition to, _CurTrans
// This item will be either a procedure, section or step, never a docversion // This item will be either a procedure, section or step, never a docversion
ItemInfo selitm = _CurTrans==null?_CurItemFrom:_CurTrans.MyItemToID; ItemInfo selitm = _CurTrans==null?_CurItemFrom:_CurTrans.MyItemToID;
// If this points to an invalid transtion, make it point to itself.
if (selitm.PreviousID == null && selitm.ItemPartCount == 0 && selitm.ItemDocVersionCount == 0)
{
selitm = _CurItemFrom;
}
ItemInfo tmpitm = selitm; ItemInfo tmpitm = selitm;
ItemInfo secitm = null; ItemInfo secitm = null;

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using System.Windows.Forms;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
@ -31,7 +32,13 @@ namespace Volian.Controls.Library
} }
public MostRecentItem Add(int itemID) public MostRecentItem Add(int itemID)
{ {
return Add(new MostRecentItem(ItemInfo.Get(itemID))); ItemInfo tmp = ItemInfo.Get(itemID);
if (tmp == null)
{
MessageBox.Show("This step no longer exists", "Invalid Most Recent Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return null;
}
return Add(new MostRecentItem(tmp));
} }
public MostRecentItem Add(ItemInfo myItem) public MostRecentItem Add(ItemInfo myItem)
{ {