From 2c2b37f301cbda1d102f1df169c0b496764415b7 Mon Sep 17 00:00:00 2001 From: Martin Zikmund Date: Thu, 9 Nov 2023 15:06:20 +0100 Subject: [PATCH] feat: Use StandardUICommand for TextBox context menu --- .../TextBox/Strings/en-US/Resources.resw | 139 ------------------ .../TextBox/Strings/en/Resources.resw | 139 ------------------ .../TextBox/Strings/es-ES/Resources.resw | 139 ------------------ .../TextBox/Strings/es-MX/Resources.resw | 139 ------------------ .../TextBox/Strings/fr-CA/Resources.resw | 139 ------------------ .../TextBox/Strings/fr/Resources.resw | 139 ------------------ .../TextBox/Strings/sr/Resources.resw | 139 ------------------ .../UI/Xaml/Controls/TextBox/TextBox.skia.cs | 8 +- 8 files changed, 4 insertions(+), 977 deletions(-) delete mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/en-US/Resources.resw delete mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/en/Resources.resw delete mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/es-ES/Resources.resw delete mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/es-MX/Resources.resw delete mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/fr-CA/Resources.resw delete mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/fr/Resources.resw delete mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/sr/Resources.resw diff --git a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/en-US/Resources.resw b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/en-US/Resources.resw deleted file mode 100644 index e3f3a401f20c..000000000000 --- a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/en-US/Resources.resw +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Cut - - - Copy - - - Paste - - - Undo - - - Redo - - - Select All - - diff --git a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/en/Resources.resw b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/en/Resources.resw deleted file mode 100644 index e3f3a401f20c..000000000000 --- a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/en/Resources.resw +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Cut - - - Copy - - - Paste - - - Undo - - - Redo - - - Select All - - diff --git a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/es-ES/Resources.resw b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/es-ES/Resources.resw deleted file mode 100644 index bf00d74b974d..000000000000 --- a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/es-ES/Resources.resw +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Cortar - - - Copiar - - - Pegar - - - Deshacer - - - Rehacer - - - Seleccionar todo - - diff --git a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/es-MX/Resources.resw b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/es-MX/Resources.resw deleted file mode 100644 index bf00d74b974d..000000000000 --- a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/es-MX/Resources.resw +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Cortar - - - Copiar - - - Pegar - - - Deshacer - - - Rehacer - - - Seleccionar todo - - diff --git a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/fr-CA/Resources.resw b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/fr-CA/Resources.resw deleted file mode 100644 index e285d4cbd103..000000000000 --- a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/fr-CA/Resources.resw +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Couper - - - Copier - - - Coller - - - Annuler - - - Rétablir - - - Sélectionner tout - - diff --git a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/fr/Resources.resw b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/fr/Resources.resw deleted file mode 100644 index e285d4cbd103..000000000000 --- a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/fr/Resources.resw +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Couper - - - Copier - - - Coller - - - Annuler - - - Rétablir - - - Sélectionner tout - - diff --git a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/sr/Resources.resw b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/sr/Resources.resw deleted file mode 100644 index fbb84019f52d..000000000000 --- a/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/sr/Resources.resw +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Izreži - - - Kopiraj - - - Nalepi - - - Poništi - - - Ponovi - - - Odaberi sve - - diff --git a/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.skia.cs b/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.skia.cs index 96b5f9aa0118..b692047f0e20 100644 --- a/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.skia.cs +++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.skia.cs @@ -647,11 +647,11 @@ protected override void OnRightTapped(RightTappedRoutedEventArgs e) _contextMenu.Opened += (_, _) => UpdateDisplaySelection(); // TODO: port localized resources from WinUI - _flyoutItems.Add(ContextMenuItem.Cut, new MenuFlyoutItem { Text = ResourceAccessor.GetLocalizedStringResource("TextBoxCut"), Command = new TextBoxCommand(CutSelectionToClipboard), Icon = new SymbolIcon(Symbol.Cut) }); - _flyoutItems.Add(ContextMenuItem.Copy, new MenuFlyoutItem { Text = ResourceAccessor.GetLocalizedStringResource("TextBoxCopy"), Command = new TextBoxCommand(CopySelectionToClipboard), Icon = new SymbolIcon(Symbol.Copy) }); - _flyoutItems.Add(ContextMenuItem.Paste, new MenuFlyoutItem { Text = ResourceAccessor.GetLocalizedStringResource("TextBoxPaste"), Command = new TextBoxCommand(PasteFromClipboard), Icon = new SymbolIcon(Symbol.Paste) }); + _flyoutItems.Add(ContextMenuItem.Cut, new MenuFlyoutItem { Command = new StandardUICommand(StandardUICommandKind.Cut) { Command = new TextBoxCommand(CutSelectionToClipboard) } }); + _flyoutItems.Add(ContextMenuItem.Copy, new MenuFlyoutItem { Command = new StandardUICommand(StandardUICommandKind.Copy) { Command = new TextBoxCommand(CopySelectionToClipboard) } }); + _flyoutItems.Add(ContextMenuItem.Paste, new MenuFlyoutItem { Command = new StandardUICommand(StandardUICommandKind.Paste) { Command = new TextBoxCommand(PasteFromClipboard) } }); // undo/redo - _flyoutItems.Add(ContextMenuItem.SelectAll, new MenuFlyoutItem { Text = ResourceAccessor.GetLocalizedStringResource("TextBoxSelectAll"), Command = new TextBoxCommand(SelectAll), Icon = new SymbolIcon(Symbol.SelectAll) }); + _flyoutItems.Add(ContextMenuItem.SelectAll, new MenuFlyoutItem { Command = new StandardUICommand(StandardUICommandKind.SelectAll) { Command = new TextBoxCommand(SelectAll) } }); } _contextMenu.Items.Clear();