mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08: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>
|
/// </summary>
|
||||||
class ChangeStatusIcon : FrameworkElement {
|
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(
|
public static readonly DependencyProperty ChangeProperty = DependencyProperty.Register(
|
||||||
"Change",
|
"Change",
|
||||||
|
@ -62,12 +83,12 @@ namespace SourceGit.Views.Controls {
|
||||||
icon.background = Brushes.OrangeRed;
|
icon.background = Brushes.OrangeRed;
|
||||||
txt = "!";
|
txt = "!";
|
||||||
} else {
|
} else {
|
||||||
icon.background = GetBackground(icon.Change.WorkTree);
|
icon.background = Backgrounds[(int)icon.Change.WorkTree];
|
||||||
txt = GetLabel(icon.Change.WorkTree);
|
txt = Labels[(int)icon.Change.WorkTree];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
icon.background = GetBackground(icon.Change.Index);
|
icon.background = Backgrounds[(int)icon.Change.Index];
|
||||||
txt = GetLabel(icon.Change.Index);
|
txt = Labels[(int)icon.Change.Index];
|
||||||
}
|
}
|
||||||
|
|
||||||
icon.label = new FormattedText(
|
icon.label = new FormattedText(
|
||||||
|
@ -81,31 +102,5 @@ namespace SourceGit.Views.Controls {
|
||||||
|
|
||||||
icon.InvalidateVisual();
|
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"
|
BorderThickness="0"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
Margin="11,5,16,0"
|
Margin="11,5,16,0"
|
||||||
|
MaxHeight="80"
|
||||||
|
HorizontalScrollBarVisibility="Disabled"
|
||||||
|
VerticalScrollBarVisibility="Auto"
|
||||||
VerticalAlignment="Top"/>
|
VerticalAlignment="Top"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
@ -193,7 +196,7 @@
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
x:Name="changeList"
|
x:Name="changeList"
|
||||||
RowHeight="24"
|
RowHeight="24"
|
||||||
Margin="11,0,0,2">
|
Margin="11,0,16,2">
|
||||||
<DataGrid.RowStyle>
|
<DataGrid.RowStyle>
|
||||||
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
|
<Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
|
||||||
<EventSetter Event="ContextMenuOpening" Handler="OnChangeListContextMenuOpening"/>
|
<EventSetter Event="ContextMenuOpening" Handler="OnChangeListContextMenuOpening"/>
|
||||||
|
|
Loading…
Reference in a new issue