RO Editor access fix and Enter key support
This commit is contained in:
		@@ -670,7 +670,7 @@ namespace Volian.Controls.Library
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
				string roapp = Environment.GetEnvironmentVariable("roapp");
 | 
									string roapp = Environment.GetEnvironmentVariable("roapp");
 | 
				
			||||||
				LinkText lt = new LinkText(_MyStepRTB.MyLinkText);
 | 
									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);
 | 
									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.");
 | 
									MessageBox.Show("Could not find associated path for ro data.");
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			string roloc = MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath;
 | 
								string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\"";
 | 
				
			||||||
			System.Diagnostics.Process.Start(roapp, roloc);
 | 
								System.Diagnostics.Process.Start(roapp, roloc);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -822,8 +822,9 @@ namespace Volian.Controls.Library
 | 
				
			|||||||
			MyStepItem.MyStepPanel.OnTabDisplay(sender, args);
 | 
								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;
 | 
								SectionInfo si = MyStepItem.MyItemInfo as SectionInfo;
 | 
				
			||||||
			if (si != null)
 | 
								if (si != null)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -851,12 +852,15 @@ namespace Volian.Controls.Library
 | 
				
			|||||||
				MessageBox.Show("Unknown type, cannot delete!");
 | 
									MessageBox.Show("Unknown type, cannot delete!");
 | 
				
			||||||
				return;
 | 
									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?";
 | 
								if (!surpressMessageBox)
 | 
				
			||||||
			DialogResult results = MessageBox.Show(msgs, "Verify Delete",	MessageBoxButtons.YesNo, MessageBoxIcon.Question);
 | 
					 | 
				
			||||||
			if (results == DialogResult.Yes)
 | 
					 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				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)
 | 
							private void btnCMIns_PopupClose(object sender, EventArgs e)
 | 
				
			||||||
@@ -866,33 +870,42 @@ namespace Volian.Controls.Library
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		public void ShortCutContextMenu(string menuName)
 | 
							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)
 | 
								switch (menuName)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				case "InsHLS":
 | 
									case "InsHLS":
 | 
				
			||||||
				_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsHLS);
 | 
										displayMenu = true;
 | 
				
			||||||
 | 
										_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsHLS);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case "InsRNO":
 | 
									case "InsRNO":
 | 
				
			||||||
 | 
										displayMenu = (actable & E_AccStep.AddingRNO) > 0;
 | 
				
			||||||
					_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsRNO);
 | 
										_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsRNO);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case "InsSubStps":
 | 
									case "InsSubStps":
 | 
				
			||||||
 | 
										displayMenu = (actable & E_AccStep.AddingSub) > 0;
 | 
				
			||||||
					_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsSubStps);
 | 
										_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsSubStps);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case "InsCaution":
 | 
									case "InsCaution":
 | 
				
			||||||
 | 
										displayMenu = (actable & E_AccStep.AddingCaution) > 0;
 | 
				
			||||||
					_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsCaution);
 | 
										_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsCaution);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case "InsNote":
 | 
									case "InsNote":
 | 
				
			||||||
 | 
										displayMenu = (actable & E_AccStep.AddingNote) > 0;
 | 
				
			||||||
					_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsNote);
 | 
										_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsNote);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case "InsTable":
 | 
									case "InsTable":
 | 
				
			||||||
 | 
										displayMenu = (actable & E_AccStep.AddingTable) > 0;
 | 
				
			||||||
					_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsTable);
 | 
										_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsTable);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case "InsFigure":
 | 
									case "InsFigure":
 | 
				
			||||||
 | 
										displayMenu = (actable & E_AccStep.AddingTable) > 0;
 | 
				
			||||||
					_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsFigure);
 | 
										_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMInsFigure);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				default:
 | 
					 | 
				
			||||||
					displayMenu = false;
 | 
					 | 
				
			||||||
					break;
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (displayMenu)
 | 
								if (displayMenu)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -912,6 +925,131 @@ namespace Volian.Controls.Library
 | 
				
			|||||||
			//dlgFindReplace.Show();
 | 
								//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 };
 | 
					public enum E_FieldToEdit { StepText, Text, Number };
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs
									
									
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user