Beispiel #1
0
 /// <summary>
 /// Gibt Lautwandel aus.
 /// </summary>
 /// <returns>The sound change.</returns>
 public void PrintSoundChange(SoundChangeRule scr, Wordform wf2, MainWindow win_)
 {
     Functions.reflex = new Wordform(wf2.CloneWfObjectExtensions());
     win_.AddToTextView(scr, wf2.lastChanges, wf2.MultiPathNum);
     win_.AddToTextView(wf2, true, "", "Honeydew", "", "lang1");
     wf2.multiPathNum = 0;
 }
Beispiel #2
0
        public Wordform CallCheckRuleAndHandleDependencies(SoundChangeRule scr, Wordform wf, MainWindow win_, int?stPosPhon, int?stPosGraph,
                                                           bool removeAppliedRules, bool otherChanges, List <SoundChangeRule> sortedRuleList)
        {
            Wordform wf2 = scr.CheckRule(wf, win_, stPosPhon, stPosGraph, otherChanges);

            if (wf2 != null)
            {
                if (otherChanges == false)
                {
                    if (wf2.printRule == null)
                    {
                        PrintSoundChange(scr, wf2, win_);
                    }
                    else
                    {
                        PrintSoundChange(wf2.printRule, wf2, win_);
                        wf2.printRule = null;
                    }
                }

                if (wf2.repeatRules.Count != 0 && wf2.repeatRules.Last() == scr.Id)
                {
                    wf2.repeatRules.RemoveAt(wf2.repeatRules.Count - 1);

                    Wordform wf3 = CallCheckRuleAndHandleDependencies(scr, wf2, win_, stPosPhon, stPosGraph, removeAppliedRules, otherChanges,
                                                                      sortedRuleList);
                    if (wf3 != null)
                    {
                        return(wf3);
                    }
                }
                sortedRuleList.Remove(scr);
                sortedRuleList.RemoveAll(x => x.EndDate < wf2.time);
                Wordform wf4 = wf2.ChangeSound(win_, 0, 0, true, otherChanges, sortedRuleList);

                if ((otherChanges == true) && (wf4 != null))
                {
                    return(wf4);
                }
                else
                {
                    return(wf2);
                }
            }
            return(null);
        }
Beispiel #3
0
        /// <summary>
        /// SoundChangeRule zum TextView hinzufügen.
        /// </summary>
        public void AddToTextView(SoundChangeRule scr, List <Change> lastChanges, int multiPathNum)
        {
            TreePath path;

            Gtk.TreeIter iter;

            /* MultiPath */
            if (multiPathNum != 0)
            {
                MyTreeNode multiPathNode = new MyTreeNode("", "\u2502 (" + Functions.ToRoman(multiPathNum) + ")", "", "");
                multiPathNode.color     = "Honeydew";
                multiPathNode.inputBold = 600;
                multiPathNode.inputSize = Convert.ToInt32(10 * Pango.Scale.PangoScale);
                iter = treeStore.AppendValues(multiPathNode);
                path = treeStore.GetPath(iter);
                tree.ScrollToCell(path, null, true, 0, 0);
            }

            /* Id + Name = IterNode */
            List <String> idName = scr.PrintShort();

            MyTreeNode idNameNode = new MyTreeNode(idName.ElementAt(0), Functions.SpliceText(idName.ElementAt(1), 20, @"\s"),
                                                   Functions.SpliceText(idName.ElementAt(2), 50, @","),
                                                   Functions.SpliceText(idName.ElementAt(3), 60, @"\s"));

            idNameNode.color = "Honeydew";
            iter             = treeStore.AppendValues(idNameNode);
            path             = treeStore.GetPath(iter);
            tree.ScrollToCell(path, null, true, 0, 0);

            /* Attribute */
            bool grey = false;

            List <List <String> > printList = scr.Print(lastChanges);

            foreach (List <string> line in printList)
            {
                MyTreeNode node = new MyTreeNode(line.ElementAt(0), Functions.SpliceText(line.ElementAt(1), 20, @"\s"),
                                                 Functions.SpliceText(line.ElementAt(2), 50, @","),
                                                 Functions.SpliceText(line.ElementAt(3), 60, @"\s"));
                if (grey == false)
                {
                    node.color = "white";
                    grey       = true;
                }
                else
                {
                    node.color = "Gray98";
                    grey       = false;
                }
                treeStore.AppendValues(iter, node);
                path = treeStore.GetPath(iter);
                tree.ScrollToCell(path, null, true, 0, 0);
            }

            /* Pfeilspitze */
            MyTreeNode arrowNode = new MyTreeNode("", "\u25bc", "", "");

            arrowNode.color = "Honeydew";
            iter            = treeStore.AppendValues(arrowNode);
            path            = treeStore.GetPath(iter);
            tree.ScrollToCell(path, null, true, 0, 0);

            while (Application.EventsPending())
            {
                Application.RunIteration();
            }
        }
Beispiel #4
0
 /// <summary>
 /// Kopierkonstruktor mit tiefer Kopie.
 /// </summary>
 public Wordform(Wordform wf)
 {
     this.word = new List <Sign>(Functions.DeepClone(wf.Word));
     if (wf.Lemma != null)
     {
         this.lemma = new List <Sign>(Functions.DeepClone(wf.Lemma));
     }
     if (wf.Phonetic != null)
     {
         this.phonetic = new List <Sign>(Functions.DeepClone(wf.Phonetic));
     }
     if (!String.IsNullOrEmpty(wf.Pos))
     {
         this.pos = wf.Pos;
     }
     if (!String.IsNullOrEmpty(wf.Cat))
     {
         this.cat = wf.Cat;
     }
     if (!String.IsNullOrEmpty(wf.Tbl))
     {
         this.tbl = wf.Tbl;
     }
     if (!String.IsNullOrEmpty(wf.Lang))
     {
         this.lang = wf.Lang;
     }
     if (wf.Syllables != null)
     {
         this.syllables = wf.Syllables;
     }
     this.syllNum = wf.SyllNum;
     if (wf.Time != null)
     {
         this.time = wf.Time;
     }
     if (wf.Additional != null)
     {
         this.additional = new Dictionary <string, string>(wf.Additional);
     }
     if (wf.MappingList != null)
     {
         this.mappingList = new List <SignMapping>(wf.MappingList);
     }
     // Vorsicht: flache Kopie:
     if (wf.PrintRule != null)
     {
         this.printRule = wf.PrintRule;
     }
     if (wf.lastChanges != null)
     {
         this.lastChanges = new List <Change>(Functions.DeepClone(wf.lastChanges));
     }
     if (wf.Suffix != null)
     {
         this.suffix = Functions.DeepClone(wf.Suffix);
     }
     if (wf.SuffixPos != null)
     {
         this.suffixPos = Functions.DeepClone(wf.SuffixPos);
     }
     this.multiPathNum = wf.multiPathNum;
 }