]> granicus.if.org Git - graphviz/commitdiff
basic viewer app for Windows
authorglenlow <devnull@localhost>
Wed, 19 Mar 2008 04:15:06 +0000 (04:15 +0000)
committerglenlow <devnull@localhost>
Wed, 19 Mar 2008 04:15:06 +0000 (04:15 +0000)
configure.ac
windows/Graph.cs [new file with mode: 0755]
windows/GraphForm.Designer.cs [new file with mode: 0755]
windows/GraphForm.cs [new file with mode: 0755]

index 4a7303a23d098d206577c3a381255cb37fee9a84..41d79650060c9c3a2bc32222710fe5fb92c9f021 100644 (file)
@@ -2522,6 +2522,7 @@ AC_CONFIG_FILES(Makefile
        macosx/graphviz.pmdoc/01local.xml
        macosx/graphviz.pmdoc/02graphviz.xml
        windows/graphviz.wxs
+       windows/Properties/AssemblyInfo.cs
        plugin/Makefile
        plugin/core/Makefile
        plugin/devil/Makefile
diff --git a/windows/Graph.cs b/windows/Graph.cs
new file mode 100755 (executable)
index 0000000..2b4b3d3
--- /dev/null
@@ -0,0 +1,127 @@
+/* $Id$ $Revision$ */\r
+/* vim:set shiftwidth=4 ts=8: */\r
+\r
+/**********************************************************\r
+*      This software is part of the graphviz package      *\r
+*                http://www.graphviz.org/                 *\r
+*                                                         *\r
+*            Copyright (c) 1994-2008 AT&T Corp.           *\r
+*                and is licensed under the                *\r
+*            Common Public License, Version 1.0           *\r
+*                      by AT&T Corp.                      *\r
+*                                                         *\r
+*        Information and Software Systems Research        *\r
+*              AT&T Research, Florham Park NJ             *\r
+**********************************************************/\r
+\r
+using System;\r
+using System.Collections.Generic;\r
+using System.ComponentModel;\r
+using System.IO;\r
+using System.Runtime.InteropServices;\r
+\r
+namespace Graphviz\r
+{\r
+       public class Graph : IDisposable\r
+       {\r
+               public class Exception : ApplicationException\r
+               {\r
+                       public Exception(string message): base(message)\r
+                       {\r
+                       }\r
+               }\r
+               \r
+               public Graph(string filename)\r
+               {\r
+                       IntPtr file = fopen(filename, "r");\r
+                       if (file == IntPtr.Zero)\r
+                               throw new Win32Exception();\r
+                       _graph = agread(file);\r
+                       if (_graph == IntPtr.Zero)\r
+                               throw new Win32Exception();\r
+                       fclose(file);\r
+               }\r
+               \r
+               public void Save(string filename)\r
+               {\r
+                       IntPtr file = fopen(filename, "w");\r
+                       if (file == IntPtr.Zero)\r
+                               throw new Win32Exception();\r
+                       if (agwrite(_graph, file) != 0)\r
+                               throw new Win32Exception();\r
+                       fclose(file);\r
+               }\r
+               \r
+               public void Layout(string engine)\r
+               {\r
+                       if (gvLayout(_context, _graph, engine) != 0)\r
+                               throw new Exception("bad layout");\r
+               }\r
+               \r
+               public Stream Render(string format)\r
+               {\r
+                       unsafe {\r
+                               byte* result;\r
+                               uint length;\r
+                               if (gvRenderData(_context, _graph, format, out result, out length) != 0)\r
+                                       throw new Exception("bad render");\r
+                               return new RenderStream(result, length);\r
+                       }\r
+               }\r
+               \r
+               void IDisposable.Dispose()\r
+               {\r
+                       agclose(_graph);\r
+               }\r
+               \r
+               private unsafe class RenderStream : UnmanagedMemoryStream\r
+               {\r
+                       public RenderStream(byte* pointer, long length): base(pointer, length)\r
+                       {\r
+                               _pointer = pointer;\r
+                       }\r
+\r
+                       protected override void Dispose(bool disposing)\r
+                       {\r
+                               base.Dispose(disposing);\r
+                               if (disposing)\r
+                                       free(_pointer);\r
+                       }\r
+                       \r
+                       private readonly byte* _pointer;\r
+               }\r
+               \r
+               [DllImport("libgraph-4.dll", SetLastError = true)]\r
+               private static extern void agclose(IntPtr file);\r
+\r
+               [DllImport("libgraph-4.dll", SetLastError = true)]\r
+               private static extern IntPtr agread(IntPtr file);\r
+\r
+               [DllImport("libgraph-4.dll", SetLastError = true)]\r
+               private static extern int agwrite(IntPtr graph, IntPtr file);\r
+               \r
+               [DllImport("libgvc-4.dll")]\r
+               private static extern IntPtr gvContext();\r
+\r
+               [DllImport("libgvc-4.dll")]\r
+               private static extern int gvLayout(IntPtr context, IntPtr graph, string engine);\r
+\r
+               [DllImport("libgvc-4.dll")]\r
+               private static extern int gvRenderFilename(IntPtr context, IntPtr graph, string format, string filename);\r
+               \r
+               [DllImport("libgvc-4.dll")]\r
+               private static extern unsafe int gvRenderData(IntPtr context, IntPtr graph, string format, out byte* result, out uint length);\r
+\r
+               [DllImport("msvcrt.dll", SetLastError = true)]\r
+               private static extern int fclose(IntPtr file);\r
+\r
+               [DllImport("msvcrt.dll", SetLastError = true)]\r
+               private static extern IntPtr fopen(string filename, string mode);\r
+\r
+               [DllImport("msvcrt.dll", SetLastError = true)]\r
+               private static extern unsafe void free(byte* pointer);\r
+\r
+               private static readonly IntPtr _context = gvContext();\r
+               private readonly IntPtr _graph;\r
+       }\r
+}\r
diff --git a/windows/GraphForm.Designer.cs b/windows/GraphForm.Designer.cs
new file mode 100755 (executable)
index 0000000..73eec1c
--- /dev/null
@@ -0,0 +1,373 @@
+namespace Graphviz\r
+{\r
+       partial class GraphForm\r
+       {\r
+               /// <summary>\r
+               /// Required designer variable.\r
+               /// </summary>\r
+               private System.ComponentModel.IContainer components = null;\r
+\r
+               /// <summary>\r
+               /// Clean up any resources being used.\r
+               /// </summary>\r
+               /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>\r
+               protected override void Dispose(bool disposing)\r
+               {\r
+                       if (disposing && (components != null))\r
+                       {\r
+                               components.Dispose();\r
+                       }\r
+                       base.Dispose(disposing);\r
+               }\r
+\r
+               #region Windows Form Designer generated code\r
+\r
+               /// <summary>\r
+               /// Required method for Designer support - do not modify\r
+               /// the contents of this method with the code editor.\r
+               /// </summary>\r
+               private void InitializeComponent()\r
+               {\r
+                       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GraphForm));\r
+                       this.mainMenuStrip = new System.Windows.Forms.MenuStrip();\r
+                       this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator();\r
+                       this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();\r
+                       this.printToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.printPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();\r
+                       this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();\r
+                       this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();\r
+                       this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.customizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.windowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.contentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.indexToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();\r
+                       this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+                       this.openFileDialog = new System.Windows.Forms.OpenFileDialog();\r
+                       this.graphControl = new Graphviz.ScrollableImageControl();\r
+                       this.mainMenuStrip.SuspendLayout();\r
+                       this.SuspendLayout();\r
+                       // \r
+                       // mainMenuStrip\r
+                       // \r
+                       this.mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {\r
+            this.fileToolStripMenuItem,\r
+            this.editToolStripMenuItem,\r
+            this.toolsToolStripMenuItem,\r
+            this.windowToolStripMenuItem,\r
+            this.helpToolStripMenuItem});\r
+                       this.mainMenuStrip.Location = new System.Drawing.Point(0, 0);\r
+                       this.mainMenuStrip.Name = "mainMenuStrip";\r
+                       this.mainMenuStrip.Size = new System.Drawing.Size(292, 24);\r
+                       this.mainMenuStrip.TabIndex = 0;\r
+                       // \r
+                       // fileToolStripMenuItem\r
+                       // \r
+                       this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {\r
+            this.newToolStripMenuItem,\r
+            this.openToolStripMenuItem,\r
+            this.toolStripSeparator,\r
+            this.saveToolStripMenuItem,\r
+            this.saveAsToolStripMenuItem,\r
+            this.toolStripSeparator1,\r
+            this.printToolStripMenuItem,\r
+            this.printPreviewToolStripMenuItem,\r
+            this.toolStripSeparator2,\r
+            this.exitToolStripMenuItem});\r
+                       this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";\r
+                       this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20);\r
+                       this.fileToolStripMenuItem.Text = "&File";\r
+                       // \r
+                       // newToolStripMenuItem\r
+                       // \r
+                       this.newToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripMenuItem.Image")));\r
+                       this.newToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;\r
+                       this.newToolStripMenuItem.Name = "newToolStripMenuItem";\r
+                       this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));\r
+                       this.newToolStripMenuItem.Size = new System.Drawing.Size(151, 22);\r
+                       this.newToolStripMenuItem.Text = "&New";\r
+                       // \r
+                       // openToolStripMenuItem\r
+                       // \r
+                       this.openToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripMenuItem.Image")));\r
+                       this.openToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;\r
+                       this.openToolStripMenuItem.Name = "openToolStripMenuItem";\r
+                       this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));\r
+                       this.openToolStripMenuItem.Size = new System.Drawing.Size(151, 22);\r
+                       this.openToolStripMenuItem.Text = "&Open";\r
+                       // \r
+                       // toolStripSeparator\r
+                       // \r
+                       this.toolStripSeparator.Name = "toolStripSeparator";\r
+                       this.toolStripSeparator.Size = new System.Drawing.Size(148, 6);\r
+                       // \r
+                       // saveToolStripMenuItem\r
+                       // \r
+                       this.saveToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem.Image")));\r
+                       this.saveToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;\r
+                       this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";\r
+                       this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));\r
+                       this.saveToolStripMenuItem.Size = new System.Drawing.Size(151, 22);\r
+                       this.saveToolStripMenuItem.Text = "&Save";\r
+                       // \r
+                       // saveAsToolStripMenuItem\r
+                       // \r
+                       this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";\r
+                       this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(151, 22);\r
+                       this.saveAsToolStripMenuItem.Text = "Save &As";\r
+                       // \r
+                       // toolStripSeparator1\r
+                       // \r
+                       this.toolStripSeparator1.Name = "toolStripSeparator1";\r
+                       this.toolStripSeparator1.Size = new System.Drawing.Size(148, 6);\r
+                       // \r
+                       // printToolStripMenuItem\r
+                       // \r
+                       this.printToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printToolStripMenuItem.Image")));\r
+                       this.printToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;\r
+                       this.printToolStripMenuItem.Name = "printToolStripMenuItem";\r
+                       this.printToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P)));\r
+                       this.printToolStripMenuItem.Size = new System.Drawing.Size(151, 22);\r
+                       this.printToolStripMenuItem.Text = "&Print";\r
+                       // \r
+                       // printPreviewToolStripMenuItem\r
+                       // \r
+                       this.printPreviewToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printPreviewToolStripMenuItem.Image")));\r
+                       this.printPreviewToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;\r
+                       this.printPreviewToolStripMenuItem.Name = "printPreviewToolStripMenuItem";\r
+                       this.printPreviewToolStripMenuItem.Size = new System.Drawing.Size(151, 22);\r
+                       this.printPreviewToolStripMenuItem.Text = "Print Pre&view";\r
+                       // \r
+                       // toolStripSeparator2\r
+                       // \r
+                       this.toolStripSeparator2.Name = "toolStripSeparator2";\r
+                       this.toolStripSeparator2.Size = new System.Drawing.Size(148, 6);\r
+                       // \r
+                       // exitToolStripMenuItem\r
+                       // \r
+                       this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";\r
+                       this.exitToolStripMenuItem.Size = new System.Drawing.Size(151, 22);\r
+                       this.exitToolStripMenuItem.Text = "E&xit";\r
+                       this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);\r
+                       // \r
+                       // editToolStripMenuItem\r
+                       // \r
+                       this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {\r
+            this.undoToolStripMenuItem,\r
+            this.redoToolStripMenuItem,\r
+            this.toolStripSeparator3,\r
+            this.cutToolStripMenuItem,\r
+            this.copyToolStripMenuItem,\r
+            this.pasteToolStripMenuItem,\r
+            this.toolStripSeparator4,\r
+            this.selectAllToolStripMenuItem});\r
+                       this.editToolStripMenuItem.Name = "editToolStripMenuItem";\r
+                       this.editToolStripMenuItem.Size = new System.Drawing.Size(37, 20);\r
+                       this.editToolStripMenuItem.Text = "&Edit";\r
+                       // \r
+                       // undoToolStripMenuItem\r
+                       // \r
+                       this.undoToolStripMenuItem.Name = "undoToolStripMenuItem";\r
+                       this.undoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));\r
+                       this.undoToolStripMenuItem.Size = new System.Drawing.Size(150, 22);\r
+                       this.undoToolStripMenuItem.Text = "&Undo";\r
+                       // \r
+                       // redoToolStripMenuItem\r
+                       // \r
+                       this.redoToolStripMenuItem.Name = "redoToolStripMenuItem";\r
+                       this.redoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y)));\r
+                       this.redoToolStripMenuItem.Size = new System.Drawing.Size(150, 22);\r
+                       this.redoToolStripMenuItem.Text = "&Redo";\r
+                       // \r
+                       // toolStripSeparator3\r
+                       // \r
+                       this.toolStripSeparator3.Name = "toolStripSeparator3";\r
+                       this.toolStripSeparator3.Size = new System.Drawing.Size(147, 6);\r
+                       // \r
+                       // cutToolStripMenuItem\r
+                       // \r
+                       this.cutToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("cutToolStripMenuItem.Image")));\r
+                       this.cutToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;\r
+                       this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";\r
+                       this.cutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));\r
+                       this.cutToolStripMenuItem.Size = new System.Drawing.Size(150, 22);\r
+                       this.cutToolStripMenuItem.Text = "Cu&t";\r
+                       // \r
+                       // copyToolStripMenuItem\r
+                       // \r
+                       this.copyToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("copyToolStripMenuItem.Image")));\r
+                       this.copyToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;\r
+                       this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";\r
+                       this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));\r
+                       this.copyToolStripMenuItem.Size = new System.Drawing.Size(150, 22);\r
+                       this.copyToolStripMenuItem.Text = "&Copy";\r
+                       // \r
+                       // pasteToolStripMenuItem\r
+                       // \r
+                       this.pasteToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("pasteToolStripMenuItem.Image")));\r
+                       this.pasteToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta;\r
+                       this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";\r
+                       this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));\r
+                       this.pasteToolStripMenuItem.Size = new System.Drawing.Size(150, 22);\r
+                       this.pasteToolStripMenuItem.Text = "&Paste";\r
+                       // \r
+                       // toolStripSeparator4\r
+                       // \r
+                       this.toolStripSeparator4.Name = "toolStripSeparator4";\r
+                       this.toolStripSeparator4.Size = new System.Drawing.Size(147, 6);\r
+                       // \r
+                       // selectAllToolStripMenuItem\r
+                       // \r
+                       this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem";\r
+                       this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(150, 22);\r
+                       this.selectAllToolStripMenuItem.Text = "Select &All";\r
+                       // \r
+                       // toolsToolStripMenuItem\r
+                       // \r
+                       this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {\r
+            this.customizeToolStripMenuItem,\r
+            this.optionsToolStripMenuItem});\r
+                       this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";\r
+                       this.toolsToolStripMenuItem.Size = new System.Drawing.Size(44, 20);\r
+                       this.toolsToolStripMenuItem.Text = "&Tools";\r
+                       // \r
+                       // customizeToolStripMenuItem\r
+                       // \r
+                       this.customizeToolStripMenuItem.Name = "customizeToolStripMenuItem";\r
+                       this.customizeToolStripMenuItem.Size = new System.Drawing.Size(134, 22);\r
+                       this.customizeToolStripMenuItem.Text = "&Customize";\r
+                       // \r
+                       // optionsToolStripMenuItem\r
+                       // \r
+                       this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";\r
+                       this.optionsToolStripMenuItem.Size = new System.Drawing.Size(134, 22);\r
+                       this.optionsToolStripMenuItem.Text = "&Options";\r
+                       // \r
+                       // windowToolStripMenuItem\r
+                       // \r
+                       this.windowToolStripMenuItem.Name = "windowToolStripMenuItem";\r
+                       this.windowToolStripMenuItem.Size = new System.Drawing.Size(57, 20);\r
+                       this.windowToolStripMenuItem.Text = "&Window";\r
+                       // \r
+                       // helpToolStripMenuItem\r
+                       // \r
+                       this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {\r
+            this.contentsToolStripMenuItem,\r
+            this.indexToolStripMenuItem,\r
+            this.searchToolStripMenuItem,\r
+            this.toolStripSeparator5,\r
+            this.aboutToolStripMenuItem});\r
+                       this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";\r
+                       this.helpToolStripMenuItem.Size = new System.Drawing.Size(40, 20);\r
+                       this.helpToolStripMenuItem.Text = "&Help";\r
+                       // \r
+                       // contentsToolStripMenuItem\r
+                       // \r
+                       this.contentsToolStripMenuItem.Name = "contentsToolStripMenuItem";\r
+                       this.contentsToolStripMenuItem.Size = new System.Drawing.Size(129, 22);\r
+                       this.contentsToolStripMenuItem.Text = "&Contents";\r
+                       // \r
+                       // indexToolStripMenuItem\r
+                       // \r
+                       this.indexToolStripMenuItem.Name = "indexToolStripMenuItem";\r
+                       this.indexToolStripMenuItem.Size = new System.Drawing.Size(129, 22);\r
+                       this.indexToolStripMenuItem.Text = "&Index";\r
+                       // \r
+                       // searchToolStripMenuItem\r
+                       // \r
+                       this.searchToolStripMenuItem.Name = "searchToolStripMenuItem";\r
+                       this.searchToolStripMenuItem.Size = new System.Drawing.Size(129, 22);\r
+                       this.searchToolStripMenuItem.Text = "&Search";\r
+                       // \r
+                       // toolStripSeparator5\r
+                       // \r
+                       this.toolStripSeparator5.Name = "toolStripSeparator5";\r
+                       this.toolStripSeparator5.Size = new System.Drawing.Size(126, 6);\r
+                       // \r
+                       // aboutToolStripMenuItem\r
+                       // \r
+                       this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";\r
+                       this.aboutToolStripMenuItem.Size = new System.Drawing.Size(129, 22);\r
+                       this.aboutToolStripMenuItem.Text = "&About...";\r
+                       // \r
+                       // graphControl\r
+                       // \r
+                       this.graphControl.Dock = System.Windows.Forms.DockStyle.Fill;\r
+                       this.graphControl.Image = null;\r
+                       this.graphControl.Location = new System.Drawing.Point(0, 24);\r
+                       this.graphControl.Name = "graphControl";\r
+                       this.graphControl.Size = new System.Drawing.Size(292, 242);\r
+                       this.graphControl.TabIndex = 1;\r
+                       this.graphControl.Zoom = 1F;\r
+                       // \r
+                       // GraphForm\r
+                       // \r
+                       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
+                       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
+                       this.ClientSize = new System.Drawing.Size(292, 266);\r
+                       this.Controls.Add(this.graphControl);\r
+                       this.Controls.Add(this.mainMenuStrip);\r
+                       this.MainMenuStrip = this.mainMenuStrip;\r
+                       this.Name = "GraphForm";\r
+                       this.mainMenuStrip.ResumeLayout(false);\r
+                       this.mainMenuStrip.PerformLayout();\r
+                       this.ResumeLayout(false);\r
+                       this.PerformLayout();\r
+\r
+               }\r
+\r
+               #endregion\r
+\r
+               private System.Windows.Forms.MenuStrip mainMenuStrip;\r
+               private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripSeparator toolStripSeparator;\r
+               private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;\r
+               private System.Windows.Forms.ToolStripMenuItem printToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem printPreviewToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;\r
+               private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;\r
+               private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;\r
+               private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem customizeToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem windowToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem contentsToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem indexToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem;\r
+               private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;\r
+               private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;\r
+               private System.Windows.Forms.OpenFileDialog openFileDialog;\r
+               private ScrollableImageControl graphControl;\r
+       }\r
+}\r
+\r
diff --git a/windows/GraphForm.cs b/windows/GraphForm.cs
new file mode 100755 (executable)
index 0000000..59fe75f
--- /dev/null
@@ -0,0 +1,60 @@
+/* $Id$ $Revision$ */\r
+/* vim:set shiftwidth=4 ts=8: */\r
+\r
+/**********************************************************\r
+*      This software is part of the graphviz package      *\r
+*                http://www.graphviz.org/                 *\r
+*                                                         *\r
+*            Copyright (c) 1994-2008 AT&T Corp.           *\r
+*                and is licensed under the                *\r
+*            Common Public License, Version 1.0           *\r
+*                      by AT&T Corp.                      *\r
+*                                                         *\r
+*        Information and Software Systems Research        *\r
+*              AT&T Research, Florham Park NJ             *\r
+**********************************************************/\r
+\r
+using System;\r
+using System.Drawing.Imaging;\r
+using System.IO;\r
+using System.Windows.Forms;\r
+\r
+namespace Graphviz\r
+{\r
+       public partial class GraphForm : Form\r
+       {\r
+               public ToolStripMenuItem OpenMenuItem\r
+               {\r
+                       get { return openToolStripMenuItem; }\r
+               }\r
+               \r
+               public ToolStripMenuItem WindowMenuItem\r
+               {\r
+                       get { return windowToolStripMenuItem; }\r
+               }\r
+               \r
+               public GraphForm(string filename)\r
+               {\r
+                       InitializeComponent();\r
+               \r
+                       _graph = new Graph(filename);\r
+                       Text = Path.GetFileName(filename);\r
+                       _graph.Layout("dot");\r
+                       using (Stream stream = _graph.Render("emfplus:gdiplus"))\r
+                               graphControl.Image = new Metafile(stream);\r
+               }\r
+\r
+               protected override void OnFormClosed(FormClosedEventArgs e)\r
+               {\r
+                       ((IDisposable)_graph).Dispose();\r
+                       base.OnFormClosed(e);\r
+               }\r
+               \r
+               private void exitToolStripMenuItem_Click(object sender, EventArgs e)\r
+               {\r
+                       Application.Exit();\r
+               }\r
+               \r
+               private readonly Graph _graph;\r
+       }\r
+}
\ No newline at end of file