-
Notifications
You must be signed in to change notification settings - Fork 475
Expand file tree
/
Copy pathBinaryFileViewer.axaml
More file actions
103 lines (94 loc) · 4.69 KB
/
Copy pathBinaryFileViewer.axaml
File metadata and controls
103 lines (94 loc) · 4.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:m="using:SourceGit.Models"
xmlns:vm="using:SourceGit.ViewModels"
xmlns:v="using:SourceGit.Views"
mc:Ignorable="d" d:DesignWidth="520" d:DesignHeight="230"
x:Class="SourceGit.Views.BinaryFileViewer"
x:Name="ThisControl"
x:DataType="vm:BinaryFileViewer"
Icon="/App.ico"
Title="{DynamicResource Text.File.HexViewer}"
Width="800" Height="600"
WindowStartupLocation="CenterOwner">
<Grid RowDefinitions="Auto,32,*">
<!-- TitleBar -->
<Grid Grid.Row="0" Height="28" IsVisible="{Binding !#ThisControl.UseSystemWindowFrame}">
<!-- Bottom border -->
<Border Background="{DynamicResource Brush.TitleBar}"
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border2}"
DoubleTapped="MaximizeOrRestoreWindow"
PointerPressed="BeginMoveWindow"/>
<Path Width="12" Height="12"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Data="{StaticResource Icons.Binary}"
IsVisible="{OnPlatform True, macOS=False}"/>
<TextBlock Classes="bold"
Text="{DynamicResource Text.File.HexViewer}"
HorizontalAlignment="Center" VerticalAlignment="Center"
IsHitTestVisible="False"/>
<!-- Caption Buttons (Windows/Linux) -->
<v:CaptionButtons HorizontalAlignment="Right" IsVisible="{OnPlatform True, macOS=False}"/>
</Grid>
<!-- File -->
<Border Grid.Row="1" Height="32" VerticalAlignment="Center">
<Grid Margin="8,0" ColumnDefinitions="Auto,*,Auto">
<Path Grid.Column="0"
Width="14" Height="14"
Data="{StaticResource Icons.File}"/>
<TextBlock Grid.Column="1"
Margin="4,0,0,0"
Text="{Binding File, Mode=OneWay}"
VerticalAlignment="Center"/>
<v:BinaryFileAddressTextBox Grid.Column="2"
Width="200" Height="26"
HorizontalAlignment="Left" VerticalAlignment="Center"
BorderThickness="1"
BorderBrush="{DynamicResource Brush.Border2}"
CornerRadius="13"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
Watermark="{DynamicResource Text.File.HexViewer.GotoAddress}"
TextChanged="OnGotoAddressTextChanged">
<TextBox.InnerLeftContent>
<Path Width="14" Height="14"
Margin="6,0,0,0"
Fill="{DynamicResource Brush.FG2}"
Data="{StaticResource Icons.Address}"/>
</TextBox.InnerLeftContent>
</v:BinaryFileAddressTextBox>
</Grid>
</Border>
<!-- Body -->
<Border Grid.Row="2" Margin="4,0,4,4" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
<ContentControl x:Name="ContentPanel" Margin="8,4,0,4" Content="{Binding Content, Mode=OneWay}">
<ContentControl.DataTemplates>
<DataTemplate DataType="m:BinaryFile">
<Grid ColumnDefinitions="*,Auto"
Background="Transparent"
PointerWheelChanged="OnContentPointerWheelChanged"
SizeChanged="OnContentSizeChanged">
<v:HexViewer Grid.Column="0"
Foreground="{DynamicResource Brush.FG1}"
HeaderForeground="{DynamicResource Brush.Accent}"
ClipToBounds="True"/>
<ScrollBar Grid.Column="1"
Margin="0,24,0,0"
Orientation="Vertical"
AllowAutoHide="False"
SmallChange="18"
ValueChanged="OnScrollBarValueChanged"/>
</Grid>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
</Border>
<!-- Loading Icon -->
<v:LoadingIcon Grid.Row="2"
Width="64" Height="64"
IsVisible="{Binding IsLoading, Mode=OneWay}"/>
</Grid>
</v:ChromelessWindow>