Skip to content

Commit 143f9d0

Browse files
authored
Fixes LT-22241: User disapproved analyses in Parsing Dev Mode (#433)
1 parent c40251b commit 143f9d0

File tree

7 files changed

+37
-25
lines changed

7 files changed

+37
-25
lines changed

Build/mkall.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@
234234
<ChorusNugetVersion>5.2.0-beta0003</ChorusNugetVersion>
235235
<PalasoNugetVersion>15.0.0-beta0117</PalasoNugetVersion>
236236
<ParatextNugetVersion>9.4.0.1-beta</ParatextNugetVersion>
237-
<LcmNugetVersion>11.0.0-beta0129</LcmNugetVersion>
237+
<LcmNugetVersion>11.0.0-beta0130</LcmNugetVersion>
238238
<IcuNugetVersion>70.1.123</IcuNugetVersion>
239239
<HermitCrabNugetVersion>3.6.6</HermitCrabNugetVersion>
240240
<IPCFrameworkVersion>1.1.1-beta0001</IPCFrameworkVersion>

Build/nuget-common/packages.config

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@
5050
<package id="SIL.Core" version="8.1.0-beta0035" targetFramework="net461" />
5151
<package id="SIL.DesktopAnalytics" version="4.0.0" targetFramework="net461" />
5252
<package id="SIL.FLExBridge.IPCFramework" version="1.1.1-beta0001" targetFramework="net461" />
53-
<package id="SIL.LCModel.Build.Tasks" version="11.0.0-beta0129" targetFramework="net461" />
54-
<package id="SIL.LCModel.Core.Tests" version="11.0.0-beta0129" targetFramework="net461" />
55-
<package id="SIL.LCModel.Core" version="11.0.0-beta0129" targetFramework="net461" />
56-
<package id="SIL.LCModel.FixData" version="11.0.0-beta0129" targetFramework="net461" />
57-
<package id="SIL.LCModel.Tests" version="11.0.0-beta0129" targetFramework="net461" />
58-
<package id="SIL.LCModel.Tools" version="11.0.0-beta0129" targetFramework="net461" />
59-
<package id="SIL.LCModel.Utils.Tests" version="11.0.0-beta0129" targetFramework="net461" />
60-
<package id="SIL.LCModel.Utils" version="11.0.0-beta0129" targetFramework="net461" />
61-
<package id="SIL.LCModel" version="11.0.0-beta0129" targetFramework="net461" />
53+
<package id="SIL.LCModel.Build.Tasks" version="11.0.0-beta0130" targetFramework="net461" />
54+
<package id="SIL.LCModel.Core.Tests" version="11.0.0-beta0130" targetFramework="net461" />
55+
<package id="SIL.LCModel.Core" version="11.0.0-beta0130" targetFramework="net461" />
56+
<package id="SIL.LCModel.FixData" version="11.0.0-beta0130" targetFramework="net461" />
57+
<package id="SIL.LCModel.Tests" version="11.0.0-beta0130" targetFramework="net461" />
58+
<package id="SIL.LCModel.Tools" version="11.0.0-beta0130" targetFramework="net461" />
59+
<package id="SIL.LCModel.Utils.Tests" version="11.0.0-beta0130" targetFramework="net461" />
60+
<package id="SIL.LCModel.Utils" version="11.0.0-beta0130" targetFramework="net461" />
61+
<package id="SIL.LCModel" version="11.0.0-beta0130" targetFramework="net461" />
6262
<package id="SIL.Lexicon" version="15.0.0-beta0117" targetFramework="net462" />
6363
<package id="SIL.libpalaso.l10ns" version="6.0.0" targetFramework="net461" />
6464
<package id="SIL.Lift" version="15.0.0-beta0117" targetFramework="net462" />

Src/LexText/Interlinear/ChooseAnalysisHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ public void SetupCombo()
288288
{
289289
Opinions o = wa.GetAgentOpinion(
290290
m_cache.LangProject.DefaultUserAgent);
291-
// skip any analysis the user has disapproved.
292-
if (o != Opinions.disapproves)
291+
// skip any analysis the user has disapproved unless we are in parsing dev mode.
292+
if (IsParsingDevMode() || o != Opinions.disapproves)
293293
{
294294
AddAnalysisItems(wa);
295295
AddSeparatorLine();

Src/LexText/Interlinear/FocusBoxController.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private void ChangeOrCreateSandbox(AnalysisOccurrence selected)
130130
//if this sandbox is presenting a wordform with multiple possible analyses then set the
131131
//bg color indicator
132132
if (selected.Analysis.Wordform != null &&
133-
SandboxBase.GetHasMultipleRelevantAnalyses(selected.Analysis.Wordform))
133+
SandboxBase.GetHasMultipleRelevantAnalyses(selected.Analysis.Wordform, IsParsingDevMode()))
134134
{
135135
color = InterlinVc.MultipleApprovedGuessColor;
136136
}
@@ -154,6 +154,13 @@ private void ChangeOrCreateSandbox(AnalysisOccurrence selected)
154154
SetSandboxSize();
155155
}
156156

157+
internal bool IsParsingDevMode()
158+
{
159+
if (InterlinDoc?.GetMaster() == null)
160+
return false;
161+
return InterlinDoc.GetMaster().IsParsingDevMode();
162+
}
163+
157164
internal virtual IAnalysisControlInternal CreateNewSandbox(AnalysisOccurrence selected)
158165
{
159166
Sandbox sandbox = new Sandbox(selected.Analysis.Cache, m_mediator, m_propertyTable, m_stylesheet,

Src/LexText/Interlinear/InterlinVc.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1832,7 +1832,7 @@ private void DisplayWord(int choiceIndex, IAnalysis wag)
18321832
if (word != null)
18331833
{
18341834
//test if there are multiple analyses that a user might choose from
1835-
if (SandboxBase.GetHasMultipleRelevantAnalyses(word))
1835+
if (SandboxBase.GetHasMultipleRelevantAnalyses(word, m_this.IsParsingDevMode()))
18361836
{
18371837
m_this.SetGuessing(m_vwenv, MultipleApprovedGuessColor); //There are multiple options, set the color
18381838
}

Src/LexText/Interlinear/SandboxBase.ComboHandlers.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,9 @@ internal InterlinComboHandler(SandboxBase sandbox)
117117

118118
internal bool IsParsingDevMode()
119119
{
120-
if (m_sandbox.InterlinDoc?.GetMaster() == null)
121-
return false;
122-
return m_sandbox.InterlinDoc.GetMaster().IsParsingDevMode();
120+
return m_sandbox.IsParsingDevMode();
123121
}
124122

125-
126-
127123
// only for testing
128124
internal void SetSandboxForTesting(SandboxBase sandbox)
129125
{
@@ -1032,8 +1028,8 @@ private void AddAnalysesOf(IWfiWordform wordform, bool fBaseWordIsPhrase)
10321028
{
10331029
Opinions o = wa.GetAgentOpinion(
10341030
m_caches.MainCache.LangProject.DefaultUserAgent);
1035-
if (o == Opinions.disapproves)
1036-
continue; // skip any analysis the user has disapproved.
1031+
if (o == Opinions.disapproves && !IsParsingDevMode())
1032+
continue; // skip any analysis the user has disapproved unless we are in parsing dev mode.
10371033
int cmorphs = wa.MorphBundlesOS.Count;
10381034
if (cmorphs == 0)
10391035
continue;

Src/LexText/Interlinear/SandboxBase.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ private bool LoadRealDataIntoSec1(int hvoSbWord, bool fLookForDefaults, bool fAd
12111211
if ((m_occurrenceSelected == null ||
12121212
m_occurrenceSelected.Analysis == null ||
12131213
m_occurrenceSelected.Analysis.Wordform != null) &&
1214-
GetHasMultipleRelevantAnalyses(CurrentAnalysisTree.Wordform))
1214+
GetHasMultipleRelevantAnalyses(CurrentAnalysisTree.Wordform, IsParsingDevMode()))
12151215
{
12161216
MultipleAnalysisColor = InterlinVc.MultipleApprovedGuessColor;
12171217
}
@@ -1633,10 +1633,12 @@ public static bool IsLexicalPattern(IMultiUnicode multiString)
16331633
return false;
16341634
}
16351635

1636-
public static bool GetHasMultipleRelevantAnalyses(IWfiWordform analysis)
1636+
public static bool GetHasMultipleRelevantAnalyses(IWfiWordform wordform, bool isParsingDevMode)
16371637
{
1638-
int humanCount = analysis.HumanApprovedAnalyses.Count();
1639-
int machineCount = analysis.HumanNoOpinionParses.Count();
1638+
if (isParsingDevMode)
1639+
return wordform.AnalysesOC.Count > 1;
1640+
int humanCount = wordform.HumanApprovedAnalyses.Count();
1641+
int machineCount = wordform.HumanNoOpinionParses.Count();
16401642
return humanCount + machineCount > 1;
16411643
}
16421644

@@ -1649,6 +1651,13 @@ private static bool IsAnalysisHumanApproved(LcmCache cache, IWfiAnalysis analysi
16491651
select ae).FirstOrDefault() != null;
16501652
}
16511653

1654+
internal bool IsParsingDevMode()
1655+
{
1656+
if (InterlinDoc?.GetMaster() == null)
1657+
return false;
1658+
return InterlinDoc.GetMaster().IsParsingDevMode();
1659+
}
1660+
16521661
/// <summary>
16531662
/// Select the indicated icon of the word.
16541663
/// </summary>

0 commit comments

Comments
 (0)