diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2020-01-14 23:23:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-14 23:23:35 +0300 |
commit | ffc961af3c5760350c1b5069ddd94ef6be8c46f0 (patch) | |
tree | 6e6da42655352c589af7b2f230097130104e7837 /main | |
parent | 39a007b7ddefbb278517cb67de0a67df22df89fd (diff) | |
parent | db3bc7f42e9b706bb4cf60579e3638ff58560fab (diff) |
Merge pull request #9547 from mono/release-8.4-a11y
[release-8.4] a11y fixes
Diffstat (limited to 'main')
29 files changed, 191 insertions, 103 deletions
diff --git a/main/src/addins/MacPlatform/MacPlatform.cs b/main/src/addins/MacPlatform/MacPlatform.cs index e5bb3c6d74..0824931d24 100644 --- a/main/src/addins/MacPlatform/MacPlatform.cs +++ b/main/src/addins/MacPlatform/MacPlatform.cs @@ -414,6 +414,14 @@ namespace MonoDevelop.MacIntegration } } + internal override void MakeAccessibilityAnnouncement (string text) + { + using var message = new NSString (text); + using var dictionary = new NSDictionary (NSAccessibilityNotificationUserInfoKeys.AnnouncementKey, message, + NSAccessibilityNotificationUserInfoKeys.PriorityKey, NSAccessibilityPriorityLevel.High); + NSAccessibility.PostNotification (NSApplication.SharedApplication.AccessibilityMainWindow, NSAccessibilityNotifications.AnnouncementRequestedNotification, dictionary); + } + protected override string OnGetMimeTypeForUri (string uri) { var ext = Path.GetExtension (uri); diff --git a/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs b/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs index 31412de471..bbc28308a2 100644 --- a/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs +++ b/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs @@ -43,6 +43,7 @@ using System.Threading; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using MonoDevelop.MacInterop; +using MonoDevelop.Components.AtkCocoaHelper; namespace MonoDevelop.MacIntegration.MainToolbar { @@ -927,8 +928,13 @@ namespace MonoDevelop.MacIntegration.MainToolbar bool changed = LoadText (message, isMarkup, statusType); LoadPixbuf (image); - if (changed) + if (changed) { ReconstructString (); + // announce new status if vo/a11y is enabled + if (IdeServices.DesktopService.AccessibilityInUse) { + IdeServices.DesktopService.MakeAccessibilityAnnouncement (text); + } + } } bool LoadText (string message, bool isMarkup, MessageType statusType) diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtAdornmentManager.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtAdornmentManager.cs index 6a633f99d0..490fbc6754 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtAdornmentManager.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtAdornmentManager.cs @@ -43,6 +43,7 @@ namespace MonoDevelop.Debugger.VSTextView.ExceptionCaught private readonly string filePath; readonly IXPlatAdornmentLayer _exceptionCaughtLayer; FileLineExtension extension; + NSPanel exceptionCaughtButtonWindow; public ExceptionCaughtAdornmentManager (ICocoaViewFactory cocoaViewFactory, ICocoaTextView textView) { @@ -68,6 +69,10 @@ namespace MonoDevelop.Debugger.VSTextView.ExceptionCaught if (e.Extension == extension) { extension = null; _exceptionCaughtLayer.RemoveAllAdornments (); + if (exceptionCaughtButtonWindow != null) { + exceptionCaughtButtonWindow.Close (); + exceptionCaughtButtonWindow = null; + } } } @@ -81,11 +86,14 @@ namespace MonoDevelop.Debugger.VSTextView.ExceptionCaught private void RenderAdornment (FileLineExtension fileLineExtension) { NSView view; - if (fileLineExtension is ExceptionCaughtButton button) + bool mini; + if (fileLineExtension is ExceptionCaughtButton button) { + mini = false; view = CreateButton (cocoaViewFactory, button); - else if (fileLineExtension is ExceptionCaughtMiniButton miniButton) + } else if (fileLineExtension is ExceptionCaughtMiniButton miniButton) { + mini = true; view = CreateMiniButton (cocoaViewFactory, miniButton); - else + } else return; if (extension != fileLineExtension) { extension = fileLineExtension; @@ -97,17 +105,38 @@ namespace MonoDevelop.Debugger.VSTextView.ExceptionCaught return; if (!textView.TextViewLines.FormattedSpan.Contains (span.End)) return; - try { - var charBound = textView.TextViewLines.GetCharacterBounds (span.End); - view.SetFrameOrigin (new CGPoint ( + _exceptionCaughtLayer.RemoveAllAdornments (); + if (exceptionCaughtButtonWindow != null) { + exceptionCaughtButtonWindow.Close (); + exceptionCaughtButtonWindow = null; + } + var charBound = textView.TextViewLines.GetCharacterBounds (span.End); + if (mini) { + try { + view.SetFrameOrigin (new CGPoint ( Math.Round (charBound.Left), - Math.Round (charBound.TextTop + charBound.TextHeight / 2 - view.Frame.Height / 2))); - } catch (Exception e) { - view.SetFrameOrigin (default); - LoggingService.LogInternalError ("https://vsmac.dev/923058", e); + Math.Round (charBound.TextTop - charBound.TextHeight / 2 - view.Frame.Height / 2))); + } catch (Exception e) { + view.SetFrameOrigin (default); + LoggingService.LogInternalError ("https://vsmac.dev/923058", e); + } + _exceptionCaughtLayer.AddAdornment (XPlatAdornmentPositioningBehavior.TextRelative, span, null, view, null); + } else { + var editorWindow = textView.VisualElement.Window; + var pointOnScreen = editorWindow.ConvertPointToScreen (textView.VisualElement.ConvertPointToView (new CGPoint (charBound.Left, charBound.TextTop), null)); + exceptionCaughtButtonWindow = new NSPanel (CGRect.Empty, NSWindowStyle.Borderless, NSBackingStore.Buffered, false); + exceptionCaughtButtonWindow.AccessibilityRole = NSAccessibilityRoles.PopoverRole; + editorWindow.AddChildWindow (exceptionCaughtButtonWindow, NSWindowOrderingMode.Above); + exceptionCaughtButtonWindow.IsOpaque = false; + exceptionCaughtButtonWindow.BackgroundColor = NSColor.Clear; + exceptionCaughtButtonWindow.HasShadow = true; + exceptionCaughtButtonWindow.ContentView = view; + var fittingSize = view.FittingSize; + var x = Math.Min (editorWindow.Screen.VisibleFrame.Width - fittingSize.Width, pointOnScreen.X); + var y = Math.Max (0, pointOnScreen.Y - fittingSize.Height / 2); + exceptionCaughtButtonWindow.SetFrame (new CGRect (x, y, fittingSize.Width, fittingSize.Height), true); + exceptionCaughtButtonWindow.MakeKeyAndOrderFront (null); } - _exceptionCaughtLayer.RemoveAllAdornments (); - _exceptionCaughtLayer.AddAdornment (XPlatAdornmentPositioningBehavior.TextRelative, span, null, view, null); } private void TextView_LayoutChanged (object sender, TextViewLayoutChangedEventArgs e) diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/ValueVisualizerDialog.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/ValueVisualizerDialog.cs index 87683dd53f..8158421700 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/ValueVisualizerDialog.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/ValueVisualizerDialog.cs @@ -54,7 +54,7 @@ namespace MonoDevelop.Debugger.Viewers visualizers.Sort ((v1, v2) => string.Compare (v1.Name, v2.Name, StringComparison.CurrentCultureIgnoreCase)); buttons = new List<ToggleButton> (); - Gtk.Button defaultVis = null; + ToggleButton defaultVis = null; for (int i = 0; i < visualizers.Count; i++) { var button = new ToggleButton (); @@ -64,14 +64,15 @@ namespace MonoDevelop.Debugger.Viewers defaultVis = button; hbox1.PackStart (button, false, false, 0); buttons.Add (button); - button.CanFocus = false; button.Show (); } - if (defaultVis != null) - defaultVis.Click (); - else if (buttons.Count > 0) - buttons [0].Click (); + if (defaultVis == null) + defaultVis = buttons [0]; + + defaultVis.GrabFocus (); + SetToggleState (defaultVis, true); + UpdateVisualizer (defaultVis); if (val.IsReadOnly || !visualizers.Any (v => v.CanEdit (val))) { buttonCancel.Label = Gtk.Stock.Close; @@ -89,24 +90,23 @@ namespace MonoDevelop.Debugger.Viewers return base.OnKeyPressEvent (evnt); } - protected virtual void OnComboVisualizersChanged (object sender, EventArgs e) + void SetToggleState (ToggleButton button, bool value) + { + button.Toggled -= OnComboVisualizersChanged; + button.Active = value; + button.Toggled += OnComboVisualizersChanged; + } + + void UpdateVisualizer (ToggleButton button) { - var button = (ToggleButton)sender; - if (!button.Active) {//Prevent un-toggling - button.Toggled -= OnComboVisualizersChanged; - button.Active = true; - button.Toggled += OnComboVisualizersChanged; - return; - } if (currentWidget != null) mainBox.Remove (currentWidget); + foreach (var b in buttons) { - if (b != button && b.Active) { - b.Toggled -= OnComboVisualizersChanged; - b.Active = false; - b.Toggled += OnComboVisualizersChanged; - } + if (b != button && b.Active) + SetToggleState (b, false); } + currentVisualizer = visualizers [buttons.IndexOf (button)]; currentWidget = currentVisualizer.GetVisualizerWidget (value); buttonSave.Sensitive = currentVisualizer.CanEdit (value); @@ -114,6 +114,18 @@ namespace MonoDevelop.Debugger.Viewers currentWidget.Show (); } + protected virtual void OnComboVisualizersChanged (object sender, EventArgs e) + { + var button = (ToggleButton) sender; + + if (!button.Active) {//Prevent un-toggling + SetToggleState (button, true); + return; + } + + UpdateVisualizer (button); + } + protected virtual void OnSaveClicked (object sender, EventArgs e) { bool saved = false; diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectCellViewBase.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectCellViewBase.cs index b179e894b9..d3d2aacf06 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectCellViewBase.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectCellViewBase.cs @@ -42,6 +42,7 @@ namespace MonoDevelop.Debugger { abstract class MacDebuggerObjectCellViewBase : NSTableCellView { + protected static readonly string[] SelectedStyle = { "sel" }; protected const int CompactImageSize = 12; protected const int RowCellSpacing = 2; protected const int ImageSize = 16; @@ -103,12 +104,12 @@ namespace MonoDevelop.Debugger get { return Node is LoadingObjectValueNode; } } - protected static NSImage GetImage (string name, Gtk.IconSize size, bool selected = false) + protected static NSImage GetImage (string name, Gtk.IconSize size, params string[] styles) { var icon = ImageService.GetIcon (name, size); - if (selected) - icon = icon.WithStyles ("sel"); + if (styles != null && styles.Length > 0) + icon = icon.WithStyles (styles); try { return icon.ToNSImage (); @@ -118,19 +119,9 @@ namespace MonoDevelop.Debugger } } - protected static NSImage GetImage (string name, Gtk.IconSize size, double alpha, bool selected = false) + protected static NSImage GetImage (string name, Gtk.IconSize size, bool selected = false) { - var icon = ImageService.GetIcon (name, size).WithAlpha (alpha); - - if (selected) - icon = icon.WithStyles ("sel"); - - try { - return icon.ToNSImage (); - } catch (Exception ex) { - Core.LoggingService.LogError ($"Failed to load '{name}' as an NSImage", ex); - return icon.ToBitmap (NSScreen.MainScreen.BackingScaleFactor).ToNSImage (); - } + return GetImage (name, size, selected ? SelectedStyle : null); } protected static NSImage GetImage (string name, int width, int height, bool selected = false) diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectNameView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectNameView.cs index 21d85d89f5..63b1c60e32 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectNameView.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectNameView.cs @@ -380,6 +380,13 @@ namespace MonoDevelop.Debugger public void SetPreviewButtonIcon (PreviewButtonIcon icon) { + // When a11y is in use, always show an icon. + if (IdeServices.DesktopService.AccessibilityInUse && icon == PreviewButtonIcon.Hidden) { + var selected = Superview is NSTableRowView rowView && rowView.Selected; + + icon = selected ? PreviewButtonIcon.Selected : PreviewButtonIcon.Hover; + } + if (!previewIconVisible || icon == currentIcon) return; diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectPinView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectPinView.cs index 82209926a5..011162b647 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectPinView.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectPinView.cs @@ -30,21 +30,19 @@ using AppKit; using MonoDevelop.Core; using MonoDevelop.Ide; +using MonoDevelop.Ide.Gui; namespace MonoDevelop.Debugger { class MacDebuggerObjectPinView : MacDebuggerObjectCellViewBase { - static readonly NSImage selectedUnpinnedImage = GetImage ("md-pin-up", Gtk.IconSize.Menu, true); - static readonly NSImage selectedPinnedImage = GetImage ("md-pin-down", Gtk.IconSize.Menu, true); - static readonly NSImage unpinnedImage = GetImage ("md-pin-up", Gtk.IconSize.Menu); - static readonly NSImage pinnedImage = GetImage ("md-pin-down", Gtk.IconSize.Menu); - - static readonly NSImage liveUpdateOnImage = GetImage ("md-live", Gtk.IconSize.Menu); - static readonly NSImage liveUpdateOffImage = GetImage ("md-live", Gtk.IconSize.Menu, 0.5); - static readonly NSImage none = GetImage ("md-empty", Gtk.IconSize.Menu); + static readonly NSImage EmptyImage = GetImage (Stock.Empty, Gtk.IconSize.Menu); + static readonly string [] ActiveSelectedStyle = { "active", "sel" }; + static readonly string [] ActiveStyle = { "active" }; + public const int MinWidth = MarginSize + 16 + MarginSize; public const int MaxWidth = MarginSize + 16 + RowCellSpacing + 16 + MarginSize; + bool disposed; bool pinned; @@ -53,7 +51,7 @@ namespace MonoDevelop.Debugger PinButton = new NSButton { TranslatesAutoresizingMaskIntoConstraints = false, BezelStyle = NSBezelStyle.Inline, - Image = none, + Image = EmptyImage, Bordered = false, }; PinButton.AccessibilityTitle = GettextCatalog.GetString ("Pin to the editor"); @@ -62,8 +60,8 @@ namespace MonoDevelop.Debugger LiveUpdateButton = new NSButton { TranslatesAutoresizingMaskIntoConstraints = false, + Image = GetImage ("md-live", Gtk.IconSize.Menu), BezelStyle = NSBezelStyle.Inline, - Image = liveUpdateOffImage, Bordered = false }; LiveUpdateButton.AccessibilityTitle = GettextCatalog.GetString ("Refresh value"); @@ -103,20 +101,28 @@ namespace MonoDevelop.Debugger var selected = Superview is NSTableRowView rowView && rowView.Selected; if (TreeView.PinnedWatch != null && Node.Parent == TreeView.Controller.Root) { - PinButton.Image = selected ? selectedPinnedImage : pinnedImage; + PinButton.Image = GetImage (Stock.PinDown, Gtk.IconSize.Menu, selected); pinned = true; } else { - PinButton.Image = none; + // When a11y is in use, always show an icon. + if (IdeServices.DesktopService.AccessibilityInUse) + PinButton.Image = GetImage (Stock.PinUp, Gtk.IconSize.Menu, selected); + else + PinButton.Image = EmptyImage; pinned = false; } if (pinned) { + string[] styles; + if (TreeView.PinnedWatch.LiveUpdate) - LiveUpdateButton.Image = liveUpdateOnImage; + styles = selected ? ActiveSelectedStyle : ActiveStyle; else - LiveUpdateButton.Image = liveUpdateOffImage; + styles = selected ? SelectedStyle : null; + + LiveUpdateButton.Image = GetImage ("md-live", Gtk.IconSize.Menu, styles); } else { - LiveUpdateButton.Image = none; + LiveUpdateButton.Image = EmptyImage; } } @@ -144,10 +150,11 @@ namespace MonoDevelop.Debugger var selected = Superview is NSTableRowView rowView && rowView.Selected; + // When a11y is in use, always show an icon. if (hover || IdeServices.DesktopService.AccessibilityInUse) { - PinButton.Image = selected ? selectedUnpinnedImage : unpinnedImage; + PinButton.Image = GetImage (Stock.PinUp, Gtk.IconSize.Menu, selected); } else { - PinButton.Image = none; + PinButton.Image = EmptyImage; } SetNeedsDisplayInRect (PinButton.Frame); diff --git a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs index 0d9e6c2395..f5f29f6b08 100644 --- a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs +++ b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorView.cs @@ -65,8 +65,6 @@ namespace MonoDevelop.HexEditor window = new ScrollView (hexEditor); await LoadContent (); - hexEditor.SetFocus (); - return new XwtControl (window); } diff --git a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorVisualizer.cs b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorVisualizer.cs index 40c0f444db..74087bbc2a 100644 --- a/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorVisualizer.cs +++ b/main/src/addins/MonoDevelop.HexEditor/MonoDevelop.HexEditor/HexEditorVisualizer.cs @@ -135,7 +135,6 @@ namespace MonoDevelop.HexEditor var xwtScrollView = new Xwt.ScrollView (hexEditor); var scrollWidget = (Widget) Xwt.Toolkit.CurrentEngine.GetNativeWidget (xwtScrollView); SetHexEditorOptions (); - hexEditor.SetFocus (); return scrollWidget; } diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.cs index 7934c29f42..f4266e4ee3 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.cs @@ -747,14 +747,17 @@ namespace MonoDevelop.PackageManagement GetPackagesCountForAddPackagesButtonLabel (), viewModel.PageSelected); - using (var dialog = new SelectProjectsDialog (selectProjectsViewModel)) { - Command result = dialog.ShowWithParent (); - if (result == Command.Ok) { - return dialog.GetSelectedProjects (); - } else { - return Enumerable.Empty<IDotNetProject> (); + return Toolkit.NativeEngine.Invoke (() => { + using (var dialog = new SelectProjectsDialog (selectProjectsViewModel)) { + Command result = dialog.Run (this); + if (result == Command.Ok) { + return dialog.GetSelectedProjects (); + } else { + return Enumerable.Empty<IDotNetProject> (); + } } - } + }); + } /// <summary> diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs index dad45ed698..9e5247472b 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using Mono.TextEditor; using MonoDevelop.Ide; using MonoDevelop.Components; +using MonoDevelop.Components.AtkCocoaHelper; using System.ComponentModel; using MonoDevelop.Core; using MonoDevelop.Ide.Gui; @@ -87,6 +88,12 @@ namespace MonoDevelop.VersionControl.Views new MonoTextEditor (new TextDocument (), options), new MonoTextEditor (new TextDocument (), options), }; + editors [0].Accessible.SetShouldIgnore (false); + editors [0].Accessible.SetRole (AtkCocoa.Roles.AXGroup); + editors [0].Accessible.SetTitle (GettextCatalog.GetString ("Comparing Revision Editor")); + editors [1].Accessible.SetShouldIgnore (false); + editors [1].Accessible.SetRole (AtkCocoa.Roles.AXGroup); + editors [1].Accessible.SetTitle (GettextCatalog.GetString ("Original Revision Editor")); if (!viewOnly) { revisionStore = new ListStore (typeof(Revision), typeof (string), typeof (string), typeof (string)); @@ -109,7 +116,8 @@ namespace MonoDevelop.VersionControl.Views originalComboBox.PackStart (authorRenderer, true); originalComboBox.AddAttribute (authorRenderer, "text", 3); - // originalComboBox.AccessibilityTextFormat = GettextCatalog.GetString ("Select original revision, current: {0}"); + originalComboBox.Accessible.SetTitle (GettextCatalog.GetString ("Original Revision")); + originalComboBox.Active = 0; originalComboBox.Sensitive = false; @@ -122,7 +130,8 @@ namespace MonoDevelop.VersionControl.Views diffComboBox.PackStart (authorRenderer, true); diffComboBox.AddAttribute (authorRenderer, "text", 3); - // diffComboBox.AccessibilityTextFormat = GettextCatalog.GetString ("Select diff revision, current: {0}"); + diffComboBox.Accessible.SetTitle (GettextCatalog.GetString ("Compared Revision")); + diffComboBox.Active = 0; diffComboBox.Sensitive = false; this.headerWidgets = new [] { diffComboBox, originalComboBox }; diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.MiddleArea.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.MiddleArea.cs index 7362d853ec..6c0ec76084 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.MiddleArea.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.MiddleArea.cs @@ -480,14 +480,13 @@ namespace MonoDevelop.VersionControl.Views Accessible.PerformPress += PerformPress; Accessible.SetRole (AtkCocoa.Roles.AXButton); - Accessible.Label = widget.useLeft ? GettextCatalog.GetString ("Revert left changes button") : GettextCatalog.GetString ("Revert right changes button"); if (hunk.Inserted > 0) { - Accessible.Label = GettextCatalog.GetString ("Revert {0} inserted lines starting at {1}", hunk.Inserted, hunk.InsertStart); + Accessible.Label = GettextCatalog.GetPluralString ("Revert {0} inserted line starting at {1}", "Revert {0} inserted lines starting at {1}", hunk.Inserted, hunk.Inserted, hunk.InsertStart); } else if (hunk.Removed > 0) { - Accessible.Label = GettextCatalog.GetString ("Revert {0} removed lines starting at {1}", hunk.Removed, hunk.RemoveStart); + Accessible.Label = GettextCatalog.GetPluralString ("Revert {0} removed line starting at {1}", "Revert {0} removed lines starting at {1}", hunk.Removed, hunk.Removed, hunk.RemoveStart); } else { - Accessible.Label = GettextCatalog.GetString ("Revert {0} replaced lines starting at {1}", hunk.Removed, hunk.InsertStart); + Accessible.Label = GettextCatalog.GetPluralString ("Revert {0} replaced line starting at {1}", "Revert {0} replaced lines starting at {1}", hunk.Removed, hunk.Removed, hunk.InsertStart); } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs index 2ecb25f055..47c7c983c9 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs @@ -513,6 +513,8 @@ namespace MonoDevelop.Ide.Desktop public static bool AccessibilityKeyboardFocusInUse { get; protected set; } + internal virtual void MakeAccessibilityAnnouncement (string text) { } + internal virtual string GetNativeRuntimeDescription () { return null; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs index 8b4d8c9f6f..03306ff44a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs @@ -78,23 +78,7 @@ namespace MonoDevelop.Ide.Projects actionHandler.PerformShowMenu += PerformShowMenu;
} - void ProjectCreationFailed (object obj, EventArgs args) => ShowProjectCreationAccessibityNotification (true);
- void ProjectCreated(object obj, EventArgs args) => ShowProjectCreationAccessibityNotification (false);
async void NextButtonClicked (object sender, EventArgs e) => await MoveToNextPage ();
-
- void ShowProjectCreationAccessibityNotification (bool hasError)
- {
- var projectTemplate = controller.SelectedTemplate;
-
- string messageText; -
- if (hasError) - messageText = GettextCatalog.GetString ("{0} failed to create", projectTemplate.Name); - else - messageText = GettextCatalog.GetString ("{0} successfully created", projectTemplate.Name);
-
- this.Accessible.MakeAccessibilityAnnouncement (messageText); - }
public void ShowDialog ()
{
@@ -114,8 +98,6 @@ namespace MonoDevelop.Ide.Projects public void RegisterController (INewProjectDialogController controller)
{
this.controller = controller;
- controller.ProjectCreationFailed += ProjectCreationFailed;
- controller.ProjectCreated += ProjectCreated;
languageCellRenderer.SelectedLanguage = controller.SelectedLanguage;
topBannerLabel.Text = controller.BannerText;
LoadTemplates ();
@@ -299,9 +281,6 @@ namespace MonoDevelop.Ide.Projects if (!controller.IsLastPage)
projectConfigurationWidget.Destroy ();
- controller.ProjectCreationFailed -= ProjectCreationFailed;
- controller.ProjectCreated -= ProjectCreated;
-
base.OnDestroyed ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs index 455929c782..41705740a0 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs @@ -613,6 +613,8 @@ namespace MonoDevelop.Ide.Projects public async Task Create ()
{
+ Runtime.AssertMainThread (); + OnProjectCreating (); projectCreated = new TaskCompletionSource<bool> ();
if (wizardProvider.HasWizard)
@@ -620,7 +622,7 @@ namespace MonoDevelop.Ide.Projects if (!await CreateProject ()) { projectCreated.SetResult (false);
- ProjectCreationFailed?.Invoke (this, EventArgs.Empty);
+ OnProjectCreationFailed (); return;
}
@@ -714,13 +716,41 @@ namespace MonoDevelop.Ide.Projects UpdateDefaultSettings (); projectCreated.SetResult (true); - await Runtime.RunInMainThread (() => ProjectCreated?.Invoke (this, EventArgs.Empty)); + OnProjectCreated (); } catch (Exception ex) { projectCreated.SetException (ex); throw; }
} + void OnProjectCreating () + { + if (IdeServices.DesktopService.AccessibilityInUse) { + var announcement = GettextCatalog.GetString ("Creating project {0}", SelectedTemplate.Name); + IdeServices.DesktopService.MakeAccessibilityAnnouncement (announcement); + } + } + + void OnProjectCreationFailed () + { + ProjectCreationFailed?.Invoke (this, EventArgs.Empty); + + if (IdeServices.DesktopService.AccessibilityInUse) { + var announcement = GettextCatalog.GetString ("{0} failed to create", SelectedTemplate.Name); + IdeServices.DesktopService.MakeAccessibilityAnnouncement (announcement); + } + } + + void OnProjectCreated () + { + ProjectCreated?.Invoke (this, EventArgs.Empty); + + if (IdeServices.DesktopService.AccessibilityInUse) { + var announcement = GettextCatalog.GetString ("{0} successfully created", SelectedTemplate.Name); + IdeServices.DesktopService.MakeAccessibilityAnnouncement (announcement); + } + } + public Task<bool> ProjectCreation => projectCreated?.Task; TaskCompletionSource<bool> projectCreated;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj index abc5d1a137..264b1ff092 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj @@ -2326,6 +2326,10 @@ <EmbeddedResource Include="icons\live-16~dark~sel%402x.png" /> <EmbeddedResource Include="icons\live-16~sel.png" /> <EmbeddedResource Include="icons\live-16~sel%402x.png" /> + <EmbeddedResource Include="icons\live-16~active.png" /> + <EmbeddedResource Include="icons\live-16~active%402x.png" /> + <EmbeddedResource Include="icons\live-16~active~dark.png" /> + <EmbeddedResource Include="icons\live-16~active~dark%402x.png" /> <EmbeddedResource Include="icons\status-instrumentation-16.png" /> <EmbeddedResource Include="icons\status-instrumentation-16%402x.png" /> <EmbeddedResource Include="icons\status-instrumentation-16~dark.png" /> diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs index 37c4cd60c9..a44b14be25 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs @@ -447,6 +447,11 @@ namespace MonoDevelop.Ide PlatformService.RestartIde (reopenWorkspace); } + public void MakeAccessibilityAnnouncement(string text) + { + PlatformService.MakeAccessibilityAnnouncement (text); + } + public bool AccessibilityInUse { get { return PlatformService.AccessibilityInUse; diff --git a/main/src/core/MonoDevelop.Ide/icons/live-16.png b/main/src/core/MonoDevelop.Ide/icons/live-16.png Binary files differindex 5062b7b0ef..4de5bb4cbe 100644 --- a/main/src/core/MonoDevelop.Ide/icons/live-16.png +++ b/main/src/core/MonoDevelop.Ide/icons/live-16.png diff --git a/main/src/core/MonoDevelop.Ide/icons/live-16@2x.png b/main/src/core/MonoDevelop.Ide/icons/live-16@2x.png Binary files differindex 5981bd69a5..40c90b8f4f 100644 --- a/main/src/core/MonoDevelop.Ide/icons/live-16@2x.png +++ b/main/src/core/MonoDevelop.Ide/icons/live-16@2x.png diff --git a/main/src/core/MonoDevelop.Ide/icons/live-16~active.png b/main/src/core/MonoDevelop.Ide/icons/live-16~active.png Binary files differnew file mode 100644 index 0000000000..1bdf1ea3e9 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/icons/live-16~active.png diff --git a/main/src/core/MonoDevelop.Ide/icons/live-16~active@2x.png b/main/src/core/MonoDevelop.Ide/icons/live-16~active@2x.png Binary files differnew file mode 100644 index 0000000000..b21098ea94 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/icons/live-16~active@2x.png diff --git a/main/src/core/MonoDevelop.Ide/icons/live-16~active~dark.png b/main/src/core/MonoDevelop.Ide/icons/live-16~active~dark.png Binary files differnew file mode 100644 index 0000000000..57eb64fe8c --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/icons/live-16~active~dark.png diff --git a/main/src/core/MonoDevelop.Ide/icons/live-16~active~dark@2x.png b/main/src/core/MonoDevelop.Ide/icons/live-16~active~dark@2x.png Binary files differnew file mode 100644 index 0000000000..ff956acf21 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/icons/live-16~active~dark@2x.png diff --git a/main/src/core/MonoDevelop.Ide/icons/live-16~dark.png b/main/src/core/MonoDevelop.Ide/icons/live-16~dark.png Binary files differindex b2dcbca9cf..87e1169432 100644 --- a/main/src/core/MonoDevelop.Ide/icons/live-16~dark.png +++ b/main/src/core/MonoDevelop.Ide/icons/live-16~dark.png diff --git a/main/src/core/MonoDevelop.Ide/icons/live-16~dark@2x.png b/main/src/core/MonoDevelop.Ide/icons/live-16~dark@2x.png Binary files differindex d7b5fb0f53..8e6641dc49 100644 --- a/main/src/core/MonoDevelop.Ide/icons/live-16~dark@2x.png +++ b/main/src/core/MonoDevelop.Ide/icons/live-16~dark@2x.png diff --git a/main/src/core/MonoDevelop.Ide/icons/live-16~dark~sel.png b/main/src/core/MonoDevelop.Ide/icons/live-16~dark~sel.png Binary files differindex 5ca6600be9..3ae97552ce 100644 --- a/main/src/core/MonoDevelop.Ide/icons/live-16~dark~sel.png +++ b/main/src/core/MonoDevelop.Ide/icons/live-16~dark~sel.png diff --git a/main/src/core/MonoDevelop.Ide/icons/live-16~dark~sel@2x.png b/main/src/core/MonoDevelop.Ide/icons/live-16~dark~sel@2x.png Binary files differindex cf2965cf4d..f3c6340a68 100644 --- a/main/src/core/MonoDevelop.Ide/icons/live-16~dark~sel@2x.png +++ b/main/src/core/MonoDevelop.Ide/icons/live-16~dark~sel@2x.png diff --git a/main/src/core/MonoDevelop.Ide/icons/live-16~sel.png b/main/src/core/MonoDevelop.Ide/icons/live-16~sel.png Binary files differindex 5ca6600be9..3ae97552ce 100644 --- a/main/src/core/MonoDevelop.Ide/icons/live-16~sel.png +++ b/main/src/core/MonoDevelop.Ide/icons/live-16~sel.png diff --git a/main/src/core/MonoDevelop.Ide/icons/live-16~sel@2x.png b/main/src/core/MonoDevelop.Ide/icons/live-16~sel@2x.png Binary files differindex cf2965cf4d..f3c6340a68 100644 --- a/main/src/core/MonoDevelop.Ide/icons/live-16~sel@2x.png +++ b/main/src/core/MonoDevelop.Ide/icons/live-16~sel@2x.png |