mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
optimize<Converters>: move converter resources to app scope
This commit is contained in:
parent
fcad602144
commit
9a9a0601ed
23 changed files with 97 additions and 113 deletions
|
@ -5,6 +5,7 @@
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="pack://application:,,,/Resources/Icons.xaml"/>
|
<ResourceDictionary Source="pack://application:,,,/Resources/Icons.xaml"/>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/Resources/Converters.xaml"/>
|
||||||
<ResourceDictionary Source="pack://application:,,,/Resources/Controls.xaml"/>
|
<ResourceDictionary Source="pack://application:,,,/Resources/Controls.xaml"/>
|
||||||
<ResourceDictionary Source="pack://application:,,,/Resources/Themes/Light.xaml"/>
|
<ResourceDictionary Source="pack://application:,,,/Resources/Themes/Light.xaml"/>
|
||||||
<ResourceDictionary Source="pack://application:,,,/Resources/Locales/en_US.xaml"/>
|
<ResourceDictionary Source="pack://application:,,,/Resources/Locales/en_US.xaml"/>
|
||||||
|
|
14
src/Resources/Converters.xaml
Normal file
14
src/Resources/Converters.xaml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:converters="clr-namespace:SourceGit.Views.Converters">
|
||||||
|
<converters:BoolToCollapsed x:Key="BoolToCollapsed"/>
|
||||||
|
<converters:BranchToName x:Key="BranchToName"/>
|
||||||
|
<converters:FontFamiliesToName x:Key="FontFamiliesToName"/>
|
||||||
|
<converters:IntToBookmarkBrush x:Key="IntToBookmarkBrush"/>
|
||||||
|
<converters:IntToBookmarkStrokeBrush x:Key="IntToBookmarkStrokeBrush"/>
|
||||||
|
<converters:InverseBool x:Key="InverseBool"/>
|
||||||
|
<converters:PureFileName x:Key="PureFileName"/>
|
||||||
|
<converters:PureFolderName x:Key="PureFolderName"/>
|
||||||
|
<converters:WindowStateToTitleBarHeight x:Key="WindowStateToTitleBarHeight"/>
|
||||||
|
</ResourceDictionary>
|
|
@ -68,6 +68,7 @@
|
||||||
<StreamGeometry x:Key="Icon.Tag">M177 156c-22 5-33 17-36 37c-10 57-33 258-13 278l445 445c23 23 61 23 84 0l246-246c23-23 23-61 0-84l-445-445C437 120 231 145 177 156zM331 344c-26 26-69 26-95 0c-26-26-26-69 0-95s69-26 95 0C357 276 357 318 331 344z</StreamGeometry>
|
<StreamGeometry x:Key="Icon.Tag">M177 156c-22 5-33 17-36 37c-10 57-33 258-13 278l445 445c23 23 61 23 84 0l246-246c23-23 23-61 0-84l-445-445C437 120 231 145 177 156zM331 344c-26 26-69 26-95 0c-26-26-26-69 0-95s69-26 95 0C357 276 357 318 331 344z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="Icon.Tag.Add">M683 537h-144v-142h-142V283H239a44 44 0 00-41 41v171a56 56 0 0014 34l321 321a41 41 0 0058 0l174-174a41 41 0 000-58zm-341-109a41 41 0 110-58a41 41 0 010 58zM649 284V142h-69v142h-142v68h142v142h69v-142h142v-68h-142z</StreamGeometry>
|
<StreamGeometry x:Key="Icon.Tag.Add">M683 537h-144v-142h-142V283H239a44 44 0 00-41 41v171a56 56 0 0014 34l321 321a41 41 0 0058 0l174-174a41 41 0 000-58zm-341-109a41 41 0 110-58a41 41 0 010 58zM649 284V142h-69v142h-142v68h142v142h69v-142h142v-68h-142z</StreamGeometry>
|
||||||
|
|
||||||
|
<StreamGeometry x:Key="Icon.Bookmark">M800 928l-512 0 0-704 224 0 0 292 113-86 111 86 0-292 128 0 0 640c0 35-29 64-64 64zM625 388l-81 64 0-260 160 0 0 260-79-64zM192 160l0 32c0 18 14 32 32 32l32 0 0 704-32 0c-35 0-64-29-64-64l0-704c0-35 29-64 64-64l576 0c24 0 44 13 55 32l-631 0c-18 0-32 14-32 32z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="Icon.VSCode">M719 85 388 417l-209-165L87 299v427l92 47 210-164L720 939 939 850V171zM186 610V412l104 104zm526 55L514 512l198-153z</StreamGeometry>
|
<StreamGeometry x:Key="Icon.VSCode">M719 85 388 417l-209-165L87 299v427l92 47 210-164L720 939 939 850V171zM186 610V412l104 104zm526 55L514 512l198-153z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="Icon.Sort">M426.7 554.7v-85.3h341.3v85.3h-341.3m0 256v-85.3h170.7v85.3h-170.7m0-512V213.3h512v85.3H426.7M256 725.3h106.7L213.3 874.7 64 725.3H170.7V298.7H64L213.3 149.3 362.7 298.7H256v426.7z</StreamGeometry>
|
<StreamGeometry x:Key="Icon.Sort">M426.7 554.7v-85.3h341.3v85.3h-341.3m0 256v-85.3h170.7v85.3h-170.7m0-512V213.3h512v85.3H426.7M256 725.3h106.7L213.3 874.7 64 725.3H170.7V298.7H64L213.3 149.3 362.7 298.7H256v426.7z</StreamGeometry>
|
||||||
<StreamGeometry x:Key="Icon.Ignores">M854 170c-189-189-495-189-684 0s-189 495 0 684 495 189 684 0 187-495 0-684zM213 706c-89-137-74-325 48-444 122-122 307-137 444-48L213 706zm106 105 493-493c89 137 74 325-48 444-120 122-307 137-444 48z</StreamGeometry>
|
<StreamGeometry x:Key="Icon.Ignores">M854 170c-189-189-495-189-684 0s-189 495 0 684 495 189 684 0 187-495 0-684zM213 706c-89-137-74-325 48-444 122-122 307-137 444-48L213 706zm106 105 493-493c89 137 74 325-48 444-120 122-307 137-444 48z</StreamGeometry>
|
||||||
|
|
|
@ -10,11 +10,11 @@ namespace SourceGit.Views.Converters {
|
||||||
Brushes.Transparent,
|
Brushes.Transparent,
|
||||||
Brushes.Red,
|
Brushes.Red,
|
||||||
Brushes.Orange,
|
Brushes.Orange,
|
||||||
Brushes.Yellow,
|
Brushes.Gold,
|
||||||
Brushes.ForestGreen,
|
Brushes.ForestGreen,
|
||||||
Brushes.Purple,
|
Brushes.DarkCyan,
|
||||||
Brushes.DeepSkyBlue,
|
Brushes.DeepSkyBlue,
|
||||||
Brushes.Magenta,
|
Brushes.Purple,
|
||||||
};
|
};
|
||||||
|
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
|
||||||
|
@ -26,4 +26,15 @@ namespace SourceGit.Views.Converters {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class IntToBookmarkStrokeBrush : IValueConverter {
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
|
||||||
|
var index = (int)value;
|
||||||
|
return index == 0 ? App.Current.FindResource("Brush.FG1") : Brushes.Transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,6 @@
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
||||||
xmlns:models="clr-namespace:SourceGit.Models"
|
xmlns:models="clr-namespace:SourceGit.Models"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
MinWidth="1024" MinHeight="768"
|
MinWidth="1024" MinHeight="768"
|
||||||
|
@ -16,11 +15,7 @@
|
||||||
Width="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Width, Mode=TwoWay}"
|
Width="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Width, Mode=TwoWay}"
|
||||||
Height="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Height, Mode=TwoWay}"
|
Height="{Binding Source={x:Static models:Preference.Instance}, Path=Window.Height, Mode=TwoWay}"
|
||||||
WindowState="{Binding Source={x:Static models:Preference.Instance}, Path=Window.State, Mode=TwoWay}"
|
WindowState="{Binding Source={x:Static models:Preference.Instance}, Path=Window.State, Mode=TwoWay}"
|
||||||
Closing="OnClosing">
|
Closing="OnClosing">
|
||||||
<Window.Resources>
|
|
||||||
<converters:WindowStateToTitleBarHeight x:Key="WindowStateToTitleBarHeight"/>
|
|
||||||
</Window.Resources>
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="{Binding ElementName=me, Path=WindowState, Converter={StaticResource WindowStateToTitleBarHeight}}"/>
|
<RowDefinition Height="{Binding ElementName=me, Path=WindowState, Converter={StaticResource WindowStateToTitleBarHeight}}"/>
|
||||||
|
|
|
@ -5,17 +5,12 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:models="clr-namespace:SourceGit.Models"
|
xmlns:models="clr-namespace:SourceGit.Models"
|
||||||
xmlns:validations="clr-namespace:SourceGit.Views.Validations"
|
xmlns:validations="clr-namespace:SourceGit.Views.Validations"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignWidth="800">
|
d:DesignWidth="800">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Resources>
|
|
||||||
<converters:InverseBool x:Key="InverseBool"/>
|
|
||||||
</Grid.Resources>
|
|
||||||
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="32"/>
|
<RowDefinition Height="32"/>
|
||||||
<RowDefinition Height="32"/>
|
<RowDefinition Height="32"/>
|
||||||
|
|
|
@ -6,15 +6,10 @@
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
xmlns:validations="clr-namespace:SourceGit.Views.Validations"
|
xmlns:validations="clr-namespace:SourceGit.Views.Validations"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignWidth="500">
|
d:DesignWidth="500">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Resources>
|
|
||||||
<converters:InverseBool x:Key="InverseBool"/>
|
|
||||||
</Grid.Resources>
|
|
||||||
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="32"/>
|
<RowDefinition Height="32"/>
|
||||||
<RowDefinition Height="32"/>
|
<RowDefinition Height="32"/>
|
||||||
|
|
|
@ -3,15 +3,10 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignWidth="500">
|
d:DesignWidth="500">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Resources>
|
|
||||||
<converters:InverseBool x:Key="InverseBool"/>
|
|
||||||
</Grid.Resources>
|
|
||||||
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="32"/>
|
<RowDefinition Height="32"/>
|
||||||
<RowDefinition Height="32"/>
|
<RowDefinition Height="32"/>
|
||||||
|
|
|
@ -5,14 +5,9 @@
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
xmlns:models="clr-namespace:SourceGit.Models"
|
xmlns:models="clr-namespace:SourceGit.Models"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignWidth="500">
|
d:DesignWidth="500">
|
||||||
<UserControl.Resources>
|
|
||||||
<converters:BranchToName x:Key="BranchToName"/>
|
|
||||||
</UserControl.Resources>
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="32"/>
|
<RowDefinition Height="32"/>
|
||||||
|
|
|
@ -5,12 +5,8 @@
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignWidth="500">
|
d:DesignWidth="500">
|
||||||
<UserControl.Resources>
|
|
||||||
<converters:BranchToName x:Key="BranchToName"/>
|
|
||||||
</UserControl.Resources>
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="32"/>
|
<RowDefinition Height="32"/>
|
||||||
|
|
|
@ -7,16 +7,12 @@
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:models="clr-namespace:SourceGit.Models"
|
xmlns:models="clr-namespace:SourceGit.Models"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
Title="{DynamicResource Text.Preference}"
|
Title="{DynamicResource Text.Preference}"
|
||||||
Width="500" Height="312">
|
Width="500" Height="312">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Resources>
|
|
||||||
<converters:FontFamiliesToName x:Key="FontFamiliesToName"/>
|
|
||||||
</Grid.Resources>
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="28"/>
|
<RowDefinition Height="28"/>
|
||||||
<RowDefinition Height="1"/>
|
<RowDefinition Height="1"/>
|
||||||
|
|
13
src/Views/Widgets/Bookmark.xaml
Normal file
13
src/Views/Widgets/Bookmark.xaml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<UserControl x:Class="SourceGit.Views.Widgets.Bookmark"
|
||||||
|
x:Name="me"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Path
|
||||||
|
Data="{StaticResource Icon.Bookmark}"
|
||||||
|
Stroke="{Binding Color, ElementName=me, Converter={StaticResource IntToBookmarkStrokeBrush}}"
|
||||||
|
Fill="{Binding Color, ElementName=me, Converter={StaticResource IntToBookmarkBrush}}"/>
|
||||||
|
</UserControl>
|
33
src/Views/Widgets/Bookmark.xaml.cs
Normal file
33
src/Views/Widgets/Bookmark.xaml.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace SourceGit.Views.Widgets {
|
||||||
|
/// <summary>
|
||||||
|
/// 仓库书签
|
||||||
|
/// </summary>
|
||||||
|
public partial class Bookmark : UserControl {
|
||||||
|
/// <summary>
|
||||||
|
/// 颜色属性
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty ColorProperty = DependencyProperty.Register(
|
||||||
|
"Color",
|
||||||
|
typeof(int),
|
||||||
|
typeof(Bookmark),
|
||||||
|
new PropertyMetadata(0));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 颜色
|
||||||
|
/// </summary>
|
||||||
|
public int Color {
|
||||||
|
get { return (int)GetValue(ColorProperty); }
|
||||||
|
set { SetValue(ColorProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构造函数
|
||||||
|
/// </summary>
|
||||||
|
public Bookmark() {
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,15 +4,11 @@
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
xmlns:models="clr-namespace:SourceGit.Models"
|
xmlns:models="clr-namespace:SourceGit.Models"
|
||||||
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<converters:PureFileName x:Key="PureFileName"/>
|
|
||||||
<converters:PureFolderName x:Key="PureFolderName"/>
|
|
||||||
|
|
||||||
<Style x:Key="Style.DataGridRow.Changes" TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
|
<Style x:Key="Style.DataGridRow.Changes" TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
|
||||||
<EventSetter Event="RequestBringIntoView" Handler="OnRequestBringIntoView"/>
|
<EventSetter Event="RequestBringIntoView" Handler="OnRequestBringIntoView"/>
|
||||||
<EventSetter Event="ContextMenuOpening" Handler="OnDataGridContextMenuOpening"/>
|
<EventSetter Event="ContextMenuOpening" Handler="OnDataGridContextMenuOpening"/>
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:models="clr-namespace:SourceGit.Models"
|
xmlns:models="clr-namespace:SourceGit.Models"
|
||||||
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
@ -15,11 +14,6 @@
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Grid.Resources>
|
|
||||||
<converters:InverseBool x:Key="InverseBool"/>
|
|
||||||
<converters:BoolToCollapsed x:Key="BoolToCollapsed"/>
|
|
||||||
</Grid.Resources>
|
|
||||||
|
|
||||||
<!-- Toolbar -->
|
<!-- Toolbar -->
|
||||||
<Border Grid.Row="0" BorderBrush="{DynamicResource Brush.Border0}" BorderThickness="0,0,0,1" Background="{DynamicResource Brush.ToolBar}">
|
<Border Grid.Row="0" BorderBrush="{DynamicResource Brush.Border0}" BorderThickness="0,0,0,1" Background="{DynamicResource Brush.ToolBar}">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
@ -157,10 +151,6 @@
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Grid.Resources>
|
|
||||||
<converters:BoolToCollapsed x:Key="BoolToCollapsed"/>
|
|
||||||
</Grid.Resources>
|
|
||||||
|
|
||||||
<!-- Workspace -->
|
<!-- Workspace -->
|
||||||
<TextBlock Grid.Row="0" Style="{DynamicResource Style.TextBlock.Group}" Text="{DynamicResource Text.Dashboard.Workspace}"/>
|
<TextBlock Grid.Row="0" Style="{DynamicResource Style.TextBlock.Group}" Text="{DynamicResource Text.Dashboard.Workspace}"/>
|
||||||
<ListView Grid.Row="1" x:Name="workspace" SelectionMode="Single" SelectionChanged="OnPageSelectionChanged">
|
<ListView Grid.Row="1" x:Name="workspace" SelectionMode="Single" SelectionChanged="OnPageSelectionChanged">
|
||||||
|
|
|
@ -4,16 +4,11 @@
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
xmlns:models="clr-namespace:SourceGit.Models"
|
xmlns:models="clr-namespace:SourceGit.Models"
|
||||||
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<Grid x:Name="layout">
|
<Grid x:Name="layout">
|
||||||
<Grid.Resources>
|
|
||||||
<converters:BoolToCollapsed x:Key="BoolToCollapsed"/>
|
|
||||||
</Grid.Resources>
|
|
||||||
|
|
||||||
<Border x:Name="commitListPanel" Background="{DynamicResource Brush.Contents}">
|
<Border x:Name="commitListPanel" Background="{DynamicResource Brush.Contents}">
|
||||||
<Grid ClipToBounds="True">
|
<Grid ClipToBounds="True">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:SourceGit.Views.Widgets"
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="32" d:DesignWidth="800">
|
d:DesignHeight="32" d:DesignWidth="800">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
@ -48,13 +48,7 @@
|
||||||
BorderBrush="{DynamicResource Brush.Border0}"
|
BorderBrush="{DynamicResource Brush.Border0}"
|
||||||
ItemsSource="{Binding ElementName=me, Path=Tabs}"
|
ItemsSource="{Binding ElementName=me, Path=Tabs}"
|
||||||
WindowChrome.IsHitTestVisibleInChrome="True"
|
WindowChrome.IsHitTestVisibleInChrome="True"
|
||||||
SelectionChanged="SelectionChanged">
|
SelectionChanged="SelectionChanged">
|
||||||
|
|
||||||
<ListBox.Resources>
|
|
||||||
<converters:IntToBookmarkBrush x:Key="IntToBookmarkBrush"/>
|
|
||||||
<converters:BoolToCollapsed x:Key="BoolToCollapsed"/>
|
|
||||||
</ListBox.Resources>
|
|
||||||
|
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<VirtualizingStackPanel Orientation="Horizontal"/>
|
<VirtualizingStackPanel Orientation="Horizontal"/>
|
||||||
|
@ -76,15 +70,12 @@
|
||||||
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||||||
<Border x:Name="Border" Background="Transparent" BorderBrush="Transparent" BorderThickness="1,1,1,0" CornerRadius="6,6,0,0">
|
<Border x:Name="Border" Background="Transparent" BorderBrush="Transparent" BorderThickness="1,1,1,0" CornerRadius="6,6,0,0">
|
||||||
<Grid x:Name="Contents" Width="200" VerticalAlignment="Center" Opacity=".5" ToolTip="{Binding Tooltip}">
|
<Grid x:Name="Contents" Width="200" VerticalAlignment="Center" Opacity=".5" ToolTip="{Binding Tooltip}">
|
||||||
<Path
|
<local:Bookmark
|
||||||
Width="8" Margin="8,0,0,0"
|
Width="14" Height="14"
|
||||||
HorizontalAlignment="Left"
|
Margin="8,0,0,0"
|
||||||
Fill="{Binding Bookmark, Converter={StaticResource IntToBookmarkBrush}}"
|
HorizontalAlignment="Left"
|
||||||
Visibility="{Binding IsRepository, Converter={StaticResource BoolToCollapsed}}">
|
Color="{Binding Bookmark}"
|
||||||
<Path.Data>
|
Visibility="{Binding IsRepository, Converter={StaticResource BoolToCollapsed}}"/>
|
||||||
<EllipseGeometry Center="0,0" RadiusX="14" RadiusY="14"/>
|
|
||||||
</Path.Data>
|
|
||||||
</Path>
|
|
||||||
|
|
||||||
<TextBlock Margin="32,0" HorizontalAlignment="Stretch" TextAlignment="Center" Text="{Binding Title}"/>
|
<TextBlock Margin="32,0" HorizontalAlignment="Stretch" TextAlignment="Center" Text="{Binding Title}"/>
|
||||||
|
|
||||||
|
|
|
@ -353,13 +353,8 @@ namespace SourceGit.Views.Widgets {
|
||||||
var bookmark = new MenuItem();
|
var bookmark = new MenuItem();
|
||||||
bookmark.Header = App.Text("PageTabBar.Tab.Bookmark");
|
bookmark.Header = App.Text("PageTabBar.Tab.Bookmark");
|
||||||
for (int i = 0; i < Converters.IntToBookmarkBrush.COLORS.Length; i++) {
|
for (int i = 0; i < Converters.IntToBookmarkBrush.COLORS.Length; i++) {
|
||||||
var icon = new System.Windows.Shapes.Path();
|
|
||||||
icon.Data = new EllipseGeometry(new Point(0, 0), 12, 12);
|
|
||||||
icon.Fill = Converters.IntToBookmarkBrush.COLORS[i];
|
|
||||||
icon.Width = 12;
|
|
||||||
|
|
||||||
var mark = new MenuItem();
|
var mark = new MenuItem();
|
||||||
mark.Icon = icon;
|
mark.Icon = new Bookmark() { Color = i, Width = 14, Height = 14 };
|
||||||
mark.Header = $"{i}";
|
mark.Header = $"{i}";
|
||||||
|
|
||||||
var refIdx = i;
|
var refIdx = i;
|
||||||
|
|
|
@ -4,14 +4,12 @@
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<Style x:Key="Style.DataGridRow.TextPreview" TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
|
<Style x:Key="Style.DataGridRow.TextPreview" TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
|
||||||
<EventSetter Event="RequestBringIntoView" Handler="OnRequestBringIntoView"/>
|
<EventSetter Event="RequestBringIntoView" Handler="OnRequestBringIntoView"/>
|
||||||
</Style>
|
</Style>
|
||||||
<converters:PureFileName x:Key="PureFileName"/>
|
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|
|
@ -3,16 +3,16 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:SourceGit.Views.Widgets"
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:models="clr-namespace:SourceGit.Models"
|
xmlns:models="clr-namespace:SourceGit.Models"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="800" d:DesignWidth="800"
|
d:DesignHeight="800" d:DesignWidth="800"
|
||||||
UseLayoutRounding="True">
|
UseLayoutRounding="True">
|
||||||
<Grid AllowDrop="True" Drop="OnPageDrop">
|
<Grid AllowDrop="True" Drop="OnPageDrop">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="36"/>
|
<RowDefinition Height="36"/>
|
||||||
<RowDefinition Height="48"/>
|
<RowDefinition Height="56"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
@ -92,11 +92,7 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Repositories List -->
|
<!-- Repositories List -->
|
||||||
<Grid Grid.Row="2" Width="600" HorizontalAlignment="Center" Margin="0,0,0,8" AllowDrop="True" Drop="OnPageDrop">
|
<Grid Grid.Row="2" Width="600" HorizontalAlignment="Center" Margin="0,0,0,8" AllowDrop="True" Drop="OnPageDrop">
|
||||||
<Grid.Resources>
|
|
||||||
<converters:IntToBookmarkBrush x:Key="IntToBookmarkBrush"/>
|
|
||||||
</Grid.Resources>
|
|
||||||
|
|
||||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||||
<ItemsControl x:Name="repoList">
|
<ItemsControl x:Name="repoList">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
|
@ -121,16 +117,11 @@
|
||||||
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}"
|
||||||
Background="{DynamicResource Brush.Popup}"
|
Background="{DynamicResource Brush.Popup}"
|
||||||
UseLayoutRounding="True"
|
UseLayoutRounding="True"
|
||||||
SnapsToDevicePixels="True">
|
SnapsToDevicePixels="True"/>
|
||||||
<Path
|
|
||||||
Width="14" Height="14"
|
|
||||||
Data="M 1,0 L8,0 L1,7 z"
|
|
||||||
HorizontalAlignment="Left" VerticalAlignment="Top"
|
|
||||||
Fill="{Binding Bookmark, Converter={StaticResource IntToBookmarkBrush}}"/>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<StackPanel Grid.Column="0" Margin="8,0" Orientation="Horizontal">
|
<StackPanel Grid.Column="0" Margin="8,0" Orientation="Horizontal">
|
||||||
<TextBlock Text="{Binding Name}" FontSize="12pt" Margin="4,0,0,0" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" />
|
<local:Bookmark Width="16" Height="16" Color="{Binding Bookmark}"/>
|
||||||
|
<TextBlock Text="{Binding Name}" FontSize="12pt" Margin="8,0,0,0" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/>
|
||||||
<TextBlock Text="{Binding Path}" FontSize="10pt" Margin="8,0,0,0" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" Foreground="{DynamicResource Brush.FG2}"/>
|
<TextBlock Text="{Binding Path}" FontSize="10pt" Margin="8,0,0,0" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|
|
@ -131,13 +131,8 @@ namespace SourceGit.Views.Widgets {
|
||||||
var bookmark = new MenuItem();
|
var bookmark = new MenuItem();
|
||||||
bookmark.Header = App.Text("PageTabBar.Tab.Bookmark");
|
bookmark.Header = App.Text("PageTabBar.Tab.Bookmark");
|
||||||
for (int i = 0; i < Converters.IntToBookmarkBrush.COLORS.Length; i++) {
|
for (int i = 0; i < Converters.IntToBookmarkBrush.COLORS.Length; i++) {
|
||||||
var icon = new System.Windows.Shapes.Path();
|
|
||||||
icon.Data = new EllipseGeometry(new Point(0, 0), 12, 12);
|
|
||||||
icon.Fill = Converters.IntToBookmarkBrush.COLORS[i];
|
|
||||||
icon.Width = 12;
|
|
||||||
|
|
||||||
var mark = new MenuItem();
|
var mark = new MenuItem();
|
||||||
mark.Icon = icon;
|
mark.Icon = new Bookmark() { Color = i, Width = 14, Height = 14 };
|
||||||
mark.Header = $"{i}";
|
mark.Header = $"{i}";
|
||||||
|
|
||||||
var refIdx = i;
|
var refIdx = i;
|
||||||
|
|
|
@ -5,15 +5,11 @@
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:converter="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
xmlns:models="clr-namespace:SourceGit.Models"
|
xmlns:models="clr-namespace:SourceGit.Models"
|
||||||
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
||||||
xmlns:validations="clr-namespace:SourceGit.Views.Validations"
|
xmlns:validations="clr-namespace:SourceGit.Views.Validations"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<UserControl.Resources>
|
|
||||||
<converter:BoolToCollapsed x:Key="BoolToCollapsed"/>
|
|
||||||
</UserControl.Resources>
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="300" MinWidth="300"/>
|
<ColumnDefinition Width="300" MinWidth="300"/>
|
||||||
|
|
|
@ -5,13 +5,10 @@
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||||
xmlns:converters="clr-namespace:SourceGit.Views.Converters"
|
|
||||||
xmlns:models="clr-namespace:SourceGit.Models"
|
xmlns:models="clr-namespace:SourceGit.Models"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<converters:PureFileName x:Key="PureFileName"/>
|
|
||||||
<converters:PureFolderName x:Key="PureFolderName"/>
|
|
||||||
<Style x:Key="Style.DataGridRow.Change" TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
|
<Style x:Key="Style.DataGridRow.Change" TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource Style.DataGridRow}">
|
||||||
<EventSetter Event="RequestBringIntoView" Handler="OnRequestBringIntoView"/>
|
<EventSetter Event="RequestBringIntoView" Handler="OnRequestBringIntoView"/>
|
||||||
<EventSetter Event="ContextMenuOpening" Handler="OnDataGridContextMenuOpening"/>
|
<EventSetter Event="ContextMenuOpening" Handler="OnDataGridContextMenuOpening"/>
|
||||||
|
|
Loading…
Reference in a new issue