From 0a929c17babb05f243edbd4f9bcc7c8dba127d35 Mon Sep 17 00:00:00 2001 From: Ramez Ragaa Date: Mon, 6 Nov 2023 19:21:40 +0200 Subject: [PATCH] chore: fix build errors and move TextBox string resources inside Uno --- .../Strings/en-US/Resources.resw | 19 --- .../Strings/en/Resources.resw | 19 --- .../Strings/es-ES/Resources.resw | 19 --- .../Strings/es-MX/Resources.resw | 19 --- .../Strings/fr-CA/Resources.resw | 19 --- .../Strings/fr/Resources.resw | 19 --- .../Strings/sr/Resources.resw | 19 --- .../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 ++++++++++++++++++ .../Controls/TextBox/TextBox.reference.cs | 16 ++ .../UI/Xaml/Controls/TextBox/TextBox.skia.cs | 12 +- .../UI/Xaml/Controls/TextBox/TextBox.wasm.cs | 15 ++ 17 files changed, 1010 insertions(+), 139 deletions(-) create mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/en-US/Resources.resw create mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/en/Resources.resw create mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/es-ES/Resources.resw create mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/es-MX/Resources.resw create mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/fr-CA/Resources.resw create mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/fr/Resources.resw create mode 100644 src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/sr/Resources.resw diff --git a/src/SamplesApp/SamplesApp.Shared/Strings/en-US/Resources.resw b/src/SamplesApp/SamplesApp.Shared/Strings/en-US/Resources.resw index f791d81ffeb0..6021eaf6fbb5 100644 --- a/src/SamplesApp/SamplesApp.Shared/Strings/en-US/Resources.resw +++ b/src/SamplesApp/SamplesApp.Shared/Strings/en-US/Resources.resw @@ -165,23 +165,4 @@ Uno Platform - - - Cut - - - Copy - - - Paste - - - Undo - - - Redo - - - Select All - diff --git a/src/SamplesApp/SamplesApp.Shared/Strings/en/Resources.resw b/src/SamplesApp/SamplesApp.Shared/Strings/en/Resources.resw index d09337b51123..2802be19907a 100644 --- a/src/SamplesApp/SamplesApp.Shared/Strings/en/Resources.resw +++ b/src/SamplesApp/SamplesApp.Shared/Strings/en/Resources.resw @@ -147,23 +147,4 @@ Uno Platform - - - Cut - - - Copy - - - Paste - - - Undo - - - Redo - - - Select All - diff --git a/src/SamplesApp/SamplesApp.Shared/Strings/es-ES/Resources.resw b/src/SamplesApp/SamplesApp.Shared/Strings/es-ES/Resources.resw index 9725d2ec5ac7..db4c881ec643 100644 --- a/src/SamplesApp/SamplesApp.Shared/Strings/es-ES/Resources.resw +++ b/src/SamplesApp/SamplesApp.Shared/Strings/es-ES/Resources.resw @@ -126,23 +126,4 @@ Uno Platform - - - Cortar - - - Copiar - - - Pegar - - - Deshacer - - - Rehacer - - - Seleccionar todo - diff --git a/src/SamplesApp/SamplesApp.Shared/Strings/es-MX/Resources.resw b/src/SamplesApp/SamplesApp.Shared/Strings/es-MX/Resources.resw index 2f34844c31c7..2ebe3777d9ed 100644 --- a/src/SamplesApp/SamplesApp.Shared/Strings/es-MX/Resources.resw +++ b/src/SamplesApp/SamplesApp.Shared/Strings/es-MX/Resources.resw @@ -126,23 +126,4 @@ Uno Platform - - - Cortar - - - Copiar - - - Pegar - - - Deshacer - - - Rehacer - - - Seleccionar todo - diff --git a/src/SamplesApp/SamplesApp.Shared/Strings/fr-CA/Resources.resw b/src/SamplesApp/SamplesApp.Shared/Strings/fr-CA/Resources.resw index aae1fb21a73f..a4f09a1bdcac 100644 --- a/src/SamplesApp/SamplesApp.Shared/Strings/fr-CA/Resources.resw +++ b/src/SamplesApp/SamplesApp.Shared/Strings/fr-CA/Resources.resw @@ -126,23 +126,4 @@ Uno Platform - - - Couper - - - Copier - - - Coller - - - Annuler - - - Rétablir - - - Sélectionner tout - diff --git a/src/SamplesApp/SamplesApp.Shared/Strings/fr/Resources.resw b/src/SamplesApp/SamplesApp.Shared/Strings/fr/Resources.resw index 6a18a8d9ac00..1afe527d547f 100644 --- a/src/SamplesApp/SamplesApp.Shared/Strings/fr/Resources.resw +++ b/src/SamplesApp/SamplesApp.Shared/Strings/fr/Resources.resw @@ -126,23 +126,4 @@ Uno Platform - - - Couper - - - Copier - - - Coller - - - Annuler - - - Rétablir - - - Sélectionner tout - diff --git a/src/SamplesApp/SamplesApp.Shared/Strings/sr/Resources.resw b/src/SamplesApp/SamplesApp.Shared/Strings/sr/Resources.resw index c91bf25d0252..1dee7464c5ab 100644 --- a/src/SamplesApp/SamplesApp.Shared/Strings/sr/Resources.resw +++ b/src/SamplesApp/SamplesApp.Shared/Strings/sr/Resources.resw @@ -126,23 +126,4 @@ Uno Platform - - - Izreži - - - Kopiraj - - - Nalepi - - - Poništi - - - Ponovi - - - Odaberi sve - 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 new file mode 100644 index 000000000000..e3f3a401f20c --- /dev/null +++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/en-US/Resources.resw @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 000000000000..e3f3a401f20c --- /dev/null +++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/en/Resources.resw @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 000000000000..bf00d74b974d --- /dev/null +++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/es-ES/Resources.resw @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 000000000000..bf00d74b974d --- /dev/null +++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/es-MX/Resources.resw @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 000000000000..e285d4cbd103 --- /dev/null +++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/fr-CA/Resources.resw @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 000000000000..e285d4cbd103 --- /dev/null +++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/fr/Resources.resw @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 000000000000..fbb84019f52d --- /dev/null +++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/Strings/sr/Resources.resw @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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.reference.cs b/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.reference.cs index 830abaa9eac8..ceb5ed5e6486 100644 --- a/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.reference.cs +++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.reference.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using Windows.UI.Xaml.Input; namespace Windows.UI.Xaml.Controls { @@ -13,5 +14,20 @@ private void UpdateTextBoxView() { } public int SelectionStart { get; set; } public int SelectionLength { get; set; } + + protected override void OnPointerMoved(PointerRoutedEventArgs e) + { + base.OnPointerMoved(e); + } + + protected override void OnDoubleTapped(DoubleTappedRoutedEventArgs e) + { + base.OnDoubleTapped(e); + } + + protected override void OnRightTapped(RightTappedRoutedEventArgs e) + { + base.OnRightTapped(e); + } } } 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 f34caf89eb6e..96b5f9aa0118 100644 --- a/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.skia.cs +++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.skia.cs @@ -9,6 +9,7 @@ using Windows.UI.Xaml.Shapes; using Uno.Extensions; using Uno.UI; +using Uno.UI.Helpers.WinUI; #if HAS_UNO_WINUI using Microsoft.UI.Input; @@ -645,13 +646,12 @@ protected override void OnRightTapped(RightTappedRoutedEventArgs e) _contextMenu = new MenuFlyout(); _contextMenu.Opened += (_, _) => UpdateDisplaySelection(); - // TODO: confirm localized names match WinUI - var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView(); - _flyoutItems.Add(ContextMenuItem.Cut, new MenuFlyoutItem { Text = resourceLoader.GetString("TextBoxCut"), Command = new TextBoxCommand(CutSelectionToClipboard), Icon = new SymbolIcon(Symbol.Cut) }); - _flyoutItems.Add(ContextMenuItem.Copy, new MenuFlyoutItem { Text = resourceLoader.GetString("TextBoxCopy"), Command = new TextBoxCommand(CopySelectionToClipboard), Icon = new SymbolIcon(Symbol.Copy) }); - _flyoutItems.Add(ContextMenuItem.Paste, new MenuFlyoutItem { Text = resourceLoader.GetString("TextBoxPaste"), Command = new TextBoxCommand(PasteFromClipboard), Icon = new SymbolIcon(Symbol.Paste) }); + // 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) }); // undo/redo - _flyoutItems.Add(ContextMenuItem.SelectAll, new MenuFlyoutItem { Text = resourceLoader.GetString("TextBoxSelectAll"), Command = new TextBoxCommand(SelectAll), Icon = new SymbolIcon(Symbol.SelectAll) }); + _flyoutItems.Add(ContextMenuItem.SelectAll, new MenuFlyoutItem { Text = ResourceAccessor.GetLocalizedStringResource("TextBoxSelectAll"), Command = new TextBoxCommand(SelectAll), Icon = new SymbolIcon(Symbol.SelectAll) }); } _contextMenu.Items.Clear(); diff --git a/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.wasm.cs b/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.wasm.cs index 6cc29230ad52..776eaba746fb 100644 --- a/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.wasm.cs +++ b/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBox.wasm.cs @@ -187,5 +187,20 @@ public int SelectionLength _textBoxView.SelectionEnd = _textBoxView.SelectionStart + value; } } + + protected override void OnPointerMoved(PointerRoutedEventArgs e) + { + base.OnPointerMoved(e); + } + + protected override void OnDoubleTapped(DoubleTappedRoutedEventArgs e) + { + base.OnDoubleTapped(e); + } + + protected override void OnRightTapped(RightTappedRoutedEventArgs e) + { + base.OnRightTapped(e); + } } }