/// ------------------------------------------------------------------------------------ /// <summary> /// Load the Paratext project and enumerator, preparing us to read the data files. /// </summary> /// <param name="paratextProjectId">3-letter Paratext project ID</param> /// <returns>true if the project was loaded, else false</returns> /// ------------------------------------------------------------------------------------ protected virtual void LoadParatextProject(string paratextProjectId) { try { m_ptProjectText = ScriptureProvider.MakeScrText(paratextProjectId); } catch (Exception e) { // Can't load Paratext project if Paratext is not installed. throw new ParatextLoadException( TeResourceHelper.GetResourceString("kstidCheckParatextInstallation"), e); } try { // create ref objs of the Paratext lib Logger.WriteEvent("Loading Paratext project " + paratextProjectId + " to import from " + m_settings.StartRef.AsString + " to " + m_settings.EndRef.AsString); // Now initialize the TextEnum with the range of Scripture text we want m_ptParser = m_ptProjectText.Parser; m_ptCurrBook = ScriptureProvider.MakeVerseRef(m_settings.StartRef.Book, 0, 0); ResetParatextState(); } catch (Exception e) { string msg = string.Format( TeResourceHelper.GetResourceString("kstidParatextProjectLoadFailure"), paratextProjectId); throw new ParatextLoadException(msg, e); } }
public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state) { m_parent = parent; if (parent.CurrentState == null) { m_project = null; m_verseRef = null; } else { m_project = parent.CurrentState.Project; m_verseRef = parent.CurrentState.VerseRef; } parent.SetTitle(PluginG.pluginName); parent.WindowClosing += WindowClosing; parent.ProjectChanged += ProjectChanged; parent.VerseRefChanged += VerseRefChanged; if (m_project != null) { m_project.ProjectDataChanged += ProjectDataChanged; } m_UpdateThread = new Thread(UpdateTimeWorker); m_UpdateThread.Start(); }
public ControlG() { InitializeComponent(); s_exists = true; m_project = null; m_verseRef = null; }
public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state) { parent.SetTitle(PluginE.pluginName); m_Project = parent.CurrentState.Project; m_Reference = parent.CurrentState.VerseRef; parent.ProjectChanged += ProjectChanged; parent.VerseRefChanged += VerseRefChanged; }
private void Parent_VerseRefChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference) { Debug.Assert(oldReference.Equals(m_reference)); m_reference = newReference; if (oldReference.BookNum != newReference.BookNum || oldReference.ChapterNum != newReference.ChapterNum) { UpdateWordleAsync(); } }
public Selection(string selectedText, string beforeContext, string afterContext, IVerseRef verseRef, int offset) { SelectedText = selectedText; BeforeContext = beforeContext; AfterContext = afterContext; VerseRefStart = verseRef; VerseRefEnd = verseRef; Offset = offset; }
public void PreviousVerse(Object sender, EventArgs e) { m_Reference = m_Reference.GetPreviousVerse(m_Project); // Get the sync group our window belongs to: var syncGroup = m_parent.CurrentState.SyncReferenceGroup; // Tell our sync group the reference has changed: m_Host.SetReferenceForSyncGroup(m_Reference, syncGroup); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates a BCVRef from a VerseRef. /// </summary> /// ------------------------------------------------------------------------------------ private static BCVRef MakeBCVRef(IVerseRef verseRef) { int segment = string.IsNullOrEmpty(verseRef.Segment()) ? 0 : verseRef.Segment()[0] - 'a'; if (segment < 0 || segment > 2) { segment = 0; } return(new BCVRef(verseRef.BookNum, verseRef.ChapterNum, verseRef.VerseNum, segment)); }
public override void DoLoad(IProgressInfo progressInfo) { if (m_parent != null) { if (m_parent.CurrentState != null) { m_project = m_parent.CurrentState.Project; m_verseRef = m_parent.CurrentState.VerseRef; Invoke((Action)(() => ShowProjectInfo())); } } }
public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state) { m_host = host; parent.SetTitle(ChapterWordCloudPlugin.pluginName); parent.VerseRefChanged += Parent_VerseRefChanged; parent.ProjectChanged += Parent_ProjectChanged; SetProject(parent.CurrentState.Project); m_reference = parent.CurrentState.VerseRef; m_selectedText = state; selectedTextToolStripMenuItem.Checked = state != null; }
private void ReferenceChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference) { if ((m_Reference.BookNum != newReference.BookNum) || (m_Reference.ChapterNum != newReference.ChapterNum)) { PromptSaveAndUnlock(); m_Reference = newReference; chapterText.Text = "Click 'Get Chapter'"; chapterText.BringToFront(); bookName.Text = m_Reference.BookCode; chapterNumber.Text = m_Reference.ChapterNum.ToString(); changedCheckBox.Checked = false; } }
public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state) { parent.SetTitle(PluginH.pluginName); m_Host = host; m_Project = parent.CurrentState.Project; m_Reference = parent.CurrentState.VerseRef; IReferenceListWindow refList = host.ReferenceList; refList.ListChanged += ListChanged; refList.SelectedItemChanged += SelectedItemChanged; refList.ItemDoubleClicked += ItemDoubleClicked; }
public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state) { parent.SetTitle(PluginL.pluginName); parent.ProjectChanged += ProjectChanged; parent.VerseRefChanged += VerseRefChanged; SetProject(parent.CurrentState.Project); m_verseRef = parent.CurrentState.VerseRef; RowStyle rowStyle = new RowStyle(SizeType.AutoSize); m_tableLayoutPanel.RowStyles.Add(rowStyle); AddHeaderRow(); }
private void ReferenceSelected(object sender, EventArgs e) { int index = m_referencesListBox.SelectedIndex; if (index >= 0) { IVerseRef verseRef = ((IBiblicalTerm)m_termsListBox.SelectedItem).Occurrences[index]; // Get the sync group our window belongs to: var syncGroup = m_parent.CurrentState.SyncReferenceGroup; // Tell our sync group the reference has changed: m_host.SetReferenceForSyncGroup(verseRef, syncGroup); } }
public void ProjectChanged(IPluginChildWindow sender, IProject newProject) { if (m_project != null) { m_project.ProjectDataChanged -= ProjectDataChanged; } m_project = newProject; if (m_project != null) { m_project.ProjectDataChanged += ProjectDataChanged; } m_verseRef = sender.CurrentState.VerseRef; ShowProjectInfo(); }
public IReadOnlyList <IPluginAnnotation> GetAnnotations(IVerseRef verseRef, string usfm) { List <IPluginAnnotation> annotations = new List <IPluginAnnotation>(); var styles = GetStyleInfo(0.0); for (int i = 0; i < m_regexes.Count(); i++) { Regex regex = m_regexes[i]; string style = styles[i].Name; foreach (Match match in regex.Matches(usfm)) { Selection sel = new Selection(match.Value, usfm.Substring(0, match.Index), usfm.Substring(match.Index + match.Length), verseRef, match.Index); annotations.Add(new Annotation(sel, style)); } } return(annotations); }
public IReadOnlyList <IPluginAnnotation> GetAnnotations(IVerseRef verseRef, string usfm) { List <IPluginAnnotation> annotations = new List <IPluginAnnotation>(); for (int level = 0; level < findMarksRegexes.Count; level++) { if (findMarksRegexes[level] == null) { continue; } foreach (Match match in findMarksRegexes[level].Matches(usfm)) { Selection sel = new Selection(match.Value, usfm.Substring(0, match.Index), usfm.Substring(match.Index + match.Length), verseRef, match.Index); annotations.Add(new Annotation(sel, "quote" + level)); } } return(annotations); }
private void btnOpen_BCV_Click(object sender, EventArgs e) { if (lstProject_BCV.SelectedItems.Count > 0) { SelectedResourceCategory = ResourceCategory.Standard; SelectedProject = (IReadOnlyProject)lstProject_BCV.SelectedItems[0].Tag; if (txtBook_BCV.Text.Trim() == "" || txtChapter_BCV.Text.Trim() == "" || txtVerse_BCV.Text.Trim() == "") { MessageBox.Show("The Book Num, Chapter Num, and Verse Num need to be filled in."); this.DialogResult = DialogResult.None; return; } try { int book = Convert.ToInt32(txtBook_BCV.Text); int chapter = Convert.ToInt32(txtChapter_BCV.Text); int verse = Convert.ToInt32(txtVerse_BCV.Text); SelectedVerseRef = m_project.Versification.CreateReference(book, chapter, verse); } catch (Exception ex) { MessageBox.Show("Error creating a verse reference: " + ex.Message); this.DialogResult = DialogResult.None; return; } SelectedOpenWindowBehavior = ConvertOpenWindowBehavior((string)cbOpenOption_BCV.SelectedItem); } else { MessageBox.Show("Please select a resource to open."); this.DialogResult = DialogResult.None; return; } Close(); }
public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state) { parent.SetTitle(PluginI.pluginName); SetProject(parent.CurrentState.Project); m_Reference = parent.CurrentState.VerseRef; chapterText.Text = "Click 'Get Chapter'"; bookName.Text = m_Reference.BookCode; chapterNumber.Text = m_Reference.ChapterNum.ToString(); chapterText.Text = ""; chapterText.BringToFront(); changedCheckBox.Checked = false; EnableRadioButtons(); UsfmRadioButton.Checked = true; UsfmTokensRadioButton.Checked = false; UsxRadioButton.Checked = false; m_WriteLock = null; lockedCheckBox.Checked = false; parent.VerseRefChanged += ReferenceChanged; parent.WindowClosing += WindowClosing; parent.SaveRequested += SaveRequested; parent.ProjectChanged += ProjectChanged; }
private void btnOpen_SLT_Click(object sender, EventArgs e) { if (cbSelect_SLT.SelectedItem != null) { SelectedResourceCategory = ResourceCategory.SLT; SelectedSLTResource = cbSelect_SLT.SelectedItem == _hebGrk ? SLTResource.HEB : SLTResource.LXX; SelectedSLTProject = ConvertSltResource(SelectedSLTResource); SelectedOpenWindowBehavior = ConvertOpenWindowBehavior((string)cbOpenOption_SLT.SelectedItem); if (txtBook_SLT.Text.Trim() == "" || txtChapter_SLT.Text.Trim() == "" || txtVerse_SLT.Text.Trim() == "") { MessageBox.Show("The Book Num, Chapter Num, and Verse Num need to be filled in."); this.DialogResult = DialogResult.None; return; } try { int book = Convert.ToInt32(txtBook_SLT.Text); int chapter = Convert.ToInt32(txtChapter_SLT.Text); int verse = Convert.ToInt32(txtVerse_SLT.Text); SelectedVerseRef = m_project.Versification.CreateReference(book, chapter, verse); } catch (Exception ex) { MessageBox.Show("Error creating a verse reference: " + ex.Message); this.DialogResult = DialogResult.None; return; } SelectedWordToSelect = txtWord_SLT.Text.Trim() == "" ? -1 : Convert.ToInt32(txtWord_SLT.Text.Trim()); } Close(); }
/// <summary/> public ScriptureProvider.IScriptureProviderParserState GetParserState(IScrText ptProjectText, IVerseRef ptCurrBook) { return(new PT8ParserStateWrapper(new ScrParserState((ScrText)ptProjectText.CoreScrText, (VerseRef)ptCurrBook.CoreVerseRef))); }
public void VerseRefChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference) { m_Reference = newReference; ShowScripture(); }
public void ProjectChanged(IPluginChildWindow sender, IProject newProject) { m_Project = newProject; m_Reference = sender.CurrentState.VerseRef; ShowScripture(); }
public IEnumerable <IUsfmToken> GetUsfmTokens(IVerseRef verseRef, bool b, bool b1) { return(ScriptureProvider.WrapPtCollection(ptParser.GetUsfmTokens((VerseRef)verseRef.CoreVerseRef, b, b1), new Func <UsfmToken, IUsfmToken>(token => new PT8TokenWrapper(token)))); }
public ScriptureProvider.IScriptureProviderParserState GetParserState(IScrText ptProjectText, IVerseRef ptCurrBook) { throw new NotImplementedException(); }
/// <summary/> public static IScriptureProviderParserState GetParserState(IScrText ptProjectText, IVerseRef ptCurrBook) { return(_scriptureProvider.GetParserState(ptProjectText, ptCurrBook)); }
public void GenerateList(object sender, EventArgs e) { IVersification versification = m_Project.Versification; List <RefItem> items = new List <RefItem>(); IVerseRef start = versification.CreateReference(40, 1, 1); IVerseRef end = versification.CreateReference(40, 1, 1); RefItem item1 = new RefItem() { VerseRefStart = start, VerseRefEnd = end, SelectedText = "Text", BeforeContext = "Before", AfterContext = "After", Message = "This is an information message", MessageId = "Id1", Severity = SeverityLevel.Information }; items.Add(item1); start = versification.CreateReference(40, 1, 2); end = versification.CreateReference(40, 1, 2); RefItem item2 = new RefItem() { VerseRefStart = start, VerseRefEnd = end, SelectedText = "Text", BeforeContext = "Before", AfterContext = "After", Message = "This is an error message", MessageId = "Id2", Severity = SeverityLevel.Error }; items.Add(item2); start = versification.CreateReference(40, 1, 3); end = versification.CreateReference(40, 1, 3); RefItem item3 = new RefItem() { VerseRefStart = start, VerseRefEnd = end, SelectedText = "Text", BeforeContext = "Before", AfterContext = "After", Message = "This is a warning message", MessageId = "Id3", Severity = SeverityLevel.Warning }; items.Add(item3); IReferenceListWindow refList = m_Host.ReferenceList; Action <IProgressInfo> rerunAction = null; if (enableRerunCheckBox.Checked) { rerunAction = Rerun; } refList.Load(m_Project, titleText.Text, items, true, rerunAction); }
public void VerseRefChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference) { m_project = sender.CurrentState.Project; m_verseRef = newReference; ShowProjectInfo(); }
private void VerseRefChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference) { m_verseRef = newReference; }
public void VerseRefChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference) { m_Reference = newReference; ShowCurrentInfo(); }