/// <summary> /// Adds a rule to the rule list. /// </summary> /// <param name="rule"> /// A <see cref="SyntacticalRule"/> /// </param> private void AddRule(SyntacticalRule rule) { string [] parts = rule.ToString().Split(':'); TreeIter iter = synRulesModel.AppendValues(parts[0] + " :", parts[1], rule); synRulesTree.Selection.SelectIter(iter); synRulesTree.ScrollToCell(synRulesModel.GetPath(iter), synRulesTree.Columns[0], true, 0.5f, 0); }
/// <summary> /// Launches the rule editor dialog for the selected rule. /// </summary> /// <param name="sender"> /// A <see cref="System.Object"/> /// </param> /// <param name="args"> /// A <see cref="EventArgs"/> /// </param> private void OnSynRuleEditBtnClicked(object sender, EventArgs args) { SyntacticalRuleEditorDialog dialog = new SyntacticalRuleEditorDialog(this); TreeIter iter; synRulesTree.Selection.GetSelected(out iter); dialog.Rule = synRulesModel.GetValue(iter, 2) as SyntacticalRule; ResponseType res = dialog.Show(); if (res == ResponseType.Ok) { SyntacticalRule rule = dialog.Rule; string [] parts = rule.ToString().Split(':'); synRulesModel.SetValue(iter, 0, parts[0] + " :"); synRulesModel.SetValue(iter, 1, parts[1]); synRulesModel.SetValue(iter, 2, rule); } dialog.Destroy(); }