예제 #1
0
        /// <summary>
        /// This is used to create an object collection with the appropriate writing system choices to be used in wsCombo.  The reason it is cached is because
        /// list generation will require looping through each kind of combo box several times.
        /// </summary>
        /// <param name="comboContent"></param>
        /// <returns></returns>
        private ComboBox.ObjectCollection WsComboItems(ColumnConfigureDialog.WsComboContent comboContent)
        {
            ComboBox.ObjectCollection objectCollection;
            if (!m_cachedComboBoxes.ContainsKey(comboContent))
            {
                objectCollection = new ComboBox.ObjectCollection(wsCombo);

                // The final argument here restricts writing systems that will be added to the combo box to
                // only be "real" writing systems.  So, English will be added, but not "Default Analysis".
                // This functionality should eventually go away.  See LT-4740.
                // JohnT: it now partially has, two lines support 'best analysis'.
                ColumnConfigureDialog.AddWritingSystemsToCombo(m_cache, objectCollection, comboContent,
                                                               comboContent != ColumnConfigureDialog.WsComboContent.kwccBestAnalysis);
                m_cachedComboBoxes[comboContent] = objectCollection;
            }
            else
            {
                objectCollection = m_cachedComboBoxes[comboContent];
            }

            return(objectCollection);
        }
 /// <summary>
 /// This is used to create an object collection with the appropriate writing system choices to be used in wsCombo.  The reason it is cached is because
 /// list generation will require looping through each kind of combo box several times.
 /// </summary>
 /// <param name="comboContent"></param>
 /// <returns></returns>
 private ComboBox.ObjectCollection WsComboItems(ColumnConfigureDialog.WsComboContent comboContent)
 {
     return(WsComboItemsInternal(m_cache, wsCombo, m_cachedComboBoxes, comboContent));
 }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="flid"></param>
        /// <param name="wsRequested">If zero, supply the default ws for the field; otherwise
        /// use the one supplied.</param>
        /// <returns></returns>
        internal InterlinLineSpec CreateSpec(int flid, int wsRequested)
        {
            int  ws             = 0;
            bool fMorphemeLevel = false;
            bool fWordLevel     = true;
            int  flidString     = 0;

            ColumnConfigureDialog.WsComboContent comboContent = ColumnConfigureDialog.WsComboContent.kwccAnalysis;             // The usual choice
            switch (flid)
            {
            case kflidWord:
                comboContent = ColumnConfigureDialog.ChooseComboContent(m_wsDefVern, "vernacular");
                ws           = m_wsDefVern;
                break;                         // vern, not interlin, word

            case kflidLexEntries:
            case kflidMorphemes:
                fMorphemeLevel = true;
                comboContent   = ColumnConfigureDialog.ChooseComboContent(m_wsDefVern, "vernacular");
                flidString     = (int)MoForm.MoFormTags.kflidForm;
                ws             = m_wsDefVern;
                break;                         // vern, morpheme

            case kflidLexGloss:
                fMorphemeLevel = true;
                ws             = LangProject.kwsFirstAnal;
                flidString     = (int)LexSense.LexSenseTags.kflidGloss;
                comboContent   = ColumnConfigureDialog.WsComboContent.kwccBestAnalysis;
                break;                         // analysis, morpheme

            case kflidLexPos:
                fMorphemeLevel = true;
                // getting to the string takes a couple of levels
                // so just do it when we have the actual hvos.
                flidString   = -1;
                ws           = LangProject.kwsFirstAnal;
                comboContent = ColumnConfigureDialog.WsComboContent.kwccBestAnalysis;
                break;                         // analysis, morpheme

            case kflidWordGloss:
                ws = m_wsDefAnal;
                break;                         // not morpheme-level

            case kflidWordPos:
                ws           = LangProject.kwsFirstAnal;
                flidString   = (int)CmPossibility.CmPossibilityTags.kflidAbbreviation;
                comboContent = ColumnConfigureDialog.WsComboContent.kwccBestAnalysis;
                break;                         // not morpheme-level

            case kflidFreeTrans:
            case kflidLitTrans:
                ws         = m_wsDefAnal;
                fWordLevel = false;
                break;

            case kflidNote:
                comboContent = ColumnConfigureDialog.WsComboContent.kwccVernAndAnal;
                ws           = m_wsDefAnal;
                fWordLevel   = false;
                break;

            default:
                throw new Exception("Adding unknown field to interlinear");
            }
            InterlinLineSpec spec = new InterlinLineSpec();

            spec.ComboContent  = comboContent;
            spec.Flid          = flid;
            spec.WritingSystem = wsRequested == 0 ? ws : wsRequested;
            spec.MorphemeLevel = fMorphemeLevel;
            spec.WordLevel     = fWordLevel;
            spec.StringFlid    = flidString;
            return(spec);
        }