forked from sourcegit-scm/sourcegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInteractiveRebase.axaml
More file actions
219 lines (197 loc) · 11.6 KB
/
InteractiveRebase.axaml
File metadata and controls
219 lines (197 loc) · 11.6 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<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:c="using:SourceGit.Converters"
xmlns:v="using:SourceGit.Views"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.InteractiveRebase"
x:DataType="vm:InteractiveRebase"
x:Name="ThisControl"
Icon="/App.ico"
Title="{DynamicResource Text.InteractiveRebase}"
Width="1080" Height="720"
WindowStartupLocation="CenterOwner">
<Grid RowDefinitions="Auto,Auto,*,Auto,Auto">
<!-- TitleBar -->
<Grid Grid.Row="0" Height="28" IsVisible="{Binding !#ThisControl.UseSystemWindowFrame}">
<Border Background="{DynamicResource Brush.TitleBar}"
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
PointerPressed="BeginMoveWindow"/>
<Path Width="14" Height="14"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Data="{StaticResource Icons.InteractiveRebase}"
IsVisible="{OnPlatform True, macOS=False}"/>
<TextBlock Classes="bold"
Text="{DynamicResource Text.InteractiveRebase}"
HorizontalAlignment="Center" VerticalAlignment="Center"
IsHitTestVisible="False"/>
<v:CaptionButtons HorizontalAlignment="Right"
IsCloseButtonOnly="True"
IsVisible="{OnPlatform True, macOS=False}"/>
</Grid>
<!-- Operation Information -->
<Grid Grid.Row="1" ColumnDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,*" Margin="8">
<TextBlock Grid.Column="0" Text="{DynamicResource Text.InteractiveRebase.Target}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/>
<Path Grid.Column="1" Width="14" Height="14" Margin="8,0,0,0" Data="{StaticResource Icons.Branch}"/>
<TextBlock Grid.Column="2" VerticalAlignment="Center" Text="{Binding Current.FriendlyName}" Margin="8,0,0,0"/>
<TextBlock Grid.Column="3" Margin="48,0,0,0" Text="{DynamicResource Text.InteractiveRebase.On}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/>
<Path Grid.Column="4" Width="14" Height="14" Margin="8,0,0,0" Data="{StaticResource Icons.Commit}"/>
<TextBlock Grid.Column="5" Classes="primary" VerticalAlignment="Center" Text="{Binding On.SHA, Converter={x:Static c:StringConverters.ToShortSHA}}" Foreground="DarkOrange" Margin="8,0,0,0"/>
<TextBlock Grid.Column="6" VerticalAlignment="Center" Text="{Binding On.Subject}" Margin="4,0,0,0" TextTrimming="CharacterEllipsis"/>
</Grid>
<!-- Body -->
<Border Grid.Row="2" Margin="8,0,8,8" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
<Grid RowDefinitions="*,3,*">
<v:InteractiveRebaseListBox Grid.Row="0"
Focusable="True"
Background="{DynamicResource Brush.Contents}"
ItemsSource="{Binding Items}"
SelectionMode="Single"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
SelectionChanged="OnRowsSelectionChanged"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
Grid.IsSharedSizeScope="True">
<v:InteractiveRebaseListBox.Styles>
<Style Selector="ListBoxItem">
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Height" Value="28"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</v:InteractiveRebaseListBox.Styles>
<v:InteractiveRebaseListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</v:InteractiveRebaseListBox.ItemsPanel>
<v:InteractiveRebaseListBox.ItemTemplate>
<DataTemplate DataType="vm:InteractiveRebaseItem">
<Grid Height="26" Margin="8,0" ClipToBounds="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="16"/>
<ColumnDefinition Width="110"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="32"/>
<ColumnDefinition Width="108"/>
<ColumnDefinition Width="Auto" SharedSizeGroup="CommitHashColumn"/>
<ColumnDefinition Width="Auto" SharedSizeGroup="CommitTimeColumn"/>
</Grid.ColumnDefinitions>
<!-- Drag & Drop Anchor -->
<Border Grid.Column="0" Background="Transparent"
Loaded="OnSetupRowHeaderDragDrop"
PointerPressed="OnRowHeaderPointerPressed">
<ToolTip.Tip>
<TextBlock>
<Run Text="{DynamicResource Text.InteractiveRebase.ReorderTip}"/>
<Run Text=" "/>
<Run Text="{OnPlatform 'Ctrl+Up/Ctrl+Down', macOS='⌘+Up/⌘+Down'}" FontSize="11" Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"/>
</TextBlock>
</ToolTip.Tip>
<Path Width="14" Height="14"
Data="{StaticResource Icons.Move}"
Fill="{DynamicResource Brush.FG2}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<!-- Action -->
<Button Grid.Column="1" Opacity="1" Margin="4,0,0,0" Padding="8,2" Background="Transparent" Click="OnButtonActionClicked">
<StackPanel Orientation="Horizontal">
<Ellipse Width="14" Height="14" Fill="{Binding Action, Converter={x:Static c:InteractiveRebaseActionConverters.ToIconBrush}}"/>
<TextBlock Classes="primary" Margin="8,0" Text="{Binding Action, Converter={x:Static c:InteractiveRebaseActionConverters.ToName}}"/>
</StackPanel>
</Button>
<!-- Subject -->
<Grid Grid.Column="2" ColumnDefinitions="Auto,*" ClipToBounds="True">
<Button Grid.Column="0"
Classes="icon_button"
Margin="0,0,6,0" Padding="0"
IsVisible="{Binding Action, Converter={x:Static c:InteractiveRebaseActionConverters.CanEditMessage}}"
Click="OnOpenCommitMessageEditor">
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Edit}"/>
</Button>
<v:CommitSubjectPresenter Grid.Column="1"
Margin="0,0,4,0"
FontFamily="{DynamicResource Fonts.Primary}"
CodeFontFamily="{DynamicResource Fonts.Monospace}"
InlineCodeBackground="{DynamicResource Brush.InlineCode}"
Foreground="{DynamicResource Brush.FG1}"
LinkForeground="{DynamicResource Brush.Link}"
Subject="{Binding Subject}"
IssueTrackerRules="{Binding $parent[v:InteractiveRebase].((vm:InteractiveRebase)DataContext).IssueTrackerRules}"
SharedIssueTrackerRules="{Binding $parent[v:InteractiveRebase].((vm:InteractiveRebase)DataContext).SharedIssueTrackerRules}"
FontWeight="Normal"/>
</Grid>
<!-- Author Avatar -->
<v:Avatar Grid.Column="3"
Width="16" Height="16"
Margin="8,0,0,0"
VerticalAlignment="Center"
User="{Binding Commit.Author}"/>
<!-- Author Name -->
<Border Grid.Column="4" ClipToBounds="True">
<TextBlock Classes="primary" Margin="6,0,12,0" Text="{Binding Commit.Author.Name}"/>
</Border>
<!-- Commit SHA -->
<Border Grid.Column="5" ClipToBounds="True">
<TextBlock Classes="primary"
Text="{Binding Commit.SHA, Converter={x:Static c:StringConverters.ToShortSHA}}"/>
</Border>
<!-- Commit Time -->
<Border Grid.Column="6">
<TextBlock Classes="primary"
Margin="16,0,8,0"
Text="{Binding Commit.CommitterTimeStr}"/>
</Border>
</Grid>
</DataTemplate>
</v:InteractiveRebaseListBox.ItemTemplate>
</v:InteractiveRebaseListBox>
<v:LoadingIcon Grid.Row="0" Width="48" Height="48" HorizontalAlignment="Center" VerticalAlignment="Center" IsVisible="{Binding IsLoading}"/>
<GridSplitter Grid.Row="1"
MinHeight="1"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Background="Transparent"
BorderThickness="0,1,0,0"
BorderBrush="{DynamicResource Brush.Border2}"/>
<Grid Grid.Row="2">
<Path Width="128" Height="128"
Data="{StaticResource Icons.Detail}"
HorizontalAlignment="Center"
Fill="{DynamicResource Brush.FG2}"
IsVisible="{Binding SelectedItem, Converter={x:Static ObjectConverters.IsNull}}"/>
<ContentControl Content="{Binding DetailContext}" IsVisible="{Binding SelectedItem, Converter={x:Static ObjectConverters.IsNotNull}}">
<ContentControl.DataTemplates>
<DataTemplate DataType="vm:CommitDetail">
<v:CommitDetail/>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
</Grid>
</Grid>
</Border>
<!-- Options -->
<Grid Grid.Row="3" ColumnDefinitions="*,Auto,Auto" Margin="8,0,8,8">
<CheckBox Grid.Column="0"
Content="{DynamicResource Text.InteractiveRebase.AutoStash}"
VerticalAlignment="Center"
IsChecked="{Binding AutoStash, Mode=TwoWay}"/>
<Button Grid.Column="1" Classes="flat primary" MinWidth="80" Content="{DynamicResource Text.Start}" Click="OnStartJobs"/>
<Button Grid.Column="2" Classes="flat" Margin="8,0,0,0" MinWidth="80" Content="{DynamicResource Text.Cancel}" Click="CloseWindow"/>
</Grid>
<!-- Progress -->
<ProgressBar x:Name="Running"
Grid.Row="4"
Margin="8,0,8,12"
Background="{DynamicResource Brush.FG2}"
Foreground="{DynamicResource Brush.Accent}"
Minimum="0"
Maximum="100"
IsVisible="False"/>
</Grid>
</v:ChromelessWindow>