Example #1
0
 // Construct the paintbox, reading values for the colours etc from the config.
 public Paintbox(CConfig config)
 {
     ColourBg             = GMHelper.ConvertColour(config.MiniTreeColourBackground);
     ColourOutline        = GMHelper.ConvertColour(config.MiniTreeColourIndiBorder);
     ColourBox            = GMHelper.ConvertColour(config.MiniTreeColourIndiBackground);
     ColourHighlight      = GMHelper.ConvertColour(config.MiniTreeColourIndiHighlight);
     ColourBgConcealed    = GMHelper.ConvertColour(config.MiniTreeColourIndiBgConcealed);
     ColourShade          = GMHelper.ConvertColour(config.MiniTreeColourIndiShade);
     ColourText           = GMHelper.ConvertColour(config.MiniTreeColourIndiText);
     ColourLink           = GMHelper.ConvertColour(config.MiniTreeColourIndiLink);
     ColourFgConcealed    = GMHelper.ConvertColour(config.MiniTreeColourIndiFgConcealed);
     ColourConnector      = GMHelper.ConvertColour(config.MiniTreeColourBranch);
     ColourGifTransparent = Color.Magenta;
     BrushBgGif           = new SolidBrush(ColourGifTransparent);
     BrushBg                      = new SolidBrush(ColourBg);
     BrushBox                     = new SolidBrush(ColourBox);
     BrushBoxHighlight            = new SolidBrush(ColourHighlight);
     BrushBoxConcealed            = new SolidBrush(ColourBgConcealed);
     BrushBoxShade                = new SolidBrush(ColourShade);
     BrushText                    = new SolidBrush(ColourText);
     BrushTextLink                = new SolidBrush(ColourLink);
     BrushTextConcealed           = new SolidBrush(ColourFgConcealed);
     PenConnector                 = new Pen(ColourConnector, 1.0f);
     PenConnectorDotted           = new Pen(ColourConnector, 1.0f);
     PenConnectorDotted.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
     PenBox = new Pen(ColourOutline, 1.0f);
     Font   = new Font("Microsoft Sans Serif", 10f);
     BrushFakeTransparency = null;
     Font = new Font(config.TreeFontName, config.TreeFontSize);
     BrushFakeTransparency = null;
 }
Example #2
0
 public Event(GDMDateValue date, string evType, string description, string overview, string note,
              bool important, bool capitalise)
 {
     fPreference = EventPreference.Unknown;
     fDate       = date;
     if (capitalise)
     {
         GMHelper.Capitalise(ref description);
     }
     if (description.Length > 0)
     {
         if (description[description.Length - 1] == '.')
         {
             fDescription = description.Substring(0, description.Length - 1);
         }
         else
         {
             fDescription = description;
         }
     }
     fOverview  = overview;
     fImportant = important;
     fNote      = note;
     if (note == "")
     {
         fNote = null;
     }
     fType = evType;
 }
Example #3
0
            public CBoxText(GDMIndividualRecord ir)
            {
                FirstName = "";
                Surname   = "";
                Concealed = (!GMHelper.GetVisibility(ir));
                if (Concealed && !CConfig.Instance.UseWithheldNames)
                {
                    FirstName = "";
                    Surname   = Name = CConfig.Instance.ConcealedName;
                }
                else
                {
                    var irName = ir.GetPrimaryFullName();
                    if (irName != "")
                    {
                        Name = GMHelper.CapitaliseName(irName, ref FirstName, ref Surname);
                    }
                    else
                    {
                        FirstName = "";
                        Surname   = Name = CConfig.Instance.UnknownName;
                    }
                }

                Date = Concealed ? string.Empty : GMHelper.GetLifeDatesStr(ir);
            }
Example #4
0
        /// <summary>
        /// 客户端请求的参数较验
        /// </summary>
        /// <returns>false:中断后面的方式执行并返回Error</returns>
        public override bool GetUrlElement()
        {
            IsNotRespond = true;
            //
            if (httpGet.GetString("Word", ref _word) &&
                httpGet.GetString("ActionType", ref _actionType))
            {
                if (!GMHelper.checkWordCorrect(_word))
                {
                    ErrorCode = Language.Instance.ErrorCode;
                    ErrorInfo = "非法操作";
                    TraceLog.WriteError("Action90016非法操作");
                    return(false);
                }
                //执行
                switch (_actionType)
                {
                case "OnStartAffer":
                {
                    ServerHelper.Init();
                    TimerHelper.StartTimer();
                } break;

                case "OnSessionRecover":            //玩家session恢复
                {
                    //大厅服写了就可以,此次不需要
                } break;

                case "OnScriptLoaded":
                {
                    TraceLog.WriteInfo("动态编译后重启定时器...");
                    TimerHelper.StartTimer();
                    TraceLog.WriteInfo("动态编译后重启定时器完成");
                } break;

                case "OnClientDisconnected":        //断开
                {
                    var message = httpGet.GetMessage();
                    if (message is GameSession)
                    {
                        var session = (GameSession)message;
                        if (session != null)
                        {
                            ServerHelper.OnOtherServerDisconnected(session);
                        }
                    }
                } break;

                default:
                    break;
                }
                return(true);
            }
            ErrorCode = Language.Instance.ErrorCode;
            ErrorInfo = Language.Instance.UrlElement;
            TraceLog.WriteError("Action90016获取参数失败");
            return(false);
        }
Example #5
0
        // Constructor. Creates a file with the given name and writes a standard HTML header.
        public HTMLFile(string filename, string title, string description, string keywords)
        {
            // This is for CJ who ended up with 17000 files plastered all over her desktop...
            if (GMHelper.IsDesktop(filename))
            {
                throw new HTMLException(string.Format("A problem occurred when creating an HTML file:\r\nGEDmill will not place files onto the Desktop."));
            }

            fLogger.WriteInfo("CHTMLFile : " + filename);

            if (File.Exists(filename))
            {
                // Delete any current file
                File.SetAttributes(filename, FileAttributes.Normal);
                File.Delete(filename);
            }
            fStream = null;
            try {
                fStream = new FileStream(filename, FileMode.Create);
            } catch (NotSupportedException) {
                throw new HTMLException(string.Format("A problem occurred when creating an HTML file:\r\nThe path or filename {0} is not valid.", filename));
            }

            if (fStream != null)
            {
                System.Text.Encoding encoding = new UTF8EncodingWithoutPreamble();

                fWriter = new StreamWriter(fStream, encoding);

                string   date;
                DateTime dt = DateTime.Now;
                date = dt.ToString("yyyy-MM-dd", DateTimeFormatInfo.InvariantInfo);

                fWriter.WriteLine("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
                fWriter.WriteLine("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">");
                fWriter.WriteLine("  <head>");
                fWriter.WriteLine("    <link rel=\"stylesheet\" type=\"text/css\" href=\"" + CConfig.Instance.StylesheetFilename + ".css\" />");
                if (CConfig.Instance.AllowMultipleImages) // Multiple images feature is currently (10Dec08) the only thing that uses javascript
                {
                    fWriter.WriteLine("    <script type=\"text/javascript\" src=\"gedmill.js\"></script>");
                }
                fWriter.WriteLine("    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=" + CharsetString + "\" />");
                fWriter.WriteLine("    <meta http-equiv=\"imagetoolbar\" content=\"no\" />");
                fWriter.WriteLine(string.Concat("    <meta name=\"Title\" content=\"", title, "\" />"));
                fWriter.WriteLine(string.Concat("    <meta name=\"Description\" content=\"", description, "\" />"));
                fWriter.WriteLine(string.Concat("    <meta name=\"Keywords\" content=\"", keywords, "\" />"));
                fWriter.WriteLine("    <meta name=\"Version\" content=\"1.00\" />");
                fWriter.WriteLine(string.Concat("    <meta name=\"VersionDate\" content=\"", date, "\" />"));
                fWriter.WriteLine(string.Concat("    <title>", title, "</title>"));
                fWriter.WriteLine("  </head>");
                fWriter.WriteLine("  ");
                fWriter.WriteLine("  <body>");
            }
        }
Example #6
0
        // Creates link HTML for the individual e.g. <a href="indiI1.html">Next Child</a>. Uses name provided by caller.
        protected static string MakeLink(GDMIndividualRecord ir, string name)
        {
            string link;

            if (!GMHelper.GetVisibility(ir))
            {
                // TODO: Why are we linking to invisible people?
                link = EscapeHTML(name, true);
            }
            else
            {
                link = string.Concat("<a href=\"", GetIndividualHTMLFilename(ir), "\">", EscapeHTML(name, false), "</a>");
            }
            return(link);
        }
Example #7
0
        // For sorting the list
        public int CompareTo(LVItem other)
        {
            if (fRecord == null && other.fRecord == null)
            {
                return(0);
            }
            if (fRecord == null)
            {
                return(1);
            }
            if (other.fRecord == null)
            {
                return(-1);
            }
            bool tr = GMHelper.GetVisibility(fRecord);
            bool or = GMHelper.GetVisibility(other.fRecord);

            return((tr == or) ? 0 : (tr) ? 1 : -1);
        }
Example #8
0
        // Creates link HTML for the individual e.g. <a href="indiI1.html">Fred Bloggs</a>
        protected static string MakeLink(GDMIndividualRecord ir)
        {
            string name  = ir.GetPrimaryFullName();
            string dummy = "";

            if (name == "")
            {
                name = CConfig.Instance.UnknownName;
            }
            else if (!GMHelper.GetVisibility(ir) && !CConfig.Instance.UseWithheldNames)
            {
                name = CConfig.Instance.ConcealedName;
            }
            else
            {
                name = GMHelper.CapitaliseName(name, ref dummy, ref dummy);
            }
            return(MakeLink(ir, name));
        }
Example #9
0
        // Adds the given multimedia links to the given multimedia list.
        protected void AddMultimedia(GDMList <GDMMultimediaLink> multimediaLinks, string mmPrefix,
                                     string mmLargePrefix, int maxWidth, int maxHeight, Stats stats)
        {
            // TODO: ml.GetFileReferences();
            var fileRefs = new List <GDMFileReference>();

            foreach (var mmLink in multimediaLinks)
            {
                if (mmLink.IsPointer)
                {
                    var mmRec = fTree.GetPtrValue(mmLink);
                    if (!GMHelper.GetVisibility(mmRec))
                    {
                        // user chose not to show this picture
                        continue;
                    }

                    foreach (var fileRef in mmRec.FileReferences)
                    {
                        fileRefs.Add(fileRef);
                    }
                }
                else
                {
                    foreach (var fileRef in mmLink.FileReferences)
                    {
                        fileRefs.Add(fileRef);
                    }
                }
            }

            if (multimediaLinks != null)
            {
                // Add extra pics added by the user on indi exclude screen.
                AddMultimediaFileReferences(fileRefs, mmPrefix, mmLargePrefix, maxWidth, maxHeight, stats);
            }
        }
Example #10
0
        // The main method that causes the page to be created.
        public bool Create(Stats stats)
        {
            // Sanity check
            if (fSourceRecord == null)
            {
                return(false);
            }

            // Create the strings to use for the HTML file.
            string pageDescription = "GEDmill GEDCOM to HTML page for " + fSourceRecord.ShortTitle;
            string keywords        = "family tree history " + fSourceRecord.ShortTitle;
            string filename        = string.Concat(CConfig.Instance.OutputFolder, "\\sour", fSourceRecord.XRef);
            string fullFilename    = string.Concat(filename, ".", CConfig.Instance.HtmlExtension);

            HTMLFile f = null;

            try {
                // Create a new file with an HTML header.
                f = new HTMLFile(fullFilename, fSourceRecord.ShortTitle, pageDescription, keywords);

                // Create a navbar to main site, front page etc.
                OutputPageHeader(f, "", "", true, true);

                f.WriteLine("    <div class=\"hr\" />");
                f.WriteLine("");
                f.WriteLine("    <div id=\"page\"> <!-- page -->");

                // Write the page's title text.
                f.WriteLine("      <div id=\"main\">");
                f.WriteLine("        <div id=\"summary\">");
                f.WriteLine("          <div id=\"names\">");
                string sourName = fSourceRecord.ShortTitle;
                if (sourName == "")
                {
                    sourName = "Source ";
                    bool gotSourceName = false;
                    // Try user reference number
                    foreach (var userRef in fSourceRecord.UserReferences)
                    {
                        if (userRef.StringValue != "")
                        {
                            sourName     += userRef.StringValue;
                            gotSourceName = true;
                            break;
                        }
                    }
                    if (!gotSourceName && fSourceRecord.AutomatedRecordID != null && fSourceRecord.AutomatedRecordID != "")
                    {
                        sourName += fSourceRecord.AutomatedRecordID;
                    }
                    else if (!gotSourceName)
                    {
                        sourName += fSourceRecord.XRef;
                    }
                }
                f.WriteLine("<h1>{0}</h1>", EscapeHTML(sourName, false));

                // Add repository information
                foreach (var sourCit in fSourceRecord.RepositoryCitations)
                {
                    GDMRepositoryRecord repoRec = fTree.GetPtrValue <GDMRepositoryRecord>(sourCit);
                    if (repoRec != null)
                    {
                        if (!string.IsNullOrEmpty(repoRec.RepositoryName))
                        {
                            f.WriteLine("<h2>{0}</h2>", EscapeHTML(repoRec.RepositoryName, false));
                        }

                        foreach (GDMNotes ns in repoRec.Notes)
                        {
                            WriteNotes(f, ns);
                        }
                    }

                    foreach (GDMNotes ns in sourCit.Notes)
                    {
                        WriteNotes(f, ns);
                    }
                }

                // Add Publication Information
                string pubFacts;
                if (CConfig.Instance.ObfuscateEmails)
                {
                    pubFacts = ObfuscateEmail(fSourceRecord.Publication.Lines.Text);
                }
                else
                {
                    pubFacts = fSourceRecord.Publication.Lines.Text;
                }
                if (!string.IsNullOrEmpty(pubFacts))
                {
                    if (pubFacts.Length > 7 && pubFacts.ToUpper().Substring(0, 7) == "HTTP://")
                    {
                        f.WriteLine("<h2><a href=\"{0}\">{1}</a></h2>", pubFacts, EscapeHTML(pubFacts, false));
                    }
                    else
                    {
                        f.WriteLine("<h2>{0}</h2>", EscapeHTML(pubFacts, false));
                    }
                }

                f.WriteLine("          </div> <!-- names -->");
                f.WriteLine("        </div> <!-- summary -->");

                // Collect together multimedia links.
                if (CConfig.Instance.AllowMultimedia)
                {
                    // Fill m_alMultimediaList:
                    AddMultimedia(fSourceRecord.MultimediaLinks, string.Concat(fSourceRecord.XRef, "mms"), string.Concat(fSourceRecord.XRef, "mos"), CConfig.Instance.MaxSourceImageWidth, CConfig.Instance.MaxSourceImageHeight, stats);
                }

                // Add pics
                OutputMultimedia(f);

                // Add textFromSource
                string cleanText = fSourceRecord.Text.Lines.Text;
                if (CConfig.Instance.ObfuscateEmails)
                {
                    cleanText = ObfuscateEmail(cleanText);
                }
                if (!string.IsNullOrEmpty(cleanText))
                {
                    f.WriteLine("        <div id=\"text\">");
                    f.WriteLine("          <h1>Text</h1>");
                    f.WriteLine("          <p class=\"pretext\">");
                    f.WriteLine(EscapeHTML(cleanText, false));
                    f.WriteLine("            </p>");
                    f.WriteLine("        </div> <!-- text -->");
                }

                // Add notes
                OutputNotes(f, fSourceRecord.Notes);

                if (!CConfig.Instance.SupressBackreferences)
                {
                    f.WriteLine("        <div id=\"citations\">");
                    f.WriteLine("          <h1>Citations</h1>");
                    f.WriteLine("          <ul>");

                    var htBackrefs = GMHelper.MakeBackReferences(fSourceRecord);
                    IDictionaryEnumerator enumerator = htBackrefs.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        GDMIndividualRecord ir = (GDMIndividualRecord)(enumerator.Value);
                        if (ir != null && GMHelper.GetVisibility(ir))
                        {
                            string link = MakeLink(ir);
                            if (link != "")
                            {
                                f.WriteLine("<li>{0}</li>", link);
                            }
                        }
                    }

                    f.WriteLine("          </ul>");
                    f.WriteLine("        </div> <!-- citations -->");
                }

                f.WriteLine("      </div> <!-- main -->");

                // Add footer (Record date, W3C sticker, GEDmill credit etc.)
                OutputFooter(f, fSourceRecord);

                f.WriteLine("    </div> <!-- page -->");
            } catch (IOException e) {
                fLogger.WriteError("Caught IO Exception(6) : ", e);
            } catch (ArgumentException e) {
                fLogger.WriteError("Caught Argument Exception(6) : ", e);
            } finally {
                if (f != null)
                {
                    f.Close(); // Adds standard footer to the file
                }
            }
            return(true);
        }
Example #11
0
        // Crops the specified image file to the given size. Also converts non-standard formats to standard ones.
        // Returns sFilename in case extension has changed.
        // sArea is changed to reflect new image size
        private static string ConvertAndCropImage(string folder, string fileName, ref Rectangle rectArea, uint maxWidth, uint maxHeight)
        {
            fLogger.WriteInfo(string.Format("ConvertAndCropImage( {0}, {1} )", folder != null ? folder : "null", fileName != null ? fileName : "null"));

            string absFilename = string.Concat(folder, fileName);

            Image image = null;

            try {
                image = Image.FromFile(absFilename);
            } catch (OutOfMemoryException) {
                // Image is not a GDI compatible format
                image = null;
            }

            if (image == null)
            {
                throw (new HTMLException("Unknown image format for file " + absFilename)); // Let caller sort it out.
            }

            Rectangle rectNewArea;

            if (rectArea.Width <= 0 || rectArea.Height <= 0)
            {
                SizeF s = image.PhysicalDimension;
                if (s.Width <= maxWidth && s.Height <= maxHeight)
                {
                    maxWidth  = (uint)s.Width;
                    maxHeight = (uint)s.Height;
                    // Nothing needs to be done, bitmap already correct size.
                    // Carry on with conversion.
                }
                rectNewArea     = new Rectangle(0, 0, (int)s.Width, (int)s.Height);
                rectArea.X      = 0;
                rectArea.Y      = 0;
                rectArea.Width  = rectNewArea.Width;
                rectArea.Height = rectNewArea.Height;
            }
            else
            {
                rectNewArea = new Rectangle(0, 0, rectArea.Width, rectArea.Height);
            }

            if (maxWidth != 0 && maxHeight != 0)
            {
                // If image is too big then shrink it. (Can't always use GetThumbnailImage because that might use embedded thumbnail).
                GMHelper.ScaleAreaToFit(ref rectNewArea, maxWidth, maxHeight);
            }

            Bitmap   bitmapNew   = new Bitmap(rectNewArea.Width, rectNewArea.Height, PixelFormat.Format24bppRgb);
            Graphics graphicsNew = Graphics.FromImage(bitmapNew);

            graphicsNew.DrawImage(image, rectNewArea, rectArea, GraphicsUnit.Pixel);
            image.Dispose();

            // Find which format to save in. TODO: There must be a more elegant way!!
            string sExtn     = Path.GetExtension(fileName);
            string sFilepart = Path.GetDirectoryName(fileName);

            sFilepart += "\\" + Path.GetFileNameWithoutExtension(fileName);
            System.Drawing.Imaging.ImageFormat imageFormat;
            switch (sExtn.ToLower())
            {
            case ".jpg":
            case ".jpeg":
                sExtn       = ".jpg";
                imageFormat = ImageFormat.Jpeg;
                break;

            case ".gif":
                imageFormat = ImageFormat.Gif;
                break;

            case ".bmp":
                imageFormat = ImageFormat.Bmp;
                break;

            case ".tif":
            case ".tiff":
                // Tif's don't display in browsers, so convert to png.
                imageFormat = ImageFormat.Png;
                sExtn       = ".png";
                break;

            case ".exif":
                imageFormat = ImageFormat.Exif;
                break;

            case ".png":
                imageFormat = ImageFormat.Png;
                break;

            default:
                imageFormat = ImageFormat.Jpeg;
                break;
            }

            string filenameNew    = sFilepart + sExtn;
            string absFilenameNew = string.Concat(folder, filenameNew);

            try {
                if (File.Exists(absFilename))
                {
                    // Delete the old file (e.g. if converting from tif to png)
                    File.Delete(absFilename);
                }
            } catch (Exception e) {
                fLogger.WriteError(string.Format("Caught exception while removing old bitmap file {0}", absFilename), e);
            }
            try {
                if (File.Exists(absFilenameNew))
                {
                    // Delete any existing file
                    File.SetAttributes(absFilenameNew, FileAttributes.Normal);
                    File.Delete(absFilenameNew);
                }
                bitmapNew.Save(absFilenameNew, imageFormat);
            } catch (Exception e) {
                fLogger.WriteError(string.Format("Caught exception while writing bitmap file {0}", filenameNew), e);
                filenameNew = "";
            }
            graphicsNew.Dispose();
            bitmapNew.Dispose();

            rectArea = rectNewArea;
            return(filenameNew);
        }
Example #12
0
 // Returns true if the supplied record is valid for inclusion in the tree
 private static bool Exists(GDMIndividualRecord ir)
 {
     return(ir != null && GMHelper.GetVisibility(ir));
 }
Example #13
0
        // Calculate size required for tree by iterating through individuals and building a data structure.
        protected MiniTreeGroup CreateDataStructure(GDMIndividualRecord irSubject)
        {
            // Add subject's frParents
            GDMFamilyRecord    frParents  = fTree.GetParentsFamily(irSubject);
            MiniTreeGroup      mtgParents = new MiniTreeGroup();
            MiniTreeIndividual mtiFather  = null;

            if (frParents != null)
            {
                mtiFather = AddToGroup(fTree.GetPtrValue(frParents.Husband), mtgParents);
            }

            // Create a group for the subejct and their siblings.
            MiniTreeGroup mtgSiblings = new MiniTreeGroup();

            // Keeps count of subject's siblings (including subject)
            int nSiblings = 0;

            // Keeps track of last added sibling, to hook up to next added sibling.
            MiniTreeIndividual mtiRightmostSibling = null;

            // Keeps track of last added child, to hook up to next added child.
            MiniTreeIndividual mtiRightmostChild = null;

            // For each sibling (including the subject)
            while (true)
            {
                GDMIndividualRecord irSibling = GetChild(frParents, nSiblings, irSubject);
                if (irSibling == null)
                {
                    break;
                }

                if (irSibling == irSubject)
                {
                    // Add spouses and children of subject, (and subject too, if we need to put wife after them.)
                    MiniTreeGroup           mtgOffspring  = null;
                    bool                    bAddedSubject = false;
                    int                     nSpouses      = 0;
                    MiniTreeGroup.ECrossbar ecbCrossbar   = MiniTreeGroup.ECrossbar.Solid;
                    var                     indiFamilies  = GMHelper.GetFamilyList(fTree, irSubject);

                    foreach (GDMFamilyRecord famRec in indiFamilies)
                    {
                        GDMIndividualRecord irSpouse = fTree.GetSpouseBy(famRec, irSubject);

                        if (famRec.Husband.XRef != irSubject.XRef)
                        {
                            mtiRightmostSibling = AddToGroup(irSpouse, mtgSiblings);
                            // Subject is female so all but last husband have dotted bars
                            ecbCrossbar = MiniTreeGroup.ECrossbar.DottedLeft;
                        }
                        else if (Exists(irSubject) && !bAddedSubject)
                        {
                            // Subject is male, so need to put them in now, before their children.
                            // (Otherwise they get added as a regular sibling later)
                            CBoxText boxtext = new CBoxText(irSubject);
                            mtiRightmostSibling = mtgSiblings.AddIndividual(irSubject, boxtext.FirstName, boxtext.Surname, boxtext.Date, false, frParents != null, true, boxtext.Concealed, false);

                            // To stop subject being added as regular sibling.
                            bAddedSubject = true;
                        }

                        int nGrandchildren = 0;
                        GDMIndividualRecord irGrandchild = null;

                        // If we have already added an offspring box (from previous marriage) need connect this box to it as its right box.
                        if (mtgOffspring != null)
                        {
                            mtgOffspring.RightBox = mtiRightmostSibling;
                        }

                        // Create a box for the offspring of this marriage
                        mtgOffspring = new MiniTreeGroup();

                        // Set crossbar that joins subject to spouse according to whether this is subject's first spouse.
                        mtgOffspring.fCrossbar = ecbCrossbar;

                        // Add children by this spouse
                        MiniTreeIndividual mtiChild = null;
                        while ((irGrandchild = GetChild(famRec, nGrandchildren, null)) != null)
                        {
                            if (Exists(irGrandchild))
                            {
                                CBoxText boxtext = new CBoxText(irGrandchild);
                                mtiChild = mtgOffspring.AddIndividual(irGrandchild, boxtext.FirstName, boxtext.Surname, boxtext.Date, true, true, false, boxtext.Concealed, false);

                                // Hook this up to any children by previous spouses.
                                if (nGrandchildren == 0 && mtiRightmostChild != null)
                                {
                                    mtiRightmostChild.RightObjectAlien = mtiChild;
                                    mtiChild.LeftObjectAlien           = mtiRightmostChild;
                                }
                            }
                            nGrandchildren++;
                        }

                        // If we added anything, record it as the right-most child ready to hook to children by next spouse.
                        if (mtiChild != null)
                        {
                            mtiRightmostChild = mtiChild;
                        }

                        // Add the subjects children to the siblings group
                        mtgSiblings.AddGroup(mtgOffspring);

                        // Hook the offspring group to the previous sibling
                        if (mtgOffspring != null)
                        {
                            mtgOffspring.LeftBox = mtiRightmostSibling;
                        }

                        // If subject is husband then we need to add their wife now.
                        if (famRec.Husband.XRef == irSubject.XRef)
                        {
                            ecbCrossbar = MiniTreeGroup.ECrossbar.DottedRight;

                            // Hook up to previous rightmost sibling and set this as new rightmost sibling.
                            mtiRightmostSibling = AddToGroup(irSpouse, mtgSiblings);

                            // Hook the wife up as box on right of offspring box.
                            if (mtgOffspring != null)
                            {
                                mtgOffspring.RightBox = mtiRightmostSibling;
                            }
                        }

                        nSpouses++;
                    }

                    if (!bAddedSubject)
                    {
                        CBoxText           boxtext = new CBoxText(irSubject);
                        MiniTreeIndividual mtiWife = mtgSiblings.AddIndividual(irSubject, boxtext.FirstName, boxtext.Surname, boxtext.Date, false, frParents != null, true, boxtext.Concealed, false);

                        if (mtgOffspring != null)
                        {
                            mtgOffspring.fCrossbar = MiniTreeGroup.ECrossbar.Solid;
                            mtgOffspring.RightBox  = mtiWife;
                        }
                    }
                }
                else if (Exists(irSibling))
                {
                    // A sibling (not the subject).
                    CBoxText boxtext = new CBoxText(irSibling);
                    mtgSiblings.AddIndividual(irSibling, boxtext.FirstName, boxtext.Surname, boxtext.Date, true, frParents != null, true, boxtext.Concealed, false);
                }

                nSiblings++;
            }

            // Add siblings group after subject's father
            mtgParents.AddGroup(mtgSiblings);

            // Hook up to subject's father
            mtgSiblings.LeftBox = mtiFather;

            // Add subject's mother
            if (frParents != null)
            {
                MiniTreeIndividual mtiMother = AddToGroup(fTree.GetPtrValue(frParents.Wife), mtgParents);
                mtgSiblings.RightBox = mtiMother;
            }

            // Return the parents group (which contains the other family groups).
            return(mtgParents);
        }
Example #14
0
        // The main method that causes the front page to be created.
        public void Create()
        {
            string keywords = "family tree history " + GMConfig.Instance.OwnersName;
            string title    = GMConfig.Instance.SiteTitle;

            HTMLFile f = null;

            try {
                f = new HTMLFile(GMConfig.Instance.FrontPageURL, title, PageDescription, keywords); // Creates a new file, and puts standard header html into it.
                f.WriteLine("  <div id=\"page\"> <!-- page -->");
                f.WriteLine("    <div id=\"cover\"> <!-- cover -->");

                f.WriteLine("<h1>{0}</h1>", EscapeHTML(title, false));

                if (!string.IsNullOrEmpty(GMConfig.Instance.FrontPageImageFilename))
                {
                    Rectangle newArea     = new Rectangle(0, 0, 0, 0);
                    string    pictureFile = CopyMultimedia(GMConfig.Instance.FrontPageImageFilename, "", 0, 0, ref newArea, null);
                    if (!string.IsNullOrEmpty(pictureFile))
                    {
                        f.WriteLine("<p><img src=\"{0}\" alt=\"Front page image\" /></p>", pictureFile);
                    }
                }

                if (!string.IsNullOrEmpty(GMConfig.Instance.CommentaryText))
                {
                    if (GMConfig.Instance.CommentaryIsHtml)
                    {
                        f.WriteLine("<p>{0}</p>", GMConfig.Instance.CommentaryText);
                    }
                    else
                    {
                        f.WriteLine("<p>{0}</p>", EscapeHTML(GMConfig.Instance.CommentaryText, false));
                    }
                }

                if (GMConfig.Instance.ShowFrontPageStats)
                {
                    string individuals = fStats.Individuals == 0 ? "no" : fStats.Individuals.ToString();
                    individuals += " individual";
                    if (fStats.Individuals != 1)
                    {
                        individuals += "s";
                    }

                    string sources = fStats.Sources == 0 ? "" : string.Concat(", cross-referenced to ", fStats.Sources.ToString(), " source");
                    if (fStats.Sources > 1)
                    {
                        sources += "s";
                    }

                    string fileType   = fStats.NonPicturesIncluded ? "multimedia file" : "image";
                    string multimedia = fStats.MultimediaFiles == 0 ? "" : string.Concat(". There are links to ", fStats.MultimediaFiles.ToString(), " ", fileType);

                    if (fStats.MultimediaFiles > 1)
                    {
                        multimedia += "s";
                    }

                    f.WriteLine(string.Concat("       <p>This website contains records on ", individuals, sources, multimedia, ".</p>"));
                }

                f.WriteLine("       <div id=\"links\"> <!-- links -->");
                f.WriteLine(string.Concat("         <p><a href=\"individuals1.", GMConfig.Instance.HtmlExtension, "\">", GMConfig.Instance.IndexTitle, "</a></p>"));
                f.WriteLine("       </div> <!-- links -->");
                if (GMConfig.Instance.KeyIndividuals != null && GMConfig.Instance.KeyIndividuals.Count > 0)
                {
                    // Although in theory you might want a restricted individual as a key individual, (they still form part of the tree), in practice this isn't allowed:
                    var censoredKeyIndividuals = new List <string>(GMConfig.Instance.KeyIndividuals.Count);

                    foreach (string keyXref in GMConfig.Instance.KeyIndividuals)
                    {
                        GDMIndividualRecord air = fTree.XRefIndex_Find(keyXref) as GDMIndividualRecord;
                        if (air != null)
                        {
                            censoredKeyIndividuals.Add(MakeLink(air));
                        }
                    }

                    if (censoredKeyIndividuals.Count > 0)
                    {
                        string plural = "";
                        if (censoredKeyIndividuals.Count > 1)
                        {
                            plural = "s";
                        }
                        f.WriteLine("<div id=\"keyindividuals\">");
                        f.WriteLine("<p>Key Individual{0}:</p>", plural);
                        f.WriteLine("<ul>");
                        foreach (string air_link in censoredKeyIndividuals)
                        {
                            f.WriteLine("<li>{0}</li>", air_link);
                        }
                        f.WriteLine("</ul>");
                        f.WriteLine("</div> <!-- keyindividuals -->");
                    }
                }

                string byEmail = "";
                // Email contact address
                if (!string.IsNullOrEmpty(GMConfig.Instance.UserEmailAddress))
                {
                    byEmail = string.Concat(" by <a href=\"mailto:", GMConfig.Instance.UserEmailAddress, "\">", EscapeHTML(GMConfig.Instance.UserEmailAddress, false), "</a>");
                }

                // Add brand and contact label
                f.WriteLine("<p>Website created{0} using GEDmill.</p>", byEmail);
                // Add last update string
                if (GMConfig.Instance.AddHomePageCreateTime)
                {
                    f.WriteLine("<p>Created on {0}.</p>", GMHelper.GetNowDateStr());
                }

                // Add link to users main website
                if (!string.IsNullOrEmpty(GMConfig.Instance.MainWebsiteLink))
                {
                    f.WriteLine("<p><a href=\"{0}\">Return to main site</a></p>", GMConfig.Instance.MainWebsiteLink);
                }

                f.WriteLine("    </div> <!-- cover -->");
                f.WriteLine("  </div> <!-- page -->");
            } catch (IOException e) {
                fLogger.WriteError("Caught IO Exception(7) : ", e);
            } catch (ArgumentException e) {
                fLogger.WriteError("Caught Argument Exception(7) : ", e);
            } finally {
                if (f != null)
                {
                    // Add standard footer to the file
                    f.Close();
                }
            }
        }
Example #15
0
        // Adds the given list of file references to the multimedia list.
        private void AddMultimediaFileReferences(List <GDMFileReference> fileRefs, string mmPrefix,
                                                 string mmLargePrefix, int maxWidth, int maxHeight, Stats stats)
        {
            if (fileRefs == null)
            {
                return;
            }

            for (int i = 0; i < fileRefs.Count; i++)
            {
                GDMFileReferenceWithTitle mfr = fileRefs[i] as GDMFileReferenceWithTitle;
                string    copyFilename        = "";
                int       nMmOrdering         = i;
                string    mmTitle             = mfr.Title;
                string    mmFilename          = mfr.StringValue;
                string    mmFormat            = mfr.MultimediaFormat.ToString();
                Rectangle rectArea            = new Rectangle(0, 0, 0, 0);
                string    extPart;
                bool      blockThisMediaType = false;

                // Don't trust extension on sFilename. Use our own. (Happens for .tmp files from embedded data)
                switch (mmFormat)
                {
                case "bmp":
                    extPart = ".bmp";
                    break;

                case "gif":
                    extPart = ".gif";
                    break;

                case "jpg":
                case "jpeg":
                    extPart = ".jpg";
                    break;

                case "tiff":
                case "tif":
                    extPart = ".tif";
                    break;

                case "png":
                    extPart = ".png";
                    break;

                case "ole":
                    blockThisMediaType = true;
                    extPart            = ".ole";
                    break;

                default:
                    extPart = Path.GetExtension(mmFilename);
                    if (extPart.ToUpper() == ".TMP")
                    {
                        extPart = "." + mmFormat;
                    }
                    break;
                }
                string originalFilename = Path.GetFileName(mmFilename);

                bool pictureFormat = GMHelper.IsPictureFormat(mfr);
                if (pictureFormat || GMConfig.Instance.AllowNonPictures)
                {
                    if (!pictureFormat && GMConfig.Instance.AllowNonPictures)
                    {
                        stats.NonPicturesIncluded = true;
                    }

                    string newFilename = originalFilename;
                    if (!string.IsNullOrEmpty(mmFilename))
                    {
                        // Give multimedia files a standard name
                        if (GMConfig.Instance.RenameOriginalPicture)
                        {
                            //string sFilePart = sMmPrefix;//string.Concat( mm_prefix, nMultimediaFiles.ToString() );
                            newFilename = string.Concat(mmPrefix, extPart.ToLower());
                        }

                        if (!blockThisMediaType)
                        {
                            if (pictureFormat)
                            {
                                // TODO

                                /*if (mfr.m_asidPair != null) {
                                 *  Rectangle rectAsidArea = mfr.m_asidPair.m_rectArea;
                                 *  rectArea = new Rectangle(rectAsidArea.X, rectAsidArea.Y, rectAsidArea.Width, rectAsidArea.Height);
                                 * }*/
                                copyFilename = CopyMultimedia(mmFilename, newFilename, maxWidth, maxHeight, ref rectArea, stats);
                            }
                            else
                            {
                                copyFilename = CopyMultimedia(mmFilename, newFilename, 0, 0, ref rectArea, stats);
                            }
                        }
                    }

                    if (!string.IsNullOrEmpty(copyFilename))
                    {
                        string largeFilename = "";
                        // Copy original original version
                        if (GMConfig.Instance.LinkOriginalPicture)
                        {
                            if (GMConfig.Instance.RenameOriginalPicture)
                            {
                                //string sFilePart = sMmLargePrefix;
                                largeFilename = string.Concat(mmLargePrefix, extPart.ToLower());
                            }
                            else
                            {
                                largeFilename = originalFilename;
                            }

                            Rectangle rectLargeArea = new Rectangle(0, 0, 0, 0);
                            largeFilename = CopyMultimedia(mmFilename, largeFilename, 0, 0, ref rectLargeArea, null);
                        }

                        // Add format and new sFilename to multimedia list
                        Multimedia imm = new Multimedia(nMmOrdering, mmFormat, mmTitle, copyFilename, largeFilename, rectArea.Width, rectArea.Height);
                        fMultimediaList.Add(imm);
                    }
                    else
                    {
                        // Happens e.g. when original file doesn't exist.
                    }
                }
            }
        }
Example #16
0
        // Writes the HTML for the multimedia files associated with this record.
        private void OutputMultimedia(HTMLFile f)
        {
            string nonPicMainFilename = "";

            if (fMultimediaList.Count > 0)
            {
                f.WriteLine("        <div id=\"sourcePics\">");
                foreach (Multimedia iMultimedia in fMultimediaList)
                {
                    nonPicMainFilename = "multimedia/" + GMHelper.NonPicFilename(iMultimedia.Format, false, CConfig.Instance.LinkOriginalPicture);

                    string imageTitle = "";
                    string altName    = "";

                    if (iMultimedia.Title != null)
                    {
                        imageTitle = iMultimedia.Title;
                        altName    = iMultimedia.Title;
                    }

                    f.WriteLine(string.Concat("          <p>"));

                    if (iMultimedia.Width != 0 && iMultimedia.Height != 0)
                    {
                        // Must be a picture.
                        if (altName == "")
                        {
                            altName = "Image for this source";
                        }
                        if (iMultimedia.LargeFileName.Length > 0)
                        {
                            f.WriteLine(string.Concat("            <a href=\"", iMultimedia.LargeFileName, "\"><img src=\"", iMultimedia.FileName, "\" alt=\"", altName, "\" /></a>")); // TODO: clip and scale properly. Use MainForm.s_config to set a max scale
                        }
                        else
                        {
                            f.WriteLine(string.Concat("            <img src=\"", iMultimedia.FileName, "\" alt=\"", altName, "\" />")); // TODO: clip and scale properly. Use MainForm.s_config to set a max scale
                        }
                    }
                    else
                    {
                        // Other multimedia
                        if (altName == "")
                        {
                            altName = "Media for this source";
                        }

                        if (CConfig.Instance.LinkOriginalPicture)
                        {
                            f.WriteLine(string.Concat("            <a href=\"", iMultimedia.FileName, "\"><img src=\"", nonPicMainFilename, "\" alt=\"", altName, "\" /></a>")); // TODO: clip and scale properly. Use MainForm.s_config to set a max scale
                        }
                        else
                        {
                            f.WriteLine(string.Concat("            <img src=\"", nonPicMainFilename, "\" alt=\"", altName, "\" />")); // TODO: clip and scale properly. Use MainForm.s_config to set a max scale
                        }
                    }
                    f.WriteLine(string.Concat("          </p>"));
                    if (imageTitle != "")
                    {
                        f.WriteLine("<p id=\"sourcepic_title\">{0}</p>", imageTitle);
                    }
                }
                f.WriteLine("        </div> <!-- sourcePics -->");
            }
        }
Example #17
0
 // Used to exclude the record from the generated web site
 public void SetVisibility(bool value)
 {
     GMHelper.SetVisibility(fRecord, value);
 }
Example #18
0
        public void Create()
        {
            fLogger.WriteInfo("CCreatorStylesheet::Create()");

            StreamWriter sw = null;

            try {
                if (File.Exists(fCssFilename))
                {
                    // Delete any current file
                    File.SetAttributes(fCssFilename, FileAttributes.Normal);
                    File.Delete(fCssFilename);
                }

                var fs = new FileStream(string.Concat(GMConfig.Instance.OutputFolder, "\\", GMConfig.Instance.StylesheetFilename, ".css"), FileMode.Create, FileAccess.Write);
                sw = new StreamWriter(fs);

                sw.WriteLine(string.Concat("/* CSS file generated by ", GMConfig.SoftwareName, " on ", GMHelper.GetNowDateStr(), " */"));
                sw.WriteLine("BODY {");
                sw.WriteLine("  background-color: #f1f4e9;");
                if (fBackgroundImageFilename != "")
                {
                    sw.WriteLine(string.Concat("  background-image: url(", fBackgroundImageFilename, ");"));
                }
                sw.WriteLine("  color: #000000;");
                sw.WriteLine("  text-align: left;");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif;   ");
                sw.WriteLine("  font-size:8pt;");
                sw.WriteLine("}");

                sw.WriteLine("IMG {");
                sw.WriteLine("  border: none;");
                sw.WriteLine("}");

                sw.WriteLine("H1 {");
                sw.WriteLine("  margin:10px 0 4px 0; ");
                sw.WriteLine("  text-align: left;");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("  font-size:26pt;");
                sw.WriteLine("  font-weight: bold;");
                sw.WriteLine("}");

                sw.WriteLine("#summary {");
                sw.WriteLine("  margin-bottom:40px;");
                sw.WriteLine("}");

                sw.WriteLine("#parents H1 {");
                sw.WriteLine("  font-size:14pt;");
                sw.WriteLine("}");

                sw.WriteLine("#parents P {");
                sw.WriteLine("  margin:4px 4px 4px 11px;");
                sw.WriteLine("}");

                sw.WriteLine("#parents {");
                sw.WriteLine("  margin-bottom:25px;");
                sw.WriteLine("}");

                sw.WriteLine("#events H1 {");
                sw.WriteLine("  font-size:14pt;");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("}");

                sw.WriteLine("#facts H1 {");
                sw.WriteLine("  font-size:14pt;");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("}");

                sw.WriteLine("#notes H1 {");
                sw.WriteLine("  font-size:14pt;");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("}");

                sw.WriteLine("#citations H1 {");
                sw.WriteLine("  font-size:14pt;");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("}");

                sw.WriteLine("#citations {");
                sw.WriteLine("  font-family:  Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("  text-align: left;");
                sw.WriteLine("  font-size:10pt;");
                sw.WriteLine("  margin-top: 22px;");
                sw.WriteLine("}");

                sw.WriteLine("#text H1 {");
                sw.WriteLine("  font-size:14pt;");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("}");

                sw.WriteLine("#references H1 {");
                sw.WriteLine("  font-size:14pt;");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("}");

                sw.WriteLine("H2 {");
                sw.WriteLine("  margin:0 0 4px 0; ");
                sw.WriteLine("  text-align: left;");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("  font-size:12pt;");
                sw.WriteLine("  font-weight: normal;");
                sw.WriteLine("}");

                sw.WriteLine("H3 {");
                sw.WriteLine("  margin:0 0 4px 0; ");
                sw.WriteLine("  text-align: left;");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("  font-size:10pt;");
                sw.WriteLine("  font-weight: normal;");
                sw.WriteLine("}");

                sw.WriteLine("P {");
                sw.WriteLine("  margin:0; ");
                sw.WriteLine("  text-align:left; ");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("  font-size:10pt;");
                sw.WriteLine("}");

                sw.WriteLine("A {");
                sw.WriteLine("  text-decoration: none;");
                sw.WriteLine("}");

                sw.WriteLine("A:link {");
                sw.WriteLine("  color:#1344e9;");
                sw.WriteLine("  background-color: inherit;");
                sw.WriteLine("}");

                sw.WriteLine("A:visited {");
                sw.WriteLine("  color:#0c2d9a;");
                sw.WriteLine("  background-color: inherit;");
                sw.WriteLine("}");

                sw.WriteLine("A:hover {");
                sw.WriteLine("  color:#0000ff;");
                sw.WriteLine("  background-color: inherit;");
                sw.WriteLine("}");

                sw.WriteLine("A:active {");
                sw.WriteLine("  color:#0c2d9a;");
                sw.WriteLine("  background-color: inherit;");
                sw.WriteLine("}");

                sw.WriteLine("A.email {");
                sw.WriteLine("  font-family: 'Courier New',monospace;");
                sw.WriteLine("}");

                sw.WriteLine("UL {");
                sw.WriteLine("  padding-top: 0;");
                sw.WriteLine("  margin-top: 0;");
                sw.WriteLine("  border-top: 0;");
                sw.WriteLine("  text-align: left;");
                sw.WriteLine("  list-style-type: none;");
                sw.WriteLine("}");

                sw.WriteLine("DIV#cover H1 {");
                sw.WriteLine("  text-align:center;");
                sw.WriteLine("  padding-bottom:38px;");
                sw.WriteLine("}");

                sw.WriteLine("DIV#cover P {");
                sw.WriteLine("  text-align:center;");
                sw.WriteLine("  padding-bottom:28px;");
                sw.WriteLine("}");

                sw.WriteLine("DIV#cover DIV#links P {");
                sw.WriteLine("  font-size:12pt;");
                sw.WriteLine("}");

                sw.WriteLine("DIV#page {");
                sw.WriteLine("  width:800px; ");
                sw.WriteLine("  margin:0 auto;");
                sw.WriteLine("  position:relative;");
                sw.WriteLine("}");

                sw.WriteLine("DIV#header {");
                sw.WriteLine("  width:800px;");
                sw.WriteLine("  margin:0 auto;");

                sw.WriteLine("}");
                sw.WriteLine("#header ul {");
                sw.WriteLine("  padding: 0;");
                sw.WriteLine("  margin: 0;");

                sw.WriteLine("}");
                sw.WriteLine("#header li {");
                sw.WriteLine("  display:inline;");
                sw.WriteLine("  font-size:14px;");
                sw.WriteLine("  padding:2px 4px 2px 6px;");
                sw.WriteLine("  line-height:20px;");
                sw.WriteLine("}");

                // For multiple images we like to keep a constant margin down the rhs to accomodate them (IE). Otherwise we just let images float and text spread around them.
                if (GMConfig.Instance.AllowMultipleImages)
                {
                    sw.WriteLine("DIV#main {");
                    int nMainWidth = (760 - GMConfig.Instance.MaxImageWidth);
                    if (nMainWidth < 0)
                    {
                        nMainWidth = 600;
                    }
                    sw.WriteLine("  width: " + nMainWidth + "px;");
                    sw.WriteLine("}");
                }

                sw.WriteLine("DIV#individualSummary P {");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("  font-size:22pt;");
                sw.WriteLine("}");

                sw.WriteLine("DIV#photos {");
                sw.WriteLine("  position:relative;");
                sw.WriteLine("  float:right;");
                sw.WriteLine("  margin-top:16px;");
                sw.WriteLine("  text-align:center;");
                sw.WriteLine("}");

                sw.WriteLine("DIV#mainphoto {");
                sw.WriteLine("  width:" + (GMConfig.Instance.MaxImageWidth + 2) + "px;");
                sw.WriteLine("  height:" + (GMConfig.Instance.MaxImageHeight + 40) + "px;");
                sw.WriteLine("  overflow:auto;");
                sw.WriteLine("}");

                sw.WriteLine("IMG#mainphoto_img {");
                sw.WriteLine("  border:1px solid black;");
                sw.WriteLine("}");

                sw.WriteLine("P#mainphoto_title {");
                sw.WriteLine("  font-family:serif;");
                sw.WriteLine("  font-weight:bold;");
                sw.WriteLine("  text-align:center;");
                sw.WriteLine("}");

                sw.WriteLine("P#sourcepic_title {");
                sw.WriteLine("  font-family:serif;");
                sw.WriteLine("  font-weight:bold;");
                sw.WriteLine("}");

                sw.WriteLine("DIV#miniphotos {");
                sw.WriteLine("  width:" + (GMConfig.Instance.MaxImageWidth + 2) + "px;");
                sw.WriteLine("  text-align:left;");
                sw.WriteLine("}");

                sw.WriteLine("DIV.miniphoto {");
                sw.WriteLine("  float:left;");
                sw.WriteLine("  width:" + (GMConfig.Instance.MaxThumbnailImageWidth + 3) + "px;");
                sw.WriteLine("  height:" + (GMConfig.Instance.MaxThumbnailImageHeight + 3) + "px;");
                sw.WriteLine("  text-align:center;");
                sw.WriteLine("}");

                sw.WriteLine("IMG.miniphoto_img {");
                sw.WriteLine("  border: 1px solid blue;");
                sw.WriteLine("  width:" + (GMConfig.Instance.MaxThumbnailImageWidth + 3) + "px;");
                sw.WriteLine("  height:" + (GMConfig.Instance.MaxThumbnailImageHeight + 3) + "px;");
                sw.WriteLine("}");

                sw.WriteLine("DIV#names {");
                sw.WriteLine("}");

                sw.WriteLine("DIV#references {");
                sw.WriteLine("}");

                sw.WriteLine(".reference {");
                sw.WriteLine("  font-size:8pt;");
                sw.WriteLine("  vertical-align:super;");
                sw.WriteLine("  font-weight:normal;");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("  line-height: 6pt;");
                sw.WriteLine("}");

                sw.WriteLine(".nicknames {");
                sw.WriteLine("  font-size:12pt;");
                sw.WriteLine("  font-weight: normal;");
                sw.WriteLine("  font-style: italic;");
                sw.WriteLine("}");

                sw.WriteLine(".centred {");
                sw.WriteLine("  text-align: center;");
                sw.WriteLine("}");

                sw.WriteLine("#index {");
                sw.WriteLine("  text-align: left;");
                sw.WriteLine("}");

                sw.WriteLine("P.plain {");
                sw.WriteLine("  font-size:11px;");
                sw.WriteLine("  text-align:right;");
                sw.WriteLine("}");

                sw.WriteLine("P.plain A {");
                sw.WriteLine("  text-decoration: none;");
                sw.WriteLine("  color:inherit;");
                sw.WriteLine("}");

                sw.WriteLine("#headingsLinks P {");
                sw.WriteLine("  margin-bottom: 18px;");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("  font-size:12pt;");
                sw.WriteLine("  font-weight: bold;");
                sw.WriteLine("  text-align: center;");
                sw.WriteLine("  border-top: 1px solid gray;");
                sw.WriteLine("  border-bottom: 1px solid gray;  ");
                sw.WriteLine("}");

                sw.WriteLine("#index TD {");
                sw.WriteLine("  width:360px;");
                sw.WriteLine("}");

                sw.WriteLine("#events {");
                sw.WriteLine("  text-align: left;");
                sw.WriteLine("  line-height: 14pt;");
                sw.WriteLine("}");

                sw.WriteLine(".eventNote {");
                sw.WriteLine("  font-style: italic; ");
                sw.WriteLine("}");

                sw.WriteLine("#text {");
                sw.WriteLine("  font-family: 'Times New Roman', serif; ");
                sw.WriteLine("  text-align: left;");
                sw.WriteLine("  font-size:13pt;");
                sw.WriteLine("  margin: 22px 0 0 0;");
                sw.WriteLine("}");

                sw.WriteLine("#notes {");
                sw.WriteLine("  font-family: 'Times New Roman', serif; ");
                sw.WriteLine("  text-align: left;");
                sw.WriteLine("  font-size:13pt;");
                sw.WriteLine("  margin-top: 22px;");
                sw.WriteLine("}");

                sw.WriteLine("#references {");
                sw.WriteLine("  font-family:  Verdana, Arial, Helvetica, sans-serif; ");
                sw.WriteLine("  text-align: left;");
                sw.WriteLine("  font-size:10pt;");
                sw.WriteLine("  margin-top: 22px;");
                sw.WriteLine("}");

                sw.WriteLine("#references UL {");
                sw.WriteLine("  margin: 0 0 0 8px;");
                sw.WriteLine("}");

                sw.WriteLine("#notes UL {");
                sw.WriteLine("  list-style-type: disc;");
                sw.WriteLine("  margin-left:8px;");
                sw.WriteLine("  padding-left:0px;");
                sw.WriteLine("}");

                sw.WriteLine("#notes LI {");
                sw.WriteLine("  text-align:left; ");
                sw.WriteLine("  font-family: Verdana, Arial, Helvetica, sans-serif;");
                sw.WriteLine("  font-size:10pt;");
                sw.WriteLine("}");

                sw.WriteLine("#sourcePics {");
                sw.WriteLine("  margin: 20px 0 24px 0;");
                sw.WriteLine("}");

                sw.WriteLine("P.pretext {");
                sw.WriteLine("  font-family: \"Courier New\", monospace; ");
                sw.WriteLine("  text-align: left;");
                sw.WriteLine("  font-size:10pt;");
                sw.WriteLine("  font-weight:normal;");
                sw.WriteLine("  margin: 0 0 0 0;");
                sw.WriteLine("}");

                sw.WriteLine("DIV#footer {");
                sw.WriteLine("  margin-top: 64px;");
                sw.WriteLine("}");

                sw.WriteLine("DIV#footer P {");
                sw.WriteLine("  font-size:11px;");
                sw.WriteLine("  text-align:right;");
                sw.WriteLine("}");

                sw.WriteLine("#events TD {");
                sw.WriteLine("  padding: 0 0 6px 8px;");
                sw.WriteLine("  vertical-align: top;");
                sw.WriteLine("}");

                sw.WriteLine("#facts TD {");
                sw.WriteLine("  padding: 0 0 6px 8px;");
                sw.WriteLine("  vertical-align: top;");
                sw.WriteLine("}");

                sw.WriteLine("#events TD.date {");
                sw.WriteLine("  width:160px;");
                sw.WriteLine("}");

                sw.WriteLine("#facts TD.date {");
                sw.WriteLine("  width:160px;");
                sw.WriteLine("}");

                sw.WriteLine("TD.date P {");
                sw.WriteLine("  font-weight:normal;");
                sw.WriteLine("}");

                sw.WriteLine("TD.event P {");
                sw.WriteLine("  font-weight:normal;");
                sw.WriteLine("  line-height: 14pt;"); // Stops IE truncating bottom of gedcomLine
                sw.WriteLine("  margin-bottom:2px;"); // No this does actually.
                sw.WriteLine("}");

                sw.WriteLine("TD P.important {");
                sw.WriteLine("  font-weight:bold;");
                sw.WriteLine("}");

                sw.WriteLine("#minitree {");
                sw.WriteLine("  position:relative;");
                sw.WriteLine("  width:100%;");
                sw.WriteLine("  overflow:auto;");
                sw.WriteLine("  text-align:center;");
                sw.WriteLine("}");

                sw.WriteLine("DIV#keyindividuals P {");
                sw.WriteLine("  padding-bottom: 8px;");
                sw.WriteLine("}");

                sw.WriteLine("DIV#keyindividuals UL {");
                sw.WriteLine("  text-align:center;");
                sw.WriteLine("  margin-left:auto;");
                sw.WriteLine("  margin-right:auto;");
                sw.WriteLine("  font-size:10pt;");
                sw.WriteLine("}");

                sw.WriteLine("DIV.hr {");
                sw.WriteLine("  height:0;");
                sw.WriteLine("  border-top:1px solid #eee;");
                sw.WriteLine("  border-bottom:1px solid #aaa;");
                sw.WriteLine("}");
            } catch (IOException e) {
                fLogger.WriteError("Caught IO Exception(5) : ", e);
            } catch (ArgumentException e) {
                fLogger.WriteError("Caught Argument Exception(5) : ", e);
            } catch (UnauthorizedAccessException e) {
                fLogger.WriteError("Caught UnauthorizedAccessException(5) : ", e);
            } finally {
                if (sw != null)
                {
                    sw.Close();
                }
            }
        }