//methods public override ObjectLabel Execute() { IMoInflAffixSlot slot = new MoInflAffixSlot(); IPartOfSpeech pos = PartOfSpeech.CreateFromDBObject(m_cache, m_posHvo); pos.AffixSlotsOC.Add(slot); string sNewSlotName = m_mediator.StringTbl.GetString("NewSlotName", "Linguistics/Morphology/TemplateTable"); slot.Name.AnalysisDefaultWritingSystem = sNewSlotName; slot.Optional = m_fOptional; return(ObjectLabel.CreateObjectLabel(m_cache, slot.Hvo, "")); }
/// <summary> /// Reset the slot combo box. /// </summary> private void ResetSlotCombo() { m_fwcbSlots.SuspendLayout(); m_fwcbSlots.Items.Clear(); int matchIdx = -1; if (m_selectedMainPOSHvo > 0) { Set <int> hvoSlots = GetHvoSlots(); foreach (int slotID in hvoSlots) { IMoInflAffixSlot slot = MoInflAffixSlot.CreateFromDBObject(m_cache, slotID); string name = slot.Name.BestAnalysisAlternative.Text; if (name != null && name.Length > 0) // Don't add empty strings. { HvoTssComboItem newItem = new HvoTssComboItem(slotID, m_tsf.MakeString(name, m_cache.LangProject.DefaultAnalysisWritingSystem)); int idx = m_fwcbSlots.Items.Add(newItem); if (newItem.Hvo == m_selectedSlotHvo) { matchIdx = idx; } } } } if (matchIdx == -1) { m_fwcbSlots.SelectedIndex = -1; m_selectedSlotHvo = 0; // if the current proposed slot isn't possible for the POS, forget it. } else { try { m_skipEvents = true; m_fwcbSlots.SelectedIndex = matchIdx; } finally { m_skipEvents = false; } } m_fwcbSlots.Enabled = m_fwcbSlots.Items.Count > 0; m_lSLots.Enabled = m_fwcbSlots.Enabled; m_fwcbSlots.ResumeLayout(); }
protected void HandleSlotInfoForInflectionalMsa(IMoInflAffMsa inflMsa, XmlDocument doc, XmlNode inflMsaNode, XmlNode morphNode) { int slotHvo = 0; int iCount = inflMsa.SlotsRC.Count; if (iCount > 0) { if (iCount > 1) { // have a circumfix; assume only two slots and assume that the first is prefix and second is suffix // TODO: ideally would figure out if the slots are prefix or suffix slots and then align the // o and 1 indices to the appropriate slot. Will just do this for now (hab 2005.08.04). XmlNode attrType = morphNode.SelectSingleNode("@type"); if (attrType != null && attrType.InnerText != "sfx") { slotHvo = inflMsa.SlotsRC.HvoArray[0]; } else { slotHvo = inflMsa.SlotsRC.HvoArray[1]; } } else { slotHvo = inflMsa.SlotsRC.HvoArray[0]; } } CreateXmlAttribute(doc, "slot", slotHvo.ToString(), inflMsaNode); string sSlotOptional = "false"; string sSlotAbbr = "??"; if (slotHvo > 0) { MoInflAffixSlot slot = (MoInflAffixSlot)CmObject.CreateFromDBObject(this.m_cache, slotHvo); if (slot != null) { sSlotAbbr = slot.Name.BestAnalysisAlternative.Text; if (slot.Optional) { sSlotOptional = "true"; } } } CreateXmlAttribute(doc, "slotAbbr", sSlotAbbr, inflMsaNode); CreateXmlAttribute(doc, "slotOptional", sSlotOptional, inflMsaNode); }