From a6d2180efa72fa549252abd6ac8d1b00fb57fd7c Mon Sep 17 00:00:00 2001
From: Snoozeds <88577069+Snoozeds@users.noreply.github.com>
Date: Tue, 16 Jul 2024 15:11:31 +0100
Subject: [PATCH] Add Find Replace menu
---
src/UnrealLocresEditor/FindDialog.axaml.cs | 2 -
.../FindReplaceDialog.axaml | 32 ++
.../FindReplaceDialog.axaml.cs | 388 ++++++++++++++++++
src/UnrealLocresEditor/Views/MainWindow.axaml | 3 +-
.../Views/MainWindow.axaml.cs | 50 ++-
5 files changed, 470 insertions(+), 5 deletions(-)
create mode 100644 src/UnrealLocresEditor/FindReplaceDialog.axaml
create mode 100644 src/UnrealLocresEditor/FindReplaceDialog.axaml.cs
diff --git a/src/UnrealLocresEditor/FindDialog.axaml.cs b/src/UnrealLocresEditor/FindDialog.axaml.cs
index 3a3b1f3..ef0533e 100644
--- a/src/UnrealLocresEditor/FindDialog.axaml.cs
+++ b/src/UnrealLocresEditor/FindDialog.axaml.cs
@@ -36,12 +36,10 @@ private void FindButton_Click(object sender, RoutedEventArgs e)
private async void ScrollToSelectedRow(DataGrid dataGrid, int selectedRowIndex)
{
-
var row = MainWindow._rows[selectedRowIndex];
var column = dataGrid.Columns[_currentMatchIndex];
var columnplus = dataGrid.Columns[_currentMatchIndex + 1];
-
// Fix bug where ScrollIntoView does not scroll the cell into view if the cell has a different height to other cells.
// This is fucking stupid and it is 1AM.
diff --git a/src/UnrealLocresEditor/FindReplaceDialog.axaml b/src/UnrealLocresEditor/FindReplaceDialog.axaml
new file mode 100644
index 0000000..1c436e2
--- /dev/null
+++ b/src/UnrealLocresEditor/FindReplaceDialog.axaml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/UnrealLocresEditor/FindReplaceDialog.axaml.cs b/src/UnrealLocresEditor/FindReplaceDialog.axaml.cs
new file mode 100644
index 0000000..48d8d5a
--- /dev/null
+++ b/src/UnrealLocresEditor/FindReplaceDialog.axaml.cs
@@ -0,0 +1,388 @@
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using Avalonia.Markup.Xaml;
+using Avalonia.Threading;
+using System;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace UnrealLocresEditor.Views
+{
+ public partial class FindReplaceDialog : Window
+ {
+ public FindReplaceDialog()
+ {
+ AvaloniaXamlLoader.Load(this);
+ this.Opened += OnWindowOpened;
+ }
+
+ private void OnWindowOpened(object? sender, EventArgs e)
+ {
+ InitializeComponent();
+
+ uiFindButton = this.FindControl