示例#1
0
        public Sfm2Xml.ClsInFieldMarker IFM()
        {
            CheckDisposed();

            string style = cbStyle.Text;

            if (style == NoChange)
            {
                style = "";                     // use empty string, not the "<No Change>" text
            }
            string lang = cbLangDesc.Text;

            if (lang == NoChange)
            {
                lang = "";                      // use empty string, not the "<No Change>" text
            }
            bool fHaveEndMarker = tbEndMarker.Text.Trim().Length > 0;
            bool fIgnore        = lang.Length + style.Length == 0;

            // get the xmlLang value
            string xmlLangValue = "Unknown";

            Sfm2Xml.LanguageInfoUI langUI = m_uiLangs[lang] as Sfm2Xml.LanguageInfoUI;
            if (langUI != null)
            {
                xmlLangValue = langUI.ClsLanguage.XmlLang;
            }

            return(new Sfm2Xml.ClsInFieldMarker(tbBeginMarker.Text.Trim(),
                                                tbEndMarker.Text.Trim(), radioEndWithWord.Checked && !fHaveEndMarker,
                                                radioEndWithField.Checked && !fHaveEndMarker,
                                                lang, xmlLangValue, style, fIgnore));
        }
示例#2
0
        public void Init(Sfm2Xml.ClsInFieldMarker ifm, Hashtable uiLangsHT, LcmCache cache)
        {
            CheckDisposed();

            if (ifm == null)
            {
                ifm = new Sfm2Xml.ClsInFieldMarker();
            }

            m_inlineMarker = ifm;
            m_uiLangs      = uiLangsHT;
            m_cache        = cache;

            // ====================================================================
            // Set the language descriptor combo box.  This is a DropList so that
            // the entered text can't be different from the contents of the list.
            // If the user wants a new language descriptor they have to add one.

            cbLangDesc.Items.Add(NoChange);
            cbLangDesc.SelectedItem = NoChange;

            foreach (DictionaryEntry lang in m_uiLangs)
            {
                Sfm2Xml.LanguageInfoUI langInfo = lang.Value as Sfm2Xml.LanguageInfoUI;
                // make sure there is only one entry for each writing system (especially 'ignore')
                if (cbLangDesc.FindStringExact(langInfo.ToString()) < 0)
                {
                    cbLangDesc.Items.Add(langInfo);
                    if (langInfo.FwName == m_inlineMarker.Language)
                    {
                        cbLangDesc.SelectedItem = langInfo;
                    }
                }
            }

            InitializeStylesComboBox();

            HideOKBtn();                // see if it needs to be visible or not
        }
示例#3
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            LexImportWizardLanguage dlg = new LexImportWizardLanguage(m_cache, m_uiLangs);

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                string langDesc, ws, ec, icu;
                // retrieve the new WS information from the dlg
                dlg.GetCurrentLangInfo(out langDesc, out ws, out ec, out icu);

                // now put the lang info into the language list view
                if (LexImportWizard.Wizard().AddLanguage(langDesc, ws, ec, icu))
                {
                    // this was added to the list of languages, so add it to the dlg and select it
                    Sfm2Xml.LanguageInfoUI langInfo = new Sfm2Xml.LanguageInfoUI(langDesc, ws, ec, icu);
                    if (cbLangDesc.FindStringExact(langInfo.ToString()) < 0)
                    {
                        cbLangDesc.Items.Add(langInfo);
                    }
                    cbLangDesc.SelectedItem = langInfo;
                }
            }
        }
		private void btnAdd_Click(object sender, EventArgs e)
		{
			using (var dlg = new LexImportWizardLanguage(m_cache, m_uiLangs, m_helpTopicProvider, m_app, m_stylesheet))
			{
				if (dlg.ShowDialog(this) == DialogResult.OK)
				{
					string langDesc, ws, ec, wsId;
					// retrieve the new WS information from the dlg
					dlg.GetCurrentLangInfo(out langDesc, out ws, out ec, out wsId);

					// now put the lang info into the language list view
					if (LexImportWizard.Wizard().AddLanguage(langDesc, ws, ec, wsId))
					{
						// this was added to the list of languages, so add it to the dlg and select it
						var langInfo = new Sfm2Xml.LanguageInfoUI(langDesc, ws, ec, wsId);
						if (cbLangDesc.FindStringExact(langInfo.ToString()) < 0)
						{
							cbLangDesc.Items.Add(langInfo);
						}
						cbLangDesc.SelectedItem = langInfo;
					}
				}
			}
		}
示例#5
0
		private static ListViewItem CreateLanguageMappingItem(string langDesc, string ws, string ec, string wsId)
		{
			var lvItem = new ListViewItem(new[] {langDesc, ws, ec});
			var langInfo = new Sfm2Xml.LanguageInfoUI(langDesc, ws, ec, wsId);
			if (langInfo.FwName == Sfm2Xml.STATICS.Ignore)	// this is ignored due to lang
			{
				lvItem.UseItemStyleForSubItems = false;
				lvItem.SubItems[1].ForeColor = Color.Blue;
			}
			lvItem.Tag = langInfo;

			return lvItem;
		}