/// ------------------------------------------------------------------------------------ /// <summary> /// Creates and returns the primary view construtor for the main view in the layout. /// This is only called once. /// </summary> /// <param name="div"></param> /// <returns>The view constructor to be used for the main view</returns> /// ------------------------------------------------------------------------------------ public virtual IVwViewConstructor MakeMainVc(DivisionLayoutMgr div) { DraftViewVc vc; if (m_divisionPortion == PrintLayoutPortion.TitleAndIntro) { vc = new ScriptureBookIntroVc(TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet, false); } else if (m_divisionPortion == PrintLayoutPortion.ScriptureSections) { vc = new ScriptureBodyVc(TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet, false); } else { vc = new DraftViewVc(TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet, false); } vc.HeightEstimator = this; if ((m_viewType & TeViewType.BackTranslation) != 0) { vc.ContentType = Options.UseInterlinearBackTranslation ? StVc.ContentTypes.kctSegmentBT : StVc.ContentTypes.kctSimpleBT; vc.DefaultWs = m_ws; } vc.Cache = m_fdoCache; vc.PrintLayout = true; return(vc); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates a view constructor suitable for this kind of view. /// </summary> /// ------------------------------------------------------------------------------------ protected override TeStVc CreateViewConstructor() { DraftViewVc vc = new DraftViewVc(TeStVc.LayoutViewTarget.targetDraft, m_filterInstance, m_styleSheet, m_fShowInTable); vc.HotLinkClick += DoHotLinkAction; return vc; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates and returns the primary view construtor for the main view in the layout. /// This is only called once. /// </summary> /// <param name="div"></param> /// <returns>The view constructor to be used for the main view</returns> /// ------------------------------------------------------------------------------------ public virtual IVwViewConstructor MakeMainVc(DivisionLayoutMgr div) { DraftViewVc vc; if (m_divisionPortion == PrintLayoutPortion.TitleAndIntro) { vc = new ScriptureBookIntroVc(TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet, false); } else if (m_divisionPortion == PrintLayoutPortion.ScriptureSections) { vc = new ScriptureBodyVc(TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet, false); } else { vc = new DraftViewVc(TeStVc.LayoutViewTarget.targetPrint, div.FilterInstance, m_styleSheet, false); } vc.HeightEstimator = this; if ((m_viewType & TeViewType.BackTranslation) != 0) { vc.ContentType = Options.UseInterlinearBackTranslation ? StVc.ContentTypes.kctSegmentBT : StVc.ContentTypes.kctSimpleBT; vc.DefaultWs = m_ws; } vc.Cache = m_fdoCache; vc.PrintLayout = true; return vc; }
/// ------------------------------------------------------------------------------------ /// <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) { // Must not be run more than once. if (IsDisposed) return; base.Dispose(disposing); if (disposing) { // Dispose managed resources here. if (m_draftViewVc != null) m_draftViewVc.Dispose(); DisposeFtMonitor(); } // Dispose unmanaged resources here, whether disposing is true or false. m_draftViewVc = null; m_SelectionHelper = null; }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <returns></returns> /// ------------------------------------------------------------------------------------ public virtual DraftViewVc CreateDraftViewVC() { CheckDisposed(); DraftViewVc vc = new DraftViewVc(TeStVc.LayoutViewTarget.targetDraft, m_filterInstance, m_styleSheet, m_fShowInTable); vc.Name = Name + " VC"; if (Group == null) vc.HeightEstimator = this; else vc.HeightEstimator = Group as IHeightEstimator; return vc; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Make the root box. /// </summary> /// ------------------------------------------------------------------------------------ public override void MakeRoot() { CheckDisposed(); if (m_fdoCache == null || DesignMode) return; // Check for non-existing rootbox before creating a new one. By doing that we // can mock the rootbox in our tests. However, this might cause problems in our // real code - altough I think MakeRoot() should be called only once. if (m_rootb == null) m_rootb = MakeRootBox(); m_rootb.SetSite(this); // Setup a notifier for object-replacement character deletions (which are footnote // markers) m_rootb.RequestObjCharDeleteNotification(EditingHelper); this.HorizMargin = 10; // Set hvo to the ID of the dummy vector that stores the root objects that have been // filtered and sorted. // TODO // int wid = m_pdcwParent->GetWindowId(); // AfMdiClientWnd * pmdic = dynamic_cast<AfMdiClientWnd *>(m_pdcwParent->Parent()); // AssertPtr(pmdic); // int iview; // iview = pmdic->GetChildIndexFromWid(wid); // UserViewSpecVec & vuvs = plpi->GetDbInfo()->GetUserViewSpecs(); // ClsLevel clevKey(kclidScripture, 0); // vuvs[iview]->m_hmclevrsp.Retrieve(clevKey, m_qrsp); // Partial implementation of the above blocked out code. // Get all UserView objects that relate to this application. // UserViewCollection uvc = // m_fdoCache.UserViewSpecs.GetUserViews(FwApp.App.AppGuid); // System.Console.WriteLine("UserViewCollection.Count={0}", uvc.Count); //if (uvc.Count == 0) // Allow this for real code? // return; // Set up a new view constructor. Debug.Assert(m_draftViewVc == null, "View constructor set up twice for " + Name); if (m_draftViewVc != null) m_draftViewVc.Dispose(); m_draftViewVc = CreateDraftViewVC(); m_draftViewVc.HotLinkClick += DoHotLinkAction; if (IsBackTranslation) { m_draftViewVc.ContentType = m_contentType; m_draftViewVc.DefaultWs = (TheMainWnd is TeMainWnd ? ((TeMainWnd)TheMainWnd).GetBackTranslationWsForView(TheViewWrapper.Name) : m_fdoCache.DefaultAnalWs); } m_draftViewVc.Cache = m_fdoCache; m_draftViewVc.BackColor = BackColor; m_draftViewVc.Editable = EditingHelper.Editable; m_rootb.DataAccess = m_fdoCache.MainCacheAccessor; //EditingHelper.RootObjects = new int[]{ScriptureObj.Hvo}; MakeRootObject(); 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> /// Creates the view constructor. /// </summary> /// <param name="flid">The flid - ignored here.</param> /// <returns>The view constructor</returns> /// ------------------------------------------------------------------------------------ protected override VwBaseVc CreateVc(int flid) { // Create a new virtual property - we don't need it here, but we use it in the view! new FilteredScrBooks(m_fdoCache, Handle.ToInt32()); m_locationTracker = new LocationTrackerImpl(m_fdoCache, Handle.ToInt32()); DraftViewVc vc = new DraftViewVc(TeStVc.LayoutViewTarget.targetDraft, Handle.ToInt32(), m_styleSheet, false); vc.Cache = m_fdoCache; return vc; }