protected override void OnCellMouseClick(DataGridViewCellMouseEventArgs e)
 {
     base.OnCellMouseClick(e);
     selectedRowIndex = e.RowIndex;
     if (e.Button == MouseButtons.Right)
     {
         if (e.ColumnIndex == 0)
         {
             speechSynthesizer.WordToSoundMappingList.RemoveAt(selectedRowIndex);
             ShowWordToSoundMappingList();
         }
         if (e.ColumnIndex == 1)
         {
             WordToSoundMapping wordToSoundMapping = speechSynthesizer.WordToSoundMappingList[selectedRowIndex];
             if (wordToSoundMapping.SoundNameList.Count > 0)
             {
                 wordToSoundMapping.SoundNameList.RemoveAt(wordToSoundMapping.SoundNameList.Count - 1);
                 string mappingString = "";
                 foreach (string soundName in wordToSoundMapping.SoundNameList)
                 {
                     mappingString += soundName + " ";
                 }
                 mappingString = mappingString.TrimEnd(new char[] { ' ' });
                 Rows[selectedRowIndex].Cells[e.ColumnIndex].Value = mappingString;
             }
         }
     }
 }
        public override WAVSound GenerateWord(string word)
        {
            int      wordIndex = wordToSoundMappingList.FindIndex(m => m.Word == word);
            WAVSound wordSound = null;

            if (wordIndex >= 0)
            {
                WordToSoundMapping wordToSoundMapping = wordToSoundMappingList[wordIndex];
                List <WAVSound>    wavSoundList       = new List <WAVSound>();
                foreach (string soundName in wordToSoundMapping.SoundNameList)
                {
                    FormantSpecification formantSpecification = SpecificationList.Find(s => s.Name == soundName);
                    if (formantSpecification != null)
                    {
                        formantSpecification.GenerateSettingsSequence();
                        WAVSound sound = GenerateSound(formantSpecification);
                        wavSoundList.Add(sound);
                    }
                }
                if (wavSoundList.Count > 0)
                {
                    wordSound = WAVSound.Join(wavSoundList, null);
                }
            }
            return(wordSound);
        }
 protected override void OnCellEndEdit(DataGridViewCellEventArgs e)
 {
     base.OnCellEndEdit(e);
     if (e.ColumnIndex == 0)
     {
         WordToSoundMapping wordToSoundMapping = speechSynthesizer.WordToSoundMappingList[e.RowIndex];
         if (this.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
         {
             wordToSoundMapping.Word = this.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
         }
     }
 }