Exemplo n.º 1
0
		public void MissingIdIsHandledOk()
		{
			WritingSystemCollection x = new WritingSystemCollection();
			WritingSystem ws = x["unheardof"];
			Assert.IsNotNull(ws);
			Assert.AreSame(ws, x["unheardof"], "Expected to get exactly the same one each time");
		}
Exemplo n.º 2
0
		public ProjectInfo(string name,
						   string pathToApplicationRootDirectory,
						   string pathToTopLevelDirectory,
						   string pathToLIFT,
						   string pathToExportDirectory,
						   string[] filesBelongingToProject,
						   FileLocater locateFile,
						   WritingSystemCollection writingSystems,
						   IServiceProvider serviceProvider,
						   // these signatures were to reduce the dependencies on addins that didn't need this stuff
						   object project)
				// these signatures were to reduce the dependencies on addins that didn't need this stuff

		{
			ServiceProvider = serviceProvider;
			_pathToTopLevelDirectory = pathToTopLevelDirectory;
			_locateFile = locateFile;
			_writingSystems = writingSystems;
			_project = project;
			_filesBelongingToProject = filesBelongingToProject;
			_name = name;
			_pathToApplicationRootDirectory = pathToApplicationRootDirectory;
			_pathToLIFT = pathToLIFT;
			_pathToExportDirectory = pathToExportDirectory;
		}
Exemplo n.º 3
0
        public MultiTextControl(WritingSystemCollection allWritingSystems)
        {
            SuspendLayout();
            _allWritingSystems = allWritingSystems;
            components = new Container();
            InitializeComponent();
            _textBoxes = new List<WeSayTextBox>();
            //this.BackColor = System.Drawing.Color.Crimson;
            _writingSystemLabelFont = new Font(FontFamily.GenericSansSerif, 9);

            if (-1 == WidthForWritingSystemLabels)
            {
                //happens when this is from a hand-placed designer piece,
                //in which case we don't really care about aligning anyhow
                ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); //ws label
            }
            else
            {
                ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, WidthForWritingSystemLabels));
            }
            ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); //text
            ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); //annotation widget

            ResumeLayout(false);
        }
 partial void SetDefaultValuesInConstruction()
 {
     m_analysisWritingSystems                      = new WritingSystemCollection(this, LangProjectTags.kflidAnalysisWss);
     m_vernacularWritingSystems                    = new WritingSystemCollection(this, LangProjectTags.kflidVernWss);
     m_currentAnalysisWritingSystems               = new WritingSystemList(this, LangProjectTags.kflidCurAnalysisWss);
     m_currentVernacularWritingSystems             = new WritingSystemList(this, LangProjectTags.kflidCurVernWss);
     m_currentPronunciationWritingSystems          = new WritingSystemList(this, LangProjectTags.kflidCurPronunWss);
     m_currentAnalysisWritingSystems.Changed      += WritingSystemListChanged;
     m_currentVernacularWritingSystems.Changed    += WritingSystemListChanged;
     m_currentPronunciationWritingSystems.Changed += WritingSystemListChanged;
     // Just in the unlikely event...except perhaps in tests...that this gets called when we have an existing cache.
     WritingSystemListChanged(this, new EventArgs());
 }
Exemplo n.º 5
0
        public MultiTextControl(IList<string> writingSystemIds,
								MultiText multiTextToCopyFormsFrom,
								string nameForTesting,
								bool showAnnotationWidget,
								WritingSystemCollection allWritingSystems,
								CommonEnumerations.VisibilitySetting visibility,
								bool isSpellCheckingEnabled)
            : this(allWritingSystems)
        {
            Name = nameForTesting + "-mtc";
            _writingSystemsForThisField = new List<WritingSystem>();
            foreach (KeyValuePair<string, WritingSystem> pair in allWritingSystems)
            {
                if (writingSystemIds.Contains(pair.Key))
                {
                    _writingSystemsForThisField.Add(pair.Value);
                }
            }
            _showAnnotationWidget = showAnnotationWidget;
            _visibility = visibility;
            _isSpellCheckingEnabled = isSpellCheckingEnabled;
            BuildBoxes(multiTextToCopyFormsFrom);
        }
Exemplo n.º 6
0
		public void DeserializeCollectionViaLoad()
		{
			MakeSampleCollection().Write(XmlWriter.Create(_path));

			WritingSystemCollection c = new WritingSystemCollection();
			c.Load(_path);
			Assert.IsNotNull(c);
			Assert.AreEqual(2, c.Values.Count);
		}
Exemplo n.º 7
0
		public void Setup()
		{
			_path = Path.GetTempFileName();
			_collection = new WritingSystemCollection();
		}
Exemplo n.º 8
0
		public void WritingSystemCollection_HasUnknownAnalysis()
		{
			WritingSystemCollection c = new WritingSystemCollection();
			Assert.IsNotNull(c.UnknownAnalysisWritingSystem);
		}
Exemplo n.º 9
0
		public void WritingSystemCollection_HasUnknownVernacular()
		{
			WritingSystemCollection c = new WritingSystemCollection();
			Assert.IsNotNull(c.UnknownVernacularWritingSystem);
		}
Exemplo n.º 10
0
		private static WritingSystemCollection MakeSampleCollection()
		{
			WritingSystemCollection c = new WritingSystemCollection();
			c.Add("one", new WritingSystem("one", new Font("Arial", 11)));
			c.Add("two", new WritingSystem("two", new Font("Times New Roman", 22)));
			return c;
		}
Exemplo n.º 11
0
		public BasilProject()
		{
			Project = this;
			_writingSystems = new WritingSystemCollection();
		}
Exemplo n.º 12
0
		/// <summary>
		/// See comment on BasilProject.InitializeForTests()
		/// </summary>
		public new static void InitializeForTests()
		{
			WeSayWordsProject project = new WeSayWordsProject();

			try
			{
				File.Delete(PathToPretendLiftFile);
			}
			catch (Exception) {}

			Directory.CreateDirectory(Path.GetDirectoryName(PathToPretendLiftFile));
			Utilities.CreateEmptyLiftFile(PathToPretendLiftFile, "InitializeForTests()", true);

			//setup writing systems
			WritingSystemCollection wsc = new WritingSystemCollection();
			wsc.Add(wsc.TestWritingSystemVernId,
					new WritingSystem(wsc.TestWritingSystemVernId, new Font("Courier", 10)));
			wsc.Add(wsc.TestWritingSystemAnalId,
					new WritingSystem(wsc.TestWritingSystemAnalId, new Font("Arial", 15)));
			if (File.Exists(PathToPretendWritingSystemPrefs))
			{
				File.Delete(PathToPretendWritingSystemPrefs);
			}
			wsc.Write(XmlWriter.Create(PathToPretendWritingSystemPrefs));

			project.SetupProjectDirForTests(PathToPretendLiftFile);


		}
Exemplo n.º 13
0
		/// <summary>
		/// this is something of a hack, because we currently create the default viewtemplate from
		/// code, but everything else from template xml files.  So this opens up the default config
		/// and sticks a nice new code-computed default view template into it.
		/// </summary>
		/// <param name="pathToWritingSystemPrefs"></param>
		/// <param name="pathToConfigFile"></param>
		private static void StickDefaultViewTemplateInNewConfigFile(string pathToWritingSystemPrefs, string pathToConfigFile)
		{
			WritingSystemCollection writingSystemCollection = new WritingSystemCollection();
			writingSystemCollection.Load(pathToWritingSystemPrefs);

			var template = ViewTemplate.MakeMasterTemplate(writingSystemCollection);
			StringBuilder builder = new StringBuilder();
			XmlWriterSettings settings = new XmlWriterSettings();
			settings.OmitXmlDeclaration = true;
			using (var writer = XmlWriter.Create(builder, settings))
			{
				template.Write(writer);
			}

			XmlDocument doc = new XmlDocument();
			doc.Load(pathToConfigFile);
			var e = doc.SelectSingleNode("configuration").AppendChild(doc.CreateElement("components"));
			e.InnerXml = builder.ToString();
			doc.Save(pathToConfigFile);
		}
Exemplo n.º 14
0
		partial void SetDefaultValuesInConstruction()
		{
			m_analysisWritingSystems = new WritingSystemCollection(this, LangProjectTags.kflidAnalysisWss);
			m_vernacularWritingSystems = new WritingSystemCollection(this, LangProjectTags.kflidVernWss);
			m_currentAnalysisWritingSystems = new WritingSystemList(this, LangProjectTags.kflidCurAnalysisWss);
			m_currentVernacularWritingSystems = new WritingSystemList(this, LangProjectTags.kflidCurVernWss);
			m_currentPronunciationWritingSystems = new WritingSystemList(this, LangProjectTags.kflidCurPronunWss);
			m_currentAnalysisWritingSystems.Changed += WritingSystemListChanged;
			m_currentVernacularWritingSystems.Changed += WritingSystemListChanged;
			m_currentPronunciationWritingSystems.Changed += WritingSystemListChanged;
			// Just in the unlikely event...except perhaps in tests...that this gets called when we have an existing cache.
			WritingSystemListChanged(this, new EventArgs());
		}