From 0fa3296466cfb58892fedbd8590286a2ba6ae17f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Fri, 17 Feb 2006 16:38:08 +0000 Subject: [PATCH] Numeric values in debugger tooltips can be shown in hexadecimal git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1164 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Src/Service/DynamicTreeDebuggerRow.cs | 29 +++++++++++++++++-- .../Project/Src/Variables/Value.cs | 21 +++++++++++++- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs index fa95eb0dcf..dce11dbb67 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs @@ -37,6 +37,15 @@ namespace ICSharpCode.SharpDevelop.Services } } + public bool ShowValuesInHexadecimal { + get { + return ((WindowsDebugger)DebuggerService.CurrentDebugger).Properties.Get("ShowValuesInHexadecimal", false); + } + set { + ((WindowsDebugger)DebuggerService.CurrentDebugger).Properties.Set("ShowValuesInHexadecimal", value); + } + } + public DynamicTreeDebuggerRow() { } @@ -68,10 +77,15 @@ namespace ICSharpCode.SharpDevelop.Services image = DebuggerIcons.GetImage(variable); this[1].Text = ""; // Icon this[2].Text = variable.Name; - this[3].Text = variable.Value.AsString; + if (ShowValuesInHexadecimal && variable.Value is PrimitiveValue && variable.Value.IsInteger) { + this[3].Text = String.Format("0x{0:X}", (variable.Value as PrimitiveValue).Primitive); + } else { + this[3].Text = variable.Value.AsString; + } this[3].AllowLabelEdit = variable.Value is PrimitiveValue && variable.Value.ManagedType != typeof(string) && - !(variable is PropertyVariable); + !(variable is PropertyVariable) && + !ShowValuesInHexadecimal; this.ShowPlus = variable.Value.MayHaveSubVariables; this.ShowMinusWhileExpanded = true; @@ -108,8 +122,17 @@ namespace ICSharpCode.SharpDevelop.Services ClipboardWrapper.SetText(((DynamicListItem)sender).Text); }; + ToolStripMenuItem hewView; + hewView = new ToolStripMenuItem(); + hewView.Text = "Show values in hexadecimal"; + hewView.Checked = ShowValuesInHexadecimal; + hewView.Click += delegate { + ShowValuesInHexadecimal = !ShowValuesInHexadecimal; + }; + menu.Items.AddRange(new ToolStripItem[] { - copyItem + copyItem, + hewView }); menu.Show(e.List, e.Location); diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs index eba2dc306e..5b2874d550 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs @@ -147,7 +147,26 @@ namespace Debugger default: return null; } } - + + /// + /// Returns true if the value is signed or unsigned integer of any siz + /// + public bool IsInteger { + get { + CorElementType corType = CorType; + return corType == CorElementType.I1 || + corType == CorElementType.U1 || + corType == CorElementType.I2 || + corType == CorElementType.U2 || + corType == CorElementType.I4 || + corType == CorElementType.U4 || + corType == CorElementType.I8 || + corType == CorElementType.U8 || + corType == CorElementType.I || + corType == CorElementType.U; + } + } + internal static string CorTypeToString(CorElementType corType) { Type manType = CorTypeToManagedType(corType);