private ColumnConfigureDialog CreateColumnConfigureDialog() { // Create window and populate currentColumns with a few items. string currentColumns_data = "<root><column layout=\"EntryHeadwordForEntry\" label=\"Headword\" ws=\"$ws=vernacular\" width=\"72000\" sortmethod=\"FullSortKey\" cansortbylength=\"true\" visibility=\"always\" /><column layout=\"LexemeFormForEntry\" label=\"Lexeme Form\" common=\"true\" width=\"72000\" ws=\"$ws=vernacular\" sortmethod=\"MorphSortKey\" cansortbylength=\"true\" visibility=\"always\" transduce=\"LexEntry.LexemeForm.Form\" transduceCreateClass=\"MoStemAllomorph\" /><column layout=\"GlossesForSense\" label=\"Glosses\" multipara=\"true\" width=\"72000\" ws=\"$ws=analysis\" transduce=\"LexSense.Gloss\" cansortbylength=\"true\" visibility=\"always\" /><column layout=\"GrammaticalInfoFullForSense\" headerlabel=\"Grammatical Info.\" chooserFilter=\"external\" label=\"Grammatical Info. (Full)\" multipara=\"true\" width=\"72000\" visibility=\"always\"><dynamicloaderinfo assemblyPath=\"FdoUi.dll\" class=\"SIL.FieldWorks.FdoUi.PosFilter\" /></column></root>"; XmlDocument currentColumns_document = new XmlDocument(); currentColumns_document.LoadXml(currentColumns_data); List<XmlNode> currentColumns = currentColumns_document.FirstChild.ChildNodes.Cast<XmlNode>().ToList(); List<XmlNode> possibleColumns = new List<XmlNode>(); ColumnConfigureDialog window = new ColumnConfigureDialog(possibleColumns, currentColumns, m_mediator, m_mediator.StringTbl); window.FinishInitialization(); return window; }
private ColumnConfigureDialog CreateColumnConfigureDialog(string currentColumnsData, string possibleColumnsData) { // Create window and populate currentColumns with a few items. var currentColumns_document = new XmlDocument(); currentColumns_document.LoadXml(currentColumnsData); List <XmlNode> currentColumns = currentColumns_document.FirstChild.ChildNodes.Cast <XmlNode>().ToList(); var possibleColumns_document = new XmlDocument(); possibleColumns_document.LoadXml(possibleColumnsData); List <XmlNode> possibleColumns = possibleColumns_document.FirstChild.ChildNodes.Cast <XmlNode>().ToList(); ColumnConfigureDialog window = new ColumnConfigureDialog(possibleColumns, currentColumns, m_propertyTable); window.FinishInitialization(); return(window); }
private ColumnConfigureDialog CreateColumnConfigureDialog() { // Create window and populate currentColumns with a few items. string currentColumns_data = "<root><column layout=\"EntryHeadwordForEntry\" label=\"Headword\" ws=\"$ws=vernacular\" width=\"72000\" sortmethod=\"FullSortKey\" cansortbylength=\"true\" visibility=\"always\" /><column layout=\"LexemeFormForEntry\" label=\"Lexeme Form\" common=\"true\" width=\"72000\" ws=\"$ws=vernacular\" sortmethod=\"MorphSortKey\" cansortbylength=\"true\" visibility=\"always\" transduce=\"LexEntry.LexemeForm.Form\" transduceCreateClass=\"MoStemAllomorph\" /><column layout=\"GlossesForSense\" label=\"Glosses\" multipara=\"true\" width=\"72000\" ws=\"$ws=analysis\" transduce=\"LexSense.Gloss\" cansortbylength=\"true\" visibility=\"always\" /><column layout=\"GrammaticalInfoFullForSense\" headerlabel=\"Grammatical Info.\" chooserFilter=\"external\" label=\"Grammatical Info. (Full)\" multipara=\"true\" width=\"72000\" visibility=\"always\"><dynamicloaderinfo assemblyPath=\"FdoUi.dll\" class=\"SIL.FieldWorks.FdoUi.PosFilter\" /></column></root>"; XmlDocument currentColumns_document = new XmlDocument(); currentColumns_document.LoadXml(currentColumns_data); List <XmlNode> currentColumns = currentColumns_document.FirstChild.ChildNodes.Cast <XmlNode>().ToList(); List <XmlNode> possibleColumns = new List <XmlNode>(); ColumnConfigureDialog window = new ColumnConfigureDialog(possibleColumns, currentColumns, m_mediator, m_mediator.StringTbl); window.FinishInitialization(); return(window); }
/// <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. /// /// This version is visible to InterlinDocRootSiteBase for its context menu. /// </summary> /// <param name="cachedBoxes"></param> /// <param name="comboContent"></param> /// <param name="cache"></param> /// <param name="owner"></param> /// <returns></returns> internal static ComboBox.ObjectCollection WsComboItemsInternal(FdoCache cache, ComboBox owner, Dictionary<ColumnConfigureDialog.WsComboContent, ComboBox.ObjectCollection> cachedBoxes, ColumnConfigureDialog.WsComboContent comboContent) { ComboBox.ObjectCollection objectCollection; if (!cachedBoxes.ContainsKey(comboContent)) { objectCollection = new ComboBox.ObjectCollection(owner); // 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(cache, objectCollection, comboContent, comboContent != ColumnConfigureDialog.WsComboContent.kwccBestAnalysis); cachedBoxes[comboContent] = objectCollection; } else { objectCollection = cachedBoxes[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); }
/// <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); }