~ubuntu-branches/ubuntu/precise/graphviz/precise-security

« back to all changes in this revision

Viewing changes to windows/AttributeInspectorForm.cs

  • Committer: Bazaar Package Importer
  • Author(s): David Claughton
  • Date: 2010-03-24 22:45:18 UTC
  • mfrom: (1.2.7 upstream) (6.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100324224518-do441tthbqjaqjzd
Tags: 2.26.3-4
Add patch to fix segfault in circo. Backported from upstream snapshot
release.  Thanks to Francis Russell for his work on this.
(Closes: #575255)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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: */
3
3
 
4
4
/**********************************************************
50
50
                        attributePropertyGrid.PropertyTabs.AddTabType(typeof(NodePropertyTab), PropertyTabScope.Static);
51
51
                        attributePropertyGrid.PropertyTabs.AddTabType(typeof(EdgePropertyTab), PropertyTabScope.Static);
52
52
                         
 
53
                        _inspected = null;
 
54
                        _inspectMainForm = delegate(object sender, EventArgs e)
 
55
                        {
 
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)
 
59
                                {
 
60
                                        if (_inspected != null)
 
61
                                                _inspected.Changed -= _inspectMainForm;
 
62
                                        _inspected = graphForm;
 
63
                                        _inspected.Changed += _inspectMainForm;
 
64
                                        
 
65
                                        Text = "Attributes of " + graphForm.Text;
 
66
                                        attributePropertyGrid.SelectedObject = graphForm.Graph;
 
67
                                }
 
68
                        };
 
69
                        
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)
56
 
                                InspectMainForm();
 
73
                                _inspectMainForm(this, EventArgs.Empty);
57
74
                        else
58
 
                                attributePropertyGrid.HandleCreated += delegate(object sender, EventArgs e)
59
 
                                {
60
 
                                        InspectMainForm();
61
 
                                };
 
75
                                attributePropertyGrid.HandleCreated += _inspectMainForm;
62
76
                        
63
77
                        /* inspect the graph when the main form changes */
64
 
                        FormController.Instance.MainFormChanged += delegate(object sender, EventArgs e)
65
 
                        {
66
 
                                InspectMainForm();
67
 
                        };
 
78
                        FormController.Instance.MainFormChanged += _inspectMainForm;
68
79
                }
69
80
 
70
81
                protected override void OnFormClosing(FormClosingEventArgs e)
71
82
                {
 
83
                        if (e.CloseReason == CloseReason.UserClosing)
 
84
                        {
72
85
                        /* instead of closing, we hide ourselves */
73
86
                        Hide();
74
87
                        e.Cancel = true;
75
88
                }
 
89
                        else
 
90
                                _instance = null;
 
91
                }
76
92
                
77
93
                private class GraphPropertyTab : ExternalPropertyTab
78
94
                {
95
111
                        }
96
112
                }
97
113
 
98
 
                private void InspectMainForm()
99
 
                {
100
 
                        /* if the main form has a graph, show its properties */
101
 
                        GraphForm graphForm = FormController.Instance.MainForm as GraphForm;
102
 
                        if (graphForm != null)
103
 
                        {
104
 
                                Text = "Attributes of " + graphForm.Text;
105
 
                                attributePropertyGrid.SelectedObject = graphForm.Graph;
106
 
                        }
107
 
                }
108
 
                
109
114
                private static PropertyDescriptorCollection GetComponentProperties(XPathNavigator schema, string component)
110
115
                {
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;
 
197
                
 
198
                private GraphForm _inspected;
 
199
                private EventHandler _inspectMainForm;
192
200
        }
193
 
}
 
 
b'\\ No newline at end of file'
 
201
}