/// <summary> /// Given a segment (for which we should have just loaded the wordforms), load any associated text tagging data /// </summary> /// <param name="hvoSeg"></param> private void LoadDataForTextTags(int hvoSeg) { // Get a 'real' Segment ISegment curSeg; try { curSeg = m_segRepository.GetObject(hvoSeg); if (curSeg.AnalysesRS == null || curSeg.AnalysesRS.Count == 0) { return; // small sanity check } } catch (KeyNotFoundException) { return; // Hmm... this could be a problem, but we'll just skip it for now. } // Get all AnalysisOccurrences in this Segment // Resharper says the following LINQ is equivalent. OK, I guess! //var segWords = new List<AnalysisOccurrence>(); //for (int i = 0; i < curSeg.AnalysesRS.Count; i++) // segWords.Add(new AnalysisOccurrence(curSeg, i)); var segWords = curSeg.AnalysesRS.Select((t, i) => new AnalysisOccurrence(curSeg, i)).ToList(); // Find all the tags for this Segment's AnalysisOccurrences and cache them var textTagList = InterlinTaggingChild.GetTaggingReferencingTheseWords(segWords); var occurrencesTagged = new Set <AnalysisOccurrence>(); foreach (var tag in textTagList) { occurrencesTagged.AddRange(tag.GetOccurrences()); CacheTagString(tag); } // now go through the list of occurrences that didn't have tags cached, and make sure they have empty strings cached var occurrencesWithoutTags = occurrencesTagged.SymmetricDifference(segWords); if (occurrencesWithoutTags != null) { CacheNullTagString(occurrencesWithoutTags); } }
/// <summary> /// /// </summary> /// <param name="interlinDoc"></param> /// <param name="fForRedo">true for adding a redo action, false for adding undo action</param> internal UndoRedoTextTag(InterlinTaggingChild interlinDoc, bool fForRedo, SelectionHelper originalSelectionInfo) { m_fForRedo = fForRedo; m_interlinDoc = interlinDoc; m_cache = interlinDoc.Cache; m_originalSelection = originalSelectionInfo; m_affectedXfics = m_interlinDoc.GetAllXficsPossiblyAffectedByTagging(m_interlinDoc.SelectedWfics); }
internal UndoRedoTagTextTaskHelper(InterlinTaggingChild itc, string undo, string redo, SelectionHelper originalSelectionInfo) : base(itc.Cache, undo, redo) { m_itc = itc; m_originalSelectionInfo = originalSelectionInfo; // add the undo action first, since this will be the last action undone. AddAction(new UndoRedoTextTag(itc, false, m_originalSelectionInfo)); }
private void ClearInterlinDocPaneVariables() { m_idcPane = null; m_taggingViewPane = null; m_printViewPane = null; }
private void MakeTaggingPane() { if (m_taggingViewPane != null) return; m_taggingViewPane = new InterlinTaggingChild(); m_taggingViewPane.Name = "m_taggingViewPane"; m_taggingViewPane.ForEditing = false; m_taggingViewPane.Dock = DockStyle.Fill; m_taggingViewPane.BackColor = Color.FromKnownColor(KnownColor.Window); this.SetStyleSheetFor(m_taggingViewPane); m_taggingViewPane.Visible = false; m_panelTagging.Controls.Add(m_taggingViewPane); // If these don't happen now they will happen later in SetupDataContext. if (Cache != null) m_taggingViewPane.Cache = Cache; if (m_mediator != null) m_taggingViewPane.Init(m_mediator, m_configurationParameters); }