private void addButton_Click(object sender, System.EventArgs e)
        {
            if (optionsList.SelectedItem == null || !(optionsList.SelectedItem is LineOption))
            {
                return;
            }
            int flid = (optionsList.SelectedItem as LineOption).Flid;

            int ws = 0;

            if (m_choices.IndexOf(flid) != -1)             // i.e., if m_choices contains flid.
            {
                InterlinLineSpec existingSpec = m_choices[m_choices.IndexOf(flid)];
                int prevWs = existingSpec.WritingSystem;

                foreach (WsComboItem item in WsComboItems(existingSpec.ComboContent))
                {
                    int newWs = getWsFromId(item.Id);

                    if (newWs != prevWs && m_choices.IndexOf(flid, newWs, true) == -1)
                    {
                        ws = newWs;
                        break;
                    }
                }
            }

            int index = m_choices.Add(flid, ws);

            InitCurrentList(index);
        }
Ejemplo n.º 2
0
        private int GetRealWsFromSpec(InterlinLineSpec spec)
        {
            if (!spec.IsMagicWritingSystem)
            {
                return(spec.WritingSystem);
            }
            // special case, the only few we support so far (and only for a few fields).
            if (spec.WritingSystem == WritingSystemServices.kwsFirstAnal)
            {
                return(Cache.LangProject.DefaultAnalysisWritingSystem.Handle);
            }
            if (spec.WritingSystem == WritingSystemServices.kwsVernInParagraph)
            {
                return(Cache.LangProject.DefaultVernacularWritingSystem.Handle);                // REVIEW (Hasso) 2018.01: this is frequently the case, but not always
            }
            int ws = -50;

            try
            {
                ws = WritingSystemServices.InterpretWsLabel(Cache, spec.WsLabel(Cache).Text, null, 0, 0, null);
            }
            catch
            {
                Debug.Assert(ws != -50, "InterpretWsLabel was not able to interpret the Ws Label.  The most likely cause for this is that a magic ws was passed in.");
            }
            return(ws);
        }
        private void optionsList_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
        {
            LineOption       option = optionsList.Items[e.Index] as LineOption;
            InterlinLineSpec spec   = m_choices.CreateSpec(option.Flid, 0);

            DrawItem(e, spec);
        }
        private void DrawItem(System.Windows.Forms.DrawListViewItemEventArgs e, InterlinLineSpec spec)
        {
            Brush backBrush = SystemBrushes.ControlLightLight;

            if (e.Item.Selected)
            {
                backBrush = SystemBrushes.Highlight;
            }
            e.Graphics.FillRectangle(backBrush, e.Bounds);
            if (e.Item.Focused)
            {
                ControlPaint.DrawFocusRectangle(e.Graphics, e.Bounds);
            }
            SolidBrush textBrush = GetBrush(spec, e.Item.Selected) as SolidBrush;

            try
            {
                Font         drawFont = e.Item.Font;
                ListViewItem item     = e.Item as ListViewItem;
                // Draw the line label.
                e.Graphics.DrawString(item.Text, drawFont, textBrush, e.Bounds);
                // Now draw the WritingSystem info.
                e.Graphics.DrawString(item.SubItems[1].Text, item.SubItems[1].Font,
                                      e.Item.Selected ? textBrush : SystemBrushes.ControlText, item.SubItems[1].Bounds);
            }
            finally
            {
                if (!e.Item.Selected)
                {
                    textBrush.Dispose();
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Answer where line n should move up to (if it can move up).
        /// If it can't answer -1.
        /// </summary>
        /// <param name="n"></param>
        /// <returns></returns>
        internal int WhereToMoveUpTo(int n)
        {
            if (n == 0)
            {
                return(-1);                // first line can't move up!
            }
            InterlinLineSpec spec = this[n];

            // Can't move up at all if it's a freeform and the previous line is not.
            if (!spec.WordLevel && this[n - 1].WordLevel)
            {
                return(-1);
            }
            int newPos = n - 1;             // default place to put it.

            // If it is not morpheme level and a morpheme-level precedes it, must move
            // past all of them.
            if (!spec.MorphemeLevel && this[newPos].MorphemeLevel)
            {
                for ( ; newPos > 0 && this[newPos - 1].MorphemeLevel; newPos--)
                {
                    ;
                }
            }
            // If it can't go here it just can't move.
            if (newPos > 0 && !CanFollow(this[newPos - 1], spec))
            {
                return(-1);
            }
            if (!CanFollow(spec, this[newPos]))
            {
                return(-1);
            }
            return(newPos);
        }
Ejemplo n.º 6
0
        private void DrawItem(System.Windows.Forms.DrawItemEventArgs e, InterlinLineSpec spec)
        {
            bool  selected  = ((e.State & DrawItemState.Selected) != 0);
            Brush textBrush = GetBrush(spec, selected);
            Font  drawFont  = e.Font;

            e.DrawBackground();
            e.Graphics.DrawString(optionsList.Items[e.Index].ToString(), drawFont, textBrush, e.Bounds);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Call before calling Remove. True and null message indicates no problem to
 /// remove this field.
 /// If it returns a true, display a message box indicating the Remove is not
 /// possible, using the returned message.
 /// If it returns false and a message, there is a warning, display it and
 /// allow the user to possibly cancel.
 /// </summary>
 /// <param name="spec"></param>
 /// <returns></returns>
 public virtual bool OkToRemove(InterlinLineSpec spec, out string message)
 {
     if (m_specs.Count == 1)
     {
         message = ITextStrings.ksNeedOneField;
         return(false);
     }
     message = null;
     return(true);
 }
        private void moveDownButton_Click(object sender, System.EventArgs e)
        {
            if (CurrentListIndex < 0 || !m_choices.OkToMoveDown(CurrentListIndex))
            {
                return;
            }
            InterlinLineSpec spec = m_choices[CurrentListIndex];

            m_choices.MoveDown(CurrentListIndex);
            InitCurrentList(spec);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Overridden to prevent removing the Words line and to remove dependents of the line being removed
        /// (after warning the user).
        /// </summary>
        /// <param name="spec"></param>
        public override void Remove(InterlinLineSpec spec)
        {
            List <InterlinLineSpec> dependents = new List <InterlinLineSpec>();

            dependents = FindDependents(spec);
            foreach (InterlinLineSpec depSpec in dependents)
            {
                m_specs.Remove(depSpec);
            }
            base.Remove(spec);
        }
Ejemplo n.º 10
0
 private IEnumerable <WsComboItem> GetWsComboItems(InterlinLineSpec curSpec)
 {
     using (var dummyCombobox = new ComboBox())
     {
         var dummyCachedBoxes = new Dictionary <ColumnConfigureDialog.WsComboContent, ComboBox.ObjectCollection>();
         var comboObjects     = ConfigureInterlinDialog.WsComboItemsInternal(
             Cache, dummyCombobox, dummyCachedBoxes, curSpec.ComboContent);
         var choices = new WsComboItem[comboObjects.Count];
         comboObjects.CopyTo(choices, 0);
         return(choices);
     }
 }
        private Brush GetBrush(InterlinLineSpec spec, bool selected)
        {
            Brush textBrush = SystemBrushes.ControlText;

            if (selected)
            {
                textBrush = SystemBrushes.HighlightText;
            }
            else
            {
                textBrush = new SolidBrush(m_choices.LabelColorFor(spec));
            }
            return(textBrush);
        }
Ejemplo n.º 12
0
 internal Color LabelColorFor(InterlinLineSpec spec)
 {
     if (spec.MorphemeLevel)
     {
         return(kMorphLevelColor);
     }
     else if (spec.WordLevel && spec.Flid != InterlinLineChoices.kflidWord)
     {
         return(kWordLevelColor);
     }
     else
     {
         return(SystemColors.ControlText);
     }
 }
Ejemplo n.º 13
0
        public void GetActualWs_MorphBundleBehavesLikeMoForm()
        {
            var wsManager = new WritingSystemManager();
            CoreWritingSystemDefinition enWs;

            wsManager.GetOrSet("en", out enWs);
            int wsEng = enWs.Handle;

            CoreWritingSystemDefinition frWs;

            wsManager.GetOrSet("fr", out frWs);
            int wsFrn = frWs.Handle;

            var choices = new InterlinLineChoices(m_lp, wsFrn, wsEng);

            MakeStandardState(choices);
            InterlinLineSpec spec = choices[1];

            Assert.AreEqual(InterlinLineChoices.kflidMorphemes, spec.Flid);
            // The StringFlid for this line spec always corresponds to a MoForm
            Assert.AreEqual(MoFormTags.kflidForm, spec.StringFlid);

            IWfiWordform    wf;
            IWfiAnalysis    wag;
            ITsString       str = TsStringUtils.MakeString("WordForm", spec.WritingSystem);
            IWfiMorphBundle wmb = Cache.ServiceLocator.GetInstance <IWfiMorphBundleFactory>().Create();

            NonUndoableUnitOfWorkHelper.Do(Cache.ActionHandlerAccessor, () =>
            {
                wf  = Cache.ServiceLocator.GetInstance <IWfiWordformFactory>().Create(str);
                wag = WordAnalysisOrGlossServices.CreateNewAnalysisWAG(wf);
                wag.MorphBundlesOS.Add(wmb);
                ILexEntry entry = Cache.ServiceLocator.GetInstance <ILexEntryFactory>().Create();
                IMoForm moForm  = Cache.ServiceLocator.GetInstance <IMoStemAllomorphFactory>().Create();
                entry.AlternateFormsOS.Add(moForm);
                moForm.Form.set_String(spec.WritingSystem, "Morph");
                wmb.MorphRA = moForm;
            });
            // The line spec for displaying the Morpheme must be able to handle getting the ws from both
            // MorphBundles or MoForms
            Assert.True(spec.Flid == InterlinLineChoices.kflidMorphemes);
            int wmbWs = spec.GetActualWs(Cache, wmb.Hvo, spec.WritingSystem);
            int mfWs  = spec.GetActualWs(Cache, wmb.MorphRA.Hvo, spec.WritingSystem);

            Assert.True(wmbWs == spec.WritingSystem);
            Assert.True(mfWs == spec.WritingSystem);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Get the writing system for the given flid.
        /// </summary>
        /// <param name="flid"></param>
        /// <param name="fGetDefaultForMissing">if true, provide the default writing system for the given flid.</param>
        /// <returns></returns>
        public List <int> WritingSystemsForFlid(int flid, bool fGetDefaultForMissing)
        {
            List <int> result = new List <int>();

            foreach (InterlinLineSpec spec in m_specs)
            {
                if (spec.Flid == flid && result.IndexOf(spec.WritingSystem) < 0)
                {
                    result.Add(spec.WritingSystem);
                }
            }
            if (fGetDefaultForMissing && result.Count == 0)
            {
                InterlinLineSpec newSpec = CreateSpec(flid, 0);
                result.Add(newSpec.WritingSystem);
            }
            return(result);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Answer an array list of integers, the writing systems we care about for the specified flid,
        /// except the one specified.
        /// </summary>
        /// <param name="flid"></param>
        /// <param name="wsToOmit">the ws to omit. use 0 remove the default ws for this flid</param>
        /// <returns></returns>
        public List <int> OtherWritingSystemsForFlid(int flid, int wsToOmit)
        {
            if (wsToOmit == 0)
            {
                // eliminate the default writing system for this flid.
                InterlinLineSpec specDefault = CreateSpec(flid, 0);
                wsToOmit = specDefault.WritingSystem;
            }
            List <int> result = new List <int>();

            foreach (InterlinLineSpec spec in m_specs)
            {
                if (spec.Flid == flid && result.IndexOf(spec.WritingSystem) < 0 && spec.WritingSystem != wsToOmit)
                {
                    result.Add(spec.WritingSystem);
                }
            }
            return(result);
        }
Ejemplo n.º 16
0
 public override bool OkToRemove(InterlinLineSpec spec, out string message)
 {
     if (!base.OkToRemove(spec, out message))
     {
         return(false);
     }
     if (spec.Flid == kflidWord && spec.WritingSystem == m_wsDefVern &&
         ItemsWithFlids(new int[] { kflidWord }, new int[] { m_wsDefVern }).Count < 2)
     {
         message = ITextStrings.ksNeedWordLine;
         return(false);
     }
     if (FindDependents(spec).Count > 0)
     {
         // Enhance JohnT: get the names and include them in the message.
         message = ITextStrings.ksHidesDependentLinesAlso;
         // OK to go ahead if the user wishes, return true.
     }
     return(true);
 }
Ejemplo n.º 17
0
        public virtual int Add(InterlinLineSpec spec)
        {
            bool fGotMorpheme = HaveMorphemeLevel;

            for (int i = m_specs.Count - 1; i >= 0; i--)
            {
                if (this[i].Flid == spec.Flid)
                {
                    // It's always OK (and optimal) to insert a new occurrence of the same
                    // flid right after the last existing one.
                    m_specs.Insert(i + 1, spec);
                    return(i + 1);
                }
            }
            for (int i = m_specs.Count - 1; i >= 0; i--)
            {
                if (CanFollow(this[i], spec))
                {
                    int firstMorphemeIndex = FirstMorphemeIndex;
                    // Even if otherwise OK, if we're inserting something morpheme level
                    // and there's already morpheme-level stuff present it must follow
                    // the existing morpheme-level stuff.
                    if (fGotMorpheme && spec.MorphemeLevel && i >= firstMorphemeIndex &&
                        (!this[i].MorphemeLevel ||
                         spec.Flid == kflidMorphemes ||
                         spec.Flid == kflidLexEntries && this[i].Flid != kflidMorphemes))
                    {
                        continue;
                    }
                    // And word-level annotations can't follow freeform ones.
                    if (spec.WordLevel && !this[i].WordLevel)
                    {
                        continue;
                    }
                    m_specs.Insert(i + 1, spec);
                    return(i + 1);
                }
            }
            m_specs.Insert(0, spec);             // can't follow anything, put first.
            return(0);
        }
        void UpdateWsComboValue()
        {
            try
            {
                m_fUpdatingWsCombo = true;
                int index = CurrentListIndex;
                if (index < 0 || index >= m_choices.Count)
                {
                    wsCombo.SelectedIndex = -1;
                    wsCombo.Enabled       = false;
                    return;
                }
                InterlinLineSpec spec = m_choices[index];

                ComboBox.ObjectCollection comboObjects = WsComboItems(spec.ComboContent);
                object[] choices = new object[comboObjects.Count];
                comboObjects.CopyTo(choices, 0);
                wsCombo.Items.Clear();
                wsCombo.Items.AddRange(choices);

                int ws = spec.WritingSystem;
                wsCombo.Enabled = true;
                // JohnT: note that, because 'Default analysis' and 'Default Vernacular'
                // come first, the corresponding actual writing systems will never be
                // chosen by this algorithm.
                foreach (WsComboItem item in wsCombo.Items)
                {
                    if (getWsFromId(item.Id) == ws)
                    {
                        wsCombo.SelectedItem = item;
                        break;
                    }
                }
            }
            finally
            {
                m_fUpdatingWsCombo = false;
            }
        }
        private void wsCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (m_fUpdatingWsCombo)
            {
                return;
            }
            if (!(wsCombo.SelectedItem is WsComboItem))
            {
                return;
            }
            int listIndex = CurrentListIndex;

            if (listIndex < 0)
            {
                return;
            }

            InterlinLineSpec spec = m_choices[listIndex];

            spec.WritingSystem = getWsFromId(((WsComboItem)wsCombo.SelectedItem).Id);

            InitCurrentList(listIndex);
        }
        private void removeButton_Click(object sender, System.EventArgs e)
        {
            int index = CurrentListIndex;

            if (index < 0)
            {
                return;
            }
            string           message;
            InterlinLineSpec spec = m_choices[index];

            if (!m_choices.OkToRemove(spec, out message))
            {
                MessageBox.Show(this, message, ITextStrings.ksCannotHideField);
                return;
            }
            if (message != null && MessageBox.Show(this, message, ITextStrings.ksWarning, MessageBoxButtons.OKCancel)
                == DialogResult.Cancel)
            {
                return;
            }
            m_choices.Remove(spec);
            InitCurrentList(index);
        }
Ejemplo n.º 21
0
        public void MoveUp(int n)
        {
            int dest = WhereToMoveUpTo(n);

            if (dest < 0)
            {
                return;
            }
            InterlinLineSpec spec = this[n];
            // If this was the first morpheme field, move the others too.
            bool fMoveGroup = spec.MorphemeLevel && !this[n - 1].MorphemeLevel;

            m_specs.RemoveAt(n);
            m_specs.Insert(dest, spec);
            if (fMoveGroup)
            {
                for (int i = n + 1; i < Count && this[i].MorphemeLevel; i++)
                {
                    InterlinLineSpec specT = this[i];
                    m_specs.RemoveAt(i);
                    m_specs.Insert(dest + i - n, specT);
                }
            }
        }
Ejemplo n.º 22
0
		public virtual int Add(InterlinLineSpec spec)
		{
			bool fGotMorpheme = HaveMorphemeLevel;
			for (int i = m_specs.Count - 1; i >= 0; i--)
			{
				if (this[i].Flid == spec.Flid)
				{
					// It's always OK (and optimal) to insert a new occurrence of the same
					// flid right after the last existing one.
					m_specs.Insert(i + 1, spec);
					return i + 1;
				}
			}
			for (int i = m_specs.Count - 1; i >= 0; i--)
			{
				if (CanFollow(this[i], spec))
				{
					int firstMorphemeIndex = FirstMorphemeIndex;
					// Even if otherwise OK, if we're inserting something morpheme level
					// and there's already morpheme-level stuff present it must follow
					// the existing morpheme-level stuff.
					if (fGotMorpheme && spec.MorphemeLevel && i >= firstMorphemeIndex &&
						(!this[i].MorphemeLevel ||
						spec.Flid == kflidMorphemes ||
						spec.Flid == kflidLexEntries && this[i].Flid != kflidMorphemes))
					{
						continue;
					}
					// And word-level annotations can't follow freeform ones.
					if (spec.WordLevel && !this[i].WordLevel)
						continue;
					m_specs.Insert(i + 1, spec);
					return i + 1;
				}
			}
			m_specs.Insert(0, spec); // can't follow anything, put first.
			return 0;
		}
Ejemplo n.º 23
0
 // Find where the spec is in your collection.
 public int IndexOf(InterlinLineSpec spec)
 {
     return(m_specs.IndexOf(spec));
 }
Ejemplo n.º 24
0
		/// <summary>
		/// Compare the public property getters to the given spec.
		/// </summary>
		/// <param name="spec"></param>
		/// <returns>true if all the public getter values match.</returns>
		public bool SameSpec(InterlinLineSpec spec)
		{
			return ReflectionHelper.HaveSamePropertyValues(this, spec);
		}
Ejemplo n.º 25
0
 protected override int LabelRGBFor(InterlinLineSpec spec)
 {
     // In the print view these colors are plain black.
     return(0);
 }
Ejemplo n.º 26
0
		private int GetRealWsFromSpec(InterlinLineSpec spec)
		{
			if (!spec.IsMagicWritingSystem)
			{
				return spec.WritingSystem;
			}
			// special case, the only few we support so far (and only for a few fields).
			if (spec.WritingSystem == WritingSystemServices.kwsFirstAnal)
				return Cache.LangProject.DefaultAnalysisWritingSystem.Handle;
			if (spec.WritingSystem == WritingSystemServices.kwsVernInParagraph)
				return Cache.LangProject.DefaultVernacularWritingSystem.Handle;
			int ws = -50;
			try
			{
				ws = WritingSystemServices.InterpretWsLabel(Cache, spec.WsLabel(Cache).Text, null, 0, 0, null);
			}
			catch
			{
				Debug.Assert(ws != -50, "InterpretWsLabel was not able to interpret the Ws Label.  The most likely cause for this is that a magic ws was passed in.");
			}
			return ws;
		}
            public override void Display(IVwEnv vwenv, int hvo, int frag)
            {
                CheckDisposed();

                try
                {
                    switch (frag)
                    {
                    case kfragBundle:                             // One annotated word bundle, in this case, the whole view.
                        if (hvo == 0)
                        {
                            return;
                        }
                        vwenv.set_IntProperty((int)FwTextPropType.ktptSpellCheck, (int)FwTextPropVar.ktpvEnum,
                                              (int)SpellingModes.ksmDoNotCheck);
                        vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
                                              (int)FwTextPropVar.ktpvDefault, krgbBackground);
                        vwenv.OpenDiv();
                        vwenv.OpenParagraph();
                        // Since embedded in a pile with context, we need another layer of pile here,.
                        // It's an overlay sandbox: draw a box around it.
                        vwenv.OpenInnerPile();
                        // Inside that division we need a paragraph which does not have any border
                        // or background. This suppresses the 'infinite width' behavior for the
                        // nested paragraphs that may have grey border.
                        vwenv.OpenParagraph();

                        // This makes a little separation between left border and arrows.
                        vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
                                              (int)FwTextPropVar.ktpvMilliPoint, 1000);
                        if (m_fRtl)
                        {
                            // This must not be on the outer paragraph or we get infinite width behavior.
                            vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
                                                  (int)FwTextPropVar.ktpvEnum, (int)FwTextToggleVal.kttvForceOn);
                            vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
                                                  (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalRight);
                        }
                        vwenv.OpenInnerPile();
                        for (int ispec = 0; ispec < m_choices.Count;)
                        {
                            InterlinLineSpec spec = m_choices[ispec];
                            if (!spec.WordLevel)
                            {
                                break;
                            }
                            if (spec.MorphemeLevel)
                            {
                                DisplayMorphBundles(vwenv, hvo);
                                ispec = m_choices.LastMorphemeIndex + 1;
                                continue;
                            }
                            switch (spec.Flid)
                            {
                            case InterlinLineChoices.kflidWord:
                                int ws = GetActualWs(hvo, spec.StringFlid, spec.WritingSystem);
                                DisplayWordform(vwenv, ws, ispec);
                                break;

                            case InterlinLineChoices.kflidWordGloss:
                                DisplayWordGloss(vwenv, hvo, spec.WritingSystem, ispec);
                                break;

                            case InterlinLineChoices.kflidWordPos:
                                DisplayWordPOS(vwenv, hvo, spec.WritingSystem, ispec);
                                break;
                            }
                            ispec++;
                        }
                        vwenv.CloseInnerPile();

                        vwenv.CloseParagraph();
                        vwenv.CloseInnerPile();

                        vwenv.CloseParagraph();
                        vwenv.CloseDiv();
                        break;

                    case kfragFirstMorph:                        // first morpheme in word
                    case kfragMorph:                             // The bundle of 4 lines representing a morpheme.
                        vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
                                              (int)FwTextPropVar.ktpvMilliPoint, 10000);
                        vwenv.OpenInnerPile();
                        for (int ispec = m_choices.FirstMorphemeIndex; ispec <= m_choices.LastMorphemeIndex; ispec++)
                        {
                            int tagLexEntryIcon = 0;
                            if (m_choices.FirstLexEntryIndex == ispec)
                            {
                                tagLexEntryIcon = ktagMorphEntryIcon;
                            }
                            InterlinLineSpec spec = m_choices[ispec];
                            switch (spec.Flid)
                            {
                            case InterlinLineChoices.kflidMorphemes:
                                DisplayMorphForm(vwenv, hvo, frag, spec.WritingSystem, ispec);
                                break;

                            case InterlinLineChoices.kflidLexEntries:
                                AddOptionalNamedObj(vwenv, hvo, ktagSbMorphEntry, ktagMissingEntry,
                                                    kfragMissingEntry, tagLexEntryIcon, spec.WritingSystem, ispec);
                                break;

                            case InterlinLineChoices.kflidLexGloss:
                                AddOptionalNamedObj(vwenv, hvo, ktagSbMorphGloss, ktagMissingMorphGloss,
                                                    kfragMissingMorphGloss, tagLexEntryIcon, spec.WritingSystem, ispec);
                                break;

                            case InterlinLineChoices.kflidLexPos:
                                AddOptionalNamedObj(vwenv, hvo, ktagSbMorphPos, ktagMissingMorphPos,
                                                    kfragMissingMorphPos, tagLexEntryIcon, spec.WritingSystem, ispec);
                                break;
                            }
                        }
                        vwenv.CloseInnerPile();

                        break;

                    default:
                        if (frag >= kfragNamedObjectNameChoices && frag < kfragNamedObjectNameChoices + m_choices.Count)
                        {
                            InterlinLineSpec spec = m_choices[frag - kfragNamedObjectNameChoices];
                            int wsActual          = GetActualWs(hvo, ktagSbNamedObjName, spec.WritingSystem);
                            vwenv.AddStringAltMember(ktagSbNamedObjName, wsActual, this);
                        }
                        else
                        {
                            throw new Exception("Bad fragment ID in SandboxVc.Display");
                        }
                        break;
                    }
                }
                catch
                {
                    Debug.Assert(false, "Exception thrown in the display of the SandboxVc (About to be eaten)");
                }
            }
Ejemplo n.º 28
0
			private void DisplayWordGloss(InterlinLineSpec spec, int choiceIndex)
			{

				switch(m_defaultObj.ClassID)
				{
				case WfiWordformTags.kClassId:
					m_this.SetColor(m_vwenv, m_this.LabelRGBFor(choiceIndex)); // looks like missing word gloss.
					m_vwenv.AddString(m_this.m_tssMissingGloss);
					break;
				case WfiAnalysisTags.kClassId:
					if (m_hvoDefault != m_hvoWordBundleAnalysis)
					{
						// Real analysis isn't what we're displaying, so morph breakdown
						// is a guess. Is it a human-approved guess?
						bool isHumanGuess = m_this.Decorator.get_IntProp(m_hvoDefault, InterlinViewDataCache.OpinionAgentFlid) !=
																		(int)AnalysisGuessServices.OpinionAgent.Parser;
						m_this.SetGuessing(m_vwenv, isHumanGuess ? ApprovedGuessColor : MachineGuessColor);
					}
					var wa = (IWfiAnalysis) m_defaultObj;
					if (wa.MeaningsOC.Count == 0)
					{
						// There's no gloss, display something indicating it is missing.
						m_this.SetColor(m_vwenv, m_this.LabelRGBFor(choiceIndex));
						m_vwenv.AddString(m_this.m_tssMissingGloss);
					}
					else
					{
						m_vwenv.AddObj(wa.MeaningsOC.First().Hvo, m_this, kfragLineChoices + choiceIndex);
					}
					break;
				case WfiGlossTags.kClassId:
					if (m_hvoWordBundleAnalysis == m_hvoDefault)
					{
						var wsActual = spec.WritingSystem;
						if (spec.IsMagicWritingSystem)
							wsActual = GetRealWs(m_cache, m_hvoWordBundleAnalysis, spec, m_this.m_wsAnalysis);
						// We're displaying properties of the current object, can do
						// straightforwardly
						m_this.FormatGloss(m_vwenv, wsActual);
						m_vwenv.set_IntProperty((int)FwTextPropType.ktptSpellCheck, (int)FwTextPropVar.ktpvEnum,
							(int)SpellingModes.ksmForceCheck);
						m_vwenv.AddObj(m_hvoWordBundleAnalysis, m_this, kfragLineChoices + choiceIndex);
					}
					else
					{
						m_this.SetGuessing(m_vwenv);
						m_vwenv.AddObj(m_hvoDefault, m_this, kfragLineChoices + choiceIndex);
					}
					break;
				default:
					throw new Exception("Invalid type found in Segment analysis");
				}
			}
Ejemplo n.º 29
0
		public bool IsDefaultSpec(InterlinLineSpec spec)
		{
			return spec.SameSpec(CreateSpec(spec.Flid, 0));
		}
Ejemplo n.º 30
0
		// Find where the spec is in your collection.
		public int IndexOf(InterlinLineSpec spec)
		{
			return m_specs.IndexOf(spec);
		}
Ejemplo n.º 31
0
		internal Color LabelColorFor(InterlinLineSpec spec)
		{
			if (spec.MorphemeLevel)
				return kMorphLevelColor;
			else if (spec.WordLevel && spec.Flid != InterlinLineChoices.kflidWord)
				return kWordLevelColor;
			else
				return SystemColors.ControlText;
		}
Ejemplo n.º 32
0
		internal int LabelRGBFor(InterlinLineSpec spec)
		{
			return (int)CmObjectUi.RGB(LabelColorFor(spec));
		}
Ejemplo n.º 33
0
		/// <summary>
		/// Remove the specified field (and any dependents, with warning).
		/// If there are dependents, this will interact with the user to ask whether to
		/// go ahead.
		/// </summary>
		/// <param name="spec"></param>
		public virtual void Remove(InterlinLineSpec spec)
		{
			m_specs.Remove(spec);
			Debug.Assert(m_specs.Count > 0);
		}
Ejemplo n.º 34
0
		internal bool OkToRemove(InterlinLineSpec spec)
		{
			string message;
			return OkToRemove(spec, out message);
		}
Ejemplo n.º 35
0
		/// <summary>
		/// Call before calling Remove. True and null message indicates no problem to
		/// remove this field.
		/// If it returns a true, display a message box indicating the Remove is not
		/// possible, using the returned message.
		/// If it returns false and a message, there is a warning, display it and
		/// allow the user to possibly cancel.
		/// </summary>
		/// <param name="spec"></param>
		/// <returns></returns>
		public virtual bool OkToRemove(InterlinLineSpec spec, out string message)
		{
			if (m_specs.Count == 1)
			{
				message = ITextStrings.ksNeedOneField;
				return false;
			}
			message = null;
			return true;
		}
Ejemplo n.º 36
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="flid"></param>
        /// <param name="wsRequested">If zero, supply the default ws for the field; otherwise
        /// use the one supplied.</param>
        /// <returns></returns>
        internal InterlinLineSpec CreateSpec(int flid, int wsRequested)
        {
            int  ws             = 0;
            bool fMorphemeLevel = false;
            bool fWordLevel     = true;
            int  flidString     = 0;

            ColumnConfigureDialog.WsComboContent comboContent = ColumnConfigureDialog.WsComboContent.kwccAnalysis;             // The usual choice
            switch (flid)
            {
            case kflidWord:
                comboContent = ColumnConfigureDialog.ChooseComboContent(m_wsDefVern, "vernacular");
                ws           = m_wsDefVern;
                break;                         // vern, not interlin, word

            case kflidLexEntries:
            case kflidMorphemes:
                fMorphemeLevel = true;
                comboContent   = ColumnConfigureDialog.ChooseComboContent(m_wsDefVern, "vernacular");
                flidString     = (int)MoForm.MoFormTags.kflidForm;
                ws             = m_wsDefVern;
                break;                         // vern, morpheme

            case kflidLexGloss:
                fMorphemeLevel = true;
                ws             = LangProject.kwsFirstAnal;
                flidString     = (int)LexSense.LexSenseTags.kflidGloss;
                comboContent   = ColumnConfigureDialog.WsComboContent.kwccBestAnalysis;
                break;                         // analysis, morpheme

            case kflidLexPos:
                fMorphemeLevel = true;
                // getting to the string takes a couple of levels
                // so just do it when we have the actual hvos.
                flidString   = -1;
                ws           = LangProject.kwsFirstAnal;
                comboContent = ColumnConfigureDialog.WsComboContent.kwccBestAnalysis;
                break;                         // analysis, morpheme

            case kflidWordGloss:
                ws = m_wsDefAnal;
                break;                         // not morpheme-level

            case kflidWordPos:
                ws           = LangProject.kwsFirstAnal;
                flidString   = (int)CmPossibility.CmPossibilityTags.kflidAbbreviation;
                comboContent = ColumnConfigureDialog.WsComboContent.kwccBestAnalysis;
                break;                         // not morpheme-level

            case kflidFreeTrans:
            case kflidLitTrans:
                ws         = m_wsDefAnal;
                fWordLevel = false;
                break;

            case kflidNote:
                comboContent = ColumnConfigureDialog.WsComboContent.kwccVernAndAnal;
                ws           = m_wsDefAnal;
                fWordLevel   = false;
                break;

            default:
                throw new Exception("Adding unknown field to interlinear");
            }
            InterlinLineSpec spec = new InterlinLineSpec();

            spec.ComboContent  = comboContent;
            spec.Flid          = flid;
            spec.WritingSystem = wsRequested == 0 ? ws : wsRequested;
            spec.MorphemeLevel = fMorphemeLevel;
            spec.WordLevel     = fWordLevel;
            spec.StringFlid    = flidString;
            return(spec);
        }
Ejemplo n.º 37
0
			private void DisplayWord(InterlinLineSpec spec, int choiceIndex, IAnalysis wag)
			{
				var wsActual = m_this.GetRealWsOrBestWsForContext(m_hvoWordform, spec);
				var tssRealForm = GetRealForm(wsActual, choiceIndex);
				if (tssRealForm != null && tssRealForm.Length > 0)
				{
					m_this.IsDoingRealWordForm = true;
					// LT-12203 Text chart doesn't want multiple analyses highlighting
					if (m_fshowMultipleAnalyses)
					{
						//identify those words the user has yet to approve which have multiple possible
						//guesses user or machine, and set the background to a special color
						var word = wag as IWfiWordform;
						if (word != null)
						{
							//test if there are multiple analyses that a user might choose from
							if (SandboxBase.GetHasMultipleRelevantAnalyses(word))
							{
								m_this.SetGuessing(m_vwenv, MultipleApprovedGuessColor); //There are multiple options, set the color
							}
						}
					}
					m_vwenv.AddString(tssRealForm);
					m_this.IsDoingRealWordForm = false;
					return;
				}
				switch (m_defaultObj.ClassID)
				{
				case WfiWordformTags.kClassId:
				case WfiAnalysisTags.kClassId:
				case WfiGlossTags.kClassId:
					m_vwenv.AddObj(m_hvoWordform, m_this, kfragLineChoices + choiceIndex);
					break;
				default:
					throw new Exception("Invalid type found in Segment analysis");
				}
			}
Ejemplo n.º 38
0
		/// <summary>
		///
		/// </summary>
		/// <param name="flid"></param>
		/// <param name="wsRequested">If zero, supply the default ws for the field; otherwise
		/// use the one supplied.</param>
		/// <returns></returns>
		internal InterlinLineSpec CreateSpec(int flid, int wsRequested)
		{
			int ws = 0;
			bool fMorphemeLevel = false;
			bool fWordLevel = true;
			int flidString = 0;
			ColumnConfigureDialog.WsComboContent comboContent = ColumnConfigureDialog.WsComboContent.kwccAnalysis; // The usual choice
			switch (flid)
			{
				case kflidWord:
					comboContent = ColumnConfigureDialog.ChooseComboContent(m_cache, m_wsDefVern, "vernacular");
					ws = m_wsDefVern;
					break; // vern, not interlin, word
				case kflidLexEntries:
				case kflidMorphemes:
					fMorphemeLevel = true;
					comboContent = ColumnConfigureDialog.ChooseComboContent(m_cache, m_wsDefVern, "vernacular");
					flidString = MoFormTags.kflidForm;
					ws = m_wsDefVern;
					break; // vern, morpheme
				case kflidLexGloss:
					fMorphemeLevel = true;
					ws = WritingSystemServices.kwsFirstAnal;
					flidString = LexSenseTags.kflidGloss;
					comboContent = ColumnConfigureDialog.WsComboContent.kwccBestAnalysis;
					break; // analysis, morpheme
				case kflidLexPos:
					fMorphemeLevel = true;
					// getting to the string takes a couple of levels
					// so just do it when we have the actual hvos.
					flidString = -1;
					ws = WritingSystemServices.kwsFirstAnal;
					comboContent = ColumnConfigureDialog.WsComboContent.kwccBestAnalysis;
					break; // analysis, morpheme
				case kflidWordGloss:
					ws = m_wsDefAnal;
					break; // not morpheme-level
				case kflidWordPos:
					ws = WritingSystemServices.kwsFirstAnal;
					flidString = CmPossibilityTags.kflidAbbreviation;
					comboContent = ColumnConfigureDialog.WsComboContent.kwccBestAnalysis;
					break; // not morpheme-level
				case kflidFreeTrans:
				case kflidLitTrans:
					ws = m_wsDefAnal;
					fWordLevel = false;
					break;
				case kflidNote:
					comboContent = ColumnConfigureDialog.WsComboContent.kwccVernAndAnal;
					ws = m_wsDefAnal;
					fWordLevel = false;
					break;
				default:
					throw new Exception("Adding unknown field to interlinear");
			}
			InterlinLineSpec spec = new InterlinLineSpec();
			spec.ComboContent = comboContent;
			spec.Flid = flid;
			spec.WritingSystem = wsRequested == 0 ? ws : wsRequested;
			spec.MorphemeLevel = fMorphemeLevel;
			spec.WordLevel = fWordLevel;
			spec.StringFlid = flidString;
			return spec;
		}
Ejemplo n.º 39
0
		virtual protected int LabelRGBFor(InterlinLineSpec spec)
		{
			return m_lineChoices.LabelRGBFor(spec);
		}
Ejemplo n.º 40
0
		static private int GetRealWs(FdoCache cache, int hvo, InterlinLineSpec spec, int wsPreferred)
		{
			int ws = 0;
			switch (spec.WritingSystem)
			{
				case LangProject.kwsVernInParagraph:
					// we want to display the wordform using the twfic ws.
					ws = wsPreferred;
					break;
				default:
					ws = spec.GetActualWs(cache, hvo, wsPreferred);
					// ws = cache.LangProject.ActualWs(spec.WritingSystem, hvo, spec.StringFlid);
					break;
			}
			return ws;
		}
Ejemplo n.º 41
0
		private IEnumerable<WsComboItem> GetWsComboItems(InterlinLineSpec curSpec)
		{
			using (var dummyCombobox = new ComboBox())
			{
				var dummyCachedBoxes = new Dictionary<ColumnConfigureDialog.WsComboContent, ComboBox.ObjectCollection>();
				var comboObjects = ConfigureInterlinDialog.WsComboItemsInternal(
				Cache, dummyCombobox, dummyCachedBoxes, curSpec.ComboContent);
				var choices = new WsComboItem[comboObjects.Count];
				comboObjects.CopyTo(choices, 0);
				return choices;
			}
		}
Ejemplo n.º 42
0
 public bool IsDefaultSpec(InterlinLineSpec spec)
 {
     return(spec.SameSpec(CreateSpec(spec.Flid, 0)));
 }
Ejemplo n.º 43
0
		protected override int LabelRGBFor(InterlinLineSpec spec)
		{
			// In the print view these colors are plain black.
			return 0;
		}
        private void currentList_DrawItem(object sender, DrawListViewItemEventArgs e)
        {
            InterlinLineSpec spec = m_choices[e.ItemIndex] as InterlinLineSpec;

            DrawItem(e, spec);
        }
 // Init the list and select specified item
 void InitCurrentList(InterlinLineSpec spec)
 {
     InitCurrentList(m_choices.IndexOf(spec));
 }
Ejemplo n.º 46
0
 internal int LabelRGBFor(InterlinLineSpec spec)
 {
     return((int)CmObjectUi.RGB(LabelColorFor(spec)));
 }
Ejemplo n.º 47
0
		private List<InterlinLineSpec> FindDependents(InterlinLineSpec spec)
		{
			List<InterlinLineSpec> dependents = new List<InterlinLineSpec>();
			return dependents;
		}
Ejemplo n.º 48
0
		/// <summary>
		/// Overridden to prevent removing the Words line and to remove dependents of the line being removed
		/// (after warning the user).
		/// </summary>
		/// <param name="spec"></param>
		public override void Remove(InterlinLineSpec spec)
		{
			List<InterlinLineSpec> dependents = new List<InterlinLineSpec>();
			dependents = FindDependents(spec);
			foreach (InterlinLineSpec depSpec in dependents)
				m_specs.Remove(depSpec);
			base.Remove(spec);
		}
Ejemplo n.º 49
0
		private void DrawItem(System.Windows.Forms.DrawListViewItemEventArgs e, InterlinLineSpec spec)
		{
			Brush backBrush = SystemBrushes.ControlLightLight;
			if (e.Item.Selected)
				backBrush = SystemBrushes.Highlight;
			e.Graphics.FillRectangle(backBrush, e.Bounds);
			if (e.Item.Focused)
				ControlPaint.DrawFocusRectangle(e.Graphics, e.Bounds);
			SolidBrush textBrush = GetBrush(spec, e.Item.Selected) as SolidBrush;
			try
			{
				Font drawFont = e.Item.Font;
				ListViewItem item = e.Item as ListViewItem;
				// Draw the line label.
				e.Graphics.DrawString(item.Text, drawFont, textBrush, e.Bounds);
				// Now draw the WritingSystem info.
				e.Graphics.DrawString(item.SubItems[1].Text, item.SubItems[1].Font,
									  e.Item.Selected ? textBrush : SystemBrushes.ControlText, item.SubItems[1].Bounds);
			}
			finally
			{
				if (!e.Item.Selected)
					textBrush.Dispose();
			}
		}
Ejemplo n.º 50
0
		/// <summary>
		/// Answer true if it is valid for the field indicated in spec2 to immediately
		/// follow the one indicated in spec1. By default any order is OK. This routine is
		/// not responsible for the restrictions related to keeping word level stuff before
		/// freeforms and morpheme-level stuff together.
		/// </summary>
		/// <param name="spec1"></param>
		/// <param name="spec2"></param>
		/// <returns></returns>
		internal virtual bool CanFollow(InterlinLineSpec spec1, InterlinLineSpec spec2)
		{
			return true;
		}
Ejemplo n.º 51
0
		private void DrawItem(System.Windows.Forms.DrawItemEventArgs e, InterlinLineSpec spec)
		{
			bool selected = ((e.State & DrawItemState.Selected) != 0);
			Brush textBrush = GetBrush(spec, selected);
			try
			{
				Font drawFont = e.Font;
				e.DrawBackground();
				e.Graphics.DrawString(optionsList.Items[e.Index].ToString(), drawFont, textBrush, e.Bounds);
			}
			finally
			{
				if (!selected)
					textBrush.Dispose();
			}
		}
Ejemplo n.º 52
0
		public override bool OkToRemove(InterlinLineSpec spec, out string message)
		{
			if (!base.OkToRemove(spec, out message))
				return false;
			if (spec.Flid == kflidWord && spec.WritingSystem == m_wsDefVern &&
				ItemsWithFlids(new int[] {kflidWord}, new int[] {m_wsDefVern}).Count < 2)
			{
				message = ITextStrings.ksNeedWordLine;
				return false;
			}
			if (FindDependents(spec).Count > 0)
			{
				// Enhance JohnT: get the names and include them in the message.
				message = ITextStrings.ksHidesDependentLinesAlso;
				// OK to go ahead if the user wishes, return true.
			}
			return true;
		}
Ejemplo n.º 53
0
		/// <summary>
		/// try to get the ws specified by spec.WritingSystem, otherwise
		/// get the default vernacular ws for the display (e.g. ws of paragraph).
		/// </summary>
		/// <param name="hvo"></param>
		/// <param name="spec"></param>
		/// <returns></returns>
		internal int GetRealWsOrBestWsForContext(int hvo, InterlinLineSpec spec)
		{
			if (spec != null && !spec.IsMagicWritingSystem && spec.WritingSystem > 0)
				return GetRealWs(m_cache, hvo, spec, spec.WritingSystem);
			return GetRealWs(m_cache, hvo, spec, m_wsVernForDisplay);
		}
Ejemplo n.º 54
0
		static private int GetRealWs(FdoCache cache, int hvo, InterlinLineSpec spec, int wsPreferred)
		{
			int ws = 0;
			switch (spec.WritingSystem)
			{
				case WritingSystemServices.kwsVernInParagraph:
					// we want to display the wordform using its own ws.
					ws = wsPreferred;
					break;
				default:
					ws = spec.GetActualWs(cache, hvo, wsPreferred);
					break;
			}
			return ws;
		}
Ejemplo n.º 55
0
		// Init the list and select specified item
		void InitCurrentList(InterlinLineSpec spec)
		{
			InitCurrentList(m_choices.IndexOf(spec));
		}
Ejemplo n.º 56
0
		internal static bool TryGetLexGlossWithInflTypeTss(ILexEntry possibleVariant, ILexSense sense, InterlinLineSpec spec, InterlinLineChoices lineChoices, int vernWsContext, ILexEntryInflType inflType, out ITsString result)
		{
			FdoCache cache = possibleVariant.Cache;
			using (var vcLexGlossFrag = new InterlinVc(cache))
			{
				vcLexGlossFrag.LineChoices = lineChoices;
				vcLexGlossFrag.PreferredVernWs = vernWsContext;


				result = null;
				var collector = new TsStringCollectorEnv(null, vcLexGlossFrag.Cache.MainCacheAccessor,
														 possibleVariant.Hvo)
									{
										RequestAppendSpaceForFirstWordInNewParagraph = false
									};
				if (vcLexGlossFrag.DisplayLexGlossWithInflType(collector, possibleVariant, sense, spec, inflType))
				{
					result = collector.Result;
					return true;
				}
				return false;
			}
		}
Ejemplo n.º 57
0
		private Brush GetBrush(InterlinLineSpec spec, bool selected)
		{
			Brush textBrush = SystemBrushes.ControlText;
			if (selected)
			{
				textBrush = SystemBrushes.HighlightText;
			}
			else
			{
				textBrush = new SolidBrush(m_choices.LabelColorFor(spec));
			}
			return textBrush;
		}
Ejemplo n.º 58
0
		/// <summary>
		/// NOTE: this routine is ignorant of calling context, so caller must provide NoteDependency to the possibleVariant and the sense
		/// (e.g. vwenv.NoteDependency(new[] { wfiMorphBundle.Hvo }, new[] { WfiMorphBundleTags.kflidSense }, 1);
		///  vwenv.NoteDependency(new[] { wfiMorphBundle.Hvo }, new[] { WfiMorphBundleTags.kflidInflType }, 1);
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="possibleVariant"></param>
		/// <param name="sense"></param>
		/// <param name="spec"></param>
		/// <param name="inflType"></param>
		/// <returns>true if there was anything to display </returns>
		internal bool DisplayLexGlossWithInflType(IVwEnv vwenv, ILexEntry possibleVariant, ILexSense sense, InterlinLineSpec spec,
			ILexEntryInflType inflType)
		{
			int iLineChoice = m_lineChoices.IndexOf(spec);
			ILexEntryRef ler;
			if (possibleVariant.IsVariantOfSenseOrOwnerEntry(sense, out ler))
			{
				var wsPreferred = GetRealWsOrBestWsForContext(sense.Hvo, spec);
				var wsGloss = Cache.ServiceLocator.WritingSystemManager.Get(wsPreferred);
				var wsUser = Cache.ServiceLocator.WritingSystemManager.UserWritingSystem;
				var testGloss = sense.Gloss.get_String(wsPreferred);
				// don't bother adding anything for an empty gloss.
				if (testGloss.Text != null && testGloss.Text.Length >= 0)
				{
					vwenv.OpenParagraph();
					// see if we have an irregularly inflected form type reference
					var leitFirst =
						ler.VariantEntryTypesRS.Where(
							let => let.ClassID == LexEntryInflTypeTags.kClassId).FirstOrDefault();

					// add any GlossPrepend info
					if (leitFirst != null)
					{
						vwenv.OpenInnerPile();
						// TODO: add dependency to VariantType GlossPrepend/Append names
						vwenv.NoteDependency(new[] { ler.Hvo },
											 new[] { LexEntryRefTags.kflidVariantEntryTypes }, 1);
						vwenv.OpenParagraph();
						ITsString tssPrepend = null;
						if (inflType != null)
						{
							tssPrepend = MorphServices.AddTssGlossAffix(null, inflType.GlossPrepend, wsGloss, wsUser);
						}
						else
						{
							ITsIncStrBldr sbPrepend;
							ITsIncStrBldr sbAppend;
							JoinGlossAffixesOfInflVariantTypes(ler, wsPreferred, out sbPrepend,
															   out sbAppend);
							if (sbPrepend.Text != null)
								tssPrepend = sbPrepend.GetString();
						}
						if (tssPrepend != null)
							vwenv.AddString(tssPrepend);
						vwenv.CloseParagraph();
						vwenv.CloseInnerPile();
					}
					// add gloss of main entry or sense
					{
						vwenv.OpenInnerPile();
						// NOTE: remember to NoteDependency from OuterObject
						vwenv.AddObj(sense.Hvo, this, kfragLineChoices + iLineChoice);
						vwenv.CloseInnerPile();
					}
					// now add variant type info
					if (leitFirst != null)
					{
						vwenv.OpenInnerPile();
						// TODO: add dependency to VariantType GlossPrepend/Append names
						vwenv.NoteDependency(new[] { ler.Hvo },
											 new[] { LexEntryRefTags.kflidVariantEntryTypes }, 1);
						vwenv.OpenParagraph();
						 ITsString tssAppend = null;
						 if (inflType != null)
						 {
							 tssAppend = MorphServices.AddTssGlossAffix(null, inflType.GlossAppend, wsGloss, wsUser);
						 }
						 else
						 {
							 ITsIncStrBldr sbPrepend;
							 ITsIncStrBldr sbAppend;
							 JoinGlossAffixesOfInflVariantTypes(ler, wsPreferred, out sbPrepend,
																out sbAppend);
							 if (sbAppend.Text != null)
								 tssAppend = sbAppend.GetString();
						 }
						{
							// Use AddProp/DisplayVariant to store GlossAppend with m_tssPendingGlossAffix
							// this allows InterlinearExporter to know to export a glsAppend item
							try
							{
								if (tssAppend != null)
									m_tssPendingGlossAffix = tssAppend;
								else
									m_tssPendingGlossAffix = m_tssMissingGlossAppend;

								vwenv.AddProp(ktagGlossAppend, this, 0);
							}
							finally
							{
								m_tssPendingGlossAffix = null;
							}
						}
						vwenv.CloseParagraph();
						vwenv.CloseInnerPile();
					}
					vwenv.CloseParagraph();
					return true;
				}
			}
			return false;
		}
Ejemplo n.º 59
0
		internal int GetRealWs(int hvo, InterlinLineSpec spec)
		{
			int wsPreferred = m_wsCurrentTwfic;
			if (wsPreferred == 0)
				wsPreferred = m_wsVernForDisplay;
			return GetRealWs(m_cache, hvo, spec, wsPreferred);
		}
Ejemplo n.º 60
0
        /// <summary>
        /// Add the specified flid (in the appropriate default writing system).
        /// </summary>
        /// <param name="flid"></param>
        /// <param name="ws">If zero, supply the default ws for the field; otherwise
        /// use the one supplied.</param>
        /// <returns>the integer where inserted</returns>
        public int Add(int flid, int wsRequested)
        {
            InterlinLineSpec spec = CreateSpec(flid, wsRequested);

            return(Add(spec));
        }