示例#1
0
 /// ///////////////////////////////////////////
 private void FillWithFields(CMotVocabulaire vocabulaire)
 {
     CDefinitionProprieteDynamique[] defs = null;
     if (m_fournisseur != null && m_objetAnalyse != null)
     {
         if (vocabulaire.ProprieteAssociee == null)
         {
             if (vocabulaire.InfoExpressionAssociee != null)
             {
                 defs = m_fournisseur.GetDefinitionsChamps(vocabulaire.InfoExpressionAssociee.TypeDonnee.TypeDotNetNatif);
             }
             else
             {
                 defs = m_fournisseur.GetDefinitionsChamps(m_objetAnalyse);
             }
         }
         else
         {
             defs = m_fournisseur.GetDefinitionsChamps(vocabulaire.ProprieteAssociee.GetObjetPourAnalyseSousProprietes(), vocabulaire.ProprieteAssociee);
         }
         vocabulaire.StartFilling();
         foreach (CDefinitionProprieteDynamique def in defs)
         {
             CMotVocabulaire mot = new CMotVocabulaire(def);
             vocabulaire.AddMot(mot);
         }
         vocabulaire.EndFilling();
     }
     vocabulaire.IsInit = true;
 }
示例#2
0
        public void Init(IFournisseurProprietesDynamiques fournisseur, CObjetPourSousProprietes objetAnalyse)
        {
            m_fournisseur  = fournisseur;
            m_objetAnalyse = objetAnalyse;
            m_formule      = null;
            m_vocabulaire  = null;
            CContexteAnalyse2iExpression contexteAnalyse = new CContexteAnalyse2iExpression(fournisseur, m_objetAnalyse);

            m_analyseur = new CAnalyseurSyntaxiqueExpression(contexteAnalyse);
        }
示例#3
0
 //-----------------------------------------------------
 public void AddMot(CMotVocabulaire mot)
 {
     if (m_tableMots[mot.Index] != null)
     {
         return;
     }
     m_listeMots.Add(mot);
     m_tableMots[mot.Index]             = mot;
     m_tableMots["[" + mot.Index + "]"] = mot;
     if (!m_bIsFilling)
     {
         m_listeMots.Sort();
     }
 }
示例#4
0
 //-----------------------------------------------------
 public CMotVocabulaire GetVocabulaire(string strRacine)
 {
     if (strRacine == "")
     {
         return(this);
     }
     if (strRacine.IndexOf('.') >= 0)
     {
         string          strLeft  = strRacine.Substring(0, strRacine.IndexOf('.'));
         string          strRight = strRacine.Substring(strRacine.IndexOf('.') + 1);
         CMotVocabulaire mot      = (CMotVocabulaire)m_tableMots[strLeft.ToUpper()];
         if (mot != null)
         {
             return(mot.GetVocabulaire(strRight));
         }
         return(null);
     }
     return(this);
 }
示例#5
0
        /// ///////////////////////////////////////////
        private void ReplaceLastWord(CMotVocabulaire mot)
        {
            int pos = this.m_textBox.SelectionStart;

            if (pos >= 0)
            {
                if (pos > 1)
                {
                    pos--;
                    char f = m_textBox.Text[pos];
                    while (pos > 0 && (m_strSeparateurs + ".").IndexOf(f) < 0)
                    {
                        pos--;
                        f = m_textBox.Text[pos];
                    }
                }
                if (pos > 0)
                {
                    pos++;
                }
                string strText = m_textBox.Text;
                while (strText.Length > pos && strText[pos] == ' ')
                {
                    pos++;
                }
                if (m_textBox.SelectionStart - pos > 0)
                {
                    strText = strText.Remove(pos, m_textBox.SelectionStart - pos);
                }
                if (pos < strText.Length)
                {
                    m_textBox.Text = strText.Insert(pos, mot.Mot);
                }
                else
                {
                    m_textBox.Text = strText + mot.Mot;
                }
                m_textBox.SelectionStart = pos + mot.Mot.Length;
            }
        }
示例#6
0
        private void FillListBox( )
        {
            int nPosInText = m_textBox.SelectionStart;

            ListBox.Items.Clear();
            int    nWidth  = 100;
            string strWord = GetLastWord(m_strSeparateurs);

            if (Vocabulaire == null)
            {
                return;
            }
            CMotVocabulaire vocab   = Vocabulaire.GetVocabulaire(strWord);
            ArrayList       lstMots = new ArrayList();

            if (vocab != null)
            {
                if (!vocab.IsInit)
                {
                    FillWithFields(vocab);
                }
                //Trouve la fin du mot
                int nLastIndex = strWord.LastIndexOf('.');
                if (nLastIndex > 0)
                {
                    strWord = strWord.Substring(nLastIndex + 1);
                }
                lstMots = vocab.GetMots(strWord);
            }
            foreach (CMotVocabulaire mot in lstMots)
            {
                string strVoc = mot.ToString();
                ListBox.Items.Add(mot);
                nWidth = (int)Math.Min(Math.Max(nWidth, strVoc.Length * ListBox.Font.Size / 1.5), 400);
            }
            ListBox.Width = nWidth;
        }