Skip to content

Commit 4a08a38

Browse files
authored
LT-22161: Show approval source in parsing development mode (#409)
Fix LT-22161: Show approval source in parsing dev mode
1 parent 3d60abd commit 4a08a38

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

Src/LexText/Interlinear/InterlinVc.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using SIL.LCModel;
1919
using SIL.LCModel.DomainServices;
2020
using SIL.LCModel.Infrastructure;
21+
using Gecko.WebIDL;
2122

2223
namespace SIL.FieldWorks.IText
2324
{
@@ -853,16 +854,35 @@ private void JoinGlossAffixesOfInflVariantTypes(ILexEntryRef entryRef1, int wsPr
853854
/// <param name="vwenv"></param>
854855
protected virtual void AddWordBundleInternal(int hvo, IVwEnv vwenv)
855856
{
856-
SetupAndOpenInnerPile(vwenv);
857857
// we assume we're in the context of a segment with analyses here.
858858
// we'll need this info down in DisplayAnalysisAndCloseInnerPile()
859859
int hvoSeg;
860860
int tagDummy;
861861
int index;
862862
vwenv.GetOuterObject(vwenv.EmbeddingLevel - 1, out hvoSeg, out tagDummy, out index);
863863
var analysisOccurrence = new AnalysisOccurrence(m_segRepository.GetObject(hvoSeg), index);
864+
SetBorderColor(vwenv, analysisOccurrence);
865+
SetupAndOpenInnerPile(vwenv);
864866
DisplayAnalysisAndCloseInnerPile(vwenv, analysisOccurrence, true);
865867
}
868+
private void SetBorderColor(IVwEnv vwenv, AnalysisOccurrence analysisOccurrence)
869+
{
870+
var coRepository = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>();
871+
var wag = (IAnalysis)coRepository.GetObject(analysisOccurrence.Analysis.Hvo);
872+
int width = 0;
873+
int color = (int)ColorUtil.ConvertColorToBGR(Color.Black);
874+
if (IsParsingDevMode() && wag.ClassID != WfiWordformTags.kClassId && !(wag is IPunctuationForm))
875+
{
876+
// Show how the analysis was approved by setting the border color.
877+
width = 3000;
878+
color = GetGuessColor(wag.Analysis);
879+
}
880+
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, width);
881+
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, width);
882+
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, width);
883+
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, width);
884+
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor, (int)FwTextPropVar.ktpvDefault, color);
885+
}
866886

867887
/// <summary>
868888
/// Displays Analysis using DisplayWordBundleMethod and closes the views Inner Pile.

0 commit comments

Comments
 (0)