mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-26 21:17:20 -08:00
251 lines
12 KiB
XML
251 lines
12 KiB
XML
<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"
|
|
d:DesignHeight="450" d:DesignWidth="800">
|
|
<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">
|
|
<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"
|
|
Text="{DynamicResource Text.WorkingCopy.Unstaged}"
|
|
Foreground="{DynamicResource Brush.FG2}"
|
|
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}"/>
|
|
<controls:IconButton
|
|
Grid.Column="5"
|
|
Click="StageAll"
|
|
Width="14" Height="14"
|
|
Margin="4,0"
|
|
Icon="{StaticResource Icon.DoubleDown}"
|
|
ToolTip="{DynamicResource Text.WorkingCopy.Unstaged.StageAll}"/>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- Unstaged Changes -->
|
|
<Border Grid.Row="1" Background="{DynamicResource Brush.Contents}">
|
|
<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">
|
|
<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}"
|
|
Foreground="{DynamicResource Brush.FG2}"
|
|
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}"/>
|
|
<controls:IconButton
|
|
Grid.Column="3"
|
|
Click="UnstageAll"
|
|
Width="14" Height="14"
|
|
Margin="4,0"
|
|
Icon="{StaticResource Icon.DoubleUp}"
|
|
ToolTip="{DynamicResource Text.WorkingCopy.Staged.UnstageAll}"/>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- Staged Changes -->
|
|
<Border Grid.Row="3" Background="{DynamicResource Brush.Contents}">
|
|
<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}"/>
|
|
|
|
<!-- 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">
|
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
<Path
|
|
Width="64" Height="64"
|
|
Data="{StaticResource Icon.Conflict}"
|
|
Fill="{DynamicResource Brush.FG2}"/>
|
|
<TextBlock
|
|
Margin="0,16,0,28"
|
|
FontSize="20" FontWeight="DemiBold"
|
|
Text="{DynamicResource Text.WorkingCopy.Conflicts}"
|
|
Foreground="{DynamicResource Brush.FG2}"
|
|
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"/>
|
|
</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"
|
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
|
Placeholder="{DynamicResource Text.WorkingCopy.CommitMessageTip}"
|
|
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}"
|
|
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}"
|
|
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}"/>
|
|
|
|
<Button
|
|
Grid.Column="5"
|
|
x:Name="btnCommitAndPush"
|
|
Height="26"
|
|
Padding="8,0"
|
|
Click="CommitAndPush"
|
|
FontWeight="Bold"
|
|
Content="{DynamicResource Text.WorkingCopy.CommitAndPush}"
|
|
Margin="8,0,0,0"/>
|
|
</Grid>
|
|
</Grid>
|
|
</Grid>
|
|
</UserControl>
|