Currently detects whether we've inserted a paragraph break (with the Enter key) and move annotations into the new paragraph.
Inheritance: SIL.FieldWorks.XWorks.RecordClerk.ListUpdateHelper
Example #1
0
        /// <summary>
        /// overriden to handle the special case where user hits ENTER in a paragraph.
        /// </summary>
        /// <param name="e"></param>
        /// <param name="modifiers"></param>
        /// <param name="graphics"></param>
        public override void OnKeyPress(KeyPressEventArgs e, Keys modifiers, IVwGraphics graphics)
        {
            RawTextPane rtp = Callbacks as RawTextPane;

            if (rtp == null)
            {
                return;
            }
            try
            {
                using (m_amh = new RawTextPane.AnnotationMoveHelper(rtp, e))
                {
                    if (m_amh.CanEdit())
                    {
                        m_annotationAdjuster.StartKeyPressed(e, modifiers);
                    }
                    base.OnKeyPress(e, modifiers, graphics);
                    // in general we don't want to reload the primary clerk
                    // while we are editing, since that can be expensive.
                    if (rtp.Clerk != null && rtp.Clerk.IsPrimaryClerk)
                    {
                        m_amh.TriggerPendingReloadOnDispose = false;
                        // in some cases we may also want to do Clerk.RemoveInvalidItems()
                        // to help prevent the user from crashing when they click on it.
                    }
                    if (m_amh.CanEdit())
                    {
                        m_annotationAdjuster.EndKeyPressed();
                    }
                }
            }
            finally
            {
                m_amh = null;
            }
        }
Example #2
0
		/// <summary>
		/// overriden to handle the special case where user hits ENTER in a paragraph.
		/// </summary>
		/// <param name="e"></param>
		/// <param name="modifiers"></param>
		/// <param name="graphics"></param>
		public override void OnKeyPress(KeyPressEventArgs e, Keys modifiers, IVwGraphics graphics)
		{
			RawTextPane rtp = Callbacks as RawTextPane;
			if (rtp == null)
				return;
			try
			{
				using (m_amh = new RawTextPane.AnnotationMoveHelper(rtp, e))
				{
					if (m_amh.CanEdit())
						m_annotationAdjuster.StartKeyPressed(e, modifiers);
					base.OnKeyPress(e, modifiers, graphics);
					// in general we don't want to reload the primary clerk
					// while we are editing, since that can be expensive.
					if (rtp.Clerk != null && rtp.Clerk.IsPrimaryClerk)
					{
						m_amh.TriggerPendingReloadOnDispose = false;
						// in some cases we may also want to do Clerk.RemoveInvalidItems()
						// to help prevent the user from crashing when they click on it.
					}
					if (m_amh.CanEdit())
						m_annotationAdjuster.EndKeyPressed();
				}
			}
			finally
			{
				m_amh = null;
			}
		}