Inheritance: SIL.FieldWorks.IText.SandboxBase
        /// -----------------------------------------------------------------------------------
        /// <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_oneAnalSandbox != null)
                {
                    if (!Controls.Contains(m_oneAnalSandbox))
                    {
                        m_oneAnalSandbox.Dispose();
                    }
                }
                if (m_vc != null)
                {
                    m_vc.Dispose();
                }
            }
            m_oneAnalSandbox    = null;
            m_vc                = null;
            m_configurationNode = null;
            m_wordform          = null;
        }
Exemple #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;
            }

            if (disposing)
            {
                if (m_oneAnalSandbox != null)
                {
                    m_oneAnalSandbox.SizeChanged -= HandleSandboxSizeChanged;
                }
            }

            base.Dispose(disposing);

            if (disposing)
            {
                if (m_oneAnalSandbox != null)
                {
                    m_oneAnalSandbox.Dispose();
                }
                if (m_vc != null)
                {
                    m_vc.Dispose();
                }
            }
            m_oneAnalSandbox    = null;
            m_vc                = null;
            m_configurationNode = null;
            m_wordform          = null;
            m_wfiAnalysis       = null;
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Make the root box.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override void MakeRoot()
        {
            CheckDisposed();

            if (m_fdoCache == null || DesignMode)
            {
                return;
            }

            m_rootb = VwRootBoxClass.Create();
            m_rootb.SetSite(this);

            m_vc = new InterlinVc(m_fdoCache);
            // Theory has it that the slices that have 'true' in this attribute will allow the sandbox to be used.
            // We'll see how the theory goes, when I get to the point of wanting to see the sandbox.
            var isEditable = IsEditable;

            m_vc.ShowMorphBundles = true;
            m_vc.ShowDefaultSense = true;
            // JohnT: kwsVernInParagraph is rather weird here, where we don't have a paragraph, but it allows the
            // VC to deduce the WS of the wordform, not from the paragraph, but from the best vern WS of the wordform itself.
            if (isEditable)
            {
                m_vc.LineChoices = new EditableInterlinLineChoices(m_fdoCache.LanguageProject, WritingSystemServices.kwsVernInParagraph,
                                                                   m_fdoCache.DefaultAnalWs);
            }
            else
            {
                m_vc.LineChoices = new InterlinLineChoices(m_fdoCache.LanguageProject, WritingSystemServices.kwsVernInParagraph,
                                                           m_fdoCache.DefaultAnalWs);
            }
            m_vc.LineChoices.Add(InterlinLineChoices.kflidMorphemes);          // 1
            m_vc.LineChoices.Add(InterlinLineChoices.kflidLexEntries);         //2
            m_vc.LineChoices.Add(InterlinLineChoices.kflidLexGloss);           //3
            m_vc.LineChoices.Add(InterlinLineChoices.kflidLexPos);             //4

            m_rootb.DataAccess = m_fdoCache.MainCacheAccessor;
            FixWs();             // AFTER setting DA!

            const int selectorId = InterlinVc.kfragSingleInterlinearAnalysisWithLabelsLeftAlign;

            if (m_wfiAnalysis != null)
            {
                m_rootb.SetRootObject(m_wfiAnalysis.Hvo, m_vc, selectorId, m_styleSheet);
            }

            base.MakeRoot();

            if (!IsEditable)
            {
                return;
            }

            m_oneAnalSandbox = new OneAnalysisSandbox(m_fdoCache,
                                                      Mediator,
                                                      StyleSheet,
                                                      m_vc.LineChoices,
                                                      m_wfiAnalysis.Hvo)
            {
                Visible = false
            };
            Controls.Add(m_oneAnalSandbox);
            if (m_oneAnalSandbox.RootBox == null)
            {
                m_oneAnalSandbox.MakeRoot();                    // adding sandbox to Controls doesn't make rootbox.
            }
            InitSandbox();
            m_oneAnalSandbox.SizeChanged += (HandleSandboxSizeChanged);
            if (m_fSliceIsCurrent)
            {
                TurnOnSandbox();
            }
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Make the root box.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override void MakeRoot()
        {
            CheckDisposed();

            if (m_fdoCache == null || DesignMode)
            {
                return;
            }

            m_rootb = VwRootBoxClass.Create();
            m_rootb.SetSite(this);

            m_vc = new InterlinVc(m_fdoCache);
            // Theory has it that the slices that have 'true' in this attribute will allow the sandbox to be used.
            // We'll see how the theory goes, when I get to the point of wanting to see the sandbox.
            bool isEditable = IsEditable;

            m_vc.ShowMorphBundles = true;
            m_vc.ShowDefaultSense = true;
            // JohnT: kwsVernInParagraph is rather weird here, where we don't have a paragraph, but it allows the
            // VC to deduce the WS of the wordform, not from the paragraph, but from the best vern WS of the wordform itself.
            if (isEditable)
            {
                m_vc.LineChoices = new EditableInterlinLineChoices(LangProject.kwsVernInParagraph, m_fdoCache.DefaultAnalWs);
            }
            else
            {
                m_vc.LineChoices = new InterlinLineChoices(LangProject.kwsVernInParagraph, m_fdoCache.DefaultAnalWs);
            }
            m_vc.LineChoices.Add(InterlinLineChoices.kflidMorphemes);          // 1
            m_vc.LineChoices.Add(InterlinLineChoices.kflidLexEntries);         //2
            m_vc.LineChoices.Add(InterlinLineChoices.kflidLexGloss);           //3
            m_vc.LineChoices.Add(InterlinLineChoices.kflidLexPos);             //4

            m_rootb.DataAccess = m_fdoCache.MainCacheAccessor;
            FixWs();                 // AFTER setting DA!

            int selectorId = 100034; //Convert.ToInt32(XmlUtils.GetManditoryAttributeValue(m_configurationNode.SelectSingleNode("deParams"), "selector"));

            if (m_hvoWfiAnalysis != 0)
            {
                m_rootb.SetRootObject(m_hvoWfiAnalysis, m_vc, selectorId, m_styleSheet);
            }

            base.MakeRoot();

            if (IsEditable)
            {
                m_oneAnalSandbox = new OneAnalysisSandbox(m_fdoCache,
                                                          Mediator,
                                                          StyleSheet,
                                                          m_vc.LineChoices,
                                                          m_hvoWfiAnalysis);
                m_oneAnalSandbox.Visible = false;
                Controls.Add(m_oneAnalSandbox);
                if (m_oneAnalSandbox.RootBox == null)
                {
                    m_oneAnalSandbox.MakeRoot();                        // adding sandbox to Controls doesn't make rootbox.
                }
                m_tag = MeVirtualHandler.InstallMe(Cache.VwCacheDaAccessor).Tag;
                InitSandbox();
                m_oneAnalSandbox.SizeChanged += (HandleSandboxSizeChanged);
            }
        }
		/// -----------------------------------------------------------------------------------
		/// <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;

			if (disposing)
			{
				if (m_oneAnalSandbox != null)
				{
					m_oneAnalSandbox.SizeChanged -= HandleSandboxSizeChanged;
				}
			}

			base.Dispose(disposing);

			if (disposing)
			{
				if (m_oneAnalSandbox != null)
				{
					m_oneAnalSandbox.Dispose();
				}
				if (m_vc != null)
					m_vc.Dispose();
			}
			m_oneAnalSandbox = null;
			m_vc = null;
			m_configurationNode = null;
			m_wordform = null;
			m_wfiAnalysis = null;
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make the root box.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void MakeRoot()
		{
			CheckDisposed();

			if (m_fdoCache == null || DesignMode || m_wfiAnalysis == null)
				return;

			m_rootb = VwRootBoxClass.Create();
			m_rootb.SetSite(this);

			m_vc = new InterlinVc(m_fdoCache);
			// Theory has it that the slices that have 'true' in this attribute will allow the sandbox to be used.
			// We'll see how the theory goes, when I get to the point of wanting to see the sandbox.
			var isEditable = IsEditable;
			m_vc.ShowMorphBundles = true;
			m_vc.ShowDefaultSense = true;
			if ((m_wfiAnalysis.GetAgentOpinion(m_fdoCache.LanguageProject.DefaultParserAgent) == Opinions.approves)
				&& (m_wfiAnalysis.GetAgentOpinion(m_fdoCache.LanguageProject.DefaultUserAgent) != Opinions.approves))
			{
				m_vc.UsingGuess = true;
			}

			// JohnT: kwsVernInParagraph is rather weird here, where we don't have a paragraph, but it allows the
			// VC to deduce the WS of the wordform, not from the paragraph, but from the best vern WS of the wordform itself.
			if (isEditable)
				m_vc.LineChoices = new EditableInterlinLineChoices(m_fdoCache.LanguageProject, WritingSystemServices.kwsVernInParagraph,
					m_fdoCache.DefaultAnalWs);
			else
				m_vc.LineChoices = new InterlinLineChoices(m_fdoCache.LanguageProject, WritingSystemServices.kwsVernInParagraph,
					m_fdoCache.DefaultAnalWs);
			m_vc.LineChoices.Add(InterlinLineChoices.kflidMorphemes); // 1
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexEntries); //2
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexGloss); //3
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexPos); //4

			m_rootb.DataAccess = m_fdoCache.MainCacheAccessor;
			FixWs(); // AFTER setting DA!

			const int selectorId = InterlinVc.kfragSingleInterlinearAnalysisWithLabelsLeftAlign;
			m_rootb.SetRootObject(m_wfiAnalysis.Hvo, m_vc, selectorId, m_styleSheet);

			base.MakeRoot();

			if (!IsEditable)
				return;

			m_oneAnalSandbox = new OneAnalysisSandbox(m_fdoCache,
													  Mediator,
													  StyleSheet,
													  m_vc.LineChoices,
													  m_wfiAnalysis.Hvo)
								{
									Visible = false
								};
			Controls.Add(m_oneAnalSandbox);
			if (m_oneAnalSandbox.RootBox == null)
				m_oneAnalSandbox.MakeRoot();	// adding sandbox to Controls doesn't make rootbox.
			InitSandbox();
			m_oneAnalSandbox.SizeChanged += (HandleSandboxSizeChanged);
			if (m_fSliceIsCurrent)
				TurnOnSandbox();
		}
		/// -----------------------------------------------------------------------------------
		/// <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_oneAnalSandbox != null)
				{
					if (!Controls.Contains(m_oneAnalSandbox))
						m_oneAnalSandbox.Dispose();
				}
				if (m_vc != null)
					m_vc.Dispose();
			}
			m_oneAnalSandbox = null;
			m_vc = null;
			m_configurationNode = null;
			m_wordform = null;
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make the root box.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void MakeRoot()
		{
			CheckDisposed();

			if (m_fdoCache == null || DesignMode)
				return;

			m_rootb = VwRootBoxClass.Create();
			m_rootb.SetSite(this);

			m_vc = new InterlinVc(m_fdoCache);
			// Theory has it that the slices that have 'true' in this attribute will allow the sandbox to be used.
			// We'll see how the theory goes, when I get to the point of wanting to see the sandbox.
			bool isEditable = IsEditable;
			m_vc.ShowMorphBundles = true;
			m_vc.ShowDefaultSense = true;
			// JohnT: kwsVernInParagraph is rather weird here, where we don't have a paragraph, but it allows the
			// VC to deduce the WS of the wordform, not from the paragraph, but from the best vern WS of the wordform itself.
			if (isEditable)
				m_vc.LineChoices = new EditableInterlinLineChoices(LangProject.kwsVernInParagraph, m_fdoCache.DefaultAnalWs);
			else
				m_vc.LineChoices = new InterlinLineChoices(LangProject.kwsVernInParagraph, m_fdoCache.DefaultAnalWs);
			m_vc.LineChoices.Add(InterlinLineChoices.kflidMorphemes); // 1
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexEntries); //2
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexGloss); //3
			m_vc.LineChoices.Add(InterlinLineChoices.kflidLexPos); //4

			m_rootb.DataAccess = m_fdoCache.MainCacheAccessor;
			FixWs(); // AFTER setting DA!

			int selectorId = 100034; //Convert.ToInt32(XmlUtils.GetManditoryAttributeValue(m_configurationNode.SelectSingleNode("deParams"), "selector"));
			if (m_hvoWfiAnalysis != 0)
				m_rootb.SetRootObject(m_hvoWfiAnalysis, m_vc, selectorId, m_styleSheet);

			base.MakeRoot();

			if (IsEditable)
			{
				m_oneAnalSandbox = new OneAnalysisSandbox(m_fdoCache,
					Mediator,
					StyleSheet,
					m_vc.LineChoices,
					m_hvoWfiAnalysis);
				m_oneAnalSandbox.Visible = false;
				Controls.Add(m_oneAnalSandbox);
				if (m_oneAnalSandbox.RootBox == null)
					m_oneAnalSandbox.MakeRoot();	// adding sandbox to Controls doesn't make rootbox.
				m_tag = MeVirtualHandler.InstallMe(Cache.VwCacheDaAccessor).Tag;
				InitSandbox();
				m_oneAnalSandbox.SizeChanged += (HandleSandboxSizeChanged);
			}
		}