 e063da6198
			
		
	
	e063da6198
	
	
	
		
			
			Added code to handle refreshing the Edit Screen when a section is moved. Added code to refresh the Edit Screen when a section is moved.
		
			
				
	
	
		
			1243 lines
		
	
	
		
			40 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			1243 lines
		
	
	
		
			40 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.ComponentModel;
 | |
| using System.Collections.Generic;
 | |
| using System.Diagnostics;
 | |
| using System.Text;
 | |
| using System.Windows.Forms;
 | |
| using VEPROMS.CSLA.Library;
 | |
| using System.Drawing;
 | |
| using System.Text.RegularExpressions;
 | |
| using Volian.Base.Library;
 | |
| 
 | |
| namespace Volian.Controls.Library
 | |
| {
 | |
| 	public partial class StepPanel : Panel
 | |
| 	{
 | |
| 		#region Fields
 | |
| 		private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
 | |
| 		/// <summary>
 | |
| 		/// Procedure Item Info - Top ItemInfo
 | |
| 		/// </summary>
 | |
| 		private ItemInfo _MyProcedureItemInfo;
 | |
| 		private E_ViewMode _VwMode = E_ViewMode.Edit;
 | |
| 		public E_ViewMode VwMode
 | |
| 		{
 | |
| 			get { return _VwMode; }
 | |
| 			set { _VwMode = value; }
 | |
| 		}
 | |
| 		private EditItem _TopMostEditItem = null;
 | |
| 		public EditItem TopMostEditItem
 | |
| 		{
 | |
| 			get { return _TopMostEditItem; }
 | |
| 			set { _TopMostEditItem = value; }
 | |
| 		}
 | |
| 		private ItemInfo _ExpandingHLS = null;
 | |
| 		public ItemInfo ExpandingHLS
 | |
| 		{
 | |
| 			get { return _ExpandingHLS; }
 | |
| 			set { _ExpandingHLS = value; }
 | |
| 		}
 | |
| 		// TODO: This is not correct.  There should be a dictionary of Section Layouts
 | |
| 		/// <summary>
 | |
| 		/// Lookup Table to convert ItemInfo.ItemID to EditItem
 | |
| 		/// </summary>
 | |
| 		internal Dictionary<int, EditItem> _LookupEditItems;
 | |
| 		public EditItem FindItem(ItemInfo itemInfo)
 | |
| 		{
 | |
| 			if (itemInfo == null) return null;
 | |
| 			if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) return null;
 | |
| 			return _LookupEditItems[itemInfo.ItemID];
 | |
| 		}
 | |
| 		private int _ApplDisplayMode = -1;
 | |
| 		public int ApplDisplayMode
 | |
| 		{
 | |
| 			get { return _ApplDisplayMode; }
 | |
| 			set 
 | |
| 			{ 
 | |
| 				if(_ApplDisplayMode == value) return;
 | |
| 				_ApplDisplayMode = value;
 | |
| 				foreach (Control c in Controls)
 | |
| 				{
 | |
| 					EditItem ei = c as EditItem;
 | |
| 					if (ei != null)
 | |
| 					{
 | |
| 						ei.Enabled = ei.MyItemInfo.IsApplicable(value);
 | |
| 						//IItemConfig cfg = ei.MyItemInfo.MyConfig as IItemConfig;
 | |
| 						//List<int> apples = cfg.MasterSlave_Applicability.GetFlags();
 | |
| 						//if (value == -1 || apples.Count == 0)
 | |
| 						//  ei.Enabled = true;
 | |
| 						//else
 | |
| 						//  ei.Enabled = apples.Contains(value);
 | |
| 					}
 | |
| 				}
 | |
| 			}
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Currently selected ItemInfo
 | |
| 		/// </summary>
 | |
| 		internal ItemInfo _SelectedItemInfo;
 | |
| 		private int _ItemMoving = 0;
 | |
| 		private StepPanelSettings _MyStepPanelSettings;
 | |
| 		private int _MaxRNO = -1; // TODO: Need to calculate MaxRNO on a section basis rather than for a panel
 | |
| 		private Font _MyFont = null;
 | |
| 		private Font _ProcFont = new Font("Arial", 12, FontStyle.Bold);
 | |
| 		private Font _SectFont = new Font("Arial", 10, FontStyle.Bold);
 | |
| 		private Font _StepFont = new Font("Arial", 10);
 | |
| 		private Color _ActiveColor = Color.SkyBlue;
 | |
| 		private Color _InactiveColor = Color.Linen;
 | |
| 		private Color _AnnotationColor = Color.FromArgb(255, 255, 128);
 | |
| 		private Color _TabColor = Color.Beige;
 | |
| 		private Color _PanelColor = Color.LightGray;
 | |
| 		// Whether panel is in view or edit mode.  Toggled from steprtb
 | |
| 		// or set based on approval/multi-user (these two will be done
 | |
| 		// later.
 | |
| 		//public E_ViewMode PanelViewEditMode = E_ViewMode.Edit;
 | |
| 		internal string _LastAdjust="";
 | |
| 		private bool _ShowLines = true;
 | |
| 		private Graphics _MyGraphics = null;
 | |
| 		private int _DPI = 0;
 | |
| 		#endregion
 | |
| 		#region Item Events
 | |
| 		/// <summary>
 | |
| 		/// Occurs when the user clicks tab of a EditItem
 | |
| 		/// </summary>
 | |
| 		public event StepPanelEvent ItemClick;
 | |
| 		/// <summary>
 | |
| 		/// Checks to see if the 'ItemClick' event is handled and launches it
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="args"></param>
 | |
| 		internal void OnItemClick(object sender, StepPanelEventArgs args)
 | |
| 		{
 | |
| 		  if (ItemClick != null) ItemClick(sender, args);
 | |
| 		}
 | |
| 		public bool ItemSelectionChangeShown = false; // This keeps OnItemSelectedChanged from being called twice when an item is selected.
 | |
| 		/// <summary>
 | |
| 		/// Occurs when the selected EditItem changes
 | |
| 		/// </summary>
 | |
| 		public event ItemSelectedChangedEvent ItemSelectedChanged;
 | |
| 		/// <summary>
 | |
| 		/// Checks to see if the 'ItemSelectedChanged' event is handled and launches it
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="args"></param>
 | |
| 		internal void OnItemSelectedChanged(object sender, ItemSelectedChangedEventArgs args)
 | |
| 		{
 | |
| 			ItemSelectionChangeShown = true;//Remember that you have run already
 | |
| 			//vlnStackTrace.ShowStack(string.Format("OnItemSelectedChanged {0}",args.MyItemInfo.ItemID));
 | |
| 			if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args);
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Occurs when the user clicks on the Attachment Expander
 | |
| 		/// </summary>
 | |
| 		public event StepPanelAttachmentEvent AttachmentClicked;
 | |
| 		/// <summary>
 | |
| 		/// Checks to see if the 'AttachmentClicked' event is handled and launches it
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="args"></param>
 | |
| 		internal void OnAttachmentClicked(object sender, StepPanelAttachmentEventArgs args)
 | |
| 		{
 | |
| 			if (AttachmentClicked != null) AttachmentClicked(sender, args);
 | |
| 			else MessageBox.Show(args.MyEditItem.MyItemInfo.MyContent.MyEntry.MyDocument.DocumentTitle, "Unhandled Attachment Click", MessageBoxButtons.OK, MessageBoxIcon.Information);
 | |
| 		}
 | |
| 
 | |
| 		// Edit/View mode change
 | |
| 		//public event StepPanelModeChangeEvent ModeChange;
 | |
| 		//internal void OnModeChange(object sender, StepRTBModeChangeEventArgs args)
 | |
| 		//{
 | |
| 		//    PanelViewEditMode = args.ViewMode;
 | |
| 		//    ModeChange(sender, args);
 | |
| 		//}
 | |
| 		// various selections from steptabribbon that need to filter up to frmveproms
 | |
| 		// such as 'global search', 'bookmarks'
 | |
| 		public event StepPanelTabDisplayEvent TabDisplay;
 | |
| 		internal void OnTabDisplay(object sender, StepPanelTabDisplayEventArgs args)
 | |
| 		{
 | |
| 			TabDisplay(sender, args);
 | |
| 		}
 | |
| 		// close section, if deleting word doc section
 | |
| 		public event StepPanelWordSectionCloseEvent WordSectionClose;
 | |
| 		internal void OnWordSectionClose(object sender, WordSectionEventArgs args)
 | |
| 		{
 | |
| 			WordSectionClose(sender, args);
 | |
| 		}
 | |
| 		// if section deleted, have event to flag in other UI panels
 | |
| 		public event StepPanelWordSectionDeletedEvent WordSectionDeleted;
 | |
| 		internal void OnWordSectionDeleted(object sender, WordSectionEventArgs args)
 | |
| 		{
 | |
| 			WordSectionDeleted(sender, args);
 | |
| 		}
 | |
| 		// if item pasted, have event to flag in other UI panels
 | |
| 		public event StepPanelItemPastedEvent ItemPasted;
 | |
| 		internal void OnItemPasted(object sender, vlnTreeItemInfoPasteEventArgs args)
 | |
| 		{
 | |
| 			ItemPasted(sender, args);
 | |
| 		}
 | |
| 		#endregion
 | |
| 		#region Link Events
 | |
| 		/// <summary>
 | |
| 		/// Occurs when the user moves onto or off of a Link
 | |
| 		/// </summary>
 | |
| 		public event StepPanelLinkEvent LinkActiveChanged;
 | |
| 		/// <summary>
 | |
| 		/// Checks to see if the 'LinkActiveChanged' event is handled and launches it
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="args"></param>
 | |
| 		internal void OnLinkActiveChanged(object sender, StepPanelLinkEventArgs args)
 | |
| 		{
 | |
| 			if (LinkActiveChanged != null) LinkActiveChanged(sender, args);
 | |
| 			else MessageBox.Show(args.LinkInfoText, "Unhandled Link Active Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Occurs when the user chooses to Insert a Transition
 | |
| 		/// </summary>
 | |
| 		public event StepPanelLinkEvent LinkInsertTran;
 | |
| 		/// <summary>
 | |
| 		/// Checks to see if the 'LinkInsertTran' event is handled and launches it
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="args"></param>
 | |
| 		internal void OnLinkInsertTran(object sender, StepPanelLinkEventArgs args)
 | |
| 		{
 | |
| 			if (LinkInsertTran != null) LinkInsertTran(sender, args);
 | |
| 			else MessageBox.Show(args.LinkInfoText, "Unhandled Link Insert Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Occurs when the user chooses to Insert an RO
 | |
| 		/// </summary>
 | |
| 		public event StepPanelLinkEvent LinkInsertRO;
 | |
| 		/// <summary>
 | |
| 		/// Checks to see if the 'LinkInsertRO' event is handled and launches it
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="args"></param>
 | |
| 		internal void OnLinkInsertRO(object sender, StepPanelLinkEventArgs args)
 | |
| 		{
 | |
| 			if (LinkInsertRO != null) LinkInsertRO(sender, args);
 | |
| 			else MessageBox.Show(args.LinkInfoText, "Unhandled Link Insert RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Occurs when the user clicks a Link
 | |
| 		/// </summary>
 | |
| 		public event StepPanelLinkEvent LinkClicked;
 | |
| 		/// <summary>
 | |
| 		/// Checks to see if the 'LinkClicked' event is handled and launches it
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="args"></param>
 | |
| 		internal void OnLinkClicked(object sender, StepPanelLinkEventArgs args)
 | |
| 		{
 | |
| 			if (LinkClicked != null) LinkClicked(sender, args);
 | |
| 			else MessageBox.Show(args.LinkInfoText, "Unhandled Link Click", MessageBoxButtons.OK, MessageBoxIcon.Information);
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Occurs when the user chooses to modify a Transition
 | |
| 		/// </summary>
 | |
| 		public event StepPanelLinkEvent LinkModifyTran;
 | |
| 		/// <summary>
 | |
| 		/// Checks to see if the 'LinkModifyTran' event is handled and launches it
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="args"></param>
 | |
| 		internal void OnLinkModifyTran(object sender, StepPanelLinkEventArgs args)
 | |
| 		{
 | |
| 			if (LinkModifyTran != null) LinkModifyTran(sender, args);
 | |
| 			else MessageBox.Show(args.LinkInfoText, "Unhandled Link Modify Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Occurs when the user chooses to modify an RO
 | |
| 		/// </summary>
 | |
| 		public event StepPanelLinkEvent LinkModifyRO;
 | |
| 		/// <summary>
 | |
| 		/// Checks to see if the 'LinkModifyRO' event is handled and launches it
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="args"></param>
 | |
| 		internal void OnLinkModifyRO(object sender, StepPanelLinkEventArgs args)
 | |
| 		{
 | |
| 			if (LinkModifyRO != null) LinkModifyRO(sender, args);
 | |
| 			else MessageBox.Show(args.LinkInfoText, "Unhandled Link Modify RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
 | |
| 		}
 | |
| 		#endregion
 | |
| 		#region Constructors
 | |
| 		public StepPanel()
 | |
| 		{
 | |
| 			InitializeComponent();
 | |
| 			SetupStepPanel();
 | |
| 		}
 | |
| 		private void SetupStepPanel()
 | |
| 		{
 | |
| 			this.BackColorChanged += new EventHandler(StepPanel_BackColorChanged);
 | |
| 			if (VlnSettings.DebugMode)
 | |
| 			{
 | |
| 				_InactiveColor = Color.Linen;
 | |
| 				_TabColor = Color.Beige;
 | |
| 				_PanelColor = Color.LightGray;
 | |
| 				this.Paint += new PaintEventHandler(StepPanel_Paint);
 | |
| 				this.DoubleClick += new EventHandler(StepPanel_DoubleClick); // Toggles Vertical lines on and off
 | |
| 			}
 | |
| 			else
 | |
| 			{
 | |
| 				_InactiveColor = Color.White;
 | |
| 				_TabColor = Color.White;
 | |
| 				_PanelColor = Color.White;
 | |
| 				this.BackColor = Color.White;
 | |
| 			}
 | |
| 			this.AutoScroll = true;
 | |
| 		}
 | |
| 		public StepPanel(IContainer container)
 | |
| 		{
 | |
| 			container.Add(this);
 | |
| 			InitializeComponent();
 | |
| 			SetupStepPanel();
 | |
| 		}
 | |
| 		void StepPanel_BackColorChanged(object sender, EventArgs e)
 | |
| 		{
 | |
| 			// Walk through controls & set colors
 | |
| 			InactiveColor = PanelColor = BackColor;
 | |
| 			foreach (Control ctrl in Controls)
 | |
| 			{
 | |
| 				if (ctrl is EditItem)
 | |
| 				{
 | |
| 					EditItem ei = (EditItem)ctrl;
 | |
| 					ei.BackColor = BackColor;
 | |
| 				}
 | |
| 			}
 | |
| 		}
 | |
| 		#endregion
 | |
| 		#region Private Methods
 | |
| 		/// <summary>
 | |
| 		/// Expands an Item and It's Parents as need to display an item
 | |
| 		/// </summary>
 | |
| 		/// <param name="myItemInfo">Item to Expand</param>
 | |
| 		private void ExpandAsNeeded(ItemInfo myItemInfo)
 | |
| 		{
 | |
| 			int id = myItemInfo.ItemID;
 | |
| 			if (!_LookupEditItems.ContainsKey(id)) // If the item is not currently displayed
 | |
| 				ExpandAsNeeded((ItemInfo)myItemInfo.ActiveParent); // Expand it's parent
 | |
| 			if (_LookupEditItems.ContainsKey(id)) // Expanding Parent should have added it to _LookupEditItems
 | |
| 			{
 | |
| 				EditItem itm = _LookupEditItems[id];
 | |
| 				ItemInfo ii = myItemInfo.ActiveParent as ItemInfo;
 | |
| 				if (itm.Visible == false && ii != null)
 | |
| 					ExpandAsNeeded((ItemInfo)myItemInfo.ActiveParent);
 | |
| 				itm.AutoExpand(); // Expand it if it should expand
 | |
| 			}
 | |
| 		}
 | |
| 		#endregion
 | |
| 		#region Properties
 | |
| 		public StepTabPanel MyStepTabPanel
 | |
| 		{ get { return Parent as StepTabPanel; } }
 | |
| 		/// <summary>
 | |
| 		/// Procedure Item Info - Top ItemInfo
 | |
| 		/// Get and Set - Set stes-up all of the 
 | |
| 		/// </summary>
 | |
| 		public ItemInfo MyProcedureItemInfo
 | |
| 		{
 | |
| 			get { return _MyProcedureItemInfo; }
 | |
| 			set
 | |
| 			{
 | |
| 				//// TIMING: DisplayItem.TimeIt("pMyItem Start");
 | |
| 				_MyProcedureItemInfo = value;
 | |
| 				//// TIMING: DisplayItem.TimeIt("pMyItem Layout");
 | |
| 				//this.Layout += new LayoutEventHandler(DisplayPanel_Layout);
 | |
| 				//this.Scroll += new ScrollEventHandler(DisplayPanel_Scroll);
 | |
| 				//// TIMING: DisplayItem.TimeIt("pMyItem Scroll");
 | |
| 				Controls.Clear();
 | |
| 				_LookupEditItems = new Dictionary<int, EditItem>();
 | |
| 				//// TIMING: DisplayItem.TimeIt("pMyItem Clear");
 | |
| 				//SuspendLayout();
 | |
| 				new RTBItem(_MyProcedureItemInfo, this, null, ChildRelation.None, false);
 | |
| 				//ResumeLayout();
 | |
| 				//// TIMING: DisplayItem.TimeIt("pMyItem End");
 | |
| 			}
 | |
| 		}
 | |
| 		public bool AutoExpand
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				// This is temporary to get the code working for this particular procedure
 | |
| 				if (MyProcedureItemInfo.DisplayNumber == "PMS-810") return false;
 | |
| 				if (MyProcedureItemInfo.DisplayNumber == "PMS-809") return false;
 | |
| 				return true;
 | |
| 			}
 | |
| 		}
 | |
| 		public void Reset()
 | |
| 		{
 | |
| 			ItemInfo parent = SelectedItemInfo.ActiveParent as ItemInfo;
 | |
| 			if (parent != null) ItemInfo.ResetParts(parent.ItemID);  // Force data to reload
 | |
| 			else ItemInfo.ResetParts(SelectedItemInfo.ItemID);
 | |
| 			// The following line actually reloads the procedure item
 | |
| 			MyProcedureItemInfo = MyProcedureItemInfo;		// see get/set above. - Load Procedure and Sections
 | |
| 			// The following line expands the items needed to display SelectedItemInfo
 | |
| 			ExpandAsNeeded(SelectedItemInfo);
 | |
| 		}
 | |
| 		public void Reset(ItemInfo myItemInfo)
 | |
| 		{
 | |
| 			ItemInfo parent = myItemInfo.ActiveParent as ItemInfo;
 | |
| 			if (parent != null) ItemInfo.ResetParts(parent.ItemID);  // Force data to reload
 | |
| 			else ItemInfo.ResetParts(myItemInfo.ItemID);
 | |
| 			// The following line actually reloads the procedure item
 | |
| 			MyProcedureItemInfo = MyProcedureItemInfo;		// see get/set above. - Load Procedure and Sections
 | |
| 			// The following line expands the items needed to display SelectedItemInfo
 | |
| 			ExpandAsNeeded(myItemInfo);
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Currently selected StepRTB
 | |
| 		/// </summary>
 | |
| 		//private StepRTB _SelectedStepRTB = null;
 | |
| 		//public StepRTB SelectedStepRTB
 | |
| 		//{
 | |
| 		//    get { return _SelectedStepRTB; }
 | |
| 		//    set { _SelectedStepRTB=value;}
 | |
| 		//}
 | |
| 		/// <summary>
 | |
| 		/// Gets or Sets the SelectedItemInfo
 | |
| 		/// Activates and Expands as necessary
 | |
| 		/// </summary>
 | |
| 		public ItemInfo SelectedItemInfo
 | |
| 		{
 | |
| 			get { return _SelectedItemInfo; }
 | |
| 			set
 | |
| 			{
 | |
| 				_SelectedItemInfo = value;
 | |
| 				ItemSelectionChangeShown = false;	//OnItemSelectedChanged has not run yet.
 | |
| 				SelectedEditItem.ItemSelect();
 | |
| 				if (!ItemSelectionChangeShown) OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(SelectedEditItem));
 | |
| 			}
 | |
| 		}
 | |
| 		public EditItem GetEditItem(ItemInfo itemInfo)
 | |
| 		{
 | |
| 			ExpandAsNeeded(itemInfo);
 | |
| 			if (_SelectedItemInfo == null) _SelectedItemInfo = itemInfo;
 | |
| 			//if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) Reset();
 | |
| 			if (itemInfo.Moving)
 | |
| 			{
 | |
| 				Reset(itemInfo);
 | |
| 				itemInfo.Moving = false;
 | |
| 			}
 | |
| 			else if ( !_LookupEditItems.ContainsKey(itemInfo.ItemID)) Reset(itemInfo);
 | |
| 			if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) return null;
 | |
| 			return _LookupEditItems[itemInfo.ItemID];
 | |
| 		}
 | |
| 		private bool _DisplayItemChanging = false;
 | |
| 		public bool DisplayItemChanging
 | |
| 		{
 | |
| 			get { return _DisplayItemChanging; }
 | |
| 			set { _DisplayItemChanging = value; }
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Returns the SelectedEditItem
 | |
| 		/// </summary>
 | |
| 		private EditItem _SelectedEditItem;
 | |
| 		public EditItem SelectedEditItem
 | |
| 		{
 | |
| 			get 
 | |
| 			{
 | |
| 				return _SelectedEditItem;
 | |
| 				//return (_SelectedItemInfo != null) ? _LookupEditItems[_SelectedItemInfo.ItemID] : null; 
 | |
| 			}
 | |
| 			set
 | |
| 			{
 | |
| 				EditItem lastEI = _SelectedEditItem;
 | |
| 				if (value != null) value.SetActive(); // Set the active color
 | |
| 				if (lastEI == value) return; // Same - No Change
 | |
| 				
 | |
| 				if (lastEI != null && lastEI.BeingDisposed == false)
 | |
| 				{
 | |
| 					bool shouldDelete = !lastEI.BeingRemoved && lastEI.Empty && (lastEI.MyItemInfo.MyContent.ContentEntryCount <= 0);
 | |
| 					if (shouldDelete)
 | |
| 					{
 | |
| 						if (lastEI.HasChildren)
 | |
| 						{
 | |
| 							if (value != null && value.MyItemInfo.HasAncestor(lastEI.MyItemInfo))
 | |
| 							{
 | |
| 								shouldDelete = false;
 | |
| 							}
 | |
| 							else
 | |
| 							{
 | |
| 								DialogResult result = MessageBox.Show("This step does not have text but has substeps. Do you want to delete it and its substeps?", "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
 | |
| 								if (result == DialogResult.No) shouldDelete = false;
 | |
| 							}
 | |
| 						}
 | |
| 					}
 | |
| 					if (shouldDelete)
 | |
| 					{
 | |
| 						float oldTop = lastEI.Top;
 | |
| 						EditItem newFocus = lastEI.DeleteItem();
 | |
| 						float newTop = newFocus.Top;
 | |
| 						lastEI.Dispose();
 | |
| 						newFocus.SetAllTabs();
 | |
| 						// If the step being deleted appears above the step to recieve focus, find another step 
 | |
| 						// to use so that the steps are positioned properly (vertically)
 | |
| 						if (oldTop < newTop)
 | |
| 						{
 | |
| 							if (newFocus.MyParentEditItem != null)
 | |
| 							{
 | |
| 								if (newFocus.Top > newFocus.MyParentEditItem.Top)
 | |
| 									newFocus.MyParentEditItem.AdjustLocation();
 | |
| 								else if (newFocus.MyParentEditItem.MyPreviousEditItem != null &&
 | |
| 									newFocus.Top > newFocus.MyParentEditItem.MyPreviousEditItem.Top)
 | |
| 									newFocus.MyParentEditItem.MyPreviousEditItem.AdjustLocation();
 | |
| 								else if (newFocus.MyParentEditItem.MyParentEditItem != null &&
 | |
| 									newFocus.Top > newFocus.MyParentEditItem.MyParentEditItem.Top)
 | |
| 									newFocus.MyParentEditItem.MyParentEditItem.AdjustLocation();
 | |
| 								else
 | |
| 									newFocus.AdjustLocation();
 | |
| 							}
 | |
| 							else if (newFocus.MyPreviousEditItem != null)
 | |
| 								newFocus.MyPreviousEditItem.AdjustLocation();
 | |
| 							else
 | |
| 								newFocus.AdjustLocation();
 | |
| 						}
 | |
| 						else
 | |
| 							newFocus.AdjustLocation();
 | |
| 					}
 | |
| 					else
 | |
| 					{
 | |
| 						lastEI.SaveContents();
 | |
| 						if (!(lastEI.MyItemInfo.IsTable))
 | |
| 							lastEI.RefreshDisplay(false);
 | |
| 					}
 | |
| 				}
 | |
| 				_SelectedEditItem = value;
 | |
| 				MyStepTabPanel.MyStepTabRibbon.MyEditItem = value;// Update StepTabRibbon.MyEditItem to match
 | |
| 				if (value != null)
 | |
| 				{
 | |
| 					_SelectedEditItem.RefreshDisplay(true);
 | |
| 					if (_SelectedItemInfo.ItemID != value.MyItemInfo.ItemID)
 | |
| 					{
 | |
| 						ExpandAsNeeded(value.MyItemInfo);
 | |
| 						SelectedItemInfo = value.MyItemInfo;
 | |
| 					}
 | |
| 				}
 | |
| 				if (lastEI != null)
 | |
| 					lastEI.IdentifyMe(false);
 | |
| 			}
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Displays the selected EditItem
 | |
| 		/// </summary>
 | |
| 		public void ItemShow()
 | |
| 		{
 | |
| 			if (_SelectedEditItem != null && SelectedEditItem.BeingDisposed == false)
 | |
| 			{
 | |
| 				SelectedEditItem.ItemShow();
 | |
| 				OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(SelectedEditItem));
 | |
| 			}
 | |
| 		}
 | |
| 		public new void MouseWheel(MouseEventArgs e)
 | |
| 		{
 | |
| 			base.OnMouseWheel(e);
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Used to track movement other than scrolling
 | |
| 		/// 0 - Indicates no other movement
 | |
| 		/// > 0 - Indicates that other movement is happening
 | |
| 		/// </summary>
 | |
| 		public int ItemMoving
 | |
| 		{
 | |
| 			get { return _ItemMoving; }
 | |
| 			set { _ItemMoving = value; }
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Lazy loaded StepPanelSettings
 | |
| 		/// </summary>
 | |
| 	public StepPanelSettings MyStepPanelSettings
 | |
| 	{
 | |
| 		get 
 | |
| 		{
 | |
| 			if (_MyStepPanelSettings == null) _MyStepPanelSettings = new StepPanelSettings(this);
 | |
| 			return _MyStepPanelSettings;
 | |
| 		}
 | |
| 		set { _MyStepPanelSettings = value;}
 | |
| 	}
 | |
| 		/// <summary>
 | |
| 		/// Gets or Sets the font for the Panel
 | |
| 		/// </summary>
 | |
| 		public Font MyFont
 | |
| 		{
 | |
| 			get { return _MyFont; }
 | |
| 			set { _ProcFont = _SectFont = _StepFont = _MyFont = value; }
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Gets or sets the font for the Procedure Text
 | |
| 		/// </summary>
 | |
| 		public Font ProcFont
 | |
| 		{
 | |
| 			get { return _ProcFont; }
 | |
| 			set { _ProcFont = value; }
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Gets or sets the font for the Section Text
 | |
| 		/// </summary>
 | |
| 		public Font SectFont
 | |
| 		{
 | |
| 			get { return _SectFont; }
 | |
| 			set { _SectFont = value; }
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Gets or sets the Step Font
 | |
| 		/// </summary>
 | |
| 		public Font StepFont
 | |
| 		{
 | |
| 			get { return _StepFont; }
 | |
| 			set { _StepFont = value; }
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Gets or Sets the Active Color for the Panel
 | |
| 		/// </summary>
 | |
| 		public Color ActiveColor
 | |
| 		{
 | |
| 			get { return _ActiveColor; }
 | |
| 			set { _ActiveColor = value; }
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Gets or Sets the Annotation backcolor for StepRTBs in the Panel
 | |
| 		/// </summary>
 | |
| 		public Color AnnotationColor
 | |
| 		{
 | |
| 			get { return _AnnotationColor; }
 | |
| 			set { _AnnotationColor = value; }
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Gets or sets the InActive Color for the Panel
 | |
| 		/// </summary>
 | |
| 		public Color InactiveColor
 | |
| 		{
 | |
| 			get { return _InactiveColor; }
 | |
| 			set { _InactiveColor = value; }
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Gets or sets the Tab Color
 | |
| 		/// </summary>
 | |
| 		public Color TabColor
 | |
| 		{
 | |
| 			get { return _TabColor; }
 | |
| 			set { _TabColor = value; }
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Gets or sets the Panel Color
 | |
| 		/// </summary>
 | |
| 		public Color PanelColor
 | |
| 		{
 | |
| 			get { return _PanelColor; }
 | |
| 			set { _PanelColor = value;
 | |
| 			BackColor = value;
 | |
| 		}
 | |
| 		}
 | |
| 		#endregion
 | |
| 		#region DisplayConversions
 | |
| 		/// <summary>
 | |
| 		/// gets a Graphic object for the panel
 | |
| 		/// </summary>
 | |
| 		public Graphics MyGraphics
 | |
| 		{
 | |
| 			get
 | |
| 			{
 | |
| 				if (_MyGraphics == null)
 | |
| 					_MyGraphics = CreateGraphics();
 | |
| 				return _MyGraphics;
 | |
| 			}
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Gets the DPI setting for the current graphics setting
 | |
| 		/// </summary>
 | |
| 		internal int DPI
 | |
| 		{
 | |
| 			get 
 | |
| 			{
 | |
| 				if (_DPI == 0)
 | |
| 					_DPI = Convert.ToInt32(MyGraphics.DpiX);
 | |
| 				return _DPI; 
 | |
| 			}
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Converts an integer value from Twips to Pixels
 | |
| 		/// </summary>
 | |
| 		/// <param name="value"></param>
 | |
| 		/// <returns></returns>
 | |
| 		public int ToDisplay(int value)
 | |
| 		{
 | |
| 			//return (DPI * value) / 864;
 | |
| 			return (DPI * value) / 72;
 | |
| 		}
 | |
| 		public int ToDisplay(float? value)
 | |
| 		{
 | |
| 			//return (DPI * value) / 864;
 | |
| 			return (int)(DPI * (value??0)) / 72;
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Converts an integer? value from Twips to Pixels
 | |
| 		/// </summary>
 | |
| 		/// <param name="value"></param>
 | |
| 		/// <returns></returns>
 | |
| 		public int ToDisplay(int? value)
 | |
| 		{
 | |
| 			return ToDisplay((int)value);
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Converts an string value from Twips to Pixels
 | |
| 		/// </summary>
 | |
| 		/// <param name="value"></param>
 | |
| 		/// <returns></returns>
 | |
| 		public int ToDisplay(string value)
 | |
| 		{
 | |
| 			return ToDisplay(Convert.ToSingle(value));
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Converts a value from a list in a string from Twips to Pixels
 | |
| 		/// </summary>
 | |
| 		/// <param name="value"></param>
 | |
| 		/// <returns></returns>
 | |
| 		public int ToDisplay(string value,int i)
 | |
| 		{
 | |
| 			if (i < 0) return 0;
 | |
| 			string s = value.Split(",".ToCharArray())[i];
 | |
| 			return ToDisplay(s);
 | |
| 		}
 | |
| 		#endregion
 | |
| 		#region Debug Methods
 | |
| 		/// <summary>
 | |
| 		/// Gets or sets ShowLines so that vertical lines are shown for debugging purposes
 | |
| 		/// </summary>
 | |
| 		public bool ShowLines
 | |
| 		{
 | |
| 			get { return _ShowLines; }
 | |
| 			set { _ShowLines = value; }
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Draw a vertical line
 | |
| 		/// </summary>
 | |
| 		/// <param name="g"></param>
 | |
| 		/// <param name="x"></param>
 | |
| 		private void VerticalLine(Graphics g, int x)
 | |
| 		{
 | |
| 			Pen bluePen = new Pen(Color.CornflowerBlue,1);
 | |
| 			g.DrawLine(bluePen, x, 0, x, this.Height);
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Toggle the vertical lines on and off
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="e"></param>
 | |
| 		private void StepPanel_DoubleClick(object sender, EventArgs e)
 | |
| 		{
 | |
| 			ShowLines = !ShowLines;
 | |
| 			Refresh();
 | |
| 		}
 | |
| 		private void StepPanel_Paint(object sender, PaintEventArgs e)
 | |
| 		{
 | |
| 			if (ShowLines)
 | |
| 			{
 | |
| 				//int fifth = Height / 5;
 | |
| 				//Rectangle r1 = new Rectangle(0, 0, Width, Height - fifth);
 | |
| 				////Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(r1, Color.FromArgb(128, 0, 32), Color.FromArgb(96, 0, 16), 90);
 | |
| 				//Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(r1, Color.FromArgb(255,128, 0, 32), Color.FromArgb(255,96, 0, 16),System.Drawing.Drawing2D.LinearGradientMode.Vertical);
 | |
| 				//e.Graphics.FillRectangle(b, r1);
 | |
| 				//r1 = new Rectangle(0, Height - fifth, Width, fifth);
 | |
| 				//b = new System.Drawing.Drawing2D.LinearGradientBrush(r1, Color.FromArgb(255,96, 0, 16), Color.FromArgb(255,128, 0, 32), 90);
 | |
| 				//e.Graphics.FillRectangle(b, r1);
 | |
| 				//VerticalLine(e.Graphics, 60);
 | |
| 				//VerticalLine(e.Graphics, 102);
 | |
| 				//VerticalLine(e.Graphics, 415);
 | |
| 			}
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Output all of the EditItem controls to the log
 | |
| 		/// </summary>
 | |
| 		private void ListControls()
 | |
| 		{
 | |
| 			// Walk through the controls and find the next control for each
 | |
| 			if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("'Item','Next'");
 | |
| 			foreach (Control control in Controls)
 | |
| 				if (control is EditItem)
 | |
| 				{
 | |
| 					EditItem ei = (EditItem)control;
 | |
| 					EditItem nxt = ei.NextDownEditItem;
 | |
| 					if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", ei.MyID, nxt == null ? 0 : nxt.MyID);
 | |
| 				}
 | |
| 		}
 | |
| 		#endregion
 | |
| 		#region Cursor Movement Methods
 | |
| 		/// <summary>
 | |
| 		/// Finds the Displayed 'top' child for a given item. Used for down arrow.
 | |
| 		/// </summary>
 | |
| 		/// <param name="ii">ItemInfo</param>
 | |
| 		/// <returns></returns>
 | |
| 		private ItemInfo TopPart(ItemInfo ii)
 | |
| 		{
 | |
| 			ExpandAsNeeded(ii);
 | |
| 			if (ii.Cautions != null) return TopPart(ii.Cautions[0]);
 | |
| 			if (ii.Notes != null) return TopPart(ii.Notes[0]);
 | |
| 			return (ii);
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Finds the Displayed 'bottom' child for a given item. Used for up arrow.
 | |
| 		/// </summary>
 | |
| 		/// <param name="ii">ItemInfo</param>
 | |
| 		/// <returns></returns>
 | |
| 		private ItemInfo BottomPart(ItemInfo ii)
 | |
| 		{
 | |
| 			ExpandAsNeeded(ii);
 | |
| 			if (ii.RNOs != null && ii.RNOLevel >= ii.ColumnMode) return BottomPart(ii.RNOs[0]);
 | |
| 			if (ii.Sections != null) return BottomPart(ii.Sections[0].LastSibling);
 | |
| 			if (ii.Steps != null) return BottomPart(ii.Steps[0].LastSibling);
 | |
| 			if (ii.Tables != null) return BottomPart(ii.Tables[0].LastSibling);
 | |
| 			return ii;
 | |
| 		}
 | |
| 		/// <summary>
 | |
| 		/// Supports cursor movement between richtext boxes, including arrow keys/page up,down/
 | |
| 		/// ctrl Home,End
 | |
| 		/// </summary>
 | |
| 		/// <param name="rtb">StepRTB</param>
 | |
| 		/// <param name="position">Point</param>
 | |
| 		/// <param name="arrow">E_ArrowKeys</param>
 | |
| 		public void CursorMovement(EditItem ei, Point position, E_ArrowKeys arrow)
 | |
| 		{
 | |
| 			ItemInfo ii = null;
 | |
| 			// The following lines are debug to check that the results of moving down and moving up are the same
 | |
| 			//ItemInfo ix = null;
 | |
| 			switch (arrow)
 | |
| 			{
 | |
| 				case E_ArrowKeys.Up:
 | |
| 				case E_ArrowKeys.CtrlUp:
 | |
| 					ii = ArrowUp(ei.MyItemInfo);
 | |
| 					// The following lines are debug to check that the results of moving down and moving up are the same
 | |
| 					//ix = ArrowDown(ii);
 | |
| 					//Console.WriteLine("'Up',{0},{1},{2},{3}", rtb.MyItemInfo.ItemID, rtb.MyItemInfo.DBSequence, ii.DBSequence, ix.DBSequence);
 | |
| 					if (ii != null) SelectedEditItem = _LookupEditItems[ii.ItemID];
 | |
| 					break;
 | |
| 				case E_ArrowKeys.Down:
 | |
| 				case E_ArrowKeys.CtrlDown:
 | |
| 					ii = MoveDown(ei, ii);
 | |
| 					break;
 | |
| 				case E_ArrowKeys.Right:
 | |
| 				case E_ArrowKeys.CtrlRight:
 | |
| 					if (!ei.MyItemInfo.IsInRNO && ei.MyItemInfo.RNOs != null)
 | |
| 						SelectedEditItem = _LookupEditItems[ei.MyItemInfo.RNOs[0].ItemID];
 | |
| 					else
 | |
| 						ii = MoveDown(ei, ii);
 | |
| 					break;
 | |
| 				case E_ArrowKeys.Left:
 | |
| 				//case E_ArrowKeys.CtrlLeft:
 | |
| 					if (!ei.MyItemInfo.IsProcedure)
 | |
| 					{
 | |
| 						EditItem tmpEI =  null;
 | |
| 						//SelectedEditItem = _LookupEditItems[ei.MyItemInfo.MyParent.ItemID];
 | |
| 						ii = ArrowUp(ei.MyItemInfo);
 | |
| 						if (ii != null)
 | |
| 						{
 | |
| 							ItemInfo tmpII = ii;
 | |
| 							while (!ei.MyItemInfo.IsInRNO && tmpII.RNOs != null)
 | |
| 								tmpII = GetLowestRNOEditItem(tmpII, ei.MyItemInfo);
 | |
| 							if (tmpII != ei.MyItemInfo)
 | |
| 								ii = tmpII;
 | |
| 							SelectedEditItem = _LookupEditItems[ii.ItemID];
 | |
| 						}
 | |
| 					}
 | |
| 					break;
 | |
| 				case E_ArrowKeys.CtrlLeft: // this logic is same as in 16-bit VE-PROMS
 | |
| 					if (!ei.MyItemInfo.IsProcedure)
 | |
| 						SelectedEditItem = _LookupEditItems[ei.MyItemInfo.MyParent.ItemID];
 | |
| 					break;
 | |
| 				default:
 | |
| 					break;
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		// This is used for the Left Arrow key when we move off the current edit window
 | |
| 		private ItemInfo GetLowestRNOEditItem(ItemInfo newII, ItemInfo startII)
 | |
| 		{
 | |
| 			EditItem tmpEI = _LookupEditItems[newII.RNOs[newII.RNOs.Count - 1].ItemID];
 | |
| 			ItemInfo tmpII = tmpEI.MyItemInfo;
 | |
| 			while (tmpII != startII && tmpII.RNOs != null)
 | |
| 			{
 | |
| 				tmpEI = _LookupEditItems[tmpII.RNOs[tmpII.RNOs.Count - 1].ItemID];
 | |
| 				tmpII = tmpEI.MyItemInfo;
 | |
| 			}
 | |
| 			if (tmpII != startII && tmpEI.MyAfterEditItems != null)
 | |
| 				tmpEI = tmpEI.MyAfterEditItems[tmpEI.MyAfterEditItems.Count - 1];
 | |
| 			return tmpEI.MyItemInfo;
 | |
| 		}
 | |
| 
 | |
| 		private ItemInfo MoveDown(EditItem ei, ItemInfo ii)
 | |
| 		{
 | |
| 			ii = ArrowDown(ei.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) SelectedEditItem = _LookupEditItems[ii.ItemID];
 | |
| 			return ii;
 | |
| 		}
 | |
| 		private ItemInfo ArrowUp(ItemInfo ii)
 | |
| 		{
 | |
| 			// Arrow-Up from a Substep should look for a Table.
 | |
| 			if (ii.IsStepPart && (ii.MyPrevious == null) && (ii.ActiveParent as ItemInfo).Tables != null)
 | |
| 				return BottomPart((ii.ActiveParent as ItemInfo).Tables[0]);
 | |
| 			// if on RNO, check display mode (1 column/2 column, etc) and how deep RNO is before going to
 | |
| 			// parents substeps.
 | |
| 			if (ii.IsRNOPart && ii.MyParent.Steps != null && ii.RNOLevel >= ii.ColumnMode) return BottomPart(ii.MyParent.Steps[0].LastSibling);
 | |
| 
 | |
| 			// If on top note and parent has cautions - go to bottom caution
 | |
| 			if (ii.IsFirstNotePart && ii.MyParent != null && ii.MyParent.Cautions != null) return BottomPart(ii.MyParent.Cautions[0].LastSibling);
 | |
| 			if (ii.IsFirstCautionPart || ii.IsFirstNotePart)
 | |
| 			{
 | |
| 				if (ii.MyParent.MyPrevious != null) return BottomPart(ii.MyParent.MyPrevious);
 | |
| 				return ii.MyParent.MyParent;
 | |
| 			}
 | |
| 
 | |
| 			// If has note, BottomPart of last sibling of the note
 | |
| 			if (ii.Notes != null) return BottomPart(ii.Notes[0].LastSibling);
 | |
| 			// If has caution, BottomPart of last sibling of the caution
 | |
| 			if (ii.Cautions != null) return BottomPart(ii.Cautions[0].LastSibling);
 | |
| 			// If previous sibling, BottomPart of previous sibling
 | |
|             if (ii.MyPrevious != null && ii.IsProcedure == false) return BottomPart(ii.MyPrevious);
 | |
| 			// Go to parent until at procedure
 | |
| 			if (!ii.IsProcedure) return (ii.MyParent);
 | |
| 			return null;
 | |
| 		}
 | |
| 		private ItemInfo ArrowDown(ItemInfo ii)
 | |
| 		{
 | |
| 			return ArrowDown(ii, true, true);
 | |
| 		}
 | |
| 		private ItemInfo ArrowDown(ItemInfo ii, bool lookAtSub, bool lookAtRNO)
 | |
| 		{
 | |
| 			if (ii.IsSection || ii.IsProcedure)
 | |
| 			{
 | |
| 				if (lookAtSub && ii.Sections != null) return TopPart(ii.Sections[0]);
 | |
| 				if (lookAtSub && ii.Steps != null) return TopPart(ii.Steps[0]);
 | |
| 				if (ii.IsSection && ii.NextItems != null && ii.NextItems.Count > 0) return TopPart(ii.NextItems[0]);
 | |
| 			}
 | |
| 			else
 | |
| 			{
 | |
| 				// Subitems - go to top part of subitem  
 | |
| 				// (the lookAtSub prevented looping within a substep group at same level)
 | |
| 				// Arrow down from a Table should look for a Substep
 | |
| 				if(ii.IsTablePart && (ii.ActiveParent as ItemInfo).Steps != null)
 | |
| 					return TopPart((ii.ActiveParent as ItemInfo).Steps[0]);
 | |
| 				if (lookAtSub && ii.Tables != null) return TopPart(ii.Tables[0]);
 | |
| 				if (lookAtSub && ii.Steps != null) return TopPart(ii.Steps[0]);
 | |
| 				// RNOs: Use PMode (column)
 | |
| 				if (lookAtRNO && ii.RNOs != null && ii.RNOLevel >= ii.ColumnMode) return TopPart(ii.RNOs[0]);
 | |
| 				// Nextsibling - go to top part of sibling
 | |
| 				// TODO: RHM - NextItems was not null when it should have been after delete of a note below a caution
 | |
| 				if (ii.NextItems != null && ii.NextItems.Count > 0) return TopPart(ii.NextItems[0]);
 | |
| 				// If on caution, if parent has note - go to note
 | |
| 				if (ii.IsCautionPart && ii.MyParent.Notes != null) return ii.MyParent.Notes[0];
 | |
| 				// If on caution, if parent !has note or if on note go to parent
 | |
| 				if ((ii.IsCautionPart && ii.MyParent.Notes == null) || ii.IsNotePart) return ii.MyParent;
 | |
| 				// Recursively call with parent until at procedure
 | |
| 				if (!ii.IsProcedure) return (ArrowDown(ii.MyParent, false, ii.MyParent.RNOLevel==ii.RNOLevel));
 | |
| 			}
 | |
| 			return null;
 | |
| 		}
 | |
| 		internal void StepCursorKeys(EditItem ei, KeyEventArgs keyargs)
 | |
| 		{
 | |
| 			ItemInfo ii = ei.MyItemInfo;
 | |
| 			if (ii.IsSection || ii.IsProcedure) return;
 | |
| 			while (!ii.IsHigh)
 | |
| 			{
 | |
| 				ii = ii.MyParent;
 | |
| 			}
 | |
| 			switch (keyargs.KeyCode)
 | |
| 			{
 | |
| 				// for home/end, control key must be pressed too, but this is checked
 | |
| 				// before here.
 | |
| 				case Keys.Home:
 | |
| 					ii = ii.FirstSibling;
 | |
| 					break;
 | |
| 				case Keys.End:
 | |
| 					ii = ii.LastSibling;
 | |
| 					break;
 | |
| 				case Keys.PageDown:
 | |
| 					ii = ii.NextItems != null && ii.NextItems.Count > 0 ? ii.NextItems[0] : null;
 | |
| 					break;
 | |
| 				case Keys.PageUp:
 | |
| 					ii = ii.MyPrevious;
 | |
| 					break;
 | |
| 			}
 | |
| 			if (ii == null) return;
 | |
| 			SelectedEditItem = _LookupEditItems[ii.ItemID];
 | |
| 		}
 | |
| 		#endregion
 | |
| 	}
 | |
| 	[TypeConverter(typeof(ExpandableObjectConverter))]
 | |
| 	public partial class StepPanelSettings
 | |
| 	{
 | |
| 		private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
 | |
| 		public StepPanelSettings(StepPanel panel)
 | |
| 		{
 | |
| 			_MyStepPanel = panel;
 | |
| 		}
 | |
| 		public StepPanelSettings()
 | |
| 		{
 | |
| 		}
 | |
| 		private StepPanel _MyStepPanel; 
 | |
| 		[Browsable(false)]
 | |
| 		public StepPanel MyStepPanel
 | |
| 		{
 | |
| 			get { return _MyStepPanel; }
 | |
| 			set { _MyStepPanel = value; }
 | |
| 		}
 | |
| 		private float _CircleXOffset = -4;
 | |
| 		[Category("Circle")]
 | |
| 		[DisplayName("Circle Horizontal Offset")]
 | |
| 		public float CircleXOffset
 | |
| 		{
 | |
| 			get { return _CircleXOffset; }
 | |
| 			set { _CircleXOffset = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private float _CircleYOffset = -13;
 | |
| 		[Category("Circle")]
 | |
| 		[DisplayName("Circle Vertical Offset")]
 | |
| 		public float CircleYOffset
 | |
| 		{
 | |
| 			get { return _CircleYOffset; }
 | |
| 			set { _CircleYOffset = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private Font _CircleFont = new Font("Arial Unicode MS", 23);
 | |
| 		[Category("Circle")]
 | |
| 		[DisplayName("Circle Font")]
 | |
| 		public Font CircleFont
 | |
| 		{
 | |
| 			get { return _CircleFont; }
 | |
| 			set { _CircleFont = value; if(_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private Color _CircleColor = Color.Black;
 | |
| 		[Category("Circle")]
 | |
| 		[DisplayName("Circle Color")]
 | |
| 		public Color CircleColor
 | |
| 		{
 | |
| 			get { return _CircleColor; }
 | |
| 			set { _CircleColor = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private int _CircleDiameter = 25;
 | |
| 		[Category("Circle")]
 | |
| 		[DisplayName("Circle Diameter")]
 | |
| 		public int CircleDiameter
 | |
| 		{
 | |
| 			get { return _CircleDiameter; }
 | |
| 			set { _CircleDiameter = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private int _CircleWeight = 2;
 | |
| 		[Category("Circle")]
 | |
| 		[DisplayName("Circle Pen Weight")]
 | |
| 		public int CircleWeight
 | |
| 		{
 | |
| 			get { return _CircleWeight; }
 | |
| 			set { _CircleWeight = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private float _NumberLocationX = 20F;
 | |
| 		[Category("Number")]
 | |
| 		[DisplayName("Number Location X")]
 | |
| 		public float NumberLocationX
 | |
| 		{
 | |
| 			get { return _NumberLocationX; }
 | |
| 			set { _NumberLocationX = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private float _NumberLocationY = 4;
 | |
| 		[Category("Number")]
 | |
| 		[DisplayName("Number Location Y")]
 | |
| 		public float NumberLocationY
 | |
| 		{
 | |
| 			get { return _NumberLocationY; }
 | |
| 			set { _NumberLocationY = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private SizeF _NumberSize = new SizeF(200F, 23F);
 | |
| 		[Category("Number")]
 | |
| 		[DisplayName("Number Size")]
 | |
| 		public SizeF NumberSize
 | |
| 		{
 | |
| 			get { return _NumberSize; }
 | |
| 			set { _NumberSize = value;  if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private int _TableWidthAdjust = 4;
 | |
| 		[Category("Table")]
 | |
| 		[DisplayName("Table Width Adjust")]
 | |
| 		public int TableWidthAdjust
 | |
| 		{
 | |
| 			get { return _TableWidthAdjust; }
 | |
| 			set { _TableWidthAdjust = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private int _CheckOffWeight = 1;
 | |
| 		[Category("CheckOff")]
 | |
| 		[DisplayName("CheckOff Pen Weight")]
 | |
| 		public int CheckOffWeight
 | |
| 		{
 | |
| 			get { return _CheckOffWeight; }
 | |
| 			set { _CheckOffWeight = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private Color _CheckOffColor = Color.Black;
 | |
| 		[Category("CheckOff")]
 | |
| 		[DisplayName("CheckOff Color")]
 | |
| 		public Color CheckOffColor
 | |
| 		{
 | |
| 			get { return _CheckOffColor; }
 | |
| 			set { _CheckOffColor = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private int _CheckOffSize =12;
 | |
| 		[Category("CheckOff")]
 | |
| 		[DisplayName("CheckOff Size")]
 | |
| 		public int CheckOffSize
 | |
| 		{
 | |
| 			get { return _CheckOffSize; }
 | |
| 			set { _CheckOffSize = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private int _CheckOffX =0;
 | |
| 		[Category("CheckOff")]
 | |
| 		[DisplayName("CheckOff X")]
 | |
| 		public int CheckOffX
 | |
| 		{
 | |
| 			get { return _CheckOffX; }
 | |
| 			set { _CheckOffX = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private int _CheckOffY =5;
 | |
| 		[Category("CheckOff")]
 | |
| 		[DisplayName("CheckOff Y")]
 | |
| 		public int CheckOffY
 | |
| 		{
 | |
| 			get { return _CheckOffY; }
 | |
| 			set { _CheckOffY = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 	
 | |
| 		private int _ChangeBarWeight = 1;
 | |
| 		[Category("ChangeBar")]
 | |
| 		[DisplayName("ChangeBar Pen Weight")]
 | |
| 		public int ChangeBarWeight
 | |
| 		{
 | |
| 			get { return _ChangeBarWeight; }
 | |
| 			set { _ChangeBarWeight = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 		private Color _ChangeBarColor = Color.Black;
 | |
| 		[Category("ChangeBar")]
 | |
| 		[DisplayName("ChangeBar Color")]
 | |
| 		public Color ChangeBarColor
 | |
| 		{
 | |
| 			get { return _ChangeBarColor; }
 | |
| 			set { _ChangeBarColor = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
 | |
| 		}
 | |
| 	}
 | |
| 	public partial class StepPanelEventArgs
 | |
| 	{
 | |
| 		private EditItem _MyEditItem;
 | |
| 		public EditItem MyEditItem
 | |
| 		{
 | |
| 			get { return _MyEditItem; }
 | |
| 			set { _MyEditItem = value; }
 | |
| 		}
 | |
| 		private MouseEventArgs _MyMouseEventArgs;
 | |
| 		public MouseEventArgs MyMouseEventArgs
 | |
| 		{
 | |
| 			get { return _MyMouseEventArgs; }
 | |
| 			set { _MyMouseEventArgs = value; }
 | |
| 		}
 | |
| 
 | |
| 		public StepPanelEventArgs(EditItem myEditItem, MouseEventArgs myMouseEventArgs)
 | |
| 		{
 | |
| 			_MyEditItem = myEditItem;
 | |
| 			_MyMouseEventArgs = myMouseEventArgs;
 | |
| 		}
 | |
| 	}
 | |
| 	public partial class ItemSelectedChangedEventArgs
 | |
| 	{
 | |
| 		private ItemInfo _MyItemInfo;
 | |
| 		public ItemInfo MyItemInfo
 | |
| 		{
 | |
| 			get { return _MyItemInfo; }
 | |
| 			set { _MyItemInfo = value; }
 | |
| 		}
 | |
| 		private EditItem _MyEditItem = null;
 | |
| 		public EditItem MyEditItem
 | |
| 		{
 | |
| 			get { return _MyEditItem; }
 | |
| 			set { _MyEditItem = value; }
 | |
| 		}
 | |
| 		public ItemSelectedChangedEventArgs(ItemInfo myItemInfo)
 | |
| 		{
 | |
| 			_MyItemInfo = myItemInfo;
 | |
| 		}
 | |
| 		public ItemSelectedChangedEventArgs(EditItem myEditItem)
 | |
| 		{
 | |
| 			_MyItemInfo = myEditItem.MyItemInfo;
 | |
| 			_MyEditItem = myEditItem;
 | |
| 		}
 | |
| 	}
 | |
| 	public partial class StepPanelAttachmentEventArgs
 | |
| 	{
 | |
| 		private EditItem _MyEditItem;
 | |
| 		public EditItem MyEditItem
 | |
| 		{
 | |
| 			get { return _MyEditItem; }
 | |
| 			set { _MyEditItem = value; }
 | |
| 		}
 | |
| 		public StepPanelAttachmentEventArgs(EditItem myEditItem)
 | |
| 		{
 | |
| 			_MyEditItem = myEditItem;
 | |
| 		}
 | |
| 	}
 | |
| 	
 | |
| 	public partial class StepPanelLinkEventArgs : EventArgs
 | |
| 	{
 | |
| 		private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
 | |
| 		//private EditItem _LinkedEditItem;
 | |
| 		//public EditItem LinkedEditItem
 | |
| 		//{
 | |
| 		//  get { return _LinkedEditItem; }
 | |
| 		//}
 | |
| 		private string _LinkInfoText;
 | |
| 		public string LinkInfoText
 | |
| 		{
 | |
| 			get { return _LinkInfoText; }
 | |
| 		}
 | |
| 		private LinkText _MyLinkText;
 | |
| 		public LinkText MyLinkText
 | |
| 		{
 | |
| 			get { return _MyLinkText;}
 | |
| 		}
 | |
| 		public StepPanelLinkEventArgs(string linkInfoText)
 | |
| 		{
 | |
| 			//_LinkedEditItem = linkedEditItem;
 | |
| 			_LinkInfoText = linkInfoText;
 | |
| 			_MyLinkText = new LinkText(_LinkInfoText);
 | |
| 			//if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("\r\n LinkInfo '{0}'\r\n", linkInfo.LinkText);
 | |
| 		}
 | |
| 	}
 | |
| 	public partial class StepPanelTabDisplayEventArgs : EventArgs
 | |
| 	{
 | |
| 		private string _PanelTabName;
 | |
| 		public string PanelTabName
 | |
| 		{
 | |
| 			get { return _PanelTabName; }
 | |
| 		}
 | |
| 		public StepPanelTabDisplayEventArgs(string panelTabname)
 | |
| 		{
 | |
| 			_PanelTabName = panelTabname;
 | |
| 		}
 | |
| 	}
 | |
| 	public partial class WordSectionEventArgs : EventArgs
 | |
| 	{
 | |
| 		private SectionInfo _MySectionInfo;
 | |
| 		public SectionInfo MySectionInfo
 | |
| 		{
 | |
| 			get { return _MySectionInfo; }
 | |
| 		}
 | |
| 		public WordSectionEventArgs(SectionInfo mySectionInfo)
 | |
| 		{
 | |
| 			_MySectionInfo = mySectionInfo;
 | |
| 		}
 | |
| 	}
 | |
| 	public delegate void StepPanelEvent(object sender, StepPanelEventArgs args);
 | |
| 	public delegate void ItemSelectedChangedEvent(object sender, ItemSelectedChangedEventArgs args);
 | |
| 	public delegate void StepPanelLinkEvent(object sender, StepPanelLinkEventArgs args);
 | |
| 	public delegate void StepPanelAttachmentEvent(object sender, StepPanelAttachmentEventArgs args);
 | |
| 	public delegate void StepRTBLinkEvent(object sender, StepPanelLinkEventArgs args);
 | |
| 	public delegate void StepPanelModeChangeEvent(object sender, StepRTBModeChangeEventArgs args);
 | |
| 	public delegate void StepPanelTabDisplayEvent(object sender, StepPanelTabDisplayEventArgs args);
 | |
| 	public delegate void StepPanelWordSectionCloseEvent(object sender, WordSectionEventArgs args);
 | |
| 	public delegate void StepPanelWordSectionDeletedEvent(object sender, WordSectionEventArgs args);
 | |
| 	public delegate void StepPanelItemPastedEvent(object sender, vlnTreeItemInfoPasteEventArgs args);
 | |
| }
 |