--- /dev/null
+/* $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.Collections.ObjectModel;\r
+using System.IO;\r
+using System.Windows.Forms;\r
+\r
+using Microsoft.VisualBasic.ApplicationServices;\r
+\r
+namespace Graphviz\r
+{\r
+ public class Program : WindowsFormsApplicationBase\r
+ {\r
+ protected override bool OnStartup(StartupEventArgs eventArgs)\r
+ {\r
+ /* if no files opened from the Explorer, pose the open file dialog to get them, then open the lot */\r
+ ICollection<string> filesToOpen = eventArgs.CommandLine.Count == 0 ?\r
+ (ICollection<string>)FilesToOpen() :\r
+ (ICollection<string>)eventArgs.CommandLine;\r
+ if (filesToOpen != null) {\r
+ OpenFiles(filesToOpen);\r
+ return base.OnStartup(eventArgs);\r
+ }\r
+ else\r
+ return false;\r
+ }\r
+ \r
+ protected override void OnStartupNextInstance(StartupNextInstanceEventArgs eventArgs)\r
+ {\r
+ /* if some files opened from the Explorer, open them */\r
+ if (eventArgs.CommandLine.Count > 0)\r
+ OpenFiles(eventArgs.CommandLine);\r
+ base.OnStartupNextInstance(eventArgs);\r
+ }\r
+ \r
+ private string[] FilesToOpen()\r
+ {\r
+ /* lazily initialize open file dialog... sometimes we are created only to pass args to the main instance */\r
+ if (_openFileDialog == null)\r
+ {\r
+ _openFileDialog = new OpenFileDialog();\r
+ _openFileDialog.Filter = "Graphviz graphs (*.dot)|*.dot|All files (*.*)|*.*";\r
+ _openFileDialog.Multiselect = true;\r
+ }\r
+ \r
+ /* if user said OK, return the files he selected */\r
+ return _openFileDialog.ShowDialog() == DialogResult.OK ? _openFileDialog.FileNames : null;\r
+ }\r
+ \r
+ private void OpenFiles(ICollection<string> filenames)\r
+ {\r
+ Form foundForm = null;\r
+ foreach (string filename in filenames) {\r
+ string canonicalFilename = Path.GetFullPath(filename).ToLower();\r
+ if (_documentForms.ContainsKey(canonicalFilename))\r
+ foundForm = _documentForms[canonicalFilename];\r
+ else {\r
+ GraphForm newForm = new GraphForm(filename);\r
+ _documentForms[canonicalFilename] = foundForm = newForm;\r
+\r
+ /* when the form closes, remove it from document form list */\r
+ newForm.FormClosed += delegate(object sender, FormClosedEventArgs eventArgs)\r
+ {\r
+ _documentForms.Remove(canonicalFilename);\r
+ };\r
+ \r
+ /* clicking the Open menu item calls our Open method */\r
+ newForm.OpenMenuItem.Click += delegate(object sender, EventArgs eventArgs)\r
+ {\r
+ string[] filesToOpen = FilesToOpen();\r
+ if (filesToOpen != null)\r
+ OpenFiles(filesToOpen);\r
+ };\r
+\r
+ /* compose the Window menu out of all the open form titles */\r
+ newForm.WindowMenuItem.DropDownOpening += delegate(object sender, EventArgs eventArgs)\r
+ {\r
+ ToolStripMenuItem windowMenuItem = sender as ToolStripMenuItem;\r
+ if (windowMenuItem != null) {\r
+ windowMenuItem.DropDownItems.Clear();\r
+ int i = 0;\r
+ foreach (Form form in OpenForms) {\r
+ Form innerForm = form;\r
+ ToolStripMenuItem formMenuItem = new ToolStripMenuItem(string.Format("{0} {1}", ++i, form.Text));\r
+ formMenuItem.Checked = Form.ActiveForm == innerForm;\r
+ formMenuItem.Click += delegate(object innerSender, EventArgs innerEventArgs)\r
+ {\r
+ innerForm.Activate();\r
+ };\r
+ windowMenuItem.DropDownItems.Add(formMenuItem);\r
+ }\r
+ }\r
+ };\r
+ foundForm.Show();\r
+ }\r
+ }\r
+ \r
+ MainForm = foundForm;\r
+ \r
+ }\r
+ \r
+ private Program()\r
+ {\r
+ EnableVisualStyles = true;\r
+ IsSingleInstance = true;\r
+ ShutdownStyle = ShutdownMode.AfterAllFormsClose;\r
+ \r
+ _openFileDialog = null;\r
+ _documentForms = new Dictionary<string, Form>();\r
+ }\r
+ \r
+ [STAThread]\r
+ static void Main(string[] commandLine)\r
+ {\r
+ new Program().Run(commandLine);\r
+ }\r
+ \r
+ private OpenFileDialog _openFileDialog;\r
+ private readonly IDictionary<string, Form> _documentForms;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/* $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.Reflection;\r
+using System.Runtime.CompilerServices;\r
+using System.Runtime.InteropServices;\r
+\r
+// General Information about an assembly is controlled through the following \r
+// set of attributes. Change these attribute values to modify the information\r
+// associated with an assembly.\r
+[assembly: AssemblyTitle("Graphviz")]\r
+[assembly: AssemblyDescription("Graph Visualization Software")]\r
+[assembly: AssemblyConfiguration("")]\r
+[assembly: AssemblyCompany("AT&T")]\r
+[assembly: AssemblyProduct("Graphviz")]\r
+[assembly: AssemblyCopyright("Copyright © AT&T 1994-2008")]\r
+[assembly: AssemblyTrademark("")]\r
+[assembly: AssemblyCulture("")]\r
+\r
+// Setting ComVisible to false makes the types in this assembly not visible \r
+// to COM components. If you need to access a type in this assembly from \r
+// COM, set the ComVisible attribute to true on that type.\r
+[assembly: ComVisible(false)]\r
+\r
+// The following GUID is for the ID of the typelib if this project is exposed to COM\r
+[assembly: Guid("78c9ce95-59fc-4513-af71-80c41d2424cc")]\r
+\r
+// Version information for an assembly consists of the following four values:\r
+//\r
+// Major Version\r
+// Minor Version \r
+// Build Number\r
+// Revision\r
+//\r
+[assembly: AssemblyVersion("@VERSION@")]\r
+[assembly: AssemblyFileVersion("@VERSION@")]\r
--- /dev/null
+//------------------------------------------------------------------------------\r
+// <auto-generated>\r
+// This code was generated by a tool.\r
+// Runtime Version:2.0.50727.832\r
+//\r
+// Changes to this file may cause incorrect behavior and will be lost if\r
+// the code is regenerated.\r
+// </auto-generated>\r
+//------------------------------------------------------------------------------\r
+\r
+namespace Graphviz.Properties {\r
+ using System;\r
+ \r
+ \r
+ /// <summary>\r
+ /// A strongly-typed resource class, for looking up localized strings, etc.\r
+ /// </summary>\r
+ // This class was auto-generated by the StronglyTypedResourceBuilder\r
+ // class via a tool like ResGen or Visual Studio.\r
+ // To add or remove a member, edit your .ResX file then rerun ResGen\r
+ // with the /str option, or rebuild your VS project.\r
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]\r
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\r
+ internal class Resources {\r
+ \r
+ private static global::System.Resources.ResourceManager resourceMan;\r
+ \r
+ private static global::System.Globalization.CultureInfo resourceCulture;\r
+ \r
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]\r
+ internal Resources() {\r
+ }\r
+ \r
+ /// <summary>\r
+ /// Returns the cached ResourceManager instance used by this class.\r
+ /// </summary>\r
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r
+ internal static global::System.Resources.ResourceManager ResourceManager {\r
+ get {\r
+ if (object.ReferenceEquals(resourceMan, null)) {\r
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Graphviz.Properties.Resources", typeof(Resources).Assembly);\r
+ resourceMan = temp;\r
+ }\r
+ return resourceMan;\r
+ }\r
+ }\r
+ \r
+ /// <summary>\r
+ /// Overrides the current thread's CurrentUICulture property for all\r
+ /// resource lookups using this strongly typed resource class.\r
+ /// </summary>\r
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r
+ internal static global::System.Globalization.CultureInfo Culture {\r
+ get {\r
+ return resourceCulture;\r
+ }\r
+ set {\r
+ resourceCulture = value;\r
+ }\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<root>\r
+ <!-- \r
+ Microsoft ResX Schema \r
+ \r
+ Version 2.0\r
+ \r
+ The primary goals of this format is to allow a simple XML format \r
+ that is mostly human readable. The generation and parsing of the \r
+ various data types are done through the TypeConverter classes \r
+ associated with the data types.\r
+ \r
+ Example:\r
+ \r
+ ... ado.net/XML headers & schema ...\r
+ <resheader name="resmimetype">text/microsoft-resx</resheader>\r
+ <resheader name="version">2.0</resheader>\r
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>\r
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>\r
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">\r
+ <value>[base64 mime encoded serialized .NET Framework object]</value>\r
+ </data>\r
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\r
+ <comment>This is a comment</comment>\r
+ </data>\r
+ \r
+ There are any number of "resheader" rows that contain simple \r
+ name/value pairs.\r
+ \r
+ Each data row contains a name, and value. The row also contains a \r
+ type or mimetype. Type corresponds to a .NET class that support \r
+ text/value conversion through the TypeConverter architecture. \r
+ Classes that don't support this are serialized and stored with the \r
+ mimetype set.\r
+ \r
+ The mimetype is used for serialized objects, and tells the \r
+ ResXResourceReader how to depersist the object. This is currently not \r
+ extensible. For a given mimetype the value must be set accordingly:\r
+ \r
+ Note - application/x-microsoft.net.object.binary.base64 is the format \r
+ that the ResXResourceWriter will generate, however the reader can \r
+ read any of the formats listed below.\r
+ \r
+ mimetype: application/x-microsoft.net.object.binary.base64\r
+ value : The object must be serialized with \r
+ : System.Serialization.Formatters.Binary.BinaryFormatter\r
+ : and then encoded with base64 encoding.\r
+ \r
+ mimetype: application/x-microsoft.net.object.soap.base64\r
+ value : The object must be serialized with \r
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r
+ : and then encoded with base64 encoding.\r
+\r
+ mimetype: application/x-microsoft.net.object.bytearray.base64\r
+ value : The object must be serialized into a byte array \r
+ : using a System.ComponentModel.TypeConverter\r
+ : and then encoded with base64 encoding.\r
+ -->\r
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
+ <xsd:element name="root" msdata:IsDataSet="true">\r
+ <xsd:complexType>\r
+ <xsd:choice maxOccurs="unbounded">\r
+ <xsd:element name="metadata">\r
+ <xsd:complexType>\r
+ <xsd:sequence>\r
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />\r
+ </xsd:sequence>\r
+ <xsd:attribute name="name" type="xsd:string" />\r
+ <xsd:attribute name="type" type="xsd:string" />\r
+ <xsd:attribute name="mimetype" type="xsd:string" />\r
+ </xsd:complexType>\r
+ </xsd:element>\r
+ <xsd:element name="assembly">\r
+ <xsd:complexType>\r
+ <xsd:attribute name="alias" type="xsd:string" />\r
+ <xsd:attribute name="name" type="xsd:string" />\r
+ </xsd:complexType>\r
+ </xsd:element>\r
+ <xsd:element name="data">\r
+ <xsd:complexType>\r
+ <xsd:sequence>\r
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
+ </xsd:sequence>\r
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />\r
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />\r
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />\r
+ </xsd:complexType>\r
+ </xsd:element>\r
+ <xsd:element name="resheader">\r
+ <xsd:complexType>\r
+ <xsd:sequence>\r
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+ </xsd:sequence>\r
+ <xsd:attribute name="name" type="xsd:string" use="required" />\r
+ </xsd:complexType>\r
+ </xsd:element>\r
+ </xsd:choice>\r
+ </xsd:complexType>\r
+ </xsd:element>\r
+ </xsd:schema>\r
+ <resheader name="resmimetype">\r
+ <value>text/microsoft-resx</value>\r
+ </resheader>\r
+ <resheader name="version">\r
+ <value>2.0</value>\r
+ </resheader>\r
+ <resheader name="reader">\r
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+ </resheader>\r
+ <resheader name="writer">\r
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+ </resheader>\r
+</root>
\ No newline at end of file