The 'TryAWordSandbox' is an IText Sandbox that is used within the Try A word dialog.
Inheritance: SIL.FieldWorks.IText.SandboxBase
Exemplo n.º 1
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);

            if (disposing)
            {
                //RightMouseClickedEvent -= new FwRightMouseClickEventHandler(InterlinDocChild_RightMouseClickedEvent);
                if (m_tryAWordSandbox != null)
                {
                    if (!Controls.Contains(m_tryAWordSandbox))
                    {
                        m_tryAWordSandbox.Dispose();
                    }
                }
                if (m_vc != null)
                {
                    m_vc.Dispose();
                }
            }
            m_tryAWordSandbox = null;
            m_vc         = null;
            m_wordform   = null;
            m_msaHvoList = null;
            m_sWordForm  = null;
        }
Exemplo n.º 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);

			if (disposing)
			{
				//RightMouseClickedEvent -= new FwRightMouseClickEventHandler(InterlinDocChild_RightMouseClickedEvent);
				if (m_tryAWordSandbox != null)
				{
					if (!Controls.Contains(m_tryAWordSandbox))
						m_tryAWordSandbox.Dispose();
				}
				if (m_vc != null)
					m_vc.Dispose();
			}
			m_tryAWordSandbox = null;
			m_vc = null;
			m_wordform = null;
			m_msaHvoList = null;
			m_sWordForm = null;
		}
Exemplo n.º 3
0
        private void CreateTryAWordSandbox()
        {
            // skip if it's before we've set the word
            if (m_sWordForm == null)
            {
                return;
            }
            // skip if it's before we've set up the rootsite control
            if (m_rootb == null)
            {
                return;
            }
            // skip if we're not visible
            if (!Visible)
            {
                return;
            }
            //Debug.WriteLine("TryAWordRootSite:WordForm - creating sandbox for " + m_sWordForm.Text);
            NonUndoableUnitOfWorkHelper.Do(m_cache.ActionHandlerAccessor, () =>
            {
                m_wordform = WfiWordformServices.FindOrCreateWordform(m_cache, m_sWordForm);
            });
            //if (m_cache.IsDummyObject(hvo))
            //	m_wordform = new WfiWordform();

            IAnalysis analysis = m_vc.GetGuessForWordform(m_wordform, m_cache.DefaultVernWs);

            if (analysis is NullWAG)
            {
                analysis = m_wordform;
            }

            m_rootb.SetRootObject(analysis.Hvo, m_vc, m_kfragSingleInterlinearAnalysisWithLabels, m_styleSheet);

            //Debug.Assert(m_tryAWordSandbox == null);
            m_tryAWordSandbox = new TryAWordSandbox(m_cache,
                                                    Mediator,
                                                    m_propertyTable,
                                                    StyleSheet,
                                                    m_vc.LineChoices,
                                                    analysis);
            m_tryAWordSandbox.Visible = false;
            Controls.Add(m_tryAWordSandbox);
            SetSandboxSize();
            SetSandboxLocation();
            m_tryAWordSandbox.Visible = true;
            SetBackgroundColor();
            int height = Math.Max(ScrollRange.Height, m_tryAWordSandbox.Height) + SystemInformation.HorizontalScrollBarHeight;

            if (Height != height)
            {
                Height = height;
            }
            m_tryAWordSandbox.SizeChanged += m_tryAWordSandbox_SizeChanged;
            //m_tryAWordSandbox.Focus();
        }
Exemplo n.º 4
0
        private void DisposeTryAWordSandbox()
        {
            CheckDisposed();

            if (m_tryAWordSandbox != null)
            {
                //Debug.WriteLine("TryAWordRootSite:WordForm - removing sandbox");
                Controls.Remove(m_tryAWordSandbox);
                m_tryAWordSandbox.Dispose();
                m_tryAWordSandbox = null;
            }
        }
Exemplo n.º 5
0
        private void CreateTryAWordSandbox()
        {
            // skip if it's before we've set the word
            if (m_sWordForm == null)
            {
                return;
            }
            // skip if it's before we've set up the rootsite control
            if (m_rootb == null)
            {
                return;
            }
            // skip if we're not visible
            if (!Visible)
            {
                return;
            }
            //Debug.WriteLine("TryAWordRootSite:WordForm - creating sandbox for " + m_sWordForm.Text);
            int hvoWordform = WfiWordform.FindOrCreateWordform(m_fdoCache, m_sWordForm, false);

            //if (m_fdoCache.IsDummyObject(hvo))
            //	m_wordform = new WfiWordform();

            m_wordform = WfiWordform.CreateFromDBObject(m_fdoCache, hvoWordform);
            m_rootb.SetRootObject(hvoWordform, m_vc, m_kfragSingleInterlinearAnalysisWithLabels, m_styleSheet);

            //Debug.Assert(m_tryAWordSandbox == null);
            m_tryAWordSandbox = new TryAWordSandbox(m_fdoCache,
                                                    Mediator,
                                                    StyleSheet,
                                                    m_vc.LineChoices,
                                                    hvoWordform);
            m_tryAWordSandbox.Visible = false;
            Controls.Add(m_tryAWordSandbox);
            SetSandboxSize();
            SetSandboxLocation();
            m_tryAWordSandbox.Visible = true;
            SetBackgroundColor();
            int height = Math.Max(ScrollRange.Height, m_tryAWordSandbox.Height) + SystemInformation.HorizontalScrollBarHeight;

            if (Height != height)
            {
                Height = height;
            }
            m_tryAWordSandbox.SizeChanged += new EventHandler(m_tryAWordSandbox_SizeChanged);
            //m_tryAWordSandbox.Focus();
        }
Exemplo n.º 6
0
		private void CreateTryAWordSandbox()
		{
			// skip if it's before we've set the word
			if (m_sWordForm == null)
				return;
			// skip if it's before we've set up the rootsite control
			if (m_rootb == null)
				return;
			// skip if we're not visible
			if (!Visible)
				return;
			//Debug.WriteLine("TryAWordRootSite:WordForm - creating sandbox for " + m_sWordForm.Text);
			NonUndoableUnitOfWorkHelper.Do(m_fdoCache.ActionHandlerAccessor, () =>
			{
				m_wordform = WfiWordformServices.FindOrCreateWordform(m_fdoCache, m_sWordForm);
			});
			//if (m_fdoCache.IsDummyObject(hvo))
			//	m_wordform = new WfiWordform();

			IAnalysis analysis = m_vc.GetGuessForWordform(m_wordform, m_fdoCache.DefaultVernWs);
			if (analysis is NullWAG)
				analysis = m_wordform;

			m_rootb.SetRootObject(analysis.Hvo, m_vc, m_kfragSingleInterlinearAnalysisWithLabels, m_styleSheet);

			//Debug.Assert(m_tryAWordSandbox == null);
			m_tryAWordSandbox = new TryAWordSandbox(m_fdoCache,
													Mediator,
													StyleSheet,
													m_vc.LineChoices,
													analysis);
			m_tryAWordSandbox.Visible = false;
			Controls.Add(m_tryAWordSandbox);
			SetSandboxSize();
			SetSandboxLocation();
			m_tryAWordSandbox.Visible = true;
			SetBackgroundColor();
			int height = Math.Max(ScrollRange.Height, m_tryAWordSandbox.Height) + SystemInformation.HorizontalScrollBarHeight;
			if (Height != height)
				Height = height;
			m_tryAWordSandbox.SizeChanged += m_tryAWordSandbox_SizeChanged;
			//m_tryAWordSandbox.Focus();
		}
Exemplo n.º 7
0
		private void DisposeTryAWordSandbox()
		{
			CheckDisposed();

			if (m_tryAWordSandbox != null)
			{
				//Debug.WriteLine("TryAWordRootSite:WordForm - removing sandbox");
				Controls.Remove(m_tryAWordSandbox);
				m_tryAWordSandbox.Dispose();
				m_tryAWordSandbox = null;
			}
		}
Exemplo n.º 8
0
		private void CreateTryAWordSandbox()
		{
			// skip if it's before we've set the word
			if (m_sWordForm == null)
				return;
			// skip if it's before we've set up the rootsite control
			if (m_rootb == null)
				return;
			// skip if we're not visible
			if (!Visible)
				return;
			//Debug.WriteLine("TryAWordRootSite:WordForm - creating sandbox for " + m_sWordForm.Text);
			int hvoWordform = WfiWordform.FindOrCreateWordform(m_fdoCache, m_sWordForm, false);
			//if (m_fdoCache.IsDummyObject(hvo))
			//	m_wordform = new WfiWordform();

			m_wordform = WfiWordform.CreateFromDBObject(m_fdoCache, hvoWordform);
			m_rootb.SetRootObject(hvoWordform, m_vc, m_kfragSingleInterlinearAnalysisWithLabels, m_styleSheet);

			//Debug.Assert(m_tryAWordSandbox == null);
			m_tryAWordSandbox = new TryAWordSandbox(m_fdoCache,
													Mediator,
													StyleSheet,
													m_vc.LineChoices,
													hvoWordform);
			m_tryAWordSandbox.Visible = false;
			Controls.Add(m_tryAWordSandbox);
			SetSandboxSize();
			SetSandboxLocation();
			m_tryAWordSandbox.Visible = true;
			SetBackgroundColor();
			int height = Math.Max(ScrollRange.Height, m_tryAWordSandbox.Height) + SystemInformation.HorizontalScrollBarHeight;
			if (Height != height)
				Height = height;
			m_tryAWordSandbox.SizeChanged += new EventHandler(m_tryAWordSandbox_SizeChanged);
			//m_tryAWordSandbox.Focus();
		}