diff --git a/Build/mkall.targets b/Build/mkall.targets index 2aae7bf96f..3aa7f41187 100644 --- a/Build/mkall.targets +++ b/Build/mkall.targets @@ -285,7 +285,7 @@ 5.2.0-beta0003 15.0.0-beta0117 9.4.0.1-beta - 11.0.0-beta0121 + 11.0.0-beta0124 70.1.123 3.6.6 1.1.1-beta0001 diff --git a/Build/nuget-common/packages.config b/Build/nuget-common/packages.config index ea0ceffbf5..179bbd5124 100644 --- a/Build/nuget-common/packages.config +++ b/Build/nuget-common/packages.config @@ -51,15 +51,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/DistFiles/Language Explorer/Configuration/Words/areaConfiguration.xml b/DistFiles/Language Explorer/Configuration/Words/areaConfiguration.xml index 48287bafa4..10fee39719 100644 --- a/DistFiles/Language Explorer/Configuration/Words/areaConfiguration.xml +++ b/DistFiles/Language Explorer/Configuration/Words/areaConfiguration.xml @@ -28,8 +28,14 @@ + + + + + + - + @@ -286,6 +292,10 @@ + + + + diff --git a/Src/LexText/Interlinear/ChooseAnalysisHandler.cs b/Src/LexText/Interlinear/ChooseAnalysisHandler.cs index ee48a376f3..79d284bec3 100644 --- a/Src/LexText/Interlinear/ChooseAnalysisHandler.cs +++ b/Src/LexText/Interlinear/ChooseAnalysisHandler.cs @@ -282,7 +282,7 @@ public void SetupCombo() var wordform = m_owner.GetWordformOfAnalysis(); // Add the analyses, and recursively the other items. - var guess_services = new AnalysisGuessServices(m_cache); + var guess_services = new AnalysisGuessServices(m_cache, IsParsingMode()); var sorted_analyses = guess_services.GetSortedAnalysisGuesses(wordform, m_occurrence, false); foreach (var wa in sorted_analyses) { @@ -311,7 +311,7 @@ void AddAnalysisItems(IWfiAnalysis wa) { AddItem(wa, MakeAnalysisStringRep(wa, m_cache, StyleSheet != null, (m_owner as SandboxBase).RawWordformWs), true); - var guess_services = new AnalysisGuessServices(m_cache); + var guess_services = new AnalysisGuessServices(m_cache, IsParsingMode()); var sorted_glosses = guess_services.GetSortedGlossGuesses(wa, m_occurrence); foreach (var gloss in sorted_glosses) { @@ -323,6 +323,13 @@ void AddAnalysisItems(IWfiAnalysis wa) AddItem(wa, MakeSimpleString(ITextStrings.ksNewWordGloss), false, WfiGlossTags.kClassId); } + private bool IsParsingMode() + { + if (Owner?.InterlinDoc?.GetMaster() == null) + return false; + return Owner.InterlinDoc.GetMaster().IsParsingMode(); + } + protected ITsString MakeSimpleString(String str) { ITsStrBldr builder = TsStringUtils.MakeStrBldr(); diff --git a/Src/LexText/Interlinear/ITextStrings.Designer.cs b/Src/LexText/Interlinear/ITextStrings.Designer.cs index 73f2a291b5..a6fa54ab95 100644 --- a/Src/LexText/Interlinear/ITextStrings.Designer.cs +++ b/Src/LexText/Interlinear/ITextStrings.Designer.cs @@ -19,7 +19,7 @@ namespace SIL.FieldWorks.IText { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class ITextStrings { @@ -1576,6 +1576,15 @@ internal static string ksParsing { } } + /// + /// Looks up a localized string similar to Parsing. + /// + internal static string ksParsingMode { + get { + return ResourceManager.GetString("ksParsingMode", resourceCulture); + } + } + /// /// Looks up a localized string similar to Ph{0} {1}. /// diff --git a/Src/LexText/Interlinear/ITextStrings.resx b/Src/LexText/Interlinear/ITextStrings.resx index 96a099fec3..0f730840c8 100644 --- a/Src/LexText/Interlinear/ITextStrings.resx +++ b/Src/LexText/Interlinear/ITextStrings.resx @@ -986,4 +986,11 @@ Click "Cancel" to abort this import. Export Concordance Results + + Results may be incomplete. + + + Parsing + alternate name for Analyze tab + \ No newline at end of file diff --git a/Src/LexText/Interlinear/InterlinDocRootSiteBase.cs b/Src/LexText/Interlinear/InterlinDocRootSiteBase.cs index 6c65d7da4e..d694321f3c 100644 --- a/Src/LexText/Interlinear/InterlinDocRootSiteBase.cs +++ b/Src/LexText/Interlinear/InterlinDocRootSiteBase.cs @@ -1013,6 +1013,7 @@ protected virtual void SetRootInternal(int hvo) NonUndoableUnitOfWorkHelper.Do(Cache.ActionHandlerAccessor, () => InterlinMaster.LoadParagraphAnnotationsAndGenerateEntryGuessesIfNeeded(RootStText, true)); // Sync Guesses data before we redraw anything. + Vc.RootSite = this; UpdateGuessData(); } // FWR-191: we don't need to reconstruct the display if we didn't need to reload annotations diff --git a/Src/LexText/Interlinear/InterlinMaster.cs b/Src/LexText/Interlinear/InterlinMaster.cs index 87fd9523bb..e5aca1c26c 100644 --- a/Src/LexText/Interlinear/InterlinMaster.cs +++ b/Src/LexText/Interlinear/InterlinMaster.cs @@ -55,6 +55,8 @@ public partial class InterlinMaster : InterlinMasterBase, IFocusablePanePortion private string m_currentTool = ""; + private string m_analyzeTabName = ""; + public string CurrentTool { get { return m_currentTool; } @@ -87,6 +89,8 @@ public InterlinMaster() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); + // Save the Analyze tab name. + m_analyzeTabName = m_tpInterlinear.Text; } internal string BookmarkId @@ -721,6 +725,7 @@ public override void Init(Mediator mediator, PropertyTable propertyTable, XmlNod m_mediator = mediator; // InitBase will do this, but we need it in place before calling SetInitialTabPage(). m_propertyTable = propertyTable; + SetParsingMode(IsParsingMode()); // Making the tab control currently requires this first... if (!fHideTitlePane) @@ -1246,6 +1251,46 @@ public bool OnConfigureInterlinear(object argument) return true; // We handled this } + public bool OnDisplaySetParsingMode(object commandObject, + ref UIItemDisplayProperties display) + { + var cmd = (Command)commandObject; + bool value = cmd.GetParameter("value") == "true"; + display.Checked = IsParsingMode() == value; + return true; + } + + public bool OnSetParsingMode(object argument) + { + var cmd = (Command)argument; + string value = cmd.GetParameter("value"); + SetParsingMode(value == "true"); + // Refresh the display. + RootStText = null; + m_idcAnalyze.ResetAnalysisCache(); + Clerk.JumpToIndex(Clerk.CurrentIndex); + return true; // we handled this + } + + public void SetParsingMode(bool value) + { + m_propertyTable.SetProperty("ParsingMode", value, PropertyTable.SettingsGroup.LocalSettings, false); + if (value) + { + m_tpInterlinear.Text = ITextStrings.ksParsingMode; + } + else + { + // Restore Analyze tab name. + m_tpInterlinear.Text = m_analyzeTabName; + } + } + + public bool IsParsingMode() + { + return m_propertyTable.GetBoolProperty("ParsingMode", false, PropertyTable.SettingsGroup.LocalSettings); + } + /// /// Use this to determine whether the last selected tab page which was /// persisted in the PropertyTable, pertains to an interlinear document. diff --git a/Src/LexText/Interlinear/InterlinVc.cs b/Src/LexText/Interlinear/InterlinVc.cs index bc71a04bf1..83380f468b 100644 --- a/Src/LexText/Interlinear/InterlinVc.cs +++ b/Src/LexText/Interlinear/InterlinVc.cs @@ -373,17 +373,24 @@ public void ResetAnalysisCache() if (m_loader != null) { CheckDisposed(); - m_loader.ResetGuessCache(); + m_loader.ResetGuessCache(IsParsingMode()); } } + internal bool IsParsingMode() + { + if (RootSite?.GetMaster() == null) + return false; + return RootSite.GetMaster().IsParsingMode(); + } + internal AnalysisGuessServices GuessServices { get { if (m_loader != null && m_loader.GuessServices != null) return m_loader.GuessServices; - return new AnalysisGuessServices(m_cache); + return new AnalysisGuessServices(m_cache, IsParsingMode()); } } @@ -541,10 +548,32 @@ private void SetGuessing(IVwEnv vwenv, int bgColor) UsingGuess = true; } - private void SetGuessing(IVwEnv vwenv) + private int GetGuessColor(ICmObject obj) { - SetGuessing(vwenv, ApprovedGuessColor); - UsingGuess = true; + IWfiAnalysis wa; + if (IsParsingMode()) + { + // Parser approval takes precedence over User approval. + wa = (obj is IWfiGloss) ? ((IWfiGloss)obj).Analysis : obj as IWfiAnalysis; + if (wa != null) + { + Opinions opinion = wa.GetAgentOpinion(wa.Cache.LangProject.DefaultParserAgent); + if (opinion == Opinions.approves) + return MachineGuessColor; + } + return ApprovedGuessColor; + } + // User approval takes precedence over Parser approval. + if (obj is IWfiGloss) + return ApprovedGuessColor; + wa = obj as IWfiAnalysis; + if (wa != null) + { + Opinions opinion = wa.GetAgentOpinion(wa.Cache.LangProject.DefaultUserAgent); + if (opinion == Opinions.approves) + return ApprovedGuessColor; + } + return MachineGuessColor; } public bool UsingGuess { get; set; } @@ -1822,11 +1851,7 @@ private void DisplayMorphemes() // Display the morpheme bundles. 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.GuessCache.get_IntProp(m_hvoDefault, InterlinViewDataCache.OpinionAgentFlid) != - (int) AnalysisGuessServices.OpinionAgent.Parser; - m_this.SetGuessing(m_vwenv, isHumanGuess ? ApprovedGuessColor : MachineGuessColor); + m_this.SetGuessing(m_vwenv, m_this.GetGuessColor(m_defaultObj)); // Let the exporter know that this is a guessed analysis. m_vwenv.set_StringProperty(ktagAnalysisStatus, "guess"); } @@ -1842,7 +1867,7 @@ private void DisplayMorphemes() if (m_hvoWordBundleAnalysis == m_hvoWordform) { // Real analysis is just word, one we're displaying is a default - m_this.SetGuessing(m_vwenv); + m_this.SetGuessing(m_vwenv, m_this.GetGuessColor(m_defaultObj)); // Let the exporter know that this is a guessed analysis. m_vwenv.set_StringProperty(ktagAnalysisStatus, "guess"); } @@ -1866,11 +1891,7 @@ private void DisplayWordGloss(InterlinLineSpec spec, int choiceIndex) 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.GuessCache.get_IntProp(m_hvoDefault, InterlinViewDataCache.OpinionAgentFlid) != - (int)AnalysisGuessServices.OpinionAgent.Parser; - m_this.SetGuessing(m_vwenv, isHumanGuess ? ApprovedGuessColor : MachineGuessColor); + m_this.SetGuessing(m_vwenv, m_this.GetGuessColor(m_defaultObj)); } var wa = (IWfiAnalysis) m_defaultObj; if (wa.MeaningsOC.Count == 0) @@ -1899,7 +1920,7 @@ private void DisplayWordGloss(InterlinLineSpec spec, int choiceIndex) } else { - m_this.SetGuessing(m_vwenv); + m_this.SetGuessing(m_vwenv, m_this.GetGuessColor(m_defaultObj)); m_vwenv.AddObj(m_hvoDefault, m_this, kfragLineChoices + choiceIndex); } break; @@ -1919,18 +1940,14 @@ private void DisplayWordPOS(int choiceIndex) case WfiAnalysisTags.kClassId: if (m_hvoDefault != m_hvoWordBundleAnalysis) { - // Real analysis isn't what we're displaying, so POS is a guess. - bool isHumanApproved = m_this.GuessCache.get_IntProp(m_hvoDefault, InterlinViewDataCache.OpinionAgentFlid) - != (int)AnalysisGuessServices.OpinionAgent.Parser; - - m_this.SetGuessing(m_vwenv, isHumanApproved ? ApprovedGuessColor : MachineGuessColor); + m_this.SetGuessing(m_vwenv, m_this.GetGuessColor(m_defaultObj)); } m_this.AddAnalysisPos(m_vwenv, m_hvoDefault, m_hvoWordBundleAnalysis, choiceIndex); break; case WfiGlossTags.kClassId: m_hvoWfiAnalysis = m_defaultObj.Owner.Hvo; if (m_hvoWordBundleAnalysis == m_hvoWordform) // then our analysis is a guess - m_this.SetGuessing(m_vwenv); + m_this.SetGuessing(m_vwenv, m_this.GetGuessColor(m_defaultObj)); m_vwenv.AddObj(m_hvoWfiAnalysis, m_this, kfragAnalysisCategoryChoices + choiceIndex); break; default: @@ -2288,7 +2305,7 @@ private void EnsureLoader() internal virtual IParaDataLoader CreateParaLoader() { - return new InterlinViewCacheLoader(new AnalysisGuessServices(m_cache), GuessCache); + return new InterlinViewCacheLoader(new AnalysisGuessServices(m_cache, IsParsingMode()), GuessCache); } internal void RecordGuessIfNotKnown(AnalysisOccurrence selected) @@ -2409,7 +2426,7 @@ public interface IParaDataLoader { void LoadParaData(IStTxtPara para); void LoadSegmentData(ISegment seg); - void ResetGuessCache(); + void ResetGuessCache(bool parsingMode); bool UpdatingOccurrence(IAnalysis oldAnalysis, IAnalysis newAnalysis); void RecordGuessIfNotKnown(AnalysisOccurrence occurrence); IAnalysis GetGuessForWordform(IWfiWordform wf, int ws); @@ -2533,10 +2550,11 @@ protected virtual void SetInt(int hvo, int flid, int n) #region IParaDataLoader Members - public void ResetGuessCache() + public void ResetGuessCache(bool parsingMode) { // recreate the guess services, so they will use the latest FDO data. GuessServices.ClearGuessData(); + GuessServices.PrioritizeParser = parsingMode; // clear the cache for the guesses, so it won't have any stale data. m_guessCache.ClearPropFromCache(InterlinViewDataCache.AnalysisMostApprovedFlid); } diff --git a/Src/LexText/Interlinear/SandboxBase.ComboHandlers.cs b/Src/LexText/Interlinear/SandboxBase.ComboHandlers.cs index f1dbb5189e..a0fb2f2838 100644 --- a/Src/LexText/Interlinear/SandboxBase.ComboHandlers.cs +++ b/Src/LexText/Interlinear/SandboxBase.ComboHandlers.cs @@ -115,6 +115,15 @@ internal InterlinComboHandler(SandboxBase sandbox) m_rootb = sandbox.RootBox; } + internal bool IsParsingMode() + { + if (m_sandbox.InterlinDoc?.GetMaster() == null) + return false; + return m_sandbox.InterlinDoc.GetMaster().IsParsingMode(); + } + + + // only for testing internal void SetSandboxForTesting(SandboxBase sandbox) { @@ -1125,7 +1134,7 @@ private void AddAnalysesOf(IWfiWordform wordform, bool fBaseWordIsPhrase) return; // no real wordform, can't have analyses. ITsStrBldr builder = TsStringUtils.MakeStrBldr(); ITsString space = TsStringUtils.MakeString(fBaseWordIsPhrase ? " " : " ", m_wsVern); - var guess_services = new AnalysisGuessServices(m_caches.MainCache); + var guess_services = new AnalysisGuessServices(m_caches.MainCache, IsParsingMode()); var sorted_analyses = guess_services.GetSortedAnalysisGuesses(wordform, m_wsVern); foreach (IWfiAnalysis wa in sorted_analyses) { @@ -3201,7 +3210,7 @@ private void AddComboItems(ref int hvoEmptyGloss, ITsStrBldr tsb, IWfiAnalysis w { IList wsids = m_sandbox.m_choices.EnabledWritingSystemsForFlid(InterlinLineChoices.kflidWordGloss); - var guess_services = new AnalysisGuessServices(m_caches.MainCache); + var guess_services = new AnalysisGuessServices(m_caches.MainCache, IsParsingMode()); var sorted_glosses = guess_services.GetSortedGlossGuesses(wa); foreach (IWfiGloss gloss in sorted_glosses) {