diff --git a/PROMS/fmtxml/GenXmlToSvg.cs b/PROMS/fmtxml/GenXmlToSvg.cs index 751add24..5fc67131 100644 --- a/PROMS/fmtxml/GenXmlToSvg.cs +++ b/PROMS/fmtxml/GenXmlToSvg.cs @@ -19,7 +19,7 @@ namespace fmtxml private XmlDocument xmlDoc; private XmlDocument xmlOutDoc; private XmlElement topOutElement; - private int Convertn = 300, I = 300, C = 118, D = 1; + private int Convertn = 300, I = 300, C = 118, D = 1, N = 0; private float Wid = 3; private int RTFFontSize = 20; private int RTFFontFamily = 3; @@ -195,6 +195,8 @@ namespace fmtxml } // convert from x (in inches) to points else if (Convertn == I) return (float)(x * 72); + else if (Convertn == N) + return (float)x; else // convert from x (in dots) to twips & then points return (float)(((4.8 * x + 0.5)/1440f)*72); } @@ -240,12 +242,14 @@ namespace fmtxml // Now for each macro, create a svg group with the name given to // it. Later we may change this to map to what was created in 16-bit // proms (for example BOX1 -> B1) + bool hasC0 = false; foreach (XmlNode nd in xmlNds) { XmlNode name = nd.SelectSingleNode("NAME"); XmlElement elm = (XmlElement) name; XmlElement grp = xmlOutDoc.CreateElement("g"); string cname = GetName(name.InnerText); + if (cname == "CNUM") hasC0 = true; grp.SetAttribute("id",cname); topOutElement.AppendChild(grp); XmlNode definition = nd.SelectSingleNode("DEFINITION"); @@ -258,6 +262,27 @@ namespace fmtxml MessageBox.Show("Error processing macro definition for " + this.genName, e.Message); } } + // if the C0 (circle string) macro didn't exist, add a default. This is done so special code + // does not have to be written to do the circle string in edit/print. + /* Add the C0 macro if not there! + + + + */ + if (!hasC0) + { + int savconvertn = Convertn; + Convertn = 0; // don't convert size + XmlElement grp = xmlOutDoc.CreateElement("g"); + grp.SetAttribute("id", "C0"); + topOutElement.AppendChild(grp); + // these numbers were gotten from hlp backup circle. They may need adjusted + // as genmacs are used! + cx = -76; + cy = -306; + grp.AppendChild(Ellipse(430,450)); + Convertn = savconvertn; + } xmlNds = top.SelectNodes("USERDEF");