/// <summary> /// Respond to user clicks in references display. /// </summary> private void webBrowser_BeforeNavigate(object s, onlyconnect.BeforeNavigateEventArgs e) { string link = e.Target; // Deny that missing reference rendering is a problem if (link.StartsWith("userclick:deny")) { DenyReference(link.Substring(15), true); e.Cancel = true; } // Remove denial that missing reference is a problem else if (link.StartsWith("userclick:undeny")) { DenyReference(link.Substring(17), false); e.Cancel = true; } // Scroll the editor to this reference. else if (link.StartsWith("userclick:scripref")) { string thisRef = link.Substring(19).Replace('_', ' '); string strStoryName, strAnchor; int nLineNumber; BiblicalTermsHTMLBuilder.ParseReference(thisRef, out strStoryName, out nLineNumber, out strAnchor); _theSE.NavigateTo(strStoryName, nLineNumber, strAnchor); e.Cancel = true; } }
readonly BiblicalTermsList _biblicalTerms; // All Biblical terms public BiblicalKeyTermsForm(StoryEditor theSE, ProjectSettings projSettings, ProjectSettings.LanguageInfo liMainLang) { _theSE = theSE; MainLang = liMainLang; _projSettings = projSettings; InitializeComponent(); _biblicalTerms = BiblicalTermsList.GetBiblicalTerms(); htmlBuilder = new BiblicalTermsHTMLBuilder(projSettings); // TODO: temporary hack. If we are using the Hindi 'MyKeyTerms' db, then // change the 'English Gloss' column header to Hindi and change the font if (_biblicalTerms.IsMyBiblicalTerms) { ColumnGlossEnglish.HeaderText = "Gloss"; ColumnGlossEnglish.DefaultCellStyle.Font = new Font("Arial Unicode MS", 12); } }
private void DenyReference(string reference, bool doDeny) { if (SelectedTerm == null) { return; // should not happen } reference = reference.Replace("%20", " "); TermRendering termRendering = renderings.GetRendering(SelectedTerm.Id); string strOneStoryDenialUrl = BiblicalTermsHTMLBuilder.ConstructUrlFromReference(_theSE, reference); if (doDeny) { if (!termRendering.Denials.Contains(strOneStoryDenialUrl)) { termRendering.Status = BiblicalTermStatus.AllFoundOrDenied; termRendering.Denials.Add(strOneStoryDenialUrl); } } else // remove denial { termRendering.Status = BiblicalTermStatus.SomeMissing; while (termRendering.Denials.Contains(strOneStoryDenialUrl)) { termRendering.Denials.Remove(strOneStoryDenialUrl); } } LoadReferencesDisplay(false); reference = reference.Replace(" ", "_"); // e.g. projectxnr_Story: 'BibStory' line: 1 anchor: Gen 2:4 idToScrollTo = "project1_" + reference; NotifyRenderingsChanged(); }