/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a EmptyTePrintLayoutConfigurer to configure the main print layout /// </summary> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="viewType">Type of the view.</param> /// ------------------------------------------------------------------------------------ public EmptyTePrintLayoutConfigurer(FdoCache cache, IVwStylesheet styleSheet, TeViewType viewType) { m_fdoCache = cache; m_styleSheet = styleSheet; m_viewType = viewType; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:TeScrDraftViewProxy"/> class. /// </summary> /// <param name="mainWnd">The main window.</param> /// <param name="name">The name of the view.</param> /// <param name="fEditable"><c>true</c> if this draft view is editable, <c>false</c> /// if it is read-only.</param> /// <param name="fShowInTable"><c>true</c> to display the view as a table.</param> /// <param name="fMakeRootAutomatically"><c>true</c> to call MakeRoot(), <c>false</c> /// if caller will call MakeRoot().</param> /// <param name="viewType">Bit-flags indicating type of view.</param> /// ------------------------------------------------------------------------------------ public TeScrDraftViewProxy(TeMainWnd mainWnd, string name, bool fEditable, bool fShowInTable, bool fMakeRootAutomatically, TeViewType viewType) : base(mainWnd, name, fEditable, viewType) { m_showInTable = fShowInTable; m_makeRootAutomatically = fMakeRootAutomatically; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:TeBtPublication"/> class. /// </summary> /// <param name="stylesheet">The stylesheet to be used for this publication (can be /// different from the one used for drafting, but should probably have all the same /// styles)</param> /// <param name="filterInstance">number used to make filters unique per main window</param> /// <param name="publication">The publication to get the information from (or /// null to keep the defaults)</param> /// <param name="viewType">Type of the view.</param> /// <param name="printDateTime">Date/Time of the printing</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <param name="app">The app.</param> /// <param name="btWs">Backtranslation WS</param> /// ------------------------------------------------------------------------------------ public TeBtPublication(FwStyleSheet stylesheet, int filterInstance, IPublication publication, TeViewType viewType, DateTime printDateTime, IHelpTopicProvider helpTopicProvider, IApp app, int btWs) : base(stylesheet, filterInstance, publication, viewType, printDateTime, helpTopicProvider, app, btWs) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the FootnoteView class /// </summary> /// <param name="cache">The cache.</param> /// <param name="filterInstance">The tag that identifies the book filter instance.</param> /// <param name="app">The application.</param> /// <param name="viewName">The name of the view.</param> /// <param name="fEditable"><c>true</c> if view is to be editable.</param> /// <param name="viewType">Bit-flags indicating type of view.</param> /// <param name="btWs">The back translation writing system (if needed).</param> /// <param name="draftView">The corresponding draftview pane</param> /// ------------------------------------------------------------------------------------ public FootnoteView(FdoCache cache, int filterInstance, IApp app, string viewName, bool fEditable, TeViewType viewType, int btWs, DraftView draftView) : base(cache, filterInstance, app, viewName, fEditable, viewType, btWs) { Debug.Assert((viewType & TeViewType.FootnoteView) != 0); m_draftView = draftView; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="TeEditingHelper"/> class. /// </summary> /// <param name="callbacks">The callbacks.</param> /// <param name="cache">The cache.</param> /// <param name="filterInstance">The filter instance.</param> /// <param name="viewType">Type of the view.</param> /// <param name="app">The app.</param> /// ------------------------------------------------------------------------------------ public TeEditingHelper(IEditingCallbacks callbacks, FdoCache cache, int filterInstance, TeViewType viewType, IApp app) : base(cache, callbacks) { if (m_cache == null) throw new ArgumentNullException("cache"); m_scr = m_cache.LangProject.TranslatedScriptureOA; m_app = app; IFdoServiceLocator servloc = m_cache.ServiceLocator; m_repoStText = servloc.GetInstance<IStTextRepository>(); m_repoScrTxtPara = servloc.GetInstance<IScrTxtParaRepository>(); m_repoScrBook = servloc.GetInstance<IScrBookRepository>(); m_repoScrSection = servloc.GetInstance<IScrSectionRepository>(); m_repoScrFootnote = servloc.GetInstance<IScrFootnoteRepository>(); m_repoCmTrans = servloc.GetInstance<ICmTranslationRepository>(); m_wsContainer = servloc.WritingSystems; m_repoCmObject = servloc.GetInstance<ICmObjectRepository>(); m_repoSegment = servloc.GetInstance<ISegmentRepository>(); m_viewType = viewType; m_filterInstance = filterInstance; PasteFixTssEvent += RemoveHardFormatting; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a TePrintLayoutConfig to configure the main print layout /// </summary> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="publication">The publication.</param> /// <param name="viewType">Type of the view.</param> /// <param name="filterInstance">the book filter instance in effect</param> /// <param name="printDateTime">printing date and time</param> /// <param name="fIntroDivision">set to <c>true</c> for a division that displays book /// title and introduction material, <c>false</c> for a division that displays main /// scripture text.</param> /// <param name="hvoBook">The hvo of the book.</param> /// <param name="sharedStream">A layout stream used for footnotes which is shared across /// multiple divisions</param> /// <param name="ws">The writing system to use for the back translation</param> /// ------------------------------------------------------------------------------------ public TeBtPrintLayoutConfig(FdoCache cache, IVwStylesheet styleSheet, IPublication publication, TeViewType viewType, int filterInstance, DateTime printDateTime, bool fIntroDivision, int hvoBook, IVwLayoutStream sharedStream, int ws) : base(cache, styleSheet, publication, viewType, filterInstance, printDateTime, fIntroDivision, hvoBook, sharedStream, ws) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="FootnoteEditingHelper"/> class. /// </summary> /// <param name="callbacks">implementation of <see cref="IEditingCallbacks"/></param> /// <param name="cache">The cache for the DB connection</param> /// <param name="filterInstance">The special tag for the book filter</param> /// <param name="draftView">The corresponding draftview pane. If we determine that the /// "other pane" is supposed to be the other pane in the split window, then this /// should be used as the other pane as well.</param> /// <param name="viewType">Bit-flags indicating type of view.</param> /// <param name="app">The app.</param> /// ------------------------------------------------------------------------------------ public FootnoteEditingHelper(IEditingCallbacks callbacks, FdoCache cache, int filterInstance, FwRootSite draftView, TeViewType viewType, IApp app) : base(callbacks, cache, filterInstance, viewType, app) { m_draftView = draftView; if (m_draftView != null) // can be null for tests { m_draftViewEditingHelper = m_draftView.EditingHelper as TeEditingHelper; Debug.Assert(m_draftViewEditingHelper != null); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:DraftViewCreateInfo"/> class. /// </summary> /// <param name="name">The name of the view.</param> /// <param name="fBackTrans"><c>true</c> if this view displays a back translation.</param> /// <param name="fShowInTable"><c>true</c> to display the view as a table.</param> /// <param name="fMakeRootAutomatically"><c>true</c> to call MakeRoot(), <c>false</c> /// if caller will call MakeRoot().</param> /// <param name="fPersistSettings"><c>true</c> to persist settings.</param> /// <param name="fEditable"><c>true</c> if this draft view is editable, <c>false</c> /// if it is read-only.</param> /// <param name="viewType">Type of the view.</param> /// ------------------------------------------------------------------------------------ public DraftViewCreateInfo(string name, bool fBackTrans, bool fShowInTable, bool fMakeRootAutomatically, bool fPersistSettings, bool fEditable, TeViewType viewType) { Name = name; IsBackTrans = fBackTrans; ShowInTable = fShowInTable; MakeRootAutomatically = fMakeRootAutomatically; PersistSettings = fPersistSettings; IsEditable = fEditable; ViewType = viewType; }
/// <summary> /// Connect each BT view to its corresponding main view. /// </summary> /// <param name="e"></param> protected override void OnControlAdded(ControlEventArgs e) { base.OnControlAdded(e); if (e.Control is DataGridView) { e.Control.ControlAdded += new ControlEventHandler(Control_ControlAdded); } if (!(e.Control is DraftView)) { return; } TE.DraftView view = e.Control as DraftView; TeViewType t = view.ViewType; if ((t & TeViewType.BackTranslation) == 0 && (t & TeViewType.FootnoteView) == 0) { m_mainDraftView = view; if (m_mainBtView != null) { m_mainBtView.MainTrans = m_mainDraftView; } } else if ((t & TeViewType.BackTranslation) != 0 && (t & TeViewType.FootnoteView) == 0) { m_mainBtView = view; if (m_mainDraftView != null) { m_mainBtView.MainTrans = m_mainDraftView; } } else if ((t & TeViewType.BackTranslation) == 0 && (t & TeViewType.FootnoteView) != 0) { m_ftDraftView = view; if (m_ftBtView != null) { m_ftBtView.MainTrans = m_ftDraftView; } } else if ((t & TeViewType.BackTranslation) == 0 && (t & TeViewType.FootnoteView) == 0) { m_ftBtView = view; if (m_ftDraftView != null) { m_ftBtView.MainTrans = m_ftDraftView; } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Method to test creation of a publication view. /// </summary> /// <param name="pub">The publication.</param> /// <param name="viewType">Type of the Translation Editor view.</param> /// <returns> /// a Scripture publication for the specified view type. /// </returns> /// ------------------------------------------------------------------------------------ internal static DummyScripturePublication Create(IPublication pub, TeViewType viewType, FwStyleSheet stylesheet) { if (viewType == TeViewType.BackTranslationParallelPrint) { Debug.Assert(false, "Not yet implemented."); return null; } DummyScripturePublication pubControl = new DummyScripturePublication(pub.Cache, stylesheet, 567, pub, viewType, DateTime.Now); pubControl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; pubControl.Dock = DockStyle.Fill; pubControl.Name = TeEditingHelper.ViewTypeString(viewType); pubControl.Visible = false; return pubControl; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a TePrintLayoutConfig to configure the main print layout /// </summary> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="publication">The publication.</param> /// <param name="viewType">Type of the view.</param> /// <param name="filterInstance">the book filter instance in effect</param> /// <param name="printDateTime">printing date and time</param> /// <param name="divisionPortion">portion of the book to be layed out in this division</param> /// <param name="hvoBook">The hvo of the book we're displaying.</param> /// <param name="sharedStream">A layout stream used for footnotes which is shared across /// multiple divisions</param> /// <param name="ws">The writing system to use for the view.</param> /// ------------------------------------------------------------------------------------ public TePrintLayoutConfig(FdoCache cache, IVwStylesheet styleSheet, IPublication publication, TeViewType viewType, int filterInstance, DateTime printDateTime, PrintLayoutPortion divisionPortion, int hvoBook, IVwLayoutStream sharedStream, int ws) { m_fdoCache = cache; m_scr = m_fdoCache.LangProject.TranslatedScriptureOA; m_styleSheet = styleSheet; m_pub = publication; m_viewType = viewType; m_bookFilterInstance = filterInstance; m_printDateTime = printDateTime; m_divisionPortion = divisionPortion; m_hvoBook = hvoBook; m_sharedStream = sharedStream; m_ws = ws; m_paraCounter = cache.ServiceLocator.GetInstance <IParagraphCounterRepository>().GetParaCounter((int)TeViewGroup.Scripture); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="DraftViewBase"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="filterInstance">The tag that identifies the book filter instance.</param> /// <param name="app">The application.</param> /// <param name="viewName">The name of the view.</param> /// <param name="fEditable"><c>true</c> if view is to be editable.</param> /// <param name="viewType">Bit-flags indicating type of view.</param> /// <param name="btWs">The back translation writing system (if needed).</param> /// ------------------------------------------------------------------------------------ public DraftViewBase(FdoCache cache, int filterInstance, IApp app, string viewName, bool fEditable, TeViewType viewType, int btWs) : base(cache) { InitializePersistence(); m_filterInstance = filterInstance; m_app = app; AccessibleName = Name = viewName; m_initialEditableState = fEditable; m_viewType = viewType; m_initialBtWs = btWs; m_locationTracker = new LocationTrackerImpl(cache, m_filterInstance, ContentType); m_bookFilter = cache.ServiceLocator.GetInstance<IFilteredScrBookRepository>().GetFilterInstance(m_filterInstance); BackColor = EditableColor; DoSpellCheck = TeProjectSettings.ShowSpellingErrors; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Method to test creation of a publication view. /// </summary> /// <param name="pub">The publication.</param> /// <param name="viewType">Type of the Translation Editor view.</param> /// <returns> /// a Scripture publication for the specified view type. /// </returns> /// ------------------------------------------------------------------------------------ internal static DummyScripturePublication Create(IPublication pub, TeViewType viewType, FwStyleSheet stylesheet) { if (viewType == TeViewType.BackTranslationParallelPrint) { Debug.Assert(false, "Not yet implemented."); return(null); } DummyScripturePublication pubControl = new DummyScripturePublication(pub.Cache, stylesheet, 567, pub, viewType, DateTime.Now); pubControl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; pubControl.Dock = DockStyle.Fill; pubControl.Name = TeEditingHelper.ViewTypeString(viewType); pubControl.Visible = false; return(pubControl); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="DraftViewBase"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="filterInstance">The tag that identifies the book filter instance.</param> /// <param name="app">The application.</param> /// <param name="viewName">The name of the view.</param> /// <param name="fEditable"><c>true</c> if view is to be editable.</param> /// <param name="viewType">Bit-flags indicating type of view.</param> /// <param name="btWs">The back translation writing system (if needed).</param> /// ------------------------------------------------------------------------------------ public DraftViewBase(FdoCache cache, int filterInstance, IApp app, string viewName, bool fEditable, TeViewType viewType, int btWs) : base(cache) { InitializePersistence(); m_filterInstance = filterInstance; m_app = app; AccessibleName = Name = viewName; m_initialEditableState = fEditable; m_viewType = viewType; m_initialBtWs = btWs; m_locationTracker = new LocationTrackerImpl(cache, m_filterInstance, ContentType); m_bookFilter = cache.ServiceLocator.GetInstance <IFilteredScrBookRepository>().GetFilterInstance(m_filterInstance); BackColor = EditableColor; DoSpellCheck = TeProjectSettings.ShowSpellingErrors; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a TePrintLayoutConfig to configure the main print layout /// </summary> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="publication">The publication.</param> /// <param name="viewType">Type of the view.</param> /// <param name="filterInstance">the book filter instance in effect</param> /// <param name="printDateTime">printing date and time</param> /// <param name="fIntroDivision">set to <c>true</c> for a division that displays book /// title and introduction material, <c>false</c> for a division that displays main /// scripture text.</param> /// <param name="hvoBook">The hvo of the book we're displaying.</param> /// <param name="sharedStream">A layout stream used for footnotes which is shared across /// multiple divisions</param> /// <param name="ws">The writing system to use for the view.</param> /// ------------------------------------------------------------------------------------ public TePrintLayoutConfig(FdoCache cache, IVwStylesheet styleSheet, IPublication publication, TeViewType viewType, int filterInstance, DateTime printDateTime, bool fIntroDivision, int hvoBook, IVwLayoutStream sharedStream, int ws) { m_fdoCache = cache; m_scr = m_fdoCache.LangProject.TranslatedScriptureOA; m_styleSheet = styleSheet; m_pub = publication; m_viewType = viewType; m_bookFilterInstance = filterInstance; m_printDateTime = printDateTime; m_fIntroDivision = fIntroDivision; m_hvoBook = hvoBook; m_sharedStream = sharedStream; m_ws = ws; m_sectionFilterInstance = g_nextSectionFilterInstance++; m_sectionFilter = new FilteredSequenceHandler(cache, ScrBook.kClassId, m_sectionFilterInstance, this, this, new SimpleFlidProvider((int)ScrBook.ScrBookTags.kflidSections)); m_paraCounter = ParagraphCounterManager.GetParaCounter(cache, (int)TeViewGroup.Scripture); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:DiffViewEditingHelper"/> class. /// </summary> /// <param name="callbacks">The callbacks.</param> /// <param name="cache">The cache.</param> /// <param name="filterInstance">The filter instance.</param> /// <param name="viewType">Type of the view.</param> /// <param name="book">The current book.</param> /// <param name="app">The app.</param> /// ------------------------------------------------------------------------------------ public DiffViewEditingHelper(IEditingCallbacks callbacks, FdoCache cache, int filterInstance, TeViewType viewType, IScrBook book, IApp app) : base(callbacks, cache, filterInstance, viewType, app) { m_book = book; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds the Scripture/Print layout View /// </summary> /// <param name="viewName">Name of the resource string for the view.</param> /// <param name="viewType">Type of the view.</param> /// <param name="pubName">Name of the publication.</param> /// <param name="sideBarIndex">Index of the side bar.</param> /// <param name="sideBarItemName">Name of the side bar item.</param> /// ------------------------------------------------------------------------------------ protected override void AddPrintLayoutView(string viewName, TeViewType viewType, string pubName, TeResourceHelper.SideBarIndices sideBarIndex, string sideBarItemName) { // We don't want to add anything but Scripture/Draft View. }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a general-purpose publication for printing Scripture /// </summary> /// <param name="stylesheet">The stylesheet.</param> /// <param name="filterInstance">number used to make filters unique per main window</param> /// <param name="publication">The publication to get the information from (or /// null to keep the defaults)</param> /// <param name="viewType">Type of the view.</param> /// <param name="printDateTime">Date/Time of the printing</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <param name="app">The app.</param> /// <param name="btWs">Backtranslation WS</param> /// ------------------------------------------------------------------------------------ public ScripturePublication(FwStyleSheet stylesheet, int filterInstance, IPublication publication, TeViewType viewType, DateTime printDateTime, IHelpTopicProvider helpTopicProvider, IApp app, int btWs) : base(stylesheet, publication, printDateTime, true, viewType == TeViewType.Correction, helpTopicProvider) { AccessibleName = TeEditingHelper.ViewTypeString(viewType); m_filterInstance = filterInstance; m_app = app; m_viewType = viewType; m_BackTranslationWS = btWs; ApplyBookFilterAndCreateDivisions(); //if (IsBackTranslation && Options.UseInterlinearBackTranslation) // BackColor = TeResourceHelper.ReadOnlyTextBackgroundColor; }
/// -------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="TePrintLayoutViewFactory"/> class. /// </summary> /// <param name="viewName">Name of the view.</param> /// <param name="viewType">Type of the view.</param> /// <param name="pubName">Name of the publication.</param> /// <param name="creatorMethod">The creator method.</param> /// -------------------------------------------------------------------------------- public TePrintLayoutViewFactory(string viewName, TeViewType viewType, string pubName, PrintLayoutCreatorDelegate creatorMethod) : base(viewName, viewType, null) { m_pubName = pubName; m_creatorMethod = creatorMethod; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="DummyTeEditingHelper"/> class. /// </summary> /// <param name="callbacks">The callbacks.</param> /// <param name="cache">The cache.</param> /// <param name="filterInstance">The filter instance.</param> /// <param name="viewType">Type of the view.</param> /// <param name="app">The app.</param> /// ------------------------------------------------------------------------------------ internal TestTeEditingHelper(IEditingCallbacks callbacks, FdoCache cache, int filterInstance, TeViewType viewType, IApp app) : base(callbacks, cache, filterInstance, viewType, app) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:TeDraftViewProxy"/> class with a flag /// indicating whether it is intended to host a back translation /// </summary> /// <param name="mainWnd">The main window.</param> /// <param name="name">The name of the view.</param> /// <param name="fEditable"><c>true</c> if this view is editable, <c>false</c> if /// read-only.</param> /// <param name="viewType">Bit-flags indicating type of view.</param> /// ------------------------------------------------------------------------------------ public TeDraftViewProxy(TeMainWnd mainWnd, string name, bool fEditable, TeViewType viewType) : base(mainWnd, name, fEditable) { m_viewType = viewType; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates the key terms view when the user switches to it. /// </summary> /// <param name="viewName">Name of the view.</param> /// <param name="viewType">Type of the view.</param> /// <param name="tabItem">The tab item.</param> /// <returns></returns> /// ------------------------------------------------------------------------------------ protected virtual ISelectableView CreateKeyTermsView(string viewName, TeViewType viewType, SBTabItemProperties tabItem) { Debug.Assert(TheKeyTermsWrapper == null); // Construct a key terms view (client window) CheckingViewProxy checkingViewProxy = new CheckingViewProxy(this, "BiblicalTermsDraftView"); KeyTermsViewWrapper keyTermsViewWrapper = new KeyTermsViewWrapper(this, m_cache, checkingViewProxy, m_app.ProjectSpecificSettingsKey, Handle.ToInt32(), m_delegate.GetProjectName(m_cache), m_StyleSheet, m_app); ((ISelectableView)keyTermsViewWrapper).BaseInfoBarCaption = viewName; if (tabItem != null) { tabItem.Tag = keyTermsViewWrapper; tabItem.Update = true; } ClientControls.Add(keyTermsViewWrapper); // Bring the key terms view to the top of the z-order, so that // (if it is the active view) it fills only the remaining space ClientControls.SetChildIndex(keyTermsViewWrapper, 0); m_rgClientViews.Add(TeEditingHelper.ViewTypeString(TeViewType.KeyTerms), keyTermsViewWrapper as IRootSite); m_uncreatedViews.Remove(TeViewType.KeyTerms); return keyTermsViewWrapper; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="TeEditingHelper"/> class. /// </summary> /// <param name="callbacks">The callbacks.</param> /// <param name="cache">The cache.</param> /// <param name="filterInstance">The filter instance.</param> /// <param name="viewType">Type of the view.</param> /// ------------------------------------------------------------------------------------ public TeEditingHelper(IEditingCallbacks callbacks, FdoCache cache, int filterInstance, TeViewType viewType) : base(cache, callbacks) { CanDoRtL = true; if (m_cache != null) m_scr = m_cache.LangProject.TranslatedScriptureOA; m_viewType = viewType; m_filterInstance = filterInstance; m_projectSettings = TeProjectSettings.LoadSettings(cache); m_annotationAdjuster = new AnnotationAdjuster(cache, this); PasteFixTssEvent += RemoveHardFormatting; m_syncHandler = new FocusMessageHandling(this); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates a publication view of the desired type /// </summary> /// <param name="pub">The DB representation of the publication</param> /// <param name="viewType">The type of view to create.</param> /// <param name="btWs">BacktTranslation WS</param> /// <returns>A ScripturePublication</returns> /// ------------------------------------------------------------------------------------ protected virtual ScripturePublication CreatePublicationView(IPublication pub, TeViewType viewType, int btWs) { ScripturePublication pubControl = (viewType == TeViewType.BackTranslationParallelPrint ? new TeBtPublication(StyleSheet, Handle.ToInt32(), pub, viewType, DateTime.Now, m_app, m_app, btWs) : new ScripturePublication(StyleSheet, Handle.ToInt32(), pub, viewType, DateTime.Now, m_app, m_app, btWs)); pubControl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; pubControl.Dock = DockStyle.Fill; pubControl.Name = TeEditingHelper.ViewTypeString(viewType); pubControl.Visible = false; RegisterFocusableView(pubControl); return pubControl; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:TeBtPublication"/> class. /// </summary> /// <param name="cache">The database connection</param> /// <param name="stylesheet">The stylesheet to be used for this publication (can be /// different from the one used for drafting, but should probably have all the same /// styles)</param> /// <param name="filterInstance">number used to make filters unique per main window</param> /// <param name="publication">The publication to get the information from (or /// null to keep the defaults)</param> /// <param name="viewType">Type of the view.</param> /// <param name="printDateTime">Date/Time of the printing</param> /// ------------------------------------------------------------------------------------ public TeBtPublication(FdoCache cache, FwStyleSheet stylesheet, int filterInstance, IPublication publication, TeViewType viewType, DateTime printDateTime) : base(stylesheet, filterInstance, publication, viewType, printDateTime) { }
/// -------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="TeSelectableViewFactory"/> class. /// </summary> /// <param name="viewName">Name of the view.</param> /// <param name="viewType">Type of the view.</param> /// <param name="creatorMethod">The creator method.</param> /// -------------------------------------------------------------------------------- public TeSelectableViewFactory(string viewName, TeViewType viewType, CreatorDelegate creatorMethod) { m_viewName = viewName; m_creatorMethod = creatorMethod; m_viewType = viewType; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the view type string. /// </summary> /// <value>The view type string.</value> /// ------------------------------------------------------------------------------------ public static string ViewTypeString(TeViewType type) { StringBuilder bldr = new StringBuilder(); // Content types if ((type & TeViewType.BackTranslation) != 0) bldr.Append(TeViewType.BackTranslation); if ((type & TeViewType.Scripture) != 0) bldr.Append(TeViewType.Scripture); if ((type & TeViewType.Checks) != 0) bldr.Append(TeViewType.Checks); // If we have a scripture or BT view, Draft or Print has to be set Debug.Assert((type & (TeViewType.Draft | TeViewType.Print)) != 0 || (type & (TeViewType.Scripture | TeViewType.BackTranslation)) == 0); if ((type & TeViewType.Draft) != 0) bldr.Append(TeViewType.Draft); else if ((type & TeViewType.Print) != 0) bldr.Append(TeViewType.Print); // If we have a scripture or BT view, Horizontal or Vertical has to be set Debug.Assert((type & (TeViewType.Horizontal | TeViewType.Vertical)) != 0 || (type & (TeViewType.Scripture | TeViewType.BackTranslation)) == 0); if ((type & TeViewType.Vertical) != 0) bldr.Append(TeViewType.Vertical); else if ((type & TeViewType.Horizontal) != 0) bldr.Append(TeViewType.Horizontal); // View types Debug.Assert(CountSetBits((int)(type & TeViewType.ViewTypeMask)) == 1, "Need exactly one view type"); TeViewType viewType = (type & TeViewType.ViewTypeMask); bldr.Append(viewType); return bldr.ToString(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:DummyScripturePublication"/> class. /// </summary> /// <param name="cache">The database connection</param> /// <param name="stylesheet">The stylesheet to be used for this publication (can be /// different from the one used for drafting, but should probably have all the same /// styles)</param> /// <param name="filterInstance">number used to make filters unique per main window</param> /// <param name="publication">The publication to get the information from (or /// null to keep the defaults)</param> /// <param name="viewType">Type of the view.</param> /// <param name="printDateTime">Date/Time of the printing</param> /// ------------------------------------------------------------------------------------ protected DummyScripturePublication(FdoCache cache, FwStyleSheet stylesheet, int filterInstance, IPublication publication, TeViewType viewType, DateTime printDateTime) : base(stylesheet, filterInstance, publication, viewType, printDateTime, null, null, cache.DefaultVernWs) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="TeEditingHelper"/> class. /// </summary> /// <param name="callbacks"></param> /// <param name="cache"></param> /// <param name="filterInstance"></param> /// <param name="viewType"></param> /// ------------------------------------------------------------------------------------ public TestTeEditingHelper(IEditingCallbacks callbacks, FdoCache cache, int filterInstance, TeViewType viewType) : base(callbacks, cache, filterInstance, viewType) { m_projectSettings.SendSyncMessages = false; m_projectSettings.ReceiveSyncMessages = false; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds the Back Translation/Print Layout View /// </summary> /// ------------------------------------------------------------------------------------ protected virtual void AddBackTransPrintLayoutView(string viewName, TeViewType viewType) { bool fIsSideBySide = viewType == TeViewType.BackTranslationParallelPrint; // Add this user view to the BackTrans sidebar tab. SBTabItemProperties itemProps = new SBTabItemProperties(this); itemProps.Name = fIsSideBySide ? kBTPrintLayoutSbsSBItemName : kBTPrintLayoutSBItemName; itemProps.Text = viewName; itemProps.ImageIndex = fIsSideBySide ? (int)TeResourceHelper.SideBarIndices.BTParallelPrintLayout : (int)TeResourceHelper.SideBarIndices.BTSimplePrintLayout; itemProps.Tag = viewType; itemProps.Message = "SwitchActiveView"; AddSideBarTabItem("TabBackTrans", itemProps); string pubName = (viewType == TeViewType.BackTranslationParallelPrint) ? "Back Translation Side-by-Side" : "Back Translation"; m_uncreatedViews.Add(viewType, new TePrintLayoutViewFactory(viewName, viewType, pubName, CreateBackTransPrintLayoutView)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a TePrintLayoutConfig to configure the main print layout /// </summary> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="publication">The publication.</param> /// <param name="viewType">Type of the view.</param> /// <param name="filterInstance">the book filter instance in effect</param> /// <param name="printDateTime">printing date and time</param> /// <param name="divisionPortion">portion of the book to be layed out in this division</param> /// <param name="hvoBook">The hvo of the book we're displaying.</param> /// <param name="sharedStream">A layout stream used for footnotes which is shared across /// multiple divisions</param> /// <param name="ws">The writing system to use for the view.</param> /// ------------------------------------------------------------------------------------ public TePrintLayoutConfig(FdoCache cache, IVwStylesheet styleSheet, IPublication publication, TeViewType viewType, int filterInstance, DateTime printDateTime, PrintLayoutPortion divisionPortion, int hvoBook, IVwLayoutStream sharedStream, int ws) { m_fdoCache = cache; m_scr = m_fdoCache.LangProject.TranslatedScriptureOA; m_styleSheet = styleSheet; m_pub = publication; m_viewType = viewType; m_bookFilterInstance = filterInstance; m_printDateTime = printDateTime; m_divisionPortion = divisionPortion; m_hvoBook = hvoBook; m_sharedStream = sharedStream; m_ws = ws; m_paraCounter = cache.ServiceLocator.GetInstance<IParagraphCounterRepository>().GetParaCounter((int)TeViewGroup.Scripture); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates a publication view of the desired type /// </summary> /// <param name="pub">The DB representation of the publication</param> /// <param name="viewType">The type of view to create </param> /// <returns>A ScripturePublication</returns> /// ------------------------------------------------------------------------------------ protected override ScripturePublication CreatePublicationView(IPublication pub, TeViewType viewType) { ScripturePublication pubControl = base.CreatePublicationView(pub, viewType); if ((viewType & TeViewType.PrintLayout) != 0 && (viewType & TeViewType.Scripture) != 0) m_PrintLayoutView = pubControl; return pubControl; }
/// -------------------------------------------------------------------------------- /// <summary> /// /// </summary> /// <param name="callbacks"></param> /// <param name="cache"></param> /// <param name="filterInstance"></param> /// <param name="viewType"></param> /// -------------------------------------------------------------------------------- public DummyTeEditingHelper(IEditingCallbacks callbacks, FdoCache cache, int filterInstance, TeViewType viewType) : base(callbacks, cache, filterInstance, viewType) { InTestMode = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds the Back Translation/Print Layout View /// </summary> /// ------------------------------------------------------------------------------------ protected override void AddBackTransPrintLayoutView(string viewName, TeViewType viewType) { // We don't want to add anything but Scripture/Draft View. }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a general-purpose publication for printing Scripture /// </summary> /// <param name="stylesheet">The stylesheet.</param> /// <param name="filterInstance">number used to make filters unique per main window</param> /// <param name="publication">The publication to get the information from (or /// null to keep the defaults)</param> /// <param name="viewType">Type of the view.</param> /// <param name="printDateTime">Date/Time of the printing</param> /// ------------------------------------------------------------------------------------ public ScripturePublication(FwStyleSheet stylesheet, int filterInstance, IPublication publication, TeViewType viewType, DateTime printDateTime) : base(stylesheet, publication, printDateTime, true, viewType == TeViewType.Correction) { AccessibleName = TeEditingHelper.ViewTypeString(viewType); m_filterInstance = filterInstance; m_viewType = viewType; if (m_cache != null) m_BackTranslationWS = (IsBackTranslation ? m_cache.DefaultAnalWs : m_cache.DefaultVernWs); ApplyBookFilterAndCreateDivisions(); //if (IsBackTranslation && Options.UseInterlinearBackTranslation) // BackColor = TeResourceHelper.ReadOnlyTextBackgroundColor; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the DraftView class as a draft view editing pane, /// for either vernacular or back translation. /// </summary> /// <param name="cache">The cache.</param> /// <param name="filterInstance">The tag that identifies the book filter instance.</param> /// <param name="app">The application.</param> /// <param name="viewName">The name of the view.</param> /// <param name="fEditable"><c>true</c> if view is to be editable.</param> /// <param name="fShowInTable"><c>true</c> if the paragraphs are to be displayed in a /// table.</param> /// <param name="fMakeRootAutomatically"><c>true</c> to make the root automatically /// when the window handle is created.</param> /// <param name="viewType">Bit-flags indicating type of view.</param> /// <param name="btWs">The back translation writing system (if needed).</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// ------------------------------------------------------------------------------------ public DraftView(FdoCache cache, int filterInstance, IApp app, string viewName, bool fEditable, bool fShowInTable, bool fMakeRootAutomatically, TeViewType viewType, int btWs, IHelpTopicProvider helpTopicProvider) : base(cache, filterInstance, app, viewName, fEditable, viewType, btWs) { Debug.Assert((viewType & TeViewType.Draft) != 0); m_helpTopicProvider = helpTopicProvider; AutoScroll = false; m_fShowInTable = fShowInTable; m_fMakeRootWhenHandleIsCreated = fMakeRootAutomatically; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds the Scripture/Print layout View /// </summary> /// <param name="viewName">Name of the resource string for the view.</param> /// <param name="viewType">Type of the view.</param> /// <param name="pubName">Name of the publication.</param> /// <param name="sideBarIndex">Index of the icon for the view in the side bar.</param> /// <param name="sideBarItemName">Name of the side bar item.</param> /// ------------------------------------------------------------------------------------ protected virtual void AddPrintLayoutView(string viewName, TeViewType viewType, string pubName, TeResourceHelper.SideBarIndices sideBarIndex, string sideBarItemName) { // Add this user view to the Scripture sidebar tab. SBTabItemProperties itemProps = new SBTabItemProperties(this); itemProps.Name = sideBarItemName; itemProps.Text = viewName; itemProps.ImageIndex = (int)sideBarIndex; itemProps.Tag = viewType; itemProps.Message = "SwitchActiveView"; AddSideBarTabItem(kScrSBTabName, itemProps); m_uncreatedViews.Add(viewType, new TePrintLayoutViewFactory(viewName, viewType, pubName, CreatePrintLayoutView)); }