예제 #1
0
        public bool SetLayout(TreeViewLayout layout, IndividualButton parentButton)
        {
            if (Visible)
            {
                return(true);
            }

            if (this.parentButton == null)
            {
                this.parentButton = parentButton;
            }
            if (this.parentButton != null)
            {
                ButtonLayout parentButtonLayout = this.parentButton.bLayout;
                if (!layout.AddChildFamilyButton(parentButtonLayout, bLayout))
                {
                    trace.TraceInformation("SetLayout()-family" + xref + " " + bLayout.generation + " abort, max gen ");
                    return(false);
                }

                SetPosition(bLayout.position);
                Size = bLayout.size;
                trace.TraceInformation("SetLayout()-family:" + xref + " " + bLayout.generation + " " + bLayout.position + " " + bLayout.size);
                this.Visible = true;
                return(true);
            }
            return(false);
        }
예제 #2
0
        public bool SetLayout(TreeViewLayout layout, FamilyButton parentButton)
        {
            if (Visible)
            {
                return(true);
            }

            if (this.parentButton == null)
            {
                this.parentButton = parentButton;
            }
            ButtonLayout parentLayout = null;

            if (parentButton != null)
            {
                parentLayout = parentButton.bLayout;
            }

            if (!layout.AddChildPersonButton(parentLayout, bLayout))
            {
                trace.TraceData(TraceEventType.Error, 0, "warning: AddChildPersonButton failed!");
                return(false);
            }
            SetPosition(bLayout.position);
            Size = bLayout.size;
            trace.TraceInformation("SetLayout()-person:" + xref + " " + bLayout.generation + " " + bLayout.position + " " + bLayout.size);
            this.Visible = true;
            return(true);
        }
예제 #3
0
        public FamilyButton(string xref, FamilyClass family = null)
        {
            Visible     = false;
            this.family = family;
            this.xref   = xref;
            bLayout     = new ButtonLayout();

            FlatStyle = FlatStyle.Flat;
            Anchor    = AnchorStyles.Left | AnchorStyles.Top;
            Click    += new System.EventHandler(Clicked);
            details   = new ToolTip();
            UpdateData();

            ClearLayout();
        }
예제 #4
0
        public IndividualButton(string xref, IndividualClass individual = null)
        {
            Visible         = false;
            this.xref       = xref;
            this.individual = individual;
            bLayout         = new ButtonLayout();

            FlatStyle     = FlatStyle.Flat;
            Anchor        = AnchorStyles.Left | AnchorStyles.Top;
            Click        += new System.EventHandler(Clicked);
            this.MouseUp += IndividualButton_MouseUp;

            details = new ToolTip();
            UpdateData();
            ClearLayout();
        }
예제 #5
0
        public bool AddChildFamilyButton(ButtonLayout parentButtonLayout, ButtonLayout bLayout)
        {
            Point retPoint = new Point();
            int   genDiff  = this.maxGenerations - parentButtonLayout.generation;

            Point parentPosition = parentButtonLayout.position;

            retPoint.Offset(parentPosition);
            retPoint.Offset(familyOffset);
            parentButtonLayout.childNo++;
            bLayout.generation = parentButtonLayout.generation;
            bLayout.size       = this.familySize;
            bLayout.position   = retPoint;
            if (parentButtonLayout.generation < 2)
            {
                bLayout.position.Y += this.personSize.Height / 2;
            }
            trace.TraceInformation("AddChildFamilyButton()g:" + bLayout.generation + " " + parentButtonLayout.childNo + " " + parentPosition + " " + retPoint);
            return(true);
        }
예제 #6
0
        public bool AddChildPersonButton(ButtonLayout parentButtonLayout, ButtonLayout bLayout)
        {
            Point retPoint = new Point();

            if (parentButtonLayout != null)
            {
                int genOffset = (this.maxGenerations - parentButtonLayout.generation);

                if (genOffset < 0)
                {
                    return(false);
                }
                double yOffset = Math.Pow(2, genOffset - 2) * (2 * parentButtonLayout.childNo - 1) * this.personSize.Height;

                Point parentPosition = parentButtonLayout.position;
                retPoint.Offset(parentPosition);
                retPoint.Offset(personOffset);
                retPoint.Y        += (int)yOffset - this.familyOffset.Y;
                bLayout.generation = parentButtonLayout.generation + 1;
                trace.TraceInformation("AddChildPersonButton()g:" + bLayout.generation + " ch:" + parentButtonLayout.childNo + " pos:" + parentPosition + " yOffset:" + yOffset + "=>" + retPoint);
                parentButtonLayout.childNo++;
            }
            else
            {
                double startY = Math.Pow(2, this.maxGenerations - 1) * this.personSize.Height;
                retPoint.Offset(startPersonPosition);
                retPoint.Y += (int)startY;
                trace.TraceInformation("AddChildPersonButton()root:" + bLayout.generation + "=>" + retPoint);
                bLayout.generation = 0;
            }
            bLayout.size     = this.personSize;
            bLayout.position = retPoint;
            if ((parentButtonLayout == null) || ((parentButtonLayout != null) && (parentButtonLayout.generation == 0)))
            {
                bLayout.position.Y -= bLayout.size.Height / 2;
                bLayout.size.Height = bLayout.size.Height * 2;
            }
            return(true);
        }
예제 #7
0
 public bool VisibleButton(ButtonLayout bLayout)
 {
     return(bLayout.generation < this.maxGenerations);
 }