From: glenlow Date: Tue, 1 Apr 2008 16:37:51 +0000 (+0000) Subject: Win tweak panel for graph, default node and default edge attributes X-Git-Tag: LAST_LIBGRAPH~32^2~4411 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3fa955cd7b88699cc13ff0404403dd4778f3a669;p=graphviz Win tweak panel for graph, default node and default edge attributes --- diff --git a/windows/AttributeInspectorForm.resx b/windows/AttributeInspectorForm.resx new file mode 100755 index 000000000..ff31a6db5 --- /dev/null +++ b/windows/AttributeInspectorForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/windows/ExternalPropertyTab.cs b/windows/ExternalPropertyTab.cs new file mode 100755 index 000000000..f97556341 --- /dev/null +++ b/windows/ExternalPropertyTab.cs @@ -0,0 +1,77 @@ +/* $Id$ $Revision$ */ +/* vim:set shiftwidth=4 ts=8: */ + +/********************************************************** +* This software is part of the graphviz package * +* http://www.graphviz.org/ * +* * +* Copyright (c) 1994-2008 AT&T Corp. * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Corp. * +* * +* Information and Software Systems Research * +* AT&T Research, Florham Park NJ * +**********************************************************/ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms.Design; + +namespace Graphviz +{ + public class ExternalPropertyTab : PropertyTab + { + public ExternalPropertyTab(string name, Bitmap bitmap, PropertyDescriptorCollection externalProperties) + { + _name = name; + _bitmap = bitmap; + _externalProperties = externalProperties; + } + + public override PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes) + { + if (attributes == null || attributes.Length == 0) + /* no need to filter by attribute, just return all properties */ + return _externalProperties; + else { + /* filter in properties that match all given attributes */ + PropertyDescriptorCollection properties = new PropertyDescriptorCollection(new PropertyDescriptor[0]); + foreach (PropertyDescriptor property in _externalProperties) { + bool allMatch = true; + foreach (Attribute attribute in attributes) + if (!property.Attributes[attribute.GetType()].Match(attribute)) { + allMatch = false; + break; + } + if (allMatch) + properties.Add(property); + } + return properties; + } + + } + + public override bool CanExtend(object extendee) + { + return true; + } + + public override string TabName + { + get { return _name; } + } + + // Provides an image for the property tab. + public override Bitmap Bitmap + { + get { return _bitmap; } + } + + private readonly string _name; + private readonly Bitmap _bitmap; + private readonly PropertyDescriptorCollection _externalProperties; + } +}