Properly Save Text from DisplayText
Fixed logic to support single character in a stepRTB (Fixed 127) Corrected code to deal with null AERStepItem Added code to respond to a Right Arrow for steps that don't have RNOs Changed KeyDown (Keys.Down) logic to support a Hard-Return at the end of a StepRTB
This commit is contained in:
parent
4e8b7932bd
commit
8f110a10e3
@ -362,12 +362,7 @@ namespace Volian.Controls.Library
|
||||
_MyItem.DTS = DateTime.Now;
|
||||
_MyItem.UserID = Environment.UserName;
|
||||
// Do the Save once rather than multiple times
|
||||
bool saveAtOnce = false;
|
||||
// If it is a new Item, save it before the transitions and ROs are saved
|
||||
if (_MyItem.ItemID < 0)
|
||||
_MyItem.Save();
|
||||
else
|
||||
saveAtOnce = true;
|
||||
_MyItem.Save();
|
||||
if (ctReplacements.Count > 0)
|
||||
{
|
||||
EditText = FixCtReplacements(EditText, ctReplacements);
|
||||
@ -375,15 +370,13 @@ namespace Volian.Controls.Library
|
||||
foreach (ContentTransition ct in ctReplacements.Values)
|
||||
using (TransitionInfo tran = TransitionInfo.Get(ct.TransitionID))
|
||||
_MyItem.MyContent.FixTransitionText(tran);
|
||||
saveAtOnce = true;
|
||||
_MyItem.Save();
|
||||
}
|
||||
if (roUsgReplacements.Count > 0)
|
||||
{
|
||||
EditText = FixRoUsgReplacements(EditText, roUsgReplacements);
|
||||
saveAtOnce = true;
|
||||
}
|
||||
if(saveAtOnce)
|
||||
_MyItem.Save();
|
||||
}
|
||||
modtext = EditText;
|
||||
}
|
||||
else
|
||||
@ -783,10 +776,9 @@ namespace Volian.Controls.Library
|
||||
retval = Regex.Replace(retval, @"(\\[^' \\?\r\n\t]+) (?=\\)", "$1"); // remove space between tokens
|
||||
retval = Regex.Replace(retval, @"(\\[^' \\?\r\n\t]+) (?=\r\n)", "$1"); // remove space before /r/n
|
||||
// remove \r\n at end of string if the string has 2 or more characters
|
||||
if (retval.Length > 1 && retval.Substring(retval.Length - 2, 2) == "\r\n") retval = retval.Remove(retval.Length - 2, 2);
|
||||
|
||||
if (retval.EndsWith("\r\n")) retval = retval.Remove(retval.Length - 2, 2);
|
||||
if (retval.Length == 0) return "";
|
||||
if (retval.Substring(retval.Length - 2, 2) == @"\v") retval = retval.Remove(retval.Length - 2, 2);
|
||||
if (retval.EndsWith(@"\v")) retval = retval.Remove(retval.Length - 2, 2);
|
||||
retval = _MyItemInfo.RemoveRtfStyles(retval); // RemoveRtfStyles(retval);
|
||||
retval = retval.Replace(@"(![", @"\{");
|
||||
retval = retval.Replace(@"(!]", @"\}");
|
||||
|
@ -1009,7 +1009,6 @@ namespace Volian.Controls.Library
|
||||
newFocus.AdjustLocation();
|
||||
//newFocus.ShowTops("");
|
||||
}
|
||||
|
||||
public StepItem DeleteItem()
|
||||
{
|
||||
StepItem newFocus = null;
|
||||
@ -2053,6 +2052,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if(RNOLevel == 0)return null;
|
||||
if (MyParentStepItem != null)
|
||||
{
|
||||
if (MyParentStepItem.RNOLevel < RNOLevel)
|
||||
@ -2060,10 +2060,12 @@ namespace Volian.Controls.Library
|
||||
else
|
||||
return MyParentStepItem.AERStepItem;
|
||||
}
|
||||
else
|
||||
else if (MyPreviousStepItem != null)
|
||||
{
|
||||
return MyPreviousStepItem.AERStepItem;
|
||||
}
|
||||
//Volian.Base.Library.vlnStackTrace.ShowStackLocal("'AERStepItem',{0},{1}", MyID, MyItemInfo.DBSequence);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@ -2071,8 +2073,10 @@ namespace Volian.Controls.Library
|
||||
/// </summary>
|
||||
internal void AdjustLocation()
|
||||
{
|
||||
//Console.WriteLine("'AdjustLocation',{0},{1},'{2}'", MyID, MyItemInfo.DBSequence, Volian.Base.Library.vlnStackTrace.CalledFrom4);
|
||||
if (RNORight) MoveRNO(); // This is needed when an AER is Deleted that has an RNO.
|
||||
if (RNOLevel>0) AERStepItem.AdjustLocation();
|
||||
if (RNOLevel > 0 && AERStepItem != null)
|
||||
AERStepItem.AdjustLocation();
|
||||
StepItem nextStepItem = NextDownStepItem;
|
||||
//if (MyID == 2138)
|
||||
// Console.WriteLine("2138");
|
||||
|
@ -713,16 +713,14 @@ namespace Volian.Controls.Library
|
||||
break;
|
||||
case E_ArrowKeys.Down:
|
||||
case E_ArrowKeys.CtrlDown:
|
||||
ii = ArrowDown(rtb.MyItemInfo);
|
||||
// The following lines are debug to check that the results of moving down and moving up are the same
|
||||
//ix = ArrowUp(ii);
|
||||
//Console.WriteLine("'Down',{0},{1},{2},{3}", rtb.MyItemInfo.ItemID, rtb.MyItemInfo.DBSequence, ii.DBSequence, ix.DBSequence);
|
||||
if (ii != null) SelectedStepRTB = _LookupStepItems[ii.ItemID].MyStepRTB;
|
||||
ii = MoveDown(rtb, ii);
|
||||
break;
|
||||
case E_ArrowKeys.Right:
|
||||
case E_ArrowKeys.CtrlRight:
|
||||
if (rtb.MyItemInfo.RNOs != null)
|
||||
SelectedStepRTB = _LookupStepItems[rtb.MyItemInfo.RNOs[0].ItemID].MyStepRTB;
|
||||
else
|
||||
ii = MoveDown(rtb, ii);
|
||||
break;
|
||||
case E_ArrowKeys.Left:
|
||||
case E_ArrowKeys.CtrlLeft:
|
||||
@ -733,6 +731,16 @@ namespace Volian.Controls.Library
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private ItemInfo MoveDown(StepRTB rtb, ItemInfo ii)
|
||||
{
|
||||
ii = ArrowDown(rtb.MyItemInfo);
|
||||
// The following lines are debug to check that the results of moving down and moving up are the same
|
||||
//ix = ArrowUp(ii);
|
||||
//Console.WriteLine("'Down',{0},{1},{2},{3}", rtb.MyItemInfo.ItemID, rtb.MyItemInfo.DBSequence, ii.DBSequence, ix.DBSequence);
|
||||
if (ii != null) SelectedStepRTB = _LookupStepItems[ii.ItemID].MyStepRTB;
|
||||
return ii;
|
||||
}
|
||||
private ItemInfo ArrowUp(ItemInfo ii)
|
||||
{
|
||||
// Arrow-Up from a Substep should look for a Table.
|
||||
|
@ -1585,7 +1585,7 @@ namespace Volian.Controls.Library
|
||||
pos.Y = ClientRectangle.Height;
|
||||
int lastIndex = this.GetCharIndexFromPosition(pos);
|
||||
int lastLine = this.GetLineFromCharIndex(lastIndex);
|
||||
if (e.Control || l == lastLine)
|
||||
if (e.Control || l >= lastLine)
|
||||
{
|
||||
StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlDown : E_ArrowKeys.Down);
|
||||
HandleLocalSelectionChange();
|
||||
@ -1729,7 +1729,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
private void StepRTB_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
|
||||
{
|
||||
if (!ReadOnly)
|
||||
if (!ReadOnly)
|
||||
{
|
||||
// add the character with its font depending on the char....
|
||||
if (!IsControlChar)
|
||||
|
Loading…
x
Reference in New Issue
Block a user