/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the ChooseScriptureDialog class. /// WARNING: this constructor is called by reflection, at least in the Interlinear /// Text DLL. If you change its parameters be SURE to find and fix those callers also. /// </summary> /// <param name="cache">The cache.</param> /// <param name="objList">A list of texts and books to check as an array of hvos</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <param name="importer">The Paratext book importer.</param> /// ------------------------------------------------------------------------------------ public FilterTextsDialogTE(FdoCache cache, IStText[] objList, IHelpTopicProvider helpTopicProvider, IBookImporter importer) : base(cache, objList, helpTopicProvider) { m_bookImporter = importer; using (var progressDlg = new ProgressDialogWithTask(this)) { // This somewhat duplicates some logic in FieldWorks.GetHelpTopicProvider, but it feels // wrong to reference the main exe even though I can't find an actual circular dependency. // As far as I can discover, the help topic provider is only used if the user has modified // TE styles and TE needs to display a dialog about it (possibly because it has loaded a // new version of the standard ones?). Anyway, I don't think it will be used at all if TE // is not installed, so it should be safe to use the regular FLEx one. IHelpTopicProvider helpProvider; if (FwUtils.FwUtils.IsTEInstalled) { helpProvider = (IHelpTopicProvider)DynamicLoader.CreateObject(FwDirectoryFinder.TeDll, "SIL.FieldWorks.TE.TeHelpTopicProvider"); } else { helpProvider = (IHelpTopicProvider)DynamicLoader.CreateObject(FwDirectoryFinder.FlexDll, "SIL.FieldWorks.XWorks.LexText.FlexHelpTopicProvider"); } NonUndoableUnitOfWorkHelper.Do(cache.ActionHandlerAccessor, () => TeScrInitializer.EnsureMinimalScriptureInitialization(cache, progressDlg, helpProvider)); } }
public BooksController(IBookImporter importer, IApiModelMapper mapper) { if (importer == null) throw new ArgumentNullException("importer"); if (mapper == null) throw new ArgumentNullException("mapper"); this.importer = importer; this.mapper = mapper; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the ChooseScriptureDialog class. /// WARNING: this constructor is called by reflection, at least in the Interlinear /// Text DLL. If you change its parameters be SURE to find and fix those callers also. /// </summary> /// <param name="cache">The cache.</param> /// <param name="objList">A list of texts and books to check as an array of hvos</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <param name="importer">The Paratext book importer.</param> /// ------------------------------------------------------------------------------------ public FilterTextsDialogTE(FdoCache cache, IStText[] objList, IHelpTopicProvider helpTopicProvider, IBookImporter importer) : base(cache, objList, helpTopicProvider) { m_bookImporter = importer; using (var progressDlg = new ProgressDialogWithTask(this)) { // This somewhat duplicates some logic in FieldWorks.GetHelpTopicProvider, but it feels // wrong to reference the main exe even though I can't find an actual circular dependency. // As far as I can discover, the help topic provider is only used if the user has modified // TE styles and TE needs to display a dialog about it (possibly because it has loaded a // new version of the standard ones?). Anyway, I don't think it will be used at all if TE // is not installed, so it should be safe to use the regular FLEx one. IHelpTopicProvider helpProvider; if (FwUtils.FwUtils.IsTEInstalled) { helpProvider = (IHelpTopicProvider) DynamicLoader.CreateObject(FwDirectoryFinder.TeDll, "SIL.FieldWorks.TE.TeHelpTopicProvider"); } else { helpProvider = (IHelpTopicProvider)DynamicLoader.CreateObject(FwDirectoryFinder.FlexDll, "SIL.FieldWorks.XWorks.LexText.FlexHelpTopicProvider"); } NonUndoableUnitOfWorkHelper.Do(cache.ActionHandlerAccessor, () => TeScrInitializer.EnsureMinimalScriptureInitialization(cache, progressDlg, helpProvider)); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Loads the texts for each Scripture book title, section, footnote, etc. /// </summary> /// ------------------------------------------------------------------------------------ public void LoadScriptureTexts(FdoCache cache, IBookImporter bookImporter) { m_bookImporter = bookImporter; m_associatedPtText = bookImporter != null?ParatextHelper.GetAssociatedProject(cache.ProjectId) : null; m_scr = cache.LanguageProject.TranslatedScriptureOA; if (m_scr == null) { return; } List <TreeNode> otBooks = new List <TreeNode>(); List <TreeNode> ntBooks = new List <TreeNode>(); for (int bookNum = 1; bookNum <= BCVRef.LastBook; bookNum++) { var bookName = cache.ServiceLocator.GetInstance <IScrRefSystemRepository>().Singleton.BooksOS[bookNum - 1].UIBookName; object book = m_scr.FindBook(bookNum); if (book == null) { if (m_associatedPtText != null && m_associatedPtText.BookPresent(bookNum)) { book = bookNum; } else { continue; } } TreeNode node = new TreeNode(bookName); node.Tag = book; node.Name = "Book"; // help us query for books. if (bookNum < ScriptureTags.kiNtMin) { otBooks.Add(node); } else { ntBooks.Add(node); } } TreeNode bibleNode = new TreeNode(FwControls.kstidBibleNode); bibleNode.Name = "Bible"; if (otBooks.Count > 0) { TreeNode testamentNode = new TreeNode(FwControls.kstidOtNode, otBooks.ToArray()); testamentNode.Name = "Testament"; // help us query for Testaments bibleNode.Nodes.Add(testamentNode); } if (ntBooks.Count > 0) { TreeNode testamentNode = new TreeNode(FwControls.kstidNtNode, ntBooks.ToArray()); testamentNode.Name = "Testament"; // help us query for Testaments bibleNode.Nodes.Add(testamentNode); } Nodes.Add(bibleNode); }
public PreviousReadsController(IBookImporter importer, IApiModelMapper mapper, IRecentReadsQuery recentReads) { if (importer == null) throw new ArgumentNullException("importer"); if (mapper == null) throw new ArgumentNullException("mapper"); if (recentReads == null) throw new ArgumentNullException("recentReads"); this.importer = importer; this.mapper = mapper; this.recentReads = recentReads; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Load Texts and ScrBooks into the tree view. /// </summary> /// <param name="cache">The cache.</param> /// <param name="bookImporter">The delegate/class that knows how to import a /// (Paratext) book on demand.</param> /// ------------------------------------------------------------------------------------ private void LoadTextsAndBooks(FdoCache cache, IBookImporter bookImporter) { Nodes.Clear(); LoadGeneralTexts(cache); if (FwUtils.FwUtils.IsTEInstalled) { LoadScriptureTexts(cache, bookImporter); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Load Texts and ScrBooks into the tree view. /// </summary> /// <param name="cache">The cache.</param> /// <param name="bookImporter">The delegate/class that knows how to import a /// (Paratext) book on demand.</param> /// ------------------------------------------------------------------------------------ private void LoadTextsAndBooks(FdoCache cache, IBookImporter bookImporter) { Nodes.Clear(); LoadGeneralTexts(cache); if (FwUtils.FwUtils.IsOkToDisplayScriptureIfPresent) { LoadScriptureTexts(cache, bookImporter); } }
public BooksController( IBookImporter bookImporter, IBookQuery bookQuery, IBookRepository bookRepository, ArchiveBookService archiveBookService) { _bookImporter = bookImporter; _bookQuery = bookQuery; _bookRepository = bookRepository; _archiveBookService = archiveBookService; }
public InterlinearExportDialog(Mediator mediator, ICmObject objRoot, InterlinVc vc, IBookImporter bookImporter) : base(mediator) { m_objRoot = objRoot; m_vc = vc; m_bookImporter = bookImporter; m_helpTopic = "khtpExportInterlinear"; columnHeader1.Text = ITextStrings.ksFormat; columnHeader2.Text = ITextStrings.ksExtension; Text = ITextStrings.ksExportInterlinear; OnLaunchFilterScrScriptureSectionsDialog += LaunchFilterTextsDialog; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the ChooseScriptureDialog class. /// WARNING: this constructor is called by reflection, at least in the Interlinear /// Text DLL. If you change its parameters be SURE to find and fix those callers also. /// </summary> /// <param name="cache">The cache.</param> /// <param name="objList">A list of texts and books to check as an array of hvos</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <param name="importer">The Paratext book importer.</param> /// ------------------------------------------------------------------------------------ public FilterTextsDialogTE(FdoCache cache, IStText[] objList, IHelpTopicProvider helpTopicProvider, IBookImporter importer) : base(cache, objList, helpTopicProvider) { m_bookImporter = importer; using (var progressDlg = new ProgressDialogWithTask(null, cache.ThreadHelper)) { NonUndoableUnitOfWorkHelper.Do(cache.ActionHandlerAccessor, () => TeScrInitializer.EnsureMinimalScriptureInitialization(cache, progressDlg, (IHelpTopicProvider)DynamicLoader.CreateObject(DirectoryFinder.TeDll, "SIL.FieldWorks.TE.TeHelpTopicProvider"))); } }
public BookController( IFileUploadUtility fileUploadUtility, IBookImporter bookImporter, IBookExporter bookExporter, ICategoryAreaService categoryAreaService, ICategoryService categoryService, IBookService bookService) { this._fileUploadUtility = fileUploadUtility; this._bookImporter = bookImporter; this._bookExporter = bookExporter; this._categoryAreaService = categoryAreaService; this._categoryService = categoryService; this._bookService = bookService; }
public bool OnExportInterlinear(object argument) { // If the currently selected text is from Scripture, then we need to give the dialog // the list of Scripture texts that have been selected for interlinearization. var parent = this.Parent; while (parent != null && !(parent is InterlinMaster)) { parent = parent.Parent; } var master = parent as InterlinMaster; var selectedObjs = new List <ICmObject>(); IBookImporter bookImporter = null; if (master != null) { bookImporter = master.Clerk as IBookImporter; var clerk = master.Clerk as InterlinearTextsRecordClerk; if (clerk != null) { foreach (int hvo in clerk.GetScriptureIds()) { selectedObjs.Add(m_objRepo.GetObject(hvo)); } } } //AnalysisOccurrence analOld = OccurrenceContainingSelection(); bool fFocusBox = TryHideFocusBoxAndUninstall(); ICmObject objRoot = m_objRepo.GetObject(m_hvoRoot); using (var dlg = new InterlinearExportDialog(m_mediator, objRoot, m_vc, bookImporter)) { dlg.ShowDialog(this); } if (fFocusBox) { CreateFocusBox(); //int hvoAnalysis = m_fdoCache.MainCacheAccessor.get_ObjectProp(oldAnnotation, CmAnnotationTags.kflidInstanceOf); //TriggerAnnotationSelected(oldAnnotation, hvoAnalysis, false); } return(true); // we handled this }
/// ------------------------------------------------------------------------------------ /// <summary> /// Load sections into the books of a Scripture tree view optionally including the /// heading as well as the content of each section. /// </summary> /// <param name="cache">The cache.</param> /// <param name="paratextBookImporter">The delegate/class that knows how to import a /// Paratext book on demand.</param> /// ------------------------------------------------------------------------------------ public void LoadScriptureAndOtherTexts(FdoCache cache, IBookImporter paratextBookImporter) { // first load the book ids. LoadTextsAndBooks(cache, paratextBookImporter); if (Nodes.Count == 0) { return; } //This requires the Bible node be loaded last. TreeNode bibleNode = Nodes[Nodes.Count - 1]; //If there was no Bible node loaded then just return. This might be the case for the SE version of FLEx. if (bibleNode.Name != "Bible") { return; } if (bibleNode.Nodes.Count == 0) { // There are no Bible book nodes, but we don't need to crash or show the Bible node. bibleNode.Remove(); return; } foreach (TreeNode testament in bibleNode.Nodes) { foreach (TreeNode bookNode in testament.Nodes) { // Put a dummy node into each book so the computer thinks it can be expanded. // When it is, we will replace this with the real children. TreeNode node = new TreeNode(ksDummmyName); node.Name = ksDummmyName; bookNode.Nodes.Add(node); } } }