RO Editor access fix and Enter key support

This commit is contained in:
John Jenko 2009-12-10 18:13:05 +00:00
parent eabc9324bc
commit bbd820532e
2 changed files with 150 additions and 12 deletions

View File

@ -670,7 +670,7 @@ namespace Volian.Controls.Library
{
string roapp = Environment.GetEnvironmentVariable("roapp");
LinkText lt = new LinkText(_MyStepRTB.MyLinkText);
string roloc = lt.MyRoUsageInfo.MyRODb.FolderPath;
string roloc = "\"" + lt.MyRoUsageInfo.MyRODb.FolderPath + "\"";
System.Diagnostics.Process.Start(roapp, roloc + " " + lt.MyRoUsageInfo.ROID);
}
}
@ -742,7 +742,7 @@ namespace Volian.Controls.Library
MessageBox.Show("Could not find associated path for ro data.");
return;
}
string roloc = MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath;
string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\"";
System.Diagnostics.Process.Start(roapp, roloc);
}
@ -822,8 +822,9 @@ namespace Volian.Controls.Library
MyStepItem.MyStepPanel.OnTabDisplay(sender, args);
}
private void btnDelStep_Click(object sender, EventArgs e)
public void btnDelStep_Click(object sender, EventArgs e)
{
bool surpressMessageBox = (e == null);
SectionInfo si = MyStepItem.MyItemInfo as SectionInfo;
if (si != null)
{
@ -851,12 +852,15 @@ namespace Volian.Controls.Library
MessageBox.Show("Unknown type, cannot delete!");
return;
}
string msgs = stpi.HasChildren ? "Are you sure you want to delete this step and its substeps?" : "Are you sure you want to delete this step?";
DialogResult results = MessageBox.Show(msgs, "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (results == DialogResult.Yes)
if (!surpressMessageBox)
{
MyStepItem.RemoveItem();
string msgs = stpi.HasChildren ? "Are you sure you want to delete this step and its substeps?" : "Are you sure you want to delete this step?";
DialogResult results = MessageBox.Show(msgs, "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (results == DialogResult.Yes)
MyStepItem.RemoveItem();
}
else
MyStepItem.RemoveItem();
}
private void btnCMIns_PopupClose(object sender, EventArgs e)
@ -866,33 +870,42 @@ namespace Volian.Controls.Library
public void ShortCutContextMenu(string menuName)
{
bool displayMenu = true;
bool displayMenu = false;
E_AccStep? actable = 0;
StepData sd = MyItemInfo.FormatStepData;
actable = sd.StepEditData.AcTable;
if (actable == null) actable = 0;
//btnInsCaut.Enabled = (actable & E_AccStep.AddingCaution) > 0;
switch (menuName)
{
case "InsHLS":
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsHLS);
displayMenu = true;
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsHLS);
break;
case "InsRNO":
displayMenu = (actable & E_AccStep.AddingRNO) > 0;
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsRNO);
break;
case "InsSubStps":
displayMenu = (actable & E_AccStep.AddingSub) > 0;
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsSubStps);
break;
case "InsCaution":
displayMenu = (actable & E_AccStep.AddingCaution) > 0;
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsCaution);
break;
case "InsNote":
displayMenu = (actable & E_AccStep.AddingNote) > 0;
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsNote);
break;
case "InsTable":
displayMenu = (actable & E_AccStep.AddingTable) > 0;
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsTable);
break;
case "InsFigure":
displayMenu = (actable & E_AccStep.AddingTable) > 0;
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsFigure);
break;
default:
displayMenu = false;
break;
}
if (displayMenu)
{
@ -912,6 +925,131 @@ namespace Volian.Controls.Library
//dlgFindReplace.Show();
}
private void InsertSiblingBeforeOrAfter(string b4aftr)
{
E_AccStep? actable = 0;
StepData sd = MyItemInfo.FormatStepData;
actable = sd.StepEditData.AcTable;
if (actable == null) actable = 0;
switch (b4aftr)
{
case "after":
if ((actable & E_AccStep.AddingNext) > 0)
MyStepItem.AddSiblingAfter();
break;
case "before":
if ((actable & E_AccStep.AddingPrev) > 0)
MyStepItem.AddSiblingBefore();
break;
}
}
public void ProcessEnterKey()
{
bool deletedEmpty = false;
bool deletedHLS = false;
bool deletedSubStep = false;
bool deletedRNO = false;
bool deletedNote = false;
bool deletedCaution = false;
if (MyStepRTB.Text.Length < 1) //empty step text
{
deletedEmpty = true;
deletedHLS = MyItemInfo.IsHigh;
deletedSubStep = MyItemInfo.IsSubStep;
deletedRNO = MyItemInfo.IsRNO;
deletedNote = MyItemInfo.IsNote;
deletedCaution = MyItemInfo.IsCaution;
btnDelStep_Click(MyStepRTB, null); // delete the empty step piece
}
if (MyItemInfo.IsHigh)
{
if (!deletedHLS)
{
if (deletedSubStep)
ShortCutContextMenu("InsHLS");
else if (MyStepItem.MyRNOStepItems != null && MyStepItem.MyRNOStepItems.Count > 0)
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlRight); // jump to RNO
else if (deletedRNO)
{
if (MyStepItem.NextDownStepItem.MyItemInfo.MyParent.Equals(MyStepItem.MyItemInfo))
{
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
InsertSiblingBeforeOrAfter("before");
}
else
ShortCutContextMenu("InsSubStps");
}
else if (!deletedHLS)
ShortCutContextMenu("InsRNO"); // create a new RNO
}
}
else if (MyItemInfo.IsRNO)
{
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlLeft);
if (MyItemInfo.IsHigh)
{
if (MyStepItem.NextDownStepItem.MyItemInfo.MyParent.Equals(MyStepItem.MyItemInfo))
{
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
InsertSiblingBeforeOrAfter("before");
}
else
ShortCutContextMenu("InsSubStps");
}
else
InsertSiblingBeforeOrAfter("after");
}
else if (MyItemInfo.IsInRNO && MyItemInfo.IsSubStep)
{
if (deletedEmpty)
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlLeft);
InsertSiblingBeforeOrAfter("after");
}
else if (MyItemInfo.IsSubStep)
{
if (deletedSubStep)
{
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlUp); // jump to HLS
ShortCutContextMenu("InsHLS"); // prompt for new HLS
}
else if (deletedRNO)
InsertSiblingBeforeOrAfter("after");
else if (MyStepItem.MyRNOStepItems != null && MyStepItem.MyRNOStepItems.Count > 0)
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlRight); // jump to RNO
else
ShortCutContextMenu("InsRNO"); // create a new RNO
}
else if (MyItemInfo.IsCaution)
{
if (deletedEmpty)
{
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
if (deletedCaution)
ShortCutContextMenu("InsNote");
}
else
InsertSiblingBeforeOrAfter("after");
}
else if (MyItemInfo.IsNote)
{
if (!deletedEmpty)
InsertSiblingBeforeOrAfter("after");
else
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlDown);
}
else if (MyItemInfo.IsTable || MyItemInfo.IsFigure)
{
MyStepRTB.StepRTB_ArrowPressed(E_ArrowKeys.CtrlUp);
if (MyItemInfo.IsHigh)
ShortCutContextMenu("InsHLS");
else
InsertSiblingBeforeOrAfter("after");
}
}
}
public enum E_FieldToEdit { StepText, Text, Number };