mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[TUI] Implement hex view window for displaying image sectors
This commit is contained in:
79
Aaru.Tui/Views/Windows/HexViewWindow.axaml
Normal file
79
Aaru.Tui/Views/Windows/HexViewWindow.axaml
Normal file
@@ -0,0 +1,79 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:console="https://github.com/jinek/consolonia"
|
||||
xmlns:windows="clr-namespace:Aaru.Tui.ViewModels.Windows"
|
||||
x:Class="Aaru.Tui.Views.Windows.HexViewWindow"
|
||||
RequestedThemeVariant="Dark">
|
||||
<Design.DataContext>
|
||||
<windows:HexViewWindowViewModel />
|
||||
</Design.DataContext>
|
||||
<DockPanel>
|
||||
<Menu DockPanel.Dock="Bottom">
|
||||
<MenuItem Header="ESC Back"
|
||||
HotKey="Escape"
|
||||
Command="{Binding BackCommand, Mode=OneWay}" />
|
||||
<MenuItem Header="F10 Exit"
|
||||
HotKey="F10"
|
||||
Command="{Binding ExitCommand, Mode=OneWay}" />
|
||||
</Menu>
|
||||
<Border BorderThickness="1">
|
||||
<Border.BorderBrush>
|
||||
<console:LineBrush LineStyle="DoubleLine"
|
||||
Brush="Blue" />
|
||||
</Border.BorderBrush>
|
||||
<Grid RowDefinitions="Auto,Auto,*">
|
||||
<TextBlock Grid.Row="0"
|
||||
Foreground="Green"
|
||||
Text="{Binding FilePath, Mode=OneWay}" />
|
||||
<!-- Header -->
|
||||
<Grid Grid.Row="1"
|
||||
ColumnDefinitions="Auto,*,Auto">
|
||||
<TextBlock Grid.Column="0"
|
||||
Text="Offset"
|
||||
HorizontalAlignment="Left"
|
||||
Foreground="Cyan"
|
||||
FontWeight="Bold" />
|
||||
<TextBlock Grid.Column="1"
|
||||
HorizontalAlignment="Center"
|
||||
Text="00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F"
|
||||
Foreground="Cyan"
|
||||
FontWeight="Bold" />
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="ASCII "
|
||||
HorizontalAlignment="Left"
|
||||
Foreground="Cyan"
|
||||
FontWeight="Bold" />
|
||||
</Grid>
|
||||
|
||||
<!-- Hex View Content -->
|
||||
<ScrollViewer Grid.Row="2"
|
||||
Background="Transparent"
|
||||
x:Name="HexScrollViewer">
|
||||
<ItemsControl ItemsSource="{Binding Lines, Mode=OneWay}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="windows:HexViewLine">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto">
|
||||
<!-- Offset Column -->
|
||||
<TextBlock Grid.Column="0"
|
||||
Text="{Binding OffsetString, Mode=OneWay}"
|
||||
Foreground="Yellow" />
|
||||
|
||||
<!-- Hex Column -->
|
||||
<TextBlock Grid.Column="1"
|
||||
HorizontalAlignment="Center"
|
||||
Text="{Binding HexString, Mode=OneWay}"
|
||||
Foreground="White" />
|
||||
|
||||
<!-- ASCII Column -->
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding AsciiString, Mode=OneWay}"
|
||||
Foreground="LightGreen" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
22
Aaru.Tui/Views/Windows/HexViewWindow.axaml.cs
Normal file
22
Aaru.Tui/Views/Windows/HexViewWindow.axaml.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Aaru.Tui.ViewModels.Windows;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace Aaru.Tui.Views.Windows;
|
||||
|
||||
public partial class HexViewWindow : Window
|
||||
{
|
||||
public HexViewWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnLoaded(RoutedEventArgs e)
|
||||
{
|
||||
base.OnLoaded(e);
|
||||
|
||||
(DataContext as HexViewWindowViewModel)?.LoadComplete();
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,10 @@
|
||||
</Design.DataContext>
|
||||
<DockPanel>
|
||||
<Menu DockPanel.Dock="Bottom">
|
||||
<MenuItem Header="ESC " />
|
||||
<MenuItem Header="ESC " /> <MenuItem Header="F1 Help" />
|
||||
<MenuItem Header="F2 ScVw"
|
||||
Command="{Binding SectorViewCommand, Mode=OneWay}"
|
||||
HotKey="F2" />
|
||||
<MenuItem Header="F10 Exit"
|
||||
Command="{Binding ExitCommand, Mode=OneWay}"
|
||||
HotKey="F10" />
|
||||
|
||||
Reference in New Issue
Block a user