diff options
author | David Karlaš <david.karlas@xamarin.com> | 2014-12-03 12:52:02 +0300 |
---|---|---|
committer | David Karlaš <david.karlas@xamarin.com> | 2014-12-03 12:52:02 +0300 |
commit | 7a14e1f7ae7e894aa348d95d0f16a6d6ddab2830 (patch) | |
tree | ae82f83bedeaecb304a6a3f1def6f78a71a722d3 /main/src/addins/MonoDevelop.Debugger | |
parent | 9f18bdadf983b3778b10658efe543922c1042b41 (diff) |
[DebuggerVisualizers] Added "md-preview-selected" icon and implemented
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger')
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs index 5abb90f88f..868da433cf 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs @@ -293,6 +293,7 @@ namespace MonoDevelop.Debugger EnableSearch = false; AllowPopupMenu = true; Selection.Mode = Gtk.SelectionMode.Multiple; + Selection.Changed += HandleSelectionChanged; ResetColumnSizes (); Pango.FontDescription newFont = Style.FontDescription.Copy (); @@ -395,6 +396,15 @@ namespace MonoDevelop.Debugger PreviewWindowManager.WindowClosed += HandlePreviewWindowClosed; } + void HandleSelectionChanged (object sender, EventArgs e) + { + if (Selection.IterIsSelected (currentHoverIter)) { + SetPreviewButtonIcon (PreviewButtonIcons.Selected, currentHoverIter); + } else { + SetPreviewButtonIcon (iconBeforeSelected, currentHoverIter); + } + } + void HandlePreviewWindowClosed (object sender, EventArgs e) { SetPreviewButtonIcon (PreviewButtonIcons.Hidden); @@ -1401,9 +1411,11 @@ namespace MonoDevelop.Debugger Hidden, RowHover, Hover, - Active + Active, + Selected, } + PreviewButtonIcons iconBeforeSelected; PreviewButtonIcons currentIcon; TreeIter currentHoverIter = TreeIter.Zero; @@ -1448,6 +1460,20 @@ namespace MonoDevelop.Debugger } } if (!it.Equals (TreeIter.Zero) && store.IterIsValid (it)) { + if (icon == PreviewButtonIcons.Selected) { + if ((currentIcon == PreviewButtonIcons.Active || + currentIcon == PreviewButtonIcons.Hover || + currentIcon == PreviewButtonIcons.RowHover) && it.Equals (TreeIter.Zero)) { + iconBeforeSelected = currentIcon; + } + } else if (icon == PreviewButtonIcons.Active || + icon == PreviewButtonIcons.Hover || + icon == PreviewButtonIcons.RowHover) { + iconBeforeSelected = icon; + if (Selection.IterIsSelected (it)) { + icon = PreviewButtonIcons.Selected; + } + } switch (icon) { case PreviewButtonIcons.None: store.SetValue (it, PreviewIconColumn, null); @@ -1464,6 +1490,9 @@ namespace MonoDevelop.Debugger case PreviewButtonIcons.Active: store.SetValue (it, PreviewIconColumn, "md-preview-active"); break; + case PreviewButtonIcons.Selected: + store.SetValue (it, PreviewIconColumn, "md-preview-selected"); + break; } currentIcon = icon; currentHoverIter = it; @@ -1646,7 +1675,7 @@ namespace MonoDevelop.Debugger if (cr == crpViewer) { var val = (ObjectValue)store.GetValue (it, ObjectColumn); DebuggingService.ShowValueVisualizer (val); - } else if (cr == crtExp && (store.GetValue (it, PreviewIconColumn) as string) == "md-preview-hover") { + } else if (cr == crtExp) { var val = (ObjectValue)store.GetValue (it, ObjectColumn); var rect = GetCellRendererArea (path, col, cr); using (var layout = new Pango.Layout (PangoContext)) { @@ -1660,8 +1689,11 @@ namespace MonoDevelop.Debugger ConvertTreeToWidgetCoords (rect.X, rect.Y, out rect.X, out rect.Y); rect.X += (int)Hadjustment.Value; rect.Y += (int)Vadjustment.Value; - DebuggingService.ShowPreviewVisualizer (val, this, rect); - SetPreviewButtonIcon (PreviewButtonIcons.Active, it); + if (rect.X < evnt.X && + rect.X + 16 > evnt.X) { + DebuggingService.ShowPreviewVisualizer (val, this, rect); + SetPreviewButtonIcon (PreviewButtonIcons.Active, it); + } } } else if (cr == crtValue) { if ((Platform.IsMac && ((evnt.State & Gdk.ModifierType.Mod2Mask) > 0)) || |