style: Blame & FileHistories window style

This commit is contained in:
leo 2024-03-15 10:41:36 +08:00
parent abc3e8e9f7
commit f93dec5e6a
3 changed files with 19 additions and 15 deletions

View file

@ -26,7 +26,7 @@ namespace SourceGit.ViewModels {
public Blame(string repo, string file, string revision) { public Blame(string repo, string file, string revision) {
_repo = repo; _repo = repo;
Title = $"{file}@{revision.Substring(0, 10)}"; Title = $"{file} @ {revision.Substring(0, 10)}";
Task.Run(() => { Task.Run(() => {
var result = new Commands.Blame(repo, file, revision).Result(); var result = new Commands.Blame(repo, file, revision).Result();
Dispatcher.UIThread.Invoke(() => { Dispatcher.UIThread.Invoke(() => {

View file

@ -21,19 +21,20 @@
<Grid Margin="{Binding #me.WindowState, Converter={x:Static c:WindowStateConverters.ToContentMargin}}"> <Grid Margin="{Binding #me.WindowState, Converter={x:Static c:WindowStateConverters.ToContentMargin}}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="30"/> <RowDefinition Height="30"/>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- Custom window shadow for Linux --> <!-- Custom window shadow for Linux -->
<Border Grid.Row="0" Grid.RowSpan="2" <Border Grid.Row="0" Grid.RowSpan="3"
Background="{DynamicResource Brush.Window}" Background="{DynamicResource Brush.Window}"
Effect="drop-shadow(0 0 6 #A0000000)" Effect="drop-shadow(0 0 6 #A0000000)"
IsVisible="{OnPlatform False, Linux=True}"/> IsVisible="{OnPlatform False, Linux=True}"/>
<!-- TitleBar --> <!-- TitleBar -->
<Grid Grid.Row="0" ColumnDefinitions="Auto,Auto,Auto,*,Auto"> <Grid Grid.Row="0" ColumnDefinitions="Auto,Auto,*,Auto">
<!-- Bottom border --> <!-- Bottom border -->
<Border Grid.Column="0" Grid.ColumnSpan="5" <Border Grid.Column="0" Grid.ColumnSpan="4"
Background="{DynamicResource Brush.TitleBar}" Background="{DynamicResource Brush.TitleBar}"
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border2}"
DoubleTapped="MaximizeOrRestoreWindow" DoubleTapped="MaximizeOrRestoreWindow"
@ -50,22 +51,25 @@
<!-- Title --> <!-- Title -->
<TextBlock Grid.Column="2" Margin="8,0,0,0" Text="{DynamicResource Text.Blame}" FontWeight="Bold" IsHitTestVisible="False" VerticalAlignment="Center"/> <TextBlock Grid.Column="2" Margin="8,0,0,0" Text="{DynamicResource Text.Blame}" FontWeight="Bold" IsHitTestVisible="False" VerticalAlignment="Center"/>
<!-- Blame information -->
<TextBlock Grid.Column="3" Margin="8,0,0,0" Text="{Binding Title}" FontSize="11" FontStyle="Italic" IsHitTestVisible="False" VerticalAlignment="Center"/>
<!-- Caption Buttons (Windows/Linux) --> <!-- Caption Buttons (Windows/Linux) -->
<Border Grid.Column="4" IsVisible="{OnPlatform True, macOS=False}"> <Border Grid.Column="3" IsVisible="{OnPlatform True, macOS=False}">
<v:CaptionButtons/> <v:CaptionButtons/>
</Border> </Border>
</Grid> </Grid>
<!-- File -->
<Border Grid.Row="1" Padding="8,0" Background="{DynamicResource Brush.Window}">
<TextBlock Text="{Binding Title}" FontSize="12" VerticalAlignment="Center"/>
</Border>
<!-- Body --> <!-- Body -->
<Grid Grid.Row="1" Background="{DynamicResource Brush.Window}"> <Grid Grid.Row="2" Background="{DynamicResource Brush.Window}">
<!-- Blame View --> <!-- Blame View -->
<v:BlameTextEditor HorizontalScrollBarVisibility="Auto" <v:BlameTextEditor HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
Margin="4,0,4,4"
BorderBrush="{DynamicResource Brush.Border2}" BorderBrush="{DynamicResource Brush.Border2}"
BorderThickness="0" BorderThickness="1"
Background="{DynamicResource Brush.Contents}" Background="{DynamicResource Brush.Contents}"
Foreground="{DynamicResource Brush.FG1}" Foreground="{DynamicResource Brush.FG1}"
FontFamily="fonts:SourceGit#JetBrains Mono" FontFamily="fonts:SourceGit#JetBrains Mono"
@ -88,7 +92,7 @@
</Grid> </Grid>
<!-- Custom window sizer for Linux --> <!-- Custom window sizer for Linux -->
<Grid Grid.Row="0" Grid.RowSpan="2" IsVisible="{OnPlatform False, Linux=True}"> <Grid Grid.Row="0" Grid.RowSpan="3" IsVisible="{OnPlatform False, Linux=True}">
<Border Width="4" Height="4" <Border Width="4" Height="4"
Background="Transparent" Background="Transparent"
HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalAlignment="Left" VerticalAlignment="Top"

View file

@ -67,7 +67,7 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<DataGrid Grid.Column="0" <DataGrid Grid.Column="0"
Background="{DynamicResource Brush.Contents}" Background="Transparent"
ItemsSource="{Binding Commits}" ItemsSource="{Binding Commits}"
SelectedItem="{Binding SelectedCommit, Mode=TwoWay}" SelectedItem="{Binding SelectedCommit, Mode=TwoWay}"
SelectionMode="Single" SelectionMode="Single"
@ -105,10 +105,10 @@
<GridSplitter Grid.Column="1" <GridSplitter Grid.Column="1"
Width="1" MinWidth=".5" Width="1" MinWidth=".5"
HorizontalAlignment="Center" VerticalAlignment="Stretch" HorizontalAlignment="Center" VerticalAlignment="Stretch"
Background="Transparent"/> Background="{DynamicResource Brush.Border0}"/>
<Grid Grid.Column="2"> <Grid Grid.Column="2">
<ContentControl Content="{Binding DiffContext}"> <ContentControl Margin="4" Content="{Binding DiffContext}">
<ContentControl.DataTemplates> <ContentControl.DataTemplates>
<DataTemplate DataType="vm:DiffContext"> <DataTemplate DataType="vm:DiffContext">
<v:DiffView/> <v:DiffView/>