SIL.FieldWorks.IText.InterlinVc.SetActiveFreeform C# (CSharp) Method

SetActiveFreeform() private method

private SetActiveFreeform ( int hvo, int flid, int ws, int cpropPrevious ) : void
hvo int
flid int
ws int
cpropPrevious int
return void
		internal void SetActiveFreeform(int hvo, int flid, int ws, int cpropPrevious)
		{
			if (hvo == m_hvoActiveFreeform && flid == ActiveFreeformFlid)
				return; // no changes; don't want to generate spurious selection changes which may trigger unwanted WS changes.
			var helper = SelectionHelper.Create(m_rootsite);
			int hvoOld = m_hvoActiveFreeform;
			int flidOld = ActiveFreeformFlid;
			m_hvoActiveFreeform = hvo;
			ActiveFreeformFlid = flid;
			ActiveFreeformWs = ws;
			// The cpropPrevious we get from the selection may be one off, if a previous line is displaying
			// the prompt for another WS of the same object.
			if (hvoOld == hvo && m_cpropActiveFreeform <= cpropPrevious)
				m_cpropActiveFreeform = cpropPrevious + 1;
			else
				m_cpropActiveFreeform = cpropPrevious;

			// The old one is easy to turn off because we have a NoteDependency on it.
			if (hvoOld != 0)
				m_rootsite.RootBox.PropChanged(hvoOld, flidOld, 0, 0, 0);
			if (m_hvoActiveFreeform != 0)
			{
				// Pretend the 'Self' property of the segment has been changed.
				// This will force it to be re-displayed, with different results now m_hvoActiveFreeform etc are set.
				var flidSelf = Cache.MetaDataCacheAccessor.GetFieldId2(CmObjectTags.kClassId, "Self", false);
				m_rootsite.RootBox.PropChanged(m_hvoActiveFreeform, flidSelf, 0, 1, 1);
			}
			if (helper != null)
			{
				helper.SetSelection(true, false);
			}
		}