protected override void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { m_cache.BeginUndoTask(LexTextControls.ksUndoInsertPhonologicalFeature, LexTextControls.ksRedoInsertPhonologicalFeature); int flid; int featureHvo; int fsysHvo = CreatePhonologicalfeature(out flid, out featureHvo); // create the two default feature values IFsSymFeatVal symFV = null; FsClosedFeature closed = m_selFeatDefn as FsClosedFeature; if (closed != null) { symFV = closed.ValuesOC.Add(new FsSymFeatVal()); symFV.SimpleInit("+", "positive"); symFV = closed.ValuesOC.Add(new FsSymFeatVal()); symFV.SimpleInit("-", "negative"); } // end create m_cache.EndUndoTask(); ForceRecordClerkToReload(fsysHvo, flid, featureHvo); DialogResult = DialogResult.Yes; Close(); }
private void AddNodeFromFS(IFsSymFeatVal val, FeatureTreeNode parentNode) { TreeNodeCollection col; if (parentNode == null) { col = Nodes; } else { col = parentNode.Nodes; } if (val == null) { return; // can't select it! } int hvoVal = val.Hvo; foreach (FeatureTreeNode node in col) { if (hvoVal == node.Hvo) { // already there (which is to be expected); mark it as selected node.ImageIndex = (int)ImageKind.radioSelected; node.SelectedImageIndex = (int)ImageKind.radioSelected; node.Chosen = true; return; } } // did not find the node, so add it (not to be expected, but we'd better deal with it) FeatureTreeNode newNode = new FeatureTreeNode(val.Name.AnalysisDefaultWritingSystem, (int)ImageKind.radio, (int)ImageKind.radio, val.Hvo, FeatureTreeNodeInfo.NodeKind.SymFeatValue); InsertNode(newNode, parentNode); newNode.Chosen = true; }
private void AddNode(IFsSymFeatVal val, FeatureTreeNode parentNode) { FeatureTreeNode newNode = new FeatureTreeNode(val.Name.BestAnalysisAlternative.Text, (int)ImageKind.radio, (int)ImageKind.radio, val.Hvo, FeatureTreeNodeInfo.NodeKind.SymFeatValue); InsertNode(newNode, parentNode); }
private void AddNode(IFsFeatureSpecification spec, FeatureTreeNode parentNode) { IFsFeatDefn defn = spec.FeatureRA; TreeNodeCollection col; if (parentNode == null) { col = Nodes; } else { col = parentNode.Nodes; } IFsClosedValue closed = spec as IFsClosedValue; if (closed != null) { foreach (FeatureTreeNode node in col) { if (defn.Hvo == node.Hvo) { // already there (which is to be expected); see if its value is, too AddNodeFromFS(closed.ValueRA, node); return; } } // did not find the node, so add it and its value (not to be expected, but we'd better deal with it) FeatureTreeNode newNode = new FeatureTreeNode(defn.Name.AnalysisDefaultWritingSystem, (int)ImageKind.feature, (int)ImageKind.feature, defn.Hvo, FeatureTreeNodeInfo.NodeKind.Closed); InsertNode(newNode, parentNode); IFsSymFeatVal val = closed.ValueRA; if (val != null) { FeatureTreeNode newValueNode = new FeatureTreeNode(val.Name.AnalysisDefaultWritingSystem, (int)ImageKind.radioSelected, (int)ImageKind.radioSelected, val.Hvo, FeatureTreeNodeInfo.NodeKind.SymFeatValue); newValueNode.Chosen = true; InsertNode(newValueNode, newNode); } } IFsComplexValue complex = spec as IFsComplexValue; if (complex != null) { foreach (FeatureTreeNode node in col) { if (defn.Hvo == node.Hvo) { // already there (which is to be expected); see if its value is, too AddNode((IFsFeatStruc)complex.ValueOA, node); return; } } // did not find the node, so add it and its value (not to be expected, but we'd better deal with it) FeatureTreeNode newNode = new FeatureTreeNode(defn.Name.AnalysisDefaultWritingSystem, (int)ImageKind.complex, (int)ImageKind.complex, defn.Hvo, FeatureTreeNodeInfo.NodeKind.Complex); InsertNode(newNode, parentNode); AddNode((IFsFeatStruc)complex.ValueOA, newNode); } }
/// <summary> /// Set description based on the content of the BasicIPASymbol field and the BasicIPAInfo document /// </summary> public void SetFeaturesBasedOnIPA() { var phoneme = (IPhPhoneme)m_obj; if (phoneme.BasicIPASymbol.Length > 0 && (m_justChangedFeatures || phoneme.FeaturesOA == null || phoneme.FeaturesOA.FeatureSpecsOC.Count == 0)) { // Mono XPath processing crashes when the expression starts out with // here. See FWNX-730. string sXPath = "/SegmentDefinitions/SegmentDefinition[Representations/Representation[.='" + XmlUtils.MakeSafeXmlAttribute(phoneme.BasicIPASymbol.Text) + "']]/Features"; XElement features = s_ipaInfoDocument.XPathSelectElement(sXPath); if (features != null) { bool fCreatedNewFS = false; foreach (XElement feature in features.Elements("FeatureValuePair")) { var sFeature = (string)feature.Attribute("feature"); var sValue = (string)feature.Attribute("value"); IFsFeatDefn featDefn = m_cache.LanguageProject.PhFeatureSystemOA.GetFeature(sFeature); if (featDefn == null) { continue; } IFsSymFeatVal symVal = m_cache.LanguageProject.PhFeatureSystemOA.GetSymbolicValue(sValue); if (symVal == null) { continue; } if (phoneme.FeaturesOA == null) { phoneme.FeaturesOA = m_cache.ServiceLocator.GetInstance <IFsFeatStrucFactory>().Create(); fCreatedNewFS = true; } IFsClosedValue value = m_cache.ServiceLocator.GetInstance <IFsClosedValueFactory>().Create(); phoneme.FeaturesOA.FeatureSpecsOC.Add(value); value.FeatureRA = featDefn; value.ValueRA = symVal; m_justChangedFeatures = true; } } } else if (phoneme.BasicIPASymbol.Length == 0 && m_justChangedFeatures) { if (phoneme.FeaturesOA != null) { // user has cleared the basic IPA symbol; clear the features phoneme.FeaturesOA.FeatureSpecsOC.Clear(); } m_justChangedFeatures = true; } else { m_justChangedFeatures = false; } }
private static string GetValueString(IFsSymFeatVal value) { string str = value.Abbreviation.BestAnalysisAlternative.Text; if (string.IsNullOrEmpty(str)) { str = value.Name.BestAnalysisAlternative.Text; } return(str); }
private static string GetFeatureString(IFsSymFeatVal value) { var feature = value.OwnerOfClass <IFsClosedFeature>(); string str = feature.Abbreviation.BestAnalysisAlternative.Text; if (string.IsNullOrEmpty(str)) { str = feature.Name.BestAnalysisAlternative.Text; } return(str); }
private IFsClosedFeature AddClosedFeature(IFsFeatureSystem featSys, string name, params string[] values) { IFsClosedFeature feat = Cache.ServiceLocator.GetInstance <IFsClosedFeatureFactory>().Create(); featSys.FeaturesOC.Add(feat); feat.Name.SetAnalysisDefaultWritingSystem(name); feat.Abbreviation.SetAnalysisDefaultWritingSystem(name); foreach (string value in values) { IFsSymFeatVal symbol = Cache.ServiceLocator.GetInstance <IFsSymFeatValFactory>().Create(); feat.ValuesOC.Add(symbol); symbol.Name.SetAnalysisDefaultWritingSystem(value); symbol.Abbreviation.SetAnalysisDefaultWritingSystem(value); } return(feat); }
private IFsFeatStruc GetTargetFsFeatStruc() { IFsFeatStruc fsTarget = null; var obj = Cache.ServiceLocator.GetInstance <ICmObjectRepository>().GetObject(SelectedHvo); if (obj is IFsFeatStruc) { fsTarget = (IFsFeatStruc)obj; } else if (obj is IFsSymFeatVal) { IFsSymFeatVal closedValue = (IFsSymFeatVal)obj; fsTarget = m_PhonologicalFeatureTreeManager.CreateEmptyFeatureStructureInAnnotation(obj); var fsClosedValue = Cache.ServiceLocator.GetInstance <IFsClosedValueFactory>().Create(); fsTarget.FeatureSpecsOC.Add(fsClosedValue); fsClosedValue.FeatureRA = (IFsFeatDefn)closedValue.Owner; fsClosedValue.ValueRA = closedValue; } return(fsTarget); }
private void PopulateValuesCombo() { int selIndex = m_bvList.SelectedIndex; if (selIndex < 0) { if (Controls.Contains(m_valuesCombo)) { Controls.Remove(m_valuesCombo); } return; } int hvoSel = m_bvList.AllItems[selIndex]; int[] values = m_cache.GetVectorProperty(hvoSel, (int)FsClosedFeature.FsClosedFeatureTags.kflidValues, false); m_valuesCombo.Items.Clear(); int comboSelectedIndex = -1; for (int i = 0; i < values.Length; i++) { int hvoValue = values[i]; IFsSymFeatVal val = FsSymFeatVal.CreateFromDBObject(m_cache, hvoValue, true) as IFsSymFeatVal; //int hvoSymfeatVal = m_cache.GetObjProperty(hvoValue, (int) FsClosedValue.FsClosedValueTags.kflidValue); if (val != null) { m_valuesCombo.Items.Add(val.Abbreviation.BestAnalysisAlternative); // try to set the selected item int hvoDummy = m_cache.GetObjProperty(hvoSel, m_flidDummyValue); if (hvoDummy == hvoValue) { comboSelectedIndex = m_valuesCombo.SelectedIndex = i; } } } m_valuesCombo.Items.Add(m_cache.MakeUserTss(MEStrings.ks_DontCare_)); if (comboSelectedIndex == -1) { m_valuesCombo.SelectedIndex = values.Length; } }
public SymbolicValue(IFsSymFeatVal value) { m_value = value; }
public ClosedFeatureValue(IFsSymFeatVal symbol, bool negate) { m_symbol = symbol; m_negate = negate; }
private void AddNodeFromFS(IFsSymFeatVal val, FeatureTreeNode parentNode) { TreeNodeCollection col; if (parentNode == null) col = Nodes; else col = parentNode.Nodes; if (val == null) return; // can't select it! int hvoVal = val.Hvo; foreach (FeatureTreeNode node in col) { if (hvoVal == node.Hvo) { // already there (which is to be expected); mark it as selected node.ImageIndex = (int)ImageKind.radioSelected; node.SelectedImageIndex = (int)ImageKind.radioSelected; node.Chosen = true; return; } } // did not find the node, so add it (not to be expected, but we'd better deal with it) FeatureTreeNode newNode = new FeatureTreeNode(val.Name.AnalysisDefaultWritingSystem.Text, (int)ImageKind.radio, (int)ImageKind.radio, val.Hvo, FeatureTreeNodeInfo.NodeKind.SymFeatValue); InsertNode(newNode, parentNode); newNode.Chosen = true; }
private static string GetFeatureString(IFsSymFeatVal value) { var feature = value.OwnerOfClass<IFsClosedFeature>(); string str = feature.Abbreviation.BestAnalysisAlternative.Text; if (string.IsNullOrEmpty(str)) str = feature.Name.BestAnalysisAlternative.Text; return str; }
private static string GetValueString(IFsSymFeatVal value) { string str = value.Abbreviation.BestAnalysisAlternative.Text; if (string.IsNullOrEmpty(str)) str = value.Name.BestAnalysisAlternative.Text; return str; }