/// ------------------------------------------------------------------------------------ /// <summary> /// Make the root box. /// </summary> /// ------------------------------------------------------------------------------------ public override void MakeRoot() { CheckDisposed(); if (m_fdoCache == null || DesignMode) { return; } Debug.Assert(Group != null && Group.ScrollingController != null); bool fSiblingEditable = ((DraftViewBase)Group.ScrollingController).InitialEditableState; BackColor = fSiblingEditable ? SystemColors.Window : TeResourceHelper.NonEditableColor; // 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? Debug.Assert(m_rootb == null, "Rootbox should be null"); if (m_rootb == null) { m_rootb = VwRootBoxClass.Create(); } m_rootb.SetSite(this); // Set up a new view constructor. m_styleBarVc = new DraftStyleBarVc(FilterInstance, m_displayForFootnotes); // Stylenames m_styleBarVc.DefaultWs = m_fdoCache.LanguageWritingSystemFactoryAccessor.GetWsFromStr("en"); m_styleBarVc.Cache = m_fdoCache; m_styleBarVc.BackColor = BackColor; m_styleBarVc.HeightEstimator = Group as IHeightEstimator; m_rootb.DataAccess = new ScrBookFilterDecorator(m_fdoCache, m_filterInstance); m_rootb.SetRootObject(m_fdoCache.LangProject.TranslatedScriptureOA.Hvo, m_styleBarVc, m_displayForFootnotes ? (int)FootnoteFrags.kfrScripture : (int)ScrFrags.kfrScripture, null); //TODO: //ptmw->RegisterRootBox(qrootb); base.MakeRoot(); m_dxdLayoutWidth = kForceLayout; // Don't try to draw until we get OnSize and do layout. Synchronize(m_rootb); }
/// <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; } base.Dispose(disposing); if (disposing) { // Dispose managed resources here. if (m_styleBarVc != null) { m_styleBarVc.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_styleBarVc = null; }
/// <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; base.Dispose(disposing); if (disposing) { // Dispose managed resources here. if (m_styleBarVc != null) m_styleBarVc.Dispose(); } // Dispose unmanaged resources here, whether disposing is true or false. m_styleBarVc = null; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Make the root box. /// </summary> /// ------------------------------------------------------------------------------------ public override void MakeRoot() { CheckDisposed(); if (m_fdoCache == null || DesignMode) return; Debug.Assert(Group != null && Group.ScrollingController != null); bool fSiblingEditable = ((DraftViewBase)Group.ScrollingController).InitialEditableState; BackColor = fSiblingEditable ? SystemColors.Window : TeResourceHelper.NonEditableColor; // 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? Debug.Assert(m_rootb == null, "Rootbox should be null"); if (m_rootb == null) m_rootb = VwRootBoxClass.Create(); m_rootb.SetSite(this); // Set up a new view constructor. m_styleBarVc = new DraftStyleBarVc(FilterInstance, m_displayForFootnotes); // Stylenames m_styleBarVc.DefaultWs = m_fdoCache.LanguageWritingSystemFactoryAccessor.GetWsFromStr("en"); m_styleBarVc.Cache = m_fdoCache; m_styleBarVc.BackColor = BackColor; m_styleBarVc.HeightEstimator = Group as IHeightEstimator; m_rootb.DataAccess = new ScrBookFilterDecorator(m_fdoCache, m_filterInstance); m_rootb.SetRootObject(m_fdoCache.LangProject.TranslatedScriptureOA.Hvo, m_styleBarVc, m_displayForFootnotes ? (int)FootnoteFrags.kfrScripture : (int)ScrFrags.kfrScripture, null); //TODO: //ptmw->RegisterRootBox(qrootb); base.MakeRoot(); m_dxdLayoutWidth = kForceLayout; // Don't try to draw until we get OnSize and do layout. Synchronize(m_rootb); }