From f39542f05a0c6e51a7ed7d2769f30071c746a5b3 Mon Sep 17 00:00:00 2001 From: Jake Oliver Date: Thu, 30 May 2024 17:16:01 -0400 Subject: [PATCH] LT-21786: Show variant info for analysis chooser --- Src/LexText/Interlinear/ChooseAnalysisHandler.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Src/LexText/Interlinear/ChooseAnalysisHandler.cs b/Src/LexText/Interlinear/ChooseAnalysisHandler.cs index bdb5f82c6f..b5fe5e4bb3 100644 --- a/Src/LexText/Interlinear/ChooseAnalysisHandler.cs +++ b/Src/LexText/Interlinear/ChooseAnalysisHandler.cs @@ -296,7 +296,7 @@ public void SetupCombo() } } - // Add option to clear the analysis altogeter. + // Add option to clear the analysis altogether. AddItem(wordform, MakeSimpleString(ITextStrings.ksNewAnalysis), false, WfiWordformTags.kClassId); // Add option to reset to the default AddItem(null, MakeSimpleString(ITextStrings.ksUseDefaultAnalysis), false); @@ -375,6 +375,7 @@ internal static ITsString MakeAnalysisStringRep(IWfiAnalysis wa, LcmCache fdoCac ITsTextProps glossTextProperties = GlossTextProperties(fdoCache, true, fUseStyleSheet); ITsStrBldr tsb = TsStringUtils.MakeStrBldr(); ISilDataAccess sda = fdoCache.MainCacheAccessor; + ILexEntry entry = null; int cmorph = wa.MorphBundlesOS.Count; if (cmorph == 0) return TsStringUtils.MakeString(ITextStrings.ksNoMorphemes, fdoCache.DefaultUserWs); @@ -396,7 +397,7 @@ internal static ITsString MakeAnalysisStringRep(IWfiAnalysis wa, LcmCache fdoCac // Review: Appears to be similar to code in LexEntryVc. if (mf != null) { - var entry = mf.Owner as ILexEntry; + entry = mf.Owner as ILexEntry; var lexemeForm = entry.LexemeFormOA; if (lexemeForm != null) { @@ -436,7 +437,12 @@ internal static ITsString MakeAnalysisStringRep(IWfiAnalysis wa, LcmCache fdoCac if (sense != null) { ITsString tssGloss = sense.Gloss.get_String(fdoCache.DefaultAnalWs); - tsb.Replace(ichMinSense, ichMinSense, tssGloss.Text, glossTextProperties); + var inflType = mb.InflTypeRA; + var glossAccessor = sense.Gloss; + var wsAnalysis = fdoCache.ServiceLocator.WritingSystemManager.Get(fdoCache.DefaultAnalWs); + var tssSense = MorphServices.MakeGlossOptionWithInflVariantTypes(inflType, glossAccessor, wsAnalysis); + var displayText = tssSense?.Text ?? tssGloss.Text; + tsb.Replace(ichMinSense, ichMinSense, displayText, glossTextProperties); } else tsb.Replace(ichMinSense, ichMinSense, ksMissingString, glossTextProperties); @@ -569,6 +575,7 @@ public void Activate(Rect loc) combo.Location = new System.Drawing.Point(loc.left, loc.top); // 21 is the default height of a combo, the smallest reasonable size. combo.Size = new System.Drawing.Size(Math.Max(loc.right - loc.left + 30, 200), Math.Max( loc.bottom - loc.top, 50)); + if (!m_owner.Controls.Contains(combo)) m_owner.Controls.Add(combo); }