public DisassemblyView () { UntitledName = GettextCatalog.GetString ("Disassembly"); sw = new Gtk.ScrolledWindow (); editor = new Mono.TextEditor.TextEditor (); editor.Document.ReadOnly = true; TextEditorOptions options = new TextEditorOptions (); options.CopyFrom (TextEditorOptions.DefaultOptions); options.ShowEolMarkers = false; options.ShowInvalidLines = false; options.ShowLineNumberMargin = false; editor.Options = options; sw.Add (editor); sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; sw.VscrollbarPolicy = Gtk.PolicyType.Automatic; sw.ShowAll (); sw.Vadjustment.ValueChanged += OnScrollEditor; sw.VScrollbar.ButtonPressEvent += OnPress; sw.VScrollbar.ButtonReleaseEvent += OnRelease; sw.VScrollbar.Events |= Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask; sw.ShadowType = Gtk.ShadowType.In; sw.Sensitive = false; currentDebugLineMarker = new CurrentDebugLineTextMarker (editor); DebuggingService.StoppedEvent += OnStop; }
public DisassemblyView() { UntitledName = GettextCatalog.GetString("Disassembly"); sw = new Gtk.ScrolledWindow(); editor = new Mono.TextEditor.TextEditor(); editor.Document.ReadOnly = true; editor.Options = new MonoDevelop.Ide.Gui.CommonTextEditorOptions() { ShowEolMarkers = false, ShowInvalidLines = false, ShowLineNumberMargin = false, }; sw.Add(editor); sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; sw.VscrollbarPolicy = Gtk.PolicyType.Automatic; sw.ShowAll(); sw.Vadjustment.ValueChanged += OnScrollEditor; sw.VScrollbar.ButtonPressEvent += OnPress; sw.VScrollbar.ButtonReleaseEvent += OnRelease; sw.VScrollbar.Events |= Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask; sw.ShadowType = Gtk.ShadowType.In; sw.Sensitive = false; currentDebugLineMarker = new CurrentDebugLineTextMarker(editor); DebuggingService.StoppedEvent += OnStop; }
public TooltipItem GetItem(Mono.TextEditor.TextEditor editor, int offset) { if (offset >= editor.Document.TextLength) { return(null); } if (!DebuggingService.IsDebugging || DebuggingService.IsRunning) { return(null); } StackFrame frame = DebuggingService.CurrentFrame; if (frame == null) { return(null); } var ed = (ExtensibleTextEditor)editor; string expression = null; int startOffset = 0, length = 0; if (ed.IsSomethingSelected && offset >= ed.SelectionRange.Offset && offset <= ed.SelectionRange.EndOffset) { expression = ed.SelectedText; startOffset = ed.SelectionRange.Offset; length = ed.SelectionRange.Length; } else { ICSharpCode.NRefactory.TypeSystem.DomRegion expressionRegion; ResolveResult res = ed.GetLanguageItem(offset, out expressionRegion); if (res == null || res.IsError || res.GetType() == typeof(ResolveResult)) { return(null); } //Console.WriteLine ("res is a {0}", res.GetType ().Name); if (expressionRegion.IsEmpty) { return(null); } if (res is NamespaceResolveResult || res is ConversionResolveResult || res is ForEachResolveResult || res is TypeIsResolveResult || res is TypeOfResolveResult || res is ErrorResolveResult) { return(null); } var start = new DocumentLocation(expressionRegion.BeginLine, expressionRegion.BeginColumn); var end = new DocumentLocation(expressionRegion.EndLine, expressionRegion.EndColumn); startOffset = editor.Document.LocationToOffset(start); int endOffset = editor.Document.LocationToOffset(end); length = endOffset - startOffset; if (res is LocalResolveResult) { var lr = (LocalResolveResult)res; // Capture only the local variable portion of the expression... expression = lr.Variable.Name; length = expression.Length; // Calculate start offset based on the end offset because we don't want to include the type information. startOffset = endOffset - length; } else if (res is InvocationResolveResult) { var ir = (InvocationResolveResult)res; if (ir.Member.Name != ".ctor") { return(null); } expression = ir.Member.DeclaringType.FullName; } else if (res is MemberResolveResult) { var mr = (MemberResolveResult)res; if (mr.TargetResult == null) { // User is hovering over a member definition... if (mr.Member is IProperty) { // Visual Studio will evaluate Properties if you hover over their definitions... var prop = (IProperty)mr.Member; if (prop.CanGet) { if (prop.IsStatic) { expression = prop.FullName; } else { expression = prop.Name; } } else { return(null); } } else if (mr.Member is IField) { var field = (IField)mr.Member; if (field.IsStatic) { expression = field.FullName; } else { expression = field.Name; } } else { return(null); } } // If the TargetResult is not null, then treat it like any other ResolveResult. } else if (res is ConstantResolveResult) { // Fall through... } else if (res is ThisResolveResult) { // Fall through... } else if (res is TypeResolveResult) { // Fall through... } else { return(null); } if (expression == null) { expression = ed.GetTextBetween(start, end); } } if (string.IsNullOrEmpty(expression)) { return(null); } ObjectValue val; if (!cachedValues.TryGetValue(expression, out val)) { val = frame.GetExpressionValue(expression, true); cachedValues [expression] = val; } if (val == null || val.IsUnknown || val.IsNotSupported) { return(null); } val.Name = expression; return(new TooltipItem(val, startOffset, length)); }
public bool IsInteractive(Mono.TextEditor.TextEditor editor, Gtk.Window tipWindow) { return(true); }
public void GetRequiredPosition(Mono.TextEditor.TextEditor editor, Gtk.Window tipWindow, out int requiredWidth, out double xalign) { xalign = 0.1; requiredWidth = tipWindow.SizeRequest().Width; }
public Gtk.Window CreateTooltipWindow(Mono.TextEditor.TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item) { return(new DebugValueWindow(editor, offset, DebuggingService.CurrentFrame, (ObjectValue)item.Item, null)); }
public TooltipItem GetItem(Mono.TextEditor.TextEditor editor, int offset) { if (offset >= editor.Document.Length) { return(null); } if (!DebuggingService.IsDebugging || DebuggingService.IsRunning) { return(null); } StackFrame frame = DebuggingService.CurrentFrame; if (frame == null) { return(null); } ExtensibleTextEditor ed = (ExtensibleTextEditor)editor; string expression = null; int startOffset = 0, length = 0; if (ed.IsSomethingSelected && offset >= ed.SelectionRange.Offset && offset <= ed.SelectionRange.EndOffset) { expression = ed.SelectedText; startOffset = ed.SelectionRange.Offset; length = ed.SelectionRange.Length; } else { ResolveResult res = ed.GetLanguageItem(offset); /* if (res is MemberResolveResult) { * MemberResolveResult mr = (MemberResolveResult) res; * if (mr.ResolvedMember == null && mr.ResolvedType != null) * expression = mr.ResolvedType.FullName; * } * if (expression == null)*/ if (res != null && res.ResolvedExpression != null) { expression = res.ResolvedExpression.Expression; startOffset = editor.Document.LocationToOffset(res.ResolvedExpression.Region.Start.Line - 1, res.ResolvedExpression.Region.Start.Column - 1); int endOffset = editor.Document.LocationToOffset(res.ResolvedExpression.Region.End.Line - 1, res.ResolvedExpression.Region.End.Column - 1); length = endOffset - startOffset; } } if (string.IsNullOrEmpty(expression)) { return(null); } ObjectValue val; if (!cachedValues.TryGetValue(expression, out val)) { val = frame.GetExpressionValue(expression, false); cachedValues [expression] = val; } if (val == null || val.IsUnknown || val.IsNotSupported) { return(null); } return(new TooltipItem(val, startOffset, length)); }
public override bool IsInteractive(Mono.TextEditor.TextEditor editor, Gtk.Window tipWindow) { return(DebuggingService.IsDebugging); }