Example #1
0
		protected void OnValueChanged(object sender, FwObjectSelectionEventArgs args)
		{
			if (ValueChanged != null)
				ValueChanged(sender, args);
		}
		/// <summary>
		/// This comes from a double click on a row in the browse view.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		void m_bvMatches_SelectionMade(object sender, FwObjectSelectionEventArgs e)
		{
			m_selObject = m_cache.ServiceLocator.GetObject(e.Hvo);
			FireSelectionMade();
		}
Example #3
0
		private void m_bvList_SelectionChanged(object sender, FwObjectSelectionEventArgs e)
		{
			if (SelectionChanged != null)
				SelectionChanged(this, e);
		}
Example #4
0
		internal virtual void ViewChangedSelectedRecord(FwObjectSelectionEventArgs e, IVwSelection sel)
		{
			ViewChangedSelectedRecord(e);
		}
Example #5
0
		/// <summary>
		/// Called by a view (e.g. browseView) when, internally, it changes the currently selected record.
		/// </summary>
		public void ViewChangedSelectedRecord(FwObjectSelectionEventArgs e)
		{
			CheckDisposed();

			// Don't do anything if we haven't changed our selection.
			int hvoCurrent = 0;
			if (CurrentObjectHvo != 0)
				hvoCurrent = CurrentObjectHvo;
			if (e.Index >= 0 && CurrentIndex == e.Index && hvoCurrent == e.Hvo ||
				e.Index < 0 && hvoCurrent == e.Hvo)
			{
				return;
			}
			// In some cases (e.g. sorting LexEntries by Gloss), results in a list that
			// contains multiple rows referring to the same object. In that case
			// we want to try to JumpToRecord of the same index, since jumping to the hvo
			// jumps to the first instance of that object (LT-4691).
			// Through deletion of Reversal Index entry it was possible to arrive here with
			// no sorted objects. (LT-13391)
			if (e.Index >= 0 && m_list.SortedObjects.Count > 0)
			{
				int ourHvo = m_list.SortItemAt(e.Index).RootObjectHvo;
				// if for some reason the index doesn't match the hvo, we'll jump to the Hvo.
				// But we don't think that should happen, so Assert to help catch the problems.
				// JohnT Nov 2010: Someone had marked this as not ported to 7.0 with the comment "assert fires".
				// But I can't find any circumstances in which e.Index >= 0, much less a case where it fires.
				// If you feel a need to take this Assert out again, which would presumably mean you know a
				// very repetable scenario for making it fire, please let me know what it is.
				Debug.Assert(e.Hvo == e.Hvo, "the index (" + e.Index + ") for selected object (" + e.Hvo +
					") does not match the object (" + e.Hvo + " in our list at that index.)");
				if (ourHvo != e.Hvo)
					JumpToRecord(e.Hvo);
				else
					JumpToIndex(e.Index);
			}
			else if (e.Hvo > 0)
			{
				JumpToRecord(e.Hvo);
			}
		}
Example #6
0
		private void m_matchingObjectsBrowser_SelectionChanged(object sender, FwObjectSelectionEventArgs e)
		{
			CheckIfGoto();
		}
Example #7
0
		private void m_matchingObjectsBrowser_SelectionMade(object sender, FwObjectSelectionEventArgs e)
		{
			DialogResult = DialogResult.OK;
			Close();
		}
Example #8
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Process mouse double click
		/// </summary>
		/// <param name="e"></param>
		/// ------------------------------------------------------------------------------------
		protected override void OnDoubleClick(EventArgs e)
		{
			if (!ReadOnlySelect)
			{
				base.OnDoubleClick(e);
			}
			else if (SelectedIndex != -1)
			{
				FwObjectSelectionEventArgs e1 =
					new FwObjectSelectionEventArgs(SelectedObject, SelectedIndex);
				m_bv.OnDoubleClick(e1);
			}
		}
Example #9
0
		protected virtual void HandleMatchingSelectionChanged(FwObjectSelectionEventArgs e)
		{
			HandleMatchingSelectionChanged();
		}
		/// <summary>
		/// Handle interaction between POS and Slot ptoeprties for a inflectional affix MSA.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		/// <remarks>
		/// If the new value is zero, then set the Slot prop to zero.
		/// If the new value is not zero, then make sure the Slot prop is valid.
		///		If the current slot is not legal for the new POS value, then set it to zero.
		///		Otherwise leave the slot value alone.
		/// </remarks>
		protected void OnReferenceChanged(object sender, FwObjectSelectionEventArgs e)
		{
			Debug.Assert(sender is AtomicReferenceLauncher);
			var source = (AtomicReferenceLauncher)sender;
			Debug.Assert(Control == source);
			Debug.Assert(Object is IMoInflAffMsa);

			int idxSender = ContainingDataTree.Slices.IndexOf(this);

			int otherFlid = MoInflAffMsaTags.kflidSlots;
			Slice otherSlice = null;
			int idxOther;

			// Try to get the Slots slice.
			// Check for slices before this one.
			if (idxSender > 0)
			{
				idxOther = idxSender - 1;
				while (idxOther >= 0
					&& (otherSlice == null
						|| (otherSlice.Indent == Indent && idxOther > 0 && otherSlice.Object == Object)))
				{
					otherSlice = ContainingDataTree.Slices[idxOther--];
					if (otherSlice is ReferenceVectorSlice && (otherSlice as ReferenceVectorSlice).Flid == otherFlid)
						break;
					otherSlice = null;
				}
			}

			// Check for following slices, if we didn't get one earlier.
			if (otherSlice == null && idxSender < ContainingDataTree.Slices.Count)
			{
				idxOther = idxSender + 1;
				while (idxOther < ContainingDataTree.Slices.Count
					&& (otherSlice == null
						|| (otherSlice.Indent == Indent && idxOther > 0 && otherSlice.Object == Object)))
				{
					otherSlice = ContainingDataTree.Slices[idxOther++];
					if (otherSlice is ReferenceVectorSlice && (otherSlice as ReferenceVectorSlice).Flid == otherFlid)
						break;
					otherSlice = null;
				}
			}

			VectorReferenceLauncher otherControl = null;
			if (otherSlice != null)
			{
				Debug.Assert(otherSlice.Flid == otherFlid);
				Debug.Assert(otherSlice.Object == Object);
				otherControl = otherSlice.Control as VectorReferenceLauncher;
				Debug.Assert(otherControl != null);
			}

			var msa = Object as IMoInflAffMsa;
			IMoInflAffixSlot slot = null;
			if (msa.SlotsRC.Count > 0)
			{
				slot = msa.SlotsRC.First();
			}
			if (e.Hvo == 0 || slot != null)
			{
				var pos = msa.PartOfSpeechRA;
				var slots = pos != null ? pos.AllAffixSlots : Enumerable.Empty<IMoInflAffixSlot>();
				bool clearSlot = e.Hvo == 0 || !slots.Contains(slot);
				if (clearSlot)
				{
					if (otherControl == null)
						msa.SlotsRC.Clear(); // The slot slice is not showing, so directly set the object's Slot property.
					else
						otherControl.AddItem(null); // Reset it using the other slice, so it gets refreshed.
				}
			}
		}
Example #11
0
		/// <summary>
		///	invoked when our XmlDocView selection changes.
		/// </summary>
		/// <param name="sender">unused</param>
		/// <param name="e">the event arguments</param>
		public void OnSelectionChanged(object sender, FwObjectSelectionEventArgs e)
		{
			CheckDisposed();

			// paranoid sanity check.
			Debug.Assert(e.Hvo != 0);
			if (e.Hvo == 0)
				return;
			Clerk.ViewChangedSelectedRecord(e, m_mainView.RootBox.Selection);
			// Change it if it's actually changed.
			SetInfoBarText();
		}
Example #12
0
		void BrowseViewer_SelectionChanged(object sender, FwObjectSelectionEventArgs e)
		{
			SetRecordStatus();
		}
		/// <summary>
		/// Handle interaction between to and from POS for a derivational affix MSA.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		/// <remarks>
		/// If the new value is zero, then set the other one's value to zero, as well.
		/// If the other one's value is zero, then set it to the new value.
		/// In all cases, set this one's value to the new value.
		/// </remarks>
		protected void OnReferenceChanged(object sender, FwObjectSelectionEventArgs e)
		{
			Debug.Assert(sender is AtomicReferenceLauncher);
			var source = (AtomicReferenceLauncher)sender;
			Debug.Assert(Control == source);
			Debug.Assert(Object is IMoDerivAffMsa);

			AtomicReferenceLauncher otherControl = null;
			int idxSender = ContainingDataTree.Slices.IndexOf(this);
			int otherFlid;
			bool myIsFromPOS = true;
			if (m_flid == MoDerivAffMsaTags.kflidFromPartOfSpeech)
				otherFlid = MoDerivAffMsaTags.kflidToPartOfSpeech;
			else
			{
				otherFlid = MoDerivAffMsaTags.kflidFromPartOfSpeech;
				myIsFromPOS = false;
			}
			int otherHvo = 0;
			Slice otherSlice = null;
			int idxOther;
			if (idxSender > 0)
			{
				idxOther = idxSender - 1;
				while (otherSlice == null || (otherSlice.Indent == Indent && idxOther > 0 && otherSlice.Object == Object))
				{
					otherSlice = ContainingDataTree.Slices[idxOther--];
					if (otherSlice is AtomicReferenceSlice && (otherSlice as AtomicReferenceSlice).Flid == otherFlid)
						break;
				}
				if (otherSlice != null && otherSlice is AtomicReferenceSlice)
					otherHvo = GetOtherHvo(otherSlice as AtomicReferenceSlice, otherFlid, myIsFromPOS, out otherControl);
				else
					otherSlice = null;
			}
			if (otherControl == null && idxSender < ContainingDataTree.Slices.Count)
			{
				idxOther = idxSender + 1;
				while (otherSlice == null
					|| (otherSlice.Indent == Indent && idxOther > 0 && otherSlice.Object == Object))
				{
					otherSlice = ContainingDataTree.Slices[idxOther++];
					if (otherSlice is AtomicReferenceSlice && (otherSlice as AtomicReferenceSlice).Flid == otherFlid)
						break;
				}
				if (otherSlice != null && otherSlice is AtomicReferenceSlice)
					otherHvo = GetOtherHvo(otherSlice as AtomicReferenceSlice, otherFlid, myIsFromPOS, out otherControl);
				else
					otherSlice = null;
			}

			var msa = Object as IMoDerivAffMsa;
			if (e.Hvo == 0 && otherHvo != 0)
			{
				if (otherControl != null)
				{
					if (m_flid == MoDerivAffMsaTags.kflidFromPartOfSpeech)
						msa.ToPartOfSpeechRA = null;
					else
						msa.FromPartOfSpeechRA = null;
				}
			}
			else if (otherHvo == 0 && e.Hvo > 0)
			{
				if (otherControl == null)
				{
					// The other one is not available (filtered out?),
					// so set it directly using the msa.
					if (m_flid == MoDerivAffMsaTags.kflidFromPartOfSpeech)
						msa.ToPartOfSpeechRA = m_cache.ServiceLocator.GetInstance<IPartOfSpeechRepository>().GetObject(e.Hvo);
					else
						msa.FromPartOfSpeechRA = m_cache.ServiceLocator.GetInstance<IPartOfSpeechRepository>().GetObject(e.Hvo);
				}
				else
				{
					otherControl.AddItem(m_cache.ServiceLocator.GetObject(e.Hvo)); // Set the other guy to this value.
				}
			}
		}
		void m_bvList_SelectionChanged(object sender, FwObjectSelectionEventArgs e)
		{
			PopulateValuesCombo();
			PositionValuesCombo();
		}
Example #15
0
		/// <summary>
		/// The selected item may have changed in the "Change To" comboBox under
		/// the List Choice tab therefore
		/// enable or disable the Apply and Preview buttons based on the selection.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e">in some situations an item selected in the combo box has no hvo so the index of the item in the list is used.</param>
		void besc_ValueChanged(object sender, FwObjectSelectionEventArgs e)
		{

			if (e.Hvo != 0 || e.Index >= 0)
			{
				m_ApplyButton.Enabled = true;
				m_previewButton.Enabled = true;
			}
			else
			{
				m_ApplyButton.Enabled = false;
				m_previewButton.Enabled = false;
			}
		}
Example #16
0
		private void m_matchingObjects_SelectionChanged(object sender, FwObjectSelectionEventArgs e)
		{
			if (m_skipCheck)
				return;

			m_selObject = m_cache.ServiceLocator.GetObject(e.Hvo);

			HandleMatchingSelectionChanged(e);
		}
		public override void OnSelectionChanged(object sender, FwObjectSelectionEventArgs e)
		{
			PreviewCurrentSelection(e.Hvo);
			base.OnSelectionChanged(sender, e);
		}
Example #18
0
        /// <summary>
        ///	invoked when our BrowseView selection changes
        /// </summary>
        /// <param name="sender">unused</param>
        /// <param name="e">the event arguments</param>
        public virtual void OnSelectionChanged(object sender, FwObjectSelectionEventArgs e)
        {
            CheckDisposed();

            if (!m_suppressRecordNavigation || ! m_suppressShowRecord)
            {
                Clerk.ViewChangedSelectedRecord(e);
                SetInfoBarText();
            }
        }