Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of some missing features in the SvgGdi Bridge #2

Merged
merged 1 commit into from
Mar 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ A fork of the SvgNet & SvgGdi bridge (http://www.codeproject.com/KB/cs/svgnet.as
## License: BSD

Copyright © 2010 SvgNet & SvgGdi Bridge Project. All rights reserved.

Copyright © 2003 RiskCare Ltd. All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
90 changes: 47 additions & 43 deletions SvgDocTest/Form1.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/*
Copyright c 2010 SvgNet & SvgGdi Bridge Project. All rights reserved.

Copyright c 2003 by RiskCare Ltd. All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -47,11 +49,13 @@ public class Form1 : System.Windows.Forms.Form
private System.Windows.Forms.TextBox tbOut;
private System.Windows.Forms.TextBox tbIn;
private System.Windows.Forms.Button button3;
private AxSVGACTIVEXLib.AxSVGCtl svgOut;
private AxSVGACTIVEXLib.AxSVGCtl svgIn;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button2;
private WebBrowser svgIn;
private WebBrowser svgOut;


/// <summary>
/// Required designer variable.
/// </summary>
Expand Down Expand Up @@ -91,18 +95,15 @@ protected override void Dispose( bool disposing )
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.button1 = new System.Windows.Forms.Button();
this.tbOut = new System.Windows.Forms.TextBox();
this.tbIn = new System.Windows.Forms.TextBox();
this.button3 = new System.Windows.Forms.Button();
this.svgOut = new AxSVGACTIVEXLib.AxSVGCtl();
this.svgIn = new AxSVGACTIVEXLib.AxSVGCtl();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.svgOut)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.svgIn)).BeginInit();
this.svgIn = new System.Windows.Forms.WebBrowser();
this.svgOut = new System.Windows.Forms.WebBrowser();
this.SuspendLayout();
//
// button1
Expand Down Expand Up @@ -141,24 +142,6 @@ private void InitializeComponent()
this.button3.Text = "Run Type Tests";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// svgOut
//
this.svgOut.Enabled = true;
this.svgOut.Location = new System.Drawing.Point(576, 296);
this.svgOut.Name = "svgOut";
this.svgOut.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("svgOut.OcxState")));
this.svgOut.Size = new System.Drawing.Size(336, 248);
this.svgOut.TabIndex = 5;
//
// svgIn
//
this.svgIn.Enabled = true;
this.svgIn.Location = new System.Drawing.Point(576, 32);
this.svgIn.Name = "svgIn";
this.svgIn.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("svgIn.OcxState")));
this.svgIn.Size = new System.Drawing.Size(336, 232);
this.svgIn.TabIndex = 6;
//
// label1
//
this.label1.Location = new System.Drawing.Point(184, 0);
Expand All @@ -184,26 +167,40 @@ private void InitializeComponent()
this.button2.Text = "Run Composition Tests";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// svgIn
//
this.svgIn.Location = new System.Drawing.Point(576, 32);
this.svgIn.MinimumSize = new System.Drawing.Size(20, 20);
this.svgIn.Name = "svgIn";
this.svgIn.Size = new System.Drawing.Size(336, 232);
this.svgIn.TabIndex = 10;
//
// svgOut
//
this.svgOut.Location = new System.Drawing.Point(576, 296);
this.svgOut.MinimumSize = new System.Drawing.Size(20, 20);
this.svgOut.Name = "svgOut";
this.svgOut.Size = new System.Drawing.Size(336, 248);
this.svgOut.TabIndex = 11;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(944, 581);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button2,
this.label2,
this.label1,
this.svgIn,
this.svgOut,
this.button3,
this.tbIn,
this.tbOut,
this.button1});
this.Controls.Add(this.svgOut);
this.Controls.Add(this.svgIn);
this.Controls.Add(this.button2);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button3);
this.Controls.Add(this.tbIn);
this.Controls.Add(this.tbOut);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "SvgNet doc reading/writing test";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.svgOut)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.svgIn)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

}
#endregion
Expand Down Expand Up @@ -232,21 +229,25 @@ private void button1_Click(object sender, System.EventArgs e)

doc.Load(fname);

svgIn.SRC = fname;
svgIn.Navigate(new Uri(fname));
svgIn.Refresh(WebBrowserRefreshOption.Completely);

_e = SvgFactory.LoadFromXML(doc, null);

string output = _e.WriteSVGString(true);

tbOut.Text = output;

StreamWriter tw = new StreamWriter("c:\\temp\\foo.svg", false);

string tempFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "foo.svg");

StreamWriter tw = new StreamWriter(tempFile, false);

tw.Write(output);

tw.Close();

svgOut.SRC = "c:\\temp\\foo.svg";
svgOut.Navigate(new Uri(tempFile));
svgOut.Refresh(WebBrowserRefreshOption.Completely);
}
}

Expand Down Expand Up @@ -337,13 +338,16 @@ private void button2_Click(object sender, System.EventArgs e)

tbOut.Text = s;

StreamWriter tw = new StreamWriter("c:\\temp\\foo.svg", false);
string tempFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "foo.svg");

StreamWriter tw = new StreamWriter(tempFile, false);

tw.Write(s);

tw.Close();

svgOut.SRC = "c:\\temp\\foo.svg";
svgOut.Navigate(new Uri(tempFile));
svgOut.Refresh(WebBrowserRefreshOption.Completely);
}
}

Expand Down
164 changes: 80 additions & 84 deletions SvgDocTest/Form1.resx
Original file line number Diff line number Diff line change
@@ -1,75 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema

Version 1.3
Microsoft ResX Schema

Version 2.0

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>

There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
Expand All @@ -88,37 +109,12 @@
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="svgOut.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuMzMw
MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFT
eXN0ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAswAA
AAIBAAAAAQAAAAAAAAAAAAAAAJ4AAAAGAAAARm9ybWF0AQAAADEFAAAAV2lkdGgEAAAAODg5MAYAAABI
ZWlnaHQEAAAANjU2MgUAAABXTW9kZQYAAAB3aW5kb3cPAAAAZGVmYXVsdEZvbnRTaXplAgAAADEyEQAA
AGRlZmF1bHRGb250RmFtaWx5BwAAAEFyaWFsTVQQAAAAZGVmYXVsdEFudGlhbGlhcwEAAAAxAwAAAEVu
ZAs=
</value>
</data>
<data name="svgIn.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuMzMw
MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFT
eXN0ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAswAA
AAIBAAAAAQAAAAAAAAAAAAAAAJ4AAAAGAAAARm9ybWF0AQAAADEFAAAAV2lkdGgEAAAAODg5MAYAAABI
ZWlnaHQEAAAANjEzOAUAAABXTW9kZQYAAAB3aW5kb3cPAAAAZGVmYXVsdEZvbnRTaXplAgAAADEyEQAA
AGRlZmF1bHRGb250RmFtaWx5BwAAAEFyaWFsTVQQAAAAZGVmYXVsdEFudGlhbGlhcwEAAAAxAwAAAEVu
ZAs=
</value>
</data>
<data name="$this.Name">
<value>Form1</value>
</data>
</root>
14 changes: 0 additions & 14 deletions SvgDocTest/SvgDocTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,6 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<COMReference Include="AxSVGACTIVEXLib">
<Guid>{8415B62C-3C1B-416E-B5D7-40D983A9FA50}</Guid>
<VersionMajor>3</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>aximp</WrapperTool>
</COMReference>
<COMReference Include="SVGACTIVEXLib">
<Guid>{8415B62C-3C1B-416E-B5D7-40D983A9FA50}</Guid>
<VersionMajor>3</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
</COMReference>
<ProjectReference Include="..\SvgNet\SvgNet.csproj">
<Name>SvgNet</Name>
<Project>{BB4C8021-B5E1-4DE2-82CB-14BDFB9837E4}</Project>
Expand Down
Loading