10.1.1
by Jo Shields
Import upstream version 1.9.2+dfsg |
1 |
// ObjectValuePad.cs
|
2 |
//
|
|
3 |
// Author:
|
|
4 |
// Lluis Sanchez Gual <lluis@novell.com>
|
|
5 |
//
|
|
6 |
// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
|
|
7 |
//
|
|
8 |
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9 |
// of this software and associated documentation files (the "Software"), to deal
|
|
10 |
// in the Software without restriction, including without limitation the rights
|
|
11 |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12 |
// copies of the Software, and to permit persons to whom the Software is
|
|
13 |
// furnished to do so, subject to the following conditions:
|
|
14 |
//
|
|
15 |
// The above copyright notice and this permission notice shall be included in
|
|
16 |
// all copies or substantial portions of the Software.
|
|
17 |
//
|
|
18 |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19 |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20 |
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21 |
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22 |
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23 |
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
24 |
// THE SOFTWARE.
|
|
25 |
//
|
|
26 |
//
|
|
27 |
||
28 |
using System; |
|
29 |
using Gtk; |
|
30 |
using MonoDevelop.Ide.Gui; |
|
31 |
using Mono.Debugging.Client; |
|
32 |
||
33 |
namespace MonoDevelop.Debugger |
|
34 |
{
|
|
35 |
public class ObjectValuePad: IPadContent |
|
36 |
{
|
|
37 |
protected ObjectValueTreeView tree; |
|
38 |
ScrolledWindow scrolled; |
|
39 |
bool needsUpdate; |
|
40 |
IPadWindow container; |
|
41 |
bool initialResume; |
|
42 |
StackFrame lastFrame; |
|
10.1.2
by Mirco Bauer
Import upstream version 1.9.3+dfsg |
43 |
MonoDevelop.Ide.Gui.PadFontChanger fontChanger; |
10.1.1
by Jo Shields
Import upstream version 1.9.2+dfsg |
44 |
|
45 |
public Gtk.Widget Control { |
|
46 |
get { |
|
47 |
return scrolled; |
|
48 |
}
|
|
49 |
}
|
|
50 |
||
51 |
public ObjectValuePad() |
|
52 |
{
|
|
53 |
scrolled = new ScrolledWindow (); |
|
54 |
scrolled.HscrollbarPolicy = PolicyType.Automatic; |
|
55 |
scrolled.VscrollbarPolicy = PolicyType.Automatic; |
|
56 |
||
57 |
tree = new ObjectValueTreeView (); |
|
10.1.2
by Mirco Bauer
Import upstream version 1.9.3+dfsg |
58 |
|
59 |
fontChanger = new PadFontChanger (tree, tree.SetCustomFont, tree.QueueResize); |
|
60 |
||
10.1.1
by Jo Shields
Import upstream version 1.9.2+dfsg |
61 |
tree.AllowEditing = true; |
62 |
tree.AllowAdding = false; |
|
63 |
tree.HeadersVisible = true; |
|
64 |
tree.RulesHint = true; |
|
65 |
scrolled.Add (tree); |
|
66 |
scrolled.ShowAll (); |
|
67 |
||
68 |
DebuggingService.CurrentFrameChanged += OnFrameChanged; |
|
69 |
DebuggingService.PausedEvent += OnDebuggerPaused; |
|
70 |
DebuggingService.ResumedEvent += OnDebuggerResumed; |
|
71 |
DebuggingService.StoppedEvent += OnDebuggerStopped; |
|
10.2.6
by Jo Shields
Import upstream version 2.4+dfsg |
72 |
DebuggingService.EvaluationOptionsChanged += OnEvaluationOptionsChanged; |
10.1.1
by Jo Shields
Import upstream version 1.9.2+dfsg |
73 |
|
74 |
needsUpdate = true; |
|
75 |
initialResume = true; |
|
76 |
}
|
|
77 |
||
78 |
public void Dispose () |
|
79 |
{
|
|
10.1.2
by Mirco Bauer
Import upstream version 1.9.3+dfsg |
80 |
if (fontChanger == null) |
81 |
return; |
|
82 |
||
83 |
fontChanger.Dispose (); |
|
84 |
fontChanger = null; |
|
10.1.1
by Jo Shields
Import upstream version 1.9.2+dfsg |
85 |
DebuggingService.CurrentFrameChanged -= OnFrameChanged; |
86 |
DebuggingService.PausedEvent -= OnDebuggerPaused; |
|
87 |
DebuggingService.ResumedEvent -= OnDebuggerResumed; |
|
88 |
DebuggingService.StoppedEvent -= OnDebuggerStopped; |
|
10.2.6
by Jo Shields
Import upstream version 2.4+dfsg |
89 |
DebuggingService.EvaluationOptionsChanged -= OnEvaluationOptionsChanged; |
10.1.1
by Jo Shields
Import upstream version 1.9.2+dfsg |
90 |
}
|
91 |
||
92 |
public void Initialize (IPadWindow container) |
|
93 |
{
|
|
94 |
this.container = container; |
|
95 |
container.PadContentShown += delegate { |
|
96 |
if (needsUpdate) |
|
97 |
OnUpdateList (); |
|
98 |
};
|
|
99 |
}
|
|
100 |
||
101 |
public void RedrawContent () |
|
102 |
{
|
|
103 |
}
|
|
104 |
||
105 |
public virtual void OnUpdateList () |
|
106 |
{
|
|
107 |
needsUpdate = false; |
|
108 |
if (DebuggingService.CurrentFrame != null && DebuggingService.CurrentFrame != lastFrame) |
|
109 |
tree.Frame = DebuggingService.CurrentFrame; |
|
110 |
lastFrame = DebuggingService.CurrentFrame; |
|
111 |
}
|
|
112 |
||
113 |
void OnFrameChanged (object s, EventArgs a) |
|
114 |
{
|
|
115 |
if (container != null && container.ContentVisible) |
|
116 |
OnUpdateList (); |
|
117 |
else
|
|
118 |
needsUpdate = true; |
|
119 |
}
|
|
120 |
||
121 |
void OnDebuggerPaused (object s, EventArgs a) |
|
122 |
{
|
|
123 |
tree.Sensitive = true; |
|
124 |
}
|
|
125 |
||
126 |
void OnDebuggerResumed (object s, EventArgs a) |
|
127 |
{
|
|
128 |
if (!initialResume) |
|
129 |
tree.ChangeCheckpoint (); |
|
130 |
||
131 |
initialResume = false; |
|
132 |
tree.Sensitive = false; |
|
133 |
}
|
|
134 |
||
135 |
void OnDebuggerStopped (object s, EventArgs a) |
|
136 |
{
|
|
137 |
tree.ResetChangeTracking (); |
|
138 |
tree.Sensitive = false; |
|
139 |
initialResume = true; |
|
140 |
}
|
|
10.2.6
by Jo Shields
Import upstream version 2.4+dfsg |
141 |
|
142 |
void OnEvaluationOptionsChanged (object s, EventArgs a) |
|
143 |
{
|
|
144 |
if (!DebuggingService.IsRunning) { |
|
145 |
lastFrame = null; |
|
146 |
if (container != null && container.ContentVisible) |
|
147 |
OnUpdateList (); |
|
148 |
else
|
|
149 |
needsUpdate = true; |
|
150 |
}
|
|
151 |
}
|
|
10.1.1
by Jo Shields
Import upstream version 1.9.2+dfsg |
152 |
}
|
153 |
}
|