diff options
author | Matt Ward <matt.ward@microsoft.com> | 2019-09-17 11:30:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-17 11:30:02 +0300 |
commit | 265704b3fc3e0e3eddf1dffca4d35ba60c0018dd (patch) | |
tree | 8c980fed4a2db66660b768d4484ea4866acb3572 /main | |
parent | 25cb20a2319cd49849320186879a1243c48b3a9a (diff) | |
parent | 05c4a9e5e7a976e160692078c28b45831cea8cb5 (diff) |
Merge pull request #8707 from mono/vsts-648206-background-color
[A11y] Set the background color of stacktrace items in Exception Caug…
Diffstat (limited to 'main')
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs | 41 | ||||
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Styles.cs | 3 |
2 files changed, 18 insertions, 26 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs index 867a8b23b1..bc64aa7348 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs @@ -200,6 +200,7 @@ widget ""*.exception_help_link_label"" style ""exception-help-link-label"" } exceptionValueTreeView.ModifyBase (StateType.Normal, Styles.ExceptionCaughtDialog.ValueTreeBackgroundColor.ToGdkColor ()); + exceptionValueTreeView.ModifyBase (StateType.Active, Styles.ObjectValueTreeActiveBackgroundColor.ToGdkColor ()); exceptionValueTreeView.ModifyFont (Pango.FontDescription.FromString (Platform.IsWindows ? "9" : "11")); exceptionValueTreeView.RulesHint = false; exceptionValueTreeView.CanFocus = true; @@ -743,23 +744,12 @@ widget ""*.exception_dialog_expander"" style ""exception-dialog-expander"" using (var layout = new Pango.Layout (widget.PangoContext)) { layout.FontDescription = font; - if ((flags & CellRendererState.Selected) != 0) { - cr.SetSourceRGB (Styles.ExceptionCaughtDialog.TreeSelectedBackgroundColor.Red, - Styles.ExceptionCaughtDialog.TreeSelectedBackgroundColor.Green, - Styles.ExceptionCaughtDialog.TreeSelectedBackgroundColor.Blue); // selected - cr.Fill (); - cr.SetSourceRGB (Styles.ExceptionCaughtDialog.TreeSelectedTextColor.Red, - Styles.ExceptionCaughtDialog.TreeSelectedTextColor.Green, - Styles.ExceptionCaughtDialog.TreeSelectedTextColor.Blue); - } else { - cr.SetSourceRGB (Styles.ExceptionCaughtDialog.TreeBackgroundColor.Red, - Styles.ExceptionCaughtDialog.TreeBackgroundColor.Green, - Styles.ExceptionCaughtDialog.TreeBackgroundColor.Blue); // background - cr.Fill (); - cr.SetSourceRGB (Styles.ExceptionCaughtDialog.TreeTextColor.Red, - Styles.ExceptionCaughtDialog.TreeTextColor.Green, - Styles.ExceptionCaughtDialog.TreeTextColor.Blue); - } + var selected = (flags & CellRendererState.Selected) != 0; + var backgroundColor = selected ? Styles.ExceptionCaughtDialog.TreeSelectedBackgroundColor : Styles.ExceptionCaughtDialog.TreeBackgroundColor; + var textColor = selected ? Styles.ExceptionCaughtDialog.TreeSelectedTextColor : Styles.ExceptionCaughtDialog.TreeTextColor; + cr.SetSourceColor (backgroundColor.ToCairoColor ()); + cr.Fill (); + cr.SetSourceColor (textColor.ToCairoColor()); layout.SetMarkup (Text); cr.Translate (cell_area.X + 10, cell_area.Y + 1); @@ -805,9 +795,9 @@ widget ""*.exception_dialog_expander"" style ""exception-dialog-expander"" string GetMethodMarkup (bool selected, string foregroundColor) { if (Markup != null) - return $"<span foreground='{Styles.ExceptionCaughtDialog.ExternalCodeTextColor.ToHexString (false)}'>{Markup}</span>";
-
- if (Frame == null)
+ return $"<span foreground='{Styles.ExceptionCaughtDialog.ExternalCodeTextColor.ToHexString (false)}'>{Markup}</span>"; + + if (Frame == null) return ""; var methodText = Frame.DisplayText; @@ -864,19 +854,18 @@ widget ""*.exception_dialog_expander"" style ""exception-dialog-expander"" protected override void Render (Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags) { using (var cr = Gdk.CairoHelper.Create (window)) { - if (!widget.HasFocus) { - cr.Rectangle (background_area.ToCairoRect ()); - cr.SetSourceColor (Styles.ObjectValueTreeDisabledBackgroundColor); - cr.Fill (); - } + + cr.Rectangle (background_area.ToCairoRect ()); Pango.Rectangle ink, logical; using (var layout = new Pango.Layout (Context)) { layout.FontDescription = font; var selected = (flags & CellRendererState.Selected) != 0; + var backgroundColor = selected ? Styles.ExceptionCaughtDialog.TreeSelectedBackgroundColor : Styles.ExceptionCaughtDialog.TreeBackgroundColor; + cr.SetSourceColor (backgroundColor.ToCairoColor ()); + cr.Fill (); var foregroundColor = Styles.GetStackFrameForegroundHexColor (selected, IsUserCode); - layout.SetMarkup (GetFileMarkup (selected, foregroundColor)); layout.GetPixelExtents (out ink, out logical); var width = widget.Allocation.Width; diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Styles.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Styles.cs index 8389942e4c..4b67bb7cac 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Styles.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Styles.cs @@ -37,6 +37,7 @@ namespace MonoDevelop.Debugger public static Color ObjectValueTreeValuesButtonBorder { get; internal set; } public static Color ObjectValueTreeValueErrorText { get; internal set; } public static Color ObjectValueTreeValueDisabledText { get; internal set; } + public static Color ObjectValueTreeActiveBackgroundColor { get; internal set; } public static Color ObjectValueTreeValueModifiedText { get; internal set; } public static Color PreviewVisualizerBackgroundColor { get; internal set; } public static Color PreviewVisualizerTextColor { get; internal set; } @@ -79,6 +80,7 @@ namespace MonoDevelop.Debugger ObjectValueTreeValuesButtonBorder = Color.FromName ("#175fde"); ObjectValueTreeValueDisabledText = Color.FromName ("#7f7f7f"); ObjectValueTreeValueModifiedText = Color.FromName ("#1FAECE"); + ObjectValueTreeActiveBackgroundColor = Color.FromName ("#a2a2a2"); ExceptionCaughtDialog.LineNumberTextColor = Color.FromName ("#707070"); ExceptionCaughtDialog.ExternalCodeTextColor = Color.FromName ("#707070"); @@ -89,6 +91,7 @@ namespace MonoDevelop.Debugger ObjectValueTreeValuesButtonBorder = Color.FromName ("#ace2ff"); ObjectValueTreeValueDisabledText = Color.FromName ("#5a5a5a"); ObjectValueTreeValueModifiedText = Color.FromName ("#4FCAE6"); + ObjectValueTreeActiveBackgroundColor = Color.FromName ("#383838"); ExceptionCaughtDialog.LineNumberTextColor = Color.FromName ("#b4b4b4"); ExceptionCaughtDialog.ExternalCodeTextColor = Color.FromName ("#b4b4b4"); |