예제 #1
0
        private void SwapValues(ILexEntry entry, IMoForm origForm, IMoForm newForm, IMoMorphType type,
                                List <IMoMorphSynAnalysis> rgmsaOld)
        {
            DataTree dtree = Slice.ContainingDataTree;
            int      idx   = Slice.IndexInContainer;

            dtree.DoNotRefresh = true;                  // don't let the datatree repeatedly redraw itself...
            entry.ReplaceMoForm(origForm, newForm);
            newForm.MorphTypeRA = type;
            entry.ReplaceObsoleteMsas(rgmsaOld);
            // Dispose of any obsolete slices: new ones will replace them automatically in a moment
            // when the datatree is redrawn.
            foreach (Slice slice in Slice.ContainingDataTree.Slices.ToArray())
            {
                if (slice.IsDisposed)
                {
                    continue;
                }
                if (slice.Object is IMoMorphSynAnalysis && rgmsaOld.Contains(slice.Object as IMoMorphSynAnalysis))
                {
                    slice.Dispose();
                }
                else if (slice is MSAReferenceComboBoxSlice)
                {
                    slice.Dispose();
                }
            }
            // now fix the record list, since it may be showing MoForm dependent columns (e.g. MorphType, Homograph, etc...)
            dtree.FixRecordList();
            dtree.DoNotRefresh = false;
            Slice sliceT = dtree.Slices[idx];

            if (sliceT != null && sliceT is MorphTypeAtomicReferenceSlice)
            {
                // When the new slice is created, the launch button is placed in the middle of
                // the slice rather than at the end.  This fiddling with the slice width seems
                // to fix that.  Then setting the index restores focus to the new slice.
                sliceT.Width += 1;
                sliceT.Width -= 1;
                dtree.GotoNextSliceAfterIndex(idx - 1);
            }
        }
		private void SwapValues(ILexEntry entry, IMoForm origForm, IMoForm newForm, IMoMorphType type,
			List<IMoMorphSynAnalysis> rgmsaOld)
		{
			DataTree dtree = Slice.ContainingDataTree;
			int idx = Slice.IndexInContainer;
			dtree.DoNotRefresh = true;	// don't let the datatree repeatedly redraw itself...
			entry.ReplaceMoForm(origForm, newForm);
			newForm.MorphTypeRA = type;
			entry.ReplaceObsoleteMsas(rgmsaOld);
			// Dispose of any obsolete slices: new ones will replace them automatically in a moment
			// when the datatree is redrawn.
			foreach (Slice slice in Slice.ContainingDataTree.Slices.ToArray())
			{
				if (slice.IsDisposed)
					continue;
				if (slice.Object is IMoMorphSynAnalysis && rgmsaOld.Contains(slice.Object as IMoMorphSynAnalysis))
					slice.Dispose();
				else if (slice is MSAReferenceComboBoxSlice)
					slice.Dispose();
			}
			// now fix the record list, since it may be showing MoForm dependent columns (e.g. MorphType, Homograph, etc...)
			dtree.FixRecordList();
			dtree.DoNotRefresh = false;
			Slice sliceT = dtree.Slices[idx];
			if (sliceT != null && sliceT is MorphTypeAtomicReferenceSlice)
			{
				// When the new slice is created, the launch button is placed in the middle of
				// the slice rather than at the end.  This fiddling with the slice width seems
				// to fix that.  Then setting the index restores focus to the new slice.
				sliceT.Width += 1;
				sliceT.Width -= 1;
				dtree.GotoNextSliceAfterIndex(idx - 1);
			}
		}