1
/* $Id: AttributeInspectorForm.cs,v 1.1 2008/04/01 16:37:51 glenlow Exp $ $Revision: 1.1 $ */
1
/* $Id: AttributeInspectorForm.cs,v 1.5 2009/06/03 01:10:59 ellson Exp $ $Revision: 1.5 $ */
2
2
/* vim:set shiftwidth=4 ts=8: */
4
4
/**********************************************************
50
50
attributePropertyGrid.PropertyTabs.AddTabType(typeof(NodePropertyTab), PropertyTabScope.Static);
51
51
attributePropertyGrid.PropertyTabs.AddTabType(typeof(EdgePropertyTab), PropertyTabScope.Static);
54
_inspectMainForm = delegate(object sender, EventArgs e)
56
/* if the main form has a graph, monitor its changes and show its properties */
57
GraphForm graphForm = FormController.Instance.MainForm as GraphForm;
58
if (graphForm != null)
60
if (_inspected != null)
61
_inspected.Changed -= _inspectMainForm;
62
_inspected = graphForm;
63
_inspected.Changed += _inspectMainForm;
65
Text = "Attributes of " + graphForm.Text;
66
attributePropertyGrid.SelectedObject = graphForm.Graph;
53
70
/* inspect the graph when the handle has been created */
54
71
/* NOTE: if we set the SelectedObject BEFORE the handle has been created, this damages the property tabs, a Microsoft bug */
55
72
if (attributePropertyGrid.IsHandleCreated)
73
_inspectMainForm(this, EventArgs.Empty);
58
attributePropertyGrid.HandleCreated += delegate(object sender, EventArgs e)
75
attributePropertyGrid.HandleCreated += _inspectMainForm;
63
77
/* inspect the graph when the main form changes */
64
FormController.Instance.MainFormChanged += delegate(object sender, EventArgs e)
78
FormController.Instance.MainFormChanged += _inspectMainForm;
70
81
protected override void OnFormClosing(FormClosingEventArgs e)
83
if (e.CloseReason == CloseReason.UserClosing)
72
85
/* instead of closing, we hide ourselves */
77
93
private class GraphPropertyTab : ExternalPropertyTab
98
private void InspectMainForm()
100
/* if the main form has a graph, show its properties */
101
GraphForm graphForm = FormController.Instance.MainForm as GraphForm;
102
if (graphForm != null)
104
Text = "Attributes of " + graphForm.Text;
105
attributePropertyGrid.SelectedObject = graphForm.Graph;
109
114
private static PropertyDescriptorCollection GetComponentProperties(XPathNavigator schema, string component)
111
116
PropertyDescriptorCollection properties = new PropertyDescriptorCollection(new PropertyDescriptor[0]);
189
194
private static PropertyDescriptorCollection _graphProperties;
190
195
private static PropertyDescriptorCollection _nodeProperties;
191
196
private static PropertyDescriptorCollection _edgeProperties;
198
private GraphForm _inspected;
199
private EventHandler _inspectMainForm;
b'\\ No newline at end of file'