sourcegit/src/Views/Widgets/WorkingCopy.xaml

254 lines
12 KiB
Text
Raw Normal View History

2021-04-29 05:05:55 -07:00
<UserControl x:Class="SourceGit.Views.Widgets.WorkingCopy"
x:Name="me"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:converter="clr-namespace:SourceGit.Views.Converters"
xmlns:models="clr-namespace:SourceGit.Models"
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
xmlns:validations="clr-namespace:SourceGit.Views.Validations"
mc:Ignorable="d"
2021-08-10 19:49:52 -07:00
d:DesignHeight="450" d:DesignWidth="800">
2021-04-29 05:05:55 -07:00
<UserControl.Resources>
<converter:BoolToCollapsed x:Key="BoolToCollapsed"/>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300" MinWidth="300"/>
<ColumnDefinition Width="1"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Left -->
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="26"/>
<RowDefinition Height="*"/>
<RowDefinition Height="26"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Unstaged Toolbar -->
<Border Grid.Row="0" BorderBrush="{DynamicResource Brush.Border0}" BorderThickness="0,0,0,1">
2021-04-29 05:05:55 -07:00
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:ChangeDisplaySwitcher
Grid.Column="0"
x:Name="unstagedMode"
Width="14" Height="14"
Margin="4,0,0,0"
Mode="{Binding Source={x:Static models:Preference.Instance}, Path=Window.ChangeInUnstaged, Mode=TwoWay}"/>
<TextBlock
Grid.Column="1"
Margin="6,0"
2021-08-05 01:01:37 -07:00
Text="{DynamicResource Text.WorkingCopy.Unstaged}"
Foreground="{DynamicResource Brush.FG2}"
2021-04-29 05:05:55 -07:00
FontWeight="Bold"/>
<controls:Loading
Grid.Column="2"
Width="12" Height="12"
x:Name="iconStaging"
IsAnimating="{Binding ElementName=unstagedContainer, Path=IsStaging}"
Visibility="{Binding ElementName=unstagedContainer, Path=IsStaging, Converter={StaticResource BoolToCollapsed}}"/>
<controls:IconButton
Grid.Column="4"
Click="StageSelected"
Width="14" Height="14"
Margin="4,0"
Icon="{StaticResource Icon.Down}"
ToolTip="{DynamicResource Text.WorkingCopy.Unstaged.Stage}"/>
2021-04-29 05:05:55 -07:00
<controls:IconButton
Grid.Column="5"
Click="StageAll"
Width="14" Height="14"
Margin="4,0"
Icon="{StaticResource Icon.DoubleDown}"
ToolTip="{DynamicResource Text.WorkingCopy.Unstaged.StageAll}"/>
2021-04-29 05:05:55 -07:00
</Grid>
</Border>
<!-- Unstaged Changes -->
<Border Grid.Row="1" Background="{DynamicResource Brush.Contents}">
2021-04-29 05:05:55 -07:00
<widgets:WorkingCopyChanges
x:Name="unstagedContainer"
IsUnstaged="True"
Mode="{Binding ElementName=unstagedMode, Path=Mode}"
DiffTargetChanged="OnDiffTargetChanged"/>
</Border>
<!-- Staged Toolbar -->
<Border Grid.Row="2" BorderBrush="{DynamicResource Brush.Border0}" BorderThickness="0,1">
2021-04-29 05:05:55 -07:00
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:ChangeDisplaySwitcher
Grid.Column="0"
x:Name="stagedMode"
Width="14" Height="14"
Margin="4,0,0,0"
Mode="{Binding Source={x:Static models:Preference.Instance}, Path=Window.ChangeInStaged, Mode=TwoWay}"/>
<TextBlock
Grid.Column="1"
Margin="6,0"
Text="{DynamicResource Text.WorkingCopy.Staged}"
2021-08-05 01:01:37 -07:00
Foreground="{DynamicResource Brush.FG2}"
2021-04-29 05:05:55 -07:00
FontWeight="Bold"/>
<controls:IconButton
Grid.Column="2"
Click="UnstageSelected"
Width="14" Height="14"
Margin="4,0"
Icon="{StaticResource Icon.Up}"
ToolTip="{DynamicResource Text.WorkingCopy.Staged.Unstage}"/>
2021-04-29 05:05:55 -07:00
<controls:IconButton
Grid.Column="3"
Click="UnstageAll"
Width="14" Height="14"
Margin="4,0"
Icon="{StaticResource Icon.DoubleUp}"
ToolTip="{DynamicResource Text.WorkingCopy.Staged.UnstageAll}"/>
2021-04-29 05:05:55 -07:00
</Grid>
</Border>
<!-- Staged Changes -->
<Border Grid.Row="3" Background="{DynamicResource Brush.Contents}">
2021-04-29 05:05:55 -07:00
<widgets:WorkingCopyChanges
x:Name="stagedContainer"
IsUnstaged="False"
Mode="{Binding ElementName=stagedMode, Path=Mode}"
DiffTargetChanged="OnDiffTargetChanged"/>
</Border>
</Grid>
<GridSplitter Grid.Column="1" Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="{DynamicResource Brush.Border0}"/>
2021-04-29 05:05:55 -07:00
<!-- Right -->
<Grid Grid.Column="2" Margin="4">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Diff viewer -->
<widgets:DiffViewer Grid.Row="0" x:Name="diffViewer"/>
<!-- Merge Option Panel -->
<Grid Grid.Row="0" x:Name="mergePanel" Background="{DynamicResource Brush.Window}" Visibility="Collapsed">
2021-04-29 05:05:55 -07:00
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<Path
Width="64" Height="64"
Data="{StaticResource Icon.Conflict}"
Fill="{DynamicResource Brush.FG2}"/>
2021-04-29 05:05:55 -07:00
<TextBlock
Margin="0,16,0,28"
FontSize="20" FontWeight="DemiBold"
Text="{DynamicResource Text.WorkingCopy.Conflicts}"
Foreground="{DynamicResource Brush.FG2}"
2021-04-29 05:05:55 -07:00
HorizontalAlignment="Center"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Click="UseTheirs" Content="{DynamicResource Text.WorkingCopy.UseTheirs}" Height="24" Padding="8,0"/>
<Button Click="UseMine" Content="{DynamicResource Text.WorkingCopy.UseMine}" Height="24" Margin="8,0" Padding="8,0"/>
<Button Click="UseMergeTool" Content="{DynamicResource Text.WorkingCopy.OpenMerger}" Height="24" Padding="8,0"/>
2021-04-29 05:05:55 -07:00
</StackPanel>
</StackPanel>
</Grid>
<!-- Commit Message -->
<controls:TextEdit
Grid.Row="1"
x:Name="txtCommitMessage"
Height="64"
Margin="0,4" Padding="1"
AcceptsReturn="True"
AcceptsTab="True"
TextWrapping="Wrap"
KeyDown="CommitMessageKeyDown"
2021-04-29 05:05:55 -07:00
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
Placeholder="{DynamicResource Text.WorkingCopy.CommitMessageTip}"
2021-04-29 05:05:55 -07:00
PlaceholderBaseline="Top">
<TextBox.Text>
<Binding ElementName="me" Path="CommitMessage" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<validations:CommitMessage/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</controls:TextEdit>
<!-- Commit Options -->
<Grid Grid.Row="2" Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:IconButton
Grid.Column="0"
Width="14" Height="14"
Click="OpenCommitMessageRecorder"
ToolTip="{DynamicResource Text.WorkingCopy.MessageHistories}"
2021-04-29 05:05:55 -07:00
Icon="{StaticResource Icon.List}"
Opacity=".5"/>
<CheckBox
Grid.Column="1"
x:Name="chkAmend"
Margin="8,0,0,0"
HorizontalAlignment="Left"
Content="{DynamicResource Text.WorkingCopy.Amend}"
2021-04-29 05:05:55 -07:00
Checked="StartAmend" Unchecked="EndAmend"/>
<controls:Loading
Grid.Column="3"
x:Name="iconCommitting"
Width="18" Height="18"
Margin="0,0,8,0"
Visibility="Collapsed"/>
<Button
Grid.Column="4"
Height="26"
Padding="8,0"
Click="Commit"
FontWeight="Bold"
Background="{DynamicResource Brush.Accent1}"
BorderBrush="{DynamicResource Brush.FG1}"
Content="{DynamicResource Text.WorkingCopy.Commit}"
ToolTip="{DynamicResource Text.WorkingCopy.CommitTip}"/>
2021-04-29 05:05:55 -07:00
<Button
Grid.Column="5"
x:Name="btnCommitAndPush"
Height="26"
Padding="8,0"
Click="CommitAndPush"
FontWeight="Bold"
Content="{DynamicResource Text.WorkingCopy.CommitAndPush}"
2021-04-29 05:05:55 -07:00
Margin="8,0,0,0"/>
</Grid>
</Grid>
</Grid>
</UserControl>