Example #1
0
        public void Assign(IOptions source)
        {
            PedigreeOptions srcOptions = source as PedigreeOptions;

            if (srcOptions == null)
            {
                return;
            }

            Format             = srcOptions.Format;
            IncludeAttributes  = srcOptions.IncludeAttributes;
            IncludeNotes       = srcOptions.IncludeNotes;
            IncludeSources     = srcOptions.IncludeSources;
            IncludeGenerations = srcOptions.IncludeGenerations;
        }
Example #2
0
        public bool Generate(CustomWriter writer)
        {
            bool result = false;

            fFormat = fOptions.PedigreeOptions.Format;

            try
            {
                fWriter = writer;
                fWriter.SetAlbumPage(false);
                fTitle = LangMan.LS(LSID.LSID_ExpPedigree) + ": " + GKUtils.GetNameString(fRoot, true, false);
                fWriter.SetDocumentTitle(fTitle);
                fWriter.SetFileName(fPath);

                IColor clrBlack = AppHost.GfxProvider.CreateColor(0x000000);
                IColor clrBlue  = AppHost.GfxProvider.CreateColor(0x0000FF);

                fWriter.beginWrite();
                try
                {
                    fTitleFont  = fWriter.CreateFont("", 16f /*20f*/, true, false, clrBlack);
                    fChapFont   = fWriter.CreateFont("", 14f /*16f*/, true, false, clrBlack);
                    fPersonFont = fWriter.CreateFont("", 12f /*10f*/, true, false, clrBlack);
                    fLinkFont   = fWriter.CreateFont("", 10f /*8f*/, false, true, clrBlue);
                    fTextFont   = fWriter.CreateFont("", 10f /*8f*/, false, false, clrBlack);
                    fSupText    = fWriter.CreateFont("", ((fWriter is RTFWriter) ? 12f : 5f) /*5f*/, false, false, clrBlue);

                    InternalGenerate();
                    result = true;
                }
                finally
                {
                    fWriter.endWrite();
                }
            }
            catch (Exception ex)
            {
                Logger.LogWrite("PedigreeExporter.Generate(): " + ex.Message);
                Logger.LogWrite("PedigreeExporter.Generate(): " + ex.StackTrace);
            }

            return(result);
        }
Example #3
0
        public void LoadFromFile(IniFile iniFile)
        {
            if (iniFile == null)
            {
                throw new ArgumentNullException("iniFile");
            }

            try
            {
                Format             = (PedigreeFormat)iniFile.ReadInteger("Pedigree", "Format", 0);
                IncludeAttributes  = iniFile.ReadBool("Pedigree", "IncludeAttributes", true);
                IncludeNotes       = iniFile.ReadBool("Pedigree", "IncludeNotes", true);
                IncludeSources     = iniFile.ReadBool("Pedigree", "IncludeSources", true);
                IncludeGenerations = iniFile.ReadBool("Pedigree", "IncludeGenerations", true);
            }
            catch (Exception)
            {
                throw new EPedigreeOptionsException("Error loading PedigreeOptions");
            }
        }
Example #4
0
        protected override void InternalGenerate()
        {
            bool isRtf = false;

#if !NETSTANDARD
            isRtf = (fWriter is RTFWriter);
#endif

            IColor clrBlack = AppHost.GfxProvider.CreateColor(0x000000);
            IColor clrBlue  = AppHost.GfxProvider.CreateColor(0x0000FF);

            fTitleFont  = fWriter.CreateFont("", 16f /*20f*/, true, false, clrBlack);
            fChapFont   = fWriter.CreateFont("", 14f /*16f*/, true, false, clrBlack);
            fPersonFont = fWriter.CreateFont("", 12f /*10f*/, true, false, clrBlack);
            fLinkFont   = fWriter.CreateFont("", 10f /*8f*/, false, true, clrBlue);
            fTextFont   = fWriter.CreateFont("", 10f /*8f*/, false, false, clrBlack);
            fSupText    = fWriter.CreateFont("", (isRtf ? 12f : 5f) /*5f*/, false, false, clrBlue);

            fFormat = fOptions.PedigreeOptions.Format;

            bool includeGens = fOptions.PedigreeOptions.IncludeGenerations;

            fWriter.AddParagraph(fTitle, fTitleFont, TextAlignment.taCenter);

            fPersonList = new ExtList <PedigreePerson>(true);
            fSourceList = new StringList();
            try {
                GenStep(null, fRoot, 1, 1);
                ReIndex();

                int curLevel = 0;
                int num      = fPersonList.Count;
                for (int i = 0; i < num; i++)
                {
                    PedigreePerson person = fPersonList[i];

                    if (includeGens && curLevel != person.Level)
                    {
                        curLevel = person.Level;
                        string genTitle = LangMan.LS(LSID.LSID_Generation) + " " + ConvertHelper.GetRome(curLevel);

                        fWriter.BeginParagraph(TextAlignment.taLeft, 12f, 6f);
                        fWriter.AddParagraphChunk(genTitle, fChapFont);
                        fWriter.EndParagraph();
                    }

                    WritePerson(person);
                }

                if (fSourceList.Count > 0)
                {
                    fWriter.BeginParagraph(TextAlignment.taCenter, 12f, 6f);
                    fWriter.AddParagraphChunk(LangMan.LS(LSID.LSID_RPSources), fChapFont);
                    fWriter.EndParagraph();

                    int num2 = fSourceList.Count;
                    for (int j = 0; j < num2; j++)
                    {
                        string sn   = (j + 1).ToString();
                        string sst  = sn + ". " + fSourceList[j];
                        string sanc = "src_" + sn;

                        fWriter.AddParagraphAnchor(sst, fTextFont, sanc);
                    }
                }
            } finally {
                fSourceList.Dispose();
                fPersonList.Dispose();
            }
        }