public void ExportUSFM_ParatextVernacular() { string fileName = Path.Combine(Path.GetTempPath(), "~usfmfile~.txt"); FilteredScrBooks filter = new FilteredScrBooks(m_cache, 1); while (filter.BookCount > 0) filter.Remove(0); // add the book of James to the book filter filter.Add(m_cache.LangProject.TranslatedScriptureOA.ScriptureBooksOS[1].Hvo); // perform Paratext vernacular export try { ExportUsfm export = new ExportUsfm(m_cache, filter, fileName); export.MarkupSystem = MarkupType.Paratext; export.Run(); VerifyFile("SIL.FieldWorks.AcceptanceTests.TE.ExportJasParatext.ptx", fileName); } finally { try { File.Delete(fileName); } catch {} } }
public override void Initialize() { CheckDisposed(); base.Initialize(); m_filter = new FilteredScrBooks(Cache, m_filterNum++); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="cache"></param> /// <param name="filter">book filter in place</param> /// <param name="bookID">ordinal ID of the book being removed</param> /// ------------------------------------------------------------------------------------ public UndoRemoveBookAction(FdoCache cache, FilteredScrBooks filter, int bookID) { m_cache = cache; m_bookFilter = filter; m_bookID = bookID; m_bookHvo = ScrBook.FindBookByID(m_cache, bookID).Hvo; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="EditorialChecksViewWrapper"/> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="cache">The cache.</param> /// <param name="bookFilter">The book filter.</param> /// <param name="viewCreateInfo">Information used to create the view.</param> /// <param name="settingsRegKey">The settings reg key.</param> /// <param name="sProjectName">The name of the current project</param> /// ------------------------------------------------------------------------------------ public EditorialChecksViewWrapper(Control parent, FdoCache cache, FilteredScrBooks bookFilter, object viewCreateInfo, RegistryKey settingsRegKey, string sProjectName) : base(parent, cache, viewCreateInfo, settingsRegKey) { Name = "EditorialChecks"; m_sProjectName = sProjectName; m_bookFilter = bookFilter; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="TeImportManager"/> class. /// </summary> /// <param name="mainWnd">The main window we belong to</param> /// <param name="importCallbacks">The import callbacks.</param> /// ------------------------------------------------------------------------------------ protected TeImportManager(FwMainWnd mainWnd, ITeImportCallbacks importCallbacks) { m_mainWnd = mainWnd; m_cache = m_mainWnd.Cache; m_styleSheet = m_mainWnd.StyleSheet; m_importCallbacks = importCallbacks; m_bookFilter = m_importCallbacks.BookFilter; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initialize the FDO cache and open database /// </summary> /// <remarks>This method is called before each test</remarks> /// ------------------------------------------------------------------------------------ public override void Initialize() { base.Initialize(); m_BookFilter = new FilteredScrBooks(Cache, m_filterInstance); m_BookFilter.ShowAllBooks(); ParagraphCounterManager.ParagraphCounterType = typeof(TeParaCounter); ConfigurePublication(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="ExportUsfmDialog"/> class. /// </summary> /// <param name="cache">database cache</param> /// <param name="filter">book filter to display which books we will export</param> /// <param name="appKey">location of registry</param> /// ------------------------------------------------------------------------------------ public ExportTbxDialog(FdoCache cache, FilteredScrBooks filter, RegistryKey appKey) : base(cache, filter, appKey, MarkupType.Toolbox) { InitializeComponent(); // Save default label for BT control m_defaultBtLabel = chkBackTranslation.Text; m_fileDialog = new TeImportExportFileDialog(m_cache, FileType.ToolBox); }
/// ------------------------------------------------------------------------------------ /// <summary> /// constructor /// </summary> /// ------------------------------------------------------------------------------------ public DummyExportUsfm(FdoCache cache, FilteredScrBooks filter) : base(cache, filter, string.Empty) { if (m_file != null) m_file.Close(); m_file = new DummyFileWriter(); // Usually this is set by the main window and most tests need this. m_requestedAnalWS = new int[] { m_defaultAnalWS }; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="TeHeaderFooterVc"/> class. /// </summary> /// <param name="cache">DB Connection</param> /// <param name="page">Page information</param> /// <param name="wsDefault">ID of default writing system</param> /// <param name="printDateTime">printing date/time</param> /// <param name="filterInstance">book filter instance</param> /// <param name="sectionsTag">The sections tag.</param> /// ------------------------------------------------------------------------------------ public TeHeaderFooterVc(FdoCache cache, IPageInfo page, int wsDefault, DateTime printDateTime, int filterInstance, int sectionsTag) : base(page, wsDefault, printDateTime, cache) { m_scr = m_cache.LangProject.TranslatedScriptureOA; m_bookFilter = FilteredScrBooks.GetFilterInstance(m_cache, filterInstance); m_autoAdjustColumns = true; m_sectionsTag = sectionsTag; }
public void Deinitialize() { CheckDisposed(); m_exporter = null; m_cache.Dispose(); m_cache = null; m_filter = null; File.Delete(m_fileName); m_fileName = null; }
public override void Initialize() { CheckDisposed(); m_cache = FdoCache.Create("TestLangProj"); m_filter = new FilteredScrBooks(m_cache, 123); m_filter.ShowAllBooks(); m_fileName = Path.GetTempFileName(); File.Delete(m_fileName); // exporter pops up dialog if file exists! m_exporter = new ExportXml(m_fileName, m_cache, m_filter, ExportWhat.AllBooks, 0, 0, 0, "This is a test"); }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if (disposing) { // Dispose managed resources here. } // Dispose unmanaged resources here, whether disposing is true or false. m_filter = null; // TODO: Needs to implement IDisposable. base.Dispose(disposing); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:UndoImportInfo"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="bookFilter">The book filter.</param> /// ------------------------------------------------------------------------------------ public UndoImportManager(FdoCache cache, FilteredScrBooks bookFilter) { m_cache = cache; m_bookFilter = bookFilter; m_scr = m_cache.LangProject.TranslatedScriptureOA; Debug.Assert(m_cache.ActionHandlerAccessor != null); Debug.Assert(m_cache.ActionHandlerAccessor.CurrentDepth == 0); m_hMark = m_cache.ActionHandlerAccessor.Mark(); IActionHandler actionHandler = m_cache.ActionHandlerAccessor; m_suppressor = new SuppressSubTasks(m_cache); // don't need to undo setting properties. // Create new archive for saving backup versions of imported book m_savedVersion = new ScrDraft(); m_scr.ArchivedDraftsOC.Add(m_savedVersion); actionHandler.AddAction(new UndoImportObjectAction(m_savedVersion)); m_savedVersion.Description = TeResourceHelper.GetResourceString("kstidSavedVersionDescriptionOriginal"); }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { // Dispose managed resources here. } // Dispose unmanaged resources here, whether disposing is true or false. m_filter = null; // TODO: Needs to implement IDisposable. base.Dispose(disposing); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Setup the test. /// </summary> /// ------------------------------------------------------------------------------------ public override void Initialize() { base.Initialize(); m_bookFilter = new FilteredScrBooks(Cache, 1); m_bookFilter.UpdateFilter(new int[] { m_Genesis.Hvo }); m_dummyParaDlg = new DummyParatextDialog(Cache, m_bookFilter); //ScrImportSet importSet = new ScrImportSet(); //Cache.LangProject.TranslatedScriptureOA.ImportSettingsOC.Add(importSet); //importSet.ParatextScrProj = "xyz"; //importSet.ParatextBTProj = "xyzBT"; //Cache.LangProject.TranslatedScriptureOA.DefaultImportSettings = importSet; ILgWritingSystem wsVern = ((LgWritingSystem)Cache.LangProject.CurVernWssRS[0]); wsVern.Abbr.UserDefaultWritingSystem = "xyz"; // Initialize in-memory registry settings. m_dummyParaDlg.Registry.SetIntValue("ParatextOneDomainExportWhat", 0); m_dummyParaDlg.Registry.SetStringValue("ParatextOutputSpec", @"C:\My Paratext Projects"); m_dummyParaDlg.Registry.SetStringValue("ParatextBTOutputSpec", @"C:\My Paratext Projects"); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create a string of book names in the filter. /// </summary> /// <param name="filter">book filter</param> /// <returns>string with comma-delimited list of books in the filter</returns> /// ------------------------------------------------------------------------------------ private string GetExportedBooksStr(FilteredScrBooks filter) { StringBuilder filteredBooks = new StringBuilder(); if (filter.BookCount > 3) return string.Empty; // Append all scripture books in filter to string for (int bookIndex = 0; bookIndex < filter.BookCount; bookIndex++) { if (bookIndex > 0) filteredBooks.Append(", "); filteredBooks.Append(((ScrBookRef)filter.GetBook(bookIndex).BookIdRA).UIBookName); } return string.Format(TeResourceHelper.GetResourceString("kstidExportDlgMultipleBooks"), filteredBooks.ToString()); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="ExportUsfmDialog"/> class. /// </summary> /// <param name="cache">database cache</param> /// <param name="filter">book filter to display which books we will export</param> /// <param name="appKey">location of registry</param> /// <param name="markup">type of markup format for export: /// Paratext (one domain, non-interleaved) OR Toolbox (optionally interleaved)</param> /// ------------------------------------------------------------------------------------ public ExportUsfmDialog(FdoCache cache, FilteredScrBooks filter, RegistryKey appKey, MarkupType markup) : this() { m_cache = cache; m_markupType = markup; // let dialog know if this is for Paratext or Toolbox if (appKey != null) // might be null in tests - in this case derived class has to provide a m_regGroup m_regGroup = new RegistryGroup(appKey, "ExportUsfmSettings"); // Display books and markup labels string filtered = (filter.AllBooks ? TeResourceHelper.GetResourceString("kstidExportDlgUnfiltered") : TeResourceHelper.GetResourceString("kstidExportDlgFiltered")); string booksToExport = GetExportedBooksStr(filter); if (filter.BookCount == 1) { lblBooks.Text = string.Format(TeResourceHelper.GetResourceString("kstidBooksToExportSingularForm"), filtered, booksToExport); } else { lblBooks.Text = string.Format(lblBooks.Text, filter.BookCount, filtered, booksToExport); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:DummyParatextDialog"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="filter">The filter.</param> /// ------------------------------------------------------------------------------------ public DummyParatextDialog(FdoCache cache, FilteredScrBooks filter) : base(cache, filter, null) { m_regGroup = new InMemoryRegistryGroup(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="EditorialChecksControl"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="bookFilter">The book filter.</param> /// <param name="sCaption">The caption to use when this control is displayed as a /// floating window</param> /// <param name="sProject">The name of the current project</param> /// <param name="tmAdapter">TMAdapter for the main window</param> /// ------------------------------------------------------------------------------------ public EditorialChecksControl(FdoCache cache, FilteredScrBooks bookFilter, string sCaption, string sProject, ITMAdapter tmAdapter) : base(sCaption, sProject) { InitializeComponent(); lblCheckName.Text = string.Empty; m_dxButtonGap = m_btnApplyFilter.Left - m_btnRunChecks.Right; m_dyButtonGap = pnlButtons.Padding.Top; m_buttonPanelHeight1 = pnlButtons.Height; m_buttonPanelHeight2 = m_buttonPanelHeight1 + m_btnRunChecks.Height + m_dyButtonGap; m_buttonPanelHeight3 = m_buttonPanelHeight2 + m_btnRunChecks.Height + m_dyButtonGap; // It's important to subscribe to this event after the previous three // heights are saved. Therefore, this event should not be subscribed // to in designer (i.e. InitializeComponent()). This fixes TE-6653. pnlButtons.ClientSizeChanged += pnlButtons_ClientSizeChanged; m_cache = cache; m_chkDataSource = new ScrChecksDataSource(cache); m_bookFilter = bookFilter; m_bookFilter.CheckFilteredBooks(); m_bookFilter.FilterChanged += OnBookFilterChanged; Content = pnlOuter; CreateCheckingToolbar(tmAdapter); m_nodeTip = new ToolTip(); m_ComboBox.HideDropDownWhenComboTextChanges = false; // Set the minimum allowable with for the // control will be based on the widest button. int minWidth = m_btnRunChecks.Width; minWidth = Math.Max(minWidth, m_btnApplyFilter.Width); MinimumSize = new Size(Math.Max(minWidth, m_btnHelp.Width), MinimumSize.Height); m_chkHelpIds = new Dictionary<Guid, string>(); m_chkHelpIds[StandardCheckIds.kguidCharacters] = "khtpScrChecksCharacters"; m_chkHelpIds[StandardCheckIds.kguidChapterVerse] = "khtpScrChecksChapterVerse"; m_chkHelpIds[StandardCheckIds.kguidMixedCapitalization] = "khtpScrChecksMixedCapitalization"; m_chkHelpIds[StandardCheckIds.kguidRepeatedWords] = "khtpScrChecksRepeatedWords"; m_chkHelpIds[StandardCheckIds.kguidMatchedPairs] = "khtpScrChecksMatchingPunctPairs"; m_chkHelpIds[StandardCheckIds.kguidPunctuation] = "khtpScrChecksPunctuationPatterns"; m_chkHelpIds[StandardCheckIds.kguidQuotations] = "khtpScrChecksQuotationMarks"; m_chkHelpIds[StandardCheckIds.kguidCapitalization] = "khtpScrChecksCapitalization"; if (tmAdapter != null) { if (tmAdapter.MessageMediator != null) tmAdapter.MessageMediator.AddColleague(this); tmAdapter.SetContextMenuForControl(this, "cmnuEditorialChecksTree"); } }
public override void Initialize() { m_inMemoryCache = null; base.Initialize(); m_inMemoryCache.InitializeAnnotationDefs(); m_listOfChecks = new SortedList<ScrCheckKey, IScriptureCheck>(); m_bookFilter = new FilteredScrBooks(Cache, m_filterInstance); m_editChecksControl = new EditorialChecksControl( m_scrInMemoryCache.Cache, m_bookFilter, "Dummy Caption", "Dummy Project", null); m_checksTree = ReflectionHelper.GetField( m_editChecksControl, "m_availableChecksTree") as TriStateTreeView; }
/// ------------------------------------------------------------------------------------ /// <summary> /// constructor /// </summary> /// ------------------------------------------------------------------------------------ public DummyExportUsfm_NoStyleMapCreated(FdoCache cache, FilteredScrBooks filter) : base(cache, filter) { ParatextProjectShortName = "ABC"; ParatextProjectFolder = Path.GetTempPath(); // @"C:\TEMP"; // Bad idea, since C:\TEMP might not exist. CreateStyleTables(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Make the root box. /// </summary> /// ------------------------------------------------------------------------------------ public override void MakeRoot() { CheckDisposed(); if (m_fdoCache == null || DesignMode) return; if (FwEditingHelper.ApplicableStyleContexts != null) { FwEditingHelper.ApplicableStyleContexts = new List<ContextValues>(2); FwEditingHelper.ApplicableStyleContexts.Add(ContextValues.Note); FwEditingHelper.ApplicableStyleContexts.Add(ContextValues.General); } // This is muy importante. If a spurious rootbox got made already and we just replace // it with a new one, the old one will fire an assertion in its destructor. // REVIEW: Is this okay? Is there any way to prevent early creation of rootboxes? if (m_rootb == null) m_rootb = VwRootBoxClass.Create(); m_rootb.SetSite(this); // Set up a new view constructor. m_FootnoteVc = new FootnoteVc(m_filterInstance, TeStVc.LayoutViewTarget.targetDraft, m_isBackTranslation ? m_btWs : m_fdoCache.DefaultVernWs); m_FootnoteVc.ContentType = this.ContentType; m_FootnoteVc.Cache = m_fdoCache; m_FootnoteVc.HeightEstimator = Group as IHeightEstimator; m_FootnoteVc.Editable = EditingHelper.Editable; m_bookFilter = FilteredScrBooks.GetFilterInstance(m_fdoCache, m_filterInstance); m_FootnoteVc.Cache = m_fdoCache; m_rootb.DataAccess = m_fdoCache.MainCacheAccessor; //EditingHelper.RootObjects = new int[]{ScriptureObj.Hvo}; m_rootb.SetRootObject(ScriptureObj.Hvo, m_FootnoteVc, (int)FootnoteFrags.kfrScripture, m_styleSheet); base.MakeRoot(); m_dxdLayoutWidth = kForceLayout; // Don't try to draw until we get OnSize and do layout. //TODO: //ptmw->RegisterRootBox(qrootb); Synchronize(m_rootb); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="cache"></param> /// <param name="filter">book filter in place</param> /// <param name="bookID">ordinal ID of the book being inserted</param> /// ------------------------------------------------------------------------------------ public UndoInsertBookAction(FdoCache cache, FilteredScrBooks filter, int bookID) { m_cache = cache; m_bookFilter = filter; m_bookID = bookID; }
public override void Initialize() { CheckDisposed(); base.Initialize(); m_filter = new FilteredScrBooks(Cache, m_filterNum++); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="EditorialChecksRenderingsControl"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="bookFilter">The book filter.</param> /// <param name="mainWnd">The FwMainWnd that owns this control.</param> /// ------------------------------------------------------------------------------------ public EditorialChecksRenderingsControl(FdoCache cache, FilteredScrBooks bookFilter, FwMainWnd mainWnd) : base(cache, mainWnd) { InitializeComponent(); DataGridView = m_dataGridView; m_BookFilter = bookFilter; if (m_cache == null) return; m_Details.Cache = m_cache; m_Details.WritingSystemCode = m_cache.DefaultVernWs; if (mainWnd != null) { m_Details.Font = new Font( mainWnd.StyleSheet.GetNormalFontFaceName(m_cache, m_cache.DefaultVernWs), FontInfo.kDefaultFontSize / 1000); } m_list = new List<ICheckGridRowObject>(); m_gridSorter = new CheckGridListSorter(m_list); m_gridSorter.AddComparer(m_TypeOfCheck.DataPropertyName, StringComparer.CurrentCulture); m_gridSorter.AddComparer(m_Message.DataPropertyName, StringComparer.CurrentCulture); m_gridSorter.AddComparer(m_Details.DataPropertyName, m_tsStrComparer); m_gridSorter.AddComparer(m_Status.DataPropertyName, new CheckingStatusComparer()); m_gridSorter.AddComparer(m_Reference.DataPropertyName, new ScrReferencePositionComparer((Scripture)m_cache.LangProject.TranslatedScriptureOA, false)); m_dataGridView.Cache = m_cache; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Make one. /// </summary> /// <param name="filter">The filter.</param> /// <param name="newBooks">The new books.</param> /// ------------------------------------------------------------------------------------ public UndoChangeFilter(FilteredScrBooks filter, List<int> newBooks) { m_newBooks = newBooks; m_filter = filter; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Clean up any resources being used. /// </summary> /// ------------------------------------------------------------------------------------ protected override void Dispose( bool disposing ) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; base.Dispose(disposing); if( disposing ) { if(components != null) { components.Dispose(); } if (m_FootnoteVc != null) m_FootnoteVc.Dispose(); } m_FootnoteVc = null; m_Scripture = null; m_persistence = null; m_draftView = null; m_bookFilter = null; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Make one. /// </summary> /// <param name="filter">The filter.</param> /// <param name="m_newBooks">The new books.</param> /// <param name="overwrittenBooksToRestore">The books to put back in the filter if the /// user performs an undo of imported books that overwrote existing books.</param> /// ------------------------------------------------------------------------------------ public UndoChangeFilter(FilteredScrBooks filter, List<int> m_newBooks, List<int> overwrittenBooksToRestore) : this(filter, m_newBooks) { m_overwrittenBooksToRestore = overwrittenBooksToRestore; }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { Debug.Assert(m_cpe == null); return; } if (disposing) { // Log disposing event - removed logging as part of fix for TE-6551 //string message = "Disposing TeEditingHelper...\n" + // "Stack Trace:\n" + Environment.StackTrace; //SIL.Utils.Logger.WriteEvent(message); // Dispose managed resources here. if (m_InsertVerseMessageFilter != null) Application.RemoveMessageFilter(m_InsertVerseMessageFilter); if (m_syncHandler != null) { m_syncHandler.ReferenceChanged -= ScrollToReference; m_syncHandler.AnnotationChanged -= ScrollToCitedText; m_syncHandler.Dispose(); } if (m_annotationAdjuster != null) m_annotationAdjuster.Dispose(); } // Dispose unmanaged resources here, whether disposing is true or false. PasteFixTssEvent -= RemoveHardFormatting; m_syncHandler = null; m_scr = null; m_bookFilter = null; m_InsertVerseMessageFilter = null; m_restoreCursor = null; m_lastFootnoteTextRepSelection = null; m_oldReference = null; if (m_cpe != null) { if (Marshal.IsComObject(m_cpe)) Marshal.ReleaseComObject(m_cpe); m_cpe = null; } m_annotationAdjuster = null; base.Dispose(disposing); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="ImportedBooks"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="booksImported">The books that have been imported.</param> /// <param name="zoomPercentageDraft">The zoom percentage of the draft view.</param> /// <param name="zoomPercentageFootnote">The zoom percentage of the footnote view.</param> /// <param name="backupVersion">where to store stuff overwritten or merged.</param> /// <param name="bookFilter">bookFilter to which to add new books</param> /// ------------------------------------------------------------------------------------ public ImportedBooks(FdoCache cache, FwStyleSheet styleSheet, IScrDraft booksImported, float zoomPercentageDraft, float zoomPercentageFootnote, IScrDraft backupVersion, FilteredScrBooks bookFilter) : this(cache, booksImported, backupVersion) { m_styleSheet = styleSheet; m_zoomPercentageDraft = zoomPercentageDraft; m_zoomPercentageFootnote = zoomPercentageFootnote; m_bookFilter = bookFilter; foreach (IScrBook rev in booksImported.BooksOS) { ListViewItem item = new ListViewItem( new string[] {rev.Name.UserDefaultWritingSystem, GetBookInfo(rev)}); item.SubItems.Add(DlgResources.ResourceString("kstidUnknown")); IScrBook curBook = m_scr.FindBook(rev.CanonicalNum); if (curBook == null) { SetItemStatus(item, ImportedBookStatus.New); int newBookHvo = m_scr.CopyBookToCurrent(rev); m_newBooks.Add(newBookHvo); } else item.Tag = new BookMerger(m_cache, styleSheet, rev); lstImportedBooks.Items.Add(item); } lstImportedBooks.Items[0].Selected = true; }
public override void Initialize() { CheckDisposed(); base.Initialize(); // initialize the exporter class m_filter = new FilteredScrBooks(Cache, 123); m_filter.ShowAllBooks(); m_exporter = new DummyExportUsfm_NoStyleMapCreated(Cache, m_filter); m_exporter.SetContext(m_book); m_exporter.ParatextProjectShortName = "ABC"; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a new instance of the <see cref="ExportXhtml"/> class. /// </summary> /// <param name="fileName">pathname of the XHTML file to create</param> /// <param name="cache">data source</param> /// <param name="filter">lists the books to export</param> /// <param name="what">tells what to export: everything, filtered list, or single book</param> /// <param name="nBook">if single book, number of the book to export</param> /// <param name="iFirstSection">if single book, index of first section to export</param> /// <param name="iLastSection">if single book, index of last section to export</param> /// <param name="sDescription"></param> /// <param name="styleSheet"></param> /// <param name="pub"></param> /// ------------------------------------------------------------------------------------ public ExportXhtml(string fileName, FdoCache cache, FilteredScrBooks filter, ExportWhat what, int nBook, int iFirstSection, int iLastSection, string sDescription, FwStyleSheet styleSheet, IPublication pub) { m_fileName = fileName; m_cache = cache; m_bookFilter = filter; m_what = what; m_nBookSingle = nBook; m_iFirstSection = iFirstSection; m_iLastSection = iLastSection; m_sDescription = sDescription; m_styleSheet = styleSheet; m_pub = pub; m_scr = cache.LangProject.TranslatedScriptureOA; }