示例#1
0
		public override void TestSetup()
		{
			base.TestSetup();

			// Save value of user prompt setting - restored in Cleanup.
			m_saveShowPrompts = Options.ShowEmptyParagraphPromptsSetting;
			Options.ShowEmptyParagraphPromptsSetting = false;
			m_saveSegmentedBT = Options.UseInterlinearBackTranslation;
			Options.UseInterlinearBackTranslation = CreateSegmentedBt;

			Debug.Assert(m_draftForm == null, "m_draftForm is not null.");
			//if (m_draftForm != null)
			//	m_draftForm.Dispose();
			m_draftForm = new DummyDraftViewForm(Cache);
			m_draftForm.DeleteRegistryKey();
			m_draftForm.CreateDraftView(Cache, CreateBtDraftView);

			m_draftView = m_draftForm.DraftView;
			m_draftView.Width = 300;
			m_draftView.Height = 290;
			m_draftView.CallOnLayout();

			// Set the selection at the start of the view
			m_draftView.RootBox.MakeSimpleSel(true, true, false, true);
		}
		public override void Exit()
		{
			CheckDisposed();

			m_btDraftView = null;
			m_draftForm.Close();
			m_draftForm = null;

			base.Exit();
		}
示例#3
0
		public void Init()
		{
			CheckDisposed();
			m_draftForm = new DummyDraftViewForm();
			m_draftForm.DeleteRegistryKey();
			m_draftForm.CreateDraftView();

			//Application.DoEvents();
			m_draftForm.Show();
			m_draftView = m_draftForm.DraftView;
			m_cache = m_draftForm.Cache;
			Application.DoEvents();
		}
示例#4
0
        public override void Initialize()
        {
            CheckDisposed();
            base.Initialize();

            m_draftForm = new DummyDraftViewForm();
            m_draftForm.DeleteRegistryKey();
            m_draftForm.CreateDraftView(Cache);
            m_draftView        = m_draftForm.DraftView;
            m_draftView.Width  = 300;
            m_draftView.Height = 290;
            m_draftView.CallOnLayout();
        }
示例#5
0
		public override void Initialize()
		{
			CheckDisposed();
			base.Initialize();

			m_draftForm = new DummyDraftViewForm();
			m_draftForm.DeleteRegistryKey();
			m_draftForm.CreateDraftView(Cache, true);

			m_btDraftView = m_draftForm.DraftView;
			m_btDraftView.Width = 300;
			m_btDraftView.Height = 290;
			m_btDraftView.CallOnLayout();
		}
		public override void Exit()
		{
			CheckDisposed();

			m_draftView = null;
			m_draftForm.Close();
			m_draftForm = null;
			m_exodus = null;
			m_leviticus = null;

			base.Exit();

			// Restore prompt setting
			Options.ShowEmptyParagraphPromptsSetting = m_saveShowPrompts;
		}
示例#7
0
        public override void Exit()
        {
            CheckDisposed();

            m_draftView = null;
            m_draftForm.Close();
            m_draftForm = null;
            m_group     = null;
            m_IgnorePropChanged.Dispose();
            m_IgnorePropChanged = null;

            // Restore prompt setting
            m_IgnorePropChanged.Dispose();
            base.Exit();
        }
示例#8
0
        public override void Initialize()
        {
            CheckDisposed();
            base.Initialize();

            m_draftForm = new DummyDraftViewForm();
            m_draftForm.DeleteRegistryKey();
            m_group             = m_draftForm.CreateSyncDraftView(Cache);
            m_IgnorePropChanged = new IgnorePropChanged(Cache,
                                                        PropChangedHandling.SuppressChangeWatcher);

            m_draftView = m_draftForm.DraftView;
            m_draftView.RootBox.MakeSimpleSel(true, true, false, true);

            Application.DoEvents();
        }
		public override void Initialize()
		{
			CheckDisposed();

			// Save value of user prompt setting - restored in Cleanup.
			m_saveShowPrompts = Options.ShowEmptyParagraphPromptsSetting;
			Options.ShowEmptyParagraphPromptsSetting = false;

			base.Initialize();
			m_draftForm = new DummyDraftViewForm();
			m_draftForm.DeleteRegistryKey();
			m_draftForm.CreateDraftView(Cache);
			m_draftView = m_draftForm.DraftView;
			m_draftView.Width = 300;
			m_draftView.Height = 290;
			m_draftView.CallOnLayout();

			Application.DoEvents();
		}
        public override void Initialize()
        {
            CheckDisposed();
            base.Initialize();

            Assert.IsNotNull(m_draftForm == null, "m_draftForm is not null.");

            m_draftForm = new DummyDraftViewForm();
            m_draftForm.DeleteRegistryKey();
            m_draftForm.CreateDraftView(Cache);
            m_draftView        = m_draftForm.DraftView;
            m_draftView.Width  = 300;
            m_draftView.Height = 290;
            m_draftView.CallOnLayout();

            Application.DoEvents();

            m_exodus = base.CreateExodusData();
        }
		public override void Initialize()
		{
			CheckDisposed();
			base.Initialize();

			m_draftForm = new DummyDraftViewForm();
			m_draftForm.DeleteRegistryKey();
			m_draftForm.CreateDraftView(Cache, true);

			m_btDraftView = m_draftForm.DraftView;
			m_btDraftView.Width = 300;
			m_btDraftView.Height = 290;
			m_btDraftView.CallOnLayout();

			m_btDraftView.RootBox.Reconstruct(); // update the view
			// Set the selection at the start of the section
			m_btDraftView.TeEditingHelper.SetInsertionPoint(0, 0, 0, 0, false);

		}
		/// <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.
				if (m_draftForm != null)
					m_draftForm.Dispose();
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_draftView = null;
			m_draftForm = null;

			base.Dispose(disposing);
		}
示例#13
0
 public void CleanUp()
 {
     CheckDisposed();
     if (m_cache != null)
     {
         if (m_cache.CanUndo)
         {
             m_cache.Undo();
         }
         if (m_cache.DatabaseAccessor.IsTransactionOpen())
         {
             m_cache.DatabaseAccessor.RollbackTrans();
         }
     }
     else
     {
         Debug.WriteLine("Null cache in cleanup, something went wrong.");
     }
     m_cache     = null;
     m_draftView = null;
     m_draftForm.Close();
     m_draftForm = null;
 }
示例#14
0
		public override void Exit()
		{
			CheckDisposed();

			DummyDbOps.DisableDummyOps();
			m_ktVwWrapper = null;
			m_draftView = null;
			m_draftForm.Close();
			m_draftForm = null;
			m_book = null;

			base.Exit();
		}
示例#15
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the dummy draft view.
		/// </summary>
		/// <param name="fForBT"><c>true</c> if the draft view is supposed to represent a BT
		/// </param>
		/// <param name="fMakeRoot"><c>true</c> if the root should be constructed; <c>false</c>
		/// if the caller will be responsible for making the rootbox later.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		private DummyDraftView CreateDummyDraftView(bool fForBT, bool fMakeRoot)
		{
			DummyDraftView draftView = new DummyDraftView(Cache, fForBT, Handle.ToInt32());
			draftView.Anchor = AnchorStyles.Top | AnchorStyles.Left |
				AnchorStyles.Right | AnchorStyles.Bottom;
			int c = draftView.BookFilter.BookCount;	// make sure the book filter gets created now.
			draftView.Dock = DockStyle.Fill;
			draftView.Name = "draftView";
			draftView.StyleSheet = StyleSheet;
			if (m_rootb != null)
				draftView.RootBox = m_rootb;

			if (fMakeRoot)
			{
				draftView.MakeRoot();
				draftView.Visible = true;
				draftView.ActivateView();
			}

			draftView.TeEditingHelper.InTestMode = true;	// turn off some processing for tests
			return draftView;
		}
示例#16
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		protected override void Dispose(bool fDisposing)
		{
			System.Diagnostics.Debug.WriteLineIf(!fDisposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
			base.Dispose(fDisposing);

			if (fDisposing)
			{
				if(components != null)
					components.Dispose();
				if (m_draftView != null)
					m_draftView.Dispose();
				if (m_isNewCache && (m_cache != null))
					m_cache.Dispose(); // Only if we made it.
				if (m_Persistence != null)
					m_Persistence.Dispose();
			}
			m_cache = null;
			m_draftView = null;
			m_styleSheet = null;
			m_rootb = null;
			m_Persistence = null;
		}
示例#17
0
		public void CleanUp()
		{
			CheckDisposed();
			if (m_cache != null)
			{
				if (m_cache.CanUndo)
					m_cache.Undo();
				if (m_cache.DatabaseAccessor.IsTransactionOpen())
					m_cache.DatabaseAccessor.RollbackTrans();
			}
			else
			{
				Debug.WriteLine("Null cache in cleanup, something went wrong.");
			}
			m_cache = null;
			m_draftView = null;
			m_draftForm.Close();
			m_draftForm = null;
		}
示例#18
0
		/// ----------------------------------------------------------------------------------------
		/// <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;

			try
			{
				if (disposing)
				{
					// Dispose managed resources here.
					if (m_btDraftForm != null)
						m_btDraftForm.Dispose();
				}
			}
			finally
			{
				// Dispose unmanaged resources here, whether disposing is true or false.
				m_btDraftForm = null;
				m_btDraftView = null;

				base.Dispose(disposing);
			}
		}
		public override void Initialize()
		{
			CheckDisposed();
			base.Initialize();

			Assert.IsNotNull(m_draftForm == null, "m_draftForm is not null.");

			m_draftForm = new DummyDraftViewForm();
			m_draftForm.DeleteRegistryKey();
			m_draftForm.CreateDraftView(Cache);
			m_draftView = m_draftForm.DraftView;
			m_draftView.Width = 300;
			m_draftView.Height = 290;
			m_draftView.CallOnLayout();

			Application.DoEvents();

			m_exodus = base.CreateExodusData();
		}
		public override void Initialize()
		{
			CheckDisposed();
			base.Initialize();

			Debug.Assert(m_draftForm == null, "m_draftForm os not null.");
			//if (m_draftForm != null)
			//	m_draftForm.Dispose();

			m_draftForm = new DummyDraftViewForm();
			m_draftForm.DeleteRegistryKey();
			m_draftForm.CreateDraftView(Cache);
			//m_draftForm.Show();
			m_draftView = m_draftForm.DraftView;
			m_draftView.Width = 300;
			m_draftView.Height = 290;
			m_draftView.CallOnLayout();

			Application.DoEvents();
		}
示例#21
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void CreateTestData()
		{
			// create a book with some scripture data in it
			m_book = AddBookToMockedScripture(40, "Matthew");
			IScrSection section = AddSectionToMockedBook(m_book);
			AddSectionHeadParaToSection(section, "Section Heading Text", ScrStyleNames.SectionHead);
			IStTxtPara para = AddParaToMockedSectionContent(section, ScrStyleNames.NormalParagraph);

			AddRunToMockedPara(para, "1", ScrStyleNames.ChapterNumber);
			AddRunToMockedPara(para, "1", ScrStyleNames.VerseNumber);
			AddRunToMockedPara(para, "The beginning of Matthew has some words.", null);
			AddRunToMockedPara(para, "2", ScrStyleNames.VerseNumber);
			AddRunToMockedPara(para, "Verse two has even more stuff in it with words. And the word possible.", null);
			AddRunToMockedPara(para, "3", ScrStyleNames.VerseNumber);
			AddRunToMockedPara(para, "Verse three does not have the key term in it.", null);
			AddRunToMockedPara(para, "4", ScrStyleNames.VerseNumber);
			AddRunToMockedPara(para, "Verse four has the word possible in it.", null);
			AddRunToMockedPara(para, "5", ScrStyleNames.VerseNumber);
			AddRunToMockedPara(para, "Verse five has the wrong word impossible in it.", null);

			// Create a key term for the term "words"
			IChkTerm keyTermWords = CreateChkTerm("words");

			// Create references of MAT 1:1, MAT 1:2, and MAT 1:3 for the key term "words"
			CreateChkRef(keyTermWords, 40001001);
			CreateChkRef(keyTermWords, 40001002);
			CreateChkRef(keyTermWords, 40001003);

			// Create a key term for the term "possible"
			IChkTerm keyTermPossible = CreateChkTerm("possible");

			// Create references of MAT 1:2, MAT 1:4, and MAT 1:5 for the key term "possible"
			CreateChkRef(keyTermPossible, 40001002);
			CreateChkRef(keyTermPossible, 40001004);
			CreateChkRef(keyTermPossible, 40001005);

			// Create a draft form, draft view, and a key terms view.
			if (m_draftForm != null)
				m_draftForm.Dispose();
			m_draftForm = new DummyDraftViewForm(Cache);
			m_draftForm.DeleteRegistryKey();

			m_scr.RestartFootnoteSequence = true;

			// Create a key terms view
			DummyDraftViewProxy viewProxy = new DummyDraftViewProxy(Cache);
			m_ktVwWrapper = new DummyKeyTermsViewWrapper(m_draftForm, Cache,
				viewProxy, m_draftForm.SettingsKey);
			m_draftForm.Controls.Add(m_ktVwWrapper);

			// Fill in the renderings view with the Key Terms
			m_ktVwWrapper.Visible = true;
			((ISelectableView)m_ktVwWrapper).ActivateView();
			((DummyDraftView)m_ktVwWrapper.DraftView).MakeRoot();
			//m_keyTermsViewWrapper.RenderingsView.MakeRoot();
#if __MonoCS__
			// For Mono WinForms, calling Form.Show is unreliable without a main Application loop.
			// This will not change.  See https://bugzilla.novell.com/show_bug.cgi?id=495562
			m_draftForm.CreateControl();
			m_miAfterSelect = m_ktVwWrapper.GetType().GetMethod("ktTree_AfterSelect",
				System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance,
				null, new Type[] {typeof(object), typeof(TreeViewEventArgs)}, null);
#else
			m_draftForm.Show();
#endif

			m_draftView = (DummyDraftView)m_ktVwWrapper.DraftView;
			m_draftView.Width = 20;
			m_draftView.Height = 20;
			m_draftView.CallOnLayout();
			m_draftForm.Hide();
		}
示例#22
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the control based on the create info.
		/// </summary>
		/// <param name="sender">The caller.</param>
		/// <param name="createInfo">The create info previously specified by the client.</param>
		/// <returns>The newly created control.</returns>
		/// ------------------------------------------------------------------------------------
		Control IControlCreator.Create(object sender, object createInfo)
		{
			if (createInfo is DraftViewCreateInfo || createInfo is ChecksDraftViewCreateInfo)
			{
				bool fBackTrans = false;
				string name;
				bool fEditable;
				bool fKeyTermsDraftView = (createInfo is ChecksDraftViewCreateInfo);
				if (fKeyTermsDraftView)
				{
					ChecksDraftViewCreateInfo keyInfo = (ChecksDraftViewCreateInfo)createInfo;
					name = keyInfo.Name;
					fEditable = keyInfo.IsEditable;
				}
				else
				{
					DraftViewCreateInfo info = (DraftViewCreateInfo)createInfo;
					fBackTrans = info.IsBackTrans;
					fEditable = info.IsEditable;
					name = info.Name;
				}

				DummyDraftView draftView = new DummyDraftView(Cache, fBackTrans, Handle.ToInt32());
				draftView.Name = name;
				draftView.Editable = fEditable;
				draftView.TheViewWrapper = sender as ViewWrapper;
				int c = draftView.BookFilter.BookCount;	// make sure the book filter gets created now.

				if (m_rootb != null)
					draftView.RootBox = m_rootb;
				draftView.TeEditingHelper.InTestMode = true;	// turn off some processing for tests
				m_draftView = draftView;
				return draftView;
			}
			else if (createInfo is KeyTermRenderingsCreateInfo)
			{
				KeyTermRenderingsControl ktRenderingsCtrl = new KeyTermRenderingsControl(m_cache, null);
				ktRenderingsCtrl.Parent = this;
				return ktRenderingsCtrl;
			}

			return null;
		}
示例#23
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Destroy the draft view.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void DestroyDraftView()
		{
			CheckDisposed();

			if (m_dummyDraftView != null)
			{
				Controls.Remove(m_dummyDraftView);
				m_dummyDraftView.Dispose(); // This will close the root box along with any other critical stuff.
				//m_dummyDraftView.RootBox.Close();
				m_dummyDraftView = null;
			}
		}
示例#24
0
		public override void TestTearDown()
		{
			m_draftView = null;
			m_draftForm.Close();
			m_draftForm = null;

			base.TestTearDown();

			// Restore prompt setting
			Options.ShowEmptyParagraphPromptsSetting = m_saveShowPrompts;
			Options.UseInterlinearBackTranslation = m_saveSegmentedBT;
		}
示例#25
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Create a new draft view
        /// </summary>
        /// -----------------------------------------------------------------------------------
        public override void TestSetup()
        {
            base.TestSetup();
            m_draftForm = new DummyDraftViewForm(Cache);
            m_draftForm.DeleteRegistryKey();
            m_draftForm.CreateDraftView();

            //Application.DoEvents();
            m_draftForm.Show();
            m_draftView = m_draftForm.DraftView;
            Application.DoEvents();
        }
示例#26
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void CreateTestData()
		{
			Cache.MapType(typeof(ChkRef), typeof(KeyTermRef));

			// Create a word form inventory for the language project
			Cache.LangProject.WordformInventoryOA = new WordformInventory();
			// create a book with some scripture data in it
			m_book = m_scrInMemoryCache.AddBookToMockedScripture(40, "Matthew");
			IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(m_book.Hvo);
			m_scrInMemoryCache.AddSectionHeadParaToSection(section.Hvo, "Section Heading Text", ScrStyleNames.SectionHead);
			StTxtPara para = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo, ScrStyleNames.NormalParagraph);

			m_scrInMemoryCache.AddRunToMockedPara(para, "1", ScrStyleNames.ChapterNumber);
			m_scrInMemoryCache.AddRunToMockedPara(para, "1", ScrStyleNames.VerseNumber);
			m_scrInMemoryCache.AddRunToMockedPara(para, "The beginning of Matthew has some words.", null);
			m_scrInMemoryCache.AddRunToMockedPara(para, "2", ScrStyleNames.VerseNumber);
			m_scrInMemoryCache.AddRunToMockedPara(para, "Verse two has even more stuff in it with words. And the word possible.", null);
			m_scrInMemoryCache.AddRunToMockedPara(para, "3", ScrStyleNames.VerseNumber);
			m_scrInMemoryCache.AddRunToMockedPara(para, "Verse three does not have the key term in it.", null);
			m_scrInMemoryCache.AddRunToMockedPara(para, "4", ScrStyleNames.VerseNumber);
			m_scrInMemoryCache.AddRunToMockedPara(para, "Verse four has the word possible in it.", null);
			m_scrInMemoryCache.AddRunToMockedPara(para, "5", ScrStyleNames.VerseNumber);
			m_scrInMemoryCache.AddRunToMockedPara(para, "Verse five has the wrong word impossible in it.", null);
			section.AdjustReferences();

			// Create a key term for the term "words"
			IChkTerm keyTermWords = CreateChkTerm("words");

			// Create references of MAT 1:1, MAT 1:2, and MAT 1:3 for the key term "words"
			CreateChkRef(keyTermWords, 40001001);
			CreateChkRef(keyTermWords, 40001002);
			CreateChkRef(keyTermWords, 40001003);

			// Create a key term for the term "possible"
			IChkTerm keyTermPossible = CreateChkTerm("possible");

			// Create references of MAT 1:2, MAT 1:4, and MAT 1:5 for the key term "possible"
			CreateChkRef(keyTermPossible, 40001002);
			CreateChkRef(keyTermPossible, 40001004);
			CreateChkRef(keyTermPossible, 40001005);

			// Create a draft form, draft view, and a key terms view.
			if (m_draftForm != null)
				m_draftForm.Dispose();
			m_draftForm = new DummyDraftViewForm(Cache);
			m_draftForm.DeleteRegistryKey();

			m_scr.RestartFootnoteSequence = true;

			// Create a key terms view
			ChecksDraftViewCreateInfo keyTermsCreateInfo = new ChecksDraftViewCreateInfo(
				"KeyTermsDraftView", true);
			m_ktVwWrapper = new DummyKeyTermsViewWrapper(m_draftForm, Cache,
				keyTermsCreateInfo, m_draftForm.SettingsKey);
			m_ktVwWrapper.DisplayUI = false;
			m_draftForm.Controls.Add(m_ktVwWrapper);

			// Fill in the renderings view with the Key Terms
			m_ktVwWrapper.Visible = true;
			((ISelectableView)m_ktVwWrapper).ActivateView();
			((DummyDraftView)m_ktVwWrapper.DraftView).MakeRoot();
			//m_keyTermsViewWrapper.RenderingsView.MakeRoot();
			m_draftForm.Show();

			m_draftView = m_draftForm.DraftView;
			m_draftView.Width = 20;
			m_draftView.Height = 20;
			m_draftView.CallOnLayout();
			m_draftForm.Hide();
		}
示例#27
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Creates and opens a draft view in a form. Loads scripture from the DB.
		/// </summary>
		/// <param name="cache">The cache, believe it or not</param>
		/// <param name="fIsBackTrans"><c>true</c> if the draft view is supposed to represent
		/// a BT</param>
		/// <param name="fMakeRoot"><c>true</c> if the root should be constructed; <c>false</c>
		/// if the caller will be responsible for making the rootbox later.</param>
		/// -----------------------------------------------------------------------------------
		public void CreateDraftView(FdoCache cache, bool fIsBackTrans, bool fMakeRoot)
		{
			CheckDisposed();

			Cache = cache;
			m_draftView = CreateDummyDraftView(fIsBackTrans, fMakeRoot);
			Controls.Add(m_draftView);
		}
示例#28
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		protected override void Dispose( bool fDisposing )
		{
			base.Dispose(fDisposing);

			if (fDisposing)
			{
				if(components != null)
					components.Dispose();
				if (m_draftView != null)
					m_draftView.Dispose();
				if (m_isNewCache && (m_cache != null))
					m_cache.Dispose(); // Only if we made it.
				if (m_Persistence != null)
					m_Persistence.Dispose();
			}
			m_cache = null;
			m_draftView = null;
			m_styleSheet = null;
			m_rootb = null;
			m_Persistence = null;
		}
示例#29
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Creates 2 sync'd draftviews in a form. Loads scripture from the DB.
		/// </summary>
		/// <param name="cache">The cache, believe it or not</param>
		/// -----------------------------------------------------------------------------------
		public RootSiteGroup CreateSyncDraftView(FdoCache cache)
		{
			CheckDisposed();

			Cache = cache;
			RootSiteGroup group = new RootSiteGroup(cache, (int)TeViewGroup.Scripture);

			DummyDraftView draft1 = CreateDummyDraftView(false, false);
			m_draftView = CreateDummyDraftView(false, false);
			group.AddToSyncGroup(draft1);
			group.AddToSyncGroup(m_draftView);
			group.ScrollingController = m_draftView;

			draft1.MakeRoot();
			draft1.Visible = true;
			m_draftView.MakeRoot();
			m_draftView.Visible = true;

			Controls.Add(group);
			group.Show();
			return group;
		}
示例#30
0
		public override void Initialize()
		{
			CheckDisposed();
			base.Initialize();

			// Save value of user prompt setting - restored in Cleanup.
			m_saveShowPrompts = Options.ShowEmptyParagraphPromptsSetting;
			Options.ShowEmptyParagraphPromptsSetting = false;

			Debug.Assert(m_btDraftForm == null, "m_btDraftForm is not null.");
			//if (m_btDraftForm != null)
			//	m_btDraftForm.Dispose();
			m_btDraftForm = new DummyDraftViewForm();
			m_btDraftForm.DeleteRegistryKey();
			m_btDraftForm.CreateDraftView(Cache, true);
			m_btDraftForm.Show();

			m_btDraftView = m_btDraftForm.DraftView;
			m_btDraftView.Width = 300;
			m_btDraftView.Height = 290;
			m_btDraftView.CallOnLayout();
			m_scr.RestartFootnoteSequence = true;

//			Application.DoEvents();
		}
示例#31
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the dummy draft view.
		/// </summary>
		/// <param name="fForBT"><c>true</c> if the draft view is supposed to represent a BT
		/// </param>
		/// <param name="fMakeRoot"><c>true</c> if the root should be constructed; <c>false</c>
		/// if the caller will be responsible for making the rootbox later.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		private DummyDraftView CreateDummyDraftView(bool fForBT, bool fMakeRoot)
		{
			DummyDraftView draftView = new DummyDraftView(Cache, fForBT, Handle.ToInt32());
			draftView.Anchor = AnchorStyles.Top | AnchorStyles.Left |
				AnchorStyles.Right | AnchorStyles.Bottom;
			draftView.Dock = DockStyle.Fill;
			draftView.Name = "draftView";
			draftView.StyleSheet = StyleSheet;
			if (m_rootb != null)
				draftView.RootBox = m_rootb;

			if (fMakeRoot)
			{
				draftView.MakeRoot();
				draftView.Visible = true;
				draftView.ActivateView();
			}

			return draftView;
		}
示例#32
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Creates a dummy draft view in the main window.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		public void CreateDraftView()
		{
			CheckDisposed();

			// Check for verse bridge
			if (m_dummyDraftView != null)
				m_dummyDraftView.Dispose();
			m_dummyDraftView = new DummyDraftView(Cache, false, Handle.ToInt32());
			m_dummyDraftView.Name = "dummyDraftView";

			m_dummyDraftView.Visible = true;
			m_dummyDraftView.StyleSheet = StyleSheet;
			m_dummyDraftView.Anchor = AnchorStyles.Top | AnchorStyles.Left |
				AnchorStyles.Right | AnchorStyles.Bottom;
			m_dummyDraftView.Dock = DockStyle.Fill;
			Controls.Add(m_dummyDraftView);
			ClientWindows.Add(m_dummyDraftView.GetType().Name, m_dummyDraftView);
			m_dummyDraftView.MakeRoot(); // JT needed to add this to get tests to pass.
			m_dummyDraftView.ActivateView();
			// m_dummyDraftView.TeEditingHelper.InTestMode = true;
		}
示例#33
0
 /// -----------------------------------------------------------------------------------
 /// <summary>
 /// Close the draft view
 /// </summary>
 /// -----------------------------------------------------------------------------------
 public override void TestTearDown()
 {
     m_draftView = null;
     m_draftForm.Close();
     m_draftForm = null;
     base.TestTearDown();
 }
示例#34
0
		/// <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_dummyDraftView = null; // Should be disposed by the window, since it is one of its controls.

			base.Dispose(disposing);
		}
示例#35
0
		public override void TestTearDown()
		{
			m_ktVwWrapper = null;
			m_draftView = null;
			m_draftForm.Close();
			m_draftForm = null;
			m_book = null;

			base.TestTearDown();
		}