Ejemplo n.º 1
0
 private void SetSandboxLocation()
 {
     m_rootb.Reconstruct();
     using (new HoldGraphics(this))
     {
         Rectangle rcSrcRoot;
         Rectangle rcDstRoot;
         GetCoordRects(out rcSrcRoot, out rcDstRoot);
         SelLevInfo[] rgvsli = new SelLevInfo[1];
         //rgvsli[1].ihvo = 0; // first morpheme bundle
         //rgvsli[1].tag = (int)WfiAnalysis.WfiAnalysisTags.kflidMorphBundles;
         rgvsli[0].ihvo = 0;
         rgvsli[0].tag  = MeVirtualHandler.InstallMe(Cache.VwCacheDaAccessor).Tag;
         IVwSelection sel = null;
         sel = RootBox.MakeTextSelInObj(0, rgvsli.Length, rgvsli, 0, null, true, false, false, false, false);
         if (sel == null)
         {
             Debug.WriteLine("Could not make selection in SetSandboxLocation");
             m_tryAWordSandbox.Left = 150;
             return;                     // can't position it accurately.
         }
         Rect rcPrimary, rcSec;
         bool fSplit, fEndBeforeAnchor;
         sel.Location(m_graphicsManager.VwGraphics, rcSrcRoot, rcDstRoot, out rcPrimary, out rcSec,
                      out fSplit, out fEndBeforeAnchor);
         if (m_vc.RightToLeft)
         {
             m_tryAWordSandbox.Left = rcPrimary.right - m_tryAWordSandbox.Width;
             m_labelWidth           = m_rootb.Width - rcPrimary.right;
         }
         else
         {
             m_tryAWordSandbox.Left = rcPrimary.left;
             m_labelWidth           = rcPrimary.left;
         }
     }
 }
Ejemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        /// <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);
            }
        }