/// ------------------------------------------------------------------------------------ /// <summary> /// Clean up any resources being used. /// </summary> /// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { if (components != null) { components.Dispose(); } var disposable = m_vc as IDisposable; if (disposable != null) { disposable.Dispose(); } if (m_zoomFactor != null) { m_zoomFactor.Dispose(); } } m_vc = null; m_zoomFactor = null; base.Dispose(disposing); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Sets up the text we expect to be added to the view in place of the empty paragraph /// </summary> /// <param name="vc">view constructor to use</param> /// <param name="hvo">hvo of the object to create a prompt for</param> /// <param name="frag">fragment id indicating the type of user prompt</param> /// <param name="flid">field id for the view system note dependency</param> /// ------------------------------------------------------------------------------------ private void CreateExpectedUserPrompt(TeStVc vc, int hvo, int frag, int flid) { // Set expectations m_vwenvMock.Expect("NoteDependency", new int[] { hvo }, new int[] { (int)flid }, 1); m_vwenvMock.Expect("AddProp", new object[] { SimpleRootSite.kTagUserPrompt, vc, frag }, new string[] { typeInt, typeof(IVwViewConstructor).FullName, typeInt }); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes for replace all: creates a view constructor to be used with replace all /// as well as initial settings for the pattern. /// </summary> /// ------------------------------------------------------------------------------------ private void InitializeForReplaceAll() { m_vc = new TeStVc(TeStVc.LayoutViewTarget.targetDraft, 0); m_vc.Cache = Cache; m_pattern = VwPatternClass.Create(); m_strFactory = TsStrFactoryClass.Create(); m_pattern.MatchOldWritingSystem = false; m_pattern.MatchDiacritics = false; m_pattern.MatchWholeWord = false; m_pattern.MatchCase = false; m_pattern.UseRegularExpressions = false; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes for replace all: creates a view constructor to be used with replace all /// as well as initial settings for the pattern. /// </summary> /// ------------------------------------------------------------------------------------ private void InitializeForReplaceAll() { // REVIEW: do we need to create m_vc? We don't seem to use it anywhere. m_vc = new TeStVc(TeStVc.LayoutViewTarget.targetDraft, 0); m_vc.Cache = Cache; m_pattern = VwPatternClass.Create(); m_strFactory = TsStrFactoryClass.Create(); m_pattern.MatchOldWritingSystem = false; m_pattern.MatchDiacritics = false; m_pattern.MatchWholeWord = false; m_pattern.MatchCase = false; m_pattern.UseRegularExpressions = false; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes for replace all: creates a view constructor to be used with replace all /// as well as initial settings for the pattern. /// </summary> /// ------------------------------------------------------------------------------------ private void InitializeForReplaceAll() { // REVIEW: do we need to create m_vc? We don't seem to use it anywhere. m_vc = new TeStVc(TeStVc.LayoutViewTarget.targetDraft, 0); m_vc.Cache = Cache; m_pattern = VwPatternClass.Create(); m_strFactory = TsStrFactoryClass.Create(); m_pattern.MatchOldWritingSystem = false; m_pattern.MatchDiacritics = false; m_pattern.MatchWholeWord = false; m_pattern.MatchCase = false; m_pattern.UseRegularExpressions = false; }
/// <summary/> protected virtual void Dispose(bool fDisposing) { System.Diagnostics.Debug.WriteLineIf(!fDisposing, "****** Missing Dispose() call for " + GetType() + " *******"); if (fDisposing && !IsDisposed) { // dispose managed and unmanaged objects var disposable = m_btVc as IDisposable; if (disposable != null) { disposable.Dispose(); } } m_btVc = null; IsDisposed = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the BtPrintLayoutSideBySideVcImpl class. /// </summary> /// <param name="target"></param> /// <param name="filterInstance"></param> /// <param name="styleSheet"></param> /// <param name="cache"></param> /// <param name="btWs">The writing system of the back translation side of the view /// </param> /// <param name="fForFootnotes">True if we are displaying footnotes, false otherwise /// </param> /// <param name="realVc">The parent VC</param> /// <param name="bookTag">The book tag</param> /// ------------------------------------------------------------------------------------ public BtPrintLayoutSideBySideVcImpl(TeStVc.LayoutViewTarget target, int filterInstance, IVwStylesheet styleSheet, FdoCache cache, int btWs, bool fForFootnotes, T realVc, int bookTag) { m_cache = cache; m_RealVc = realVc; m_bookTag = bookTag; m_btVc = (fForFootnotes) ? (TeStVc) new FootnoteVc(TeStVc.LayoutViewTarget.targetPrint, filterInstance) : new DraftViewVc(target, filterInstance, styleSheet, false); m_btVc.DefaultWs = btWs; m_btVc.ContentType = Options.UseInterlinearBackTranslation ? StVc.ContentTypes.kctSegmentBT : StVc.ContentTypes.kctSimpleBT; m_btVc.Cache = cache; m_btVc.PrintLayout = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Make the root box. /// </summary> /// ------------------------------------------------------------------------------------ public override void MakeRoot() { CheckDisposed(); if (m_fdoCache == null || DesignMode) { return; } Editable = m_initialEditableState; // 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); HorizMargin = 10; // Set up a new view constructor. m_vc = CreateViewConstructor(); m_vc.Name = Name + " VC"; m_vc.HeightEstimator = (Group == null) ? this : Group as IHeightEstimator; m_vc.Cache = m_fdoCache; m_vc.ContentType = ContentType; m_vc.BackColor = BackColor; m_vc.Editable = EditingHelper.Editable; if (IsBackTranslation) { m_vc.DefaultWs = m_initialBtWs; } m_rootb.DataAccess = new ScrBookFilterDecorator(m_fdoCache, m_filterInstance); MakeRootObject(); base.MakeRoot(); m_dxdLayoutWidth = kForceLayout; // Don't try to draw until we get OnSize and do layout. Synchronize(m_rootb); }
/// ------------------------------------------------------------------------------------ /// <summary> /// make one. /// </summary> /// ------------------------------------------------------------------------------------ public UndoSuppressBtPrompt(TeStVc vc, ISegment segment) { m_vc = vc; m_seg = segment; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes for replace all: creates a view constructor to be used with replace all /// as well as initial settings for the pattern. /// </summary> /// ------------------------------------------------------------------------------------ private void InitializeForReplaceAll() { m_vc = new TeStVc(TeStVc.LayoutViewTarget.targetDraft, 0); m_vc.Cache = Cache; m_pattern = VwPatternClass.Create(); m_strFactory = TsStrFactoryClass.Create(); m_pattern.MatchOldWritingSystem = false; m_pattern.MatchDiacritics = false; m_pattern.MatchWholeWord = false; m_pattern.MatchCase = false; m_pattern.UseRegularExpressions = false; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Sets up the text we expect to be added to the view in place of the empty paragraph /// </summary> /// <param name="vc">view constructor to use</param> /// <param name="hvo">hvo of the object to create a prompt for</param> /// <param name="frag">fragment id indicating the type of user prompt</param> /// <param name="flid">field id for the view system note dependency</param> /// ------------------------------------------------------------------------------------ private void CreateExpectedUserPrompt(TeStVc vc, int hvo, int frag, int flid) { // Set expectations m_vwenvMock.Expect("NoteDependency", new int[] { hvo }, new int[] { (int)flid }, 1); m_vwenvMock.Expect("AddProp", new object[] { SimpleRootSite.kTagUserPrompt, vc, frag}, new string[] { typeInt, typeof(IVwViewConstructor).FullName, typeInt }); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Sets up the text we expect to be added to the view in place of the empty paragraph /// </summary> /// <param name="vc">view constructor to use</param> /// <param name="hvo">hvo of the object to create a prompt for</param> /// <param name="frag">fragment id indicating the type of user prompt</param> /// <param name="flid">field id for the view system note dependency</param> /// ------------------------------------------------------------------------------------ private void CreateExpectedUserPrompt(TeStVc vc, int hvo, int frag, int flid) { // Set expectations m_vwenvMock.Expect(x => x.NoteDependency(new int[] { hvo }, new int[] { flid }, 1)); m_vwenvMock.Expect(x => x.AddProp(SimpleRootSite.kTagUserPrompt, vc, frag)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the DraftViewVc class /// </summary> /// <param name="target">target of the view (printer or draft)</param> /// <param name="filterInstance">Number used to make filters unique for each main /// window</param> /// <param name="styleSheet">Optional stylesheet. Null is okay if this view constructor /// promises never to try to display a back translation</param> /// <param name="fShowInTable">True to show in table, otherwise false</param> /// ------------------------------------------------------------------------------------ public DummyDraftViewVC(TeStVc.LayoutViewTarget target, int filterInstance, IVwStylesheet styleSheet, bool fShowInTable) : base(target, filterInstance, styleSheet, fShowInTable) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the DraftViewVc class /// </summary> /// <param name="target">target of the view (printer or draft)</param> /// <param name="filterInstance">Number used to make filters unique for each main /// window</param> /// <param name="styleSheet">Optional stylesheet. Null is okay if this view constructor /// promises never to try to display a back translation</param> /// <param name="displayInTable">True to display the paragraphs in a table layout, /// false otherwise</param> /// ------------------------------------------------------------------------------------ public DraftViewVc(TeStVc.LayoutViewTarget target, int filterInstance, IVwStylesheet styleSheet, bool displayInTable) : base(target, filterInstance) { m_UnfinishedPic = PrepareImage(TeResourceHelper.BackTranslationUnfinishedImage); m_FinishedPic = PrepareImage(TeResourceHelper.BackTranslationFinishedImage); m_CheckedPic = PrepareImage(TeResourceHelper.BackTranslationCheckedImage); m_stylesheet = styleSheet; m_fDisplayInTable = displayInTable; //m_fLazy = true; // This makes the paragraphs lazy. }
/// ------------------------------------------------------------------------------------ /// <summary> /// Sets up the text we expect to be added to the view in place of the empty paragraph /// </summary> /// <param name="vc">view constructor to use</param> /// <param name="hvo">hvo of the object to create a prompt for</param> /// <param name="frag">fragment id indicating the type of user prompt</param> /// <param name="flid">field id for the view system note dependency</param> /// ------------------------------------------------------------------------------------ private void CreateExpectedUserPrompt(TeStVc vc, int hvo, int frag, int flid) { // Set expectations m_vwenvMock.Expect(x => x.NoteDependency(new int[] { hvo }, new int[] { flid }, 1)); m_vwenvMock.Expect(x => x.AddProp(SimpleRootSite.kTagUserPrompt, vc, frag)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Clean up any resources being used. /// </summary> /// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { // Must not be run more than once. if (IsDisposed) return; if (disposing) { if (components != null) components.Dispose(); var disposable = m_vc as IDisposable; if (disposable != null) disposable.Dispose(); if (m_zoomFactor != null) m_zoomFactor.Dispose(); } m_vc = null; m_zoomFactor = null; base.Dispose(disposing); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Make the root box. /// </summary> /// ------------------------------------------------------------------------------------ public override void MakeRoot() { CheckDisposed(); if (m_fdoCache == null || DesignMode) return; Editable = m_initialEditableState; // 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); HorizMargin = 10; // Set up a new view constructor. m_vc = CreateViewConstructor(); m_vc.Name = Name + " VC"; m_vc.HeightEstimator = (Group == null) ? this : Group as IHeightEstimator; m_vc.Cache = m_fdoCache; m_vc.ContentType = ContentType; m_vc.BackColor = BackColor; m_vc.Editable = EditingHelper.Editable; if (IsBackTranslation) m_vc.DefaultWs = m_initialBtWs; m_rootb.DataAccess = new ScrBookFilterDecorator(m_fdoCache, m_filterInstance); MakeRootObject(); base.MakeRoot(); m_dxdLayoutWidth = kForceLayout; // Don't try to draw until we get OnSize and do layout. Synchronize(m_rootb); }
/// ------------------------------------------------------------------------------------ /// <summary> /// make one. /// </summary> /// ------------------------------------------------------------------------------------ public UndoSuppressBtPrompt(TeStVc vc, ISegment segment) { m_vc = vc; m_seg = segment; }
/// <summary> /// make one. /// </summary> public UndoSuppressCommentPrompt(TeStVc vc, CmIndirectAnnotation ft) { m_vc = vc; m_ft = ft; }