]> granicus.if.org Git - graphviz/commitdiff
Win tweak panel for graph, default node and default edge attributes
authorglenlow <devnull@localhost>
Tue, 1 Apr 2008 16:37:51 +0000 (16:37 +0000)
committerglenlow <devnull@localhost>
Tue, 1 Apr 2008 16:37:51 +0000 (16:37 +0000)
windows/AttributeInspectorForm.resx [new file with mode: 0755]
windows/ExternalPropertyTab.cs [new file with mode: 0755]

diff --git a/windows/AttributeInspectorForm.resx b/windows/AttributeInspectorForm.resx
new file mode 100755 (executable)
index 0000000..ff31a6d
--- /dev/null
@@ -0,0 +1,120 @@
+<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />\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" use="required" type="xsd:string" />\r
+              <xsd:attribute name="type" type="xsd:string" />\r
+              <xsd:attribute name="mimetype" type="xsd:string" />\r
+              <xsd:attribute ref="xml:space" />\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" use="required" 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:attribute ref="xml:space" />\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
diff --git a/windows/ExternalPropertyTab.cs b/windows/ExternalPropertyTab.cs
new file mode 100755 (executable)
index 0000000..f975563
--- /dev/null
@@ -0,0 +1,77 @@
+/* $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.Drawing;\r
+using System.Windows.Forms.Design;\r
+\r
+namespace Graphviz\r
+{\r
+       public class ExternalPropertyTab : PropertyTab\r
+       {\r
+               public ExternalPropertyTab(string name, Bitmap bitmap, PropertyDescriptorCollection externalProperties)\r
+               {\r
+                       _name = name;\r
+                       _bitmap = bitmap;\r
+                       _externalProperties = externalProperties;\r
+               }\r
+\r
+               public override PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes)\r
+               {\r
+                       if (attributes == null || attributes.Length == 0)\r
+                               /* no need to filter by attribute, just return all properties */\r
+                               return _externalProperties;\r
+                       else {\r
+                               /* filter in properties that match all given attributes */\r
+                               PropertyDescriptorCollection properties = new PropertyDescriptorCollection(new PropertyDescriptor[0]);\r
+                               foreach (PropertyDescriptor property in _externalProperties) {\r
+                                       bool allMatch = true;\r
+                                       foreach (Attribute attribute in attributes)\r
+                                               if (!property.Attributes[attribute.GetType()].Match(attribute)) {\r
+                                                       allMatch = false;\r
+                                                       break;\r
+                                               }\r
+                                       if (allMatch)\r
+                                               properties.Add(property);\r
+                               }\r
+                               return properties;\r
+                       }\r
+                       \r
+               }\r
+\r
+               public override bool CanExtend(object extendee)\r
+               {\r
+                       return true;\r
+               }\r
+\r
+               public override string TabName\r
+               {\r
+                       get { return _name; }\r
+               }\r
+\r
+               // Provides an image for the property tab.\r
+               public override Bitmap Bitmap\r
+               {\r
+                       get { return _bitmap; }\r
+               }\r
+\r
+               private readonly string _name;\r
+               private readonly Bitmap _bitmap;\r
+               private readonly PropertyDescriptorCollection _externalProperties;\r
+       }\r
+}\r