Exemplo n.º 1
0
        private void TestFeatureStructureContent(IFsFeatStruc featStruct)
        {
            ILcmOwningCollection <IFsFeatureSpecification> specCol = featStruct.FeatureSpecsOC;

            Assert.AreEqual(1, specCol.Count, "Count of top level feature specs");
            foreach (IFsFeatureSpecification spec in specCol)
            {
                IFsComplexValue complex = spec as IFsComplexValue;
                Assert.IsNotNull(complex, "complex feature value is null and should not be");
                Assert.AreEqual("subject agreement", complex.FeatureRA.Name.AnalysisDefaultWritingSystem.Text, "Expected complex feature name");
                IFsFeatStruc fsNested = complex.ValueOA as IFsFeatStruc;
                ILcmOwningCollection <IFsFeatureSpecification> fsNestedCol = fsNested.FeatureSpecsOC;
                Assert.AreEqual(2, fsNestedCol.Count, "Nested fs has one feature");
                foreach (IFsFeatureSpecification specNested in fsNestedCol)
                {
                    IFsClosedValue closed = specNested as IFsClosedValue;
                    Assert.IsNotNull(closed, "closed feature value is null and should not be");
                    if (!(((closed.FeatureRA.Name.AnalysisDefaultWritingSystem.Text == "gender") &&
                           (closed.ValueRA.Name.AnalysisDefaultWritingSystem.Text == "feminine gender")) ||
                          ((closed.FeatureRA.Name.AnalysisDefaultWritingSystem.Text == "person") &&
                           (closed.ValueRA.Name.AnalysisDefaultWritingSystem.Text == "first person"))))
                    {
                        Assert.Fail("Unexpected value found: {0}:{1}",
                                    closed.FeatureRA.Name.AnalysisDefaultWritingSystem.Text,
                                    closed.ValueRA.Name.AnalysisDefaultWritingSystem.Text);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void BuildCmFilter2()
        {
            // Setup test values
            Cache.LangProject.PeopleOA = Cache.ServiceLocator.GetInstance <ICmPossibilityListFactory>().Create();
            ICmPossibility person1 = Cache.ServiceLocator.GetInstance <ICmPersonFactory>().Create();

            Cache.LangProject.PeopleOA.PossibilitiesOS.Add(person1);
            person1.ForeColor = 5;
            person1.BackColor = 10;

            // Setup filter
            ILcmOwningCollection <ICmFilter> filtersCol = Cache.LangProject.FiltersOC;
            ICmFilter filter = Cache.ServiceLocator.GetInstance <ICmFilterFactory>().Create();

            filtersCol.Add(filter);
            filter.ColumnInfo = CmPossibilityTags.kClassId + "," + CmPossibilityTags.kflidForeColor
                                + "|" + CmPossibilityTags.kClassId + "," + CmPossibilityTags.kflidBackColor;
            ICmRow row = Cache.ServiceLocator.GetInstance <ICmRowFactory>().Create();

            filter.RowsOS.Add(row);
            ICmCell cell1 = Cache.ServiceLocator.GetInstance <ICmCellFactory>().Create();

            row.CellsOS.Add(cell1);
            cell1.Contents = MakeString("= 5");
            ICmCell cell2 = Cache.ServiceLocator.GetInstance <ICmCellFactory>().Create();

            row.CellsOS.Add(cell2);
            cell2.Contents = MakeString("= 10");

            // Check the result
            filter.InitCriteria();
            Assert.IsTrue(filter.MatchesCriteria(person1.Hvo));
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="featSys"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        /// <param name="launchedFromInsertMenu"></param>
        /// <param name="sWindowKey">used to store location and size of dialog window</param>
        /// <param name="sXmlFile">file containing the XML form of the gloss list</param>
        public void SetDlginfo(IFsFeatureSystem featSys, Mediator mediator, XCore.PropertyTable propertyTable, bool launchedFromInsertMenu, string sWindowKey, string sXmlFile)
        {
            CheckDisposed();

            m_featureSystem          = featSys;
            m_featureList            = featSys.FeaturesOC;
            m_launchedFromInsertMenu = launchedFromInsertMenu;
            m_mediator      = mediator;
            m_propertyTable = propertyTable;
            if (m_propertyTable != null)
            {
                m_sWindowKeyLocation = sWindowKey + "Location";
                m_sWindowKeySize     = sWindowKey + "Size";

                ResetWindowLocationAndSize();

                m_helpTopicProvider        = m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");
                helpProvider               = new HelpProvider();
                helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
                helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(s_helpTopic));
                helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
            }
            m_cache = featSys.Cache;
            LoadMasterFeatures(sXmlFile);
            m_tvMasterList.Cache = m_cache;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
                if (m_tvMasterList != null)
                {
                    m_tvMasterList.Dispose();
                }
            }
            m_cache        = null;
            m_selFeatDefn  = null;
            m_featureList  = null;
            m_mediator     = null;
            m_tvMasterList = null;

            base.Dispose(disposing);
        }
Exemplo n.º 5
0
 public ObjectValuePartGenerator(LcmCache cache, XmlNode input, XmlVc vc, int rootClassId)
     : base(cache, input, vc, rootClassId)
 {
     m_objectPath = XmlUtils.GetAttributeValue(input, "objectPath");
     if (m_objectPath == null)
     {
         throw new ArgumentException("ObjectValuePartGenerator expects input to have objectPath attribute.");
     }
     // Enhance: generalize this
     if (m_objectPath == "PhFeatureSystem.Features")
     {
         m_collectionToGeneratePartsFrom = cache.LangProject.PhFeatureSystemOA.FeaturesOC;
         m_sortedCollection = from s in m_collectionToGeneratePartsFrom
                              orderby s.Abbreviation.BestAnalysisAlternative.Text
                              select s;
     }
 }
Exemplo n.º 6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Create a new style on the specified style list.
        /// </summary>
        /// <param name="styleList">The style list to add the style to</param>
        /// <param name="name">style name</param>
        /// <param name="context">style context</param>
        /// <param name="structure">style structure</param>
        /// <param name="function">style function</param>
        /// <param name="isCharStyle">true if character style, otherwise false</param>
        /// <param name="userLevel">User level</param>
        /// <param name="isBuiltIn">true if style is a bult-in style</param>
        /// ------------------------------------------------------------------------------------
        public IStStyle AddStyle(ILcmOwningCollection <IStStyle> styleList, string name,
                                 ContextValues context, StructureValues structure, FunctionValues function,
                                 bool isCharStyle, int userLevel, bool isBuiltIn)
        {
            IStStyle style = Cache.ServiceLocator.GetInstance <IStStyleFactory>().Create();

            styleList.Add(style);
            style.Name      = name;
            style.Context   = context;
            style.Structure = structure;
            style.Function  = function;
            style.Type      = (isCharStyle ? StyleType.kstCharacter : StyleType.kstParagraph);
            style.UserLevel = userLevel;
            ITsPropsBldr bldr = TsStringUtils.MakePropsBldr();

            style.Rules     = bldr.GetTextProps();
            style.IsBuiltIn = isBuiltIn;
            return(style);
        }
Exemplo n.º 7
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Create a new style and add it to the Language Project stylesheet.
 /// </summary>
 /// <param name="name">style name</param>
 /// <param name="context">style context</param>
 /// <param name="structure">style structure</param>
 /// <param name="function">style function</param>
 /// <param name="isCharStyle">true if character style, otherwise false</param>
 /// <param name="userLevel">The user level.</param>
 /// <param name="styleCollection">The style collection.</param>
 /// <returns>The style</returns>
 /// ------------------------------------------------------------------------------------
 public IStStyle AddTestStyle(string name, ContextValues context, StructureValues structure,
                              FunctionValues function, bool isCharStyle, int userLevel, ILcmOwningCollection <IStStyle> styleCollection)
 {
     return(AddStyle(styleCollection, name, context, structure, function, isCharStyle, userLevel, true));
 }