Esempio n. 1
0
        public void tryAdd(Action<YAMMNode> continuous)
        {
            var ui = cast<UIMM>();
            var pt = ui.mRoot.transformAbs(new PointF(100, 0));
            UI.Instance.input((int)pt.X, (int)pt.Y, str =>
            {
                var node = new YAMMNode();
                node.setText(str);
                appendChild(node);

                if (continuous != null)
                {
                    continuous(node);
                }
            });
        }
Esempio n. 2
0
 public void attachChildrent(string text)
 {
     var c = new YAMMNode();
     c.setText(text);
     c.setParesent(this);
 }
Esempio n. 3
0
 public void setParesent(YAMMNode t)
 {
     treeNode tselfNode = cast<treeNode>();
     treeNode pNode = t.cast<treeNode>();
     tselfNode.setParesent(pNode);
 }
Esempio n. 4
0
 public void appendChild(YAMMNode node)
 {
     if (node == null) return;
     node.cast<UIMM>().mRoot.paresent = this.cast<UIMM>().mRoot.findByPath("subs");
     //生成连线
     var selfNode = cast<treeNode>();
     node.cast<treeNode>().setParesent(selfNode);
     selfNode.root().cast<UIMM>().rerangeChildren();
 }
Esempio n. 5
0
 public void setCurrent(YAMMNode node)
 {
     if (mCurrent != null) mCurrent.setChoose(false);
     mCurrent = node;
     if (mCurrent != null) mCurrent.setChoose(true);
 }
Esempio n. 6
0
        public void init()
        {
            mRoot = new YAMMRootNode();
            var node = mRoot.cast<YAMMNode>();

            mCurrent = node;
            node.setText("main_topic");

            var ui = mRoot.cast<UIMM>();
            ui.mRoot.evtOnChar += (self, k, isC, isS) =>
                {
                    Console.WriteLine(k +" is pressed");
                    if (k == 45/*insert*/)
                    {
                        mCurrent.tryAdd(delegate(YAMMNode n) {
                            setCurrent(n);
                        });

                    }
                    if (k == 46/*del*/)
                    {
                        if(mCurrent.cast<YAMMRootNode>() == null)
                            deleteNode(mCurrent);
                    }
                    else if (k == 37/*left*/)
                    {
                        var p = mCurrent.cast<treeNode>().mParesent;
                        if(p != null)
                        {
                            node = p.cast<YAMMNode>();
                            setCurrent(node);
                        }

                    }
                    else if (k == 39/*right*/)
                    {
                        var f = mCurrent.cast<treeNode>().firstChild();
                        if (f != null)
                        {
                            mCurrent.cast<YAMMNode>().open(true);
                            node = f.cast<YAMMNode>();
                            setCurrent(node);
                        }
                    }
                    else if (k == 38/*up*/)
                    {
                        var p = mCurrent.cast<treeNode>().pre();
                        if (p != null)
                        {
                            node = p.cast<YAMMNode>();
                            setCurrent(node);
                        }
                    }
                    else if (k == 40/*down*/)
                    {
                        var n = mCurrent.cast<treeNode>().next();
                        if (n != null)
                        {
                            node = n.cast<YAMMNode>();
                            setCurrent(node);
                        }
                    }
                    UI.Instance.flush();
                    return false;
                };
        }
Esempio n. 7
0
 public void deleteNode(YAMMNode node)
 {
     node.cast<treeNode>().setParesent(null);
     node.cast<UIMM>().breakLink();
     YAMM.Instance.mRoot.cast<UIMM>().rerangeChildren();
     UI.Instance.flush();
 }
Esempio n. 8
0
        public YAMMNode addNode(string name)
        {
            var node = new YAMMNode();
            node.setText(name);
            mCurrent.appendChild(node);

            return node;
        }