diff options
author | Aaron Bockover <abock@microsoft.com> | 2019-02-08 03:01:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-08 03:01:42 +0300 |
commit | e61c3b35028cca154aae88a59d42a624cc169926 (patch) | |
tree | 7157668d27b87f068e535deec23c7f5938ebc91d /main | |
parent | c89bb6699238dfa381ba367e3ccfc3c5c055f45c (diff) | |
parent | c972f71dc4fdb8bd74f0b2dc6565c427abcf43ed (diff) |
Merge pull request #159 from xamarin/pr-abock-zoomies
Implement IZoomable, fix font size support
Diffstat (limited to 'main')
6 files changed, 29 insertions, 12 deletions
diff --git a/main/external/vs-editor-core b/main/external/vs-editor-core -Subproject 52b9dd18dbf4f780ec0098266f6e4ae205a872b +Subproject a205d966671643149f9c91f68af215ccee61b19 diff --git a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MonoTextEditor.ITextView.cs b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MonoTextEditor.ITextView.cs index bc10c02014..5cfed522d7 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MonoTextEditor.ITextView.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MonoTextEditor.ITextView.cs @@ -608,6 +608,10 @@ namespace Mono.TextEditor }
public ITextViewLineSource FormattedLineSource { get; } = null;
+
+ public void Focus () + { + }
#endif
}
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/IMdTextView.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/IMdTextView.cs index 80768b8efe..7e49f15b5b 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/IMdTextView.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/IMdTextView.cs @@ -13,5 +13,7 @@ namespace Microsoft.VisualStudio.Text.Editor { get; }
+
+ void Focus();
}
}
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewDisplayBinding.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewDisplayBinding.cs index 5d67738071..c1781137d9 100644 --- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewDisplayBinding.cs +++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewDisplayBinding.cs @@ -18,10 +18,8 @@ // 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.
-using System;
-using System.Windows; -using AppKit; +using System.Windows; using Microsoft.VisualStudio.Text.Classification;
@@ -47,7 +45,8 @@ namespace MonoDevelop.TextEditor protected override void AddFontToDictionary (ResourceDictionary resourceDictionary, string fontName, double fontSize)
{
- resourceDictionary[ClassificationFormatDefinition.TypefaceId] = NSFontWorkarounds.FromFontName (fontName, (nfloat)fontSize);
+ resourceDictionary [ClassificationFormatDefinition.TypefaceId] = fontName;
+ resourceDictionary [ClassificationFormatDefinition.FontRenderingSizeId] = fontSize;
}
} } diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.Commands.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.Commands.cs index c3d26b243a..44f9e0c148 100644 --- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.Commands.cs +++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.Commands.cs @@ -36,12 +36,12 @@ namespace MonoDevelop.TextEditor protected readonly struct EditorOperationCommand { - public readonly Action<IEditorOperations3> Execute; - public readonly Action<IEditorOperations3, CommandInfo> Update; + public readonly Action<IEditorOperations4> Execute; + public readonly Action<IEditorOperations4, CommandInfo> Update; public EditorOperationCommand ( - Action<IEditorOperations3> execute, - Action<IEditorOperations3, CommandInfo> update = null) + Action<IEditorOperations4> execute, + Action<IEditorOperations4, CommandInfo> update = null) { Execute = execute; Update = update; @@ -50,7 +50,7 @@ namespace MonoDevelop.TextEditor protected sealed class EditorOperationsMap : Dictionary<object, EditorOperationCommand> { - public new Action<IEditorOperations3> this [object id] { + public new Action<IEditorOperations4> this [object id] { get => base [id].Execute; set => base [CommandManager.ToCommandId (id)] = new EditorOperationCommand (value); } @@ -162,6 +162,18 @@ namespace MonoDevelop.TextEditor => throw new InvalidOperationException ("Array commands cannot be mapped to editor commands"); #endregion + + #region IZoomable + + public bool EnableZoomIn => editorOperations.CanZoomIn; + public bool EnableZoomOut => editorOperations.CanZoomOut; + public bool EnableZoomReset => editorOperations.CanZoomReset; + + public void ZoomIn () => editorOperations.ZoomIn (); + public void ZoomOut () => editorOperations.ZoomOut (); + public void ZoomReset () => editorOperations.ZoomReset (); + + #endregion } } diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs index 9a011af98f..50a21a641e 100644 --- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs +++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs @@ -36,7 +36,7 @@ using MonoDevelop.Projects; namespace MonoDevelop.TextEditor { - abstract partial class TextViewContent<TView, TImports> : ViewContent, INavigable, ICustomCommandTarget, ICommandHandler, ICommandUpdater + abstract partial class TextViewContent<TView, TImports> : ViewContent, INavigable, IZoomable, ICustomCommandTarget, ICommandHandler, ICommandUpdater where TView : ITextView where TImports : TextViewImports { @@ -44,7 +44,7 @@ namespace MonoDevelop.TextEditor readonly string mimeType; readonly Project ownerProject; readonly IEditorCommandHandlerService commandService; - readonly IEditorOperations3 editorOperations; + readonly IEditorOperations4 editorOperations; readonly IEditorOptions editorOptions; readonly List<IEditorContentProvider> contentProviders; readonly Ide.Editor.DefaultSourceEditorOptions sourceEditorOptions; @@ -90,7 +90,7 @@ namespace MonoDevelop.TextEditor control = CreateControl (); commandService = Imports.EditorCommandHandlerServiceFactory.GetService (TextView); - editorOperations = (IEditorOperations3)Imports.EditorOperationsProvider.GetEditorOperations (TextView); + editorOperations = (IEditorOperations4)Imports.EditorOperationsProvider.GetEditorOperations (TextView); editorOptions = Imports.EditorOptionsFactoryService.GetOptions (TextView); contentProviders = new List<IEditorContentProvider> (Imports.EditorContentProviderService.GetContentProvidersForView (TextView)); |