mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
style<DiffViewer>: using rectange instead of datagrid.gridlines for diff viewer
This commit is contained in:
parent
724908eaa8
commit
017c083c52
2 changed files with 36 additions and 2 deletions
|
@ -67,6 +67,9 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
<Grid Grid.Row="1" x:Name="editorLines">
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Grid Grid.Row="1" x:Name="editorContainer" SizeChanged="OnSizeChanged">
|
<Grid Grid.Row="1" x:Name="editorContainer" SizeChanged="OnSizeChanged">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
|
|
|
@ -7,6 +7,7 @@ using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Shapes;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace SourceGit.UI {
|
namespace SourceGit.UI {
|
||||||
|
@ -173,6 +174,21 @@ namespace SourceGit.UI {
|
||||||
editor.SetValue(Grid.ColumnSpanProperty, 2);
|
editor.SetValue(Grid.ColumnSpanProperty, 2);
|
||||||
editorContainer.Children.Add(editor);
|
editorContainer.Children.Add(editor);
|
||||||
editors.Add(editor);
|
editors.Add(editor);
|
||||||
|
|
||||||
|
editorLines.Children.Clear();
|
||||||
|
editorLines.ColumnDefinitions.Clear();
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
editorLines.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(lineNumberWidth) });
|
||||||
|
|
||||||
|
var split = new Rectangle();
|
||||||
|
split.Width = 1;
|
||||||
|
split.Fill = FindResource("Brush.Border2") as Brush;
|
||||||
|
split.HorizontalAlignment = HorizontalAlignment.Right;
|
||||||
|
Grid.SetColumn(split, i);
|
||||||
|
|
||||||
|
editorLines.Children.Add(split);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var oldSideBlocks = new List<ChangeBlock>();
|
var oldSideBlocks = new List<ChangeBlock>();
|
||||||
|
@ -223,6 +239,7 @@ namespace SourceGit.UI {
|
||||||
oldEditor.Columns[0].Width = new DataGridLength(lineNumberWidth, DataGridLengthUnitType.Pixel);
|
oldEditor.Columns[0].Width = new DataGridLength(lineNumberWidth, DataGridLengthUnitType.Pixel);
|
||||||
oldEditor.Columns[1].MinWidth = minWidth;
|
oldEditor.Columns[1].MinWidth = minWidth;
|
||||||
oldEditor.ItemsSource = oldSideBlocks;
|
oldEditor.ItemsSource = oldSideBlocks;
|
||||||
|
|
||||||
var newEditor = CreateTextEditor(new string[] { "NewLine" });
|
var newEditor = CreateTextEditor(new string[] { "NewLine" });
|
||||||
newEditor.SetValue(Grid.ColumnProperty, 1);
|
newEditor.SetValue(Grid.ColumnProperty, 1);
|
||||||
newEditor.ContextMenuOpening += OnTextChangeContextMenuOpening;
|
newEditor.ContextMenuOpening += OnTextChangeContextMenuOpening;
|
||||||
|
@ -236,6 +253,22 @@ namespace SourceGit.UI {
|
||||||
|
|
||||||
editors.Add(oldEditor);
|
editors.Add(oldEditor);
|
||||||
editors.Add(newEditor);
|
editors.Add(newEditor);
|
||||||
|
|
||||||
|
editorLines.Children.Clear();
|
||||||
|
editorLines.ColumnDefinitions.Clear();
|
||||||
|
editorLines.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(lineNumberWidth) });
|
||||||
|
editorLines.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
|
||||||
|
editorLines.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(lineNumberWidth) });
|
||||||
|
editorLines.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
var split = new Rectangle();
|
||||||
|
split.Width = 1;
|
||||||
|
split.Fill = FindResource("Brush.Border2") as Brush;
|
||||||
|
split.HorizontalAlignment = HorizontalAlignment.Right;
|
||||||
|
Grid.SetColumn(split, i);
|
||||||
|
editorLines.Children.Add(split);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,8 +405,6 @@ namespace SourceGit.UI {
|
||||||
var grid = new DataGrid();
|
var grid = new DataGrid();
|
||||||
grid.SetValue(Grid.RowProperty, 1);
|
grid.SetValue(Grid.RowProperty, 1);
|
||||||
grid.RowHeight = 16.0;
|
grid.RowHeight = 16.0;
|
||||||
grid.GridLinesVisibility = DataGridGridLinesVisibility.Vertical;
|
|
||||||
grid.VerticalGridLinesBrush = FindResource("Brush.Border2") as Brush;
|
|
||||||
grid.FrozenColumnCount = lineNumbers.Length;
|
grid.FrozenColumnCount = lineNumbers.Length;
|
||||||
grid.ContextMenuOpening += OnTextChangeContextMenuOpening;
|
grid.ContextMenuOpening += OnTextChangeContextMenuOpening;
|
||||||
grid.RowStyle = FindResource("Style.DataGridRow.TextChange") as Style;
|
grid.RowStyle = FindResource("Style.DataGridRow.TextChange") as Style;
|
||||||
|
|
Loading…
Reference in a new issue