Beispiel #1
0
        //-------------------------------------------------------------------
        public void AddFatherAll(TaxonTreeNode _taxon)
        {
            if (_taxon == null)
            {
                return;
            }
            TaxonDialog.NewTaxon dlg = new TaxonDialog.NewTaxon
            {
                TopMost        = true,
                CheckNameUsage = true
            };
            dlg.ShowDialog();
            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            TaxonDesc     newTaxon = new TaxonDesc(dlg.TaxonName);
            TaxonTreeNode newNode  = new TaxonTreeNode(newTaxon);

            TaxonTreeNode OldFather = _taxon.Father;

            foreach (TaxonTreeNode child in OldFather.Children)
            {
                newNode.AddChild(child);
            }

            OldFather.Children.Clear();
            OldFather.AddChild(newNode);

            OldFather.Expand();
            newNode.Expand();
            RefreshGraph();
        }
Beispiel #2
0
        //-------------------------------------------------------------------
        public void AddFather(TaxonTreeNode _taxon)
        {
            if (_taxon == null)
            {
                return;
            }
            TaxonDialog.NewTaxon dlg = new TaxonDialog.NewTaxon
            {
                TopMost        = true,
                CheckNameUsage = true
            };
            dlg.ShowDialog();
            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            TaxonDesc     newTaxon = new TaxonDesc(dlg.TaxonName);
            TaxonTreeNode newNode  = new TaxonTreeNode(newTaxon);

            TaxonTreeNode OldFather = _taxon.Father;

            OldFather.ReplaceChild(_taxon, newNode);
            newNode.AddChild(_taxon);
            OldFather.Expand();
            newNode.Expand();
            RefreshGraph();
        }
Beispiel #3
0
        //-------------------------------------------------------------------
        public void AddChild(TaxonTreeNode _taxon)
        {
            if (_taxon == null)
            {
                return;
            }

            string firstName = null;

            if (_taxon.Desc.ClassicRank == ClassicRankEnum.Genre)
            {
                firstName = _taxon.Desc.RefMainName;
            }
            TaxonDialog.NewTaxon dlg = new TaxonDialog.NewTaxon(firstName)
            {
                TopMost        = true,
                CheckNameUsage = true
            };
            dlg.ShowDialog();
            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            TaxonDesc newTaxon = new TaxonDesc(dlg.TaxonName);

            if (_taxon.Desc.ClassicRank == ClassicRankEnum.Genre)
            {
                newTaxon.ClassicRank = ClassicRankEnum.Espece;
            }
            else if (_taxon.Desc.ClassicRank == ClassicRankEnum.Espece)
            {
                newTaxon.ClassicRank = ClassicRankEnum.SousEspece;
            }

            TaxonTreeNode newNode = new TaxonTreeNode(newTaxon);

            _taxon.AddChild(newNode);
            _taxon.SortChildren();
            _taxon.Expand();
            RefreshGraph();
        }
Beispiel #4
0
        //-------------------------------------------------------------------
        public void AddSiblingAbove(TaxonTreeNode _taxon)
        {
            if (_taxon == null)
            {
                return;
            }
            string firstName = null;

            if (_taxon.Desc.ClassicRank == ClassicRankEnum.Espece)
            {
                string[] parts = _taxon.Desc.RefMainName.Split(' ');
                if (parts.Length >= 2)
                {
                    firstName = parts[0];
                }
            }
            NewTaxon dlg = new TaxonDialog.NewTaxon(firstName)
            {
                TopMost        = true,
                CheckNameUsage = true
            };

            dlg.ShowDialog();
            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            TaxonDesc newTaxon = new TaxonDesc(dlg.TaxonName)
            {
                ClassicRank = _taxon.Desc.ClassicRank
            };

            TaxonTreeNode newNode = new TaxonTreeNode(newTaxon);

            _taxon.AddSiblingBefore(newNode);
            _taxon.Father.Expand();
            RefreshGraph();
        }
Beispiel #5
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TaxonDialog.NewTaxon dlg = new TaxonDialog.NewTaxon(null)
            {
                TopMost        = true,
                CheckNameUsage = true
            };
            dlg.ShowDialog();
            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            TaxonDesc desc = new TaxonDesc(dlg.TaxonName);

            TaxonTreeNode root = new TaxonTreeNode(desc);

            TaxonUtils.SetOriginalRoot(root);
            TaxonUtils.MyConfig.TaxonFileName = "";
            TaxonUtils.MyConfig.saved         = false;
            TaxonUtils.MainGraph.Root         = root;
            TaxonUtils.MainGraph.ResetView();
        }