Example #1
0
		void PopulateTextView (ObjectValue value)
		{
			var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
			ops.ChunkRawStrings = true;

			if (value.TypeName == "string") {
				rawString = value.GetRawValue (ops) as RawValueString;
				length = rawString.Length;
				offset = 0;

				if (length > 0) {
					idle_id = GLib.Idle.Add (GetNextStringChunk);
					textView.Destroyed += delegate {
						if (idle_id != 0) {
							GLib.Source.Remove (idle_id);
							idle_id = 0;
						}
					};
				}
			} else if (value.TypeName == "char[]") {
				rawArray = value.GetRawValue () as RawValueArray;
				length = rawArray.Length;
				offset = 0;

				if (length > 0) {
					idle_id = GLib.Idle.Add (GetNextCharArrayChunk);
					textView.Destroyed += delegate {
						if (idle_id != 0) {
							GLib.Source.Remove (idle_id);
							idle_id = 0;
						}
					};
				}
			}
		}
		public Gtk.Widget GetVisualizerWidget (ObjectValue val)
		{
			VBox box = new VBox (false, 6);
			textView = new TextView () { WrapMode = WrapMode.Char };
			Gtk.ScrolledWindow scrolled = new Gtk.ScrolledWindow ();
			scrolled.HscrollbarPolicy = PolicyType.Automatic;
			scrolled.VscrollbarPolicy = PolicyType.Automatic;
			scrolled.ShadowType = ShadowType.In;
			scrolled.Add (textView);
			box.PackStart (scrolled, true, true, 0);
			CheckButton cb = new CheckButton (GettextCatalog.GetString ("Wrap text"));
			cb.Active = true;
			cb.Toggled += delegate {
				if (cb.Active)
					textView.WrapMode = WrapMode.Char;
				else
					textView.WrapMode = WrapMode.None;
			};
			box.PackStart (cb, false, false, 0);
			box.ShowAll ();
			
			EvaluationOptions ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
			ops.ChunkRawStrings = true;
			
			this.raw = val.GetRawValue (ops) as RawValueString;
			this.length = raw.Length;
			this.offset = 0;
			this.val = val;
			
			if (this.length > 0) {
				idle_id = GLib.Idle.Add (GetNextStringChunk);
				textView.Destroyed += delegate {
					if (idle_id != 0) {
						GLib.Source.Remove (idle_id);
						idle_id = 0;
					}
				};
			}
			
			return box;
		}
		public RawStringBuffer (RawValueString raw)
		{
			Bytes = new byte[raw.Length * 2];
			Length = raw.Length * 2;
			array = raw;
			offset = 0;
		}
Example #4
0
		void PopulateTextView ()
		{
			if (value.TypeName == "string") {
				var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
				ops.ChunkRawStrings = true;

				raw = value.GetRawValue (ops) as RawValueString;
				length = raw.Length;
				offset = 0;

				if (length > 0) {
					idle_id = GLib.Idle.Add (GetNextStringChunk);
					textView.Destroyed += delegate {
						if (idle_id != 0) {
							GLib.Source.Remove (idle_id);
							idle_id = 0;
						}
					};
				}
			} else {
				var array = value.GetRawValue () as RawValueArray;
				var iter = textView.Buffer.EndIter;
				string text;

				switch (value.TypeName) {
				case "char[]":
					text = new string (array.ToArray () as char[]);
					break;
				default:
					text = string.Empty;
					break;
				}

				textView.Buffer.Insert (ref iter, text);
			}
		}