Skip to content

Commit f462470

Browse files
authored
Fix LT-5408: Show which parses are valid in chooser (#364)
* Add highlighting for parser-approved analyses * Add GetAnalysisColor * Change to use check marks and red Xs * Add AddOpinion * Add SetGuessColor. Make double approved analyses be green * Remove double coloring and add space * Fix unit test failure * Remove unnecessary changes
1 parent 2742241 commit f462470

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Src/LexText/Interlinear/ChooseAnalysisHandler.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,17 @@ internal static ITsString MakeAnalysisStringRep(IWfiAnalysis wa, LcmCache fdoCac
387387
lim = -1;
388388
increment = -1;
389389
}
390+
391+
if (wa?.Cache?.LanguageProject != null)
392+
{
393+
Opinions uao = wa.GetAgentOpinion(wa.Cache.LangProject.DefaultUserAgent);
394+
Opinions pao = wa.GetAgentOpinion(wa.Cache.LangProject.DefaultParserAgent);
395+
AddOpinion(tsb, uao, InterlinVc.ApprovedGuessColor);
396+
AddOpinion(tsb, pao, InterlinVc.MachineGuessColor);
397+
tsb.Replace(tsb.Length, tsb.Length, " ", null);
398+
tsb.SetProperties(tsb.Length - 1, tsb.Length, formTextProperties);
399+
}
400+
390401
for (int i = start; i != lim; i += increment)
391402
{
392403
var mb = wa.MorphBundlesOS[i];
@@ -457,6 +468,27 @@ internal static ITsString MakeAnalysisStringRep(IWfiAnalysis wa, LcmCache fdoCac
457468
return tsb.GetString();
458469
}
459470

471+
private static void AddOpinion(ITsStrBldr tsb, Opinions opinion, int backColor)
472+
{
473+
int foreColor = (int)CmObjectUi.RGB(Color.Black);
474+
if (opinion == Opinions.approves)
475+
tsb.Replace(tsb.Length, tsb.Length, "\u2714", null); // bold check mark
476+
else if (opinion == Opinions.noopinion)
477+
{
478+
// Use same foreground and background color to create a blank of the same width as a check mark.
479+
tsb.Replace(tsb.Length, tsb.Length, "\u2714", null);
480+
foreColor = backColor;
481+
}
482+
else if (opinion == Opinions.disapproves)
483+
{
484+
tsb.Replace(tsb.Length, tsb.Length, "X", null);
485+
foreColor = (int)CmObjectUi.RGB(Color.Red);
486+
}
487+
tsb.SetStrPropValue(tsb.Length - 1, tsb.Length, (int)FwTextPropType.ktptFontFamily, "Segoe UI Symbol");
488+
tsb.SetIntPropValues(tsb.Length - 1, tsb.Length, (int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, foreColor);
489+
tsb.SetIntPropValues(tsb.Length - 1, tsb.Length, (int)FwTextPropType.ktptBackColor, (int)FwTextPropVar.ktpvDefault, backColor);
490+
}
491+
460492
/// <summary>
461493
///
462494
/// </summary>

0 commit comments

Comments
 (0)