Skip to content

Commit

Permalink
Add Find Replace menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Snoozeds committed Jul 16, 2024
1 parent 17a2134 commit a6d2180
Show file tree
Hide file tree
Showing 5 changed files with 470 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/UnrealLocresEditor/FindDialog.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
32 changes: 32 additions & 0 deletions src/UnrealLocresEditor/FindReplaceDialog.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="UnrealLocresEditor.Views.FindReplaceDialog"
Title="Find and replace"
Width="350"
Height="225">

<Grid RowDefinitions="Auto,Auto,*,Auto,Auto,Auto,Auto" ColumnDefinitions="*,Auto" Margin="10">
<TextBox x:Name="uiSearchTextBox" Watermark="Find" Grid.Row="0" Grid.Column="0" Margin="0,0,5,0" />
<TextBox x:Name="uiReplaceTextBox" Watermark="Replace" Grid.Row="1" Grid.Column="0" Margin="0,10,5,0" />
<Button Name="uiFindButton" Content="Find" Grid.Row="0" Grid.Column="1" />
<TextBlock x:Name="uiMatchCountTextBlock" Grid.Row="2" Grid.ColumnSpan="2"
HorizontalAlignment="Center" VerticalAlignment="Center" Text="" />
<StackPanel Orientation="Horizontal" Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Center" Spacing="10" Margin="0,0,0,10">
<CheckBox x:Name="uiLocresModeCheckBox" Content="Locres mode" IsChecked="True" />
<Button Content="(?)" VerticalAlignment="Center" Margin="-10,0,0,0" Background="Transparent" BorderBrush="Transparent">
<ToolTip.Tip>
<ToolTip Content="Searches the 2nd column, then copies to the 3rd column and replaces the copied text." />
</ToolTip.Tip>
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="4" Grid.ColumnSpan="2" HorizontalAlignment="Center" Spacing="10" Margin="0,0,0,10">
<Button x:Name="uiReplaceButton" Content="Replace" Width="100" />
<Button x:Name="uiReplaceAllButton" Content="Replace All" Width="100" />
</StackPanel>
<UniformGrid Grid.Row="6" Grid.ColumnSpan="2" Rows="1" Columns="3" Height="40">
<CheckBox x:Name="uiMatchCaseCheckBox" Content="Match case" />
<CheckBox x:Name="uiMatchWholeWordCheckBox" Content="Match whole word" />
<CheckBox x:Name="uiMatchCellCheckBox" Content="Match entire cell" />
</UniformGrid>
</Grid>
</Window>
Loading

0 comments on commit a6d2180

Please sign in to comment.