Correct cursor position after RO Insert

Correct dispose logic for transition destination ITEMs
Correct cursor position after Transition Insert
Correct logic to parse Transition Link Token
Correct Save Config to dispose of ITEM
Removed debug vlnStackTrace
This commit is contained in:
Rich
2010-09-27 16:12:46 +00:00
parent fb3ed8d053
commit dc7eb108cb
6 changed files with 104 additions and 81 deletions

View File

@@ -14,6 +14,7 @@ namespace Volian.Controls.Library
{
public partial class DisplayTransition : UserControl
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Properties
private int _TranFmtIndx = -1; // stores selected transition format
private ItemInfo _CurItemFrom; // stores what item transition is 'from'
@@ -30,6 +31,7 @@ namespace Volian.Controls.Library
if (_CurTrans == value && _CurItemFrom == MyRTB.MyItemInfo) return;
_CurItemFrom = MyRTB.MyItemInfo;
_TranFmtIndx = 0;
btnTranSave.Enabled = btnTranCancel.Enabled = true;
}
else // Modify a transition
{
@@ -409,15 +411,15 @@ namespace Volian.Controls.Library
ItemInfo selitm = startitm;
if (!nostep)
{
if (_CurTrans == null)
if (_CurTrans == null)
{
if (!startitm.IsHigh)
{
if (!startitm.IsHigh)
{
startitm = startitm.MyParent;
selitm = startitm;
}
startitm = startitm.MyParent;
selitm = startitm;
}
}
}
else
selitm = null;
E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI;
@@ -522,7 +524,7 @@ namespace Volian.Controls.Library
{
cbTranSects.Enabled = false;
}
// check for range - if no range, then range button/label & step tree selections should be
// 'cleared/invisble'.
btnTranRangeClear.Visible = _DoingRange;
@@ -767,7 +769,7 @@ namespace Volian.Controls.Library
if (selii != null) allowSave = true;
}
if (!_DoingRange)
{
{
SaveCancelEnabling(allowSave, selii);
return;
}
@@ -800,7 +802,6 @@ namespace Volian.Controls.Library
}
}
}
private void SaveCancelEnabling(bool allowSave, ItemInfo selii)
{
btnTranSave.Enabled = allowSave;
@@ -934,9 +935,16 @@ namespace Volian.Controls.Library
}
// Can I build the text right now?
trantxt = TransitionText.GetResolvedText(_MyRTB.MyItemInfo, listBoxTranFmt.SelectedIndex,toItem,rangeItem ?? toItem);
_MyRTB.InsertTran(trantxt, linktxt);
_MyRTB.Select(_MyRTB.SelectionStart + trantxt.Length + linktxt.Length, 0);
_MyRTB.SaveText();
int ss = _MyRTB.SelectionStart;// Remember where the link is being added
_MyRTB.InsertTran(trantxt, linktxt);// Insert the LINK
_MyRTB.SaveText();// Save the text with the LINK - This also moves the cursor to the end of the text
// By selecting a starting position within a link, StepRTB (HandleSelectionChange) will select the link
_MyRTB.Select(ss + 7 + trantxt.Length, 0);// Try 7 for <Start] and the length of the transition text
//Console.WriteLine("'{0}'",_MyRTB.Text.Substring(_MyRTB.SelectionStart,_MyRTB.SelectionLength));
string linkText = _MyRTB.Text.Substring(_MyRTB.SelectionStart, _MyRTB.SelectionLength);
if(_MyLog.IsInfoEnabled && (linkText.Contains("NewID") || linkText.Contains("CTID")))
_MyLog.InfoFormat("ItemID {0}, LinkText '{1}'", _MyRTB.MyItemInfo.ItemID, linkText);
_MyRTB.Select(_MyRTB.SelectionStart + _MyRTB.SelectionLength, 0);// Move cursor to end of LINK
_MyRTB.Focus();
}
#endregion