Beispiel #1
0
        protected override void InternalGenerate()
        {
            IColor clrBlack = AppHost.GfxProvider.CreateColor(0x000000);

            fTitleFont = fWriter.CreateFont("", 14f, true, false, clrBlack);
            fChapFont  = fWriter.CreateFont("", 12f, true, false, clrBlack);
            fTextFont  = fWriter.CreateFont("", 10f, false, false, clrBlack);

            //fWriter.AddParagraph(fTitle, fTitleFont, TextAlignment.taLeft);
            fWriter.AddParagraph(GKUtils.GetNameString(fPerson, true, false), fTitleFont, TextAlignment.taLeft);
            fWriter.NewLine();

            IBaseContext baseContext = fBase.Context;

            var evList = new List <PersonalEvent>();

            GDMIndividualRecord father = null, mother = null;
            GDMFamilyRecord     parFamily = baseContext.Tree.GetParentsFamily(fPerson);

            if (parFamily != null && baseContext.IsRecordAccess(parFamily.Restriction))
            {
                baseContext.Tree.GetSpouses(parFamily, out father, out mother);
            }

            ExtractEvents(EventType.Personal, evList, fPerson);

            int num2 = fPerson.SpouseToFamilyLinks.Count;

            for (int j = 0; j < num2; j++)
            {
                GDMFamilyRecord family = baseContext.Tree.GetPtrValue(fPerson.SpouseToFamilyLinks[j]);
                if (!baseContext.IsRecordAccess(family.Restriction))
                {
                    continue;
                }

                ExtractEvents(EventType.Spouse, evList, family);

                int num3 = family.Children.Count;
                for (int i = 0; i < num3; i++)
                {
                    GDMIndividualRecord child = baseContext.Tree.GetPtrValue(family.Children[i]);
                    GDMCustomEvent      evt   = child.FindEvent(GEDCOMTagType.BIRT);
                    if (evt != null && evt.GetChronologicalYear() != 0)
                    {
                        evList.Add(new PersonalEvent(EventType.Child, child, evt));
                    }
                }
            }

            SortHelper.QuickSort(evList, EventsCompare);
            fWriter.BeginList();

            int num4 = evList.Count;

            for (int i = 0; i < num4; i++)
            {
                PersonalEvent evObj = evList[i];
                if (!evObj.Date.HasKnownYear())
                {
                    continue;
                }

                GDMCustomEvent evt = evObj.Event;
                string         st  = GKUtils.GetEventName(evt);
                string         dt  = GKUtils.GEDCOMEventToDateStr(evt, GlobalOptions.Instance.DefDateFormat, false);

                if (ShowAges)
                {
                    int year = evt.GetChronologicalYear();
                    int age  = (evObj.Rec == fPerson) ? GKUtils.GetAge(fPerson, year) : -1;
                    if (age >= 0)
                    {
                        dt += string.Format(" ({0})", age);
                    }
                }

                string li = dt + ": " + st + ".";
                if (evt.HasPlace && evt.Place.StringValue != "")
                {
                    li = li + " " + LangMan.LS(LSID.LSID_Place) + ": " + evt.Place.StringValue;
                }
                fWriter.AddListItem("   " + li, fTextFont);

                if (evObj.Rec is GDMIndividualRecord)
                {
                    GDMIndividualRecord iRec = (GDMIndividualRecord)evObj.Rec;

                    if (evt.GetTagType() == GEDCOMTagType.BIRT)
                    {
                        if (evObj.Type == EventType.Personal)
                        {
                            if (father != null)
                            {
                                fWriter.AddListItem("   " + "   " + LangMan.LS(LSID.LSID_Father) + ": " + GKUtils.GetNameString(father, true, false) + " ", fTextFont);
                            }
                            if (mother != null)
                            {
                                fWriter.AddListItem("   " + "   " + LangMan.LS(LSID.LSID_Mother) + ": " + GKUtils.GetNameString(mother, true, false) + " ", fTextFont);
                            }
                        }
                        else if (evObj.Type == EventType.Child)
                        {
                            if (iRec.Sex == GDMSex.svMale)
                            {
                                st = LangMan.LS(LSID.LSID_RK_Son) + ": ";
                            }
                            else
                            {
                                st = LangMan.LS(LSID.LSID_RK_Daughter) + ": ";
                            }
                            st = ConvertHelper.UniformName(st) + GKUtils.GetNameString(iRec, true, false);
                            fWriter.AddListItem("   " + "   " + st, fTextFont);
                        }
                    }
                }
                else if (evObj.Rec is GDMFamilyRecord)
                {
                    GDMFamilyRecord famRec = (GDMFamilyRecord)evObj.Rec;

                    GDMIndividualRecord sp;
                    string unk;
                    if (fPerson.Sex == GDMSex.svMale)
                    {
                        sp  = baseContext.Tree.GetPtrValue(famRec.Wife);
                        st  = LangMan.LS(LSID.LSID_Wife) + ": ";
                        unk = LangMan.LS(LSID.LSID_UnkFemale);
                    }
                    else
                    {
                        sp  = baseContext.Tree.GetPtrValue(famRec.Husband);
                        st  = LangMan.LS(LSID.LSID_Husband) + ": ";
                        unk = LangMan.LS(LSID.LSID_UnkMale);
                    }

                    string sps;
                    if (sp != null)
                    {
                        sps = st + GKUtils.GetNameString(sp, true, false) /* + GKUtils.GetPedigreeLifeStr(sp, fOptions.PedigreeOptions.Format)*/;
                    }
                    else
                    {
                        sps = st + unk;
                    }
                    fWriter.AddListItem("   " + "   " + sps, fTextFont);
                }
            }

            fWriter.EndList();
        }