Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <llsan@microsoft.com>2017-05-01 16:29:12 +0300
committerGitHub <noreply@github.com>2017-05-01 16:29:12 +0300
commite5296061de5c6b093fb59668526728f2b82caa91 (patch)
treeaeab67f76b5154d3ea19d764ba11cec715ae6e59
parentb10d2d7b3da53409d5efeb7040a8929a9a5422d8 (diff)
parentbd98cdd283b28bcb60c012846270d3c31500df0b (diff)
Merge pull request #2312 from mono/d15-2-disable-a11ymonodevelop-7.0.0.3051
[A11y] Add option to disable accessibility
-rw-r--r--main/src/core/MonoDevelop.Ide/ExtensionModel/GlobalOptionsDialog.addin.xml5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/IdeTheme.cs12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/D152AccessibilityPanel.cs135
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj3
4 files changed, 151 insertions, 4 deletions
diff --git a/main/src/core/MonoDevelop.Ide/ExtensionModel/GlobalOptionsDialog.addin.xml b/main/src/core/MonoDevelop.Ide/ExtensionModel/GlobalOptionsDialog.addin.xml
index 732fe600ca..60beb40d2b 100644
--- a/main/src/core/MonoDevelop.Ide/ExtensionModel/GlobalOptionsDialog.addin.xml
+++ b/main/src/core/MonoDevelop.Ide/ExtensionModel/GlobalOptionsDialog.addin.xml
@@ -1,4 +1,4 @@
-<ExtensionModel>
+<ExtensionModel>
<ExtensionPoint path = "/MonoDevelop/Ide/GlobalOptionsDialog" name = "Global options panels">
<Description>Dialog panels for global MonoDevelop options.</Description>
@@ -47,6 +47,9 @@
<Section id = "LogAgent" _label = "Feedback" class = "MonoDevelop.Ide.Gui.OptionPanels.LogAgentOptionsPanel" icon="md-prefs-feedback" fill="true" />
<Section id = "MonoDevelopMaintenance" _label = "MonoDevelop Maintenance" class = "MonoDevelop.Ide.Gui.OptionPanels.MaintenanceOptionsPanel" icon="md-prefs-maintenance" />
</Condition>
+ <Condition id="Platform" value="mac">
+ <Section id = "Accessibility" _label = "Accessibility" class = "MonoDevelop.Ide.Gui.OptionPanels.D152AccessibilityPanel" fill="true" />
+ </Condition>
</Section>
</Extension>
</ExtensionModel>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/IdeTheme.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/IdeTheme.cs
index 3f685d732b..583cc8eec5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/IdeTheme.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/IdeTheme.cs
@@ -67,15 +67,23 @@ namespace MonoDevelop.Components
if (!Platform.IsLinux)
UpdateGtkTheme ();
- if (Platform.IsMac) {
+#if MAC
+ // Early init Cocoa through xwt
+ var path = Path.GetDirectoryName (typeof (IdeTheme).Assembly.Location);
+ System.Reflection.Assembly.LoadFrom (Path.Combine (path, "Xwt.XamMac.dll"));
+ var loaded = Xwt.Toolkit.Load (Xwt.ToolkitType.XamMac);
+
+ if (Platform.IsMac && NSUserDefaults.StandardUserDefaults.BoolForKey ("com.monodevelop.AccessibilityEnabled")) {
// Load a private version of AtkCocoa stored in the XS app directory
var appDir = Directory.GetParent (AppDomain.CurrentDomain.BaseDirectory);
var gtkPath = $"{appDir.Parent.FullName}/lib/gtk-2.0";
LoggingService.LogInfo ($"Loading modules from {gtkPath}");
Environment.SetEnvironmentVariable ("GTK_MODULES", $"{gtkPath}/libatkcocoa.so");
+ } else {
+ LoggingService.LogInfo ("Accessibility disabled");
}
-
+#endif
Gtk.Application.Init (BrandingService.ApplicationName, ref args);
// Reset our environment after initialization on Mac
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/D152AccessibilityPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/D152AccessibilityPanel.cs
new file mode 100644
index 0000000000..4b1a784029
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/D152AccessibilityPanel.cs
@@ -0,0 +1,135 @@
+//
+// D152AccessibilityPanel.cs
+//
+// Author:
+// iain <>
+//
+// Copyright (c) 2017
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if MAC
+using System;
+using MonoDevelop.Components;
+using MonoDevelop.Projects;
+using MonoDevelop.Ide.Projects;
+using MonoDevelop.Ide.Gui.Dialogs;
+using MonoDevelop.Core;
+
+using Gtk;
+
+using Foundation;
+
+namespace MonoDevelop.Ide.Gui.OptionPanels
+{
+ public class D152AccessibilityPanel : OptionsPanel
+ {
+ D152AccessibilityPanelWidget widget;
+
+ public override Control CreatePanelWidget ()
+ {
+ return widget = new D152AccessibilityPanelWidget ();
+ }
+
+ public override void ApplyChanges ()
+ {
+ widget.Save ();
+ }
+ }
+
+ class D152AccessibilityPanelWidget : VBox
+ {
+ bool originalSetting;
+ CheckButton enabled;
+
+ HSeparator separatorRestart;
+ Table tableRestart;
+ Button btnRestart;
+ ImageView imageRestart;
+ Label labelRestart;
+
+ static string EnabledKey = "com.monodevelop.AccessibilityEnabled";
+
+ public D152AccessibilityPanelWidget () : base (false, 6)
+ {
+ NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults;
+
+ enabled = new CheckButton ("Enable Accessibility");
+ enabled.Active = originalSetting = defaults.BoolForKey (EnabledKey);
+ enabled.Visible = true;
+
+ enabled.Toggled += ShowQuitOption;
+ PackStart (enabled, false, false, 0);
+
+ separatorRestart = new HSeparator ();
+ PackStart (this.separatorRestart, false, false, 0);
+
+ tableRestart = new Table (2, 3, false);
+ tableRestart.RowSpacing = 6;
+ tableRestart.ColumnSpacing = 6;
+
+ btnRestart = new Button ();
+ btnRestart.CanFocus = true;
+ btnRestart.UseUnderline = true;
+ btnRestart.Clicked += RestartClicked;
+
+ tableRestart.Attach (btnRestart, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
+
+ imageRestart = new global::MonoDevelop.Components.ImageView ();
+ imageRestart.IconId = "md-information";
+ imageRestart.IconSize = ((global::Gtk.IconSize)(1));
+
+ tableRestart.Attach (imageRestart, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
+ labelRestart = new global::Gtk.Label ();
+ tableRestart.Attach (labelRestart, 1, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
+
+ PackStart (tableRestart, false, false, 0);
+
+ labelRestart.LabelProp = GettextCatalog.GetString ("These preferences will take effect next time you start {0}", BrandingService.ApplicationName);
+ btnRestart.Label = GettextCatalog.GetString ("Restart {0}", BrandingService.ApplicationName);
+
+ Visible = true;
+ }
+
+ public void Save ()
+ {
+ NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults;
+ defaults.SetBool (enabled.Active, EnabledKey);
+ }
+
+ void ShowQuitOption (object sender, EventArgs args)
+ {
+ if (enabled.Active != originalSetting) {
+ tableRestart.ShowAll ();
+ separatorRestart.Show ();
+ } else {
+ tableRestart.Hide ();
+ separatorRestart.Hide ();
+ }
+ }
+
+ void RestartClicked (object sender, System.EventArgs e)
+ {
+ Save ();
+ IdeApp.Restart (true);
+ }
+ }
+}
+
+#endif
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
index 5ec001bc59..f5fe0235d2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
@@ -9412,6 +9412,7 @@
<Compile Include="MonoDevelop.Ide.Templates\MicrosoftTemplateEngineProcessedTemplateResult.cs" />
<Compile Include="MonoDevelop.Ide.Codons\TemplateExtensionNode.cs" />
<Compile Include="MonoDevelop.Ide.Templates\HasReferenceFileTemplateCondition.cs" />
+ <Compile Include="MonoDevelop.Ide.Gui.OptionPanels\D152AccessibilityPanel.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />
@@ -9452,7 +9453,7 @@
<None Include="MonoDevelop.Ide.Editor.Highlighting\VSCodeImport\objective-c\language-configuration.json" />
<None Include="MonoDevelop.Ide.Editor.Highlighting\VSCodeImport\objective-c\package.json" />
</ItemGroup>
- <Import Project="..\..\core\Mono.TextEditor.Platform\Mono.TextEditor.Platform.Def.projitems" Label="Shared" Condition="Exists('..\..\core\Mono.TextEditor.Platform\Mono.TextEditor.Platform.Def.projitems')" />
+ <Import Project="..\Mono.TextEditor.Platform\Mono.TextEditor.Platform.Def.projitems" Label="Shared" Condition="Exists('..\Mono.TextEditor.Platform\Mono.TextEditor.Platform.Def.projitems')" />
<ItemGroup>
<Folder Include="MonoDevelop.Components.MainToolbar\Theme\" />
<Folder Include="MonoDevelop.Components\Xwt\" />