mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-10-31 13:03:20 -07:00
style<CommitDetail>: add scrollbar for commit messages
This commit is contained in:
parent
12c33545bf
commit
8fa3a558a0
2 changed files with 29 additions and 31 deletions
|
@ -8,6 +8,27 @@ namespace SourceGit.Views.Controls {
|
|||
/// 变更状态图标
|
||||
/// </summary>
|
||||
class ChangeStatusIcon : FrameworkElement {
|
||||
public static readonly Brush[] Backgrounds = new Brush[] {
|
||||
Brushes.Transparent,
|
||||
new LinearGradientBrush(Color.FromRgb(238, 160, 14), Color.FromRgb(228, 172, 67), 90),
|
||||
new LinearGradientBrush(Color.FromRgb(47, 185, 47), Color.FromRgb(75, 189, 75), 90),
|
||||
new LinearGradientBrush(Colors.Tomato, Color.FromRgb(252, 165, 150), 90),
|
||||
new LinearGradientBrush(Colors.Orchid, Color.FromRgb(248, 161, 245), 90),
|
||||
new LinearGradientBrush(Color.FromRgb(238, 160, 14), Color.FromRgb(228, 172, 67), 90),
|
||||
new LinearGradientBrush(Color.FromRgb(238, 160, 14), Color.FromRgb(228, 172, 67), 90),
|
||||
new LinearGradientBrush(Color.FromRgb(47, 185, 47), Color.FromRgb(75, 189, 75), 90),
|
||||
};
|
||||
|
||||
public static readonly string[] Labels = new string[] {
|
||||
"?",
|
||||
"±",
|
||||
"+",
|
||||
"−",
|
||||
"➜",
|
||||
"❏",
|
||||
"U",
|
||||
"★",
|
||||
};
|
||||
|
||||
public static readonly DependencyProperty ChangeProperty = DependencyProperty.Register(
|
||||
"Change",
|
||||
|
@ -62,12 +83,12 @@ namespace SourceGit.Views.Controls {
|
|||
icon.background = Brushes.OrangeRed;
|
||||
txt = "!";
|
||||
} else {
|
||||
icon.background = GetBackground(icon.Change.WorkTree);
|
||||
txt = GetLabel(icon.Change.WorkTree);
|
||||
icon.background = Backgrounds[(int)icon.Change.WorkTree];
|
||||
txt = Labels[(int)icon.Change.WorkTree];
|
||||
}
|
||||
} else {
|
||||
icon.background = GetBackground(icon.Change.Index);
|
||||
txt = GetLabel(icon.Change.Index);
|
||||
icon.background = Backgrounds[(int)icon.Change.Index];
|
||||
txt = Labels[(int)icon.Change.Index];
|
||||
}
|
||||
|
||||
icon.label = new FormattedText(
|
||||
|
@ -81,31 +102,5 @@ namespace SourceGit.Views.Controls {
|
|||
|
||||
icon.InvalidateVisual();
|
||||
}
|
||||
|
||||
private static Brush GetBackground(Models.Change.Status status) {
|
||||
switch (status) {
|
||||
case Models.Change.Status.Modified: return new LinearGradientBrush(Color.FromRgb(238, 160, 14), Color.FromRgb(228, 172, 67), 90);
|
||||
case Models.Change.Status.Added: return new LinearGradientBrush(Color.FromRgb(47, 185, 47), Color.FromRgb(75, 189, 75), 90);
|
||||
case Models.Change.Status.Deleted: return new LinearGradientBrush(Colors.Tomato, Color.FromRgb(252, 165, 150), 90);
|
||||
case Models.Change.Status.Renamed: return new LinearGradientBrush(Colors.Orchid, Color.FromRgb(248, 161, 245), 90);
|
||||
case Models.Change.Status.Copied: return new LinearGradientBrush(Color.FromRgb(238, 160, 14), Color.FromRgb(228, 172, 67), 90);
|
||||
case Models.Change.Status.Unmerged: return new LinearGradientBrush(Color.FromRgb(238, 160, 14), Color.FromRgb(228, 172, 67), 90);
|
||||
case Models.Change.Status.Untracked: return new LinearGradientBrush(Color.FromRgb(47, 185, 47), Color.FromRgb(75, 189, 75), 90);
|
||||
default: return Brushes.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetLabel(Models.Change.Status status) {
|
||||
switch (status) {
|
||||
case Models.Change.Status.Modified: return "±";
|
||||
case Models.Change.Status.Added: return "+";
|
||||
case Models.Change.Status.Deleted: return "−";
|
||||
case Models.Change.Status.Renamed: return "➜";
|
||||
case Models.Change.Status.Copied: return "❏";
|
||||
case Models.Change.Status.Unmerged: return "U";
|
||||
case Models.Change.Status.Untracked: return "★";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,6 +170,9 @@
|
|||
BorderThickness="0"
|
||||
TextWrapping="Wrap"
|
||||
Margin="11,5,16,0"
|
||||
MaxHeight="80"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
|
||||
|
@ -193,7 +196,7 @@
|
|||
Grid.Column="1"
|
||||
x:Name="changeList"
|
||||
RowHeight="24"
|
||||
Margin="11,0,0,2">
|
||||
Margin="11,0,16,2">
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
|
||||
<EventSetter Event="ContextMenuOpening" Handler="OnChangeListContextMenuOpening"/>
|
||||
|
|
Loading…
Reference in a new issue