-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMergeWorkbenchWindow.xaml
More file actions
390 lines (374 loc) · 26.7 KB
/
Copy pathMergeWorkbenchWindow.xaml
File metadata and controls
390 lines (374 loc) · 26.7 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
<Window x:Class="CodexChannelLauncher.MergeWorkbenchWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:shell="clr-namespace:System.Windows.Shell;assembly=PresentationFramework"
Title="Codex 多开器 · 差异合并工作台"
Width="1320"
Height="840"
MinWidth="1120"
MinHeight="720"
WindowStartupLocation="CenterOwner"
WindowStyle="None"
ResizeMode="CanResize"
Background="Transparent"
UseLayoutRounding="True"
SnapsToDevicePixels="True"
SourceInitialized="Window_SourceInitialized"
Closing="Window_Closing">
<shell:WindowChrome.WindowChrome>
<shell:WindowChrome CaptionHeight="58"
ResizeBorderThickness="6"
GlassFrameThickness="0"
CornerRadius="18"
UseAeroCaptionButtons="False" />
</shell:WindowChrome.WindowChrome>
<Window.Resources>
<Style x:Key="PanelCard" TargetType="Border">
<Setter Property="Background" Value="{StaticResource Surface1Brush}" />
<Setter Property="BorderBrush" Value="{StaticResource StrokeBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="14" />
<Setter Property="Padding" Value="14" />
</Style>
<Style x:Key="DiffTextBox" TargetType="TextBox" BasedOn="{StaticResource InputTextBox}">
<Setter Property="Height" Value="Auto" />
<Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
<Setter Property="CaretBrush" Value="{StaticResource AccentBrightBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource InputBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="9" />
<Setter Property="FontFamily" Value="Cascadia Mono, Consolas" />
<Setter Property="FontSize" Value="11" />
<Setter Property="AcceptsReturn" Value="True" />
<Setter Property="AcceptsTab" Value="True" />
<Setter Property="TextWrapping" Value="NoWrap" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
</Style>
<Style x:Key="ResultDiffTextBox" TargetType="TextBox" BasedOn="{StaticResource DiffTextBox}">
<Setter Property="Background" Value="{StaticResource OrangeSoftBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource AccentBrush}" />
</Style>
<Style x:Key="SmallActionButton" TargetType="Button" BasedOn="{StaticResource SecondaryButton}">
<Setter Property="Height" Value="30" />
<Setter Property="Padding" Value="10,0" />
<Setter Property="FontSize" Value="11" />
</Style>
<Style x:Key="FileListStyle" TargetType="ListBox">
<Setter Property="Background" Value="{StaticResource Surface1Brush}" />
<Setter Property="BorderBrush" Value="{StaticResource StrokeBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="4" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
</Style>
<Style TargetType="ListBoxItem">
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
<Setter Property="Padding" Value="10,8" />
<Setter Property="Margin" Value="2" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="ItemBorder" CornerRadius="9" Padding="{TemplateBinding Padding}"
Background="Transparent" BorderBrush="Transparent" BorderThickness="1">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="{StaticResource Surface2Brush}" />
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter TargetName="ItemBorder" Property="BorderBrush" Value="{StaticResource AccentBrush}" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="{StaticResource OrangeSoftBrush}" />
<Setter TargetName="ItemBorder" Property="BorderBrush" Value="{StaticResource AccentBrush}" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True" />
<Condition Property="IsKeyboardFocusWithin" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="ItemBorder" Property="BorderBrush" Value="{StaticResource AccentBrightBrush}" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Border CornerRadius="18" BorderBrush="{StaticResource StrokeBrush}" BorderThickness="1"
Background="{StaticResource WindowBackgroundBrush}">
<Grid x:Name="RootContent" ClipToBounds="True" Background="{StaticResource WindowBackgroundBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="58" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="66" />
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="{StaticResource StrokeBrush}" BorderThickness="0,0,0,1">
<Grid Margin="20,0,13,0" Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Width="30" Height="30" CornerRadius="10" VerticalAlignment="Center"
Background="{StaticResource AccentBrush}">
<TextBlock Text="⇄" Foreground="{StaticResource WindowBackgroundBrush}" FontSize="15"
FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<StackPanel Grid.Column="1" Margin="12,0,0,0" VerticalAlignment="Center">
<TextBlock Text="差异合并工作台" FontFamily="{StaticResource DisplayFont}"
FontSize="15" FontWeight="SemiBold" />
<TextBlock x:Name="ScopeText" Text="个人 / 工作空间 · 逐块 Diff 与三方 Merge"
FontSize="10.5" Foreground="{StaticResource TextSecondaryBrush}" Margin="0,2,0,0" />
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center"
shell:WindowChrome.IsHitTestVisibleInChrome="True">
<Button Style="{StaticResource WindowButton}" Content="—" Click="MinimizeButton_Click" />
<Button Style="{StaticResource WindowButton}" Content="×" Margin="5,0,0,0"
Click="CloseButton_Click" />
</StackPanel>
</Grid>
</Border>
<Border Grid.Row="1" Margin="20,14,20,12" Padding="14,10" CornerRadius="13"
Background="{StaticResource Surface1Brush}" BorderBrush="{StaticResource StrokeBrush}"
BorderThickness="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Ellipse x:Name="RuntimeDot" Width="8" Height="8" Fill="#F3C777"
VerticalAlignment="Center" />
<StackPanel Grid.Column="1" Margin="11,0,0,0">
<TextBlock x:Name="RuntimeText" Text="正在读取运行状态" FontSize="12" FontWeight="SemiBold" />
<TextBlock Text="查看差异不受影响;写回前必须完全退出个人与工作空间 App。"
Foreground="{StaticResource TextSecondaryBrush}" FontSize="10" Margin="0,3,0,0" />
</StackPanel>
<Button Grid.Column="2" Style="{StaticResource SecondaryButton}" Height="34"
Content="刷新差异" Click="RefreshButton_Click" />
</Grid>
</Border>
<Grid Grid.Row="2" Margin="20,0,20,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300" />
<ColumnDefinition Width="14" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Style="{StaticResource PanelCard}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="10" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel>
<TextBlock Text="差异文件" FontSize="16" FontWeight="SemiBold" />
<TextBlock x:Name="FileCountText" Text="正在读取" Foreground="{StaticResource TextSecondaryBrush}"
FontSize="10.5" Margin="0,4,0,0" />
</StackPanel>
<ListBox x:Name="FileList" Grid.Row="2" Style="{StaticResource FileListStyle}"
SelectionChanged="FileList_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding RelativePath}" FontFamily="Cascadia Mono, Consolas"
FontSize="10.5" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" />
<TextBlock Text="{Binding StatusText}" Foreground="{StaticResource AccentBrightBrush}"
FontSize="10" Margin="0,4,0,0" />
<TextBlock Text="{Binding DetailText}" Foreground="{StaticResource TextSecondaryBrush}"
FontSize="9.5" Margin="0,2,0,0" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Border>
<Border Grid.Column="2" Style="{StaticResource PanelCard}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock x:Name="SelectedPathText" Text="请选择差异文件"
FontFamily="Cascadia Mono, Consolas" FontSize="13"
FontWeight="SemiBold" TextTrimming="CharacterEllipsis" />
<TextBlock x:Name="DocumentMetaText" Text="—" Foreground="{StaticResource TextSecondaryBrush}"
FontSize="10" Margin="0,4,0,0" />
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Button x:Name="AdoptPersonalFileButton" Style="{StaticResource SmallActionButton}"
Content="整文件采用个人" IsEnabled="False"
Click="AdoptPersonalFileButton_Click" />
<Button x:Name="AdoptCompanyFileButton" Style="{StaticResource SmallActionButton}"
Content="整文件采用工作空间" Margin="7,0,0,0" IsEnabled="False"
Click="AdoptCompanyFileButton_Click" />
<Button x:Name="KeepResultButton" Style="{StaticResource SmallActionButton}"
Content="保留结果文件" Margin="7,0,0,0" IsEnabled="False"
Click="KeepResultButton_Click" />
<Button x:Name="DeleteResultButton" Style="{StaticResource SmallActionButton}"
Content="结果删除文件" Margin="7,0,0,0" IsEnabled="False"
Click="DeleteResultButton_Click" />
</StackPanel>
</Grid>
<Border x:Name="WarningBox" Grid.Row="1" Margin="0,12,0,12" Padding="11,8"
CornerRadius="10" Background="#2A241C" BorderBrush="#5D4A2A"
BorderThickness="1" Visibility="Collapsed">
<TextBlock x:Name="WarningText" Foreground="#F3C777" FontSize="10.5"
TextWrapping="Wrap" />
</Border>
<Grid Grid.Row="2">
<TextBlock x:Name="EmptySelectionText" Text="从左侧选择文件后,可逐块采用个人或工作空间内容。"
Foreground="{StaticResource TextSecondaryBrush}" HorizontalAlignment="Center"
VerticalAlignment="Center" />
<Grid x:Name="TextMergePanel" Visibility="Collapsed">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="8" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock x:Name="MergeSummaryText" Text="—" Foreground="{StaticResource TextPrimaryBrush}"
FontSize="11" VerticalAlignment="Center" />
<StackPanel Grid.Column="1" Orientation="Horizontal">
<TextBlock Text="文件存在状态:" Foreground="{StaticResource TextSecondaryBrush}" FontSize="10.5"
VerticalAlignment="Center" />
<TextBlock x:Name="ExistenceStateText" Text="—" FontSize="10.5"
FontWeight="SemiBold" VerticalAlignment="Center" />
</StackPanel>
</Grid>
<ListBox x:Name="MergeBlockList" Grid.Row="2" Background="Transparent"
BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate>
<Border Margin="0,0,0,10" Padding="12" CornerRadius="12"
Background="{StaticResource Surface2Brush}" BorderBrush="{StaticResource StrokeBrush}" BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="8" />
<RowDefinition Height="Auto" />
<RowDefinition Height="8" />
<RowDefinition Height="Auto" />
<RowDefinition Height="8" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding HeaderText}" FontWeight="SemiBold"
FontSize="11" />
<TextBlock Grid.Column="1" Text="{Binding ResolutionText}"
Foreground="{StaticResource AccentBrightBrush}" FontSize="10.5" />
</Grid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="8" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="8" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Text="个人" Foreground="#74DDB8" FontSize="10"
Margin="2,0,0,4" />
<TextBox Style="{StaticResource DiffTextBox}" Text="{Binding PersonalText, Mode=OneWay}"
IsReadOnly="True" MaxHeight="130" />
</StackPanel>
<StackPanel Grid.Column="2">
<TextBlock Text="共同基线" Foreground="{StaticResource TextSecondaryBrush}" FontSize="10"
Margin="2,0,0,4" />
<TextBox Style="{StaticResource DiffTextBox}" Text="{Binding BaseText, Mode=OneWay}"
IsReadOnly="True" MaxHeight="130" />
</StackPanel>
<StackPanel Grid.Column="4">
<TextBlock Text="工作空间" Foreground="{StaticResource AccentBrightBrush}" FontSize="10"
Margin="2,0,0,4" />
<TextBox Style="{StaticResource DiffTextBox}" Text="{Binding CompanyText, Mode=OneWay}"
IsReadOnly="True" MaxHeight="130" />
</StackPanel>
</Grid>
<StackPanel Grid.Row="4" Orientation="Horizontal">
<Button Style="{StaticResource SmallActionButton}" Content="采用个人块"
Click="AdoptPersonalBlockButton_Click" />
<Button Style="{StaticResource SmallActionButton}" Content="采用工作空间块"
Margin="7,0,0,0" Click="AdoptCompanyBlockButton_Click" />
<Button Style="{StaticResource SmallActionButton}" Content="两块都保留"
Margin="7,0,0,0" Click="AdoptBothBlockButton_Click" />
</StackPanel>
<StackPanel Grid.Row="6">
<TextBlock Text="合并结果(可直接编辑)" Foreground="{StaticResource AccentBrightBrush}"
FontSize="10" Margin="2,0,0,4" />
<TextBox Style="{StaticResource DiffTextBox}"
Text="{Binding ResultText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
MinHeight="62" MaxHeight="170" />
</StackPanel>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<Border x:Name="BinaryPanel" Visibility="Collapsed" CornerRadius="12"
Background="{StaticResource Surface2Brush}" BorderBrush="{StaticResource StrokeBrush}" BorderThickness="1" Padding="22">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" MaxWidth="570">
<TextBlock Text="该文件只能整文件采用" FontSize="18" FontWeight="SemiBold"
HorizontalAlignment="Center" />
<TextBlock x:Name="BinaryDetailText" Text="二进制或超大文本不支持逐块编辑。"
Foreground="{StaticResource TextSecondaryBrush}" TextWrapping="Wrap" TextAlignment="Center"
Margin="0,10,0,0" />
<TextBlock Text="请在上方选择“整文件采用个人”“整文件采用工作空间”或“结果删除文件”,再选择写入目标。"
Foreground="{StaticResource TextSecondaryBrush}" TextWrapping="Wrap" TextAlignment="Center"
Margin="0,8,0,0" />
</StackPanel>
</Border>
</Grid>
</Grid>
</Border>
</Grid>
<Border Grid.Row="3" BorderBrush="{StaticResource StrokeBrush}" BorderThickness="0,1,0,0" Background="#760B0E16">
<Grid Margin="20,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="190" />
</Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Center">
<TextBlock x:Name="FooterStatusText" Text="请选择差异文件" Foreground="{StaticResource TextPrimaryBrush}"
FontSize="11" TextTrimming="CharacterEllipsis" />
<TextBlock x:Name="UnresolvedText" Text="—" Foreground="{StaticResource TextSecondaryBrush}"
FontSize="9.5" Margin="0,3,0,0" />
</StackPanel>
<ComboBox x:Name="TargetBox" Grid.Column="1" Width="160" Height="36"
Style="{StaticResource InputComboBox}"
SelectionChanged="TargetBox_SelectionChanged">
<ComboBoxItem Content="写入工作空间" Tag="Company" IsSelected="True" />
<ComboBoxItem Content="写入个人" Tag="Personal" />
<ComboBoxItem Content="写入双方" Tag="Both" />
</ComboBox>
<Button x:Name="SaveButton" Grid.Column="3" Style="{StaticResource PrimaryButton}"
Height="42" Content="保存合并结果" IsEnabled="False" Click="SaveButton_Click" />
</Grid>
</Border>
</Grid>
</Border>
</Window>