B2020-015 improved the Enter key logic to handle steps containing tables. Prior to this update, a new table was inserted above the existing table when the Enter key was used starting from the step/substep above the existing table.
This commit is contained in:
parent
4dae30b71b
commit
23354f3ed2
@ -3484,6 +3484,7 @@ namespace Volian.Controls.Library
|
||||
bool deletedRNO = false;
|
||||
bool deletedNote = false;
|
||||
bool deletedCaution = false;
|
||||
ItemInfo parentOfDeleted = null;
|
||||
if (!MyItemInfo.IsTable && MyStepRTB.Text.Length < 1) //empty step text
|
||||
{
|
||||
deletedEmpty = true;
|
||||
@ -3492,12 +3493,14 @@ namespace Volian.Controls.Library
|
||||
deletedRNO = MyItemInfo.IsRNOPart;
|
||||
deletedNote = MyItemInfo.IsNote;
|
||||
deletedCaution = MyItemInfo.IsCaution;
|
||||
parentOfDeleted = MyItemInfo.MyParent; // B2020-015 save the parent of the empty step part that was deleted
|
||||
|
||||
btnDelStep_Click(MyStepRTB, null); // delete the empty step piece
|
||||
}
|
||||
|
||||
if (MyItemInfo.IsHigh)
|
||||
{
|
||||
bool processed = true;
|
||||
if (!deletedHLS)
|
||||
{
|
||||
if (deletedSubStep)
|
||||
@ -3512,18 +3515,25 @@ namespace Volian.Controls.Library
|
||||
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlRight); // jump to RNO
|
||||
else if (deletedRNO)
|
||||
{
|
||||
AddSubStep();
|
||||
processed = AddSubStep(); // B2020-015 see comment below
|
||||
}
|
||||
else if (!deletedHLS)
|
||||
{
|
||||
if (MyItemInfo.ColumnMode > 0)
|
||||
CreateNewRNO();
|
||||
else
|
||||
AddSubStep();
|
||||
processed = AddSubStep(); // B2020-015 see comment below
|
||||
}
|
||||
}
|
||||
if (processed) return;
|
||||
}
|
||||
else if (MyItemInfo.IsRNOPart)
|
||||
// B2020-015 Replaced the "else if" with just an "if". The code above processes pressing the Enter Key when starting on a high level step.
|
||||
// We needed to have a special case when, during the processing of the enter key, we ended up on a table or figure. In those cases
|
||||
// it was inserting a new table or figure before the existing one. Instead, we want it to process it as if we starting pressing
|
||||
// the enter key while on the table or figure. By returning a "false" from AddSubStep(), we can let it fall through so that
|
||||
// it is processed properly.
|
||||
|
||||
if (MyItemInfo.IsRNOPart)
|
||||
{
|
||||
// B2013-154: if in single column mode, enter key from an RNO part should insert an RNO part:
|
||||
if (MyItemInfo.ColumnMode == 0)
|
||||
@ -3531,11 +3541,16 @@ namespace Volian.Controls.Library
|
||||
CreateNewRNO();
|
||||
return;
|
||||
}
|
||||
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlLeft);
|
||||
// B2020-015 We are on an RNO step type. Spin up the first non-RNO parent then decide what step part to add.
|
||||
// Prior to this fix, an un-typed step part was created when you pressed Enter from a second RNO
|
||||
ItemInfo ii = MyItemInfo;
|
||||
while (ii.IsRNOPart) ii = ii.MyParent;
|
||||
MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(ii);
|
||||
if (MyItemInfo.IsHigh)
|
||||
{
|
||||
//if (MyEditItem != null && MyEditItem.NextDownEditItem != null && MyEditItem.NextDownEditItem.MyItemInfo.MyParent.Equals(MyEditItem.MyItemInfo))
|
||||
if (MyEditItem != null && MyEditItem.NextDownEditItem != null && MyEditItem.NextDownEditItem.MyItemInfo.MyParent.ItemID == MyEditItem.MyItemInfo.ItemID)
|
||||
if (MyEditItem != null && MyEditItem.NextDownEditItem != null &&
|
||||
!MyEditItem.NextDownEditItem.MyItemInfo.IsTable && !MyEditItem.NextDownEditItem.MyItemInfo.IsFigure &&
|
||||
MyEditItem.NextDownEditItem.MyItemInfo.MyParent.ItemID == MyEditItem.MyItemInfo.ItemID)
|
||||
{
|
||||
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
|
||||
InsertSiblingBeforeOrAfter("before");
|
||||
@ -3550,29 +3565,62 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (deletedEmpty)
|
||||
{
|
||||
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlLeft);
|
||||
CreateNewRNO();
|
||||
MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(parentOfDeleted);
|
||||
if (parentOfDeleted.IsHigh)
|
||||
{
|
||||
if (!AddSubStep())
|
||||
SetShortCutContextMenu("InsSubStps");
|
||||
}
|
||||
else if (!MyItemInfo.IsRNOPart)
|
||||
InsertSiblingBeforeOrAfter("after");
|
||||
}
|
||||
else
|
||||
InsertSiblingBeforeOrAfter("after");
|
||||
}
|
||||
else if (MyItemInfo.IsInRNO &&( MyItemInfo.IsTable || MyItemInfo.IsFigure))
|
||||
{
|
||||
if (deletedEmpty)
|
||||
{
|
||||
while (parentOfDeleted.IsRNOPart)
|
||||
parentOfDeleted = parentOfDeleted.MyParent;
|
||||
MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(parentOfDeleted);
|
||||
if (parentOfDeleted.IsHigh)
|
||||
{
|
||||
if (!AddSubStep())
|
||||
SetShortCutContextMenu("InsSubStps");
|
||||
}
|
||||
else
|
||||
InsertSiblingBeforeOrAfter("after");
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemInfo tItemInfo = MyItemInfo.MyParent;
|
||||
while (tItemInfo.IsRNOPart) tItemInfo = tItemInfo.MyParent;
|
||||
MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(tItemInfo);
|
||||
if (MyItemInfo.IsHigh)
|
||||
{
|
||||
if (!AddSubStep())
|
||||
SetShortCutContextMenu("InsSubStps");
|
||||
}
|
||||
else
|
||||
InsertSiblingBeforeOrAfter("after");
|
||||
}
|
||||
}
|
||||
else if (MyItemInfo.IsStepPart)
|
||||
{
|
||||
if (deletedSubStep)
|
||||
{
|
||||
//MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlUp); // jump to HLS
|
||||
SetShortCutContextMenu("InsHLS"); // prompt for new HLS
|
||||
// B2020-015 jump to the parent of the empty step part that was deleted
|
||||
MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(parentOfDeleted);
|
||||
if (MyItemInfo.IsHigh)
|
||||
SetShortCutContextMenu("InsHLS"); // prompt for new HLS
|
||||
else
|
||||
InsertSiblingBeforeOrAfter("after");
|
||||
}
|
||||
//else if (deletedRNO || MyItemInfo.IsEquipmentList)
|
||||
// InsertSiblingBeforeOrAfter("after");
|
||||
else if (!MyItemInfo.IsSequential) // only add a sibling if substep type does not have sequential tabs
|
||||
InsertSiblingBeforeOrAfter("after");
|
||||
else if (deletedRNO)
|
||||
{
|
||||
|
||||
if (MyItemInfo.SearchNext != null && MyItemInfo.SearchNext.IsTable)
|
||||
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
|
||||
else
|
||||
InsertSiblingBeforeOrAfter("after");
|
||||
}
|
||||
else if (MyEditItem.MyRNOEditItems != null && MyEditItem.MyRNOEditItems.Count > 0)
|
||||
@ -3598,50 +3646,44 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (!deletedEmpty)
|
||||
InsertSiblingBeforeOrAfter("after");
|
||||
else
|
||||
else if (!deletedCaution)
|
||||
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
|
||||
}
|
||||
else if (MyItemInfo.IsTable || MyItemInfo.IsFigure)
|
||||
else if (MyItemInfo.IsTable || MyItemInfo.IsFigure || MyItemInfo.IsRtfRaw) //is Table, Figure, or Equation
|
||||
{
|
||||
ItemInfo next = MyItemInfo.SearchNext;
|
||||
MyFlexGrid.Select(0, 0); // make sure we are at the first row before doing an up arrow
|
||||
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlUp);
|
||||
ItemInfo next = (deletedEmpty && !deletedHLS)? parentOfDeleted : MyItemInfo.MyParent;
|
||||
while (next.IsTable || next.IsFigure || next.IsRtfRaw) next = next.MyParent;
|
||||
MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(next);
|
||||
if (MyItemInfo.IsHigh)
|
||||
{
|
||||
if (deletedSubStep)
|
||||
SetShortCutContextMenu("InsHLS");
|
||||
else if (next != null && next.IsFirstSubStep)
|
||||
if (!deletedHLS)
|
||||
{
|
||||
MyEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(next);
|
||||
InsertSiblingBeforeOrAfter("before");
|
||||
if (deletedSubStep)
|
||||
SetShortCutContextMenu("InsHLS");
|
||||
else if (!deletedNote && !deletedCaution)
|
||||
SetShortCutContextMenu("InsSubStps");
|
||||
}
|
||||
else
|
||||
SetShortCutContextMenu("InsSubStps");
|
||||
}
|
||||
else
|
||||
else if (!deletedNote && !deletedCaution)
|
||||
InsertSiblingBeforeOrAfter("after");
|
||||
}
|
||||
}
|
||||
|
||||
private void AddSubStep()
|
||||
private bool AddSubStep()
|
||||
{
|
||||
EditItem nextDownEditItem = MyEditItem.NextDownEditItem;
|
||||
//bool skipTable = false;
|
||||
// //If the step has a table, move past it before adding a substep
|
||||
//if (nextDownEditItem != null && nextDownEditItem.MyItemInfo.MyParent.ItemID == MyEditItem.MyID &&
|
||||
// nextDownEditItem.MyItemInfo.IsTablePart)
|
||||
//{
|
||||
// nextDownEditItem = nextDownEditItem.NextDownEditItem;
|
||||
// skipTable = true;
|
||||
//}
|
||||
if (nextDownEditItem != null && nextDownEditItem.MyItemInfo.MyParent.ItemID == MyEditItem.MyID)
|
||||
{
|
||||
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
|
||||
//if (skipTable) MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
|
||||
// B2020-015 when nextDownEditItem is a table or figure, we want to treat it as if we started pressing the Enter Key while on that table or figure.
|
||||
// Return "false' in this case so it can be processed properly
|
||||
if (nextDownEditItem.MyItemInfo.IsTable || nextDownEditItem.MyItemInfo.IsFigure)
|
||||
return false;
|
||||
InsertSiblingBeforeOrAfter("before");
|
||||
}
|
||||
else
|
||||
SetShortCutContextMenu("InsSubStps");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CreateNewRNO()
|
||||
|
Loading…
x
Reference in New Issue
Block a user