[Monodevelop-patches-list] r1112 - in trunk/MonoDevelop: build/AddIns build/data/options src/AddIns/DisplayBindings/SourceEditor src/AddIns/DisplayBindings/SourceEditor/Gui/Pads src/Main/Base/Gui/Workbench/Layouts
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Thu Mar 4 17:24:41 EST 2004
Author: tberman
Date: 2004-03-04 17:24:41 -0500 (Thu, 04 Mar 2004)
New Revision: 1112
Added:
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerLocalsPad.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerVariablePad.cs
Modified:
trunk/MonoDevelop/build/AddIns/MonoDevelopNewEditor.addin
trunk/MonoDevelop/build/data/options/DefaultEditingLayout.xml
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile.am
trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
Log:
adding locals pad
Modified: trunk/MonoDevelop/build/AddIns/MonoDevelopNewEditor.addin
===================================================================
--- trunk/MonoDevelop/build/AddIns/MonoDevelopNewEditor.addin 2004-03-04 21:27:02 UTC (rev 1111)
+++ trunk/MonoDevelop/build/AddIns/MonoDevelopNewEditor.addin 2004-03-04 22:24:41 UTC (rev 1112)
@@ -52,6 +52,8 @@
<Extension path = "/SharpDevelop/Workbench/Views">
<Class id = "CompilerMessageView"
class = "MonoDevelop.EditorBindings.Gui.Pads.CompilerMessageView"/>
+ <Class id = "DebuggerLocalsPad"
+ class = "MonoDevelop.SourceEditor.Gui.DebuggerLocalsPad"/>
</Extension>
<Extension path = "/SharpDevelop/ViewContent/DefaultTextEditor/ContextMenu">
Modified: trunk/MonoDevelop/build/data/options/DefaultEditingLayout.xml
===================================================================
--- trunk/MonoDevelop/build/data/options/DefaultEditingLayout.xml 2004-03-04 21:27:02 UTC (rev 1111)
+++ trunk/MonoDevelop/build/data/options/DefaultEditingLayout.xml 2004-03-04 22:24:41 UTC (rev 1112)
@@ -1,2 +1,2 @@
<?xml version="1.0"?>
-<dock-layout><layout name="__default__"><dock name="__dock_1" floating="no" width="-1" height="-1" floatx="0" floaty="0"><paned orientation="horizontal" locked="no" position="202"><notebook orientation="vertical" locked="no" page="0"><item name="ICSharpCode.SharpDevelop.Gui.Pads.FileScout" orientation="vertical" locked="no"/><item name="ICSharpCode.SharpDevelop.Gui.Pads.ClassScout" orientation="vertical" locked="no"/><item name="ICSharpCode.SharpDevelop.Gui.Pads.ProjectBrowser.ProjectBrowserView" orientation="vertical" locked="no"/></notebook><paned orientation="vertical" locked="no" position="268"><item name="Documents" orientation="vertical" locked="yes"/><notebook orientation="vertical" locked="no" page="0"><item name="MonoDevelop.EditorBindings.Gui.Pads.CompilerMessageView" orientation="vertical" locked="no"/><item name="ICSharpCode.SharpDevelop.Gui.Pads.OpenTaskView" orientation="vertical" locked="no"/></notebook></paned></paned></dock></layout></dock-layout>
+<dock-layout><layout name="__default__"><dock name="__dock_1" floating="no" width="-1" height="-1" floatx="0" floaty="0"><paned orientation="horizontal" locked="no" position="226"><notebook orientation="vertical" locked="no" page="0"><item name="ICSharpCode.SharpDevelop.Gui.Pads.FileScout" orientation="vertical" locked="no"/><item name="ICSharpCode.SharpDevelop.Gui.Pads.ClassScout" orientation="vertical" locked="no"/><item name="ICSharpCode.SharpDevelop.Gui.Pads.ProjectBrowser.ProjectBrowserView" orientation="vertical" locked="no"/></notebook><paned orientation="vertical" locked="no" position="468"><item name="Documents" orientation="vertical" locked="yes"/><notebook orientation="vertical" locked="no" page="2"><item name="ICSharpCode.SharpDevelop.Gui.Pads.OpenTaskView" orientation="vertical" locked="no"/><item name="MonoDevelop.EditorBindings.Gui.Pads.CompilerMessageView" orientation="vertical" locked="no"/><item name="MonoDevelop.SourceEditor.Gui.DebuggerLocalsPad" orientat
ion="vertical" locked="no"/></notebook></paned></paned></dock></layout></dock-layout>
Added: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerLocalsPad.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerLocalsPad.cs 2004-03-04 21:27:02 UTC (rev 1111)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerLocalsPad.cs 2004-03-04 22:24:41 UTC (rev 1112)
@@ -0,0 +1,57 @@
+using System;
+using ICSharpCode.SharpDevelop.Gui;
+
+namespace MonoDevelop.SourceEditor.Gui
+{
+ public class DebuggerLocalsPad : DebuggerVariablePad, IPadContent
+ {
+
+ public DebuggerLocalsPad () : base (true)
+ {
+ }
+
+ public Gtk.Widget Control {
+ get {
+ return this;
+ }
+ }
+
+ public string Title {
+ get {
+ return "Locals";
+ }
+ }
+
+ public string Icon {
+ get {
+ return MonoDevelop.Gui.Stock.OutputIcon;
+ }
+ }
+
+ public void RedrawContent ()
+ {
+ UpdateDisplay ();
+ }
+
+ public void BringToFront ()
+ {
+ }
+
+ protected virtual void OnTitleChanged(EventArgs e)
+ {
+ if (TitleChanged != null) {
+ TitleChanged(this, e);
+ }
+ }
+ protected virtual void OnIconChanged(EventArgs e)
+ {
+ if (IconChanged != null) {
+ IconChanged(this, e);
+ }
+ }
+ public event EventHandler TitleChanged;
+ public event EventHandler IconChanged;
+
+
+ }
+}
Added: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerVariablePad.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerVariablePad.cs 2004-03-04 21:27:02 UTC (rev 1111)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/DebuggerVariablePad.cs 2004-03-04 22:24:41 UTC (rev 1112)
@@ -0,0 +1,271 @@
+using GLib;
+using Gtk;
+using GtkSharp;
+using System;
+using System.IO;
+using System.Collections;
+using System.Globalization;
+using System.Runtime.InteropServices;
+using Mono.Debugger;
+using Mono.Debugger.Languages;
+
+using ICSharpCode.Core.Services;
+using ICSharpCode.SharpDevelop.Services;
+using MonoDevelop.Services;
+
+namespace MonoDevelop.SourceEditor.Gui
+{
+ public class DebuggerVariablePad : Gtk.Frame
+ {
+ StackFrame current_frame;
+
+ Gtk.TreeView tree;
+ Gtk.TreeStore store;
+ bool is_locals_display;
+
+ public DebuggerVariablePad (bool is_locals_display)
+ {
+ this.Shadow = ShadowType.None;
+
+ this.is_locals_display = is_locals_display;
+
+ store = new TreeStore (typeof (string),
+ typeof (string),
+ typeof (string));
+
+ tree = new TreeView (store);
+ tree.RulesHint = true;
+ tree.HeadersVisible = true;
+
+ TreeViewColumn NameCol = new TreeViewColumn ();
+ CellRenderer NameRenderer = new CellRendererText ();
+ NameCol.Title = "Name";
+ NameCol.PackStart (NameRenderer, true);
+ NameCol.AddAttribute (NameRenderer, "text", 0);
+ NameCol.Resizable = true;
+ NameCol.Alignment = 0.0f;
+ tree.AppendColumn (NameCol);
+
+ TreeViewColumn TypeCol = new TreeViewColumn ();
+ CellRenderer TypeRenderer = new CellRendererText ();
+ TypeCol.Title = "Type";
+ TypeCol.PackStart (TypeRenderer, true);
+ TypeCol.AddAttribute (TypeRenderer, "text", 1);
+ TypeCol.Resizable = true;
+ NameCol.Alignment = 0.0f;
+ tree.AppendColumn (TypeCol);
+
+ TreeViewColumn ValueCol = new TreeViewColumn ();
+ CellRenderer ValueRenderer = new CellRendererText ();
+ ValueCol.Title = "Value";
+ ValueCol.PackStart (ValueRenderer, true);
+ ValueCol.AddAttribute (ValueRenderer, "text", 2);
+ ValueCol.Resizable = true;
+ NameCol.Alignment = 0.0f;
+ tree.AppendColumn (ValueCol);
+
+ tree.TestExpandRow += new TestExpandRowHandler (test_expand_row);
+
+ Add (tree);
+ ShowAll ();
+
+ DebuggingService dbgr = (DebuggingService)ServiceManager.Services.GetService (typeof (DebuggingService));
+ dbgr.PausedEvent += new EventHandler (OnPausedEvent);
+ }
+
+ bool add_array (TreeIter parent, ITargetArrayObject array)
+ {
+ bool inserted = false;
+
+ for (int i = array.LowerBound; i < array.UpperBound; i++) {
+ ITargetObject elt = array [i];
+ if (elt == null)
+ continue;
+
+ TreeIter iter = store.Append (parent);
+ add_object (elt, i.ToString (), iter);
+ inserted = true;
+ }
+
+ return inserted;
+ }
+
+ bool add_struct (TreeIter parent, ITargetStructObject sobj)
+ {
+ bool inserted = false;
+
+ foreach (ITargetFieldInfo field in sobj.Type.Fields) {
+ TreeIter iter = store.Append (parent);
+ add_object (sobj.GetField (field.Index), field.Name, iter);
+ inserted = true;
+ }
+
+ return inserted;
+ }
+
+ bool add_class (TreeIter parent, ITargetClassObject sobj)
+ {
+ bool inserted = false;
+
+ if (sobj.Type.HasParent) {
+ TreeIter iter = store.Append (parent);
+ add_object (sobj.Parent, "<parent>", iter);
+ inserted = true;
+ }
+
+ if (add_struct (parent, sobj))
+ inserted = true;
+
+ return inserted;
+ }
+
+ void add_message (TreeIter parent, string message)
+ {
+ TreeIter child;
+ if (store.IterChildren (out child, parent)) {
+ while (!(child.Equals (Gtk.TreeIter.Zero)) && (child.Stamp != 0))
+ store.Remove (ref child);
+ }
+
+ TreeIter iter = store.Append (parent);
+ store.SetValue (iter, 2, new GLib.Value (message));
+ }
+
+ void test_expand_row (object o, TestExpandRowArgs args)
+ {
+ bool inserted = false;
+
+ ITargetObject obj = (ITargetObject) iters [args.Iter];
+
+ TreeIter child;
+ if (store.IterChildren (out child, args.Iter)) {
+ while (!(child.Equals (Gtk.TreeIter.Zero)) && (child.Stamp != 0))
+ store.Remove (ref child);
+ }
+
+ if (obj == null) {
+ child = store.Append (args.Iter);
+ return;
+ }
+
+ switch (obj.Type.Kind) {
+ case TargetObjectKind.Array:
+ ITargetArrayObject array = (ITargetArrayObject) obj;
+ try {
+ inserted = add_array (args.Iter, array);
+ } catch {
+ add_message (args.Iter, "<can't display array>");
+ inserted = true;
+ }
+ if (!inserted)
+ add_message (args.Iter, "<empty array>");
+ break;
+
+ case TargetObjectKind.Class:
+ ITargetClassObject cobj = (ITargetClassObject) obj;
+ try {
+ inserted = add_class (args.Iter, cobj);
+ } catch {
+ add_message (args.Iter, "<can't display class>");
+ inserted = true;
+ }
+ if (!inserted)
+ add_message (args.Iter, "<empty class>");
+ break;
+
+ case TargetObjectKind.Struct:
+ ITargetStructObject sobj = (ITargetStructObject) obj;
+ try {
+ inserted = add_struct (args.Iter, sobj);
+ } catch {
+ add_message (args.Iter, "<can't display struct>");
+ inserted = true;
+ }
+ if (!inserted)
+ add_message (args.Iter, "<empty struct>");
+ break;
+
+ default:
+ add_message (args.Iter, "<unknown object>");
+ break;
+ }
+ }
+
+ void add_data (ITargetObject obj, TreeIter parent)
+ {
+ TreeIter iter = store.Append (parent);
+ iters.Add (parent, obj);
+ }
+
+ void add_object (ITargetObject obj, string name, TreeIter iter)
+ {
+ store.SetValue (iter, 0, new GLib.Value (name));
+ store.SetValue (iter, 1, new GLib.Value (obj.Type.Name));
+
+ switch (obj.Type.Kind) {
+ case TargetObjectKind.Fundamental:
+ object contents = ((ITargetFundamentalObject) obj).Object;
+ store.SetValue (iter, 2, new GLib.Value (contents.ToString ()));
+ break;
+
+ case TargetObjectKind.Array:
+ case TargetObjectKind.Struct:
+ case TargetObjectKind.Class:
+ add_data (obj, iter);
+ break;
+ }
+ }
+
+ void add_variable (IVariable variable)
+ {
+ if (!variable.IsAlive (current_frame.TargetAddress))
+ return;
+
+ TreeIter iter;
+ store.Append (out iter);
+
+ try {
+ ITargetObject obj = variable.GetObject (current_frame);
+ add_object (obj, variable.Name, iter);
+ } catch (LocationInvalidException) {
+ // Do nothing
+ } catch (Exception e) {
+ Console.WriteLine ("CAN'T ADD VARIABLE: {0} {1}", variable, e);
+ }
+ }
+
+ Hashtable iters = null;
+
+ public void UpdateDisplay ()
+ {
+ store.Clear ();
+ iters = new Hashtable ();
+
+ if ((current_frame == null) || (current_frame.Method == null))
+ return;
+
+ try {
+ if (is_locals_display) {
+ IVariable[] local_vars = current_frame.Method.Locals;
+ foreach (IVariable var in local_vars)
+ add_variable (var);
+ } else {
+ IVariable[] param_vars = current_frame.Method.Parameters;
+ foreach (IVariable var in param_vars)
+ add_variable (var);
+ }
+ } catch (Exception e) {
+ Console.WriteLine ("CAN'T GET VARIABLES: {0}", e);
+ store.Clear ();
+ iters = new Hashtable ();
+ }
+ }
+
+ protected void OnPausedEvent (object o, EventArgs args)
+ {
+ DebuggingService dbgr = (DebuggingService)ServiceManager.Services.GetService (typeof (DebuggingService));
+ current_frame = dbgr.CurrentFrame;
+ UpdateDisplay ();
+ }
+ }
+}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile.am
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile.am 2004-03-04 21:27:02 UTC (rev 1111)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Makefile.am 2004-03-04 22:24:41 UTC (rev 1112)
@@ -14,6 +14,8 @@
./Gui/SourceEditorView.cs \
./Gui/SourceEditorDisplayBinding.cs \
./Gui/Pads/CompilerMessageView.cs \
+./Gui/Pads/DebuggerVariablePad.cs \
+./Gui/Pads/DebuggerLocalsPad.cs \
./Gui/OptionPanels/BehaviorTextEditorPanel.cs \
./Gui/OptionPanels/MarkersTextEditorPanel.cs \
./Gui/OptionPanels/CodeTemplatePanel.cs \
@@ -82,6 +84,7 @@
/r:pango-sharp /r:gnome-sharp /r:glade-sharp \
/r:gconf-sharp \
/r:System.Drawing \
+ /r:Mono.Debugger \
&& cp $(DLL) ../../../../build/bin/.
assemblydir = $(libdir)/monodevelop/bin
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2004-03-04 21:27:02 UTC (rev 1111)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2004-03-04 22:24:41 UTC (rev 1112)
@@ -140,7 +140,8 @@
};
string[] bottomContents = new string[] {
"ICSharpCode.SharpDevelop.Gui.Pads.OpenTaskView",
- "MonoDevelop.EditorBindings.Gui.Pads.CompilerMessageView"
+ "MonoDevelop.EditorBindings.Gui.Pads.CompilerMessageView",
+ "MonoDevelop.SourceEditor.Gui.DebuggerLocalsPad"
};
foreach (string typeName in leftContents) {
More information about the Monodevelop-patches-list
mailing list