Beispiel #1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Handles a VwSelectionChanged event in the key terms draft view.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:SIL.FieldWorks.Common.RootSites.VwSelectionArgs"/>
		/// instance containing the event data.</param>
		/// ------------------------------------------------------------------------------------
		internal void OnSelChangedInDraftView(object sender, VwSelectionArgs e)
		{
			UpdateToolStripButtons();
		}
Beispiel #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Handle a selection change by growing it to a word (unless the new selection IS
		/// the one we're growing to a word).
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void HandleSelectionChange(object sender, VwSelectionArgs args)
		{
			CheckDisposed();

			IVwRootBox rootb = args.RootBox;
			IVwSelection vwselNew = args.Selection;
			Debug.Assert(vwselNew != null);

			if (!m_fInSelChange)
			{
				m_fInSelChange = true;
				try
				{
					if (!vwselNew.IsRange)
					{
						vwselNew.GrowToWord().Install();
					}
				}
				finally
				{
					m_fInSelChange = false;
				}
			}
			if (SelChanged != null)
				SelChanged(this, new EventArgs());
		}
		/// <summary>
		/// Event handler to grow selection if it's not a range when the selection changes.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		void m_xv_VwSelectionChanged(object sender, VwSelectionArgs e)
		{
			Debug.Assert(e.RootBox == m_xv.RootBox);
			if (!m_fInSelChange)
			{
				m_fInSelChange = true;
				try
				{
					// Expand the selection to cover the entire LexEntry object.
					int cvsli = e.Selection.CLevels(false) - 1;
					int ihvoRoot;
					int tagTextProp;
					int cpropPrev;
					int ichAnchor;
					int ichEnd;
					int ws;
					bool fAssocPrev;
					int ihvoEnd;
					ITsTextProps ttp;
					SelLevInfo[] rgvsli = SelLevInfo.AllTextSelInfo(e.Selection, cvsli,
						out ihvoRoot, out tagTextProp, out cpropPrev, out ichAnchor, out ichEnd,
						out ws, out fAssocPrev, out ihvoEnd, out ttp);
					// The selection should cover the outermost object (which should be a LexEntry).
					SelLevInfo[] rgvsliOuter = new SelLevInfo[1];
					rgvsliOuter[0] = rgvsli[cvsli - 1];
					e.RootBox.MakeTextSelInObj(ihvoRoot, 1, rgvsliOuter, 0, null,
						false, false, false, true, true);
					// Save the selected object for possible use later.
					m_hvoSelected = rgvsliOuter[0].hvo;
					Debug.Assert(m_rghvo.Contains(m_hvoSelected));
					// Make the "Open Lexicon" button the default action after making a selection.
					this.AcceptButton = btnLexicon;
				}
				finally
				{
					m_fInSelChange = false;
				}
			}
		}
Beispiel #4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make a selection in all of the views that are in a snynced group. This fixes
		/// problems where the user changes the selection in one of the slaves, but the master
		/// is not updated. Thus the view is not scrolled as the groups scroll position only
		/// scrolls the master's selection into view. (TE-3380)
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void HandleSelectionChange(object sender, VwSelectionArgs args)
		{
			CheckDisposed();

			IVwRootBox rootb = args.RootBox;
			IVwSelection vwselNew = args.Selection;
			Debug.Assert(vwselNew != null);
			HandleSelectionChange(rootb, vwselNew);
		}
Beispiel #5
0
		/// <summary>
		/// This override ensures that we always have whole objects selected.
		/// Enhance: it may cause flicker during drag, in which case, we may change to only do it on mouse up,
		/// or only IF the mouse is up.
		/// </summary>
		protected override void  HandleSelectionChange(object sender, VwSelectionArgs args)
		{
			if (m_InSelectionChanged || RootBox.Selection == null)
				return;
			TextSelInfo info = new TextSelInfo(RootBox);
			int end = Math.Max(info.ContainingObjectIndex(info.Levels(true) - 1, true),
				info.ContainingObjectIndex(info.Levels(false) - 1, false));
			int begin = Math.Min(info.ContainingObjectIndex(info.Levels(true) - 1, true),
				info.ContainingObjectIndex(info.Levels(false) - 1, false));
			SelectRange(begin, end);
		}
Beispiel #6
0
		/// <summary>
		/// This override ensures that we always have whole objects selected.
		/// Enhance: it may cause flicker during drag, in which case, we may change to only do it on mouse up,
		/// or only IF the mouse is up.
		/// </summary>
		protected virtual void HandleSelectionChange(object sender, VwSelectionArgs args)
		{
			CheckDisposed();

			if (m_InSelectionChanged || RootBox.Selection == null)
				return;

			var info = new TextSelInfo(RootBox);
			var end = Math.Max(info.ContainingObjectIndex(info.Levels(true) - 1, true),
				info.ContainingObjectIndex(info.Levels(false) - 1, false));
			SelectUpTo(end);
		}