Implementation of the draft view (formerly SeDraftWnd)
상속: SIL.FieldWorks.TE.DraftViewBase, ISelectableView
예제 #1
0
		/// ------------------------------------------------------------------------------------
		/// <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;
		}
예제 #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		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);

			m_draftView = null;
		}
예제 #3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Method to create the view when needed
		/// </summary>
		/// <param name="host">The control that will host (or "wrap") the view (can be
		/// <c>null</c>)</param>
		/// <returns>The created view</returns>
		/// ------------------------------------------------------------------------------------
		public override Control CreateView(Control host)
		{
			ViewWrapper wrapper = (ViewWrapper)host;
			DraftView draftView = new DraftView(m_mainWnd.Cache, m_mainWnd.Handle.ToInt32(),
				m_mainWnd.App, m_name, m_editable, m_showInTable, m_makeRootAutomatically,
				m_viewType, GetBtWs(wrapper), m_mainWnd.App);

			m_mainWnd.RegisterFocusableView(draftView);
			draftView.TheViewWrapper = wrapper;
			return draftView;
		}
예제 #4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Connect each BT view to its corresponding main view.
		/// </summary>
		/// <param name="e">A <see cref="T:System.Windows.Forms.ControlEventArgs"/> that
		/// contains the event data.</param>
		/// ------------------------------------------------------------------------------------
		protected override void OnControlAdded(ControlEventArgs e)
		{
			base.OnControlAdded(e);
			if (e.Control is DataGridView)
				e.Control.ControlAdded += DataGridView_ControlAdded;

			if (e.Control is DraftView)
			{
				DraftView view = (DraftView)e.Control;
				if (view.IsBackTranslation)
					m_mainBtView = view;
				else
					m_mainDraftView = view;
				if (m_mainBtView != null && m_mainDraftView != null)
					m_mainBtView.VernacularDraftView = m_mainDraftView;
			}
			else if (e.Control is FootnoteView)
			{
				FootnoteView ftView = (FootnoteView)e.Control;
				if (ftView.IsBackTranslation)
					m_ftBtView = ftView;
				else
					m_ftDraftView = ftView;
				if (m_ftBtView != null && m_ftDraftView != null)
					m_ftBtView.VernacularDraftView = m_ftDraftView;
			}
		}
예제 #5
0
		/// <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;
			}

		}
예제 #6
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the draft view.
		/// </summary>
		/// <param name="createInfo">The create info.</param>
		/// <param name="wrapper">The wrapper.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		public Control CreateDraftView(object createInfo, ViewWrapper wrapper)
		{
			DraftViewCreateInfo info = (DraftViewCreateInfo)createInfo;
			StVc.ContentTypes contentType = StVc.ContentTypes.kctNormal;
			if (info.IsBackTrans)
			{
				contentType = (Options.UseInterlinearBackTranslation ?
					StVc.ContentTypes.kctSegmentBT : StVc.ContentTypes.kctSimpleBT);
			}

			DraftView draftView = new DraftView(m_cache, contentType, info.ShowInTable,
					info.MakeRootAutomatically, info.PersistSettings, info.ViewType, Handle.ToInt32());
			draftView.Name = info.Name;
			draftView.AccessibleName = info.Name;
			draftView.Editable = info.IsEditable;
			draftView.LostFocus += ViewLostFocus;
			draftView.GotFocus += ViewGotFocus;
			draftView.TheViewWrapper = wrapper;
			return draftView;
		}
예제 #7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets the notes window's sync. handler when a draftview gains focus.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void SetNotesWndSyncHandler(DraftView draftView)
		{
			NotesMainWnd notesWnd = TeApp.GetNotesWndForCache(m_cache);
			if (draftView != null && notesWnd != null)
				notesWnd.SyncHandler = ((TeEditingHelper)draftView.EditingHelper).SyncHandler;
		}