コード例 #1
0
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            SetupTestModel(Properties.Resources.TextCacheModel_xml);

            m_cache = new T();
            m_cache.MetaDataCache      = MetaDataCache.CreateMetaDataCache("TestModel.xml");
            m_cache.ParaContentsFlid   = SimpleRootsiteTestsConstants.kflidParaContents;
            m_cache.ParaPropertiesFlid = SimpleRootsiteTestsConstants.kflidParaProperties;
            m_cache.TextParagraphsFlid = SimpleRootsiteTestsConstants.kflidTextParas;

            Debug.Assert(m_wsManager == null);
            m_wsManager = new PalasoWritingSystemManager();
            m_cache.WritingSystemFactory = m_wsManager;

            IWritingSystem enWs;

            m_wsManager.GetOrSet("en", out enWs);
            m_wsEng = enWs.Handle;

            IWritingSystem frWs;

            m_wsManager.GetOrSet("fr", out frWs);
            m_wsFrn = frWs.Handle;

            IWritingSystem deWs;

            m_wsManager.GetOrSet("de", out deWs);
            m_wsDeu = deWs.Handle;

            m_wsManager.UserWs = m_wsEng;
            m_wsUser           = m_wsManager.UserWs;
        }
コード例 #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Set up some dummy styles for testing purposes
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            m_stylesheet = new TestFwStylesheet();
            m_wsManager  = new PalasoWritingSystemManager();

            // English
            IWritingSystem enWs;

            m_wsManager.GetOrSet("en", out enWs);
            m_hvoEnglishWs = enWs.Handle;
            Assert.IsTrue(m_hvoEnglishWs > 0, "Should have gotten an hvo for the English WS");
            // German
            IWritingSystem deWs;

            m_wsManager.GetOrSet("de", out deWs);
            m_hvoGermanWs = deWs.Handle;
            Assert.IsTrue(m_hvoGermanWs > 0, "Should have gotten an hvo for the German WS");
            Assert.IsTrue(m_hvoEnglishWs != m_hvoGermanWs, "Writing systems should have different IDs");

            // Create a couple of styles
            int          hvoStyle  = m_stylesheet.MakeNewStyle();
            ITsPropsBldr propsBldr = TsPropsBldrClass.Create();

            propsBldr.SetStrPropValue((int)FwTextStringProp.kstpFontFamily, "Arial");
            m_stylesheet.PutStyle("StyleA", "bla", hvoStyle, 0, hvoStyle, 1, false, false,
                                  propsBldr.GetTextProps());

            hvoStyle = m_stylesheet.MakeNewStyle();
            propsBldr.SetStrPropValue((int)FwTextStringProp.kstpFontFamily, "Times New Roman");
            m_stylesheet.PutStyle("StyleB", "bla", hvoStyle, 0, hvoStyle, 1, false, false,
                                  propsBldr.GetTextProps());

            // Override the font size for each writing system and each style.
            List <FontOverride> fontOverrides = new List <FontOverride>(2);
            FontOverride        fo;

            fo.writingSystem = m_hvoEnglishWs;
            fo.fontSize      = 21;
            fontOverrides.Add(fo);
            fo.writingSystem = m_hvoGermanWs;
            fo.fontSize      = 13;
            fontOverrides.Add(fo);
            m_stylesheet.OverrideFontsForWritingSystems("StyleA", fontOverrides);

            fontOverrides.Clear();
            fo.writingSystem = m_hvoEnglishWs;
            fo.fontSize      = 20;
            fontOverrides.Add(fo);
            fo.writingSystem = m_hvoGermanWs;
            fo.fontSize      = 56;
            fontOverrides.Add(fo);
            m_stylesheet.OverrideFontsForWritingSystems("StyleB", fontOverrides);
        }
コード例 #3
0
		public void FixtureSetup()
		{
			m_wsManager = new PalasoWritingSystemManager();
			IWritingSystem enWs;
			m_wsManager.GetOrSet("en", out enWs);
			m_enWs = enWs.Handle;
			IWritingSystem frWs;
			m_wsManager.GetOrSet("fr", out frWs);
			m_frWs = frWs.Handle;
			m_tsf = TsStrFactoryClass.Create();
		}
コード例 #4
0
        public void FixtureSetup()
        {
            m_wsManager = new PalasoWritingSystemManager();
            IWritingSystem enWs;

            m_wsManager.GetOrSet("en", out enWs);
            m_enWs = enWs.Handle;
            IWritingSystem frWs;

            m_wsManager.GetOrSet("fr", out frWs);
            m_frWs = frWs.Handle;
            m_tsf  = TsStrFactoryClass.Create();
        }
コード例 #5
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Set up some dummy styles for testing purposes
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void FixtureSetup()
		{
			base.FixtureSetup();

			m_stylesheet = new TestFwStylesheet();
			m_wsManager = new PalasoWritingSystemManager();

			// English
			IWritingSystem enWs;
			m_wsManager.GetOrSet("en", out enWs);
			m_hvoEnglishWs = enWs.Handle;
			Assert.IsTrue(m_hvoEnglishWs > 0, "Should have gotten an hvo for the English WS");
			// German
			IWritingSystem deWs;
			m_wsManager.GetOrSet("de", out deWs);
			m_hvoGermanWs = deWs.Handle;
			Assert.IsTrue(m_hvoGermanWs > 0, "Should have gotten an hvo for the German WS");
			Assert.IsTrue(m_hvoEnglishWs != m_hvoGermanWs, "Writing systems should have different IDs");

			// Create a couple of styles
			int hvoStyle = m_stylesheet.MakeNewStyle();
			ITsPropsBldr propsBldr = TsPropsBldrClass.Create();
			propsBldr.SetStrPropValue((int)FwTextStringProp.kstpFontFamily, "Arial");
			m_stylesheet.PutStyle("StyleA", "bla", hvoStyle, 0, hvoStyle, 1, false, false,
				propsBldr.GetTextProps());

			hvoStyle = m_stylesheet.MakeNewStyle();
			propsBldr.SetStrPropValue((int)FwTextStringProp.kstpFontFamily, "Times New Roman");
			m_stylesheet.PutStyle("StyleB", "bla", hvoStyle, 0, hvoStyle, 1, false, false,
				propsBldr.GetTextProps());

			// Override the font size for each writing system and each style.
			List<FontOverride> fontOverrides = new List<FontOverride>(2);
			FontOverride fo;
			fo.writingSystem = m_hvoEnglishWs;
			fo.fontSize = 21;
			fontOverrides.Add(fo);
			fo.writingSystem = m_hvoGermanWs;
			fo.fontSize = 13;
			fontOverrides.Add(fo);
			m_stylesheet.OverrideFontsForWritingSystems("StyleA", fontOverrides);

			fontOverrides.Clear();
			fo.writingSystem = m_hvoEnglishWs;
			fo.fontSize = 20;
			fontOverrides.Add(fo);
			fo.writingSystem = m_hvoGermanWs;
			fo.fontSize = 56;
			fontOverrides.Add(fo);
			m_stylesheet.OverrideFontsForWritingSystems("StyleB", fontOverrides);
		}
コード例 #6
0
		public void FixtureSetup()
		{
			m_DebugProcs = new DebugProcs();
			RegistryHelper.CompanyName = "SIL";

			Icu.InitIcuDataDir();
			m_wsManager = new PalasoWritingSystemManager();

			IWritingSystem enWs;
			m_wsManager.GetOrSet("en", out enWs);
			m_enWs = enWs.Handle;

			IWritingSystem esWs;
			m_wsManager.GetOrSet("es", out esWs);
			m_esWs = esWs.Handle;
		}
コード例 #7
0
        /// <summary>
        /// Create the most basic parts of the LgWritingSystem objects.
        /// This can be everything except ITsStrings,
        /// which may depend on non-existing WS definitions.
        /// A second pass will add the ITsStrings.
        /// </summary>
        private static void BootstrapWritingSystems(ILangProject lp)
        {
            IWritingSystemManager wsManager = lp.Services.WritingSystemManager;
            // English WS.
            IWritingSystem ws;

            wsManager.GetOrSet("en", out ws);
            lp.AddToCurrentAnalysisWritingSystems(ws);

            // Spanish WS.
            wsManager.GetOrSet("es", out ws);
            // German WS.
            wsManager.GetOrSet("de", out ws);
            // French WS.
            wsManager.GetOrSet("fr", out ws);

            wsManager.Save();
        }
コード例 #8
0
ファイル: FwTextBoxTests.cs プロジェクト: sillsdev/FieldWorks
		public override void FixtureSetup()
		{
			base.FixtureSetup();
			m_wsManager = new PalasoWritingSystemManager();

			// setup English ws.
			IWritingSystem enWs;
			m_wsManager.GetOrSet("en", out enWs);
			m_hvoEnglishWs = enWs.Handle;
		}
コード例 #9
0
        public override void FixtureSetup()
        {
            base.FixtureSetup();
            m_wsManager = new PalasoWritingSystemManager();

            // setup English ws.
            IWritingSystem enWs;

            m_wsManager.GetOrSet("en", out enWs);
            m_hvoEnglishWs = enWs.Handle;
        }
コード例 #10
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void UpdateLanguageCombos()
        {
            var wsSaveVern = (IWritingSystem)m_cbVernWrtSys.SelectedItem;
            var wsSaveAnal = (IWritingSystem)m_cbAnalWrtSys.SelectedItem;

            m_cbAnalWrtSys.BeginUpdate();
            m_cbVernWrtSys.BeginUpdate();
            m_cbAnalWrtSys.Items.Clear();
            m_cbVernWrtSys.Items.Clear();

            // Make sure our manager knows about any writing systems in the template folder.
            // In pathological cases where no projects have been installed these might not be in the global store.
            foreach (var templateLangFile in Directory.GetFiles(FwDirectoryFinder.TemplateDirectory, @"*.ldml"))
            {
                var            id = Path.GetFileNameWithoutExtension(templateLangFile);
                IWritingSystem dummy;
                m_wsManager.GetOrSet(id, out dummy);
            }

            foreach (IWritingSystem ws in m_wsManager.LocalWritingSystems)
            {
                m_cbAnalWrtSys.Items.Add(ws);
                m_cbVernWrtSys.Items.Add(ws);
            }

            if (m_cbVernWrtSys.Items.Count > 0)
            {
#if !__MonoCS__
                int i = (wsSaveVern == null ? 0 : m_cbVernWrtSys.FindString(wsSaveVern.ToString()));
#else
                // TODO-Linux: mono difference? on mono setting SelectedIndex to 0 on an empty combo throws exception
                int i = (wsSaveVern == null ? -1 : m_cbVernWrtSys.FindString(wsSaveVern.ToString()));
                if (i != -1)
#endif
                m_cbVernWrtSys.SelectedIndex = (i >= 0 ? i : 0);
            }
            m_cbVernWrtSys.EndUpdate();

            if (m_cbAnalWrtSys.Items.Count > 0)
            {
#if !__MonoCS__
                int i = (wsSaveAnal == null ? 0 : m_cbAnalWrtSys.FindString(wsSaveAnal.ToString()));
#else
                // TODO-Linux: mono difference? on mono setting SelectedIndex to 0 on an empty combo throws exception
                int i = (wsSaveAnal == null ? -1 : m_cbAnalWrtSys.FindString(wsSaveAnal.ToString()));
                if (i != -1)
#endif
                m_cbAnalWrtSys.SelectedIndex = (i >= 0 ? i : 0);
            }
            m_cbAnalWrtSys.EndUpdate();
        }
コード例 #11
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Handle the OK button click event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ------------------------------------------------------------------------------------
        protected void btnOK_Click(object sender, System.EventArgs e)
        {
            // Save values to the registry for the "Draft View" tab.
            Options.ShowEmptyParagraphPromptsSetting    = m_chkPromptEmptyParas.Checked;
            Options.ShowMarkerlessIconsSetting          = m_chkMarkerlessFootnoteIcons.Checked;
            Options.ShowFormatMarksSetting              = m_chkShowFormatMarks.Checked;
            Options.FootnoteSynchronousScrollingSetting = m_chkSynchFootnoteScroll.Checked;

            // Save values to the registry for the "Styles" tab.
            if (rdoAllStyles.Checked)
            {
                Options.ShowTheseStylesSetting = Options.ShowTheseStyles.All;
            }
            else if (rdoBasicStyles.Checked)
            {
                Options.ShowTheseStylesSetting = Options.ShowTheseStyles.Basic;
            }
            else if (rdoCustomList.Checked)
            {
                Options.ShowTheseStylesSetting = Options.ShowTheseStyles.Custom;
            }

            string s = (string)cboStyleLevel.SelectedItem;

            if (s == DlgResources.ResourceString("kstidStyleLevelBasic"))
            {
                Options.ShowStyleLevelSetting = Options.StyleLevel.Basic;
            }
            else if (s == DlgResources.ResourceString("kstidStyleLevelIntermediate"))
            {
                Options.ShowStyleLevelSetting = Options.StyleLevel.Intermediate;
            }
            else if (s == DlgResources.ResourceString("kstidStyleLevelAdvanced"))
            {
                Options.ShowStyleLevelSetting = Options.StyleLevel.Advanced;
            }
            else if (s == DlgResources.ResourceString("kstidStyleLevelExpert"))
            {
                Options.ShowStyleLevelSetting = Options.StyleLevel.Expert;
            }

            Options.ShowUserDefinedStylesSetting = chkShowUserDefined.Checked;

            // Save values to the registry for the "General" tab.
            Options.AutoStartLibronix = m_chkStartLibronixWithTE.Checked;
            FwRegistrySettings.MeasurementUnitSetting = m_cboMeasurement.SelectedIndex;

            // Use the following code block to set registry values for experimental features.
            // Currently, there are no experimental features that can be turned on/off through the
            // Tools/Options dialog.
#if DEBUG
            Options.UseVerticalDraftView = m_cboExperimentalFeatures.GetItemChecked(kVerticalDraftView);
#endif
            Options.UseInterlinearBackTranslation = m_cboExperimentalFeatures.GetItemChecked(kInterlinearBackTranslation);
            Options.UseXhtmlExport = m_cboExperimentalFeatures.GetItemChecked(kXhtmlExport);
            // The UNS translation feature is only available if the required files are present.
            if (m_cboExperimentalFeatures.Items.Count > kTranslateUnsQuestions)
            {
                Options.ShowTranslateUnsQuestions = m_cboExperimentalFeatures.GetItemChecked(kTranslateUnsQuestions);
            }
            Options.AddErrorReportingInfo();

            if (Options.UseInterlinearBackTranslation != m_origInterLinearBTValue)
            {
                string msg =
                    "You have changed the setting for enabling or disabling the" + Environment.NewLine +
                    "Experimental feature for Segmented Back Translation. For this" + Environment.NewLine +
                    "change to take effect, you must restart Translation Editor.";

                MessageBox.Show(this, msg, m_app.ApplicationName,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            // IMPORTANT: This has to be the last thing we do because changing the UI locale
            // will reload the controls in the dialog box and lose any changes the user made.
            string sUserWs    = m_wsManager.UserWritingSystem.Id;
            string sNewUserWs = m_userInterfaceChooser.NewUserWs;
            if (sUserWs != sNewUserWs)
            {
                CultureInfo ci = MiscUtils.GetCultureForWs(sNewUserWs);
                if (ci != null)
                {
                    FormLanguageSwitchSingleton.Instance.ChangeCurrentThreadUICulture(ci);
                    FormLanguageSwitchSingleton.Instance.ChangeLanguage(this);
#if __MonoCS__
                    // Mono leaves the wait cursor on, unlike .Net itself.
                    Cursor.Current = Cursors.Default;
#endif
                }
                Options.UserInterfaceWritingSystem = sNewUserWs;
                //The writing system the user selects for the user interface may not be loaded yet into the project
                //database. Therefore we need to check this first and if it is not we need to load it.
                IWritingSystem ws;
                m_wsManager.GetOrSet(sNewUserWs, out ws);
                m_wsManager.UserWritingSystem = ws;
            }

            // DON'T ADD CODE HERE (see above)
        }
コード例 #12
0
			/// <summary>
			/// Constructor using the writing system identifier and Converter name explicitly.
			/// </summary>
			public EncConverterChoice(string sWs, string sConverter, IWritingSystemManager wsManager)
			{
				m_sConverter = sConverter;
				if (String.IsNullOrEmpty(m_sConverter))
					m_sConverter = Sfm2Xml.STATICS.AlreadyInUnicode;
				wsManager.GetOrSet(sWs, out m_ws);
			}